@axa-fr/react-oidc 7.13.14 → 7.13.15
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/FetchToken.d.ts.map +1 -1
- package/dist/index.js +73 -76
- package/dist/index.umd.cjs +6 -6
- package/package.json +3 -3
- package/src/FetchToken.tsx +0 -1
package/dist/FetchToken.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchToken.d.ts","sourceRoot":"","sources":["../src/FetchToken.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAUD,eAAO,MAAM,aAAa,WAAW,KAAK,oEAE7B,2BAA2B,4CAGvC,CAAC;AAEF,eAAO,MAAM,YAAY,WAAW,KAAK;mBAK7B,WAAW,GAAG,GAAG,SAAS,WAAW;
|
|
1
|
+
{"version":3,"file":"FetchToken.d.ts","sourceRoot":"","sources":["../src/FetchToken.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAUD,eAAO,MAAM,aAAa,WAAW,KAAK,oEAE7B,2BAA2B,4CAGvC,CAAC;AAEF,eAAO,MAAM,YAAY,WAAW,KAAK;mBAK7B,WAAW,GAAG,GAAG,SAAS,WAAW;CAQhD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,12 +16,12 @@ function wt() {
|
|
|
16
16
|
if (Me)
|
|
17
17
|
return J;
|
|
18
18
|
Me = 1;
|
|
19
|
-
var o = ke, s = Symbol.for("react.element"), r = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, d = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
19
|
+
var o = ke, s = Symbol.for("react.element"), r = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, d = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, u = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
20
|
function g(c, v, b) {
|
|
21
21
|
var k, w = {}, j = null, O = null;
|
|
22
22
|
b !== void 0 && (j = "" + b), v.key !== void 0 && (j = "" + v.key), v.ref !== void 0 && (O = v.ref);
|
|
23
23
|
for (k in v)
|
|
24
|
-
a.call(v, k) && !
|
|
24
|
+
a.call(v, k) && !u.hasOwnProperty(k) && (w[k] = v[k]);
|
|
25
25
|
if (c && c.defaultProps)
|
|
26
26
|
for (k in v = c.defaultProps, v)
|
|
27
27
|
w[k] === void 0 && (w[k] = v[k]);
|
|
@@ -42,7 +42,7 @@ var G = {};
|
|
|
42
42
|
var Ve;
|
|
43
43
|
function Ct() {
|
|
44
44
|
return Ve || (Ve = 1, process.env.NODE_ENV !== "production" && function() {
|
|
45
|
-
var o = ke, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"),
|
|
45
|
+
var o = ke, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), c = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), k = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), O = 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;
|
|
@@ -52,14 +52,14 @@ function Ct() {
|
|
|
52
52
|
var L = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
53
53
|
function C(e) {
|
|
54
54
|
{
|
|
55
|
-
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0),
|
|
56
|
-
n[
|
|
55
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), l = 1; l < t; l++)
|
|
56
|
+
n[l - 1] = arguments[l];
|
|
57
57
|
ne("error", e, n);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function ne(e, t, n) {
|
|
61
61
|
{
|
|
62
|
-
var
|
|
62
|
+
var l = L.ReactDebugCurrentFrame, _ = l.getStackAddendum();
|
|
63
63
|
_ !== "" && (t += "%s", n = n.concat([_]));
|
|
64
64
|
var y = n.map(function(p) {
|
|
65
65
|
return String(p);
|
|
@@ -70,16 +70,16 @@ function Ct() {
|
|
|
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 === d || e === b || e === k || ae || e === O || $ || oe || se || typeof e == "object" && e !== null && (e.$$typeof === j || e.$$typeof === w || e.$$typeof === g || 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.
|
|
77
77
|
e.$$typeof === F || e.getModuleId !== void 0));
|
|
78
78
|
}
|
|
79
79
|
function le(e, t, n) {
|
|
80
|
-
var
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
80
|
+
var l = e.displayName;
|
|
81
|
+
if (l)
|
|
82
|
+
return l;
|
|
83
83
|
var _ = t.displayName || t.name || "";
|
|
84
84
|
return _ !== "" ? n + "(" + _ + ")" : n;
|
|
85
85
|
}
|
|
@@ -98,7 +98,7 @@ function Ct() {
|
|
|
98
98
|
return "Fragment";
|
|
99
99
|
case r:
|
|
100
100
|
return "Portal";
|
|
101
|
-
case
|
|
101
|
+
case u:
|
|
102
102
|
return "Profiler";
|
|
103
103
|
case d:
|
|
104
104
|
return "StrictMode";
|
|
@@ -118,8 +118,8 @@ function Ct() {
|
|
|
118
118
|
case v:
|
|
119
119
|
return le(e, e.render, "ForwardRef");
|
|
120
120
|
case w:
|
|
121
|
-
var
|
|
122
|
-
return
|
|
121
|
+
var l = e.displayName || null;
|
|
122
|
+
return l !== null ? l : x(e.type) || "Memo";
|
|
123
123
|
case j: {
|
|
124
124
|
var _ = e, y = _._payload, p = _._init;
|
|
125
125
|
try {
|
|
@@ -200,8 +200,8 @@ function Ct() {
|
|
|
200
200
|
try {
|
|
201
201
|
throw Error();
|
|
202
202
|
} catch (_) {
|
|
203
|
-
var
|
|
204
|
-
de =
|
|
203
|
+
var l = _.stack.trim().match(/\n( *(at )?)/);
|
|
204
|
+
de = l && l[1] || "";
|
|
205
205
|
}
|
|
206
206
|
return `
|
|
207
207
|
` + de + e;
|
|
@@ -220,7 +220,7 @@ function Ct() {
|
|
|
220
220
|
if (n !== void 0)
|
|
221
221
|
return n;
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var l;
|
|
224
224
|
fe = !0;
|
|
225
225
|
var _ = Error.prepareStackTrace;
|
|
226
226
|
Error.prepareStackTrace = void 0;
|
|
@@ -239,14 +239,14 @@ function Ct() {
|
|
|
239
239
|
try {
|
|
240
240
|
Reflect.construct(p, []);
|
|
241
241
|
} catch (D) {
|
|
242
|
-
|
|
242
|
+
l = D;
|
|
243
243
|
}
|
|
244
244
|
Reflect.construct(e, [], p);
|
|
245
245
|
} else {
|
|
246
246
|
try {
|
|
247
247
|
p.call();
|
|
248
248
|
} catch (D) {
|
|
249
|
-
|
|
249
|
+
l = D;
|
|
250
250
|
}
|
|
251
251
|
e.call(p.prototype);
|
|
252
252
|
}
|
|
@@ -254,14 +254,14 @@ function Ct() {
|
|
|
254
254
|
try {
|
|
255
255
|
throw Error();
|
|
256
256
|
} catch (D) {
|
|
257
|
-
|
|
257
|
+
l = D;
|
|
258
258
|
}
|
|
259
259
|
e();
|
|
260
260
|
}
|
|
261
261
|
} catch (D) {
|
|
262
|
-
if (D &&
|
|
262
|
+
if (D && l && typeof D.stack == "string") {
|
|
263
263
|
for (var h = D.stack.split(`
|
|
264
|
-
`), R =
|
|
264
|
+
`), R = l.stack.split(`
|
|
265
265
|
`), m = h.length - 1, T = R.length - 1; m >= 1 && T >= 0 && h[m] !== R[T]; )
|
|
266
266
|
T--;
|
|
267
267
|
for (; m >= 1 && T >= 0; m--, T--)
|
|
@@ -310,7 +310,7 @@ function Ct() {
|
|
|
310
310
|
case w:
|
|
311
311
|
return ee(e.type, t, n);
|
|
312
312
|
case j: {
|
|
313
|
-
var
|
|
313
|
+
var l = e, _ = l._payload, y = l._init;
|
|
314
314
|
try {
|
|
315
315
|
return ee(y(_), t, n);
|
|
316
316
|
} catch {
|
|
@@ -327,7 +327,7 @@ function Ct() {
|
|
|
327
327
|
} else
|
|
328
328
|
Oe.setExtraStackFrame(null);
|
|
329
329
|
}
|
|
330
|
-
function tt(e, t, n,
|
|
330
|
+
function tt(e, t, n, l, _) {
|
|
331
331
|
{
|
|
332
332
|
var y = Function.call.bind(te);
|
|
333
333
|
for (var p in e)
|
|
@@ -335,14 +335,14 @@ function Ct() {
|
|
|
335
335
|
var h = void 0;
|
|
336
336
|
try {
|
|
337
337
|
if (typeof e[p] != "function") {
|
|
338
|
-
var R = Error((
|
|
338
|
+
var R = Error((l || "React class") + ": " + n + " 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`.");
|
|
339
339
|
throw R.name = "Invariant Violation", R;
|
|
340
340
|
}
|
|
341
|
-
h = e[p](t, p,
|
|
341
|
+
h = e[p](t, p, l, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
342
342
|
} catch (m) {
|
|
343
343
|
h = m;
|
|
344
344
|
}
|
|
345
|
-
h && !(h instanceof Error) && (re(_), C("%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
|
+
h && !(h instanceof Error) && (re(_), C("%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).", l || "React class", n, p, typeof h), re(null)), h instanceof Error && !(h.message in je) && (je[h.message] = !0, re(_), C("Failed %s type: %s", n, h.message), re(null));
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
@@ -421,7 +421,7 @@ function Ct() {
|
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
var dt = function(e, t, n,
|
|
424
|
+
var dt = function(e, t, n, l, _, y, p) {
|
|
425
425
|
var h = {
|
|
426
426
|
// This tag allows us to uniquely identify this as a React Element
|
|
427
427
|
$$typeof: s,
|
|
@@ -442,7 +442,7 @@ function Ct() {
|
|
|
442
442
|
configurable: !1,
|
|
443
443
|
enumerable: !1,
|
|
444
444
|
writable: !1,
|
|
445
|
-
value:
|
|
445
|
+
value: l
|
|
446
446
|
}), Object.defineProperty(h, "_source", {
|
|
447
447
|
configurable: !1,
|
|
448
448
|
enumerable: !1,
|
|
@@ -450,7 +450,7 @@ function Ct() {
|
|
|
450
450
|
value: _
|
|
451
451
|
}), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
|
|
452
452
|
};
|
|
453
|
-
function ft(e, t, n,
|
|
453
|
+
function ft(e, t, n, l, _) {
|
|
454
454
|
{
|
|
455
455
|
var y, p = {}, h = null, R = null;
|
|
456
456
|
n !== void 0 && (Pe(n), h = "" + n), it(t) && (Pe(t.key), h = "" + t.key), at(t) && (R = t.ref, ct(t, _));
|
|
@@ -465,7 +465,7 @@ function Ct() {
|
|
|
465
465
|
var T = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
466
466
|
h && lt(p, T), R && ut(p, T);
|
|
467
467
|
}
|
|
468
|
-
return dt(e, h, R, _,
|
|
468
|
+
return dt(e, h, R, _, l, B.current, p);
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
var pe = L.ReactCurrentOwner, Ne = L.ReactDebugCurrentFrame;
|
|
@@ -526,8 +526,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
526
526
|
if (De[n])
|
|
527
527
|
return;
|
|
528
528
|
De[n] = !0;
|
|
529
|
-
var
|
|
530
|
-
e && e._owner && e._owner !== pe.current && (
|
|
529
|
+
var l = "";
|
|
530
|
+
e && e._owner && e._owner !== pe.current && (l = " It was passed a child from " + x(e._owner.type) + "."), V(e), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, l), 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 (ve(e))
|
|
538
538
|
for (var n = 0; n < e.length; n++) {
|
|
539
|
-
var
|
|
540
|
-
ge(
|
|
539
|
+
var l = e[n];
|
|
540
|
+
ge(l) && Le(l, t);
|
|
541
541
|
}
|
|
542
542
|
else if (ge(e))
|
|
543
543
|
e._store && (e._store.validated = !0);
|
|
@@ -564,8 +564,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
564
564
|
else
|
|
565
565
|
return;
|
|
566
566
|
if (n) {
|
|
567
|
-
var
|
|
568
|
-
tt(n, e.props, "prop",
|
|
567
|
+
var l = x(t);
|
|
568
|
+
tt(n, e.props, "prop", l, e);
|
|
569
569
|
} else if (t.PropTypes !== void 0 && !_e) {
|
|
570
570
|
_e = !0;
|
|
571
571
|
var _ = x(t);
|
|
@@ -577,16 +577,16 @@ Check the top-level render call using <` + n + ">.");
|
|
|
577
577
|
function _t(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), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
580
|
+
var l = t[n];
|
|
581
|
+
if (l !== "children" && l !== "key") {
|
|
582
|
+
V(e), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", l), V(null);
|
|
583
583
|
break;
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
e.ref !== null && (V(e), C("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
function Ue(e, t, n,
|
|
589
|
+
function Ue(e, t, n, l, _, y) {
|
|
590
590
|
{
|
|
591
591
|
var p = ce(e);
|
|
592
592
|
if (!p) {
|
|
@@ -603,7 +603,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
603
603
|
if (p) {
|
|
604
604
|
var S = t.children;
|
|
605
605
|
if (S !== void 0)
|
|
606
|
-
if (
|
|
606
|
+
if (l)
|
|
607
607
|
if (ve(S)) {
|
|
608
608
|
for (var q = 0; q < S.length; q++)
|
|
609
609
|
We(S[q], e);
|
|
@@ -634,10 +634,7 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
634
634
|
}, xt = (o = null, s = Be) => {
|
|
635
635
|
const r = o || window.fetch, a = f.get;
|
|
636
636
|
return { fetch: mt(
|
|
637
|
-
(
|
|
638
|
-
const v = Rt(r, () => a(s));
|
|
639
|
-
return console.log("newFetch", l), v(l, g);
|
|
640
|
-
},
|
|
637
|
+
(u, g) => Rt(r, () => a(s))(u, g),
|
|
641
638
|
[r, s]
|
|
642
639
|
) };
|
|
643
640
|
}, ze = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-authenticating__container", children: [
|
|
@@ -649,18 +646,18 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
649
646
|
] }) }), Ot = () => Math.random().toString(36).substr(2, 6), St = (o, s) => (r, a) => {
|
|
650
647
|
if (typeof o.CustomEvent == "function")
|
|
651
648
|
return new o.CustomEvent(r, a);
|
|
652
|
-
const d = a || { bubbles: !1, cancelable: !1, detail: void 0 },
|
|
653
|
-
return
|
|
649
|
+
const d = a || { bubbles: !1, cancelable: !1, detail: void 0 }, u = s.createEvent("CustomEvent");
|
|
650
|
+
return u.initCustomEvent(r, d.bubbles, d.cancelable, d.detail), u.prototype = o.Event.prototype, u;
|
|
654
651
|
}, Pt = (o, s, r) => ({
|
|
655
652
|
replaceState: (a, d) => {
|
|
656
|
-
const
|
|
657
|
-
o.history.replaceState({ key:
|
|
653
|
+
const u = r(), g = d || o.history.state;
|
|
654
|
+
o.history.replaceState({ key: u, state: g }, null, a), o.dispatchEvent(s("popstate"));
|
|
658
655
|
}
|
|
659
656
|
}), At = () => Pt(window, St(window, document), Ot), Je = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-callback", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-callback__container", children: [
|
|
660
657
|
/* @__PURE__ */ i.jsx("h1", { className: "oidc-callback__title", children: "Authentication complete" }),
|
|
661
658
|
/* @__PURE__ */ i.jsx("p", { className: "oidc-callback__content", children: "You will be redirected to your application." })
|
|
662
659
|
] }) }), Ft = ({ callBackError: o, callBackSuccess: s, configurationName: r, withCustomHistory: a }) => {
|
|
663
|
-
const [d,
|
|
660
|
+
const [d, u] = A(!1);
|
|
664
661
|
P(() => {
|
|
665
662
|
let v = !0;
|
|
666
663
|
return (async () => {
|
|
@@ -669,7 +666,7 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
669
666
|
const { callbackPath: w } = await k(r).loginCallbackAsync();
|
|
670
667
|
(a ? a() : At()).replaceState(w || "/");
|
|
671
668
|
} catch (w) {
|
|
672
|
-
v && (console.warn(w),
|
|
669
|
+
v && (console.warn(w), u(!0));
|
|
673
670
|
}
|
|
674
671
|
})(), () => {
|
|
675
672
|
v = !1;
|
|
@@ -691,8 +688,8 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
691
688
|
}, []), /* @__PURE__ */ i.jsx(i.Fragment, {})), Wt = ({ configurationName: o }) => {
|
|
692
689
|
const s = Et(window.location.href), r = f.get, a = r(o);
|
|
693
690
|
let d = null;
|
|
694
|
-
for (const [
|
|
695
|
-
|
|
691
|
+
for (const [u, g] of Object.entries(s))
|
|
692
|
+
u === "state" || u === "scope" || (d === null && (d = {}), d[u] = g);
|
|
696
693
|
return P(() => {
|
|
697
694
|
a.tokens || a.loginAsync(null, d, !0, s.scope);
|
|
698
695
|
}, []), /* @__PURE__ */ i.jsx(i.Fragment, {});
|
|
@@ -702,7 +699,7 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
702
699
|
redirect_uri: r,
|
|
703
700
|
silent_redirect_uri: a,
|
|
704
701
|
silent_login_uri: d,
|
|
705
|
-
children:
|
|
702
|
+
children: u,
|
|
706
703
|
configurationName: g,
|
|
707
704
|
withCustomHistory: c = null,
|
|
708
705
|
location: v
|
|
@@ -721,10 +718,10 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
721
718
|
case j:
|
|
722
719
|
return /* @__PURE__ */ i.jsx(Ft, { callBackError: o, callBackSuccess: s, configurationName: g, withCustomHistory: c });
|
|
723
720
|
default:
|
|
724
|
-
return /* @__PURE__ */ i.jsx(i.Fragment, { children:
|
|
721
|
+
return /* @__PURE__ */ i.jsx(i.Fragment, { children: u });
|
|
725
722
|
}
|
|
726
723
|
}, Yt = ke.memo(Ut), qe = { name: "", data: null }, $t = ({ loadingComponent: o, children: s, configurationName: r }) => {
|
|
727
|
-
const [a, d] = A(!0),
|
|
724
|
+
const [a, d] = A(!0), u = f.get, g = u(r);
|
|
728
725
|
P(() => {
|
|
729
726
|
let v = !0;
|
|
730
727
|
return g && g.tryKeepExistingSessionAsync().then(() => {
|
|
@@ -744,7 +741,7 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
744
741
|
configurationName: r = "default",
|
|
745
742
|
callbackSuccessComponent: a = Je,
|
|
746
743
|
authenticatingComponent: d = jt,
|
|
747
|
-
loadingComponent:
|
|
744
|
+
loadingComponent: u = Nt,
|
|
748
745
|
serviceWorkerNotSupportedComponent: g = It,
|
|
749
746
|
authenticatingErrorComponent: c = ze,
|
|
750
747
|
sessionLostComponent: v = Dt,
|
|
@@ -785,7 +782,7 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
785
782
|
Y(r).removeEventSubscription(M), $(qe);
|
|
786
783
|
};
|
|
787
784
|
}, [s, r]);
|
|
788
|
-
const ae = v, ie = d, F =
|
|
785
|
+
const ae = v, ie = d, F = u, ce = g, le = c, W = L || oe !== r, x = Y(r);
|
|
789
786
|
switch (ne.name) {
|
|
790
787
|
case f.eventNames.service_worker_not_supported_by_browser:
|
|
791
788
|
return /* @__PURE__ */ i.jsx(K, { loadingComponent: F, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(ce, { configurationName: r }) });
|
|
@@ -816,10 +813,10 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
816
813
|
) });
|
|
817
814
|
}
|
|
818
815
|
}, Mt = ({ children: o, callbackPath: s = null, extras: r = null, configurationName: a = "default" }) => {
|
|
819
|
-
const d = f.get,
|
|
816
|
+
const d = f.get, u = d(a);
|
|
820
817
|
return P(() => {
|
|
821
|
-
|
|
822
|
-
}, [a, s, r]),
|
|
818
|
+
u.tokens || u.loginAsync(s, r);
|
|
819
|
+
}, [a, s, r]), u.tokens ? /* @__PURE__ */ i.jsx(i.Fragment, { children: o }) : null;
|
|
823
820
|
}, Ht = (o, s = null, r = null, a = "default") => (d) => /* @__PURE__ */ i.jsx(Mt, { callbackPath: s, extras: r, configurationName: a, children: /* @__PURE__ */ i.jsx(o, { ...d }) }), me = "default", ye = (o, s) => {
|
|
824
821
|
let r = !1;
|
|
825
822
|
return o(s) && (r = o(s).tokens != null), r;
|
|
@@ -862,19 +859,19 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
862
859
|
const s = f.get, [r, a] = A(Vt(o));
|
|
863
860
|
return P(() => {
|
|
864
861
|
let d = !0;
|
|
865
|
-
const
|
|
866
|
-
if (
|
|
867
|
-
const c =
|
|
862
|
+
const u = s(o);
|
|
863
|
+
if (u.tokens) {
|
|
864
|
+
const c = u.tokens;
|
|
868
865
|
a({ accessToken: c.accessToken, accessTokenPayload: c.accessTokenPayload });
|
|
869
866
|
}
|
|
870
|
-
const g =
|
|
867
|
+
const g = u.subscribeEvents((c, v) => {
|
|
871
868
|
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) && d) {
|
|
872
|
-
const b =
|
|
869
|
+
const b = u.tokens;
|
|
873
870
|
a(b != null ? { accessToken: b.accessToken, accessTokenPayload: b.accessTokenPayload } : Ge);
|
|
874
871
|
}
|
|
875
872
|
});
|
|
876
873
|
return () => {
|
|
877
|
-
d = !1,
|
|
874
|
+
d = !1, u.removeEventSubscription(g);
|
|
878
875
|
};
|
|
879
876
|
}, [o]), r;
|
|
880
877
|
}, Ke = { idToken: null, idTokenPayload: null }, qt = (o) => {
|
|
@@ -888,19 +885,19 @@ const Be = "default", Rt = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
888
885
|
const s = f.get, [r, a] = A(qt(o));
|
|
889
886
|
return P(() => {
|
|
890
887
|
let d = !0;
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
const c =
|
|
888
|
+
const u = s(o);
|
|
889
|
+
if (u.tokens) {
|
|
890
|
+
const c = u.tokens;
|
|
894
891
|
a({ idToken: c.idToken, idTokenPayload: c.idTokenPayload });
|
|
895
892
|
}
|
|
896
|
-
const g =
|
|
893
|
+
const g = u.subscribeEvents((c, v) => {
|
|
897
894
|
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) && d) {
|
|
898
|
-
const b =
|
|
895
|
+
const b = u.tokens;
|
|
899
896
|
a(b != null ? { idToken: b.idToken, idTokenPayload: b.idTokenPayload } : Ke);
|
|
900
897
|
}
|
|
901
898
|
});
|
|
902
899
|
return () => {
|
|
903
|
-
d = !1,
|
|
900
|
+
d = !1, u.removeEventSubscription(g);
|
|
904
901
|
};
|
|
905
902
|
}, [o]), r;
|
|
906
903
|
};
|
|
@@ -910,17 +907,17 @@ const er = (o = "default") => {
|
|
|
910
907
|
user: null,
|
|
911
908
|
status: "Unauthenticated"
|
|
912
909
|
/* Unauthenticated */
|
|
913
|
-
}), [a, d] = A(""),
|
|
910
|
+
}), [a, d] = A(""), u = f.get(o);
|
|
914
911
|
P(() => {
|
|
915
912
|
let c = !0;
|
|
916
|
-
if (
|
|
913
|
+
if (u && u.tokens) {
|
|
917
914
|
r({
|
|
918
915
|
...s,
|
|
919
916
|
status: "Loading user"
|
|
920
917
|
/* Loading */
|
|
921
918
|
});
|
|
922
919
|
const v = a !== "";
|
|
923
|
-
|
|
920
|
+
u.userInfoAsync(v).then((b) => {
|
|
924
921
|
c && r({
|
|
925
922
|
user: b,
|
|
926
923
|
status: "User loaded"
|
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 ke;function Qe(){if(ke)return J;ke=1;var s=_,o=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,f=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
9
|
+
*/var ke;function Qe(){if(ke)return J;ke=1;var s=_,o=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,f=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function y(l,v,k){var m,R={},x=null,P=null;k!==void 0&&(x=""+k),v.key!==void 0&&(x=""+v.key),v.ref!==void 0&&(P=v.ref);for(m in v)a.call(v,m)&&!d.hasOwnProperty(m)&&(R[m]=v[m]);if(l&&l.defaultProps)for(m in v=l.defaultProps,v)R[m]===void 0&&(R[m]=v[m]);return{$$typeof:o,type:l,key:x,ref:P,props:R,_owner:f.current}}return J.Fragment=n,J.jsx=y,J.jsxs=y,J}var G={};/**
|
|
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=_,o=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),
|
|
18
|
-
`+ve+e}}var he=!1,q;{var Tt=typeof WeakMap=="function"?WeakMap:Map;q=new Tt}function De(e,t){if(!e||he)return"";{var r=q.get(e);if(r!==void 0)return r}var
|
|
19
|
-
`),j=
|
|
17
|
+
*/var me;function Ze(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){var s=_,o=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),l=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),P=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 S(e){{for(var t=arguments.length,r=new Array(t>1?t-1:0),u=1;u<t;u++)r[u-1]=arguments[u];oe("error",e,r)}}function oe(e,t,r){{var u=L.ReactDebugCurrentFrame,g=u.getStackAddendum();g!==""&&(t+="%s",r=r.concat([g]));var b=r.map(function(p){return String(p)});b.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,b)}}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===d||le||e===f||e===k||e===m||ie||e===P||Y||ae||ce||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===R||e.$$typeof===y||e.$$typeof===l||e.$$typeof===v||e.$$typeof===F||e.getModuleId!==void 0))}function de(e,t,r){var u=e.displayName;if(u)return u;var g=t.displayName||t.name||"";return g!==""?r+"("+g+")":r}function U(e){return e.displayName||"Context"}function C(e){if(e==null)return null;if(typeof e.tag=="number"&&S("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 d:return"Profiler";case f:return"StrictMode";case k:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case l:var t=e;return U(t)+".Consumer";case y:var r=e;return U(r._context)+".Provider";case v:return de(e,e.render,"ForwardRef");case R:var u=e.displayName||null;return u!==null?u:C(e.type)||"Memo";case x:{var g=e,b=g._payload,p=g._init;try{return C(p(b))}catch{return null}}}return null}var W=Object.assign,N=0,V,E,I,Pe,Ae,Fe,Ne;function Ie(){}Ie.__reactDisabledLog=!0;function Ot(){{if(N===0){V=console.log,E=console.info,I=console.warn,Pe=console.error,Ae=console.group,Fe=console.groupCollapsed,Ne=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ie,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:W({},e,{value:V}),info:W({},e,{value:E}),warn:W({},e,{value:I}),error:W({},e,{value:Pe}),group:W({},e,{value:Ae}),groupCollapsed:W({},e,{value:Fe}),groupEnd:W({},e,{value:Ne})})}N<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=L.ReactCurrentDispatcher,ve;function Z(e,t,r){{if(ve===void 0)try{throw Error()}catch(g){var u=g.stack.trim().match(/\n( *(at )?)/);ve=u&&u[1]||""}return`
|
|
18
|
+
`+ve+e}}var he=!1,q;{var Tt=typeof WeakMap=="function"?WeakMap:Map;q=new Tt}function De(e,t){if(!e||he)return"";{var r=q.get(e);if(r!==void 0)return r}var u;he=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var b;b=fe.current,fe.current=null,Ot();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(D){u=D}Reflect.construct(e,[],p)}else{try{p.call()}catch(D){u=D}e.call(p.prototype)}}else{try{throw Error()}catch(D){u=D}e()}}catch(D){if(D&&u&&typeof D.stack=="string"){for(var h=D.stack.split(`
|
|
19
|
+
`),j=u.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,fe.current=b,Et(),Error.prepareStackTrace=g}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 De(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 De(e,Rt(e));if(typeof e=="string")return Z(e);switch(e){case k:return Z("Suspense");case m:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return wt(e.render);case R:return $(e.type,t,r);case x:{var
|
|
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,fe.current=b,Et(),Error.prepareStackTrace=g}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 De(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 De(e,Rt(e));if(typeof e=="string")return Z(e);switch(e){case k:return Z("Suspense");case m:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return wt(e.render);case R:return $(e.type,t,r);case x:{var u=e,g=u._payload,b=u._init;try{return $(b(g),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,u,g){{var b=Function.call.bind(ee);for(var p in e)if(b(e,p)){var h=void 0;try{if(typeof e[p]!="function"){var j=Error((u||"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,u,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(O){h=O}h&&!(h instanceof Error)&&(te(g),S("%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).",u||"React class",r,p,typeof h),te(null)),h instanceof Error&&!(h.message in Le)&&(Le[h.message]=!0,te(g),S("Failed %s type: %s",r,h.message),te(null))}}}var jt=Array.isArray;function pe(e){return jt(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 S("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,Pt={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ve,_e;_e={};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"&&H.current&&t&&H.current.stateNode!==t){var r=C(H.current.type);_e[r]||(S('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',C(H.current.type),e.ref),_e[r]=!0)}}function It(e,t){{var r=function(){Ye||(Ye=!0,S("%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 Dt(e,t){{var r=function(){Ve||(Ve=!0,S("%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,u,g,b,p){var h={$$typeof:o,type:e,key:t,ref:r,props:p,_owner:b};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:u}),Object.defineProperty(h,"_source",{configurable:!1,enumerable:!1,writable:!1,value:g}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h};function Ut(e,t,r,u,g){{var b,p={},h=null,j=null;r!==void 0&&(Me(r),h=""+r),Ft(t)&&(Me(t.key),h=""+t.key),At(t)&&(j=t.ref,Nt(t,g));for(b in t)ee.call(t,b)&&!Pt.hasOwnProperty(b)&&(p[b]=t[b]);if(e&&e.defaultProps){var O=e.defaultProps;for(b in O)p[b]===void 0&&(p[b]=O[b])}if(h||j){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;h&&It(p,T),j&&Dt(p,T)}return Lt(e,h,j,g,u,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=C(ge.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 Je={};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 Ge(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Mt(t);if(Je[r])return;Je[r]=!0;var d="";e&&e._owner&&e._owner!==ge.current&&(d=" It was passed a child from "+C(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)&&Ge(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 b=g.call(e),p;!(p=b.next()).done;)be(p.value)&&Ge(p.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===R))r=t.propTypes;else return;if(r){var d=C(t);St(r,e.props,"prop",d,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var g=C(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 Vt(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,b){{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=Wt(g);j?h+=j:h+=ze();var O;e===null?O="null":pe(e)?O="array":e!==void 0&&e.$$typeof===o?(O="<"+(C(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=Ut(e,t,r,g,b);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?Vt(T):Yt(T),T}}function Bt(e,t,r){return He(e,t,r,!0)}function zt(e,t,r){return He(e,t,r,!1)}var Jt=zt,Gt=Bt;G.Fragment=a,G.jsx=Jt,G.jsxs=Gt}()),G}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)=>{const v=qe(n,()=>a(o));return console.log("newFetch",u),v(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,{})},dt=({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 k=window?i.getPath(window.location.href):"",[m,R]=_.useState(k);_.useEffect(()=>{const P=()=>R(i.getPath(window.location.href));return P(),window.addEventListener("popstate",P,!1),()=>window.removeEventListener("popstate",P,!1)},[]);const x=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 x:return c.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:y,withCustomHistory:l});default:return c.jsx(c.Fragment,{children:u})}},ft=_.memo(dt),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:k=null,onLogoutFromAnotherTab:m=null,onLogoutFromSameTab:R=null,withCustomHistory:x=null,onEvent:P=null,getFetch:X=null,location:Q=null})=>{const M=(N="default")=>i.OidcClient.getOrCreate(X??i.getFetchDefault,Q??new i.OidcLocation)(o,N),[L,S]=_.useState(!0),[oe,Y]=_.useState(Re),[ae,ce]=_.useState("default");_.useEffect(()=>{const V=M(n).subscribeEvents((E,I)=>{P&&P(n,E,I)});return()=>{M(n).removeEventSubscription(V)}},[n,P]),_.useEffect(()=>{const V=M(n).subscribeEvents((E,I)=>{if(E===i.OidcClient.eventNames.refreshTokensAsync_error||E===i.OidcClient.eventNames.syncTokensAsync_error){if(k!=null){k();return}Y({name:E,data:I})}else if(E===i.OidcClient.eventNames.logout_from_another_tab){if(m!=null){m();return}Y({name:E,data:I})}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:I}):E===i.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&Y({name:E,data:I})});return ce(n),S(!1),()=>{M(n).removeEventSubscription(V),Y(Re)}},[o,n]);const ie=v,le=f,F=u,ue=y,de=l,U=L||ae!==n,C=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(de,{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(ft,{redirect_uri:C.configuration.redirect_uri,silent_redirect_uri:C.configuration.silent_redirect_uri,silent_login_uri:C.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:l,authenticatingComponent:f,configurationName:n,withCustomHistory:x,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 k=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(k)}},[s]),{login:(l=void 0,v=null,k=!1)=>o(s).loginAsync(l,v,!1,void 0,k),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}}return je},yt=(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 k=u.tokens;a(k!=null?{accessToken:k.accessToken,accessTokenPayload:k.accessTokenPayload}:je)}});return()=>{f=!1,u.removeEventSubscription(y)}},[s]),n},Ce={idToken:null,idTokenPayload:null},bt=s=>{const o=i.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{idToken:a.idToken,idTokenPayload:a.idTokenPayload}}return Ce},kt=(s=re)=>{const o=i.OidcClient.get,[n,a]=_.useState(bt(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 k=u.tokens;a(k!=null?{idToken:k.idToken,idTokenPayload:k.idTokenPayload}:Ce)}});return()=>{f=!1,u.removeEventSubscription(y)}},[s]),n};var xe=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(xe||{});const mt=(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(k=>{l&&n({user:k,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=xe,w.useOidc=_t,w.useOidcAccessToken=yt,w.useOidcFetch=Ee,w.useOidcIdToken=kt,w.useOidcUser=mt,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 Ge(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Mt(t);if(Je[r])return;Je[r]=!0;var u="";e&&e._owner&&e._owner!==ge.current&&(u=" It was passed a child from "+C(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,u),B(null)}}function Ke(e,t){{if(typeof e!="object")return;if(pe(e))for(var r=0;r<e.length;r++){var u=e[r];be(u)&&Ge(u,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 b=g.call(e),p;!(p=b.next()).done;)be(p.value)&&Ge(p.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===R))r=t.propTypes;else return;if(r){var u=C(t);St(r,e.props,"prop",u,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var g=C(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 Vt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var u=t[r];if(u!=="children"&&u!=="key"){B(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",u),B(null);break}}e.ref!==null&&(B(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function He(e,t,r,u,g,b){{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=Wt(g);j?h+=j:h+=ze();var O;e===null?O="null":pe(e)?O="array":e!==void 0&&e.$$typeof===o?(O="<"+(C(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=Ut(e,t,r,g,b);if(T==null)return T;if(p){var A=t.children;if(A!==void 0)if(u)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?Vt(T):Yt(T),T}}function Bt(e,t,r){return He(e,t,r,!0)}function zt(e,t,r){return He(e,t,r,!1)}var Jt=zt,Gt=Bt;G.Fragment=a,G.jsx=Jt,G.jsxs=Gt}()),G}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((d,y)=>qe(n,()=>a(o))(d,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},d=o.createEvent("CustomEvent");return d.initCustomEvent(n,f.bubbles,f.cancelable,f.detail),d.prototype=s.Event.prototype,d},rt=(s,o,n)=>({replaceState:(a,f)=>{const d=n(),y=f||s.history.state;s.history.replaceState({key:d,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,d]=_.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),d(!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[d,y]of Object.entries(o))d==="state"||d==="scope"||(f===null&&(f={}),f[d]=y);return _.useEffect(()=>{a.tokens||a.loginAsync(null,f,!0,o.scope)},[]),c.jsx(c.Fragment,{})},dt=({callbackErrorComponent:s,callbackSuccessComponent:o,redirect_uri:n,silent_redirect_uri:a,silent_login_uri:f,children:d,configurationName:y,withCustomHistory:l=null,location:v})=>{const k=window?i.getPath(window.location.href):"",[m,R]=_.useState(k);_.useEffect(()=>{const P=()=>R(i.getPath(window.location.href));return P(),window.addEventListener("popstate",P,!1),()=>window.removeEventListener("popstate",P,!1)},[]);const x=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 x:return c.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:y,withCustomHistory:l});default:return c.jsx(c.Fragment,{children:d})}},ft=_.memo(dt),Re={name:"",data:null},vt=({loadingComponent:s,children:o,configurationName:n})=>{const[a,f]=_.useState(!0),d=i.OidcClient.get,y=d(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:d=at,serviceWorkerNotSupportedComponent:y=ct,authenticatingErrorComponent:l=Te,sessionLostComponent:v=it,onSessionLost:k=null,onLogoutFromAnotherTab:m=null,onLogoutFromSameTab:R=null,withCustomHistory:x=null,onEvent:P=null,getFetch:X=null,location:Q=null})=>{const M=(N="default")=>i.OidcClient.getOrCreate(X??i.getFetchDefault,Q??new i.OidcLocation)(o,N),[L,S]=_.useState(!0),[oe,Y]=_.useState(Re),[ae,ce]=_.useState("default");_.useEffect(()=>{const V=M(n).subscribeEvents((E,I)=>{P&&P(n,E,I)});return()=>{M(n).removeEventSubscription(V)}},[n,P]),_.useEffect(()=>{const V=M(n).subscribeEvents((E,I)=>{if(E===i.OidcClient.eventNames.refreshTokensAsync_error||E===i.OidcClient.eventNames.syncTokensAsync_error){if(k!=null){k();return}Y({name:E,data:I})}else if(E===i.OidcClient.eventNames.logout_from_another_tab){if(m!=null){m();return}Y({name:E,data:I})}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:I}):E===i.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&Y({name:E,data:I})});return ce(n),S(!1),()=>{M(n).removeEventSubscription(V),Y(Re)}},[o,n]);const ie=v,le=f,F=d,ue=y,de=l,U=L||ae!==n,C=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(de,{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(ft,{redirect_uri:C.configuration.redirect_uri,silent_redirect_uri:C.configuration.silent_redirect_uri,silent_login_uri:C.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:l,authenticatingComponent:f,configurationName:n,withCustomHistory:x,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,d=f(a);return _.useEffect(()=>{d.tokens||d.loginAsync(o,n)},[a,o,n]),d.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 k=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(k)}},[s]),{login:(l=void 0,v=null,k=!1)=>o(s).loginAsync(l,v,!1,void 0,k),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}}return je},yt=(s=re)=>{const o=i.OidcClient.get,[n,a]=_.useState(gt(s));return _.useEffect(()=>{let f=!0;const d=o(s);if(d.tokens){const l=d.tokens;a({accessToken:l.accessToken,accessTokenPayload:l.accessTokenPayload})}const y=d.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 k=d.tokens;a(k!=null?{accessToken:k.accessToken,accessTokenPayload:k.accessTokenPayload}:je)}});return()=>{f=!1,d.removeEventSubscription(y)}},[s]),n},Ce={idToken:null,idTokenPayload:null},bt=s=>{const o=i.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{idToken:a.idToken,idTokenPayload:a.idTokenPayload}}return Ce},kt=(s=re)=>{const o=i.OidcClient.get,[n,a]=_.useState(bt(s));return _.useEffect(()=>{let f=!0;const d=o(s);if(d.tokens){const l=d.tokens;a({idToken:l.idToken,idTokenPayload:l.idTokenPayload})}const y=d.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 k=d.tokens;a(k!=null?{idToken:k.idToken,idTokenPayload:k.idTokenPayload}:Ce)}});return()=>{f=!1,d.removeEventSubscription(y)}},[s]),n};var xe=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(xe||{});const mt=(s="default")=>{const[o,n]=_.useState({user:null,status:"Unauthenticated"}),[a,f]=_.useState(""),d=i.OidcClient.get(s);_.useEffect(()=>{let l=!0;if(d&&d.tokens){n({...o,status:"Loading user"});const v=a!=="";d.userInfoAsync(v).then(k=>{l&&n({user:k,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=xe,w.useOidc=_t,w.useOidcAccessToken=yt,w.useOidcFetch=Ee,w.useOidcIdToken=kt,w.useOidcUser=mt,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.13.
|
|
3
|
+
"version": "7.13.15",
|
|
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.13.
|
|
44
|
-
"@axa-fr/oidc-client": "7.13.
|
|
43
|
+
"@axa-fr/oidc-client-service-worker": "7.13.15",
|
|
44
|
+
"@axa-fr/oidc-client": "7.13.15",
|
|
45
45
|
"base64-js": "1.5.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
package/src/FetchToken.tsx
CHANGED
|
@@ -28,7 +28,6 @@ export const useOidcFetch = (fetch: Fetch = null, configurationName = defaultCon
|
|
|
28
28
|
(input: RequestInfo | URL, init?: RequestInit) => {
|
|
29
29
|
const getOidcWithConfigurationName = () => getOidc(configurationName);
|
|
30
30
|
const newFetch = fetchWithToken(previousFetch, getOidcWithConfigurationName);
|
|
31
|
-
console.log('newFetch', input)
|
|
32
31
|
return newFetch(input, init);
|
|
33
32
|
},
|
|
34
33
|
[previousFetch, configurationName],
|