@admin-layout/client 11.0.2-alpha.0 → 12.0.16-alpha.0

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.
Files changed (183) hide show
  1. package/lib/{antd-themes/colors.d.ts → colors/colorsList.d.ts} +1 -1
  2. package/lib/colors/colorsList.d.ts.map +1 -0
  3. package/lib/{antd-themes/colors.js → colors/colorsList.js} +1 -1
  4. package/lib/colors/colorsList.js.map +1 -0
  5. package/lib/colors/index.d.ts +1 -0
  6. package/lib/colors/index.d.ts.map +1 -1
  7. package/lib/colors/presets/black.js +0 -3
  8. package/lib/colors/presets/black.js.map +1 -1
  9. package/lib/colors/presets/brinkPink.js +11 -0
  10. package/lib/colors/presets/brinkPink.js.map +1 -0
  11. package/lib/colors/presets/cyan.js +11 -0
  12. package/lib/colors/presets/cyan.js.map +1 -0
  13. package/lib/colors/presets/lime.js +11 -0
  14. package/lib/colors/presets/lime.js.map +1 -0
  15. package/lib/colors/presets/pink.js +11 -0
  16. package/lib/colors/presets/pink.js.map +1 -0
  17. package/lib/colors/presets/purple.js +11 -0
  18. package/lib/colors/presets/purple.js.map +1 -0
  19. package/lib/colors/presets/skyBlue.js +11 -0
  20. package/lib/colors/presets/skyBlue.js.map +1 -0
  21. package/lib/colors/presets/turquoise.js +11 -0
  22. package/lib/colors/presets/turquoise.js.map +1 -0
  23. package/lib/colors/presets/white.js +0 -3
  24. package/lib/colors/presets/white.js.map +1 -1
  25. package/lib/components/ApplicationErrorFillWrapper.d.ts +1 -2
  26. package/lib/components/ApplicationErrorFillWrapper.d.ts.map +1 -1
  27. package/lib/components/ApplicationErrorFillWrapper.js +2 -2
  28. package/lib/components/ApplicationErrorHandlerCommon.d.ts.map +1 -1
  29. package/lib/components/ApplicationErrorHandlerCommon.js +6 -8
  30. package/lib/components/ApplicationErrorHandlerCommon.js.map +1 -1
  31. package/lib/components/ErrorBoundaryCommon.d.ts +1 -1
  32. package/lib/components/ErrorBoundaryCommon.js +2 -2
  33. package/lib/components/ErrorBoundaryCommon.js.map +1 -1
  34. package/lib/components/LayoutCookieProvider.d.ts +7 -0
  35. package/lib/components/LayoutCookieProvider.d.ts.map +1 -0
  36. package/lib/components/LayoutCookieProvider.js +25 -0
  37. package/lib/components/LayoutCookieProvider.js.map +1 -0
  38. package/lib/components/UpdateSettings/SettingsConfigurationModel.test.d.ts +2 -0
  39. package/lib/components/UpdateSettings/SettingsConfigurationModel.test.d.ts.map +1 -0
  40. package/lib/components/UpdateSettings/UpdateSettings.server.d.ts +21 -4
  41. package/lib/components/UpdateSettings/UpdateSettings.server.d.ts.map +1 -1
  42. package/lib/components/UpdateSettings/UpdateSettings.server.js +112 -24
  43. package/lib/components/UpdateSettings/UpdateSettings.server.js.map +1 -1
  44. package/lib/components/index.d.ts +1 -0
  45. package/lib/components/index.d.ts.map +1 -1
  46. package/lib/config/defaultSettings.d.ts +108 -1
  47. package/lib/config/defaultSettings.d.ts.map +1 -1
  48. package/lib/config/defaultSettings.js +160 -15
  49. package/lib/config/defaultSettings.js.map +1 -1
  50. package/lib/config/env-config.d.ts.map +1 -1
  51. package/lib/config/env-config.js +11 -4
  52. package/lib/config/env-config.js.map +1 -1
  53. package/lib/graphql/link/error-link.d.ts.map +1 -1
  54. package/lib/graphql/link/error-link.js +1 -1
  55. package/lib/graphql/link/error-link.js.map +1 -1
  56. package/lib/hooks/Client-only.d.ts +28 -0
  57. package/lib/hooks/Client-only.d.ts.map +1 -0
  58. package/lib/hooks/Client-only.js +18 -0
  59. package/lib/hooks/Client-only.js.map +1 -0
  60. package/lib/hooks/hooks.d.ts +4 -0
  61. package/lib/hooks/hooks.d.ts.map +1 -0
  62. package/lib/hooks/index.d.ts +2 -1
  63. package/lib/hooks/index.d.ts.map +1 -1
  64. package/lib/hooks/use-hydrated.d.ts +19 -0
  65. package/lib/hooks/use-hydrated.d.ts.map +1 -0
  66. package/lib/hooks/use-hydrated.js +24 -0
  67. package/lib/hooks/use-hydrated.js.map +1 -0
  68. package/lib/hooks/useLayoutSettings.d.ts +6 -0
  69. package/lib/hooks/useLayoutSettings.d.ts.map +1 -0
  70. package/lib/hooks/{useSettings.js → useLayoutSettings.js} +23 -28
  71. package/lib/hooks/useLayoutSettings.js.map +1 -0
  72. package/lib/index.d.ts +1 -1
  73. package/lib/index.d.ts.map +1 -1
  74. package/lib/index.js +1 -1
  75. package/lib/index.native.js +1 -1
  76. package/lib/interfaces/default-settings.d.ts +1 -0
  77. package/lib/interfaces/default-settings.d.ts.map +1 -1
  78. package/lib/interfaces/index.d.ts +2 -0
  79. package/lib/interfaces/index.d.ts.map +1 -1
  80. package/lib/interfaces/pure-settings.d.ts +9 -1
  81. package/lib/interfaces/pure-settings.d.ts.map +1 -1
  82. package/lib/interfaces/searchbar-settings.d.ts +61 -0
  83. package/lib/interfaces/searchbar-settings.d.ts.map +1 -0
  84. package/lib/interfaces/settings.d.ts +166 -0
  85. package/lib/interfaces/settings.d.ts.map +1 -0
  86. package/lib/interfaces/settings.js +5 -0
  87. package/lib/interfaces/settings.js.map +1 -0
  88. package/lib/redux/actions/error-actions.d.ts.map +1 -1
  89. package/lib/redux/reducers/settings.d.ts +2 -36
  90. package/lib/redux/reducers/settings.d.ts.map +1 -1
  91. package/lib/redux/reducers/settings.js +4 -8
  92. package/lib/redux/reducers/settings.js.map +1 -1
  93. package/lib/redux/store.js +1 -1
  94. package/lib/themes/templates/darkLayoutTheme.d.ts +1 -1
  95. package/lib/themes/templates/darkLayoutTheme.d.ts.map +1 -1
  96. package/lib/utils/assignDefaults.d.ts +11 -0
  97. package/lib/utils/assignDefaults.d.ts.map +1 -0
  98. package/lib/utils/assignDefaults.js +166 -0
  99. package/lib/utils/assignDefaults.js.map +1 -0
  100. package/lib/utils/assignDefaults.test.d.ts +2 -0
  101. package/lib/utils/assignDefaults.test.d.ts.map +1 -0
  102. package/lib/utils/generateMenuLink.d.ts.map +1 -1
  103. package/lib/utils/generateMenuLink.js +13 -1
  104. package/lib/utils/generateMenuLink.js.map +1 -1
  105. package/lib/utils/generateMenuLink.test.d.ts +2 -0
  106. package/lib/utils/generateMenuLink.test.d.ts.map +1 -0
  107. package/lib/utils/index.d.ts +1 -1
  108. package/lib/utils/index.d.ts.map +1 -1
  109. package/lib/utils/matchMenuKeys.d.ts.map +1 -1
  110. package/lib/utils/matchMenuKeys.js.map +1 -1
  111. package/lib/utils/menuUtils.d.ts +2 -2
  112. package/lib/utils/menuUtils.d.ts.map +1 -1
  113. package/lib/utils/menuUtils.js +1 -1
  114. package/lib/utils/menuUtils.js.map +1 -1
  115. package/lib/utils/parentRoute.d.ts.map +1 -1
  116. package/lib/utils/settingsDiff.test.d.ts +2 -0
  117. package/lib/utils/settingsDiff.test.d.ts.map +1 -0
  118. package/lib/utils/settingsDifference.d.ts +5 -0
  119. package/lib/utils/settingsDifference.d.ts.map +1 -0
  120. package/lib/utils/settingsDifference.js +207 -0
  121. package/lib/utils/settingsDifference.js.map +1 -0
  122. package/lib/utils/settingsDifference.test.d.ts +2 -0
  123. package/lib/utils/settingsDifference.test.d.ts.map +1 -0
  124. package/package.json +5 -4
  125. package/lib/antd-themes/ThemeProvider.d.ts +0 -434
  126. package/lib/antd-themes/ThemeProvider.d.ts.map +0 -1
  127. package/lib/antd-themes/ThemeProvider.js +0 -34
  128. package/lib/antd-themes/ThemeProvider.js.map +0 -1
  129. package/lib/antd-themes/airbnb-dark-theme.d.ts +0 -230
  130. package/lib/antd-themes/airbnb-dark-theme.d.ts.map +0 -1
  131. package/lib/antd-themes/airbnb-dark-theme.js +0 -168
  132. package/lib/antd-themes/airbnb-dark-theme.js.map +0 -1
  133. package/lib/antd-themes/airbnb-light-theme.d.ts +0 -230
  134. package/lib/antd-themes/airbnb-light-theme.d.ts.map +0 -1
  135. package/lib/antd-themes/airbnb-light-theme.js +0 -168
  136. package/lib/antd-themes/airbnb-light-theme.js.map +0 -1
  137. package/lib/antd-themes/colors.d.ts.map +0 -1
  138. package/lib/antd-themes/colors.js.map +0 -1
  139. package/lib/antd-themes/default-dark-theme.d.ts +0 -199
  140. package/lib/antd-themes/default-dark-theme.d.ts.map +0 -1
  141. package/lib/antd-themes/default-dark-theme.js +0 -136
  142. package/lib/antd-themes/default-dark-theme.js.map +0 -1
  143. package/lib/antd-themes/default-light-theme.d.ts +0 -199
  144. package/lib/antd-themes/default-light-theme.d.ts.map +0 -1
  145. package/lib/antd-themes/default-light-theme.js +0 -136
  146. package/lib/antd-themes/default-light-theme.js.map +0 -1
  147. package/lib/antd-themes/github-dark-theme.d.ts +0 -230
  148. package/lib/antd-themes/github-dark-theme.d.ts.map +0 -1
  149. package/lib/antd-themes/github-dark-theme.js +0 -168
  150. package/lib/antd-themes/github-dark-theme.js.map +0 -1
  151. package/lib/antd-themes/github-light-theme.d.ts +0 -230
  152. package/lib/antd-themes/github-light-theme.d.ts.map +0 -1
  153. package/lib/antd-themes/github-light-theme.js +0 -168
  154. package/lib/antd-themes/github-light-theme.js.map +0 -1
  155. package/lib/antd-themes/index.d.ts +0 -14
  156. package/lib/antd-themes/index.d.ts.map +0 -1
  157. package/lib/antd-themes/slack-dark-theme.d.ts +0 -229
  158. package/lib/antd-themes/slack-dark-theme.d.ts.map +0 -1
  159. package/lib/antd-themes/slack-dark-theme.js +0 -167
  160. package/lib/antd-themes/slack-dark-theme.js.map +0 -1
  161. package/lib/antd-themes/slack-light-theme.d.ts +0 -229
  162. package/lib/antd-themes/slack-light-theme.d.ts.map +0 -1
  163. package/lib/antd-themes/slack-light-theme.js +0 -167
  164. package/lib/antd-themes/slack-light-theme.js.map +0 -1
  165. package/lib/antd-themes/spotify-dark-theme.d.ts +0 -230
  166. package/lib/antd-themes/spotify-dark-theme.d.ts.map +0 -1
  167. package/lib/antd-themes/spotify-dark-theme.js +0 -168
  168. package/lib/antd-themes/spotify-dark-theme.js.map +0 -1
  169. package/lib/antd-themes/spotify-light-theme.d.ts +0 -230
  170. package/lib/antd-themes/spotify-light-theme.d.ts.map +0 -1
  171. package/lib/antd-themes/spotify-light-theme.js +0 -168
  172. package/lib/antd-themes/spotify-light-theme.js.map +0 -1
  173. package/lib/antd-themes/themeRegistry.d.ts +0 -2229
  174. package/lib/antd-themes/themeRegistry.d.ts.map +0 -1
  175. package/lib/antd-themes/themeRegistry.js +0 -12
  176. package/lib/antd-themes/themeRegistry.js.map +0 -1
  177. package/lib/hooks/useSettings.d.ts +0 -5
  178. package/lib/hooks/useSettings.d.ts.map +0 -1
  179. package/lib/hooks/useSettings.js.map +0 -1
  180. package/lib/utils/getAntdLocale.d.ts +0 -3
  181. package/lib/utils/getAntdLocale.d.ts.map +0 -1
  182. package/lib/utils/getAntdLocale.js +0 -18
  183. package/lib/utils/getAntdLocale.js.map +0 -1
