@admin-layout/client 12.0.16-alpha.7 → 12.0.16-alpha.72
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/__tests__/ApplicationErrorHandlerCommon.test.d.ts.map +1 -0
- package/lib/__tests__/ConfigurationModelWrapper.test.d.ts +2 -0
- package/lib/__tests__/ConfigurationModelWrapper.test.d.ts.map +1 -0
- package/lib/__tests__/SettingsConfigurationModel.test.d.ts.map +1 -0
- package/lib/__tests__/__fixtures__/defaultSettingsExample.d.ts +3 -0
- package/lib/__tests__/__fixtures__/defaultSettingsExample.d.ts.map +1 -0
- package/lib/colors/colorsList.js.map +1 -1
- package/lib/colors/presets/black.js.map +1 -1
- package/lib/colors/presets/white.js.map +1 -1
- package/lib/components/ApplicationErrorHandlerCommon.js.map +1 -1
- package/lib/components/ErrorBoundaryCommon.js.map +1 -1
- package/lib/components/UpdateSettings/UpdateSettings.server.d.ts +65 -20
- package/lib/components/UpdateSettings/UpdateSettings.server.d.ts.map +1 -1
- package/lib/components/UpdateSettings/UpdateSettings.server.js +198 -103
- package/lib/components/UpdateSettings/UpdateSettings.server.js.map +1 -1
- package/lib/components/UpdateSettings/UpdateSettings.server.test.d.ts +2 -0
- package/lib/components/UpdateSettings/UpdateSettings.server.test.d.ts.map +1 -0
- package/lib/config/defaultSettings.d.ts +76 -1
- package/lib/config/defaultSettings.d.ts.map +1 -1
- package/lib/config/defaultSettings.js +2 -112
- package/lib/config/defaultSettings.js.map +1 -1
- package/lib/config/env-config.d.ts +3 -5
- package/lib/config/env-config.d.ts.map +1 -1
- package/lib/config/env-config.js +13 -20
- package/lib/config/env-config.js.map +1 -1
- package/lib/constants/constants.js.map +1 -1
- package/lib/constants/error.js.map +1 -1
- package/lib/constants/languages.js.map +1 -1
- package/lib/constants/layout.js.map +1 -1
- package/lib/graphql/link/error-link.js.map +1 -1
- package/lib/hooks/useLayoutSettings.d.ts +2 -2
- package/lib/hooks/useLayoutSettings.d.ts.map +1 -1
- package/lib/hooks/useLayoutSettings.js +64 -31
- package/lib/hooks/useLayoutSettings.js.map +1 -1
- package/lib/hooks/useLayoutSettings.test.d.ts +2 -0
- package/lib/hooks/useLayoutSettings.test.d.ts.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.native.js +1 -1
- package/lib/interfaces/pure-settings.d.ts +8 -0
- package/lib/interfaces/pure-settings.d.ts.map +1 -1
- package/lib/interfaces/settings.d.ts +7 -6
- package/lib/interfaces/settings.d.ts.map +1 -1
- package/lib/interfaces/settings.js.map +1 -1
- package/lib/interfaces/typings.d.ts +1 -1
- package/lib/interfaces/typings.d.ts.map +1 -1
- package/lib/redux/actions/error-actions.js.map +1 -1
- package/lib/redux/reducers/error.js.map +1 -1
- package/lib/redux/reducers/settings.d.ts.map +1 -1
- package/lib/redux/reducers/settings.js +2 -2
- package/lib/redux/reducers/settings.js.map +1 -1
- package/lib/redux/selectors/index.js.map +1 -1
- package/lib/redux/store.js +1 -1
- package/lib/redux/store.js.map +1 -1
- package/lib/themes/systemFont/index.js.map +1 -1
- package/lib/themes/templates/createLayoutTheme.js.map +1 -1
- package/lib/themes/templates/darkLayoutTheme.js.map +1 -1
- package/lib/themes/templates/lightLayoutTheme.js.map +1 -1
- package/lib/utils/assignDefaults.d.ts +0 -1
- package/lib/utils/assignDefaults.d.ts.map +1 -1
- package/lib/utils/assignDefaults.test.d.ts +0 -1
- package/lib/utils/generateMenuLink.js.map +1 -1
- package/lib/utils/matchMenuKeys.js.map +1 -1
- package/lib/utils/menuUtils.js.map +1 -1
- package/lib/utils/parseEnvUiLayoutSettings.d.ts +6 -0
- package/lib/utils/parseEnvUiLayoutSettings.d.ts.map +1 -0
- package/lib/utils/parseEnvUiLayoutSettings.js +27 -0
- package/lib/utils/parseEnvUiLayoutSettings.js.map +1 -0
- package/lib/utils/parseEnvUiLayoutSettings.test.d.ts +2 -0
- package/lib/utils/parseEnvUiLayoutSettings.test.d.ts.map +1 -0
- package/lib/utils/seperatedMenus.js.map +1 -1
- package/lib/utils/settingsDifference.d.ts +1 -0
- package/lib/utils/settingsDifference.d.ts.map +1 -1
- package/lib/utils/settingsDifference.js +51 -110
- package/lib/utils/settingsDifference.js.map +1 -1
- package/package.json +8 -4
- package/lib/components/UpdateSettings/SettingsConfigurationModel.test.d.ts.map +0 -1
- package/lib/components/__tests__/ApplicationErrorHandlerCommon.test.d.ts.map +0 -1
- package/lib/utils/assignDefaults.js +0 -166
- package/lib/utils/assignDefaults.js.map +0 -1
- /package/lib/{components/__tests__ → __tests__}/ApplicationErrorHandlerCommon.test.d.ts +0 -0
- /package/lib/{components/UpdateSettings → __tests__}/SettingsConfigurationModel.test.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"darkLayoutTheme.js","sources":["../../../src/themes/templates/darkLayoutTheme.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;IAuBE,0BAAA,EAAA,KAAA,CAAA,OAAA;AAEF,IAAA,0BAAa,EAAA,KAAA,CAAA,OAAwB;AAUrC,IAAA,0BAAa,EAAA,
|
|
1
|
+
{"version":3,"file":"darkLayoutTheme.js","sources":["../../../src/themes/templates/darkLayoutTheme.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;IAuBE,0BAAA,EAAA,KAAA,CAAA,OAAA;AAEF,IAAA,0BAAa,EAAA,KAAA,CAAA,OAAwB;AAUrC,IAAA,0BAAa,EAAA,KAAe,CAAE;AAK9B;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightLayoutTheme.js","sources":["../../../src/themes/templates/lightLayoutTheme.ts"],"sourcesContent":[null],"names":[],"mappings":"0VAuFA,MAAA,
|
|
1
|
+
{"version":3,"file":"lightLayoutTheme.js","sources":["../../../src/themes/templates/lightLayoutTheme.ts"],"sourcesContent":[null],"names":[],"mappings":"0VAuFA,MAAA,MAAO,GAAM;AAQb,IAAA,UAAA,EAAO,KAAM,CAAA,OAAA;AAQb,IAAA,UAAA,EAAO,KAAM,CAAA,IAAK;AAclB,IAAA,IAAA,EAAA,KAAO,CAAA,OAAM;AAKb,IAAA,SAAA,EAAO,KAAA,CAAM,OAAA;AAqEb,IAAA,WAAO,EAAA,KAAM,CAAA,OAAA;AAkBb,IAAA,KAAA,EAAA,KAAO,CAAA,OAAM;AAiBb,IAAA,SAAA,EAAO,KAAA,CAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -7,5 +7,4 @@ export interface DefaultsObject {
|
|
|
7
7
|
* @param target - The target object to assign defaults to
|
|
8
8
|
* @param source - The source object containing the structure and default values
|
|
9
9
|
*/
|
|
10
|
-
export declare function assignDefaults(target: DefaultsObject, source: DefaultsObject): void;
|
|
11
10
|
//# sourceMappingURL=assignDefaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assignDefaults.d.ts","sourceRoot":"","sources":["../../src/utils/assignDefaults.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"assignDefaults.d.ts","sourceRoot":"","sources":["../../src/utils/assignDefaults.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;;;;GAKG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateMenuLink.js","sources":["../../src/utils/generateMenuLink.ts"],"sourcesContent":[null],"names":[],"mappings":"AAwEA,SAAA,
|
|
1
|
+
{"version":3,"file":"generateMenuLink.js","sources":["../../src/utils/generateMenuLink.ts"],"sourcesContent":[null],"names":[],"mappings":"AAwEA,SAAA,eAAa,EAAA,OAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchMenuKeys.js","sources":["../../src/utils/matchMenuKeys.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAEA;;;;;;;AAOG,MAAA,gBAAA,GAAA,CAAA,SAAA,EAAA,WAAA,KAAA;AAEH,IAAA,MAAA,
|
|
1
|
+
{"version":3,"file":"matchMenuKeys.js","sources":["../../src/utils/matchMenuKeys.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAEA;;;;;;;AAOG,MAAA,gBAAA,GAAA,CAAA,SAAA,EAAA,WAAA,KAAA;AAEH,IAAA,MAAA,SAAO,GAAM,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menuUtils.js","sources":["../../src/utils/menuUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAaG;AACH;AA2BA;AAeA,MAAA,uCAA+B;AAS/B,
|
|
1
|
+
{"version":3,"file":"menuUtils.js","sources":["../../src/utils/menuUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAaG;AACH;AA2BA;AAeA,MAAA,uCAA+B;AAS/B,IAAA,MAAA,CAAA,KAAO,CAAA,kCAAgC,CAAA;AAWvC,IAAA,MAAA,cAAa,GAAA,mBAA0B,CAAA,QAAA,CAAA;AAevC,IAAA,QAAA;;;AAGG,QAAA,MAAA,EAAA,SAAA,EAAA,GAAA,IAAA;AACH,QAAA,IAAA,KAAA,CAAA,OAAgB,CAAA,SAAA,CAAA,IAAA,SAAA,EAA2B,MAAI,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse LAYOUT_SETTINGS from config (which may be a JSON string from env variable)
|
|
3
|
+
* This is the single place where we handle the parsing logic
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseEnvLayoutSettings(): Record<string, any>;
|
|
6
|
+
//# sourceMappingURL=parseEnvUiLayoutSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseEnvUiLayoutSettings.d.ts","sourceRoot":"","sources":["../../src/utils/parseEnvUiLayoutSettings.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAwB5D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {config}from'../config/env-config.js';import'../config/defaultSettings.js';/**
|
|
2
|
+
* Parse LAYOUT_SETTINGS from config (which may be a JSON string from env variable)
|
|
3
|
+
* This is the single place where we handle the parsing logic
|
|
4
|
+
*/
|
|
5
|
+
function parseEnvLayoutSettings() {
|
|
6
|
+
try {
|
|
7
|
+
if (!config.LAYOUT_SETTINGS) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
// If it's already an object (parsed by envalid json validator), return it
|
|
11
|
+
if (typeof config.LAYOUT_SETTINGS === 'object' && !Array.isArray(config.LAYOUT_SETTINGS)) {
|
|
12
|
+
return config.LAYOUT_SETTINGS;
|
|
13
|
+
}
|
|
14
|
+
// If it's a string, parse it (this happens when envalid uses str validator)
|
|
15
|
+
if (typeof config.LAYOUT_SETTINGS === 'string') {
|
|
16
|
+
const parsed = JSON.parse(config.LAYOUT_SETTINGS);
|
|
17
|
+
return parsed || {};
|
|
18
|
+
}
|
|
19
|
+
console.warn('⚠️ config.LAYOUT_SETTINGS is unexpected type:', typeof config.LAYOUT_SETTINGS);
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error('❌ Error parsing LAYOUT_SETTINGS:', error);
|
|
24
|
+
console.error('❌ Value was:', config.LAYOUT_SETTINGS);
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
}export{parseEnvLayoutSettings};//# sourceMappingURL=parseEnvUiLayoutSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseEnvUiLayoutSettings.js","sources":["../../src/utils/parseEnvUiLayoutSettings.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseEnvUiLayoutSettings.test.d.ts","sourceRoot":"","sources":["../../src/utils/parseEnvUiLayoutSettings.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seperatedMenus.js","sources":["../../src/utils/seperatedMenus.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAGY,uBAAkB,GAAG,CAAA,KAAA,KAAA;AAC7B,IAAA,IAAA,CAAA,KAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"seperatedMenus.js","sources":["../../src/utils/seperatedMenus.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAGY,uBAAkB,GAAG,CAAA,KAAA,KAAA;AAC7B,IAAA,IAAA,CAAA,KAAU,CAAC,OAAE,CAAA,KAAA,CAAY,EAAE;AAC3B,QAAA,OAAW,CAAC,GAAE,CAAA,kBAAe,EAAA,KAAA,CAAA;AAC7B,IAAA;AACA;IACF,MAAA,UAAA,GAAA,KAAA,EAAA,MAAA,CAAA,CAAA,IAAA,KAAA,IAAA,CAAA,QAAA,KAAA,OAAA,CAAA,IAAA,EAAA;AAGF,IAAA,MAAA,WAAa,GAAA,KAAA,EAAA,MAAA,CAAiB,CAAA,IAAG,KAAO,IAAA,CAAA,QAAY,KAAE,QAAK;;;;;;;;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Compares settings objects and saves only the differences
|
|
3
|
+
* @returns An object containing only the differences, or an empty object on error
|
|
3
4
|
*/
|
|
4
5
|
export declare const compareAndSaveSettingsDifferences: (currentSettings: any, defaultSettings: any) => any;
|
|
5
6
|
//# sourceMappingURL=settingsDifference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settingsDifference.d.ts","sourceRoot":"","sources":["../../src/utils/settingsDifference.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settingsDifference.d.ts","sourceRoot":"","sources":["../../src/utils/settingsDifference.ts"],"names":[],"mappings":"AAkLA;;;GAGG;AACH,eAAO,MAAM,iCAAiC,GAAI,iBAAiB,GAAG,EAAE,iBAAiB,GAAG,QA8D3F,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {cloneDeep,
|
|
1
|
+
import {cloneDeep,isObject,isEqual,transform}from'lodash-es';/**
|
|
2
2
|
* Gets the deep differences between two objects
|
|
3
3
|
* Returns only the values that differ from obj2
|
|
4
4
|
*/
|
|
@@ -16,17 +16,26 @@ const getDifference = (obj1, obj2) => {
|
|
|
16
16
|
return source;
|
|
17
17
|
}
|
|
18
18
|
// Handle non-object comparisons (primitives, functions, etc.)
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// IMPORTANT: Check for string BEFORE isObject check, because strings are technically objects
|
|
20
|
+
if (typeof source === 'string' || typeof target === 'string') {
|
|
21
21
|
if (typeof source === 'string' && typeof target === 'string') {
|
|
22
|
+
// Case-insensitive string comparison
|
|
22
23
|
return source.toLowerCase() !== target.toLowerCase() ? source : undefined;
|
|
23
24
|
}
|
|
25
|
+
// If types differ, return the source value
|
|
26
|
+
return source;
|
|
27
|
+
}
|
|
28
|
+
if (!isObject(source) || !isObject(target)) {
|
|
24
29
|
return !isEqual(source, target) ? source : undefined;
|
|
25
30
|
}
|
|
26
31
|
// For arrays, do a simple equality check and return the full array if different
|
|
27
32
|
if (Array.isArray(source) && Array.isArray(target)) {
|
|
28
33
|
return !isEqual(source, target) ? source : undefined;
|
|
29
34
|
}
|
|
35
|
+
// Prevent string from being treated as an object with numeric keys
|
|
36
|
+
if (Array.isArray(source) !== Array.isArray(target)) {
|
|
37
|
+
return source;
|
|
38
|
+
}
|
|
30
39
|
// For objects, do deep comparison
|
|
31
40
|
const result = transform(source, (result, value, key) => {
|
|
32
41
|
// Skip keys that are in source but have the exact same value in target
|
|
@@ -54,129 +63,61 @@ const getDifference = (obj1, obj2) => {
|
|
|
54
63
|
// Return undefined if the resulting object is empty
|
|
55
64
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
56
65
|
};
|
|
57
|
-
/**
|
|
58
|
-
* Special handler for route settings differences with improved nested comparison
|
|
59
|
-
*/
|
|
60
|
-
const getRouteSettingsDifferences = (currentRouteSettings, defaultRouteSettings) => {
|
|
61
|
-
const differences = {};
|
|
62
|
-
// Get the default route template (typically from '/')
|
|
63
|
-
const defaultRouteTemplate = defaultRouteSettings['/'] || Object.values(defaultRouteSettings)[0];
|
|
64
|
-
if (!defaultRouteTemplate) {
|
|
65
|
-
console.warn('No default route template found for comparison');
|
|
66
|
-
return currentRouteSettings;
|
|
67
|
-
}
|
|
68
|
-
// Compare each route's settings
|
|
69
|
-
Object.keys(currentRouteSettings).forEach((route) => {
|
|
70
|
-
const currentRouteConfig = currentRouteSettings[route];
|
|
71
|
-
// Use the specific route config if it exists, otherwise use the default template
|
|
72
|
-
const defaultRouteConfig = defaultRouteSettings[route] || defaultRouteTemplate;
|
|
73
|
-
// Compare each section separately (layout, regions, etc)
|
|
74
|
-
const routeDiff = {};
|
|
75
|
-
Object.keys(currentRouteConfig).forEach((section) => {
|
|
76
|
-
if (section === 'layout' || section === 'regions') {
|
|
77
|
-
const sectionDiff = {};
|
|
78
|
-
// Compare desktop and mobile separately
|
|
79
|
-
['desktop', 'mobile'].forEach((device) => {
|
|
80
|
-
if (!currentRouteConfig[section][device]) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
// For regions section with header/footer/background
|
|
84
|
-
if (section === 'regions') {
|
|
85
|
-
const regionsDiff = {};
|
|
86
|
-
['header', 'footer', 'background'].forEach((region) => {
|
|
87
|
-
if (!currentRouteConfig[section][device][region]) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
// Get default path for comparison
|
|
91
|
-
const defaultRegionPath = `${section}.${device}.${region}`;
|
|
92
|
-
const defaultRegion = get(defaultRouteConfig, defaultRegionPath);
|
|
93
|
-
if (defaultRegion) {
|
|
94
|
-
const regionDiff = getDifference(currentRouteConfig[section][device][region], defaultRegion);
|
|
95
|
-
if (regionDiff !== undefined &&
|
|
96
|
-
(Array.isArray(regionDiff) || Object.keys(regionDiff).length > 0)) {
|
|
97
|
-
regionsDiff[region] = regionDiff;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
if (Object.keys(regionsDiff).length > 0) {
|
|
102
|
-
sectionDiff[device] = regionsDiff;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
// For other sections (like layout)
|
|
107
|
-
const defaultDevicePath = `${section}.${device}`;
|
|
108
|
-
const defaultDevice = get(defaultRouteConfig, defaultDevicePath);
|
|
109
|
-
if (defaultDevice) {
|
|
110
|
-
const deviceDiff = getDifference(currentRouteConfig[section][device], defaultDevice);
|
|
111
|
-
if (deviceDiff !== undefined && Object.keys(deviceDiff).length > 0) {
|
|
112
|
-
sectionDiff[device] = deviceDiff;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
if (Object.keys(sectionDiff).length > 0) {
|
|
118
|
-
routeDiff[section] = sectionDiff;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
const sectionDiff = getDifference(currentRouteConfig[section], defaultRouteConfig[section]);
|
|
123
|
-
if (sectionDiff !== undefined && Object.keys(sectionDiff).length > 0) {
|
|
124
|
-
routeDiff[section] = sectionDiff;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
// Only include the route if there are actual differences
|
|
129
|
-
if (Object.keys(routeDiff).length > 0) {
|
|
130
|
-
differences[route] = routeDiff;
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
return Object.keys(differences).length > 0 ? differences : undefined;
|
|
134
|
-
};
|
|
135
66
|
/**
|
|
136
67
|
* Compares settings objects and saves only the differences
|
|
68
|
+
* @returns An object containing only the differences, or an empty object on error
|
|
137
69
|
*/
|
|
138
70
|
const compareAndSaveSettingsDifferences = (currentSettings, defaultSettings) => {
|
|
139
71
|
try {
|
|
140
72
|
if (!currentSettings || !defaultSettings) {
|
|
141
73
|
console.warn('Missing settings objects for comparison');
|
|
142
|
-
return
|
|
74
|
+
return {};
|
|
143
75
|
}
|
|
144
76
|
// Make deep clones to avoid modifying the original objects
|
|
145
77
|
const current = cloneDeep(currentSettings);
|
|
146
78
|
const defaults = cloneDeep(defaultSettings);
|
|
147
|
-
//
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
79
|
+
// Extract overrides (bracket keys) from current settings
|
|
80
|
+
const overrides = {};
|
|
81
|
+
Object.keys(current).forEach((key) => {
|
|
82
|
+
if (key.startsWith('[') && key.endsWith(']')) {
|
|
83
|
+
overrides[key] = current[key];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
// Get differences for non-override settings (base settings)
|
|
87
|
+
const currentBase = { ...current };
|
|
88
|
+
const defaultBase = { ...defaults };
|
|
89
|
+
// Remove all bracket keys from both objects
|
|
90
|
+
Object.keys(currentBase).forEach((key) => {
|
|
91
|
+
if (key.startsWith('[') && key.endsWith(']')) {
|
|
92
|
+
delete currentBase[key];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
Object.keys(defaultBase).forEach((key) => {
|
|
96
|
+
if (key.startsWith('[') && key.endsWith(']')) {
|
|
97
|
+
delete defaultBase[key];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
const baseSettingsDiff = getDifference(currentBase, defaultBase);
|
|
101
|
+
// Combine base settings differences with overrides
|
|
102
|
+
// const diffSettings: any = {};
|
|
103
|
+
// // Add base settings differences if any exist
|
|
104
|
+
// if (baseSettingsDiff && Object.keys(baseSettingsDiff).length > 0) {
|
|
105
|
+
// Object.assign(diffSettings, baseSettingsDiff);
|
|
106
|
+
// }
|
|
107
|
+
// console.log('diffSettings :', diffSettings);
|
|
108
|
+
// // Add all overrides (they are always different from defaults)
|
|
109
|
+
// Object.assign(diffSettings, overrides);
|
|
110
|
+
// // If there are no differences at all, return early
|
|
111
|
+
// if (Object.keys(diffSettings).length === 0) {
|
|
112
|
+
// return {};
|
|
113
|
+
// }
|
|
172
114
|
// Remove empty objects from the diff
|
|
173
|
-
|
|
174
|
-
const cleanDiffSettings = removeEmptyObjects(diffSettings);
|
|
115
|
+
const cleanDiffSettings = removeEmptyObjects(baseSettingsDiff);
|
|
175
116
|
return cleanDiffSettings;
|
|
176
117
|
}
|
|
177
118
|
catch (error) {
|
|
178
119
|
console.error('Error comparing settings differences:', error);
|
|
179
|
-
return
|
|
120
|
+
return {};
|
|
180
121
|
}
|
|
181
122
|
};
|
|
182
123
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settingsDifference.js","sources":["../../src/utils/settingsDifference.ts"],"sourcesContent":[null],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"settingsDifference.js","sources":["../../src/utils/settingsDifference.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAqLG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/client",
|
|
3
|
-
"version": "12.0.16-alpha.
|
|
3
|
+
"version": "12.0.16-alpha.72",
|
|
4
4
|
"description": "Sample client for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -23,11 +23,15 @@
|
|
|
23
23
|
"watch": "yarn build:lib:watch"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@common-stack/client-core": "7.1.1-alpha.32",
|
|
27
|
-
"common": "12.0.16-alpha.7",
|
|
28
26
|
"serialize-error": "^8.0.0"
|
|
29
27
|
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"common": "12.0.16-alpha.70",
|
|
30
|
+
"rc-menu": "^9.16.1"
|
|
31
|
+
},
|
|
30
32
|
"peerDependencies": {
|
|
33
|
+
"@adminide-stack/core": ">=12.0.4-alpha.247",
|
|
34
|
+
"@common-stack/client-core": ">=7.1.1-alpha.63",
|
|
31
35
|
"envalid": "*",
|
|
32
36
|
"history": "*",
|
|
33
37
|
"lodash-es": "^4.17.21",
|
|
@@ -40,5 +44,5 @@
|
|
|
40
44
|
"typescript": {
|
|
41
45
|
"definition": "lib/index.d.ts"
|
|
42
46
|
},
|
|
43
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "74e741b33a694e67abed0694a1d76964550ef2c4"
|
|
44
48
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsConfigurationModel.test.d.ts","sourceRoot":"","sources":["../../../src/components/UpdateSettings/SettingsConfigurationModel.test.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationErrorHandlerCommon.test.d.ts","sourceRoot":"","sources":["../../../src/components/__tests__/ApplicationErrorHandlerCommon.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recursively assigns default values only for non-existent keys in target object,
|
|
3
|
-
* based on source object structure. Does not modify any existing values in target.
|
|
4
|
-
* @param target - The target object to assign defaults to
|
|
5
|
-
* @param source - The source object containing the structure and default values
|
|
6
|
-
*/
|
|
7
|
-
function assignDefaults(target, source) {
|
|
8
|
-
// Special handling for routeSettings to ensure all routes have complete structure
|
|
9
|
-
if (source?.routeSettings && target.routeSettings) {
|
|
10
|
-
const rootRoute = source.routeSettings['/'];
|
|
11
|
-
if (rootRoute) {
|
|
12
|
-
Object.keys(target.routeSettings).forEach((route) => {
|
|
13
|
-
const currentRoute = target.routeSettings[route];
|
|
14
|
-
// Handle layout
|
|
15
|
-
if (!currentRoute.layout) {
|
|
16
|
-
currentRoute.layout = {
|
|
17
|
-
desktop: { ...rootRoute.layout.desktop },
|
|
18
|
-
mobile: { ...rootRoute.layout.mobile },
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
if (!currentRoute.layout.desktop) {
|
|
23
|
-
currentRoute.layout.desktop = { ...rootRoute.layout.desktop };
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
Object.keys(rootRoute.layout.desktop).forEach((key) => {
|
|
27
|
-
if (!(key in currentRoute.layout.desktop)) {
|
|
28
|
-
currentRoute.layout.desktop[key] = rootRoute.layout.desktop[key];
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
if (!currentRoute.layout.mobile) {
|
|
33
|
-
currentRoute.layout.mobile = { ...rootRoute.layout.mobile };
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
Object.keys(rootRoute.layout.mobile).forEach((key) => {
|
|
37
|
-
if (!(key in currentRoute.layout.mobile)) {
|
|
38
|
-
currentRoute.layout.mobile[key] = rootRoute.layout.mobile[key];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Handle regions
|
|
44
|
-
if (!currentRoute.regions) {
|
|
45
|
-
currentRoute.regions = {
|
|
46
|
-
desktop: {
|
|
47
|
-
header: { ...rootRoute.regions.desktop.header },
|
|
48
|
-
background: { ...rootRoute.regions.desktop.background },
|
|
49
|
-
footer: { ...rootRoute.regions.desktop.footer },
|
|
50
|
-
},
|
|
51
|
-
mobile: {
|
|
52
|
-
header: { ...rootRoute.regions.mobile.header },
|
|
53
|
-
background: { ...rootRoute.regions.mobile.background },
|
|
54
|
-
footer: { ...rootRoute.regions.mobile.footer },
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
// Handle desktop regions
|
|
60
|
-
if (!currentRoute.regions.desktop) {
|
|
61
|
-
currentRoute.regions.desktop = {
|
|
62
|
-
header: { ...rootRoute.regions.desktop.header },
|
|
63
|
-
background: { ...rootRoute.regions.desktop.background },
|
|
64
|
-
footer: { ...rootRoute.regions.desktop.footer },
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
// Handle desktop header
|
|
69
|
-
if (!currentRoute.regions.desktop.header) {
|
|
70
|
-
currentRoute.regions.desktop.header = { ...rootRoute.regions.desktop.header };
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
Object.keys(rootRoute.regions.desktop.header).forEach((key) => {
|
|
74
|
-
if (!(key in currentRoute.regions.desktop.header)) {
|
|
75
|
-
currentRoute.regions.desktop.header[key] = rootRoute.regions.desktop.header[key];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
// Handle desktop background
|
|
80
|
-
if (!currentRoute.regions.desktop.background) {
|
|
81
|
-
currentRoute.regions.desktop.background = { ...rootRoute.regions.desktop.background };
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
Object.keys(rootRoute.regions.desktop.background).forEach((key) => {
|
|
85
|
-
if (!(key in currentRoute.regions.desktop.background)) {
|
|
86
|
-
currentRoute.regions.desktop.background[key] =
|
|
87
|
-
rootRoute.regions.desktop.background[key];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
// Handle desktop footer
|
|
92
|
-
if (!currentRoute.regions.desktop.footer) {
|
|
93
|
-
currentRoute.regions.desktop.footer = { ...rootRoute.regions.desktop.footer };
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
Object.keys(rootRoute.regions.desktop.footer).forEach((key) => {
|
|
97
|
-
if (!(key in currentRoute.regions.desktop.footer)) {
|
|
98
|
-
currentRoute.regions.desktop.footer[key] = rootRoute.regions.desktop.footer[key];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
// Handle mobile regions
|
|
104
|
-
if (!currentRoute.regions.mobile) {
|
|
105
|
-
currentRoute.regions.mobile = {
|
|
106
|
-
header: { ...rootRoute.regions.mobile.header },
|
|
107
|
-
background: { ...rootRoute.regions.mobile.background },
|
|
108
|
-
footer: { ...rootRoute.regions.mobile.footer },
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
// Handle mobile header
|
|
113
|
-
if (!currentRoute.regions.mobile.header) {
|
|
114
|
-
currentRoute.regions.mobile.header = { ...rootRoute.regions.mobile.header };
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
Object.keys(rootRoute.regions.mobile.header).forEach((key) => {
|
|
118
|
-
if (!(key in currentRoute.regions.mobile.header)) {
|
|
119
|
-
currentRoute.regions.mobile.header[key] = rootRoute.regions.mobile.header[key];
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
// Handle mobile background
|
|
124
|
-
if (!currentRoute.regions.mobile.background) {
|
|
125
|
-
currentRoute.regions.mobile.background = { ...rootRoute.regions.mobile.background };
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
Object.keys(rootRoute.regions.mobile.background).forEach((key) => {
|
|
129
|
-
if (!(key in currentRoute.regions.mobile.background)) {
|
|
130
|
-
currentRoute.regions.mobile.background[key] =
|
|
131
|
-
rootRoute.regions.mobile.background[key];
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
// Handle mobile footer
|
|
136
|
-
if (!currentRoute.regions.mobile.footer) {
|
|
137
|
-
currentRoute.regions.mobile.footer = { ...rootRoute.regions.mobile.footer };
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
Object.keys(rootRoute.regions.mobile.footer).forEach((key) => {
|
|
141
|
-
if (!(key in currentRoute.regions.mobile.footer)) {
|
|
142
|
-
currentRoute.regions.mobile.footer[key] = rootRoute.regions.mobile.footer[key];
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
Object.keys(source).forEach((key) => {
|
|
152
|
-
if (!(key in target)) {
|
|
153
|
-
// Only assign default if the key doesn't exist
|
|
154
|
-
target[key] = source[key];
|
|
155
|
-
}
|
|
156
|
-
else if (typeof source[key] === 'object' &&
|
|
157
|
-
source[key] !== null &&
|
|
158
|
-
!Array.isArray(source[key]) &&
|
|
159
|
-
typeof target[key] === 'object' &&
|
|
160
|
-
target[key] !== null &&
|
|
161
|
-
!Array.isArray(target[key])) {
|
|
162
|
-
// Recursively assign for nested objects
|
|
163
|
-
assignDefaults(target[key], source[key]);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}export{assignDefaults};//# sourceMappingURL=assignDefaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assignDefaults.js","sources":["../../src/utils/assignDefaults.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACI;AACH;AAED;;;;;AAKG,IAAA,IAAA,MAAA,EAAA,aAAA,IAAA,MAAA,CAAA,aAAA,EAAA;AACH,QAAgB,MAAA,SAAA,GAAA,MAAA,CAAA,aAAuB,CAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
File without changes
|
|
File without changes
|