SILENT KILLERPanel

Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > extendify > > src > > Shared > state


Operation   : Linux premium131.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
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//ameliagraphics.com/wp-content/plugins/extendify//src//Shared/state

NameTypeSizeLast ModifiedActions
activity.js File 1253 bytes October 08 2024 14:19:28.
ai-consent.js File 1515 bytes May 19 2025 16:47:28.
site-profile.js File 1551 bytes March 13 2025 21:10:44.
unsplash-cache.js File 661 bytes March 13 2025 21:10:44.

Reading File: /home/codekrsu//ameliagraphics.com/wp-content/plugins/extendify//src//Shared/state/site-profile.js

import apiFetch from '@wordpress/api-fetch';
import { safeParseJson } from '@shared/lib/parsing';
import { create } from 'zustand';
import { devtools, persist, createJSONStorage } from 'zustand/middleware';

const generalSiteProfile =
	safeParseJson(window.extSharedData.userData.userSelectionData)?.state
		?.siteProfile || {};

const initialState = {
	siteProfile: {
		aiDescription:
			window.extSharedData?.siteProfile?.aiDescription ||
			generalSiteProfile?.aiDescription,
		aiSiteType: generalSiteProfile?.aiSiteType,
		aiSiteCategory: generalSiteProfile?.aiSiteCategory,
		aiKeywords: generalSiteProfile?.aiKeywords,
	},
};

const state = (set) => ({
	...initialState,
	setSiteProfile(data) {
		const siteProfile = Object.assign(
			{
				aiSiteType: initialState?.siteProfile?.aiSiteType,
				aiSiteCategory: initialState?.siteProfile?.aiSiteCategory,
				aiDescription: initialState?.siteProfile?.aiDescription,
				aiKeywords: initialState?.siteProfile?.aiKeywords,
			},
			data || {},
		);

		set({ siteProfile });
	},
	resetState() {
		set(initialState);
	},
});

const path = '/extendify/v1/shared/site-profile';
const storage = {
	getItem: async () => await apiFetch({ path }),
	setItem: async (_name, state) => {
		await apiFetch({
			path,
			method: 'POST',
			data: { value: safeParseJson(state)?.state?.siteProfile || {} },
		});
	},
};

export const useSiteProfileStore = create(
	persist(devtools(state, { name: 'Extendify Site Profile' }), {
		storage: createJSONStorage(() => storage),
		skipHydration: false,
	}),
	state,
);

SILENT KILLER Tool