@seliseblocks/genesis-os 4.3.6 → 4.3.8
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/dist/{chunk-VQWYNAO5.cjs → chunk-4QN4CYSC.cjs} +10 -7
- package/dist/chunk-4QN4CYSC.cjs.map +1 -0
- package/dist/{chunk-OJG2XE7Z.cjs → chunk-IJMKS4XG.cjs} +6 -6
- package/dist/{chunk-OJG2XE7Z.cjs.map → chunk-IJMKS4XG.cjs.map} +1 -1
- package/dist/{chunk-PKRBEIHK.js → chunk-JITR3QYC.js} +10 -7
- package/dist/chunk-JITR3QYC.js.map +1 -0
- package/dist/{chunk-SKKVJAXT.js → chunk-LNQUCEQU.js} +44 -7
- package/dist/chunk-LNQUCEQU.js.map +1 -0
- package/dist/{chunk-SHCA37CD.cjs → chunk-OVQEP63V.cjs} +215 -115
- package/dist/chunk-OVQEP63V.cjs.map +1 -0
- package/dist/{chunk-Y36F6N2O.js → chunk-PSJHGD3M.js} +156 -56
- package/dist/chunk-PSJHGD3M.js.map +1 -0
- package/dist/{chunk-JDWJ2HXQ.cjs → chunk-QN6HLQ67.cjs} +45 -8
- package/dist/chunk-QN6HLQ67.cjs.map +1 -0
- package/dist/{chunk-OAWBQY5W.js → chunk-XRAO7JBH.js} +3 -3
- package/dist/{chunk-OAWBQY5W.js.map → chunk-XRAO7JBH.js.map} +1 -1
- package/dist/components/index.cjs +351 -351
- package/dist/components/index.js +4 -4
- package/dist/guards/index.cjs +10 -10
- package/dist/guards/index.js +4 -4
- package/dist/hooks/index.cjs +54 -54
- package/dist/hooks/index.d.cts +3 -3
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +2 -2
- package/dist/index.cjs +431 -431
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/layouts/index.cjs +11 -11
- package/dist/layouts/index.js +4 -4
- package/dist/models/index.d.cts +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/pages/index.cjs +9 -9
- package/dist/pages/index.js +4 -4
- package/dist/providers/index.cjs +6 -6
- package/dist/providers/index.js +2 -2
- package/dist/{service-registry.model-pcv_ix2e.d.cts → service-registry.model-DJGsTRWZ.d.cts} +17 -1
- package/dist/{service-registry.model-pcv_ix2e.d.ts → service-registry.model-DJGsTRWZ.d.ts} +17 -1
- package/dist/store/index.cjs +7 -7
- package/dist/store/index.d.cts +16 -6
- package/dist/store/index.d.ts +16 -6
- package/dist/store/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-JDWJ2HXQ.cjs.map +0 -1
- package/dist/chunk-PKRBEIHK.js.map +0 -1
- package/dist/chunk-SHCA37CD.cjs.map +0 -1
- package/dist/chunk-SKKVJAXT.js.map +0 -1
- package/dist/chunk-VQWYNAO5.cjs.map +0 -1
- package/dist/chunk-Y36F6N2O.js.map +0 -1
|
@@ -70,7 +70,8 @@ var useImpersonateStore = zustand.create()((set) => ({
|
|
|
70
70
|
originalTenantId: null,
|
|
71
71
|
isInitialized: false,
|
|
72
72
|
impersonationError: null,
|
|
73
|
-
|
|
73
|
+
detachedReason: null,
|
|
74
|
+
detachedTenantId: null,
|
|
74
75
|
setImpersonation: (isImpersonated, originalTenantId, impersonatedTenantId) => {
|
|
75
76
|
set({ isImpersonated, impersonatedTenantId, originalTenantId });
|
|
76
77
|
},
|
|
@@ -80,7 +81,8 @@ var useImpersonateStore = zustand.create()((set) => ({
|
|
|
80
81
|
impersonatedTenantId,
|
|
81
82
|
originalTenantId,
|
|
82
83
|
impersonationError: null,
|
|
83
|
-
|
|
84
|
+
detachedReason: null,
|
|
85
|
+
detachedTenantId: null
|
|
84
86
|
});
|
|
85
87
|
},
|
|
86
88
|
terminate: (originalTenantId) => {
|
|
@@ -97,8 +99,8 @@ var useImpersonateStore = zustand.create()((set) => ({
|
|
|
97
99
|
setImpersonationError: (impersonationError) => {
|
|
98
100
|
set({ impersonationError });
|
|
99
101
|
},
|
|
100
|
-
setDetached: (
|
|
101
|
-
set({
|
|
102
|
+
setDetached: (detachedReason, detachedTenantId = null) => {
|
|
103
|
+
set({ detachedReason, detachedTenantId });
|
|
102
104
|
},
|
|
103
105
|
reset: () => {
|
|
104
106
|
set({
|
|
@@ -107,7 +109,8 @@ var useImpersonateStore = zustand.create()((set) => ({
|
|
|
107
109
|
originalTenantId: null,
|
|
108
110
|
isInitialized: false,
|
|
109
111
|
impersonationError: null,
|
|
110
|
-
|
|
112
|
+
detachedReason: null,
|
|
113
|
+
detachedTenantId: null
|
|
111
114
|
});
|
|
112
115
|
}
|
|
113
116
|
}));
|
|
@@ -201,5 +204,5 @@ exports.useImpersonateStore = useImpersonateStore;
|
|
|
201
204
|
exports.useLanguageViewStore = useLanguageViewStore;
|
|
202
205
|
exports.useLayoutSettingsStore = useLayoutSettingsStore;
|
|
203
206
|
exports.useUserStore = useUserStore;
|
|
204
|
-
//# sourceMappingURL=chunk-
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
207
|
+
//# sourceMappingURL=chunk-4QN4CYSC.cjs.map
|
|
208
|
+
//# sourceMappingURL=chunk-4QN4CYSC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/store/app-settings.store.ts","../src/store/impersonate.store.ts","../src/store/app-config.store.ts","../src/store/language-view.store.ts","../src/store/layout-settings.store.ts","../src/store/user.store.ts"],"names":["CookieStorage","create","persist","getSystemTheme","createStore","createJSONStorage"],"mappings":";;;;;;AAMA,IAAM,sBAAsB,MAAM;AAChC,EAAA,MAAM,WAAW,IAAI,GAAA,CAAI,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA,CAAE,QAAA;AACjD,EAAA,IAAI,CAAC,UAAU,OAAO,MAAA;AACtB,EAAA,IAAI,QAAA,KAAa,aAAa,OAAO,QAAA;AACrC,EAAA,OAAO,QAAA,CAAS,MAAM,GAAG,CAAA,CAAE,MAAM,EAAE,CAAA,CAAE,KAAK,GAAG,CAAA;AAC/C,CAA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AG,KAAA,EAAO,aAAY,CAAE,CAAA;AAAA,MAC5C,CAAA;AAAA,MACA,gBAAgB,MAAM;AACpB,QAAA,GAAA,CAAI;AAAA,UACF,WAAA,EAAa;AAAA,SACd,CAAA;AAAA,MACH;AAAA,KACF,CAAA;AAAA,IACA;AAAA,MACE,IAAA,EAAM;AAAA;AACR;AAEJ","file":"chunk-4QN4CYSC.cjs","sourcesContent":["import type { Theme } from \"@/lib/theme\";\nimport { getSystemTheme } from \"@/lib/theme\";\nimport { CookieStorage } from \"@/lib/cookie-storage\";\nimport { create } from \"zustand\";\nimport { persist, type PersistStorage } from \"zustand/middleware\";\n\nconst resolveCookieDomain = () => {\n const hostname = new URL(window.location.origin).hostname;\n if (!hostname) return undefined;\n if (hostname === \"localhost\") return hostname;\n return hostname.split(\".\").slice(-2).join(\".\");\n};\n\nexport interface AppSettings {\n theme: Theme;\n language?: string;\n defaultApp?: string;\n [key: string]: unknown;\n}\n\ninterface AppSettingsStoreState {\n settings: AppSettings;\n // Non-persisted — tracks app preference reactively, not stored in cookie\n systemTheme: Exclude<Theme, \"system\">;\n getSettings: () => AppSettings;\n setSettings: (nextSettings: Partial<AppSettings>) => void;\n setSystemTheme: (systemTheme: Exclude<Theme, \"system\">) => void;\n resetSettings: () => void;\n}\n\n// Only `settings` goes into the cookie — systemTheme and actions are excluded\ntype AppSettingsPersistedState = Pick<AppSettingsStoreState, \"settings\">;\n\nconst cookieStorage = new CookieStorage();\nconst APP_SETTINGS_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 365;\n\nconst persistStorage: PersistStorage<AppSettingsPersistedState> = {\n getItem: (name) => {\n const cookie = cookieStorage.getItem(name);\n return cookie ? { state: JSON.parse(cookie) } : null;\n },\n setItem: (name, value) => {\n cookieStorage.setItem(name, JSON.stringify(value.state), {\n expires: APP_SETTINGS_COOKIE_MAX_AGE_SECONDS,\n domain: resolveCookieDomain(),\n path: \"/\",\n secure: window.location.protocol === \"https:\",\n sameSite: \"Lax\",\n });\n },\n removeItem: (name) => {\n cookieStorage.removeItem(name);\n },\n};\n\nexport const useAppSettingsStore = create<AppSettingsStoreState>()(\n persist(\n (set, get) => ({\n settings: {\n theme: \"system\",\n language: \"en\",\n },\n // Initialized from app at store creation — correct on first render\n systemTheme: getSystemTheme(),\n getSettings: () => get().settings,\n setSettings: (nextSettings) => {\n set((state) => ({\n ...state,\n settings: { ...state.settings, ...nextSettings },\n }));\n },\n setSystemTheme: (systemTheme) => {\n set((state) => ({ ...state, systemTheme }));\n },\n resetSettings: () => {\n set((state) => ({\n ...state,\n settings: { theme: \"system\", language: \"en\" },\n }));\n },\n }),\n {\n name: \"app-settings-storage\",\n storage: persistStorage,\n // Explicit partialize keeps systemTheme and actions out of the cookie\n partialize: (state) => ({ settings: state.settings }),\n },\n ),\n);\n","import { create } from \"zustand\";\n\n/** Why a window is no longer the one holding the shared session. */\nexport type DetachedReason = \"another-project\" | \"console\";\n\ninterface ImpersonateStoreState {\n isImpersonated: boolean;\n impersonatedTenantId: string | null;\n originalTenantId: string | null;\n isInitialized: boolean;\n /**\n * A re-impersonation that failed. Kept in the store rather than swallowed so the guard can render\n * a terminal state with a way out: a failure used to leave the store pinned to the *previous*\n * project's tenant, which froze the guard's effect dependencies and meant it never retried.\n */\n impersonationError: unknown;\n /**\n * Why this window lost the shared session, or null while it still holds it. A detached window\n * must issue no requests: its own state is stale, and the cookie underneath it now belongs to\n * somewhere else.\n *\n * The cause is kept, not just the fact, because the two read very differently to a user. Being\n * displaced by another project is \"your session moved\"; being displaced by the console is \"you\n * went back to the console\" -- and telling someone their project is \"open in another window\"\n * when they actually returned to the console would send them looking for a window that is not\n * there.\n */\n detachedReason: DetachedReason | null;\n /** Tenant that took the session, so the UI can name it rather than say \"another window\". */\n detachedTenantId: string | null;\n setImpersonation: (\n isImpersonated: boolean,\n originalTenantId: string | null,\n impersonatedTenantId: string | null,\n ) => void;\n impersonate: (impersonatedTenantId: string, originalTenantId: string) => void;\n terminate: (originalTenantId: string) => void;\n setInitialized: (isInitialized: boolean) => void;\n setImpersonationError: (impersonationError: unknown) => void;\n setDetached: (\n detachedReason: DetachedReason | null,\n detachedTenantId?: string | null,\n ) => void;\n reset: () => void;\n}\n\nexport const useImpersonateStore = create<ImpersonateStoreState>()((set) => ({\n isImpersonated: false,\n impersonatedTenantId: null,\n originalTenantId: null,\n isInitialized: false,\n impersonationError: null,\n detachedReason: null,\n detachedTenantId: null,\n setImpersonation: (\n isImpersonated: boolean,\n originalTenantId: string | null,\n impersonatedTenantId: string | null,\n ) => {\n set({ isImpersonated, impersonatedTenantId, originalTenantId });\n },\n impersonate: (impersonatedTenantId: string, originalTenantId: string) => {\n // A successful impersonation clears both failure states: this tab now owns the cookie and is\n // pointed at the tenant it believes it is pointed at.\n set({\n isImpersonated: true,\n impersonatedTenantId,\n originalTenantId,\n impersonationError: null,\n detachedReason: null,\n detachedTenantId: null,\n });\n },\n terminate: (originalTenantId: string) => {\n set((state) => ({\n ...state,\n isImpersonated: false,\n impersonatedTenantId: null,\n originalTenantId,\n }));\n },\n setInitialized: (isInitialized: boolean) => {\n set({ isInitialized });\n },\n setImpersonationError: (impersonationError: unknown) => {\n set({ impersonationError });\n },\n setDetached: (\n detachedReason: DetachedReason | null,\n detachedTenantId: string | null = null,\n ) => {\n set({ detachedReason, detachedTenantId });\n },\n reset: () => {\n set({\n isImpersonated: false,\n impersonatedTenantId: null,\n originalTenantId: null,\n isInitialized: false,\n impersonationError: null,\n detachedReason: null,\n detachedTenantId: null,\n });\n },\n}));\n","import { createStore } from \"zustand\";\n\nexport type ServiceName =\n | \"blocks-os\"\n | \"blocks-utilities\"\n | \"blocks-logic\"\n | \"blocks-monitor\"\n | \"blocks-release\"\n | \"blocks-iam\"\n | \"blocks-studio\"\n | \"blocks-agents\"\n | \"blocks-data\"\n | \"blocks-localization\";\n\nexport interface AppConfig {\n name: ServiceName;\n appLogoUrl:\n | {\n dark?: string;\n light?: string;\n }\n | string;\n}\n\nexport interface AppConfigStoreState {\n config: AppConfig;\n getConfig: () => AppConfig;\n setConfig: (nextConfig: Partial<AppConfig>) => void;\n resetConfig: () => void;\n}\n\nexport const CreateAppConfigStore = (initialConfig?: Partial<AppConfig>) =>\n createStore<AppConfigStoreState>()((set, get) => ({\n config: { name: \"blocks-os\", appLogoUrl: \"\", ...initialConfig },\n getConfig: () => get().config,\n setConfig: (nextConfig) => {\n set((state) => ({\n ...state,\n config: { ...state.config, ...nextConfig },\n }));\n },\n resetConfig: () => {\n set((state) => ({\n ...state,\n config: { name: \"blocks-os\", appLogoUrl: \"\", ...initialConfig },\n }));\n },\n }));\n","import { create } from \"zustand\";\nimport { createJSONStorage, persist } from \"zustand/middleware\";\n\ninterface LanguageViewState {\n selectedLanguages: string[];\n setSelectedLanguages: (languages: string[]) => void;\n toggleLanguage: (languageCode: string) => void;\n resetSelectedLanguages: () => void;\n selectedOptionalColumns: string[];\n setSelectedOptionalColumns: (columns: string[]) => void;\n toggleOptionalColumn: (column: string) => void;\n}\n\nexport const useLanguageViewStore = create<LanguageViewState>()(\n persist(\n (set) => ({\n selectedLanguages: [],\n\n setSelectedLanguages: (languages: string[]) => {\n set({ selectedLanguages: languages });\n },\n\n toggleLanguage: (languageCode: string) => {\n set((state) => ({\n selectedLanguages: state.selectedLanguages.includes(languageCode)\n ? state.selectedLanguages.filter((lang) => lang !== languageCode)\n : [...state.selectedLanguages, languageCode],\n }));\n },\n\n resetSelectedLanguages: () => {\n set({ selectedLanguages: [] });\n set({ selectedOptionalColumns: [] });\n },\n\n selectedOptionalColumns: [],\n\n setSelectedOptionalColumns: (columns: string[]) => {\n set({ selectedOptionalColumns: columns });\n },\n\n toggleOptionalColumn: (column: string) => {\n set((state) => ({\n selectedOptionalColumns: state.selectedOptionalColumns.includes(\n column,\n )\n ? state.selectedOptionalColumns.filter((col) => col !== column)\n : [...state.selectedOptionalColumns, column],\n }));\n },\n }),\n {\n name: \"language-view-storage\",\n storage: createJSONStorage(() => sessionStorage),\n },\n ),\n);\n","import { create } from \"zustand\";\nimport { persist, createJSONStorage } from \"zustand/middleware\";\n\ninterface LayoutSettings {\n isLeftSidebarOpen?: boolean;\n leftSidebarWidth?: string;\n rightSidePanelWidth?: string;\n}\n\ninterface LayoutSettingsStoreState {\n layout: LayoutSettings;\n setLayoutSetting: <K extends keyof LayoutSettings>(\n key: K,\n value: LayoutSettings[K],\n ) => void;\n resetLayout: () => void;\n}\n\nexport const useLayoutSettingsStore = create<LayoutSettingsStoreState>()(\n persist(\n (set) => ({\n layout: {},\n setLayoutSetting: (key, value) =>\n set((state) => ({\n layout: { ...state.layout, [key]: value },\n })),\n resetLayout: () => set({ layout: {} }),\n }),\n {\n name: \"layout-settings\",\n storage: createJSONStorage(() => localStorage),\n },\n ),\n);\n","import type { UserDetails } from \"@/models\";\nimport { create } from \"zustand\";\nimport { persist } from \"zustand/middleware\";\n\ninterface UserStoreState {\n userDetails: UserDetails | null;\n setUserDetails: (userDetails: UserDetails | null) => void;\n resetUserStore: () => void;\n}\n\nexport const useUserStore = create<UserStoreState>()(\n persist(\n (set) => ({\n userDetails: null,\n setUserDetails: (userDetails) => {\n set((state) => ({ ...state, userDetails }));\n },\n resetUserStore: () => {\n set({\n userDetails: null,\n });\n },\n }),\n {\n name: \"user-storage\",\n },\n ),\n);\n"]}
|
|
@@ -4,7 +4,7 @@ var chunkBPJM3L7O_cjs = require('./chunk-BPJM3L7O.cjs');
|
|
|
4
4
|
var chunkZK3WUWET_cjs = require('./chunk-ZK3WUWET.cjs');
|
|
5
5
|
var chunkYAF2X7W5_cjs = require('./chunk-YAF2X7W5.cjs');
|
|
6
6
|
var chunkF2LXD7RI_cjs = require('./chunk-F2LXD7RI.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunk4QN4CYSC_cjs = require('./chunk-4QN4CYSC.cjs');
|
|
8
8
|
var chunk6GCU5LM7_cjs = require('./chunk-6GCU5LM7.cjs');
|
|
9
9
|
var reactQuery = require('@tanstack/react-query');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -76,7 +76,7 @@ function DashboardLayoutProvider({
|
|
|
76
76
|
}) {
|
|
77
77
|
const { isActivePath: isServicesPath } = chunkBPJM3L7O_cjs.useIsActiveMenu("/app/services");
|
|
78
78
|
const isMobile = chunkBPJM3L7O_cjs.useIsMobile();
|
|
79
|
-
const { layout, setLayoutSetting } =
|
|
79
|
+
const { layout, setLayoutSetting } = chunk4QN4CYSC_cjs.useLayoutSettingsStore();
|
|
80
80
|
const isLeftSidebarOpen = layout.isLeftSidebarOpen;
|
|
81
81
|
const [isSidebarSubMenuOpen, setIsSidebarSubMenuOpen] = React2.useState(isSubMenuOpen);
|
|
82
82
|
const [subMenuId, setSubMenuId] = React2.useState(null);
|
|
@@ -297,7 +297,7 @@ browserWindow.process = {
|
|
|
297
297
|
env: window.__BLOCKS_ENV__
|
|
298
298
|
};
|
|
299
299
|
var BlocksAppLayout = ({ children, config }) => {
|
|
300
|
-
const [store] = React2.useState(() =>
|
|
300
|
+
const [store] = React2.useState(() => chunk4QN4CYSC_cjs.CreateAppConfigStore(config));
|
|
301
301
|
if (window && window.process && config) {
|
|
302
302
|
const projectBaseUrlKey = config.name === "blocks-os" ? "BLOCKS_OS_BASE_URL" : "BLOCKS_LOGIC_BASE_URL";
|
|
303
303
|
window.process.env.projectBaseUrl = window.process.env[projectBaseUrlKey] ?? "";
|
|
@@ -320,7 +320,7 @@ function ThemeProvider({
|
|
|
320
320
|
systemTheme,
|
|
321
321
|
setSettings,
|
|
322
322
|
setSystemTheme
|
|
323
|
-
} =
|
|
323
|
+
} = chunk4QN4CYSC_cjs.useAppSettingsStore();
|
|
324
324
|
const resolvedTheme = theme === "system" ? systemTheme : theme;
|
|
325
325
|
const isFirstRender = React2.useRef(true);
|
|
326
326
|
React2.useEffect(() => {
|
|
@@ -367,5 +367,5 @@ exports.ToastTitle = ToastTitle;
|
|
|
367
367
|
exports.ToastViewport = ToastViewport;
|
|
368
368
|
exports.Toaster = Toaster;
|
|
369
369
|
exports.defaultRightSidePanelContextValue = defaultRightSidePanelContextValue;
|
|
370
|
-
//# sourceMappingURL=chunk-
|
|
371
|
-
//# sourceMappingURL=chunk-
|
|
370
|
+
//# sourceMappingURL=chunk-IJMKS4XG.cjs.map
|
|
371
|
+
//# sourceMappingURL=chunk-IJMKS4XG.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/providers/query.provider.tsx","../src/contexts/dashboard-layout/right-side-panel.context.ts","../src/contexts/dashboard-layout/sidebar.context.ts","../src/providers/dashboard-layout.provider.tsx","../src/components/core/toaster/toast.tsx","../src/components/core/toaster/toaster.tsx","../src/providers/blocks-app-layout.provider.tsx","../src/providers/theme.provider.tsx"],"names":["getQueryClient","jsx","QueryClientProvider","createContext","useIsActiveMenu","useIsMobile","useLayoutSettingsStore","useState","useRef","useEffect","useCallback","React","ToastPrimitives","React2","cn","cva","X","useToast","jsxs","CreateAppConfigStore","BlocksAppLayoutContext","useAppSettingsStore","applyTheme","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,SAAS,aAAA,CAAc,EAAE,QAAA,EAAS,EAAkC;AACzE,EAAA,MAAM,cAAcA,gCAAA,EAAe;AAEnC,EAAA,uBACEC,cAAA,CAACC,8BAAA,EAAA,EAAoB,MAAA,EAAQ,WAAA,EAAc,QAAA,EAAS,CAAA;AAExD;ACRO,IAAM,iCAAA,GAAgE;AAAA,EAC3E,IAAA,EAAM,KAAA;AAAA,EACN,SAAS,MAAM,MAAA;AAAA,EACf,QAAQ,MAAM,MAAA;AAAA,EACd,OAAO,MAAM,MAAA;AAAA,EACb,QAAQ,EAAE,KAAA,EAAO,SAAS,QAAA,EAAU,OAAA,EAAS,UAAU,MAAA,EAAO;AAAA,EAC9D,SAAA,EAAW,KAAA;AAAA,EACX,cAAc,MAAM,MAAA;AAAA,EACpB,SAAA,EAAW,KAAA;AAAA,EACX,OAAA,EAAS,kBAAA;AAAA,EACT,QAAA,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AAA,MAAM,SAAA,GAAY,QAAA,CAAS,MAAA,CAAO,QAAA,CAAS,uBAAuB,CAAA;AAClE,IAAA,IAAI,CAAC,SAAA,EAAW;AACd,MAAA,WAAA,CAAY,EAAE,KAAA,EAAO,YAAA,EAAc,CAAA;AAAA,IACrC;AAAA,EAGF,CAAA,EAAG,EAAE,CAAA;AAGL,EAAAA,iBAAU,MAAM;AACd,IAAAa,4BAAA,CAAW,aAAa,CAAA;AAAA,EAC1B,CAAA,EAAG,CAAC,aAAa,CAAC,CAAA;AAGlB,EAAAb,iBAAU,MAAM;AACd,IAAA,IAAI,UAAU,QAAA,EAAU;AACxB,IAAA,MAAM,EAAA,GAAK,MAAA,CAAO,UAAA,CAAW,8BAA8B,CAAA;AAC3D,IAAA,MAAM,OAAA,GAAU,CAAC,KAAA,KAA+B;AAC9C,MAAA,cAAA,CAAe,KAAA,CAAM,OAAA,GAAU,MAAA,GAAS,OAAO,CAAA;AAAA,IACjD,CAAA;AACA,IAAA,EAAA,CAAG,gBAAA,CAAiB,UAAU,OAAO,CAAA;AACrC,IAAA,OAAO,MAAM,EAAA,CAAG,mBAAA,CAAoB,QAAA,EAAU,OAAO,CAAA;AAAA,EACvD,CAAA,EAAG,CAAC,KAAA,EAAO,cAAc,CAAC,CAAA;AAG1B,EAAAA,iBAAU,MAAM;AACd,IAAA,IAAI,cAAc,OAAA,EAAS;AACzB,MAAA,aAAA,CAAc,OAAA,GAAU,KAAA;AACxB,MAAA;AAAA,IACF;AACA,IAAA,aAAA,GAAgB,OAAO,aAAa,CAAA;AAAA,EACtC,CAAA,EAAG,CAAC,KAAA,EAAO,aAAA,EAAe,aAAa,CAAC,CAAA;AAExC,EAAA,uBAAOR,cAAAA,CAAAsB,mBAAA,EAAA,EAAG,QAAA,EAAS,CAAA;AACrB","file":"chunk-OJG2XE7Z.cjs","sourcesContent":["import { QueryClientProvider } from \"@tanstack/react-query\";\n\nimport { getQueryClient } from \"./query-client\";\nimport type * as React from \"react\";\n\nexport function QueryProvider({ children }: { children: React.ReactNode }) {\n const queryClient = getQueryClient();\n\n return (\n <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n );\n}\n","import { createContext } from \"react\";\nimport type { RightSidePanelContextValue } from \"./right-side-panel.types\";\n\nexport const defaultRightSidePanelContextValue: RightSidePanelContextValue = {\n open: false,\n setOpen: () => undefined,\n toggle: () => undefined,\n close: () => undefined,\n sizing: { width: \"24rem\", minWidth: \"20rem\", maxWidth: \"50vw\" },\n liveWidth: \"0px\",\n setLiveWidth: () => undefined,\n resizable: false,\n panelId: \"right-side-panel\",\n isMobile: false,\n topOffset: \"0px\",\n};\n\nexport const RightSidePanelContext = createContext<RightSidePanelContextValue>(\n defaultRightSidePanelContextValue,\n);\n","import { createContext } from \"react\";\n\nexport type SidebarContextValue = {\n isSidebarOpen: boolean;\n toggleSidebar: () => void;\n closeSidebar: () => void;\n isSidebarSubMenuOpen: boolean;\n toggleSidebarSubMenu: () => void;\n showSidebarSubMenu: () => void;\n subMenuId: string | null;\n updateSubMenuId: (id: string) => void;\n servicesSearchTerm: string;\n updateServicesSearchTerm: (term: string) => void;\n};\n\nexport const defaultContextValue: SidebarContextValue = {\n isSidebarOpen: false,\n toggleSidebar: () => undefined,\n closeSidebar: () => undefined,\n isSidebarSubMenuOpen: false,\n toggleSidebarSubMenu: () => undefined,\n showSidebarSubMenu: () => undefined,\n subMenuId: null,\n updateSubMenuId: () => undefined,\n servicesSearchTerm: \"\",\n updateServicesSearchTerm: () => undefined,\n};\n\nexport const SidebarContext =\n createContext<SidebarContextValue>(defaultContextValue);\n","import { SidebarContext } from \"@/contexts\";\nimport { useIsActiveMenu } from \"@/hooks/use-menus\";\nimport { useIsMobile } from \"@/hooks/use-mobile\";\nimport { useLayoutSettingsStore } from \"@/store/layout-settings.store\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\n// Below this width (but above the mobile breakpoint handled by\n// useIsMobile), the sidebar auto-collapses to icon-only. At/above it,\n// it restores whatever the user last manually chose.\nconst SIDEBAR_COLLAPSE_BREAKPOINT = 1024;\nconst RESIZE_DEBOUNCE_MS = 150;\n\nexport function DashboardLayoutProvider({\n children,\n isOpen,\n isSubMenuOpen = false,\n}: {\n children: React.ReactNode;\n isOpen: boolean;\n isSubMenuOpen?: boolean;\n}) {\n const { isActivePath: isServicesPath } = useIsActiveMenu(\"/app/services\");\n const isMobile = useIsMobile();\n const { layout, setLayoutSetting } = useLayoutSettingsStore();\n const isLeftSidebarOpen = layout.isLeftSidebarOpen;\n\n const [isSidebarSubMenuOpen, setIsSidebarSubMenuOpen] =\n useState(isSubMenuOpen);\n const [subMenuId, setSubMenuId] = useState<string | null>(null);\n const [servicesSearchTerm, setServicesSearchTerm] = useState(\"\");\n\n // Desktop ↔ tablet classification as of the last time this was computed\n // while non-mobile. null forces a fresh evaluation next time (used when\n // coming back from mobile, where width may have jumped any amount).\n const previousRangeRef = useRef<\"desktop\" | \"tablet\" | null>(null);\n const [isTablet, setIsTablet] = useState(false);\n\n // Remember the user's last manual preference before auto-collapse so it\n // can be restored when the viewport returns to desktop width.\n const userPreferenceRef = useRef<boolean | undefined>(undefined);\n\n // Seed the store from the isOpen prop on first mount, when the store\n // has no preference yet. Subsequent isOpen prop changes are ignored\n // (matches the original useState(isOpen) semantics).\n useEffect(() => {\n if (isLeftSidebarOpen === undefined) {\n setLayoutSetting(\"isLeftSidebarOpen\", isOpen);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Live state: respect the user's manual preference on desktop, but\n // force-closed on tablet (auto-collapse) and mobile.\n const isSidebarOpen = !isMobile && !isTablet && (isLeftSidebarOpen ?? isOpen);\n\n // Tablet-width auto-collapse. Only reacts to actually crossing the\n // breakpoint, not every resize tick, so a manual toggle while inside a\n // given range sticks until the range changes again.\n useEffect(() => {\n if (isMobile) {\n previousRangeRef.current = null;\n setIsTablet(false);\n return;\n }\n\n let debounceTimer: ReturnType<typeof setTimeout>;\n\n const syncToViewport = () => {\n const currentRange: \"desktop\" | \"tablet\" =\n window.innerWidth < SIDEBAR_COLLAPSE_BREAKPOINT ? \"tablet\" : \"desktop\";\n\n if (previousRangeRef.current === currentRange) {\n return;\n }\n previousRangeRef.current = currentRange;\n\n if (currentRange === \"tablet\") {\n // Stash the user's manual preference before the auto-collapse\n // overwrites it, so we can restore it when going back to desktop.\n userPreferenceRef.current = isLeftSidebarOpen;\n setLayoutSetting(\"isLeftSidebarOpen\", false);\n } else if (userPreferenceRef.current !== undefined) {\n setLayoutSetting(\"isLeftSidebarOpen\", userPreferenceRef.current);\n userPreferenceRef.current = undefined;\n }\n\n setIsTablet(currentRange === \"tablet\");\n };\n\n const handleResize = () => {\n clearTimeout(debounceTimer);\n debounceTimer = setTimeout(syncToViewport, RESIZE_DEBOUNCE_MS);\n };\n\n syncToViewport();\n window.addEventListener(\"resize\", handleResize);\n return () => {\n clearTimeout(debounceTimer);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [isMobile, isLeftSidebarOpen, setLayoutSetting]);\n\n useEffect(() => {\n const menuId = localStorage.getItem(\"subMenuId\");\n if (menuId !== null) {\n setSubMenuId(menuId);\n }\n }, []);\n\n useEffect(() => {\n if (!isMobile && isServicesPath) {\n setIsSidebarSubMenuOpen(true);\n }\n }, [isServicesPath, isMobile]);\n\n useEffect(() => {\n if (isSidebarOpen && !isMobile) {\n setIsSidebarSubMenuOpen(false);\n }\n }, [isSidebarOpen, isMobile]);\n\n const toggleSidebar = useCallback(() => {\n if (isMobile || isTablet) {\n return;\n }\n setLayoutSetting(\"isLeftSidebarOpen\", !(isLeftSidebarOpen ?? isOpen));\n setIsSidebarSubMenuOpen(false);\n }, [isMobile, isTablet, isLeftSidebarOpen, isOpen, setLayoutSetting]);\n\n const closeSidebar = useCallback(() => {\n setLayoutSetting(\"isLeftSidebarOpen\", false);\n }, [setLayoutSetting]);\n\n const toggleSidebarSubMenu = useCallback(() => {\n setIsSidebarSubMenuOpen((prev) => !prev);\n }, []);\n\n const showSidebarSubMenu = useCallback(() => {\n setIsSidebarSubMenuOpen(true);\n }, []);\n\n const updateSubMenuId = useCallback((id: string) => {\n localStorage.setItem(\"subMenuId\", id);\n setSubMenuId(id);\n setServicesSearchTerm(\"\");\n }, []);\n\n const updateServicesSearchTerm = useCallback((term: string) => {\n setServicesSearchTerm(term);\n }, []);\n\n const contextValue = React.useMemo(\n () => ({\n isSidebarOpen,\n toggleSidebar,\n closeSidebar,\n isSidebarSubMenuOpen,\n toggleSidebarSubMenu,\n showSidebarSubMenu,\n subMenuId,\n updateSubMenuId,\n servicesSearchTerm,\n updateServicesSearchTerm,\n }),\n [\n isSidebarOpen,\n toggleSidebar,\n closeSidebar,\n isSidebarSubMenuOpen,\n toggleSidebarSubMenu,\n showSidebarSubMenu,\n subMenuId,\n updateSubMenuId,\n servicesSearchTerm,\n updateServicesSearchTerm,\n ],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n {children}\n </SidebarContext.Provider>\n );\n}\n","import * as React from \"react\";\nimport * as ToastPrimitives from \"@radix-ui/react-toast\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nconst ToastProvider = ToastPrimitives.Provider;\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className,\n )}\n {...props}\n />\n));\nToastViewport.displayName = ToastPrimitives.Viewport.displayName;\n\nconst toastVariants = cva(\n \"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full\",\n {\n variants: {\n variant: {\n default: \"border bg-background text-foreground\",\n destructive:\n \"destructive group border-destructive bg-destructive text-destructive-foreground\",\n success: \"border-green-500 bg-green-50 text-green-800\",\n warning: \"border-yellow-500 bg-yellow-50 text-yellow-800\",\n info: \"border-blue-500 bg-blue-50 text-blue-800\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n>(({ className, variant, ...props }, ref) => {\n return (\n <ToastPrimitives.Root\n ref={ref}\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n});\nToast.displayName = ToastPrimitives.Root.displayName;\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n \"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive\",\n className,\n )}\n {...props}\n />\n));\nToastAction.displayName = ToastPrimitives.Action.displayName;\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n \"absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600\",\n className,\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n));\nToastClose.displayName = ToastPrimitives.Close.displayName;\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title\n ref={ref}\n className={cn(\"text-sm font-semibold\", className)}\n {...props}\n />\n));\nToastTitle.displayName = ToastPrimitives.Title.displayName;\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description\n ref={ref}\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n));\nToastDescription.displayName = ToastPrimitives.Description.displayName;\ntype ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;\ntype ToastActionElement = React.ReactElement<typeof ToastAction>;\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n","import {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from \"@/components/core/toaster/toast\";\nimport { useToast } from \"@/hooks/use-toast\";\n\nexport function Toaster() {\n const { toasts } = useToast();\n return (\n <ToastProvider>\n {toasts.map(function ({ id, title, description, action, ...props }) {\n return (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && (\n <ToastDescription>{description}</ToastDescription>\n )}\n </div>\n {action}\n <ToastClose />\n </Toast>\n );\n })}\n <ToastViewport />\n </ToastProvider>\n );\n}\n","import { Toaster } from \"@/components/core\";\nimport { BlocksAppLayoutContext } from \"@/contexts\";\nimport {\n CreateAppConfigStore,\n type AppConfigStoreState,\n} from \"@/store/app-config.store\";\nimport type { RuntimeKey } from \"@/types\";\nimport { useState } from \"react\";\n\ntype BlocksAppLayoutProps = {\n children: React.ReactNode;\n config: Partial<AppConfigStoreState[\"config\"]>;\n};\n\ndeclare global {\n interface Window {\n __BLOCKS_ENV__?: Partial<Record<RuntimeKey, string>>;\n process?: { env: Partial<Record<RuntimeKey, string>> };\n }\n}\n\n// window is typed Window & typeof globalThis, and @types/node contributes a\n// global `process` whose type this browser shim cannot satisfy. Assign through\n// a plain Window reference so only the declaration above applies.\nconst browserWindow: Window = window;\nbrowserWindow.process = {\n env: window.__BLOCKS_ENV__ as Partial<Record<RuntimeKey, string>>,\n};\n\nexport const BlocksAppLayout = ({ children, config }: BlocksAppLayoutProps) => {\n const [store] = useState(() => CreateAppConfigStore(config));\n if (window && window.process && config) {\n const projectBaseUrlKey =\n config.name === \"blocks-os\"\n ? \"BLOCKS_OS_BASE_URL\"\n : \"BLOCKS_LOGIC_BASE_URL\";\n window.process.env.projectBaseUrl =\n window.process.env[projectBaseUrlKey] ?? \"\";\n\n // When the host app IS blocks-iam, the IAM API is same-origin with this SPA\n // (the client is built into server/Api/wwwroot and one Kestrel serves both),\n // so the browser origin is authoritative. BLOCKS_IAM_BASE_URL is baked into\n // wwwroot at container start, before the app can know which host it will be\n // served on, so it points at the canonical host even on a per-PR preview —\n // which would send the preview's own login/me/status calls to shared dev.\n // Every other app talks to IAM cross-origin and keeps using the config value.\n window.process.env[\"userBaseUrl\"] =\n config.name === \"blocks-iam\"\n ? window.location.origin\n : window.process?.env[\"BLOCKS_IAM_BASE_URL\"] || \"\";\n\n const notificationBaseUrlKey = \"BLOCKS_LOGIC_BASE_URL\";\n window.process.env[\"notificationBaseUrl\"] = notificationBaseUrlKey\n ? window.process?.env[notificationBaseUrlKey] || \"\"\n : \"\";\n }\n return (\n <BlocksAppLayoutContext.Provider value={store}>\n {children}\n <Toaster />\n </BlocksAppLayoutContext.Provider>\n );\n};\n","import { useEffect, useRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { useAppSettingsStore } from \"@/store\";\nimport { applyTheme } from \"@/lib/theme\";\nimport type { Theme } from \"@/lib/theme\";\n\ninterface ThemeProviderProps {\n children: ReactNode;\n /**\n * Seeds the initial theme only when no persisted cookie exists yet.\n * If the user already has a saved preference, it always wins.\n */\n defaultTheme?: Theme;\n /**\n * Fires after every confirmed theme or resolved-theme change.\n * Does NOT fire on initial mount — only on actual changes.\n */\n onThemeChange?: (\n theme: Theme,\n resolvedTheme: Exclude<Theme, \"system\">,\n ) => void;\n}\n\nexport function ThemeProvider({\n children,\n defaultTheme,\n onThemeChange,\n}: ThemeProviderProps) {\n const {\n settings: { theme },\n systemTheme,\n setSettings,\n setSystemTheme,\n } = useAppSettingsStore();\n\n const resolvedTheme: Exclude<Theme, \"system\"> =\n theme === \"system\" ? systemTheme : theme;\n\n // Skip onThemeChange on initial mount — only fire on actual changes\n const isFirstRender = useRef(true);\n\n // ── Seed defaultTheme once on mount, only if no cookie persisted yet ────────\n useEffect(() => {\n if (!defaultTheme) return;\n // Cookie storage is synchronous, so if the cookie exists the store is\n // already rehydrated with the user's saved preference — don't override it\n const hasCookie = document.cookie.includes(\"app-settings-storage=\");\n if (!hasCookie) {\n setSettings({ theme: defaultTheme });\n }\n // Intentionally empty dep array — seed is mount-only, one shot\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // ── Sync resolved theme to DOM ───────────────────────────────────────────────\n useEffect(() => {\n applyTheme(resolvedTheme);\n }, [resolvedTheme]);\n\n // ── App media query listener — active only when theme is \"system\" ─────────────\n useEffect(() => {\n if (theme !== \"system\") return;\n const mq = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const handler = (event: MediaQueryListEvent) => {\n setSystemTheme(event.matches ? \"dark\" : \"light\");\n };\n mq.addEventListener(\"change\", handler);\n return () => mq.removeEventListener(\"change\", handler);\n }, [theme, setSystemTheme]);\n\n // ── onThemeChange callback — skips initial mount ─────────────────────────────\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false;\n return;\n }\n onThemeChange?.(theme, resolvedTheme);\n }, [theme, resolvedTheme, onThemeChange]);\n\n return <>{children}</>;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/providers/query.provider.tsx","../src/contexts/dashboard-layout/right-side-panel.context.ts","../src/contexts/dashboard-layout/sidebar.context.ts","../src/providers/dashboard-layout.provider.tsx","../src/components/core/toaster/toast.tsx","../src/components/core/toaster/toaster.tsx","../src/providers/blocks-app-layout.provider.tsx","../src/providers/theme.provider.tsx"],"names":["getQueryClient","jsx","QueryClientProvider","createContext","useIsActiveMenu","useIsMobile","useLayoutSettingsStore","useState","useRef","useEffect","useCallback","React","ToastPrimitives","React2","cn","cva","X","useToast","jsxs","CreateAppConfigStore","BlocksAppLayoutContext","useAppSettingsStore","applyTheme","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,SAAS,aAAA,CAAc,EAAE,QAAA,EAAS,EAAkC;AACzE,EAAA,MAAM,cAAcA,gCAAA,EAAe;AAEnC,EAAA,uBACEC,cAAA,CAACC,8BAAA,EAAA,EAAoB,MAAA,EAAQ,WAAA,EAAc,QAAA,EAAS,CAAA;AAExD;ACRO,IAAM,iCAAA,GAAgE;AAAA,EAC3E,IAAA,EAAM,KAAA;AAAA,EACN,SAAS,MAAM,MAAA;AAAA,EACf,QAAQ,MAAM,MAAA;AAAA,EACd,OAAO,MAAM,MAAA;AAAA,EACb,QAAQ,EAAE,KAAA,EAAO,SAAS,QAAA,EAAU,OAAA,EAAS,UAAU,MAAA,EAAO;AAAA,EAC9D,SA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rB","file":"chunk-IJMKS4XG.cjs","sourcesContent":["import { QueryClientProvider } from \"@tanstack/react-query\";\n\nimport { getQueryClient } from \"./query-client\";\nimport type * as React from \"react\";\n\nexport function QueryProvider({ children }: { children: React.ReactNode }) {\n const queryClient = getQueryClient();\n\n return (\n <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n );\n}\n","import { createContext } from \"react\";\nimport type { RightSidePanelContextValue } from \"./right-side-panel.types\";\n\nexport const defaultRightSidePanelContextValue: RightSidePanelContextValue = {\n open: false,\n setOpen: () => undefined,\n toggle: () => undefined,\n close: () => undefined,\n sizing: { width: \"24rem\", minWidth: \"20rem\", maxWidth: \"50vw\" },\n liveWidth: \"0px\",\n setLiveWidth: () => undefined,\n resizable: false,\n panelId: \"right-side-panel\",\n isMobile: false,\n topOffset: \"0px\",\n};\n\nexport const RightSidePanelContext = createContext<RightSidePanelContextValue>(\n defaultRightSidePanelContextValue,\n);\n","import { createContext } from \"react\";\n\nexport type SidebarContextValue = {\n isSidebarOpen: boolean;\n toggleSidebar: () => void;\n closeSidebar: () => void;\n isSidebarSubMenuOpen: boolean;\n toggleSidebarSubMenu: () => void;\n showSidebarSubMenu: () => void;\n subMenuId: string | null;\n updateSubMenuId: (id: string) => void;\n servicesSearchTerm: string;\n updateServicesSearchTerm: (term: string) => void;\n};\n\nexport const defaultContextValue: SidebarContextValue = {\n isSidebarOpen: false,\n toggleSidebar: () => undefined,\n closeSidebar: () => undefined,\n isSidebarSubMenuOpen: false,\n toggleSidebarSubMenu: () => undefined,\n showSidebarSubMenu: () => undefined,\n subMenuId: null,\n updateSubMenuId: () => undefined,\n servicesSearchTerm: \"\",\n updateServicesSearchTerm: () => undefined,\n};\n\nexport const SidebarContext =\n createContext<SidebarContextValue>(defaultContextValue);\n","import { SidebarContext } from \"@/contexts\";\nimport { useIsActiveMenu } from \"@/hooks/use-menus\";\nimport { useIsMobile } from \"@/hooks/use-mobile\";\nimport { useLayoutSettingsStore } from \"@/store/layout-settings.store\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\n// Below this width (but above the mobile breakpoint handled by\n// useIsMobile), the sidebar auto-collapses to icon-only. At/above it,\n// it restores whatever the user last manually chose.\nconst SIDEBAR_COLLAPSE_BREAKPOINT = 1024;\nconst RESIZE_DEBOUNCE_MS = 150;\n\nexport function DashboardLayoutProvider({\n children,\n isOpen,\n isSubMenuOpen = false,\n}: {\n children: React.ReactNode;\n isOpen: boolean;\n isSubMenuOpen?: boolean;\n}) {\n const { isActivePath: isServicesPath } = useIsActiveMenu(\"/app/services\");\n const isMobile = useIsMobile();\n const { layout, setLayoutSetting } = useLayoutSettingsStore();\n const isLeftSidebarOpen = layout.isLeftSidebarOpen;\n\n const [isSidebarSubMenuOpen, setIsSidebarSubMenuOpen] =\n useState(isSubMenuOpen);\n const [subMenuId, setSubMenuId] = useState<string | null>(null);\n const [servicesSearchTerm, setServicesSearchTerm] = useState(\"\");\n\n // Desktop ↔ tablet classification as of the last time this was computed\n // while non-mobile. null forces a fresh evaluation next time (used when\n // coming back from mobile, where width may have jumped any amount).\n const previousRangeRef = useRef<\"desktop\" | \"tablet\" | null>(null);\n const [isTablet, setIsTablet] = useState(false);\n\n // Remember the user's last manual preference before auto-collapse so it\n // can be restored when the viewport returns to desktop width.\n const userPreferenceRef = useRef<boolean | undefined>(undefined);\n\n // Seed the store from the isOpen prop on first mount, when the store\n // has no preference yet. Subsequent isOpen prop changes are ignored\n // (matches the original useState(isOpen) semantics).\n useEffect(() => {\n if (isLeftSidebarOpen === undefined) {\n setLayoutSetting(\"isLeftSidebarOpen\", isOpen);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Live state: respect the user's manual preference on desktop, but\n // force-closed on tablet (auto-collapse) and mobile.\n const isSidebarOpen = !isMobile && !isTablet && (isLeftSidebarOpen ?? isOpen);\n\n // Tablet-width auto-collapse. Only reacts to actually crossing the\n // breakpoint, not every resize tick, so a manual toggle while inside a\n // given range sticks until the range changes again.\n useEffect(() => {\n if (isMobile) {\n previousRangeRef.current = null;\n setIsTablet(false);\n return;\n }\n\n let debounceTimer: ReturnType<typeof setTimeout>;\n\n const syncToViewport = () => {\n const currentRange: \"desktop\" | \"tablet\" =\n window.innerWidth < SIDEBAR_COLLAPSE_BREAKPOINT ? \"tablet\" : \"desktop\";\n\n if (previousRangeRef.current === currentRange) {\n return;\n }\n previousRangeRef.current = currentRange;\n\n if (currentRange === \"tablet\") {\n // Stash the user's manual preference before the auto-collapse\n // overwrites it, so we can restore it when going back to desktop.\n userPreferenceRef.current = isLeftSidebarOpen;\n setLayoutSetting(\"isLeftSidebarOpen\", false);\n } else if (userPreferenceRef.current !== undefined) {\n setLayoutSetting(\"isLeftSidebarOpen\", userPreferenceRef.current);\n userPreferenceRef.current = undefined;\n }\n\n setIsTablet(currentRange === \"tablet\");\n };\n\n const handleResize = () => {\n clearTimeout(debounceTimer);\n debounceTimer = setTimeout(syncToViewport, RESIZE_DEBOUNCE_MS);\n };\n\n syncToViewport();\n window.addEventListener(\"resize\", handleResize);\n return () => {\n clearTimeout(debounceTimer);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [isMobile, isLeftSidebarOpen, setLayoutSetting]);\n\n useEffect(() => {\n const menuId = localStorage.getItem(\"subMenuId\");\n if (menuId !== null) {\n setSubMenuId(menuId);\n }\n }, []);\n\n useEffect(() => {\n if (!isMobile && isServicesPath) {\n setIsSidebarSubMenuOpen(true);\n }\n }, [isServicesPath, isMobile]);\n\n useEffect(() => {\n if (isSidebarOpen && !isMobile) {\n setIsSidebarSubMenuOpen(false);\n }\n }, [isSidebarOpen, isMobile]);\n\n const toggleSidebar = useCallback(() => {\n if (isMobile || isTablet) {\n return;\n }\n setLayoutSetting(\"isLeftSidebarOpen\", !(isLeftSidebarOpen ?? isOpen));\n setIsSidebarSubMenuOpen(false);\n }, [isMobile, isTablet, isLeftSidebarOpen, isOpen, setLayoutSetting]);\n\n const closeSidebar = useCallback(() => {\n setLayoutSetting(\"isLeftSidebarOpen\", false);\n }, [setLayoutSetting]);\n\n const toggleSidebarSubMenu = useCallback(() => {\n setIsSidebarSubMenuOpen((prev) => !prev);\n }, []);\n\n const showSidebarSubMenu = useCallback(() => {\n setIsSidebarSubMenuOpen(true);\n }, []);\n\n const updateSubMenuId = useCallback((id: string) => {\n localStorage.setItem(\"subMenuId\", id);\n setSubMenuId(id);\n setServicesSearchTerm(\"\");\n }, []);\n\n const updateServicesSearchTerm = useCallback((term: string) => {\n setServicesSearchTerm(term);\n }, []);\n\n const contextValue = React.useMemo(\n () => ({\n isSidebarOpen,\n toggleSidebar,\n closeSidebar,\n isSidebarSubMenuOpen,\n toggleSidebarSubMenu,\n showSidebarSubMenu,\n subMenuId,\n updateSubMenuId,\n servicesSearchTerm,\n updateServicesSearchTerm,\n }),\n [\n isSidebarOpen,\n toggleSidebar,\n closeSidebar,\n isSidebarSubMenuOpen,\n toggleSidebarSubMenu,\n showSidebarSubMenu,\n subMenuId,\n updateSubMenuId,\n servicesSearchTerm,\n updateServicesSearchTerm,\n ],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n {children}\n </SidebarContext.Provider>\n );\n}\n","import * as React from \"react\";\nimport * as ToastPrimitives from \"@radix-ui/react-toast\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nconst ToastProvider = ToastPrimitives.Provider;\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className,\n )}\n {...props}\n />\n));\nToastViewport.displayName = ToastPrimitives.Viewport.displayName;\n\nconst toastVariants = cva(\n \"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full\",\n {\n variants: {\n variant: {\n default: \"border bg-background text-foreground\",\n destructive:\n \"destructive group border-destructive bg-destructive text-destructive-foreground\",\n success: \"border-green-500 bg-green-50 text-green-800\",\n warning: \"border-yellow-500 bg-yellow-50 text-yellow-800\",\n info: \"border-blue-500 bg-blue-50 text-blue-800\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n>(({ className, variant, ...props }, ref) => {\n return (\n <ToastPrimitives.Root\n ref={ref}\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n});\nToast.displayName = ToastPrimitives.Root.displayName;\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n \"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive\",\n className,\n )}\n {...props}\n />\n));\nToastAction.displayName = ToastPrimitives.Action.displayName;\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n \"absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600\",\n className,\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n));\nToastClose.displayName = ToastPrimitives.Close.displayName;\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title\n ref={ref}\n className={cn(\"text-sm font-semibold\", className)}\n {...props}\n />\n));\nToastTitle.displayName = ToastPrimitives.Title.displayName;\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description\n ref={ref}\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n));\nToastDescription.displayName = ToastPrimitives.Description.displayName;\ntype ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;\ntype ToastActionElement = React.ReactElement<typeof ToastAction>;\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n","import {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from \"@/components/core/toaster/toast\";\nimport { useToast } from \"@/hooks/use-toast\";\n\nexport function Toaster() {\n const { toasts } = useToast();\n return (\n <ToastProvider>\n {toasts.map(function ({ id, title, description, action, ...props }) {\n return (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && (\n <ToastDescription>{description}</ToastDescription>\n )}\n </div>\n {action}\n <ToastClose />\n </Toast>\n );\n })}\n <ToastViewport />\n </ToastProvider>\n );\n}\n","import { Toaster } from \"@/components/core\";\nimport { BlocksAppLayoutContext } from \"@/contexts\";\nimport {\n CreateAppConfigStore,\n type AppConfigStoreState,\n} from \"@/store/app-config.store\";\nimport type { RuntimeKey } from \"@/types\";\nimport { useState } from \"react\";\n\ntype BlocksAppLayoutProps = {\n children: React.ReactNode;\n config: Partial<AppConfigStoreState[\"config\"]>;\n};\n\ndeclare global {\n interface Window {\n __BLOCKS_ENV__?: Partial<Record<RuntimeKey, string>>;\n process?: { env: Partial<Record<RuntimeKey, string>> };\n }\n}\n\n// window is typed Window & typeof globalThis, and @types/node contributes a\n// global `process` whose type this browser shim cannot satisfy. Assign through\n// a plain Window reference so only the declaration above applies.\nconst browserWindow: Window = window;\nbrowserWindow.process = {\n env: window.__BLOCKS_ENV__ as Partial<Record<RuntimeKey, string>>,\n};\n\nexport const BlocksAppLayout = ({ children, config }: BlocksAppLayoutProps) => {\n const [store] = useState(() => CreateAppConfigStore(config));\n if (window && window.process && config) {\n const projectBaseUrlKey =\n config.name === \"blocks-os\"\n ? \"BLOCKS_OS_BASE_URL\"\n : \"BLOCKS_LOGIC_BASE_URL\";\n window.process.env.projectBaseUrl =\n window.process.env[projectBaseUrlKey] ?? \"\";\n\n // When the host app IS blocks-iam, the IAM API is same-origin with this SPA\n // (the client is built into server/Api/wwwroot and one Kestrel serves both),\n // so the browser origin is authoritative. BLOCKS_IAM_BASE_URL is baked into\n // wwwroot at container start, before the app can know which host it will be\n // served on, so it points at the canonical host even on a per-PR preview —\n // which would send the preview's own login/me/status calls to shared dev.\n // Every other app talks to IAM cross-origin and keeps using the config value.\n window.process.env[\"userBaseUrl\"] =\n config.name === \"blocks-iam\"\n ? window.location.origin\n : window.process?.env[\"BLOCKS_IAM_BASE_URL\"] || \"\";\n\n const notificationBaseUrlKey = \"BLOCKS_LOGIC_BASE_URL\";\n window.process.env[\"notificationBaseUrl\"] = notificationBaseUrlKey\n ? window.process?.env[notificationBaseUrlKey] || \"\"\n : \"\";\n }\n return (\n <BlocksAppLayoutContext.Provider value={store}>\n {children}\n <Toaster />\n </BlocksAppLayoutContext.Provider>\n );\n};\n","import { useEffect, useRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { useAppSettingsStore } from \"@/store\";\nimport { applyTheme } from \"@/lib/theme\";\nimport type { Theme } from \"@/lib/theme\";\n\ninterface ThemeProviderProps {\n children: ReactNode;\n /**\n * Seeds the initial theme only when no persisted cookie exists yet.\n * If the user already has a saved preference, it always wins.\n */\n defaultTheme?: Theme;\n /**\n * Fires after every confirmed theme or resolved-theme change.\n * Does NOT fire on initial mount — only on actual changes.\n */\n onThemeChange?: (\n theme: Theme,\n resolvedTheme: Exclude<Theme, \"system\">,\n ) => void;\n}\n\nexport function ThemeProvider({\n children,\n defaultTheme,\n onThemeChange,\n}: ThemeProviderProps) {\n const {\n settings: { theme },\n systemTheme,\n setSettings,\n setSystemTheme,\n } = useAppSettingsStore();\n\n const resolvedTheme: Exclude<Theme, \"system\"> =\n theme === \"system\" ? systemTheme : theme;\n\n // Skip onThemeChange on initial mount — only fire on actual changes\n const isFirstRender = useRef(true);\n\n // ── Seed defaultTheme once on mount, only if no cookie persisted yet ────────\n useEffect(() => {\n if (!defaultTheme) return;\n // Cookie storage is synchronous, so if the cookie exists the store is\n // already rehydrated with the user's saved preference — don't override it\n const hasCookie = document.cookie.includes(\"app-settings-storage=\");\n if (!hasCookie) {\n setSettings({ theme: defaultTheme });\n }\n // Intentionally empty dep array — seed is mount-only, one shot\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // ── Sync resolved theme to DOM ───────────────────────────────────────────────\n useEffect(() => {\n applyTheme(resolvedTheme);\n }, [resolvedTheme]);\n\n // ── App media query listener — active only when theme is \"system\" ─────────────\n useEffect(() => {\n if (theme !== \"system\") return;\n const mq = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const handler = (event: MediaQueryListEvent) => {\n setSystemTheme(event.matches ? \"dark\" : \"light\");\n };\n mq.addEventListener(\"change\", handler);\n return () => mq.removeEventListener(\"change\", handler);\n }, [theme, setSystemTheme]);\n\n // ── onThemeChange callback — skips initial mount ─────────────────────────────\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false;\n return;\n }\n onThemeChange?.(theme, resolvedTheme);\n }, [theme, resolvedTheme, onThemeChange]);\n\n return <>{children}</>;\n}\n"]}
|
|
@@ -68,7 +68,8 @@ var useImpersonateStore = create()((set) => ({
|
|
|
68
68
|
originalTenantId: null,
|
|
69
69
|
isInitialized: false,
|
|
70
70
|
impersonationError: null,
|
|
71
|
-
|
|
71
|
+
detachedReason: null,
|
|
72
|
+
detachedTenantId: null,
|
|
72
73
|
setImpersonation: (isImpersonated, originalTenantId, impersonatedTenantId) => {
|
|
73
74
|
set({ isImpersonated, impersonatedTenantId, originalTenantId });
|
|
74
75
|
},
|
|
@@ -78,7 +79,8 @@ var useImpersonateStore = create()((set) => ({
|
|
|
78
79
|
impersonatedTenantId,
|
|
79
80
|
originalTenantId,
|
|
80
81
|
impersonationError: null,
|
|
81
|
-
|
|
82
|
+
detachedReason: null,
|
|
83
|
+
detachedTenantId: null
|
|
82
84
|
});
|
|
83
85
|
},
|
|
84
86
|
terminate: (originalTenantId) => {
|
|
@@ -95,8 +97,8 @@ var useImpersonateStore = create()((set) => ({
|
|
|
95
97
|
setImpersonationError: (impersonationError) => {
|
|
96
98
|
set({ impersonationError });
|
|
97
99
|
},
|
|
98
|
-
setDetached: (
|
|
99
|
-
set({
|
|
100
|
+
setDetached: (detachedReason, detachedTenantId = null) => {
|
|
101
|
+
set({ detachedReason, detachedTenantId });
|
|
100
102
|
},
|
|
101
103
|
reset: () => {
|
|
102
104
|
set({
|
|
@@ -105,7 +107,8 @@ var useImpersonateStore = create()((set) => ({
|
|
|
105
107
|
originalTenantId: null,
|
|
106
108
|
isInitialized: false,
|
|
107
109
|
impersonationError: null,
|
|
108
|
-
|
|
110
|
+
detachedReason: null,
|
|
111
|
+
detachedTenantId: null
|
|
109
112
|
});
|
|
110
113
|
}
|
|
111
114
|
}));
|
|
@@ -194,5 +197,5 @@ var useUserStore = create()(
|
|
|
194
197
|
);
|
|
195
198
|
|
|
196
199
|
export { CreateAppConfigStore, useAppSettingsStore, useImpersonateStore, useLanguageViewStore, useLayoutSettingsStore, useUserStore };
|
|
197
|
-
//# sourceMappingURL=chunk-
|
|
198
|
-
//# sourceMappingURL=chunk-
|
|
200
|
+
//# sourceMappingURL=chunk-JITR3QYC.js.map
|
|
201
|
+
//# sourceMappingURL=chunk-JITR3QYC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/store/app-settings.store.ts","../src/store/impersonate.store.ts","../src/store/app-config.store.ts","../src/store/language-view.store.ts","../src/store/layout-settings.store.ts","../src/store/user.store.ts"],"names":["create","persist","createJSONStorage"],"mappings":";;;;AAMA,IAAM,sBAAsB,MAAM;AAChC,EAAA,MAAM,WAAW,IAAI,GAAA,CAAI,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA,CAAE,QAAA;AACjD,EAAA,IAAI,CAAC,UAAU,OAAO,MAAA;AACtB,EAAA,IAAI,QAAA,KAAa,aAAa,OAAO,QAAA;AACrC,EAAA,OAAO,QAAA,CAAS,MAAM,GAAG,CAAA,CAAE,MAAM,EAAE,CAAA,CAAE,KAAK,GAAG,CAAA;AAC/C,CAAA;AAsBA,IAAM,aAAA,GAAgB,IAAI,aAAA,EAAc;AACxC,IAAM,mCAAA,GAAsC,EAAA,GAAK,EAAA,GAAK,EAAA,GAAK,GAAA;AAE3D,IAAM,cAAA,GAA4D;AAAA,EAChE,OAAA,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ACA;AAAA,MACE,IAAA,EAAM;AAAA;AACR;AAEJ","file":"chunk-JITR3QYC.js","sourcesContent":["import type { Theme } from \"@/lib/theme\";\nimport { getSystemTheme } from \"@/lib/theme\";\nimport { CookieStorage } from \"@/lib/cookie-storage\";\nimport { create } from \"zustand\";\nimport { persist, type PersistStorage } from \"zustand/middleware\";\n\nconst resolveCookieDomain = () => {\n const hostname = new URL(window.location.origin).hostname;\n if (!hostname) return undefined;\n if (hostname === \"localhost\") return hostname;\n return hostname.split(\".\").slice(-2).join(\".\");\n};\n\nexport interface AppSettings {\n theme: Theme;\n language?: string;\n defaultApp?: string;\n [key: string]: unknown;\n}\n\ninterface AppSettingsStoreState {\n settings: AppSettings;\n // Non-persisted — tracks app preference reactively, not stored in cookie\n systemTheme: Exclude<Theme, \"system\">;\n getSettings: () => AppSettings;\n setSettings: (nextSettings: Partial<AppSettings>) => void;\n setSystemTheme: (systemTheme: Exclude<Theme, \"system\">) => void;\n resetSettings: () => void;\n}\n\n// Only `settings` goes into the cookie — systemTheme and actions are excluded\ntype AppSettingsPersistedState = Pick<AppSettingsStoreState, \"settings\">;\n\nconst cookieStorage = new CookieStorage();\nconst APP_SETTINGS_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 365;\n\nconst persistStorage: PersistStorage<AppSettingsPersistedState> = {\n getItem: (name) => {\n const cookie = cookieStorage.getItem(name);\n return cookie ? { state: JSON.parse(cookie) } : null;\n },\n setItem: (name, value) => {\n cookieStorage.setItem(name, JSON.stringify(value.state), {\n expires: APP_SETTINGS_COOKIE_MAX_AGE_SECONDS,\n domain: resolveCookieDomain(),\n path: \"/\",\n secure: window.location.protocol === \"https:\",\n sameSite: \"Lax\",\n });\n },\n removeItem: (name) => {\n cookieStorage.removeItem(name);\n },\n};\n\nexport const useAppSettingsStore = create<AppSettingsStoreState>()(\n persist(\n (set, get) => ({\n settings: {\n theme: \"system\",\n language: \"en\",\n },\n // Initialized from app at store creation — correct on first render\n systemTheme: getSystemTheme(),\n getSettings: () => get().settings,\n setSettings: (nextSettings) => {\n set((state) => ({\n ...state,\n settings: { ...state.settings, ...nextSettings },\n }));\n },\n setSystemTheme: (systemTheme) => {\n set((state) => ({ ...state, systemTheme }));\n },\n resetSettings: () => {\n set((state) => ({\n ...state,\n settings: { theme: \"system\", language: \"en\" },\n }));\n },\n }),\n {\n name: \"app-settings-storage\",\n storage: persistStorage,\n // Explicit partialize keeps systemTheme and actions out of the cookie\n partialize: (state) => ({ settings: state.settings }),\n },\n ),\n);\n","import { create } from \"zustand\";\n\n/** Why a window is no longer the one holding the shared session. */\nexport type DetachedReason = \"another-project\" | \"console\";\n\ninterface ImpersonateStoreState {\n isImpersonated: boolean;\n impersonatedTenantId: string | null;\n originalTenantId: string | null;\n isInitialized: boolean;\n /**\n * A re-impersonation that failed. Kept in the store rather than swallowed so the guard can render\n * a terminal state with a way out: a failure used to leave the store pinned to the *previous*\n * project's tenant, which froze the guard's effect dependencies and meant it never retried.\n */\n impersonationError: unknown;\n /**\n * Why this window lost the shared session, or null while it still holds it. A detached window\n * must issue no requests: its own state is stale, and the cookie underneath it now belongs to\n * somewhere else.\n *\n * The cause is kept, not just the fact, because the two read very differently to a user. Being\n * displaced by another project is \"your session moved\"; being displaced by the console is \"you\n * went back to the console\" -- and telling someone their project is \"open in another window\"\n * when they actually returned to the console would send them looking for a window that is not\n * there.\n */\n detachedReason: DetachedReason | null;\n /** Tenant that took the session, so the UI can name it rather than say \"another window\". */\n detachedTenantId: string | null;\n setImpersonation: (\n isImpersonated: boolean,\n originalTenantId: string | null,\n impersonatedTenantId: string | null,\n ) => void;\n impersonate: (impersonatedTenantId: string, originalTenantId: string) => void;\n terminate: (originalTenantId: string) => void;\n setInitialized: (isInitialized: boolean) => void;\n setImpersonationError: (impersonationError: unknown) => void;\n setDetached: (\n detachedReason: DetachedReason | null,\n detachedTenantId?: string | null,\n ) => void;\n reset: () => void;\n}\n\nexport const useImpersonateStore = create<ImpersonateStoreState>()((set) => ({\n isImpersonated: false,\n impersonatedTenantId: null,\n originalTenantId: null,\n isInitialized: false,\n impersonationError: null,\n detachedReason: null,\n detachedTenantId: null,\n setImpersonation: (\n isImpersonated: boolean,\n originalTenantId: string | null,\n impersonatedTenantId: string | null,\n ) => {\n set({ isImpersonated, impersonatedTenantId, originalTenantId });\n },\n impersonate: (impersonatedTenantId: string, originalTenantId: string) => {\n // A successful impersonation clears both failure states: this tab now owns the cookie and is\n // pointed at the tenant it believes it is pointed at.\n set({\n isImpersonated: true,\n impersonatedTenantId,\n originalTenantId,\n impersonationError: null,\n detachedReason: null,\n detachedTenantId: null,\n });\n },\n terminate: (originalTenantId: string) => {\n set((state) => ({\n ...state,\n isImpersonated: false,\n impersonatedTenantId: null,\n originalTenantId,\n }));\n },\n setInitialized: (isInitialized: boolean) => {\n set({ isInitialized });\n },\n setImpersonationError: (impersonationError: unknown) => {\n set({ impersonationError });\n },\n setDetached: (\n detachedReason: DetachedReason | null,\n detachedTenantId: string | null = null,\n ) => {\n set({ detachedReason, detachedTenantId });\n },\n reset: () => {\n set({\n isImpersonated: false,\n impersonatedTenantId: null,\n originalTenantId: null,\n isInitialized: false,\n impersonationError: null,\n detachedReason: null,\n detachedTenantId: null,\n });\n },\n}));\n","import { createStore } from \"zustand\";\n\nexport type ServiceName =\n | \"blocks-os\"\n | \"blocks-utilities\"\n | \"blocks-logic\"\n | \"blocks-monitor\"\n | \"blocks-release\"\n | \"blocks-iam\"\n | \"blocks-studio\"\n | \"blocks-agents\"\n | \"blocks-data\"\n | \"blocks-localization\";\n\nexport interface AppConfig {\n name: ServiceName;\n appLogoUrl:\n | {\n dark?: string;\n light?: string;\n }\n | string;\n}\n\nexport interface AppConfigStoreState {\n config: AppConfig;\n getConfig: () => AppConfig;\n setConfig: (nextConfig: Partial<AppConfig>) => void;\n resetConfig: () => void;\n}\n\nexport const CreateAppConfigStore = (initialConfig?: Partial<AppConfig>) =>\n createStore<AppConfigStoreState>()((set, get) => ({\n config: { name: \"blocks-os\", appLogoUrl: \"\", ...initialConfig },\n getConfig: () => get().config,\n setConfig: (nextConfig) => {\n set((state) => ({\n ...state,\n config: { ...state.config, ...nextConfig },\n }));\n },\n resetConfig: () => {\n set((state) => ({\n ...state,\n config: { name: \"blocks-os\", appLogoUrl: \"\", ...initialConfig },\n }));\n },\n }));\n","import { create } from \"zustand\";\nimport { createJSONStorage, persist } from \"zustand/middleware\";\n\ninterface LanguageViewState {\n selectedLanguages: string[];\n setSelectedLanguages: (languages: string[]) => void;\n toggleLanguage: (languageCode: string) => void;\n resetSelectedLanguages: () => void;\n selectedOptionalColumns: string[];\n setSelectedOptionalColumns: (columns: string[]) => void;\n toggleOptionalColumn: (column: string) => void;\n}\n\nexport const useLanguageViewStore = create<LanguageViewState>()(\n persist(\n (set) => ({\n selectedLanguages: [],\n\n setSelectedLanguages: (languages: string[]) => {\n set({ selectedLanguages: languages });\n },\n\n toggleLanguage: (languageCode: string) => {\n set((state) => ({\n selectedLanguages: state.selectedLanguages.includes(languageCode)\n ? state.selectedLanguages.filter((lang) => lang !== languageCode)\n : [...state.selectedLanguages, languageCode],\n }));\n },\n\n resetSelectedLanguages: () => {\n set({ selectedLanguages: [] });\n set({ selectedOptionalColumns: [] });\n },\n\n selectedOptionalColumns: [],\n\n setSelectedOptionalColumns: (columns: string[]) => {\n set({ selectedOptionalColumns: columns });\n },\n\n toggleOptionalColumn: (column: string) => {\n set((state) => ({\n selectedOptionalColumns: state.selectedOptionalColumns.includes(\n column,\n )\n ? state.selectedOptionalColumns.filter((col) => col !== column)\n : [...state.selectedOptionalColumns, column],\n }));\n },\n }),\n {\n name: \"language-view-storage\",\n storage: createJSONStorage(() => sessionStorage),\n },\n ),\n);\n","import { create } from \"zustand\";\nimport { persist, createJSONStorage } from \"zustand/middleware\";\n\ninterface LayoutSettings {\n isLeftSidebarOpen?: boolean;\n leftSidebarWidth?: string;\n rightSidePanelWidth?: string;\n}\n\ninterface LayoutSettingsStoreState {\n layout: LayoutSettings;\n setLayoutSetting: <K extends keyof LayoutSettings>(\n key: K,\n value: LayoutSettings[K],\n ) => void;\n resetLayout: () => void;\n}\n\nexport const useLayoutSettingsStore = create<LayoutSettingsStoreState>()(\n persist(\n (set) => ({\n layout: {},\n setLayoutSetting: (key, value) =>\n set((state) => ({\n layout: { ...state.layout, [key]: value },\n })),\n resetLayout: () => set({ layout: {} }),\n }),\n {\n name: \"layout-settings\",\n storage: createJSONStorage(() => localStorage),\n },\n ),\n);\n","import type { UserDetails } from \"@/models\";\nimport { create } from \"zustand\";\nimport { persist } from \"zustand/middleware\";\n\ninterface UserStoreState {\n userDetails: UserDetails | null;\n setUserDetails: (userDetails: UserDetails | null) => void;\n resetUserStore: () => void;\n}\n\nexport const useUserStore = create<UserStoreState>()(\n persist(\n (set) => ({\n userDetails: null,\n setUserDetails: (userDetails) => {\n set((state) => ({ ...state, userDetails }));\n },\n resetUserStore: () => {\n set({\n userDetails: null,\n });\n },\n }),\n {\n name: \"user-storage\",\n },\n ),\n);\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HttpClient, IAM_ENDPOINTS, notificationClient, NOTIFICATION_ENDPOINTS, NOTIFICATION_CONFIG_ENDPOINTS, PROJECT_ENDPOINTS, logicClient, iamClient, AUTH_ENDPOINTS, ORGANIZATION_ENDPOINTS, SERVICE_REGISTRY_ENDPOINTS, IMPERSONATE_ENDPOINTS } from './chunk-46ZGVJEX.js';
|
|
2
|
-
import { getRuntimeEnv } from './chunk-JUVLHPQI.js';
|
|
1
|
+
import { HttpClient, IAM_ENDPOINTS, notificationClient, NOTIFICATION_ENDPOINTS, NOTIFICATION_CONFIG_ENDPOINTS, PROJECT_ENDPOINTS, logicClient, claimTenant, iamClient, AUTH_ENDPOINTS, ORGANIZATION_ENDPOINTS, SERVICE_REGISTRY_ENDPOINTS, IMPERSONATE_ENDPOINTS } from './chunk-46ZGVJEX.js';
|
|
2
|
+
import { getRuntimeEnv, HttpError } from './chunk-JUVLHPQI.js';
|
|
3
3
|
import { BlocksAppLayoutContext } from './chunk-AHCHUUXM.js';
|
|
4
|
-
import { useAppSettingsStore, useImpersonateStore } from './chunk-
|
|
4
|
+
import { useAppSettingsStore, useImpersonateStore } from './chunk-JITR3QYC.js';
|
|
5
5
|
import { useProjectStore } from './chunk-4UHGGHI6.js';
|
|
6
6
|
import { useMemo, useState, useEffect, useCallback, useRef, useContext } from 'react';
|
|
7
7
|
import { useQueryStates } from 'nuqs';
|
|
@@ -1096,20 +1096,52 @@ var useStopImpersonation = () => {
|
|
|
1096
1096
|
return useMutation({
|
|
1097
1097
|
mutationKey: ["impersonation", "stop"],
|
|
1098
1098
|
mutationFn: impersonationService.stopImpersonation,
|
|
1099
|
-
|
|
1099
|
+
onSuccess: () => {
|
|
1100
1100
|
queryClient.setQueryData(
|
|
1101
1101
|
IMPERSONATION_STATUS_QUERY_KEY,
|
|
1102
1102
|
buildStoppedStatus()
|
|
1103
1103
|
);
|
|
1104
|
+
},
|
|
1105
|
+
// This used to be `onSettled`, which recorded "stopped" for failures too. A stop that 500s or
|
|
1106
|
+
// never leaves the browser leaves the session impersonated server-side, so writing the stopped
|
|
1107
|
+
// status there put the client into a state the server did not share -- the UI left the project
|
|
1108
|
+
// while the cookie stayed pointed at it.
|
|
1109
|
+
//
|
|
1110
|
+
// 401 is the one failure that still means stopped: IAM answers it when the refresh token names
|
|
1111
|
+
// no live impersonated session, so there is nothing left to stop either way. Every other failure
|
|
1112
|
+
// is unknown, and unknown is resolved by asking the server rather than by guessing.
|
|
1113
|
+
onError: (error) => {
|
|
1114
|
+
if (error instanceof HttpError && error.status === 401) {
|
|
1115
|
+
queryClient.setQueryData(
|
|
1116
|
+
IMPERSONATION_STATUS_QUERY_KEY,
|
|
1117
|
+
buildStoppedStatus()
|
|
1118
|
+
);
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
void queryClient.invalidateQueries({
|
|
1122
|
+
queryKey: IMPERSONATION_STATUS_QUERY_KEY
|
|
1123
|
+
});
|
|
1104
1124
|
}
|
|
1105
1125
|
});
|
|
1106
1126
|
};
|
|
1127
|
+
var startImpersonation = async (request) => {
|
|
1128
|
+
const result = await impersonationService.startImpersonation(request);
|
|
1129
|
+
if (result?.cookie_set !== true) {
|
|
1130
|
+
throw new HttpError(500, {
|
|
1131
|
+
errors: {
|
|
1132
|
+
general: "Impersonation did not replace the session cookie (cookie_set was not true)"
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
return result;
|
|
1137
|
+
};
|
|
1107
1138
|
var useStartImpersonation = () => {
|
|
1108
1139
|
const queryClient = useQueryClient();
|
|
1109
1140
|
return useMutation({
|
|
1110
1141
|
mutationKey: ["impersonation", "start"],
|
|
1111
|
-
mutationFn:
|
|
1142
|
+
mutationFn: startImpersonation,
|
|
1112
1143
|
onSuccess: (_data, variables) => {
|
|
1144
|
+
claimTenant(variables.targeted_tenant_id);
|
|
1113
1145
|
queryClient.setQueryData(
|
|
1114
1146
|
IMPERSONATION_STATUS_QUERY_KEY,
|
|
1115
1147
|
(current) => ({
|
|
@@ -1118,10 +1150,15 @@ var useStartImpersonation = () => {
|
|
|
1118
1150
|
impersonatedTenantId: variables.targeted_tenant_id
|
|
1119
1151
|
})
|
|
1120
1152
|
);
|
|
1153
|
+
},
|
|
1154
|
+
onError: () => {
|
|
1155
|
+
void queryClient.invalidateQueries({
|
|
1156
|
+
queryKey: IMPERSONATION_STATUS_QUERY_KEY
|
|
1157
|
+
});
|
|
1121
1158
|
}
|
|
1122
1159
|
});
|
|
1123
1160
|
};
|
|
1124
1161
|
|
|
1125
1162
|
export { applyColumnFuseFilters, createFuseSearcher, createQueryKeyFactory, defaultFuseSearchOptions, defaultPathSegmentFormatter, fuseFilter, fuseSearch, fuseSearchWithIndex, getPathSegments, initiateService, notificationService, projectService, useBlocksAppConfigStore, useBoolean, useCopyToClipboard, useCountDown, useDebounce, useDebouncedFuseFilter, useDisableProject, useFuseIndex, useFuseSearch, useGetAllServices, useGetBlocksNotificationConfig, useGetEnvRepositories, useGetMyOrganizations, useGetNotifications, useGetProject, useGetProjects, useIcon, useImpersonationStatusChecker, useInitiateRedirect, useKeyboardShortcut, useLanguage, useLanguageSwitcher, useLogin, useLogo, useLogout, useMarkAllAsRead, useMarkAsRead, useMediaQuery, usePathSegments, usePopoverWidth, usePrefetchRedirect, useQueryClientKit, useQueryStatesKit, useScopedPath, useSignUpAffordance, useSignUpRedirect, useStartImpersonation, useStopImpersonation, useTheme, useUpdateProject, useUpdateRepositories, useUpdateTenantGroup, useValidateCNameProject };
|
|
1126
|
-
//# sourceMappingURL=chunk-
|
|
1127
|
-
//# sourceMappingURL=chunk-
|
|
1163
|
+
//# sourceMappingURL=chunk-LNQUCEQU.js.map
|
|
1164
|
+
//# sourceMappingURL=chunk-LNQUCEQU.js.map
|