@abyss-project/commons-front-core 5.0.0 → 5.0.1
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/{CookieConsentSettings.component-Qv7WlFv1.js → CookieConsentSettings.component-B7HoVxDK.js} +1003 -994
- package/dist/auth/components/SecuritySettings/sections/PasswordSection.component.d.ts +0 -2
- package/dist/auth-client.js +1 -1
- package/dist/components/Inputs/CloudImport/CloudImport.component.d.ts +4 -0
- package/dist/components/Inputs/CloudImport/CloudImportFile.component.spec.d.ts +1 -0
- package/dist/components/Inputs/CloudImport/cloud-accept.d.ts +13 -0
- package/dist/components/Inputs/CloudImport/cloud-accept.spec.d.ts +1 -0
- package/dist/components/Support/support-status-timeline.logic.d.ts +2 -2
- package/dist/cookie-consent.js +1 -1
- package/dist/hooks/use-rich-intl.hook.d.ts +2 -2
- package/dist/{index-BuIwrS34.js → index-B9j-3Wv9.js} +2 -2
- package/dist/{index-D5ylhtng.js → index-BCNdS_hZ.js} +2 -2
- package/dist/{index-C8PVDVGQ.js → index-BQJ_IibV.js} +2 -2
- package/dist/{index-BG716EPB.js → index-BYFdosUa.js} +3 -3
- package/dist/{index-oKfJH01a.js → index-BlzK79bL.js} +3 -3
- package/dist/{index-DHCXtcI7.js → index-C-ryoEBt.js} +2 -2
- package/dist/{index-B0h04i9u.js → index-CDh8wzu8.js} +3 -3
- package/dist/{index-CS_grWE4.js → index-CMfXPyXq.js} +4 -4
- package/dist/{index-Y2TnZBi8.js → index-CuhdwbRD.js} +4 -4
- package/dist/{index-D1N8_Qim.js → index-D0uOg6A0.js} +4 -4
- package/dist/{index-5owlFn6W.js → index-DQAX2wNI.js} +2 -2
- package/dist/{index-BFEmh_EV.js → index-DZ8YTYOY.js} +2 -2
- package/dist/{index-C_-NoOPN.js → index-Db7YwEDm.js} +2 -2
- package/dist/{index-Cl8WUtRw.js → index-DnCvSvTf.js} +2 -2
- package/dist/{index-B2u_xNxk.js → index-DvjhhENb.js} +2 -2
- package/dist/{index-BsFPvS1n.js → index-DwOujeYK.js} +2 -2
- package/dist/{index-1CoDaadD.js → index-IWLHhMeY.js} +1 -1
- package/dist/{index-Ci4SXMFB.js → index-LoP5aAOy.js} +2 -2
- package/dist/{index-C2RWcbVl.js → index-Pm0jV-Wz.js} +2 -2
- package/dist/{index-CDUED8YP.js → index-PxLJ-vzu.js} +2 -2
- package/dist/{index-CLz2EEY4.js → index-alA0Reco.js} +3 -3
- package/dist/{index-B4Ff-AfL.js → index-vc79tKxC.js} +20113 -20063
- package/dist/index.js +3 -3
- package/dist/internal/lazy-value.d.ts +11 -0
- package/dist/internal/lazy-value.spec.d.ts +1 -0
- package/dist/lazy-value-Co76vxsM.js +7 -0
- package/dist/load-safety.spec.d.ts +1 -0
- package/dist/{use-auth.hook-BLaU_u8T.js → use-auth.hook-DatVLGxS.js} +103 -100
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { bv as e, aK as o, aL as t, R as r, M as i, Q as c, aW as b, cT as n, Z as A, d4 as l, aO as d, d0 as S, $ as u, cU as g, d1 as C, a6 as y, d8 as p, cV as L, aH as E, ah as T, ai as _, c$ as h, aY as P, b8 as R, b7 as I, d5 as m, aP as O, cW as D, aI as k, b4 as B, d7 as f, b5 as M, b1 as N, aE as U, Y as F, aQ as v, ak as H, cX as G, b6 as x, cY as W, b2 as w, al as Q, bx as Y, _ as V, da as j, bA as K, bG as z, d3 as X, av as Z, aN as q, ar as J, aq as $, bu as aa, bs as sa, bt as ea, d2 as oa, aJ as ta, cZ as ra, c_ as ia, a9 as ca, aM as ba, b3 as na, d9 as Aa, d6 as la, V as da, a5 as Sa, a4 as ua, dq as ga, dr as Ca, ds as ya, dv as pa, cn as La, bB as Ea, cq as Ta, am as _a, ao as ha, an as Pa, af as Ra, ae as Ia, a8 as ma, aS as Oa, db as Da, az as ka, a_ as Ba, aZ as fa, aC as Ma, aD as Na, ag as Ua, cQ as Fa, ap as va, cr as Ha, ab as Ga, cx as xa, cR as Wa, co as wa, cp as Qa, a$ as Ya, aT as Va, aa as ja, X as Ka, ax as za, aw as Xa, aB as Za, a0 as qa, cP as Ja, cN as $a, cO as as, b0 as ss, aA as es, dw as os, O as ts, cw as rs, cm as is, aj as cs, by as bs, bz as ns, K as As, W as ls, at as ds, au as Ss, a1 as us, as as gs, aU as Cs, bP as ys, bH as ps, bL as Ls, bD as Es, du as Ts, dt as _s, cS as hs, ad as Ps, bg as Rs, bh as Is, bi as ms, bl as Os, bq as Ds, bo as ks, bf as Bs, be as fs, bb as Ms, bj as Ns, ba as Us, bd as Fs, br as vs, bk as Hs, bc as Gs, bp as xs, U as Ws, S as ws, aR as Qs, aV as Ys, ac as Vs, aX as js, a2 as Ks, a3 as zs, bO as Xs, c8 as Zs, cc as qs, b9 as Js, cM as $s, cF as ae, bE as se, bS as ee, aG as oe, bU as te, cj as re, ci as ie, cB as ce, bI as be, bX as ne, bY as Ae, ca as le, dh as de, c4 as Se, c2 as ue, c3 as ge, cG as Ce, bn as ye, bm as pe, cz as Le, cE as Ee, cD as Te, ay as _e, cI as he, cu as Pe, cC as Re, ct as Ie, cs as me, cv as Oe, bQ as De, bw as ke, ce as Be, cf as fe, b$ as Me, c0 as Ne, cg as Ue, ch as Fe, cJ as ve, c5 as He, dm as Ge, cl as xe, ck as We, bF as we, bJ as Qe, bN as Ye, bC as Ve, dk as je, dg as Ke, cb as ze, bV as Xe, bR as Ze, dn as qe, cL as Je, cK as $e, cA as ao, cH as so, bZ as eo, b_ as oo, c7 as to, bK as ro, c9 as io, cd as co, c1 as bo, bT as no, bW as Ao, c6 as lo, aF as So, df as uo, a7 as go, dc as Co, dp as yo, dl as po, di as Lo, dj as Eo, bM as To, dd as _o, de as ho, cy as Po } from "./index-
|
|
2
|
-
import { A as Io, t as mo, c as Oo, C as Do, a as ko, D as Bo, J as fo, R as Mo, V as No, i as Uo, z as Fo, d as vo, B as Ho, E as Go, y as xo, v as Wo, K as wo, f as Qo, L as Yo, G as Vo, H as jo, j as Ko, m as zo, n as Xo, p as Zo, r as qo, e as Jo, h as $o, F as at, I as st, u as et, b as ot, g as tt, w as rt } from "./CookieConsentSettings.component-
|
|
1
|
+
import { bv as e, aK as o, aL as t, R as r, M as i, Q as c, aW as b, cT as n, Z as A, d4 as l, aO as d, d0 as S, $ as u, cU as g, d1 as C, a6 as y, d8 as p, cV as L, aH as E, ah as T, ai as _, c$ as h, aY as P, b8 as R, b7 as I, d5 as m, aP as O, cW as D, aI as k, b4 as B, d7 as f, b5 as M, b1 as N, aE as U, Y as F, aQ as v, ak as H, cX as G, b6 as x, cY as W, b2 as w, al as Q, bx as Y, _ as V, da as j, bA as K, bG as z, d3 as X, av as Z, aN as q, ar as J, aq as $, bu as aa, bs as sa, bt as ea, d2 as oa, aJ as ta, cZ as ra, c_ as ia, a9 as ca, aM as ba, b3 as na, d9 as Aa, d6 as la, V as da, a5 as Sa, a4 as ua, dq as ga, dr as Ca, ds as ya, dv as pa, cn as La, bB as Ea, cq as Ta, am as _a, ao as ha, an as Pa, af as Ra, ae as Ia, a8 as ma, aS as Oa, db as Da, az as ka, a_ as Ba, aZ as fa, aC as Ma, aD as Na, ag as Ua, cQ as Fa, ap as va, cr as Ha, ab as Ga, cx as xa, cR as Wa, co as wa, cp as Qa, a$ as Ya, aT as Va, aa as ja, X as Ka, ax as za, aw as Xa, aB as Za, a0 as qa, cP as Ja, cN as $a, cO as as, b0 as ss, aA as es, dw as os, O as ts, cw as rs, cm as is, aj as cs, by as bs, bz as ns, K as As, W as ls, at as ds, au as Ss, a1 as us, as as gs, aU as Cs, bP as ys, bH as ps, bL as Ls, bD as Es, du as Ts, dt as _s, cS as hs, ad as Ps, bg as Rs, bh as Is, bi as ms, bl as Os, bq as Ds, bo as ks, bf as Bs, be as fs, bb as Ms, bj as Ns, ba as Us, bd as Fs, br as vs, bk as Hs, bc as Gs, bp as xs, U as Ws, S as ws, aR as Qs, aV as Ys, ac as Vs, aX as js, a2 as Ks, a3 as zs, bO as Xs, c8 as Zs, cc as qs, b9 as Js, cM as $s, cF as ae, bE as se, bS as ee, aG as oe, bU as te, cj as re, ci as ie, cB as ce, bI as be, bX as ne, bY as Ae, ca as le, dh as de, c4 as Se, c2 as ue, c3 as ge, cG as Ce, bn as ye, bm as pe, cz as Le, cE as Ee, cD as Te, ay as _e, cI as he, cu as Pe, cC as Re, ct as Ie, cs as me, cv as Oe, bQ as De, bw as ke, ce as Be, cf as fe, b$ as Me, c0 as Ne, cg as Ue, ch as Fe, cJ as ve, c5 as He, dm as Ge, cl as xe, ck as We, bF as we, bJ as Qe, bN as Ye, bC as Ve, dk as je, dg as Ke, cb as ze, bV as Xe, bR as Ze, dn as qe, cL as Je, cK as $e, cA as ao, cH as so, bZ as eo, b_ as oo, c7 as to, bK as ro, c9 as io, cd as co, c1 as bo, bT as no, bW as Ao, c6 as lo, aF as So, df as uo, a7 as go, dc as Co, dp as yo, dl as po, di as Lo, dj as Eo, bM as To, dd as _o, de as ho, cy as Po } from "./index-vc79tKxC.js";
|
|
2
|
+
import { A as Io, t as mo, c as Oo, C as Do, a as ko, D as Bo, J as fo, R as Mo, V as No, i as Uo, z as Fo, d as vo, B as Ho, E as Go, y as xo, v as Wo, K as wo, f as Qo, L as Yo, G as Vo, H as jo, j as Ko, m as zo, n as Xo, p as Zo, r as qo, e as Jo, h as $o, F as at, I as st, u as et, b as ot, g as tt, w as rt } from "./CookieConsentSettings.component-B7HoVxDK.js";
|
|
3
3
|
import { a as ct, A as bt, R as nt, b as At, c as lt, s as dt } from "./token-storage-CbWrBeIP.js";
|
|
4
|
-
import { g as ut, i as gt, j as Ct, A as yt, G as pt, c as Lt, L as Et, d as Tt, e as _t, a as ht, b as Pt, R as Rt, U as It, f as mt, h as Ot, u as Dt } from "./use-auth.hook-
|
|
4
|
+
import { g as ut, i as gt, j as Ct, A as yt, G as pt, c as Lt, L as Et, d as Tt, e as _t, a as ht, b as Pt, R as Rt, U as It, f as mt, h as Ot, u as Dt } from "./use-auth.hook-DatVLGxS.js";
|
|
5
5
|
export {
|
|
6
6
|
e as ABYSS_SERVICE_CONFIG,
|
|
7
7
|
o as ABYSS_SIDEBAR_WIDTH,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a value on its first read, then always returns that same instance.
|
|
3
|
+
*
|
|
4
|
+
* Why it exists: this package is loaded by fronts that pin an older `@abyss-project/main`, where
|
|
5
|
+
* some enums or constants of the current one do not exist yet. Reading one of them at module
|
|
6
|
+
* load (`MfaFactorType.TOTP` in a top-level constant) throws while the package entry is being
|
|
7
|
+
* evaluated, and the whole host app renders a blank page even if it never uses that feature.
|
|
8
|
+
* A table built from `@abyss-project/main` values goes through this helper instead, so the read
|
|
9
|
+
* happens when the feature that needs it runs. Not exported from the package barrel.
|
|
10
|
+
*/
|
|
11
|
+
export declare const lazyValue: <T>(build: () => T) => (() => T);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { SessionPlatform as H, AbyssCore as U, Code as J, AuthResultStatus as V, MfaFactorType as x } from "@abyss-project/main";
|
|
2
|
+
import { l as X } from "./lazy-value-Co76vxsM.js";
|
|
3
|
+
import { browserSupportsWebAuthn as g, startRegistration as $, browserSupportsWebAuthnAutofill as Q, startAuthentication as Z, WebAuthnError as ee } from "@simplewebauthn/browser";
|
|
4
|
+
import { a as c, A as d, s as te } from "./token-storage-CbWrBeIP.js";
|
|
5
|
+
import { createContext as ne, useState as se, useEffect as re, useMemo as oe, useContext as ae } from "react";
|
|
6
|
+
import { jsx as ie } from "react/jsx-runtime";
|
|
7
|
+
var ue = /* @__PURE__ */ ((e) => (e.LOADING = "loading", e.ANONYMOUS = "anonymous", e.AUTHENTICATED = "authenticated", e))(ue || {}), le = /* @__PURE__ */ ((e) => (e.PASSKEY = "passkey", e.TOTP = "totp", e.PASSWORD = "password", e.EMAIL_CODE = "email-code", e))(le || {});
|
|
8
|
+
const ce = 6e4, F = 3e4, de = [
|
|
8
9
|
500,
|
|
9
10
|
1e3,
|
|
10
11
|
2e3
|
|
11
|
-
],
|
|
12
|
+
], fe = [
|
|
12
13
|
7500,
|
|
13
14
|
15e3,
|
|
14
15
|
22500,
|
|
15
16
|
27e3
|
|
16
|
-
], G = 3e4,
|
|
17
|
+
], G = 3e4, pe = 5e3, he = "abyss-auth-refresh", we = 2147483647, me = "Token Expired", Ee = (e) => typeof e == "object" && e !== null && e.isAxiosError === !0, W = (e) => {
|
|
17
18
|
var r;
|
|
18
19
|
if (!Ee(e) || e.code === "ERR_CANCELED")
|
|
19
20
|
return { kind: "other" };
|
|
@@ -27,71 +28,73 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
27
28
|
message: s == null ? void 0 : s.message,
|
|
28
29
|
params: s == null ? void 0 : s.params
|
|
29
30
|
};
|
|
30
|
-
},
|
|
31
|
-
[
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
]
|
|
31
|
+
}, Ae = X(
|
|
32
|
+
() => /* @__PURE__ */ new Map([
|
|
33
|
+
[
|
|
34
|
+
x.TOTP,
|
|
35
|
+
"totp"
|
|
36
|
+
/* TOTP */
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
x.PASSKEY,
|
|
40
|
+
"passkey"
|
|
41
|
+
/* PASSKEY */
|
|
42
|
+
]
|
|
43
|
+
])
|
|
44
|
+
), ye = (e) => {
|
|
42
45
|
const s = e == null ? void 0 : e.methods;
|
|
43
46
|
return Array.isArray(s) ? {
|
|
44
47
|
methods: s.flatMap((r) => {
|
|
45
|
-
const i =
|
|
48
|
+
const i = Ae().get(r);
|
|
46
49
|
return i ? [i] : [];
|
|
47
50
|
})
|
|
48
51
|
} : {};
|
|
49
|
-
},
|
|
50
|
-
const s = e.bridge.platform ===
|
|
52
|
+
}, Re = (e) => new Promise((s) => setTimeout(s, e)), ke = () => typeof navigator > "u" || navigator.onLine !== !1, Te = () => typeof navigator > "u" ? null : navigator.locks ?? null, Ne = (e) => {
|
|
53
|
+
const s = e.bridge.platform === H.WEB, r = e.isOnline ?? ke;
|
|
51
54
|
let i = {
|
|
52
55
|
status: "loading"
|
|
53
56
|
/* LOADING */
|
|
54
|
-
}, a = null, n = null,
|
|
55
|
-
const R = /* @__PURE__ */ new Set(),
|
|
57
|
+
}, a = null, n = null, m = null, y = null, _ = null, E = null, p = null, l = null, A = 0;
|
|
58
|
+
const R = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Set(), S = (t) => {
|
|
56
59
|
i = t, R.forEach((o) => o(i));
|
|
57
|
-
},
|
|
58
|
-
a = t, e.applyToken(t),
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
},
|
|
60
|
+
}, P = (t) => {
|
|
61
|
+
a = t, e.applyToken(t), k.forEach((o) => o(t));
|
|
62
|
+
}, T = () => {
|
|
63
|
+
E && (clearTimeout(E), E = null), p && (clearTimeout(p), p = null);
|
|
64
|
+
}, z = (t) => {
|
|
62
65
|
const o = Date.parse(t);
|
|
63
66
|
if (!Number.isFinite(o))
|
|
64
67
|
return;
|
|
65
68
|
const u = Math.min(
|
|
66
|
-
Math.max(o -
|
|
67
|
-
|
|
69
|
+
Math.max(o - ce - Date.now(), 0),
|
|
70
|
+
we
|
|
68
71
|
);
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
E = setTimeout(() => {
|
|
73
|
+
E = null, h.refresh();
|
|
71
74
|
}, u);
|
|
72
|
-
},
|
|
75
|
+
}, D = async (t) => {
|
|
73
76
|
var o;
|
|
74
|
-
|
|
77
|
+
T(), t.refreshToken && await e.storage.setRefreshToken(t.refreshToken), P(t.accessToken), n = t.user, (o = e.onPersistUser) == null || o.call(e, t.user), S({
|
|
75
78
|
status: "authenticated",
|
|
76
79
|
user: t.user,
|
|
77
80
|
mfaEnrollmentRequired: t.mfaEnrollmentRequired,
|
|
78
81
|
offline: !1
|
|
79
|
-
}),
|
|
82
|
+
}), z(t.accessTokenExpiresAt);
|
|
80
83
|
}, N = async () => {
|
|
81
84
|
var t;
|
|
82
|
-
A += 1,
|
|
85
|
+
A += 1, T(), l = null, await e.storage.setRefreshToken(null), P(null), n = null, (t = e.onPersistUser) == null || t.call(e, null), S({
|
|
83
86
|
status: "anonymous"
|
|
84
87
|
/* ANONYMOUS */
|
|
85
88
|
});
|
|
86
|
-
},
|
|
89
|
+
}, K = () => {
|
|
87
90
|
if (l === null)
|
|
88
91
|
return G;
|
|
89
|
-
const t = Date.now() - l, o =
|
|
90
|
-
(u) => u > t && u <
|
|
92
|
+
const t = Date.now() - l, o = fe.find(
|
|
93
|
+
(u) => u > t && u < F
|
|
91
94
|
);
|
|
92
95
|
return o === void 0 ? (l = null, G) : o - t;
|
|
93
|
-
},
|
|
94
|
-
|
|
96
|
+
}, j = () => {
|
|
97
|
+
T();
|
|
95
98
|
const t = i.user ?? n;
|
|
96
99
|
S(
|
|
97
100
|
t ? {
|
|
@@ -102,7 +105,7 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
102
105
|
} : { status: "anonymous", offline: !0 }
|
|
103
106
|
), p = setTimeout(() => {
|
|
104
107
|
p = null, h.refresh();
|
|
105
|
-
},
|
|
108
|
+
}, K());
|
|
106
109
|
}, I = async () => {
|
|
107
110
|
const t = s ? null : await e.storage.getRefreshToken();
|
|
108
111
|
if (!s && !t)
|
|
@@ -111,10 +114,10 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
111
114
|
return { kind: "offline" };
|
|
112
115
|
const o = Date.now(), u = new AbortController(), f = setTimeout(
|
|
113
116
|
() => u.abort(),
|
|
114
|
-
|
|
117
|
+
pe
|
|
115
118
|
);
|
|
116
119
|
try {
|
|
117
|
-
const w = await
|
|
120
|
+
const w = await U.sdk.auth.refresh(
|
|
118
121
|
t ? { refreshToken: t } : void 0,
|
|
119
122
|
{ signal: u.signal }
|
|
120
123
|
);
|
|
@@ -122,7 +125,7 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
122
125
|
} catch (w) {
|
|
123
126
|
if (u.signal.aborted)
|
|
124
127
|
return { kind: "unreachable", sentAt: o };
|
|
125
|
-
const L =
|
|
128
|
+
const L = W(w);
|
|
126
129
|
if (L.kind === "other")
|
|
127
130
|
throw w;
|
|
128
131
|
return L.kind === "http" && L.status === 401 ? { kind: "revoked" } : { kind: "unreachable", sentAt: o };
|
|
@@ -131,11 +134,11 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
131
134
|
}
|
|
132
135
|
}, O = async () => {
|
|
133
136
|
const t = A;
|
|
134
|
-
l !== null && Date.now() - l >=
|
|
137
|
+
l !== null && Date.now() - l >= F && (l = null);
|
|
135
138
|
let o = await I();
|
|
136
|
-
const u = l === null ?
|
|
139
|
+
const u = l === null ? de : [];
|
|
137
140
|
for (const f of u) {
|
|
138
|
-
if (o.kind !== "unreachable" || t !== A || (l = l ?? o.sentAt, await
|
|
141
|
+
if (o.kind !== "unreachable" || t !== A || (l = l ?? o.sentAt, await Re(f), t !== A))
|
|
139
142
|
break;
|
|
140
143
|
o = await I();
|
|
141
144
|
}
|
|
@@ -145,14 +148,14 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
145
148
|
}
|
|
146
149
|
switch (o.kind) {
|
|
147
150
|
case "session":
|
|
148
|
-
await
|
|
151
|
+
await D(o.session);
|
|
149
152
|
return;
|
|
150
153
|
case "revoked":
|
|
151
154
|
await N();
|
|
152
155
|
return;
|
|
153
156
|
case "offline":
|
|
154
157
|
case "unreachable":
|
|
155
|
-
|
|
158
|
+
j();
|
|
156
159
|
return;
|
|
157
160
|
}
|
|
158
161
|
}, b = () => {
|
|
@@ -168,18 +171,18 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
168
171
|
R.delete(t);
|
|
169
172
|
}),
|
|
170
173
|
accessToken: () => a,
|
|
171
|
-
subscribeToken: (t) => (
|
|
172
|
-
|
|
174
|
+
subscribeToken: (t) => (k.add(t), t(a), () => {
|
|
175
|
+
k.delete(t);
|
|
173
176
|
}),
|
|
174
177
|
bootstrap: () => (_ || (_ = (async () => {
|
|
175
178
|
var t;
|
|
176
179
|
n = await ((t = e.restoreUser) == null ? void 0 : t.call(e)) ?? null, await h.refresh();
|
|
177
180
|
})()), _),
|
|
178
|
-
handleResult: async (t) => (t.status ===
|
|
181
|
+
handleResult: async (t) => (t.status === V.AUTHENTICATED && await D(t.session), t),
|
|
179
182
|
refresh: () => {
|
|
180
183
|
if (!y) {
|
|
181
184
|
const t = s ? Te() : null;
|
|
182
|
-
y = (t ? t.request(
|
|
185
|
+
y = (t ? t.request(he, O) : O()).finally(() => {
|
|
183
186
|
y = null;
|
|
184
187
|
});
|
|
185
188
|
}
|
|
@@ -190,38 +193,38 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
190
193
|
try {
|
|
191
194
|
return await t();
|
|
192
195
|
} catch (u) {
|
|
193
|
-
const f =
|
|
196
|
+
const f = W(u);
|
|
194
197
|
if (f.kind !== "http")
|
|
195
198
|
throw u;
|
|
196
|
-
if (f.status === 401 && f.message ===
|
|
199
|
+
if (f.status === 401 && f.message === me) {
|
|
197
200
|
if (a === o && await h.refresh(), i.status !== "authenticated" || a === null || a === o)
|
|
198
201
|
throw u;
|
|
199
202
|
return t();
|
|
200
203
|
}
|
|
201
|
-
if (f.status === 403 && f.code === J.reauthRequired &&
|
|
202
|
-
if (!await
|
|
204
|
+
if (f.status === 403 && f.code === J.reauthRequired && m) {
|
|
205
|
+
if (!await m(ye(f.params)))
|
|
203
206
|
throw u;
|
|
204
207
|
return t();
|
|
205
208
|
}
|
|
206
209
|
throw u;
|
|
207
210
|
}
|
|
208
211
|
},
|
|
209
|
-
onReauthRequired: (t) => (
|
|
210
|
-
|
|
212
|
+
onReauthRequired: (t) => (m = t, () => {
|
|
213
|
+
m === t && (m = null);
|
|
211
214
|
}),
|
|
212
215
|
logout: async () => {
|
|
213
216
|
try {
|
|
214
|
-
i.status === "authenticated" && a === null && await h.refresh(), a !== null && await h.withAuthRetry(() =>
|
|
217
|
+
i.status === "authenticated" && a === null && await h.refresh(), a !== null && await h.withAuthRetry(() => U.sdk.auth.logout());
|
|
215
218
|
} finally {
|
|
216
219
|
await N();
|
|
217
220
|
}
|
|
218
221
|
},
|
|
219
222
|
dispose: () => {
|
|
220
|
-
|
|
223
|
+
T(), R.clear(), k.clear(), typeof window < "u" && window.removeEventListener("online", b), typeof document < "u" && document.removeEventListener("visibilitychange", M);
|
|
221
224
|
}
|
|
222
225
|
};
|
|
223
226
|
return h;
|
|
224
|
-
},
|
|
227
|
+
}, _e = "https://accounts.google.com/gsi/client", Se = "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1.0/en_US/appleid.auth.js", v = /* @__PURE__ */ new Map(), Y = (e) => {
|
|
225
228
|
const s = v.get(e);
|
|
226
229
|
if (s)
|
|
227
230
|
return s;
|
|
@@ -237,31 +240,31 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
237
240
|
}, document.head.appendChild(n);
|
|
238
241
|
});
|
|
239
242
|
return v.set(e, r), r;
|
|
240
|
-
},
|
|
243
|
+
}, be = [
|
|
241
244
|
"popup_closed_by_user",
|
|
242
245
|
"user_cancelled_authorize"
|
|
243
|
-
],
|
|
246
|
+
], B = (e) => {
|
|
244
247
|
const { name: s, message: r } = e ?? {}, i = typeof r == "string" ? r : "Passkey ceremony failed";
|
|
245
|
-
return s === "NotAllowedError" || s === "AbortError" || e instanceof
|
|
248
|
+
return s === "NotAllowedError" || s === "AbortError" || e instanceof ee && e.code === "ERROR_CEREMONY_ABORTED" ? new c(d.CANCELLED, i, e) : new c(d.FAILED, i, e);
|
|
246
249
|
}, C = (e) => new c(
|
|
247
250
|
d.UNSUPPORTED,
|
|
248
251
|
`${e} is not supported by this browser`
|
|
249
|
-
),
|
|
250
|
-
platform:
|
|
252
|
+
), Ie = (e) => ({
|
|
253
|
+
platform: H.WEB,
|
|
251
254
|
passkeySupported: async () => g(),
|
|
252
255
|
getPasskey: async (s, r = !1) => {
|
|
253
256
|
if (!g())
|
|
254
257
|
throw C("WebAuthn");
|
|
255
|
-
if (r && !await
|
|
258
|
+
if (r && !await Q())
|
|
256
259
|
throw C("Passkey autofill");
|
|
257
260
|
try {
|
|
258
|
-
return await
|
|
261
|
+
return await Z({
|
|
259
262
|
// abyss-main's options are the WebAuthn JSON this call reads (base64url binary fields).
|
|
260
263
|
optionsJSON: s,
|
|
261
264
|
useBrowserAutofill: r
|
|
262
265
|
});
|
|
263
266
|
} catch (i) {
|
|
264
|
-
throw
|
|
267
|
+
throw B(i);
|
|
265
268
|
}
|
|
266
269
|
},
|
|
267
270
|
createPasskey: async (s) => {
|
|
@@ -272,11 +275,11 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
272
275
|
optionsJSON: s
|
|
273
276
|
});
|
|
274
277
|
} catch (r) {
|
|
275
|
-
throw
|
|
278
|
+
throw B(r);
|
|
276
279
|
}
|
|
277
280
|
},
|
|
278
281
|
google: async (s) => {
|
|
279
|
-
await
|
|
282
|
+
await Y(_e);
|
|
280
283
|
const r = window.google;
|
|
281
284
|
if (!r)
|
|
282
285
|
throw new c(
|
|
@@ -325,7 +328,7 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
325
328
|
},
|
|
326
329
|
apple: async (s) => {
|
|
327
330
|
var i;
|
|
328
|
-
await
|
|
331
|
+
await Y(Se);
|
|
329
332
|
const r = window.AppleID;
|
|
330
333
|
if (!r)
|
|
331
334
|
throw new c(
|
|
@@ -338,7 +341,7 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
338
341
|
redirectURI: e.appleRedirectUri,
|
|
339
342
|
usePopup: !0,
|
|
340
343
|
// Apple carries what it is given; abyss-main compares it with SHA-256(raw nonce) in hex.
|
|
341
|
-
nonce: await
|
|
344
|
+
nonce: await te(s)
|
|
342
345
|
});
|
|
343
346
|
try {
|
|
344
347
|
const a = await r.auth.signIn(), n = (i = a.user) == null ? void 0 : i.name;
|
|
@@ -349,43 +352,43 @@ const le = 6e4, x = 3e4, ce = [
|
|
|
349
352
|
};
|
|
350
353
|
} catch (a) {
|
|
351
354
|
const n = a == null ? void 0 : a.error;
|
|
352
|
-
throw typeof n == "string" &&
|
|
355
|
+
throw typeof n == "string" && be.includes(n) ? new c(d.CANCELLED, n, a) : new c(
|
|
353
356
|
d.FAILED,
|
|
354
357
|
typeof n == "string" ? n : "Sign in with Apple failed",
|
|
355
358
|
a
|
|
356
359
|
);
|
|
357
360
|
}
|
|
358
361
|
}
|
|
359
|
-
}), q =
|
|
360
|
-
const [r, i] =
|
|
361
|
-
|
|
362
|
+
}), q = ne(null), Oe = ({ client: e, children: s }) => {
|
|
363
|
+
const [r, i] = se(() => e.state());
|
|
364
|
+
re(() => {
|
|
362
365
|
i(e.state());
|
|
363
366
|
const n = e.subscribe(i);
|
|
364
367
|
return e.bootstrap(), n;
|
|
365
368
|
}, [e]);
|
|
366
|
-
const a =
|
|
367
|
-
return /* @__PURE__ */
|
|
368
|
-
},
|
|
369
|
-
const e =
|
|
369
|
+
const a = oe(() => ({ state: r, client: e }), [r, e]);
|
|
370
|
+
return /* @__PURE__ */ ie(q.Provider, { value: a, children: s });
|
|
371
|
+
}, Me = () => {
|
|
372
|
+
const e = ae(q);
|
|
370
373
|
if (!e)
|
|
371
374
|
throw new Error("useAuth() must be called inside <AuthProvider>");
|
|
372
375
|
return e;
|
|
373
376
|
};
|
|
374
377
|
export {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
378
|
+
ue as A,
|
|
379
|
+
_e as G,
|
|
380
|
+
de as L,
|
|
381
|
+
le as R,
|
|
379
382
|
G as U,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
383
|
+
ce as a,
|
|
384
|
+
F as b,
|
|
385
|
+
fe as c,
|
|
386
|
+
pe as d,
|
|
387
|
+
he as e,
|
|
388
|
+
Ne as f,
|
|
389
|
+
Se as g,
|
|
390
|
+
Ie as h,
|
|
388
391
|
q as i,
|
|
389
|
-
|
|
390
|
-
|
|
392
|
+
Oe as j,
|
|
393
|
+
Me as u
|
|
391
394
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abyss-project/commons-front-core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Front Core package of AbyssProject",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"react-is": "^18.0.0 || ^19.0.0",
|
|
70
70
|
"react-router-dom": "^6.15.0",
|
|
71
71
|
"zustand": "^5.0.0",
|
|
72
|
-
"@abyss-project/main": "13.
|
|
72
|
+
"@abyss-project/main": "13.4.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {
|
|
75
75
|
"@abyss-project/capacitor-auth": {
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"use-debounce": "^10.0.5",
|
|
117
117
|
"uuid": "^9.0.0",
|
|
118
118
|
"yup": "^0.32.11",
|
|
119
|
-
"@abyss-project/main": "13.
|
|
119
|
+
"@abyss-project/main": "13.4.0"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@abyss-project/cloud": "^2.4.0",
|