????JFIF??x?x????'
| Server IP : 104.21.30.238 / Your IP : 216.73.216.87 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/wp-content/themes/zakra/assets/js/dashboard/store/ |
Upload File : |
import { createReduxStore, register } from '@wordpress/data';
import { localized } from '../utils/global';
export const ZAKRA_DASHBOARD_STORE = 'zakra/dashboard';
type RootState = {
plugins: typeof localized.plugins;
themes: typeof localized.themes;
};
const INITIAL_STATE: RootState = {
plugins: localized.plugins,
themes: localized.themes,
};
export const dashboardStore = createReduxStore(ZAKRA_DASHBOARD_STORE, {
reducer(
state = INITIAL_STATE,
action: {
type: string;
payload: {
[key in keyof typeof localized.plugins]:
| 'active'
| 'inactive'
| 'not-installed';
};
},
) {
switch (action.type) {
case 'UPDATE_PLUGINS_STATUS':
return {
...state,
plugins: {
...state.plugins,
...action.payload,
},
};
case 'UPDATE_THEMES_STATUS':
return {
...state,
themes: {
...state.themes,
...action.payload,
},
};
}
return state;
},
actions: {
setPluginsStatus(plugins: {
[key in keyof typeof localized.plugins]:
| 'active'
| 'inactive'
| 'not-installed';
}) {
return {
type: 'UPDATE_PLUGINS_STATUS',
payload: plugins,
};
},
setThemesStatus(themes: {
[key in keyof typeof localized.themes]:
| 'active'
| 'inactive'
| 'not-installed';
}) {
return {
type: 'UPDATE_THEMES_STATUS',
payload: themes,
};
},
},
selectors: {
getPluginsStatus(state: RootState) {
return state.plugins;
},
getPluginStatus(state: RootState, plugin: keyof typeof localized.plugins) {
return state.plugins[plugin];
},
getThemesStatus(state: RootState) {
return state.themes;
},
getThemeStatus(state: RootState, theme: keyof typeof localized.themes) {
return state.themes[theme];
},
},
});
register(dashboardStore);