@@ -0,0 +1,166 @@
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
@@ -0,0 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=assignDefaults.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignDefaults.test.d.ts","sourceRoot":"","sources":["../../src/utils/assignDefaults.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"generateMenuLink.d.ts","sourceRoot":"","sources":["../../src/utils/generateMenuLink.ts"],"names":[],"mappings":"AAwEA,eAAO,MAAM,gBAAgB,oCAa5B,CAAC"}
1
+ {"version":3,"file":"generateMenuLink.d.ts","sourceRoot":"","sources":["../../src/utils/generateMenuLink.ts"],"names":[],"mappings":"AAwEA,eAAO,MAAM,gBAAgB,GAAI,SAAI,EAAE,WAAM,WA2B5C,CAAC"}
@@ -67,12 +67,24 @@ 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
+ }
70
83
  try {
71
84
  const generatedPath = generatePath(path, params);
72
85
  return generatedPath;
73
86
  }
74
87
  catch (err) {
75
- console.error('Error generating path:', err);
76
88
  console.log('Path:', path);
77
89
  console.log('Params:', params);
78
90
  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,SAAA,eAA6B,EAAA,OAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generateMenuLink.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateMenuLink.test.d.ts","sourceRoot":"","sources":["../../src/utils/generateMenuLink.test.ts"],"names":[],"mappings":""}
@@ -3,6 +3,6 @@ export * from './componentSize';
3
3
  export * from './parentRoute';
4
4
  export * from './menuUtils';
5
5
  export * from './matchMenuKeys';
6
- export * from './getAntdLocale';
7
6
  export * from './generateMenuLink';
7
+ export * from './settingsDifference';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -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,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"matchMenuKeys.d.ts","sourceRoot":"","sources":["../../src/utils/matchMenuKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;GAOG;AAEH,eAAO,MAAM,gBAAgB,cAAe,YAAY,EAAE,eAAe,MAAM,KAAG,MAAM,EA2CvF,CAAC"}
1
+ {"version":3,"file":"matchMenuKeys.d.ts","sourceRoot":"","sources":["../../src/utils/matchMenuKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;GAOG;AAEH,eAAO,MAAM,gBAAgB,GAAI,WAAW,YAAY,EAAE,EAAE,aAAa,MAAM,KAAG,MAAM,EA2CvF,CAAC"}
@@ -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,IAAO,MAAA,SAAA,GAAsB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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,SAAa,GAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { IMenuDataItem } from '@common-stack/client-react/lib/interfaces/menu';
1
+ import { type IMenuData } from '@common-stack/client-react/lib/interfaces/menu';
2
2
  /**
3
3
  * Custom menuDataRender function which will be called on component render
4
4
  * to filter out menus from props.menuData on the basis of authorities.
@@ -9,7 +9,7 @@ import { IMenuDataItem } from '@common-stack/client-react/lib/interfaces/menu';
9
9
  * @param menuList
10
10
  * @param authorities
11
11
  */
12
- export declare const menuDataRender: (menuList: IMenuDataItem[], authorities: any) => IMenuDataItem[];
12
+ export declare const menuDataRender: (menuList: IMenuData[], authorities: any) => IMenuData[];
13
13
  export declare function transformData(data: any): any;
14
14
  export declare function setLocale(obj: any, parentName?: string): void;
15
15
  export declare const addProLayoutParentKeys: (menuData?: any[], parentKeys?: string[]) => any[];
@@ -1 +1 @@
1
- {"version":3,"file":"menuUtils.d.ts","sourceRoot":"","sources":["../../src/utils/menuUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,aAAc,aAAa,EAAE,uBAAgB,aAAa,EAqBpF,CAAC;AAMF,wBAAgB,aAAa,CAAC,IAAI,KAAA,OAcjC;AACD,wBAAgB,SAAS,CAAC,GAAG,KAAA,EAAE,UAAU,SAAK,QAO7C;AAED,eAAO,MAAM,sBAAsB,cAAe,GAAG,EAAE,eAAc,MAAM,EAAE,UAS5E,CAAC;AAEF,eAAO,MAAM,sBAAsB,sBAalC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,KAAA,QAY9C"}
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;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,SAAS,EAAE,EAAE,gBAAW,KAAG,SAAS,EAqB5E,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,QAa5C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,KAAA,QAY9C"}
@@ -1,4 +1,4 @@
1
- import {get,sortBy,cloneDeep}from'lodash-es';import {PermissionType}from'common';import {logger}from'@cdm-logger/client';/**
1
+ import {get,cloneDeep,sortBy}from'lodash-es';import {PermissionType}from'common';import {logger}from'@cdm-logger/client';/**
2
2
  * Custom menuDataRender function which will be called on component render
3
3
  * to filter out menus from props.menuData on the basis of authorities.
4
4
  *
@@ -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,IAAO,MAAA,CAAA,KAAA,CAAA,kCAA2C,CAAA;AAWlD,IAAO,MAAA,cAA4B,GAAA,mBAAA,CAAA,QAAA,CAAA;AAenC,IAAA,QAAA;;;AAGG,QAAA,MAAA,EAAA,SAAA,EAAA,GAAA,IAAA;AACH,QAAA,IAAA,KAAA,CAAA,OAA2C,CAAA,SAAA,CAAA,IAAA,SAAA,EAAA,MAAI,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"menuUtils.js","sources":["../../src/utils/menuUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAaG;AACH;AA2BA;AAeA,MAAA,uCAA+B;AAS/B,IAAO,MAAA,CAAA,KAAA,CAAA,kCAA2C,CAAA;AAWlD,IAAA,MAAA,cAAa,GAAA,mBAA0B,CAAA,QAAA,CAAA;AAevC,IAAA,QAAA;;;AAGG,QAAA,MAAA,EAAA,SAAA,EAAA,GAAA,IAAA;AACH,QAAA,IAAA,KAAA,CAAA,OAA2C,CAAA,SAAA,CAAA,IAAA,SAAA,EAAA,MAAI,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"parentRoute.d.ts","sourceRoot":"","sources":["../../src/utils/parentRoute.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,4CAwB5B,CAAC"}
1
+ {"version":3,"file":"parentRoute.d.ts","sourceRoot":"","sources":["../../src/utils/parentRoute.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,GAAa,cAAS,EAAE,iBAAY,QAwBhE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=settingsDiff.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsDiff.test.d.ts","sourceRoot":"","sources":["../../src/utils/settingsDiff.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Compares settings objects and saves only the differences
3
+ */
4
+ export declare const compareAndSaveSettingsDifferences: (currentSettings: any, defaultSettings: any) => any;
5
+ //# sourceMappingURL=settingsDifference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsDifference.d.ts","sourceRoot":"","sources":["../../src/utils/settingsDifference.ts"],"names":[],"mappings":"AAuKA;;GAEG;AACH,eAAO,MAAM,iCAAiC,GAAI,iBAAiB,GAAG,EAAE,iBAAiB,GAAG,QAoD3F,CAAC"}
@@ -0,0 +1,207 @@
1
+ import {cloneDeep,get,isObject,isEqual,transform}from'lodash-es';/**
2
+ * Gets the deep differences between two objects
3
+ * Returns only the values that differ from obj2
4
+ */
5
+ const getDifference = (obj1, obj2) => {
6
+ // Create copies to avoid modifying the original objects
7
+ const source = cloneDeep(obj1);
8
+ const target = cloneDeep(obj2);
9
+ // If obj1 is undefined or null, return undefined to avoid adding to result
10
+ if (source === undefined || source === null) {
11
+ // Only include null/undefined if they differ from obj2
12
+ return source !== target ? source : undefined;
13
+ }
14
+ // If we're comparing different types, or if obj2 is null/undefined, return obj1
15
+ if (typeof source !== typeof target || target === undefined || target === null) {
16
+ return source;
17
+ }
18
+ // Handle non-object comparisons (primitives, functions, etc.)
19
+ if (!isObject(source) || !isObject(target)) {
20
+ // Case-insensitive string comparison
21
+ if (typeof source === 'string' && typeof target === 'string') {
22
+ return source.toLowerCase() !== target.toLowerCase() ? source : undefined;
23
+ }
24
+ return !isEqual(source, target) ? source : undefined;
25
+ }
26
+ // For arrays, do a simple equality check and return the full array if different
27
+ if (Array.isArray(source) && Array.isArray(target)) {
28
+ return !isEqual(source, target) ? source : undefined;
29
+ }
30
+ // For objects, do deep comparison
31
+ const result = transform(source, (result, value, key) => {
32
+ // Skip keys that are in source but have the exact same value in target
33
+ if (key in target && isEqual(value, target[key])) {
34
+ return;
35
+ }
36
+ // If the key doesn't exist in target, add it to the result
37
+ if (!(key in target)) {
38
+ result[key] = value;
39
+ return;
40
+ }
41
+ // For nested objects, recursively get differences
42
+ if (isObject(value) && isObject(target[key])) {
43
+ const nestedDiff = getDifference(value, target[key]);
44
+ if (nestedDiff !== undefined && (Array.isArray(nestedDiff) || Object.keys(nestedDiff).length > 0)) {
45
+ result[key] = nestedDiff;
46
+ }
47
+ return;
48
+ }
49
+ // For non-objects (primitives, etc.), only add if different
50
+ if (!isEqual(value, target[key])) {
51
+ result[key] = value;
52
+ }
53
+ });
54
+ // Return undefined if the resulting object is empty
55
+ return Object.keys(result).length > 0 ? result : undefined;
56
+ };
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
+ /**
136
+ * Compares settings objects and saves only the differences
137
+ */
138
+ const compareAndSaveSettingsDifferences = (currentSettings, defaultSettings) => {
139
+ try {
140
+ if (!currentSettings || !defaultSettings) {
141
+ console.warn('Missing settings objects for comparison');
142
+ return null;
143
+ }
144
+ // Make deep clones to avoid modifying the original objects
145
+ const current = cloneDeep(currentSettings);
146
+ const defaults = cloneDeep(defaultSettings);
147
+ // Handle route settings separately
148
+ const routeSettingsDiff = current.routeSettings
149
+ ? getRouteSettingsDifferences(current.routeSettings, defaults?.routeSettings || {})
150
+ : undefined;
151
+ // Make a copy of settings without routeSettings to compare separately
152
+ const currentWithoutRoutes = { ...current };
153
+ const defaultWithoutRoutes = { ...defaults };
154
+ delete currentWithoutRoutes.routeSettings;
155
+ delete defaultWithoutRoutes.routeSettings;
156
+ // Get differences for all other settings
157
+ const otherSettingsDiff = getDifference(currentWithoutRoutes, defaultWithoutRoutes);
158
+ // Combine the differences
159
+ const diffSettings = {};
160
+ // Add other settings differences if any exist and are not empty objects
161
+ if (otherSettingsDiff && Object.keys(otherSettingsDiff).length > 0) {
162
+ Object.assign(diffSettings, otherSettingsDiff);
163
+ }
164
+ // Add route settings differences if any exist
165
+ if (routeSettingsDiff && Object.keys(routeSettingsDiff).length > 0) {
166
+ diffSettings.routeSettings = routeSettingsDiff;
167
+ }
168
+ // If there are no differences at all, return early
169
+ if (Object.keys(diffSettings).length === 0) {
170
+ return {};
171
+ }
172
+ // Remove empty objects from the diff
173
+ // This helps prevent unnecessary properties in the payload
174
+ const cleanDiffSettings = removeEmptyObjects(diffSettings);
175
+ return cleanDiffSettings;
176
+ }
177
+ catch (error) {
178
+ console.error('Error comparing settings differences:', error);
179
+ return null;
180
+ }
181
+ };
182
+ /**
183
+ * Recursively removes empty objects from an object
184
+ * This helps clean up the diff payload
185
+ */
186
+ function removeEmptyObjects(obj) {
187
+ if (!isObject(obj) || Array.isArray(obj)) {
188
+ return obj;
189
+ }
190
+ const result = {};
191
+ let hasKeys = false;
192
+ Object.keys(obj).forEach((key) => {
193
+ const value = obj[key];
194
+ if (isObject(value) && !Array.isArray(value)) {
195
+ const cleanValue = removeEmptyObjects(value);
196
+ if (Object.keys(cleanValue).length > 0) {
197
+ result[key] = cleanValue;
198
+ hasKeys = true;
199
+ }
200
+ }
201
+ else if (value !== undefined) {
202
+ result[key] = value;
203
+ hasKeys = true;
204
+ }
205
+ });
206
+ return hasKeys ? result : {};
207
+ }export{compareAndSaveSettingsDifferences};//# sourceMappingURL=settingsDifference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsDifference.js","sources":["../../src/utils/settingsDifference.ts"],"sourcesContent":[null],"names":[],"mappings":";AAyKG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=settingsDifference.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsDifference.test.d.ts","sourceRoot":"","sources":["../../src/utils/settingsDifference.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/client",
3
- "version": "11.0.2-alpha.0",
3
+ "version": "12.0.16-alpha.0",
4
4
  "description": "Sample client for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -19,11 +19,12 @@
19
19
  "test": "cross-env ENV_FILE=../../config/test/test.env jest",
20
20
  "test:debug": "npm test -- --runInBand",
21
21
  "test:watch": "npm test -- --watch",
22
+ "vitest": "cross-env ENV_FILE=../../config/test/test.env vitest",
22
23
  "watch": "yarn build:lib:watch"
23
24
  },
24
25
  "dependencies": {
25
- "@common-stack/client-core": "7.0.2-alpha.1",
26
- "common": "11.0.2-alpha.0",
26
+ "@common-stack/client-core": "7.1.1-alpha.32",
27
+ "common": "10.1.1-alpha.28",
27
28
  "serialize-error": "^8.0.0"
28
29
  },
29
30
  "peerDependencies": {
@@ -39,5 +40,5 @@
39
40
  "typescript": {
40
41
  "definition": "lib/index.d.ts"
41
42
  },
42
- "gitHead": "f00268ad48da5c2f63088282a3061e00e3a807d1"
43
+ "gitHead": "13b6399435ba738671b6feea9adf84a12c256d69"
43
44
  }