@admin-layout/client 10.1.1-alpha.11 → 10.1.1-alpha.14
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 +14 -6
- package/lib/components/LayoutCookieProvider.js.map +1 -1
- package/lib/components/UpdateSettings/UpdateSettings.server.d.ts.map +1 -1
- package/lib/components/UpdateSettings/UpdateSettings.server.js +5 -2
- package/lib/components/UpdateSettings/UpdateSettings.server.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutCookieProvider.d.ts","sourceRoot":"","sources":["../../src/components/LayoutCookieProvider.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"LayoutCookieProvider.d.ts","sourceRoot":"","sources":["../../src/components/LayoutCookieProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,UAAU,yBAAyB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,yBAAyB,GAAG,KAAK,CAAC,YAAY,CA0BhG"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import {jsx,Fragment}from'react/jsx-runtime';import {useLoaderData}from'@remix-run/react';import {
|
|
1
|
+
import {jsx,Fragment}from'react/jsx-runtime';import {useLoaderData}from'@remix-run/react';import {useRef,useEffect}from'react';import {useDispatch}from'react-redux';import {CHANGE_SETTINGS_ACTION}from'../constants/constants.js';function LayoutCookieProvider({ children }) {
|
|
2
2
|
const { settings } = useLoaderData();
|
|
3
3
|
const dispatch = useDispatch();
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const hasDispatched = useRef(false);
|
|
5
|
+
// Handle both server and client side
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (settings && !hasDispatched.current) {
|
|
6
8
|
dispatch({
|
|
7
9
|
type: CHANGE_SETTINGS_ACTION,
|
|
8
10
|
payload: settings,
|
|
9
11
|
});
|
|
12
|
+
hasDispatched.current = true;
|
|
10
13
|
}
|
|
11
|
-
};
|
|
12
|
-
useLayoutEffect(() => {
|
|
13
|
-
changeSettings();
|
|
14
14
|
}, [settings, dispatch]);
|
|
15
|
+
// Initial server-side dispatch
|
|
16
|
+
if (typeof window === 'undefined' && settings && !hasDispatched.current) {
|
|
17
|
+
dispatch({
|
|
18
|
+
type: CHANGE_SETTINGS_ACTION,
|
|
19
|
+
payload: settings,
|
|
20
|
+
});
|
|
21
|
+
hasDispatched.current = true;
|
|
22
|
+
}
|
|
15
23
|
return jsx(Fragment, { children: children });
|
|
16
24
|
}export{LayoutCookieProvider};//# sourceMappingURL=LayoutCookieProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutCookieProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LayoutCookieProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
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;AAY/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,CA6BD;AAED,eAAO,MAAM,MAAM,GAAU,aAAa;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,
|
|
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;AAY/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,CA6BD;AAED,eAAO,MAAM,MAAM,GAAU,aAAa;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,oEAkC7D,CAAC;AAEF,eAAO,MAAM,MAAM,GAAU,aAAa;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE;;GAkB7D,CAAC"}
|
|
@@ -36,18 +36,21 @@ const action = async ({ request }) => {
|
|
|
36
36
|
try {
|
|
37
37
|
const jsonData = await request.json();
|
|
38
38
|
const payload = jsonData?.config || {};
|
|
39
|
+
assignDefaults(payload, defaultSettings);
|
|
39
40
|
const cookieHeader = request.headers.get('Cookie');
|
|
40
41
|
let existingSettings;
|
|
42
|
+
let mergedSettings;
|
|
41
43
|
try {
|
|
42
44
|
existingSettings = await settingsCookie.parse(cookieHeader);
|
|
43
|
-
|
|
45
|
+
mergedSettings = merge({}, existingSettings, payload);
|
|
46
|
+
assignDefaults(mergedSettings, defaultSettings);
|
|
44
47
|
}
|
|
45
48
|
catch (error) {
|
|
46
49
|
console.error('Error parsing settings cookie in action:', error);
|
|
47
50
|
existingSettings = null;
|
|
48
51
|
}
|
|
49
52
|
// Merge everything together
|
|
50
|
-
const fullSettings = merge({},
|
|
53
|
+
const fullSettings = merge({}, config.LAYOUT_SETTINGS, mergedSettings);
|
|
51
54
|
// Store only differences from default
|
|
52
55
|
const diffSettings = await compareAndSaveSettingsDifferences(fullSettings, defaultSettings);
|
|
53
56
|
// Create a new cookie with the diff settings
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateSettings.server.js","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"sourcesContent":[null],"names":[],"mappings":"uYAiBa,iBAAS,YAAA,CAAA,UAAA,EAAA;AACrB,IA6BA,MAAA,EAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA;AAED,IAAO,QAAA,EAAA,KAAA;IAAqC,QAAO;AAAW,IAAA,IAAA,EAAA,GAAA;
|
|
1
|
+
{"version":3,"file":"UpdateSettings.server.js","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"sourcesContent":[null],"names":[],"mappings":"uYAiBa,iBAAS,YAAA,CAAA,UAAA,EAAA;AACrB,IA6BA,MAAA,EAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA;AAED,IAAO,QAAA,EAAA,KAAA;IAAqC,QAAO;AAAW,IAAA,IAAA,EAAA,GAAA;AAoC9D,IAAO,MAAA,EAAA,MAAA,CAAA,MAAY,GAAA,MAAuB,CAAA,UAAA,GAAA,SAAA;;AAAoB,eAAA,kBAAA,CAAA,EAAA,OAAA,EAAA,EAAA;;IAkB5D,IAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/client",
|
|
3
|
-
"version": "10.1.1-alpha.
|
|
3
|
+
"version": "10.1.1-alpha.14",
|
|
4
4
|
"description": "Sample client for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"typescript": {
|
|
41
41
|
"definition": "lib/index.d.ts"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "377421f92a20ac0db0d2d59a6c5df304669bc01e"
|
|
44
44
|
}
|