@axa-fr/react-oidc 7.4.1 → 7.5.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/README.md +4 -1
- package/dist/index.js +215 -208
- package/dist/index.umd.cjs +7 -7
- package/package.json +3 -3
- package/src/FetchToken.tsx +7 -1
package/README.md
CHANGED
|
@@ -31,7 +31,8 @@ We provide a wrapper **@axa-fr/react-oidc** for **React** (compatible next.js) a
|
|
|
31
31
|
@axa-fr/react is:
|
|
32
32
|
|
|
33
33
|
- **Secure** :
|
|
34
|
-
- With
|
|
34
|
+
- With Demonstrating Proof of Possession (DPoP), your access_token and refresh_token are not usable outside your browser context (big protection)
|
|
35
|
+
- With the use of Service Worker, your tokens (refresh_token and/or access_token) are not accessible to the JavaScript client code (if you follow good practices from [`FAQ`](https://github.com/AxaFrance/oidc-client/blob/main/FAQ.md) section)
|
|
35
36
|
- OIDC using client side Code Credential Grant with pkce only
|
|
36
37
|
- **Lightweight** : Unpacked Size on npm is **274 kB**
|
|
37
38
|
- **Simple**
|
|
@@ -141,6 +142,7 @@ const configuration = {
|
|
|
141
142
|
authority: "https://demo.duendesoftware.com",
|
|
142
143
|
service_worker_relative_url: "/OidcServiceWorker.js", // just comment that line to disable service worker mode
|
|
143
144
|
service_worker_only: false,
|
|
145
|
+
demonstrating_proof_of_possession: true, // demonstrating proof of possession will work only if access_token is accessible from the client (This is because WebCrypto API is not available inside a Service Worker)
|
|
144
146
|
};
|
|
145
147
|
|
|
146
148
|
const App = () => (
|
|
@@ -197,6 +199,7 @@ const configuration = {
|
|
|
197
199
|
onLogoutFromSameTab: Function, // Optional, can be set to override the default behavior, this function is triggered when a user is logged out from the same tab when session_monitor is active
|
|
198
200
|
token_renew_mode: String, // Optional, update tokens based on the selected token(s) lifetime: "access_token_or_id_token_invalid" (default), "access_token_invalid", "id_token_invalid"
|
|
199
201
|
logout_tokens_to_invalidate: Array<string>, // Optional tokens to invalidate during logout, default: ['access_token', 'refresh_token']
|
|
202
|
+
demonstrating_proof_of_possession: Boolean, // Optional, default is false, if true, the the Demonstrating Proof of Possession will be activated //https://www.rfc-editor.org/rfc/rfc9449.html#name-protected-resource-access
|
|
200
203
|
}.isRequired,
|
|
201
204
|
};
|
|
202
205
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import be, { useCallback as kt, useState as
|
|
2
|
-
import { OidcClient as
|
|
1
|
+
import be, { useCallback as kt, useState as S, useEffect as O } from "react";
|
|
2
|
+
import { OidcClient as v, getParseQueryStringFromLocation as mt, getPath as z, getFetchDefault as Et } from "@axa-fr/oidc-client";
|
|
3
3
|
import { TokenRenewMode as rr } from "@axa-fr/oidc-client";
|
|
4
4
|
var ye = { exports: {} }, G = {};
|
|
5
5
|
/**
|
|
@@ -17,15 +17,15 @@ function Tt() {
|
|
|
17
17
|
return G;
|
|
18
18
|
Ye = 1;
|
|
19
19
|
var o = be, s = Symbol.for("react.element"), r = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, u = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
-
function h(
|
|
21
|
-
var b, m = {}, C = null,
|
|
22
|
-
g !== void 0 && (C = "" + g),
|
|
23
|
-
for (b in
|
|
24
|
-
a.call(
|
|
25
|
-
if (
|
|
26
|
-
for (b in
|
|
27
|
-
m[b] === void 0 && (m[b] =
|
|
28
|
-
return { $$typeof: s, type:
|
|
20
|
+
function h(i, d, g) {
|
|
21
|
+
var b, m = {}, C = null, A = null;
|
|
22
|
+
g !== void 0 && (C = "" + g), d.key !== void 0 && (C = "" + d.key), d.ref !== void 0 && (A = d.ref);
|
|
23
|
+
for (b in d)
|
|
24
|
+
a.call(d, b) && !l.hasOwnProperty(b) && (m[b] = d[b]);
|
|
25
|
+
if (i && i.defaultProps)
|
|
26
|
+
for (b in d = i.defaultProps, d)
|
|
27
|
+
m[b] === void 0 && (m[b] = d[b]);
|
|
28
|
+
return { $$typeof: s, type: i, key: C, ref: A, props: m, _owner: u.current };
|
|
29
29
|
}
|
|
30
30
|
return G.Fragment = r, G.jsx = h, G.jsxs = h, G;
|
|
31
31
|
}
|
|
@@ -42,24 +42,24 @@ var H = {};
|
|
|
42
42
|
var Me;
|
|
43
43
|
function wt() {
|
|
44
44
|
return Me || (Me = 1, process.env.NODE_ENV !== "production" && function() {
|
|
45
|
-
var o = be, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), h = Symbol.for("react.provider"),
|
|
45
|
+
var o = be, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), i = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), K = Symbol.iterator, $ = "@@iterator";
|
|
46
46
|
function ne(e) {
|
|
47
47
|
if (e === null || typeof e != "object")
|
|
48
48
|
return null;
|
|
49
|
-
var t = K && e[K] || e[
|
|
49
|
+
var t = K && e[K] || e[$];
|
|
50
50
|
return typeof t == "function" ? t : null;
|
|
51
51
|
}
|
|
52
52
|
var L = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
53
53
|
function R(e) {
|
|
54
54
|
{
|
|
55
|
-
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0),
|
|
56
|
-
n[
|
|
57
|
-
|
|
55
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), f = 1; f < t; f++)
|
|
56
|
+
n[f - 1] = arguments[f];
|
|
57
|
+
U("error", e, n);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function U(e, t, n) {
|
|
61
61
|
{
|
|
62
|
-
var
|
|
62
|
+
var f = L.ReactDebugCurrentFrame, y = f.getStackAddendum();
|
|
63
63
|
y !== "" && (t += "%s", n = n.concat([y]));
|
|
64
64
|
var k = n.map(function(_) {
|
|
65
65
|
return String(_);
|
|
@@ -70,23 +70,23 @@ function wt() {
|
|
|
70
70
|
var oe = !1, se = !1, ae = !1, ie = !1, W = !1, X;
|
|
71
71
|
X = Symbol.for("react.module.reference");
|
|
72
72
|
function ce(e) {
|
|
73
|
-
return !!(typeof e == "string" || typeof e == "function" || e === a || e === l || W || e === u || e === g || e === b || ie || e ===
|
|
73
|
+
return !!(typeof e == "string" || typeof e == "function" || e === a || e === l || W || e === u || e === g || e === b || ie || e === A || oe || se || ae || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === m || e.$$typeof === h || e.$$typeof === i || e.$$typeof === d || // This needs to include all possible module reference object
|
|
74
74
|
// types supported by any Flight configuration anywhere since
|
|
75
75
|
// we don't know which Flight build this will end up being used
|
|
76
76
|
// with.
|
|
77
77
|
e.$$typeof === X || e.getModuleId !== void 0));
|
|
78
78
|
}
|
|
79
79
|
function Y(e, t, n) {
|
|
80
|
-
var
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
80
|
+
var f = e.displayName;
|
|
81
|
+
if (f)
|
|
82
|
+
return f;
|
|
83
83
|
var y = t.displayName || t.name || "";
|
|
84
84
|
return y !== "" ? n + "(" + y + ")" : n;
|
|
85
85
|
}
|
|
86
86
|
function M(e) {
|
|
87
87
|
return e.displayName || "Context";
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function F(e) {
|
|
90
90
|
if (e == null)
|
|
91
91
|
return null;
|
|
92
92
|
if (typeof e.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
@@ -109,21 +109,21 @@ function wt() {
|
|
|
109
109
|
}
|
|
110
110
|
if (typeof e == "object")
|
|
111
111
|
switch (e.$$typeof) {
|
|
112
|
-
case
|
|
112
|
+
case i:
|
|
113
113
|
var t = e;
|
|
114
114
|
return M(t) + ".Consumer";
|
|
115
115
|
case h:
|
|
116
116
|
var n = e;
|
|
117
117
|
return M(n._context) + ".Provider";
|
|
118
|
-
case
|
|
118
|
+
case d:
|
|
119
119
|
return Y(e, e.render, "ForwardRef");
|
|
120
120
|
case m:
|
|
121
|
-
var
|
|
122
|
-
return
|
|
121
|
+
var f = e.displayName || null;
|
|
122
|
+
return f !== null ? f : F(e.type) || "Memo";
|
|
123
123
|
case C: {
|
|
124
124
|
var y = e, k = y._payload, _ = y._init;
|
|
125
125
|
try {
|
|
126
|
-
return
|
|
126
|
+
return F(_(k));
|
|
127
127
|
} catch {
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
@@ -131,14 +131,14 @@ function wt() {
|
|
|
131
131
|
}
|
|
132
132
|
return null;
|
|
133
133
|
}
|
|
134
|
-
var
|
|
134
|
+
var P = Object.assign, N = 0, T, D, me, Ee, Te, we, Ce;
|
|
135
135
|
function Re() {
|
|
136
136
|
}
|
|
137
137
|
Re.__reactDisabledLog = !0;
|
|
138
138
|
function Je() {
|
|
139
139
|
{
|
|
140
|
-
if (
|
|
141
|
-
T = console.log,
|
|
140
|
+
if (N === 0) {
|
|
141
|
+
T = console.log, D = console.info, me = console.warn, Ee = console.error, Te = console.group, we = console.groupCollapsed, Ce = console.groupEnd;
|
|
142
142
|
var e = {
|
|
143
143
|
configurable: !0,
|
|
144
144
|
enumerable: !0,
|
|
@@ -155,42 +155,42 @@ function wt() {
|
|
|
155
155
|
groupEnd: e
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
N++;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
function Ke() {
|
|
162
162
|
{
|
|
163
|
-
if (
|
|
163
|
+
if (N--, N === 0) {
|
|
164
164
|
var e = {
|
|
165
165
|
configurable: !0,
|
|
166
166
|
enumerable: !0,
|
|
167
167
|
writable: !0
|
|
168
168
|
};
|
|
169
169
|
Object.defineProperties(console, {
|
|
170
|
-
log:
|
|
170
|
+
log: P({}, e, {
|
|
171
171
|
value: T
|
|
172
172
|
}),
|
|
173
|
-
info:
|
|
174
|
-
value:
|
|
173
|
+
info: P({}, e, {
|
|
174
|
+
value: D
|
|
175
175
|
}),
|
|
176
|
-
warn:
|
|
176
|
+
warn: P({}, e, {
|
|
177
177
|
value: me
|
|
178
178
|
}),
|
|
179
|
-
error:
|
|
179
|
+
error: P({}, e, {
|
|
180
180
|
value: Ee
|
|
181
181
|
}),
|
|
182
|
-
group:
|
|
182
|
+
group: P({}, e, {
|
|
183
183
|
value: Te
|
|
184
184
|
}),
|
|
185
|
-
groupCollapsed:
|
|
185
|
+
groupCollapsed: P({}, e, {
|
|
186
186
|
value: we
|
|
187
187
|
}),
|
|
188
|
-
groupEnd:
|
|
188
|
+
groupEnd: P({}, e, {
|
|
189
189
|
value: Ce
|
|
190
190
|
})
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
N < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
var le = L.ReactCurrentDispatcher, ue;
|
|
@@ -200,8 +200,8 @@ function wt() {
|
|
|
200
200
|
try {
|
|
201
201
|
throw Error();
|
|
202
202
|
} catch (y) {
|
|
203
|
-
var
|
|
204
|
-
ue =
|
|
203
|
+
var f = y.stack.trim().match(/\n( *(at )?)/);
|
|
204
|
+
ue = f && f[1] || "";
|
|
205
205
|
}
|
|
206
206
|
return `
|
|
207
207
|
` + ue + e;
|
|
@@ -220,7 +220,7 @@ function wt() {
|
|
|
220
220
|
if (n !== void 0)
|
|
221
221
|
return n;
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var f;
|
|
224
224
|
de = !0;
|
|
225
225
|
var y = Error.prepareStackTrace;
|
|
226
226
|
Error.prepareStackTrace = void 0;
|
|
@@ -239,14 +239,14 @@ function wt() {
|
|
|
239
239
|
try {
|
|
240
240
|
Reflect.construct(_, []);
|
|
241
241
|
} catch (I) {
|
|
242
|
-
|
|
242
|
+
f = I;
|
|
243
243
|
}
|
|
244
244
|
Reflect.construct(e, [], _);
|
|
245
245
|
} else {
|
|
246
246
|
try {
|
|
247
247
|
_.call();
|
|
248
248
|
} catch (I) {
|
|
249
|
-
|
|
249
|
+
f = I;
|
|
250
250
|
}
|
|
251
251
|
e.call(_.prototype);
|
|
252
252
|
}
|
|
@@ -254,14 +254,14 @@ function wt() {
|
|
|
254
254
|
try {
|
|
255
255
|
throw Error();
|
|
256
256
|
} catch (I) {
|
|
257
|
-
|
|
257
|
+
f = I;
|
|
258
258
|
}
|
|
259
259
|
e();
|
|
260
260
|
}
|
|
261
261
|
} catch (I) {
|
|
262
|
-
if (I &&
|
|
262
|
+
if (I && f && typeof I.stack == "string") {
|
|
263
263
|
for (var p = I.stack.split(`
|
|
264
|
-
`), x =
|
|
264
|
+
`), x = f.stack.split(`
|
|
265
265
|
`), E = p.length - 1, w = x.length - 1; E >= 1 && w >= 0 && p[E] !== x[w]; )
|
|
266
266
|
w--;
|
|
267
267
|
for (; E >= 1 && w >= 0; E--, w--)
|
|
@@ -280,8 +280,8 @@ function wt() {
|
|
|
280
280
|
} finally {
|
|
281
281
|
de = !1, le.current = k, Ke(), Error.prepareStackTrace = y;
|
|
282
282
|
}
|
|
283
|
-
var B = e ? e.displayName || e.name : "",
|
|
284
|
-
return typeof e == "function" && Z.set(e,
|
|
283
|
+
var B = e ? e.displayName || e.name : "", Ue = B ? Q(B) : "";
|
|
284
|
+
return typeof e == "function" && Z.set(e, Ue), Ue;
|
|
285
285
|
}
|
|
286
286
|
function Qe(e, t, n) {
|
|
287
287
|
return xe(e, !1);
|
|
@@ -305,12 +305,12 @@ function wt() {
|
|
|
305
305
|
}
|
|
306
306
|
if (typeof e == "object")
|
|
307
307
|
switch (e.$$typeof) {
|
|
308
|
-
case
|
|
308
|
+
case d:
|
|
309
309
|
return Qe(e.render);
|
|
310
310
|
case m:
|
|
311
311
|
return ee(e.type, t, n);
|
|
312
312
|
case C: {
|
|
313
|
-
var
|
|
313
|
+
var f = e, y = f._payload, k = f._init;
|
|
314
314
|
try {
|
|
315
315
|
return ee(k(y), t, n);
|
|
316
316
|
} catch {
|
|
@@ -327,7 +327,7 @@ function wt() {
|
|
|
327
327
|
} else
|
|
328
328
|
Oe.setExtraStackFrame(null);
|
|
329
329
|
}
|
|
330
|
-
function et(e, t, n,
|
|
330
|
+
function et(e, t, n, f, y) {
|
|
331
331
|
{
|
|
332
332
|
var k = Function.call.bind(te);
|
|
333
333
|
for (var _ in e)
|
|
@@ -335,14 +335,14 @@ function wt() {
|
|
|
335
335
|
var p = void 0;
|
|
336
336
|
try {
|
|
337
337
|
if (typeof e[_] != "function") {
|
|
338
|
-
var x = Error((
|
|
338
|
+
var x = Error((f || "React class") + ": " + n + " type `" + _ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[_] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
339
339
|
throw x.name = "Invariant Violation", x;
|
|
340
340
|
}
|
|
341
|
-
p = e[_](t, _,
|
|
341
|
+
p = e[_](t, _, f, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
342
342
|
} catch (E) {
|
|
343
343
|
p = E;
|
|
344
344
|
}
|
|
345
|
-
p && !(p instanceof Error) && (re(y), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",
|
|
345
|
+
p && !(p instanceof Error) && (re(y), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", f || "React class", n, _, typeof p), re(null)), p instanceof Error && !(p.message in je) && (je[p.message] = !0, re(y), R("Failed %s type: %s", n, p.message), re(null));
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
@@ -358,17 +358,17 @@ function wt() {
|
|
|
358
358
|
}
|
|
359
359
|
function nt(e) {
|
|
360
360
|
try {
|
|
361
|
-
return
|
|
361
|
+
return Pe(e), !1;
|
|
362
362
|
} catch {
|
|
363
363
|
return !0;
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function Pe(e) {
|
|
367
367
|
return "" + e;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function Se(e) {
|
|
370
370
|
if (nt(e))
|
|
371
|
-
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rt(e)),
|
|
371
|
+
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rt(e)), Pe(e);
|
|
372
372
|
}
|
|
373
373
|
var q = L.ReactCurrentOwner, ot = {
|
|
374
374
|
key: !0,
|
|
@@ -395,8 +395,8 @@ function wt() {
|
|
|
395
395
|
}
|
|
396
396
|
function it(e, t) {
|
|
397
397
|
if (typeof e.ref == "string" && q.current && t && q.current.stateNode !== t) {
|
|
398
|
-
var n =
|
|
399
|
-
ve[n] || (R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',
|
|
398
|
+
var n = F(q.current.type);
|
|
399
|
+
ve[n] || (R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', F(q.current.type), e.ref), ve[n] = !0);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
function ct(e, t) {
|
|
@@ -421,7 +421,7 @@ function wt() {
|
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
var ut = function(e, t, n,
|
|
424
|
+
var ut = function(e, t, n, f, y, k, _) {
|
|
425
425
|
var p = {
|
|
426
426
|
// This tag allows us to uniquely identify this as a React Element
|
|
427
427
|
$$typeof: s,
|
|
@@ -442,7 +442,7 @@ function wt() {
|
|
|
442
442
|
configurable: !1,
|
|
443
443
|
enumerable: !1,
|
|
444
444
|
writable: !1,
|
|
445
|
-
value:
|
|
445
|
+
value: f
|
|
446
446
|
}), Object.defineProperty(p, "_source", {
|
|
447
447
|
configurable: !1,
|
|
448
448
|
enumerable: !1,
|
|
@@ -450,10 +450,10 @@ function wt() {
|
|
|
450
450
|
value: y
|
|
451
451
|
}), Object.freeze && (Object.freeze(p.props), Object.freeze(p)), p;
|
|
452
452
|
};
|
|
453
|
-
function dt(e, t, n,
|
|
453
|
+
function dt(e, t, n, f, y) {
|
|
454
454
|
{
|
|
455
455
|
var k, _ = {}, p = null, x = null;
|
|
456
|
-
n !== void 0 && (
|
|
456
|
+
n !== void 0 && (Se(n), p = "" + n), at(t) && (Se(t.key), p = "" + t.key), st(t) && (x = t.ref, it(t, y));
|
|
457
457
|
for (k in t)
|
|
458
458
|
te.call(t, k) && !ot.hasOwnProperty(k) && (_[k] = t[k]);
|
|
459
459
|
if (e && e.defaultProps) {
|
|
@@ -465,7 +465,7 @@ function wt() {
|
|
|
465
465
|
var w = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
466
466
|
p && ct(_, w), x && lt(_, w);
|
|
467
467
|
}
|
|
468
|
-
return ut(e, p, x, y,
|
|
468
|
+
return ut(e, p, x, y, f, q.current, _);
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
var he = L.ReactCurrentOwner, Ne = L.ReactDebugCurrentFrame;
|
|
@@ -481,10 +481,10 @@ function wt() {
|
|
|
481
481
|
function _e(e) {
|
|
482
482
|
return typeof e == "object" && e !== null && e.$$typeof === s;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function De() {
|
|
485
485
|
{
|
|
486
486
|
if (he.current) {
|
|
487
|
-
var e =
|
|
487
|
+
var e = F(he.current.type);
|
|
488
488
|
if (e)
|
|
489
489
|
return `
|
|
490
490
|
|
|
@@ -504,10 +504,10 @@ Check your code at ` + t + ":" + n + ".";
|
|
|
504
504
|
return "";
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
var
|
|
507
|
+
var Ie = {};
|
|
508
508
|
function vt(e) {
|
|
509
509
|
{
|
|
510
|
-
var t =
|
|
510
|
+
var t = De();
|
|
511
511
|
if (!t) {
|
|
512
512
|
var n = typeof e == "string" ? e : e.displayName || e.name;
|
|
513
513
|
n && (t = `
|
|
@@ -523,11 +523,11 @@ Check the top-level render call using <` + n + ">.");
|
|
|
523
523
|
return;
|
|
524
524
|
e._store.validated = !0;
|
|
525
525
|
var n = vt(t);
|
|
526
|
-
if (
|
|
526
|
+
if (Ie[n])
|
|
527
527
|
return;
|
|
528
|
-
|
|
529
|
-
var
|
|
530
|
-
e && e._owner && e._owner !== he.current && (
|
|
528
|
+
Ie[n] = !0;
|
|
529
|
+
var f = "";
|
|
530
|
+
e && e._owner && e._owner !== he.current && (f = " It was passed a child from " + F(e._owner.type) + "."), V(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, f), V(null);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
function We(e, t) {
|
|
@@ -536,8 +536,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
536
536
|
return;
|
|
537
537
|
if (fe(e))
|
|
538
538
|
for (var n = 0; n < e.length; n++) {
|
|
539
|
-
var
|
|
540
|
-
_e(
|
|
539
|
+
var f = e[n];
|
|
540
|
+
_e(f) && Le(f, t);
|
|
541
541
|
}
|
|
542
542
|
else if (_e(e))
|
|
543
543
|
e._store && (e._store.validated = !0);
|
|
@@ -557,18 +557,18 @@ Check the top-level render call using <` + n + ">.");
|
|
|
557
557
|
var n;
|
|
558
558
|
if (typeof t == "function")
|
|
559
559
|
n = t.propTypes;
|
|
560
|
-
else if (typeof t == "object" && (t.$$typeof ===
|
|
560
|
+
else if (typeof t == "object" && (t.$$typeof === d || // Note: Memo only checks outer props here.
|
|
561
561
|
// Inner props are checked in the reconciler.
|
|
562
562
|
t.$$typeof === m))
|
|
563
563
|
n = t.propTypes;
|
|
564
564
|
else
|
|
565
565
|
return;
|
|
566
566
|
if (n) {
|
|
567
|
-
var
|
|
568
|
-
et(n, e.props, "prop",
|
|
567
|
+
var f = F(t);
|
|
568
|
+
et(n, e.props, "prop", f, e);
|
|
569
569
|
} else if (t.PropTypes !== void 0 && !pe) {
|
|
570
570
|
pe = !0;
|
|
571
|
-
var y =
|
|
571
|
+
var y = F(t);
|
|
572
572
|
R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", y || "Unknown");
|
|
573
573
|
}
|
|
574
574
|
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
@@ -577,25 +577,25 @@ Check the top-level render call using <` + n + ">.");
|
|
|
577
577
|
function pt(e) {
|
|
578
578
|
{
|
|
579
579
|
for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
|
|
580
|
-
var
|
|
581
|
-
if (
|
|
582
|
-
V(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
580
|
+
var f = t[n];
|
|
581
|
+
if (f !== "children" && f !== "key") {
|
|
582
|
+
V(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", f), V(null);
|
|
583
583
|
break;
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
e.ref !== null && (V(e), R("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function $e(e, t, n, f, y, k) {
|
|
590
590
|
{
|
|
591
591
|
var _ = ce(e);
|
|
592
592
|
if (!_) {
|
|
593
593
|
var p = "";
|
|
594
594
|
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (p += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
595
595
|
var x = ft(y);
|
|
596
|
-
x ? p += x : p +=
|
|
596
|
+
x ? p += x : p += De();
|
|
597
597
|
var E;
|
|
598
|
-
e === null ? E = "null" : fe(e) ? E = "array" : e !== void 0 && e.$$typeof === s ? (E = "<" + (
|
|
598
|
+
e === null ? E = "null" : fe(e) ? E = "array" : e !== void 0 && e.$$typeof === s ? (E = "<" + (F(e.type) || "Unknown") + " />", p = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, p);
|
|
599
599
|
}
|
|
600
600
|
var w = dt(e, t, n, y, k);
|
|
601
601
|
if (w == null)
|
|
@@ -603,7 +603,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
603
603
|
if (_) {
|
|
604
604
|
var j = t.children;
|
|
605
605
|
if (j !== void 0)
|
|
606
|
-
if (
|
|
606
|
+
if (f)
|
|
607
607
|
if (fe(j)) {
|
|
608
608
|
for (var B = 0; B < j.length; B++)
|
|
609
609
|
We(j[B], e);
|
|
@@ -617,91 +617,98 @@ Check the top-level render call using <` + n + ">.");
|
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
function _t(e, t, n) {
|
|
620
|
-
return
|
|
620
|
+
return $e(e, t, n, !0);
|
|
621
621
|
}
|
|
622
622
|
function gt(e, t, n) {
|
|
623
|
-
return
|
|
623
|
+
return $e(e, t, n, !1);
|
|
624
624
|
}
|
|
625
625
|
var yt = gt, bt = _t;
|
|
626
626
|
H.Fragment = a, H.jsx = yt, H.jsxs = bt;
|
|
627
627
|
}()), H;
|
|
628
628
|
}
|
|
629
629
|
process.env.NODE_ENV === "production" ? ye.exports = Tt() : ye.exports = wt();
|
|
630
|
-
var
|
|
630
|
+
var c = ye.exports;
|
|
631
631
|
const Be = "default", Ct = (o, s) => async (...r) => {
|
|
632
632
|
var C;
|
|
633
633
|
const [a, u, ...l] = r, h = u ? { ...u } : { method: "GET" };
|
|
634
|
-
let
|
|
635
|
-
h.headers && (
|
|
636
|
-
const g = await
|
|
637
|
-
|
|
638
|
-
|
|
634
|
+
let i = new Headers();
|
|
635
|
+
h.headers && (i = h.headers instanceof Headers ? h.headers : new Headers(h.headers));
|
|
636
|
+
const d = s(), g = await d.getValidTokenAsync(), b = (C = g == null ? void 0 : g.tokens) == null ? void 0 : C.accessToken;
|
|
637
|
+
if (i.has("Accept") || i.set("Accept", "application/json"), b) {
|
|
638
|
+
if (d.configuration.demonstrating_proof_of_possession) {
|
|
639
|
+
const A = await d.generateDemonstrationOfProofOfPossessionAsync(b, a.toString(), h.method);
|
|
640
|
+
i.set("Authorization", `PoP ${b}`), i.set("DPoP", A);
|
|
641
|
+
} else
|
|
642
|
+
i.set("Authorization", `Bearer ${b}`);
|
|
643
|
+
h.credentials || (h.credentials = "same-origin");
|
|
644
|
+
}
|
|
645
|
+
const m = { ...h, headers: i };
|
|
639
646
|
return await o(a, m, ...l);
|
|
640
647
|
}, Gt = (o = null, s = Be) => (r) => (a) => {
|
|
641
648
|
const { fetch: u } = Rt(o || a.fetch, s);
|
|
642
|
-
return /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ c.jsx(r, { ...a, fetch: u });
|
|
643
650
|
}, Rt = (o = null, s = Be) => {
|
|
644
|
-
const r = o || window.fetch, a =
|
|
651
|
+
const r = o || window.fetch, a = v.get;
|
|
645
652
|
return { fetch: kt(
|
|
646
653
|
(l, h) => Ct(r, () => a(s))(l, h),
|
|
647
654
|
[r, s]
|
|
648
655
|
) };
|
|
649
|
-
}, qe = () => /* @__PURE__ */
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
] }) }), xt = () => /* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */
|
|
656
|
+
}, qe = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-authenticating__container", children: [
|
|
657
|
+
/* @__PURE__ */ c.jsx("h1", { className: "oidc-authenticating__title", children: "Error authentication" }),
|
|
658
|
+
/* @__PURE__ */ c.jsx("p", { className: "oidc-authenticating__content", children: "An error occurred during authentication." })
|
|
659
|
+
] }) }), xt = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-authenticating__container", children: [
|
|
660
|
+
/* @__PURE__ */ c.jsx("h1", { className: "oidc-authenticating__title", children: "Authentication in progress" }),
|
|
661
|
+
/* @__PURE__ */ c.jsx("p", { className: "oidc-authenticating__content", children: "You will be redirected to the login page." })
|
|
655
662
|
] }) }), jt = () => Math.random().toString(36).substr(2, 6), Ot = (o, s) => (r, a) => {
|
|
656
663
|
if (typeof o.CustomEvent == "function")
|
|
657
664
|
return new o.CustomEvent(r, a);
|
|
658
665
|
const u = a || { bubbles: !1, cancelable: !1, detail: void 0 }, l = s.createEvent("CustomEvent");
|
|
659
666
|
return l.initCustomEvent(r, u.bubbles, u.cancelable, u.detail), l.prototype = o.Event.prototype, l;
|
|
660
|
-
},
|
|
667
|
+
}, Pt = (o, s, r) => ({
|
|
661
668
|
replaceState: (a, u) => {
|
|
662
669
|
const l = r(), h = u || o.history.state;
|
|
663
670
|
o.history.replaceState({ key: l, state: h }, null, a), o.dispatchEvent(s("popstate"));
|
|
664
671
|
}
|
|
665
|
-
}),
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */
|
|
672
|
+
}), St = () => Pt(window, Ot(window, document), jt), ze = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-callback", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-callback__container", children: [
|
|
673
|
+
/* @__PURE__ */ c.jsx("h1", { className: "oidc-callback__title", children: "Authentication complete" }),
|
|
674
|
+
/* @__PURE__ */ c.jsx("p", { className: "oidc-callback__content", children: "You will be redirected to your application." })
|
|
668
675
|
] }) }), At = ({ callBackError: o, callBackSuccess: s, configurationName: r, withCustomHistory: a }) => {
|
|
669
|
-
const [u, l] =
|
|
676
|
+
const [u, l] = S(!1);
|
|
670
677
|
O(() => {
|
|
671
|
-
let
|
|
678
|
+
let d = !0;
|
|
672
679
|
return (async () => {
|
|
673
|
-
const b =
|
|
680
|
+
const b = v.get;
|
|
674
681
|
try {
|
|
675
682
|
const { callbackPath: m } = await b(r).loginCallbackAsync();
|
|
676
|
-
(a ? a() :
|
|
683
|
+
(a ? a() : St()).replaceState(m || "/");
|
|
677
684
|
} catch (m) {
|
|
678
|
-
|
|
685
|
+
d && (console.warn(m), l(!0));
|
|
679
686
|
}
|
|
680
687
|
})(), () => {
|
|
681
|
-
|
|
688
|
+
d = !1;
|
|
682
689
|
};
|
|
683
690
|
}, []);
|
|
684
|
-
const h = o || qe,
|
|
685
|
-
return u ? /* @__PURE__ */
|
|
686
|
-
}, Ft = () => /* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
-
] }) }),
|
|
690
|
-
/* @__PURE__ */
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
] }) }),
|
|
691
|
+
const h = o || qe, i = s || ze;
|
|
692
|
+
return u ? /* @__PURE__ */ c.jsx(h, { configurationName: r }) : /* @__PURE__ */ c.jsx(i, { configurationName: r });
|
|
693
|
+
}, Ft = () => /* @__PURE__ */ c.jsx("span", { className: "oidc-loading", children: "Loading" }), Nt = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-serviceworker", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-serviceworker__container", children: [
|
|
694
|
+
/* @__PURE__ */ c.jsx("h1", { className: "oidc-serviceworker__title", children: "Unable to authenticate on this browser" }),
|
|
695
|
+
/* @__PURE__ */ c.jsx("p", { className: "oidc-serviceworker__content", children: "Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser." })
|
|
696
|
+
] }) }), Dt = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-session-lost", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-session-lost__container", children: [
|
|
697
|
+
/* @__PURE__ */ c.jsx("h1", { className: "oidc-session-lost__title", children: "Session timed out" }),
|
|
698
|
+
/* @__PURE__ */ c.jsx("p", { className: "oidc-session-lost__content", children: "Your session has expired. Please re-authenticate." })
|
|
699
|
+
] }) }), It = ({ configurationName: o }) => (O(() => {
|
|
693
700
|
(async () => {
|
|
694
|
-
const r =
|
|
701
|
+
const r = v.get;
|
|
695
702
|
r(o).silentLoginCallbackAsync();
|
|
696
703
|
})();
|
|
697
|
-
}, []), /* @__PURE__ */
|
|
698
|
-
const s = mt(window.location.href), r =
|
|
704
|
+
}, []), /* @__PURE__ */ c.jsx(c.Fragment, {})), Lt = ({ configurationName: o }) => {
|
|
705
|
+
const s = mt(window.location.href), r = v.get, a = r(o);
|
|
699
706
|
let u = null;
|
|
700
707
|
for (const [l, h] of Object.entries(s))
|
|
701
708
|
l === "state" || l === "scope" || (u === null && (u = {}), u[l] = h);
|
|
702
709
|
return O(() => {
|
|
703
710
|
a.tokens || a.loginAsync(null, u, !0, s.scope);
|
|
704
|
-
}, []), /* @__PURE__ */
|
|
711
|
+
}, []), /* @__PURE__ */ c.jsx(c.Fragment, {});
|
|
705
712
|
}, Wt = ({
|
|
706
713
|
callbackErrorComponent: o,
|
|
707
714
|
callbackSuccessComponent: s,
|
|
@@ -710,39 +717,39 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
710
717
|
silent_login_uri: u,
|
|
711
718
|
children: l,
|
|
712
719
|
configurationName: h,
|
|
713
|
-
withCustomHistory:
|
|
720
|
+
withCustomHistory: i = null
|
|
714
721
|
}) => {
|
|
715
|
-
const
|
|
722
|
+
const d = window ? z(window.location.href) : "", [g, b] = S(d);
|
|
716
723
|
O(() => {
|
|
717
724
|
const C = () => b(z(window.location.href));
|
|
718
725
|
return C(), window.addEventListener("popstate", C, !1), () => window.removeEventListener("popstate", C, !1);
|
|
719
726
|
}, []);
|
|
720
727
|
const m = z(r);
|
|
721
728
|
if (a && g === z(a))
|
|
722
|
-
return /* @__PURE__ */
|
|
729
|
+
return /* @__PURE__ */ c.jsx(It, { configurationName: h });
|
|
723
730
|
if (u && g === z(u))
|
|
724
|
-
return /* @__PURE__ */
|
|
731
|
+
return /* @__PURE__ */ c.jsx(Lt, { configurationName: h });
|
|
725
732
|
switch (g) {
|
|
726
733
|
case m:
|
|
727
|
-
return /* @__PURE__ */
|
|
734
|
+
return /* @__PURE__ */ c.jsx(At, { callBackError: o, callBackSuccess: s, configurationName: h, withCustomHistory: i });
|
|
728
735
|
default:
|
|
729
|
-
return /* @__PURE__ */
|
|
736
|
+
return /* @__PURE__ */ c.jsx(c.Fragment, { children: l });
|
|
730
737
|
}
|
|
731
|
-
},
|
|
732
|
-
const [a, u] =
|
|
738
|
+
}, $t = be.memo(Wt), Ve = { name: "", data: null }, Ut = ({ loadingComponent: o, children: s, configurationName: r }) => {
|
|
739
|
+
const [a, u] = S(!0), l = v.get, h = l(r);
|
|
733
740
|
O(() => {
|
|
734
|
-
let
|
|
741
|
+
let d = !0;
|
|
735
742
|
return h && h.tryKeepExistingSessionAsync().then(() => {
|
|
736
|
-
|
|
743
|
+
d && u(!1);
|
|
737
744
|
}), () => {
|
|
738
|
-
|
|
745
|
+
d = !1;
|
|
739
746
|
};
|
|
740
747
|
}, [r]);
|
|
741
|
-
const
|
|
742
|
-
return /* @__PURE__ */
|
|
748
|
+
const i = o;
|
|
749
|
+
return /* @__PURE__ */ c.jsx(c.Fragment, { children: a ? /* @__PURE__ */ c.jsx(i, { configurationName: r }) : /* @__PURE__ */ c.jsx(c.Fragment, { children: s }) });
|
|
743
750
|
}, J = ({ isLoading: o, loadingComponent: s, children: r, configurationName: a }) => {
|
|
744
751
|
const u = s;
|
|
745
|
-
return o ? /* @__PURE__ */
|
|
752
|
+
return o ? /* @__PURE__ */ c.jsx(u, { configurationName: a, children: r }) : /* @__PURE__ */ c.jsx(c.Fragment, { children: r });
|
|
746
753
|
}, Ht = ({
|
|
747
754
|
children: o,
|
|
748
755
|
configuration: s,
|
|
@@ -751,108 +758,108 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
751
758
|
authenticatingComponent: u = xt,
|
|
752
759
|
loadingComponent: l = Ft,
|
|
753
760
|
serviceWorkerNotSupportedComponent: h = Nt,
|
|
754
|
-
authenticatingErrorComponent:
|
|
755
|
-
sessionLostComponent:
|
|
761
|
+
authenticatingErrorComponent: i = qe,
|
|
762
|
+
sessionLostComponent: d = Dt,
|
|
756
763
|
onSessionLost: g = null,
|
|
757
764
|
onLogoutFromAnotherTab: b = null,
|
|
758
765
|
onLogoutFromSameTab: m = null,
|
|
759
766
|
withCustomHistory: C = null,
|
|
760
|
-
onEvent:
|
|
767
|
+
onEvent: A = null,
|
|
761
768
|
getFetch: K = null
|
|
762
769
|
}) => {
|
|
763
|
-
const
|
|
770
|
+
const $ = (P = "default") => v.getOrCreate(K ?? Et)(s, P), [ne, L] = S(!0), [R, U] = S(Ve), [oe, se] = S("default");
|
|
764
771
|
O(() => {
|
|
765
|
-
const
|
|
766
|
-
|
|
772
|
+
const N = $(r).subscribeEvents((T, D) => {
|
|
773
|
+
A && A(r, T, D);
|
|
767
774
|
});
|
|
768
775
|
return () => {
|
|
769
|
-
|
|
776
|
+
$(r).removeEventSubscription(N);
|
|
770
777
|
};
|
|
771
|
-
}, [r,
|
|
772
|
-
const
|
|
773
|
-
if (T ===
|
|
778
|
+
}, [r, A]), O(() => {
|
|
779
|
+
const N = $(r).subscribeEvents((T, D) => {
|
|
780
|
+
if (T === v.eventNames.refreshTokensAsync_error || T === v.eventNames.syncTokensAsync_error) {
|
|
774
781
|
if (g != null) {
|
|
775
782
|
g();
|
|
776
783
|
return;
|
|
777
784
|
}
|
|
778
|
-
|
|
779
|
-
} else if (T ===
|
|
785
|
+
U({ name: T, data: D });
|
|
786
|
+
} else if (T === v.eventNames.logout_from_another_tab) {
|
|
780
787
|
if (b != null) {
|
|
781
788
|
b();
|
|
782
789
|
return;
|
|
783
790
|
}
|
|
784
|
-
|
|
791
|
+
U({ name: T, data: D });
|
|
785
792
|
} else
|
|
786
|
-
T ===
|
|
793
|
+
T === v.eventNames.logout_from_same_tab ? m != null && m() : T === v.eventNames.loginAsync_begin || T === v.eventNames.loginCallbackAsync_end || T === v.eventNames.loginAsync_error || T === v.eventNames.loginCallbackAsync_error ? U({ name: T, data: D }) : T === v.eventNames.service_worker_not_supported_by_browser && s.service_worker_only === !0 && U({ name: T, data: D });
|
|
787
794
|
});
|
|
788
795
|
return se(r), L(!1), () => {
|
|
789
|
-
|
|
796
|
+
$(r).removeEventSubscription(N), U(Ve);
|
|
790
797
|
};
|
|
791
798
|
}, [s, r]);
|
|
792
|
-
const ae =
|
|
799
|
+
const ae = d, ie = u, W = l, X = h, ce = i, Y = ne || oe !== r, M = $(r);
|
|
793
800
|
switch (R.name) {
|
|
794
|
-
case
|
|
795
|
-
return /* @__PURE__ */
|
|
796
|
-
case
|
|
797
|
-
return /* @__PURE__ */
|
|
798
|
-
case
|
|
799
|
-
case
|
|
800
|
-
return /* @__PURE__ */
|
|
801
|
-
case
|
|
802
|
-
case
|
|
803
|
-
case
|
|
804
|
-
return /* @__PURE__ */
|
|
801
|
+
case v.eventNames.service_worker_not_supported_by_browser:
|
|
802
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: W, isLoading: Y, configurationName: r, children: /* @__PURE__ */ c.jsx(X, { configurationName: r }) });
|
|
803
|
+
case v.eventNames.loginAsync_begin:
|
|
804
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: W, isLoading: Y, configurationName: r, children: /* @__PURE__ */ c.jsx(ie, { configurationName: r }) });
|
|
805
|
+
case v.eventNames.loginAsync_error:
|
|
806
|
+
case v.eventNames.loginCallbackAsync_error:
|
|
807
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: W, isLoading: Y, configurationName: r, children: /* @__PURE__ */ c.jsx(ce, { configurationName: r }) });
|
|
808
|
+
case v.eventNames.refreshTokensAsync_error:
|
|
809
|
+
case v.eventNames.syncTokensAsync_error:
|
|
810
|
+
case v.eventNames.logout_from_another_tab:
|
|
811
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: W, isLoading: Y, configurationName: r, children: /* @__PURE__ */ c.jsx(ae, { configurationName: r }) });
|
|
805
812
|
default:
|
|
806
|
-
return /* @__PURE__ */
|
|
807
|
-
|
|
813
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: W, isLoading: Y, configurationName: r, children: /* @__PURE__ */ c.jsx(
|
|
814
|
+
$t,
|
|
808
815
|
{
|
|
809
816
|
redirect_uri: M.configuration.redirect_uri,
|
|
810
817
|
silent_redirect_uri: M.configuration.silent_redirect_uri,
|
|
811
818
|
silent_login_uri: M.configuration.silent_login_uri,
|
|
812
819
|
callbackSuccessComponent: a,
|
|
813
|
-
callbackErrorComponent:
|
|
820
|
+
callbackErrorComponent: i,
|
|
814
821
|
authenticatingComponent: u,
|
|
815
822
|
configurationName: r,
|
|
816
823
|
withCustomHistory: C,
|
|
817
|
-
children: /* @__PURE__ */
|
|
824
|
+
children: /* @__PURE__ */ c.jsx(Ut, { loadingComponent: W, configurationName: r, children: o })
|
|
818
825
|
}
|
|
819
826
|
) });
|
|
820
827
|
}
|
|
821
828
|
}, Yt = ({ children: o, callbackPath: s = null, extras: r = null, configurationName: a = "default" }) => {
|
|
822
|
-
const u =
|
|
829
|
+
const u = v.get, l = u(a);
|
|
823
830
|
return O(() => {
|
|
824
831
|
l.tokens || l.loginAsync(s, r);
|
|
825
|
-
}, [a, s, r]), l.tokens ? /* @__PURE__ */
|
|
826
|
-
}, Jt = (o, s = null, r = null, a = "default") => (u) => /* @__PURE__ */
|
|
832
|
+
}, [a, s, r]), l.tokens ? /* @__PURE__ */ c.jsx(c.Fragment, { children: o }) : null;
|
|
833
|
+
}, Jt = (o, s = null, r = null, a = "default") => (u) => /* @__PURE__ */ c.jsx(Yt, { callbackPath: s, extras: r, configurationName: a, children: /* @__PURE__ */ c.jsx(o, { ...u }) }), ke = "default", ge = (o, s) => {
|
|
827
834
|
let r = !1;
|
|
828
835
|
return o(s) && (r = o(s).tokens != null), r;
|
|
829
836
|
}, Kt = (o = ke) => {
|
|
830
|
-
const s =
|
|
837
|
+
const s = v.get, [r, a] = S(ge(s, o));
|
|
831
838
|
return O(() => {
|
|
832
|
-
let
|
|
833
|
-
const
|
|
839
|
+
let i = !0;
|
|
840
|
+
const d = s(o);
|
|
834
841
|
a(ge(s, o));
|
|
835
|
-
const g =
|
|
836
|
-
(b ===
|
|
842
|
+
const g = d.subscribeEvents((b, m) => {
|
|
843
|
+
(b === v.eventNames.logout_from_another_tab || b === v.eventNames.logout_from_same_tab || b === v.eventNames.token_aquired) && i && a(ge(s, o));
|
|
837
844
|
});
|
|
838
845
|
return () => {
|
|
839
|
-
|
|
846
|
+
i = !1, d.removeEventSubscription(g);
|
|
840
847
|
};
|
|
841
|
-
}, [o]), { login: (
|
|
842
|
-
const
|
|
848
|
+
}, [o]), { login: (i = void 0, d = null, g = !1) => s(o).loginAsync(i, d, !1, void 0, g), logout: (i = void 0, d = null) => s(o).logoutAsync(i, d), renewTokens: async (i = null) => {
|
|
849
|
+
const d = await s(o).renewTokensAsync(i);
|
|
843
850
|
return {
|
|
844
851
|
// @ts-ignore
|
|
845
|
-
accessToken:
|
|
852
|
+
accessToken: d.accessToken,
|
|
846
853
|
// @ts-ignore
|
|
847
|
-
accessTokenPayload:
|
|
854
|
+
accessTokenPayload: d.accessTokenPayload,
|
|
848
855
|
// @ts-ignore
|
|
849
|
-
idToken:
|
|
856
|
+
idToken: d.idToken,
|
|
850
857
|
// @ts-ignore
|
|
851
|
-
idTokenPayload:
|
|
858
|
+
idTokenPayload: d.idTokenPayload
|
|
852
859
|
};
|
|
853
860
|
}, isAuthenticated: r };
|
|
854
861
|
}, Ge = { accessToken: null, accessTokenPayload: null }, Mt = (o) => {
|
|
855
|
-
const s =
|
|
862
|
+
const s = v.get, r = s(o);
|
|
856
863
|
if (r.tokens) {
|
|
857
864
|
const a = r.tokens;
|
|
858
865
|
return {
|
|
@@ -862,16 +869,16 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
862
869
|
}
|
|
863
870
|
return Ge;
|
|
864
871
|
}, Xt = (o = ke) => {
|
|
865
|
-
const s =
|
|
872
|
+
const s = v.get, [r, a] = S(Mt(o));
|
|
866
873
|
return O(() => {
|
|
867
874
|
let u = !0;
|
|
868
875
|
const l = s(o);
|
|
869
876
|
if (l.tokens) {
|
|
870
|
-
const
|
|
871
|
-
a({ accessToken:
|
|
877
|
+
const i = l.tokens;
|
|
878
|
+
a({ accessToken: i.accessToken, accessTokenPayload: i.accessTokenPayload });
|
|
872
879
|
}
|
|
873
|
-
const h = l.subscribeEvents((
|
|
874
|
-
if ((
|
|
880
|
+
const h = l.subscribeEvents((i, d) => {
|
|
881
|
+
if ((i === v.eventNames.token_renewed || i === v.eventNames.token_aquired || i === v.eventNames.logout_from_another_tab || i === v.eventNames.logout_from_same_tab || i === v.eventNames.refreshTokensAsync_error || i === v.eventNames.syncTokensAsync_error) && u) {
|
|
875
882
|
const g = l.tokens;
|
|
876
883
|
a(g != null ? { accessToken: g.accessToken, accessTokenPayload: g.accessTokenPayload } : Ge);
|
|
877
884
|
}
|
|
@@ -881,23 +888,23 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
881
888
|
};
|
|
882
889
|
}, [o]), r;
|
|
883
890
|
}, He = { idToken: null, idTokenPayload: null }, Vt = (o) => {
|
|
884
|
-
const s =
|
|
891
|
+
const s = v.get, r = s(o);
|
|
885
892
|
if (r.tokens) {
|
|
886
893
|
const a = r.tokens;
|
|
887
894
|
return { idToken: a.idToken, idTokenPayload: a.idTokenPayload };
|
|
888
895
|
}
|
|
889
896
|
return He;
|
|
890
897
|
}, Qt = (o = ke) => {
|
|
891
|
-
const s =
|
|
898
|
+
const s = v.get, [r, a] = S(Vt(o));
|
|
892
899
|
return O(() => {
|
|
893
900
|
let u = !0;
|
|
894
901
|
const l = s(o);
|
|
895
902
|
if (l.tokens) {
|
|
896
|
-
const
|
|
897
|
-
a({ idToken:
|
|
903
|
+
const i = l.tokens;
|
|
904
|
+
a({ idToken: i.idToken, idTokenPayload: i.idTokenPayload });
|
|
898
905
|
}
|
|
899
|
-
const h = l.subscribeEvents((
|
|
900
|
-
if ((
|
|
906
|
+
const h = l.subscribeEvents((i, d) => {
|
|
907
|
+
if ((i === v.eventNames.token_renewed || i === v.eventNames.token_aquired || i === v.eventNames.logout_from_another_tab || i === v.eventNames.logout_from_same_tab || i === v.eventNames.refreshTokensAsync_error || i === v.eventNames.syncTokensAsync_error) && u) {
|
|
901
908
|
const g = l.tokens;
|
|
902
909
|
a(g != null ? { idToken: g.idToken, idTokenPayload: g.idTokenPayload } : He);
|
|
903
910
|
}
|
|
@@ -909,22 +916,22 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
909
916
|
};
|
|
910
917
|
var Bt = /* @__PURE__ */ ((o) => (o.Unauthenticated = "Unauthenticated", o.Loading = "Loading user", o.Loaded = "User loaded", o.LoadingError = "Error loading user", o))(Bt || {});
|
|
911
918
|
const Zt = (o = "default") => {
|
|
912
|
-
const [s, r] =
|
|
919
|
+
const [s, r] = S({
|
|
913
920
|
user: null,
|
|
914
921
|
status: "Unauthenticated"
|
|
915
922
|
/* Unauthenticated */
|
|
916
|
-
}), [a, u] =
|
|
923
|
+
}), [a, u] = S(""), l = v.get(o);
|
|
917
924
|
O(() => {
|
|
918
|
-
let
|
|
925
|
+
let i = !0;
|
|
919
926
|
if (l && l.tokens) {
|
|
920
927
|
r({
|
|
921
928
|
...s,
|
|
922
929
|
status: "Loading user"
|
|
923
930
|
/* Loading */
|
|
924
931
|
});
|
|
925
|
-
const
|
|
926
|
-
l.userInfoAsync(
|
|
927
|
-
|
|
932
|
+
const d = a !== "";
|
|
933
|
+
l.userInfoAsync(d).then((g) => {
|
|
934
|
+
i && r({
|
|
928
935
|
user: g,
|
|
929
936
|
status: "User loaded"
|
|
930
937
|
/* Loaded */
|
|
@@ -941,7 +948,7 @@ const Zt = (o = "default") => {
|
|
|
941
948
|
/* Unauthenticated */
|
|
942
949
|
});
|
|
943
950
|
return () => {
|
|
944
|
-
|
|
951
|
+
i = !1;
|
|
945
952
|
};
|
|
946
953
|
}, [a]);
|
|
947
954
|
const h = () => {
|
package/dist/index.umd.cjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var be;function Qe(){if(be)return G;be=1;var s=y,o=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,d=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function h(i,
|
|
9
|
+
*/var be;function Qe(){if(be)return G;be=1;var s=y,o=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,d=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function h(i,f,g){var k,O={},S=null,A=null;g!==void 0&&(S=""+g),f.key!==void 0&&(S=""+f.key),f.ref!==void 0&&(A=f.ref);for(k in f)a.call(f,k)&&!u.hasOwnProperty(k)&&(O[k]=f[k]);if(i&&i.defaultProps)for(k in f=i.defaultProps,f)O[k]===void 0&&(O[k]=f[k]);return{$$typeof:o,type:i,key:S,ref:A,props:O,_owner:d.current}}return G.Fragment=n,G.jsx=h,G.jsxs=h,G}var H={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ke;function Ze(){return ke||(ke=1,process.env.NODE_ENV!=="production"&&function(){var s=y,o=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),i=Symbol.for("react.context"),
|
|
18
|
-
`+fe+e}}var ve=!1,q;{var Tt=typeof WeakMap=="function"?WeakMap:Map;q=new Tt}function
|
|
19
|
-
`),
|
|
20
|
-
`),E=p.length-1,w=
|
|
21
|
-
`+p[E].replace(" at new "," at ");return e.displayName&&
|
|
17
|
+
*/var ke;function Ze(){return ke||(ke=1,process.env.NODE_ENV!=="production"&&function(){var s=y,o=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),i=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),X=Symbol.iterator,W="@@iterator";function oe(e){if(e===null||typeof e!="object")return null;var t=X&&e[X]||e[W];return typeof t=="function"?t:null}var L=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(e){{for(var t=arguments.length,r=new Array(t>1?t-1:0),v=1;v<t;v++)r[v-1]=arguments[v];M("error",e,r)}}function M(e,t,r){{var v=L.ReactDebugCurrentFrame,b=v.getStackAddendum();b!==""&&(t+="%s",r=r.concat([b]));var m=r.map(function(_){return String(_)});m.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,m)}}var ae=!1,ie=!1,ce=!1,le=!1,U=!1,Q;Q=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===a||e===u||U||e===d||e===g||e===k||le||e===A||ae||ie||ce||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===O||e.$$typeof===h||e.$$typeof===i||e.$$typeof===f||e.$$typeof===Q||e.getModuleId!==void 0))}function Y(e,t,r){var v=e.displayName;if(v)return v;var b=t.displayName||t.name||"";return b!==""?r+"("+b+")":r}function V(e){return e.displayName||"Context"}function F(e){if(e==null)return null;if(typeof e.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case a:return"Fragment";case n:return"Portal";case u:return"Profiler";case d:return"StrictMode";case g:return"Suspense";case k:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case i:var t=e;return V(t)+".Consumer";case h:var r=e;return V(r._context)+".Provider";case f:return Y(e,e.render,"ForwardRef");case O:var v=e.displayName||null;return v!==null?v:F(e.type)||"Memo";case S:{var b=e,m=b._payload,_=b._init;try{return F(_(m))}catch{return null}}}return null}var x=Object.assign,N=0,T,D,Ce,xe,Ae,Fe,Ne;function De(){}De.__reactDisabledLog=!0;function Ot(){{if(N===0){T=console.log,D=console.info,Ce=console.warn,xe=console.error,Ae=console.group,Fe=console.groupCollapsed,Ne=console.groupEnd;var e={configurable:!0,enumerable:!0,value:De,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}}function Et(){{if(N--,N===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:x({},e,{value:T}),info:x({},e,{value:D}),warn:x({},e,{value:Ce}),error:x({},e,{value:xe}),group:x({},e,{value:Ae}),groupCollapsed:x({},e,{value:Fe}),groupEnd:x({},e,{value:Ne})})}N<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var de=L.ReactCurrentDispatcher,fe;function Z(e,t,r){{if(fe===void 0)try{throw Error()}catch(b){var v=b.stack.trim().match(/\n( *(at )?)/);fe=v&&v[1]||""}return`
|
|
18
|
+
`+fe+e}}var ve=!1,q;{var Tt=typeof WeakMap=="function"?WeakMap:Map;q=new Tt}function Ie(e,t){if(!e||ve)return"";{var r=q.get(e);if(r!==void 0)return r}var v;ve=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var m;m=de.current,de.current=null,Ot();try{if(t){var _=function(){throw Error()};if(Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(I){v=I}Reflect.construct(e,[],_)}else{try{_.call()}catch(I){v=I}e.call(_.prototype)}}else{try{throw Error()}catch(I){v=I}e()}}catch(I){if(I&&v&&typeof I.stack=="string"){for(var p=I.stack.split(`
|
|
19
|
+
`),P=v.stack.split(`
|
|
20
|
+
`),E=p.length-1,w=P.length-1;E>=1&&w>=0&&p[E]!==P[w];)w--;for(;E>=1&&w>=0;E--,w--)if(p[E]!==P[w]){if(E!==1||w!==1)do if(E--,w--,w<0||p[E]!==P[w]){var C=`
|
|
21
|
+
`+p[E].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,C),C}while(E>=1&&w>=0);break}}}finally{ve=!1,de.current=m,Et(),Error.prepareStackTrace=b}var z=e?e.displayName||e.name:"",Xe=z?Z(z):"";return typeof e=="function"&&q.set(e,Xe),Xe}function wt(e,t,r){return Ie(e,!1)}function Rt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function $(e,t,r){if(e==null)return"";if(typeof e=="function")return Ie(e,Rt(e));if(typeof e=="string")return Z(e);switch(e){case g:return Z("Suspense");case k:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return wt(e.render);case O:return $(e.type,t,r);case S:{var v=e,b=v._payload,m=v._init;try{return $(m(b),t,r)}catch{}}}return""}var ee=Object.prototype.hasOwnProperty,Le={},Ue=L.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,r=$(e.type,e._source,t?t.type:null);Ue.setExtraStackFrame(r)}else Ue.setExtraStackFrame(null)}function St(e,t,r,v,b){{var m=Function.call.bind(ee);for(var _ in e)if(m(e,_)){var p=void 0;try{if(typeof e[_]!="function"){var P=Error((v||"React class")+": "+r+" type `"+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[_]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}p=e[_](t,_,v,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){p=E}p&&!(p instanceof Error)&&(te(b),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",v||"React class",r,_,typeof p),te(null)),p instanceof Error&&!(p.message in Le)&&(Le[p.message]=!0,te(b),j("Failed %s type: %s",r,p.message),te(null))}}}var jt=Array.isArray;function he(e){return jt(e)}function Pt(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,r=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r}}function Ct(e){try{return We(e),!1}catch{return!0}}function We(e){return""+e}function Me(e){if(Ct(e))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Pt(e)),We(e)}var K=L.ReactCurrentOwner,xt={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ve,pe;pe={};function At(e){if(ee.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function Ft(e){if(ee.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Nt(e,t){if(typeof e.ref=="string"&&K.current&&t&&K.current.stateNode!==t){var r=F(K.current.type);pe[r]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(K.current.type),e.ref),pe[r]=!0)}}function Dt(e,t){{var r=function(){Ye||(Ye=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}}function It(e,t){{var r=function(){Ve||(Ve=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}}var Lt=function(e,t,r,v,b,m,_){var p={$$typeof:o,type:e,key:t,ref:r,props:_,_owner:m};return p._store={},Object.defineProperty(p._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(p,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(p,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(p.props),Object.freeze(p)),p};function Ut(e,t,r,v,b){{var m,_={},p=null,P=null;r!==void 0&&(Me(r),p=""+r),Ft(t)&&(Me(t.key),p=""+t.key),At(t)&&(P=t.ref,Nt(t,b));for(m in t)ee.call(t,m)&&!xt.hasOwnProperty(m)&&(_[m]=t[m]);if(e&&e.defaultProps){var E=e.defaultProps;for(m in E)_[m]===void 0&&(_[m]=E[m])}if(p||P){var w=typeof e=="function"?e.displayName||e.name||"Unknown":e;p&&Dt(_,w),P&&It(_,w)}return Lt(e,p,P,b,v,K.current,_)}}var _e=L.ReactCurrentOwner,Be=L.ReactDebugCurrentFrame;function B(e){if(e){var t=e._owner,r=$(e.type,e._source,t?t.type:null);Be.setExtraStackFrame(r)}else Be.setExtraStackFrame(null)}var ge;ge=!1;function ye(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function ze(){{if(_e.current){var e=F(_e.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function Wt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),r=e.lineNumber;return`
|
|
24
24
|
|
|
25
25
|
Check your code at `+t+":"+r+"."}return""}}var Ge={};function Mt(e){{var t=ze();if(!t){var r=typeof e=="string"?e:e.displayName||e.name;r&&(t=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+r+">.")}return t}}function He(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Mt(t);if(Ge[r])return;Ge[r]=!0;var f="";e&&e._owner&&e._owner!==_e.current&&(f=" It was passed a child from "+A(e._owner.type)+"."),B(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,f),B(null)}}function Je(e,t){{if(typeof e!="object")return;if(he(e))for(var r=0;r<e.length;r++){var f=e[r];ye(f)&&He(f,t)}else if(ye(e))e._store&&(e._store.validated=!0);else if(e){var b=oe(e);if(typeof b=="function"&&b!==e.entries)for(var m=b.call(e),_;!(_=m.next()).done;)ye(_.value)&&He(_.value,t)}}}function Yt(e){{var t=e.type;if(t==null||typeof t=="string")return;var r;if(typeof t=="function")r=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===v||t.$$typeof===O))r=t.propTypes;else return;if(r){var f=A(t);St(r,e.props,"prop",f,e)}else if(t.PropTypes!==void 0&&!ge){ge=!0;var b=A(t);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var f=t[r];if(f!=="children"&&f!=="key"){B(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",f),B(null);break}}e.ref!==null&&(B(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function Ke(e,t,r,f,b,m){{var _=ue(e);if(!_){var p="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(p+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var C=Wt(b);C?p+=C:p+=ze();var E;e===null?E="null":he(e)?E="array":e!==void 0&&e.$$typeof===o?(E="<"+(A(e.type)||"Unknown")+" />",p=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,p)}var w=Ut(e,t,r,b,m);if(w==null)return w;if(_){var x=t.children;if(x!==void 0)if(f)if(he(x)){for(var z=0;z<x.length;z++)Je(x[z],e);Object.freeze&&Object.freeze(x)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Je(x,e)}return e===a?Vt(w):Yt(w),w}}function Bt(e,t,r){return Ke(e,t,r,!0)}function zt(e,t,r){return Ke(e,t,r,!1)}var Gt=zt,Ht=Bt;H.Fragment=a,H.jsx=Gt,H.jsxs=Ht}()),H}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=Ze();var c=ne.exports;const me="default",qe=(s,o)=>async(...n)=>{var S;const[a,d,...u]=n,h=d?{...d}:{method:"GET"};let i=new Headers;h.headers&&(i=h.headers instanceof Headers?h.headers:new Headers(h.headers));const g=await o().getValidTokenAsync(),k=(S=g==null?void 0:g.tokens)==null?void 0:S.accessToken;i.has("Accept")||i.set("Accept","application/json"),k&&(i.set("Authorization",`Bearer ${k}`),h.credentials||(h.credentials="same-origin"));const O={...h,headers:i};return await s(a,O,...u)},$e=(s=null,o=me)=>n=>a=>{const{fetch:d}=Oe(s||a.fetch,o);return c.jsx(n,{...a,fetch:d})},Oe=(s=null,o=me)=>{const n=s||window.fetch,a=l.OidcClient.get;return{fetch:y.useCallback((u,h)=>qe(n,()=>a(o))(u,h),[n,o])}},Ee=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Error authentication"}),c.jsx("p",{className:"oidc-authenticating__content",children:"An error occurred during authentication."})]})}),et=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Authentication in progress"}),c.jsx("p",{className:"oidc-authenticating__content",children:"You will be redirected to the login page."})]})}),tt=()=>Math.random().toString(36).substr(2,6),nt=(s,o)=>(n,a)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,a);const d=a||{bubbles:!1,cancelable:!1,detail:void 0},u=o.createEvent("CustomEvent");return u.initCustomEvent(n,d.bubbles,d.cancelable,d.detail),u.prototype=s.Event.prototype,u},rt=(s,o,n)=>({replaceState:(a,d)=>{const u=n(),h=d||s.history.state;s.history.replaceState({key:u,state:h},null,a),s.dispatchEvent(o("popstate"))}}),st=()=>rt(window,nt(window,document),tt),Te=()=>c.jsx("div",{className:"oidc-callback",children:c.jsxs("div",{className:"oidc-callback__container",children:[c.jsx("h1",{className:"oidc-callback__title",children:"Authentication complete"}),c.jsx("p",{className:"oidc-callback__content",children:"You will be redirected to your application."})]})}),ot=({callBackError:s,callBackSuccess:o,configurationName:n,withCustomHistory:a})=>{const[d,u]=y.useState(!1);y.useEffect(()=>{let v=!0;return(async()=>{const k=l.OidcClient.get;try{const{callbackPath:O}=await k(n).loginCallbackAsync();(a?a():st()).replaceState(O||"/")}catch(O){v&&(console.warn(O),u(!0))}})(),()=>{v=!1}},[]);const h=s||Ee,i=o||Te;return d?c.jsx(h,{configurationName:n}):c.jsx(i,{configurationName:n})},at=()=>c.jsx("span",{className:"oidc-loading",children:"Loading"}),ct=()=>c.jsx("div",{className:"oidc-serviceworker",children:c.jsxs("div",{className:"oidc-serviceworker__container",children:[c.jsx("h1",{className:"oidc-serviceworker__title",children:"Unable to authenticate on this browser"}),c.jsx("p",{className:"oidc-serviceworker__content",children:"Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser."})]})}),it=()=>c.jsx("div",{className:"oidc-session-lost",children:c.jsxs("div",{className:"oidc-session-lost__container",children:[c.jsx("h1",{className:"oidc-session-lost__title",children:"Session timed out"}),c.jsx("p",{className:"oidc-session-lost__content",children:"Your session has expired. Please re-authenticate."})]})}),lt=({configurationName:s})=>(y.useEffect(()=>{(async()=>{const n=l.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),c.jsx(c.Fragment,{})),ut=({configurationName:s})=>{const o=l.getParseQueryStringFromLocation(window.location.href),n=l.OidcClient.get,a=n(s);let d=null;for(const[u,h]of Object.entries(o))u==="state"||u==="scope"||(d===null&&(d={}),d[u]=h);return y.useEffect(()=>{a.tokens||a.loginAsync(null,d,!0,o.scope)},[]),c.jsx(c.Fragment,{})},dt=({callbackErrorComponent:s,callbackSuccessComponent:o,redirect_uri:n,silent_redirect_uri:a,silent_login_uri:d,children:u,configurationName:h,withCustomHistory:i=null})=>{const v=window?l.getPath(window.location.href):"",[g,k]=y.useState(v);y.useEffect(()=>{const S=()=>k(l.getPath(window.location.href));return S(),window.addEventListener("popstate",S,!1),()=>window.removeEventListener("popstate",S,!1)},[]);const O=l.getPath(n);if(a&&g===l.getPath(a))return c.jsx(lt,{configurationName:h});if(d&&g===l.getPath(d))return c.jsx(ut,{configurationName:h});switch(g){case O:return c.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:h,withCustomHistory:i});default:return c.jsx(c.Fragment,{children:u})}},ft=y.memo(dt),we={name:"",data:null},vt=({loadingComponent:s,children:o,configurationName:n})=>{const[a,d]=y.useState(!0),u=l.OidcClient.get,h=u(n);y.useEffect(()=>{let v=!0;return h&&h.tryKeepExistingSessionAsync().then(()=>{v&&d(!1)}),()=>{v=!1}},[n]);const i=s;return c.jsx(c.Fragment,{children:a?c.jsx(i,{configurationName:n}):c.jsx(c.Fragment,{children:o})})},J=({isLoading:s,loadingComponent:o,children:n,configurationName:a})=>{const d=o;return s?c.jsx(d,{configurationName:a,children:n}):c.jsx(c.Fragment,{children:n})},ht=({children:s,configuration:o,configurationName:n="default",callbackSuccessComponent:a=Te,authenticatingComponent:d=et,loadingComponent:u=at,serviceWorkerNotSupportedComponent:h=ct,authenticatingErrorComponent:i=Ee,sessionLostComponent:v=it,onSessionLost:g=null,onLogoutFromAnotherTab:k=null,onLogoutFromSameTab:O=null,withCustomHistory:S=null,onEvent:D=null,getFetch:X=null})=>{const W=(P="default")=>l.OidcClient.getOrCreate(X??l.getFetchDefault)(o,P),[oe,L]=y.useState(!0),[j,M]=y.useState(we),[ae,ce]=y.useState("default");y.useEffect(()=>{const F=W(n).subscribeEvents((T,N)=>{D&&D(n,T,N)});return()=>{W(n).removeEventSubscription(F)}},[n,D]),y.useEffect(()=>{const F=W(n).subscribeEvents((T,N)=>{if(T===l.OidcClient.eventNames.refreshTokensAsync_error||T===l.OidcClient.eventNames.syncTokensAsync_error){if(g!=null){g();return}M({name:T,data:N})}else if(T===l.OidcClient.eventNames.logout_from_another_tab){if(k!=null){k();return}M({name:T,data:N})}else T===l.OidcClient.eventNames.logout_from_same_tab?O!=null&&O():T===l.OidcClient.eventNames.loginAsync_begin||T===l.OidcClient.eventNames.loginCallbackAsync_end||T===l.OidcClient.eventNames.loginAsync_error||T===l.OidcClient.eventNames.loginCallbackAsync_error?M({name:T,data:N}):T===l.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&M({name:T,data:N})});return ce(n),L(!1),()=>{W(n).removeEventSubscription(F),M(we)}},[o,n]);const ie=v,le=d,U=u,Q=h,ue=i,Y=oe||ae!==n,V=W(n);switch(j.name){case l.OidcClient.eventNames.service_worker_not_supported_by_browser:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(Q,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_begin:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(le,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_error:case l.OidcClient.eventNames.loginCallbackAsync_error:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(ue,{configurationName:n})});case l.OidcClient.eventNames.refreshTokensAsync_error:case l.OidcClient.eventNames.syncTokensAsync_error:case l.OidcClient.eventNames.logout_from_another_tab:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(ie,{configurationName:n})});default:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(ft,{redirect_uri:V.configuration.redirect_uri,silent_redirect_uri:V.configuration.silent_redirect_uri,silent_login_uri:V.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:i,authenticatingComponent:d,configurationName:n,withCustomHistory:S,children:c.jsx(vt,{loadingComponent:U,configurationName:n,children:s})})})}},Re=({children:s,callbackPath:o=null,extras:n=null,configurationName:a="default"})=>{const d=l.OidcClient.get,u=d(a);return y.useEffect(()=>{u.tokens||u.loginAsync(o,n)},[a,o,n]),u.tokens?c.jsx(c.Fragment,{children:s}):null},pt=(s,o=null,n=null,a="default")=>d=>c.jsx(Re,{callbackPath:o,extras:n,configurationName:a,children:c.jsx(s,{...d})}),re="default",se=(s,o)=>{let n=!1;return s(o)&&(n=s(o).tokens!=null),n},_t=(s=re)=>{const o=l.OidcClient.get,[n,a]=y.useState(se(o,s));return y.useEffect(()=>{let i=!0;const v=o(s);a(se(o,s));const g=v.subscribeEvents((k,O)=>{(k===l.OidcClient.eventNames.logout_from_another_tab||k===l.OidcClient.eventNames.logout_from_same_tab||k===l.OidcClient.eventNames.token_aquired)&&i&&a(se(o,s))});return()=>{i=!1,v.removeEventSubscription(g)}},[s]),{login:(i=void 0,v=null,g=!1)=>o(s).loginAsync(i,v,!1,void 0,g),logout:(i=void 0,v=null)=>o(s).logoutAsync(i,v),renewTokens:async(i=null)=>{const v=await o(s).renewTokensAsync(i);return{accessToken:v.accessToken,accessTokenPayload:v.accessTokenPayload,idToken:v.idToken,idTokenPayload:v.idTokenPayload}},isAuthenticated:n}},Se={accessToken:null,accessTokenPayload:null},gt=s=>{const o=l.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{accessToken:a.accessToken,accessTokenPayload:a.accessTokenPayload}}return Se},yt=(s=re)=>{const o=l.OidcClient.get,[n,a]=y.useState(gt(s));return y.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const i=u.tokens;a({accessToken:i.accessToken,accessTokenPayload:i.accessTokenPayload})}const h=u.subscribeEvents((i,v)=>{if((i===l.OidcClient.eventNames.token_renewed||i===l.OidcClient.eventNames.token_aquired||i===l.OidcClient.eventNames.logout_from_another_tab||i===l.OidcClient.eventNames.logout_from_same_tab||i===l.OidcClient.eventNames.refreshTokensAsync_error||i===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const g=u.tokens;a(g!=null?{accessToken:g.accessToken,accessTokenPayload:g.accessTokenPayload}:Se)}});return()=>{d=!1,u.removeEventSubscription(h)}},[s]),n},je={idToken:null,idTokenPayload:null},bt=s=>{const o=l.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{idToken:a.idToken,idTokenPayload:a.idTokenPayload}}return je},kt=(s=re)=>{const o=l.OidcClient.get,[n,a]=y.useState(bt(s));return y.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const i=u.tokens;a({idToken:i.idToken,idTokenPayload:i.idTokenPayload})}const h=u.subscribeEvents((i,v)=>{if((i===l.OidcClient.eventNames.token_renewed||i===l.OidcClient.eventNames.token_aquired||i===l.OidcClient.eventNames.logout_from_another_tab||i===l.OidcClient.eventNames.logout_from_same_tab||i===l.OidcClient.eventNames.refreshTokensAsync_error||i===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const g=u.tokens;a(g!=null?{idToken:g.idToken,idTokenPayload:g.idTokenPayload}:je)}});return()=>{d=!1,u.removeEventSubscription(h)}},[s]),n};var Ce=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Ce||{});const mt=(s="default")=>{const[o,n]=y.useState({user:null,status:"Unauthenticated"}),[a,d]=y.useState(""),u=l.OidcClient.get(s);y.useEffect(()=>{let i=!0;if(u&&u.tokens){n({...o,status:"Loading user"});const v=a!=="";u.userInfoAsync(v).then(g=>{i&&n({user:g,status:"User loaded"})}).catch(()=>n({...o,status:"Error loading user"}))}else n({user:null,status:"Unauthenticated"});return()=>{i=!1}},[a]);const h=()=>{d(a+" ")};return{oidcUser:o.user,oidcUserLoadingState:o.status,reloadOidcUser:h}};Object.defineProperty(R,"TokenRenewMode",{enumerable:!0,get:()=>l.TokenRenewMode}),R.OidcProvider=ht,R.OidcSecure=Re,R.OidcUserStatus=Ce,R.useOidc=_t,R.useOidcAccessToken=yt,R.useOidcFetch=Oe,R.useOidcIdToken=kt,R.useOidcUser=mt,R.withOidcFetch=$e,R.withOidcSecure=pt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|
|
27
|
+
Check the top-level render call using <`+r+">.")}return t}}function He(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Mt(t);if(Ge[r])return;Ge[r]=!0;var v="";e&&e._owner&&e._owner!==_e.current&&(v=" It was passed a child from "+F(e._owner.type)+"."),B(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,v),B(null)}}function Je(e,t){{if(typeof e!="object")return;if(he(e))for(var r=0;r<e.length;r++){var v=e[r];ye(v)&&He(v,t)}else if(ye(e))e._store&&(e._store.validated=!0);else if(e){var b=oe(e);if(typeof b=="function"&&b!==e.entries)for(var m=b.call(e),_;!(_=m.next()).done;)ye(_.value)&&He(_.value,t)}}}function Yt(e){{var t=e.type;if(t==null||typeof t=="string")return;var r;if(typeof t=="function")r=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===f||t.$$typeof===O))r=t.propTypes;else return;if(r){var v=F(t);St(r,e.props,"prop",v,e)}else if(t.PropTypes!==void 0&&!ge){ge=!0;var b=F(t);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var v=t[r];if(v!=="children"&&v!=="key"){B(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),B(null);break}}e.ref!==null&&(B(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function Ke(e,t,r,v,b,m){{var _=ue(e);if(!_){var p="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(p+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=Wt(b);P?p+=P:p+=ze();var E;e===null?E="null":he(e)?E="array":e!==void 0&&e.$$typeof===o?(E="<"+(F(e.type)||"Unknown")+" />",p=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,p)}var w=Ut(e,t,r,b,m);if(w==null)return w;if(_){var C=t.children;if(C!==void 0)if(v)if(he(C)){for(var z=0;z<C.length;z++)Je(C[z],e);Object.freeze&&Object.freeze(C)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Je(C,e)}return e===a?Vt(w):Yt(w),w}}function Bt(e,t,r){return Ke(e,t,r,!0)}function zt(e,t,r){return Ke(e,t,r,!1)}var Gt=zt,Ht=Bt;H.Fragment=a,H.jsx=Gt,H.jsxs=Ht}()),H}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=Ze();var c=ne.exports;const me="default",qe=(s,o)=>async(...n)=>{var S;const[a,d,...u]=n,h=d?{...d}:{method:"GET"};let i=new Headers;h.headers&&(i=h.headers instanceof Headers?h.headers:new Headers(h.headers));const f=o(),g=await f.getValidTokenAsync(),k=(S=g==null?void 0:g.tokens)==null?void 0:S.accessToken;if(i.has("Accept")||i.set("Accept","application/json"),k){if(f.configuration.demonstrating_proof_of_possession){const A=await f.generateDemonstrationOfProofOfPossessionAsync(k,a.toString(),h.method);i.set("Authorization",`PoP ${k}`),i.set("DPoP",A)}else i.set("Authorization",`Bearer ${k}`);h.credentials||(h.credentials="same-origin")}const O={...h,headers:i};return await s(a,O,...u)},$e=(s=null,o=me)=>n=>a=>{const{fetch:d}=Oe(s||a.fetch,o);return c.jsx(n,{...a,fetch:d})},Oe=(s=null,o=me)=>{const n=s||window.fetch,a=l.OidcClient.get;return{fetch:y.useCallback((u,h)=>qe(n,()=>a(o))(u,h),[n,o])}},Ee=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Error authentication"}),c.jsx("p",{className:"oidc-authenticating__content",children:"An error occurred during authentication."})]})}),et=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Authentication in progress"}),c.jsx("p",{className:"oidc-authenticating__content",children:"You will be redirected to the login page."})]})}),tt=()=>Math.random().toString(36).substr(2,6),nt=(s,o)=>(n,a)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,a);const d=a||{bubbles:!1,cancelable:!1,detail:void 0},u=o.createEvent("CustomEvent");return u.initCustomEvent(n,d.bubbles,d.cancelable,d.detail),u.prototype=s.Event.prototype,u},rt=(s,o,n)=>({replaceState:(a,d)=>{const u=n(),h=d||s.history.state;s.history.replaceState({key:u,state:h},null,a),s.dispatchEvent(o("popstate"))}}),st=()=>rt(window,nt(window,document),tt),Te=()=>c.jsx("div",{className:"oidc-callback",children:c.jsxs("div",{className:"oidc-callback__container",children:[c.jsx("h1",{className:"oidc-callback__title",children:"Authentication complete"}),c.jsx("p",{className:"oidc-callback__content",children:"You will be redirected to your application."})]})}),ot=({callBackError:s,callBackSuccess:o,configurationName:n,withCustomHistory:a})=>{const[d,u]=y.useState(!1);y.useEffect(()=>{let f=!0;return(async()=>{const k=l.OidcClient.get;try{const{callbackPath:O}=await k(n).loginCallbackAsync();(a?a():st()).replaceState(O||"/")}catch(O){f&&(console.warn(O),u(!0))}})(),()=>{f=!1}},[]);const h=s||Ee,i=o||Te;return d?c.jsx(h,{configurationName:n}):c.jsx(i,{configurationName:n})},at=()=>c.jsx("span",{className:"oidc-loading",children:"Loading"}),it=()=>c.jsx("div",{className:"oidc-serviceworker",children:c.jsxs("div",{className:"oidc-serviceworker__container",children:[c.jsx("h1",{className:"oidc-serviceworker__title",children:"Unable to authenticate on this browser"}),c.jsx("p",{className:"oidc-serviceworker__content",children:"Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser."})]})}),ct=()=>c.jsx("div",{className:"oidc-session-lost",children:c.jsxs("div",{className:"oidc-session-lost__container",children:[c.jsx("h1",{className:"oidc-session-lost__title",children:"Session timed out"}),c.jsx("p",{className:"oidc-session-lost__content",children:"Your session has expired. Please re-authenticate."})]})}),lt=({configurationName:s})=>(y.useEffect(()=>{(async()=>{const n=l.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),c.jsx(c.Fragment,{})),ut=({configurationName:s})=>{const o=l.getParseQueryStringFromLocation(window.location.href),n=l.OidcClient.get,a=n(s);let d=null;for(const[u,h]of Object.entries(o))u==="state"||u==="scope"||(d===null&&(d={}),d[u]=h);return y.useEffect(()=>{a.tokens||a.loginAsync(null,d,!0,o.scope)},[]),c.jsx(c.Fragment,{})},dt=({callbackErrorComponent:s,callbackSuccessComponent:o,redirect_uri:n,silent_redirect_uri:a,silent_login_uri:d,children:u,configurationName:h,withCustomHistory:i=null})=>{const f=window?l.getPath(window.location.href):"",[g,k]=y.useState(f);y.useEffect(()=>{const S=()=>k(l.getPath(window.location.href));return S(),window.addEventListener("popstate",S,!1),()=>window.removeEventListener("popstate",S,!1)},[]);const O=l.getPath(n);if(a&&g===l.getPath(a))return c.jsx(lt,{configurationName:h});if(d&&g===l.getPath(d))return c.jsx(ut,{configurationName:h});switch(g){case O:return c.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:h,withCustomHistory:i});default:return c.jsx(c.Fragment,{children:u})}},ft=y.memo(dt),we={name:"",data:null},vt=({loadingComponent:s,children:o,configurationName:n})=>{const[a,d]=y.useState(!0),u=l.OidcClient.get,h=u(n);y.useEffect(()=>{let f=!0;return h&&h.tryKeepExistingSessionAsync().then(()=>{f&&d(!1)}),()=>{f=!1}},[n]);const i=s;return c.jsx(c.Fragment,{children:a?c.jsx(i,{configurationName:n}):c.jsx(c.Fragment,{children:o})})},J=({isLoading:s,loadingComponent:o,children:n,configurationName:a})=>{const d=o;return s?c.jsx(d,{configurationName:a,children:n}):c.jsx(c.Fragment,{children:n})},ht=({children:s,configuration:o,configurationName:n="default",callbackSuccessComponent:a=Te,authenticatingComponent:d=et,loadingComponent:u=at,serviceWorkerNotSupportedComponent:h=it,authenticatingErrorComponent:i=Ee,sessionLostComponent:f=ct,onSessionLost:g=null,onLogoutFromAnotherTab:k=null,onLogoutFromSameTab:O=null,withCustomHistory:S=null,onEvent:A=null,getFetch:X=null})=>{const W=(x="default")=>l.OidcClient.getOrCreate(X??l.getFetchDefault)(o,x),[oe,L]=y.useState(!0),[j,M]=y.useState(we),[ae,ie]=y.useState("default");y.useEffect(()=>{const N=W(n).subscribeEvents((T,D)=>{A&&A(n,T,D)});return()=>{W(n).removeEventSubscription(N)}},[n,A]),y.useEffect(()=>{const N=W(n).subscribeEvents((T,D)=>{if(T===l.OidcClient.eventNames.refreshTokensAsync_error||T===l.OidcClient.eventNames.syncTokensAsync_error){if(g!=null){g();return}M({name:T,data:D})}else if(T===l.OidcClient.eventNames.logout_from_another_tab){if(k!=null){k();return}M({name:T,data:D})}else T===l.OidcClient.eventNames.logout_from_same_tab?O!=null&&O():T===l.OidcClient.eventNames.loginAsync_begin||T===l.OidcClient.eventNames.loginCallbackAsync_end||T===l.OidcClient.eventNames.loginAsync_error||T===l.OidcClient.eventNames.loginCallbackAsync_error?M({name:T,data:D}):T===l.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&M({name:T,data:D})});return ie(n),L(!1),()=>{W(n).removeEventSubscription(N),M(we)}},[o,n]);const ce=f,le=d,U=u,Q=h,ue=i,Y=oe||ae!==n,V=W(n);switch(j.name){case l.OidcClient.eventNames.service_worker_not_supported_by_browser:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(Q,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_begin:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(le,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_error:case l.OidcClient.eventNames.loginCallbackAsync_error:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(ue,{configurationName:n})});case l.OidcClient.eventNames.refreshTokensAsync_error:case l.OidcClient.eventNames.syncTokensAsync_error:case l.OidcClient.eventNames.logout_from_another_tab:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(ce,{configurationName:n})});default:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(ft,{redirect_uri:V.configuration.redirect_uri,silent_redirect_uri:V.configuration.silent_redirect_uri,silent_login_uri:V.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:i,authenticatingComponent:d,configurationName:n,withCustomHistory:S,children:c.jsx(vt,{loadingComponent:U,configurationName:n,children:s})})})}},Re=({children:s,callbackPath:o=null,extras:n=null,configurationName:a="default"})=>{const d=l.OidcClient.get,u=d(a);return y.useEffect(()=>{u.tokens||u.loginAsync(o,n)},[a,o,n]),u.tokens?c.jsx(c.Fragment,{children:s}):null},pt=(s,o=null,n=null,a="default")=>d=>c.jsx(Re,{callbackPath:o,extras:n,configurationName:a,children:c.jsx(s,{...d})}),re="default",se=(s,o)=>{let n=!1;return s(o)&&(n=s(o).tokens!=null),n},_t=(s=re)=>{const o=l.OidcClient.get,[n,a]=y.useState(se(o,s));return y.useEffect(()=>{let i=!0;const f=o(s);a(se(o,s));const g=f.subscribeEvents((k,O)=>{(k===l.OidcClient.eventNames.logout_from_another_tab||k===l.OidcClient.eventNames.logout_from_same_tab||k===l.OidcClient.eventNames.token_aquired)&&i&&a(se(o,s))});return()=>{i=!1,f.removeEventSubscription(g)}},[s]),{login:(i=void 0,f=null,g=!1)=>o(s).loginAsync(i,f,!1,void 0,g),logout:(i=void 0,f=null)=>o(s).logoutAsync(i,f),renewTokens:async(i=null)=>{const f=await o(s).renewTokensAsync(i);return{accessToken:f.accessToken,accessTokenPayload:f.accessTokenPayload,idToken:f.idToken,idTokenPayload:f.idTokenPayload}},isAuthenticated:n}},Se={accessToken:null,accessTokenPayload:null},gt=s=>{const o=l.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{accessToken:a.accessToken,accessTokenPayload:a.accessTokenPayload}}return Se},yt=(s=re)=>{const o=l.OidcClient.get,[n,a]=y.useState(gt(s));return y.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const i=u.tokens;a({accessToken:i.accessToken,accessTokenPayload:i.accessTokenPayload})}const h=u.subscribeEvents((i,f)=>{if((i===l.OidcClient.eventNames.token_renewed||i===l.OidcClient.eventNames.token_aquired||i===l.OidcClient.eventNames.logout_from_another_tab||i===l.OidcClient.eventNames.logout_from_same_tab||i===l.OidcClient.eventNames.refreshTokensAsync_error||i===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const g=u.tokens;a(g!=null?{accessToken:g.accessToken,accessTokenPayload:g.accessTokenPayload}:Se)}});return()=>{d=!1,u.removeEventSubscription(h)}},[s]),n},je={idToken:null,idTokenPayload:null},bt=s=>{const o=l.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{idToken:a.idToken,idTokenPayload:a.idTokenPayload}}return je},kt=(s=re)=>{const o=l.OidcClient.get,[n,a]=y.useState(bt(s));return y.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const i=u.tokens;a({idToken:i.idToken,idTokenPayload:i.idTokenPayload})}const h=u.subscribeEvents((i,f)=>{if((i===l.OidcClient.eventNames.token_renewed||i===l.OidcClient.eventNames.token_aquired||i===l.OidcClient.eventNames.logout_from_another_tab||i===l.OidcClient.eventNames.logout_from_same_tab||i===l.OidcClient.eventNames.refreshTokensAsync_error||i===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const g=u.tokens;a(g!=null?{idToken:g.idToken,idTokenPayload:g.idTokenPayload}:je)}});return()=>{d=!1,u.removeEventSubscription(h)}},[s]),n};var Pe=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Pe||{});const mt=(s="default")=>{const[o,n]=y.useState({user:null,status:"Unauthenticated"}),[a,d]=y.useState(""),u=l.OidcClient.get(s);y.useEffect(()=>{let i=!0;if(u&&u.tokens){n({...o,status:"Loading user"});const f=a!=="";u.userInfoAsync(f).then(g=>{i&&n({user:g,status:"User loaded"})}).catch(()=>n({...o,status:"Error loading user"}))}else n({user:null,status:"Unauthenticated"});return()=>{i=!1}},[a]);const h=()=>{d(a+" ")};return{oidcUser:o.user,oidcUserLoadingState:o.status,reloadOidcUser:h}};Object.defineProperty(R,"TokenRenewMode",{enumerable:!0,get:()=>l.TokenRenewMode}),R.OidcProvider=ht,R.OidcSecure=Re,R.OidcUserStatus=Pe,R.useOidc=_t,R.useOidcAccessToken=yt,R.useOidcFetch=Oe,R.useOidcIdToken=kt,R.useOidcUser=mt,R.withOidcFetch=$e,R.withOidcSecure=pt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/react-oidc",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"lint": "eslint src"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@axa-fr/oidc-client-service-worker": "7.
|
|
44
|
-
"@axa-fr/oidc-client": "7.
|
|
43
|
+
"@axa-fr/oidc-client-service-worker": "7.5.0",
|
|
44
|
+
"@axa-fr/oidc-client": "7.5.0",
|
|
45
45
|
"base64-js": "1.5.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
package/src/FetchToken.tsx
CHANGED
|
@@ -27,7 +27,13 @@ const fetchWithToken = (fetch: Fetch, getOidcWithConfigurationName: () => OidcCl
|
|
|
27
27
|
headers.set('Accept', 'application/json');
|
|
28
28
|
}
|
|
29
29
|
if (accessToken) {
|
|
30
|
-
|
|
30
|
+
if(oidc.configuration.demonstrating_proof_of_possession){
|
|
31
|
+
const demonstrationOdProofOfPossession = await oidc.generateDemonstrationOfProofOfPossessionAsync(accessToken, url.toString(), optionTmp.method);
|
|
32
|
+
headers.set('Authorization', `PoP ${accessToken}`);
|
|
33
|
+
headers.set('DPoP', demonstrationOdProofOfPossession);
|
|
34
|
+
} else{
|
|
35
|
+
headers.set('Authorization', `Bearer ${accessToken}`);
|
|
36
|
+
}
|
|
31
37
|
if (!optionTmp.credentials) {
|
|
32
38
|
optionTmp.credentials = 'same-origin';
|
|
33
39
|
}
|