@burdenoff/microfe-auth 2026.1031.1 → 2026.1101.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.
Files changed (135) hide show
  1. package/dist/auth/AuthRoot.js +14 -11
  2. package/dist/auth/AuthRoot.js.map +1 -1
  3. package/dist/auth/AuthRoutes.js +1 -2
  4. package/dist/auth/AuthRoutes.js.map +1 -1
  5. package/dist/auth/components/AuthIcons.js +1 -2
  6. package/dist/auth/components/AuthIcons.js.map +1 -1
  7. package/dist/auth/components/AuthLayout.js +1 -2
  8. package/dist/auth/components/AuthLayout.js.map +1 -1
  9. package/dist/auth/components/CaptchaV2.js +9 -10
  10. package/dist/auth/components/CaptchaV2.js.map +1 -1
  11. package/dist/auth/components/ConfirmActionDialog.js +1 -2
  12. package/dist/auth/components/ConfirmActionDialog.js.map +1 -1
  13. package/dist/auth/components/profile/UserProfileMenu.js +7 -6
  14. package/dist/auth/components/profile/UserProfileMenu.js.map +1 -1
  15. package/dist/auth/components/workspace/WorkspaceSelector.js +1 -2
  16. package/dist/auth/components/workspace/WorkspaceSelector.js.map +1 -1
  17. package/dist/auth/constants/permissions.js +1 -2
  18. package/dist/auth/constants/permissions.js.map +1 -1
  19. package/dist/auth/constants/sessionKeys.js +1 -2
  20. package/dist/auth/constants/sessionKeys.js.map +1 -1
  21. package/dist/auth/hooks/contextDeepLink.js +1 -2
  22. package/dist/auth/hooks/contextDeepLink.js.map +1 -1
  23. package/dist/auth/hooks/index.js +12 -11
  24. package/dist/auth/hooks/useAccountOperations.js +1 -2
  25. package/dist/auth/hooks/useAccountOperations.js.map +1 -1
  26. package/dist/auth/hooks/useActiveContextBootstrapMirror.js +1 -2
  27. package/dist/auth/hooks/useActiveContextBootstrapMirror.js.map +1 -1
  28. package/dist/auth/hooks/useAuthOperations.js +37 -37
  29. package/dist/auth/hooks/useAuthOperations.js.map +1 -1
  30. package/dist/auth/hooks/useAuthPermissions.js +1 -2
  31. package/dist/auth/hooks/useAuthPermissions.js.map +1 -1
  32. package/dist/auth/hooks/useCaptchaV3.js +1 -2
  33. package/dist/auth/hooks/useCaptchaV3.js.map +1 -1
  34. package/dist/auth/hooks/useContextSwitcherData.js +86 -79
  35. package/dist/auth/hooks/useContextSwitcherData.js.map +1 -1
  36. package/dist/auth/hooks/useMfaOperations.js +4 -5
  37. package/dist/auth/hooks/useMfaOperations.js.map +1 -1
  38. package/dist/auth/hooks/useMyWorkspaces.js +4 -5
  39. package/dist/auth/hooks/useMyWorkspaces.js.map +1 -1
  40. package/dist/auth/hooks/useOAuthOperations.js +11 -12
  41. package/dist/auth/hooks/useOAuthOperations.js.map +1 -1
  42. package/dist/auth/hooks/usePasswordOperations.js +1 -2
  43. package/dist/auth/hooks/usePasswordOperations.js.map +1 -1
  44. package/dist/auth/hooks/useSessionOperations.js +3 -4
  45. package/dist/auth/hooks/useSessionOperations.js.map +1 -1
  46. package/dist/auth/hooks/useSignupCaptcha.js +1 -2
  47. package/dist/auth/hooks/useSignupCaptcha.js.map +1 -1
  48. package/dist/auth/hooks/useSsoOperations.js +80 -81
  49. package/dist/auth/hooks/useSsoOperations.js.map +1 -1
  50. package/dist/auth/hooks/useTokenRefresh.js +8 -12
  51. package/dist/auth/hooks/useTokenRefresh.js.map +1 -1
  52. package/dist/auth/hooks/useUserOperations.js +1 -2
  53. package/dist/auth/hooks/useUserOperations.js.map +1 -1
  54. package/dist/auth/hooks/useWorkspaceOperations.js +1 -2
  55. package/dist/auth/hooks/useWorkspaceOperations.js.map +1 -1
  56. package/dist/auth/hooks/useWorkspaceToken.js +1 -2
  57. package/dist/auth/hooks/useWorkspaceToken.js.map +1 -1
  58. package/dist/auth/index.js +19 -18
  59. package/dist/auth/pages/AuditLogPage.js +21 -22
  60. package/dist/auth/pages/AuditLogPage.js.map +1 -1
  61. package/dist/auth/pages/EmailVerifyPage.js +15 -17
  62. package/dist/auth/pages/EmailVerifyPage.js.map +1 -1
  63. package/dist/auth/pages/LoginPage.js +89 -105
  64. package/dist/auth/pages/LoginPage.js.map +1 -1
  65. package/dist/auth/pages/MagicLinkPage.js +30 -31
  66. package/dist/auth/pages/MagicLinkPage.js.map +1 -1
  67. package/dist/auth/pages/MfaSetupPage.js +18 -20
  68. package/dist/auth/pages/MfaSetupPage.js.map +1 -1
  69. package/dist/auth/pages/MfaVerifyPage.js +31 -35
  70. package/dist/auth/pages/MfaVerifyPage.js.map +1 -1
  71. package/dist/auth/pages/OAuthCallbackPage.js +4 -11
  72. package/dist/auth/pages/OAuthCallbackPage.js.map +1 -1
  73. package/dist/auth/pages/PasswordResetPage.js +20 -23
  74. package/dist/auth/pages/PasswordResetPage.js.map +1 -1
  75. package/dist/auth/pages/ReactivatePage.js +14 -18
  76. package/dist/auth/pages/ReactivatePage.js.map +1 -1
  77. package/dist/auth/pages/RegisterPage.js +180 -181
  78. package/dist/auth/pages/RegisterPage.js.map +1 -1
  79. package/dist/auth/pages/SSOClearPage.js +9 -10
  80. package/dist/auth/pages/SSOClearPage.js.map +1 -1
  81. package/dist/auth/pages/SSODepositPage.js +9 -13
  82. package/dist/auth/pages/SSODepositPage.js.map +1 -1
  83. package/dist/auth/pages/SSORelayCallbackPage.js +3 -7
  84. package/dist/auth/pages/SSORelayCallbackPage.js.map +1 -1
  85. package/dist/auth/pages/SSORelayPage.js +11 -10
  86. package/dist/auth/pages/SSORelayPage.js.map +1 -1
  87. package/dist/auth/pages/SecurityPage.js +19 -21
  88. package/dist/auth/pages/SecurityPage.js.map +1 -1
  89. package/dist/auth/pages/SessionBridgePage.js +9 -16
  90. package/dist/auth/pages/SessionBridgePage.js.map +1 -1
  91. package/dist/auth/pages/SessionsPage.js +17 -18
  92. package/dist/auth/pages/SessionsPage.js.map +1 -1
  93. package/dist/auth/pages/SsoCallbackPage.js +17 -22
  94. package/dist/auth/pages/SsoCallbackPage.js.map +1 -1
  95. package/dist/auth/pages/SsoConfigPage.js +69 -69
  96. package/dist/auth/pages/SsoConfigPage.js.map +1 -1
  97. package/dist/auth/pages/SsoLoginPage.js +9 -10
  98. package/dist/auth/pages/SsoLoginPage.js.map +1 -1
  99. package/dist/auth/pages/UserDetailsPage.js +16 -23
  100. package/dist/auth/pages/UserDetailsPage.js.map +1 -1
  101. package/dist/auth/pages/UserProfilePage.js +140 -141
  102. package/dist/auth/pages/UserProfilePage.js.map +1 -1
  103. package/dist/auth/pages/UsersPage.js +446 -453
  104. package/dist/auth/pages/UsersPage.js.map +1 -1
  105. package/dist/auth/providers/AuthProvider.js +1 -2
  106. package/dist/auth/providers/AuthProvider.js.map +1 -1
  107. package/dist/auth/providers/CaptchaProvider.js +1 -2
  108. package/dist/auth/providers/CaptchaProvider.js.map +1 -1
  109. package/dist/auth/store/authStore.js +5 -12
  110. package/dist/auth/store/authStore.js.map +1 -1
  111. package/dist/auth/utils/captchaConfig.js +5 -8
  112. package/dist/auth/utils/captchaConfig.js.map +1 -1
  113. package/dist/auth/utils/formatters.js +1 -2
  114. package/dist/auth/utils/formatters.js.map +1 -1
  115. package/dist/auth/utils/gatewayBaseUrls.js +1 -2
  116. package/dist/auth/utils/gatewayBaseUrls.js.map +1 -1
  117. package/dist/auth/utils/legalUrls.js +2 -3
  118. package/dist/auth/utils/legalUrls.js.map +1 -1
  119. package/dist/auth/utils/redirect.js +1 -2
  120. package/dist/auth/utils/redirect.js.map +1 -1
  121. package/dist/auth/utils/ssoOrigins.js +2 -3
  122. package/dist/auth/utils/ssoOrigins.js.map +1 -1
  123. package/dist/auth/utils/validation.js +34 -36
  124. package/dist/auth/utils/validation.js.map +1 -1
  125. package/dist/generated/global-operations.js +2 -3
  126. package/dist/generated/global-operations.js.map +1 -1
  127. package/dist/generated/wspace-operations.js +2 -3
  128. package/dist/generated/wspace-operations.js.map +1 -1
  129. package/dist/microfe-auth.css +1 -1
  130. package/dist/shared/hooks/useTr.js +1 -2
  131. package/dist/shared/hooks/useTr.js.map +1 -1
  132. package/dist/translations/en.js +1 -2
  133. package/dist/translations/en.js.map +1 -1
  134. package/dist/utils/nativeBridge.js +1 -2
  135. package/package.json +7 -3
