@admin-layout/client 11.0.2-alpha.0 → 11.2.1-alpha.1

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 (208) hide show
  1. package/lib/__tests__/ApplicationErrorHandlerCommon.test.d.ts.map +1 -0
  2. package/lib/__tests__/ConfigurationModelWrapper.test.d.ts +2 -0
  3. package/lib/__tests__/ConfigurationModelWrapper.test.d.ts.map +1 -0
  4. package/lib/__tests__/SettingsConfigurationModel.test.d.ts +2 -0
  5. package/lib/__tests__/SettingsConfigurationModel.test.d.ts.map +1 -0
  6. package/lib/__tests__/__fixtures__/defaultSettingsExample.d.ts +3 -0
  7. package/lib/__tests__/__fixtures__/defaultSettingsExample.d.ts.map +1 -0
  8. package/lib/{antd-themes/colors.d.ts → colors/colorsList.d.ts} +1 -1
  9. package/lib/colors/colorsList.d.ts.map +1 -0
  10. package/lib/{antd-themes/colors.js → colors/colorsList.js} +1 -1
  11. package/lib/colors/colorsList.js.map +1 -0
  12. package/lib/colors/index.d.ts +1 -0
  13. package/lib/colors/index.d.ts.map +1 -1
  14. package/lib/colors/presets/black.js +0 -3
  15. package/lib/colors/presets/black.js.map +1 -1
  16. package/lib/colors/presets/brinkPink.js +11 -0
  17. package/lib/colors/presets/brinkPink.js.map +1 -0
  18. package/lib/colors/presets/cyan.js +11 -0
  19. package/lib/colors/presets/cyan.js.map +1 -0
  20. package/lib/colors/presets/lime.js +11 -0
  21. package/lib/colors/presets/lime.js.map +1 -0
  22. package/lib/colors/presets/pink.js +11 -0
  23. package/lib/colors/presets/pink.js.map +1 -0
  24. package/lib/colors/presets/purple.js +11 -0
  25. package/lib/colors/presets/purple.js.map +1 -0
  26. package/lib/colors/presets/skyBlue.js +11 -0
  27. package/lib/colors/presets/skyBlue.js.map +1 -0
  28. package/lib/colors/presets/turquoise.js +11 -0
  29. package/lib/colors/presets/turquoise.js.map +1 -0
  30. package/lib/colors/presets/white.js +0 -3
  31. package/lib/colors/presets/white.js.map +1 -1
  32. package/lib/components/ApplicationErrorFillWrapper.d.ts.map +1 -1
  33. package/lib/components/ApplicationErrorHandlerCommon.d.ts.map +1 -1
  34. package/lib/components/ApplicationErrorHandlerCommon.js.map +1 -1
  35. package/lib/components/ErrorBoundaryCommon.js.map +1 -1
  36. package/lib/components/LayoutCookieProvider.d.ts +7 -0
  37. package/lib/components/LayoutCookieProvider.d.ts.map +1 -0
  38. package/lib/components/LayoutCookieProvider.js +25 -0
  39. package/lib/components/LayoutCookieProvider.js.map +1 -0
  40. package/lib/components/UpdateSettings/UpdateSettings.server.d.ts +68 -6
  41. package/lib/components/UpdateSettings/UpdateSettings.server.d.ts.map +1 -1
  42. package/lib/components/UpdateSettings/UpdateSettings.server.js +218 -28
  43. package/lib/components/UpdateSettings/UpdateSettings.server.js.map +1 -1
  44. package/lib/components/UpdateSettings/UpdateSettings.server.test.d.ts +2 -0
  45. package/lib/components/UpdateSettings/UpdateSettings.server.test.d.ts.map +1 -0
  46. package/lib/components/index.d.ts +1 -0
  47. package/lib/components/index.d.ts.map +1 -1
  48. package/lib/config/defaultSettings.d.ts +184 -2
  49. package/lib/config/defaultSettings.d.ts.map +1 -1
  50. package/lib/config/defaultSettings.js +67 -32
  51. package/lib/config/defaultSettings.js.map +1 -1
  52. package/lib/config/env-config.d.ts +3 -5
  53. package/lib/config/env-config.d.ts.map +1 -1
  54. package/lib/config/env-config.js +13 -13
  55. package/lib/config/env-config.js.map +1 -1
  56. package/lib/constants/constants.js.map +1 -1
  57. package/lib/constants/error.js.map +1 -1
  58. package/lib/constants/languages.js.map +1 -1
  59. package/lib/constants/layout.js.map +1 -1
  60. package/lib/graphql/link/error-link.d.ts.map +1 -1
  61. package/lib/graphql/link/error-link.js +1 -1
  62. package/lib/graphql/link/error-link.js.map +1 -1
  63. package/lib/hooks/Client-only.d.ts +28 -0
  64. package/lib/hooks/Client-only.d.ts.map +1 -0
  65. package/lib/hooks/Client-only.js +18 -0
  66. package/lib/hooks/Client-only.js.map +1 -0
  67. package/lib/hooks/hooks.d.ts +4 -0
  68. package/lib/hooks/hooks.d.ts.map +1 -0
  69. package/lib/hooks/index.d.ts +2 -1
  70. package/lib/hooks/index.d.ts.map +1 -1
  71. package/lib/hooks/use-hydrated.d.ts +19 -0
  72. package/lib/hooks/use-hydrated.d.ts.map +1 -0
  73. package/lib/hooks/use-hydrated.js +24 -0
  74. package/lib/hooks/use-hydrated.js.map +1 -0
  75. package/lib/hooks/useLayoutSettings.d.ts +6 -0
  76. package/lib/hooks/useLayoutSettings.d.ts.map +1 -0
  77. package/lib/hooks/useLayoutSettings.js +106 -0
  78. package/lib/hooks/useLayoutSettings.js.map +1 -0
  79. package/lib/hooks/useLayoutSettings.test.d.ts +2 -0
  80. package/lib/hooks/useLayoutSettings.test.d.ts.map +1 -0
  81. package/lib/index.d.ts +1 -1
  82. package/lib/index.d.ts.map +1 -1
  83. package/lib/index.js +1 -1
  84. package/lib/index.native.js +1 -1
  85. package/lib/interfaces/default-settings.d.ts +1 -0
  86. package/lib/interfaces/default-settings.d.ts.map +1 -1
  87. package/lib/interfaces/index.d.ts +2 -0
  88. package/lib/interfaces/index.d.ts.map +1 -1
  89. package/lib/interfaces/pure-settings.d.ts +17 -1
  90. package/lib/interfaces/pure-settings.d.ts.map +1 -1
  91. package/lib/interfaces/searchbar-settings.d.ts +61 -0
  92. package/lib/interfaces/searchbar-settings.d.ts.map +1 -0
  93. package/lib/interfaces/settings.d.ts +167 -0
  94. package/lib/interfaces/settings.d.ts.map +1 -0
  95. package/lib/interfaces/settings.js +5 -0
  96. package/lib/interfaces/settings.js.map +1 -0
  97. package/lib/interfaces/typings.d.ts +1 -1
  98. package/lib/interfaces/typings.d.ts.map +1 -1
  99. package/lib/redux/actions/error-actions.d.ts.map +1 -1
  100. package/lib/redux/actions/error-actions.js.map +1 -1
  101. package/lib/redux/reducers/error.js.map +1 -1
  102. package/lib/redux/reducers/settings.d.ts +2 -36
  103. package/lib/redux/reducers/settings.d.ts.map +1 -1
  104. package/lib/redux/reducers/settings.js +4 -11
  105. package/lib/redux/reducers/settings.js.map +1 -1
  106. package/lib/redux/selectors/index.js.map +1 -1
  107. package/lib/redux/store.js +1 -1
  108. package/lib/redux/store.js.map +1 -1
  109. package/lib/themes/systemFont/index.js.map +1 -1
  110. package/lib/themes/templates/createLayoutTheme.js.map +1 -1
  111. package/lib/themes/templates/darkLayoutTheme.js.map +1 -1
  112. package/lib/themes/templates/lightLayoutTheme.js.map +1 -1
  113. package/lib/utils/assignDefaults.d.ts +10 -0
  114. package/lib/utils/assignDefaults.d.ts.map +1 -0
  115. package/lib/utils/assignDefaults.test.d.ts +1 -0
  116. package/lib/utils/assignDefaults.test.d.ts.map +1 -0
  117. package/lib/utils/generateMenuLink.d.ts.map +1 -1
  118. package/lib/utils/generateMenuLink.js +13 -1
  119. package/lib/utils/generateMenuLink.js.map +1 -1
  120. package/lib/utils/generateMenuLink.test.d.ts +2 -0
  121. package/lib/utils/generateMenuLink.test.d.ts.map +1 -0
  122. package/lib/utils/index.d.ts +1 -1
  123. package/lib/utils/index.d.ts.map +1 -1
  124. package/lib/utils/matchMenuKeys.d.ts.map +1 -1
  125. package/lib/utils/matchMenuKeys.js.map +1 -1
  126. package/lib/utils/menuUtils.d.ts +2 -2
  127. package/lib/utils/menuUtils.d.ts.map +1 -1
  128. package/lib/utils/menuUtils.js +1 -1
  129. package/lib/utils/menuUtils.js.map +1 -1
  130. package/lib/utils/parentRoute.d.ts.map +1 -1
  131. package/lib/utils/parseEnvUiLayoutSettings.d.ts +6 -0
  132. package/lib/utils/parseEnvUiLayoutSettings.d.ts.map +1 -0
  133. package/lib/utils/parseEnvUiLayoutSettings.js +27 -0
  134. package/lib/utils/parseEnvUiLayoutSettings.js.map +1 -0
  135. package/lib/utils/parseEnvUiLayoutSettings.test.d.ts +2 -0
  136. package/lib/utils/parseEnvUiLayoutSettings.test.d.ts.map +1 -0
  137. package/lib/utils/seperatedMenus.js.map +1 -1
  138. package/lib/utils/settingsDiff.test.d.ts +2 -0
  139. package/lib/utils/settingsDiff.test.d.ts.map +1 -0
  140. package/lib/utils/settingsDifference.d.ts +6 -0
  141. package/lib/utils/settingsDifference.d.ts.map +1 -0
  142. package/lib/utils/settingsDifference.js +148 -0
  143. package/lib/utils/settingsDifference.js.map +1 -0
  144. package/lib/utils/settingsDifference.test.d.ts +2 -0
  145. package/lib/utils/settingsDifference.test.d.ts.map +1 -0
  146. package/package.json +9 -4
  147. package/lib/antd-themes/ThemeProvider.d.ts +0 -434
  148. package/lib/antd-themes/ThemeProvider.d.ts.map +0 -1
  149. package/lib/antd-themes/ThemeProvider.js +0 -34
  150. package/lib/antd-themes/ThemeProvider.js.map +0 -1
  151. package/lib/antd-themes/airbnb-dark-theme.d.ts +0 -230
  152. package/lib/antd-themes/airbnb-dark-theme.d.ts.map +0 -1
  153. package/lib/antd-themes/airbnb-dark-theme.js +0 -168
  154. package/lib/antd-themes/airbnb-dark-theme.js.map +0 -1
  155. package/lib/antd-themes/airbnb-light-theme.d.ts +0 -230
  156. package/lib/antd-themes/airbnb-light-theme.d.ts.map +0 -1
  157. package/lib/antd-themes/airbnb-light-theme.js +0 -168
  158. package/lib/antd-themes/airbnb-light-theme.js.map +0 -1
  159. package/lib/antd-themes/colors.d.ts.map +0 -1
  160. package/lib/antd-themes/colors.js.map +0 -1
  161. package/lib/antd-themes/default-dark-theme.d.ts +0 -199
  162. package/lib/antd-themes/default-dark-theme.d.ts.map +0 -1
  163. package/lib/antd-themes/default-dark-theme.js +0 -136
  164. package/lib/antd-themes/default-dark-theme.js.map +0 -1
  165. package/lib/antd-themes/default-light-theme.d.ts +0 -199
  166. package/lib/antd-themes/default-light-theme.d.ts.map +0 -1
  167. package/lib/antd-themes/default-light-theme.js +0 -136
  168. package/lib/antd-themes/default-light-theme.js.map +0 -1
  169. package/lib/antd-themes/github-dark-theme.d.ts +0 -230
  170. package/lib/antd-themes/github-dark-theme.d.ts.map +0 -1
  171. package/lib/antd-themes/github-dark-theme.js +0 -168
  172. package/lib/antd-themes/github-dark-theme.js.map +0 -1
  173. package/lib/antd-themes/github-light-theme.d.ts +0 -230
  174. package/lib/antd-themes/github-light-theme.d.ts.map +0 -1
  175. package/lib/antd-themes/github-light-theme.js +0 -168
  176. package/lib/antd-themes/github-light-theme.js.map +0 -1
  177. package/lib/antd-themes/index.d.ts +0 -14
  178. package/lib/antd-themes/index.d.ts.map +0 -1
  179. package/lib/antd-themes/slack-dark-theme.d.ts +0 -229
  180. package/lib/antd-themes/slack-dark-theme.d.ts.map +0 -1
  181. package/lib/antd-themes/slack-dark-theme.js +0 -167
  182. package/lib/antd-themes/slack-dark-theme.js.map +0 -1
  183. package/lib/antd-themes/slack-light-theme.d.ts +0 -229
  184. package/lib/antd-themes/slack-light-theme.d.ts.map +0 -1
  185. package/lib/antd-themes/slack-light-theme.js +0 -167
  186. package/lib/antd-themes/slack-light-theme.js.map +0 -1
  187. package/lib/antd-themes/spotify-dark-theme.d.ts +0 -230
  188. package/lib/antd-themes/spotify-dark-theme.d.ts.map +0 -1
  189. package/lib/antd-themes/spotify-dark-theme.js +0 -168
  190. package/lib/antd-themes/spotify-dark-theme.js.map +0 -1
  191. package/lib/antd-themes/spotify-light-theme.d.ts +0 -230
  192. package/lib/antd-themes/spotify-light-theme.d.ts.map +0 -1
  193. package/lib/antd-themes/spotify-light-theme.js +0 -168
  194. package/lib/antd-themes/spotify-light-theme.js.map +0 -1
  195. package/lib/antd-themes/themeRegistry.d.ts +0 -2229
  196. package/lib/antd-themes/themeRegistry.d.ts.map +0 -1
  197. package/lib/antd-themes/themeRegistry.js +0 -12
  198. package/lib/antd-themes/themeRegistry.js.map +0 -1
  199. package/lib/components/__tests__/ApplicationErrorHandlerCommon.test.d.ts.map +0 -1
  200. package/lib/hooks/useSettings.d.ts +0 -5
  201. package/lib/hooks/useSettings.d.ts.map +0 -1
  202. package/lib/hooks/useSettings.js +0 -80
  203. package/lib/hooks/useSettings.js.map +0 -1
  204. package/lib/utils/getAntdLocale.d.ts +0 -3
  205. package/lib/utils/getAntdLocale.d.ts.map +0 -1
  206. package/lib/utils/getAntdLocale.js +0 -18
  207. package/lib/utils/getAntdLocale.js.map +0 -1
  208. /package/lib/{components/__tests__ → __tests__}/ApplicationErrorHandlerCommon.test.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationErrorHandlerCommon.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ApplicationErrorHandlerCommon.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ConfigurationModelWrapper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigurationModelWrapper.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ConfigurationModelWrapper.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import 'reflect-metadata';
