@admin-layout/client 12.2.4-alpha.1 → 12.2.4-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/ApplicationErrorHandlerCommon.d.ts +1 -1
- package/lib/components/ApplicationErrorHandlerCommon.d.ts.map +1 -1
- package/lib/components/ApplicationErrorHandlerCommon.js +29 -15
- package/lib/components/ApplicationErrorHandlerCommon.js.map +1 -1
- package/lib/hooks/useLayoutSettings.d.ts.map +1 -1
- package/lib/hooks/useLayoutSettings.js +34 -20
- package/lib/hooks/useLayoutSettings.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.native.js +1 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/menuUtils.d.ts +3 -2
- package/lib/utils/menuUtils.d.ts.map +1 -1
- package/lib/utils/menuUtils.js +9 -3
- package/lib/utils/menuUtils.js.map +1 -1
- package/lib/utils/settingsStorage.d.ts +53 -0
- package/lib/utils/settingsStorage.d.ts.map +1 -0
- package/lib/utils/settingsStorage.js +117 -0
- package/lib/utils/settingsStorage.js.map +1 -0
- package/lib/utils/storage.d.ts +9 -0
- package/lib/utils/storage.d.ts.map +1 -0
- package/lib/utils/storage.js +31 -0
- package/lib/utils/storage.js.map +1 -0
- package/package.json +3 -3
|
@@ -31,6 +31,6 @@ type IApplicationErrorSlotType = (props: {
|
|
|
31
31
|
* @param [RendererComponent] IRendererComponentType
|
|
32
32
|
* @returns ReactNode
|
|
33
33
|
*/
|
|
34
|
-
export declare
|
|
34
|
+
export declare function ApplicationErrorHandlerCommon(FallbackComponent: any, ApplicationErrorSlot?: IApplicationErrorSlotType, RendererComponent?: IRendererComponentType): ({ plugins, children }: ApplicationErrorHandlerCommonProps) => ReactElement;
|
|
35
35
|
export {};
|
|
36
36
|
//# sourceMappingURL=ApplicationErrorHandlerCommon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationErrorHandlerCommon.d.ts","sourceRoot":"","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD;;;GAGG;AACH,UAAU,kCAAkC;IAC1C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,KAAK,sBAAsB,GAAG,CAAC,KAAK,EAAE;IACpC,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;IAC3C,YAAY,EAAE,qBAAqB,CAAA;CACpC,KAAK,YAAY,CAAC;AAEnB,KAAK,yBAAyB,GAAG,CAC/B,KAAK,EAAE;IACL,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,iBAAiB,EAAE,qBAAqB,EAAE,CAAA;KAC3C,CAAA;CACF,KACE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ApplicationErrorHandlerCommon.d.ts","sourceRoot":"","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD;;;GAGG;AACH,UAAU,kCAAkC;IAC1C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,KAAK,sBAAsB,GAAG,CAAC,KAAK,EAAE;IACpC,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;IAC3C,YAAY,EAAE,qBAAqB,CAAA;CACpC,KAAK,YAAY,CAAC;AAEnB,KAAK,yBAAyB,GAAG,CAC/B,KAAK,EAAE;IACL,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,iBAAiB,EAAE,qBAAqB,EAAE,CAAA;KAC3C,CAAA;CACF,KACE,YAAY,CAAC;AA6ClB;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,iBAAiB,KAAA,EACjB,oBAAoB,CAAC,EAAE,yBAAyB,EAChD,iBAAiB,CAAC,EAAE,sBAAsB,IAEO,uBAAuB,kCAAkC,KAAG,YAAY,CAqB1H"}
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import React__default from'react';import {useSelector}from'react-redux';import'reflect-metadata';import {Slot}from'@common-stack/components-pro';import {APPLICATION_ERROR_SLOT_FILL}from'../constants/constants.js';import {backendErrorSelector}from'../redux/selectors/index.js'
|
|
2
|
-
|
|
3
|
-
* we import Slot from @common-stack/react-mobile. The default
|
|
4
|
-
* Slot under RenderApplicationErrorSlot works for browser
|
|
5
|
-
* both ant and chakra
|
|
6
|
-
*
|
|
7
|
-
* @param FallbackComponent ReactNode
|
|
8
|
-
* @param [ApplicationErrorSlot] IApplicationErrorSlotType
|
|
9
|
-
* @param [RendererComponent] IRendererComponentType
|
|
10
|
-
* @returns ReactNode
|
|
11
|
-
*/
|
|
12
|
-
const ApplicationErrorHandlerCommon = (FallbackComponent, ApplicationErrorSlot, RendererComponent) => ({ plugins, children }) => {
|
|
1
|
+
import React__default from'react';import {useSelector}from'react-redux';import'reflect-metadata';import {Slot}from'@common-stack/components-pro';import {APPLICATION_ERROR_SLOT_FILL}from'../constants/constants.js';import {backendErrorSelector}from'../redux/selectors/index.js';// Inner component that uses Redux hooks - only rendered when Redux is available
|
|
2
|
+
function ApplicationErrorHandlerInner({ FallbackComponent, ApplicationErrorSlot, RendererComponent, plugins, children, }) {
|
|
13
3
|
const applicationErrors = useSelector((state) => state?.applicationErrors);
|
|
14
4
|
const errors = applicationErrors?.filter((error) => !!plugins.find((plugin) => plugin.name === error?.pluginName));
|
|
15
5
|
const backendError = useSelector(backendErrorSelector);
|
|
16
|
-
|
|
6
|
+
function RenderApplicationErrorSlot(props) {
|
|
17
7
|
return !!ApplicationErrorSlot ? React__default.createElement(ApplicationErrorSlot, { ...props }) : React__default.createElement(Slot, { ...props });
|
|
18
|
-
}
|
|
8
|
+
}
|
|
19
9
|
if (!!RendererComponent) {
|
|
20
10
|
return React__default.createElement(RendererComponent, { applicationErrors: errors, backendError: backendError });
|
|
21
11
|
}
|
|
@@ -24,4 +14,28 @@ const ApplicationErrorHandlerCommon = (FallbackComponent, ApplicationErrorSlot,
|
|
|
24
14
|
!!errors?.length
|
|
25
15
|
? React__default.createElement(RenderApplicationErrorSlot, { name: APPLICATION_ERROR_SLOT_FILL, fillProps: { active: true, applicationErrors: errors } })
|
|
26
16
|
: children));
|
|
27
|
-
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* ApplicationErrorSlot is needed for mobile. Since for mobile
|
|
20
|
+
* we import Slot from @common-stack/react-mobile. The default
|
|
21
|
+
* Slot under RenderApplicationErrorSlot works for browser
|
|
22
|
+
* both ant and chakra
|
|
23
|
+
*
|
|
24
|
+
* @param FallbackComponent ReactNode
|
|
25
|
+
* @param [ApplicationErrorSlot] IApplicationErrorSlotType
|
|
26
|
+
* @param [RendererComponent] IRendererComponentType
|
|
27
|
+
* @returns ReactNode
|
|
28
|
+
*/
|
|
29
|
+
function ApplicationErrorHandlerCommon(FallbackComponent, ApplicationErrorSlot, RendererComponent) {
|
|
30
|
+
return function ApplicationErrorHandlerComponent({ plugins, children }) {
|
|
31
|
+
// Check if we're in SSR/build mode where Redux store might not be available
|
|
32
|
+
// In SPA mode, the server renders without providers, so we just render children
|
|
33
|
+
const isSSR = typeof window === 'undefined';
|
|
34
|
+
if (isSSR) {
|
|
35
|
+
// During SSR/build, just render children without Redux functionality
|
|
36
|
+
// The client-side hydration will provide the full functionality
|
|
37
|
+
return React__default.createElement(React__default.Fragment, null, children);
|
|
38
|
+
}
|
|
39
|
+
return (React__default.createElement(ApplicationErrorHandlerInner, { FallbackComponent: FallbackComponent, ApplicationErrorSlot: ApplicationErrorSlot, RendererComponent: RendererComponent, plugins: plugins, children: children }));
|
|
40
|
+
};
|
|
41
|
+
}export{ApplicationErrorHandlerCommon};//# sourceMappingURL=ApplicationErrorHandlerCommon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationErrorHandlerCommon.js","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"oRAUG;AACH
|
|
1
|
+
{"version":3,"file":"ApplicationErrorHandlerCommon.js","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"oRAUG;AACH,SAAA,4BAAU,CAAA,EAAA,iBAAkC,EAAA,oBAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,QAAA,GAAA,EAAA;AAC1C,IAAA,MAAA,iBAAsB,GAAE,WAAK,CAAA,CAAA,KAAA,KAAA,KAAA,EAAA,iBAAA,CAAA;IAC7B,MAAA,0BAAmB,EAAA,MAAA,CAAA,CAAA,KAAA,KAAA,CAAA,CAAA,OAAA,CAAA,IAAA,CAAA,CAAA,MAAA,KAAA,MAAA,CAAA,IAAA,KAAA,KAAA,EAAA,UAAA,CAAA,CAAA;AACpB,IAAA,MAAA,YAAA,GAAA,WAAA,CAAA,oBAAA,CAAA;AAED,IAAA,SAAK,0BAAiC,CAAA,KAAA,EAAA;QACpC,OAAA,CAAA,CAAA,oBAAmB,GAAAA,cAAqB,CAAE,aAAC,CAAA,oBAAA,EAAA,EAAA,GAAA,KAAA,EAAA,CAAA,GAAAA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,GAAA,KAAA,EAAA,CAAA;IAC3C;AACD,IAAA,uBAAkB,EAAA;AAEnB,QAAK,OAAAA,cAAA,CAAA,aACH,CAAA,iBAAO,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,YAAA,EAAA,YAAA,EAAA,CAAA;IACL;AACA,IAAA,QAAAA,cAAW,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA;QACT,CAAA,CAAA,eAAgBA,cAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAA,KAAA,EAAA,YAAA,EAAA,CAAA,GAAA,IAAA;QAChB,CAAA,CAAA,MAAA,EAAA;cACDA,cAAA,CAAA,aAAA,CAAA,0BAAA,EAAA,EAAA,IAAA,EAAA,2BAAA,EAAA,SAAA,EAAA,EAAA,MAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA;AACF,sBACe,CAAA;AA6ClB;;;;;;;;;;AAUG;AACH;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayoutSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useLayoutSettings.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB;;
|
|
1
|
+
{"version":3,"file":"useLayoutSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useLayoutSettings.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB;;0BAuDV,GAAG,0BAA0B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;EAuEtE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useParams}from'@remix-run/react';import {useCallback}from'react';import {useDispatch,useSelector,shallowEqual}from'react-redux';import {CHANGE_SETTINGS_ACTION}from'../constants/constants.js';function useLayoutSettings() {
|
|
1
|
+
import {useParams}from'@remix-run/react';import {useCallback}from'react';import {useDispatch,useSelector,shallowEqual}from'react-redux';import {CHANGE_SETTINGS_ACTION}from'../constants/constants.js';import {isSpaMode,settingsStorage}from'../utils/settingsStorage.js';function useLayoutSettings() {
|
|
2
2
|
const dispatch = useDispatch();
|
|
3
3
|
useSelector((state) => state.settings, shallowEqual);
|
|
4
4
|
// Filter out machine internal state - settings are now flat (no uilayout wrapper)
|
|
@@ -11,10 +11,16 @@ import {useParams}from'@remix-run/react';import {useCallback}from'react';import
|
|
|
11
11
|
return cleaned;
|
|
12
12
|
}, shallowEqual);
|
|
13
13
|
const { orgName: orgNameFromParams } = useSelector((state) => ({
|
|
14
|
-
orgName: state
|
|
14
|
+
orgName: state?.platform?.orgName ?? '',
|
|
15
15
|
}), shallowEqual);
|
|
16
16
|
const { orgName: orgNameFromUrl } = useParams();
|
|
17
17
|
const getSettings = useCallback(async () => {
|
|
18
|
+
// In SPA mode, get settings from localStorage
|
|
19
|
+
if (isSpaMode()) {
|
|
20
|
+
const localSettings = settingsStorage.get();
|
|
21
|
+
return localSettings || {};
|
|
22
|
+
}
|
|
23
|
+
// In SSR mode, fetch from server
|
|
18
24
|
try {
|
|
19
25
|
const response = await fetch('/resources/settings', {
|
|
20
26
|
method: 'GET',
|
|
@@ -34,7 +40,7 @@ import {useParams}from'@remix-run/react';import {useCallback}from'react';import
|
|
|
34
40
|
// Return default settings if there's an error
|
|
35
41
|
return {};
|
|
36
42
|
}
|
|
37
|
-
}, []);
|
|
43
|
+
}, [orgNameFromParams, orgNameFromUrl]);
|
|
38
44
|
const setSettings = useCallback(async (config, currentChangedSetting) => {
|
|
39
45
|
try {
|
|
40
46
|
// 1. Calculate payload first
|
|
@@ -54,22 +60,30 @@ import {useParams}from'@remix-run/react';import {useCallback}from'react';import
|
|
|
54
60
|
if (colorWeak !== undefined && settings.colorWeak !== colorWeak) {
|
|
55
61
|
updateColorWeak(!!colorWeak);
|
|
56
62
|
}
|
|
57
|
-
// 3.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
// 3. Persist settings based on mode (SPA vs SSR)
|
|
64
|
+
if (isSpaMode()) {
|
|
65
|
+
// SPA mode: Save to localStorage
|
|
66
|
+
settingsStorage.merge(currentChangedSetting);
|
|
67
|
+
console.log('[useLayoutSettings] Settings saved to localStorage (SPA mode)');
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// SSR mode: Make API call to save via cookies
|
|
71
|
+
const response = await fetch('/resources/settings', {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: {
|
|
74
|
+
'Content-Type': 'application/json',
|
|
75
|
+
orgName: orgNameFromParams || orgNameFromUrl || '',
|
|
76
|
+
},
|
|
77
|
+
body: JSON.stringify({
|
|
78
|
+
config: currentChangedSetting,
|
|
79
|
+
deviceType: getClientDeviceType(),
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
const errorText = await response.text();
|
|
84
|
+
console.error('Server error response:', errorText.substring(0, 500));
|
|
85
|
+
throw new Error('Failed to update settings');
|
|
86
|
+
}
|
|
73
87
|
}
|
|
74
88
|
// 4. update redux
|
|
75
89
|
let payloadToDispatch = currentChangedSetting;
|
|
@@ -86,7 +100,7 @@ import {useParams}from'@remix-run/react';import {useCallback}from'react';import
|
|
|
86
100
|
console.error('setSettings error:', error);
|
|
87
101
|
return null;
|
|
88
102
|
}
|
|
89
|
-
}, [dispatch, settings]);
|
|
103
|
+
}, [dispatch, settings, orgNameFromParams, orgNameFromUrl]);
|
|
90
104
|
return { settings, setSettings, getSettings };
|
|
91
105
|
}
|
|
92
106
|
function updateColorWeak(colorWeak) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayoutSettings.js","sources":[
|
|
1
|
+
{"version":3,"file":"useLayoutSettings.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SearchBarBehavior}from'./interfaces/settings.js';export{APPLICATION_ERROR_SLOT_FILL,CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'./constants/constants.js';export{BACKEND_ERROR,CLEAR_APPLICATION_ERRORS,DISMISS_APPLICATION_ERROR,LOG_APPLICATION_ERROR,RESTORE_APPLICATION_ERRORS}from'./constants/error.js';export{HEADER_SEARCHBAR_FILL,HEADER_SEARCH_BUTTON_FILL,RIGHT_CONTENT_FILL,SCROLL_END_FILL}from'./constants/layout.js';export{languages}from'./constants/languages.js';export{dismissApplicationError,restoreApplicationError,setApplicationError}from'./redux/actions/error-actions.js';export{applicationErrors,initialErrorsState}from'./redux/reducers/error.js';export{settingsReducer}from'./redux/reducers/settings.js';export{store}from'./redux/store.js';export{useAppDispatch,useAppSelector}from'./redux/hooks.js';export{getMenuSeparation}from'./utils/seperatedMenus.js';export{useComponentSize,useIsomorphicLayoutEffect}from'./utils/componentSize.js';export{matchParentRoute}from'./utils/parentRoute.js';export{addProLayoutParentKeys,filterRoutesWithLocale,menuDataRender,removeUnnecessaryProperties,setLocale,transformData}from'./utils/menuUtils.js';export{getMatchMenuKeys}from'./utils/matchMenuKeys.js';export{generateMenuPath}from'./utils/generateMenuLink.js';export{compareAndSaveSettingsDifferences}from'./utils/settingsDifference.js';export{ApplicationErrorHandlerCommon}from'./components/ApplicationErrorHandlerCommon.js';export{ErrorBoundaryCommon}from'./components/ErrorBoundaryCommon.js';export{ApplicationErrorFillWrapper}from'./components/ApplicationErrorFillWrapper.js';export{LayoutCookieProvider}from'./components/LayoutCookieProvider.js';export{ErrorLink,errorReduxLink}from'./graphql/link/error-link.js';export{systemFont}from'./themes/systemFont/index.js';export{borderRadius,colors,lightLayoutTheme,lightNavigationBarTheme,lightTabBarTheme,shadows,sizes,spacings,textVariants}from'./themes/templates/lightLayoutTheme.js';export{createLayoutTheme}from'./themes/templates/createLayoutTheme.js';export{darkColors,darkLayoutTheme,darkNavigationBarTheme,darkTabBarTheme}from'./themes/templates/darkLayoutTheme.js';export{config}from'./config/env-config.js';export{AMENITIES,DEFAULT_HEADER,DEFAULT_LAYOUT,SEARCH_TYPES,SHARED_VIEW_CONFIG}from'./config/defaultSettings.js';export{useLayoutSettings}from'./hooks/useLayoutSettings.js';export{usePermissionAutoFetch,useSetting,useSettingsLoader}from'@adminide-stack/platform-client';export{ClientOnly}from'./hooks/Client-only.js';export{blue}from'./colors/presets/blue.js';export{brinkPink}from'./colors/presets/brinkPink.js';export{cyan}from'./colors/presets/cyan.js';export{green}from'./colors/presets/green.js';export{lime}from'./colors/presets/lime.js';export{orange}from'./colors/presets/orange.js';export{pink}from'./colors/presets/pink.js';export{purple}from'./colors/presets/purple.js';export{red}from'./colors/presets/red.js';export{skyBlue}from'./colors/presets/skyBlue.js';export{turquoise}from'./colors/presets/turquoise.js';export{yellow}from'./colors/presets/yellow.js';export{white}from'./colors/presets/white.js';export{black}from'./colors/presets/black.js';export{colorList,getThemeColors}from'./colors/colorsList.js';//# sourceMappingURL=index.js.map
|
|
1
|
+
export{SearchBarBehavior}from'./interfaces/settings.js';export{APPLICATION_ERROR_SLOT_FILL,CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'./constants/constants.js';export{BACKEND_ERROR,CLEAR_APPLICATION_ERRORS,DISMISS_APPLICATION_ERROR,LOG_APPLICATION_ERROR,RESTORE_APPLICATION_ERRORS}from'./constants/error.js';export{HEADER_SEARCHBAR_FILL,HEADER_SEARCH_BUTTON_FILL,RIGHT_CONTENT_FILL,SCROLL_END_FILL}from'./constants/layout.js';export{languages}from'./constants/languages.js';export{dismissApplicationError,restoreApplicationError,setApplicationError}from'./redux/actions/error-actions.js';export{applicationErrors,initialErrorsState}from'./redux/reducers/error.js';export{settingsReducer}from'./redux/reducers/settings.js';export{store}from'./redux/store.js';export{useAppDispatch,useAppSelector}from'./redux/hooks.js';export{getMenuSeparation}from'./utils/seperatedMenus.js';export{useComponentSize,useIsomorphicLayoutEffect}from'./utils/componentSize.js';export{matchParentRoute}from'./utils/parentRoute.js';export{addProLayoutParentKeys,filterRoutesWithLocale,menuDataRender,removeUnnecessaryProperties,setLocale,transformData}from'./utils/menuUtils.js';export{getMatchMenuKeys}from'./utils/matchMenuKeys.js';export{generateMenuPath}from'./utils/generateMenuLink.js';export{compareAndSaveSettingsDifferences}from'./utils/settingsDifference.js';export{safeLocalStorage}from'./utils/storage.js';export{getStorageMode,isSpaMode,settingsStorage}from'./utils/settingsStorage.js';export{ApplicationErrorHandlerCommon}from'./components/ApplicationErrorHandlerCommon.js';export{ErrorBoundaryCommon}from'./components/ErrorBoundaryCommon.js';export{ApplicationErrorFillWrapper}from'./components/ApplicationErrorFillWrapper.js';export{LayoutCookieProvider}from'./components/LayoutCookieProvider.js';export{ErrorLink,errorReduxLink}from'./graphql/link/error-link.js';export{systemFont}from'./themes/systemFont/index.js';export{borderRadius,colors,lightLayoutTheme,lightNavigationBarTheme,lightTabBarTheme,shadows,sizes,spacings,textVariants}from'./themes/templates/lightLayoutTheme.js';export{createLayoutTheme}from'./themes/templates/createLayoutTheme.js';export{darkColors,darkLayoutTheme,darkNavigationBarTheme,darkTabBarTheme}from'./themes/templates/darkLayoutTheme.js';export{config}from'./config/env-config.js';export{AMENITIES,DEFAULT_HEADER,DEFAULT_LAYOUT,SEARCH_TYPES,SHARED_VIEW_CONFIG}from'./config/defaultSettings.js';export{useLayoutSettings}from'./hooks/useLayoutSettings.js';export{usePermissionAutoFetch,useSetting,useSettingsLoader}from'@adminide-stack/platform-client';export{ClientOnly}from'./hooks/Client-only.js';export{blue}from'./colors/presets/blue.js';export{brinkPink}from'./colors/presets/brinkPink.js';export{cyan}from'./colors/presets/cyan.js';export{green}from'./colors/presets/green.js';export{lime}from'./colors/presets/lime.js';export{orange}from'./colors/presets/orange.js';export{pink}from'./colors/presets/pink.js';export{purple}from'./colors/presets/purple.js';export{red}from'./colors/presets/red.js';export{skyBlue}from'./colors/presets/skyBlue.js';export{turquoise}from'./colors/presets/turquoise.js';export{yellow}from'./colors/presets/yellow.js';export{white}from'./colors/presets/white.js';export{black}from'./colors/presets/black.js';export{colorList,getThemeColors}from'./colors/colorsList.js';//# sourceMappingURL=index.js.map
|
package/lib/index.native.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SearchBarBehavior}from'./interfaces/settings.js';export{APPLICATION_ERROR_SLOT_FILL,CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'./constants/constants.js';export{BACKEND_ERROR,CLEAR_APPLICATION_ERRORS,DISMISS_APPLICATION_ERROR,LOG_APPLICATION_ERROR,RESTORE_APPLICATION_ERRORS}from'./constants/error.js';export{HEADER_SEARCHBAR_FILL,HEADER_SEARCH_BUTTON_FILL,RIGHT_CONTENT_FILL,SCROLL_END_FILL}from'./constants/layout.js';export{languages}from'./constants/languages.js';export{dismissApplicationError,restoreApplicationError,setApplicationError}from'./redux/actions/error-actions.js';export{applicationErrors,initialErrorsState}from'./redux/reducers/error.js';export{settingsReducer}from'./redux/reducers/settings.js';export{store}from'./redux/store.js';export{useAppDispatch,useAppSelector}from'./redux/hooks.js';export{getMenuSeparation}from'./utils/seperatedMenus.js';export{useComponentSize,useIsomorphicLayoutEffect}from'./utils/componentSize.js';export{matchParentRoute}from'./utils/parentRoute.js';export{addProLayoutParentKeys,filterRoutesWithLocale,menuDataRender,removeUnnecessaryProperties,setLocale,transformData}from'./utils/menuUtils.js';export{getMatchMenuKeys}from'./utils/matchMenuKeys.js';export{generateMenuPath}from'./utils/generateMenuLink.js';export{compareAndSaveSettingsDifferences}from'./utils/settingsDifference.js';export{ApplicationErrorHandlerCommon}from'./components/ApplicationErrorHandlerCommon.js';export{ErrorBoundaryCommon}from'./components/ErrorBoundaryCommon.js';export{ApplicationErrorFillWrapper}from'./components/ApplicationErrorFillWrapper.js';export{LayoutCookieProvider}from'./components/LayoutCookieProvider.js';export{ErrorLink,errorReduxLink}from'./graphql/link/error-link.js';export{systemFont}from'./themes/systemFont/index.js';export{borderRadius,colors,lightLayoutTheme,lightNavigationBarTheme,lightTabBarTheme,shadows,sizes,spacings,textVariants}from'./themes/templates/lightLayoutTheme.js';export{createLayoutTheme}from'./themes/templates/createLayoutTheme.js';export{darkColors,darkLayoutTheme,darkNavigationBarTheme,darkTabBarTheme}from'./themes/templates/darkLayoutTheme.js';export{config}from'./config/env-config.js';export{AMENITIES,DEFAULT_HEADER,DEFAULT_LAYOUT,SEARCH_TYPES,SHARED_VIEW_CONFIG}from'./config/defaultSettings.js';//# sourceMappingURL=index.native.js.map
|
|
1
|
+
export{SearchBarBehavior}from'./interfaces/settings.js';export{APPLICATION_ERROR_SLOT_FILL,CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'./constants/constants.js';export{BACKEND_ERROR,CLEAR_APPLICATION_ERRORS,DISMISS_APPLICATION_ERROR,LOG_APPLICATION_ERROR,RESTORE_APPLICATION_ERRORS}from'./constants/error.js';export{HEADER_SEARCHBAR_FILL,HEADER_SEARCH_BUTTON_FILL,RIGHT_CONTENT_FILL,SCROLL_END_FILL}from'./constants/layout.js';export{languages}from'./constants/languages.js';export{dismissApplicationError,restoreApplicationError,setApplicationError}from'./redux/actions/error-actions.js';export{applicationErrors,initialErrorsState}from'./redux/reducers/error.js';export{settingsReducer}from'./redux/reducers/settings.js';export{store}from'./redux/store.js';export{useAppDispatch,useAppSelector}from'./redux/hooks.js';export{getMenuSeparation}from'./utils/seperatedMenus.js';export{useComponentSize,useIsomorphicLayoutEffect}from'./utils/componentSize.js';export{matchParentRoute}from'./utils/parentRoute.js';export{addProLayoutParentKeys,filterRoutesWithLocale,menuDataRender,removeUnnecessaryProperties,setLocale,transformData}from'./utils/menuUtils.js';export{getMatchMenuKeys}from'./utils/matchMenuKeys.js';export{generateMenuPath}from'./utils/generateMenuLink.js';export{compareAndSaveSettingsDifferences}from'./utils/settingsDifference.js';export{safeLocalStorage}from'./utils/storage.js';export{getStorageMode,isSpaMode,settingsStorage}from'./utils/settingsStorage.js';export{ApplicationErrorHandlerCommon}from'./components/ApplicationErrorHandlerCommon.js';export{ErrorBoundaryCommon}from'./components/ErrorBoundaryCommon.js';export{ApplicationErrorFillWrapper}from'./components/ApplicationErrorFillWrapper.js';export{LayoutCookieProvider}from'./components/LayoutCookieProvider.js';export{ErrorLink,errorReduxLink}from'./graphql/link/error-link.js';export{systemFont}from'./themes/systemFont/index.js';export{borderRadius,colors,lightLayoutTheme,lightNavigationBarTheme,lightTabBarTheme,shadows,sizes,spacings,textVariants}from'./themes/templates/lightLayoutTheme.js';export{createLayoutTheme}from'./themes/templates/createLayoutTheme.js';export{darkColors,darkLayoutTheme,darkNavigationBarTheme,darkTabBarTheme}from'./themes/templates/darkLayoutTheme.js';export{config}from'./config/env-config.js';export{AMENITIES,DEFAULT_HEADER,DEFAULT_LAYOUT,SEARCH_TYPES,SHARED_VIEW_CONFIG}from'./config/defaultSettings.js';//# sourceMappingURL=index.native.js.map
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC"}
|
package/lib/utils/menuUtils.d.ts
CHANGED
|
@@ -8,12 +8,13 @@ import { type IMenuData } from '@common-stack/client-react/lib/interfaces/menu';
|
|
|
8
8
|
*
|
|
9
9
|
* @param menuList
|
|
10
10
|
* @param authorities
|
|
11
|
+
* @param isTopLevel - Internal flag to prevent logging during recursion
|
|
11
12
|
*/
|
|
12
|
-
export declare const menuDataRender: (menuList: IMenuData[], authorities: any) => IMenuData[];
|
|
13
|
+
export declare const menuDataRender: (menuList: IMenuData[], authorities: any, isTopLevel?: boolean) => IMenuData[];
|
|
13
14
|
export declare function transformData(data: any): any;
|
|
14
15
|
export declare function setLocale(obj: any, parentName?: string): void;
|
|
15
16
|
export declare const addProLayoutParentKeys: (menuData?: any[], parentKeys?: string[]) => any[];
|
|
16
|
-
export declare const filterRoutesWithLocale: (routes: any) => any;
|
|
17
|
+
export declare const filterRoutesWithLocale: (routes: any) => any[];
|
|
17
18
|
/**
|
|
18
19
|
*
|
|
19
20
|
* included [ 'dialogPath']
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menuUtils.d.ts","sourceRoot":"","sources":["../../src/utils/menuUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAChF
|
|
1
|
+
{"version":3,"file":"menuUtils.d.ts","sourceRoot":"","sources":["../../src/utils/menuUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAChF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,SAAS,EAAE,EAAE,gBAAW,EAAE,oBAAiB,KAAG,SAAS,EAuB/F,CAAC;AAMF,wBAAgB,aAAa,CAAC,IAAI,KAAA,OAcjC;AACD,wBAAgB,SAAS,CAAC,GAAG,KAAA,EAAE,UAAU,SAAK,QAO7C;AAED,eAAO,MAAM,sBAAsB,GAAI,WAAW,GAAG,EAAE,EAAE,aAAY,MAAM,EAAO,UASjF,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,WAAM,UAgB5C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,KAAA,QAY9C"}
|
package/lib/utils/menuUtils.js
CHANGED
|
@@ -7,9 +7,12 @@ import {get,cloneDeep,sortBy}from'lodash-es';import {PermissionType}from'common'
|
|
|
7
7
|
*
|
|
8
8
|
* @param menuList
|
|
9
9
|
* @param authorities
|
|
10
|
+
* @param isTopLevel - Internal flag to prevent logging during recursion
|
|
10
11
|
*/
|
|
11
|
-
const menuDataRender = (menuList, authorities) => {
|
|
12
|
-
|
|
12
|
+
const menuDataRender = (menuList, authorities, isTopLevel = true) => {
|
|
13
|
+
if (isTopLevel) {
|
|
14
|
+
logger.trace('menuDataRender execution started');
|
|
15
|
+
}
|
|
13
16
|
const sortedMenuList = sortMenusByPriority(menuList);
|
|
14
17
|
return (sortedMenuList
|
|
15
18
|
// filter routes with valid permission
|
|
@@ -24,7 +27,7 @@ const menuDataRender = (menuList, authorities) => {
|
|
|
24
27
|
// return Authorized.check(item.authority, localItem, null) as MenuDataItem;
|
|
25
28
|
return {
|
|
26
29
|
...item,
|
|
27
|
-
children: item.children ? menuDataRender(item.children, authorities) : undefined,
|
|
30
|
+
children: item.children ? menuDataRender(item.children, authorities, false) : undefined,
|
|
28
31
|
};
|
|
29
32
|
}));
|
|
30
33
|
};
|
|
@@ -61,6 +64,9 @@ const addProLayoutParentKeys = (menuData, parentKeys = []) => {
|
|
|
61
64
|
});
|
|
62
65
|
};
|
|
63
66
|
const filterRoutesWithLocale = (routes) => {
|
|
67
|
+
if (!routes || !Array.isArray(routes)) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
64
70
|
return routes
|
|
65
71
|
.filter((item) => {
|
|
66
72
|
if (item.routes && item.routes.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menuUtils.js","sources":["../../src/utils/menuUtils.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"menuUtils.js","sources":["../../src/utils/menuUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAcG;AACH;AA6BA;AAeA,MAAA,uCAA+B,EAAU,UAAK,GAAA,IAO7C,KAAA;AAED,IAAA,IAAA,UAAO,EAAA;AAWP,QAAA,MAAA,CAAO,KAAA,CAAM,kCAA0B,CAAA;AAkBvC,IAAA;;;AAGG;AACH,SAAA,MAAA,CAAA,CAAA,IAAA,KAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect if the application is running in SPA mode (client-side only, no SSR)
|
|
3
|
+
*
|
|
4
|
+
* In SPA mode:
|
|
5
|
+
* - Server loaders are not available
|
|
6
|
+
* - Cookies cannot be set via server response
|
|
7
|
+
* - localStorage is the primary storage mechanism
|
|
8
|
+
*
|
|
9
|
+
* In SSR mode:
|
|
10
|
+
* - Server loaders are available
|
|
11
|
+
* - Cookies can be set via server response
|
|
12
|
+
* - Cookies are the primary storage mechanism (server can read them)
|
|
13
|
+
*
|
|
14
|
+
* @returns true if running in SPA mode, false if SSR mode
|
|
15
|
+
*/
|
|
16
|
+
export declare function isSpaMode(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get the current storage mode description for debugging
|
|
19
|
+
* @returns 'spa' | 'ssr'
|
|
20
|
+
*/
|
|
21
|
+
export declare function getStorageMode(): 'spa' | 'ssr';
|
|
22
|
+
/**
|
|
23
|
+
* Settings storage utility for persisting UI settings
|
|
24
|
+
* Uses localStorage for SPA mode persistence
|
|
25
|
+
*/
|
|
26
|
+
export declare const settingsStorage: {
|
|
27
|
+
/**
|
|
28
|
+
* Get settings deltas from localStorage
|
|
29
|
+
* @returns Parsed deltas or null
|
|
30
|
+
*/
|
|
31
|
+
get: () => any | null;
|
|
32
|
+
/**
|
|
33
|
+
* Save settings deltas to localStorage
|
|
34
|
+
* @param deltas - Deltas to store
|
|
35
|
+
*/
|
|
36
|
+
set: (deltas: any) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Merge new deltas with existing deltas
|
|
39
|
+
* @param newDeltas - New deltas to merge
|
|
40
|
+
* @returns Merged deltas
|
|
41
|
+
*/
|
|
42
|
+
merge: (newDeltas: any) => any;
|
|
43
|
+
/**
|
|
44
|
+
* Clear all deltas from localStorage
|
|
45
|
+
*/
|
|
46
|
+
clear: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Check if localStorage is available
|
|
49
|
+
* @returns true if available
|
|
50
|
+
*/
|
|
51
|
+
isAvailable: () => boolean;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=settingsStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settingsStorage.d.ts","sourceRoot":"","sources":["../../src/utils/settingsStorage.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAUnC;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,KAAK,GAAG,KAAK,CAE9C;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;IACxB;;;OAGG;eACM,GAAG,GAAG,IAAI;IAWnB;;;OAGG;kBACW,GAAG,KAAG,IAAI;IAUxB;;;;OAIG;uBACgB,GAAG,KAAG,GAAG;IAQ5B;;OAEG;iBACQ,IAAI;IAYf;;;OAGG;uBACc,OAAO;CAW3B,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {merge}from'lodash-es';import {safeLocalStorage}from'./storage.js';const STORAGE_KEY = 'ui-layout-settings';
|
|
2
|
+
/**
|
|
3
|
+
* Detect if the application is running in SPA mode (client-side only, no SSR)
|
|
4
|
+
*
|
|
5
|
+
* In SPA mode:
|
|
6
|
+
* - Server loaders are not available
|
|
7
|
+
* - Cookies cannot be set via server response
|
|
8
|
+
* - localStorage is the primary storage mechanism
|
|
9
|
+
*
|
|
10
|
+
* In SSR mode:
|
|
11
|
+
* - Server loaders are available
|
|
12
|
+
* - Cookies can be set via server response
|
|
13
|
+
* - Cookies are the primary storage mechanism (server can read them)
|
|
14
|
+
*
|
|
15
|
+
* @returns true if running in SPA mode, false if SSR mode
|
|
16
|
+
*/
|
|
17
|
+
function isSpaMode() {
|
|
18
|
+
// Server-side rendering - definitely not SPA mode
|
|
19
|
+
if (typeof window === 'undefined')
|
|
20
|
+
return false;
|
|
21
|
+
// Check Remix context for SPA mode flag
|
|
22
|
+
const remixContext = window.__remixContext;
|
|
23
|
+
if (remixContext?.isSpaMode === true)
|
|
24
|
+
return true;
|
|
25
|
+
// Fallback: If no remix context exists and we're in browser,
|
|
26
|
+
// assume SSR mode (conservative default)
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the current storage mode description for debugging
|
|
31
|
+
* @returns 'spa' | 'ssr'
|
|
32
|
+
*/
|
|
33
|
+
function getStorageMode() {
|
|
34
|
+
return isSpaMode() ? 'spa' : 'ssr';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Settings storage utility for persisting UI settings
|
|
38
|
+
* Uses localStorage for SPA mode persistence
|
|
39
|
+
*/
|
|
40
|
+
const settingsStorage = {
|
|
41
|
+
/**
|
|
42
|
+
* Get settings deltas from localStorage
|
|
43
|
+
* @returns Parsed deltas or null
|
|
44
|
+
*/
|
|
45
|
+
get: () => {
|
|
46
|
+
if (typeof window === 'undefined')
|
|
47
|
+
return null;
|
|
48
|
+
try {
|
|
49
|
+
const stored = safeLocalStorage.getItem(STORAGE_KEY);
|
|
50
|
+
return stored ? JSON.parse(stored) : null;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.warn('Failed to read settings from localStorage:', error);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Save settings deltas to localStorage
|
|
59
|
+
* @param deltas - Deltas to store
|
|
60
|
+
*/
|
|
61
|
+
set: (deltas) => {
|
|
62
|
+
if (typeof window === 'undefined')
|
|
63
|
+
return;
|
|
64
|
+
try {
|
|
65
|
+
const serialized = JSON.stringify(deltas);
|
|
66
|
+
safeLocalStorage.setItem(STORAGE_KEY, serialized);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.warn('Failed to write settings to localStorage (may be full):', error);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Merge new deltas with existing deltas
|
|
74
|
+
* @param newDeltas - New deltas to merge
|
|
75
|
+
* @returns Merged deltas
|
|
76
|
+
*/
|
|
77
|
+
merge: (newDeltas) => {
|
|
78
|
+
const existingDeltas = settingsStorage.get() || {};
|
|
79
|
+
// Deep merge for nested bracket notation
|
|
80
|
+
const mergedDeltas = merge({}, existingDeltas, newDeltas);
|
|
81
|
+
settingsStorage.set(mergedDeltas);
|
|
82
|
+
return mergedDeltas;
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Clear all deltas from localStorage
|
|
86
|
+
*/
|
|
87
|
+
clear: () => {
|
|
88
|
+
if (typeof window === 'undefined')
|
|
89
|
+
return;
|
|
90
|
+
try {
|
|
91
|
+
safeLocalStorage.removeItem(STORAGE_KEY);
|
|
92
|
+
// Also clear legacy storage keys if any
|
|
93
|
+
safeLocalStorage.removeItem('ui-desktop-settings');
|
|
94
|
+
console.log('✅ Cleared localStorage settings');
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.warn('Failed to clear localStorage:', error);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* Check if localStorage is available
|
|
102
|
+
* @returns true if available
|
|
103
|
+
*/
|
|
104
|
+
isAvailable: () => {
|
|
105
|
+
if (typeof window === 'undefined')
|
|
106
|
+
return false;
|
|
107
|
+
try {
|
|
108
|
+
const testKey = '__storage_test__';
|
|
109
|
+
localStorage.setItem(testKey, 'test');
|
|
110
|
+
localStorage.removeItem(testKey);
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
};export{getStorageMode,isSpaMode,settingsStorage};//# sourceMappingURL=settingsStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settingsStorage.js","sources":["../../src/utils/settingsStorage.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAmBG;AACH;AAYA;;;AAGG;AACH,IAAA,IAAA,OAAA,MAAA,KAAgB,WAAA;AAIhB,QAAA,OAAA,KAAA;;;AAGG,IAAA,IAAA,YAAA,EAAA,SAAA,KAAA,IAAA;AACH,QAAA,OAAO;AACH;;;AAGG;AACM;AAWT;;;AAGG,SAAA,cAAA,GAAA;AACW,IAAA,OAAA,SAAA,UAAU,GAAA,KAAA;AAUxB;;;;AAIG;AACgB,MAAA,kBAAM;AAQzB;;AAEG;;AAaH,IAAA,GAAA,EAAA,MAAA;;;AAGG,QAAA,IAAA;wBACc,GAAA,gBAAO,CAAA,OAAA,CAAA,WAAA,CAAA;YAW1B,OAAA,MAAA,GAAA,IAAA,CAAA,KAAA,CAAA,MAAA,CAAA,GAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe localStorage wrapper for SSR compatibility
|
|
3
|
+
*/
|
|
4
|
+
export declare const safeLocalStorage: {
|
|
5
|
+
getItem: (key: string) => string | null;
|
|
6
|
+
setItem: (key: string, value: string) => void;
|
|
7
|
+
removeItem: (key: string) => void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/utils/storage.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,gBAAgB;mBACV,MAAM,KAAG,MAAM,GAAG,IAAI;mBAQtB,MAAM,SAAS,MAAM,KAAG,IAAI;sBAMzB,MAAM,KAAG,IAAI;CAMlC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe localStorage wrapper for SSR compatibility
|
|
3
|
+
*/
|
|
4
|
+
const safeLocalStorage = {
|
|
5
|
+
getItem: (key) => {
|
|
6
|
+
if (typeof window === 'undefined')
|
|
7
|
+
return null;
|
|
8
|
+
try {
|
|
9
|
+
return localStorage.getItem(key);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setItem: (key, value) => {
|
|
16
|
+
if (typeof window === 'undefined')
|
|
17
|
+
return;
|
|
18
|
+
try {
|
|
19
|
+
localStorage.setItem(key, value);
|
|
20
|
+
}
|
|
21
|
+
catch { }
|
|
22
|
+
},
|
|
23
|
+
removeItem: (key) => {
|
|
24
|
+
if (typeof window === 'undefined')
|
|
25
|
+
return;
|
|
26
|
+
try {
|
|
27
|
+
localStorage.removeItem(key);
|
|
28
|
+
}
|
|
29
|
+
catch { }
|
|
30
|
+
},
|
|
31
|
+
};export{safeLocalStorage};//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sources":["../../src/utils/storage.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;AAEG;AACH,MAAA,gBAAa,GAAA;sBACM;mBAQA,MAAM,KAAA,WAAe;AAMlB,YAAA,OAAA,IAAA;QAMpB,IAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/client",
|
|
3
|
-
"version": "12.2.4-alpha.
|
|
3
|
+
"version": "12.2.4-alpha.4",
|
|
4
4
|
"description": "Sample client for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"serialize-error": "^8.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"common": "12.2.4-alpha.
|
|
29
|
+
"common": "12.2.4-alpha.4",
|
|
30
30
|
"rc-menu": "^9.16.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"typescript": {
|
|
45
45
|
"definition": "lib/index.d.ts"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "b88c77dd51092d2ac4992bdd438c430612e2e7e2"
|
|
48
48
|
}
|