403Webshell
Server IP : 66.29.153.156  /  Your IP : 216.73.217.22
Web Server : LiteSpeed
System : Linux premium322.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User : lastyfjz ( 1521)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/lastyfjz/././unicitys.com/wp-content/plugins/extendify/src/Agent/state/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/lastyfjz/././unicitys.com/wp-content/plugins/extendify/src/Agent/state/domain-activities.js
import { safeParseJson } from '@shared/lib/parsing';
import apiFetch from '@wordpress/api-fetch';
import { create } from 'zustand';
import { createJSONStorage, devtools, persist } from 'zustand/middleware';

// Seed from the server so we read-modify-write the full activity list and
// don't clobber what Assist already stored in the same option.
const initialState = {
	activities: [],
	...(safeParseJson(
		window.extAgentData?.userData?.domainsRecommendationsActivities,
	)?.state ?? {}),
};

const state = (set, get) => ({
	...initialState,
	setDomainActivity: ({
		domain,
		position,
		type = 'primary',
		action = 'clicked',
	}) => {
		set({
			activities: [
				...get().activities,
				{
					domain: domain?.toLowerCase(),
					position,
					type,
					action,
					date: new Date().toISOString(),
				},
			],
		});
	},
});

const debounce = (func, delay) => {
	let timeoutId;
	return (...params) => {
		clearTimeout(timeoutId);
		timeoutId = setTimeout(() => func(...params), delay);
	};
};

// Same endpoint/option as Assist so both surfaces feed one list.
const path = '/extendify/v1/assists/domains-recommendations-activities';
const storage = {
	getItem: async () => await apiFetch({ path }),
	setItem: debounce(
		async (_name, state) =>
			await apiFetch({ path, method: 'POST', data: { state } }),
		500,
	),
};

export const useDomainActivities = create(
	persist(devtools(state, { name: 'Extendify Agent Domain Activities' }), {
		storage: createJSONStorage(() => storage),
		skipHydration: true,
	}),
);

Youez - 2016 - github.com/yon3zu
LinuXploit