@seliseblocks/genesis-os 4.3.5 → 4.3.6
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-WBSWAHS6.js → chunk-46ZGVJEX.js} +98 -17
- package/dist/chunk-46ZGVJEX.js.map +1 -0
- package/dist/{chunk-FKFBYT22.cjs → chunk-4QKE3WAW.cjs} +103 -18
- package/dist/chunk-4QKE3WAW.cjs.map +1 -0
- package/dist/{chunk-ENK42YC4.js → chunk-4UHGGHI6.js} +17 -3
- package/dist/chunk-4UHGGHI6.js.map +1 -0
- package/dist/{chunk-VAKGHXK6.cjs → chunk-6GCU5LM7.cjs} +17 -3
- package/dist/chunk-6GCU5LM7.cjs.map +1 -0
- package/dist/{chunk-NF54AHIF.js → chunk-AHCHUUXM.js} +2 -2
- package/dist/{chunk-NF54AHIF.js.map → chunk-AHCHUUXM.js.map} +1 -1
- package/dist/{chunk-Q7Y32IBM.cjs → chunk-BPJM3L7O.cjs} +2 -2
- package/dist/{chunk-Q7Y32IBM.cjs.map → chunk-BPJM3L7O.cjs.map} +1 -1
- package/dist/{chunk-XALNVJQU.cjs → chunk-JDWJ2HXQ.cjs} +236 -21
- package/dist/{chunk-H47HQ5UX.js.map → chunk-JDWJ2HXQ.cjs.map} +1 -1
- package/dist/{chunk-TE3SKUL4.js → chunk-JSXAKNHQ.js} +3 -3
- package/dist/{chunk-TE3SKUL4.js.map → chunk-JSXAKNHQ.js.map} +1 -1
- package/dist/{chunk-WIY77276.js → chunk-OAWBQY5W.js} +5 -5
- package/dist/{chunk-WIY77276.js.map → chunk-OAWBQY5W.js.map} +1 -1
- package/dist/{chunk-ZVGCCTNK.cjs → chunk-OJG2XE7Z.cjs} +12 -12
- package/dist/{chunk-ZVGCCTNK.cjs.map → chunk-OJG2XE7Z.cjs.map} +1 -1
- package/dist/{chunk-6WBFAHAO.js → chunk-PKRBEIHK.js} +21 -5
- package/dist/chunk-PKRBEIHK.js.map +1 -0
- package/dist/{chunk-VTOD5ZQU.cjs → chunk-QTSTAWK3.cjs} +3 -3
- package/dist/{chunk-VTOD5ZQU.cjs.map → chunk-QTSTAWK3.cjs.map} +1 -1
- package/dist/{chunk-6DQTH7RD.cjs → chunk-SHCA37CD.cjs} +510 -159
- package/dist/{chunk-6DQTH7RD.cjs.map → chunk-SHCA37CD.cjs.map} +1 -1
- package/dist/{chunk-H47HQ5UX.js → chunk-SKKVJAXT.js} +209 -6
- package/dist/chunk-SKKVJAXT.js.map +1 -0
- package/dist/{chunk-3VNGGYRG.cjs → chunk-VQWYNAO5.cjs} +23 -7
- package/dist/chunk-VQWYNAO5.cjs.map +1 -0
- package/dist/{chunk-IWWGJQGJ.js → chunk-Y36F6N2O.js} +357 -13
- package/dist/chunk-Y36F6N2O.js.map +1 -0
- package/dist/components/index.cjs +359 -361
- package/dist/components/index.js +9 -11
- package/dist/guards/index.cjs +315 -11
- package/dist/guards/index.d.cts +3 -1
- package/dist/guards/index.d.ts +3 -1
- package/dist/guards/index.js +309 -5
- package/dist/hooks/index.cjs +92 -93
- package/dist/hooks/index.js +6 -7
- package/dist/index.cjs +625 -611
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -11
- package/dist/layouts/index.cjs +16 -18
- package/dist/layouts/index.js +9 -11
- package/dist/lib/index.cjs +33 -17
- package/dist/lib/index.d.cts +57 -2
- package/dist/lib/index.d.ts +57 -2
- package/dist/lib/index.js +2 -2
- package/dist/pages/index.cjs +14 -16
- package/dist/pages/index.js +9 -11
- package/dist/providers/index.cjs +8 -8
- package/dist/providers/index.js +4 -4
- package/dist/store/index.cjs +10 -10
- package/dist/store/index.d.cts +20 -2
- package/dist/store/index.d.ts +20 -2
- package/dist/store/index.js +2 -2
- package/dist/utils/index.cjs +72 -72
- package/dist/utils/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-25L7I5C7.js +0 -265
- package/dist/chunk-25L7I5C7.js.map +0 -1
- package/dist/chunk-3VNGGYRG.cjs.map +0 -1
- package/dist/chunk-6WBFAHAO.js.map +0 -1
- package/dist/chunk-ENK42YC4.js.map +0 -1
- package/dist/chunk-FKFBYT22.cjs.map +0 -1
- package/dist/chunk-HS6F65WY.cjs +0 -273
- package/dist/chunk-HS6F65WY.cjs.map +0 -1
- package/dist/chunk-IICIA5RV.js +0 -212
- package/dist/chunk-IICIA5RV.js.map +0 -1
- package/dist/chunk-IWWGJQGJ.js.map +0 -1
- package/dist/chunk-UVMFL4UV.cjs +0 -225
- package/dist/chunk-UVMFL4UV.cjs.map +0 -1
- package/dist/chunk-VAKGHXK6.cjs.map +0 -1
- package/dist/chunk-WBSWAHS6.js.map +0 -1
- package/dist/chunk-XALNVJQU.cjs.map +0 -1
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { refractor } from './chunk-FGY7QM3Y.js';
|
|
2
|
-
import { useKeyboardShortcut, usePopoverWidth, useBlocksAppConfigStore, useTheme, useLogout, useGetMyOrganizations, useLanguageSwitcher, useGetBlocksNotificationConfig, notificationService, useLogo, useLogin, useSignUpAffordance, useSignUpRedirect, useInitiateRedirect, useIcon, initiateService, useGetNotifications, useMarkAsRead, useMarkAllAsRead, useDebouncedFuseFilter, usePrefetchRedirect } from './chunk-
|
|
3
|
-
import { showErrorToast, createStorage, getForwardedToPath, debounce, formatFullDate, formatDate, deepEqual, showSuccessToast, isErrorWithErrors, getServiceBaseUrl, getServiceSwaggerUrl } from './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { fadeTransition, fadeInUp, staggerContainer, staggerItem, fadeInScale, iamClient, PROFILE_ENDPOINTS } from './chunk-WBSWAHS6.js';
|
|
9
|
-
import { getRuntimeEnv } from './chunk-JUVLHPQI.js';
|
|
2
|
+
import { useKeyboardShortcut, usePopoverWidth, useBlocksAppConfigStore, useTheme, useLogout, useGetMyOrganizations, useLanguageSwitcher, useGetBlocksNotificationConfig, notificationService, useLogo, useStartImpersonation, useGetProjects, useGetProject, useImpersonationStatusChecker, useStopImpersonation, useLogin, useSignUpAffordance, useSignUpRedirect, useInitiateRedirect, useGetEnvRepositories, useUpdateTenantGroup, useIcon, useDisableProject, projectService, initiateService, useGetNotifications, useMarkAsRead, useMarkAllAsRead, useDebouncedFuseFilter, useUpdateRepositories, usePrefetchRedirect } from './chunk-SKKVJAXT.js';
|
|
3
|
+
import { showErrorToast, createStorage, getForwardedToPath, debounce, formatFullDate, formatDate, deepEqual, showSuccessToast, isErrorWithErrors, getServiceBaseUrl, getServiceSwaggerUrl } from './chunk-JSXAKNHQ.js';
|
|
4
|
+
import { fadeTransition, fadeInUp, staggerContainer, staggerItem, fadeInScale, claimTenant, readCurrentOwner, subscribeToTenantClaims, iamClient, AUTH_ENDPOINTS, PROFILE_ENDPOINTS } from './chunk-46ZGVJEX.js';
|
|
5
|
+
import { getRuntimeEnv, HttpError } from './chunk-JUVLHPQI.js';
|
|
6
|
+
import { defaultRightSidePanelContextValue, RightSidePanelContext, SidebarContext, DashboardLayoutProvider } from './chunk-OAWBQY5W.js';
|
|
7
|
+
import { useIsMobile, useIsActiveMenu, useFilteredMenus } from './chunk-AHCHUUXM.js';
|
|
10
8
|
import { cn } from './chunk-3MLPBMH2.js';
|
|
11
9
|
import { getQueryClient } from './chunk-BRHE44FE.js';
|
|
12
|
-
import { useLayoutSettingsStore, useLanguageViewStore, useUserStore } from './chunk-
|
|
13
|
-
import { CookieStorage, useProjectStore, useAuthStore } from './chunk-
|
|
10
|
+
import { useLayoutSettingsStore, useLanguageViewStore, useImpersonateStore, useUserStore } from './chunk-PKRBEIHK.js';
|
|
11
|
+
import { CookieStorage, useProjectStore, useAuthStore } from './chunk-4UHGGHI6.js';
|
|
14
12
|
import { __commonJS, __toESM } from './chunk-PL4HS6R6.js';
|
|
15
13
|
import * as React8 from 'react';
|
|
16
14
|
import React8__default, { createContext, forwardRef, useState, useCallback, useEffect, useRef, useContext, useMemo, Suspense, Fragment as Fragment$1, Component, createElement as createElement$1, isValidElement } from 'react';
|
|
@@ -7680,6 +7678,352 @@ function SelectedProject() {
|
|
|
7680
7678
|
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-foreground", children: projectName })
|
|
7681
7679
|
] });
|
|
7682
7680
|
}
|
|
7681
|
+
function ProtectedGuard({
|
|
7682
|
+
children,
|
|
7683
|
+
defaultPublicPath = "/login"
|
|
7684
|
+
}) {
|
|
7685
|
+
const { isAuthenticated } = useAuthStore();
|
|
7686
|
+
const navigate = useNavigate();
|
|
7687
|
+
useEffect(() => {
|
|
7688
|
+
if (!isAuthenticated) navigate(defaultPublicPath);
|
|
7689
|
+
}, [isAuthenticated, defaultPublicPath, navigate]);
|
|
7690
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
7691
|
+
}
|
|
7692
|
+
var useAppState = () => {
|
|
7693
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
7694
|
+
useEffect(() => {
|
|
7695
|
+
setIsMounted(true);
|
|
7696
|
+
}, []);
|
|
7697
|
+
return { isMounted };
|
|
7698
|
+
};
|
|
7699
|
+
function PublicGuard({
|
|
7700
|
+
children,
|
|
7701
|
+
defaultProtectedPath = "/app/console"
|
|
7702
|
+
}) {
|
|
7703
|
+
const { isAuthenticated } = useAuthStore();
|
|
7704
|
+
const { isMounted } = useAppState();
|
|
7705
|
+
const navigate = useNavigate();
|
|
7706
|
+
useEffect(() => {
|
|
7707
|
+
if (!isMounted) return;
|
|
7708
|
+
if (isAuthenticated) navigate(defaultProtectedPath, { replace: true });
|
|
7709
|
+
}, [isAuthenticated, isMounted, navigate, defaultProtectedPath]);
|
|
7710
|
+
if (!isMounted) return null;
|
|
7711
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
7712
|
+
}
|
|
7713
|
+
function AuthResolver({ children }) {
|
|
7714
|
+
const { setUser, setAuthenticated, setUnAuthenticated } = useAuthStore();
|
|
7715
|
+
const hasResolved = useRef(false);
|
|
7716
|
+
useEffect(() => {
|
|
7717
|
+
if (hasResolved.current) return;
|
|
7718
|
+
hasResolved.current = true;
|
|
7719
|
+
async function resolve() {
|
|
7720
|
+
try {
|
|
7721
|
+
const res = await iamClient.get(`${AUTH_ENDPOINTS.ME}`);
|
|
7722
|
+
setUser(res);
|
|
7723
|
+
setAuthenticated();
|
|
7724
|
+
} catch {
|
|
7725
|
+
setUnAuthenticated();
|
|
7726
|
+
}
|
|
7727
|
+
}
|
|
7728
|
+
resolve();
|
|
7729
|
+
}, [setAuthenticated, setUnAuthenticated, setUser]);
|
|
7730
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
7731
|
+
}
|
|
7732
|
+
var BlocksIcon = ({ size }) => /* @__PURE__ */ jsxs(
|
|
7733
|
+
"svg",
|
|
7734
|
+
{
|
|
7735
|
+
width: size,
|
|
7736
|
+
height: size,
|
|
7737
|
+
viewBox: "0 0 246 360",
|
|
7738
|
+
fill: "none",
|
|
7739
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7740
|
+
children: [
|
|
7741
|
+
/* @__PURE__ */ jsx(
|
|
7742
|
+
"path",
|
|
7743
|
+
{
|
|
7744
|
+
d: "M245.455 68.1627V129.877L168.982 156.67V93.9638L245.455 68.1627Z",
|
|
7745
|
+
fill: "#2D86C7"
|
|
7746
|
+
}
|
|
7747
|
+
),
|
|
7748
|
+
/* @__PURE__ */ jsx(
|
|
7749
|
+
"path",
|
|
7750
|
+
{
|
|
7751
|
+
d: "M240.389 62.3805L165.49 87.6573L5.30933 24.2563L85.3314 0L240.389 62.3805Z",
|
|
7752
|
+
fill: "#2D86C7"
|
|
7753
|
+
}
|
|
7754
|
+
),
|
|
7755
|
+
/* @__PURE__ */ jsx(
|
|
7756
|
+
"path",
|
|
7757
|
+
{
|
|
7758
|
+
d: "M161.797 93.8295V156.43L81.1141 122.607V188.07L0 152.738V29.6846L161.797 93.8295Z",
|
|
7759
|
+
fill: "#2D86C7"
|
|
7760
|
+
}
|
|
7761
|
+
),
|
|
7762
|
+
/* @__PURE__ */ jsx(
|
|
7763
|
+
"path",
|
|
7764
|
+
{
|
|
7765
|
+
d: "M76.4728 266.036L0 291.837V230.123L76.4728 203.329V266.036Z",
|
|
7766
|
+
fill: "#2D86C7"
|
|
7767
|
+
}
|
|
7768
|
+
),
|
|
7769
|
+
/* @__PURE__ */ jsx(
|
|
7770
|
+
"path",
|
|
7771
|
+
{
|
|
7772
|
+
d: "M160.123 360L5.07178 297.619L79.964 272.343L240.145 335.744L160.123 360Z",
|
|
7773
|
+
fill: "#2D86C7"
|
|
7774
|
+
}
|
|
7775
|
+
),
|
|
7776
|
+
/* @__PURE__ */ jsx(
|
|
7777
|
+
"path",
|
|
7778
|
+
{
|
|
7779
|
+
d: "M245.454 330.315L83.657 266.17V203.57L164.34 237.393V171.93L245.454 207.262V330.315Z",
|
|
7780
|
+
fill: "#2D86C7"
|
|
7781
|
+
}
|
|
7782
|
+
)
|
|
7783
|
+
]
|
|
7784
|
+
}
|
|
7785
|
+
);
|
|
7786
|
+
var AppLoadingSpinner = ({ size = 64 }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7787
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
7788
|
+
@keyframes breathe {
|
|
7789
|
+
0%, 100% { transform: scaleY(1); }
|
|
7790
|
+
50% { transform: scaleY(0.85); }
|
|
7791
|
+
|
|
7792
|
+
}
|
|
7793
|
+
.animate-breathe {
|
|
7794
|
+
animation: breathe 2s ease-in-out infinite;
|
|
7795
|
+
transform-origin: center;
|
|
7796
|
+
}
|
|
7797
|
+
` }),
|
|
7798
|
+
/* @__PURE__ */ jsx("div", { className: "bg-background fixed inset-0 z-50 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "animate-breathe", children: /* @__PURE__ */ jsx(BlocksIcon, { size }) }) })
|
|
7799
|
+
] });
|
|
7800
|
+
var ImpersonationChecker = ({
|
|
7801
|
+
children
|
|
7802
|
+
}) => {
|
|
7803
|
+
const { data, isLoading, isSuccess } = useImpersonationStatusChecker();
|
|
7804
|
+
const { setImpersonation, isInitialized, setInitialized } = useImpersonateStore();
|
|
7805
|
+
useEffect(() => {
|
|
7806
|
+
if (!data) return;
|
|
7807
|
+
setImpersonation(
|
|
7808
|
+
data.impersonated,
|
|
7809
|
+
data.originalTenantId,
|
|
7810
|
+
data.impersonated ? data.impersonatedTenantId : null
|
|
7811
|
+
);
|
|
7812
|
+
setInitialized(true);
|
|
7813
|
+
}, [data, setImpersonation, setInitialized]);
|
|
7814
|
+
if (isLoading || !isSuccess || !isInitialized) return null;
|
|
7815
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
7816
|
+
};
|
|
7817
|
+
function ImpersonationTerminator({
|
|
7818
|
+
children
|
|
7819
|
+
}) {
|
|
7820
|
+
const { terminate, isImpersonated } = useImpersonateStore();
|
|
7821
|
+
const { mutateAsync } = useStopImpersonation();
|
|
7822
|
+
const isTriggering = useRef(false);
|
|
7823
|
+
const [isTerminating, setIsTerminating] = useState(false);
|
|
7824
|
+
useEffect(() => {
|
|
7825
|
+
if (isTriggering.current || !isImpersonated) return;
|
|
7826
|
+
isTriggering.current = true;
|
|
7827
|
+
setIsTerminating(true);
|
|
7828
|
+
const blocksKey = window.process?.env.BLOCKS_X_BLOCKS_KEY || "";
|
|
7829
|
+
const stopImpersonation = async () => {
|
|
7830
|
+
try {
|
|
7831
|
+
await mutateAsync(void 0);
|
|
7832
|
+
} catch (error) {
|
|
7833
|
+
if (!(error instanceof HttpError) || error.status !== 401) {
|
|
7834
|
+
console.error("Error stopping impersonation:", error);
|
|
7835
|
+
}
|
|
7836
|
+
} finally {
|
|
7837
|
+
terminate(blocksKey);
|
|
7838
|
+
isTriggering.current = false;
|
|
7839
|
+
setIsTerminating(false);
|
|
7840
|
+
}
|
|
7841
|
+
};
|
|
7842
|
+
void stopImpersonation();
|
|
7843
|
+
}, [mutateAsync, terminate, isImpersonated]);
|
|
7844
|
+
if (isImpersonated || isTerminating) return /* @__PURE__ */ jsx(AppLoadingSpinner, {});
|
|
7845
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
7846
|
+
}
|
|
7847
|
+
function ImpersonationBlocked({
|
|
7848
|
+
title,
|
|
7849
|
+
description,
|
|
7850
|
+
actionLabel,
|
|
7851
|
+
onAction,
|
|
7852
|
+
consolePath
|
|
7853
|
+
}) {
|
|
7854
|
+
const navigate = useNavigate();
|
|
7855
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-[320px] w-full flex-col items-center justify-center gap-4 p-8 text-center", children: [
|
|
7856
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
7857
|
+
/* @__PURE__ */ jsx("h2", { className: "text-base font-semibold", children: title }),
|
|
7858
|
+
/* @__PURE__ */ jsx("p", { className: "max-w-md text-sm text-muted-foreground", children: description })
|
|
7859
|
+
] }),
|
|
7860
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2", children: [
|
|
7861
|
+
/* @__PURE__ */ jsx(Button, { onClick: onAction, children: actionLabel }),
|
|
7862
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => navigate(consolePath), children: "Back to console" })
|
|
7863
|
+
] })
|
|
7864
|
+
] });
|
|
7865
|
+
}
|
|
7866
|
+
function ImpersonationSynchronizer({
|
|
7867
|
+
children,
|
|
7868
|
+
consolePath = "/app/console"
|
|
7869
|
+
}) {
|
|
7870
|
+
const {
|
|
7871
|
+
impersonate,
|
|
7872
|
+
isImpersonated,
|
|
7873
|
+
impersonatedTenantId,
|
|
7874
|
+
impersonationError,
|
|
7875
|
+
isDetached,
|
|
7876
|
+
setImpersonationError,
|
|
7877
|
+
setDetached
|
|
7878
|
+
} = useImpersonateStore();
|
|
7879
|
+
const { mutateAsync } = useStartImpersonation();
|
|
7880
|
+
const { data: _data } = useGetProjects({ enabled: true });
|
|
7881
|
+
const { selectedProject, setSelectedProject, projects, setTenantGroup } = useProjectStore();
|
|
7882
|
+
const isTriggering = useRef(false);
|
|
7883
|
+
const [isImpersonating, setIsImpersonating] = useState(false);
|
|
7884
|
+
const { itemId } = useParams();
|
|
7885
|
+
const routeTenantId = useMemo(() => {
|
|
7886
|
+
if (!itemId) return null;
|
|
7887
|
+
return projects.find((p) => p.itemId === itemId)?.tenantId ?? null;
|
|
7888
|
+
}, [itemId, projects]);
|
|
7889
|
+
const impersonatedTenantIdRef = useRef(impersonatedTenantId);
|
|
7890
|
+
const selectedProjectRef = useRef(selectedProject);
|
|
7891
|
+
const projectsRef = useRef(projects);
|
|
7892
|
+
const routeTenantIdRef = useRef(routeTenantId);
|
|
7893
|
+
impersonatedTenantIdRef.current = impersonatedTenantId;
|
|
7894
|
+
selectedProjectRef.current = selectedProject;
|
|
7895
|
+
projectsRef.current = projects;
|
|
7896
|
+
routeTenantIdRef.current = routeTenantId;
|
|
7897
|
+
useEffect(() => {
|
|
7898
|
+
if (!itemId || !projects.length) return;
|
|
7899
|
+
if (selectedProject?.itemId === itemId) return;
|
|
7900
|
+
const match = projects.find((p) => p.itemId === itemId);
|
|
7901
|
+
if (match) {
|
|
7902
|
+
setSelectedProject(match);
|
|
7903
|
+
setTenantGroup(match.tenantGroupId);
|
|
7904
|
+
}
|
|
7905
|
+
}, [
|
|
7906
|
+
itemId,
|
|
7907
|
+
selectedProject?.itemId,
|
|
7908
|
+
projects,
|
|
7909
|
+
setSelectedProject,
|
|
7910
|
+
setTenantGroup
|
|
7911
|
+
]);
|
|
7912
|
+
const getImpersonatedProject = async () => {
|
|
7913
|
+
try {
|
|
7914
|
+
const res = projectService.getProject();
|
|
7915
|
+
return (await res).data;
|
|
7916
|
+
} catch (error) {
|
|
7917
|
+
console.error("Error fetching projects:", error);
|
|
7918
|
+
}
|
|
7919
|
+
};
|
|
7920
|
+
const runImpersonation = useCallback(async () => {
|
|
7921
|
+
const targetTenantId = routeTenantIdRef.current;
|
|
7922
|
+
const currentTenantId = impersonatedTenantIdRef.current;
|
|
7923
|
+
const knownProjects = projectsRef.current;
|
|
7924
|
+
isTriggering.current = true;
|
|
7925
|
+
setIsImpersonating(true);
|
|
7926
|
+
try {
|
|
7927
|
+
if (!targetTenantId) {
|
|
7928
|
+
if (currentTenantId && !selectedProjectRef.current) {
|
|
7929
|
+
const project2 = knownProjects.find((p) => p.tenantId === currentTenantId) ?? await getImpersonatedProject();
|
|
7930
|
+
if (project2) {
|
|
7931
|
+
setSelectedProject(project2);
|
|
7932
|
+
setTenantGroup(project2.tenantGroupId);
|
|
7933
|
+
}
|
|
7934
|
+
}
|
|
7935
|
+
return;
|
|
7936
|
+
}
|
|
7937
|
+
await mutateAsync({ targeted_tenant_id: targetTenantId });
|
|
7938
|
+
impersonate(
|
|
7939
|
+
targetTenantId,
|
|
7940
|
+
window.process?.env.BLOCKS_X_BLOCKS_KEY || ""
|
|
7941
|
+
);
|
|
7942
|
+
claimTenant(targetTenantId);
|
|
7943
|
+
const project = knownProjects.find((p) => p.tenantId === targetTenantId);
|
|
7944
|
+
if (project) {
|
|
7945
|
+
setSelectedProject(project);
|
|
7946
|
+
setTenantGroup(project.tenantGroupId);
|
|
7947
|
+
}
|
|
7948
|
+
} catch (error) {
|
|
7949
|
+
setImpersonationError(error);
|
|
7950
|
+
} finally {
|
|
7951
|
+
isTriggering.current = false;
|
|
7952
|
+
setIsImpersonating(false);
|
|
7953
|
+
}
|
|
7954
|
+
}, [
|
|
7955
|
+
mutateAsync,
|
|
7956
|
+
impersonate,
|
|
7957
|
+
setSelectedProject,
|
|
7958
|
+
setTenantGroup,
|
|
7959
|
+
setImpersonationError
|
|
7960
|
+
]);
|
|
7961
|
+
const retry = useCallback(() => {
|
|
7962
|
+
setImpersonationError(null);
|
|
7963
|
+
setDetached(false);
|
|
7964
|
+
void runImpersonation();
|
|
7965
|
+
}, [runImpersonation, setImpersonationError, setDetached]);
|
|
7966
|
+
useEffect(() => {
|
|
7967
|
+
const owner = readCurrentOwner();
|
|
7968
|
+
if (owner && routeTenantId && owner.tenantId !== routeTenantId) {
|
|
7969
|
+
setDetached(true);
|
|
7970
|
+
}
|
|
7971
|
+
return subscribeToTenantClaims((claim) => {
|
|
7972
|
+
const mine = routeTenantIdRef.current;
|
|
7973
|
+
if (!mine) return;
|
|
7974
|
+
setDetached(claim.tenantId !== mine);
|
|
7975
|
+
});
|
|
7976
|
+
}, [routeTenantId, setDetached]);
|
|
7977
|
+
useEffect(() => {
|
|
7978
|
+
if (!itemId) return;
|
|
7979
|
+
if (isTriggering.current) return;
|
|
7980
|
+
if (impersonationError || isDetached) return;
|
|
7981
|
+
const needsColdStart = !routeTenantId && !!impersonatedTenantId && !selectedProject;
|
|
7982
|
+
const needsRetarget = !!routeTenantId && routeTenantId !== impersonatedTenantId;
|
|
7983
|
+
if (!needsColdStart && !needsRetarget) return;
|
|
7984
|
+
void runImpersonation();
|
|
7985
|
+
}, [
|
|
7986
|
+
itemId,
|
|
7987
|
+
routeTenantId,
|
|
7988
|
+
impersonatedTenantId,
|
|
7989
|
+
selectedProject,
|
|
7990
|
+
impersonationError,
|
|
7991
|
+
isDetached,
|
|
7992
|
+
runImpersonation
|
|
7993
|
+
]);
|
|
7994
|
+
if (isImpersonating) return /* @__PURE__ */ jsx(AppLoadingSpinner, {});
|
|
7995
|
+
if (!itemId) {
|
|
7996
|
+
if (!isImpersonated || isTriggering.current) return null;
|
|
7997
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
7998
|
+
}
|
|
7999
|
+
if (impersonationError) {
|
|
8000
|
+
return /* @__PURE__ */ jsx(
|
|
8001
|
+
ImpersonationBlocked,
|
|
8002
|
+
{
|
|
8003
|
+
title: "Could not open this project",
|
|
8004
|
+
description: "We could not switch your session to this project. Retry, or go back to the console and pick a project again.",
|
|
8005
|
+
actionLabel: "Retry",
|
|
8006
|
+
onAction: retry,
|
|
8007
|
+
consolePath
|
|
8008
|
+
}
|
|
8009
|
+
);
|
|
8010
|
+
}
|
|
8011
|
+
if (isDetached) {
|
|
8012
|
+
return /* @__PURE__ */ jsx(
|
|
8013
|
+
ImpersonationBlocked,
|
|
8014
|
+
{
|
|
8015
|
+
title: "This project is open in another tab",
|
|
8016
|
+
description: "Your session can only be in one project at a time. Use this tab instead, or return to the console.",
|
|
8017
|
+
actionLabel: "Use this tab",
|
|
8018
|
+
onAction: retry,
|
|
8019
|
+
consolePath
|
|
8020
|
+
}
|
|
8021
|
+
);
|
|
8022
|
+
}
|
|
8023
|
+
if (!routeTenantId) return /* @__PURE__ */ jsx(AppLoadingSpinner, {});
|
|
8024
|
+
if (routeTenantId !== impersonatedTenantId) return /* @__PURE__ */ jsx(AppLoadingSpinner, {});
|
|
8025
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
8026
|
+
}
|
|
7683
8027
|
function PublicLayout({ children }) {
|
|
7684
8028
|
return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(PublicGuard, { children }) });
|
|
7685
8029
|
}
|
|
@@ -12882,6 +13226,6 @@ var TablePagination2 = React8.forwardRef(
|
|
|
12882
13226
|
);
|
|
12883
13227
|
TablePagination2.displayName = "TablePagination";
|
|
12884
13228
|
|
|
12885
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppSwitcher, ArchiveProject, AspectRatio, AuthLayout, Avatar, AvatarFallback, AvatarImage, BackToConsoleNavigator, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CallbackPage, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmationModal, ConsoleHeader, ConsoleLayout, ConsolePage, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyToClipboardButton, CopyableSnippet, DEFAULT_KANBAN_COLUMNS, DashboardHeader, DashboardLayout, DashboardOverview, DashboardRoute, DashboardSectionCard, DataTable, DataTableHeaderCell, DateRangePicker, DesktopMenuItem, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditProject, EditProjectDialog, EditProjectForm, EnvironmentCard, EnvironmentList, ErrorBoundary, ErrorDisplay, ErrorDisplayWithCard, FileInput, FileUploader, FileUploaderContent, FileUploaderItem, FilterControls, FilterToolBarMobileView, FilterToolbar, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, ImportFileModalContent, InfiniteScroll, InfiniteScroller, InfoTooltip, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, KanbanBoard, KanbanBoardColumn, KanbanBoardContainer, KanbanTaskCard, Label, LanguageSelector, LoadingButton, LoginPage, Logo, MaskedText, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MobileMenuItem, MultiSelect, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Notification, OidcLayout, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, ProfilePage, Progress, ProjectActions, ProjectCardLoadingSkeleton, ProjectDetail, ProjectList2 as ProjectList, ProjectListRowLoadingSkeleton, ProjectOverview, ProjectRepoList, PublicLayout, RadioGroup4 as RadioGroup, RadioGroupItem, RenderAlternatively, RenderConditionally, ResizableHandle, ResizablePanel, ResizablePanelGroup, RightSidePanel, RightSidePanelBody, RightSidePanelClose, RightSidePanelDescription, RightSidePanelFooter, RightSidePanelHeader, RightSidePanelProvider, RightSidePanelTitle, RightSidePanelTrigger, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectedEnvironment, SelectedProject, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarCollapsedTooltip, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuDesktop, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarMobileView, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableLoadingSkeleton, TablePagination2 as TablePagination, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeSwitcher, Timeline, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserDropdownMenu, WizardHorizontalTrackBar, WizardStepContent, WizardStepIndicator, WizardStepViewport, WizardStepperProvider, WizardVerticalTrackBar, badgeVariants, buttonVariants, editProjectFormDefaultValues, editProjectFormSchema, filteredAppSwitcherData, hasDraggableData, kanbanKeyboardCoordinateGetter, navigationMenuTriggerStyle, paginationQueryParsers, sidebarCollapsedTooltipClass, sortQueryParsers, spinnerVariants, toggleVariants, useFileUpload, useFormField, useNotificationSocket, useOidcContext, usePaginationQueryParams, useRightSidePanel, useSortQueryParams, useWizardStepper };
|
|
12886
|
-
//# sourceMappingURL=chunk-
|
|
12887
|
-
//# sourceMappingURL=chunk-
|
|
13229
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppLoadingSpinner, AppSwitcher, ArchiveProject, AspectRatio, AuthLayout, AuthResolver, Avatar, AvatarFallback, AvatarImage, BackToConsoleNavigator, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CallbackPage, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmationModal, ConsoleHeader, ConsoleLayout, ConsolePage, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyToClipboardButton, CopyableSnippet, DEFAULT_KANBAN_COLUMNS, DashboardHeader, DashboardLayout, DashboardOverview, DashboardRoute, DashboardSectionCard, DataTable, DataTableHeaderCell, DateRangePicker, DesktopMenuItem, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditProject, EditProjectDialog, EditProjectForm, EnvironmentCard, EnvironmentList, ErrorBoundary, ErrorDisplay, ErrorDisplayWithCard, FileInput, FileUploader, FileUploaderContent, FileUploaderItem, FilterControls, FilterToolBarMobileView, FilterToolbar, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, ImpersonationChecker, ImpersonationSynchronizer, ImpersonationTerminator, ImportFileModalContent, InfiniteScroll, InfiniteScroller, InfoTooltip, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, KanbanBoard, KanbanBoardColumn, KanbanBoardContainer, KanbanTaskCard, Label, LanguageSelector, LoadingButton, LoginPage, Logo, MaskedText, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MobileMenuItem, MultiSelect, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Notification, OidcLayout, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, ProfilePage, Progress, ProjectActions, ProjectCardLoadingSkeleton, ProjectDetail, ProjectList2 as ProjectList, ProjectListRowLoadingSkeleton, ProjectOverview, ProjectRepoList, ProtectedGuard, PublicGuard, PublicLayout, RadioGroup4 as RadioGroup, RadioGroupItem, RenderAlternatively, RenderConditionally, ResizableHandle, ResizablePanel, ResizablePanelGroup, RightSidePanel, RightSidePanelBody, RightSidePanelClose, RightSidePanelDescription, RightSidePanelFooter, RightSidePanelHeader, RightSidePanelProvider, RightSidePanelTitle, RightSidePanelTrigger, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectedEnvironment, SelectedProject, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarCollapsedTooltip, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuDesktop, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarMobileView, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableLoadingSkeleton, TablePagination2 as TablePagination, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeSwitcher, Timeline, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserDropdownMenu, WizardHorizontalTrackBar, WizardStepContent, WizardStepIndicator, WizardStepViewport, WizardStepperProvider, WizardVerticalTrackBar, badgeVariants, buttonVariants, editProjectFormDefaultValues, editProjectFormSchema, filteredAppSwitcherData, hasDraggableData, kanbanKeyboardCoordinateGetter, navigationMenuTriggerStyle, paginationQueryParsers, sidebarCollapsedTooltipClass, sortQueryParsers, spinnerVariants, toggleVariants, useFileUpload, useFormField, useNotificationSocket, useOidcContext, usePaginationQueryParams, useRightSidePanel, useSortQueryParams, useWizardStepper };
|
|
13230
|
+
//# sourceMappingURL=chunk-Y36F6N2O.js.map
|
|
13231
|
+
//# sourceMappingURL=chunk-Y36F6N2O.js.map
|