2
+ //# sourceMappingURL=SettingsConfigurationModel.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsConfigurationModel.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/SettingsConfigurationModel.test.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ISettings } from '../../config/defaultSettings';
2
+ export declare const defaultSettings: ISettings;
3
+ //# sourceMappingURL=defaultSettingsExample.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultSettingsExample.d.ts","sourceRoot":"","sources":["../../../src/__tests__/__fixtures__/defaultSettingsExample.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA+D,MAAM,8BAA8B,CAAC;AAEtH,eAAO,MAAM,eAAe,EAAE,SA+G7B,CAAC"}
@@ -26,4 +26,4 @@ export declare const getThemeColors: (theme?: ThemeKey) => {
26
26
  color: string;
27
27
  }[];
28
28
  export {};
29
- //# sourceMappingURL=colors.d.ts.map
29
+ //# sourceMappingURL=colorsList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorsList.d.ts","sourceRoot":"","sources":["../../src/colors/colorsList.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;CA4DrB,CAAC;AAEF,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC,eAAO,MAAM,cAAc,GAAI,QAAQ,QAAQ;;;GAK9C,CAAC"}
@@ -64,4 +64,4 @@ const getThemeColors = (theme) => {
64
64
  return colorList[theme];
65
65
  }
66
66
  return colorList.default;