@@ -8,8 +8,8 @@ import { getStoredAuthToken as d, graphqlFetch as f } from "@burdenoff/fe-libs/s
8
8
  import { clearWorkspaceWideSelection as p, isWorkspaceWideSelection as m, selectWorkspaceWide as h } from "@burdenoff/fe-libs/shared/providers/shell/WorkspaceWideSelection";
9
9
  import { getUrlParam as g } from "@burdenoff/fe-libs/shared/providers/shell/ActiveContextStorage";
10
10
  import { useActiveContext as _ } from "@burdenoff/fe-libs/shared/providers/shell/ActiveContextProvider";
11
- //#region src/auth/hooks/useContextSwitcherData.ts
12
- var v = "\n query MyOrganizations {\n myOrganizations {\n total\n items {\n id\n name\n slug\n tenantId\n description\n logo\n website\n status\n type\n createdAt\n updatedAt\n }\n }\n }\n", y = "\n query WorkspacesByOrg {\n workspaces: myWorkspaces(limit: 100) {\n total\n items {\n id\n name\n slug\n tenantId\n organizationId\n type\n status\n region\n createdAt\n updatedAt\n }\n }\n }\n", b = "\n query MyWorkspacesPage($limit: Int, $offset: Int) {\n workspaces: myWorkspaces(limit: $limit, offset: $offset) {\n total\n items {\n id\n name\n slug\n tenantId\n organizationId\n type\n status\n region\n createdAt\n updatedAt\n }\n }\n }\n", x = new Set(["NOT_PROJECT_MEMBER", "PROJECT_NOT_FOUND"]);
11
+ // src/auth/hooks/useContextSwitcherData.ts
12
+ var v = "\n query MyOrganizations {\n myOrganizations {\n total\n items {\n id\n name\n slug\n tenantId\n description\n logo\n website\n status\n type\n createdAt\n updatedAt\n }\n }\n }\n", y = "\n query WorkspacesByOrg {\n workspaces: myWorkspaces(limit: 100) {\n total\n items {\n id\n name\n slug\n tenantId\n organizationId\n type\n status\n region\n createdAt\n updatedAt\n }\n }\n }\n", b = "\n query MyWorkspacesPage($limit: Int, $offset: Int) {\n workspaces: myWorkspaces(limit: $limit, offset: $offset) {\n total\n items {\n id\n name\n slug\n tenantId\n organizationId\n type\n status\n region\n createdAt\n updatedAt\n }\n }\n }\n", x = /* @__PURE__ */ new Set(["NOT_PROJECT_MEMBER", "PROJECT_NOT_FOUND"]);
13
13
  function S(e) {
14
14
  return !!e && x.has(e);
15
15
  }
