@seliseblocks/genesis-os 4.4.0 → 4.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkXJ6DPUCV_cjs = require('./chunk-XJ6DPUCV.cjs');
4
- var chunkHBVSAOTQ_cjs = require('./chunk-HBVSAOTQ.cjs');
4
+ var chunk3EGBCU4W_cjs = require('./chunk-3EGBCU4W.cjs');
5
5
  var chunkQTSTAWK3_cjs = require('./chunk-QTSTAWK3.cjs');
6
6
  var chunkVAWEXEJZ_cjs = require('./chunk-VAWEXEJZ.cjs');
7
7
  var chunkX4YCRWXO_cjs = require('./chunk-X4YCRWXO.cjs');
@@ -1523,7 +1523,7 @@ function RightSidePanelProvider({
1523
1523
  const close = React8__namespace.useCallback(() => {
1524
1524
  setOpen(false);
1525
1525
  }, [setOpen]);
1526
- chunkHBVSAOTQ_cjs.useKeyboardShortcut(shortcut, toggle);
1526
+ chunk3EGBCU4W_cjs.useKeyboardShortcut(shortcut, toggle);
1527
1527
  React8__namespace.useEffect(() => {
1528
1528
  if (!syncHash || isControlled || typeof window === "undefined") return;
1529
1529
  const handleHashChange = () => {
@@ -3499,7 +3499,7 @@ function MultiSelect({
3499
3499
  onChange,
3500
3500
  value: selectedValues
3501
3501
  }) {
3502
- const [buttonRef, popoverWidth] = chunkHBVSAOTQ_cjs.usePopoverWidth();
3502
+ const [buttonRef, popoverWidth] = chunk3EGBCU4W_cjs.usePopoverWidth();
3503
3503
  const onSelectHandler = (value) => {
3504
3504
  const nextValues = selectedValues.includes(value) ? selectedValues.filter((item) => item !== value) : [...selectedValues, value];
3505
3505
  onChange(nextValues);
@@ -6701,7 +6701,7 @@ function useAppRedirectUrls({
6701
6701
  queries: requests.map(
6702
6702
  ({ clientId, redirectUri, forwardedTo, queryKey }) => ({
6703
6703
  queryKey,
6704
- queryFn: ({ signal }) => chunkHBVSAOTQ_cjs.initiateService.fetchRedirectUrl(
6704
+ queryFn: ({ signal }) => chunk3EGBCU4W_cjs.initiateService.fetchRedirectUrl(
6705
6705
  { clientId, redirectUri, forwardedTo },
6706
6706
  signal
6707
6707
  ),
@@ -6740,7 +6740,7 @@ function useAppRedirectUrls({
6740
6740
  }
6741
6741
  var AppSwitcher = ({ forwardedTo }) => {
6742
6742
  const [open, setOpen] = React8.useState(false);
6743
- const config = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.getConfig());
6743
+ const config = chunk3EGBCU4W_cjs.useBlocksAppConfigStore((state) => state.getConfig());
6744
6744
  const filteredApps = React8.useMemo(
6745
6745
  () => filteredAppSwitcherData.filter((app) => app.id !== config.name),
6746
6746
  [config.name]
@@ -6779,7 +6779,7 @@ function ThemeSwitcher({
6779
6779
  className,
6780
6780
  showChevron = true
6781
6781
  } = {}) {
6782
- const { theme, setTheme } = chunkHBVSAOTQ_cjs.useTheme();
6782
+ const { theme, setTheme } = chunk3EGBCU4W_cjs.useTheme();
6783
6783
  const { Icon: ThemeIcon } = OPTIONS[theme];
6784
6784
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
6785
6785
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6889,14 +6889,14 @@ function UserAvatar({ size = "sm" }) {
6889
6889
  );
6890
6890
  }
6891
6891
  function UserDropdownMenu() {
6892
- const { name } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.config);
6892
+ const { name } = chunk3EGBCU4W_cjs.useBlocksAppConfigStore((state) => state.config);
6893
6893
  const { data } = useGetUserInfo();
6894
6894
  const userData = data?.data;
6895
- const { isPending, mutateAsync } = chunkHBVSAOTQ_cjs.useLogout();
6895
+ const { isPending, mutateAsync } = chunk3EGBCU4W_cjs.useLogout();
6896
6896
  const { resetProjectStore } = chunk6GCU5LM7_cjs.useProjectStore();
6897
6897
  const { setUnAuthenticated, clearTokens } = chunk6GCU5LM7_cjs.useAuthStore();
6898
6898
  const { resetSelectedLanguages } = chunk4QN4CYSC_cjs.useLanguageViewStore();
6899
- const { data: myOrgsData, isLoading: isOrgsLoading } = chunkHBVSAOTQ_cjs.useGetMyOrganizations();
6899
+ const { data: myOrgsData, isLoading: isOrgsLoading } = chunk3EGBCU4W_cjs.useGetMyOrganizations();
6900
6900
  const fullName = [userData?.firstName, userData?.lastName].filter(Boolean).join(" ") || "\u2014";
6901
6901
  const email = userData?.email || "";
6902
6902
  const roles = Object.values(userData?.roles || {}).flat();
@@ -7026,7 +7026,7 @@ var languages = [
7026
7026
  { key: "fr", title: "French" }
7027
7027
  ];
7028
7028
  function LanguageSelector() {
7029
- const { changeLanguage, language } = chunkHBVSAOTQ_cjs.useLanguageSwitcher();
7029
+ const { changeLanguage, language } = chunk3EGBCU4W_cjs.useLanguageSwitcher();
7030
7030
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
7031
7031
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
7032
7032
  "button",
@@ -7091,8 +7091,24 @@ function Logo({
7091
7091
  ] });
7092
7092
  }
7093
7093
  var logicOrigin = () => chunkX4YCRWXO_cjs.getRuntimeEnv("BLOCKS_LOGIC_BASE_URL").trim().replace(/\/$/, "");
7094
+ var RETRY_DELAYS_MS = [2e3, 5e3, 15e3, 3e4];
7095
+ var STEADY_RETRY_MS = 6e4;
7096
+ var isLoggedOut = (error) => error?.status === 401;
7097
+ var hasHttpStatus = (error) => typeof error?.status === "number";
7098
+ var refreshLoginCall = async (probe) => {
7099
+ try {
7100
+ await probe;
7101
+ } catch (error) {
7102
+ if (isLoggedOut(error) || !hasHttpStatus(error)) throw error;
7103
+ }
7104
+ };
7094
7105
  var NotificationListenerService = class {
7095
7106
  connection;
7107
+ // True from connect() until disconnect(): the app wants the hub up.
7108
+ wanted = false;
7109
+ attempt = 0;
7110
+ timer;
7111
+ inFlight;
7096
7112
  constructor() {
7097
7113
  this.connection = new signalr.HubConnectionBuilder().withUrl(
7098
7114
  `${logicOrigin()}/api/NotificationHub?x-blocks-key=${chunkX4YCRWXO_cjs.getRuntimeEnv("BLOCKS_X_BLOCKS_KEY")}`,
@@ -7100,23 +7116,78 @@ var NotificationListenerService = class {
7100
7116
  transport: signalr.HttpTransportType.WebSockets
7101
7117
  }
7102
7118
  ).withAutomaticReconnect().build();
7119
+ this.connection.onclose(() => {
7120
+ if (this.wanted) this.recover(true);
7121
+ });
7103
7122
  }
7104
7123
  async connect() {
7105
- if (this.connection.state === "Disconnected") {
7106
- await this.connection.start();
7124
+ if (!this.wanted) {
7125
+ this.wanted = true;
7126
+ this.attempt = 0;
7127
+ globalThis.addEventListener("online", this.onWake);
7128
+ document.addEventListener("visibilitychange", this.onVisibility);
7107
7129
  }
7130
+ if (this.timer === void 0) await this.recover(false);
7108
7131
  }
7109
7132
  async disconnect() {
7133
+ this.wanted = false;
7134
+ this.stopWatching();
7110
7135
  if (this.connection.state !== "Disconnected") {
7111
7136
  await this.connection.stop();
7112
7137
  }
7113
7138
  }
7139
+ onWake = () => {
7140
+ if (this.wanted) this.recover(true);
7141
+ };
7142
+ onVisibility = () => {
7143
+ if (document.visibilityState === "visible") this.onWake();
7144
+ };
7145
+ stopWatching() {
7146
+ clearTimeout(this.timer);
7147
+ this.timer = void 0;
7148
+ globalThis.removeEventListener("online", this.onWake);
7149
+ document.removeEventListener("visibilitychange", this.onVisibility);
7150
+ }
7151
+ // Never two starts at once: callers share the run that is already going.
7152
+ recover(refreshLogin) {
7153
+ this.inFlight ??= this.tryStart(refreshLogin).finally(() => {
7154
+ this.inFlight = void 0;
7155
+ });
7156
+ return this.inFlight;
7157
+ }
7158
+ async tryStart(refreshLogin) {
7159
+ clearTimeout(this.timer);
7160
+ this.timer = void 0;
7161
+ if (!this.wanted || this.connection.state !== "Disconnected") return;
7162
+ if (refreshLogin && navigator.onLine === false) return;
7163
+ try {
7164
+ if (refreshLogin)
7165
+ await refreshLoginCall(chunk3EGBCU4W_cjs.notificationService.getNotifications(1, 1));
7166
+ if (!this.wanted) return;
7167
+ await this.connection.start();
7168
+ this.attempt = 0;
7169
+ if (!this.wanted) await this.connection.stop();
7170
+ } catch (error) {
7171
+ if (!this.wanted) return;
7172
+ if (isLoggedOut(error)) {
7173
+ this.wanted = false;
7174
+ this.stopWatching();
7175
+ return;
7176
+ }
7177
+ this.scheduleRetry();
7178
+ }
7179
+ }
7180
+ scheduleRetry() {
7181
+ const delay = RETRY_DELAYS_MS[this.attempt] ?? STEADY_RETRY_MS;
7182
+ this.attempt += 1;
7183
+ this.timer = setTimeout(() => this.recover(true), delay);
7184
+ }
7114
7185
  };
7115
7186
  var notificationListenerService = new NotificationListenerService();
7116
7187
 
7117
7188
  // src/components/common/notification/use-notification-socket.ts
7118
7189
  function useNotificationSocket() {
7119
- const { data: configData } = chunkHBVSAOTQ_cjs.useGetBlocksNotificationConfig(0, 100);
7190
+ const { data: configData } = chunk3EGBCU4W_cjs.useGetBlocksNotificationConfig(0, 100);
7120
7191
  const queryClient = reactQuery.useQueryClient();
7121
7192
  notificationListenerService.connect();
7122
7193
  React8.useEffect(() => {
@@ -7131,7 +7202,7 @@ function useNotificationSocket() {
7131
7202
  notificationListenerService.connection.on(
7132
7203
  config.notifyMethod,
7133
7204
  (message) => {
7134
- chunkHBVSAOTQ_cjs.notificationService.getNotificationConfig(config, message);
7205
+ chunk3EGBCU4W_cjs.notificationService.getNotificationConfig(config, message);
7135
7206
  try {
7136
7207
  const notice = typeof message === "string" ? JSON.parse(message) : message;
7137
7208
  const denom = JSON.parse(
@@ -7155,12 +7226,12 @@ function useNotificationFeed(open) {
7155
7226
  const [notifications, setNotifications] = React8.useState([]);
7156
7227
  const [hasMore, setHasMore] = React8.useState(true);
7157
7228
  const listRef = React8.useRef(null);
7158
- const { data, isLoading, isFetching } = chunkHBVSAOTQ_cjs.useGetNotifications(
7229
+ const { data, isLoading, isFetching } = chunk3EGBCU4W_cjs.useGetNotifications(
7159
7230
  pageNumber,
7160
7231
  PAGE_SIZE
7161
7232
  );
7162
- const markAsRead = chunkHBVSAOTQ_cjs.useMarkAsRead();
7163
- const markAllAsRead = chunkHBVSAOTQ_cjs.useMarkAllAsRead();
7233
+ const markAsRead = chunk3EGBCU4W_cjs.useMarkAsRead();
7234
+ const markAllAsRead = chunk3EGBCU4W_cjs.useMarkAllAsRead();
7164
7235
  React8.useEffect(() => {
7165
7236
  if (!data?.notifications) return;
7166
7237
  setNotifications((prev) => {
@@ -7394,7 +7465,7 @@ function ConsoleHeader() {
7394
7465
  window.addEventListener("scroll", handleScroll);
7395
7466
  return () => window.removeEventListener("scroll", handleScroll);
7396
7467
  }, []);
7397
- const { appLightLogo, appDarkLogo } = chunkHBVSAOTQ_cjs.useLogo();
7468
+ const { appLightLogo, appDarkLogo } = chunk3EGBCU4W_cjs.useLogo();
7398
7469
  return /* @__PURE__ */ jsxRuntime.jsx(
7399
7470
  "div",
7400
7471
  {
@@ -7573,7 +7644,7 @@ var EnvironmentCard = ({
7573
7644
  className
7574
7645
  }) => {
7575
7646
  const { setSelectedProject, setTenantGroup } = chunk6GCU5LM7_cjs.useProjectStore();
7576
- const { mutateAsync } = chunkHBVSAOTQ_cjs.useStartImpersonation();
7647
+ const { mutateAsync } = chunk3EGBCU4W_cjs.useStartImpersonation();
7577
7648
  const navigate = reactRouter.useNavigate();
7578
7649
  const handleCardClick = async () => {
7579
7650
  try {
@@ -7627,11 +7698,11 @@ function EnvironmentList({
7627
7698
  }) {
7628
7699
  const navigate = reactRouter.useNavigate();
7629
7700
  const { pathname } = reactRouter.useLocation();
7630
- const { data: projectGroups = [], isLoading } = chunkHBVSAOTQ_cjs.useGetProjects({
7701
+ const { data: projectGroups = [], isLoading } = chunk3EGBCU4W_cjs.useGetProjects({
7631
7702
  enabled: true
7632
7703
  });
7633
7704
  const { selectedProject, setSelectedProject } = chunk6GCU5LM7_cjs.useProjectStore();
7634
- const { data: projectData } = chunkHBVSAOTQ_cjs.useGetProject();
7705
+ const { data: projectData } = chunk3EGBCU4W_cjs.useGetProject();
7635
7706
  const pendingProjectRef = React8.useRef(null);
7636
7707
  const redirectRegexMap = React8.useMemo(
7637
7708
  () => Object.entries(redirectPaths).reduce(
@@ -7914,7 +7985,7 @@ var useLiveOwnerProbe = ({
7914
7985
  var ImpersonationChecker = ({
7915
7986
  children
7916
7987
  }) => {
7917
- const { data, isLoading, isSuccess } = chunkHBVSAOTQ_cjs.useImpersonationStatusChecker();
7988
+ const { data, isLoading, isSuccess } = chunk3EGBCU4W_cjs.useImpersonationStatusChecker();
7918
7989
  const { setImpersonation, isInitialized, setInitialized } = chunk4QN4CYSC_cjs.useImpersonateStore();
7919
7990
  React8.useEffect(() => {
7920
7991
  if (!data) return;
@@ -7971,8 +8042,8 @@ function ImpersonationTerminator({
7971
8042
  detachedTenantId,
7972
8043
  setDetached
7973
8044
  } = chunk4QN4CYSC_cjs.useImpersonateStore();
7974
- const { mutateAsync } = chunkHBVSAOTQ_cjs.useStopImpersonation();
7975
- const recordClaimedTenant = chunkHBVSAOTQ_cjs.useRecordClaimedTenant();
8045
+ const { mutateAsync } = chunk3EGBCU4W_cjs.useStopImpersonation();
8046
+ const recordClaimedTenant = chunk3EGBCU4W_cjs.useRecordClaimedTenant();
7976
8047
  const { projects } = chunk6GCU5LM7_cjs.useProjectStore();
7977
8048
  const isTriggering = React8.useRef(false);
7978
8049
  const [isTerminating, setIsTerminating] = React8.useState(false);
@@ -8060,9 +8131,9 @@ function ImpersonationSynchronizer({
8060
8131
  setImpersonationError,
8061
8132
  setDetached
8062
8133
  } = chunk4QN4CYSC_cjs.useImpersonateStore();
8063
- const { mutateAsync } = chunkHBVSAOTQ_cjs.useStartImpersonation();
8064
- const recordClaimedTenant = chunkHBVSAOTQ_cjs.useRecordClaimedTenant();
8065
- const { data: _data } = chunkHBVSAOTQ_cjs.useGetProjects({ enabled: true });
8134
+ const { mutateAsync } = chunk3EGBCU4W_cjs.useStartImpersonation();
8135
+ const recordClaimedTenant = chunk3EGBCU4W_cjs.useRecordClaimedTenant();
8136
+ const { data: _data } = chunk3EGBCU4W_cjs.useGetProjects({ enabled: true });
8066
8137
  const { selectedProject, setSelectedProject, projects, setTenantGroup } = chunk6GCU5LM7_cjs.useProjectStore();
8067
8138
  const isTriggering = React8.useRef(false);
8068
8139
  const [isImpersonating, setIsImpersonating] = React8.useState(false);
@@ -8097,7 +8168,7 @@ function ImpersonationSynchronizer({
8097
8168
  ]);
8098
8169
  const getImpersonatedProject = async () => {
8099
8170
  try {
8100
- const res = chunkHBVSAOTQ_cjs.projectService.getProject();
8171
+ const res = chunk3EGBCU4W_cjs.projectService.getProject();
8101
8172
  return (await res).data;
8102
8173
  } catch (error) {
8103
8174
  console.error("Error fetching projects:", error);
@@ -8378,7 +8449,7 @@ var LoginHeader = ({
8378
8449
  }) => {
8379
8450
  const {
8380
8451
  config: { appLogoUrl }
8381
- } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state);
8452
+ } = chunk3EGBCU4W_cjs.useBlocksAppConfigStore((state) => state);
8382
8453
  const resolveLogo = (variant) => {
8383
8454
  if (!appLogoUrl) return void 0;
8384
8455
  if (typeof appLogoUrl === "string") return appLogoUrl;
@@ -9643,10 +9714,10 @@ var BlocksLoginPage = ({
9643
9714
  ] });
9644
9715
  };
9645
9716
  var LoginPage = () => {
9646
- const config = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.getConfig());
9647
- const { start, isLoading } = chunkHBVSAOTQ_cjs.useLogin();
9648
- const { canSignUp } = chunkHBVSAOTQ_cjs.useSignUpAffordance();
9649
- const { start: startSignUp, isLoading: isSignUpLoading } = chunkHBVSAOTQ_cjs.useSignUpRedirect();
9717
+ const config = chunk3EGBCU4W_cjs.useBlocksAppConfigStore((state) => state.getConfig());
9718
+ const { start, isLoading } = chunk3EGBCU4W_cjs.useLogin();
9719
+ const { canSignUp } = chunk3EGBCU4W_cjs.useSignUpAffordance();
9720
+ const { start: startSignUp, isLoading: isSignUpLoading } = chunk3EGBCU4W_cjs.useSignUpRedirect();
9650
9721
  return /* @__PURE__ */ jsxRuntime.jsx(
9651
9722
  BlocksLoginPage,
9652
9723
  {
@@ -9761,10 +9832,10 @@ var BentoCard = ({
9761
9832
  );
9762
9833
  var DefaultDoc = () => /* @__PURE__ */ jsxRuntime.jsx(BentoGrid, { children: resources.map((resource) => /* @__PURE__ */ jsxRuntime.jsx(BentoCard, { ...resource }, resource.url)) });
9763
9834
  function useCreateProjectRedirect() {
9764
- const { name } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.config);
9835
+ const { name } = chunk3EGBCU4W_cjs.useBlocksAppConfigStore((state) => state.config);
9765
9836
  const navigate = reactRouter.useNavigate();
9766
9837
  const osApp = filteredAppSwitcherData.find((app) => app.id === "blocks-os");
9767
- const { isFetching, isReady, redirect } = chunkHBVSAOTQ_cjs.usePrefetchRedirect({
9838
+ const { isFetching, isReady, redirect } = chunk3EGBCU4W_cjs.usePrefetchRedirect({
9768
9839
  clientId: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.clientId) : "",
9769
9840
  redirectUri: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.redirectUri) : "",
9770
9841
  forwardedTo: "/app/create-project",
@@ -9856,10 +9927,10 @@ function useProjectOverviewRedirect({
9856
9927
  tenantGroupId
9857
9928
  }) {
9858
9929
  const navigate = reactRouter.useNavigate();
9859
- const { name } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.config);
9930
+ const { name } = chunk3EGBCU4W_cjs.useBlocksAppConfigStore((state) => state.config);
9860
9931
  const osApp = filteredAppSwitcherData.find((app) => app.id === "blocks-os");
9861
9932
  const redirectedRoute = `/app/project/${tenantGroupId}/environments`;
9862
- const { isFetching, isReady, redirect } = chunkHBVSAOTQ_cjs.usePrefetchRedirect({
9933
+ const { isFetching, isReady, redirect } = chunk3EGBCU4W_cjs.usePrefetchRedirect({
9863
9934
  clientId: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.clientId) : "",
9864
9935
  redirectUri: osApp ? chunkX4YCRWXO_cjs.getRuntimeEnv(osApp.redirectUri) : "",
9865
9936
  forwardedTo: redirectedRoute,
@@ -10219,7 +10290,7 @@ function MultiSelect2({
10219
10290
  onChange,
10220
10291
  value: selectedValues
10221
10292
  }) {
10222
- const [buttonRef, popoverWidth] = chunkHBVSAOTQ_cjs.usePopoverWidth();
10293
+ const [buttonRef, popoverWidth] = chunk3EGBCU4W_cjs.usePopoverWidth();
10223
10294
  const onSelectHandler = (value) => {
10224
10295
  const nextValues = selectedValues.includes(value) ? selectedValues.filter((item) => item !== value) : [...selectedValues, value];
10225
10296
  onChange(nextValues);
@@ -10500,7 +10571,7 @@ var useProjectListState = (projectGroups) => {
10500
10571
  })),
10501
10572
  [projectGroups]
10502
10573
  );
10503
- const searchedGroups = chunkHBVSAOTQ_cjs.useDebouncedFuseFilter(
10574
+ const searchedGroups = chunk3EGBCU4W_cjs.useDebouncedFuseFilter(
10504
10575
  searchableGroups,
10505
10576
  searchText,
10506
10577
  SEARCH_OPTIONS
@@ -10570,8 +10641,8 @@ var SelfProjectLoading = ({ viewMode }) => {
10570
10641
  ) });
10571
10642
  };
10572
10643
  var SelfProject = ({ canCreateProject = false }) => {
10573
- const { data, isLoading, isFetching } = chunkHBVSAOTQ_cjs.useGetProjects({ enabled: true });
10574
- const isPending = isLoading || isFetching;
10644
+ const { data, isLoading } = chunk3EGBCU4W_cjs.useGetProjects({ enabled: true });
10645
+ const isPending = isLoading;
10575
10646
  const projectGroups = data || [];
10576
10647
  const {
10577
10648
  availableEnvironmentOptions,
@@ -10691,6 +10762,16 @@ var ConsolePage = ({ canCreateProject = false }) => {
10691
10762
  ] })
10692
10763
  ] });
10693
10764
  };
10765
+ var toSafeAppPath = (value) => {
10766
+ if (!value || !value.startsWith("/")) return null;
10767
+ try {
10768
+ const target = new URL(value, window.location.origin);
10769
+ if (target.origin !== window.location.origin) return null;
10770
+ return target.href;
10771
+ } catch {
10772
+ return null;
10773
+ }
10774
+ };
10694
10775
  var CallbackPage = ({ defaultRedirectUrl }) => {
10695
10776
  const [searchParams] = reactRouter.useSearchParams();
10696
10777
  const hasProcessed = React8.useRef(false);
@@ -10706,7 +10787,7 @@ var CallbackPage = ({ defaultRedirectUrl }) => {
10706
10787
  const idpBaseUrl = window.process?.env.userBaseUrl;
10707
10788
  const callbackUrl = new URL(`${idpBaseUrl}/api/idp/callback`);
10708
10789
  const tenantId = window.process?.env.BLOCKS_X_BLOCKS_KEY;
10709
- const appRedirectUrl = forwardTo || defaultRedirectUrl || "/";
10790
+ const appRedirectUrl = toSafeAppPath(forwardTo) || defaultRedirectUrl || "/";
10710
10791
  if (code) callbackUrl.searchParams.set("code", code);
10711
10792
  if (state) callbackUrl.searchParams.set("state", state);
10712
10793
  if (error) callbackUrl.searchParams.set("error", error);
@@ -10729,7 +10810,7 @@ var CallbackPage = ({ defaultRedirectUrl }) => {
10729
10810
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-screen items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader, { className: "h-12 w-12 animate-spin text-gray-500" }) });
10730
10811
  };
10731
10812
  function ProfilePage() {
10732
- const { isLoading, error } = chunkHBVSAOTQ_cjs.useInitiateRedirect({
10813
+ const { isLoading, error } = chunk3EGBCU4W_cjs.useInitiateRedirect({
10733
10814
  clientId: chunkX4YCRWXO_cjs.getRuntimeEnv("BLOCKS_IAM_CLIENT_ID"),
10734
10815
  redirectUri: chunkX4YCRWXO_cjs.getRuntimeEnv("BLOCKS_IAM_CALLBACK_URL"),
10735
10816
  forwardedTo: "/app/profile"
@@ -11007,8 +11088,8 @@ var ConfirmationModal = ({
11007
11088
  ] })
11008
11089
  ] });
11009
11090
  var DashboardOverview = () => {
11010
- const { name } = chunkHBVSAOTQ_cjs.useBlocksAppConfigStore((state) => state.config);
11011
- const { data, isFetching } = chunkHBVSAOTQ_cjs.useGetProject();
11091
+ const { name } = chunk3EGBCU4W_cjs.useBlocksAppConfigStore((state) => state.config);
11092
+ const { data, isFetching } = chunk3EGBCU4W_cjs.useGetProject();
11012
11093
  const {
11013
11094
  endpoints,
11014
11095
  isLoading: isLoadingEndpoints,
@@ -11102,11 +11183,11 @@ function ProjectList2({
11102
11183
  }) {
11103
11184
  const navigate = reactRouter.useNavigate();
11104
11185
  const { pathname } = reactRouter.useLocation();
11105
- const { data: projectGroups = [], isLoading } = chunkHBVSAOTQ_cjs.useGetProjects({
11186
+ const { data: projectGroups = [], isLoading } = chunk3EGBCU4W_cjs.useGetProjects({
11106
11187
  enabled: true
11107
11188
  });
11108
11189
  const { selectedProject, setSelectedProject } = chunk6GCU5LM7_cjs.useProjectStore();
11109
- const { data: projectData } = chunkHBVSAOTQ_cjs.useGetProject();
11190
+ const { data: projectData } = chunk3EGBCU4W_cjs.useGetProject();
11110
11191
  const pendingProjectRef = React8.useRef(null);
11111
11192
  const redirectRegexMap = React8.useMemo(
11112
11193
  () => Object.entries(redirectPaths).reduce(
@@ -11255,7 +11336,7 @@ var SetCustomDomainDialog = ({
11255
11336
  projectKey,
11256
11337
  projectEnv
11257
11338
  }) => {
11258
- const { mutateAsync, isPending } = chunkHBVSAOTQ_cjs.useUpdateRepositories();
11339
+ const { mutateAsync, isPending } = chunk3EGBCU4W_cjs.useUpdateRepositories();
11259
11340
  const verifiedDomains = React8.useMemo(
11260
11341
  () => Array.from(
11261
11342
  new Set(domains.filter((d) => d.isDomainVerified).map((d) => d.domain))
@@ -11439,7 +11520,7 @@ var ProjectRepoList = ({
11439
11520
  data: envRepositoriesResponse,
11440
11521
  isLoading: isLoadingEnvRepos,
11441
11522
  isFetching: isFetchingEnvRepos
11442
- } = chunkHBVSAOTQ_cjs.useGetEnvRepositories(project?.tenantId || "");
11523
+ } = chunk3EGBCU4W_cjs.useGetEnvRepositories(project?.tenantId || "");
11443
11524
  if (isLoading || isLoadingEnvRepos || isFetchingEnvRepos) {
11444
11525
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 rounded-lg border bg-card px-2 py-2 shadow-sm md:mt-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid-col-1 grid gap-3 px-2 py-4 md:grid-cols-2 md:gap-4 lg:gap-6", children: ["sk-1", "sk-2", "sk-3", "sk-4", "sk-5", "sk-6"].map((itemKey) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11445
11526
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-5 w-1/2" }),
@@ -11539,7 +11620,7 @@ var EditProjectForm = ({
11539
11620
  onAfterSubmit
11540
11621
  }) => {
11541
11622
  const queryClient = reactQuery.useQueryClient();
11542
- const { mutateAsync, isPending } = chunkHBVSAOTQ_cjs.useUpdateTenantGroup();
11623
+ const { mutateAsync, isPending } = chunk3EGBCU4W_cjs.useUpdateTenantGroup();
11543
11624
  const form = reactHookForm.useForm({
11544
11625
  resolver: zod$1.zodResolver(editProjectFormSchema),
11545
11626
  defaultValues: {
@@ -11560,6 +11641,7 @@ var EditProjectForm = ({
11560
11641
  description: "Project name updated successfully"
11561
11642
  });
11562
11643
  queryClient.invalidateQueries({ queryKey: ["identifier", "project"] });
11644
+ queryClient.invalidateQueries({ queryKey: ["identifier", "projects"] });
11563
11645
  form.reset();
11564
11646
  onAfterSubmit();
11565
11647
  } else {
@@ -11675,7 +11757,7 @@ function SidebarMobileView({
11675
11757
  navigationMenus
11676
11758
  }) {
11677
11759
  const [open, setOpen] = React8.useState(false);
11678
- const { appLightLogo, appDarkLogo } = chunkHBVSAOTQ_cjs.useLogo();
11760
+ const { appLightLogo, appDarkLogo } = chunk3EGBCU4W_cjs.useLogo();
11679
11761
  const allowedMenu = chunkBPJM3L7O_cjs.useFilteredMenus(navigationMenus);
11680
11762
  return /* @__PURE__ */ jsxRuntime.jsxs(Sheet, { open, onOpenChange: setOpen, children: [
11681
11763
  /* @__PURE__ */ jsxRuntime.jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "icon", className: "shrink-0", children: [
@@ -11725,8 +11807,8 @@ function SidebarMenuDesktop({
11725
11807
  navigationMenus
11726
11808
  }) {
11727
11809
  const { isSidebarOpen, toggleSidebar } = React8.useContext(chunkIJMKS4XG_cjs.SidebarContext);
11728
- const { appLightLogo, appDarkLogo } = chunkHBVSAOTQ_cjs.useLogo();
11729
- const icon = chunkHBVSAOTQ_cjs.useIcon();
11810
+ const { appLightLogo, appDarkLogo } = chunk3EGBCU4W_cjs.useLogo();
11811
+ const icon = chunk3EGBCU4W_cjs.useIcon();
11730
11812
  const allowedMenu = chunkBPJM3L7O_cjs.useFilteredMenus(navigationMenus);
11731
11813
  const { isActivePath: isProjectOverviewRoute } = chunkBPJM3L7O_cjs.useIsActiveMenu("/app/project");
11732
11814
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -11855,7 +11937,7 @@ var ErrorBoundary = class extends React8.Component {
11855
11937
  var ArchiveProject = () => {
11856
11938
  const navigate = reactRouter.useNavigate();
11857
11939
  const projectKey = chunk6GCU5LM7_cjs.useProjectStore().selectedProject?.tenantId || "";
11858
- const { mutateAsync, isPending } = chunkHBVSAOTQ_cjs.useDisableProject({ projectKey });
11940
+ const { mutateAsync, isPending } = chunk3EGBCU4W_cjs.useDisableProject({ projectKey });
11859
11941
  const onClickHandler = async () => {
11860
11942
  try {
11861
11943
  const res = await mutateAsync();
@@ -12825,7 +12907,7 @@ var ClearButton = ({ onClear }) => {
12825
12907
  };
12826
12908
  function Radio({ label, options, onChange, value }) {
12827
12909
  const [search, setSearch] = React8.useState("");
12828
- const [buttonRef, popoverWidth] = chunkHBVSAOTQ_cjs.usePopoverWidth();
12910
+ const [buttonRef, popoverWidth] = chunk3EGBCU4W_cjs.usePopoverWidth();
12829
12911
  const isMobile = chunkBPJM3L7O_cjs.useIsMobile();
12830
12912
  const selected = React8.useMemo(
12831
12913
  () => options.find((item) => item.value === value) || null,
@@ -13834,5 +13916,5 @@ exports.usePaginationQueryParams = usePaginationQueryParams;
13834
13916
  exports.useRightSidePanel = useRightSidePanel;
13835
13917
  exports.useSortQueryParams = useSortQueryParams;
13836
13918
  exports.useWizardStepper = useWizardStepper;
13837
- //# sourceMappingURL=chunk-DXITHNQR.cjs.map
13838
- //# sourceMappingURL=chunk-DXITHNQR.cjs.map
13919
+ //# sourceMappingURL=chunk-MYTS3R4F.cjs.map
13920
+ //# sourceMappingURL=chunk-MYTS3R4F.cjs.map