@bitplanet/deva-sdk 0.8.3 → 0.8.5
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/assets/deva-sdk.css +1 -1
- package/dist/components.d.ts +53 -79
- package/dist/components.es.js +16534 -16001
- package/dist/config-CBh0zg_P.js +677 -0
- package/dist/index.d.ts +53 -79
- package/dist/index.es.js +251 -207
- package/package.json +20 -18
- package/dist/config-CL6PuR8K.js +0 -669
package/dist/index.es.js
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { f as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as oe } from "react/jsx-runtime";
|
|
2
|
+
import { useState as U, useCallback as p, useEffect as v, useLayoutEffect as se, useRef as S, useContext as ae } from "react";
|
|
3
|
+
import { f as Y, D as G, u as q, e as K } from "./config-CBh0zg_P.js";
|
|
4
|
+
const ce = () => {
|
|
5
5
|
const e = new Uint8Array(32);
|
|
6
|
-
return crypto.getRandomValues(e),
|
|
7
|
-
},
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
if (!
|
|
6
|
+
return crypto.getRandomValues(e), Q(e);
|
|
7
|
+
}, Q = (e) => btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), ie = async (e) => {
|
|
8
|
+
const t = new TextEncoder().encode(e), o = await crypto.subtle.digest("SHA-256", t);
|
|
9
|
+
return Q(o);
|
|
10
|
+
}, ue = (e) => Math.round(Date.now() / 1e3 + Number(e)), H = (e) => Math.round(Date.now()) / 1e3 + 60 >= e, D = typeof window < "u", de = (e, r) => {
|
|
11
|
+
if (!D)
|
|
12
12
|
return r;
|
|
13
13
|
try {
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
} catch (
|
|
17
|
-
return console.error(
|
|
14
|
+
const t = sessionStorage.getItem(e);
|
|
15
|
+
return t ? JSON.parse(t) : r;
|
|
16
|
+
} catch (t) {
|
|
17
|
+
return console.error(t), r;
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
function
|
|
21
|
-
const [
|
|
22
|
-
() =>
|
|
23
|
-
),
|
|
24
|
-
(
|
|
20
|
+
function k(e, r) {
|
|
21
|
+
const [t, o] = U(
|
|
22
|
+
() => de(e, r)
|
|
23
|
+
), u = p(
|
|
24
|
+
(n) => {
|
|
25
25
|
try {
|
|
26
|
-
o(
|
|
27
|
-
} catch (
|
|
28
|
-
console.error(
|
|
26
|
+
o(n), D && sessionStorage.setItem(e, JSON.stringify(n));
|
|
27
|
+
} catch (a) {
|
|
28
|
+
console.error(a);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
[e]
|
|
32
32
|
);
|
|
33
|
-
return
|
|
34
|
-
if (!
|
|
33
|
+
return v(() => {
|
|
34
|
+
if (!D)
|
|
35
35
|
return;
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
36
|
+
const n = sessionStorage.getItem(e);
|
|
37
|
+
if (n)
|
|
38
38
|
try {
|
|
39
|
-
o(JSON.parse(
|
|
40
|
-
} catch (
|
|
41
|
-
console.error(
|
|
39
|
+
o(JSON.parse(n));
|
|
40
|
+
} catch (a) {
|
|
41
|
+
console.error(a);
|
|
42
42
|
}
|
|
43
|
-
}, []),
|
|
44
|
-
if (!
|
|
43
|
+
}, []), v(() => {
|
|
44
|
+
if (!D)
|
|
45
45
|
return;
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
if (
|
|
46
|
+
const n = (a) => {
|
|
47
|
+
if (a.storageArea === window.sessionStorage && a.key === e)
|
|
48
|
+
if (a.newValue === null)
|
|
49
49
|
o(r);
|
|
50
50
|
else
|
|
51
51
|
try {
|
|
52
|
-
o(JSON.parse(
|
|
52
|
+
o(JSON.parse(a.newValue));
|
|
53
53
|
} catch {
|
|
54
54
|
console.warn(
|
|
55
|
-
`Failed to handle storageEvent's newValue='${
|
|
55
|
+
`Failed to handle storageEvent's newValue='${a.newValue}' for key '${e}'`
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
return window.addEventListener("storage",
|
|
60
|
-
}, [e, r]), [
|
|
59
|
+
return window.addEventListener("storage", n, !1), () => window.removeEventListener("storage", n, !1);
|
|
60
|
+
}, [e, r]), [t, u];
|
|
61
61
|
}
|
|
62
|
-
class
|
|
62
|
+
class T extends Error {
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
function
|
|
66
|
-
return decodeURIComponent(atob(e).replace(/(.)/g, (r,
|
|
67
|
-
let o =
|
|
64
|
+
T.prototype.name = "InvalidTokenError";
|
|
65
|
+
function fe(e) {
|
|
66
|
+
return decodeURIComponent(atob(e).replace(/(.)/g, (r, t) => {
|
|
67
|
+
let o = t.charCodeAt(0).toString(16).toUpperCase();
|
|
68
68
|
return o.length < 2 && (o = "0" + o), "%" + o;
|
|
69
69
|
}));
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function le(e) {
|
|
72
72
|
let r = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
73
73
|
switch (r.length % 4) {
|
|
74
74
|
case 0:
|
|
@@ -83,58 +83,58 @@ function de(e) {
|
|
|
83
83
|
throw new Error("base64 string is not of the correct length");
|
|
84
84
|
}
|
|
85
85
|
try {
|
|
86
|
-
return
|
|
86
|
+
return fe(r);
|
|
87
87
|
} catch {
|
|
88
88
|
return atob(r);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function he(e, r) {
|
|
92
92
|
if (typeof e != "string")
|
|
93
|
-
throw new
|
|
93
|
+
throw new T("Invalid token specified: must be a string");
|
|
94
94
|
r || (r = {});
|
|
95
|
-
const
|
|
95
|
+
const t = r.header === !0 ? 0 : 1, o = e.split(".")[t];
|
|
96
96
|
if (typeof o != "string")
|
|
97
|
-
throw new
|
|
98
|
-
let
|
|
97
|
+
throw new T(`Invalid token specified: missing part #${t + 1}`);
|
|
98
|
+
let u;
|
|
99
99
|
try {
|
|
100
|
-
|
|
101
|
-
} catch (
|
|
102
|
-
throw new
|
|
100
|
+
u = le(o);
|
|
101
|
+
} catch (n) {
|
|
102
|
+
throw new T(`Invalid token specified: invalid base64 for part #${t + 1} (${n.message})`);
|
|
103
103
|
}
|
|
104
104
|
try {
|
|
105
|
-
return JSON.parse(
|
|
106
|
-
} catch (
|
|
107
|
-
throw new
|
|
105
|
+
return JSON.parse(u);
|
|
106
|
+
} catch (n) {
|
|
107
|
+
throw new T(`Invalid token specified: invalid json for part #${t + 1} (${n.message})`);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
110
|
+
const pe = typeof window < "u" ? se : v;
|
|
111
|
+
function ge(e, r, t = [], o, u) {
|
|
112
|
+
const n = S(e);
|
|
113
|
+
pe(() => {
|
|
114
|
+
n.current = e;
|
|
115
|
+
}, t), v(() => {
|
|
116
116
|
if (!r && r !== 0)
|
|
117
117
|
return;
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const a = o(() => {
|
|
119
|
+
n.current();
|
|
120
120
|
}, r);
|
|
121
121
|
return () => {
|
|
122
|
-
|
|
122
|
+
u(a);
|
|
123
123
|
};
|
|
124
124
|
}, [r]);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
126
|
+
function we(e, r, t = []) {
|
|
127
|
+
ge(e, r, t, setInterval, clearInterval);
|
|
128
128
|
}
|
|
129
|
-
const
|
|
129
|
+
const V = typeof window < "u" && typeof document < "u", b = (...e) => {
|
|
130
130
|
console.log("[sdk/provider]", ...e);
|
|
131
|
-
},
|
|
132
|
-
const r =
|
|
133
|
-
|
|
131
|
+
}, me = (e) => {
|
|
132
|
+
const r = K(e), { data: t, error: o, isLoading: u } = q(
|
|
133
|
+
V ? `${r}/.well-known/openid-configuration` : null
|
|
134
134
|
);
|
|
135
|
-
return { openIdConfig:
|
|
136
|
-
},
|
|
137
|
-
const { data:
|
|
135
|
+
return { openIdConfig: t, isOpenIdConfigLoading: u, error: o };
|
|
136
|
+
}, ye = (e, r) => {
|
|
137
|
+
const { data: t, error: o, isLoading: u } = q(
|
|
138
138
|
r ? e : !1,
|
|
139
139
|
{
|
|
140
140
|
headers: {
|
|
@@ -143,16 +143,16 @@ const $ = typeof window < "u" && typeof document < "u", A = (...e) => {
|
|
|
143
143
|
}
|
|
144
144
|
);
|
|
145
145
|
return {
|
|
146
|
-
userInfo:
|
|
147
|
-
isUserInfoLoading:
|
|
146
|
+
userInfo: t,
|
|
147
|
+
isUserInfoLoading: u,
|
|
148
148
|
userInfoError: o
|
|
149
149
|
};
|
|
150
|
-
},
|
|
151
|
-
if (!r || !
|
|
152
|
-
|
|
150
|
+
}, ke = (e, r, t) => p(async () => {
|
|
151
|
+
if (!r || !t) {
|
|
152
|
+
b("no refresh token or token endpoint");
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
-
return
|
|
155
|
+
return Y(t, {
|
|
156
156
|
method: "POST",
|
|
157
157
|
headers: {
|
|
158
158
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -162,8 +162,8 @@ const $ = typeof window < "u" && typeof document < "u", A = (...e) => {
|
|
|
162
162
|
refresh_token: r
|
|
163
163
|
})
|
|
164
164
|
});
|
|
165
|
-
}, [r, e,
|
|
166
|
-
!
|
|
165
|
+
}, [r, e, t]), ve = (e, r, t) => p(async () => {
|
|
166
|
+
!t || !e || await fetch(t, {
|
|
167
167
|
method: "POST",
|
|
168
168
|
headers: {
|
|
169
169
|
"Content-Type": "application/json"
|
|
@@ -173,18 +173,18 @@ const $ = typeof window < "u" && typeof document < "u", A = (...e) => {
|
|
|
173
173
|
client_id: r
|
|
174
174
|
})
|
|
175
175
|
});
|
|
176
|
-
}, [e, r,
|
|
177
|
-
function
|
|
176
|
+
}, [e, r, t]);
|
|
177
|
+
function Se({
|
|
178
178
|
clientId: e,
|
|
179
179
|
redirectUri: r,
|
|
180
|
-
children:
|
|
180
|
+
children: t,
|
|
181
181
|
env: o
|
|
182
182
|
}) {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
o === "development" && !
|
|
183
|
+
const u = K(o), { openIdConfig: n, isOpenIdConfigLoading: a, error: M } = me(o);
|
|
184
|
+
M && console.error("[sdk/provider] error fetching openid info: ", M);
|
|
185
|
+
const J = S(!1), F = S(!1);
|
|
186
|
+
v(() => {
|
|
187
|
+
o === "development" && !F.current && (F.current = !0, console.warn(
|
|
188
188
|
`
|
|
189
189
|
========================================
|
|
190
190
|
⚠️ WARNING: DEVELOPMENT ENVIRONMENT ⚠️
|
|
@@ -198,134 +198,178 @@ Please verify your environment settings and use 'staging' or 'production' instea
|
|
|
198
198
|
`
|
|
199
199
|
));
|
|
200
200
|
}, [o]);
|
|
201
|
-
const [
|
|
201
|
+
const [X, w] = k("code_verifier", ""), [O, _] = k(
|
|
202
202
|
"auth_in_progress",
|
|
203
203
|
!1
|
|
204
|
-
), [
|
|
204
|
+
), [Z, P] = k("id_token", null), [f, A] = k(
|
|
205
205
|
"access_token",
|
|
206
206
|
null
|
|
207
|
-
), [
|
|
207
|
+
), [g, I] = k(
|
|
208
208
|
"refresh_token",
|
|
209
209
|
null
|
|
210
|
-
), [
|
|
211
|
-
(
|
|
212
|
-
let d =
|
|
213
|
-
|
|
210
|
+
), [m, L] = k("expires_in", 0), [N, l] = U(!0), y = p(
|
|
211
|
+
(c) => {
|
|
212
|
+
let d = m;
|
|
213
|
+
A(c.access_token), P(c.id_token);
|
|
214
214
|
try {
|
|
215
|
-
const
|
|
216
|
-
d = Math.round(Number(
|
|
217
|
-
} catch (
|
|
215
|
+
const i = he(c.id_token);
|
|
216
|
+
d = Math.round(Number(i.exp) - Date.now() / 1e3);
|
|
217
|
+
} catch (i) {
|
|
218
218
|
console.warn(
|
|
219
|
-
`[sdk/provider]: Failed to decode idToken: ${
|
|
219
|
+
`[sdk/provider]: Failed to decode idToken: ${i.message}`
|
|
220
220
|
);
|
|
221
221
|
}
|
|
222
|
-
const
|
|
223
|
-
|
|
222
|
+
const s = c.expires_in ?? d;
|
|
223
|
+
L(ue(s)), I(c.refresh_token), w("");
|
|
224
224
|
},
|
|
225
225
|
[
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
226
|
+
A,
|
|
227
|
+
P,
|
|
228
|
+
L,
|
|
229
|
+
I,
|
|
230
|
+
w,
|
|
231
|
+
m
|
|
232
232
|
]
|
|
233
|
-
), [
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
),
|
|
237
|
-
|
|
233
|
+
), [ee, C] = U(null), { userInfo: re } = ye(
|
|
234
|
+
n == null ? void 0 : n.userinfo_endpoint,
|
|
235
|
+
N ? null : f
|
|
236
|
+
), R = p(() => {
|
|
237
|
+
w(""), _(!1), A(""), P(""), L(0), I("");
|
|
238
238
|
}, [
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
]),
|
|
239
|
+
w,
|
|
240
|
+
_,
|
|
241
|
+
A,
|
|
242
|
+
P,
|
|
243
|
+
L,
|
|
244
|
+
I
|
|
245
|
+
]), j = ve(
|
|
246
246
|
f,
|
|
247
247
|
e,
|
|
248
|
-
|
|
249
|
-
),
|
|
250
|
-
await
|
|
251
|
-
}, [
|
|
252
|
-
|
|
248
|
+
n == null ? void 0 : n.revocation_endpoint
|
|
249
|
+
), z = p(async () => {
|
|
250
|
+
await j(), R(), C(null);
|
|
251
|
+
}, [R, j]), E = ke(
|
|
252
|
+
e,
|
|
253
|
+
g,
|
|
254
|
+
n == null ? void 0 : n.token_endpoint
|
|
255
|
+
), B = p(async () => {
|
|
256
|
+
if (f && !H(m))
|
|
253
257
|
return;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
if (g) {
|
|
259
|
+
if (a)
|
|
260
|
+
return;
|
|
261
|
+
l(!0);
|
|
262
|
+
try {
|
|
263
|
+
const i = await E();
|
|
264
|
+
if (i) {
|
|
265
|
+
y(i), h.current = 0;
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
} catch (i) {
|
|
269
|
+
console.error("[sdk/provider]: Error refreshing token during login", i);
|
|
270
|
+
} finally {
|
|
271
|
+
l(!1);
|
|
272
|
+
}
|
|
273
|
+
try {
|
|
274
|
+
await new Promise((ne) => setTimeout(ne, 2e3)), l(!0);
|
|
275
|
+
const i = await E();
|
|
276
|
+
if (i) {
|
|
277
|
+
y(i), h.current = 0;
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
} catch (i) {
|
|
281
|
+
console.error("[sdk/provider]: Retry refresh also failed", i);
|
|
282
|
+
} finally {
|
|
283
|
+
l(!1);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (R(), _(!0), a)
|
|
287
|
+
return;
|
|
288
|
+
const c = ce(), d = await ie(c);
|
|
289
|
+
w(c);
|
|
290
|
+
const s = new URL((n == null ? void 0 : n.authorization_endpoint) ?? "");
|
|
291
|
+
s.searchParams.append("client_id", e), s.searchParams.append("redirect_uri", r), s.searchParams.append("response_type", "code"), s.searchParams.append("code_challenge", d), s.searchParams.append("code_challenge_method", "S256"), window.location.assign(s.toString());
|
|
258
292
|
}, [
|
|
259
|
-
|
|
260
|
-
r,
|
|
261
|
-
l,
|
|
293
|
+
f,
|
|
262
294
|
m,
|
|
263
295
|
g,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
296
|
+
E,
|
|
297
|
+
y,
|
|
298
|
+
l,
|
|
267
299
|
e,
|
|
300
|
+
r,
|
|
268
301
|
w,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
302
|
+
R,
|
|
303
|
+
_,
|
|
304
|
+
a,
|
|
305
|
+
n
|
|
306
|
+
]), h = S(0), W = S(0), $ = p(
|
|
307
|
+
async (c = !1) => {
|
|
272
308
|
if (!f) {
|
|
273
|
-
|
|
309
|
+
b("no access token");
|
|
274
310
|
return;
|
|
275
311
|
}
|
|
276
|
-
if (!(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
312
|
+
if (!H(m) && !c) {
|
|
313
|
+
h.current = 0;
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
if (N && !c) {
|
|
317
|
+
b("already refreshing");
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (!g) {
|
|
321
|
+
b("no refresh token");
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const d = h.current;
|
|
325
|
+
if (d > 0 && !c) {
|
|
326
|
+
const s = Math.min(1e3 * Math.pow(2, d), 3e5);
|
|
327
|
+
if (Date.now() - W.current < s)
|
|
283
328
|
return;
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
329
|
+
}
|
|
330
|
+
W.current = Date.now(), l(!0);
|
|
331
|
+
try {
|
|
332
|
+
const s = await E();
|
|
333
|
+
s ? (y(s), h.current = 0) : (h.current++, b(`refresh returned empty response (attempt ${h.current})`));
|
|
334
|
+
} catch (s) {
|
|
335
|
+
h.current++, console.error(`[sdk/provider]: Error refreshing token (attempt ${h.current})`, s);
|
|
336
|
+
} finally {
|
|
337
|
+
l(!1);
|
|
294
338
|
}
|
|
295
339
|
},
|
|
296
340
|
[
|
|
297
341
|
f,
|
|
298
|
-
|
|
299
|
-
z,
|
|
300
|
-
L,
|
|
301
|
-
T,
|
|
342
|
+
g,
|
|
302
343
|
E,
|
|
303
|
-
|
|
344
|
+
y,
|
|
345
|
+
N,
|
|
346
|
+
m,
|
|
347
|
+
l
|
|
304
348
|
]
|
|
305
|
-
),
|
|
306
|
-
|
|
349
|
+
), te = 1e4 * Math.random();
|
|
350
|
+
we(
|
|
307
351
|
() => {
|
|
308
|
-
|
|
352
|
+
$();
|
|
309
353
|
},
|
|
310
|
-
|
|
311
|
-
[
|
|
312
|
-
),
|
|
313
|
-
let
|
|
314
|
-
if (
|
|
315
|
-
if (
|
|
316
|
-
|
|
354
|
+
V && g ? 1e4 + te : null,
|
|
355
|
+
[$]
|
|
356
|
+
), v(() => {
|
|
357
|
+
let c = "";
|
|
358
|
+
if (V && !a) {
|
|
359
|
+
if (O) {
|
|
360
|
+
l(!1);
|
|
317
361
|
const d = new URLSearchParams(window.location.search);
|
|
318
|
-
if (
|
|
319
|
-
const
|
|
362
|
+
if (c = d.get("code") ?? "", !c) {
|
|
363
|
+
const s = d.get("error_description") ?? "An unknown error occurred";
|
|
320
364
|
console.error(
|
|
321
|
-
`[sdk/provider]: ${
|
|
365
|
+
`[sdk/provider]: ${s}
|
|
322
366
|
Expected to find a '?code=' parameter in the URL but found none`
|
|
323
|
-
),
|
|
367
|
+
), C(s), R();
|
|
324
368
|
return;
|
|
325
369
|
}
|
|
326
|
-
if (
|
|
370
|
+
if (_(!1), J.current)
|
|
327
371
|
return;
|
|
328
|
-
|
|
372
|
+
J.current = !0, Y((n == null ? void 0 : n.token_endpoint) ?? "", {
|
|
329
373
|
method: "POST",
|
|
330
374
|
headers: {
|
|
331
375
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -333,50 +377,50 @@ Expected to find a '?code=' parameter in the URL but found none`
|
|
|
333
377
|
body: new URLSearchParams({
|
|
334
378
|
client_id: e,
|
|
335
379
|
redirect_uri: r,
|
|
336
|
-
code:
|
|
337
|
-
code_verifier:
|
|
380
|
+
code: c,
|
|
381
|
+
code_verifier: X,
|
|
338
382
|
grant_type: "authorization_code"
|
|
339
383
|
})
|
|
340
|
-
}).then(
|
|
341
|
-
console.error("[sdk/provider]: error in fetching",
|
|
384
|
+
}).then(y).catch((s) => {
|
|
385
|
+
console.error("[sdk/provider]: error in fetching", s), C("An error occurred while fetching tokens");
|
|
342
386
|
}), window.history.replaceState({}, document.title, window.location.pathname);
|
|
343
387
|
}
|
|
344
|
-
|
|
388
|
+
$(!0);
|
|
345
389
|
}
|
|
346
|
-
}, [
|
|
347
|
-
const
|
|
348
|
-
isAuthenticated: !!f && !
|
|
390
|
+
}, [a]);
|
|
391
|
+
const x = {
|
|
392
|
+
isAuthenticated: !!f && !N,
|
|
349
393
|
accessToken: f,
|
|
350
|
-
user:
|
|
351
|
-
login:
|
|
352
|
-
logout:
|
|
353
|
-
isReady: !
|
|
394
|
+
user: re ?? null,
|
|
395
|
+
login: B,
|
|
396
|
+
logout: z,
|
|
397
|
+
isReady: !a && !O
|
|
354
398
|
};
|
|
355
|
-
return /* @__PURE__ */
|
|
356
|
-
|
|
399
|
+
return /* @__PURE__ */ oe(
|
|
400
|
+
G.Provider,
|
|
357
401
|
{
|
|
358
402
|
value: {
|
|
359
403
|
clientId: e,
|
|
360
404
|
redirectUri: r,
|
|
361
405
|
env: o,
|
|
362
|
-
login:
|
|
363
|
-
logout:
|
|
364
|
-
authInProgress:
|
|
365
|
-
authError:
|
|
366
|
-
idToken:
|
|
406
|
+
login: B,
|
|
407
|
+
logout: z,
|
|
408
|
+
authInProgress: O,
|
|
409
|
+
authError: ee,
|
|
410
|
+
idToken: Z,
|
|
367
411
|
accessToken: f,
|
|
368
|
-
refreshToken:
|
|
369
|
-
user:
|
|
370
|
-
isAuthenticated:
|
|
371
|
-
isReady:
|
|
372
|
-
url:
|
|
412
|
+
refreshToken: g,
|
|
413
|
+
user: x.user,
|
|
414
|
+
isAuthenticated: x.isAuthenticated,
|
|
415
|
+
isReady: x.isReady,
|
|
416
|
+
url: u
|
|
373
417
|
},
|
|
374
|
-
children: typeof
|
|
418
|
+
children: typeof t == "function" ? t(x) : t
|
|
375
419
|
}
|
|
376
420
|
);
|
|
377
421
|
}
|
|
378
|
-
const
|
|
379
|
-
const e =
|
|
422
|
+
const Te = () => {
|
|
423
|
+
const e = ae(G);
|
|
380
424
|
if (!e)
|
|
381
425
|
throw new Error("useDeva must be used within a DevaProvider");
|
|
382
426
|
return {
|
|
@@ -389,6 +433,6 @@ const Ee = () => {
|
|
|
389
433
|
};
|
|
390
434
|
};
|
|
391
435
|
export {
|
|
392
|
-
|
|
393
|
-
|
|
436
|
+
Se as DevaProvider,
|
|
437
|
+
Te as useDeva
|
|
394
438
|
};
|