@admin-layout/client 12.0.16-alpha.87 → 12.0.16-alpha.90

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.
@@ -1,6 +1,6 @@
1
1
  export declare function useLayoutSettings(): {
2
2
  settings: any;
3
- setSettings: (config: any, changedSettings?: Record<string, any>) => Promise<any>;
3
+ setSettings: (config: any, currentChangedSetting?: Record<string, any>) => Promise<any>;
4
4
  getSettings: () => Promise<any>;
5
5
  };
6
6
  //# sourceMappingURL=useLayoutSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLayoutSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useLayoutSettings.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB;;0BAgDV,GAAG,oBAAoB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;EA8DhE"}
1
+ {"version":3,"file":"useLayoutSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useLayoutSettings.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB;;0BAgDV,GAAG,0BAA0B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;EA+DtE"}
@@ -35,12 +35,12 @@ import {useParams}from'@remix-run/react';import {useCallback}from'react';import
35
35
  return {};
36
36
  }
37
37
  }, []);
38
- const setSettings = useCallback(async (config, changedSettings) => {
39
- console.log('3️⃣ setSetting called', { config, changedSettings });
38
+ const setSettings = useCallback(async (config, currentChangedSetting) => {
39
+ console.log('3️⃣ setSetting called', { config, currentChangedSetting });
40
40
  try {
41
41
  // 1. Calculate payload first
42
- if (Object.keys(changedSettings).length === 0) {
43
- console.log('⏭️ No changes to persist');
42
+ if (!currentChangedSetting || Object.keys(currentChangedSetting).length === 0) {
43
+ console.log('No changes to persist');
44
44
  return;
45
45
  }
46
46
  // 2. Apply UI side effects ONLY if relevant settings changed
@@ -49,12 +49,12 @@ import {useParams}from'@remix-run/react';import {useCallback}from'react';import
49
49
  if (contentWidth !== undefined &&
50
50
  settings.contentWidth !== contentWidth &&
51
51
  typeof window !== 'undefined') {
52
- console.log('📐 Content width changed, triggering resize');
52
+ console.log('Content width changed, triggering resize');
53
53
  window.dispatchEvent(new Event('resize'));
54
54
  }
55
55
  // Only update colorWeak if it changed
56
56
  if (colorWeak !== undefined && settings.colorWeak !== colorWeak) {
57
- console.log('🎨 Color weak mode changed');
57
+ console.log('Color weak mode changed');
58
58
  updateColorWeak(!!colorWeak);
59
59
  }
60
60
  // 3. Make API call
@@ -65,7 +65,7 @@ import {useParams}from'@remix-run/react';import {useCallback}from'react';import
65
65
  orgName: orgNameFromParams || orgNameFromUrl || '',
66
66
  },
67
67
  body: JSON.stringify({
68
- config: changedSettings,
68
+ config: currentChangedSetting,
69
69
  deviceType: getClientDeviceType(),
70
70
  }),
71
71
  });
@@ -75,13 +75,14 @@ import {useParams}from'@remix-run/react';import {useCallback}from'react';import
75
75
  throw new Error('Failed to update settings');
76
76
  }
77
77
  // 4. update redux
78
+ const [_, changedPublicSetting] = Object.entries(currentChangedSetting)[0];
78
79
  dispatch({
79
80
  type: CHANGE_SETTINGS_ACTION,
80
- payload: config,
81
+ payload: changedPublicSetting,
81
82
  });
82
83
  }
83
84
  catch (error) {
84
- console.error('setSettings error:', error);
85
+ console.error('setSettings error:', error);
85
86
  return null;
86
87
  }
87
88
  }, [dispatch, settings]);
@@ -1 +1 @@
1
- {"version":3,"file":"useLayoutSettings.js","sources":["../../src/hooks/useLayoutSettings.ts"],"sourcesContent":[null],"names":[],"mappings":"uMAqHC,SAAA,iBAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"useLayoutSettings.js","sources":["../../src/hooks/useLayoutSettings.ts"],"sourcesContent":[null],"names":[],"mappings":"uMAsHC,SAAA,iBAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/redux/reducers/settings.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAanD,QAAA,MAAM,eAAe,GACjB,OAAO,GAAmB,EAC1B,mBAAwB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,QAyBrE,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/redux/reducers/settings.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAanD,QAAA,MAAM,eAAe,GACjB,OAAO,GAAmB,EAC1B,mBAAwB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,QAuBrE,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import {CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'../../constants/constants.js';import {merge,cloneDeep}from'lodash-es';/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
1
+ import {merge,cloneDeep}from'lodash-es';import {CHANGE_LANGUAGE,CHANGE_SETTINGS_ACTION}from'../../constants/constants.js';/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2
2
  /* eslint-disable no-case-declarations */
3
3
  // Note: We customize reducer part as AntPro uses inbuild way.
4
4
  const updateColorWeak = (colorWeak) => {
@@ -21,10 +21,7 @@ const settingsReducer = (state = merge({}, {}), { type, payload = {} }) => {
21
21
  }
22
22
  }
23
23
  updateColorWeak(!!colorWeak);
24
- return {
25
- ...state,
26
- ...cloneDeep(payload),
27
- };
24
+ return merge({}, state, cloneDeep(payload));
28
25
  case CHANGE_LANGUAGE:
29
26
  return {
30
27
  ...state,
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sources":["../../../src/redux/reducers/settings.ts"],"sourcesContent":[null],"names":[],"mappings":"0HAGA;AAaA;AAEsE;AA2BtE,MAAA,eAAS,GAAe,CAAA,SAAG,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"settings.js","sources":["../../../src/redux/reducers/settings.ts"],"sourcesContent":[null],"names":[],"mappings":"0HAIA;AAaA;AAEsE;AAyBtE,MAAA,eAAS,GAAe,CAAA,SAAG,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/client",
3
- "version": "12.0.16-alpha.87",
3
+ "version": "12.0.16-alpha.90",
4
4
  "description": "Sample client for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -44,5 +44,5 @@
44
44
  "typescript": {
45
45
  "definition": "lib/index.d.ts"
46
46
  },
47
- "gitHead": "2bba6a254488c1da0b941a314146a76446503735"
47
+ "gitHead": "849c3620442e737e42537608d8ce9fae4f4f9b3a"
48
48
  }