@axa-fr/react-oidc 7.21.0 → 7.22.0-alpha.1416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/FetchToken.d.ts +2 -2
- package/dist/FetchToken.d.ts.map +1 -1
- package/dist/User.d.ts +1 -1
- package/dist/index.js +177 -177
- package/dist/index.umd.cjs +6 -6
- package/package.json +3 -3
- package/src/FetchToken.tsx +6 -6
- package/src/User.ts +2 -2
package/README.md
CHANGED
|
@@ -101,7 +101,8 @@ trustedDomains.config_show_access_token = {
|
|
|
101
101
|
// DPoP (Demonstrating Proof of Possession) will be activated for the following domains
|
|
102
102
|
trustedDomains.config_with_dpop = {
|
|
103
103
|
domains: ["https://demo.duendesoftware.com"],
|
|
104
|
-
demonstratingProofOfPossession: true
|
|
104
|
+
demonstratingProofOfPossession: true,
|
|
105
|
+
demonstratingProofOfPossessionOnlyWhenDpopHeaderPresent: true, // default value is false, inject DPOP token only when DPOP header is present
|
|
105
106
|
// Optional, more details bellow
|
|
106
107
|
/*demonstratingProofOfPossessionConfiguration: {
|
|
107
108
|
importKeyAlgorithm: {
|
package/dist/FetchToken.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Fetch } from '@axa-fr/oidc-client';
|
|
|
2
2
|
export interface ComponentWithOidcFetchProps {
|
|
3
3
|
fetch?: Fetch;
|
|
4
4
|
}
|
|
5
|
-
export declare const withOidcFetch: (fetch?: Fetch, configurationName?: string) => (WrappedComponent: any) => (props: ComponentWithOidcFetchProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export declare const useOidcFetch: (fetch?: Fetch, configurationName?: string) => {
|
|
5
|
+
export declare const withOidcFetch: (fetch?: Fetch, configurationName?: string, demonstrating_proof_of_possession?: boolean) => (WrappedComponent: any) => (props: ComponentWithOidcFetchProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const useOidcFetch: (fetch?: Fetch, configurationName?: string, demonstrating_proof_of_possession?: boolean) => {
|
|
7
7
|
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=FetchToken.d.ts.map
|
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,
|
|
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,kEAAyF,OAAO,wCAE7H,2BAA2B,4CAGvC,CAAC;AAEF,eAAO,MAAM,YAAY,WAAW,KAAK,kEAAyF,OAAO;mBAK7H,WAAW,GAAG,GAAG,SAAS,WAAW;CAQhD,CAAC"}
|
package/dist/User.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type OidcUser<T extends OidcUserInfo = OidcUserInfo> = {
|
|
|
9
9
|
user: T | null;
|
|
10
10
|
status: OidcUserStatus;
|
|
11
11
|
};
|
|
12
|
-
export declare const useOidcUser: <T extends OidcUserInfo = OidcUserInfo>(configurationName?: string) => {
|
|
12
|
+
export declare const useOidcUser: <T extends OidcUserInfo = OidcUserInfo>(configurationName?: string, demonstrating_proof_of_possession?: boolean) => {
|
|
13
13
|
oidcUser: T;
|
|
14
14
|
oidcUserLoadingState: OidcUserStatus;
|
|
15
15
|
reloadOidcUser: () => void;
|
package/dist/index.js
CHANGED
|
@@ -16,18 +16,18 @@ function wt() {
|
|
|
16
16
|
if ($e)
|
|
17
17
|
return G;
|
|
18
18
|
$e = 1;
|
|
19
|
-
var o = me,
|
|
20
|
-
function
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
for (
|
|
24
|
-
|
|
19
|
+
var o = me, a = Symbol.for("react.element"), r = Symbol.for("react.fragment"), s = 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 y(c, v, b) {
|
|
21
|
+
var _, k = {}, x = null, j = null;
|
|
22
|
+
b !== void 0 && (x = "" + b), v.key !== void 0 && (x = "" + v.key), v.ref !== void 0 && (j = v.ref);
|
|
23
|
+
for (_ in v)
|
|
24
|
+
s.call(v, _) && !u.hasOwnProperty(_) && (k[_] = v[_]);
|
|
25
25
|
if (c && c.defaultProps)
|
|
26
|
-
for (
|
|
27
|
-
|
|
28
|
-
return { $$typeof:
|
|
26
|
+
for (_ in v = c.defaultProps, v)
|
|
27
|
+
k[_] === void 0 && (k[_] = v[_]);
|
|
28
|
+
return { $$typeof: a, type: c, key: x, ref: j, props: k, _owner: l.current };
|
|
29
29
|
}
|
|
30
|
-
return G.Fragment = r, G.jsx =
|
|
30
|
+
return G.Fragment = r, G.jsx = y, G.jsxs = y, 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 = me,
|
|
45
|
+
var o = me, a = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), y = Symbol.for("react.provider"), c = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), k = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), H = Symbol.iterator, X = "@@iterator";
|
|
46
46
|
function M(e) {
|
|
47
47
|
if (e === null || typeof e != "object")
|
|
48
48
|
return null;
|
|
@@ -70,7 +70,7 @@ function Ot() {
|
|
|
70
70
|
var Y = !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 ===
|
|
73
|
+
return !!(typeof e == "string" || typeof e == "function" || e === s || e === u || ie || e === l || e === b || e === _ || ae || e === j || Y || oe || se || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === k || e.$$typeof === y || 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.
|
|
@@ -94,7 +94,7 @@ function Ot() {
|
|
|
94
94
|
if (typeof e == "string")
|
|
95
95
|
return e;
|
|
96
96
|
switch (e) {
|
|
97
|
-
case
|
|
97
|
+
case s:
|
|
98
98
|
return "Fragment";
|
|
99
99
|
case r:
|
|
100
100
|
return "Portal";
|
|
@@ -102,9 +102,9 @@ function Ot() {
|
|
|
102
102
|
return "Profiler";
|
|
103
103
|
case l:
|
|
104
104
|
return "StrictMode";
|
|
105
|
-
case y:
|
|
106
|
-
return "Suspense";
|
|
107
105
|
case b:
|
|
106
|
+
return "Suspense";
|
|
107
|
+
case _:
|
|
108
108
|
return "SuspenseList";
|
|
109
109
|
}
|
|
110
110
|
if (typeof e == "object")
|
|
@@ -112,12 +112,12 @@ function Ot() {
|
|
|
112
112
|
case c:
|
|
113
113
|
var t = e;
|
|
114
114
|
return W(t) + ".Consumer";
|
|
115
|
-
case
|
|
115
|
+
case y:
|
|
116
116
|
var n = e;
|
|
117
117
|
return W(n._context) + ".Provider";
|
|
118
118
|
case v:
|
|
119
119
|
return le(e, e.render, "ForwardRef");
|
|
120
|
-
case
|
|
120
|
+
case k:
|
|
121
121
|
var d = e.displayName || null;
|
|
122
122
|
return d !== null ? d : R(e.type) || "Memo";
|
|
123
123
|
case x: {
|
|
@@ -131,14 +131,14 @@ function Ot() {
|
|
|
131
131
|
}
|
|
132
132
|
return null;
|
|
133
133
|
}
|
|
134
|
-
var U = Object.assign, D = 0, $,
|
|
134
|
+
var U = Object.assign, D = 0, $, T, N, Ee, Te, we, Oe;
|
|
135
135
|
function Ce() {
|
|
136
136
|
}
|
|
137
137
|
Ce.__reactDisabledLog = !0;
|
|
138
138
|
function He() {
|
|
139
139
|
{
|
|
140
140
|
if (D === 0) {
|
|
141
|
-
$ = console.log,
|
|
141
|
+
$ = console.log, T = console.info, N = console.warn, Ee = console.error, Te = console.group, we = console.groupCollapsed, Oe = console.groupEnd;
|
|
142
142
|
var e = {
|
|
143
143
|
configurable: !0,
|
|
144
144
|
enumerable: !0,
|
|
@@ -171,7 +171,7 @@ function Ot() {
|
|
|
171
171
|
value: $
|
|
172
172
|
}),
|
|
173
173
|
info: U({}, e, {
|
|
174
|
-
value:
|
|
174
|
+
value: T
|
|
175
175
|
}),
|
|
176
176
|
warn: U({}, e, {
|
|
177
177
|
value: N
|
|
@@ -262,18 +262,18 @@ 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
|
-
`),
|
|
266
|
-
|
|
267
|
-
for (;
|
|
268
|
-
if (h[
|
|
269
|
-
if (
|
|
265
|
+
`), E = h.length - 1, w = C.length - 1; E >= 1 && w >= 0 && h[E] !== C[w]; )
|
|
266
|
+
w--;
|
|
267
|
+
for (; E >= 1 && w >= 0; E--, w--)
|
|
268
|
+
if (h[E] !== C[w]) {
|
|
269
|
+
if (E !== 1 || w !== 1)
|
|
270
270
|
do
|
|
271
|
-
if (
|
|
271
|
+
if (E--, w--, w < 0 || h[E] !== C[w]) {
|
|
272
272
|
var P = `
|
|
273
|
-
` + h[
|
|
273
|
+
` + h[E].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 (E >= 1 && w >= 0);
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
@@ -298,16 +298,16 @@ function Ot() {
|
|
|
298
298
|
if (typeof e == "string")
|
|
299
299
|
return Q(e);
|
|
300
300
|
switch (e) {
|
|
301
|
-
case y:
|
|
302
|
-
return Q("Suspense");
|
|
303
301
|
case b:
|
|
302
|
+
return Q("Suspense");
|
|
303
|
+
case _:
|
|
304
304
|
return Q("SuspenseList");
|
|
305
305
|
}
|
|
306
306
|
if (typeof e == "object")
|
|
307
307
|
switch (e.$$typeof) {
|
|
308
308
|
case v:
|
|
309
309
|
return Ze(e.render);
|
|
310
|
-
case
|
|
310
|
+
case k:
|
|
311
311
|
return ee(e.type, t, n);
|
|
312
312
|
case x: {
|
|
313
313
|
var d = e, g = d._payload, m = d._init;
|
|
@@ -339,8 +339,8 @@ 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 (E) {
|
|
343
|
+
h = E;
|
|
344
344
|
}
|
|
345
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
|
}
|
|
@@ -424,7 +424,7 @@ function Ot() {
|
|
|
424
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
|
-
$$typeof:
|
|
427
|
+
$$typeof: a,
|
|
428
428
|
// Built-in properties that belong on the element
|
|
429
429
|
type: e,
|
|
430
430
|
key: t,
|
|
@@ -457,13 +457,13 @@ function Ot() {
|
|
|
457
457
|
for (m in t)
|
|
458
458
|
te.call(t, m) && !st.hasOwnProperty(m) && (p[m] = t[m]);
|
|
459
459
|
if (e && e.defaultProps) {
|
|
460
|
-
var
|
|
461
|
-
for (m in
|
|
462
|
-
p[m] === void 0 && (p[m] =
|
|
460
|
+
var E = e.defaultProps;
|
|
461
|
+
for (m in E)
|
|
462
|
+
p[m] === void 0 && (p[m] = E[m]);
|
|
463
463
|
}
|
|
464
464
|
if (h || C) {
|
|
465
|
-
var
|
|
466
|
-
h && lt(p,
|
|
465
|
+
var w = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
466
|
+
h && lt(p, w), C && ut(p, w);
|
|
467
467
|
}
|
|
468
468
|
return dt(e, h, C, g, d, B.current, p);
|
|
469
469
|
}
|
|
@@ -479,7 +479,7 @@ function Ot() {
|
|
|
479
479
|
var _e;
|
|
480
480
|
_e = !1;
|
|
481
481
|
function ge(e) {
|
|
482
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
482
|
+
return typeof e == "object" && e !== null && e.$$typeof === a;
|
|
483
483
|
}
|
|
484
484
|
function Ne() {
|
|
485
485
|
{
|
|
@@ -559,7 +559,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
559
559
|
n = t.propTypes;
|
|
560
560
|
else if (typeof t == "object" && (t.$$typeof === v || // Note: Memo only checks outer props here.
|
|
561
561
|
// Inner props are checked in the reconciler.
|
|
562
|
-
t.$$typeof ===
|
|
562
|
+
t.$$typeof === k))
|
|
563
563
|
n = t.propTypes;
|
|
564
564
|
else
|
|
565
565
|
return;
|
|
@@ -594,12 +594,12 @@ Check the top-level render call using <` + n + ">.");
|
|
|
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
595
|
var C = vt(g);
|
|
596
596
|
C ? h += C : h += Ne();
|
|
597
|
-
var
|
|
598
|
-
e === null ?
|
|
597
|
+
var E;
|
|
598
|
+
e === null ? E = "null" : ve(e) ? E = "array" : e !== void 0 && e.$$typeof === a ? (E = "<" + (R(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : E = 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", E, h);
|
|
599
599
|
}
|
|
600
|
-
var
|
|
601
|
-
if (
|
|
602
|
-
return
|
|
600
|
+
var w = ft(e, t, n, g, m);
|
|
601
|
+
if (w == null)
|
|
602
|
+
return w;
|
|
603
603
|
if (p) {
|
|
604
604
|
var P = t.children;
|
|
605
605
|
if (P !== void 0)
|
|
@@ -613,7 +613,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
613
613
|
else
|
|
614
614
|
We(P, e);
|
|
615
615
|
}
|
|
616
|
-
return e ===
|
|
616
|
+
return e === s ? _t(w) : pt(w), w;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
function gt(e, t, n) {
|
|
@@ -623,19 +623,19 @@ Check the top-level render call using <` + n + ">.");
|
|
|
623
623
|
return Ue(e, t, n, !1);
|
|
624
624
|
}
|
|
625
625
|
var bt = yt, mt = gt;
|
|
626
|
-
J.Fragment =
|
|
626
|
+
J.Fragment = s, 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
|
-
const Be = "default", Ct = (o,
|
|
632
|
-
const { fetch:
|
|
633
|
-
return /* @__PURE__ */ i.jsx(
|
|
634
|
-
}, Rt = (o = null,
|
|
635
|
-
const
|
|
631
|
+
const Be = "default", Ct = (o, a, r = !1) => async (...s) => await a().fetchWithTokens(o, r)(...s), Kt = (o = null, a = Be, r = !1) => (s) => (l) => {
|
|
632
|
+
const { fetch: u } = Rt(o || l.fetch, a, r);
|
|
633
|
+
return /* @__PURE__ */ i.jsx(s, { ...l, fetch: u });
|
|
634
|
+
}, Rt = (o = null, a = Be, r = !1) => {
|
|
635
|
+
const s = o || window.fetch, l = f.get;
|
|
636
636
|
return { fetch: kt(
|
|
637
|
-
(
|
|
638
|
-
[
|
|
637
|
+
(y, c) => Ct(s, () => l(a), r)(y, c),
|
|
638
|
+
[s, a]
|
|
639
639
|
) };
|
|
640
640
|
}, ze = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-authenticating__container", children: [
|
|
641
641
|
/* @__PURE__ */ i.jsx("h1", { className: "oidc-authenticating__title", children: "Error authentication" }),
|
|
@@ -643,37 +643,37 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
643
643
|
] }) }), xt = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-authenticating__container", children: [
|
|
644
644
|
/* @__PURE__ */ i.jsx("h1", { className: "oidc-authenticating__title", children: "Authentication in progress" }),
|
|
645
645
|
/* @__PURE__ */ i.jsx("p", { className: "oidc-authenticating__content", children: "You will be redirected to the login page." })
|
|
646
|
-
] }) }), jt = () => Math.random().toString(36).substr(2, 6), Pt = (o,
|
|
646
|
+
] }) }), jt = () => Math.random().toString(36).substr(2, 6), Pt = (o, a) => (r, s) => {
|
|
647
647
|
if (typeof o.CustomEvent == "function")
|
|
648
|
-
return new o.CustomEvent(r,
|
|
649
|
-
const l =
|
|
648
|
+
return new o.CustomEvent(r, s);
|
|
649
|
+
const l = s || { bubbles: !1, cancelable: !1, detail: void 0 }, u = a.createEvent("CustomEvent");
|
|
650
650
|
return u.initCustomEvent(r, l.bubbles, l.cancelable, l.detail), u.prototype = o.Event.prototype, u;
|
|
651
|
-
}, St = (o,
|
|
652
|
-
replaceState: (
|
|
653
|
-
const u = r(),
|
|
654
|
-
o.history.replaceState({ key: u, state:
|
|
651
|
+
}, St = (o, a, r) => ({
|
|
652
|
+
replaceState: (s, l) => {
|
|
653
|
+
const u = r(), y = l || o.history.state;
|
|
654
|
+
o.history.replaceState({ key: u, state: y }, null, s), o.dispatchEvent(a("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
|
-
] }) }), Ft = ({ callBackError: o, callBackSuccess:
|
|
659
|
+
] }) }), Ft = ({ callBackError: o, callBackSuccess: a, configurationName: r, withCustomHistory: s }) => {
|
|
660
660
|
const [l, u] = A(!1);
|
|
661
661
|
S(() => {
|
|
662
662
|
let v = !0;
|
|
663
663
|
return (async () => {
|
|
664
|
-
const
|
|
664
|
+
const _ = f.get;
|
|
665
665
|
try {
|
|
666
|
-
const { callbackPath:
|
|
667
|
-
(
|
|
668
|
-
} catch (
|
|
669
|
-
v && (console.warn(
|
|
666
|
+
const { callbackPath: k } = await _(r).loginCallbackAsync();
|
|
667
|
+
(s ? s() : At()).replaceState(k || "/");
|
|
668
|
+
} catch (k) {
|
|
669
|
+
v && (console.warn(k), u(!0));
|
|
670
670
|
}
|
|
671
671
|
})(), () => {
|
|
672
672
|
v = !1;
|
|
673
673
|
};
|
|
674
674
|
}, []);
|
|
675
|
-
const
|
|
676
|
-
return l ? /* @__PURE__ */ i.jsx(
|
|
675
|
+
const y = o || ze, c = a || Ge;
|
|
676
|
+
return l ? /* @__PURE__ */ i.jsx(y, { 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." })
|
|
@@ -686,103 +686,103 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
686
686
|
r(o).silentLoginCallbackAsync();
|
|
687
687
|
})();
|
|
688
688
|
}, []), /* @__PURE__ */ i.jsx(i.Fragment, {})), Wt = ({ configurationName: o }) => {
|
|
689
|
-
const
|
|
689
|
+
const a = Et(window.location.href), r = f.get, s = r(o);
|
|
690
690
|
let l = null;
|
|
691
|
-
for (const [u,
|
|
692
|
-
u === "state" || u === "scope" || (l === null && (l = {}), l[u] =
|
|
691
|
+
for (const [u, y] of Object.entries(a))
|
|
692
|
+
u === "state" || u === "scope" || (l === null && (l = {}), l[u] = y);
|
|
693
693
|
return S(() => {
|
|
694
|
-
|
|
694
|
+
s.tokens || s.loginAsync(null, l, !0, a.scope);
|
|
695
695
|
}, []), /* @__PURE__ */ i.jsx(i.Fragment, {});
|
|
696
696
|
}, Ut = ({
|
|
697
697
|
callbackErrorComponent: o,
|
|
698
|
-
callbackSuccessComponent:
|
|
698
|
+
callbackSuccessComponent: a,
|
|
699
699
|
redirect_uri: r,
|
|
700
|
-
silent_redirect_uri:
|
|
700
|
+
silent_redirect_uri: s,
|
|
701
701
|
silent_login_uri: l,
|
|
702
702
|
children: u,
|
|
703
|
-
configurationName:
|
|
703
|
+
configurationName: y,
|
|
704
704
|
withCustomHistory: c = null,
|
|
705
705
|
location: v
|
|
706
706
|
}) => {
|
|
707
|
-
const
|
|
707
|
+
const b = window ? z(window.location.href) : "", [_, k] = A(b);
|
|
708
708
|
S(() => {
|
|
709
|
-
const j = () =>
|
|
709
|
+
const j = () => k(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 (
|
|
714
|
-
return /* @__PURE__ */ i.jsx(Lt, { configurationName:
|
|
715
|
-
if (l &&
|
|
716
|
-
return /* @__PURE__ */ i.jsx(Wt, { configurationName:
|
|
717
|
-
switch (
|
|
713
|
+
if (s && _ === z(s))
|
|
714
|
+
return /* @__PURE__ */ i.jsx(Lt, { configurationName: y });
|
|
715
|
+
if (l && _ === z(l))
|
|
716
|
+
return /* @__PURE__ */ i.jsx(Wt, { configurationName: y });
|
|
717
|
+
switch (_) {
|
|
718
718
|
case x:
|
|
719
|
-
return /* @__PURE__ */ i.jsx(Ft, { callBackError: o, callBackSuccess:
|
|
719
|
+
return /* @__PURE__ */ i.jsx(Ft, { callBackError: o, callBackSuccess: a, configurationName: y, withCustomHistory: c });
|
|
720
720
|
default:
|
|
721
721
|
return /* @__PURE__ */ i.jsx(i.Fragment, { children: u });
|
|
722
722
|
}
|
|
723
|
-
}, Mt = me.memo(Ut), qe = { name: "", data: null }, Yt = ({ loadingComponent: o, children:
|
|
724
|
-
const [
|
|
723
|
+
}, Mt = me.memo(Ut), qe = { name: "", data: null }, Yt = ({ loadingComponent: o, children: a, configurationName: r }) => {
|
|
724
|
+
const [s, l] = A(!0), u = f.get, y = u(r);
|
|
725
725
|
S(() => {
|
|
726
726
|
let v = !0;
|
|
727
|
-
return
|
|
727
|
+
return y && y.tryKeepExistingSessionAsync().then(() => {
|
|
728
728
|
v && l(!1);
|
|
729
729
|
}), () => {
|
|
730
730
|
v = !1;
|
|
731
731
|
};
|
|
732
732
|
}, [r]);
|
|
733
733
|
const c = o;
|
|
734
|
-
return /* @__PURE__ */ i.jsx(i.Fragment, { children:
|
|
735
|
-
}, K = ({ isLoading: o, loadingComponent:
|
|
736
|
-
const l =
|
|
737
|
-
return o ? /* @__PURE__ */ i.jsx(l, { configurationName:
|
|
734
|
+
return /* @__PURE__ */ i.jsx(i.Fragment, { children: s ? /* @__PURE__ */ i.jsx(c, { configurationName: r }) : /* @__PURE__ */ i.jsx(i.Fragment, { children: a }) });
|
|
735
|
+
}, K = ({ isLoading: o, loadingComponent: a, children: r, configurationName: s }) => {
|
|
736
|
+
const l = a;
|
|
737
|
+
return o ? /* @__PURE__ */ i.jsx(l, { configurationName: s, children: r }) : /* @__PURE__ */ i.jsx(i.Fragment, { children: r });
|
|
738
738
|
}, Ht = ({
|
|
739
739
|
children: o,
|
|
740
|
-
configuration:
|
|
740
|
+
configuration: a,
|
|
741
741
|
configurationName: r = "default",
|
|
742
|
-
callbackSuccessComponent:
|
|
742
|
+
callbackSuccessComponent: s = Ge,
|
|
743
743
|
authenticatingComponent: l = xt,
|
|
744
744
|
loadingComponent: u = Dt,
|
|
745
|
-
serviceWorkerNotSupportedComponent:
|
|
745
|
+
serviceWorkerNotSupportedComponent: y = Nt,
|
|
746
746
|
authenticatingErrorComponent: c = ze,
|
|
747
747
|
sessionLostComponent: v = It,
|
|
748
|
-
onSessionLost:
|
|
749
|
-
onLogoutFromAnotherTab:
|
|
750
|
-
onLogoutFromSameTab:
|
|
748
|
+
onSessionLost: b = null,
|
|
749
|
+
onLogoutFromAnotherTab: _ = null,
|
|
750
|
+
onLogoutFromSameTab: k = null,
|
|
751
751
|
withCustomHistory: x = null,
|
|
752
752
|
onEvent: j = null,
|
|
753
753
|
getFetch: H = null,
|
|
754
754
|
location: X = null
|
|
755
755
|
}) => {
|
|
756
|
-
const M = (D = "default") => f.getOrCreate(H ?? Tt, X ?? new Ye())(
|
|
756
|
+
const M = (D = "default") => f.getOrCreate(H ?? Tt, X ?? new Ye())(a, D), [L, O] = A(!0), [ne, Y] = A(qe), [oe, se] = A("default");
|
|
757
757
|
S(() => {
|
|
758
|
-
const $ = M(r).subscribeEvents((
|
|
759
|
-
j && j(r,
|
|
758
|
+
const $ = M(r).subscribeEvents((T, N) => {
|
|
759
|
+
j && j(r, T, N);
|
|
760
760
|
});
|
|
761
761
|
return () => {
|
|
762
762
|
M(r).removeEventSubscription($);
|
|
763
763
|
};
|
|
764
764
|
}, [r, j]), S(() => {
|
|
765
|
-
const $ = M(r).subscribeEvents((
|
|
766
|
-
if (
|
|
767
|
-
if (y != null) {
|
|
768
|
-
y();
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
Y({ name: E, data: N });
|
|
772
|
-
} else if (E === f.eventNames.logout_from_another_tab) {
|
|
765
|
+
const $ = M(r).subscribeEvents((T, N) => {
|
|
766
|
+
if (T === f.eventNames.refreshTokensAsync_error || T === f.eventNames.syncTokensAsync_error) {
|
|
773
767
|
if (b != null) {
|
|
774
768
|
b();
|
|
775
769
|
return;
|
|
776
770
|
}
|
|
777
|
-
Y({ name:
|
|
771
|
+
Y({ name: T, data: N });
|
|
772
|
+
} else if (T === f.eventNames.logout_from_another_tab) {
|
|
773
|
+
if (_ != null) {
|
|
774
|
+
_();
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
Y({ name: T, data: N });
|
|
778
778
|
} else
|
|
779
|
-
|
|
779
|
+
T === f.eventNames.logout_from_same_tab ? k != null && k() : T === f.eventNames.loginAsync_begin || T === f.eventNames.loginCallbackAsync_end || T === f.eventNames.loginAsync_error || T === f.eventNames.loginCallbackAsync_error ? Y({ name: T, data: N }) : T === f.eventNames.service_worker_not_supported_by_browser && a.service_worker_only === !0 && Y({ name: T, data: N });
|
|
780
780
|
});
|
|
781
781
|
return se(r), O(!1), () => {
|
|
782
782
|
M(r).removeEventSubscription($), Y(qe);
|
|
783
783
|
};
|
|
784
|
-
}, [
|
|
785
|
-
const ae = v, ie = l, F = u, ce =
|
|
784
|
+
}, [a, r]);
|
|
785
|
+
const ae = v, ie = l, F = u, ce = y, le = c, W = L || oe !== r, R = M(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 }) });
|
|
@@ -802,7 +802,7 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
802
802
|
redirect_uri: R.configuration.redirect_uri,
|
|
803
803
|
silent_redirect_uri: R.configuration.silent_redirect_uri,
|
|
804
804
|
silent_login_uri: R.configuration.silent_login_uri,
|
|
805
|
-
callbackSuccessComponent:
|
|
805
|
+
callbackSuccessComponent: s,
|
|
806
806
|
callbackErrorComponent: c,
|
|
807
807
|
authenticatingComponent: l,
|
|
808
808
|
configurationName: r,
|
|
@@ -812,28 +812,28 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
812
812
|
}
|
|
813
813
|
) });
|
|
814
814
|
}
|
|
815
|
-
}, $t = ({ children: o, callbackPath:
|
|
816
|
-
const l = f.get, u = l(
|
|
815
|
+
}, $t = ({ children: o, callbackPath: a = null, extras: r = null, configurationName: s = "default" }) => {
|
|
816
|
+
const l = f.get, u = l(s);
|
|
817
817
|
return S(() => {
|
|
818
|
-
u.tokens || u.loginAsync(
|
|
819
|
-
}, [
|
|
820
|
-
}, Xt = (o,
|
|
818
|
+
u.tokens || u.loginAsync(a, r);
|
|
819
|
+
}, [s, a, r]), u.tokens ? /* @__PURE__ */ i.jsx(i.Fragment, { children: o }) : null;
|
|
820
|
+
}, Xt = (o, a = null, r = null, s = "default") => (l) => /* @__PURE__ */ i.jsx($t, { callbackPath: a, extras: r, configurationName: s, children: /* @__PURE__ */ i.jsx(o, { ...l }) }), ke = "default", ye = (o, a) => {
|
|
821
821
|
let r = !1;
|
|
822
|
-
return o(
|
|
822
|
+
return o(a) && (r = o(a).tokens != null), r;
|
|
823
823
|
}, Qt = (o = ke) => {
|
|
824
|
-
const
|
|
824
|
+
const a = f.get, [r, s] = A(ye(a, o));
|
|
825
825
|
return S(() => {
|
|
826
826
|
let c = !0;
|
|
827
|
-
const v =
|
|
828
|
-
|
|
829
|
-
const
|
|
830
|
-
(
|
|
827
|
+
const v = a(o);
|
|
828
|
+
s(ye(a, o));
|
|
829
|
+
const b = v.subscribeEvents((_, k) => {
|
|
830
|
+
(_ === f.eventNames.logout_from_another_tab || _ === f.eventNames.logout_from_same_tab || _ === f.eventNames.token_aquired) && c && s(ye(a, o));
|
|
831
831
|
});
|
|
832
832
|
return () => {
|
|
833
|
-
c = !1, v.removeEventSubscription(
|
|
833
|
+
c = !1, v.removeEventSubscription(b);
|
|
834
834
|
};
|
|
835
|
-
}, [o]), { login: (c = void 0, v = null,
|
|
836
|
-
const v = await
|
|
835
|
+
}, [o]), { login: (c = void 0, v = null, b = !1) => a(o).loginAsync(c, v, !1, void 0, b), logout: (c = void 0, v = null) => a(o).logoutAsync(c, v), renewTokens: async (c = null) => {
|
|
836
|
+
const v = await a(o).renewTokensAsync(c);
|
|
837
837
|
return {
|
|
838
838
|
// @ts-ignore
|
|
839
839
|
accessToken: v.accessToken,
|
|
@@ -846,119 +846,119 @@ const Be = "default", Ct = (o, s) => async (...r) => await s().fetchWithTokens(o
|
|
|
846
846
|
};
|
|
847
847
|
}, isAuthenticated: r };
|
|
848
848
|
}, Je = { accessToken: null, accessTokenPayload: null }, Vt = (o) => {
|
|
849
|
-
const
|
|
849
|
+
const a = f.get, r = a(o);
|
|
850
850
|
if (r.tokens) {
|
|
851
|
-
const
|
|
851
|
+
const s = r.tokens;
|
|
852
852
|
return {
|
|
853
|
-
accessToken:
|
|
854
|
-
accessTokenPayload:
|
|
855
|
-
generateDemonstrationOfProofOfPossessionAsync: r.configuration.demonstrating_proof_of_possession ? (l, u) => r.generateDemonstrationOfProofOfPossessionAsync(
|
|
853
|
+
accessToken: s.accessToken,
|
|
854
|
+
accessTokenPayload: s.accessTokenPayload,
|
|
855
|
+
generateDemonstrationOfProofOfPossessionAsync: r.configuration.demonstrating_proof_of_possession ? (l, u) => r.generateDemonstrationOfProofOfPossessionAsync(s.accessToken, l, u) : null
|
|
856
856
|
};
|
|
857
857
|
}
|
|
858
858
|
return Je;
|
|
859
859
|
};
|
|
860
|
-
function qt(o,
|
|
861
|
-
return o.configuration.demonstrating_proof_of_possession ? (r,
|
|
860
|
+
function qt(o, a) {
|
|
861
|
+
return o.configuration.demonstrating_proof_of_possession ? (r, s, l = {}) => o.generateDemonstrationOfProofOfPossessionAsync(a.accessToken, r, s, l) : null;
|
|
862
862
|
}
|
|
863
863
|
const Zt = (o = ke) => {
|
|
864
|
-
const
|
|
864
|
+
const a = f.get, [r, s] = A(Vt(o));
|
|
865
865
|
return S(() => {
|
|
866
866
|
let l = !0;
|
|
867
|
-
const u =
|
|
867
|
+
const u = a(o);
|
|
868
868
|
if (u.tokens) {
|
|
869
869
|
const c = u.tokens;
|
|
870
|
-
|
|
870
|
+
s({ accessToken: c.accessToken, accessTokenPayload: c.accessTokenPayload });
|
|
871
871
|
}
|
|
872
|
-
const
|
|
872
|
+
const y = u.subscribeEvents((c, v) => {
|
|
873
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
|
|
875
|
-
|
|
876
|
-
accessToken:
|
|
877
|
-
accessTokenPayload:
|
|
878
|
-
generateDemonstrationOfProofOfPossessionAsync: qt(u,
|
|
874
|
+
const b = u.tokens;
|
|
875
|
+
s(b != null ? {
|
|
876
|
+
accessToken: b.accessToken,
|
|
877
|
+
accessTokenPayload: b.accessTokenPayload,
|
|
878
|
+
generateDemonstrationOfProofOfPossessionAsync: qt(u, b)
|
|
879
879
|
} : Je);
|
|
880
880
|
}
|
|
881
881
|
});
|
|
882
882
|
return () => {
|
|
883
|
-
l = !1, u.removeEventSubscription(
|
|
883
|
+
l = !1, u.removeEventSubscription(y);
|
|
884
884
|
};
|
|
885
885
|
}, [o]), r;
|
|
886
886
|
}, Ke = { idToken: null, idTokenPayload: null }, Bt = (o) => {
|
|
887
|
-
const
|
|
887
|
+
const a = f.get, r = a(o);
|
|
888
888
|
if (r.tokens) {
|
|
889
|
-
const
|
|
890
|
-
return { idToken:
|
|
889
|
+
const s = r.tokens;
|
|
890
|
+
return { idToken: s.idToken, idTokenPayload: s.idTokenPayload };
|
|
891
891
|
}
|
|
892
892
|
return Ke;
|
|
893
893
|
}, er = (o = ke) => {
|
|
894
|
-
const
|
|
894
|
+
const a = f.get, [r, s] = A(Bt(o));
|
|
895
895
|
return S(() => {
|
|
896
896
|
let l = !0;
|
|
897
|
-
const u =
|
|
897
|
+
const u = a(o);
|
|
898
898
|
if (u.tokens) {
|
|
899
899
|
const c = u.tokens;
|
|
900
|
-
|
|
900
|
+
s({ idToken: c.idToken, idTokenPayload: c.idTokenPayload });
|
|
901
901
|
}
|
|
902
|
-
const
|
|
902
|
+
const y = u.subscribeEvents((c, v) => {
|
|
903
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
|
|
905
|
-
|
|
904
|
+
const b = u.tokens;
|
|
905
|
+
s(b != null ? { idToken: b.idToken, idTokenPayload: b.idTokenPayload } : Ke);
|
|
906
906
|
}
|
|
907
907
|
});
|
|
908
908
|
return () => {
|
|
909
|
-
l = !1, u.removeEventSubscription(
|
|
909
|
+
l = !1, u.removeEventSubscription(y);
|
|
910
910
|
};
|
|
911
911
|
}, [o]), r;
|
|
912
912
|
};
|
|
913
913
|
var zt = /* @__PURE__ */ ((o) => (o.Unauthenticated = "Unauthenticated", o.Loading = "Loading user", o.Loaded = "User loaded", o.LoadingError = "Error loading user", o))(zt || {});
|
|
914
|
-
const tr = (o = "default") => {
|
|
915
|
-
const [
|
|
914
|
+
const tr = (o = "default", a = !1) => {
|
|
915
|
+
const [r, s] = A({
|
|
916
916
|
user: null,
|
|
917
917
|
status: "Unauthenticated"
|
|
918
918
|
/* Unauthenticated */
|
|
919
|
-
}), [
|
|
919
|
+
}), [l, u] = A("");
|
|
920
920
|
S(() => {
|
|
921
|
-
const
|
|
922
|
-
let
|
|
923
|
-
if (
|
|
924
|
-
|
|
925
|
-
...
|
|
921
|
+
const c = f.get(o);
|
|
922
|
+
let v = !0;
|
|
923
|
+
if (c && c.tokens) {
|
|
924
|
+
s({
|
|
925
|
+
...r,
|
|
926
926
|
status: "Loading user"
|
|
927
927
|
/* Loading */
|
|
928
928
|
});
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
user:
|
|
929
|
+
const _ = l !== "";
|
|
930
|
+
c.userInfoAsync(_, a).then((k) => {
|
|
931
|
+
v && s({
|
|
932
|
+
user: k,
|
|
933
933
|
status: "User loaded"
|
|
934
934
|
/* Loaded */
|
|
935
935
|
});
|
|
936
|
-
}).catch(() =>
|
|
937
|
-
...
|
|
936
|
+
}).catch(() => s({
|
|
937
|
+
...r,
|
|
938
938
|
status: "Error loading user"
|
|
939
939
|
/* LoadingError */
|
|
940
940
|
}));
|
|
941
941
|
} else
|
|
942
|
-
|
|
942
|
+
s({
|
|
943
943
|
user: null,
|
|
944
944
|
status: "Unauthenticated"
|
|
945
945
|
/* Unauthenticated */
|
|
946
946
|
});
|
|
947
|
-
const
|
|
948
|
-
(
|
|
947
|
+
const b = c.subscribeEvents((_, k) => {
|
|
948
|
+
(_ === f.eventNames.logout_from_another_tab || _ === f.eventNames.logout_from_same_tab) && v && s({
|
|
949
949
|
user: null,
|
|
950
950
|
status: "Unauthenticated"
|
|
951
951
|
/* Unauthenticated */
|
|
952
952
|
});
|
|
953
953
|
});
|
|
954
954
|
return () => {
|
|
955
|
-
|
|
955
|
+
v = !1, c.removeEventSubscription(b);
|
|
956
956
|
};
|
|
957
|
-
}, [
|
|
958
|
-
const
|
|
959
|
-
l
|
|
957
|
+
}, [l]);
|
|
958
|
+
const y = () => {
|
|
959
|
+
u(l + " ");
|
|
960
960
|
};
|
|
961
|
-
return { oidcUser:
|
|
961
|
+
return { oidcUser: r.user, oidcUserLoadingState: r.status, reloadOidcUser: y };
|
|
962
962
|
};
|
|
963
963
|
export {
|
|
964
964
|
or as OidcClient,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(E,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("react"),require("@axa-fr/oidc-client")):typeof define=="function"&&define.amd?define(["exports","react","@axa-fr/oidc-client"],_):(E=typeof globalThis<"u"?globalThis:E||self,_(E["react-oidc"]={},E.React,E.oidcClient))})(this,function(E,_,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 me;function Qe(){if(me)return G;me=1;var s=
|
|
9
|
+
*/var me;function Qe(){if(me)return G;me=1;var s=_,a=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=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 b(l,v,m){var g,O={},C=null,x=null;m!==void 0&&(C=""+m),v.key!==void 0&&(C=""+v.key),v.ref!==void 0&&(x=v.ref);for(g in v)o.call(v,g)&&!f.hasOwnProperty(g)&&(O[g]=v[g]);if(l&&l.defaultProps)for(g in v=l.defaultProps,v)O[g]===void 0&&(O[g]=v[g]);return{$$typeof:a,type:l,key:C,ref:x,props:O,_owner:u.current}}return G.Fragment=n,G.jsx=b,G.jsxs=b,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 ke;function Ze(){return ke||(ke=1,process.env.NODE_ENV!=="production"&&function(){var s=
|
|
17
|
+
*/var ke;function Ze(){return ke||(ke=1,process.env.NODE_ENV!=="production"&&function(){var s=_,a=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),l=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),X=Symbol.iterator,Q="@@iterator";function W(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),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 k=r.map(function(p){return String(p)});k.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,k)}}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===o||e===f||le||e===u||e===m||e===g||ie||e===x||Y||ae||ce||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===O||e.$$typeof===b||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"&&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 o:return"Fragment";case n:return"Portal";case f:return"Profiler";case u:return"StrictMode";case m:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case l:var t=e;return U(t)+".Consumer";case b:var r=e;return U(r._context)+".Provider";case v:return fe(e,e.render,"ForwardRef");case O:var d=e.displayName||null;return d!==null?d:P(e.type)||"Memo";case C:{var y=e,k=y._payload,p=y._init;try{return P(p(k))}catch{return null}}}return null}var M=Object.assign,D=0,V,w,N,xe,Ae,Fe,De;function Ne(){}Ne.__reactDisabledLog=!0;function Et(){{if(D===0){V=console.log,w=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:M({},e,{value:V}),info:M({},e,{value:w}),warn:M({},e,{value:N}),error:M({},e,{value:xe}),group:M({},e,{value:Ae}),groupCollapsed:M({},e,{value:Fe}),groupEnd:M({},e,{value:De})})}D<0&&S("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
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 k;k=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
|
-
`),
|
|
21
|
-
`+h[
|
|
20
|
+
`),T=h.length-1,R=j.length-1;T>=1&&R>=0&&h[T]!==j[R];)R--;for(;T>=1&&R>=0;T--,R--)if(h[T]!==j[R]){if(T!==1||R!==1)do if(T--,R--,R<0||h[T]!==j[R]){var A=`
|
|
21
|
+
`+h[T].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(T>=1&&R>=0);break}}}finally{he=!1,de.current=k,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 Rt(e,t,r){return Ie(e,!1)}function St(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function $(e,t,r){if(e==null)return"";if(typeof e=="function")return Ie(e,St(e));if(typeof e=="string")return Z(e);switch(e){case m:return Z("Suspense");case g:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Rt(e.render);case O:return $(e.type,t,r);case C:{var d=e,y=d._payload,k=d._init;try{return $(k(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 k=Function.call.bind(ee);for(var p in e)if(k(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(T){h=T}h&&!(h instanceof Error)&&(te(y),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).",d||"React class",r,p,typeof h),te(null)),h instanceof Error&&!(h.message in Le)&&(Le[h.message]=!0,te(y),S("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 Me(e),!1}catch{return!0}}function Me(e){return""+e}function We(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)),Me(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]||(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',P(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 Lt(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 Ut=function(e,t,r,d,y,k,p){var h={$$typeof:a,type:e,key:t,ref:r,props:p,_owner:k};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 Mt(e,t,r,d,y){{var k,p={},h=null,j=null;r!==void 0&&(We(r),h=""+r),Dt(t)&&(We(t.key),h=""+t.key),Ft(t)&&(j=t.ref,Nt(t,y));for(k in t)ee.call(t,k)&&!At.hasOwnProperty(k)&&(p[k]=t[k]);if(e&&e.defaultProps){var T=e.defaultProps;for(k in T)p[k]===void 0&&(p[k]=T[k])}if(h||j){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;h&&It(p,R),j&&Lt(p,R)}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===a}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 Wt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),r=e.lineNumber;return`
|
|
24
24
|
|
|
25
25
|
Check your code at `+t+":"+r+"."}return""}}var Ge={};function 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 y=W(e);if(typeof y=="function"&&y!==e.entries)for(var k=y.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 y=P(t);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y||"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,y,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=Wt(y);j?h+=j:h+=ze();var E;e===null?E="null":pe(e)?E="array":e!==void 0&&e.$$typeof===o?(E="<"+(P(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):E=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",E,h)}var w=Mt(e,t,r,y,k);if(w==null)return w;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(w):Vt(w),w}}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 m=c.OidcClient.get;try{const{callbackPath:R}=await m(n).loginCallbackAsync();(a?a():st()).replaceState(R||"/")}catch(R){v&&(console.warn(R),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):"",[m,R]=g.useState(b);g.useEffect(()=>{const x=()=>R(c.getPath(window.location.href));return x(),window.addEventListener("popstate",x,!1),()=>window.removeEventListener("popstate",x,!1)},[]);const C=c.getPath(n);if(a&&m===c.getPath(a))return i.jsx(lt,{configurationName:_});if(u&&m===c.getPath(u))return i.jsx(ut,{configurationName:_});switch(m){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),Re={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:m=null,onLogoutFromSameTab:R=null,withCustomHistory:C=null,onEvent:x=null,getFetch:X=null,location:Q=null})=>{const W=(D="default")=>c.OidcClient.getOrCreate(X??c.getFetchDefault,Q??new c.OidcLocation)(o,D),[L,S]=g.useState(!0),[oe,Y]=g.useState(Re),[ae,ce]=g.useState("default");g.useEffect(()=>{const V=W(n).subscribeEvents((T,N)=>{x&&x(n,T,N)});return()=>{W(n).removeEventSubscription(V)}},[n,x]),g.useEffect(()=>{const V=W(n).subscribeEvents((T,N)=>{if(T===c.OidcClient.eventNames.refreshTokensAsync_error||T===c.OidcClient.eventNames.syncTokensAsync_error){if(b!=null){b();return}Y({name:T,data:N})}else if(T===c.OidcClient.eventNames.logout_from_another_tab){if(m!=null){m();return}Y({name:T,data:N})}else T===c.OidcClient.eventNames.logout_from_same_tab?R!=null&&R():T===c.OidcClient.eventNames.loginAsync_begin||T===c.OidcClient.eventNames.loginCallbackAsync_end||T===c.OidcClient.eventNames.loginAsync_error||T===c.OidcClient.eventNames.loginCallbackAsync_error?Y({name:T,data:N}):T===c.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&Y({name:T,data:N})});return ce(n),S(!1),()=>{W(n).removeEventSubscription(V),Y(Re)}},[o,n]);const ie=v,le=u,F=f,ue=_,fe=l,U=L||ae!==n,P=W(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})})})}},Se=({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(Se,{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((m,R)=>{(m===c.OidcClient.eventNames.logout_from_another_tab||m===c.OidcClient.eventNames.logout_from_same_tab||m===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,u={})=>s.generateDemonstrationOfProofOfPossessionAsync(o.accessToken,n,a,u):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},mt=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},kt=(s=re)=>{const o=c.OidcClient.get,[n,a]=g.useState(mt(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(m=>{l&&n({user:m,status:"User loaded"})}).catch(()=>n({...o,status:"Error loading user"}))}else n({user:null,status:"Unauthenticated"});const v=_.subscribeEvents((b,m)=>{(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(O,"OidcClient",{enumerable:!0,get:()=>c.OidcClient}),Object.defineProperty(O,"OidcLocation",{enumerable:!0,get:()=>c.OidcLocation}),Object.defineProperty(O,"TokenAutomaticRenewMode",{enumerable:!0,get:()=>c.TokenAutomaticRenewMode}),Object.defineProperty(O,"TokenRenewMode",{enumerable:!0,get:()=>c.TokenRenewMode}),O.OidcProvider=ht,O.OidcSecure=Se,O.OidcUserStatus=Ce,O.useOidc=_t,O.useOidcAccessToken=bt,O.useOidcFetch=Ee,O.useOidcIdToken=kt,O.useOidcUser=Ot,O.withOidcFetch=$e,O.withOidcSecure=pt,Object.defineProperty(O,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),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 y=W(e);if(typeof y=="function"&&y!==e.entries)for(var k=y.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===O))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);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y||"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,y,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=Wt(y);j?h+=j:h+=ze();var T;e===null?T="null":pe(e)?T="array":e!==void 0&&e.$$typeof===a?(T="<"+(P(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):T=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",T,h)}var R=Mt(e,t,r,y,k);if(R==null)return R;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===o?Bt(R):Vt(R),R}}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=o,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,a,n=!1)=>async(...o)=>await a().fetchWithTokens(s,n)(...o),$e=(s=null,a=Oe,n=!1)=>o=>u=>{const{fetch:f}=Ee(s||u.fetch,a,n);return i.jsx(o,{...u,fetch:f})},Ee=(s=null,a=Oe,n=!1)=>{const o=s||window.fetch,u=c.OidcClient.get;return{fetch:_.useCallback((b,l)=>qe(o,()=>u(a),n)(b,l),[o,a])}},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,a)=>(n,o)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,o);const u=o||{bubbles:!1,cancelable:!1,detail:void 0},f=a.createEvent("CustomEvent");return f.initCustomEvent(n,u.bubbles,u.cancelable,u.detail),f.prototype=s.Event.prototype,f},rt=(s,a,n)=>({replaceState:(o,u)=>{const f=n(),b=u||s.history.state;s.history.replaceState({key:f,state:b},null,o),s.dispatchEvent(a("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:a,configurationName:n,withCustomHistory:o})=>{const[u,f]=_.useState(!1);_.useEffect(()=>{let v=!0;return(async()=>{const g=c.OidcClient.get;try{const{callbackPath:O}=await g(n).loginCallbackAsync();(o?o():st()).replaceState(O||"/")}catch(O){v&&(console.warn(O),f(!0))}})(),()=>{v=!1}},[]);const b=s||Te,l=a||we;return u?i.jsx(b,{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})=>(_.useEffect(()=>{(async()=>{const n=c.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),i.jsx(i.Fragment,{})),ut=({configurationName:s})=>{const a=c.getParseQueryStringFromLocation(window.location.href),n=c.OidcClient.get,o=n(s);let u=null;for(const[f,b]of Object.entries(a))f==="state"||f==="scope"||(u===null&&(u={}),u[f]=b);return _.useEffect(()=>{o.tokens||o.loginAsync(null,u,!0,a.scope)},[]),i.jsx(i.Fragment,{})},ft=({callbackErrorComponent:s,callbackSuccessComponent:a,redirect_uri:n,silent_redirect_uri:o,silent_login_uri:u,children:f,configurationName:b,withCustomHistory:l=null,location:v})=>{const m=window?c.getPath(window.location.href):"",[g,O]=_.useState(m);_.useEffect(()=>{const x=()=>O(c.getPath(window.location.href));return x(),window.addEventListener("popstate",x,!1),()=>window.removeEventListener("popstate",x,!1)},[]);const C=c.getPath(n);if(o&&g===c.getPath(o))return i.jsx(lt,{configurationName:b});if(u&&g===c.getPath(u))return i.jsx(ut,{configurationName:b});switch(g){case C:return i.jsx(ot,{callBackError:s,callBackSuccess:a,configurationName:b,withCustomHistory:l});default:return i.jsx(i.Fragment,{children:f})}},dt=_.memo(ft),Re={name:"",data:null},vt=({loadingComponent:s,children:a,configurationName:n})=>{const[o,u]=_.useState(!0),f=c.OidcClient.get,b=f(n);_.useEffect(()=>{let v=!0;return b&&b.tryKeepExistingSessionAsync().then(()=>{v&&u(!1)}),()=>{v=!1}},[n]);const l=s;return i.jsx(i.Fragment,{children:o?i.jsx(l,{configurationName:n}):i.jsx(i.Fragment,{children:a})})},K=({isLoading:s,loadingComponent:a,children:n,configurationName:o})=>{const u=a;return s?i.jsx(u,{configurationName:o,children:n}):i.jsx(i.Fragment,{children:n})},ht=({children:s,configuration:a,configurationName:n="default",callbackSuccessComponent:o=we,authenticatingComponent:u=et,loadingComponent:f=at,serviceWorkerNotSupportedComponent:b=ct,authenticatingErrorComponent:l=Te,sessionLostComponent:v=it,onSessionLost:m=null,onLogoutFromAnotherTab:g=null,onLogoutFromSameTab:O=null,withCustomHistory:C=null,onEvent:x=null,getFetch:X=null,location:Q=null})=>{const W=(D="default")=>c.OidcClient.getOrCreate(X??c.getFetchDefault,Q??new c.OidcLocation)(a,D),[L,S]=_.useState(!0),[oe,Y]=_.useState(Re),[ae,ce]=_.useState("default");_.useEffect(()=>{const V=W(n).subscribeEvents((w,N)=>{x&&x(n,w,N)});return()=>{W(n).removeEventSubscription(V)}},[n,x]),_.useEffect(()=>{const V=W(n).subscribeEvents((w,N)=>{if(w===c.OidcClient.eventNames.refreshTokensAsync_error||w===c.OidcClient.eventNames.syncTokensAsync_error){if(m!=null){m();return}Y({name:w,data:N})}else if(w===c.OidcClient.eventNames.logout_from_another_tab){if(g!=null){g();return}Y({name:w,data:N})}else w===c.OidcClient.eventNames.logout_from_same_tab?O!=null&&O():w===c.OidcClient.eventNames.loginAsync_begin||w===c.OidcClient.eventNames.loginCallbackAsync_end||w===c.OidcClient.eventNames.loginAsync_error||w===c.OidcClient.eventNames.loginCallbackAsync_error?Y({name:w,data:N}):w===c.OidcClient.eventNames.service_worker_not_supported_by_browser&&a.service_worker_only===!0&&Y({name:w,data:N})});return ce(n),S(!1),()=>{W(n).removeEventSubscription(V),Y(Re)}},[a,n]);const ie=v,le=u,F=f,ue=b,fe=l,U=L||ae!==n,P=W(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:o,callbackErrorComponent:l,authenticatingComponent:u,configurationName:n,withCustomHistory:C,location:Q??new c.OidcLocation,children:i.jsx(vt,{loadingComponent:F,configurationName:n,children:s})})})}},Se=({children:s,callbackPath:a=null,extras:n=null,configurationName:o="default"})=>{const u=c.OidcClient.get,f=u(o);return _.useEffect(()=>{f.tokens||f.loginAsync(a,n)},[o,a,n]),f.tokens?i.jsx(i.Fragment,{children:s}):null},pt=(s,a=null,n=null,o="default")=>u=>i.jsx(Se,{callbackPath:a,extras:n,configurationName:o,children:i.jsx(s,{...u})}),re="default",se=(s,a)=>{let n=!1;return s(a)&&(n=s(a).tokens!=null),n},_t=(s=re)=>{const a=c.OidcClient.get,[n,o]=_.useState(se(a,s));return _.useEffect(()=>{let l=!0;const v=a(s);o(se(a,s));const m=v.subscribeEvents((g,O)=>{(g===c.OidcClient.eventNames.logout_from_another_tab||g===c.OidcClient.eventNames.logout_from_same_tab||g===c.OidcClient.eventNames.token_aquired)&&l&&o(se(a,s))});return()=>{l=!1,v.removeEventSubscription(m)}},[s]),{login:(l=void 0,v=null,m=!1)=>a(s).loginAsync(l,v,!1,void 0,m),logout:(l=void 0,v=null)=>a(s).logoutAsync(l,v),renewTokens:async(l=null)=>{const v=await a(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 a=c.OidcClient.get,n=a(s);if(n.tokens){const o=n.tokens;return{accessToken:o.accessToken,accessTokenPayload:o.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:n.configuration.demonstrating_proof_of_possession?(u,f)=>n.generateDemonstrationOfProofOfPossessionAsync(o.accessToken,u,f):null}}return je};function yt(s,a){return s.configuration.demonstrating_proof_of_possession?(n,o,u={})=>s.generateDemonstrationOfProofOfPossessionAsync(a.accessToken,n,o,u):null}const bt=(s=re)=>{const a=c.OidcClient.get,[n,o]=_.useState(gt(s));return _.useEffect(()=>{let u=!0;const f=a(s);if(f.tokens){const l=f.tokens;o({accessToken:l.accessToken,accessTokenPayload:l.accessTokenPayload})}const b=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 m=f.tokens;o(m!=null?{accessToken:m.accessToken,accessTokenPayload:m.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:yt(f,m)}:je)}});return()=>{u=!1,f.removeEventSubscription(b)}},[s]),n},Pe={idToken:null,idTokenPayload:null},mt=s=>{const a=c.OidcClient.get,n=a(s);if(n.tokens){const o=n.tokens;return{idToken:o.idToken,idTokenPayload:o.idTokenPayload}}return Pe},kt=(s=re)=>{const a=c.OidcClient.get,[n,o]=_.useState(mt(s));return _.useEffect(()=>{let u=!0;const f=a(s);if(f.tokens){const l=f.tokens;o({idToken:l.idToken,idTokenPayload:l.idTokenPayload})}const b=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 m=f.tokens;o(m!=null?{idToken:m.idToken,idTokenPayload:m.idTokenPayload}:Pe)}});return()=>{u=!1,f.removeEventSubscription(b)}},[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",a=!1)=>{const[n,o]=_.useState({user:null,status:"Unauthenticated"}),[u,f]=_.useState("");_.useEffect(()=>{const l=c.OidcClient.get(s);let v=!0;if(l&&l.tokens){o({...n,status:"Loading user"});const g=u!=="";l.userInfoAsync(g,a).then(O=>{v&&o({user:O,status:"User loaded"})}).catch(()=>o({...n,status:"Error loading user"}))}else o({user:null,status:"Unauthenticated"});const m=l.subscribeEvents((g,O)=>{(g===c.OidcClient.eventNames.logout_from_another_tab||g===c.OidcClient.eventNames.logout_from_same_tab)&&v&&o({user:null,status:"Unauthenticated"})});return()=>{v=!1,l.removeEventSubscription(m)}},[u]);const b=()=>{f(u+" ")};return{oidcUser:n.user,oidcUserLoadingState:n.status,reloadOidcUser:b}};Object.defineProperty(E,"OidcClient",{enumerable:!0,get:()=>c.OidcClient}),Object.defineProperty(E,"OidcLocation",{enumerable:!0,get:()=>c.OidcLocation}),Object.defineProperty(E,"TokenAutomaticRenewMode",{enumerable:!0,get:()=>c.TokenAutomaticRenewMode}),Object.defineProperty(E,"TokenRenewMode",{enumerable:!0,get:()=>c.TokenRenewMode}),E.OidcProvider=ht,E.OidcSecure=Se,E.OidcUserStatus=Ce,E.useOidc=_t,E.useOidcAccessToken=bt,E.useOidcFetch=Ee,E.useOidcIdToken=kt,E.useOidcUser=Ot,E.withOidcFetch=$e,E.withOidcSecure=pt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/react-oidc",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.22.0-alpha.1416",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"lint": "eslint src"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@axa-fr/oidc-client-service-worker": "7.
|
|
44
|
-
"@axa-fr/oidc-client": "7.
|
|
43
|
+
"@axa-fr/oidc-client-service-worker": "7.22.0-alpha.1416",
|
|
44
|
+
"@axa-fr/oidc-client": "7.22.0-alpha.1416"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^17.0.0 || ^18.0.0"
|
package/src/FetchToken.tsx
CHANGED
|
@@ -7,27 +7,27 @@ export interface ComponentWithOidcFetchProps {
|
|
|
7
7
|
|
|
8
8
|
const defaultConfigurationName = 'default';
|
|
9
9
|
|
|
10
|
-
const fetchWithToken = (fetch: Fetch, getOidcWithConfigurationName: () => OidcClient | null) => async (...params: Parameters<Fetch>) => {
|
|
10
|
+
const fetchWithToken = (fetch: Fetch, getOidcWithConfigurationName: () => OidcClient | null, demonstrating_proof_of_possession=false) => async (...params: Parameters<Fetch>) => {
|
|
11
11
|
const oidc = getOidcWithConfigurationName();
|
|
12
|
-
const newFetch = oidc.fetchWithTokens(fetch);
|
|
12
|
+
const newFetch = oidc.fetchWithTokens(fetch, demonstrating_proof_of_possession);
|
|
13
13
|
return await newFetch(...params);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export const withOidcFetch = (fetch: Fetch = null, configurationName = defaultConfigurationName) => (
|
|
16
|
+
export const withOidcFetch = (fetch: Fetch = null, configurationName = defaultConfigurationName, demonstrating_proof_of_possession:boolean=false) => (
|
|
17
17
|
WrappedComponent,
|
|
18
18
|
) => (props: ComponentWithOidcFetchProps) => {
|
|
19
|
-
const { fetch: newFetch } = useOidcFetch(fetch || props.fetch, configurationName);
|
|
19
|
+
const { fetch: newFetch } = useOidcFetch(fetch || props.fetch, configurationName, demonstrating_proof_of_possession);
|
|
20
20
|
return <WrappedComponent {...props} fetch={newFetch} />;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export const useOidcFetch = (fetch: Fetch = null, configurationName = defaultConfigurationName) => {
|
|
23
|
+
export const useOidcFetch = (fetch: Fetch = null, configurationName = defaultConfigurationName, demonstrating_proof_of_possession:boolean=false) => {
|
|
24
24
|
const previousFetch = fetch || window.fetch;
|
|
25
25
|
const getOidc = OidcClient.get;
|
|
26
26
|
|
|
27
27
|
const memoizedFetchCallback = useCallback(
|
|
28
28
|
(input: RequestInfo | URL, init?: RequestInit) => {
|
|
29
29
|
const getOidcWithConfigurationName = () => getOidc(configurationName);
|
|
30
|
-
const newFetch = fetchWithToken(previousFetch, getOidcWithConfigurationName);
|
|
30
|
+
const newFetch = fetchWithToken(previousFetch, getOidcWithConfigurationName, demonstrating_proof_of_possession);
|
|
31
31
|
return newFetch(input, init);
|
|
32
32
|
},
|
|
33
33
|
[previousFetch, configurationName],
|
package/src/User.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type OidcUser<T extends OidcUserInfo = OidcUserInfo> = {
|
|
|
13
13
|
status: OidcUserStatus;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export const useOidcUser = <T extends OidcUserInfo = OidcUserInfo>(configurationName = 'default') => {
|
|
16
|
+
export const useOidcUser = <T extends OidcUserInfo = OidcUserInfo>(configurationName = 'default', demonstrating_proof_of_possession=false) => {
|
|
17
17
|
const [oidcUser, setOidcUser] = useState<OidcUser<T>>({ user: null, status: OidcUserStatus.Unauthenticated });
|
|
18
18
|
const [oidcUserId, setOidcUserId] = useState<string>('');
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ export const useOidcUser = <T extends OidcUserInfo = OidcUserInfo>(configuration
|
|
|
23
23
|
if (oidc && oidc.tokens) {
|
|
24
24
|
setOidcUser({ ...oidcUser, status: OidcUserStatus.Loading });
|
|
25
25
|
const isNoCache = oidcUserId !== '';
|
|
26
|
-
oidc.userInfoAsync(isNoCache)
|
|
26
|
+
oidc.userInfoAsync(isNoCache, demonstrating_proof_of_possession)
|
|
27
27
|
.then((info) => {
|
|
28
28
|
if (isMounted) {
|
|
29
29
|
// @ts-ignore
|