@axa-fr/react-oidc 7.22.4-alpha.1424 → 7.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/User.d.ts.map +1 -1
- package/dist/index.js +198 -198
- package/dist/index.umd.cjs +8 -8
- package/package.json +3 -3
- package/src/User.ts +7 -5
package/dist/User.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../src/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAGpE,oBAAY,cAAc;IACtB,eAAe,oBAAmB;IAClC,OAAO,iBAAiB;IACxB,MAAM,gBAAgB;IACtB,YAAY,uBAAuB;CACtC;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IAC1D,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;CAC1B,CAAA;AAED,eAAO,MAAM,WAAW;;;;
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../src/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAGpE,oBAAY,cAAc;IACtB,eAAe,oBAAmB;IAClC,OAAO,iBAAiB;IACxB,MAAM,gBAAgB;IACtB,YAAY,uBAAuB;CACtC;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI;IAC1D,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;CAC1B,CAAA;AAED,eAAO,MAAM,WAAW;;;;CA8CvB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import me, { useCallback as kt, useState as
|
|
2
|
-
import { OidcClient as d, getParseQueryStringFromLocation as Et, getPath as
|
|
1
|
+
import me, { useCallback as kt, useState as S, useEffect as A } from "react";
|
|
2
|
+
import { OidcClient as d, getParseQueryStringFromLocation as Et, getPath as J, OidcLocation as Ye, getFetchDefault as Tt } from "@axa-fr/oidc-client";
|
|
3
3
|
import { OidcClient as or, OidcLocation as sr, TokenAutomaticRenewMode as ar, TokenRenewMode as ir } from "@axa-fr/oidc-client";
|
|
4
|
-
var be = { exports: {} },
|
|
4
|
+
var be = { exports: {} }, K = {};
|
|
5
5
|
/**
|
|
6
6
|
* @license React
|
|
7
7
|
* react-jsx-runtime.production.min.js
|
|
@@ -14,22 +14,22 @@ var be = { exports: {} }, G = {};
|
|
|
14
14
|
var $e;
|
|
15
15
|
function wt() {
|
|
16
16
|
if ($e)
|
|
17
|
-
return
|
|
17
|
+
return K;
|
|
18
18
|
$e = 1;
|
|
19
19
|
var o = me, a = Symbol.for("react.element"), r = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, c = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
-
function
|
|
21
|
-
var b, k = {},
|
|
22
|
-
|
|
20
|
+
function _(u, v, y) {
|
|
21
|
+
var b, k = {}, C = null, x = null;
|
|
22
|
+
y !== void 0 && (C = "" + y), v.key !== void 0 && (C = "" + v.key), v.ref !== void 0 && (x = v.ref);
|
|
23
23
|
for (b in v)
|
|
24
24
|
s.call(v, b) && !l.hasOwnProperty(b) && (k[b] = v[b]);
|
|
25
25
|
if (u && u.defaultProps)
|
|
26
26
|
for (b in v = u.defaultProps, v)
|
|
27
27
|
k[b] === void 0 && (k[b] = v[b]);
|
|
28
|
-
return { $$typeof: a, type: u, key:
|
|
28
|
+
return { $$typeof: a, type: u, key: C, ref: x, props: k, _owner: c.current };
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return K.Fragment = r, K.jsx = _, K.jsxs = _, K;
|
|
31
31
|
}
|
|
32
|
-
var
|
|
32
|
+
var H = {};
|
|
33
33
|
/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-jsx-runtime.development.js
|
|
@@ -42,15 +42,15 @@ 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, a = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"),
|
|
46
|
-
function
|
|
45
|
+
var o = me, a = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), _ = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), k = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), F = Symbol.iterator, V = "@@iterator";
|
|
46
|
+
function Y(e) {
|
|
47
47
|
if (e === null || typeof e != "object")
|
|
48
48
|
return null;
|
|
49
|
-
var t =
|
|
49
|
+
var t = F && e[F] || e[V];
|
|
50
50
|
return typeof t == "function" ? t : null;
|
|
51
51
|
}
|
|
52
|
-
var
|
|
53
|
-
function
|
|
52
|
+
var U = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
53
|
+
function O(e) {
|
|
54
54
|
{
|
|
55
55
|
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), f = 1; f < t; f++)
|
|
56
56
|
n[f - 1] = arguments[f];
|
|
@@ -59,37 +59,37 @@ function Ot() {
|
|
|
59
59
|
}
|
|
60
60
|
function ne(e, t, n) {
|
|
61
61
|
{
|
|
62
|
-
var f =
|
|
63
|
-
|
|
62
|
+
var f = U.ReactDebugCurrentFrame, g = f.getStackAddendum();
|
|
63
|
+
g !== "" && (t += "%s", n = n.concat([g]));
|
|
64
64
|
var m = n.map(function(p) {
|
|
65
65
|
return String(p);
|
|
66
66
|
});
|
|
67
67
|
m.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, m);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
var
|
|
71
|
-
|
|
70
|
+
var $ = !1, oe = !1, se = !1, ae = !1, ie = !1, I;
|
|
71
|
+
I = Symbol.for("react.module.reference");
|
|
72
72
|
function ce(e) {
|
|
73
|
-
return !!(typeof e == "string" || typeof e == "function" || e === s || e === l || ie || e === c || e ===
|
|
73
|
+
return !!(typeof e == "string" || typeof e == "function" || e === s || e === l || ie || e === c || e === y || e === b || ae || e === x || $ || oe || se || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === k || e.$$typeof === _ || e.$$typeof === u || 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
|
-
e.$$typeof ===
|
|
77
|
+
e.$$typeof === I || e.getModuleId !== void 0));
|
|
78
78
|
}
|
|
79
79
|
function le(e, t, n) {
|
|
80
80
|
var f = e.displayName;
|
|
81
81
|
if (f)
|
|
82
82
|
return f;
|
|
83
|
-
var
|
|
84
|
-
return
|
|
83
|
+
var g = t.displayName || t.name || "";
|
|
84
|
+
return g !== "" ? n + "(" + g + ")" : n;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function W(e) {
|
|
87
87
|
return e.displayName || "Context";
|
|
88
88
|
}
|
|
89
89
|
function j(e) {
|
|
90
90
|
if (e == null)
|
|
91
91
|
return null;
|
|
92
|
-
if (typeof e.tag == "number" &&
|
|
92
|
+
if (typeof e.tag == "number" && O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
93
93
|
return e.displayName || e.name || null;
|
|
94
94
|
if (typeof e == "string")
|
|
95
95
|
return e;
|
|
@@ -102,7 +102,7 @@ function Ot() {
|
|
|
102
102
|
return "Profiler";
|
|
103
103
|
case c:
|
|
104
104
|
return "StrictMode";
|
|
105
|
-
case
|
|
105
|
+
case y:
|
|
106
106
|
return "Suspense";
|
|
107
107
|
case b:
|
|
108
108
|
return "SuspenseList";
|
|
@@ -111,17 +111,17 @@ function Ot() {
|
|
|
111
111
|
switch (e.$$typeof) {
|
|
112
112
|
case u:
|
|
113
113
|
var t = e;
|
|
114
|
-
return
|
|
115
|
-
case
|
|
114
|
+
return W(t) + ".Consumer";
|
|
115
|
+
case _:
|
|
116
116
|
var n = e;
|
|
117
|
-
return
|
|
117
|
+
return W(n._context) + ".Provider";
|
|
118
118
|
case v:
|
|
119
119
|
return le(e, e.render, "ForwardRef");
|
|
120
120
|
case k:
|
|
121
121
|
var f = e.displayName || null;
|
|
122
122
|
return f !== null ? f : j(e.type) || "Memo";
|
|
123
|
-
case
|
|
124
|
-
var
|
|
123
|
+
case C: {
|
|
124
|
+
var g = e, m = g._payload, p = g._init;
|
|
125
125
|
try {
|
|
126
126
|
return j(p(m));
|
|
127
127
|
} catch {
|
|
@@ -131,14 +131,14 @@ function Ot() {
|
|
|
131
131
|
}
|
|
132
132
|
return null;
|
|
133
133
|
}
|
|
134
|
-
var
|
|
134
|
+
var M = Object.assign, D = 0, q, 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
|
-
|
|
141
|
+
q = 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,
|
|
@@ -167,40 +167,40 @@ function Ot() {
|
|
|
167
167
|
writable: !0
|
|
168
168
|
};
|
|
169
169
|
Object.defineProperties(console, {
|
|
170
|
-
log:
|
|
171
|
-
value:
|
|
170
|
+
log: M({}, e, {
|
|
171
|
+
value: q
|
|
172
172
|
}),
|
|
173
|
-
info:
|
|
173
|
+
info: M({}, e, {
|
|
174
174
|
value: T
|
|
175
175
|
}),
|
|
176
|
-
warn:
|
|
177
|
-
value:
|
|
176
|
+
warn: M({}, e, {
|
|
177
|
+
value: N
|
|
178
178
|
}),
|
|
179
|
-
error:
|
|
179
|
+
error: M({}, e, {
|
|
180
180
|
value: Ee
|
|
181
181
|
}),
|
|
182
|
-
group:
|
|
182
|
+
group: M({}, e, {
|
|
183
183
|
value: Te
|
|
184
184
|
}),
|
|
185
|
-
groupCollapsed:
|
|
185
|
+
groupCollapsed: M({}, e, {
|
|
186
186
|
value: we
|
|
187
187
|
}),
|
|
188
|
-
groupEnd:
|
|
188
|
+
groupEnd: M({}, e, {
|
|
189
189
|
value: Oe
|
|
190
190
|
})
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
-
D < 0 &&
|
|
193
|
+
D < 0 && O("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
var ue =
|
|
196
|
+
var ue = U.ReactCurrentDispatcher, de;
|
|
197
197
|
function Q(e, t, n) {
|
|
198
198
|
{
|
|
199
199
|
if (de === void 0)
|
|
200
200
|
try {
|
|
201
201
|
throw Error();
|
|
202
|
-
} catch (
|
|
203
|
-
var f =
|
|
202
|
+
} catch (g) {
|
|
203
|
+
var f = g.stack.trim().match(/\n( *(at )?)/);
|
|
204
204
|
de = f && f[1] || "";
|
|
205
205
|
}
|
|
206
206
|
return `
|
|
@@ -222,7 +222,7 @@ function Ot() {
|
|
|
222
222
|
}
|
|
223
223
|
var f;
|
|
224
224
|
fe = !0;
|
|
225
|
-
var
|
|
225
|
+
var g = Error.prepareStackTrace;
|
|
226
226
|
Error.prepareStackTrace = void 0;
|
|
227
227
|
var m;
|
|
228
228
|
m = ue.current, ue.current = null, He();
|
|
@@ -238,29 +238,29 @@ function Ot() {
|
|
|
238
238
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
239
239
|
try {
|
|
240
240
|
Reflect.construct(p, []);
|
|
241
|
-
} catch (
|
|
242
|
-
f =
|
|
241
|
+
} catch (L) {
|
|
242
|
+
f = L;
|
|
243
243
|
}
|
|
244
244
|
Reflect.construct(e, [], p);
|
|
245
245
|
} else {
|
|
246
246
|
try {
|
|
247
247
|
p.call();
|
|
248
|
-
} catch (
|
|
249
|
-
f =
|
|
248
|
+
} catch (L) {
|
|
249
|
+
f = L;
|
|
250
250
|
}
|
|
251
251
|
e.call(p.prototype);
|
|
252
252
|
}
|
|
253
253
|
} else {
|
|
254
254
|
try {
|
|
255
255
|
throw Error();
|
|
256
|
-
} catch (
|
|
257
|
-
f =
|
|
256
|
+
} catch (L) {
|
|
257
|
+
f = L;
|
|
258
258
|
}
|
|
259
259
|
e();
|
|
260
260
|
}
|
|
261
|
-
} catch (
|
|
262
|
-
if (
|
|
263
|
-
for (var h =
|
|
261
|
+
} catch (L) {
|
|
262
|
+
if (L && f && typeof L.stack == "string") {
|
|
263
|
+
for (var h = L.stack.split(`
|
|
264
264
|
`), R = f.stack.split(`
|
|
265
265
|
`), E = h.length - 1, w = R.length - 1; E >= 1 && w >= 0 && h[E] !== R[w]; )
|
|
266
266
|
w--;
|
|
@@ -278,9 +278,9 @@ function Ot() {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
} finally {
|
|
281
|
-
fe = !1, ue.current = m, Xe(), Error.prepareStackTrace =
|
|
281
|
+
fe = !1, ue.current = m, Xe(), Error.prepareStackTrace = g;
|
|
282
282
|
}
|
|
283
|
-
var
|
|
283
|
+
var z = e ? e.displayName || e.name : "", Me = z ? Q(z) : "";
|
|
284
284
|
return typeof e == "function" && Z.set(e, Me), Me;
|
|
285
285
|
}
|
|
286
286
|
function Ze(e, t, n) {
|
|
@@ -298,7 +298,7 @@ function Ot() {
|
|
|
298
298
|
if (typeof e == "string")
|
|
299
299
|
return Q(e);
|
|
300
300
|
switch (e) {
|
|
301
|
-
case
|
|
301
|
+
case y:
|
|
302
302
|
return Q("Suspense");
|
|
303
303
|
case b:
|
|
304
304
|
return Q("SuspenseList");
|
|
@@ -309,17 +309,17 @@ function Ot() {
|
|
|
309
309
|
return Ze(e.render);
|
|
310
310
|
case k:
|
|
311
311
|
return ee(e.type, t, n);
|
|
312
|
-
case
|
|
313
|
-
var f = e,
|
|
312
|
+
case C: {
|
|
313
|
+
var f = e, g = f._payload, m = f._init;
|
|
314
314
|
try {
|
|
315
|
-
return ee(m(
|
|
315
|
+
return ee(m(g), t, n);
|
|
316
316
|
} catch {
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
return "";
|
|
321
321
|
}
|
|
322
|
-
var te = Object.prototype.hasOwnProperty, xe = {}, je =
|
|
322
|
+
var te = Object.prototype.hasOwnProperty, xe = {}, je = U.ReactDebugCurrentFrame;
|
|
323
323
|
function re(e) {
|
|
324
324
|
if (e) {
|
|
325
325
|
var t = e._owner, n = ee(e.type, e._source, t ? t.type : null);
|
|
@@ -327,7 +327,7 @@ function Ot() {
|
|
|
327
327
|
} else
|
|
328
328
|
je.setExtraStackFrame(null);
|
|
329
329
|
}
|
|
330
|
-
function tt(e, t, n, f,
|
|
330
|
+
function tt(e, t, n, f, g) {
|
|
331
331
|
{
|
|
332
332
|
var m = Function.call.bind(te);
|
|
333
333
|
for (var p in e)
|
|
@@ -342,7 +342,7 @@ function Ot() {
|
|
|
342
342
|
} catch (E) {
|
|
343
343
|
h = E;
|
|
344
344
|
}
|
|
345
|
-
h && !(h instanceof Error) && (re(
|
|
345
|
+
h && !(h instanceof Error) && (re(g), O("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", f || "React class", n, p, typeof h), re(null)), h instanceof Error && !(h.message in xe) && (xe[h.message] = !0, re(g), O("Failed %s type: %s", n, h.message), re(null));
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
@@ -368,9 +368,9 @@ function Ot() {
|
|
|
368
368
|
}
|
|
369
369
|
function Se(e) {
|
|
370
370
|
if (ot(e))
|
|
371
|
-
return
|
|
371
|
+
return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", nt(e)), Pe(e);
|
|
372
372
|
}
|
|
373
|
-
var
|
|
373
|
+
var G = U.ReactCurrentOwner, st = {
|
|
374
374
|
key: !0,
|
|
375
375
|
ref: !0,
|
|
376
376
|
__self: !0,
|
|
@@ -394,15 +394,15 @@ function Ot() {
|
|
|
394
394
|
return e.key !== void 0;
|
|
395
395
|
}
|
|
396
396
|
function ct(e, t) {
|
|
397
|
-
if (typeof e.ref == "string" &&
|
|
398
|
-
var n = j(
|
|
399
|
-
he[n] || (
|
|
397
|
+
if (typeof e.ref == "string" && G.current && t && G.current.stateNode !== t) {
|
|
398
|
+
var n = j(G.current.type);
|
|
399
|
+
he[n] || (O('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', j(G.current.type), e.ref), he[n] = !0);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
function lt(e, t) {
|
|
403
403
|
{
|
|
404
404
|
var n = function() {
|
|
405
|
-
Ae || (Ae = !0,
|
|
405
|
+
Ae || (Ae = !0, O("%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));
|
|
406
406
|
};
|
|
407
407
|
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
408
408
|
get: n,
|
|
@@ -413,7 +413,7 @@ function Ot() {
|
|
|
413
413
|
function ut(e, t) {
|
|
414
414
|
{
|
|
415
415
|
var n = function() {
|
|
416
|
-
Fe || (Fe = !0,
|
|
416
|
+
Fe || (Fe = !0, O("%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));
|
|
417
417
|
};
|
|
418
418
|
n.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
419
419
|
get: n,
|
|
@@ -421,7 +421,7 @@ function Ot() {
|
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
var dt = function(e, t, n, f,
|
|
424
|
+
var dt = function(e, t, n, f, g, m, p) {
|
|
425
425
|
var h = {
|
|
426
426
|
// This tag allows us to uniquely identify this as a React Element
|
|
427
427
|
$$typeof: a,
|
|
@@ -447,13 +447,13 @@ function Ot() {
|
|
|
447
447
|
configurable: !1,
|
|
448
448
|
enumerable: !1,
|
|
449
449
|
writable: !1,
|
|
450
|
-
value:
|
|
450
|
+
value: g
|
|
451
451
|
}), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
|
|
452
452
|
};
|
|
453
|
-
function ft(e, t, n, f,
|
|
453
|
+
function ft(e, t, n, f, g) {
|
|
454
454
|
{
|
|
455
455
|
var m, p = {}, h = null, R = null;
|
|
456
|
-
n !== void 0 && (Se(n), h = "" + n), it(t) && (Se(t.key), h = "" + t.key), at(t) && (R = t.ref, ct(t,
|
|
456
|
+
n !== void 0 && (Se(n), h = "" + n), it(t) && (Se(t.key), h = "" + t.key), at(t) && (R = t.ref, ct(t, g));
|
|
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) {
|
|
@@ -465,23 +465,23 @@ function Ot() {
|
|
|
465
465
|
var w = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
466
466
|
h && lt(p, w), R && ut(p, w);
|
|
467
467
|
}
|
|
468
|
-
return dt(e, h, R,
|
|
468
|
+
return dt(e, h, R, g, f, G.current, p);
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
var pe =
|
|
472
|
-
function
|
|
471
|
+
var pe = U.ReactCurrentOwner, Ie = U.ReactDebugCurrentFrame;
|
|
472
|
+
function B(e) {
|
|
473
473
|
if (e) {
|
|
474
474
|
var t = e._owner, n = ee(e.type, e._source, t ? t.type : null);
|
|
475
|
-
|
|
475
|
+
Ie.setExtraStackFrame(n);
|
|
476
476
|
} else
|
|
477
|
-
|
|
477
|
+
Ie.setExtraStackFrame(null);
|
|
478
478
|
}
|
|
479
479
|
var _e;
|
|
480
480
|
_e = !1;
|
|
481
481
|
function ge(e) {
|
|
482
482
|
return typeof e == "object" && e !== null && e.$$typeof === a;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function De() {
|
|
485
485
|
{
|
|
486
486
|
if (pe.current) {
|
|
487
487
|
var e = j(pe.current.type);
|
|
@@ -507,7 +507,7 @@ Check your code at ` + t + ":" + n + ".";
|
|
|
507
507
|
var Ne = {};
|
|
508
508
|
function ht(e) {
|
|
509
509
|
{
|
|
510
|
-
var t =
|
|
510
|
+
var t = De();
|
|
511
511
|
if (!t) {
|
|
512
512
|
var n = typeof e == "string" ? e : e.displayName || e.name;
|
|
513
513
|
n && (t = `
|
|
@@ -527,7 +527,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
527
527
|
return;
|
|
528
528
|
Ne[n] = !0;
|
|
529
529
|
var f = "";
|
|
530
|
-
e && e._owner && e._owner !== pe.current && (f = " It was passed a child from " + j(e._owner.type) + "."),
|
|
530
|
+
e && e._owner && e._owner !== pe.current && (f = " It was passed a child from " + j(e._owner.type) + "."), B(e), O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, f), B(null);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
function Ue(e, t) {
|
|
@@ -542,9 +542,9 @@ Check the top-level render call using <` + n + ">.");
|
|
|
542
542
|
else if (ge(e))
|
|
543
543
|
e._store && (e._store.validated = !0);
|
|
544
544
|
else if (e) {
|
|
545
|
-
var
|
|
546
|
-
if (typeof
|
|
547
|
-
for (var m =
|
|
545
|
+
var g = Y(e);
|
|
546
|
+
if (typeof g == "function" && g !== e.entries)
|
|
547
|
+
for (var m = g.call(e), p; !(p = m.next()).done; )
|
|
548
548
|
ge(p.value) && Le(p.value, t);
|
|
549
549
|
}
|
|
550
550
|
}
|
|
@@ -568,10 +568,10 @@ Check the top-level render call using <` + n + ">.");
|
|
|
568
568
|
tt(n, e.props, "prop", f, e);
|
|
569
569
|
} else if (t.PropTypes !== void 0 && !_e) {
|
|
570
570
|
_e = !0;
|
|
571
|
-
var
|
|
572
|
-
|
|
571
|
+
var g = j(t);
|
|
572
|
+
O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", g || "Unknown");
|
|
573
573
|
}
|
|
574
|
-
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved &&
|
|
574
|
+
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
function _t(e) {
|
|
@@ -579,25 +579,25 @@ Check the top-level render call using <` + n + ">.");
|
|
|
579
579
|
for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
|
|
580
580
|
var f = t[n];
|
|
581
581
|
if (f !== "children" && f !== "key") {
|
|
582
|
-
|
|
582
|
+
B(e), O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", f), B(null);
|
|
583
583
|
break;
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
|
-
e.ref !== null && (
|
|
586
|
+
e.ref !== null && (B(e), O("Invalid attribute `ref` supplied to `React.Fragment`."), B(null));
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
function We(e, t, n, f,
|
|
589
|
+
function We(e, t, n, f, g, m) {
|
|
590
590
|
{
|
|
591
591
|
var p = ce(e);
|
|
592
592
|
if (!p) {
|
|
593
593
|
var h = "";
|
|
594
594
|
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
595
|
-
var R = vt(
|
|
596
|
-
R ? h += R : h +=
|
|
595
|
+
var R = vt(g);
|
|
596
|
+
R ? h += R : h += De();
|
|
597
597
|
var E;
|
|
598
|
-
e === null ? E = "null" : ve(e) ? E = "array" : e !== void 0 && e.$$typeof === a ? (E = "<" + (j(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e,
|
|
598
|
+
e === null ? E = "null" : ve(e) ? E = "array" : e !== void 0 && e.$$typeof === a ? (E = "<" + (j(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 w = ft(e, t, n,
|
|
600
|
+
var w = ft(e, t, n, g, m);
|
|
601
601
|
if (w == null)
|
|
602
602
|
return w;
|
|
603
603
|
if (p) {
|
|
@@ -605,11 +605,11 @@ Check the top-level render call using <` + n + ">.");
|
|
|
605
605
|
if (P !== void 0)
|
|
606
606
|
if (f)
|
|
607
607
|
if (ve(P)) {
|
|
608
|
-
for (var
|
|
609
|
-
Ue(P[
|
|
608
|
+
for (var z = 0; z < P.length; z++)
|
|
609
|
+
Ue(P[z], e);
|
|
610
610
|
Object.freeze && Object.freeze(P);
|
|
611
611
|
} else
|
|
612
|
-
|
|
612
|
+
O("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
613
613
|
else
|
|
614
614
|
Ue(P, e);
|
|
615
615
|
}
|
|
@@ -623,8 +623,8 @@ Check the top-level render call using <` + n + ">.");
|
|
|
623
623
|
return We(e, t, n, !1);
|
|
624
624
|
}
|
|
625
625
|
var bt = yt, mt = gt;
|
|
626
|
-
|
|
627
|
-
}()),
|
|
626
|
+
H.Fragment = s, H.jsx = bt, H.jsxs = mt;
|
|
627
|
+
}()), H;
|
|
628
628
|
}
|
|
629
629
|
process.env.NODE_ENV === "production" ? be.exports = wt() : be.exports = Ot();
|
|
630
630
|
var i = be.exports;
|
|
@@ -634,7 +634,7 @@ const Be = "default", Ct = (o, a, r = !1) => async (...s) => await a().fetchWith
|
|
|
634
634
|
}, Rt = (o = null, a = Be, r = !1) => {
|
|
635
635
|
const s = o || window.fetch, c = d.get;
|
|
636
636
|
return { fetch: kt(
|
|
637
|
-
(
|
|
637
|
+
(_, u) => Ct(s, () => c(a), r)(_, u),
|
|
638
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: [
|
|
@@ -650,15 +650,15 @@ const Be = "default", Ct = (o, a, r = !1) => async (...s) => await a().fetchWith
|
|
|
650
650
|
return l.initCustomEvent(r, c.bubbles, c.cancelable, c.detail), l.prototype = o.Event.prototype, l;
|
|
651
651
|
}, St = (o, a, r) => ({
|
|
652
652
|
replaceState: (s, c) => {
|
|
653
|
-
const l = r(),
|
|
654
|
-
o.history.replaceState({ key: l, state:
|
|
653
|
+
const l = r(), _ = c || o.history.state;
|
|
654
|
+
o.history.replaceState({ key: l, state: _ }, 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
659
|
] }) }), Ft = ({ callBackError: o, callBackSuccess: a, configurationName: r, withCustomHistory: s }) => {
|
|
660
|
-
const [c, l] =
|
|
661
|
-
|
|
660
|
+
const [c, l] = S(!1);
|
|
661
|
+
A(() => {
|
|
662
662
|
let v = !0;
|
|
663
663
|
return (async () => {
|
|
664
664
|
const b = d.get;
|
|
@@ -672,15 +672,15 @@ const Be = "default", Ct = (o, a, r = !1) => async (...s) => await a().fetchWith
|
|
|
672
672
|
v = !1;
|
|
673
673
|
};
|
|
674
674
|
}, []);
|
|
675
|
-
const
|
|
676
|
-
return c ? /* @__PURE__ */ i.jsx(
|
|
677
|
-
},
|
|
675
|
+
const _ = o || ze, u = a || Ge;
|
|
676
|
+
return c ? /* @__PURE__ */ i.jsx(_, { configurationName: r }) : /* @__PURE__ */ i.jsx(u, { configurationName: r });
|
|
677
|
+
}, It = () => /* @__PURE__ */ i.jsx("span", { className: "oidc-loading", children: "Loading" }), Dt = () => /* @__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." })
|
|
680
680
|
] }) }), Nt = () => /* @__PURE__ */ i.jsx("div", { className: "oidc-session-lost", children: /* @__PURE__ */ i.jsxs("div", { className: "oidc-session-lost__container", children: [
|
|
681
681
|
/* @__PURE__ */ i.jsx("h1", { className: "oidc-session-lost__title", children: "Session timed out" }),
|
|
682
682
|
/* @__PURE__ */ i.jsx("p", { className: "oidc-session-lost__content", children: "Your session has expired. Please re-authenticate." })
|
|
683
|
-
] }) }), Lt = ({ configurationName: o }) => (
|
|
683
|
+
] }) }), Lt = ({ configurationName: o }) => (A(() => {
|
|
684
684
|
(async () => {
|
|
685
685
|
const r = d.get;
|
|
686
686
|
r(o).silentLoginCallbackAsync();
|
|
@@ -688,9 +688,9 @@ const Be = "default", Ct = (o, a, r = !1) => async (...s) => await a().fetchWith
|
|
|
688
688
|
}, []), /* @__PURE__ */ i.jsx(i.Fragment, {})), Ut = ({ configurationName: o }) => {
|
|
689
689
|
const a = Et(window.location.href), r = d.get, s = r(o);
|
|
690
690
|
let c = null;
|
|
691
|
-
for (const [l,
|
|
692
|
-
l === "state" || l === "scope" || (c === null && (c = {}), c[l] =
|
|
693
|
-
return
|
|
691
|
+
for (const [l, _] of Object.entries(a))
|
|
692
|
+
l === "state" || l === "scope" || (c === null && (c = {}), c[l] = _);
|
|
693
|
+
return A(() => {
|
|
694
694
|
s.tokens || s.loginAsync(null, c, !0, a.scope);
|
|
695
695
|
}, []), /* @__PURE__ */ i.jsx(i.Fragment, {});
|
|
696
696
|
}, Wt = ({
|
|
@@ -700,31 +700,31 @@ const Be = "default", Ct = (o, a, r = !1) => async (...s) => await a().fetchWith
|
|
|
700
700
|
silent_redirect_uri: s,
|
|
701
701
|
silent_login_uri: c,
|
|
702
702
|
children: l,
|
|
703
|
-
configurationName:
|
|
703
|
+
configurationName: _,
|
|
704
704
|
withCustomHistory: u = null,
|
|
705
705
|
location: v
|
|
706
706
|
}) => {
|
|
707
|
-
const
|
|
708
|
-
|
|
709
|
-
const x = () => k(
|
|
707
|
+
const y = window ? J(window.location.href) : "", [b, k] = S(y);
|
|
708
|
+
A(() => {
|
|
709
|
+
const x = () => k(J(window.location.href));
|
|
710
710
|
return x(), window.addEventListener("popstate", x, !1), () => window.removeEventListener("popstate", x, !1);
|
|
711
711
|
}, []);
|
|
712
|
-
const
|
|
713
|
-
if (s && b ===
|
|
714
|
-
return /* @__PURE__ */ i.jsx(Lt, { configurationName:
|
|
715
|
-
if (c && b ===
|
|
716
|
-
return /* @__PURE__ */ i.jsx(Ut, { configurationName:
|
|
712
|
+
const C = J(r);
|
|
713
|
+
if (s && b === J(s))
|
|
714
|
+
return /* @__PURE__ */ i.jsx(Lt, { configurationName: _ });
|
|
715
|
+
if (c && b === J(c))
|
|
716
|
+
return /* @__PURE__ */ i.jsx(Ut, { configurationName: _ });
|
|
717
717
|
switch (b) {
|
|
718
|
-
case
|
|
719
|
-
return /* @__PURE__ */ i.jsx(Ft, { callBackError: o, callBackSuccess: a, configurationName:
|
|
718
|
+
case C:
|
|
719
|
+
return /* @__PURE__ */ i.jsx(Ft, { callBackError: o, callBackSuccess: a, configurationName: _, withCustomHistory: u });
|
|
720
720
|
default:
|
|
721
721
|
return /* @__PURE__ */ i.jsx(i.Fragment, { children: l });
|
|
722
722
|
}
|
|
723
723
|
}, Mt = me.memo(Wt), qe = { name: "", data: null }, Yt = ({ loadingComponent: o, children: a, configurationName: r }) => {
|
|
724
|
-
const [s, c] =
|
|
725
|
-
|
|
724
|
+
const [s, c] = S(!0), l = d.get, _ = l(r);
|
|
725
|
+
A(() => {
|
|
726
726
|
let v = !0;
|
|
727
|
-
return
|
|
727
|
+
return _ && _.tryKeepExistingSessionAsync().then(() => {
|
|
728
728
|
v && c(!1);
|
|
729
729
|
}), () => {
|
|
730
730
|
v = !1;
|
|
@@ -732,7 +732,7 @@ const Be = "default", Ct = (o, a, r = !1) => async (...s) => await a().fetchWith
|
|
|
732
732
|
}, [r]);
|
|
733
733
|
const u = o;
|
|
734
734
|
return /* @__PURE__ */ i.jsx(i.Fragment, { children: s ? /* @__PURE__ */ i.jsx(u, { configurationName: r }) : /* @__PURE__ */ i.jsx(i.Fragment, { children: a }) });
|
|
735
|
-
},
|
|
735
|
+
}, X = ({ isLoading: o, loadingComponent: a, children: r, configurationName: s }) => {
|
|
736
736
|
const c = a;
|
|
737
737
|
return o ? /* @__PURE__ */ i.jsx(c, { configurationName: s, children: r }) : /* @__PURE__ */ i.jsx(i.Fragment, { children: r });
|
|
738
738
|
}, Ht = ({
|
|
@@ -741,62 +741,62 @@ const Be = "default", Ct = (o, a, r = !1) => async (...s) => await a().fetchWith
|
|
|
741
741
|
configurationName: r = "default",
|
|
742
742
|
callbackSuccessComponent: s = Ge,
|
|
743
743
|
authenticatingComponent: c = xt,
|
|
744
|
-
loadingComponent: l =
|
|
745
|
-
serviceWorkerNotSupportedComponent:
|
|
744
|
+
loadingComponent: l = It,
|
|
745
|
+
serviceWorkerNotSupportedComponent: _ = Dt,
|
|
746
746
|
authenticatingErrorComponent: u = ze,
|
|
747
747
|
sessionLostComponent: v = Nt,
|
|
748
|
-
onSessionLost:
|
|
748
|
+
onSessionLost: y = null,
|
|
749
749
|
onLogoutFromAnotherTab: b = null,
|
|
750
750
|
onLogoutFromSameTab: k = null,
|
|
751
|
-
withCustomHistory:
|
|
751
|
+
withCustomHistory: C = null,
|
|
752
752
|
onEvent: x = null,
|
|
753
|
-
getFetch:
|
|
754
|
-
location:
|
|
753
|
+
getFetch: F = null,
|
|
754
|
+
location: V = null
|
|
755
755
|
}) => {
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
const
|
|
759
|
-
x && x(r, T,
|
|
756
|
+
const Y = (D = "default") => d.getOrCreate(F ?? Tt, V ?? new Ye())(a, D), [U, O] = S(!0), [ne, $] = S(qe), [oe, se] = S("default");
|
|
757
|
+
A(() => {
|
|
758
|
+
const q = Y(r).subscribeEvents((T, N) => {
|
|
759
|
+
x && x(r, T, N);
|
|
760
760
|
});
|
|
761
761
|
return () => {
|
|
762
|
-
|
|
762
|
+
Y(r).removeEventSubscription(q);
|
|
763
763
|
};
|
|
764
|
-
}, [r, x]),
|
|
765
|
-
const
|
|
764
|
+
}, [r, x]), A(() => {
|
|
765
|
+
const q = Y(r).subscribeEvents((T, N) => {
|
|
766
766
|
if (T === d.eventNames.refreshTokensAsync_error || T === d.eventNames.syncTokensAsync_error) {
|
|
767
|
-
if (
|
|
768
|
-
|
|
767
|
+
if (y != null) {
|
|
768
|
+
y();
|
|
769
769
|
return;
|
|
770
770
|
}
|
|
771
|
-
|
|
771
|
+
$({ name: T, data: N });
|
|
772
772
|
} else if (T === d.eventNames.logout_from_another_tab) {
|
|
773
773
|
if (b != null) {
|
|
774
774
|
b();
|
|
775
775
|
return;
|
|
776
776
|
}
|
|
777
|
-
|
|
777
|
+
$({ name: T, data: N });
|
|
778
778
|
} else
|
|
779
|
-
T === d.eventNames.logout_from_same_tab ? k != null && k() : T === d.eventNames.loginAsync_begin || T === d.eventNames.loginCallbackAsync_end || T === d.eventNames.loginAsync_error || T === d.eventNames.loginCallbackAsync_error ?
|
|
779
|
+
T === d.eventNames.logout_from_same_tab ? k != null && k() : T === d.eventNames.loginAsync_begin || T === d.eventNames.loginCallbackAsync_end || T === d.eventNames.loginAsync_error || T === d.eventNames.loginCallbackAsync_error ? $({ name: T, data: N }) : T === d.eventNames.service_worker_not_supported_by_browser && a.service_worker_only === !0 && $({ name: T, data: N });
|
|
780
780
|
});
|
|
781
|
-
return se(r),
|
|
782
|
-
|
|
781
|
+
return se(r), O(!1), () => {
|
|
782
|
+
Y(r).removeEventSubscription(q), $(qe);
|
|
783
783
|
};
|
|
784
784
|
}, [a, r]);
|
|
785
|
-
const ae = v, ie = c,
|
|
785
|
+
const ae = v, ie = c, I = l, ce = _, le = u, W = U || oe !== r, j = Y(r);
|
|
786
786
|
switch (ne.name) {
|
|
787
787
|
case d.eventNames.service_worker_not_supported_by_browser:
|
|
788
|
-
return /* @__PURE__ */ i.jsx(
|
|
788
|
+
return /* @__PURE__ */ i.jsx(X, { loadingComponent: I, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(ce, { configurationName: r }) });
|
|
789
789
|
case d.eventNames.loginAsync_begin:
|
|
790
|
-
return /* @__PURE__ */ i.jsx(
|
|
790
|
+
return /* @__PURE__ */ i.jsx(X, { loadingComponent: I, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(ie, { configurationName: r }) });
|
|
791
791
|
case d.eventNames.loginAsync_error:
|
|
792
792
|
case d.eventNames.loginCallbackAsync_error:
|
|
793
|
-
return /* @__PURE__ */ i.jsx(
|
|
793
|
+
return /* @__PURE__ */ i.jsx(X, { loadingComponent: I, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(le, { configurationName: r }) });
|
|
794
794
|
case d.eventNames.refreshTokensAsync_error:
|
|
795
795
|
case d.eventNames.syncTokensAsync_error:
|
|
796
796
|
case d.eventNames.logout_from_another_tab:
|
|
797
|
-
return /* @__PURE__ */ i.jsx(
|
|
797
|
+
return /* @__PURE__ */ i.jsx(X, { loadingComponent: I, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(ae, { configurationName: r }) });
|
|
798
798
|
default:
|
|
799
|
-
return /* @__PURE__ */ i.jsx(
|
|
799
|
+
return /* @__PURE__ */ i.jsx(X, { loadingComponent: I, isLoading: W, configurationName: r, children: /* @__PURE__ */ i.jsx(
|
|
800
800
|
Mt,
|
|
801
801
|
{
|
|
802
802
|
redirect_uri: j.configuration.redirect_uri,
|
|
@@ -806,33 +806,33 @@ const Be = "default", Ct = (o, a, r = !1) => async (...s) => await a().fetchWith
|
|
|
806
806
|
callbackErrorComponent: u,
|
|
807
807
|
authenticatingComponent: c,
|
|
808
808
|
configurationName: r,
|
|
809
|
-
withCustomHistory:
|
|
810
|
-
location:
|
|
811
|
-
children: /* @__PURE__ */ i.jsx(Yt, { loadingComponent:
|
|
809
|
+
withCustomHistory: C,
|
|
810
|
+
location: V ?? new Ye(),
|
|
811
|
+
children: /* @__PURE__ */ i.jsx(Yt, { loadingComponent: I, configurationName: r, children: o })
|
|
812
812
|
}
|
|
813
813
|
) });
|
|
814
814
|
}
|
|
815
815
|
}, $t = ({ children: o, callbackPath: a = null, extras: r = null, configurationName: s = "default" }) => {
|
|
816
816
|
const c = d.get, l = c(s);
|
|
817
|
-
return
|
|
817
|
+
return A(() => {
|
|
818
818
|
l.tokens || l.loginAsync(a, r);
|
|
819
819
|
}, [s, a, r]), l.tokens ? /* @__PURE__ */ i.jsx(i.Fragment, { children: o }) : null;
|
|
820
820
|
}, Xt = (o, a = null, r = null, s = "default") => (c) => /* @__PURE__ */ i.jsx($t, { callbackPath: a, extras: r, configurationName: s, children: /* @__PURE__ */ i.jsx(o, { ...c }) }), ke = "default", ye = (o, a) => {
|
|
821
821
|
let r = !1;
|
|
822
822
|
return o(a) && (r = o(a).tokens != null), r;
|
|
823
823
|
}, Qt = (o = ke) => {
|
|
824
|
-
const a = d.get, [r, s] =
|
|
825
|
-
return
|
|
824
|
+
const a = d.get, [r, s] = S(ye(a, o));
|
|
825
|
+
return A(() => {
|
|
826
826
|
let u = !0;
|
|
827
827
|
const v = a(o);
|
|
828
828
|
s(ye(a, o));
|
|
829
|
-
const
|
|
829
|
+
const y = v.subscribeEvents((b, k) => {
|
|
830
830
|
(b === d.eventNames.logout_from_another_tab || b === d.eventNames.logout_from_same_tab || b === d.eventNames.token_aquired) && u && s(ye(a, o));
|
|
831
831
|
});
|
|
832
832
|
return () => {
|
|
833
|
-
u = !1, v.removeEventSubscription(
|
|
833
|
+
u = !1, v.removeEventSubscription(y);
|
|
834
834
|
};
|
|
835
|
-
}, [o]), { login: (u = void 0, v = null,
|
|
835
|
+
}, [o]), { login: (u = void 0, v = null, y = !1) => a(o).loginAsync(u, v, !1, void 0, y), logout: (u = void 0, v = null) => a(o).logoutAsync(u, v), renewTokens: async (u = null) => {
|
|
836
836
|
const v = await a(o).renewTokensAsync(u);
|
|
837
837
|
return {
|
|
838
838
|
// @ts-ignore
|
|
@@ -861,26 +861,26 @@ function qt(o, a) {
|
|
|
861
861
|
return o.configuration.demonstrating_proof_of_possession ? (r, s, c = {}) => o.generateDemonstrationOfProofOfPossessionAsync(a.accessToken, r, s, c) : null;
|
|
862
862
|
}
|
|
863
863
|
const Zt = (o = ke) => {
|
|
864
|
-
const a = d.get, [r, s] =
|
|
865
|
-
return
|
|
864
|
+
const a = d.get, [r, s] = S(Vt(o));
|
|
865
|
+
return A(() => {
|
|
866
866
|
let c = !0;
|
|
867
867
|
const l = a(o);
|
|
868
868
|
if (l.tokens) {
|
|
869
869
|
const u = l.tokens;
|
|
870
870
|
s({ accessToken: u.accessToken, accessTokenPayload: u.accessTokenPayload });
|
|
871
871
|
}
|
|
872
|
-
const
|
|
872
|
+
const _ = l.subscribeEvents((u, v) => {
|
|
873
873
|
if ((u === d.eventNames.token_renewed || u === d.eventNames.token_aquired || u === d.eventNames.logout_from_another_tab || u === d.eventNames.logout_from_same_tab || u === d.eventNames.refreshTokensAsync_error || u === d.eventNames.syncTokensAsync_error) && c) {
|
|
874
|
-
const
|
|
875
|
-
s(
|
|
876
|
-
accessToken:
|
|
877
|
-
accessTokenPayload:
|
|
878
|
-
generateDemonstrationOfProofOfPossessionAsync: qt(l,
|
|
874
|
+
const y = l.tokens;
|
|
875
|
+
s(y != null ? {
|
|
876
|
+
accessToken: y.accessToken,
|
|
877
|
+
accessTokenPayload: y.accessTokenPayload,
|
|
878
|
+
generateDemonstrationOfProofOfPossessionAsync: qt(l, y)
|
|
879
879
|
} : Je);
|
|
880
880
|
}
|
|
881
881
|
});
|
|
882
882
|
return () => {
|
|
883
|
-
c = !1, l.removeEventSubscription(
|
|
883
|
+
c = !1, l.removeEventSubscription(_);
|
|
884
884
|
};
|
|
885
885
|
}, [o]), r;
|
|
886
886
|
}, Ke = { idToken: null, idTokenPayload: null }, Bt = (o) => {
|
|
@@ -891,46 +891,46 @@ const Zt = (o = ke) => {
|
|
|
891
891
|
}
|
|
892
892
|
return Ke;
|
|
893
893
|
}, er = (o = ke) => {
|
|
894
|
-
const a = d.get, [r, s] =
|
|
895
|
-
return
|
|
894
|
+
const a = d.get, [r, s] = S(Bt(o));
|
|
895
|
+
return A(() => {
|
|
896
896
|
let c = !0;
|
|
897
897
|
const l = a(o);
|
|
898
898
|
if (l.tokens) {
|
|
899
899
|
const u = l.tokens;
|
|
900
900
|
s({ idToken: u.idToken, idTokenPayload: u.idTokenPayload });
|
|
901
901
|
}
|
|
902
|
-
const
|
|
902
|
+
const _ = l.subscribeEvents((u, v) => {
|
|
903
903
|
if ((u === d.eventNames.token_renewed || u === d.eventNames.token_aquired || u === d.eventNames.logout_from_another_tab || u === d.eventNames.logout_from_same_tab || u === d.eventNames.refreshTokensAsync_error || u === d.eventNames.syncTokensAsync_error) && c) {
|
|
904
|
-
const
|
|
905
|
-
s(
|
|
904
|
+
const y = l.tokens;
|
|
905
|
+
s(y != null ? { idToken: y.idToken, idTokenPayload: y.idTokenPayload } : Ke);
|
|
906
906
|
}
|
|
907
907
|
});
|
|
908
908
|
return () => {
|
|
909
|
-
c = !1, l.removeEventSubscription(
|
|
909
|
+
c = !1, l.removeEventSubscription(_);
|
|
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
914
|
const tr = (o = "default", a = !1) => {
|
|
915
|
-
const s = d.get(o).userInfo(), [c, l] =
|
|
915
|
+
const s = d.get(o).userInfo(), [c, l] = S({
|
|
916
916
|
user: s,
|
|
917
917
|
status: s ? "User loaded" : "Unauthenticated"
|
|
918
918
|
/* Unauthenticated */
|
|
919
|
-
}), [
|
|
920
|
-
|
|
921
|
-
const
|
|
922
|
-
let
|
|
923
|
-
if (
|
|
924
|
-
const
|
|
925
|
-
if (
|
|
919
|
+
}), [_, u] = S(s ? 1 : 0), [v, y] = S(s ? 1 : 0);
|
|
920
|
+
A(() => {
|
|
921
|
+
const k = d.get(o);
|
|
922
|
+
let C = !0;
|
|
923
|
+
if (k && k.tokens) {
|
|
924
|
+
const F = _ === v;
|
|
925
|
+
if (F && k.userInfo())
|
|
926
926
|
return;
|
|
927
927
|
l({
|
|
928
928
|
...c,
|
|
929
929
|
status: "Loading user"
|
|
930
930
|
/* Loading */
|
|
931
|
-
}),
|
|
932
|
-
|
|
933
|
-
user:
|
|
931
|
+
}), k.userInfoAsync(!F, a).then((V) => {
|
|
932
|
+
C && l({
|
|
933
|
+
user: V,
|
|
934
934
|
status: "User loaded"
|
|
935
935
|
/* Loaded */
|
|
936
936
|
});
|
|
@@ -938,28 +938,28 @@ const tr = (o = "default", a = !1) => {
|
|
|
938
938
|
...c,
|
|
939
939
|
status: "Error loading user"
|
|
940
940
|
/* LoadingError */
|
|
941
|
-
}));
|
|
941
|
+
})), y(_);
|
|
942
942
|
} else
|
|
943
943
|
l({
|
|
944
944
|
user: null,
|
|
945
945
|
status: "Unauthenticated"
|
|
946
946
|
/* Unauthenticated */
|
|
947
947
|
});
|
|
948
|
-
const
|
|
949
|
-
(
|
|
948
|
+
const x = k.subscribeEvents((F) => {
|
|
949
|
+
(F === d.eventNames.logout_from_another_tab || F === d.eventNames.logout_from_same_tab) && C && l({
|
|
950
950
|
user: null,
|
|
951
951
|
status: "Unauthenticated"
|
|
952
952
|
/* Unauthenticated */
|
|
953
953
|
});
|
|
954
954
|
});
|
|
955
955
|
return () => {
|
|
956
|
-
|
|
956
|
+
C = !1, k.removeEventSubscription(x);
|
|
957
957
|
};
|
|
958
|
-
}, [
|
|
959
|
-
const
|
|
960
|
-
u(
|
|
958
|
+
}, [_]);
|
|
959
|
+
const b = () => {
|
|
960
|
+
u(_ + 1);
|
|
961
961
|
};
|
|
962
|
-
return { oidcUser: c.user, oidcUserLoadingState: c.status, reloadOidcUser:
|
|
962
|
+
return { oidcUser: c.user, oidcUserLoadingState: c.status, reloadOidcUser: b };
|
|
963
963
|
};
|
|
964
964
|
export {
|
|
965
965
|
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,_,a){"use strict";var ne={exports:{}},K={};/**
|
|
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
|
|
9
|
+
*/var me;function Qe(){if(me)return K;me=1;var s=_,c=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function g(f,v,b){var m,k={},P=null,C=null;b!==void 0&&(P=""+b),v.key!==void 0&&(P=""+v.key),v.ref!==void 0&&(C=v.ref);for(m in v)o.call(v,m)&&!u.hasOwnProperty(m)&&(k[m]=v[m]);if(f&&f.defaultProps)for(m in v=f.defaultProps,v)k[m]===void 0&&(k[m]=v[m]);return{$$typeof:c,type:f,key:P,ref:C,props:k,_owner:l.current}}return K.Fragment=n,K.jsx=g,K.jsxs=g,K}var H={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+ve+e}}var he=!1,q;{var wt=typeof WeakMap=="function"?WeakMap:Map;q=new wt}function Ne(e,t){if(!e||he)return"";{var r=q.get(e);if(r!==void 0)return r}var d;he=!0;var
|
|
19
|
-
`),
|
|
20
|
-
`),T=h.length-1,R=
|
|
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=
|
|
17
|
+
*/var Oe;function Ze(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&function(){var s=_,c=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),f=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),F=Symbol.iterator,B="@@iterator";function Y(e){if(e===null||typeof e!="object")return null;var t=F&&e[F]||e[B];return typeof t=="function"?t:null}var U=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=U.ReactDebugCurrentFrame,y=d.getStackAddendum();y!==""&&(t+="%s",r=r.concat([y]));var O=r.map(function(p){return String(p)});O.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,O)}}var V=!1,ae=!1,ce=!1,ie=!1,le=!1,I;I=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===u||le||e===l||e===b||e===m||ie||e===C||V||ae||ce||typeof e=="object"&&e!==null&&(e.$$typeof===P||e.$$typeof===k||e.$$typeof===g||e.$$typeof===f||e.$$typeof===v||e.$$typeof===I||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 M(e){return e.displayName||"Context"}function x(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 u:return"Profiler";case l:return"StrictMode";case b:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case f:var t=e;return M(t)+".Consumer";case g:var r=e;return M(r._context)+".Provider";case v:return fe(e,e.render,"ForwardRef");case k:var d=e.displayName||null;return d!==null?d:x(e.type)||"Memo";case P:{var y=e,O=y._payload,p=y._init;try{return x(p(O))}catch{return null}}}return null}var W=Object.assign,D=0,z,w,N,xe,Ae,Fe,Ie;function De(){}De.__reactDisabledLog=!0;function Et(){{if(D===0){z=console.log,w=console.info,N=console.warn,xe=console.error,Ae=console.group,Fe=console.groupCollapsed,Ie=console.groupEnd;var e={configurable:!0,enumerable:!0,value:De,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}D++}}function Tt(){{if(D--,D===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:z}),info:W({},e,{value:w}),warn:W({},e,{value:N}),error:W({},e,{value:xe}),group:W({},e,{value:Ae}),groupCollapsed:W({},e,{value:Fe}),groupEnd:W({},e,{value:Ie})})}D<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var de=U.ReactCurrentDispatcher,ve;function Z(e,t,r){{if(ve===void 0)try{throw Error()}catch(y){var d=y.stack.trim().match(/\n( *(at )?)/);ve=d&&d[1]||""}return`
|
|
18
|
+
`+ve+e}}var he=!1,q;{var wt=typeof WeakMap=="function"?WeakMap:Map;q=new wt}function Ne(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 O;O=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(L){d=L}Reflect.construct(e,[],p)}else{try{p.call()}catch(L){d=L}e.call(p.prototype)}}else{try{throw Error()}catch(L){d=L}e()}}catch(L){if(L&&d&&typeof L.stack=="string"){for(var h=L.stack.split(`
|
|
19
|
+
`),j=d.stack.split(`
|
|
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=O,Tt(),Error.prepareStackTrace=y}var J=e?e.displayName||e.name:"",Xe=J?Z(J):"";return typeof e=="function"&&q.set(e,Xe),Xe}function Rt(e,t,r){return Ne(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 Ne(e,St(e));if(typeof e=="string")return Z(e);switch(e){case b:return Z("Suspense");case m:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Rt(e.render);case k:return $(e.type,t,r);case P:{var d=e,y=d._payload,O=d._init;try{return $(O(y),t,r)}catch{}}}return""}var ee=Object.prototype.hasOwnProperty,Le={},Ue=U.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 Pt(e,t,r,d,y){{var O=Function.call.bind(ee);for(var p in e)if(O(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 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 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 Q=U.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 It(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 Dt(e,t){if(typeof e.ref=="string"&&Q.current&&t&&Q.current.stateNode!==t){var r=x(Q.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',x(Q.current.type),e.ref),_e[r]=!0)}}function Nt(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,O,p){var h={$$typeof:c,type:e,key:t,ref:r,props:p,_owner:O};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 O,p={},h=null,j=null;r!==void 0&&(We(r),h=""+r),It(t)&&(We(t.key),h=""+t.key),Ft(t)&&(j=t.ref,Dt(t,y));for(O in t)ee.call(t,O)&&!At.hasOwnProperty(O)&&(p[O]=t[O]);if(e&&e.defaultProps){var T=e.defaultProps;for(O in T)p[O]===void 0&&(p[O]=T[O])}if(h||j){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;h&&Nt(p,R),j&&Lt(p,R)}return Ut(e,h,j,y,d,Q.current,p)}}var ge=U.ReactCurrentOwner,Be=U.ReactDebugCurrentFrame;function G(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===c}function ze(){{if(ge.current){var e=x(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 "+x(e._owner.type)+"."),B(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,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 b=W(e);if(typeof b=="function"&&b!==e.entries)for(var k=b.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===E))r=t.propTypes;else return;if(r){var d=x(t);jt(r,e.props,"prop",d,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var b=x(t);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function 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),j("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),j("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function He(e,t,r,d,b,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 P=Wt(b);P?h+=P:h+=ze();var T;e===null?T="null":pe(e)?T="array":e!==void 0&&e.$$typeof===c?(T="<"+(x(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,h)}var R=Mt(e,t,r,b,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 j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else 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,c,n=!1)=>async(...o)=>await c().fetchWithTokens(s,n)(...o),$e=(s=null,c=Oe,n=!1)=>o=>l=>{const{fetch:u}=Ee(s||l.fetch,c,n);return i.jsx(o,{...l,fetch:u})},Ee=(s=null,c=Oe,n=!1)=>{const o=s||window.fetch,l=a.OidcClient.get;return{fetch:g.useCallback((y,f)=>qe(o,()=>l(c),n)(y,f),[o,c])}},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,c)=>(n,o)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,o);const l=o||{bubbles:!1,cancelable:!1,detail:void 0},u=c.createEvent("CustomEvent");return u.initCustomEvent(n,l.bubbles,l.cancelable,l.detail),u.prototype=s.Event.prototype,u},rt=(s,c,n)=>({replaceState:(o,l)=>{const u=n(),y=l||s.history.state;s.history.replaceState({key:u,state:y},null,o),s.dispatchEvent(c("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:c,configurationName:n,withCustomHistory:o})=>{const[l,u]=g.useState(!1);g.useEffect(()=>{let v=!0;return(async()=>{const m=a.OidcClient.get;try{const{callbackPath:E}=await m(n).loginCallbackAsync();(o?o():st()).replaceState(E||"/")}catch(E){v&&(console.warn(E),u(!0))}})(),()=>{v=!1}},[]);const y=s||Te,f=c||we;return l?i.jsx(y,{configurationName:n}):i.jsx(f,{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=a.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),i.jsx(i.Fragment,{})),ut=({configurationName:s})=>{const c=a.getParseQueryStringFromLocation(window.location.href),n=a.OidcClient.get,o=n(s);let l=null;for(const[u,y]of Object.entries(c))u==="state"||u==="scope"||(l===null&&(l={}),l[u]=y);return g.useEffect(()=>{o.tokens||o.loginAsync(null,l,!0,c.scope)},[]),i.jsx(i.Fragment,{})},ft=({callbackErrorComponent:s,callbackSuccessComponent:c,redirect_uri:n,silent_redirect_uri:o,silent_login_uri:l,children:u,configurationName:y,withCustomHistory:f=null,location:v})=>{const _=window?a.getPath(window.location.href):"",[m,E]=g.useState(_);g.useEffect(()=>{const C=()=>E(a.getPath(window.location.href));return C(),window.addEventListener("popstate",C,!1),()=>window.removeEventListener("popstate",C,!1)},[]);const S=a.getPath(n);if(o&&m===a.getPath(o))return i.jsx(lt,{configurationName:y});if(l&&m===a.getPath(l))return i.jsx(ut,{configurationName:y});switch(m){case S:return i.jsx(ot,{callBackError:s,callBackSuccess:c,configurationName:y,withCustomHistory:f});default:return i.jsx(i.Fragment,{children:u})}},dt=g.memo(ft),Re={name:"",data:null},vt=({loadingComponent:s,children:c,configurationName:n})=>{const[o,l]=g.useState(!0),u=a.OidcClient.get,y=u(n);g.useEffect(()=>{let v=!0;return y&&y.tryKeepExistingSessionAsync().then(()=>{v&&l(!1)}),()=>{v=!1}},[n]);const f=s;return i.jsx(i.Fragment,{children:o?i.jsx(f,{configurationName:n}):i.jsx(i.Fragment,{children:c})})},K=({isLoading:s,loadingComponent:c,children:n,configurationName:o})=>{const l=c;return s?i.jsx(l,{configurationName:o,children:n}):i.jsx(i.Fragment,{children:n})},ht=({children:s,configuration:c,configurationName:n="default",callbackSuccessComponent:o=we,authenticatingComponent:l=et,loadingComponent:u=at,serviceWorkerNotSupportedComponent:y=ct,authenticatingErrorComponent:f=Te,sessionLostComponent:v=it,onSessionLost:_=null,onLogoutFromAnotherTab:m=null,onLogoutFromSameTab:E=null,withCustomHistory:S=null,onEvent:C=null,getFetch:X=null,location:Q=null})=>{const W=(D="default")=>a.OidcClient.getOrCreate(X??a.getFetchDefault,Q??new a.OidcLocation)(c,D),[L,j]=g.useState(!0),[oe,Y]=g.useState(Re),[ae,ce]=g.useState("default");g.useEffect(()=>{const V=W(n).subscribeEvents((w,I)=>{C&&C(n,w,I)});return()=>{W(n).removeEventSubscription(V)}},[n,C]),g.useEffect(()=>{const V=W(n).subscribeEvents((w,I)=>{if(w===a.OidcClient.eventNames.refreshTokensAsync_error||w===a.OidcClient.eventNames.syncTokensAsync_error){if(_!=null){_();return}Y({name:w,data:I})}else if(w===a.OidcClient.eventNames.logout_from_another_tab){if(m!=null){m();return}Y({name:w,data:I})}else w===a.OidcClient.eventNames.logout_from_same_tab?E!=null&&E():w===a.OidcClient.eventNames.loginAsync_begin||w===a.OidcClient.eventNames.loginCallbackAsync_end||w===a.OidcClient.eventNames.loginAsync_error||w===a.OidcClient.eventNames.loginCallbackAsync_error?Y({name:w,data:I}):w===a.OidcClient.eventNames.service_worker_not_supported_by_browser&&c.service_worker_only===!0&&Y({name:w,data:I})});return ce(n),j(!1),()=>{W(n).removeEventSubscription(V),Y(Re)}},[c,n]);const ie=v,le=l,F=u,ue=y,fe=f,U=L||ae!==n,x=W(n);switch(oe.name){case a.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 a.OidcClient.eventNames.loginAsync_begin:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(le,{configurationName:n})});case a.OidcClient.eventNames.loginAsync_error:case a.OidcClient.eventNames.loginCallbackAsync_error:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(fe,{configurationName:n})});case a.OidcClient.eventNames.refreshTokensAsync_error:case a.OidcClient.eventNames.syncTokensAsync_error:case a.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:x.configuration.redirect_uri,silent_redirect_uri:x.configuration.silent_redirect_uri,silent_login_uri:x.configuration.silent_login_uri,callbackSuccessComponent:o,callbackErrorComponent:f,authenticatingComponent:l,configurationName:n,withCustomHistory:S,location:Q??new a.OidcLocation,children:i.jsx(vt,{loadingComponent:F,configurationName:n,children:s})})})}},Se=({children:s,callbackPath:c=null,extras:n=null,configurationName:o="default"})=>{const l=a.OidcClient.get,u=l(o);return g.useEffect(()=>{u.tokens||u.loginAsync(c,n)},[o,c,n]),u.tokens?i.jsx(i.Fragment,{children:s}):null},pt=(s,c=null,n=null,o="default")=>l=>i.jsx(Se,{callbackPath:c,extras:n,configurationName:o,children:i.jsx(s,{...l})}),re="default",se=(s,c)=>{let n=!1;return s(c)&&(n=s(c).tokens!=null),n},_t=(s=re)=>{const c=a.OidcClient.get,[n,o]=g.useState(se(c,s));return g.useEffect(()=>{let f=!0;const v=c(s);o(se(c,s));const _=v.subscribeEvents((m,E)=>{(m===a.OidcClient.eventNames.logout_from_another_tab||m===a.OidcClient.eventNames.logout_from_same_tab||m===a.OidcClient.eventNames.token_aquired)&&f&&o(se(c,s))});return()=>{f=!1,v.removeEventSubscription(_)}},[s]),{login:(f=void 0,v=null,_=!1)=>c(s).loginAsync(f,v,!1,void 0,_),logout:(f=void 0,v=null)=>c(s).logoutAsync(f,v),renewTokens:async(f=null)=>{const v=await c(s).renewTokensAsync(f);return{accessToken:v.accessToken,accessTokenPayload:v.accessTokenPayload,idToken:v.idToken,idTokenPayload:v.idTokenPayload}},isAuthenticated:n}},je={accessToken:null,accessTokenPayload:null},gt=s=>{const c=a.OidcClient.get,n=c(s);if(n.tokens){const o=n.tokens;return{accessToken:o.accessToken,accessTokenPayload:o.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:n.configuration.demonstrating_proof_of_possession?(l,u)=>n.generateDemonstrationOfProofOfPossessionAsync(o.accessToken,l,u):null}}return je};function yt(s,c){return s.configuration.demonstrating_proof_of_possession?(n,o,l={})=>s.generateDemonstrationOfProofOfPossessionAsync(c.accessToken,n,o,l):null}const bt=(s=re)=>{const c=a.OidcClient.get,[n,o]=g.useState(gt(s));return g.useEffect(()=>{let l=!0;const u=c(s);if(u.tokens){const f=u.tokens;o({accessToken:f.accessToken,accessTokenPayload:f.accessTokenPayload})}const y=u.subscribeEvents((f,v)=>{if((f===a.OidcClient.eventNames.token_renewed||f===a.OidcClient.eventNames.token_aquired||f===a.OidcClient.eventNames.logout_from_another_tab||f===a.OidcClient.eventNames.logout_from_same_tab||f===a.OidcClient.eventNames.refreshTokensAsync_error||f===a.OidcClient.eventNames.syncTokensAsync_error)&&l){const _=u.tokens;o(_!=null?{accessToken:_.accessToken,accessTokenPayload:_.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:yt(u,_)}:je)}});return()=>{l=!1,u.removeEventSubscription(y)}},[s]),n},Pe={idToken:null,idTokenPayload:null},mt=s=>{const c=a.OidcClient.get,n=c(s);if(n.tokens){const o=n.tokens;return{idToken:o.idToken,idTokenPayload:o.idTokenPayload}}return Pe},kt=(s=re)=>{const c=a.OidcClient.get,[n,o]=g.useState(mt(s));return g.useEffect(()=>{let l=!0;const u=c(s);if(u.tokens){const f=u.tokens;o({idToken:f.idToken,idTokenPayload:f.idTokenPayload})}const y=u.subscribeEvents((f,v)=>{if((f===a.OidcClient.eventNames.token_renewed||f===a.OidcClient.eventNames.token_aquired||f===a.OidcClient.eventNames.logout_from_another_tab||f===a.OidcClient.eventNames.logout_from_same_tab||f===a.OidcClient.eventNames.refreshTokensAsync_error||f===a.OidcClient.eventNames.syncTokensAsync_error)&&l){const _=u.tokens;o(_!=null?{idToken:_.idToken,idTokenPayload:_.idTokenPayload}:Pe)}});return()=>{l=!1,u.removeEventSubscription(y)}},[s]),n};var Ce=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Ce||{});const Ot=(s="default",c=!1)=>{const o=a.OidcClient.get(s).userInfo(),[l,u]=g.useState({user:o,status:o?"User loaded":"Unauthenticated"}),[y,f]=g.useState(o?" ":"");g.useEffect(()=>{const _=a.OidcClient.get(s);let m=!0;if(_&&_.tokens){const S=y!=="";if(S&&_.userInfo())return;u({...l,status:"Loading user"}),_.userInfoAsync(S,c).then(C=>{m&&u({user:C,status:"User loaded"})}).catch(()=>u({...l,status:"Error loading user"}))}else u({user:null,status:"Unauthenticated"});const E=_.subscribeEvents(S=>{(S===a.OidcClient.eventNames.logout_from_another_tab||S===a.OidcClient.eventNames.logout_from_same_tab)&&m&&u({user:null,status:"Unauthenticated"})});return()=>{m=!1,_.removeEventSubscription(E)}},[y]);const v=()=>{f(y+" ")};return{oidcUser:l.user,oidcUserLoadingState:l.status,reloadOidcUser:v}};Object.defineProperty(O,"OidcClient",{enumerable:!0,get:()=>a.OidcClient}),Object.defineProperty(O,"OidcLocation",{enumerable:!0,get:()=>a.OidcLocation}),Object.defineProperty(O,"TokenAutomaticRenewMode",{enumerable:!0,get:()=>a.TokenAutomaticRenewMode}),Object.defineProperty(O,"TokenRenewMode",{enumerable:!0,get:()=>a.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 "+x(e._owner.type)+"."),G(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),G(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=Y(e);if(typeof y=="function"&&y!==e.entries)for(var O=y.call(e),p;!(p=O.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===k))r=t.propTypes;else return;if(r){var d=x(t);Pt(r,e.props,"prop",d,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var y=x(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"){G(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),G(null);break}}e.ref!==null&&(G(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),G(null))}}function He(e,t,r,d,y,O){{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===c?(T="<"+(x(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,O);if(R==null)return R;if(p){var A=t.children;if(A!==void 0)if(d)if(pe(A)){for(var J=0;J<A.length;J++)Ke(A[J],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;H.Fragment=o,H.jsx=Jt,H.jsxs=Kt}()),H}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=Ze();var i=ne.exports;const ke="default",qe=(s,c,n=!1)=>async(...o)=>await c().fetchWithTokens(s,n)(...o),$e=(s=null,c=ke,n=!1)=>o=>l=>{const{fetch:u}=Ee(s||l.fetch,c,n);return i.jsx(o,{...l,fetch:u})},Ee=(s=null,c=ke,n=!1)=>{const o=s||window.fetch,l=a.OidcClient.get;return{fetch:_.useCallback((g,f)=>qe(o,()=>l(c),n)(g,f),[o,c])}},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,c)=>(n,o)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,o);const l=o||{bubbles:!1,cancelable:!1,detail:void 0},u=c.createEvent("CustomEvent");return u.initCustomEvent(n,l.bubbles,l.cancelable,l.detail),u.prototype=s.Event.prototype,u},rt=(s,c,n)=>({replaceState:(o,l)=>{const u=n(),g=l||s.history.state;s.history.replaceState({key:u,state:g},null,o),s.dispatchEvent(c("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:c,configurationName:n,withCustomHistory:o})=>{const[l,u]=_.useState(!1);_.useEffect(()=>{let v=!0;return(async()=>{const m=a.OidcClient.get;try{const{callbackPath:k}=await m(n).loginCallbackAsync();(o?o():st()).replaceState(k||"/")}catch(k){v&&(console.warn(k),u(!0))}})(),()=>{v=!1}},[]);const g=s||Te,f=c||we;return l?i.jsx(g,{configurationName:n}):i.jsx(f,{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=a.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),i.jsx(i.Fragment,{})),ut=({configurationName:s})=>{const c=a.getParseQueryStringFromLocation(window.location.href),n=a.OidcClient.get,o=n(s);let l=null;for(const[u,g]of Object.entries(c))u==="state"||u==="scope"||(l===null&&(l={}),l[u]=g);return _.useEffect(()=>{o.tokens||o.loginAsync(null,l,!0,c.scope)},[]),i.jsx(i.Fragment,{})},ft=({callbackErrorComponent:s,callbackSuccessComponent:c,redirect_uri:n,silent_redirect_uri:o,silent_login_uri:l,children:u,configurationName:g,withCustomHistory:f=null,location:v})=>{const b=window?a.getPath(window.location.href):"",[m,k]=_.useState(b);_.useEffect(()=>{const C=()=>k(a.getPath(window.location.href));return C(),window.addEventListener("popstate",C,!1),()=>window.removeEventListener("popstate",C,!1)},[]);const P=a.getPath(n);if(o&&m===a.getPath(o))return i.jsx(lt,{configurationName:g});if(l&&m===a.getPath(l))return i.jsx(ut,{configurationName:g});switch(m){case P:return i.jsx(ot,{callBackError:s,callBackSuccess:c,configurationName:g,withCustomHistory:f});default:return i.jsx(i.Fragment,{children:u})}},dt=_.memo(ft),Re={name:"",data:null},vt=({loadingComponent:s,children:c,configurationName:n})=>{const[o,l]=_.useState(!0),u=a.OidcClient.get,g=u(n);_.useEffect(()=>{let v=!0;return g&&g.tryKeepExistingSessionAsync().then(()=>{v&&l(!1)}),()=>{v=!1}},[n]);const f=s;return i.jsx(i.Fragment,{children:o?i.jsx(f,{configurationName:n}):i.jsx(i.Fragment,{children:c})})},X=({isLoading:s,loadingComponent:c,children:n,configurationName:o})=>{const l=c;return s?i.jsx(l,{configurationName:o,children:n}):i.jsx(i.Fragment,{children:n})},ht=({children:s,configuration:c,configurationName:n="default",callbackSuccessComponent:o=we,authenticatingComponent:l=et,loadingComponent:u=at,serviceWorkerNotSupportedComponent:g=ct,authenticatingErrorComponent:f=Te,sessionLostComponent:v=it,onSessionLost:b=null,onLogoutFromAnotherTab:m=null,onLogoutFromSameTab:k=null,withCustomHistory:P=null,onEvent:C=null,getFetch:F=null,location:B=null})=>{const Y=(D="default")=>a.OidcClient.getOrCreate(F??a.getFetchDefault,B??new a.OidcLocation)(c,D),[U,S]=_.useState(!0),[oe,V]=_.useState(Re),[ae,ce]=_.useState("default");_.useEffect(()=>{const z=Y(n).subscribeEvents((w,N)=>{C&&C(n,w,N)});return()=>{Y(n).removeEventSubscription(z)}},[n,C]),_.useEffect(()=>{const z=Y(n).subscribeEvents((w,N)=>{if(w===a.OidcClient.eventNames.refreshTokensAsync_error||w===a.OidcClient.eventNames.syncTokensAsync_error){if(b!=null){b();return}V({name:w,data:N})}else if(w===a.OidcClient.eventNames.logout_from_another_tab){if(m!=null){m();return}V({name:w,data:N})}else w===a.OidcClient.eventNames.logout_from_same_tab?k!=null&&k():w===a.OidcClient.eventNames.loginAsync_begin||w===a.OidcClient.eventNames.loginCallbackAsync_end||w===a.OidcClient.eventNames.loginAsync_error||w===a.OidcClient.eventNames.loginCallbackAsync_error?V({name:w,data:N}):w===a.OidcClient.eventNames.service_worker_not_supported_by_browser&&c.service_worker_only===!0&&V({name:w,data:N})});return ce(n),S(!1),()=>{Y(n).removeEventSubscription(z),V(Re)}},[c,n]);const ie=v,le=l,I=u,ue=g,fe=f,M=U||ae!==n,x=Y(n);switch(oe.name){case a.OidcClient.eventNames.service_worker_not_supported_by_browser:return i.jsx(X,{loadingComponent:I,isLoading:M,configurationName:n,children:i.jsx(ue,{configurationName:n})});case a.OidcClient.eventNames.loginAsync_begin:return i.jsx(X,{loadingComponent:I,isLoading:M,configurationName:n,children:i.jsx(le,{configurationName:n})});case a.OidcClient.eventNames.loginAsync_error:case a.OidcClient.eventNames.loginCallbackAsync_error:return i.jsx(X,{loadingComponent:I,isLoading:M,configurationName:n,children:i.jsx(fe,{configurationName:n})});case a.OidcClient.eventNames.refreshTokensAsync_error:case a.OidcClient.eventNames.syncTokensAsync_error:case a.OidcClient.eventNames.logout_from_another_tab:return i.jsx(X,{loadingComponent:I,isLoading:M,configurationName:n,children:i.jsx(ie,{configurationName:n})});default:return i.jsx(X,{loadingComponent:I,isLoading:M,configurationName:n,children:i.jsx(dt,{redirect_uri:x.configuration.redirect_uri,silent_redirect_uri:x.configuration.silent_redirect_uri,silent_login_uri:x.configuration.silent_login_uri,callbackSuccessComponent:o,callbackErrorComponent:f,authenticatingComponent:l,configurationName:n,withCustomHistory:P,location:B??new a.OidcLocation,children:i.jsx(vt,{loadingComponent:I,configurationName:n,children:s})})})}},Se=({children:s,callbackPath:c=null,extras:n=null,configurationName:o="default"})=>{const l=a.OidcClient.get,u=l(o);return _.useEffect(()=>{u.tokens||u.loginAsync(c,n)},[o,c,n]),u.tokens?i.jsx(i.Fragment,{children:s}):null},pt=(s,c=null,n=null,o="default")=>l=>i.jsx(Se,{callbackPath:c,extras:n,configurationName:o,children:i.jsx(s,{...l})}),re="default",se=(s,c)=>{let n=!1;return s(c)&&(n=s(c).tokens!=null),n},_t=(s=re)=>{const c=a.OidcClient.get,[n,o]=_.useState(se(c,s));return _.useEffect(()=>{let f=!0;const v=c(s);o(se(c,s));const b=v.subscribeEvents((m,k)=>{(m===a.OidcClient.eventNames.logout_from_another_tab||m===a.OidcClient.eventNames.logout_from_same_tab||m===a.OidcClient.eventNames.token_aquired)&&f&&o(se(c,s))});return()=>{f=!1,v.removeEventSubscription(b)}},[s]),{login:(f=void 0,v=null,b=!1)=>c(s).loginAsync(f,v,!1,void 0,b),logout:(f=void 0,v=null)=>c(s).logoutAsync(f,v),renewTokens:async(f=null)=>{const v=await c(s).renewTokensAsync(f);return{accessToken:v.accessToken,accessTokenPayload:v.accessTokenPayload,idToken:v.idToken,idTokenPayload:v.idTokenPayload}},isAuthenticated:n}},Pe={accessToken:null,accessTokenPayload:null},gt=s=>{const c=a.OidcClient.get,n=c(s);if(n.tokens){const o=n.tokens;return{accessToken:o.accessToken,accessTokenPayload:o.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:n.configuration.demonstrating_proof_of_possession?(l,u)=>n.generateDemonstrationOfProofOfPossessionAsync(o.accessToken,l,u):null}}return Pe};function yt(s,c){return s.configuration.demonstrating_proof_of_possession?(n,o,l={})=>s.generateDemonstrationOfProofOfPossessionAsync(c.accessToken,n,o,l):null}const bt=(s=re)=>{const c=a.OidcClient.get,[n,o]=_.useState(gt(s));return _.useEffect(()=>{let l=!0;const u=c(s);if(u.tokens){const f=u.tokens;o({accessToken:f.accessToken,accessTokenPayload:f.accessTokenPayload})}const g=u.subscribeEvents((f,v)=>{if((f===a.OidcClient.eventNames.token_renewed||f===a.OidcClient.eventNames.token_aquired||f===a.OidcClient.eventNames.logout_from_another_tab||f===a.OidcClient.eventNames.logout_from_same_tab||f===a.OidcClient.eventNames.refreshTokensAsync_error||f===a.OidcClient.eventNames.syncTokensAsync_error)&&l){const b=u.tokens;o(b!=null?{accessToken:b.accessToken,accessTokenPayload:b.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:yt(u,b)}:Pe)}});return()=>{l=!1,u.removeEventSubscription(g)}},[s]),n},je={idToken:null,idTokenPayload:null},mt=s=>{const c=a.OidcClient.get,n=c(s);if(n.tokens){const o=n.tokens;return{idToken:o.idToken,idTokenPayload:o.idTokenPayload}}return je},Ot=(s=re)=>{const c=a.OidcClient.get,[n,o]=_.useState(mt(s));return _.useEffect(()=>{let l=!0;const u=c(s);if(u.tokens){const f=u.tokens;o({idToken:f.idToken,idTokenPayload:f.idTokenPayload})}const g=u.subscribeEvents((f,v)=>{if((f===a.OidcClient.eventNames.token_renewed||f===a.OidcClient.eventNames.token_aquired||f===a.OidcClient.eventNames.logout_from_another_tab||f===a.OidcClient.eventNames.logout_from_same_tab||f===a.OidcClient.eventNames.refreshTokensAsync_error||f===a.OidcClient.eventNames.syncTokensAsync_error)&&l){const b=u.tokens;o(b!=null?{idToken:b.idToken,idTokenPayload:b.idTokenPayload}:je)}});return()=>{l=!1,u.removeEventSubscription(g)}},[s]),n};var Ce=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Ce||{});const kt=(s="default",c=!1)=>{const o=a.OidcClient.get(s).userInfo(),[l,u]=_.useState({user:o,status:o?"User loaded":"Unauthenticated"}),[g,f]=_.useState(o?1:0),[v,b]=_.useState(o?1:0);_.useEffect(()=>{const k=a.OidcClient.get(s);let P=!0;if(k&&k.tokens){const F=g===v;if(F&&k.userInfo())return;u({...l,status:"Loading user"}),k.userInfoAsync(!F,c).then(B=>{P&&u({user:B,status:"User loaded"})}).catch(()=>u({...l,status:"Error loading user"})),b(g)}else u({user:null,status:"Unauthenticated"});const C=k.subscribeEvents(F=>{(F===a.OidcClient.eventNames.logout_from_another_tab||F===a.OidcClient.eventNames.logout_from_same_tab)&&P&&u({user:null,status:"Unauthenticated"})});return()=>{P=!1,k.removeEventSubscription(C)}},[g]);const m=()=>{f(g+1)};return{oidcUser:l.user,oidcUserLoadingState:l.status,reloadOidcUser:m}};Object.defineProperty(E,"OidcClient",{enumerable:!0,get:()=>a.OidcClient}),Object.defineProperty(E,"OidcLocation",{enumerable:!0,get:()=>a.OidcLocation}),Object.defineProperty(E,"TokenAutomaticRenewMode",{enumerable:!0,get:()=>a.TokenAutomaticRenewMode}),Object.defineProperty(E,"TokenRenewMode",{enumerable:!0,get:()=>a.TokenRenewMode}),E.OidcProvider=ht,E.OidcSecure=Se,E.OidcUserStatus=Ce,E.useOidc=_t,E.useOidcAccessToken=bt,E.useOidcFetch=Ee,E.useOidcIdToken=Ot,E.useOidcUser=kt,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.22.4
|
|
3
|
+
"version": "7.22.4",
|
|
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.22.4
|
|
44
|
-
"@axa-fr/oidc-client": "7.22.4
|
|
43
|
+
"@axa-fr/oidc-client-service-worker": "7.22.4",
|
|
44
|
+
"@axa-fr/oidc-client": "7.22.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^17.0.0 || ^18.0.0"
|
package/src/User.ts
CHANGED
|
@@ -17,18 +17,19 @@ export const useOidcUser = <T extends OidcUserInfo = OidcUserInfo>(configuration
|
|
|
17
17
|
const oidc = OidcClient.get(configurationName);
|
|
18
18
|
const user = oidc.userInfo<T>();
|
|
19
19
|
const [oidcUser, setOidcUser] = useState<OidcUser<T>>({ user: user, status: user ? OidcUserStatus.Loaded : OidcUserStatus.Unauthenticated });
|
|
20
|
-
const [oidcUserId, setOidcUserId] = useState<
|
|
20
|
+
const [oidcUserId, setOidcUserId] = useState<number>(user ? 1 : 0);
|
|
21
|
+
const [oidcPreviousUserId, setPreviousOidcUserId] = useState<number>(user ? 1 : 0);
|
|
21
22
|
|
|
22
23
|
useEffect(() => {
|
|
23
24
|
const oidc = OidcClient.get(configurationName);
|
|
24
25
|
let isMounted = true;
|
|
25
26
|
if (oidc && oidc.tokens) {
|
|
26
|
-
const
|
|
27
|
-
if(
|
|
27
|
+
const isCache = oidcUserId === oidcPreviousUserId;
|
|
28
|
+
if(isCache && oidc.userInfo<T>()) {
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
31
|
setOidcUser({ ...oidcUser, status: OidcUserStatus.Loading });
|
|
31
|
-
oidc.userInfoAsync(
|
|
32
|
+
oidc.userInfoAsync(!isCache, demonstrating_proof_of_possession)
|
|
32
33
|
.then((info) => {
|
|
33
34
|
if (isMounted) {
|
|
34
35
|
// @ts-ignore
|
|
@@ -36,6 +37,7 @@ export const useOidcUser = <T extends OidcUserInfo = OidcUserInfo>(configuration
|
|
|
36
37
|
}
|
|
37
38
|
})
|
|
38
39
|
.catch(() => setOidcUser({ ...oidcUser, status: OidcUserStatus.LoadingError }));
|
|
40
|
+
setPreviousOidcUserId(oidcUserId);
|
|
39
41
|
} else {
|
|
40
42
|
setOidcUser({ user: null, status: OidcUserStatus.Unauthenticated });
|
|
41
43
|
}
|
|
@@ -53,7 +55,7 @@ export const useOidcUser = <T extends OidcUserInfo = OidcUserInfo>(configuration
|
|
|
53
55
|
}, [oidcUserId]);
|
|
54
56
|
|
|
55
57
|
const reloadOidcUser = () => {
|
|
56
|
-
setOidcUserId(oidcUserId
|
|
58
|
+
setOidcUserId(oidcUserId+1);
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
return { oidcUser: oidcUser.user, oidcUserLoadingState: oidcUser.status, reloadOidcUser };
|