67
- };export{colorList,getThemeColors};//# sourceMappingURL=colors.js.map
67
+ };export{colorList,getThemeColors};//# sourceMappingURL=colorsList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorsList.js","sources":["../../src/colors/colorsList.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,MAAA,SAAa,GAAA;;;;;;;;;;;;;;;;;;;;;QA4DX,EAAA,GAAA,EAAA,OAAA,EAAA,KAAA,EAAA,SAAA,EAAA;AAEF,KAAK;AAEL,IAAA,KAAA,EAAA;;;QAKE,EAAA,GAAA,EAAA,OAAA,EAAA,KAAA,EAAA,SAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,3 +1,4 @@
1
1
  export * from './Color';
2
2
  export * from './presets';
3
+ export * from './colorsList';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/colors/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/colors/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
@@ -4,8 +4,5 @@ const black = {
4
4
  base300: '#2b2f3b',
5
5
  base400: '#181a21',
6
6
  base: '#20232c',
7
- base600: '#000',
8
- base700: '#FFF',
9
- base800: '#000',
10
7
  base900: '#FFF'
11
8
  };export{black};//# sourceMappingURL=black.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"black.js","sources":["../../../src/colors/presets/black.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,KAAO,GAAA;AAEhB,IAAA,OAAA,EAAA,MAAa;;;;;;;;;"}
