@admin-layout/tailwind-design-pro 12.0.16-alpha.87 → 12.0.16-alpha.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Layout/BasicLayout/index.d.ts.map +1 -1
- package/lib/components/Layout/BasicLayout/index.js.map +1 -1
- package/lib/components/Layout/TailwindLayout.js +1 -1
- package/lib/components/Layout/TailwindLayout.js.map +1 -1
- package/lib/components/SettingDrawer/SettingDrawer.d.ts +1 -3
- package/lib/components/SettingDrawer/SettingDrawer.d.ts.map +1 -1
- package/lib/components/SettingDrawer/SettingDrawer.js +88 -665
- package/lib/components/SettingDrawer/SettingDrawer.js.map +1 -1
- package/lib/components/SettingDrawer/components/ApplyToAllRoutesToggle.d.ts +7 -0
- package/lib/components/SettingDrawer/components/ApplyToAllRoutesToggle.d.ts.map +1 -0
- package/lib/components/SettingDrawer/components/ApplyToAllRoutesToggle.js +30 -0
- package/lib/components/SettingDrawer/components/ApplyToAllRoutesToggle.js.map +1 -0
- package/lib/components/SettingDrawer/components/CheckBoxTheme.d.ts +3 -0
- package/lib/components/SettingDrawer/components/CheckBoxTheme.d.ts.map +1 -0
- package/lib/components/SettingDrawer/{CheckBoxTheme.js → components/CheckBoxTheme.js} +2 -2
- package/lib/components/SettingDrawer/components/CheckBoxTheme.js.map +1 -0
- package/lib/components/SettingDrawer/components/DeviceTabs.d.ts +7 -0
- package/lib/components/SettingDrawer/components/DeviceTabs.d.ts.map +1 -0
- package/lib/components/SettingDrawer/components/DeviceTabs.js +82 -0
- package/lib/components/SettingDrawer/components/DeviceTabs.js.map +1 -0
- package/lib/components/SettingDrawer/components/InvitationSettings.d.ts +3 -0
- package/lib/components/SettingDrawer/components/InvitationSettings.d.ts.map +1 -0
- package/lib/components/SettingDrawer/{InvitationSettings.js → components/InvitationSettings.js} +2 -2
- package/lib/components/SettingDrawer/components/InvitationSettings.js.map +1 -0
- package/lib/components/SettingDrawer/components/LayoutChange.d.ts +3 -0
- package/lib/components/SettingDrawer/components/LayoutChange.d.ts.map +1 -0
- package/lib/components/SettingDrawer/{LayoutChange.js → components/LayoutChange.js} +2 -2
- package/lib/components/SettingDrawer/components/LayoutChange.js.map +1 -0
- package/lib/components/SettingDrawer/{MenuVisibilitySettings.d.ts → components/MenuVisibilitySettings.d.ts} +1 -1
- package/lib/components/SettingDrawer/components/MenuVisibilitySettings.d.ts.map +1 -0
- package/lib/components/SettingDrawer/{MenuVisibilitySettings.js → components/MenuVisibilitySettings.js} +44 -45
- package/lib/components/SettingDrawer/components/MenuVisibilitySettings.js.map +1 -0
- package/lib/components/SettingDrawer/components/NavigationsModes.d.ts +3 -0
- package/lib/components/SettingDrawer/components/NavigationsModes.d.ts.map +1 -0
- package/lib/components/SettingDrawer/{NavigationsModes.js → components/NavigationsModes.js} +2 -2
- package/lib/components/SettingDrawer/components/NavigationsModes.js.map +1 -0
- package/lib/components/SettingDrawer/components/RegionalSettings.d.ts +3 -0
- package/lib/components/SettingDrawer/components/RegionalSettings.d.ts.map +1 -0
- package/lib/components/SettingDrawer/{RegionalSettings.js → components/RegionalSettings.js} +2 -2
- package/lib/components/SettingDrawer/components/RegionalSettings.js.map +1 -0
- package/lib/components/SettingDrawer/components/SettingsActions.d.ts +12 -0
- package/lib/components/SettingDrawer/components/SettingsActions.d.ts.map +1 -0
- package/lib/components/SettingDrawer/components/SettingsActions.js +69 -0
- package/lib/components/SettingDrawer/components/SettingsActions.js.map +1 -0
- package/lib/components/SettingDrawer/components/SettingsDrawerHeader.d.ts +4 -0
- package/lib/components/SettingDrawer/components/SettingsDrawerHeader.d.ts.map +1 -0
- package/lib/components/SettingDrawer/components/SettingsDrawerHeader.js +25 -0
- package/lib/components/SettingDrawer/components/SettingsDrawerHeader.js.map +1 -0
- package/lib/components/SettingDrawer/{Switch/index.d.ts → components/Switch.d.ts} +2 -2
- package/lib/components/SettingDrawer/components/Switch.d.ts.map +1 -0
- package/lib/components/SettingDrawer/{Switch/index.js → components/Switch.js} +1 -1
- package/lib/components/SettingDrawer/components/Switch.js.map +1 -0
- package/lib/components/SettingDrawer/components/ThemeColor.d.ts +3 -0
- package/lib/components/SettingDrawer/components/ThemeColor.d.ts.map +1 -0
- package/lib/components/SettingDrawer/{ThemeColor.js → components/ThemeColor.js} +2 -2
- package/lib/components/SettingDrawer/components/ThemeColor.js.map +1 -0
- package/lib/components/SettingDrawer/{ThemeSelector.d.ts → components/ThemeSelector.d.ts} +1 -1
- package/lib/components/SettingDrawer/components/ThemeSelector.d.ts.map +1 -0
- package/lib/components/SettingDrawer/components/ThemeSelector.js.map +1 -0
- package/lib/components/SettingDrawer/components/WebFontsSelector.d.ts +3 -0
- package/lib/components/SettingDrawer/components/WebFontsSelector.d.ts.map +1 -0
- package/lib/components/SettingDrawer/components/WebFontsSelector.js.map +1 -0
- package/lib/components/SettingDrawer/hooks/useSettingsOperations.d.ts +18 -0
- package/lib/components/SettingDrawer/hooks/useSettingsOperations.d.ts.map +1 -0
- package/lib/components/SettingDrawer/hooks/useSettingsOperations.js +117 -0
- package/lib/components/SettingDrawer/hooks/useSettingsOperations.js.map +1 -0
- package/lib/components/SettingDrawer/utils/constants.d.ts +11 -0
- package/lib/components/SettingDrawer/utils/constants.d.ts.map +1 -0
- package/lib/components/SettingDrawer/utils/constants.js +77 -0
- package/lib/components/SettingDrawer/utils/constants.js.map +1 -0
- package/lib/components/SettingDrawer/utils/helper.d.ts +37 -0
- package/lib/components/SettingDrawer/utils/helper.d.ts.map +1 -0
- package/lib/components/SettingDrawer/utils/helper.js +243 -0
- package/lib/components/SettingDrawer/utils/helper.js.map +1 -0
- package/lib/components/SettingDrawer/utils/transformers.d.ts +15 -0
- package/lib/components/SettingDrawer/utils/transformers.d.ts.map +1 -0
- package/lib/components/SettingDrawer/utils/transformers.js +76 -0
- package/lib/components/SettingDrawer/utils/transformers.js.map +1 -0
- package/lib/components/SettingDrawer/utils/types.d.ts.map +1 -0
- package/lib/machines/settingsMachine.js +6 -9
- package/lib/machines/settingsMachine.js.map +1 -1
- package/lib/machines/types.d.ts +1 -0
- package/lib/machines/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/lib/components/SettingDrawer/CheckBoxTheme.d.ts +0 -3
- package/lib/components/SettingDrawer/CheckBoxTheme.d.ts.map +0 -1
- package/lib/components/SettingDrawer/CheckBoxTheme.js.map +0 -1
- package/lib/components/SettingDrawer/InvitationSettings.d.ts +0 -3
- package/lib/components/SettingDrawer/InvitationSettings.d.ts.map +0 -1
- package/lib/components/SettingDrawer/InvitationSettings.js.map +0 -1
- package/lib/components/SettingDrawer/LayoutChange.d.ts +0 -3
- package/lib/components/SettingDrawer/LayoutChange.d.ts.map +0 -1
- package/lib/components/SettingDrawer/LayoutChange.js.map +0 -1
- package/lib/components/SettingDrawer/MenuVisibilitySettings.d.ts.map +0 -1
- package/lib/components/SettingDrawer/MenuVisibilitySettings.js.map +0 -1
- package/lib/components/SettingDrawer/NavigationsModes.d.ts +0 -3
- package/lib/components/SettingDrawer/NavigationsModes.d.ts.map +0 -1
- package/lib/components/SettingDrawer/NavigationsModes.js.map +0 -1
- package/lib/components/SettingDrawer/RegionalSettings.d.ts +0 -3
- package/lib/components/SettingDrawer/RegionalSettings.d.ts.map +0 -1
- package/lib/components/SettingDrawer/RegionalSettings.js.map +0 -1
- package/lib/components/SettingDrawer/Switch/index.d.ts.map +0 -1
- package/lib/components/SettingDrawer/Switch/index.js.map +0 -1
- package/lib/components/SettingDrawer/ThemeColor.d.ts +0 -3
- package/lib/components/SettingDrawer/ThemeColor.d.ts.map +0 -1
- package/lib/components/SettingDrawer/ThemeColor.js.map +0 -1
- package/lib/components/SettingDrawer/ThemeSelector.d.ts.map +0 -1
- package/lib/components/SettingDrawer/ThemeSelector.js.map +0 -1
- package/lib/components/SettingDrawer/WebFontsSelector.d.ts +0 -3
- package/lib/components/SettingDrawer/WebFontsSelector.d.ts.map +0 -1
- package/lib/components/SettingDrawer/WebFontsSelector.js.map +0 -1
- package/lib/components/SettingDrawer/types.d.ts.map +0 -1
- /package/lib/components/SettingDrawer/{ThemeSelector.js → components/ThemeSelector.js} +0 -0
- /package/lib/components/SettingDrawer/{WebFontsSelector.js → components/WebFontsSelector.js} +0 -0
- /package/lib/components/SettingDrawer/{types.d.ts → utils/types.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeColor.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingDrawer/components/ThemeColor.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD,wBAAgB,UAAU,CAAC,KAAK,EAAE,gBAAgB,2CAgDjD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {jsx}from'react/jsx-runtime';import'react';import'@react-icons/all-files/fa/FaMoon.js';import'@react-icons/all-files/fa/FaSun.js';import {useMediaQuery}from'
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import'react';import'@react-icons/all-files/fa/FaMoon.js';import'@react-icons/all-files/fa/FaSun.js';import {useMediaQuery}from'../../../hooks/useMediaQuery.js';import {getSettingValue}from'../../../utils/settingsUtils.js';function ThemeColor(props) {
|
|
2
2
|
const {
|
|
3
3
|
color,
|
|
4
4
|
changeSetting,
|
|
@@ -44,4 +44,4 @@ import {jsx}from'react/jsx-runtime';import'react';import'@react-icons/all-files/
|
|
|
44
44
|
}, index);
|
|
45
45
|
})
|
|
46
46
|
});
|
|
47
|
-
}export{ThemeColor
|
|
47
|
+
}export{ThemeColor};//# sourceMappingURL=ThemeColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeColor.js","sources":["../../../../src/components/SettingDrawer/components/ThemeColor.tsx"],"sourcesContent":[null],"names":[],"mappings":"mQAKM,SAAU,UAAU,CAAC,KAAuB,EAAA;AAC9C,EAAA,MAAA;AACA,IAAA,KAAA;IACA,aAAM;IACN,QAAM;IAEN,QAAA;IACA,YAAM;AACF,IAAA,gBAAO,GAAA;AACX,GAAA,GAAE,KAAA;QAEE;AACA,IAAA;MACH,aAAA,EAAA;AAED,EAAA,MAAA,YACI,GAAA,YAAc,6BAA0B;AAEhC,EAAA,MAAA,UAAA,GACI,QAAA,GAAA,QAEI,GAAS,SAAC;AAGN;4BACH,GAEA,MAAA;WAkBX,eAER,CAAA,QAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,SAAA,CAAA;AACN,EAAC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ThemeSelectorProps } from '
|
|
1
|
+
import { ThemeSelectorProps } from '../utils/types';
|
|
2
2
|
export declare function ThemeSelector({ value, onChange, options }: ThemeSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=ThemeSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingDrawer/components/ThemeSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,kBAAkB,2CAgB7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeSelector.js","sources":["../../../../src/components/SettingDrawer/components/ThemeSelector.tsx"],"sourcesContent":[null],"names":[],"mappings":"oCAGM,SAAU,aAAa,CAAC;AAC1B,EAAA,KAAA;AAeJ,EAAC,QAAA;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebFontsSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingDrawer/components/WebFontsSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAiB5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebFontsSelector.js","sources":["../../../../src/components/SettingDrawer/components/WebFontsSelector.tsx"],"sourcesContent":[null],"names":[],"mappings":"oCAEO,MAAM,gBAAgB,GAAoC,CAAC;AAC9D,EAAA,KAAA;AAgBJ,EAAE,QAAA;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface UseSettingsOperationsProps {
|
|
2
|
+
actor: any;
|
|
3
|
+
settingState: any;
|
|
4
|
+
changedSettings: any;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Custom hook to handle all settings operations (save, reset, copy)
|
|
8
|
+
*/
|
|
9
|
+
export declare function useSettingsOperations({ actor, settingState, changedSettings }: UseSettingsOperationsProps): {
|
|
10
|
+
copied: boolean;
|
|
11
|
+
copiedModified: boolean;
|
|
12
|
+
handleCopySettings: () => Promise<void>;
|
|
13
|
+
handleCopyModifiedSettings: () => Promise<void>;
|
|
14
|
+
handleSaveSettings: () => Promise<void>;
|
|
15
|
+
handleResetSettings: () => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=useSettingsOperations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSettingsOperations.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingDrawer/hooks/useSettingsOperations.ts"],"names":[],"mappings":"AASA,UAAU,0BAA0B;IAChC,KAAK,EAAE,GAAG,CAAC;IACX,YAAY,EAAE,GAAG,CAAC;IAClB,eAAe,EAAE,GAAG,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,0BAA0B;;;;;;;EAmIzG"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {useState}from'react';import {useWriteSettingsMutation,useResetApplicationUiSettingsMutation}from'common/lib/generated/generated.js';import {ConfigCollectionName,ConfigFragmentName}from'common/lib/generated/generated-models.js';import {generateCdecodeUri,DEFAULT_CONTRIBUTION_TENANT_ID}from'@adminide-stack/core';import {config}from'../../../config/env-config.js';import isBrowser from'../../../utils/isBrowser/index.js';import {clearSettingsCookies,transformSettingsForBackend,getCookieSettings}from'../utils/transformers.js';import {RESET_CONFIRMATION_MESSAGE,COPY_TIMEOUT_MS}from'../utils/constants.js';/**
|
|
2
|
+
* Custom hook to handle all settings operations (save, reset, copy)
|
|
3
|
+
*/
|
|
4
|
+
function useSettingsOperations({
|
|
5
|
+
actor,
|
|
6
|
+
settingState,
|
|
7
|
+
changedSettings
|
|
8
|
+
}) {
|
|
9
|
+
const [copied, setCopied] = useState(false);
|
|
10
|
+
const [copiedModified, setCopiedModified] = useState(false);
|
|
11
|
+
// Mutations
|
|
12
|
+
const [writeSettingsMutation] = useWriteSettingsMutation();
|
|
13
|
+
const [resetApplicationSettings] = useResetApplicationUiSettingsMutation();
|
|
14
|
+
// Generate resource URI for API calls
|
|
15
|
+
const resource = generateCdecodeUri(DEFAULT_CONTRIBUTION_TENANT_ID, {
|
|
16
|
+
resourceType: ConfigCollectionName.Applications,
|
|
17
|
+
resourceId: config.APPLICATION_ID,
|
|
18
|
+
idField: 'appId'
|
|
19
|
+
}, {}, ConfigFragmentName.UiSettings);
|
|
20
|
+
/**
|
|
21
|
+
* Copy all current settings to clipboard
|
|
22
|
+
*/
|
|
23
|
+
const handleCopySettings = async () => {
|
|
24
|
+
if (!isBrowser()) return;
|
|
25
|
+
try {
|
|
26
|
+
const settings = JSON.stringify(settingState, null, 2);
|
|
27
|
+
await navigator.clipboard.writeText(settings);
|
|
28
|
+
setCopied(true);
|
|
29
|
+
setTimeout(() => setCopied(false), COPY_TIMEOUT_MS);
|
|
30
|
+
} catch (err) {
|
|
31
|
+
console.error('Failed to copy settings:', err);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Copy modified settings from cookies to clipboard
|
|
36
|
+
*/
|
|
37
|
+
const handleCopyModifiedSettings = async () => {
|
|
38
|
+
if (!isBrowser()) return;
|
|
39
|
+
try {
|
|
40
|
+
const parsedSettings = getCookieSettings();
|
|
41
|
+
if (parsedSettings) {
|
|
42
|
+
await navigator.clipboard.writeText(JSON.stringify(parsedSettings, null, 2));
|
|
43
|
+
setCopiedModified(true);
|
|
44
|
+
setTimeout(() => setCopiedModified(false), COPY_TIMEOUT_MS);
|
|
45
|
+
}
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.error('Failed to copy modified settings:', err);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Save changed settings to backend
|
|
52
|
+
*/
|
|
53
|
+
const handleSaveSettings = async () => {
|
|
54
|
+
if (!isBrowser()) return;
|
|
55
|
+
try {
|
|
56
|
+
// Transform changedSettings to wrap in uilayout structure for backend
|
|
57
|
+
const wrappedSettings = transformSettingsForBackend(changedSettings);
|
|
58
|
+
console.log('📤 Sending to API:', wrappedSettings);
|
|
59
|
+
const variables = {
|
|
60
|
+
editingUri: resource,
|
|
61
|
+
settings: wrappedSettings
|
|
62
|
+
};
|
|
63
|
+
const response = await writeSettingsMutation({
|
|
64
|
+
variables
|
|
65
|
+
});
|
|
66
|
+
if (response.data) {
|
|
67
|
+
console.log('✅ Settings saved successfully');
|
|
68
|
+
actor.send({
|
|
69
|
+
type: 'UISETTING_RESET_CHANGED_SETTINGS'
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.error('❌ Failed to save settings:', err);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Reset all settings (database + cookies) and reload
|
|
78
|
+
*/
|
|
79
|
+
const handleResetSettings = async () => {
|
|
80
|
+
if (!isBrowser()) return;
|
|
81
|
+
const confirmed = window.confirm(RESET_CONFIRMATION_MESSAGE);
|
|
82
|
+
if (!confirmed) return;
|
|
83
|
+
try {
|
|
84
|
+
console.log('🔥 Resetting all settings...');
|
|
85
|
+
// Step 1: Delete uiSettings from database
|
|
86
|
+
try {
|
|
87
|
+
await resetApplicationSettings({
|
|
88
|
+
variables: {
|
|
89
|
+
appId: config.APPLICATION_ID
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
console.log('✅ Database uiSettings deleted');
|
|
93
|
+
} catch (dbErr) {
|
|
94
|
+
console.error('⚠️ Failed to delete database uiSettings:', dbErr);
|
|
95
|
+
}
|
|
96
|
+
// Step 2: Clear cookies
|
|
97
|
+
await clearSettingsCookies();
|
|
98
|
+
// Step 3: Reset XState machine
|
|
99
|
+
actor.send({
|
|
100
|
+
type: 'UISETTING_RESET_CHANGED_SETTINGS'
|
|
101
|
+
});
|
|
102
|
+
} catch (err) {
|
|
103
|
+
console.error('❌ Error resetting settings:', err);
|
|
104
|
+
alert('Failed to reset settings. Please try again.');
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
// State
|
|
109
|
+
copied,
|
|
110
|
+
copiedModified,
|
|
111
|
+
// Handlers
|
|
112
|
+
handleCopySettings,
|
|
113
|
+
handleCopyModifiedSettings,
|
|
114
|
+
handleSaveSettings,
|
|
115
|
+
handleResetSettings
|
|
116
|
+
};
|
|
117
|
+
}export{useSettingsOperations};//# sourceMappingURL=useSettingsOperations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSettingsOperations.js","sources":["../../../../src/components/SettingDrawer/hooks/useSettingsOperations.ts"],"sourcesContent":[null],"names":[],"mappings":"qmBAeA;;AAEG;AACG,SAAU,qBAAqB,CAAC;OAClC;cACO;;AAGP,CAAA,EAAA;AACA,EAAA,MAAA,CAAA,MAAO,EAAA,SAAA,CAAA,GAAA,QAAyB,CAAG,KAAA,CAAA;QAEnC,CAAA,cAAA,EAAA,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T_OPTIONS: {
|
|
6
|
+
key: string;
|
|
7
|
+
title: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const COPY_TIMEOUT_MS = 2000;
|
|
10
|
+
export declare const RESET_CONFIRMATION_MESSAGE = "Are you sure you want to reset all settings? This will delete all customizations from database and cookies, then reload the page.";
|
|
11
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingDrawer/utils/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa;;;GAMzB,CAAC;AAGF,eAAO,MAAM,YAAY;;;GAmBxB,CAAC;AAGF,eAAO,MAAM,eAAe,OAAO,CAAC;AAGpC,eAAO,MAAM,0BAA0B,sIACgG,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Theme options for the settings drawer
|
|
2
|
+
const THEME_OPTIONS = [{
|
|
3
|
+
key: 'default',
|
|
4
|
+
title: 'Default'
|
|
5
|
+
}, {
|
|
6
|
+
key: 'github',
|
|
7
|
+
title: 'Github Theme'
|
|
8
|
+
}, {
|
|
9
|
+
key: 'slack',
|
|
10
|
+
title: 'Slack Theme'
|
|
11
|
+
}, {
|
|
12
|
+
key: 'airbnb',
|
|
13
|
+
title: 'Airbnb Theme'
|
|
14
|
+
}, {
|
|
15
|
+
key: 'spotify',
|
|
16
|
+
title: 'Spotify Theme'
|
|
17
|
+
}];
|
|
18
|
+
// Font options for the settings drawer
|
|
19
|
+
const FONT_OPTIONS = [{
|
|
20
|
+
key: 'Poppins, sans-serif',
|
|
21
|
+
title: 'Poppins'
|
|
22
|
+
}, {
|
|
23
|
+
key: 'Roboto, sans-serif',
|
|
24
|
+
title: 'Roboto'
|
|
25
|
+
}, {
|
|
26
|
+
key: 'Open Sans, sans-serif',
|
|
27
|
+
title: 'Open Sans'
|
|
28
|
+
}, {
|
|
29
|
+
key: 'Montserrat, sans-serif',
|
|
30
|
+
title: 'Montserrat'
|
|
31
|
+
}, {
|
|
32
|
+
key: 'Lato, sans-serif',
|
|
33
|
+
title: 'Lato'
|
|
34
|
+
}, {
|
|
35
|
+
key: 'Nunito, sans-serif',
|
|
36
|
+
title: 'Nunito'
|
|
37
|
+
}, {
|
|
38
|
+
key: 'Ubuntu, sans-serif',
|
|
39
|
+
title: 'Ubuntu'
|
|
40
|
+
}, {
|
|
41
|
+
key: 'Inter, sans-serif',
|
|
42
|
+
title: 'Inter'
|
|
43
|
+
}, {
|
|
44
|
+
key: 'Arial, sans-serif',
|
|
45
|
+
title: 'Arial'
|
|
46
|
+
}, {
|
|
47
|
+
key: 'Helvetica, sans-serif',
|
|
48
|
+
title: 'Helvetica'
|
|
49
|
+
}, {
|
|
50
|
+
key: 'Tahoma, sans-serif',
|
|
51
|
+
title: 'Tahoma'
|
|
52
|
+
}, {
|
|
53
|
+
key: 'Trebuchet MS, sans-serif',
|
|
54
|
+
title: 'Trebuchet MS'
|
|
55
|
+
}, {
|
|
56
|
+
key: 'Georgia, serif',
|
|
57
|
+
title: 'Georgia'
|
|
58
|
+
}, {
|
|
59
|
+
key: 'Bookman, serif',
|
|
60
|
+
title: 'Bookman'
|
|
61
|
+
}, {
|
|
62
|
+
key: 'Geneva, sans-serif',
|
|
63
|
+
title: 'Geneva'
|
|
64
|
+
}, {
|
|
65
|
+
key: 'Lucida Console, monospace',
|
|
66
|
+
title: 'Lucida Console'
|
|
67
|
+
}, {
|
|
68
|
+
key: 'Courier New, monospace',
|
|
69
|
+
title: 'Courier New'
|
|
70
|
+
}, {
|
|
71
|
+
key: 'Lucida Sans, sans-serif',
|
|
72
|
+
title: 'Lucida Sans'
|
|
73
|
+
}];
|
|
74
|
+
// Timeouts
|
|
75
|
+
const COPY_TIMEOUT_MS = 2000;
|
|
76
|
+
// Confirmation messages
|
|
77
|
+
const RESET_CONFIRMATION_MESSAGE = 'Are you sure you want to reset all settings? This will delete all customizations from database and cookies, then reload the page.';export{COPY_TIMEOUT_MS,FONT_OPTIONS,RESET_CONFIRMATION_MESSAGE,THEME_OPTIONS};//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/components/SettingDrawer/utils/constants.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACO,MAAM,aAAa,GAAG,CAAA;AACzB,EAAA,GAAA,WAAO;AACP,EAAA,OAAK;AACL,CAAA,EAAA;AACA,EAAA,GAAA,UAAO;AACP,EAAA,OAAK;CACR,EAAC;AAEF,EAAA,GAAA,EAAA,OAAA;AACA,EAAA,KAAO,EAAA;AACH,CAAA,EAAA;AACA,EAAA,GAAA,UAAO;AACP,EAAA,OAAK;AACL,CAAA,EAAA;AACA,EAAA,GAAA,WAAO;AACP,EAAA,OAAK;AACL,CAAA;AACA;AACO,MAAA,YAAA,GAAA,CAAA;AACP,EAAA,GAAA,uBAAO;AACP,EAAA,OAAK;AACL,CAAA,EAAA;AACA,EAAA,GAAA,sBAAuB;AACvB,EAAA,OAAK;AACL,CAAA,EAAA;AACA,EAAA,GAAA,yBAAO;AACP,EAAA,OAAK;AACL,CAAA,EAAA;EACF,GAAA,EAAA,wBAAA;AAEF,EAAA,KAAA,EAAA;AACA,CAAA,EAAA;AAEA,EAAA,GAAA,EAAA,kBAAwB;AACxB,EAAA,KAAO,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ProSettings } from '@admin-layout/client';
|
|
2
|
+
import { MergerSettingsType, SettingDrawerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Initialize settings from URL parameters and apply theme
|
|
5
|
+
*/
|
|
6
|
+
export declare function initState(settings: Partial<MergerSettingsType<ProSettings>>, onSettingChange: SettingDrawerProps['onSettingChange'], publicPath?: string, oldSetting?: Partial<MergerSettingsType<ProSettings>>): void;
|
|
7
|
+
/**
|
|
8
|
+
* Update theme by dynamically loading CSS file
|
|
9
|
+
*/
|
|
10
|
+
export declare function updateTheme(dark?: boolean | any, color?: string, publicPath?: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Get theme list with colors based on current settings and device
|
|
13
|
+
*/
|
|
14
|
+
export declare function getThemeList(settings: Partial<ProSettings>, location: any, routePattern?: string): {
|
|
15
|
+
colorList: {
|
|
16
|
+
dark: {
|
|
17
|
+
key: string;
|
|
18
|
+
color: string;
|
|
19
|
+
theme?: "dark" | "light";
|
|
20
|
+
}[];
|
|
21
|
+
light: {
|
|
22
|
+
key: string;
|
|
23
|
+
color: string;
|
|
24
|
+
theme?: "dark" | "light";
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
themeList: {
|
|
28
|
+
key: string;
|
|
29
|
+
title: string;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Parse a dot-separated path into a nested object structure
|
|
34
|
+
* Example: parseSettingPath('a.b.c', 'value') => { a: { b: { c: 'value' } } }
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseSettingPath(path: string, value: any): any;
|
|
37
|
+
//# sourceMappingURL=helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingDrawer/utils/helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEjE;;GAEG;AACH,wBAAgB,SAAS,CACrB,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,EAClD,eAAe,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,EACtD,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,QAkExD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,SAAW,QA+CtF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM;;;iBAsGpF,MAAM;mBACJ,MAAM;oBACL,MAAM,GAAG,OAAO;;;iBAUnB,MAAM;mBACJ,MAAM;oBACL,MAAM,GAAG,OAAO;;;;;;;EA8C/B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,CAoB9D"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import {parse}from'qs';import {useTranslation}from'react-i18next';import isBrowser from'../../../utils/isBrowser/index.js';import'react';import'@react-icons/all-files/fa/FaMoon.js';import'@react-icons/all-files/fa/FaSun.js';import {useMediaQuery}from'../../../hooks/useMediaQuery.js';/**
|
|
2
|
+
* Initialize settings from URL parameters and apply theme
|
|
3
|
+
*/
|
|
4
|
+
function initState(settings, onSettingChange, publicPath, oldSetting) {
|
|
5
|
+
if (!isBrowser()) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
let loadedStyle = false;
|
|
9
|
+
if (window.location.search) {
|
|
10
|
+
const params = parse(window.location.search.replace('?', ''));
|
|
11
|
+
const replaceSetting = {};
|
|
12
|
+
Object.keys(params).forEach(key => {
|
|
13
|
+
if (settings[key] !== undefined || settings[key] === undefined) {
|
|
14
|
+
replaceSetting[key] = params[key];
|
|
15
|
+
if (key.includes('Render')) {
|
|
16
|
+
replaceSetting[key] = params[key] === 'false' ? false : undefined;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
// Only call onSettingChange if we have actual URL parameters to apply
|
|
21
|
+
if (onSettingChange && Object.keys(replaceSetting).length > 0) {
|
|
22
|
+
console.log('✅ initState: Calling onSettingChange with URL params:', replaceSetting);
|
|
23
|
+
onSettingChange({
|
|
24
|
+
...settings,
|
|
25
|
+
...replaceSetting
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
console.log('⏭️ initState: Skipping onSettingChange - no valid URL params to apply');
|
|
29
|
+
}
|
|
30
|
+
// Set the topic in the URL and load it once.
|
|
31
|
+
if (oldSetting?.navTheme !== params.navTheme && params.navTheme) {
|
|
32
|
+
updateTheme(settings.navTheme === 'realDark', params.primaryColor, publicPath);
|
|
33
|
+
loadedStyle = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (loadedStyle) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// If there is no topic in the URL, and no load in the URL is loaded.
|
|
40
|
+
if (oldSetting?.navTheme !== settings.navTheme && settings.navTheme) {
|
|
41
|
+
updateTheme(settings.navTheme === 'realDark', settings.primaryColor, publicPath);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Update theme by dynamically loading CSS file
|
|
46
|
+
*/
|
|
47
|
+
function updateTheme(dark, color, publicPath = '/theme') {
|
|
48
|
+
// ssr
|
|
49
|
+
if (typeof window === 'undefined' || !window.umi_plugin_ant_themeVar) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const href = dark ? `${publicPath}/dark` : `${publicPath}/`;
|
|
53
|
+
// If it is DARK, and is color = daybreak, there is no need to splice
|
|
54
|
+
let colorFileName = dark && color ? `-${encodeURIComponent(color)}` : encodeURIComponent(color || '');
|
|
55
|
+
if (color === 'daybreak' && dark) {
|
|
56
|
+
colorFileName = '';
|
|
57
|
+
}
|
|
58
|
+
const dom = document.getElementById('theme-style');
|
|
59
|
+
// If these two are empty
|
|
60
|
+
if (!href && !colorFileName) {
|
|
61
|
+
if (dom) {
|
|
62
|
+
dom.remove();
|
|
63
|
+
localStorage.removeItem('site-theme');
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const url = `${href}${colorFileName || ''}.css`;
|
|
68
|
+
if (dom) {
|
|
69
|
+
dom.onload = () => {
|
|
70
|
+
window.setTimeout(() => {});
|
|
71
|
+
};
|
|
72
|
+
dom.href = url;
|
|
73
|
+
} else {
|
|
74
|
+
const style = document.createElement('link');
|
|
75
|
+
style.type = 'text/css';
|
|
76
|
+
style.rel = 'stylesheet';
|
|
77
|
+
style.id = 'theme-style';
|
|
78
|
+
style.onload = () => {
|
|
79
|
+
window.setTimeout(() => {});
|
|
80
|
+
};
|
|
81
|
+
style.href = url;
|
|
82
|
+
if (document.body.append) {
|
|
83
|
+
document.body.append(style);
|
|
84
|
+
} else {
|
|
85
|
+
document.body.appendChild(style);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// localStorage.setItem('site-theme', dark ? 'dark' : 'light');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get theme list with colors based on current settings and device
|
|
92
|
+
*/
|
|
93
|
+
function getThemeList(settings, location, routePattern) {
|
|
94
|
+
const {
|
|
95
|
+
t
|
|
96
|
+
} = useTranslation('settings');
|
|
97
|
+
const {
|
|
98
|
+
isMobile
|
|
99
|
+
} = useMediaQuery();
|
|
100
|
+
const currentRoute = routePattern || location?.pathname || '/';
|
|
101
|
+
const deviceType = isMobile ? 'mobile' : 'desktop';
|
|
102
|
+
// Helper function to get value from settings with route/device override support
|
|
103
|
+
const getUILayoutValue = path => {
|
|
104
|
+
const routeDeviceKey = `[${currentRoute}][${deviceType}]`;
|
|
105
|
+
const uiOverride = settings?.uiSettings?.[routeDeviceKey];
|
|
106
|
+
if (uiOverride) {
|
|
107
|
+
const value = path.split('.').reduce((obj, key) => obj?.[key], uiOverride);
|
|
108
|
+
if (value !== undefined) return value;
|
|
109
|
+
}
|
|
110
|
+
return path.split('.').reduce((obj, key) => obj?.[key], settings);
|
|
111
|
+
};
|
|
112
|
+
const deviceLayout = {
|
|
113
|
+
navigationMode: getUILayoutValue('navigationMode'),
|
|
114
|
+
sideMenuType: getUILayoutValue('sideMenuType'),
|
|
115
|
+
contentWidth: getUILayoutValue('contentWidth'),
|
|
116
|
+
fixedHeader: getUILayoutValue('fixedHeader'),
|
|
117
|
+
fixedSidebar: getUILayoutValue('fixedSidebar'),
|
|
118
|
+
splitMenus: getUILayoutValue('splitMenus')
|
|
119
|
+
};
|
|
120
|
+
let list = [];
|
|
121
|
+
const defaultList = [
|
|
122
|
+
//@sri following are needed otherwise we need make above plugin to work
|
|
123
|
+
{
|
|
124
|
+
key: 'dust',
|
|
125
|
+
fileName: 'dust.css',
|
|
126
|
+
modifyVars: {
|
|
127
|
+
'@primary-color': '#F5222D'
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: 'volcano',
|
|
131
|
+
fileName: 'volcano.css',
|
|
132
|
+
modifyVars: {
|
|
133
|
+
'@primary-color': '#FA541C'
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
key: 'sunset',
|
|
137
|
+
fileName: 'sunset.css',
|
|
138
|
+
modifyVars: {
|
|
139
|
+
'@primary-color': '#FAAD14'
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
key: 'cyan',
|
|
143
|
+
fileName: 'cyan.css',
|
|
144
|
+
modifyVars: {
|
|
145
|
+
'@primary-color': '#13C2C2'
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: 'green',
|
|
149
|
+
fileName: 'green.css',
|
|
150
|
+
modifyVars: {
|
|
151
|
+
'@primary-color': '#52C41A'
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: 'geekblue',
|
|
155
|
+
fileName: 'geekblue.css',
|
|
156
|
+
modifyVars: {
|
|
157
|
+
'@primary-color': '#2F54EB'
|
|
158
|
+
}
|
|
159
|
+
}, {
|
|
160
|
+
key: 'purple',
|
|
161
|
+
fileName: 'purple.css',
|
|
162
|
+
modifyVars: {
|
|
163
|
+
'@primary-color': '#722ED1'
|
|
164
|
+
}
|
|
165
|
+
}];
|
|
166
|
+
// ssr
|
|
167
|
+
if (typeof window === 'undefined') {
|
|
168
|
+
list = defaultList;
|
|
169
|
+
} else {
|
|
170
|
+
list = window.umi_plugin_ant_themeVar || defaultList;
|
|
171
|
+
}
|
|
172
|
+
const themeList = [{
|
|
173
|
+
key: 'light',
|
|
174
|
+
title: t('light')
|
|
175
|
+
}];
|
|
176
|
+
const darkColorList = [{
|
|
177
|
+
key: 'daybreak',
|
|
178
|
+
color: '#1890ff',
|
|
179
|
+
theme: 'dark'
|
|
180
|
+
}];
|
|
181
|
+
const lightColorList = [{
|
|
182
|
+
key: 'daybreak',
|
|
183
|
+
color: '#1890ff',
|
|
184
|
+
theme: 'dark'
|
|
185
|
+
}];
|
|
186
|
+
if (deviceLayout.navigationMode !== 'mixed') {
|
|
187
|
+
themeList.push({
|
|
188
|
+
key: 'dark',
|
|
189
|
+
title: t('dark')
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
if (list.find(item => item.theme === 'dark')) {
|
|
193
|
+
themeList.push({
|
|
194
|
+
key: 'realDark',
|
|
195
|
+
title: t('dark')
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
// insert theme color List
|
|
199
|
+
list.forEach(item => {
|
|
200
|
+
const color = (item.modifyVars || {})['@primary-color'];
|
|
201
|
+
if (item.theme === 'dark' && color) {
|
|
202
|
+
darkColorList.push({
|
|
203
|
+
color,
|
|
204
|
+
...item
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
if (!item.theme || item.theme === 'light') {
|
|
208
|
+
lightColorList.push({
|
|
209
|
+
color,
|
|
210
|
+
...item
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
return {
|
|
215
|
+
colorList: {
|
|
216
|
+
dark: darkColorList,
|
|
217
|
+
light: lightColorList
|
|
218
|
+
},
|
|
219
|
+
themeList
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Parse a dot-separated path into a nested object structure
|
|
224
|
+
* Example: parseSettingPath('a.b.c', 'value') => { a: { b: { c: 'value' } } }
|
|
225
|
+
*/
|
|
226
|
+
function parseSettingPath(path, value) {
|
|
227
|
+
const keys = path.split('.');
|
|
228
|
+
// Base case: no nesting
|
|
229
|
+
if (keys.length === 1) {
|
|
230
|
+
return {
|
|
231
|
+
[path]: value
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
// Build nested object
|
|
235
|
+
let result = {};
|
|
236
|
+
let current = result;
|
|
237
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
238
|
+
current[keys[i]] = {};
|
|
239
|
+
current = current[keys[i]];
|
|
240
|
+
}
|
|
241
|
+
current[keys[keys.length - 1]] = value;
|
|
242
|
+
return result;
|
|
243
|
+
}export{getThemeList,initState,parseSettingPath,updateTheme};//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sources":["../../../../src/components/SettingDrawer/utils/helper.ts"],"sourcesContent":[null],"names":[],"mappings":"4RAOA;;AAEG;AACG,SAAU,SAAS,CACrB,QAAkD,EAClD,eAAsD,EACtD,UAAmB,EACnB,UAAqD,EAAA;AAErD,EAAA,IAAA,CAAA,SAAK,EAAS,EAAE;;;MAgBhB,WAAI,GAAW,KAAG;AAElB,EAAA,IAAA,eAAW,CAAA,MAAS,EAAM;AACtB,IAAA,MAAA,cAAe,CAAA,MAAM,CAAA,QAAO,CAAA,MAAS,CAAA,WAAc,EAAC,EAAG,EAAE;UAKzD,cAAM,GAAA,EAAc;UACpB,CAAA,IAAO,CAAA,MAAK,CAAA,CAAA,OAAQ,CAAA,GAAO,IAAE;AACzB,MAAA,IAAA,QAAI,CAAA,GAAA,CAAA,KAAY,SAAM,IAAA,QAAa,CAAA,GAAA,CAAA,KAAY,SAAM,EAAA;sBACjD,CAAA,GAAA,CAAA,GAAc,MAAK,CAAA;AACnB,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A"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform changed settings to wrap in uilayout structure for backend API
|
|
3
|
+
* Converts keys like "[desktop].theme" to "[desktop].uilayout.theme"
|
|
4
|
+
*/
|
|
5
|
+
export declare function transformSettingsForBackend(changedSettings: Record<string, any>): Record<string, any>;
|
|
6
|
+
/**
|
|
7
|
+
* Extract and parse settings from browser cookies
|
|
8
|
+
* Returns null if cookie not found or parsing fails
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCookieSettings(): Record<string, any> | null;
|
|
11
|
+
/**
|
|
12
|
+
* Clear settings cookies by sending DELETE request to server
|
|
13
|
+
*/
|
|
14
|
+
export declare function clearSettingsCookies(): Promise<boolean>;
|
|
15
|
+
//# sourceMappingURL=transformers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../../../../src/components/SettingDrawer/utils/transformers.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAmCrG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAqB9D;AAED;;GAEG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAkB7D"}
|