@axa-fr/react-oidc 7.18.0 → 7.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/User.d.ts.map +1 -1
- package/dist/index.js +158 -150
- package/dist/index.umd.cjs +6 -6
- package/package.json +3 -3
- package/src/User.ts +14 -2
package/dist/User.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../src/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAGpE,oBAAY,cAAc;IACtB,eAAe,oBAAmB;IAClC,OAAO,iBAAiB;IACxB,MAAM,gBAAgB;IACtB,YAAY,uBAAuB;CACtC;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IAC1D,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;CAC1B,CAAA;AAED,eAAO,MAAM,WAAW;;;;
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../src/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAGpE,oBAAY,cAAc;IACtB,eAAe,oBAAmB;IAClC,OAAO,iBAAiB;IACxB,MAAM,gBAAgB;IACtB,YAAY,uBAAuB;CACtC;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IAC1D,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;CAC1B,CAAA;AAED,eAAO,MAAM,WAAW;;;;CAyCvB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import me, { useCallback as kt, useState as A, useEffect as S } from "react";
|
|
2
2
|
import { OidcClient as f, getParseQueryStringFromLocation as Et, getPath as z, OidcLocation as $e, getFetchDefault as Tt } from "@axa-fr/oidc-client";
|
|
3
3
|
import { OidcClient as or, TokenRenewMode as sr } from "@axa-fr/oidc-client";
|
|
4
4
|
var be = { exports: {} }, G = {};
|
|
@@ -16,18 +16,18 @@ function wt() {
|
|
|
16
16
|
if (Me)
|
|
17
17
|
return G;
|
|
18
18
|
Me = 1;
|
|
19
|
-
var o =
|
|
20
|
-
function
|
|
21
|
-
var
|
|
19
|
+
var o = me, s = Symbol.for("react.element"), r = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, l = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, u = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function _(c, v, y) {
|
|
21
|
+
var b, w = {}, x = null, j = null;
|
|
22
22
|
y !== void 0 && (x = "" + y), v.key !== void 0 && (x = "" + v.key), v.ref !== void 0 && (j = v.ref);
|
|
23
|
-
for (
|
|
24
|
-
a.call(v,
|
|
23
|
+
for (b in v)
|
|
24
|
+
a.call(v, b) && !u.hasOwnProperty(b) && (w[b] = v[b]);
|
|
25
25
|
if (c && c.defaultProps)
|
|
26
|
-
for (
|
|
27
|
-
w[
|
|
28
|
-
return { $$typeof: s, type: c, key: x, ref: j, props: w, _owner:
|
|
26
|
+
for (b in v = c.defaultProps, v)
|
|
27
|
+
w[b] === void 0 && (w[b] = v[b]);
|
|
28
|
+
return { $$typeof: s, type: c, key: x, ref: j, props: w, _owner: l.current };
|
|
29
29
|
}
|
|
30
|
-
return G.Fragment = r, G.jsx =
|
|
30
|
+
return G.Fragment = r, G.jsx = _, G.jsxs = _, G;
|
|
31
31
|
}
|
|
32
32
|
var J = {};
|
|
33
33
|
/**
|
|
@@ -42,7 +42,7 @@ var J = {};
|
|
|
42
42
|
var Ve;
|
|
43
43
|
function Ot() {
|
|
44
44
|
return Ve || (Ve = 1, process.env.NODE_ENV !== "production" && function() {
|
|
45
|
-
var o =
|
|
45
|
+
var o = me, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), _ = Symbol.for("react.provider"), c = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), H = Symbol.iterator, X = "@@iterator";
|
|
46
46
|
function Y(e) {
|
|
47
47
|
if (e === null || typeof e != "object")
|
|
48
48
|
return null;
|
|
@@ -59,18 +59,18 @@ function Ot() {
|
|
|
59
59
|
}
|
|
60
60
|
function ne(e, t, n) {
|
|
61
61
|
{
|
|
62
|
-
var d = L.ReactDebugCurrentFrame,
|
|
63
|
-
|
|
64
|
-
var
|
|
62
|
+
var d = L.ReactDebugCurrentFrame, g = d.getStackAddendum();
|
|
63
|
+
g !== "" && (t += "%s", n = n.concat([g]));
|
|
64
|
+
var m = n.map(function(p) {
|
|
65
65
|
return String(p);
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
m.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, m);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
var $ = !1, oe = !1, se = !1, ae = !1, ie = !1, F;
|
|
71
71
|
F = Symbol.for("react.module.reference");
|
|
72
72
|
function ce(e) {
|
|
73
|
-
return !!(typeof e == "string" || typeof e == "function" || e === a || e ===
|
|
73
|
+
return !!(typeof e == "string" || typeof e == "function" || e === a || e === u || ie || e === l || e === y || e === b || ae || e === j || $ || oe || se || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === w || e.$$typeof === _ || e.$$typeof === c || e.$$typeof === v || // 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.
|
|
@@ -80,8 +80,8 @@ function Ot() {
|
|
|
80
80
|
var d = e.displayName;
|
|
81
81
|
if (d)
|
|
82
82
|
return d;
|
|
83
|
-
var
|
|
84
|
-
return
|
|
83
|
+
var g = t.displayName || t.name || "";
|
|
84
|
+
return g !== "" ? n + "(" + g + ")" : n;
|
|
85
85
|
}
|
|
86
86
|
function W(e) {
|
|
87
87
|
return e.displayName || "Context";
|
|
@@ -98,13 +98,13 @@ function Ot() {
|
|
|
98
98
|
return "Fragment";
|
|
99
99
|
case r:
|
|
100
100
|
return "Portal";
|
|
101
|
-
case l:
|
|
102
|
-
return "Profiler";
|
|
103
101
|
case u:
|
|
102
|
+
return "Profiler";
|
|
103
|
+
case l:
|
|
104
104
|
return "StrictMode";
|
|
105
105
|
case y:
|
|
106
106
|
return "Suspense";
|
|
107
|
-
case
|
|
107
|
+
case b:
|
|
108
108
|
return "SuspenseList";
|
|
109
109
|
}
|
|
110
110
|
if (typeof e == "object")
|
|
@@ -112,7 +112,7 @@ function Ot() {
|
|
|
112
112
|
case c:
|
|
113
113
|
var t = e;
|
|
114
114
|
return W(t) + ".Consumer";
|
|
115
|
-
case
|
|
115
|
+
case _:
|
|
116
116
|
var n = e;
|
|
117
117
|
return W(n._context) + ".Provider";
|
|
118
118
|
case v:
|
|
@@ -121,9 +121,9 @@ function Ot() {
|
|
|
121
121
|
var d = e.displayName || null;
|
|
122
122
|
return d !== null ? d : R(e.type) || "Memo";
|
|
123
123
|
case x: {
|
|
124
|
-
var
|
|
124
|
+
var g = e, m = g._payload, p = g._init;
|
|
125
125
|
try {
|
|
126
|
-
return R(p(
|
|
126
|
+
return R(p(m));
|
|
127
127
|
} catch {
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
@@ -199,8 +199,8 @@ function Ot() {
|
|
|
199
199
|
if (de === void 0)
|
|
200
200
|
try {
|
|
201
201
|
throw Error();
|
|
202
|
-
} catch (
|
|
203
|
-
var d =
|
|
202
|
+
} catch (g) {
|
|
203
|
+
var d = g.stack.trim().match(/\n( *(at )?)/);
|
|
204
204
|
de = d && d[1] || "";
|
|
205
205
|
}
|
|
206
206
|
return `
|
|
@@ -222,10 +222,10 @@ function Ot() {
|
|
|
222
222
|
}
|
|
223
223
|
var d;
|
|
224
224
|
fe = !0;
|
|
225
|
-
var
|
|
225
|
+
var g = Error.prepareStackTrace;
|
|
226
226
|
Error.prepareStackTrace = void 0;
|
|
227
|
-
var
|
|
228
|
-
|
|
227
|
+
var m;
|
|
228
|
+
m = ue.current, ue.current = null, He();
|
|
229
229
|
try {
|
|
230
230
|
if (t) {
|
|
231
231
|
var p = function() {
|
|
@@ -262,23 +262,23 @@ function Ot() {
|
|
|
262
262
|
if (I && d && typeof I.stack == "string") {
|
|
263
263
|
for (var h = I.stack.split(`
|
|
264
264
|
`), C = d.stack.split(`
|
|
265
|
-
`),
|
|
265
|
+
`), k = h.length - 1, T = C.length - 1; k >= 1 && T >= 0 && h[k] !== C[T]; )
|
|
266
266
|
T--;
|
|
267
|
-
for (;
|
|
268
|
-
if (h[
|
|
269
|
-
if (
|
|
267
|
+
for (; k >= 1 && T >= 0; k--, T--)
|
|
268
|
+
if (h[k] !== C[T]) {
|
|
269
|
+
if (k !== 1 || T !== 1)
|
|
270
270
|
do
|
|
271
|
-
if (
|
|
271
|
+
if (k--, T--, T < 0 || h[k] !== C[T]) {
|
|
272
272
|
var P = `
|
|
273
|
-
` + h[
|
|
273
|
+
` + h[k].replace(" at new ", " at ");
|
|
274
274
|
return e.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", e.displayName)), typeof e == "function" && Z.set(e, P), P;
|
|
275
275
|
}
|
|
276
|
-
while (
|
|
276
|
+
while (k >= 1 && T >= 0);
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
} finally {
|
|
281
|
-
fe = !1, ue.current =
|
|
281
|
+
fe = !1, ue.current = m, Xe(), Error.prepareStackTrace = g;
|
|
282
282
|
}
|
|
283
283
|
var q = e ? e.displayName || e.name : "", Ye = q ? Q(q) : "";
|
|
284
284
|
return typeof e == "function" && Z.set(e, Ye), Ye;
|
|
@@ -300,7 +300,7 @@ function Ot() {
|
|
|
300
300
|
switch (e) {
|
|
301
301
|
case y:
|
|
302
302
|
return Q("Suspense");
|
|
303
|
-
case
|
|
303
|
+
case b:
|
|
304
304
|
return Q("SuspenseList");
|
|
305
305
|
}
|
|
306
306
|
if (typeof e == "object")
|
|
@@ -310,9 +310,9 @@ function Ot() {
|
|
|
310
310
|
case w:
|
|
311
311
|
return ee(e.type, t, n);
|
|
312
312
|
case x: {
|
|
313
|
-
var d = e,
|
|
313
|
+
var d = e, g = d._payload, m = d._init;
|
|
314
314
|
try {
|
|
315
|
-
return ee(
|
|
315
|
+
return ee(m(g), t, n);
|
|
316
316
|
} catch {
|
|
317
317
|
}
|
|
318
318
|
}
|
|
@@ -327,11 +327,11 @@ function Ot() {
|
|
|
327
327
|
} else
|
|
328
328
|
je.setExtraStackFrame(null);
|
|
329
329
|
}
|
|
330
|
-
function tt(e, t, n, d,
|
|
330
|
+
function tt(e, t, n, d, g) {
|
|
331
331
|
{
|
|
332
|
-
var
|
|
332
|
+
var m = Function.call.bind(te);
|
|
333
333
|
for (var p in e)
|
|
334
|
-
if (
|
|
334
|
+
if (m(e, p)) {
|
|
335
335
|
var h = void 0;
|
|
336
336
|
try {
|
|
337
337
|
if (typeof e[p] != "function") {
|
|
@@ -339,10 +339,10 @@ function Ot() {
|
|
|
339
339
|
throw C.name = "Invariant Violation", C;
|
|
340
340
|
}
|
|
341
341
|
h = e[p](t, p, d, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
342
|
-
} catch (
|
|
343
|
-
h =
|
|
342
|
+
} catch (k) {
|
|
343
|
+
h = k;
|
|
344
344
|
}
|
|
345
|
-
h && !(h instanceof Error) && (re(
|
|
345
|
+
h && !(h instanceof Error) && (re(g), O("%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).", d || "React class", n, p, typeof h), re(null)), h instanceof Error && !(h.message in xe) && (xe[h.message] = !0, re(g), O("Failed %s type: %s", n, h.message), re(null));
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
@@ -421,7 +421,7 @@ function Ot() {
|
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
var dt = function(e, t, n, d,
|
|
424
|
+
var dt = function(e, t, n, d, g, m, p) {
|
|
425
425
|
var h = {
|
|
426
426
|
// This tag allows us to uniquely identify this as a React Element
|
|
427
427
|
$$typeof: s,
|
|
@@ -431,7 +431,7 @@ function Ot() {
|
|
|
431
431
|
ref: n,
|
|
432
432
|
props: p,
|
|
433
433
|
// Record the component responsible for creating this element.
|
|
434
|
-
_owner:
|
|
434
|
+
_owner: m
|
|
435
435
|
};
|
|
436
436
|
return h._store = {}, Object.defineProperty(h._store, "validated", {
|
|
437
437
|
configurable: !1,
|
|
@@ -447,25 +447,25 @@ function Ot() {
|
|
|
447
447
|
configurable: !1,
|
|
448
448
|
enumerable: !1,
|
|
449
449
|
writable: !1,
|
|
450
|
-
value:
|
|
450
|
+
value: g
|
|
451
451
|
}), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
|
|
452
452
|
};
|
|
453
|
-
function ft(e, t, n, d,
|
|
453
|
+
function ft(e, t, n, d, g) {
|
|
454
454
|
{
|
|
455
|
-
var
|
|
456
|
-
n !== void 0 && (Se(n), h = "" + n), it(t) && (Se(t.key), h = "" + t.key), at(t) && (C = t.ref, ct(t,
|
|
457
|
-
for (
|
|
458
|
-
te.call(t,
|
|
455
|
+
var m, p = {}, h = null, C = null;
|
|
456
|
+
n !== void 0 && (Se(n), h = "" + n), it(t) && (Se(t.key), h = "" + t.key), at(t) && (C = t.ref, ct(t, g));
|
|
457
|
+
for (m in t)
|
|
458
|
+
te.call(t, m) && !st.hasOwnProperty(m) && (p[m] = t[m]);
|
|
459
459
|
if (e && e.defaultProps) {
|
|
460
|
-
var
|
|
461
|
-
for (
|
|
462
|
-
p[
|
|
460
|
+
var k = e.defaultProps;
|
|
461
|
+
for (m in k)
|
|
462
|
+
p[m] === void 0 && (p[m] = k[m]);
|
|
463
463
|
}
|
|
464
464
|
if (h || C) {
|
|
465
465
|
var T = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
466
466
|
h && lt(p, T), C && ut(p, T);
|
|
467
467
|
}
|
|
468
|
-
return dt(e, h, C,
|
|
468
|
+
return dt(e, h, C, g, d, B.current, p);
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
var pe = L.ReactCurrentOwner, De = L.ReactDebugCurrentFrame;
|
|
@@ -542,9 +542,9 @@ Check the top-level render call using <` + n + ">.");
|
|
|
542
542
|
else if (ge(e))
|
|
543
543
|
e._store && (e._store.validated = !0);
|
|
544
544
|
else if (e) {
|
|
545
|
-
var
|
|
546
|
-
if (typeof
|
|
547
|
-
for (var
|
|
545
|
+
var g = Y(e);
|
|
546
|
+
if (typeof g == "function" && g !== e.entries)
|
|
547
|
+
for (var m = g.call(e), p; !(p = m.next()).done; )
|
|
548
548
|
ge(p.value) && Le(p.value, t);
|
|
549
549
|
}
|
|
550
550
|
}
|
|
@@ -568,8 +568,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
568
568
|
tt(n, e.props, "prop", d, e);
|
|
569
569
|
} else if (t.PropTypes !== void 0 && !_e) {
|
|
570
570
|
_e = !0;
|
|
571
|
-
var
|
|
572
|
-
O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
571
|
+
var g = R(t);
|
|
572
|
+
O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", g || "Unknown");
|
|
573
573
|
}
|
|
574
574
|
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
575
575
|
}
|
|
@@ -586,18 +586,18 @@ Check the top-level render call using <` + n + ">.");
|
|
|
586
586
|
e.ref !== null && (V(e), O("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
function Ue(e, t, n, d,
|
|
589
|
+
function Ue(e, t, n, d, g, m) {
|
|
590
590
|
{
|
|
591
591
|
var p = ce(e);
|
|
592
592
|
if (!p) {
|
|
593
593
|
var h = "";
|
|
594
594
|
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " 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
|
-
var C = vt(
|
|
595
|
+
var C = vt(g);
|
|
596
596
|
C ? h += C : h += Ne();
|
|
597
|
-
var
|
|
598
|
-
e === null ?
|
|
597
|
+
var k;
|
|
598
|
+
e === null ? k = "null" : ve(e) ? k = "array" : e !== void 0 && e.$$typeof === s ? (k = "<" + (R(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : k = typeof e, O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", k, h);
|
|
599
599
|
}
|
|
600
|
-
var T = ft(e, t, n,
|
|
600
|
+
var T = ft(e, t, n, g, m);
|
|
601
601
|
if (T == null)
|
|
602
602
|
return T;
|
|
603
603
|
if (p) {
|
|
@@ -622,19 +622,19 @@ Check the top-level render call using <` + n + ">.");
|
|
|
622
622
|
function yt(e, t, n) {
|
|
623
623
|
return Ue(e, t, n, !1);
|
|
624
624
|
}
|
|
625
|
-
var bt = yt,
|
|
626
|
-
J.Fragment = a, J.jsx = bt, J.jsxs =
|
|
625
|
+
var bt = yt, mt = gt;
|
|
626
|
+
J.Fragment = a, J.jsx = bt, J.jsxs = mt;
|
|
627
627
|
}()), J;
|
|
628
628
|
}
|
|
629
629
|
process.env.NODE_ENV === "production" ? be.exports = wt() : be.exports = Ot();
|
|
630
630
|
var i = be.exports;
|
|
631
631
|
const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o)(...r), Kt = (o = null, s = Be) => (r) => (a) => {
|
|
632
|
-
const { fetch:
|
|
633
|
-
return /* @__PURE__ */ i.jsx(r, { ...a, fetch:
|
|
632
|
+
const { fetch: l } = Rt(o || a.fetch, s);
|
|
633
|
+
return /* @__PURE__ */ i.jsx(r, { ...a, fetch: l });
|
|
634
634
|
}, Rt = (o = null, s = Be) => {
|
|
635
635
|
const r = o || window.fetch, a = f.get;
|
|
636
|
-
return { fetch:
|
|
637
|
-
(
|
|
636
|
+
return { fetch: kt(
|
|
637
|
+
(u, _) => Ct(r, () => a(s))(u, _),
|
|
638
638
|
[r, s]
|
|
639
639
|
) };
|
|
640
640
|
}, ze = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-authenticating__container", children: [
|
|
@@ -646,34 +646,34 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
646
646
|
] }) }), jt = () => Math.random().toString(36).substr(2, 6), Pt = (o, s) => (r, a) => {
|
|
647
647
|
if (typeof o.CustomEvent == "function")
|
|
648
648
|
return new o.CustomEvent(r, a);
|
|
649
|
-
const
|
|
650
|
-
return
|
|
649
|
+
const l = a || { bubbles: !1, cancelable: !1, detail: void 0 }, u = s.createEvent("CustomEvent");
|
|
650
|
+
return u.initCustomEvent(r, l.bubbles, l.cancelable, l.detail), u.prototype = o.Event.prototype, u;
|
|
651
651
|
}, St = (o, s, r) => ({
|
|
652
|
-
replaceState: (a,
|
|
653
|
-
const
|
|
654
|
-
o.history.replaceState({ key:
|
|
652
|
+
replaceState: (a, l) => {
|
|
653
|
+
const u = r(), _ = l || o.history.state;
|
|
654
|
+
o.history.replaceState({ key: u, state: _ }, null, a), o.dispatchEvent(s("popstate"));
|
|
655
655
|
}
|
|
656
656
|
}), At = () => St(window, Pt(window, document), jt), Ge = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-callback", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-callback__container", children: [
|
|
657
657
|
/* @__PURE__ */ i.jsx("h1", { className: "oidc-callback__title", children: "Authentication complete" }),
|
|
658
658
|
/* @__PURE__ */ i.jsx("p", { className: "oidc-callback__content", children: "You will be redirected to your application." })
|
|
659
659
|
] }) }), Ft = ({ callBackError: o, callBackSuccess: s, configurationName: r, withCustomHistory: a }) => {
|
|
660
|
-
const [
|
|
660
|
+
const [l, u] = A(!1);
|
|
661
661
|
S(() => {
|
|
662
662
|
let v = !0;
|
|
663
663
|
return (async () => {
|
|
664
|
-
const
|
|
664
|
+
const b = f.get;
|
|
665
665
|
try {
|
|
666
|
-
const { callbackPath: w } = await
|
|
666
|
+
const { callbackPath: w } = await b(r).loginCallbackAsync();
|
|
667
667
|
(a ? a() : At()).replaceState(w || "/");
|
|
668
668
|
} catch (w) {
|
|
669
|
-
v && (console.warn(w),
|
|
669
|
+
v && (console.warn(w), u(!0));
|
|
670
670
|
}
|
|
671
671
|
})(), () => {
|
|
672
672
|
v = !1;
|
|
673
673
|
};
|
|
674
674
|
}, []);
|
|
675
|
-
const
|
|
676
|
-
return
|
|
675
|
+
const _ = o || ze, c = s || Ge;
|
|
676
|
+
return l ? /* @__PURE__ */ i.jsx(_, { configurationName: r }) : /* @__PURE__ */ i.jsx(c, { configurationName: r });
|
|
677
677
|
}, Dt = () => /* @__PURE__ */ i.jsx("span", { className: "oidc-loading", children: "Loading" }), Nt = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-serviceworker", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-serviceworker__container", children: [
|
|
678
678
|
/* @__PURE__ */ i.jsx("h1", { className: "oidc-serviceworker__title", children: "Unable to authenticate on this browser" }),
|
|
679
679
|
/* @__PURE__ */ i.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." })
|
|
@@ -687,45 +687,45 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
687
687
|
})();
|
|
688
688
|
}, []), /* @__PURE__ */ i.jsx(i.Fragment, {})), Wt = ({ configurationName: o }) => {
|
|
689
689
|
const s = Et(window.location.href), r = f.get, a = r(o);
|
|
690
|
-
let
|
|
691
|
-
for (const [
|
|
692
|
-
|
|
690
|
+
let l = null;
|
|
691
|
+
for (const [u, _] of Object.entries(s))
|
|
692
|
+
u === "state" || u === "scope" || (l === null && (l = {}), l[u] = _);
|
|
693
693
|
return S(() => {
|
|
694
|
-
a.tokens || a.loginAsync(null,
|
|
694
|
+
a.tokens || a.loginAsync(null, l, !0, s.scope);
|
|
695
695
|
}, []), /* @__PURE__ */ i.jsx(i.Fragment, {});
|
|
696
696
|
}, Ut = ({
|
|
697
697
|
callbackErrorComponent: o,
|
|
698
698
|
callbackSuccessComponent: s,
|
|
699
699
|
redirect_uri: r,
|
|
700
700
|
silent_redirect_uri: a,
|
|
701
|
-
silent_login_uri:
|
|
702
|
-
children:
|
|
703
|
-
configurationName:
|
|
701
|
+
silent_login_uri: l,
|
|
702
|
+
children: u,
|
|
703
|
+
configurationName: _,
|
|
704
704
|
withCustomHistory: c = null,
|
|
705
705
|
location: v
|
|
706
706
|
}) => {
|
|
707
|
-
const y = window ? z(window.location.href) : "", [
|
|
707
|
+
const y = window ? z(window.location.href) : "", [b, w] = A(y);
|
|
708
708
|
S(() => {
|
|
709
709
|
const j = () => w(z(window.location.href));
|
|
710
710
|
return j(), window.addEventListener("popstate", j, !1), () => window.removeEventListener("popstate", j, !1);
|
|
711
711
|
}, []);
|
|
712
712
|
const x = z(r);
|
|
713
|
-
if (a &&
|
|
714
|
-
return /* @__PURE__ */ i.jsx(Lt, { configurationName:
|
|
715
|
-
if (
|
|
716
|
-
return /* @__PURE__ */ i.jsx(Wt, { configurationName:
|
|
717
|
-
switch (
|
|
713
|
+
if (a && b === z(a))
|
|
714
|
+
return /* @__PURE__ */ i.jsx(Lt, { configurationName: _ });
|
|
715
|
+
if (l && b === z(l))
|
|
716
|
+
return /* @__PURE__ */ i.jsx(Wt, { configurationName: _ });
|
|
717
|
+
switch (b) {
|
|
718
718
|
case x:
|
|
719
|
-
return /* @__PURE__ */ i.jsx(Ft, { callBackError: o, callBackSuccess: s, configurationName:
|
|
719
|
+
return /* @__PURE__ */ i.jsx(Ft, { callBackError: o, callBackSuccess: s, configurationName: _, withCustomHistory: c });
|
|
720
720
|
default:
|
|
721
|
-
return /* @__PURE__ */ i.jsx(i.Fragment, { children:
|
|
721
|
+
return /* @__PURE__ */ i.jsx(i.Fragment, { children: u });
|
|
722
722
|
}
|
|
723
|
-
}, Yt =
|
|
724
|
-
const [a,
|
|
723
|
+
}, Yt = me.memo(Ut), qe = { name: "", data: null }, $t = ({ loadingComponent: o, children: s, configurationName: r }) => {
|
|
724
|
+
const [a, l] = A(!0), u = f.get, _ = u(r);
|
|
725
725
|
S(() => {
|
|
726
726
|
let v = !0;
|
|
727
|
-
return
|
|
728
|
-
v &&
|
|
727
|
+
return _ && _.tryKeepExistingSessionAsync().then(() => {
|
|
728
|
+
v && l(!1);
|
|
729
729
|
}), () => {
|
|
730
730
|
v = !1;
|
|
731
731
|
};
|
|
@@ -733,20 +733,20 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
733
733
|
const c = o;
|
|
734
734
|
return /* @__PURE__ */ i.jsx(i.Fragment, { children: a ? /* @__PURE__ */ i.jsx(c, { configurationName: r }) : /* @__PURE__ */ i.jsx(i.Fragment, { children: s }) });
|
|
735
735
|
}, K = ({ isLoading: o, loadingComponent: s, children: r, configurationName: a }) => {
|
|
736
|
-
const
|
|
737
|
-
return o ? /* @__PURE__ */ i.jsx(
|
|
736
|
+
const l = s;
|
|
737
|
+
return o ? /* @__PURE__ */ i.jsx(l, { configurationName: a, children: r }) : /* @__PURE__ */ i.jsx(i.Fragment, { children: r });
|
|
738
738
|
}, Ht = ({
|
|
739
739
|
children: o,
|
|
740
740
|
configuration: s,
|
|
741
741
|
configurationName: r = "default",
|
|
742
742
|
callbackSuccessComponent: a = Ge,
|
|
743
|
-
authenticatingComponent:
|
|
744
|
-
loadingComponent:
|
|
745
|
-
serviceWorkerNotSupportedComponent:
|
|
743
|
+
authenticatingComponent: l = xt,
|
|
744
|
+
loadingComponent: u = Dt,
|
|
745
|
+
serviceWorkerNotSupportedComponent: _ = Nt,
|
|
746
746
|
authenticatingErrorComponent: c = ze,
|
|
747
747
|
sessionLostComponent: v = It,
|
|
748
748
|
onSessionLost: y = null,
|
|
749
|
-
onLogoutFromAnotherTab:
|
|
749
|
+
onLogoutFromAnotherTab: b = null,
|
|
750
750
|
onLogoutFromSameTab: w = null,
|
|
751
751
|
withCustomHistory: x = null,
|
|
752
752
|
onEvent: j = null,
|
|
@@ -770,8 +770,8 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
770
770
|
}
|
|
771
771
|
$({ name: E, data: N });
|
|
772
772
|
} else if (E === f.eventNames.logout_from_another_tab) {
|
|
773
|
-
if (
|
|
774
|
-
|
|
773
|
+
if (b != null) {
|
|
774
|
+
b();
|
|
775
775
|
return;
|
|
776
776
|
}
|
|
777
777
|
$({ name: E, data: N });
|
|
@@ -782,7 +782,7 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
782
782
|
Y(r).removeEventSubscription(M), $(qe);
|
|
783
783
|
};
|
|
784
784
|
}, [s, r]);
|
|
785
|
-
const ae = v, ie =
|
|
785
|
+
const ae = v, ie = l, F = u, ce = _, le = c, W = L || oe !== r, R = Y(r);
|
|
786
786
|
switch (ne.name) {
|
|
787
787
|
case f.eventNames.service_worker_not_supported_by_browser:
|
|
788
788
|
return /* @__PURE__ */ i.jsx(K, { loadingComponent: F, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(ce, { configurationName: r }) });
|
|
@@ -804,7 +804,7 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
804
804
|
silent_login_uri: R.configuration.silent_login_uri,
|
|
805
805
|
callbackSuccessComponent: a,
|
|
806
806
|
callbackErrorComponent: c,
|
|
807
|
-
authenticatingComponent:
|
|
807
|
+
authenticatingComponent: l,
|
|
808
808
|
configurationName: r,
|
|
809
809
|
withCustomHistory: x,
|
|
810
810
|
location: X ?? new $e(),
|
|
@@ -813,21 +813,21 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
813
813
|
) });
|
|
814
814
|
}
|
|
815
815
|
}, Mt = ({ children: o, callbackPath: s = null, extras: r = null, configurationName: a = "default" }) => {
|
|
816
|
-
const
|
|
816
|
+
const l = f.get, u = l(a);
|
|
817
817
|
return S(() => {
|
|
818
|
-
|
|
819
|
-
}, [a, s, r]),
|
|
820
|
-
}, Xt = (o, s = null, r = null, a = "default") => (
|
|
818
|
+
u.tokens || u.loginAsync(s, r);
|
|
819
|
+
}, [a, s, r]), u.tokens ? /* @__PURE__ */ i.jsx(i.Fragment, { children: o }) : null;
|
|
820
|
+
}, Xt = (o, s = null, r = null, a = "default") => (l) => /* @__PURE__ */ i.jsx(Mt, { callbackPath: s, extras: r, configurationName: a, children: /* @__PURE__ */ i.jsx(o, { ...l }) }), ke = "default", ye = (o, s) => {
|
|
821
821
|
let r = !1;
|
|
822
822
|
return o(s) && (r = o(s).tokens != null), r;
|
|
823
|
-
}, Qt = (o =
|
|
823
|
+
}, Qt = (o = ke) => {
|
|
824
824
|
const s = f.get, [r, a] = A(ye(s, o));
|
|
825
825
|
return S(() => {
|
|
826
826
|
let c = !0;
|
|
827
827
|
const v = s(o);
|
|
828
828
|
a(ye(s, o));
|
|
829
|
-
const y = v.subscribeEvents((
|
|
830
|
-
(
|
|
829
|
+
const y = v.subscribeEvents((b, w) => {
|
|
830
|
+
(b === f.eventNames.logout_from_another_tab || b === f.eventNames.logout_from_same_tab || b === f.eventNames.token_aquired) && c && a(ye(s, o));
|
|
831
831
|
});
|
|
832
832
|
return () => {
|
|
833
833
|
c = !1, v.removeEventSubscription(y);
|
|
@@ -852,7 +852,7 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
852
852
|
return {
|
|
853
853
|
accessToken: a.accessToken,
|
|
854
854
|
accessTokenPayload: a.accessTokenPayload,
|
|
855
|
-
generateDemonstrationOfProofOfPossessionAsync: r.configuration.demonstrating_proof_of_possession ? (
|
|
855
|
+
generateDemonstrationOfProofOfPossessionAsync: r.configuration.demonstrating_proof_of_possession ? (l, u) => r.generateDemonstrationOfProofOfPossessionAsync(a.accessToken, l, u) : null
|
|
856
856
|
};
|
|
857
857
|
}
|
|
858
858
|
return Je;
|
|
@@ -860,27 +860,27 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
860
860
|
function qt(o, s) {
|
|
861
861
|
return o.configuration.demonstrating_proof_of_possession ? (r, a) => o.generateDemonstrationOfProofOfPossessionAsync(s.accessToken, r, a) : null;
|
|
862
862
|
}
|
|
863
|
-
const Zt = (o =
|
|
863
|
+
const Zt = (o = ke) => {
|
|
864
864
|
const s = f.get, [r, a] = A(Vt(o));
|
|
865
865
|
return S(() => {
|
|
866
|
-
let
|
|
867
|
-
const
|
|
868
|
-
if (
|
|
869
|
-
const c =
|
|
866
|
+
let l = !0;
|
|
867
|
+
const u = s(o);
|
|
868
|
+
if (u.tokens) {
|
|
869
|
+
const c = u.tokens;
|
|
870
870
|
a({ accessToken: c.accessToken, accessTokenPayload: c.accessTokenPayload });
|
|
871
871
|
}
|
|
872
|
-
const
|
|
873
|
-
if ((c === f.eventNames.token_renewed || c === f.eventNames.token_aquired || c === f.eventNames.logout_from_another_tab || c === f.eventNames.logout_from_same_tab || c === f.eventNames.refreshTokensAsync_error || c === f.eventNames.syncTokensAsync_error) &&
|
|
874
|
-
const y =
|
|
872
|
+
const _ = u.subscribeEvents((c, v) => {
|
|
873
|
+
if ((c === f.eventNames.token_renewed || c === f.eventNames.token_aquired || c === f.eventNames.logout_from_another_tab || c === f.eventNames.logout_from_same_tab || c === f.eventNames.refreshTokensAsync_error || c === f.eventNames.syncTokensAsync_error) && l) {
|
|
874
|
+
const y = u.tokens;
|
|
875
875
|
a(y != null ? {
|
|
876
876
|
accessToken: y.accessToken,
|
|
877
877
|
accessTokenPayload: y.accessTokenPayload,
|
|
878
|
-
generateDemonstrationOfProofOfPossessionAsync: qt(
|
|
878
|
+
generateDemonstrationOfProofOfPossessionAsync: qt(u, y)
|
|
879
879
|
} : Je);
|
|
880
880
|
}
|
|
881
881
|
});
|
|
882
882
|
return () => {
|
|
883
|
-
|
|
883
|
+
l = !1, u.removeEventSubscription(_);
|
|
884
884
|
};
|
|
885
885
|
}, [o]), r;
|
|
886
886
|
}, Ke = { idToken: null, idTokenPayload: null }, Bt = (o) => {
|
|
@@ -890,23 +890,23 @@ const Zt = (o = me) => {
|
|
|
890
890
|
return { idToken: a.idToken, idTokenPayload: a.idTokenPayload };
|
|
891
891
|
}
|
|
892
892
|
return Ke;
|
|
893
|
-
}, er = (o =
|
|
893
|
+
}, er = (o = ke) => {
|
|
894
894
|
const s = f.get, [r, a] = A(Bt(o));
|
|
895
895
|
return S(() => {
|
|
896
|
-
let
|
|
897
|
-
const
|
|
898
|
-
if (
|
|
899
|
-
const c =
|
|
896
|
+
let l = !0;
|
|
897
|
+
const u = s(o);
|
|
898
|
+
if (u.tokens) {
|
|
899
|
+
const c = u.tokens;
|
|
900
900
|
a({ idToken: c.idToken, idTokenPayload: c.idTokenPayload });
|
|
901
901
|
}
|
|
902
|
-
const
|
|
903
|
-
if ((c === f.eventNames.token_renewed || c === f.eventNames.token_aquired || c === f.eventNames.logout_from_another_tab || c === f.eventNames.logout_from_same_tab || c === f.eventNames.refreshTokensAsync_error || c === f.eventNames.syncTokensAsync_error) &&
|
|
904
|
-
const y =
|
|
902
|
+
const _ = u.subscribeEvents((c, v) => {
|
|
903
|
+
if ((c === f.eventNames.token_renewed || c === f.eventNames.token_aquired || c === f.eventNames.logout_from_another_tab || c === f.eventNames.logout_from_same_tab || c === f.eventNames.refreshTokensAsync_error || c === f.eventNames.syncTokensAsync_error) && l) {
|
|
904
|
+
const y = u.tokens;
|
|
905
905
|
a(y != null ? { idToken: y.idToken, idTokenPayload: y.idTokenPayload } : Ke);
|
|
906
906
|
}
|
|
907
907
|
});
|
|
908
908
|
return () => {
|
|
909
|
-
|
|
909
|
+
l = !1, u.removeEventSubscription(_);
|
|
910
910
|
};
|
|
911
911
|
}, [o]), r;
|
|
912
912
|
};
|
|
@@ -916,19 +916,20 @@ const tr = (o = "default") => {
|
|
|
916
916
|
user: null,
|
|
917
917
|
status: "Unauthenticated"
|
|
918
918
|
/* Unauthenticated */
|
|
919
|
-
}), [a,
|
|
919
|
+
}), [a, l] = A("");
|
|
920
920
|
S(() => {
|
|
921
|
+
const _ = f.get(o);
|
|
921
922
|
let c = !0;
|
|
922
|
-
if (
|
|
923
|
+
if (_ && _.tokens) {
|
|
923
924
|
r({
|
|
924
925
|
...s,
|
|
925
926
|
status: "Loading user"
|
|
926
927
|
/* Loading */
|
|
927
928
|
});
|
|
928
|
-
const
|
|
929
|
-
|
|
929
|
+
const y = a !== "";
|
|
930
|
+
_.userInfoAsync(y).then((b) => {
|
|
930
931
|
c && r({
|
|
931
|
-
user:
|
|
932
|
+
user: b,
|
|
932
933
|
status: "User loaded"
|
|
933
934
|
/* Loaded */
|
|
934
935
|
});
|
|
@@ -943,14 +944,21 @@ const tr = (o = "default") => {
|
|
|
943
944
|
status: "Unauthenticated"
|
|
944
945
|
/* Unauthenticated */
|
|
945
946
|
});
|
|
947
|
+
const v = _.subscribeEvents((y, b) => {
|
|
948
|
+
(y === f.eventNames.logout_from_another_tab || y === f.eventNames.logout_from_same_tab) && c && r({
|
|
949
|
+
user: null,
|
|
950
|
+
status: "Unauthenticated"
|
|
951
|
+
/* Unauthenticated */
|
|
952
|
+
});
|
|
953
|
+
});
|
|
946
954
|
return () => {
|
|
947
|
-
c = !1;
|
|
955
|
+
c = !1, _.removeEventSubscription(v);
|
|
948
956
|
};
|
|
949
957
|
}, [a]);
|
|
950
|
-
const
|
|
951
|
-
|
|
958
|
+
const u = () => {
|
|
959
|
+
l(a + " ");
|
|
952
960
|
};
|
|
953
|
-
return { oidcUser: s.user, oidcUserLoadingState: s.status, reloadOidcUser:
|
|
961
|
+
return { oidcUser: s.user, oidcUserLoadingState: s.status, reloadOidcUser: u };
|
|
954
962
|
};
|
|
955
963
|
export {
|
|
956
964
|
or as OidcClient,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(w,
|
|
1
|
+
(function(w,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react"),require("@axa-fr/oidc-client")):typeof define=="function"&&define.amd?define(["exports","react","@axa-fr/oidc-client"],g):(w=typeof globalThis<"u"?globalThis:w||self,g(w["react-oidc"]={},w.React,w.oidcClient))})(this,function(w,g,c){"use strict";var ne={exports:{}},G={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -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 ke;function Qe(){if(ke)return G;ke=1;var s=
|
|
9
|
+
*/var ke;function Qe(){if(ke)return G;ke=1;var s=g,o=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,u=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function _(l,v,b){var k,S={},C=null,x=null;b!==void 0&&(C=""+b),v.key!==void 0&&(C=""+v.key),v.ref!==void 0&&(x=v.ref);for(k in v)a.call(v,k)&&!f.hasOwnProperty(k)&&(S[k]=v[k]);if(l&&l.defaultProps)for(k in v=l.defaultProps,v)S[k]===void 0&&(S[k]=v[k]);return{$$typeof:o,type:l,key:C,ref:x,props:S,_owner:u.current}}return G.Fragment=n,G.jsx=_,G.jsxs=_,G}var J={};/**
|
|
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 me;function Ze(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){var s=
|
|
18
|
-
`+ve+e}}var he=!1,q;{var wt=typeof WeakMap=="function"?WeakMap:Map;q=new wt}function Ie(e,t){if(!e||he)return"";{var r=q.get(e);if(r!==void 0)return r}var d;he=!0;var
|
|
17
|
+
*/var me;function Ze(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){var s=g,o=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),l=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),X=Symbol.iterator,Q="@@iterator";function M(e){if(e===null||typeof e!="object")return null;var t=X&&e[X]||e[Q];return typeof t=="function"?t:null}var L=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(e){{for(var t=arguments.length,r=new Array(t>1?t-1:0),d=1;d<t;d++)r[d-1]=arguments[d];oe("error",e,r)}}function oe(e,t,r){{var d=L.ReactDebugCurrentFrame,y=d.getStackAddendum();y!==""&&(t+="%s",r=r.concat([y]));var m=r.map(function(p){return String(p)});m.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,m)}}var Y=!1,ae=!1,ce=!1,ie=!1,le=!1,F;F=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===a||e===f||le||e===u||e===b||e===k||ie||e===x||Y||ae||ce||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===S||e.$$typeof===_||e.$$typeof===l||e.$$typeof===v||e.$$typeof===F||e.getModuleId!==void 0))}function fe(e,t,r){var d=e.displayName;if(d)return d;var y=t.displayName||t.name||"";return y!==""?r+"("+y+")":r}function U(e){return e.displayName||"Context"}function P(e){if(e==null)return null;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")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case a:return"Fragment";case n:return"Portal";case f:return"Profiler";case u:return"StrictMode";case b:return"Suspense";case k:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case l:var t=e;return U(t)+".Consumer";case _:var r=e;return U(r._context)+".Provider";case v:return fe(e,e.render,"ForwardRef");case S:var d=e.displayName||null;return d!==null?d:P(e.type)||"Memo";case C:{var y=e,m=y._payload,p=y._init;try{return P(p(m))}catch{return null}}}return null}var W=Object.assign,D=0,V,E,N,xe,Ae,Fe,De;function Ne(){}Ne.__reactDisabledLog=!0;function Et(){{if(D===0){V=console.log,E=console.info,N=console.warn,xe=console.error,Ae=console.group,Fe=console.groupCollapsed,De=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ne,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}D++}}function Tt(){{if(D--,D===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:V}),info:W({},e,{value:E}),warn:W({},e,{value:N}),error:W({},e,{value:xe}),group:W({},e,{value:Ae}),groupCollapsed:W({},e,{value:Fe}),groupEnd:W({},e,{value:De})})}D<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var de=L.ReactCurrentDispatcher,ve;function Z(e,t,r){{if(ve===void 0)try{throw Error()}catch(y){var d=y.stack.trim().match(/\n( *(at )?)/);ve=d&&d[1]||""}return`
|
|
18
|
+
`+ve+e}}var he=!1,q;{var wt=typeof WeakMap=="function"?WeakMap:Map;q=new wt}function Ie(e,t){if(!e||he)return"";{var r=q.get(e);if(r!==void 0)return r}var d;he=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var m;m=de.current,de.current=null,Et();try{if(t){var p=function(){throw Error()};if(Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(I){d=I}Reflect.construct(e,[],p)}else{try{p.call()}catch(I){d=I}e.call(p.prototype)}}else{try{throw Error()}catch(I){d=I}e()}}catch(I){if(I&&d&&typeof I.stack=="string"){for(var h=I.stack.split(`
|
|
19
19
|
`),j=d.stack.split(`
|
|
20
20
|
`),O=h.length-1,T=j.length-1;O>=1&&T>=0&&h[O]!==j[T];)T--;for(;O>=1&&T>=0;O--,T--)if(h[O]!==j[T]){if(O!==1||T!==1)do if(O--,T--,T<0||h[O]!==j[T]){var A=`
|
|
21
|
-
`+h[O].replace(" at new "," at ");return e.displayName&&A.includes("<anonymous>")&&(A=A.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,A),A}while(O>=1&&T>=0);break}}}finally{he=!1,de.current=
|
|
21
|
+
`+h[O].replace(" at new "," at ");return e.displayName&&A.includes("<anonymous>")&&(A=A.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,A),A}while(O>=1&&T>=0);break}}}finally{he=!1,de.current=m,Tt(),Error.prepareStackTrace=y}var z=e?e.displayName||e.name:"",Xe=z?Z(z):"";return typeof e=="function"&&q.set(e,Xe),Xe}function St(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 b:return Z("Suspense");case k:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return St(e.render);case S:return $(e.type,t,r);case C:{var d=e,y=d._payload,m=d._init;try{return $(m(y),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 jt(e,t,r,d,y){{var m=Function.call.bind(ee);for(var p in e)if(m(e,p)){var h=void 0;try{if(typeof e[p]!="function"){var j=Error((d||"React class")+": "+r+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw j.name="Invariant Violation",j}h=e[p](t,p,d,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(O){h=O}h&&!(h instanceof Error)&&(te(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).",d||"React class",r,p,typeof h),te(null)),h instanceof Error&&!(h.message in Le)&&(Le[h.message]=!0,te(y),R("Failed %s type: %s",r,h.message),te(null))}}}var Pt=Array.isArray;function pe(e){return Pt(e)}function Ct(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,r=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r}}function xt(e){try{return We(e),!1}catch{return!0}}function We(e){return""+e}function Me(e){if(xt(e))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ct(e)),We(e)}var H=L.ReactCurrentOwner,At={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ve,_e;_e={};function Ft(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 Dt(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"&&H.current&&t&&H.current.stateNode!==t){var r=P(H.current.type);_e[r]||(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',P(H.current.type),e.ref),_e[r]=!0)}}function It(e,t){{var r=function(){Ye||(Ye=!0,R("%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 Lt(e,t){{var r=function(){Ve||(Ve=!0,R("%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 Ut=function(e,t,r,d,y,m,p){var h={$$typeof:o,type:e,key:t,ref:r,props:p,_owner:m};return h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(h,"_self",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.defineProperty(h,"_source",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h};function Wt(e,t,r,d,y){{var m,p={},h=null,j=null;r!==void 0&&(Me(r),h=""+r),Dt(t)&&(Me(t.key),h=""+t.key),Ft(t)&&(j=t.ref,Nt(t,y));for(m in t)ee.call(t,m)&&!At.hasOwnProperty(m)&&(p[m]=t[m]);if(e&&e.defaultProps){var O=e.defaultProps;for(m in O)p[m]===void 0&&(p[m]=O[m])}if(h||j){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;h&&It(p,T),j&&Lt(p,T)}return Ut(e,h,j,y,d,H.current,p)}}var ge=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 ye;ye=!1;function be(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function ze(){{if(ge.current){var e=P(ge.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function Mt(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 Yt(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 Je(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Yt(t);if(Ge[r])return;Ge[r]=!0;var d="";e&&e._owner&&e._owner!==ge.current&&(d=" It was passed a child from "+P(e._owner.type)+"."),B(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,d),B(null)}}function Ke(e,t){{if(typeof e!="object")return;if(pe(e))for(var r=0;r<e.length;r++){var d=e[r];be(d)&&Je(d,t)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var g=M(e);if(typeof g=="function"&&g!==e.entries)for(var k=g.call(e),p;!(p=k.next()).done;)be(p.value)&&Je(p.value,t)}}}function Vt(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===R))r=t.propTypes;else return;if(r){var d=P(t);jt(r,e.props,"prop",d,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var g=P(t);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",g||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Bt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var d=t[r];if(d!=="children"&&d!=="key"){B(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),B(null);break}}e.ref!==null&&(B(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function He(e,t,r,d,g,k){{var p=ue(e);if(!p){var h="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(h+=" 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 j=Mt(g);j?h+=j:h+=ze();var O;e===null?O="null":pe(e)?O="array":e!==void 0&&e.$$typeof===o?(O="<"+(P(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):O=typeof e,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",O,h)}var T=Wt(e,t,r,g,k);if(T==null)return T;if(p){var A=t.children;if(A!==void 0)if(d)if(pe(A)){for(var z=0;z<A.length;z++)Ke(A[z],e);Object.freeze&&Object.freeze(A)}else S("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 Ke(A,e)}return e===a?Bt(T):Vt(T),T}}function zt(e,t,r){return He(e,t,r,!0)}function Gt(e,t,r){return He(e,t,r,!1)}var Jt=Gt,Kt=zt;J.Fragment=a,J.jsx=Jt,J.jsxs=Kt}()),J}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=Ze();var c=ne.exports;const Oe="default",qe=(s,o)=>async(...n)=>await o().fetchWithTokens(s)(...n),$e=(s=null,o=Oe)=>n=>a=>{const{fetch:f}=Ee(s||a.fetch,o);return c.jsx(n,{...a,fetch:f})},Ee=(s=null,o=Oe)=>{const n=s||window.fetch,a=i.OidcClient.get;return{fetch:_.useCallback((u,y)=>qe(n,()=>a(o))(u,y),[n,o])}},Te=()=>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 f=a||{bubbles:!1,cancelable:!1,detail:void 0},u=o.createEvent("CustomEvent");return u.initCustomEvent(n,f.bubbles,f.cancelable,f.detail),u.prototype=s.Event.prototype,u},rt=(s,o,n)=>({replaceState:(a,f)=>{const u=n(),y=f||s.history.state;s.history.replaceState({key:u,state:y},null,a),s.dispatchEvent(o("popstate"))}}),st=()=>rt(window,nt(window,document),tt),we=()=>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[f,u]=_.useState(!1);_.useEffect(()=>{let v=!0;return(async()=>{const m=i.OidcClient.get;try{const{callbackPath:R}=await m(n).loginCallbackAsync();(a?a():st()).replaceState(R||"/")}catch(R){v&&(console.warn(R),u(!0))}})(),()=>{v=!1}},[]);const y=s||Te,l=o||we;return f?c.jsx(y,{configurationName:n}):c.jsx(l,{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})=>(_.useEffect(()=>{(async()=>{const n=i.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),c.jsx(c.Fragment,{})),ut=({configurationName:s})=>{const o=i.getParseQueryStringFromLocation(window.location.href),n=i.OidcClient.get,a=n(s);let f=null;for(const[u,y]of Object.entries(o))u==="state"||u==="scope"||(f===null&&(f={}),f[u]=y);return _.useEffect(()=>{a.tokens||a.loginAsync(null,f,!0,o.scope)},[]),c.jsx(c.Fragment,{})},ft=({callbackErrorComponent:s,callbackSuccessComponent:o,redirect_uri:n,silent_redirect_uri:a,silent_login_uri:f,children:u,configurationName:y,withCustomHistory:l=null,location:v})=>{const b=window?i.getPath(window.location.href):"",[m,R]=_.useState(b);_.useEffect(()=>{const x=()=>R(i.getPath(window.location.href));return x(),window.addEventListener("popstate",x,!1),()=>window.removeEventListener("popstate",x,!1)},[]);const C=i.getPath(n);if(a&&m===i.getPath(a))return c.jsx(lt,{configurationName:y});if(f&&m===i.getPath(f))return c.jsx(ut,{configurationName:y});switch(m){case C:return c.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:y,withCustomHistory:l});default:return c.jsx(c.Fragment,{children:u})}},dt=_.memo(ft),Re={name:"",data:null},vt=({loadingComponent:s,children:o,configurationName:n})=>{const[a,f]=_.useState(!0),u=i.OidcClient.get,y=u(n);_.useEffect(()=>{let v=!0;return y&&y.tryKeepExistingSessionAsync().then(()=>{v&&f(!1)}),()=>{v=!1}},[n]);const l=s;return c.jsx(c.Fragment,{children:a?c.jsx(l,{configurationName:n}):c.jsx(c.Fragment,{children:o})})},K=({isLoading:s,loadingComponent:o,children:n,configurationName:a})=>{const f=o;return s?c.jsx(f,{configurationName:a,children:n}):c.jsx(c.Fragment,{children:n})},ht=({children:s,configuration:o,configurationName:n="default",callbackSuccessComponent:a=we,authenticatingComponent:f=et,loadingComponent:u=at,serviceWorkerNotSupportedComponent:y=ct,authenticatingErrorComponent:l=Te,sessionLostComponent:v=it,onSessionLost:b=null,onLogoutFromAnotherTab:m=null,onLogoutFromSameTab:R=null,withCustomHistory:C=null,onEvent:x=null,getFetch:X=null,location:Q=null})=>{const M=(D="default")=>i.OidcClient.getOrCreate(X??i.getFetchDefault,Q??new i.OidcLocation)(o,D),[L,S]=_.useState(!0),[oe,Y]=_.useState(Re),[ae,ce]=_.useState("default");_.useEffect(()=>{const V=M(n).subscribeEvents((E,N)=>{x&&x(n,E,N)});return()=>{M(n).removeEventSubscription(V)}},[n,x]),_.useEffect(()=>{const V=M(n).subscribeEvents((E,N)=>{if(E===i.OidcClient.eventNames.refreshTokensAsync_error||E===i.OidcClient.eventNames.syncTokensAsync_error){if(b!=null){b();return}Y({name:E,data:N})}else if(E===i.OidcClient.eventNames.logout_from_another_tab){if(m!=null){m();return}Y({name:E,data:N})}else E===i.OidcClient.eventNames.logout_from_same_tab?R!=null&&R():E===i.OidcClient.eventNames.loginAsync_begin||E===i.OidcClient.eventNames.loginCallbackAsync_end||E===i.OidcClient.eventNames.loginAsync_error||E===i.OidcClient.eventNames.loginCallbackAsync_error?Y({name:E,data:N}):E===i.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&Y({name:E,data:N})});return ce(n),S(!1),()=>{M(n).removeEventSubscription(V),Y(Re)}},[o,n]);const ie=v,le=f,F=u,ue=y,fe=l,U=L||ae!==n,P=M(n);switch(oe.name){case i.OidcClient.eventNames.service_worker_not_supported_by_browser:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(ue,{configurationName:n})});case i.OidcClient.eventNames.loginAsync_begin:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(le,{configurationName:n})});case i.OidcClient.eventNames.loginAsync_error:case i.OidcClient.eventNames.loginCallbackAsync_error:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(fe,{configurationName:n})});case i.OidcClient.eventNames.refreshTokensAsync_error:case i.OidcClient.eventNames.syncTokensAsync_error:case i.OidcClient.eventNames.logout_from_another_tab:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(ie,{configurationName:n})});default:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(dt,{redirect_uri:P.configuration.redirect_uri,silent_redirect_uri:P.configuration.silent_redirect_uri,silent_login_uri:P.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:l,authenticatingComponent:f,configurationName:n,withCustomHistory:C,location:Q??new i.OidcLocation,children:c.jsx(vt,{loadingComponent:F,configurationName:n,children:s})})})}},Se=({children:s,callbackPath:o=null,extras:n=null,configurationName:a="default"})=>{const f=i.OidcClient.get,u=f(a);return _.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")=>f=>c.jsx(Se,{callbackPath:o,extras:n,configurationName:a,children:c.jsx(s,{...f})}),re="default",se=(s,o)=>{let n=!1;return s(o)&&(n=s(o).tokens!=null),n},_t=(s=re)=>{const o=i.OidcClient.get,[n,a]=_.useState(se(o,s));return _.useEffect(()=>{let l=!0;const v=o(s);a(se(o,s));const b=v.subscribeEvents((m,R)=>{(m===i.OidcClient.eventNames.logout_from_another_tab||m===i.OidcClient.eventNames.logout_from_same_tab||m===i.OidcClient.eventNames.token_aquired)&&l&&a(se(o,s))});return()=>{l=!1,v.removeEventSubscription(b)}},[s]),{login:(l=void 0,v=null,b=!1)=>o(s).loginAsync(l,v,!1,void 0,b),logout:(l=void 0,v=null)=>o(s).logoutAsync(l,v),renewTokens:async(l=null)=>{const v=await o(s).renewTokensAsync(l);return{accessToken:v.accessToken,accessTokenPayload:v.accessTokenPayload,idToken:v.idToken,idTokenPayload:v.idTokenPayload}},isAuthenticated:n}},je={accessToken:null,accessTokenPayload:null},gt=s=>{const o=i.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{accessToken:a.accessToken,accessTokenPayload:a.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:n.configuration.demonstrating_proof_of_possession?(f,u)=>n.generateDemonstrationOfProofOfPossessionAsync(a.accessToken,f,u):null}}return je};function yt(s,o){return s.configuration.demonstrating_proof_of_possession?(n,a)=>s.generateDemonstrationOfProofOfPossessionAsync(o.accessToken,n,a):null}const bt=(s=re)=>{const o=i.OidcClient.get,[n,a]=_.useState(gt(s));return _.useEffect(()=>{let f=!0;const u=o(s);if(u.tokens){const l=u.tokens;a({accessToken:l.accessToken,accessTokenPayload:l.accessTokenPayload})}const y=u.subscribeEvents((l,v)=>{if((l===i.OidcClient.eventNames.token_renewed||l===i.OidcClient.eventNames.token_aquired||l===i.OidcClient.eventNames.logout_from_another_tab||l===i.OidcClient.eventNames.logout_from_same_tab||l===i.OidcClient.eventNames.refreshTokensAsync_error||l===i.OidcClient.eventNames.syncTokensAsync_error)&&f){const b=u.tokens;a(b!=null?{accessToken:b.accessToken,accessTokenPayload:b.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:yt(u,b)}:je)}});return()=>{f=!1,u.removeEventSubscription(y)}},[s]),n},Pe={idToken:null,idTokenPayload:null},kt=s=>{const o=i.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{idToken:a.idToken,idTokenPayload:a.idTokenPayload}}return Pe},mt=(s=re)=>{const o=i.OidcClient.get,[n,a]=_.useState(kt(s));return _.useEffect(()=>{let f=!0;const u=o(s);if(u.tokens){const l=u.tokens;a({idToken:l.idToken,idTokenPayload:l.idTokenPayload})}const y=u.subscribeEvents((l,v)=>{if((l===i.OidcClient.eventNames.token_renewed||l===i.OidcClient.eventNames.token_aquired||l===i.OidcClient.eventNames.logout_from_another_tab||l===i.OidcClient.eventNames.logout_from_same_tab||l===i.OidcClient.eventNames.refreshTokensAsync_error||l===i.OidcClient.eventNames.syncTokensAsync_error)&&f){const b=u.tokens;a(b!=null?{idToken:b.idToken,idTokenPayload:b.idTokenPayload}:Pe)}});return()=>{f=!1,u.removeEventSubscription(y)}},[s]),n};var Ce=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Ce||{});const Ot=(s="default")=>{const[o,n]=_.useState({user:null,status:"Unauthenticated"}),[a,f]=_.useState(""),u=i.OidcClient.get(s);_.useEffect(()=>{let l=!0;if(u&&u.tokens){n({...o,status:"Loading user"});const v=a!=="";u.userInfoAsync(v).then(b=>{l&&n({user:b,status:"User loaded"})}).catch(()=>n({...o,status:"Error loading user"}))}else n({user:null,status:"Unauthenticated"});return()=>{l=!1}},[a]);const y=()=>{f(a+" ")};return{oidcUser:o.user,oidcUserLoadingState:o.status,reloadOidcUser:y}};Object.defineProperty(w,"OidcClient",{enumerable:!0,get:()=>i.OidcClient}),Object.defineProperty(w,"TokenRenewMode",{enumerable:!0,get:()=>i.TokenRenewMode}),w.OidcProvider=ht,w.OidcSecure=Se,w.OidcUserStatus=Ce,w.useOidc=_t,w.useOidcAccessToken=bt,w.useOidcFetch=Ee,w.useOidcIdToken=mt,w.useOidcUser=Ot,w.withOidcFetch=$e,w.withOidcSecure=pt,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
|
27
|
+
Check the top-level render call using <`+r+">.")}return t}}function Je(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Yt(t);if(Ge[r])return;Ge[r]=!0;var d="";e&&e._owner&&e._owner!==ge.current&&(d=" It was passed a child from "+P(e._owner.type)+"."),B(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.',r,d),B(null)}}function Ke(e,t){{if(typeof e!="object")return;if(pe(e))for(var r=0;r<e.length;r++){var d=e[r];be(d)&&Je(d,t)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var y=M(e);if(typeof y=="function"&&y!==e.entries)for(var m=y.call(e),p;!(p=m.next()).done;)be(p.value)&&Je(p.value,t)}}}function Vt(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===S))r=t.propTypes;else return;if(r){var d=P(t);jt(r,e.props,"prop",d,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var y=P(t);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Bt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var d=t[r];if(d!=="children"&&d!=="key"){B(e),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),B(null);break}}e.ref!==null&&(B(e),R("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function He(e,t,r,d,y,m){{var p=ue(e);if(!p){var h="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(h+=" 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 j=Mt(y);j?h+=j:h+=ze();var O;e===null?O="null":pe(e)?O="array":e!==void 0&&e.$$typeof===o?(O="<"+(P(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):O=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",O,h)}var T=Wt(e,t,r,y,m);if(T==null)return T;if(p){var A=t.children;if(A!==void 0)if(d)if(pe(A)){for(var z=0;z<A.length;z++)Ke(A[z],e);Object.freeze&&Object.freeze(A)}else R("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 Ke(A,e)}return e===a?Bt(T):Vt(T),T}}function zt(e,t,r){return He(e,t,r,!0)}function Gt(e,t,r){return He(e,t,r,!1)}var Jt=Gt,Kt=zt;J.Fragment=a,J.jsx=Jt,J.jsxs=Kt}()),J}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=Ze();var i=ne.exports;const Oe="default",qe=(s,o)=>async(...n)=>await o().fetchWithTokens(s)(...n),$e=(s=null,o=Oe)=>n=>a=>{const{fetch:u}=Ee(s||a.fetch,o);return i.jsx(n,{...a,fetch:u})},Ee=(s=null,o=Oe)=>{const n=s||window.fetch,a=c.OidcClient.get;return{fetch:g.useCallback((f,_)=>qe(n,()=>a(o))(f,_),[n,o])}},Te=()=>i.jsx("div",{className:"oidc-authenticating",children:i.jsxs("div",{className:"oidc-authenticating__container",children:[i.jsx("h1",{className:"oidc-authenticating__title",children:"Error authentication"}),i.jsx("p",{className:"oidc-authenticating__content",children:"An error occurred during authentication."})]})}),et=()=>i.jsx("div",{className:"oidc-authenticating",children:i.jsxs("div",{className:"oidc-authenticating__container",children:[i.jsx("h1",{className:"oidc-authenticating__title",children:"Authentication in progress"}),i.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 u=a||{bubbles:!1,cancelable:!1,detail:void 0},f=o.createEvent("CustomEvent");return f.initCustomEvent(n,u.bubbles,u.cancelable,u.detail),f.prototype=s.Event.prototype,f},rt=(s,o,n)=>({replaceState:(a,u)=>{const f=n(),_=u||s.history.state;s.history.replaceState({key:f,state:_},null,a),s.dispatchEvent(o("popstate"))}}),st=()=>rt(window,nt(window,document),tt),we=()=>i.jsx("div",{className:"oidc-callback",children:i.jsxs("div",{className:"oidc-callback__container",children:[i.jsx("h1",{className:"oidc-callback__title",children:"Authentication complete"}),i.jsx("p",{className:"oidc-callback__content",children:"You will be redirected to your application."})]})}),ot=({callBackError:s,callBackSuccess:o,configurationName:n,withCustomHistory:a})=>{const[u,f]=g.useState(!1);g.useEffect(()=>{let v=!0;return(async()=>{const k=c.OidcClient.get;try{const{callbackPath:S}=await k(n).loginCallbackAsync();(a?a():st()).replaceState(S||"/")}catch(S){v&&(console.warn(S),f(!0))}})(),()=>{v=!1}},[]);const _=s||Te,l=o||we;return u?i.jsx(_,{configurationName:n}):i.jsx(l,{configurationName:n})},at=()=>i.jsx("span",{className:"oidc-loading",children:"Loading"}),ct=()=>i.jsx("div",{className:"oidc-serviceworker",children:i.jsxs("div",{className:"oidc-serviceworker__container",children:[i.jsx("h1",{className:"oidc-serviceworker__title",children:"Unable to authenticate on this browser"}),i.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=()=>i.jsx("div",{className:"oidc-session-lost",children:i.jsxs("div",{className:"oidc-session-lost__container",children:[i.jsx("h1",{className:"oidc-session-lost__title",children:"Session timed out"}),i.jsx("p",{className:"oidc-session-lost__content",children:"Your session has expired. Please re-authenticate."})]})}),lt=({configurationName:s})=>(g.useEffect(()=>{(async()=>{const n=c.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),i.jsx(i.Fragment,{})),ut=({configurationName:s})=>{const o=c.getParseQueryStringFromLocation(window.location.href),n=c.OidcClient.get,a=n(s);let u=null;for(const[f,_]of Object.entries(o))f==="state"||f==="scope"||(u===null&&(u={}),u[f]=_);return g.useEffect(()=>{a.tokens||a.loginAsync(null,u,!0,o.scope)},[]),i.jsx(i.Fragment,{})},ft=({callbackErrorComponent:s,callbackSuccessComponent:o,redirect_uri:n,silent_redirect_uri:a,silent_login_uri:u,children:f,configurationName:_,withCustomHistory:l=null,location:v})=>{const b=window?c.getPath(window.location.href):"",[k,S]=g.useState(b);g.useEffect(()=>{const x=()=>S(c.getPath(window.location.href));return x(),window.addEventListener("popstate",x,!1),()=>window.removeEventListener("popstate",x,!1)},[]);const C=c.getPath(n);if(a&&k===c.getPath(a))return i.jsx(lt,{configurationName:_});if(u&&k===c.getPath(u))return i.jsx(ut,{configurationName:_});switch(k){case C:return i.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:_,withCustomHistory:l});default:return i.jsx(i.Fragment,{children:f})}},dt=g.memo(ft),Se={name:"",data:null},vt=({loadingComponent:s,children:o,configurationName:n})=>{const[a,u]=g.useState(!0),f=c.OidcClient.get,_=f(n);g.useEffect(()=>{let v=!0;return _&&_.tryKeepExistingSessionAsync().then(()=>{v&&u(!1)}),()=>{v=!1}},[n]);const l=s;return i.jsx(i.Fragment,{children:a?i.jsx(l,{configurationName:n}):i.jsx(i.Fragment,{children:o})})},K=({isLoading:s,loadingComponent:o,children:n,configurationName:a})=>{const u=o;return s?i.jsx(u,{configurationName:a,children:n}):i.jsx(i.Fragment,{children:n})},ht=({children:s,configuration:o,configurationName:n="default",callbackSuccessComponent:a=we,authenticatingComponent:u=et,loadingComponent:f=at,serviceWorkerNotSupportedComponent:_=ct,authenticatingErrorComponent:l=Te,sessionLostComponent:v=it,onSessionLost:b=null,onLogoutFromAnotherTab:k=null,onLogoutFromSameTab:S=null,withCustomHistory:C=null,onEvent:x=null,getFetch:X=null,location:Q=null})=>{const M=(D="default")=>c.OidcClient.getOrCreate(X??c.getFetchDefault,Q??new c.OidcLocation)(o,D),[L,R]=g.useState(!0),[oe,Y]=g.useState(Se),[ae,ce]=g.useState("default");g.useEffect(()=>{const V=M(n).subscribeEvents((E,N)=>{x&&x(n,E,N)});return()=>{M(n).removeEventSubscription(V)}},[n,x]),g.useEffect(()=>{const V=M(n).subscribeEvents((E,N)=>{if(E===c.OidcClient.eventNames.refreshTokensAsync_error||E===c.OidcClient.eventNames.syncTokensAsync_error){if(b!=null){b();return}Y({name:E,data:N})}else if(E===c.OidcClient.eventNames.logout_from_another_tab){if(k!=null){k();return}Y({name:E,data:N})}else E===c.OidcClient.eventNames.logout_from_same_tab?S!=null&&S():E===c.OidcClient.eventNames.loginAsync_begin||E===c.OidcClient.eventNames.loginCallbackAsync_end||E===c.OidcClient.eventNames.loginAsync_error||E===c.OidcClient.eventNames.loginCallbackAsync_error?Y({name:E,data:N}):E===c.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&Y({name:E,data:N})});return ce(n),R(!1),()=>{M(n).removeEventSubscription(V),Y(Se)}},[o,n]);const ie=v,le=u,F=f,ue=_,fe=l,U=L||ae!==n,P=M(n);switch(oe.name){case c.OidcClient.eventNames.service_worker_not_supported_by_browser:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(ue,{configurationName:n})});case c.OidcClient.eventNames.loginAsync_begin:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(le,{configurationName:n})});case c.OidcClient.eventNames.loginAsync_error:case c.OidcClient.eventNames.loginCallbackAsync_error:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(fe,{configurationName:n})});case c.OidcClient.eventNames.refreshTokensAsync_error:case c.OidcClient.eventNames.syncTokensAsync_error:case c.OidcClient.eventNames.logout_from_another_tab:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(ie,{configurationName:n})});default:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(dt,{redirect_uri:P.configuration.redirect_uri,silent_redirect_uri:P.configuration.silent_redirect_uri,silent_login_uri:P.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:l,authenticatingComponent:u,configurationName:n,withCustomHistory:C,location:Q??new c.OidcLocation,children:i.jsx(vt,{loadingComponent:F,configurationName:n,children:s})})})}},Re=({children:s,callbackPath:o=null,extras:n=null,configurationName:a="default"})=>{const u=c.OidcClient.get,f=u(a);return g.useEffect(()=>{f.tokens||f.loginAsync(o,n)},[a,o,n]),f.tokens?i.jsx(i.Fragment,{children:s}):null},pt=(s,o=null,n=null,a="default")=>u=>i.jsx(Re,{callbackPath:o,extras:n,configurationName:a,children:i.jsx(s,{...u})}),re="default",se=(s,o)=>{let n=!1;return s(o)&&(n=s(o).tokens!=null),n},_t=(s=re)=>{const o=c.OidcClient.get,[n,a]=g.useState(se(o,s));return g.useEffect(()=>{let l=!0;const v=o(s);a(se(o,s));const b=v.subscribeEvents((k,S)=>{(k===c.OidcClient.eventNames.logout_from_another_tab||k===c.OidcClient.eventNames.logout_from_same_tab||k===c.OidcClient.eventNames.token_aquired)&&l&&a(se(o,s))});return()=>{l=!1,v.removeEventSubscription(b)}},[s]),{login:(l=void 0,v=null,b=!1)=>o(s).loginAsync(l,v,!1,void 0,b),logout:(l=void 0,v=null)=>o(s).logoutAsync(l,v),renewTokens:async(l=null)=>{const v=await o(s).renewTokensAsync(l);return{accessToken:v.accessToken,accessTokenPayload:v.accessTokenPayload,idToken:v.idToken,idTokenPayload:v.idTokenPayload}},isAuthenticated:n}},je={accessToken:null,accessTokenPayload:null},gt=s=>{const o=c.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{accessToken:a.accessToken,accessTokenPayload:a.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:n.configuration.demonstrating_proof_of_possession?(u,f)=>n.generateDemonstrationOfProofOfPossessionAsync(a.accessToken,u,f):null}}return je};function yt(s,o){return s.configuration.demonstrating_proof_of_possession?(n,a)=>s.generateDemonstrationOfProofOfPossessionAsync(o.accessToken,n,a):null}const bt=(s=re)=>{const o=c.OidcClient.get,[n,a]=g.useState(gt(s));return g.useEffect(()=>{let u=!0;const f=o(s);if(f.tokens){const l=f.tokens;a({accessToken:l.accessToken,accessTokenPayload:l.accessTokenPayload})}const _=f.subscribeEvents((l,v)=>{if((l===c.OidcClient.eventNames.token_renewed||l===c.OidcClient.eventNames.token_aquired||l===c.OidcClient.eventNames.logout_from_another_tab||l===c.OidcClient.eventNames.logout_from_same_tab||l===c.OidcClient.eventNames.refreshTokensAsync_error||l===c.OidcClient.eventNames.syncTokensAsync_error)&&u){const b=f.tokens;a(b!=null?{accessToken:b.accessToken,accessTokenPayload:b.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:yt(f,b)}:je)}});return()=>{u=!1,f.removeEventSubscription(_)}},[s]),n},Pe={idToken:null,idTokenPayload:null},kt=s=>{const o=c.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{idToken:a.idToken,idTokenPayload:a.idTokenPayload}}return Pe},mt=(s=re)=>{const o=c.OidcClient.get,[n,a]=g.useState(kt(s));return g.useEffect(()=>{let u=!0;const f=o(s);if(f.tokens){const l=f.tokens;a({idToken:l.idToken,idTokenPayload:l.idTokenPayload})}const _=f.subscribeEvents((l,v)=>{if((l===c.OidcClient.eventNames.token_renewed||l===c.OidcClient.eventNames.token_aquired||l===c.OidcClient.eventNames.logout_from_another_tab||l===c.OidcClient.eventNames.logout_from_same_tab||l===c.OidcClient.eventNames.refreshTokensAsync_error||l===c.OidcClient.eventNames.syncTokensAsync_error)&&u){const b=f.tokens;a(b!=null?{idToken:b.idToken,idTokenPayload:b.idTokenPayload}:Pe)}});return()=>{u=!1,f.removeEventSubscription(_)}},[s]),n};var Ce=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Ce||{});const Ot=(s="default")=>{const[o,n]=g.useState({user:null,status:"Unauthenticated"}),[a,u]=g.useState("");g.useEffect(()=>{const _=c.OidcClient.get(s);let l=!0;if(_&&_.tokens){n({...o,status:"Loading user"});const b=a!=="";_.userInfoAsync(b).then(k=>{l&&n({user:k,status:"User loaded"})}).catch(()=>n({...o,status:"Error loading user"}))}else n({user:null,status:"Unauthenticated"});const v=_.subscribeEvents((b,k)=>{(b===c.OidcClient.eventNames.logout_from_another_tab||b===c.OidcClient.eventNames.logout_from_same_tab)&&l&&n({user:null,status:"Unauthenticated"})});return()=>{l=!1,_.removeEventSubscription(v)}},[a]);const f=()=>{u(a+" ")};return{oidcUser:o.user,oidcUserLoadingState:o.status,reloadOidcUser:f}};Object.defineProperty(w,"OidcClient",{enumerable:!0,get:()=>c.OidcClient}),Object.defineProperty(w,"TokenRenewMode",{enumerable:!0,get:()=>c.TokenRenewMode}),w.OidcProvider=ht,w.OidcSecure=Re,w.OidcUserStatus=Ce,w.useOidc=_t,w.useOidcAccessToken=bt,w.useOidcFetch=Ee,w.useOidcIdToken=mt,w.useOidcUser=Ot,w.withOidcFetch=$e,w.withOidcSecure=pt,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/react-oidc",
|
|
3
|
-
"version": "7.18.
|
|
3
|
+
"version": "7.18.2",
|
|
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.18.
|
|
44
|
-
"@axa-fr/oidc-client": "7.18.
|
|
43
|
+
"@axa-fr/oidc-client-service-worker": "7.18.2",
|
|
44
|
+
"@axa-fr/oidc-client": "7.18.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^17.0.0 || ^18.0.0"
|
package/src/User.ts
CHANGED
|
@@ -17,8 +17,9 @@ export const useOidcUser = <T extends OidcUserInfo = OidcUserInfo>(configuration
|
|
|
17
17
|
const [oidcUser, setOidcUser] = useState<OidcUser<T>>({ user: null, status: OidcUserStatus.Unauthenticated });
|
|
18
18
|
const [oidcUserId, setOidcUserId] = useState<string>('');
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
useEffect(() => {
|
|
22
|
+
const oidc = OidcClient.get(configurationName);
|
|
22
23
|
let isMounted = true;
|
|
23
24
|
if (oidc && oidc.tokens) {
|
|
24
25
|
setOidcUser({ ...oidcUser, status: OidcUserStatus.Loading });
|
|
@@ -34,7 +35,18 @@ export const useOidcUser = <T extends OidcUserInfo = OidcUserInfo>(configuration
|
|
|
34
35
|
} else {
|
|
35
36
|
setOidcUser({ user: null, status: OidcUserStatus.Unauthenticated });
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39
|
+
const newSubscriptionId = oidc.subscribeEvents((name: string, data: any) => {
|
|
40
|
+
if (name === OidcClient.eventNames.logout_from_another_tab || name === OidcClient.eventNames.logout_from_same_tab) {
|
|
41
|
+
if (isMounted) {
|
|
42
|
+
setOidcUser({ user: null, status: OidcUserStatus.Unauthenticated });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return () => {
|
|
47
|
+
isMounted = false;
|
|
48
|
+
oidc.removeEventSubscription(newSubscriptionId);
|
|
49
|
+
};
|
|
38
50
|
}, [oidcUserId]);
|
|
39
51
|
|
|
40
52
|
const reloadOidcUser = () => {
|