@@ -86,13 +86,13 @@ function M(e) {
86
86
  tenantId: e.find((e) => e.organizationId === t)?.tenantId || ""
87
87
  }));
88
88
  }
89
- var N = new Set([
89
+ var N = /* @__PURE__ */ new Set([
90
90
  "project.created",
91
91
  "project.updated",
92
92
  "project.deleted",
93
93
  "project.archived",
94
94
  "project.unarchived"
95
- ]), P = new Set([
95
+ ]), P = /* @__PURE__ */ new Set([
96
96
  "workspace.created",
97
97
  "workspace.updated",
98
98
  "workspace.deleted",
@@ -106,44 +106,44 @@ function F(e) {
106
106
  }
107
107
  }
108
108
  function I(d) {
109
- let { organizationId: b, workspaceId: x, projectId: S, tenantId: C, setContext: w } = _(), T = u(), E = e((e) => e.organizations), I = e((e) => e.currentOrganizationId), L = e((e) => e.isLoadingOrganizations), R = e((e) => e.workspaces), ne = e((e) => e.currentWorkspaceId), re = e((e) => e.workspaceToken), ie = e((e) => e.isLoadingWorkspaces), ae = e((e) => e.projects), z = e((e) => e.currentProjectId), B = e((e) => e.isLoadingProjects);
109
+ let b = d?.disableBootstrap ?? !1, x = d?.disableWorkspaceSync ?? !1, S = d?.disableProjectSync ?? !1, C = d?.skipProjectFetch ?? !1, { organizationId: w, workspaceId: T, projectId: E, tenantId: I, setContext: L } = _(), R = u(), z = e((e) => e.organizations), ne = e((e) => e.currentOrganizationId), re = e((e) => e.isLoadingOrganizations), B = e((e) => e.workspaces), ie = e((e) => e.currentWorkspaceId), ae = e((e) => e.workspaceToken), oe = e((e) => e.isLoadingWorkspaces), se = e((e) => e.projects), ce = e((e) => e.currentProjectId), le = e((e) => e.isLoadingProjects);
110
110
  o(() => {
111
- let e = R.find((e) => e.id === x && e.organizationId === b), t = E.find((e) => e.id === b);
112
- !e || !t || !/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(e.tenantId) || e.tenantId !== t.tenantId || C === e.tenantId || w({ tenantId: e.tenantId });
111
+ let e = B.find((e) => e.id === T && e.organizationId === w), t = z.find((e) => e.id === w);
112
+ e && t && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(e.tenantId) && e.tenantId === t.tenantId && I !== e.tenantId && L({ tenantId: e.tenantId });
113
113
  }, [
114
- b,
115
- x,
116
- C,
117
- E,
118
- R,
119
- w
114
+ w,
115
+ T,
116
+ I,
117
+ z,
118
+ B,
119
+ L
120
120
  ]);
121
- let [oe, V] = c(null), [se, H] = c(0), U = s(0), W = s(null), G = s(/* @__PURE__ */ new Map()), K = s(x), q = s(b);
121
+ let [ue, V] = c(null), [de, H] = c(0), U = s(0), W = s(null), G = s(/* @__PURE__ */ new Map()), K = s(T), q = s(w);
122
122
  o(() => {
123
- K.current = x, q.current = b;
123
+ K.current = T, q.current = w;
124
124
  });
125
- let ce = t(), J = d?.globalBaseUrl ?? ce.globalBaseUrl, Y = d?.workspaceBaseUrl ?? ce.workspaceBaseUrl, le = s(null), ue = s(null), de = s(null), fe = s(null);
125
+ let fe = t(), J = d?.globalBaseUrl ?? fe.globalBaseUrl, Y = d?.workspaceBaseUrl ?? fe.workspaceBaseUrl, pe = s(null), me = s(null), he = s(null), ge = s(null);
126
126
  o(() => {
127
127
  let t = e.getState();
128
- if (b && b !== t.currentOrganizationId && b !== le.current && (le.current = b, t.setCurrentOrganizationId(b), t.workspaces.length > 0 && !t.workspaces.some((e) => e.organizationId === b) && t.setWorkspaces([])), x && x !== t.currentWorkspaceId && x !== ue.current && (ue.current = x, t.setCurrentWorkspaceId(x), t.projects.length > 0 && !t.projects.some((e) => e.workspaceId === x) && (t.setProjects([]), t.setCurrentProjectId(null))), m({
129
- organizationId: b,
130
- workspaceId: x
131
- }) && !S && t.currentProjectId && (t.setCurrentProjectId(null), t.setWorkspaceToken(null)), S && S !== t.currentProjectId && S !== de.current && (de.current = S, t.setCurrentProjectId(S)), t.workspaceToken && !D(t.workspaceToken, {
132
- workspaceId: x,
133
- organizationId: b,
134
- projectId: S,
135
- workspaceWide: !S && m({
136
- organizationId: b,
137
- workspaceId: x
128
+ if (w && w !== t.currentOrganizationId && w !== pe.current && (pe.current = w, t.setCurrentOrganizationId(w), t.workspaces.length > 0 && !t.workspaces.some((e) => e.organizationId === w) && t.setWorkspaces([])), T && T !== t.currentWorkspaceId && T !== me.current && (me.current = T, t.setCurrentWorkspaceId(T), t.projects.length > 0 && !t.projects.some((e) => e.workspaceId === T) && (t.setProjects([]), t.setCurrentProjectId(null))), m({
129
+ organizationId: w,
130
+ workspaceId: T
131
+ }) && !E && t.currentProjectId && (t.setCurrentProjectId(null), t.setWorkspaceToken(null)), E && E !== t.currentProjectId && E !== he.current && (he.current = E, t.setCurrentProjectId(E)), t.workspaceToken && !D(t.workspaceToken, {
132
+ workspaceId: T,
133
+ organizationId: w,
134
+ projectId: E,
135
+ workspaceWide: !E && m({
136
+ organizationId: w,
137
+ workspaceId: T
138
138
  })
139
139
  })) {
140
- let e = `${b ?? ""}|${x ?? ""}|${S ?? ""}`;
141
- fe.current !== e && (fe.current = e, t.setWorkspaceToken(null));
140
+ let e = `${w ?? ""}|${T ?? ""}|${E ?? ""}`;
141
+ ge.current !== e && (ge.current = e, t.setWorkspaceToken(null));
142
142
  }
143
143
  }, [
144
- b,
145
- x,
146
- S
144
+ w,
145
+ T,
146
+ E
147
147
  ]);
148
148
  let X = a(async () => {
149
149
  if (W.current) return W.current;
@@ -219,7 +219,7 @@ function I(d) {
219
219
  });
220
220
  if (b.kind === "switch") {
221
221
  let e = b.workspace;
222
- h = e.organizationId, w({
222
+ h = e.organizationId, L({
223
223
  organizationId: e.organizationId,
224
224
  workspaceId: e.id,
225
225
  tenantId: e.tenantId || null,
@@ -234,7 +234,7 @@ function I(d) {
234
234
  e && t.setContextLinkDenial(e);
235
235
  }
236
236
  let x = h && d.some((e) => e.id === h);
237
- if (h && !x && d.length > 0 && (h = d[0].id, w({
237
+ if (h && !x && d.length > 0 && (h = d[0].id, L({
238
238
  organizationId: h,
239
239
  workspaceId: null,
240
240
  tenantId: null,
@@ -259,7 +259,7 @@ function I(d) {
259
259
  tenantId: e[0].tenantId,
260
260
  projectId: null
261
261
  };
262
- K.current ? (t.setCurrentWorkspaceId(e[0].id), t.setWorkspaceToken(null), w(n)) : t.currentWorkspaceId || (t.setCurrentWorkspaceId(e[0].id), w(n));
262
+ K.current ? (t.setCurrentWorkspaceId(e[0].id), t.setWorkspaceToken(null), L(n)) : t.currentWorkspaceId || (t.setCurrentWorkspaceId(e[0].id), L(n));
263
263
  }
264
264
  }
265
265
  } catch {
@@ -281,9 +281,9 @@ function I(d) {
281
281
  t.setLoadingOrganizations(!1), W.current = null;
282
282
  }
283
283
  })(), W.current) : [];
284
- }, [J, w]);
284
+ }, [J, L]);
285
285
  o(() => {
286
- if (se === 0 || U.current >= 5 || !A()) return;
286
+ if (b || de === 0 || U.current >= 5 || !A()) return;
287
287
  U.current += 1;
288
288
  let e = Math.min(1500 * 2 ** (U.current - 1), 12e3), t = window.setTimeout(() => {
289
289
  X();
@@ -291,14 +291,19 @@ function I(d) {
291
291
  return () => {
292
292
  window.clearTimeout(t);
293
293
  };
294
- }, [se, X]), o(() => {
294
+ }, [
295
+ b,
296
+ de,
297
+ X
298
+ ]), o(() => {
299
+ if (b) return;
295
300
  let t = () => {
296
301
  e.getState().organizations.length === 0 && A() && (U.current = 0, X());
297
302
  };
298
303
  return window.addEventListener("online", t), () => {
299
304
  window.removeEventListener("online", t);
300
305
  };
301
- }, [X]);
306
+ }, [b, X]);
302
307
  let Z = a(async (t) => {
303
308
  let n = e.getState(), r = A(), i = l(), a = n.user?.id, o = JSON.stringify([
304
309
  i,
@@ -362,7 +367,11 @@ function I(d) {
362
367
  } },
363
368
  authToken: c,
364
369
  baseUrl: Y,
365
- tenantId: i
370
+ tenantId: i,
371
+ workspaceId: n,
372
+ organizationId: t,
373
+ projectId: r ?? void 0,
374
+ workspaceToken: !1
366
375
  });
367
376
  if (p.errors?.length) {
368
377
  let e = p.errors[0]?.message ?? "GraphQL error";
@@ -443,10 +452,10 @@ function I(d) {
443
452
  } finally {
444
453
  t.setLoadingProjects(!1);
445
454
  }
446
- }, [Y]), pe = a(async (t) => {
455
+ }, [Y]), _e = a(async (t) => {
447
456
  let n = e.getState();
448
457
  return n.setContextLinkDenial(null), n.setCurrentWorkspaceId(null), n.setWorkspaceToken(null), n.setProjects([]), n.setCurrentProjectId(null), n.setCurrentOrganizationId(t.id), await Z(t.id);
449
- }, [Z]), me = a(async (t) => {
458
+ }, [Z]), ve = a(async (t) => {
450
459
  let n = e.getState();
451
460
  if (n.setContextLinkDenial(null), n.setCurrentProjectId(null), n.setProjects([]), !t.organizationId) return console.error("Workspace missing organizationId:", t), {
452
461
  success: !1,
@@ -477,7 +486,7 @@ function I(d) {
477
486
  success: !1,
478
487
  error: "Context changed during selection"
479
488
  };
480
- }, [Q, $]), he = a((t) => {
489
+ }, [Q, $]), ye = a((t) => {
481
490
  let n = e.getState();
482
491
  p({
483
492
  organizationId: n.currentOrganizationId,
@@ -487,73 +496,72 @@ function I(d) {
487
496
  organizationId: n.currentOrganizationId,
488
497
  projectId: t.id
489
498
  }) && n.setWorkspaceToken(null);
490
- }, []), ge = a(() => {
499
+ }, []), be = a(() => {
491
500
  let t = e.getState(), n = {
492
501
  organizationId: q.current,
493
502
  workspaceId: K.current
494
503
  };
495
504
  if (!n.organizationId || !n.workspaceId || t.currentOrganizationId !== n.organizationId || t.currentWorkspaceId !== n.workspaceId) throw Error("Current workspace context required");
496
505
  if (!h(n)) throw Error("Workspace-wide preference could not be saved");
497
- t.setCurrentProjectId(null), t.setWorkspaceToken(null), w({ projectId: null });
498
- }, [w]);
506
+ t.setCurrentProjectId(null), t.setWorkspaceToken(null), L({ projectId: null });
507
+ }, [L]);
499
508
  return o(() => {
500
509
  let t = !1, n = (e) => {
501
510
  let n = !1, r = !1, i = () => {
502
- if (!t) {
503
- if (n) {
504
- r = !0;
505
- return;
506
- }
507
- n = !0, e().finally(() => {
508
- n = !1, !t && r && (r = !1, i());
509
- });
510
- }
511
+ t || (n ? r = !0 : (n = !0, e().finally(() => {
512
+ n = !1, !t && r && (r = !1, i());
513
+ })));
511
514
  };
512
515
  return i;
513
516
  }, r = n(() => $()), i = n(() => {
514
517
  let t = e.getState().currentOrganizationId;
515
518
  return t ? Z(t) : Promise.resolve();
516
- }), a = T.onAny((t) => {
519
+ }), a = R.onAny((t) => {
517
520
  let n = t.name;
518
521
  if (N.has(n)) {
522
+ if (S || C) return;
519
523
  let n = F(t.payload), { currentWorkspaceId: i } = e.getState();
520
524
  if (n && i && n !== i) return;
521
525
  r();
522
- return;
526
+ } else if (P.has(n)) {
527
+ if (x) return;
528
+ i();
523
529
  }
524
- P.has(n) && i();
525
530
  });
526
531
  return () => {
527
532
  t = !0, a();
528
533
  };
529
534
  }, [
530
- T,
535
+ R,
531
536
  $,
532
- Z
537
+ Z,
538
+ x,
539
+ S,
540
+ C
533
541
  ]), {
534
- organizations: E,
535
- workspaces: R,
536
- projects: ae,
537
- currentOrganizationId: I,
538
- currentWorkspaceId: ne,
539
- currentProjectId: z,
540
- currentOrganization: E.find((e) => e.id === I),
541
- currentWorkspace: R.find((e) => e.id === ne),
542
- currentProject: ae.find((e) => e.id === z),
543
- workspaceToken: re,
544
- isLoadingOrganizations: L,
545
- isLoadingWorkspaces: ie,
546
- isLoadingProjects: B,
547
- isLoading: L || ie || B,
548
- error: oe,
542
+ organizations: z,
543
+ workspaces: B,
544
+ projects: se,
545
+ currentOrganizationId: ne,
546
+ currentWorkspaceId: ie,
547
+ currentProjectId: ce,
548
+ currentOrganization: z.find((e) => e.id === ne),
549
+ currentWorkspace: B.find((e) => e.id === ie),
550
+ currentProject: se.find((e) => e.id === ce),
551
+ workspaceToken: ae,
552
+ isLoadingOrganizations: re,
553
+ isLoadingWorkspaces: oe,
554
+ isLoadingProjects: le,
555
+ isLoading: re || oe || le,
556
+ error: ue,
549
557
  fetchOrganizations: X,
550
558
  fetchWorkspacesForOrg: Z,
551
559
  issueWorkspaceToken: Q,
552
560
  fetchProjects: $,
553
- selectOrganization: pe,
554
- selectWorkspace: me,
555
- selectProject: he,
556
- selectWorkspaceWide: ge
561
+ selectOrganization: _e,
562
+ selectWorkspace: ve,
563
+ selectProject: ye,
564
+ selectWorkspaceWide: be
557
565
  };
558
566
  }
559
567
  function L(n) {
@@ -733,7 +741,6 @@ function R(n) {
733
741
  };
734
742
  }, []);
735
743
  }
736
- //#endregion
737
744
  export { I as useContextSwitcherData, R as useProjectSyncEffect, L as useWorkspaceSyncEffect };
738
745
 
739
746
  //# sourceMappingURL=useContextSwitcherData.js.map