@admin-layout/client 10.0.9-alpha.65 → 10.0.9-alpha.67
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/LayoutCookieProvider.d.ts.map +1 -1
- package/lib/components/LayoutCookieProvider.js +3 -3
- package/lib/components/UpdateSettings/UpdateSettings.server.d.ts.map +1 -1
- package/lib/components/UpdateSettings/UpdateSettings.server.js +75 -28
- package/lib/components/UpdateSettings/UpdateSettings.server.js.map +1 -1
- package/lib/config/defaultSettings.d.ts +13 -0
- package/lib/config/defaultSettings.d.ts.map +1 -1
- package/lib/config/defaultSettings.js +7 -0
- package/lib/config/defaultSettings.js.map +1 -1
- package/lib/config/env-config.d.ts.map +1 -1
- package/lib/config/env-config.js +10 -3
- package/lib/config/env-config.js.map +1 -1
- package/lib/hooks/useLayoutSettings.d.ts +1 -0
- package/lib/hooks/useLayoutSettings.d.ts.map +1 -1
- package/lib/hooks/useLayoutSettings.js +3 -31
- package/lib/hooks/useLayoutSettings.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.native.js +1 -1
- package/lib/utils/generateMenuLink.d.ts.map +1 -1
- package/lib/utils/generateMenuLink.js +1 -13
- package/lib/utils/generateMenuLink.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/settingsDifference.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutCookieProvider.d.ts","sourceRoot":"","sources":["../../src/components/LayoutCookieProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"LayoutCookieProvider.d.ts","sourceRoot":"","sources":["../../src/components/LayoutCookieProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAQ1D,UAAU,yBAAyB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,yBAAyB,GAAG,KAAK,CAAC,YAAY,CAqBhG"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {jsx,Fragment}from'react/jsx-runtime';import {
|
|
1
|
+
import {jsx,Fragment}from'react/jsx-runtime';import {useLayoutEffect}from'react';import {useDispatch}from'react-redux';import {useLoaderData}from'@remix-run/react';import {CHANGE_SETTINGS_ACTION}from'../constants/constants.js';import {defaultSettings}from'../config/defaultSettings.js';import {merge}from'lodash-es';function LayoutCookieProvider({ children }) {
|
|
2
2
|
const { settings } = useLoaderData();
|
|
3
3
|
const dispatch = useDispatch();
|
|
4
4
|
const changeSettings = () => {
|
|
5
5
|
if (settings) {
|
|
6
6
|
dispatch({
|
|
7
7
|
type: CHANGE_SETTINGS_ACTION,
|
|
8
|
-
payload: settings,
|
|
8
|
+
payload: merge({}, defaultSettings, settings),
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
useLayoutEffect(() => {
|
|
13
13
|
changeSettings();
|
|
14
14
|
}, [settings, dispatch]);
|
|
15
15
|
if (typeof window === 'undefined') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateSettings.server.d.ts","sourceRoot":"","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UpdateSettings.server.d.ts","sourceRoot":"","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAW/C,wBAAsB,kBAAkB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC;IACjF,QAAQ,EAAE,WAAW,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC,CA2BD;AAED,eAAO,MAAM,MAAM,gBAAuB;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,oEAsC7D,CAAC;AAEF,eAAO,MAAM,MAAM,gBAAuB;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE;;GAkB7D,CAAC"}
|
|
@@ -1,41 +1,88 @@
|
|
|
1
|
-
import {createCookie,json}from'@remix-run/node';import {
|
|
1
|
+
import {createCookie,json}from'@remix-run/node';import {merge}from'lodash-es';import {config}from'../../config/env-config.js';import {defaultSettings}from'../../config/defaultSettings.js';import'react';import'common';import'@cdm-logger/client';import'i18next';import'antd/lib/locale/en_US.js';import'antd/lib/locale/zh_CN.js';import'antd/lib/locale/fr_FR.js';import'antd/lib/locale/es_ES.js';import'antd/lib/locale/de_DE.js';import {compareAndSaveSettingsDifferences}from'../../utils/settingsDifference.js';const settingsCookie = createCookie('settings', {
|
|
2
2
|
maxAge: 60 * 60 * 24 * 30, // 1 month
|
|
3
|
-
httpOnly:
|
|
3
|
+
httpOnly: false, // Allow client-side access
|
|
4
4
|
sameSite: 'lax',
|
|
5
|
+
path: '/', // Ensure cookie is available for all paths
|
|
5
6
|
domain: config.isProd ? config.APP_DOMAIN : undefined,
|
|
6
7
|
});
|
|
7
8
|
async function settingsLoaderUtil({ request }) {
|
|
8
9
|
const cookieHeader = request.headers.get('Cookie');
|
|
9
|
-
|
|
10
|
+
let settings;
|
|
11
|
+
try {
|
|
12
|
+
settings = await settingsCookie.parse(cookieHeader);
|
|
13
|
+
console.log('Parsed cookie settings:', settings);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error('Error parsing settings cookie:', error);
|
|
17
|
+
settings = null;
|
|
18
|
+
}
|
|
19
|
+
// If no settings in cookie, generate default settings
|
|
10
20
|
if (!settings) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const cookie = await settingsCookie.serialize(
|
|
15
|
-
return { settings:
|
|
21
|
+
const fullSettings = merge({}, defaultSettings, config.LAYOUT_SETTINGS);
|
|
22
|
+
// Only store differences to keep cookie size small
|
|
23
|
+
const diffSettings = await compareAndSaveSettingsDifferences(fullSettings, defaultSettings);
|
|
24
|
+
const cookie = await settingsCookie.serialize(diffSettings);
|
|
25
|
+
return { settings: fullSettings, setCookie: cookie };
|
|
16
26
|
}
|
|
17
|
-
|
|
27
|
+
// Merge cookie settings with defaults to get complete settings
|
|
28
|
+
const fullSettings = merge({}, defaultSettings, config.LAYOUT_SETTINGS, settings);
|
|
29
|
+
// Refresh the cookie to keep it active
|
|
30
|
+
const cookie = await settingsCookie.serialize(settings);
|
|
31
|
+
return { settings: fullSettings, setCookie: cookie };
|
|
18
32
|
}
|
|
19
33
|
const action = async ({ request }) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
34
|
+
try {
|
|
35
|
+
const jsonData = await request.json();
|
|
36
|
+
const payload = jsonData?.config || {};
|
|
37
|
+
const cookieHeader = request.headers.get('Cookie');
|
|
38
|
+
let existingSettings;
|
|
39
|
+
try {
|
|
40
|
+
existingSettings = await settingsCookie.parse(cookieHeader);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('Error parsing settings cookie in action:', error);
|
|
44
|
+
existingSettings = null;
|
|
45
|
+
}
|
|
46
|
+
// Compare payload and existingSettings, add missing keys from existingSettings to payload with default value
|
|
47
|
+
if (existingSettings) {
|
|
48
|
+
Object.keys(existingSettings).forEach((key) => {
|
|
49
|
+
if (!(key in payload)) {
|
|
50
|
+
payload[key] = defaultSettings[key];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Merge everything together
|
|
55
|
+
const fullSettings = merge({}, defaultSettings, config.LAYOUT_SETTINGS, existingSettings || {}, payload);
|
|
56
|
+
// Store only differences from default
|
|
57
|
+
const diffSettings = await compareAndSaveSettingsDifferences(fullSettings, defaultSettings);
|
|
58
|
+
// Create a new cookie with the diff settings
|
|
59
|
+
const newCookie = await settingsCookie.serialize(diffSettings);
|
|
60
|
+
return json(fullSettings, {
|
|
61
|
+
headers: {
|
|
62
|
+
'Set-Cookie': newCookie,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error('Error in action:', error);
|
|
68
|
+
return json({ error: 'Failed to update settings' }, { status: 500 });
|
|
69
|
+
}
|
|
33
70
|
};
|
|
34
71
|
const loader = async ({ request }) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
headers
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
72
|
+
try {
|
|
73
|
+
const { settings, setCookie } = await settingsLoaderUtil({ request });
|
|
74
|
+
// Always include headers, but only set cookie if provided
|
|
75
|
+
const headers = {};
|
|
76
|
+
if (setCookie) {
|
|
77
|
+
headers['Set-Cookie'] = setCookie;
|
|
78
|
+
}
|
|
79
|
+
return json({ settings }, { headers });
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error('Error in settings loader:', error);
|
|
83
|
+
// Fall back to default settings
|
|
84
|
+
return json({
|
|
85
|
+
settings: merge({}, defaultSettings, config.LAYOUT_SETTINGS),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
41
88
|
};export{action,loader,settingsLoaderUtil};//# sourceMappingURL=UpdateSettings.server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateSettings.server.js","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UpdateSettings.server.js","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"sourcesContent":[null],"names":[],"mappings":"igBAeY,6BAAc,CAAA,UAAA,EAAA;IACtB,MAAS,EAAA,EAAA,QAAS,EAAA,GAAA,EAAA;AACrB,IA2BA,QAAA,EAAA,KAAA;AAED,IAAO,QAAA,EAAA,KAAA;IAAqC,IAAO,EAAA,GAAE;AAAS,IAAA,MAAA,EAAA,MAAA,CAAA,MAAA,GAAA,MAAA,CAAA,UAAA,GAAA,SAAA;AAwC9D,CAAO,CAAA;AAA4C,eAAS,kBAAA,CAAA,EAAA,OAAA,EAAA,EAAA;AAAE,IAAA,MAAA,YAAA,GAAA,OAAA,CAAA,OAAA,CAAA,GAAA,CAAA,QAAA,CAAA;;IAkB5D,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -75,6 +75,13 @@ export type ISettings = ProSettings & {
|
|
|
75
75
|
searchBarOverlay: boolean;
|
|
76
76
|
scrollThreshold: number;
|
|
77
77
|
};
|
|
78
|
+
background: {
|
|
79
|
+
type: string;
|
|
80
|
+
color: string;
|
|
81
|
+
image: string;
|
|
82
|
+
video: string;
|
|
83
|
+
videoThumbnail: string;
|
|
84
|
+
};
|
|
78
85
|
footer: {
|
|
79
86
|
showFooter: boolean;
|
|
80
87
|
};
|
|
@@ -100,6 +107,12 @@ export type ISettings = ProSettings & {
|
|
|
100
107
|
searchBarOverlay: boolean;
|
|
101
108
|
scrollThreshold: number;
|
|
102
109
|
};
|
|
110
|
+
background: {
|
|
111
|
+
type: string;
|
|
112
|
+
color: string;
|
|
113
|
+
image: string;
|
|
114
|
+
video: string;
|
|
115
|
+
};
|
|
103
116
|
footer: {
|
|
104
117
|
showFooter: boolean;
|
|
105
118
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultSettings.d.ts","sourceRoot":"","sources":["../../src/config/defaultSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB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,CAAC;IACF,UAAU,EAAE,GAAG,EAAE,CAAC;IAClB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SA6G7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultSettings.js","sources":["../../src/config/defaultSettings.ts"],"sourcesContent":[null],"names":[],"mappings":"0DACA;AACA;
|
|
1
|
+
{"version":3,"file":"defaultSettings.js","sources":["../../src/config/defaultSettings.ts"],"sourcesContent":[null],"names":[],"mappings":"0DACA;AACA;AA8EA,MAAM,cAAM,GAAY;IACpB,YAAY,EAAC,OAAA;IACb,WAAgB,EAAA,IAAA;IAChB,YAAc,EAAA;IACd,UAAU,EAAE;;MAEF,iBAAS;IACnB,QAAe,EAAA,IAAA;IACf,sBAAoB;IACpB,cAAa;IACb,cAAc,EAAE;IAChB,aAAY;IACZ,uBAAsB;IACtB,QAAS,EAAA,OAAQ;IACjB,eAAc,EAAA,SAAA;IACd,SAAS,EAAE;IACX,UAAe,EAAA,IAAA;IACf,QAAiB,EAAA,IAAA;IACjB,sBAAqB;IACrB,eAAoB,EAAA,IAAA;IACpB,iBAAgB,mBAAS,CAAA,SAAA;IACzB,gBAAkB,EAAA;IAClB,eAAyB,EAAA,EAAA;;MAED,YAAA,GAAA;IACxB,MAAiB,EAAA,QAAA;IACjB,OAAY,EAAA;AACZ,IAAA,IAAA,EAAA,MAAA;AAGQ,CAAA;AACI,MAAA,SAAA,GAAA;;;;sBAIe;;;;;;cAMb;AACF,IAAA,SAAA;;;;wBAIe,GAAA;;yBAED;sBACU,EAAA,OAAA;oBACC,EAAA,UAAA;4BACD,EAAA;6BACtB,EAAA,WAAA;4BACJ,EAAA,OAAA;AACF,KAAA;AACI,IAAA,OAAA,EAAA;AACI,QAAA,MAAA,EAAA;6BACY;0BACM,EAAA,IAAA;oBACd,MAAgB;;oBAEhB;yBACa;4BACI;qBACT;qBACF;0BACS,EAAA,EAAA;;4BAEL,EAAA;;;qBAGK,GAAA;6EACsB;sBACrB;oBAChB;kBACF,SAAA;AACF,IAAA,YAAA,EAAA,SAAY;oBACR;;iCAEa,YAAC;2CACA;+BACA,CAAA,YAAS;oBACzB;AACF,IAAA,KAAA,EAAA,aAAQ;;oBAEN,EAAA,IAAA;cACJ,EAAA,SAAA;AACF,IAAA,QAAA,EAAA,OAAQ;AACJ,IAAA,UAAA,EAAA,qBAAQ;qBACI,KAAA;uBACM;2BACE;oBAChB,KAAc;0BACA;qBACD,MAAA;qBACI,EAAA,QAAA;gEACA;wBACX,EAAA;oBACN,EAAe,QAAA;sBACN,EAAA,EAAA;6BACC,EAAA;2BACF,EAAA,2FAAU;4BACF,EAAA,KAAA;qBACD;;;oBAGf;uBACF,EAAA,kBAAA,CAAA,MAAA;AACF,gBAAA,MAAA,EAAA,kBAAY,CAAA,MAAA;;qBAEH;uBACA,EAAA,kBAAS,CAAA,OAAA;sBACT,EAAA,kBAAS,CAAA,OAAA;;AAElB,SAAA;;kBAEE;mBACJ,EAAA,IAAA;qBACJ,EAAA;AACL,QACH,iBAAA,EAAA;YACQ,CAAA,YAAQ,CAAA,MAAA,GAAA,IAAA;AAClB,YAAA,CAAA,YAAiB,CAAA,OAAS,GAAK,IAAA;YACjC,CAAA,YAAA,CAAA,IAAA,GAAA,IAAA;AAEF,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-config.d.ts","sourceRoot":"","sources":["../../src/config/env-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"env-config.d.ts","sourceRoot":"","sources":["../../src/config/env-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAOhD,QAAA,MAAM,SAAS;;;gCAKb,CAAC;AACH,QAAA,IAAI,MAAM,EAAS,OAAO,SAAS,CAAC;AAepC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/lib/config/env-config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as envalid from'envalid';import {getEnvironment}from'@common-stack/core';import {defaultSettings}from'./defaultSettings.js';const { json } = envalid;
|
|
1
|
+
import*as envalid from'envalid';import {getEnvironment}from'@common-stack/core';import {defaultSettings}from'./defaultSettings.js';import {merge}from'lodash-es';const { json } = envalid;
|
|
2
2
|
const env = getEnvironment();
|
|
3
3
|
const preConfig = envalid.cleanEnv(env, {
|
|
4
4
|
LAYOUT_SETTINGS: json({
|
|
@@ -7,9 +7,16 @@ const preConfig = envalid.cleanEnv(env, {
|
|
|
7
7
|
APP_DOMAIN: envalid.str({ default: 'cdebase.dev' }),
|
|
8
8
|
});
|
|
9
9
|
let config = {};
|
|
10
|
-
//
|
|
10
|
+
// Parse the LAYOUT_SETTINGS if it exists in the environment
|
|
11
11
|
if (env.LAYOUT_SETTINGS) {
|
|
12
|
-
|
|
12
|
+
try {
|
|
13
|
+
const parsedLayoutSettings = JSON.parse(env.LAYOUT_SETTINGS);
|
|
14
|
+
config = { ...preConfig, LAYOUT_SETTINGS: merge({}, defaultSettings, parsedLayoutSettings) };
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error('Error parsing LAYOUT_SETTINGS:', error);
|
|
18
|
+
config = preConfig;
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
else {
|
|
15
22
|
config = preConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-config.js","sources":["../../src/config/env-config.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"env-config.js","sources":["../../src/config/env-config.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAeA,MAAA,SAAI,GAAM,OAAS,CAAA,YAAiB,EAAA;AAepC,IAAO,eAAW,EAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayoutSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useLayoutSettings.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,iBAAiB;;
|
|
1
|
+
{"version":3,"file":"useLayoutSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useLayoutSettings.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,iBAAiB;;0BA4BP,GAAG;;CA4CzB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {useCallback}from'react';import {useDispatch,useSelector}from'react-redux';import {merge}from'lodash-es';import {defaultSettings}from'../config/defaultSettings.js';import {CHANGE_SETTINGS_ACTION}from'../constants/constants.js';import {compareAndSaveSettingsDifferences}from'../utils/settingsDifference.js';const updateColorWeak = (colorWeak) => {
|
|
2
2
|
// @sri to avoid breaking during SSR, split into to checks
|
|
3
3
|
if (typeof window !== 'undefined') {
|
|
4
4
|
const root = document.getElementById('root');
|
|
@@ -10,18 +10,6 @@ import {useEffect,useCallback}from'react';import {useDispatch,useSelector}from'r
|
|
|
10
10
|
const useLayoutSettings = () => {
|
|
11
11
|
const dispatch = useDispatch();
|
|
12
12
|
const settings = useSelector((state) => state.settings);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (!settings || Object.keys(settings).length === 0) {
|
|
15
|
-
void getSettings().then((settingsData) => {
|
|
16
|
-
if (settingsData) {
|
|
17
|
-
dispatch({
|
|
18
|
-
type: CHANGE_SETTINGS_ACTION,
|
|
19
|
-
payload: settingsData,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}, [dispatch, settings]);
|
|
25
13
|
const getSettings = useCallback(async () => {
|
|
26
14
|
try {
|
|
27
15
|
const response = await fetch('/resources/settings', {
|
|
@@ -34,20 +22,7 @@ const useLayoutSettings = () => {
|
|
|
34
22
|
throw new Error('Failed to fetch settings');
|
|
35
23
|
}
|
|
36
24
|
const diffSettings = await response.json();
|
|
37
|
-
|
|
38
|
-
const mergedSettings = merge({}, defaultSettings, diffSettings);
|
|
39
|
-
// Ensure route settings are properly merged
|
|
40
|
-
if (diffSettings.routeSettings) {
|
|
41
|
-
Object.keys(diffSettings.routeSettings).forEach((route) => {
|
|
42
|
-
if (defaultSettings.routeSettings[route]) {
|
|
43
|
-
mergedSettings.routeSettings[route] = merge({}, defaultSettings.routeSettings[route], diffSettings.routeSettings[route]);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
mergedSettings.routeSettings[route] = diffSettings.routeSettings[route];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return mergedSettings;
|
|
25
|
+
return diffSettings.settings;
|
|
51
26
|
}
|
|
52
27
|
catch (error) {
|
|
53
28
|
console.error(error);
|
|
@@ -65,9 +40,7 @@ const useLayoutSettings = () => {
|
|
|
65
40
|
}
|
|
66
41
|
}
|
|
67
42
|
updateColorWeak(!!colorWeak);
|
|
68
|
-
// Use the improved difference comparison and saving function
|
|
69
43
|
const cleanDiffSettings = compareAndSaveSettingsDifferences(config, defaultSettings);
|
|
70
|
-
console.log('cleanDiffSettings >>>>>>>>>>>>>>', cleanDiffSettings);
|
|
71
44
|
const response = await fetch('/resources/settings', {
|
|
72
45
|
method: 'POST',
|
|
73
46
|
headers: {
|
|
@@ -79,7 +52,6 @@ const useLayoutSettings = () => {
|
|
|
79
52
|
throw new Error('Failed to update settings');
|
|
80
53
|
}
|
|
81
54
|
const result = await response.json();
|
|
82
|
-
console.log('result >>>>>>>>>>>>>>', result);
|
|
83
55
|
// Merge the full config with default settings before updating the store
|
|
84
56
|
const mergedSettings = merge({}, defaultSettings, config);
|
|
85
57
|
dispatch({
|
|
@@ -92,5 +64,5 @@ const useLayoutSettings = () => {
|
|
|
92
64
|
return null;
|
|
93
65
|
}
|
|
94
66
|
}, [dispatch, settings]);
|
|
95
|
-
return { settings, setSettings };
|
|
67
|
+
return { settings, setSettings, getSettings };
|
|
96
68
|
};export{useLayoutSettings};//# sourceMappingURL=useLayoutSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayoutSettings.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
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{getAntdLocale}from'./utils/getAntdLocale.js';export{generateMenuPath}from'./utils/generateMenuLink.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{defaultSettings}from'./config/defaultSettings.js';export{ThemeProvider,getTheme}from'./antd-themes/ThemeProvider.js';export{airbnbDarkTheme}from'./antd-themes/airbnb-dark-theme.js';export{airbnbLightTheme}from'./antd-themes/airbnb-light-theme.js';export{colorList,getThemeColors}from'./antd-themes/colors.js';export{defaultDarkTheme}from'./antd-themes/default-dark-theme.js';export{defaultLightTheme}from'./antd-themes/default-light-theme.js';export{githubDarkTheme}from'./antd-themes/github-dark-theme.js';export{githubLightTheme}from'./antd-themes/github-light-theme.js';export{slackDarkTheme}from'./antd-themes/slack-dark-theme.js';export{slackLightTheme}from'./antd-themes/slack-light-theme.js';export{spotifyDarkTheme}from'./antd-themes/spotify-dark-theme.js';export{spotifyLightTheme}from'./antd-themes/spotify-light-theme.js';export{themeRegistry}from'./antd-themes/themeRegistry.js';export{useLayoutSettings}from'./hooks/useLayoutSettings.js';export{usePermissionAutoFetch,useSetting,useSettingsLoader}from'@adminide-stack/platform-client';export{ClientOnly}from'./hooks/Client-only.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{getAntdLocale}from'./utils/getAntdLocale.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{defaultSettings}from'./config/defaultSettings.js';export{ThemeProvider,getTheme}from'./antd-themes/ThemeProvider.js';export{airbnbDarkTheme}from'./antd-themes/airbnb-dark-theme.js';export{airbnbLightTheme}from'./antd-themes/airbnb-light-theme.js';export{colorList,getThemeColors}from'./antd-themes/colors.js';export{defaultDarkTheme}from'./antd-themes/default-dark-theme.js';export{defaultLightTheme}from'./antd-themes/default-light-theme.js';export{githubDarkTheme}from'./antd-themes/github-dark-theme.js';export{githubLightTheme}from'./antd-themes/github-light-theme.js';export{slackDarkTheme}from'./antd-themes/slack-dark-theme.js';export{slackLightTheme}from'./antd-themes/slack-light-theme.js';export{spotifyDarkTheme}from'./antd-themes/spotify-dark-theme.js';export{spotifyLightTheme}from'./antd-themes/spotify-light-theme.js';export{themeRegistry}from'./antd-themes/themeRegistry.js';export{useLayoutSettings}from'./hooks/useLayoutSettings.js';export{usePermissionAutoFetch,useSetting,useSettingsLoader}from'@adminide-stack/platform-client';export{ClientOnly}from'./hooks/Client-only.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{getAntdLocale}from'./utils/getAntdLocale.js';export{generateMenuPath}from'./utils/generateMenuLink.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{defaultSettings}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{getAntdLocale}from'./utils/getAntdLocale.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{defaultSettings}from'./config/defaultSettings.js';//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateMenuLink.d.ts","sourceRoot":"","sources":["../../src/utils/generateMenuLink.ts"],"names":[],"mappings":"AAwEA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"generateMenuLink.d.ts","sourceRoot":"","sources":["../../src/utils/generateMenuLink.ts"],"names":[],"mappings":"AAwEA,eAAO,MAAM,gBAAgB,oCAa5B,CAAC"}
|
|
@@ -67,24 +67,12 @@ function generatePath(originalPath, params) {
|
|
|
67
67
|
return prefix + segments.join('/');
|
|
68
68
|
}
|
|
69
69
|
const generateMenuPath = (path, params) => {
|
|
70
|
-
// Check if all required parameters exist before attempting to generate the path
|
|
71
|
-
const requiredParams = [];
|
|
72
|
-
path.split('/').forEach((segment) => {
|
|
73
|
-
if (segment.startsWith(':') && !segment.endsWith('?')) {
|
|
74
|
-
const paramName = segment.substring(1);
|
|
75
|
-
requiredParams.push(paramName);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
// If any required parameter is missing, return null immediately
|
|
79
|
-
const missingParams = requiredParams.filter((param) => params[param] === undefined);
|
|
80
|
-
if (missingParams.length > 0) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
70
|
try {
|
|
84
71
|
const generatedPath = generatePath(path, params);
|
|
85
72
|
return generatedPath;
|
|
86
73
|
}
|
|
87
74
|
catch (err) {
|
|
75
|
+
console.error('Error generating path:', err);
|
|
88
76
|
console.log('Path:', path);
|
|
89
77
|
console.log('Params:', params);
|
|
90
78
|
console.warn(`menu path ${path} is errored due to missing params. If it is not required, please use hidemenu option`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateMenuLink.js","sources":["../../src/utils/generateMenuLink.ts"],"sourcesContent":[null],"names":[],"mappings":"AAwEA,SAAO,SAAA,CAAA,KAAsB,EAAA,OAAA,EAAA
|
|
1
|
+
{"version":3,"file":"generateMenuLink.js","sources":["../../src/utils/generateMenuLink.ts"],"sourcesContent":[null],"names":[],"mappings":"AAwEA,SAAO,SAAA,CAAA,KAAsB,EAAA,OAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
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,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,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,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
|
|
@@ -166,7 +166,7 @@ const compareAndSaveSettingsDifferences = (currentSettings, defaultSettings) =>
|
|
|
166
166
|
}
|
|
167
167
|
// If there are no differences at all, return early
|
|
168
168
|
if (Object.keys(diffSettings).length === 0) {
|
|
169
|
-
return {
|
|
169
|
+
return {};
|
|
170
170
|
}
|
|
171
171
|
// Remove empty objects from the diff
|
|
172
172
|
// This helps prevent unnecessary properties in the payload
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/client",
|
|
3
|
-
"version": "10.0.9-alpha.
|
|
3
|
+
"version": "10.0.9-alpha.67",
|
|
4
4
|
"description": "Sample client for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "f7ada2c4bfede9df31d8cc4da070d2f8ed85dd62",
|
|
41
41
|
"typescript": {
|
|
42
42
|
"definition": "lib/index.d.ts"
|
|
43
43
|
}
|