@burdenoff/fe-libs 2026.1013.14 → 2026.1014.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,152 +1,147 @@
1
- import { getActiveProfileId as e, getProfileTokens as t, getProfileUser as n, getProfileWorkspaceToken as r, getProfiles as i, resolveActiveProfileId as a } from "./ProfileStorageManager.js";
2
- import { readShellSsoCookie as o } from "../../utils/authCookie.js";
3
- import { useBridgeInitialization as ee } from "./authProvider/useBridgeInitialization.js";
4
- import { useTokenExpiryTimer as te } from "./authProvider/useTokenExpiryTimer.js";
5
- import { useStorageSync as s } from "./authProvider/useStorageSync.js";
6
- import { useRemoteSLO as c } from "./authProvider/useRemoteSLO.js";
7
- import { useAuthActions as l } from "./authProvider/useAuthActions.js";
8
- import { useSsoDepositBootGuard as u } from "./authProvider/useSsoDepositBootGuard.js";
9
- import { createContext as d, use as f, useCallback as p, useMemo as m, useRef as h, useState as g } from "react";
10
- import { jsx as _ } from "react/jsx-runtime";
1
+ import { getActiveProfileId as e, getProfileTokens as t, getProfileUser as n, getProfileWorkspaceToken as ee, getSwitchableProfiles as r, resolveActiveProfileId as te } from "./ProfileStorageManager.js";
2
+ import { readShellSsoCookie as i } from "../../utils/authCookie.js";
3
+ import { useBridgeInitialization as a } from "./authProvider/useBridgeInitialization.js";
4
+ import { useTokenExpiryTimer as o } from "./authProvider/useTokenExpiryTimer.js";
5
+ import { useStorageSync as ne } from "./authProvider/useStorageSync.js";
6
+ import { useRemoteSLO as s } from "./authProvider/useRemoteSLO.js";
7
+ import { useAuthActions as c } from "./authProvider/useAuthActions.js";
8
+ import { useSsoDepositBootGuard as l } from "./authProvider/useSsoDepositBootGuard.js";
9
+ import { createContext as u, use as d, useCallback as f, useMemo as p, useRef as m, useState as h } from "react";
10
+ import { jsx as g } from "react/jsx-runtime";
11
11
  //#region src/shared/providers/shell/AuthProvider.tsx
