@declarion/react 0.122.0 → 0.131.0
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-lib/api/auth.js +38 -38
- package/dist-lib/api/client.js +73 -62
- package/dist-lib/stores/auth.js +42 -32
- package/package.json +1 -1
package/dist-lib/api/auth.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { beginSessionInPage as e, callHandler as t, scheduleProactiveRefresh as n } from "./client.js";
|
|
2
2
|
//#region src/api/auth.ts
|
|
3
|
-
async function
|
|
4
|
-
return
|
|
3
|
+
async function r() {
|
|
4
|
+
return t("auth.check_setup");
|
|
5
5
|
}
|
|
6
|
-
async function
|
|
7
|
-
let a = await
|
|
6
|
+
async function i(n, r, i = !0) {
|
|
7
|
+
let a = await t("auth.login", {
|
|
8
8
|
email: n,
|
|
9
9
|
password: r,
|
|
10
10
|
remember: i
|
|
11
11
|
});
|
|
12
|
-
return
|
|
12
|
+
return e(a.expires_at), a;
|
|
13
13
|
}
|
|
14
|
-
async function
|
|
15
|
-
let a = await
|
|
14
|
+
async function a(n, r, i) {
|
|
15
|
+
let a = await t("auth.signup", {
|
|
16
16
|
email: n,
|
|
17
17
|
password: r,
|
|
18
18
|
display_name: i
|
|
19
19
|
});
|
|
20
|
-
return a.verification_required ||
|
|
20
|
+
return a.verification_required || e(a.expires_at), a;
|
|
21
21
|
}
|
|
22
|
-
async function
|
|
23
|
-
let i = await
|
|
22
|
+
async function o(n, r) {
|
|
23
|
+
let i = await t("auth.confirm_signup", {
|
|
24
24
|
email: n,
|
|
25
25
|
code: r
|
|
26
26
|
});
|
|
27
|
-
return
|
|
27
|
+
return e(i.expires_at), i;
|
|
28
28
|
}
|
|
29
|
-
async function
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
async function s() {
|
|
33
|
-
return e("auth.me");
|
|
29
|
+
async function s(e) {
|
|
30
|
+
return t("auth.resend_signup_code", { email: e });
|
|
34
31
|
}
|
|
35
32
|
async function c() {
|
|
36
|
-
return
|
|
33
|
+
return t("auth.me");
|
|
37
34
|
}
|
|
38
35
|
async function l() {
|
|
39
|
-
return (
|
|
36
|
+
return t("auth.me", {}, { isSessionProbe: !0 });
|
|
37
|
+
}
|
|
38
|
+
async function u() {
|
|
39
|
+
return (await t("auth.list_tenants")).tenants;
|
|
40
40
|
}
|
|
41
|
-
async function
|
|
42
|
-
let r = await
|
|
43
|
-
return
|
|
41
|
+
async function d(e) {
|
|
42
|
+
let r = await t("auth.switch_tenant", { tenant_id: e });
|
|
43
|
+
return n(r.expires_at), r;
|
|
44
44
|
}
|
|
45
|
-
async function
|
|
46
|
-
await
|
|
45
|
+
async function f() {
|
|
46
|
+
await t("auth.logout", {}, { keepalive: !0 });
|
|
47
47
|
}
|
|
48
|
-
async function
|
|
49
|
-
return (await
|
|
48
|
+
async function p(e) {
|
|
49
|
+
return (await t("auth.list_identity_providers", e ? { tenant_code: e } : {})).providers;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function m(e, t, n) {
|
|
52
52
|
let r = new URLSearchParams();
|
|
53
53
|
t && r.set("tenant", t), n && r.set("redirect", n);
|
|
54
54
|
let i = r.toString();
|
|
55
55
|
return `/api/auth/sso/authorize/${encodeURIComponent(e)}${i ? `?${i}` : ""}`;
|
|
56
56
|
}
|
|
57
|
-
async function
|
|
57
|
+
async function h(e, n, r) {
|
|
58
58
|
let i = {
|
|
59
|
-
target_user_id:
|
|
59
|
+
target_user_id: e,
|
|
60
60
|
reason: n
|
|
61
61
|
};
|
|
62
|
-
return r != null && (i.duration_minutes = r),
|
|
62
|
+
return r != null && (i.duration_minutes = r), t("impersonation.start", i);
|
|
63
63
|
}
|
|
64
|
-
async function
|
|
65
|
-
return
|
|
64
|
+
async function g() {
|
|
65
|
+
return t("impersonation.stop");
|
|
66
66
|
}
|
|
67
|
-
async function
|
|
68
|
-
await
|
|
67
|
+
async function _(e) {
|
|
68
|
+
await t("impersonation.revoke", { session_id: e });
|
|
69
69
|
}
|
|
70
|
-
async function
|
|
71
|
-
await
|
|
72
|
-
current_password:
|
|
70
|
+
async function v(e, n) {
|
|
71
|
+
await t("auth.change_password", {
|
|
72
|
+
current_password: e,
|
|
73
73
|
new_password: n
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
//#endregion
|
|
77
|
-
export {
|
|
77
|
+
export { v as changePassword, r as checkSetup, o as confirmSignup, c as getMe, _ as impersonationRevoke, h as impersonationStart, g as impersonationStop, p as listIdentityProviders, u as listTenants, i as login, f as logout, l as probeSession, s as resendSignupCode, a as signup, m as ssoAuthorizeUrl, d as switchTenant };
|
package/dist-lib/api/client.js
CHANGED
|
@@ -26,12 +26,12 @@ function b(e) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
function x(e) {
|
|
29
|
-
return e.ok ? (e.access_expires_at &&
|
|
29
|
+
return e.ok ? (e.access_expires_at && T(e.access_expires_at), null) : new C(e.status ?? 401);
|
|
30
30
|
}
|
|
31
31
|
async function S() {
|
|
32
32
|
let e = navigator.locks;
|
|
33
33
|
if (!e) {
|
|
34
|
-
await
|
|
34
|
+
await P();
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
let t = Date.now();
|
|
@@ -43,7 +43,7 @@ async function S() {
|
|
|
43
43
|
} else try {
|
|
44
44
|
b({
|
|
45
45
|
ok: !0,
|
|
46
|
-
access_expires_at: await
|
|
46
|
+
access_expires_at: await P()
|
|
47
47
|
});
|
|
48
48
|
} catch (e) {
|
|
49
49
|
throw e instanceof C && b({
|
|
@@ -59,23 +59,33 @@ var C = class extends Error {
|
|
|
59
59
|
super(`refresh failed terminally (${e})`), this.status = e, this.name = "RefreshDeadError";
|
|
60
60
|
}
|
|
61
61
|
}, w = null;
|
|
62
|
-
function
|
|
62
|
+
function ee() {
|
|
63
63
|
return w ??= import("./session-renewal.js").catch((e) => {
|
|
64
64
|
throw w = null, e;
|
|
65
65
|
}), w;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
67
|
+
function T(e) {
|
|
68
|
+
return D || (F = null, c() || p(e), typeof window > "u") ? Promise.resolve() : ee().then((t) => t.scheduleRenewal(e), () => void 0);
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function E() {
|
|
71
71
|
f(), w?.then((e) => e.cancelRenewal());
|
|
72
72
|
}
|
|
73
|
+
var D = !1;
|
|
74
|
+
function O() {
|
|
75
|
+
D = !0, E();
|
|
76
|
+
}
|
|
77
|
+
function k() {
|
|
78
|
+
return D;
|
|
79
|
+
}
|
|
80
|
+
function A(e) {
|
|
81
|
+
return D = !1, T(e);
|
|
82
|
+
}
|
|
73
83
|
typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
74
84
|
if (e.key !== _ || c()) return;
|
|
75
85
|
let t = y(() => e.newValue);
|
|
76
|
-
t?.ok && t.access_expires_at &&
|
|
86
|
+
t?.ok && t.access_expires_at && T(t.access_expires_at);
|
|
77
87
|
});
|
|
78
|
-
async function
|
|
88
|
+
async function j(e, n, r) {
|
|
79
89
|
let i = new AbortController(), a = setTimeout(() => i.abort(), r);
|
|
80
90
|
try {
|
|
81
91
|
return await fetch(e, {
|
|
@@ -88,114 +98,115 @@ async function O(e, n, r) {
|
|
|
88
98
|
clearTimeout(a);
|
|
89
99
|
}
|
|
90
100
|
}
|
|
91
|
-
async function
|
|
101
|
+
async function M(e) {
|
|
92
102
|
try {
|
|
93
103
|
return (await e.json())?.result?.expires_at;
|
|
94
104
|
} catch {
|
|
95
105
|
return;
|
|
96
106
|
}
|
|
97
107
|
}
|
|
98
|
-
function
|
|
99
|
-
return
|
|
108
|
+
function N() {
|
|
109
|
+
return j("/api/actions/auth.refresh", {
|
|
100
110
|
method: "POST",
|
|
101
111
|
credentials: "include",
|
|
102
112
|
headers: { "Content-Type": "application/json" },
|
|
103
113
|
body: h({})
|
|
104
114
|
}, u);
|
|
105
115
|
}
|
|
106
|
-
async function
|
|
107
|
-
let t = await
|
|
116
|
+
async function P() {
|
|
117
|
+
let t = await N();
|
|
108
118
|
if (t.status === 429) {
|
|
109
119
|
let e = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
110
|
-
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await
|
|
120
|
+
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await N();
|
|
111
121
|
}
|
|
112
122
|
if (t.status >= 500) {
|
|
113
123
|
let n = await r(t);
|
|
114
124
|
throw new e(t.status, n.body, n.raw);
|
|
115
125
|
}
|
|
116
126
|
if (!t.ok) throw await r(t), new C(t.status);
|
|
117
|
-
let n = await
|
|
118
|
-
return
|
|
127
|
+
let n = await M(t);
|
|
128
|
+
return T(n), n;
|
|
119
129
|
}
|
|
120
|
-
var
|
|
121
|
-
function
|
|
130
|
+
var F = null, I = /* @__PURE__ */ new Set(["auth.token_refresh_needed", "auth.unauthorized"]);
|
|
131
|
+
function L(n) {
|
|
122
132
|
return n instanceof t || n instanceof e;
|
|
123
133
|
}
|
|
124
|
-
async function
|
|
125
|
-
if (
|
|
134
|
+
async function R() {
|
|
135
|
+
if (D) throw new C(401);
|
|
136
|
+
if (F !== null) throw new C(F);
|
|
126
137
|
return g || (g = S().catch((e) => {
|
|
127
|
-
throw e instanceof C && (
|
|
138
|
+
throw e instanceof C && (F = e.status), e;
|
|
128
139
|
}).finally(() => {
|
|
129
140
|
g = null;
|
|
130
141
|
}), g);
|
|
131
142
|
}
|
|
132
|
-
var
|
|
143
|
+
var z = () => {
|
|
133
144
|
if (typeof window > "u") return;
|
|
134
145
|
let { pathname: e } = window.location;
|
|
135
146
|
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href = i());
|
|
136
147
|
};
|
|
137
|
-
function
|
|
138
|
-
let t =
|
|
139
|
-
return
|
|
148
|
+
function B(e) {
|
|
149
|
+
let t = z;
|
|
150
|
+
return z = e, t;
|
|
140
151
|
}
|
|
141
|
-
function
|
|
142
|
-
return
|
|
152
|
+
function V() {
|
|
153
|
+
return z;
|
|
143
154
|
}
|
|
144
|
-
var
|
|
155
|
+
var H = ({ status: e, code: t, message: n }) => {
|
|
145
156
|
console.error(`[API ${e}] ${t}: ${n}`);
|
|
146
157
|
};
|
|
147
|
-
function
|
|
158
|
+
function U(e, t, n, r) {
|
|
148
159
|
let i = new Headers(e);
|
|
149
160
|
return !i.has("Content-Type") && t && i.set("Content-Type", "application/json"), n.setAccept && !i.has("Accept") && i.set("Accept", "*/*"), r && i.set("Authorization", `Bearer ${r}`), i;
|
|
150
161
|
}
|
|
151
|
-
var
|
|
152
|
-
function
|
|
153
|
-
|
|
162
|
+
var W = null, G;
|
|
163
|
+
function K(e) {
|
|
164
|
+
G = e, W && e !== void 0 && !m(W.reader, e) && (W = null);
|
|
154
165
|
}
|
|
155
|
-
function
|
|
156
|
-
(
|
|
166
|
+
function q(e, t) {
|
|
167
|
+
(G === void 0 || m(e, G)) && (W = t ? {
|
|
157
168
|
language: t,
|
|
158
169
|
reader: e
|
|
159
170
|
} : null);
|
|
160
171
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
172
|
+
function J(e) {
|
|
173
|
+
W = e ? {
|
|
163
174
|
language: e,
|
|
164
|
-
reader:
|
|
175
|
+
reader: G ?? null
|
|
165
176
|
} : null;
|
|
166
177
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
178
|
+
function Y() {
|
|
179
|
+
return W?.language ?? null;
|
|
169
180
|
}
|
|
170
|
-
function
|
|
171
|
-
let t =
|
|
181
|
+
function X(e) {
|
|
182
|
+
let t = Y();
|
|
172
183
|
return !t || !e.startsWith("/api/") || /[?&]language=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}language=${encodeURIComponent(t)}`;
|
|
173
184
|
}
|
|
174
|
-
async function
|
|
175
|
-
let p =
|
|
185
|
+
async function Z(t, i, u, f) {
|
|
186
|
+
let p = X(t), m = c(), h = m ? "omit" : "include", g = U(i.headers, !!i.body, u, m ? s() : null), _ = d(t, i), v = await j(p, {
|
|
176
187
|
...i,
|
|
177
188
|
headers: g,
|
|
178
189
|
credentials: h
|
|
179
190
|
}, _);
|
|
180
191
|
if (l(v.headers), !v.ok) {
|
|
181
192
|
let { raw: t, body: s } = await r(v), c = n(s.type), l = s.title ?? "";
|
|
182
|
-
if (v.status === 401 &&
|
|
193
|
+
if (v.status === 401 && I.has(c)) try {
|
|
183
194
|
let t = null;
|
|
184
|
-
m ? (o(), t = await a()) : await
|
|
185
|
-
let s =
|
|
195
|
+
m ? (o(), t = await a()) : await R();
|
|
196
|
+
let s = U(i.headers, !!i.body, u, t), c = await j(p, {
|
|
186
197
|
...i,
|
|
187
198
|
headers: s,
|
|
188
199
|
credentials: h
|
|
189
200
|
}, _);
|
|
190
201
|
if (!c.ok) {
|
|
191
202
|
let t = await r(c);
|
|
192
|
-
throw !m && c.status === 401 &&
|
|
203
|
+
throw !m && c.status === 401 && I.has(n(t.body.type)) && (F = 401), c.status === 401 && !u.isSessionProbe && z(), new e(c.status, t.body, t.raw);
|
|
193
204
|
}
|
|
194
205
|
return f(c);
|
|
195
206
|
} catch (n) {
|
|
196
|
-
throw
|
|
207
|
+
throw L(n) ? n : (u.isSessionProbe || z(), new e(401, s, t));
|
|
197
208
|
}
|
|
198
|
-
throw v.status === 401 && !u.isSessionProbe &&
|
|
209
|
+
throw v.status === 401 && !u.isSessionProbe && z(), H({
|
|
199
210
|
status: v.status,
|
|
200
211
|
code: c,
|
|
201
212
|
message: l
|
|
@@ -203,27 +214,27 @@ async function J(t, i, u, f) {
|
|
|
203
214
|
}
|
|
204
215
|
return f(v);
|
|
205
216
|
}
|
|
206
|
-
function
|
|
217
|
+
function Q(e) {
|
|
207
218
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
208
219
|
}
|
|
209
|
-
async function
|
|
210
|
-
return
|
|
220
|
+
async function te(e, t = {}, { isSessionProbe: n = !1 } = {}) {
|
|
221
|
+
return Z(e, t, {
|
|
211
222
|
setAccept: !1,
|
|
212
223
|
isSessionProbe: n
|
|
213
|
-
},
|
|
224
|
+
}, Q);
|
|
214
225
|
}
|
|
215
|
-
async function
|
|
226
|
+
async function ne(e) {
|
|
216
227
|
return {
|
|
217
228
|
blob: await e.blob(),
|
|
218
229
|
filename: $(e.headers),
|
|
219
230
|
headers: e.headers
|
|
220
231
|
};
|
|
221
232
|
}
|
|
222
|
-
async function
|
|
223
|
-
return
|
|
233
|
+
async function re(e, t = {}) {
|
|
234
|
+
return Z(e, t, {
|
|
224
235
|
setAccept: !0,
|
|
225
236
|
isSessionProbe: !1
|
|
226
|
-
},
|
|
237
|
+
}, ne);
|
|
227
238
|
}
|
|
228
239
|
function $(e) {
|
|
229
240
|
let t = e.get("Content-Disposition");
|
|
@@ -235,15 +246,15 @@ function $(e) {
|
|
|
235
246
|
let r = t.match(/filename\s*=\s*("([^"]+)"|([^;]+))/i);
|
|
236
247
|
return r ? (r[2] ?? r[3] ?? "").trim() : "";
|
|
237
248
|
}
|
|
238
|
-
async function
|
|
239
|
-
return (await
|
|
249
|
+
async function ie(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1 } = {}) {
|
|
250
|
+
return (await Z(`/api/actions/${encodeURIComponent(e)}`, {
|
|
240
251
|
method: "POST",
|
|
241
252
|
body: h(t),
|
|
242
253
|
keepalive: r
|
|
243
254
|
}, {
|
|
244
255
|
setAccept: !1,
|
|
245
256
|
isSessionProbe: n
|
|
246
|
-
},
|
|
257
|
+
}, Q)).result;
|
|
247
258
|
}
|
|
248
259
|
//#endregion
|
|
249
|
-
export { C as RefreshDeadError,
|
|
260
|
+
export { C as RefreshDeadError, te as apiFetch, re as apiFetchBlob, A as beginSessionInPage, ie as callHandler, E as cancelProactiveRefresh, Y as currentPublishedLanguage, O as endSessionInPage, R as ensureRefresh, V as getPersistentAuthFailureHandler, k as isSignedOutInPage, L as isTransientFailure, $ as parseContentDispositionFilename, J as publishLanguage, q as publishLanguageFor, T as scheduleProactiveRefresh, K as setLanguageReader, B as setPersistentAuthFailureHandler, X as withPublishedLanguage };
|
package/dist-lib/stores/auth.js
CHANGED
|
@@ -1,33 +1,39 @@
|
|
|
1
1
|
import { isEmbedTokenMode as e } from "../embed/token.js";
|
|
2
2
|
import { startOrderNow as t } from "../api/access-expiry.js";
|
|
3
3
|
import { sessionCaller as n } from "../api/audience.js";
|
|
4
|
-
import { cancelProactiveRefresh as r,
|
|
5
|
-
import { getMe as
|
|
6
|
-
import { warmRoutePages as
|
|
7
|
-
import { usePreferencesStore as
|
|
8
|
-
import { create as
|
|
4
|
+
import { cancelProactiveRefresh as r, endSessionInPage as i, ensureRefresh as a, isSignedOutInPage as o, scheduleProactiveRefresh as s, setLanguageReader as c } from "../api/client.js";
|
|
5
|
+
import { getMe as l, listTenants as u, logout as d, probeSession as f } from "../api/auth.js";
|
|
6
|
+
import { warmRoutePages as p } from "../lib/capabilityPrefetch.js";
|
|
7
|
+
import { usePreferencesStore as m } from "./preferences.js";
|
|
8
|
+
import { create as h } from "zustand";
|
|
9
9
|
//#region src/stores/auth.ts
|
|
10
|
-
async function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
async function g(e, t, n) {
|
|
11
|
+
let r = () => e({
|
|
12
|
+
user: null,
|
|
13
|
+
isAuthenticated: !1,
|
|
14
|
+
isLoading: !1,
|
|
15
|
+
sessionPresumed: !1,
|
|
16
|
+
identitySince: performance.now()
|
|
17
|
+
});
|
|
18
|
+
if (o()) r();
|
|
19
|
+
else try {
|
|
20
|
+
let i = await n();
|
|
21
|
+
if (o()) {
|
|
22
|
+
r();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
s(i.access_expires_at), e({
|
|
26
|
+
user: i,
|
|
15
27
|
isAuthenticated: !0,
|
|
16
28
|
isLoading: !1,
|
|
17
|
-
activeTenant:
|
|
29
|
+
activeTenant: i.tenant ?? null,
|
|
18
30
|
identitySince: performance.now()
|
|
19
31
|
}), t().loadTenants();
|
|
20
32
|
} catch {
|
|
21
|
-
|
|
22
|
-
user: null,
|
|
23
|
-
isAuthenticated: !1,
|
|
24
|
-
isLoading: !1,
|
|
25
|
-
sessionPresumed: !1,
|
|
26
|
-
identitySince: performance.now()
|
|
27
|
-
});
|
|
33
|
+
r();
|
|
28
34
|
}
|
|
29
35
|
}
|
|
30
|
-
var
|
|
36
|
+
var _ = h((e, n) => ({
|
|
31
37
|
user: null,
|
|
32
38
|
isAuthenticated: !1,
|
|
33
39
|
isLoading: !0,
|
|
@@ -37,13 +43,15 @@ var h = p((e, n) => ({
|
|
|
37
43
|
identitySince: 0,
|
|
38
44
|
initialize: async () => {
|
|
39
45
|
let r = t();
|
|
40
|
-
r === "refresh-first" && (r = await
|
|
46
|
+
r === "refresh-first" && (r = await a().then(() => "first-wave", () => "probe-first")), e({ sessionPresumed: r === "first-wave" }), r === "first-wave" && p(), await g(e, n, f), r === "probe-first" && n().isAuthenticated && p();
|
|
41
47
|
},
|
|
42
|
-
reloadSession: () =>
|
|
43
|
-
recheckSession: () =>
|
|
48
|
+
reloadSession: () => g(e, n, l),
|
|
49
|
+
recheckSession: () => g(e, n, f),
|
|
44
50
|
refreshMe: async () => {
|
|
45
51
|
try {
|
|
46
|
-
let t = await
|
|
52
|
+
let t = await l();
|
|
53
|
+
if (o()) return;
|
|
54
|
+
let r = n(), i = r.user?.id !== t.id || r.activeTenant?.id !== t.tenant?.id;
|
|
47
55
|
e({
|
|
48
56
|
user: t,
|
|
49
57
|
activeTenant: t.tenant ?? null,
|
|
@@ -61,26 +69,28 @@ var h = p((e, n) => ({
|
|
|
61
69
|
});
|
|
62
70
|
},
|
|
63
71
|
loadTenants: () => {
|
|
64
|
-
|
|
72
|
+
u().then((t) => {
|
|
73
|
+
o() || e({ tenants: t });
|
|
74
|
+
}, () => void 0);
|
|
65
75
|
},
|
|
66
76
|
setActiveTenant: (t) => {
|
|
67
77
|
e({ activeTenant: t });
|
|
68
78
|
},
|
|
69
79
|
logout: async () => {
|
|
70
|
-
|
|
80
|
+
i(), e({
|
|
71
81
|
user: null,
|
|
72
82
|
isAuthenticated: !1,
|
|
73
83
|
activeTenant: null,
|
|
74
84
|
tenants: [],
|
|
75
85
|
sessionPresumed: !1,
|
|
76
86
|
identitySince: performance.now()
|
|
77
|
-
}), await
|
|
87
|
+
}), await d(), y?.postMessage(v);
|
|
78
88
|
}
|
|
79
|
-
})),
|
|
80
|
-
|
|
81
|
-
t.data ===
|
|
82
|
-
}),
|
|
83
|
-
|
|
89
|
+
})), v = "signed-out", y = typeof BroadcastChannel == "function" ? new BroadcastChannel("declarion.auth") : null;
|
|
90
|
+
y?.addEventListener("message", (t) => {
|
|
91
|
+
t.data === v && !e() && _.getState().isAuthenticated && (r(), window.location.assign("/login"));
|
|
92
|
+
}), _.subscribe((e, t) => {
|
|
93
|
+
c(n(e)), e.user?.id !== t.user?.id && m.getState().startIdentity();
|
|
84
94
|
});
|
|
85
95
|
//#endregion
|
|
86
|
-
export {
|
|
96
|
+
export { _ as useAuthStore };
|