@axa-fr/react-oidc 7.5.1 → 7.7.0-alpha.1071
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/OidcProvider.d.ts +2 -1
- package/dist/index.js +176 -175
- package/dist/index.umd.cjs +7 -7
- package/package.json +3 -3
- package/src/OidcProvider.tsx +4 -2
package/dist/OidcProvider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fetch, OidcConfiguration, OidcClient } from '@axa-fr/oidc-client';
|
|
1
|
+
import { Fetch, OidcConfiguration, OidcClient, ILOidcLocation } from '@axa-fr/oidc-client';
|
|
2
2
|
import { ComponentType, FC, PropsWithChildren } from 'react';
|
|
3
3
|
import { CustomHistory } from './core/routes/withRouter.js';
|
|
4
4
|
export type oidcContext = {
|
|
@@ -20,6 +20,7 @@ export type OidcProviderProps = {
|
|
|
20
20
|
withCustomHistory?: () => CustomHistory;
|
|
21
21
|
onEvent?: (configuration: string, name: string, data: any) => void;
|
|
22
22
|
getFetch?: () => Fetch;
|
|
23
|
+
location?: ILOidcLocation;
|
|
23
24
|
};
|
|
24
25
|
export type OidcSessionProps = {
|
|
25
26
|
configurationName: string;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { OidcClient as v, getParseQueryStringFromLocation as mt, getPath as z, getFetchDefault as Et } from "@axa-fr/oidc-client";
|
|
3
|
-
import { TokenRenewMode as
|
|
4
|
-
var
|
|
1
|
+
import ke, { useCallback as kt, useState as S, useEffect as P } from "react";
|
|
2
|
+
import { OidcClient as v, getParseQueryStringFromLocation as mt, getPath as z, getFetchDefault as Et, OidcLocation as Tt } from "@axa-fr/oidc-client";
|
|
3
|
+
import { TokenRenewMode as nr } from "@axa-fr/oidc-client";
|
|
4
|
+
var be = { exports: {} }, G = {};
|
|
5
5
|
/**
|
|
6
6
|
* @license React
|
|
7
7
|
* react-jsx-runtime.production.min.js
|
|
@@ -12,11 +12,11 @@ var ye = { exports: {} }, G = {};
|
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
13
|
*/
|
|
14
14
|
var Ye;
|
|
15
|
-
function
|
|
15
|
+
function wt() {
|
|
16
16
|
if (Ye)
|
|
17
17
|
return G;
|
|
18
18
|
Ye = 1;
|
|
19
|
-
var o =
|
|
19
|
+
var o = ke, s = Symbol.for("react.element"), r = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, u = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
20
|
function h(i, d, g) {
|
|
21
21
|
var b, m = {}, C = null, A = null;
|
|
22
22
|
g !== void 0 && (C = "" + g), d.key !== void 0 && (C = "" + d.key), d.ref !== void 0 && (A = d.ref);
|
|
@@ -40,13 +40,13 @@ var H = {};
|
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
41
|
*/
|
|
42
42
|
var Me;
|
|
43
|
-
function
|
|
43
|
+
function Ct() {
|
|
44
44
|
return Me || (Me = 1, process.env.NODE_ENV !== "production" && function() {
|
|
45
|
-
var o =
|
|
46
|
-
function
|
|
45
|
+
var o = ke, s = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), i = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), K = Symbol.iterator, re = "@@iterator";
|
|
46
|
+
function U(e) {
|
|
47
47
|
if (e === null || typeof e != "object")
|
|
48
48
|
return null;
|
|
49
|
-
var t = K && e[K] || e[
|
|
49
|
+
var t = K && e[K] || e[re];
|
|
50
50
|
return typeof t == "function" ? t : null;
|
|
51
51
|
}
|
|
52
52
|
var L = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
@@ -54,10 +54,10 @@ function wt() {
|
|
|
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];
|
|
57
|
-
|
|
57
|
+
ne("error", e, n);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function ne(e, t, n) {
|
|
61
61
|
{
|
|
62
62
|
var f = L.ReactDebugCurrentFrame, y = f.getStackAddendum();
|
|
63
63
|
y !== "" && (t += "%s", n = n.concat([y]));
|
|
@@ -67,26 +67,26 @@ function wt() {
|
|
|
67
67
|
k.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, k);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
var
|
|
71
|
-
|
|
70
|
+
var Y = !1, oe = !1, se = !1, ae = !1, ie = !1, F;
|
|
71
|
+
F = Symbol.for("react.module.reference");
|
|
72
72
|
function ce(e) {
|
|
73
|
-
return !!(typeof e == "string" || typeof e == "function" || e === a || e === l ||
|
|
73
|
+
return !!(typeof e == "string" || typeof e == "function" || e === a || e === l || ie || e === u || e === g || e === b || ae || e === A || Y || oe || se || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === m || e.$$typeof === h || e.$$typeof === i || e.$$typeof === d || // This needs to include all possible module reference object
|
|
74
74
|
// types supported by any Flight configuration anywhere since
|
|
75
75
|
// we don't know which Flight build this will end up being used
|
|
76
76
|
// with.
|
|
77
|
-
e.$$typeof ===
|
|
77
|
+
e.$$typeof === F || e.getModuleId !== void 0));
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function le(e, t, n) {
|
|
80
80
|
var f = e.displayName;
|
|
81
81
|
if (f)
|
|
82
82
|
return f;
|
|
83
83
|
var y = t.displayName || t.name || "";
|
|
84
84
|
return y !== "" ? n + "(" + y + ")" : n;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function W(e) {
|
|
87
87
|
return e.displayName || "Context";
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function O(e) {
|
|
90
90
|
if (e == null)
|
|
91
91
|
return null;
|
|
92
92
|
if (typeof e.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
@@ -111,19 +111,19 @@ function wt() {
|
|
|
111
111
|
switch (e.$$typeof) {
|
|
112
112
|
case i:
|
|
113
113
|
var t = e;
|
|
114
|
-
return
|
|
114
|
+
return W(t) + ".Consumer";
|
|
115
115
|
case h:
|
|
116
116
|
var n = e;
|
|
117
|
-
return
|
|
117
|
+
return W(n._context) + ".Provider";
|
|
118
118
|
case d:
|
|
119
|
-
return
|
|
119
|
+
return le(e, e.render, "ForwardRef");
|
|
120
120
|
case m:
|
|
121
121
|
var f = e.displayName || null;
|
|
122
|
-
return f !== null ? f :
|
|
122
|
+
return f !== null ? f : O(e.type) || "Memo";
|
|
123
123
|
case C: {
|
|
124
124
|
var y = e, k = y._payload, _ = y._init;
|
|
125
125
|
try {
|
|
126
|
-
return
|
|
126
|
+
return O(_(k));
|
|
127
127
|
} catch {
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
@@ -131,14 +131,14 @@ function wt() {
|
|
|
131
131
|
}
|
|
132
132
|
return null;
|
|
133
133
|
}
|
|
134
|
-
var
|
|
134
|
+
var $ = Object.assign, N = 0, M, T, D, Ee, Te, we, Ce;
|
|
135
135
|
function Re() {
|
|
136
136
|
}
|
|
137
137
|
Re.__reactDisabledLog = !0;
|
|
138
138
|
function Je() {
|
|
139
139
|
{
|
|
140
140
|
if (N === 0) {
|
|
141
|
-
|
|
141
|
+
M = console.log, T = console.info, D = console.warn, Ee = console.error, Te = console.group, we = console.groupCollapsed, Ce = console.groupEnd;
|
|
142
142
|
var e = {
|
|
143
143
|
configurable: !0,
|
|
144
144
|
enumerable: !0,
|
|
@@ -167,25 +167,25 @@ function wt() {
|
|
|
167
167
|
writable: !0
|
|
168
168
|
};
|
|
169
169
|
Object.defineProperties(console, {
|
|
170
|
-
log:
|
|
170
|
+
log: $({}, e, {
|
|
171
|
+
value: M
|
|
172
|
+
}),
|
|
173
|
+
info: $({}, e, {
|
|
171
174
|
value: T
|
|
172
175
|
}),
|
|
173
|
-
|
|
176
|
+
warn: $({}, e, {
|
|
174
177
|
value: D
|
|
175
178
|
}),
|
|
176
|
-
|
|
177
|
-
value: me
|
|
178
|
-
}),
|
|
179
|
-
error: P({}, e, {
|
|
179
|
+
error: $({}, e, {
|
|
180
180
|
value: Ee
|
|
181
181
|
}),
|
|
182
|
-
group:
|
|
182
|
+
group: $({}, e, {
|
|
183
183
|
value: Te
|
|
184
184
|
}),
|
|
185
|
-
groupCollapsed:
|
|
185
|
+
groupCollapsed: $({}, e, {
|
|
186
186
|
value: we
|
|
187
187
|
}),
|
|
188
|
-
groupEnd:
|
|
188
|
+
groupEnd: $({}, e, {
|
|
189
189
|
value: Ce
|
|
190
190
|
})
|
|
191
191
|
});
|
|
@@ -193,39 +193,39 @@ function wt() {
|
|
|
193
193
|
N < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
var
|
|
197
|
-
function
|
|
196
|
+
var ue = L.ReactCurrentDispatcher, de;
|
|
197
|
+
function X(e, t, n) {
|
|
198
198
|
{
|
|
199
|
-
if (
|
|
199
|
+
if (de === void 0)
|
|
200
200
|
try {
|
|
201
201
|
throw Error();
|
|
202
202
|
} catch (y) {
|
|
203
203
|
var f = y.stack.trim().match(/\n( *(at )?)/);
|
|
204
|
-
|
|
204
|
+
de = f && f[1] || "";
|
|
205
205
|
}
|
|
206
206
|
return `
|
|
207
|
-
` +
|
|
207
|
+
` + de + e;
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
var
|
|
210
|
+
var fe = !1, Q;
|
|
211
211
|
{
|
|
212
212
|
var Xe = typeof WeakMap == "function" ? WeakMap : Map;
|
|
213
|
-
|
|
213
|
+
Q = new Xe();
|
|
214
214
|
}
|
|
215
215
|
function xe(e, t) {
|
|
216
|
-
if (!e ||
|
|
216
|
+
if (!e || fe)
|
|
217
217
|
return "";
|
|
218
218
|
{
|
|
219
|
-
var n =
|
|
219
|
+
var n = Q.get(e);
|
|
220
220
|
if (n !== void 0)
|
|
221
221
|
return n;
|
|
222
222
|
}
|
|
223
223
|
var f;
|
|
224
|
-
|
|
224
|
+
fe = !0;
|
|
225
225
|
var y = Error.prepareStackTrace;
|
|
226
226
|
Error.prepareStackTrace = void 0;
|
|
227
227
|
var k;
|
|
228
|
-
k =
|
|
228
|
+
k = ue.current, ue.current = null, Je();
|
|
229
229
|
try {
|
|
230
230
|
if (t) {
|
|
231
231
|
var _ = function() {
|
|
@@ -271,17 +271,17 @@ function wt() {
|
|
|
271
271
|
if (E--, w--, w < 0 || p[E] !== x[w]) {
|
|
272
272
|
var j = `
|
|
273
273
|
` + p[E].replace(" at new ", " at ");
|
|
274
|
-
return e.displayName && j.includes("<anonymous>") && (j = j.replace("<anonymous>", e.displayName)), typeof e == "function" &&
|
|
274
|
+
return e.displayName && j.includes("<anonymous>") && (j = j.replace("<anonymous>", e.displayName)), typeof e == "function" && Q.set(e, j), j;
|
|
275
275
|
}
|
|
276
276
|
while (E >= 1 && w >= 0);
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
} finally {
|
|
281
|
-
|
|
281
|
+
fe = !1, ue.current = k, Ke(), Error.prepareStackTrace = y;
|
|
282
282
|
}
|
|
283
|
-
var B = e ? e.displayName || e.name : "", Ue = B ?
|
|
284
|
-
return typeof e == "function" &&
|
|
283
|
+
var B = e ? e.displayName || e.name : "", Ue = B ? X(B) : "";
|
|
284
|
+
return typeof e == "function" && Q.set(e, Ue), Ue;
|
|
285
285
|
}
|
|
286
286
|
function Qe(e, t, n) {
|
|
287
287
|
return xe(e, !1);
|
|
@@ -290,46 +290,46 @@ function wt() {
|
|
|
290
290
|
var t = e.prototype;
|
|
291
291
|
return !!(t && t.isReactComponent);
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function Z(e, t, n) {
|
|
294
294
|
if (e == null)
|
|
295
295
|
return "";
|
|
296
296
|
if (typeof e == "function")
|
|
297
297
|
return xe(e, Ze(e));
|
|
298
298
|
if (typeof e == "string")
|
|
299
|
-
return
|
|
299
|
+
return X(e);
|
|
300
300
|
switch (e) {
|
|
301
301
|
case g:
|
|
302
|
-
return
|
|
302
|
+
return X("Suspense");
|
|
303
303
|
case b:
|
|
304
|
-
return
|
|
304
|
+
return X("SuspenseList");
|
|
305
305
|
}
|
|
306
306
|
if (typeof e == "object")
|
|
307
307
|
switch (e.$$typeof) {
|
|
308
308
|
case d:
|
|
309
309
|
return Qe(e.render);
|
|
310
310
|
case m:
|
|
311
|
-
return
|
|
311
|
+
return Z(e.type, t, n);
|
|
312
312
|
case C: {
|
|
313
313
|
var f = e, y = f._payload, k = f._init;
|
|
314
314
|
try {
|
|
315
|
-
return
|
|
315
|
+
return Z(k(y), t, n);
|
|
316
316
|
} catch {
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
return "";
|
|
321
321
|
}
|
|
322
|
-
var
|
|
323
|
-
function
|
|
322
|
+
var ee = Object.prototype.hasOwnProperty, Oe = {}, je = L.ReactDebugCurrentFrame;
|
|
323
|
+
function te(e) {
|
|
324
324
|
if (e) {
|
|
325
|
-
var t = e._owner, n =
|
|
326
|
-
|
|
325
|
+
var t = e._owner, n = Z(e.type, e._source, t ? t.type : null);
|
|
326
|
+
je.setExtraStackFrame(n);
|
|
327
327
|
} else
|
|
328
|
-
|
|
328
|
+
je.setExtraStackFrame(null);
|
|
329
329
|
}
|
|
330
330
|
function et(e, t, n, f, y) {
|
|
331
331
|
{
|
|
332
|
-
var k = Function.call.bind(
|
|
332
|
+
var k = Function.call.bind(ee);
|
|
333
333
|
for (var _ in e)
|
|
334
334
|
if (k(e, _)) {
|
|
335
335
|
var p = void 0;
|
|
@@ -342,12 +342,12 @@ function wt() {
|
|
|
342
342
|
} catch (E) {
|
|
343
343
|
p = E;
|
|
344
344
|
}
|
|
345
|
-
p && !(p instanceof Error) && (
|
|
345
|
+
p && !(p instanceof Error) && (te(y), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", f || "React class", n, _, typeof p), te(null)), p instanceof Error && !(p.message in Oe) && (Oe[p.message] = !0, te(y), R("Failed %s type: %s", n, p.message), te(null));
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
var tt = Array.isArray;
|
|
350
|
-
function
|
|
350
|
+
function ve(e) {
|
|
351
351
|
return tt(e);
|
|
352
352
|
}
|
|
353
353
|
function rt(e) {
|
|
@@ -375,10 +375,10 @@ function wt() {
|
|
|
375
375
|
ref: !0,
|
|
376
376
|
__self: !0,
|
|
377
377
|
__source: !0
|
|
378
|
-
}, Ae, Fe,
|
|
379
|
-
|
|
378
|
+
}, Ae, Fe, he;
|
|
379
|
+
he = {};
|
|
380
380
|
function st(e) {
|
|
381
|
-
if (
|
|
381
|
+
if (ee.call(e, "ref")) {
|
|
382
382
|
var t = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
383
383
|
if (t && t.isReactWarning)
|
|
384
384
|
return !1;
|
|
@@ -386,7 +386,7 @@ function wt() {
|
|
|
386
386
|
return e.ref !== void 0;
|
|
387
387
|
}
|
|
388
388
|
function at(e) {
|
|
389
|
-
if (
|
|
389
|
+
if (ee.call(e, "key")) {
|
|
390
390
|
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
391
391
|
if (t && t.isReactWarning)
|
|
392
392
|
return !1;
|
|
@@ -395,8 +395,8 @@ function wt() {
|
|
|
395
395
|
}
|
|
396
396
|
function it(e, t) {
|
|
397
397
|
if (typeof e.ref == "string" && q.current && t && q.current.stateNode !== t) {
|
|
398
|
-
var n =
|
|
399
|
-
|
|
398
|
+
var n = O(q.current.type);
|
|
399
|
+
he[n] || (R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', O(q.current.type), e.ref), he[n] = !0);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
function ct(e, t) {
|
|
@@ -455,7 +455,7 @@ function wt() {
|
|
|
455
455
|
var k, _ = {}, p = null, x = null;
|
|
456
456
|
n !== void 0 && (Se(n), p = "" + n), at(t) && (Se(t.key), p = "" + t.key), st(t) && (x = t.ref, it(t, y));
|
|
457
457
|
for (k in t)
|
|
458
|
-
|
|
458
|
+
ee.call(t, k) && !ot.hasOwnProperty(k) && (_[k] = t[k]);
|
|
459
459
|
if (e && e.defaultProps) {
|
|
460
460
|
var E = e.defaultProps;
|
|
461
461
|
for (k in E)
|
|
@@ -468,23 +468,23 @@ function wt() {
|
|
|
468
468
|
return ut(e, p, x, y, f, q.current, _);
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
var
|
|
471
|
+
var pe = L.ReactCurrentOwner, Ne = L.ReactDebugCurrentFrame;
|
|
472
472
|
function V(e) {
|
|
473
473
|
if (e) {
|
|
474
|
-
var t = e._owner, n =
|
|
474
|
+
var t = e._owner, n = Z(e.type, e._source, t ? t.type : null);
|
|
475
475
|
Ne.setExtraStackFrame(n);
|
|
476
476
|
} else
|
|
477
477
|
Ne.setExtraStackFrame(null);
|
|
478
478
|
}
|
|
479
|
-
var
|
|
480
|
-
|
|
481
|
-
function
|
|
479
|
+
var _e;
|
|
480
|
+
_e = !1;
|
|
481
|
+
function ge(e) {
|
|
482
482
|
return typeof e == "object" && e !== null && e.$$typeof === s;
|
|
483
483
|
}
|
|
484
484
|
function De() {
|
|
485
485
|
{
|
|
486
|
-
if (
|
|
487
|
-
var e =
|
|
486
|
+
if (pe.current) {
|
|
487
|
+
var e = O(pe.current.type);
|
|
488
488
|
if (e)
|
|
489
489
|
return `
|
|
490
490
|
|
|
@@ -527,25 +527,25 @@ Check the top-level render call using <` + n + ">.");
|
|
|
527
527
|
return;
|
|
528
528
|
Ie[n] = !0;
|
|
529
529
|
var f = "";
|
|
530
|
-
e && e._owner && e._owner !==
|
|
530
|
+
e && e._owner && e._owner !== pe.current && (f = " It was passed a child from " + O(e._owner.type) + "."), V(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, f), V(null);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
function We(e, t) {
|
|
534
534
|
{
|
|
535
535
|
if (typeof e != "object")
|
|
536
536
|
return;
|
|
537
|
-
if (
|
|
537
|
+
if (ve(e))
|
|
538
538
|
for (var n = 0; n < e.length; n++) {
|
|
539
539
|
var f = e[n];
|
|
540
|
-
|
|
540
|
+
ge(f) && Le(f, t);
|
|
541
541
|
}
|
|
542
|
-
else if (
|
|
542
|
+
else if (ge(e))
|
|
543
543
|
e._store && (e._store.validated = !0);
|
|
544
544
|
else if (e) {
|
|
545
|
-
var y =
|
|
545
|
+
var y = U(e);
|
|
546
546
|
if (typeof y == "function" && y !== e.entries)
|
|
547
547
|
for (var k = y.call(e), _; !(_ = k.next()).done; )
|
|
548
|
-
|
|
548
|
+
ge(_.value) && Le(_.value, t);
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
551
|
}
|
|
@@ -564,11 +564,11 @@ Check the top-level render call using <` + n + ">.");
|
|
|
564
564
|
else
|
|
565
565
|
return;
|
|
566
566
|
if (n) {
|
|
567
|
-
var f =
|
|
567
|
+
var f = O(t);
|
|
568
568
|
et(n, e.props, "prop", f, e);
|
|
569
|
-
} else if (t.PropTypes !== void 0 && !
|
|
570
|
-
|
|
571
|
-
var y =
|
|
569
|
+
} else if (t.PropTypes !== void 0 && !_e) {
|
|
570
|
+
_e = !0;
|
|
571
|
+
var y = O(t);
|
|
572
572
|
R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", y || "Unknown");
|
|
573
573
|
}
|
|
574
574
|
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
@@ -595,7 +595,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
595
595
|
var x = ft(y);
|
|
596
596
|
x ? p += x : p += De();
|
|
597
597
|
var E;
|
|
598
|
-
e === null ? E = "null" :
|
|
598
|
+
e === null ? E = "null" : ve(e) ? E = "array" : e !== void 0 && e.$$typeof === s ? (E = "<" + (O(e.type) || "Unknown") + " />", p = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, p);
|
|
599
599
|
}
|
|
600
600
|
var w = dt(e, t, n, y, k);
|
|
601
601
|
if (w == null)
|
|
@@ -604,7 +604,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
604
604
|
var j = t.children;
|
|
605
605
|
if (j !== void 0)
|
|
606
606
|
if (f)
|
|
607
|
-
if (
|
|
607
|
+
if (ve(j)) {
|
|
608
608
|
for (var B = 0; B < j.length; B++)
|
|
609
609
|
We(j[B], e);
|
|
610
610
|
Object.freeze && Object.freeze(j);
|
|
@@ -626,9 +626,9 @@ Check the top-level render call using <` + n + ">.");
|
|
|
626
626
|
H.Fragment = a, H.jsx = yt, H.jsxs = bt;
|
|
627
627
|
}()), H;
|
|
628
628
|
}
|
|
629
|
-
process.env.NODE_ENV === "production" ?
|
|
630
|
-
var c =
|
|
631
|
-
const Be = "default",
|
|
629
|
+
process.env.NODE_ENV === "production" ? be.exports = wt() : be.exports = Ct();
|
|
630
|
+
var c = be.exports;
|
|
631
|
+
const Be = "default", Rt = (o, s) => async (...r) => {
|
|
632
632
|
var C;
|
|
633
633
|
const [a, u, ...l] = r, h = u ? { ...u } : { method: "GET" };
|
|
634
634
|
let i = new Headers();
|
|
@@ -644,43 +644,43 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
644
644
|
}
|
|
645
645
|
const m = { ...h, headers: i };
|
|
646
646
|
return await o(a, m, ...l);
|
|
647
|
-
},
|
|
648
|
-
const { fetch: u } =
|
|
647
|
+
}, Ht = (o = null, s = Be) => (r) => (a) => {
|
|
648
|
+
const { fetch: u } = xt(o || a.fetch, s);
|
|
649
649
|
return /* @__PURE__ */ c.jsx(r, { ...a, fetch: u });
|
|
650
|
-
},
|
|
650
|
+
}, xt = (o = null, s = Be) => {
|
|
651
651
|
const r = o || window.fetch, a = v.get;
|
|
652
652
|
return { fetch: kt(
|
|
653
|
-
(l, h) =>
|
|
653
|
+
(l, h) => Rt(r, () => a(s))(l, h),
|
|
654
654
|
[r, s]
|
|
655
655
|
) };
|
|
656
656
|
}, qe = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-authenticating__container", children: [
|
|
657
657
|
/* @__PURE__ */ c.jsx("h1", { className: "oidc-authenticating__title", children: "Error authentication" }),
|
|
658
658
|
/* @__PURE__ */ c.jsx("p", { className: "oidc-authenticating__content", children: "An error occurred during authentication." })
|
|
659
|
-
] }) }),
|
|
659
|
+
] }) }), Ot = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-authenticating", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-authenticating__container", children: [
|
|
660
660
|
/* @__PURE__ */ c.jsx("h1", { className: "oidc-authenticating__title", children: "Authentication in progress" }),
|
|
661
661
|
/* @__PURE__ */ c.jsx("p", { className: "oidc-authenticating__content", children: "You will be redirected to the login page." })
|
|
662
|
-
] }) }), jt = () => Math.random().toString(36).substr(2, 6),
|
|
662
|
+
] }) }), jt = () => Math.random().toString(36).substr(2, 6), Pt = (o, s) => (r, a) => {
|
|
663
663
|
if (typeof o.CustomEvent == "function")
|
|
664
664
|
return new o.CustomEvent(r, a);
|
|
665
665
|
const u = a || { bubbles: !1, cancelable: !1, detail: void 0 }, l = s.createEvent("CustomEvent");
|
|
666
666
|
return l.initCustomEvent(r, u.bubbles, u.cancelable, u.detail), l.prototype = o.Event.prototype, l;
|
|
667
|
-
},
|
|
667
|
+
}, St = (o, s, r) => ({
|
|
668
668
|
replaceState: (a, u) => {
|
|
669
669
|
const l = r(), h = u || o.history.state;
|
|
670
670
|
o.history.replaceState({ key: l, state: h }, null, a), o.dispatchEvent(s("popstate"));
|
|
671
671
|
}
|
|
672
|
-
}),
|
|
672
|
+
}), At = () => St(window, Pt(window, document), jt), ze = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-callback", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-callback__container", children: [
|
|
673
673
|
/* @__PURE__ */ c.jsx("h1", { className: "oidc-callback__title", children: "Authentication complete" }),
|
|
674
674
|
/* @__PURE__ */ c.jsx("p", { className: "oidc-callback__content", children: "You will be redirected to your application." })
|
|
675
|
-
] }) }),
|
|
675
|
+
] }) }), Ft = ({ callBackError: o, callBackSuccess: s, configurationName: r, withCustomHistory: a }) => {
|
|
676
676
|
const [u, l] = S(!1);
|
|
677
|
-
|
|
677
|
+
P(() => {
|
|
678
678
|
let d = !0;
|
|
679
679
|
return (async () => {
|
|
680
680
|
const b = v.get;
|
|
681
681
|
try {
|
|
682
682
|
const { callbackPath: m } = await b(r).loginCallbackAsync();
|
|
683
|
-
(a ? a() :
|
|
683
|
+
(a ? a() : At()).replaceState(m || "/");
|
|
684
684
|
} catch (m) {
|
|
685
685
|
d && (console.warn(m), l(!0));
|
|
686
686
|
}
|
|
@@ -690,26 +690,26 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
690
690
|
}, []);
|
|
691
691
|
const h = o || qe, i = s || ze;
|
|
692
692
|
return u ? /* @__PURE__ */ c.jsx(h, { configurationName: r }) : /* @__PURE__ */ c.jsx(i, { configurationName: r });
|
|
693
|
-
},
|
|
693
|
+
}, Nt = () => /* @__PURE__ */ c.jsx("span", { className: "oidc-loading", children: "Loading" }), Dt = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-serviceworker", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-serviceworker__container", children: [
|
|
694
694
|
/* @__PURE__ */ c.jsx("h1", { className: "oidc-serviceworker__title", children: "Unable to authenticate on this browser" }),
|
|
695
695
|
/* @__PURE__ */ c.jsx("p", { className: "oidc-serviceworker__content", children: "Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser." })
|
|
696
|
-
] }) }),
|
|
696
|
+
] }) }), It = () => /* @__PURE__ */ c.jsx("div", { className: "oidc-session-lost", children: /* @__PURE__ */ c.jsxs("div", { className: "oidc-session-lost__container", children: [
|
|
697
697
|
/* @__PURE__ */ c.jsx("h1", { className: "oidc-session-lost__title", children: "Session timed out" }),
|
|
698
698
|
/* @__PURE__ */ c.jsx("p", { className: "oidc-session-lost__content", children: "Your session has expired. Please re-authenticate." })
|
|
699
|
-
] }) }),
|
|
699
|
+
] }) }), Lt = ({ configurationName: o }) => (P(() => {
|
|
700
700
|
(async () => {
|
|
701
701
|
const r = v.get;
|
|
702
702
|
r(o).silentLoginCallbackAsync();
|
|
703
703
|
})();
|
|
704
|
-
}, []), /* @__PURE__ */ c.jsx(c.Fragment, {})),
|
|
704
|
+
}, []), /* @__PURE__ */ c.jsx(c.Fragment, {})), Wt = ({ configurationName: o }) => {
|
|
705
705
|
const s = mt(window.location.href), r = v.get, a = r(o);
|
|
706
706
|
let u = null;
|
|
707
707
|
for (const [l, h] of Object.entries(s))
|
|
708
708
|
l === "state" || l === "scope" || (u === null && (u = {}), u[l] = h);
|
|
709
|
-
return
|
|
709
|
+
return P(() => {
|
|
710
710
|
a.tokens || a.loginAsync(null, u, !0, s.scope);
|
|
711
711
|
}, []), /* @__PURE__ */ c.jsx(c.Fragment, {});
|
|
712
|
-
},
|
|
712
|
+
}, $t = ({
|
|
713
713
|
callbackErrorComponent: o,
|
|
714
714
|
callbackSuccessComponent: s,
|
|
715
715
|
redirect_uri: r,
|
|
@@ -720,24 +720,24 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
720
720
|
withCustomHistory: i = null
|
|
721
721
|
}) => {
|
|
722
722
|
const d = window ? z(window.location.href) : "", [g, b] = S(d);
|
|
723
|
-
|
|
723
|
+
P(() => {
|
|
724
724
|
const C = () => b(z(window.location.href));
|
|
725
725
|
return C(), window.addEventListener("popstate", C, !1), () => window.removeEventListener("popstate", C, !1);
|
|
726
726
|
}, []);
|
|
727
727
|
const m = z(r);
|
|
728
728
|
if (a && g === z(a))
|
|
729
|
-
return /* @__PURE__ */ c.jsx(It, { configurationName: h });
|
|
730
|
-
if (u && g === z(u))
|
|
731
729
|
return /* @__PURE__ */ c.jsx(Lt, { configurationName: h });
|
|
730
|
+
if (u && g === z(u))
|
|
731
|
+
return /* @__PURE__ */ c.jsx(Wt, { configurationName: h });
|
|
732
732
|
switch (g) {
|
|
733
733
|
case m:
|
|
734
|
-
return /* @__PURE__ */ c.jsx(
|
|
734
|
+
return /* @__PURE__ */ c.jsx(Ft, { callBackError: o, callBackSuccess: s, configurationName: h, withCustomHistory: i });
|
|
735
735
|
default:
|
|
736
736
|
return /* @__PURE__ */ c.jsx(c.Fragment, { children: l });
|
|
737
737
|
}
|
|
738
|
-
},
|
|
738
|
+
}, Ut = ke.memo($t), Ve = { name: "", data: null }, Yt = ({ loadingComponent: o, children: s, configurationName: r }) => {
|
|
739
739
|
const [a, u] = S(!0), l = v.get, h = l(r);
|
|
740
|
-
|
|
740
|
+
P(() => {
|
|
741
741
|
let d = !0;
|
|
742
742
|
return h && h.tryKeepExistingSessionAsync().then(() => {
|
|
743
743
|
d && u(!1);
|
|
@@ -750,97 +750,98 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
750
750
|
}, J = ({ isLoading: o, loadingComponent: s, children: r, configurationName: a }) => {
|
|
751
751
|
const u = s;
|
|
752
752
|
return o ? /* @__PURE__ */ c.jsx(u, { configurationName: a, children: r }) : /* @__PURE__ */ c.jsx(c.Fragment, { children: r });
|
|
753
|
-
},
|
|
753
|
+
}, Jt = ({
|
|
754
754
|
children: o,
|
|
755
755
|
configuration: s,
|
|
756
756
|
configurationName: r = "default",
|
|
757
757
|
callbackSuccessComponent: a = ze,
|
|
758
|
-
authenticatingComponent: u =
|
|
759
|
-
loadingComponent: l =
|
|
760
|
-
serviceWorkerNotSupportedComponent: h =
|
|
758
|
+
authenticatingComponent: u = Ot,
|
|
759
|
+
loadingComponent: l = Nt,
|
|
760
|
+
serviceWorkerNotSupportedComponent: h = Dt,
|
|
761
761
|
authenticatingErrorComponent: i = qe,
|
|
762
|
-
sessionLostComponent: d =
|
|
762
|
+
sessionLostComponent: d = It,
|
|
763
763
|
onSessionLost: g = null,
|
|
764
764
|
onLogoutFromAnotherTab: b = null,
|
|
765
765
|
onLogoutFromSameTab: m = null,
|
|
766
766
|
withCustomHistory: C = null,
|
|
767
767
|
onEvent: A = null,
|
|
768
|
-
getFetch: K = null
|
|
768
|
+
getFetch: K = null,
|
|
769
|
+
location: re = null
|
|
769
770
|
}) => {
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
const
|
|
771
|
+
const U = (N = "default") => v.getOrCreate(K ?? Et, re ?? new Tt())(s, N), [L, R] = S(!0), [ne, Y] = S(Ve), [oe, se] = S("default");
|
|
772
|
+
P(() => {
|
|
773
|
+
const M = U(r).subscribeEvents((T, D) => {
|
|
773
774
|
A && A(r, T, D);
|
|
774
775
|
});
|
|
775
776
|
return () => {
|
|
776
|
-
|
|
777
|
+
U(r).removeEventSubscription(M);
|
|
777
778
|
};
|
|
778
|
-
}, [r, A]),
|
|
779
|
-
const
|
|
779
|
+
}, [r, A]), P(() => {
|
|
780
|
+
const M = U(r).subscribeEvents((T, D) => {
|
|
780
781
|
if (T === v.eventNames.refreshTokensAsync_error || T === v.eventNames.syncTokensAsync_error) {
|
|
781
782
|
if (g != null) {
|
|
782
783
|
g();
|
|
783
784
|
return;
|
|
784
785
|
}
|
|
785
|
-
|
|
786
|
+
Y({ name: T, data: D });
|
|
786
787
|
} else if (T === v.eventNames.logout_from_another_tab) {
|
|
787
788
|
if (b != null) {
|
|
788
789
|
b();
|
|
789
790
|
return;
|
|
790
791
|
}
|
|
791
|
-
|
|
792
|
+
Y({ name: T, data: D });
|
|
792
793
|
} else
|
|
793
|
-
T === v.eventNames.logout_from_same_tab ? m != null && m() : T === v.eventNames.loginAsync_begin || T === v.eventNames.loginCallbackAsync_end || T === v.eventNames.loginAsync_error || T === v.eventNames.loginCallbackAsync_error ?
|
|
794
|
+
T === v.eventNames.logout_from_same_tab ? m != null && m() : T === v.eventNames.loginAsync_begin || T === v.eventNames.loginCallbackAsync_end || T === v.eventNames.loginAsync_error || T === v.eventNames.loginCallbackAsync_error ? Y({ name: T, data: D }) : T === v.eventNames.service_worker_not_supported_by_browser && s.service_worker_only === !0 && Y({ name: T, data: D });
|
|
794
795
|
});
|
|
795
|
-
return se(r),
|
|
796
|
-
|
|
796
|
+
return se(r), R(!1), () => {
|
|
797
|
+
U(r).removeEventSubscription(M), Y(Ve);
|
|
797
798
|
};
|
|
798
799
|
}, [s, r]);
|
|
799
|
-
const ae = d, ie = u,
|
|
800
|
-
switch (
|
|
800
|
+
const ae = d, ie = u, F = l, ce = h, le = i, W = L || oe !== r, O = U(r);
|
|
801
|
+
switch (ne.name) {
|
|
801
802
|
case v.eventNames.service_worker_not_supported_by_browser:
|
|
802
|
-
return /* @__PURE__ */ c.jsx(J, { loadingComponent:
|
|
803
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: F, isLoading: W, configurationName: r, children: /* @__PURE__ */ c.jsx(ce, { configurationName: r }) });
|
|
803
804
|
case v.eventNames.loginAsync_begin:
|
|
804
|
-
return /* @__PURE__ */ c.jsx(J, { loadingComponent:
|
|
805
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: F, isLoading: W, configurationName: r, children: /* @__PURE__ */ c.jsx(ie, { configurationName: r }) });
|
|
805
806
|
case v.eventNames.loginAsync_error:
|
|
806
807
|
case v.eventNames.loginCallbackAsync_error:
|
|
807
|
-
return /* @__PURE__ */ c.jsx(J, { loadingComponent:
|
|
808
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: F, isLoading: W, configurationName: r, children: /* @__PURE__ */ c.jsx(le, { configurationName: r }) });
|
|
808
809
|
case v.eventNames.refreshTokensAsync_error:
|
|
809
810
|
case v.eventNames.syncTokensAsync_error:
|
|
810
811
|
case v.eventNames.logout_from_another_tab:
|
|
811
|
-
return /* @__PURE__ */ c.jsx(J, { loadingComponent:
|
|
812
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: F, isLoading: W, configurationName: r, children: /* @__PURE__ */ c.jsx(ae, { configurationName: r }) });
|
|
812
813
|
default:
|
|
813
|
-
return /* @__PURE__ */ c.jsx(J, { loadingComponent:
|
|
814
|
-
|
|
814
|
+
return /* @__PURE__ */ c.jsx(J, { loadingComponent: F, isLoading: W, configurationName: r, children: /* @__PURE__ */ c.jsx(
|
|
815
|
+
Ut,
|
|
815
816
|
{
|
|
816
|
-
redirect_uri:
|
|
817
|
-
silent_redirect_uri:
|
|
818
|
-
silent_login_uri:
|
|
817
|
+
redirect_uri: O.configuration.redirect_uri,
|
|
818
|
+
silent_redirect_uri: O.configuration.silent_redirect_uri,
|
|
819
|
+
silent_login_uri: O.configuration.silent_login_uri,
|
|
819
820
|
callbackSuccessComponent: a,
|
|
820
821
|
callbackErrorComponent: i,
|
|
821
822
|
authenticatingComponent: u,
|
|
822
823
|
configurationName: r,
|
|
823
824
|
withCustomHistory: C,
|
|
824
|
-
children: /* @__PURE__ */ c.jsx(
|
|
825
|
+
children: /* @__PURE__ */ c.jsx(Yt, { loadingComponent: F, configurationName: r, children: o })
|
|
825
826
|
}
|
|
826
827
|
) });
|
|
827
828
|
}
|
|
828
|
-
},
|
|
829
|
+
}, Mt = ({ children: o, callbackPath: s = null, extras: r = null, configurationName: a = "default" }) => {
|
|
829
830
|
const u = v.get, l = u(a);
|
|
830
|
-
return
|
|
831
|
+
return P(() => {
|
|
831
832
|
l.tokens || l.loginAsync(s, r);
|
|
832
833
|
}, [a, s, r]), l.tokens ? /* @__PURE__ */ c.jsx(c.Fragment, { children: o }) : null;
|
|
833
|
-
},
|
|
834
|
+
}, Kt = (o, s = null, r = null, a = "default") => (u) => /* @__PURE__ */ c.jsx(Mt, { callbackPath: s, extras: r, configurationName: a, children: /* @__PURE__ */ c.jsx(o, { ...u }) }), me = "default", ye = (o, s) => {
|
|
834
835
|
let r = !1;
|
|
835
836
|
return o(s) && (r = o(s).tokens != null), r;
|
|
836
|
-
},
|
|
837
|
-
const s = v.get, [r, a] = S(
|
|
838
|
-
return
|
|
837
|
+
}, Xt = (o = me) => {
|
|
838
|
+
const s = v.get, [r, a] = S(ye(s, o));
|
|
839
|
+
return P(() => {
|
|
839
840
|
let i = !0;
|
|
840
841
|
const d = s(o);
|
|
841
|
-
a(
|
|
842
|
+
a(ye(s, o));
|
|
842
843
|
const g = d.subscribeEvents((b, m) => {
|
|
843
|
-
(b === v.eventNames.logout_from_another_tab || b === v.eventNames.logout_from_same_tab || b === v.eventNames.token_aquired) && i && a(
|
|
844
|
+
(b === v.eventNames.logout_from_another_tab || b === v.eventNames.logout_from_same_tab || b === v.eventNames.token_aquired) && i && a(ye(s, o));
|
|
844
845
|
});
|
|
845
846
|
return () => {
|
|
846
847
|
i = !1, d.removeEventSubscription(g);
|
|
@@ -858,7 +859,7 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
858
859
|
idTokenPayload: d.idTokenPayload
|
|
859
860
|
};
|
|
860
861
|
}, isAuthenticated: r };
|
|
861
|
-
}, Ge = { accessToken: null, accessTokenPayload: null },
|
|
862
|
+
}, Ge = { accessToken: null, accessTokenPayload: null }, Vt = (o) => {
|
|
862
863
|
const s = v.get, r = s(o);
|
|
863
864
|
if (r.tokens) {
|
|
864
865
|
const a = r.tokens;
|
|
@@ -868,9 +869,9 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
868
869
|
};
|
|
869
870
|
}
|
|
870
871
|
return Ge;
|
|
871
|
-
},
|
|
872
|
-
const s = v.get, [r, a] = S(
|
|
873
|
-
return
|
|
872
|
+
}, Qt = (o = me) => {
|
|
873
|
+
const s = v.get, [r, a] = S(Vt(o));
|
|
874
|
+
return P(() => {
|
|
874
875
|
let u = !0;
|
|
875
876
|
const l = s(o);
|
|
876
877
|
if (l.tokens) {
|
|
@@ -887,16 +888,16 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
887
888
|
u = !1, l.removeEventSubscription(h);
|
|
888
889
|
};
|
|
889
890
|
}, [o]), r;
|
|
890
|
-
}, He = { idToken: null, idTokenPayload: null },
|
|
891
|
+
}, He = { idToken: null, idTokenPayload: null }, Bt = (o) => {
|
|
891
892
|
const s = v.get, r = s(o);
|
|
892
893
|
if (r.tokens) {
|
|
893
894
|
const a = r.tokens;
|
|
894
895
|
return { idToken: a.idToken, idTokenPayload: a.idTokenPayload };
|
|
895
896
|
}
|
|
896
897
|
return He;
|
|
897
|
-
},
|
|
898
|
-
const s = v.get, [r, a] = S(
|
|
899
|
-
return
|
|
898
|
+
}, Zt = (o = me) => {
|
|
899
|
+
const s = v.get, [r, a] = S(Bt(o));
|
|
900
|
+
return P(() => {
|
|
900
901
|
let u = !0;
|
|
901
902
|
const l = s(o);
|
|
902
903
|
if (l.tokens) {
|
|
@@ -914,14 +915,14 @@ const Be = "default", Ct = (o, s) => async (...r) => {
|
|
|
914
915
|
};
|
|
915
916
|
}, [o]), r;
|
|
916
917
|
};
|
|
917
|
-
var
|
|
918
|
-
const
|
|
918
|
+
var qt = /* @__PURE__ */ ((o) => (o.Unauthenticated = "Unauthenticated", o.Loading = "Loading user", o.Loaded = "User loaded", o.LoadingError = "Error loading user", o))(qt || {});
|
|
919
|
+
const er = (o = "default") => {
|
|
919
920
|
const [s, r] = S({
|
|
920
921
|
user: null,
|
|
921
922
|
status: "Unauthenticated"
|
|
922
923
|
/* Unauthenticated */
|
|
923
924
|
}), [a, u] = S(""), l = v.get(o);
|
|
924
|
-
|
|
925
|
+
P(() => {
|
|
925
926
|
let i = !0;
|
|
926
927
|
if (l && l.tokens) {
|
|
927
928
|
r({
|
|
@@ -957,15 +958,15 @@ const Zt = (o = "default") => {
|
|
|
957
958
|
return { oidcUser: s.user, oidcUserLoadingState: s.status, reloadOidcUser: h };
|
|
958
959
|
};
|
|
959
960
|
export {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
961
|
+
Jt as OidcProvider,
|
|
962
|
+
Mt as OidcSecure,
|
|
963
|
+
qt as OidcUserStatus,
|
|
964
|
+
nr as TokenRenewMode,
|
|
965
|
+
Xt as useOidc,
|
|
966
|
+
Qt as useOidcAccessToken,
|
|
967
|
+
xt as useOidcFetch,
|
|
968
|
+
Zt as useOidcIdToken,
|
|
969
|
+
er as useOidcUser,
|
|
970
|
+
Ht as withOidcFetch,
|
|
971
|
+
Kt as withOidcSecure
|
|
971
972
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(R,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react"),require("@axa-fr/oidc-client")):typeof define=="function"&&define.amd?define(["exports","react","@axa-fr/oidc-client"],y):(R=typeof globalThis<"u"?globalThis:R||self,y(R["react-oidc"]={},R.React,R.oidcClient))})(this,function(R,y,l){"use strict";var
|
|
1
|
+
(function(R,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react"),require("@axa-fr/oidc-client")):typeof define=="function"&&define.amd?define(["exports","react","@axa-fr/oidc-client"],y):(R=typeof globalThis<"u"?globalThis:R||self,y(R["react-oidc"]={},R.React,R.oidcClient))})(this,function(R,y,l){"use strict";var te={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
|
|
9
|
+
*/var ke;function Qe(){if(ke)return G;ke=1;var s=y,o=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,d=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function h(i,f,g){var k,O={},S=null,A=null;g!==void 0&&(S=""+g),f.key!==void 0&&(S=""+f.key),f.ref!==void 0&&(A=f.ref);for(k in f)a.call(f,k)&&!u.hasOwnProperty(k)&&(O[k]=f[k]);if(i&&i.defaultProps)for(k in f=i.defaultProps,f)O[k]===void 0&&(O[k]=f[k]);return{$$typeof:o,type:i,key:S,ref:A,props:O,_owner:d.current}}return G.Fragment=n,G.jsx=h,G.jsxs=h,G}var H={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
17
|
+
*/var me;function Ze(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){var s=y,o=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),i=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),X=Symbol.iterator,se="@@iterator";function M(e){if(e===null||typeof e!="object")return null;var t=X&&e[X]||e[se];return typeof t=="function"?t:null}var L=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(e){{for(var t=arguments.length,r=new Array(t>1?t-1:0),v=1;v<t;v++)r[v-1]=arguments[v];oe("error",e,r)}}function oe(e,t,r){{var v=L.ReactDebugCurrentFrame,b=v.getStackAddendum();b!==""&&(t+="%s",r=r.concat([b]));var m=r.map(function(_){return String(_)});m.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,m)}}var Y=!1,ae=!1,ie=!1,ce=!1,le=!1,F;F=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===a||e===u||le||e===d||e===g||e===k||ce||e===A||Y||ae||ie||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===O||e.$$typeof===h||e.$$typeof===i||e.$$typeof===f||e.$$typeof===F||e.getModuleId!==void 0))}function de(e,t,r){var v=e.displayName;if(v)return v;var b=t.displayName||t.name||"";return b!==""?r+"("+b+")":r}function U(e){return e.displayName||"Context"}function C(e){if(e==null)return null;if(typeof e.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case a:return"Fragment";case n:return"Portal";case u:return"Profiler";case d:return"StrictMode";case g:return"Suspense";case k:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case i:var t=e;return U(t)+".Consumer";case h:var r=e;return U(r._context)+".Provider";case f:return de(e,e.render,"ForwardRef");case O:var v=e.displayName||null;return v!==null?v:C(e.type)||"Memo";case S:{var b=e,m=b._payload,_=b._init;try{return C(_(m))}catch{return null}}}return null}var W=Object.assign,N=0,V,T,D,xe,Ae,Fe,Ne;function De(){}De.__reactDisabledLog=!0;function Ot(){{if(N===0){V=console.log,T=console.info,D=console.warn,xe=console.error,Ae=console.group,Fe=console.groupCollapsed,Ne=console.groupEnd;var e={configurable:!0,enumerable:!0,value:De,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}}function Et(){{if(N--,N===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:V}),info:W({},e,{value:T}),warn:W({},e,{value:D}),error:W({},e,{value:xe}),group:W({},e,{value:Ae}),groupCollapsed:W({},e,{value:Fe}),groupEnd:W({},e,{value:Ne})})}N<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=L.ReactCurrentDispatcher,ve;function Q(e,t,r){{if(ve===void 0)try{throw Error()}catch(b){var v=b.stack.trim().match(/\n( *(at )?)/);ve=v&&v[1]||""}return`
|
|
18
|
+
`+ve+e}}var he=!1,Z;{var Tt=typeof WeakMap=="function"?WeakMap:Map;Z=new Tt}function Ie(e,t){if(!e||he)return"";{var r=Z.get(e);if(r!==void 0)return r}var v;he=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var m;m=fe.current,fe.current=null,Ot();try{if(t){var _=function(){throw Error()};if(Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(I){v=I}Reflect.construct(e,[],_)}else{try{_.call()}catch(I){v=I}e.call(_.prototype)}}else{try{throw Error()}catch(I){v=I}e()}}catch(I){if(I&&v&&typeof I.stack=="string"){for(var p=I.stack.split(`
|
|
19
19
|
`),P=v.stack.split(`
|
|
20
|
-
`),E=p.length-1,w=P.length-1;E>=1&&w>=0&&p[E]!==P[w];)w--;for(;E>=1&&w>=0;E--,w--)if(p[E]!==P[w]){if(E!==1||w!==1)do if(E--,w--,w<0||p[E]!==P[w]){var
|
|
21
|
-
`+p[E].replace(" at new "," at ");return e.displayName&&
|
|
20
|
+
`),E=p.length-1,w=P.length-1;E>=1&&w>=0&&p[E]!==P[w];)w--;for(;E>=1&&w>=0;E--,w--)if(p[E]!==P[w]){if(E!==1||w!==1)do if(E--,w--,w<0||p[E]!==P[w]){var x=`
|
|
21
|
+
`+p[E].replace(" at new "," at ");return e.displayName&&x.includes("<anonymous>")&&(x=x.replace("<anonymous>",e.displayName)),typeof e=="function"&&Z.set(e,x),x}while(E>=1&&w>=0);break}}}finally{he=!1,fe.current=m,Et(),Error.prepareStackTrace=b}var z=e?e.displayName||e.name:"",Xe=z?Q(z):"";return typeof e=="function"&&Z.set(e,Xe),Xe}function wt(e,t,r){return Ie(e,!1)}function Rt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function q(e,t,r){if(e==null)return"";if(typeof e=="function")return Ie(e,Rt(e));if(typeof e=="string")return Q(e);switch(e){case g:return Q("Suspense");case k:return Q("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return wt(e.render);case O:return q(e.type,t,r);case S:{var v=e,b=v._payload,m=v._init;try{return q(m(b),t,r)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,Le={},Ue=L.ReactDebugCurrentFrame;function ee(e){if(e){var t=e._owner,r=q(e.type,e._source,t?t.type:null);Ue.setExtraStackFrame(r)}else Ue.setExtraStackFrame(null)}function St(e,t,r,v,b){{var m=Function.call.bind($);for(var _ in e)if(m(e,_)){var p=void 0;try{if(typeof e[_]!="function"){var P=Error((v||"React class")+": "+r+" type `"+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[_]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}p=e[_](t,_,v,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){p=E}p&&!(p instanceof Error)&&(ee(b),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",v||"React class",r,_,typeof p),ee(null)),p instanceof Error&&!(p.message in Le)&&(Le[p.message]=!0,ee(b),j("Failed %s type: %s",r,p.message),ee(null))}}}var jt=Array.isArray;function pe(e){return jt(e)}function Pt(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,r=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r}}function Ct(e){try{return We(e),!1}catch{return!0}}function We(e){return""+e}function Me(e){if(Ct(e))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Pt(e)),We(e)}var K=L.ReactCurrentOwner,xt={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ve,_e;_e={};function At(e){if($.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function Ft(e){if($.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Nt(e,t){if(typeof e.ref=="string"&&K.current&&t&&K.current.stateNode!==t){var r=C(K.current.type);_e[r]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',C(K.current.type),e.ref),_e[r]=!0)}}function Dt(e,t){{var r=function(){Ye||(Ye=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}}function It(e,t){{var r=function(){Ve||(Ve=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}}var Lt=function(e,t,r,v,b,m,_){var p={$$typeof:o,type:e,key:t,ref:r,props:_,_owner:m};return p._store={},Object.defineProperty(p._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(p,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(p,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(p.props),Object.freeze(p)),p};function Ut(e,t,r,v,b){{var m,_={},p=null,P=null;r!==void 0&&(Me(r),p=""+r),Ft(t)&&(Me(t.key),p=""+t.key),At(t)&&(P=t.ref,Nt(t,b));for(m in t)$.call(t,m)&&!xt.hasOwnProperty(m)&&(_[m]=t[m]);if(e&&e.defaultProps){var E=e.defaultProps;for(m in E)_[m]===void 0&&(_[m]=E[m])}if(p||P){var w=typeof e=="function"?e.displayName||e.name||"Unknown":e;p&&Dt(_,w),P&&It(_,w)}return Lt(e,p,P,b,v,K.current,_)}}var ge=L.ReactCurrentOwner,Be=L.ReactDebugCurrentFrame;function B(e){if(e){var t=e._owner,r=q(e.type,e._source,t?t.type:null);Be.setExtraStackFrame(r)}else Be.setExtraStackFrame(null)}var ye;ye=!1;function be(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function ze(){{if(ge.current){var e=C(ge.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function Wt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),r=e.lineNumber;return`
|
|
24
24
|
|
|
25
25
|
Check your code at `+t+":"+r+"."}return""}}var Ge={};function Mt(e){{var t=ze();if(!t){var r=typeof e=="string"?e:e.displayName||e.name;r&&(t=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+r+">.")}return t}}function He(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Mt(t);if(Ge[r])return;Ge[r]=!0;var v="";e&&e._owner&&e._owner!==_e.current&&(v=" It was passed a child from "+F(e._owner.type)+"."),B(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,v),B(null)}}function Je(e,t){{if(typeof e!="object")return;if(he(e))for(var r=0;r<e.length;r++){var v=e[r];ye(v)&&He(v,t)}else if(ye(e))e._store&&(e._store.validated=!0);else if(e){var b=oe(e);if(typeof b=="function"&&b!==e.entries)for(var m=b.call(e),_;!(_=m.next()).done;)ye(_.value)&&He(_.value,t)}}}function Yt(e){{var t=e.type;if(t==null||typeof t=="string")return;var r;if(typeof t=="function")r=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===f||t.$$typeof===O))r=t.propTypes;else return;if(r){var v=F(t);St(r,e.props,"prop",v,e)}else if(t.PropTypes!==void 0&&!ge){ge=!0;var b=F(t);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var v=t[r];if(v!=="children"&&v!=="key"){B(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),B(null);break}}e.ref!==null&&(B(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function Ke(e,t,r,v,b,m){{var _=ue(e);if(!_){var p="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(p+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=Wt(b);P?p+=P:p+=ze();var E;e===null?E="null":he(e)?E="array":e!==void 0&&e.$$typeof===o?(E="<"+(F(e.type)||"Unknown")+" />",p=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,p)}var w=Ut(e,t,r,b,m);if(w==null)return w;if(_){var C=t.children;if(C!==void 0)if(v)if(he(C)){for(var z=0;z<C.length;z++)Je(C[z],e);Object.freeze&&Object.freeze(C)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Je(C,e)}return e===a?Vt(w):Yt(w),w}}function Bt(e,t,r){return Ke(e,t,r,!0)}function zt(e,t,r){return Ke(e,t,r,!1)}var Gt=zt,Ht=Bt;H.Fragment=a,H.jsx=Gt,H.jsxs=Ht}()),H}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=Ze();var c=ne.exports;const me="default",qe=(s,o)=>async(...n)=>{var S;const[a,d,...u]=n,h=d?{...d}:{method:"GET"};let i=new Headers;h.headers&&(i=h.headers instanceof Headers?h.headers:new Headers(h.headers));const f=o(),g=await f.getValidTokenAsync(),k=(S=g==null?void 0:g.tokens)==null?void 0:S.accessToken;if(i.has("Accept")||i.set("Accept","application/json"),k){if(f.configuration.demonstrating_proof_of_possession){const A=await f.generateDemonstrationOfProofOfPossessionAsync(k,a.toString(),h.method);i.set("Authorization",`PoP ${k}`),i.set("DPoP",A)}else i.set("Authorization",`Bearer ${k}`);h.credentials||(h.credentials="same-origin")}const O={...h,headers:i};return await s(a,O,...u)},$e=(s=null,o=me)=>n=>a=>{const{fetch:d}=Oe(s||a.fetch,o);return c.jsx(n,{...a,fetch:d})},Oe=(s=null,o=me)=>{const n=s||window.fetch,a=l.OidcClient.get;return{fetch:y.useCallback((u,h)=>qe(n,()=>a(o))(u,h),[n,o])}},Ee=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Error authentication"}),c.jsx("p",{className:"oidc-authenticating__content",children:"An error occurred during authentication."})]})}),et=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Authentication in progress"}),c.jsx("p",{className:"oidc-authenticating__content",children:"You will be redirected to the login page."})]})}),tt=()=>Math.random().toString(36).substr(2,6),nt=(s,o)=>(n,a)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,a);const d=a||{bubbles:!1,cancelable:!1,detail:void 0},u=o.createEvent("CustomEvent");return u.initCustomEvent(n,d.bubbles,d.cancelable,d.detail),u.prototype=s.Event.prototype,u},rt=(s,o,n)=>({replaceState:(a,d)=>{const u=n(),h=d||s.history.state;s.history.replaceState({key:u,state:h},null,a),s.dispatchEvent(o("popstate"))}}),st=()=>rt(window,nt(window,document),tt),Te=()=>c.jsx("div",{className:"oidc-callback",children:c.jsxs("div",{className:"oidc-callback__container",children:[c.jsx("h1",{className:"oidc-callback__title",children:"Authentication complete"}),c.jsx("p",{className:"oidc-callback__content",children:"You will be redirected to your application."})]})}),ot=({callBackError:s,callBackSuccess:o,configurationName:n,withCustomHistory:a})=>{const[d,u]=y.useState(!1);y.useEffect(()=>{let f=!0;return(async()=>{const k=l.OidcClient.get;try{const{callbackPath:O}=await k(n).loginCallbackAsync();(a?a():st()).replaceState(O||"/")}catch(O){f&&(console.warn(O),u(!0))}})(),()=>{f=!1}},[]);const h=s||Ee,i=o||Te;return d?c.jsx(h,{configurationName:n}):c.jsx(i,{configurationName:n})},at=()=>c.jsx("span",{className:"oidc-loading",children:"Loading"}),it=()=>c.jsx("div",{className:"oidc-serviceworker",children:c.jsxs("div",{className:"oidc-serviceworker__container",children:[c.jsx("h1",{className:"oidc-serviceworker__title",children:"Unable to authenticate on this browser"}),c.jsx("p",{className:"oidc-serviceworker__content",children:"Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser."})]})}),ct=()=>c.jsx("div",{className:"oidc-session-lost",children:c.jsxs("div",{className:"oidc-session-lost__container",children:[c.jsx("h1",{className:"oidc-session-lost__title",children:"Session timed out"}),c.jsx("p",{className:"oidc-session-lost__content",children:"Your session has expired. Please re-authenticate."})]})}),lt=({configurationName:s})=>(y.useEffect(()=>{(async()=>{const n=l.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),c.jsx(c.Fragment,{})),ut=({configurationName:s})=>{const o=l.getParseQueryStringFromLocation(window.location.href),n=l.OidcClient.get,a=n(s);let d=null;for(const[u,h]of Object.entries(o))u==="state"||u==="scope"||(d===null&&(d={}),d[u]=h);return y.useEffect(()=>{a.tokens||a.loginAsync(null,d,!0,o.scope)},[]),c.jsx(c.Fragment,{})},dt=({callbackErrorComponent:s,callbackSuccessComponent:o,redirect_uri:n,silent_redirect_uri:a,silent_login_uri:d,children:u,configurationName:h,withCustomHistory:i=null})=>{const f=window?l.getPath(window.location.href):"",[g,k]=y.useState(f);y.useEffect(()=>{const S=()=>k(l.getPath(window.location.href));return S(),window.addEventListener("popstate",S,!1),()=>window.removeEventListener("popstate",S,!1)},[]);const O=l.getPath(n);if(a&&g===l.getPath(a))return c.jsx(lt,{configurationName:h});if(d&&g===l.getPath(d))return c.jsx(ut,{configurationName:h});switch(g){case O:return c.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:h,withCustomHistory:i});default:return c.jsx(c.Fragment,{children:u})}},ft=y.memo(dt),we={name:"",data:null},vt=({loadingComponent:s,children:o,configurationName:n})=>{const[a,d]=y.useState(!0),u=l.OidcClient.get,h=u(n);y.useEffect(()=>{let f=!0;return h&&h.tryKeepExistingSessionAsync().then(()=>{f&&d(!1)}),()=>{f=!1}},[n]);const i=s;return c.jsx(c.Fragment,{children:a?c.jsx(i,{configurationName:n}):c.jsx(c.Fragment,{children:o})})},J=({isLoading:s,loadingComponent:o,children:n,configurationName:a})=>{const d=o;return s?c.jsx(d,{configurationName:a,children:n}):c.jsx(c.Fragment,{children:n})},ht=({children:s,configuration:o,configurationName:n="default",callbackSuccessComponent:a=Te,authenticatingComponent:d=et,loadingComponent:u=at,serviceWorkerNotSupportedComponent:h=it,authenticatingErrorComponent:i=Ee,sessionLostComponent:f=ct,onSessionLost:g=null,onLogoutFromAnotherTab:k=null,onLogoutFromSameTab:O=null,withCustomHistory:S=null,onEvent:A=null,getFetch:X=null})=>{const W=(x="default")=>l.OidcClient.getOrCreate(X??l.getFetchDefault)(o,x),[oe,L]=y.useState(!0),[j,M]=y.useState(we),[ae,ie]=y.useState("default");y.useEffect(()=>{const N=W(n).subscribeEvents((T,D)=>{A&&A(n,T,D)});return()=>{W(n).removeEventSubscription(N)}},[n,A]),y.useEffect(()=>{const N=W(n).subscribeEvents((T,D)=>{if(T===l.OidcClient.eventNames.refreshTokensAsync_error||T===l.OidcClient.eventNames.syncTokensAsync_error){if(g!=null){g();return}M({name:T,data:D})}else if(T===l.OidcClient.eventNames.logout_from_another_tab){if(k!=null){k();return}M({name:T,data:D})}else T===l.OidcClient.eventNames.logout_from_same_tab?O!=null&&O():T===l.OidcClient.eventNames.loginAsync_begin||T===l.OidcClient.eventNames.loginCallbackAsync_end||T===l.OidcClient.eventNames.loginAsync_error||T===l.OidcClient.eventNames.loginCallbackAsync_error?M({name:T,data:D}):T===l.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&M({name:T,data:D})});return ie(n),L(!1),()=>{W(n).removeEventSubscription(N),M(we)}},[o,n]);const ce=f,le=d,U=u,Q=h,ue=i,Y=oe||ae!==n,V=W(n);switch(j.name){case l.OidcClient.eventNames.service_worker_not_supported_by_browser:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(Q,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_begin:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(le,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_error:case l.OidcClient.eventNames.loginCallbackAsync_error:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(ue,{configurationName:n})});case l.OidcClient.eventNames.refreshTokensAsync_error:case l.OidcClient.eventNames.syncTokensAsync_error:case l.OidcClient.eventNames.logout_from_another_tab:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(ce,{configurationName:n})});default:return c.jsx(J,{loadingComponent:U,isLoading:Y,configurationName:n,children:c.jsx(ft,{redirect_uri:V.configuration.redirect_uri,silent_redirect_uri:V.configuration.silent_redirect_uri,silent_login_uri:V.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:i,authenticatingComponent:d,configurationName:n,withCustomHistory:S,children:c.jsx(vt,{loadingComponent:U,configurationName:n,children:s})})})}},Re=({children:s,callbackPath:o=null,extras:n=null,configurationName:a="default"})=>{const d=l.OidcClient.get,u=d(a);return y.useEffect(()=>{u.tokens||u.loginAsync(o,n)},[a,o,n]),u.tokens?c.jsx(c.Fragment,{children:s}):null},pt=(s,o=null,n=null,a="default")=>d=>c.jsx(Re,{callbackPath:o,extras:n,configurationName:a,children:c.jsx(s,{...d})}),re="default",se=(s,o)=>{let n=!1;return s(o)&&(n=s(o).tokens!=null),n},_t=(s=re)=>{const o=l.OidcClient.get,[n,a]=y.useState(se(o,s));return y.useEffect(()=>{let i=!0;const f=o(s);a(se(o,s));const g=f.subscribeEvents((k,O)=>{(k===l.OidcClient.eventNames.logout_from_another_tab||k===l.OidcClient.eventNames.logout_from_same_tab||k===l.OidcClient.eventNames.token_aquired)&&i&&a(se(o,s))});return()=>{i=!1,f.removeEventSubscription(g)}},[s]),{login:(i=void 0,f=null,g=!1)=>o(s).loginAsync(i,f,!1,void 0,g),logout:(i=void 0,f=null)=>o(s).logoutAsync(i,f),renewTokens:async(i=null)=>{const f=await o(s).renewTokensAsync(i);return{accessToken:f.accessToken,accessTokenPayload:f.accessTokenPayload,idToken:f.idToken,idTokenPayload:f.idTokenPayload}},isAuthenticated:n}},Se={accessToken:null,accessTokenPayload:null},gt=s=>{const o=l.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{accessToken:a.accessToken,accessTokenPayload:a.accessTokenPayload}}return Se},yt=(s=re)=>{const o=l.OidcClient.get,[n,a]=y.useState(gt(s));return y.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const i=u.tokens;a({accessToken:i.accessToken,accessTokenPayload:i.accessTokenPayload})}const h=u.subscribeEvents((i,f)=>{if((i===l.OidcClient.eventNames.token_renewed||i===l.OidcClient.eventNames.token_aquired||i===l.OidcClient.eventNames.logout_from_another_tab||i===l.OidcClient.eventNames.logout_from_same_tab||i===l.OidcClient.eventNames.refreshTokensAsync_error||i===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const g=u.tokens;a(g!=null?{accessToken:g.accessToken,accessTokenPayload:g.accessTokenPayload}:Se)}});return()=>{d=!1,u.removeEventSubscription(h)}},[s]),n},je={idToken:null,idTokenPayload:null},bt=s=>{const o=l.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{idToken:a.idToken,idTokenPayload:a.idTokenPayload}}return je},kt=(s=re)=>{const o=l.OidcClient.get,[n,a]=y.useState(bt(s));return y.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const i=u.tokens;a({idToken:i.idToken,idTokenPayload:i.idTokenPayload})}const h=u.subscribeEvents((i,f)=>{if((i===l.OidcClient.eventNames.token_renewed||i===l.OidcClient.eventNames.token_aquired||i===l.OidcClient.eventNames.logout_from_another_tab||i===l.OidcClient.eventNames.logout_from_same_tab||i===l.OidcClient.eventNames.refreshTokensAsync_error||i===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const g=u.tokens;a(g!=null?{idToken:g.idToken,idTokenPayload:g.idTokenPayload}:je)}});return()=>{d=!1,u.removeEventSubscription(h)}},[s]),n};var Pe=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Pe||{});const mt=(s="default")=>{const[o,n]=y.useState({user:null,status:"Unauthenticated"}),[a,d]=y.useState(""),u=l.OidcClient.get(s);y.useEffect(()=>{let i=!0;if(u&&u.tokens){n({...o,status:"Loading user"});const f=a!=="";u.userInfoAsync(f).then(g=>{i&&n({user:g,status:"User loaded"})}).catch(()=>n({...o,status:"Error loading user"}))}else n({user:null,status:"Unauthenticated"});return()=>{i=!1}},[a]);const h=()=>{d(a+" ")};return{oidcUser:o.user,oidcUserLoadingState:o.status,reloadOidcUser:h}};Object.defineProperty(R,"TokenRenewMode",{enumerable:!0,get:()=>l.TokenRenewMode}),R.OidcProvider=ht,R.OidcSecure=Re,R.OidcUserStatus=Pe,R.useOidc=_t,R.useOidcAccessToken=yt,R.useOidcFetch=Oe,R.useOidcIdToken=kt,R.useOidcUser=mt,R.withOidcFetch=$e,R.withOidcSecure=pt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|
|
27
|
+
Check the top-level render call using <`+r+">.")}return t}}function He(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Mt(t);if(Ge[r])return;Ge[r]=!0;var v="";e&&e._owner&&e._owner!==ge.current&&(v=" It was passed a child from "+C(e._owner.type)+"."),B(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,v),B(null)}}function Je(e,t){{if(typeof e!="object")return;if(pe(e))for(var r=0;r<e.length;r++){var v=e[r];be(v)&&He(v,t)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var b=M(e);if(typeof b=="function"&&b!==e.entries)for(var m=b.call(e),_;!(_=m.next()).done;)be(_.value)&&He(_.value,t)}}}function Yt(e){{var t=e.type;if(t==null||typeof t=="string")return;var r;if(typeof t=="function")r=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===f||t.$$typeof===O))r=t.propTypes;else return;if(r){var v=C(t);St(r,e.props,"prop",v,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var b=C(t);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var v=t[r];if(v!=="children"&&v!=="key"){B(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),B(null);break}}e.ref!==null&&(B(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function Ke(e,t,r,v,b,m){{var _=ue(e);if(!_){var p="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(p+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=Wt(b);P?p+=P:p+=ze();var E;e===null?E="null":pe(e)?E="array":e!==void 0&&e.$$typeof===o?(E="<"+(C(e.type)||"Unknown")+" />",p=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,p)}var w=Ut(e,t,r,b,m);if(w==null)return w;if(_){var x=t.children;if(x!==void 0)if(v)if(pe(x)){for(var z=0;z<x.length;z++)Je(x[z],e);Object.freeze&&Object.freeze(x)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Je(x,e)}return e===a?Vt(w):Yt(w),w}}function Bt(e,t,r){return Ke(e,t,r,!0)}function zt(e,t,r){return Ke(e,t,r,!1)}var Gt=zt,Ht=Bt;H.Fragment=a,H.jsx=Gt,H.jsxs=Ht}()),H}process.env.NODE_ENV==="production"?te.exports=Qe():te.exports=Ze();var c=te.exports;const Oe="default",qe=(s,o)=>async(...n)=>{var S;const[a,d,...u]=n,h=d?{...d}:{method:"GET"};let i=new Headers;h.headers&&(i=h.headers instanceof Headers?h.headers:new Headers(h.headers));const f=o(),g=await f.getValidTokenAsync(),k=(S=g==null?void 0:g.tokens)==null?void 0:S.accessToken;if(i.has("Accept")||i.set("Accept","application/json"),k){if(f.configuration.demonstrating_proof_of_possession){const A=await f.generateDemonstrationOfProofOfPossessionAsync(k,a.toString(),h.method);i.set("Authorization",`PoP ${k}`),i.set("DPoP",A)}else i.set("Authorization",`Bearer ${k}`);h.credentials||(h.credentials="same-origin")}const O={...h,headers:i};return await s(a,O,...u)},$e=(s=null,o=Oe)=>n=>a=>{const{fetch:d}=Ee(s||a.fetch,o);return c.jsx(n,{...a,fetch:d})},Ee=(s=null,o=Oe)=>{const n=s||window.fetch,a=l.OidcClient.get;return{fetch:y.useCallback((u,h)=>qe(n,()=>a(o))(u,h),[n,o])}},Te=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Error authentication"}),c.jsx("p",{className:"oidc-authenticating__content",children:"An error occurred during authentication."})]})}),et=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Authentication in progress"}),c.jsx("p",{className:"oidc-authenticating__content",children:"You will be redirected to the login page."})]})}),tt=()=>Math.random().toString(36).substr(2,6),nt=(s,o)=>(n,a)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,a);const d=a||{bubbles:!1,cancelable:!1,detail:void 0},u=o.createEvent("CustomEvent");return u.initCustomEvent(n,d.bubbles,d.cancelable,d.detail),u.prototype=s.Event.prototype,u},rt=(s,o,n)=>({replaceState:(a,d)=>{const u=n(),h=d||s.history.state;s.history.replaceState({key:u,state:h},null,a),s.dispatchEvent(o("popstate"))}}),st=()=>rt(window,nt(window,document),tt),we=()=>c.jsx("div",{className:"oidc-callback",children:c.jsxs("div",{className:"oidc-callback__container",children:[c.jsx("h1",{className:"oidc-callback__title",children:"Authentication complete"}),c.jsx("p",{className:"oidc-callback__content",children:"You will be redirected to your application."})]})}),ot=({callBackError:s,callBackSuccess:o,configurationName:n,withCustomHistory:a})=>{const[d,u]=y.useState(!1);y.useEffect(()=>{let f=!0;return(async()=>{const k=l.OidcClient.get;try{const{callbackPath:O}=await k(n).loginCallbackAsync();(a?a():st()).replaceState(O||"/")}catch(O){f&&(console.warn(O),u(!0))}})(),()=>{f=!1}},[]);const h=s||Te,i=o||we;return d?c.jsx(h,{configurationName:n}):c.jsx(i,{configurationName:n})},at=()=>c.jsx("span",{className:"oidc-loading",children:"Loading"}),it=()=>c.jsx("div",{className:"oidc-serviceworker",children:c.jsxs("div",{className:"oidc-serviceworker__container",children:[c.jsx("h1",{className:"oidc-serviceworker__title",children:"Unable to authenticate on this browser"}),c.jsx("p",{className:"oidc-serviceworker__content",children:"Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser."})]})}),ct=()=>c.jsx("div",{className:"oidc-session-lost",children:c.jsxs("div",{className:"oidc-session-lost__container",children:[c.jsx("h1",{className:"oidc-session-lost__title",children:"Session timed out"}),c.jsx("p",{className:"oidc-session-lost__content",children:"Your session has expired. Please re-authenticate."})]})}),lt=({configurationName:s})=>(y.useEffect(()=>{(async()=>{const n=l.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),c.jsx(c.Fragment,{})),ut=({configurationName:s})=>{const o=l.getParseQueryStringFromLocation(window.location.href),n=l.OidcClient.get,a=n(s);let d=null;for(const[u,h]of Object.entries(o))u==="state"||u==="scope"||(d===null&&(d={}),d[u]=h);return y.useEffect(()=>{a.tokens||a.loginAsync(null,d,!0,o.scope)},[]),c.jsx(c.Fragment,{})},dt=({callbackErrorComponent:s,callbackSuccessComponent:o,redirect_uri:n,silent_redirect_uri:a,silent_login_uri:d,children:u,configurationName:h,withCustomHistory:i=null})=>{const f=window?l.getPath(window.location.href):"",[g,k]=y.useState(f);y.useEffect(()=>{const S=()=>k(l.getPath(window.location.href));return S(),window.addEventListener("popstate",S,!1),()=>window.removeEventListener("popstate",S,!1)},[]);const O=l.getPath(n);if(a&&g===l.getPath(a))return c.jsx(lt,{configurationName:h});if(d&&g===l.getPath(d))return c.jsx(ut,{configurationName:h});switch(g){case O:return c.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:h,withCustomHistory:i});default:return c.jsx(c.Fragment,{children:u})}},ft=y.memo(dt),Re={name:"",data:null},vt=({loadingComponent:s,children:o,configurationName:n})=>{const[a,d]=y.useState(!0),u=l.OidcClient.get,h=u(n);y.useEffect(()=>{let f=!0;return h&&h.tryKeepExistingSessionAsync().then(()=>{f&&d(!1)}),()=>{f=!1}},[n]);const i=s;return c.jsx(c.Fragment,{children:a?c.jsx(i,{configurationName:n}):c.jsx(c.Fragment,{children:o})})},J=({isLoading:s,loadingComponent:o,children:n,configurationName:a})=>{const d=o;return s?c.jsx(d,{configurationName:a,children:n}):c.jsx(c.Fragment,{children:n})},ht=({children:s,configuration:o,configurationName:n="default",callbackSuccessComponent:a=we,authenticatingComponent:d=et,loadingComponent:u=at,serviceWorkerNotSupportedComponent:h=it,authenticatingErrorComponent:i=Te,sessionLostComponent:f=ct,onSessionLost:g=null,onLogoutFromAnotherTab:k=null,onLogoutFromSameTab:O=null,withCustomHistory:S=null,onEvent:A=null,getFetch:X=null,location:se=null})=>{const M=(N="default")=>l.OidcClient.getOrCreate(X??l.getFetchDefault,se??new l.OidcLocation)(o,N),[L,j]=y.useState(!0),[oe,Y]=y.useState(Re),[ae,ie]=y.useState("default");y.useEffect(()=>{const V=M(n).subscribeEvents((T,D)=>{A&&A(n,T,D)});return()=>{M(n).removeEventSubscription(V)}},[n,A]),y.useEffect(()=>{const V=M(n).subscribeEvents((T,D)=>{if(T===l.OidcClient.eventNames.refreshTokensAsync_error||T===l.OidcClient.eventNames.syncTokensAsync_error){if(g!=null){g();return}Y({name:T,data:D})}else if(T===l.OidcClient.eventNames.logout_from_another_tab){if(k!=null){k();return}Y({name:T,data:D})}else T===l.OidcClient.eventNames.logout_from_same_tab?O!=null&&O():T===l.OidcClient.eventNames.loginAsync_begin||T===l.OidcClient.eventNames.loginCallbackAsync_end||T===l.OidcClient.eventNames.loginAsync_error||T===l.OidcClient.eventNames.loginCallbackAsync_error?Y({name:T,data:D}):T===l.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&Y({name:T,data:D})});return ie(n),j(!1),()=>{M(n).removeEventSubscription(V),Y(Re)}},[o,n]);const ce=f,le=d,F=u,ue=h,de=i,U=L||ae!==n,C=M(n);switch(oe.name){case l.OidcClient.eventNames.service_worker_not_supported_by_browser:return c.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(ue,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_begin:return c.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(le,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_error:case l.OidcClient.eventNames.loginCallbackAsync_error:return c.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(de,{configurationName:n})});case l.OidcClient.eventNames.refreshTokensAsync_error:case l.OidcClient.eventNames.syncTokensAsync_error:case l.OidcClient.eventNames.logout_from_another_tab:return c.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(ce,{configurationName:n})});default:return c.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(ft,{redirect_uri:C.configuration.redirect_uri,silent_redirect_uri:C.configuration.silent_redirect_uri,silent_login_uri:C.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:i,authenticatingComponent:d,configurationName:n,withCustomHistory:S,children:c.jsx(vt,{loadingComponent:F,configurationName:n,children:s})})})}},Se=({children:s,callbackPath:o=null,extras:n=null,configurationName:a="default"})=>{const d=l.OidcClient.get,u=d(a);return y.useEffect(()=>{u.tokens||u.loginAsync(o,n)},[a,o,n]),u.tokens?c.jsx(c.Fragment,{children:s}):null},pt=(s,o=null,n=null,a="default")=>d=>c.jsx(Se,{callbackPath:o,extras:n,configurationName:a,children:c.jsx(s,{...d})}),ne="default",re=(s,o)=>{let n=!1;return s(o)&&(n=s(o).tokens!=null),n},_t=(s=ne)=>{const o=l.OidcClient.get,[n,a]=y.useState(re(o,s));return y.useEffect(()=>{let i=!0;const f=o(s);a(re(o,s));const g=f.subscribeEvents((k,O)=>{(k===l.OidcClient.eventNames.logout_from_another_tab||k===l.OidcClient.eventNames.logout_from_same_tab||k===l.OidcClient.eventNames.token_aquired)&&i&&a(re(o,s))});return()=>{i=!1,f.removeEventSubscription(g)}},[s]),{login:(i=void 0,f=null,g=!1)=>o(s).loginAsync(i,f,!1,void 0,g),logout:(i=void 0,f=null)=>o(s).logoutAsync(i,f),renewTokens:async(i=null)=>{const f=await o(s).renewTokensAsync(i);return{accessToken:f.accessToken,accessTokenPayload:f.accessTokenPayload,idToken:f.idToken,idTokenPayload:f.idTokenPayload}},isAuthenticated:n}},je={accessToken:null,accessTokenPayload:null},gt=s=>{const o=l.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{accessToken:a.accessToken,accessTokenPayload:a.accessTokenPayload}}return je},yt=(s=ne)=>{const o=l.OidcClient.get,[n,a]=y.useState(gt(s));return y.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const i=u.tokens;a({accessToken:i.accessToken,accessTokenPayload:i.accessTokenPayload})}const h=u.subscribeEvents((i,f)=>{if((i===l.OidcClient.eventNames.token_renewed||i===l.OidcClient.eventNames.token_aquired||i===l.OidcClient.eventNames.logout_from_another_tab||i===l.OidcClient.eventNames.logout_from_same_tab||i===l.OidcClient.eventNames.refreshTokensAsync_error||i===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const g=u.tokens;a(g!=null?{accessToken:g.accessToken,accessTokenPayload:g.accessTokenPayload}:je)}});return()=>{d=!1,u.removeEventSubscription(h)}},[s]),n},Pe={idToken:null,idTokenPayload:null},bt=s=>{const o=l.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{idToken:a.idToken,idTokenPayload:a.idTokenPayload}}return Pe},kt=(s=ne)=>{const o=l.OidcClient.get,[n,a]=y.useState(bt(s));return y.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const i=u.tokens;a({idToken:i.idToken,idTokenPayload:i.idTokenPayload})}const h=u.subscribeEvents((i,f)=>{if((i===l.OidcClient.eventNames.token_renewed||i===l.OidcClient.eventNames.token_aquired||i===l.OidcClient.eventNames.logout_from_another_tab||i===l.OidcClient.eventNames.logout_from_same_tab||i===l.OidcClient.eventNames.refreshTokensAsync_error||i===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const g=u.tokens;a(g!=null?{idToken:g.idToken,idTokenPayload:g.idTokenPayload}:Pe)}});return()=>{d=!1,u.removeEventSubscription(h)}},[s]),n};var Ce=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Ce||{});const mt=(s="default")=>{const[o,n]=y.useState({user:null,status:"Unauthenticated"}),[a,d]=y.useState(""),u=l.OidcClient.get(s);y.useEffect(()=>{let i=!0;if(u&&u.tokens){n({...o,status:"Loading user"});const f=a!=="";u.userInfoAsync(f).then(g=>{i&&n({user:g,status:"User loaded"})}).catch(()=>n({...o,status:"Error loading user"}))}else n({user:null,status:"Unauthenticated"});return()=>{i=!1}},[a]);const h=()=>{d(a+" ")};return{oidcUser:o.user,oidcUserLoadingState:o.status,reloadOidcUser:h}};Object.defineProperty(R,"TokenRenewMode",{enumerable:!0,get:()=>l.TokenRenewMode}),R.OidcProvider=ht,R.OidcSecure=Se,R.OidcUserStatus=Ce,R.useOidc=_t,R.useOidcAccessToken=yt,R.useOidcFetch=Ee,R.useOidcIdToken=kt,R.useOidcUser=mt,R.withOidcFetch=$e,R.withOidcSecure=pt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/react-oidc",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0-alpha.1071",
|
|
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.7.0-alpha.1071",
|
|
44
|
+
"@axa-fr/oidc-client": "7.7.0-alpha.1071",
|
|
45
45
|
"base64-js": "1.5.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
package/src/OidcProvider.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Fetch, getFetchDefault, OidcConfiguration, OidcClient, ILOidcLocation, OidcLocation} from '@axa-fr/oidc-client';
|
|
2
2
|
import { ComponentType, FC, PropsWithChildren, useEffect, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import AuthenticatingError from './core/default-component/AuthenticateError.component.js';
|
|
@@ -29,6 +29,7 @@ export type OidcProviderProps = {
|
|
|
29
29
|
withCustomHistory?: () => CustomHistory;
|
|
30
30
|
onEvent?: (configuration: string, name: string, data: any) => void;
|
|
31
31
|
getFetch?: () => Fetch;
|
|
32
|
+
location?: ILOidcLocation
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
export type OidcSessionProps = {
|
|
@@ -92,9 +93,10 @@ export const OidcProvider: FC<PropsWithChildren<OidcProviderProps>> = ({
|
|
|
92
93
|
withCustomHistory = null,
|
|
93
94
|
onEvent = null,
|
|
94
95
|
getFetch = null,
|
|
96
|
+
location= null,
|
|
95
97
|
}) => {
|
|
96
98
|
const getOidc = (configurationName = 'default') => {
|
|
97
|
-
return OidcClient.getOrCreate(getFetch ?? getFetchDefault)(configuration, configurationName);
|
|
99
|
+
return OidcClient.getOrCreate(getFetch ?? getFetchDefault, location ?? new OidcLocation())(configuration, configurationName);
|
|
98
100
|
};
|
|
99
101
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
100
102
|
const [loading, setLoading] = useState(true);
|