12
- var v = d(null);
13
- function y({ children: d, onTokenExpired: f, onSessionExpiringSoon: y, onRefreshToken: b, bridgeUrl: x, bridgeAllowedOrigins: S, bridgeDebug: C, onBridgeReady: w }) {
14
- let T = h(!1), [E, D] = g(() => a()), [O, k] = g(() => E ? n(E) : null), [A, j] = g(() => E ? t(E) : null), [M, N] = g(() => E ? r(E) : null), [P, F] = g(() => {
15
- if (E && n(E)) return !1;
16
- if (x) try {
17
- let e = o()?.id ?? null;
12
+ var _ = u(null);
13
+ function v(e) {
14
+ return r(e).map((t) => ({
15
+ id: t.id,
16
+ email: t.email,
17
+ name: t.name,
18
+ avatar: t.avatar,
19
+ isActive: t.id === e,
20
+ lastLogin: t.lastLogin
21
+ }));
22
+ }
23
+ function y({ children: r, onTokenExpired: u, onSessionExpiringSoon: d, onRefreshToken: y, bridgeUrl: b, bridgeAllowedOrigins: x, bridgeDebug: S, onBridgeReady: C }) {
24
+ let w = m(!1), [T, E] = h(() => te()), [D, O] = h(() => T ? n(T) : null), [k, A] = h(() => T ? t(T) : null), [j, M] = h(() => T ? ee(T) : null), [N, P] = h(() => {
25
+ if (T && n(T)) return !1;
26
+ if (b) try {
27
+ let e = i()?.id ?? null;
18
28
  if (e && localStorage.getItem(`bf-p-${e}-tokens`)) return !1;
19
29
  } catch {}
20
- return !!x;
21
- }), [I, ne] = g(!1), [L, re] = g(null), [R, z] = g(() => i().map((e) => ({
22
- id: e.id,
23
- email: e.email,
24
- name: e.name,
25
- avatar: e.avatar,
26
- isActive: e.id === E,
27
- lastLogin: e.lastLogin
28
- }))), B = p(() => {
30
+ return !!b;
31
+ }), [F, I] = h(!1), [L, re] = h(null), [R, z] = h(() => v(T)), B = f(() => {
29
32
  z([]);
30
- }, []), V = p(() => {
31
- let t = e();
32
- z(i().map((e) => ({
33
- id: e.id,
34
- email: e.email,
35
- name: e.name,
36
- avatar: e.avatar,
37
- isActive: e.id === t,
38
- lastLogin: e.lastLogin
39
- })));
33
+ }, []), V = f(() => {
34
+ z(v(e()));
40
35
  }, []);
41
- ee({
42
- bridgeUrl: x,
43
- bridgeAllowedOrigins: S,
44
- bridgeDebug: C,
45
- onBridgeReady: w,
46
- bridgeSyncInProgress: T,
47
- setIsLoading: F,
48
- setActiveId: D,
49
- setUser: k,
50
- setTokens: j,
51
- setWorkspaceTokenLocal: N,
36
+ a({
37
+ bridgeUrl: b,
38
+ bridgeAllowedOrigins: x,
39
+ bridgeDebug: S,
40
+ onBridgeReady: C,
41
+ bridgeSyncInProgress: w,
42
+ setIsLoading: P,
43
+ setActiveId: E,
44
+ setUser: O,
45
+ setTokens: A,
46
+ setWorkspaceTokenLocal: M,
52
47
  clearAccounts: B,
53
48
  refreshAccounts: V
54
49
  });
55
- let { login: H, logout: U, logoutAll: W, updateUser: G, refreshAccessToken: K, hasPermission: q, setWorkspaceToken: J, setMfaState: Y, switchAccount: X, addAccount: Z, removeAccount: Q } = l({
56
- user: O,
57
- tokens: A,
58
- activeId: E,
59
- bridgeSyncInProgress: T,
60
- onRefreshToken: b,
61
- onTokenExpired: f,
62
- setActiveId: D,
63
- setUser: k,
64
- setTokens: j,
65
- setWorkspaceTokenLocal: N,
66
- setMfaRequiredState: ne,
50
+ let { login: H, logout: U, logoutAll: W, updateUser: G, refreshAccessToken: K, hasPermission: q, setWorkspaceToken: J, setMfaState: Y, switchAccount: X, addAccount: Z, removeAccount: Q } = c({
51
+ user: D,
52
+ tokens: k,
53
+ activeId: T,
54
+ bridgeSyncInProgress: w,
55
+ onRefreshToken: y,
56
+ onTokenExpired: u,
57
+ setActiveId: E,
58
+ setUser: O,
59
+ setTokens: A,
60
+ setWorkspaceTokenLocal: M,
61
+ setMfaRequiredState: I,
67
62
  setMfaChallengeIdState: re,
68
- setIsLoading: F,
63
+ setIsLoading: P,
69
64
  clearAccounts: B,
70
65
  refreshAccounts: V
71
66
  });
72
- te({
73
- tokens: A,
74
- onRefreshToken: b,
75
- onTokenExpired: f,
76
- onSessionExpiringSoon: y,
67
+ o({
68
+ tokens: k,
69
+ onRefreshToken: y,
70
+ onTokenExpired: u,
71
+ onSessionExpiringSoon: d,
77
72
  refreshAccessToken: K
78
- }), s({
79
- user: O,
80
- tokens: A,
81
- workspaceToken: M,
82
- activeId: E,
83
- setUser: k,
84
- setTokens: j,
85
- setWorkspaceTokenLocal: N,
86
- setActiveId: D,
73
+ }), ne({
74
+ user: D,
75
+ tokens: k,
76
+ workspaceToken: j,
77
+ activeId: T,
78
+ setUser: O,
79
+ setTokens: A,
80
+ setWorkspaceTokenLocal: M,
81
+ setActiveId: E,
87
82
  clearAccounts: B,
88
83
  refreshAccounts: V
89
- }), u(), c({
90
- tokens: A,
91
- bridgeUrl: x,
84
+ }), l(), s({
85
+ tokens: k,
86
+ bridgeUrl: b,
92
87
  logout: U,
93
- setActiveId: D,
94
- setUser: k,
95
- setTokens: j,
96
- setWorkspaceTokenLocal: N,
88
+ setActiveId: E,
89
+ setUser: O,
90
+ setTokens: A,
91
+ setWorkspaceTokenLocal: M,
97
92
  clearAccounts: B
98
93
  });
99
- let $ = m(() => !!O && !!A, [O, A]), ie = m(() => ({
100
- user: O,
101
- tokens: A,
94
+ let $ = p(() => !!D && !!k, [D, k]), ie = p(() => ({
95
+ user: D,
96
+ tokens: k,
102
97
  isAuthenticated: $,
103
- isLoading: P,
98
+ isLoading: N,
104
99
  login: H,
105
100
  logout: U,
106
101
  updateUser: G,
107
102
  refreshAccessToken: K,
108
103
  hasPermission: q,
109
104
  setWorkspaceToken: J,
110
- workspaceToken: M,
111
- mfaRequired: I,
105
+ workspaceToken: j,
106
+ mfaRequired: F,
112
107
  mfaChallengeId: L,
113
108
  setMfaState: Y,
114
- activeProfileId: E,
109
+ activeProfileId: T,
115
110
  accounts: R,
116
111
  switchAccount: X,
117
112
  addAccount: Z,
118
113
  removeAccount: Q,
119
114
  logoutAll: W,
120
- currentUser: O
115
+ currentUser: D
121
116
  }), [
122
- O,
123
- A,
117
+ D,
118
+ k,
124
119
  $,
125
- P,
120
+ N,
126
121
  H,
127
122
  U,
128
123
  G,
129
124
  K,
130
125
  q,
131
126
  J,
132
- M,
133
- I,
127
+ j,
128
+ F,
134
129
  L,
135
130
  Y,
136
- E,
131
+ T,
137
132
  R,
138
133
  X,
139
134
  Z,
140
135
  Q,
141
136
  W
142
137
  ]);
143
- return /* @__PURE__ */ _(v.Provider, {
138
+ return /* @__PURE__ */ g(_.Provider, {
144
139
  value: ie,
145
- children: d
140
+ children: r
146
141
  });
147
142
  }
148
143
  function b() {
149
- let e = f(v);
144
+ let e = d(_);
150
145
  if (!e) throw Error("useAuth must be used within an AuthProvider");
151
146
  return e;
152
147
  }
@@ -58,6 +58,26 @@ export interface ProfileUser {
58
58
  */
59
59
  export declare const PROFILE_STORAGE_CHANGE_EVENT = "bf-profile-storage-change";
60
60
  export declare function getProfiles(): ProfileMeta[];
61
+ /**
62
+ * True when the stored user for a profile is an account whose email was never
63
+ * verified. Such an account can't sign in (the backend rejects it with
64
+ * EMAIL_NOT_VERIFIED), so it is never a valid active or switchable profile —
65
+ * older auth builds wrote one to the list on signup alone (BOFF-7215).
66
+ */
67
+ export declare function isPendingVerificationProfile(profileId: string): boolean;
68
+ /** True when a profile holds credentials from a completed sign-in. */
69
+ export declare function hasProfileCredentials(profileId: string): boolean;
70
+ /**
71
+ * Profiles that may become the active profile. Excludes pending-verification
72
+ * accounts only: a verified profile may briefly lack tokens mid-sign-in (user
73
+ * is written before tokens), and must still resolve as active then.
74
+ */
75
+ export declare function getSelectableProfiles(): ProfileMeta[];
76
+ /**
77
+ * Profiles to list in the account switcher: selectable profiles that hold
78
+ * credentials, plus the active profile (whose tokens may be mid-write).
79
+ */
80
+ export declare function getSwitchableProfiles(activeProfileId: string | null): ProfileMeta[];
61
81
  export declare function setProfiles(profiles: ProfileMeta[]): void;
62
82
  export declare function addProfile(meta: ProfileMeta): void;
63
83
  export declare function removeProfile(profileId: string): void;
@@ -2,33 +2,37 @@ import { __exportAll as e } from "../../../_virtual/_rolldown/runtime.js";
2
2
  //#region src/shared/providers/shell/ProfileStorageManager.ts
3
3
  var t = /* @__PURE__ */ e({
4
4
  PROFILE_STORAGE_CHANGE_EVENT: () => s,
5
- addProfile: () => h,
6
- clearActiveProfileId: () => b,
7
- getActiveContext: () => F,
8
- getActiveProfileId: () => v,
9
- getActiveTokens: () => N,
10
- getActiveUser: () => M,
11
- getActiveWorkspaceToken: () => P,
12
- getProfileContext: () => O,
13
- getProfileLocale: () => A,
14
- getProfileTokens: () => w,
15
- getProfileUser: () => S,
16
- getProfileWorkspaceToken: () => E,
5
+ addProfile: () => y,
6
+ clearActiveProfileId: () => w,
7
+ getActiveContext: () => z,
8
+ getActiveProfileId: () => S,
9
+ getActiveTokens: () => L,
10
+ getActiveUser: () => I,
11
+ getActiveWorkspaceToken: () => R,
12
+ getProfileContext: () => M,
13
+ getProfileLocale: () => P,
14
+ getProfileTokens: () => O,
15
+ getProfileUser: () => E,
16
+ getProfileWorkspaceToken: () => A,
17
17
  getProfiles: () => p,
18
- loginProfile: () => I,
19
- logoutActiveProfile: () => L,
20
- logoutAllProfiles: () => R,
21
- removeAllProfiles: () => _,
22
- removeProfile: () => g,
23
- resolveActiveProfileId: () => x,
24
- setActiveProfileId: () => y,
25
- setProfileContext: () => k,
26
- setProfileLocale: () => j,
27
- setProfileTokens: () => T,
28
- setProfileUser: () => C,
29
- setProfileWorkspaceToken: () => D,
30
- setProfiles: () => m,
31
- switchProfile: () => z
18
+ getSelectableProfiles: () => g,
19
+ getSwitchableProfiles: () => _,
20
+ hasProfileCredentials: () => h,
21
+ isPendingVerificationProfile: () => m,
22
+ loginProfile: () => B,
23
+ logoutActiveProfile: () => V,
24
+ logoutAllProfiles: () => H,
25
+ removeAllProfiles: () => x,
26
+ removeProfile: () => b,
27
+ resolveActiveProfileId: () => T,
28
+ setActiveProfileId: () => C,
29
+ setProfileContext: () => N,
30
+ setProfileLocale: () => F,
31
+ setProfileTokens: () => k,
32
+ setProfileUser: () => D,
33
+ setProfileWorkspaceToken: () => j,
34
+ setProfiles: () => v,
35
+ switchProfile: () => U
32
36
  }), n = "bf-profiles", r = "bf-active-profile", i = "bf-last-active-profile", a = "bf-p", o = "session", s = "bf-profile-storage-change";
33
37
  function c() {
34
38
  typeof window < "u" && window.dispatchEvent(new Event(s));
@@ -54,14 +58,27 @@ function p() {
54
58
  return d(n) ?? [];
55
59
  }
56
60
  function m(e) {
57
- f(n, e);
61
+ return E(e)?.emailVerified === !1;
58
62
  }
59
63
  function h(e) {
64
+ let t = O(e);
65
+ return !!(t?.accessToken || t?.refreshToken);
66
+ }
67
+ function g() {
68
+ return p().filter((e) => !m(e.id));
69
+ }
70
+ function _(e) {
71
+ return g().filter((t) => t.id === e || h(t.id));
72
+ }
73
+ function v(e) {
74
+ f(n, e);
75
+ }
76
+ function y(e) {
60
77
  let t = p().filter((t) => t.id !== e.id);
61
- t.push(e), m(t);
78
+ t.push(e), v(t);
62
79
  }
63
- function g(e) {
64
- m(p().filter((t) => t.id !== e));
80
+ function b(e) {
81
+ v(p().filter((t) => t.id !== e));
65
82
  for (let t of [
66
83
  "user",
67
84
  "tokens",
@@ -76,25 +93,25 @@ function g(e) {
76
93
  "sidebar-collapsed"
77
94
  ]) localStorage.removeItem(l(e, t)), sessionStorage.removeItem(u(e, t));
78
95
  }
79
- function _() {
96
+ function x() {
80
97
  let e = p();
81
- for (let t of e) g(t.id);
98
+ for (let t of e) b(t.id);
82
99
  localStorage.removeItem(n), sessionStorage.removeItem(r);
83
100
  }
84
- function v() {
101
+ function S() {
85
102
  return sessionStorage.getItem(r);
86
103
  }
87
- function y(e) {
104
+ function C(e) {
88
105
  sessionStorage.setItem(r, e);
89
106
  try {
90
107
  localStorage.setItem(i, e);
91
108
  } catch {}
92
109
  }
93
- function b() {
110
+ function w() {
94
111
  sessionStorage.removeItem(r);
95
112
  }
96
- function x() {
97
- let e = p(), t = v();
113
+ function T() {
114
+ let e = g(), t = S();
98
115
  if (t && e.some((e) => e.id === t)) return t;
99
116
  let n = null;
100
117
  try {
@@ -102,30 +119,30 @@ function x() {
102
119
  } catch {
103
120
  n = null;
104
121
  }
105
- return n && e.some((e) => e.id === n) ? (y(n), n) : e.length > 0 ? (y(e[0].id), e[0].id) : null;
122
+ return n && e.some((e) => e.id === n) ? (C(n), n) : e.length > 0 ? (C(e[0].id), e[0].id) : null;
106
123
  }
107
- function S(e) {
124
+ function E(e) {
108
125
  return d(l(e, "user"));
109
126
  }
110
- function C(e, t) {
127
+ function D(e, t) {
111
128
  let n = l(e, "user");
112
129
  t ? f(n, t) : localStorage.removeItem(n);
113
130
  }
114
- function w(e) {
131
+ function O(e) {
115
132
  return d(l(e, "tokens"));
116
133
  }
117
- function T(e, t) {
134
+ function k(e, t) {
118
135
  let n = l(e, "tokens");
119
136
  t ? f(n, t) : localStorage.removeItem(n);
120
137
  }
121
- function E(e) {
138
+ function A(e) {
122
139
  try {
123
140
  let t = sessionStorage.getItem(u(e, "workspace-token"));
124
141
  if (t) return t;
125
142
  } catch {}
126
143
  return localStorage.getItem(l(e, "workspace-token"));
127
144
  }
128
- function D(e, t) {
145
+ function j(e, t) {
129
146
  let n = l(e, "workspace-token"), r = u(e, "workspace-token");
130
147
  if (t) {
131
148
  try {
@@ -140,53 +157,53 @@ function D(e, t) {
140
157
  }
141
158
  c();
142
159
  }
143
- function O(e) {
160
+ function M(e) {
144
161
  return d(l(e, "context"));
145
162
  }
146
- function k(e, t) {
163
+ function N(e, t) {
147
164
  f(l(e, "context"), t);
148
165
  }
149
- function A(e) {
166
+ function P(e) {
150
167
  return localStorage.getItem(l(e, "locale"));
151
168
  }
152
- function j(e, t) {
169
+ function F(e, t) {
153
170
  localStorage.setItem(l(e, "locale"), t);
154
171
  }
155
- function M() {
156
- let e = x();
157
- return e ? S(e) : null;
158
- }
159
- function N() {
160
- let e = x();
161
- return e ? w(e) : null;
162
- }
163
- function P() {
164
- let e = x();
172
+ function I() {
173
+ let e = T();
165
174
  return e ? E(e) : null;
166
175
  }
167
- function F() {
168
- let e = x();
176
+ function L() {
177
+ let e = T();
169
178
  return e ? O(e) : null;
170
179
  }
171
- function I(e, t) {
180
+ function R() {
181
+ let e = T();
182
+ return e ? A(e) : null;
183
+ }
184
+ function z() {
185
+ let e = T();
186
+ return e ? M(e) : null;
187
+ }
188
+ function B(e, t) {
172
189
  let n = e.id;
173
- return h({
190
+ return y({
174
191
  id: n,
175
192
  email: e.email,
176
193
  name: e.name ?? `${e.firstName ?? ""} ${e.lastName ?? ""}`.trim(),
177
194
  avatar: e.avatar,
178
195
  lastLogin: (/* @__PURE__ */ new Date()).toISOString()
179
- }), C(n, e), T(n, t), y(n), c(), n;
196
+ }), D(n, e), k(n, t), C(n), c(), n;
180
197
  }
181
- function L() {
182
- let e = v();
183
- e && (g(e), b(), x(), c());
198
+ function V() {
199
+ let e = S();
200
+ e && (b(e), w(), T(), c());
184
201
  }
185
- function R() {
186
- _(), c();
202
+ function H() {
203
+ x(), c();
187
204
  }
188
- function z(e) {
189
- return p().some((t) => t.id === e) ? (y(e), !0) : !1;
205
+ function U(e) {
206
+ return g().some((t) => t.id === e) ? (C(e), !0) : !1;
190
207
  }
191
208
  //#endregion
192
- export { s as PROFILE_STORAGE_CHANGE_EVENT, t as ProfileStorageManager_exports, h as addProfile, b as clearActiveProfileId, F as getActiveContext, v as getActiveProfileId, N as getActiveTokens, M as getActiveUser, P as getActiveWorkspaceToken, O as getProfileContext, A as getProfileLocale, w as getProfileTokens, S as getProfileUser, E as getProfileWorkspaceToken, p as getProfiles, I as loginProfile, L as logoutActiveProfile, R as logoutAllProfiles, _ as removeAllProfiles, g as removeProfile, x as resolveActiveProfileId, y as setActiveProfileId, k as setProfileContext, j as setProfileLocale, T as setProfileTokens, C as setProfileUser, D as setProfileWorkspaceToken, m as setProfiles, z as switchProfile };
209
+ export { s as PROFILE_STORAGE_CHANGE_EVENT, t as ProfileStorageManager_exports, y as addProfile, w as clearActiveProfileId, z as getActiveContext, S as getActiveProfileId, L as getActiveTokens, I as getActiveUser, R as getActiveWorkspaceToken, M as getProfileContext, P as getProfileLocale, O as getProfileTokens, E as getProfileUser, A as getProfileWorkspaceToken, p as getProfiles, _ as getSwitchableProfiles, B as loginProfile, V as logoutActiveProfile, H as logoutAllProfiles, x as removeAllProfiles, b as removeProfile, T as resolveActiveProfileId, C as setActiveProfileId, N as setProfileContext, F as setProfileLocale, k as setProfileTokens, D as setProfileUser, j as setProfileWorkspaceToken, v as setProfiles, U as switchProfile };