# extendify/3.0.5/src/HelpCenter/state/user-selections.js

Extendify, version 3.0.5. 40 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.0.5/code/src/HelpCenter/state/user-selections.js
- Raw: https://pluginprobe.com/plugins/extendify/3.0.5/raw/src/HelpCenter/state/user-selections.js
- Modified: 2026-02-26T23:48:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.0.5/code/src/HelpCenter/state/user-selections.js#L10-L20`.

```javascript
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 = {
	siteType: {
		slug: '0default',
		name: 'Default',
	},
	siteInformation: {
		title: undefined,
	},
	style: null,
	pages: [],
	sitePlugins: [],
	// initialize the state with default values
	...(safeParseJson(window.extSharedData.launchDataLegacy)?.state ?? {}),
};

const state = () => ({
	...startingState,
	// Add methods here
});

const path = '/extendify/v1/shared/user-selections-data';
const storage = {
	getItem: async () => await apiFetch({ path }),
	setItem: async (_name, state) =>
		await apiFetch({ path, method: 'POST', data: { state } }),
};

export const useUserSelectionStore = create(
	persist(devtools(state, { name: 'Extendify User Selections' }), {
		storage: createJSONStorage(() => storage),
		skipHydration: true,
	}),
	state,
);

```
