????JFIF??x?x????'
Server IP : 104.21.32.1 / Your IP : 216.73.216.150 Web Server : LiteSpeed System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : tempvsty ( 647) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/./././tempvsty/eaabusiness.com/custom/wp-content/plugins/extendify/src/Agent/state/ |
Upload File : |
import { isInTheFuture } from '@wordpress/date'; import { create } from 'zustand'; import { persist, devtools } from 'zustand/middleware'; const DEFAULT_HEIGHT = 510; const startingPosition = { x: 100, y: window.innerHeight - DEFAULT_HEIGHT, width: 390, height: DEFAULT_HEIGHT, }; export const useGlobalStore = create()( persist( devtools( (set, get) => ({ retryAfter: undefined, open: true, seenToolTips: [], showSuggestions: true, // e.g. floating, docked-left, docked-right ? mode: 'floating', ...startingPosition, queuedTour: null, scratch: {}, isMobile: window.innerWidth < 768, setIsMobile: (isMobile) => set({ isMobile }), queueTourForRedirect: (tour) => set({ queuedTour: tour }), clearQueuedTour: () => set({ queuedTour: null }), setOpen: (open) => { if (!open) get().resetPosition(); set({ open }); }, setShowSuggestions: (show) => set({ showSuggestions: show }), toggleOpen: () => set((state) => { if (!state.open) { get().resetPosition(); } return { open: !state.open }; }), setSize: (width, height) => set({ width, height }), setPosition: (x, y) => set({ x, y }), resetPosition: () => set({ ...startingPosition, y: window.innerHeight - DEFAULT_HEIGHT, }), setSeenToolTip: (name) => set((state) => { if (state.seenToolTips.includes(name)) return state; return { seenToolTips: [...state.seenToolTips, name] }; }), 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) => { // eslint-disable-next-line const { [key]: _, ...rest } = state.scratch; return { scratch: rest }; }), }), { name: 'Extendify Agent Global' }, ), { name: `extendify-agent-global-${window.extSharedData.siteId}`, partialize: (state) => { // eslint-disable-next-line const { showSuggestions, isMobile, ...rest } = state; return { ...rest }; }, }, ), );