1
+ {"version":3,"file":"black.js","sources":["../../../src/colors/presets/black.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,KAAO,GAAA;AAEhB,IAAA,OAAA,EAAA,MAAO;;;;;;"}
@@ -0,0 +1,11 @@
1
+ const brinkPink = {
2
+ base100: '#FEDCD7',
3
+ base200: '#FDB3B0',
4
+ base300: '#FB888F',
5
+ base400: '#F86A80',
6
+ base: '#E63763',
7
+ base600: '#D12A64',
8
+ base700: '#AF1D5E',
9
+ base800: '#8D1255',
10
+ base900: '#750B4E'
11
+ };export{brinkPink};//# sourceMappingURL=brinkPink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brinkPink.js","sources":["../../../src/colors/presets/brinkPink.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,SAAa;AAEtB,IAAA,OAAA,EAAA,SAAa;;;;;;;;;"}
@@ -0,0 +1,11 @@
1
+ const cyan = {
2
+ base100: '#CEFDF9',
3
+ base200: '#9EFBFB',
4
+ base300: '#6CECF5',
5
+ base400: '#47D4EC',
6
+ base: '#10B3E0',
7
+ base600: '#0B8CC0',
8
+ base700: '#0869A1',
9
+ base800: '#054B81',
10
+ base900: '#03366B'
11
+ };export{cyan};//# sourceMappingURL=cyan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cyan.js","sources":["../../../src/colors/presets/cyan.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,IAAO,GAAA;AAEhB,IAAA,OAAA,EAAA,SAAa;;;;;;;;;"}
@@ -0,0 +1,11 @@
1
+ const lime = {
2
+ base100: '#F5FCD4',
3
+ base200: '#E9FAA9',
4
+ base300: '#D4F07C',
5
+ base400: '#BDE25A',
6
+ base: '#9DCF29',
7
+ base600: '#80B21D',
8
+ base700: '#669514',
9
+ base800: '#4D780D',
10
+ base900: '#3C6307'
11
+ };export{lime};//# sourceMappingURL=lime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lime.js","sources":["../../../src/colors/presets/lime.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,IAAO,GAAA;AAEhB,IAAA,OAAA,EAAA,SAAa;;;;;;;;;"}
@@ -0,0 +1,11 @@
1
+ const pink = {
2
+ base100: '#FEDADD',
3
+ base200: '#FEBAC7',
4
+ base300: '#FD98B5',
5
+ base400: '#FB7EAE',
6
+ base: '#EB4696',
7
+ base600: '#D63D96',
8
+ base700: '#B32A88',
9
+ base800: '#901A77',
10
+ base900: '#77106B'
11
+ };export{pink};//# sourceMappingURL=pink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pink.js","sources":["../../../src/colors/presets/pink.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,IAAO,GAAA;AAEhB,IAAA,OAAA,EAAA,SAAa;;;;;;;;;"}
@@ -0,0 +1,11 @@
1
+ const purple = {
2
+ base100: '#FBCAFC',
3
+ base200: '#F096FA',
4
+ base300: '#D960F1',
5
+ base400: '#BC39E4',
6
+ base: '#9400D3',
7
+ base600: '#7300B5',
8
+ base700: '#560097',
9
+ base800: '#3D007A',
10
+ base900: '#2B0065'
11
+ };export{purple};//# sourceMappingURL=purple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purple.js","sources":["../../../src/colors/presets/purple.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,MAAO,GAAM;AAEtB,IAAA,OAAA,EAAA,SAAa;;;;;;;;;"}
@@ -0,0 +1,11 @@
1
+ const skyBlue = {
2
+ base100: '#CEFDF9',
3
+ base200: '#9EFBFB',
4
+ base300: '#6CECF5',
5
+ base400: '#47D4EC',
6
+ base: '#10B3E0',
7
+ base600: '#0B8CC0',
8
+ base700: '#0869A1',
9
+ base800: '#054B81',
10
+ base900: '#03366B'
11
+ };export{skyBlue};//# sourceMappingURL=skyBlue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skyBlue.js","sources":["../../../src/colors/presets/skyBlue.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,OAAO;AAEhB,IAAA,OAAA,EAAA,SAAa;;;;;;;;;"}
@@ -0,0 +1,11 @@
1
+ const turquoise = {
2
+ base100: '#CFFCE4',
3
+ base200: '#A0FAD2',
4
+ base300: '#6FF1C3',
5
+ base400: '#49E3BB',
6
+ base: '#15D1B2',
7
+ base600: '#0FB3A8',
8
+ base700: '#0A9396',
9
+ base800: '#066B79',
10
+ base900: '#045064'
11
+ };export{turquoise};//# sourceMappingURL=turquoise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turquoise.js","sources":["../../../src/colors/presets/turquoise.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,SAAa;AAEtB,IAAA,OAAA,EAAA,SAAa;;;;;;;;;"}
@@ -4,8 +4,5 @@ const white = {
4
4
  base300: '#C3C3C3',
5
5
  base400: '#F7F7F7', // #F2F2F2
6
6
  base: '#FFF',
7
- base600: '#000',
8
- base700: '#FFF',
9
- base800: '#FFF',
10
7
  base900: '#000'
11
8
  };export{white};//# sourceMappingURL=white.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"white.js","sources":["../../../src/colors/presets/white.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,KAAO,GAAA;AAEhB,IAAA,OAAA,EAAA,MAAa;;;;;;;;;"}
1
+ {"version":3,"file":"white.js","sources":["../../../src/colors/presets/white.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAS,MAAA,KAAO,GAAA;AAEhB,IAAA,OAAA,EAAA,MAAO;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationErrorFillWrapper.d.ts","sourceRoot":"","sources":["../../src/components/ApplicationErrorFillWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,2BAA2B,mCAEvC,CAAA"}
1
+ {"version":3,"file":"ApplicationErrorFillWrapper.d.ts","sourceRoot":"","sources":["../../src/components/ApplicationErrorFillWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,2BAA2B,GAAI,UAAK,sBAEhD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationErrorHandlerCommon.d.ts","sourceRoot":"","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD;;;GAGG;AACH,UAAU,kCAAkC;IAC1C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,KAAK,sBAAsB,GAAG,CAAC,KAAK,EAAE;IACpC,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;IAC3C,YAAY,EAAE,qBAAqB,CAAA;CACpC,KAAK,YAAY,CAAC;AAEnB,KAAK,yBAAyB,GAAG,CAC/B,KAAK,EAAE;IACL,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,iBAAiB,EAAE,qBAAqB,EAAE,CAAA;KAC3C,CAAA;CACF,KACE,YAAY,CAAC;AAClB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,kDAEjB,yBAAyB,sBAC5B,sBAAsB,6BACf,kCAAkC,KAAG,YA2BjE,CAAA"}
1
+ {"version":3,"file":"ApplicationErrorHandlerCommon.d.ts","sourceRoot":"","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD;;;GAGG;AACH,UAAU,kCAAkC;IAC1C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,KAAK,sBAAsB,GAAG,CAAC,KAAK,EAAE;IACpC,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;IAC3C,YAAY,EAAE,qBAAqB,CAAA;CACpC,KAAK,YAAY,CAAC;AAEnB,KAAK,yBAAyB,GAAG,CAC/B,KAAK,EAAE;IACL,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,iBAAiB,EAAE,qBAAqB,EAAE,CAAA;KAC3C,CAAA;CACF,KACE,YAAY,CAAC;AAClB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,GACxC,sBAAiB,EACjB,uBAAuB,yBAAyB,EAChD,oBAAoB,sBAAsB,MACtC,uBAAuB,kCAAkC,KAAG,YA2BjE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationErrorHandlerCommon.js","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"oRAUG;AACH;AACE;;AAED;AAED;;;AAGC;AAED;;AAGI,MAAS,6BAAE,GAAA,CAAA,iBAAA,EAAA,oBAAA,EAAA,iBAAA,KAAA,CAAA,EAAA,OAAA,EAAA,QAAA,EAAA,KAAA;UACH,iBAAU,GAAA,WAAA,CAAA,CAAA,KAAA,KAAA,KAAA,EAAA,iBAAA,CAAA;UACC,MAAA,GAAA,iBAAuB,EAAA,MAAA,CAAA,CAAA,KAAE,KAAA,CAAA,CAAA,OAAA,CAAA,IAAA,CAAA,CAAA,MAAA,KAAA,MAAA,CAAA,IAAA,KAAA,KAAA,EAAA,UAAA,CAAA,CAAA;UAC3C,YAAA,GAAA,WAAA,CAAA,oBAAA,CAAA;AACF,IAAA,gCACe,GAAA,CAAA,KAAA,KAAA;AAClB,QAAA,OAAA,CAAA,CAAA,oBAAA,GAAAA,cAAA,CAAA,aAAA,CAAA,oBAAA,EAAA,EAAA,GAAA,KAAA,EAAA,CAAA,GAAAA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,GAAA,KAAA,EAAA,CAAA;;;;;;;;;;AAUG"}
1
+ {"version":3,"file":"ApplicationErrorHandlerCommon.js","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"oRAUG;AACH;AACE;;AAED;AAED;;;AAGC;AAED;;AAGI,MAAS,6BAAE,GAAA,CAAA,iBAAA,EAAA,oBAAA,EAAA,iBAAA,KAAA,CAAA,EAAA,OAAA,EAAA,QAAA,EAAA,KAAA;UACT,iBAAgB,GAAA,WAAA,CAAA,CAAA,KAAA,KAAA,KAAA,EAAA,iBAAA,CAAA;UAChB,MAAA,GAAA,iBAAmB,EAAA,MAAA,CAAA,CAAA,KAAuB,KAAA,CAAA,CAAA,OAAA,CAAA,IAAA,CAAA,CAAA,MAAA,KAAA,MAAA,CAAA,IAAA,KAAA,KAAA,EAAA,UAAA,CAAA,CAAA;UAC3C,YAAA,GAAA,WAAA,CAAA,oBAAA,CAAA;AACF,IAAA,gCACe,GAAA,CAAA,KAAA,KAAA;AAClB,QAAA,OAAA,CAAA,CAAA,oBAAA,GAAAA,cAAA,CAAA,aAAA,CAAA,oBAAA,EAAA,EAAA,GAAA,KAAA,EAAA,CAAA,GAAAA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,GAAA,KAAA,EAAA,CAAA;;;;;;;;;;AAUG"}
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundaryCommon.js","sources":["../../src/components/ErrorBoundaryCommon.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"0EAGoC,MAAA,mBAAU,SAAAA,cAAA,CAAA,SAAA,CAAA;AAAC,IAAA,WAAO,CAAK,KAAG,EAAI;QAAG,KAAA,CAAA,KAAA,CAAA;AACrE,uBAAuB,QAAG,EAAA,KAAA,EAAA,KAAA,EAAA,IAAA,EAAA;;IAEtB,OAAQ,wBAAe,CAAA,KAAA,EAAA;QACN,OAAA,EAAA,QAAG,EAAA,IAAO,EAAA,KAAA,EAAA;;AAAgB,IAAA,kBAAiB,KAAC,EAAA;QAC/D,MAAA,CAAA,KAAA,CAAA,KAAA,CAAA;AAEF;AACgB,IAAA,mBAAO,SAAkB,EAAA,SAAA,EAAA;AAKrC,QAAA,IAAO,SAAA,EAAA,QAAA,KAAyB,IAAA,CAAK,KAAO,EAAA,QAAA,EAAA;;;;IAI5C,MAAiB,GAAA;AAIjB,QAAA,IAAA,IAAA,CAAA,KAAkB,CAAC,QAAA,EAAW;YAMxB,MAAA,iBAAA,GAAA,IAAA,CAAA,KAAA,CAAA,iBAAA;AAOT,YAAA,OAAAA,cAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAA,KAAA,EAAA,IAAA,CAAA,KAAA,CAAA,KAAA,EAAA,CAAA;;;;"}
1
+ {"version":3,"file":"ErrorBoundaryCommon.js","sources":["../../src/components/ErrorBoundaryCommon.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"0EAG4B,MAAQ,mBAAU,SAAAA,cAAA,CAAA,SAAA,CAAA;AAAC,IAAA,WAAO,CAAK,KAAG,EAAI;QAAG,KAAA,CAAA,KAAA,CAAA;AACrE,uBAAuB,QAAG,EAAA,KAAA,EAAA,KAAA,EAAA,IAAA,EAAA;IACtB;IACA,OAAA,wBAAuB,CAAA,KAAA,EAAA;QACvB,OAAA,EAAA,QAAoB,EAAA,IAAO,EAAA,KAAA,EAAA;;AAAgB,IAAA,kBAAiB,KAAC,EAAA;QAC/D,MAAA,CAAA,KAAA,CAAA,KAAA,CAAA;AAEF,IAAA;AACgB,IAAA,mBAAO,SAAA,EAAA,SAAkB,EAAA;AAKrC,QAAA,IAAO,SAAA,EAAA,QAAA,KAAyB,IAAA,CAAK,KAAE,EAAK,QAAA,EAAA;;;;IAI5C,MAAA,GAAA;AAIA,QAAA,IAAA,IAAA,CAAA,KAAkB,CAAC,QAAA,EAAS;YAMtB,MAAA,iBAAA,GAAA,IAAA,CAAA,KAAA,CAAA,iBAAA;AAOT,YAAA,OAAAA,cAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAA,KAAA,EAAA,IAAA,CAAA,KAAA,CAAA,KAAA,EAAA,CAAA;;;;"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface LayoutCookieProviderProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare function LayoutCookieProvider({ children }: LayoutCookieProviderProps): React.ReactElement;
6
+ export {};
7
+ //# sourceMappingURL=LayoutCookieProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutCookieProvider.d.ts","sourceRoot":"","sources":["../../src/components/LayoutCookieProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAIlE,UAAU,yBAAyB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,yBAAyB,GAAG,KAAK,CAAC,YAAY,CA2BhG"}
@@ -0,0 +1,25 @@
1
+ import {useRouteLoaderData}from'@remix-run/react';import React__default,{useRef,useEffect}from'react';import {useDispatch}from'react-redux';import {CHANGE_SETTINGS_ACTION}from'../constants/constants.js';function LayoutCookieProvider({ children }) {
2
+ const routeData = useRouteLoaderData('root');
3
+ const settings = routeData?.settings?.settings || routeData?.settings;
4
+ const dispatch = useDispatch();
5
+ const hasDispatched = useRef(false);
6
+ // Handle both server and client side
7
+ useEffect(() => {
8
+ if (settings && !hasDispatched.current) {
9
+ dispatch({
10
+ type: CHANGE_SETTINGS_ACTION,
11
+ payload: settings,
12
+ });
13
+ hasDispatched.current = true;
14
+ }
15
+ }, [settings, dispatch]);
16
+ // Initial server-side dispatch
17
+ if (typeof window === 'undefined' && settings && !hasDispatched.current) {
18
+ dispatch({
19
+ type: CHANGE_SETTINGS_ACTION,
20
+ payload: settings,
21
+ });
22
+ hasDispatched.current = true;
23
+ }
24
+ return React__default.createElement(React__default.Fragment, null, children);
25
+ }export{LayoutCookieProvider};//# sourceMappingURL=LayoutCookieProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutCookieProvider.js","sources":["../../src/components/LayoutCookieProvider.tsx"],"sourcesContent":[null],"names":[],"mappings":"2MASA,SAAA,oBAAgB,CAAA,EAAA,QAAuB,EAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,69 @@
1
- export declare const action: ({ request }: {
2
- request: Request;
3
- }) => Promise<import("@remix-run/node").TypedResponse<any>>;
4
- export declare const loader: ({ request }: {
5
- request: Request;
6
- }) => Promise<import("@remix-run/node").TypedResponse<any>>;
1
+ /**
2
+ * Cookie configuration for storing user settings
3
+ * - Max age: 30 days
4
+ * - Client-side accessible for dynamic UI updates
5
+ * - Domain-scoped in production for subdomain sharing
6
+ */
7
+ export declare const settingsCookie: import("@remix-run/node").Cookie;
8
+ /**
9
+ * Fetches page settings from GraphQL backend with device/route-specific overrides
10
+ *
11
+ * @param request - The incoming HTTP request (used for forwarding cookies and headers)
12
+ * @param overrideIdentifier - Optional override identifier (e.g., "[mobile]", "[desktop]", "[/dashboard][mobile]")
13
+ * @returns GraphQL query result containing merged settings with overrides applied
14
+ *
15
+ * @remarks
16
+ * - The GraphQL backend implements Redis caching for performance
17
+ * - Settings are returned in a flat structure with bracket notation for overrides
18
+ * - Example structure: { logo: '...', theme: '...', '[mobile]': { ... }, '[/dashboard][mobile]': { ... } }
19
+ */
20
+ export declare function fetchPageSettingsWithFetch(request: Request, overrideIdentifier?: string): Promise<{
21
+ data: any;
22
+ }>;
23
+ /**
24
+ * Universal settings loader utility for both Remix loaders and actions
25
+ *
26
+ * @param params - Object containing request, context, and params
27
+ * @param params.request - The incoming HTTP request
28
+ * @param params.context - Optional Remix load context
29
+ * @param params.params - Optional route parameters
30
+ *
31
+ * @returns Object containing merged settings and cookie string
32
+ * @returns settings - Fully merged settings (GraphQL + env + cookies + request payload)
33
+ * @returns setCookie - Cookie string to set in response headers
34
+ *
35
+ * @remarks
36
+ * This utility handles both loader (GET) and action (POST/PUT/DELETE) requests:
37
+ * - **Loaders (GET)**: Fetches and merges settings from GraphQL, env, and cookies
38
+ * - **Actions (POST/PUT)**: Additionally processes request payload and updates cookies
39
+ *
40
+ * Settings merge order (later sources override earlier ones):
41
+ * 1. GraphQL backend settings (with device overrides)
42
+ * 2. Environment variable settings
43
+ * 3. Cookie settings (user preferences)
44
+ * 4. Request payload (only for actions)
45
+ *
46
+ * @example
47
+ * // In a Remix loader
48
+ * export const loader = async ({ request }) => {
49
+ * const { settings, setCookie } = await settingsLoaderUtil({ request });
50
+ * return json({ settings }, { headers: { 'Set-Cookie': setCookie } });
51
+ * };
52
+ *
53
+ * @example
54
+ * // In a Remix action
55
+ * export const action = async ({ request }) => {
56
+ * const { settings, setCookie } = await settingsLoaderUtil({ request });
57
+ * return json(settings, { headers: { 'Set-Cookie': setCookie } });
58
+ * };
59
+ */
60
+ export declare function settingsLoaderUtil({ request, context, params }: {
61
+ request: any;
62
+ context: any;
63
+ params: any;
64
+ }): Promise<{
65
+ settings: any;
66
+ setCookie: string;
67
+ }>;
68
+ export declare function getDeviceType(userAgent: string): 'mobile' | 'desktop';
7
69
  //# sourceMappingURL=UpdateSettings.server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UpdateSettings.server.d.ts","sourceRoot":"","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,MAAM,gBAAuB;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,0DAiB7D,CAAC;AAEF,eAAO,MAAM,MAAM,gBAAuB;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,0DAiB7D,CAAC"}
1
+ {"version":3,"file":"UpdateSettings.server.d.ts","sourceRoot":"","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,kCAMzB,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,kBAAkB,CAAC,EAAE,MAAM;;GAuF7F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,kBAAkB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE;;;;CAAA;;;GA8GpE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAQrE"}
@@ -1,36 +1,226 @@
1
- import {createCookie,json}from'@remix-run/node';import {pick,keys}from'lodash-es';import {config}from'../../config/env-config.js';import {defaultSettings}from'../../config/defaultSettings.js';const settingsCookie = createCookie('settings', {
1
+ import {createCookie}from'@remix-run/node';import {ConfigCollectionName,ConfigFragmentName,ConfigurationSchemaId}from'common';import {GetPageSettingsDocument}from'common/graphql';import {merge}from'lodash-es';import {print}from'graphql';import {parseEnvLayoutSettings}from'../../utils/parseEnvUiLayoutSettings.js';import {config}from'../../config/env-config.js';import'../../config/defaultSettings.js';import {generateCdecodeUri,DEFAULT_CONTRIBUTION_TENANT_ID}from'@adminide-stack/core';/**
2
+ * Cookie configuration for storing user settings
3
+ * - Max age: 30 days
4
+ * - Client-side accessible for dynamic UI updates
5
+ * - Domain-scoped in production for subdomain sharing
6
+ */
7
+ const settingsCookie = createCookie('settings', {
2
8
  maxAge: 60 * 60 * 24 * 30, // 1 month
3
- httpOnly: true,
9
+ httpOnly: false, // Allow client-side access
4
10
  sameSite: 'lax',
11
+ path: '/', // Ensure cookie is available for all paths
5
12
  domain: config.isProd ? config.APP_DOMAIN : undefined,
6
13
  });
7
- const action = async ({ request }) => {
8
- const jsonData = await request.json();
9
- const payload = jsonData?.config;
10
- const cookieHeader = request.headers.get('Cookie');
11
- const settings = await settingsCookie.parse(cookieHeader);
12
- const updatedSettings = {
13
- ...settings,
14
- ...pick(payload, keys(config.LAYOUT_SETTINGS)),
14
+ /**
15
+ * Fetches page settings from GraphQL backend with device/route-specific overrides
16
+ *
17
+ * @param request - The incoming HTTP request (used for forwarding cookies and headers)
18
+ * @param overrideIdentifier - Optional override identifier (e.g., "[mobile]", "[desktop]", "[/dashboard][mobile]")
19
+ * @returns GraphQL query result containing merged settings with overrides applied
20
+ *
21
+ * @remarks
22
+ * - The GraphQL backend implements Redis caching for performance
23
+ * - Settings are returned in a flat structure with bracket notation for overrides
24
+ * - Example structure: { logo: '...', theme: '...', '[mobile]': { ... }, '[/dashboard][mobile]': { ... } }
25
+ */
26
+ async function fetchPageSettingsWithFetch(request, overrideIdentifier) {
27
+ console.log(`🔍 Fetching settings from GraphQL (Redis-cached backend)...`);
28
+ // Generate resource URI for the application settings
29
+ const resource = generateCdecodeUri(DEFAULT_CONTRIBUTION_TENANT_ID, {
30
+ resourceType: ConfigCollectionName.Applications,
31
+ resourceId: config.APPLICATION_ID,
32
+ idField: 'appId',
33
+ }, {}, ConfigFragmentName.UiSettings);
34
+ const url = process.env.GRAPHQL_URL || 'http://localhost:8080/graphql';
35
+ // Convert GraphQL DocumentNode to string
36
+ const query = print(GetPageSettingsDocument);
37
+ // Prepare GraphQL query options
38
+ const options = {
39
+ schemaId: ConfigurationSchemaId.UiLayout,
40
+ target: 2 /* ConfigurationTarget.APPLICATION */,
41
+ configKey: 'uilayout',
15
42
  };
16
- return json(updatedSettings, {
17
- headers: {
18
- 'Set-Cookie': await settingsCookie.serialize(updatedSettings),
19
- },
20
- });
21
- };
22
- const loader = async ({ request }) => {
23
- const cookieHeader = request.headers.get('Cookie');
24
- const settings = await settingsCookie.parse(cookieHeader);
25
- if (!settings) {
26
- const updatedSettings = {
27
- ...defaultSettings,
43
+ // Add device/route overrides if provided
44
+ if (overrideIdentifier) {
45
+ options.overrides = {
46
+ strict: true,
47
+ overrideIdentifier,
28
48
  };
29
- return json(updatedSettings, {
30
- headers: {
31
- 'Set-Cookie': await settingsCookie.serialize(updatedSettings),
32
- },
49
+ }
50
+ const variables = {
51
+ resourceUri: resource,
52
+ options,
53
+ };
54
+ console.log('🔍 Fetching settings with direct fetch to:', url);
55
+ // console.log('🔍 Query variables:', JSON.stringify(variables, null, 2));
56
+ // Forward cookies and headers from the incoming request
57
+ const headers = {
58
+ 'Content-Type': 'application/json',
59
+ 'Cache-Control': 'no-cache, no-store, must-revalidate',
60
+ Pragma: 'no-cache',
61
+ Expires: '0',
62
+ };
63
+ const cookieHeader = request.headers.get('Cookie');
64
+ if (cookieHeader) {
65
+ headers['Cookie'] = cookieHeader;
66
+ console.log('🍪 Forwarding cookies to GraphQL backend');
67
+ }
68
+ else {
69
+ console.log('⚠️ No cookies found in request');
70
+ }
71
+ try {
72
+ const response = await fetch(url, {
73
+ method: 'POST',
74
+ headers,
75
+ body: JSON.stringify({
76
+ query,
77
+ variables,
78
+ }),
79
+ });
80
+ if (!response.ok) {
81
+ console.error('❌ GraphQL fetch failed with status:', response.status);
82
+ throw new Error(`GraphQL request failed: ${response.status} ${response.statusText}`);
83
+ }
84
+ const result = await response.json();
85
+ if (result.errors) {
86
+ console.error('❌ GraphQL errors:', JSON.stringify(result.errors, null, 2));
87
+ throw new Error(`GraphQL errors: ${JSON.stringify(result.errors)}`);
88
+ }
89
+ console.log('✅ Settings fetched successfully (from Redis-cached backend)');
90
+ return { data: result.data };
91
+ }
92
+ catch (error) {
93
+ console.error('❌ Failed to fetch settings with fetch:', error);
94
+ throw error;
95
+ }
96
+ }
97
+ /**
98
+ * Universal settings loader utility for both Remix loaders and actions
99
+ *
100
+ * @param params - Object containing request, context, and params
101
+ * @param params.request - The incoming HTTP request
102
+ * @param params.context - Optional Remix load context
103
+ * @param params.params - Optional route parameters
104
+ *
105
+ * @returns Object containing merged settings and cookie string
106
+ * @returns settings - Fully merged settings (GraphQL + env + cookies + request payload)
107
+ * @returns setCookie - Cookie string to set in response headers
108
+ *
109
+ * @remarks
110
+ * This utility handles both loader (GET) and action (POST/PUT/DELETE) requests:
111
+ * - **Loaders (GET)**: Fetches and merges settings from GraphQL, env, and cookies
112
+ * - **Actions (POST/PUT)**: Additionally processes request payload and updates cookies
113
+ *
114
+ * Settings merge order (later sources override earlier ones):
115
+ * 1. GraphQL backend settings (with device overrides)
116
+ * 2. Environment variable settings
117
+ * 3. Cookie settings (user preferences)
118
+ * 4. Request payload (only for actions)
119
+ *
120
+ * @example
121
+ * // In a Remix loader
122
+ * export const loader = async ({ request }) => {
123
+ * const { settings, setCookie } = await settingsLoaderUtil({ request });
124
+ * return json({ settings }, { headers: { 'Set-Cookie': setCookie } });
125
+ * };
126
+ *
127
+ * @example
128
+ * // In a Remix action
129
+ * export const action = async ({ request }) => {
130
+ * const { settings, setCookie } = await settingsLoaderUtil({ request });
131
+ * return json(settings, { headers: { 'Set-Cookie': setCookie } });
132
+ * };
133
+ */
134
+ async function settingsLoaderUtil({ request, context, params }) {
135
+ // 1. Detect device type from User-Agent header
136
+ const userAgent = request.headers.get('User-Agent') || '';
137
+ const deviceType = getDeviceType(userAgent);
138
+ // 2. Fetch settings from GraphQL backend with device-specific overrides
139
+ // Override identifier format: "[desktop]" or "[mobile]"
140
+ const overrideIdentifier = `[${deviceType}]`;
141
+ const result = await fetchPageSettingsWithFetch(request, overrideIdentifier);
142
+ // console.log('ddRESULT=========>', JSON.stringify(result));
143
+ const pageBackendSettings = result?.data?.pageSettings?.settings
144
+ ? JSON.parse(JSON.stringify(result?.data?.pageSettings?.settings))
145
+ : null;
146
+ // 3. Parse request payload (only available for POST/PUT requests in actions)
147
+ let requestPayload = {};
148
+ try {
149
+ // Clone request to avoid "body already read" errors
150
+ const clonedRequest = request.clone();
151
+ const contentType = request.headers.get('content-type');
152
+ // Only parse JSON for non-GET requests with JSON content-type
153
+ if (request.method !== 'GET' && contentType?.includes('application/json')) {
154
+ const jsonData = await clonedRequest.json();
155
+ requestPayload = jsonData?.config || {};
156
+ }
157
+ }
158
+ catch (error) {
159
+ // Expected for GET requests (loaders) - no payload to parse
160
+ console.log('ℹ️ No request payload (likely a loader call)');
161
+ requestPayload = {};
162
+ }
163
+ // console.log('🔍 DEBUG - pageBackendSettings:', JSON.stringify(pageBackendSettings, null, 2));
164
+ // 4. Parse environment-based layout settings (fallback/default values)
165
+ const envLayoutSettings = parseEnvLayoutSettings();
166
+ // 5. Parse and validate existing cookie settings
167
+ const cookieHeader = request.headers.get('Cookie');
168
+ let existingCookieSettings;
169
+ let cookieUpdatedSettings;
170
+ try {
171
+ existingCookieSettings = await settingsCookie.parse(cookieHeader);
172
+ // DEFENSIVE: Remove invalid numeric string keys (data corruption prevention)
173
+ if (existingCookieSettings && typeof existingCookieSettings === 'object') {
174
+ Object.keys(existingCookieSettings).forEach((key) => {
175
+ // Remove keys that are numeric strings (like "0", "1", etc.)
176
+ if (/^\d+$/.test(key)) {
177
+ console.warn(`⚠️ Removing invalid numeric key from cookie settings: "${key}" = ${JSON.stringify(existingCookieSettings[key])}`);
178
+ delete existingCookieSettings[key];
179
+ }
180
+ });
181
+ }
182
+ // 6. Merge existing cookie settings with new request payload
183
+ cookieUpdatedSettings = merge({}, existingCookieSettings, requestPayload);
184
+ // Validate merge result - check for numeric key corruption
185
+ const numericKeysAfterMerge = Object.keys(cookieUpdatedSettings).filter((k) => /^\d+$/.test(k));
186
+ if (numericKeysAfterMerge.length > 0) {
187
+ console.error('❌ NUMERIC KEYS APPEARED AFTER MERGE!', numericKeysAfterMerge);
188
+ console.error('❌ Values:', numericKeysAfterMerge.map((k) => `${k}: ${JSON.stringify(cookieUpdatedSettings[k])}`));
189
+ }
190
+ }
191
+ catch (error) {
192
+ // If cookie parsing fails, use only the request payload
193
+ console.error('Error parsing settings cookie:', error);
194
+ existingCookieSettings = null;
195
+ cookieUpdatedSettings = requestPayload;
196
+ }
197
+ // 7. Merge all settings sources in priority order (later sources override earlier)
198
+ // Priority: GraphQL backend → Environment → Cookie + Request payload
199
+ const fullSettings = merge({}, pageBackendSettings, envLayoutSettings, cookieUpdatedSettings);
200
+ // 8. Validate final merged settings - detect and remove numeric key corruption
201
+ const numericKeysAfterFinalMerge = Object.keys(fullSettings).filter((k) => /^\d+$/.test(k));
202
+ if (numericKeysAfterFinalMerge.length > 0) {
203
+ console.error('❌ NUMERIC KEYS APPEARED AFTER FINAL MERGE!', numericKeysAfterFinalMerge);
204
+ console.error('❌ Values:', numericKeysAfterFinalMerge.map((k) => `${k}: ${JSON.stringify(fullSettings[k])}`));
205
+ }
206
+ // 9. Final cleanup - remove any invalid numeric string keys before returning
207
+ if (fullSettings && typeof fullSettings === 'object') {
208
+ Object.keys(fullSettings).forEach((key) => {
209
+ if (/^\d+$/.test(key)) {
210
+ console.warn(`⚠️ Removing invalid numeric key from fullSettings: "${key}"`);
211
+ delete fullSettings[key];
212
+ }
33
213
  });
34
214
  }
35
- return json(settings);
36
- };export{action,loader};//# sourceMappingURL=UpdateSettings.server.js.map
215
+ // 10. Serialize cookie settings for response headers
216
+ const cookie = await settingsCookie.serialize(cookieUpdatedSettings);
217
+ console.log('✅ FULL_SETTINGS prepared:', Object.keys(fullSettings).length, 'keys');
218
+ return { settings: fullSettings, setCookie: cookie };
219
+ }
220
+ function getDeviceType(userAgent) {
221
+ if (!userAgent)
222
+ return 'desktop';
223
+ // Enhanced regex that catches more mobile devices
224
+ const mobileRegex = /mobile|android|iphone|ipad|ipod|blackberry|windows phone|opera mini|iemobile|webos|palm|playbook|kindle|silk|psp|symbian|nokia|nexus|htc|samsung|sony|ericsson|lg|motorola|sgh|sec|sharp|vodafone|benq|sanyo|kyocera|nec|alcatel|denso|jarviss|docomo|emacs|minimo|maemo|blazer|dolfin|dolphin|netfront|openwave|teleca|elaine|bolt|iris|maui|packet|pie|portalmmm|w3c|wig|zte|audiovox|ericsson|kyocera|panasonic|qwerty|sendo|sharp|sie-|sonyericsson|t-mobile|up\.browser|up\.link|verizon|vodafone|wap|winwap|xda|zte/i;
225
+ return mobileRegex.test(userAgent) ? 'mobile' : 'desktop';
226
+ }export{fetchPageSettingsWithFetch,getDeviceType,settingsCookie,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":"gMA8BA,MAAO,cAAA,eAAmC,CAAA,UAAA,EAAA;IAAE,MAAO,EAAA,UAAS,EAAA,GAAA,EAAA;AAAE,IAAA,QAAA,EAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"UpdateSettings.server.js","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAyCG,IAAA,IAAA,EAAA,GAAA;AACH,IAAA,MAAA,EAAA,MAAA,CAAA,MAAsB,GAAA,MAAA,CAAA,UAAA,GAAA,SAA2B;;AAuFhD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG,QAAA,WAAA,EAAA,QAAA;AACH,QAAA,OAAA;;;;AAAqE;;;AA8GpE,QAAA,eAAA,EAAA,qCAAA;AAED,QAAA,MAAA,EAAA,UAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=UpdateSettings.server.test.d.ts.map