@axa-fr/react-oidc 7.22.0 → 7.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FetchToken.d.ts +1 -0
- package/dist/OidcProvider.d.ts +3 -2
- package/dist/OidcSecure.d.ts +2 -1
- package/dist/ReactOidc.d.ts +1 -0
- package/dist/User.d.ts +2 -1
- package/dist/User.d.ts.map +1 -1
- package/dist/core/default-component/AuthenticateError.component.d.ts +1 -0
- package/dist/core/default-component/Authenticating.component.d.ts +1 -0
- package/dist/core/default-component/Callback.component.d.ts +1 -0
- package/dist/core/default-component/Loading.component.d.ts +1 -0
- package/dist/core/default-component/ServiceWorkerNotSupported.component.d.ts +1 -0
- package/dist/core/default-component/SessionLost.component.d.ts +1 -0
- package/dist/core/default-component/SilentCallback.component.d.ts +1 -0
- package/dist/core/default-component/SilentLogin.component.d.ts +1 -0
- package/dist/core/routes/OidcRoutes.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +5 -5
- package/package.json +11 -11
- package/src/User.ts +1 -2
package/dist/FetchToken.d.ts
CHANGED
package/dist/OidcProvider.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Fetch, OidcConfiguration, OidcClient, ILOidcLocation } from '@axa-fr/oidc-client';
|
|
2
|
-
import { ComponentType, FC, PropsWithChildren } from 'react';
|
|
3
1
|
import { CustomHistory } from './core/routes/withRouter.js';
|
|
2
|
+
import { ComponentType, FC, PropsWithChildren } from 'react';
|
|
3
|
+
import { Fetch, OidcConfiguration, OidcClient, ILOidcLocation } from '@axa-fr/oidc-client';
|
|
4
|
+
|
|
4
5
|
export type oidcContext = {
|
|
5
6
|
(name?: string): OidcClient;
|
|
6
7
|
};
|
package/dist/OidcSecure.d.ts
CHANGED
package/dist/ReactOidc.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StringMap } from '@axa-fr/oidc-client';
|
|
2
|
+
|
|
2
3
|
export declare const useOidc: (configurationName?: string) => {
|
|
3
4
|
login: (callbackPath?: string | undefined, extras?: StringMap, silentLoginOnly?: boolean) => Promise<unknown>;
|
|
4
5
|
logout: (callbackPath?: string | null | undefined, extras?: StringMap) => Promise<void>;
|
package/dist/User.d.ts
CHANGED
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;;;;CAuCvB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ILOidcLocation } from '@axa-fr/oidc-client';
|
|
2
|
-
import React, { ComponentType } from 'react';
|
|
3
1
|
import { CustomHistory } from './withRouter.js';
|
|
2
|
+
import { default as React, ComponentType } from 'react';
|
|
3
|
+
import { ILOidcLocation } from '@axa-fr/oidc-client';
|
|
4
|
+
|
|
4
5
|
type OidcRoutesProps = {
|
|
5
6
|
callbackSuccessComponent?: ComponentType;
|
|
6
7
|
callbackErrorComponent?: ComponentType;
|
package/dist/index.js
CHANGED
|
@@ -944,7 +944,7 @@ const tr = (o = "default", a = !1) => {
|
|
|
944
944
|
status: "Unauthenticated"
|
|
945
945
|
/* Unauthenticated */
|
|
946
946
|
});
|
|
947
|
-
const b = c.subscribeEvents((_
|
|
947
|
+
const b = c.subscribeEvents((_) => {
|
|
948
948
|
(_ === f.eventNames.logout_from_another_tab || _ === f.eventNames.logout_from_same_tab) && v && s({
|
|
949
949
|
user: null,
|
|
950
950
|
status: "Unauthenticated"
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(O,_){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"],_):(O=typeof globalThis<"u"?globalThis:O||self,_(O["react-oidc"]={},O.React,O.oidcClient))})(this,function(O,_,c){"use strict";var ne={exports:{}},G={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var me;function Qe(){if(me)return G;me=1;var s=_,a=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,u=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function b(l,v,m){var g,
|
|
9
|
+
*/var me;function Qe(){if(me)return G;me=1;var s=_,a=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,u=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function b(l,v,m){var g,E={},C=null,x=null;m!==void 0&&(C=""+m),v.key!==void 0&&(C=""+v.key),v.ref!==void 0&&(x=v.ref);for(g in v)o.call(v,g)&&!f.hasOwnProperty(g)&&(E[g]=v[g]);if(l&&l.defaultProps)for(g in v=l.defaultProps,v)E[g]===void 0&&(E[g]=v[g]);return{$$typeof:a,type:l,key:C,ref:x,props:E,_owner:u.current}}return G.Fragment=n,G.jsx=b,G.jsxs=b,G}var J={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ke;function Ze(){return ke||(ke=1,process.env.NODE_ENV!=="production"&&function(){var s=_,a=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),l=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),
|
|
17
|
+
*/var ke;function Ze(){return ke||(ke=1,process.env.NODE_ENV!=="production"&&function(){var s=_,a=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),l=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),X=Symbol.iterator,Q="@@iterator";function W(e){if(e===null||typeof e!="object")return null;var t=X&&e[X]||e[Q];return typeof t=="function"?t:null}var L=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(e){{for(var t=arguments.length,r=new Array(t>1?t-1:0),d=1;d<t;d++)r[d-1]=arguments[d];oe("error",e,r)}}function oe(e,t,r){{var d=L.ReactDebugCurrentFrame,y=d.getStackAddendum();y!==""&&(t+="%s",r=r.concat([y]));var k=r.map(function(p){return String(p)});k.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,k)}}var Y=!1,ae=!1,ce=!1,ie=!1,le=!1,F;F=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===f||le||e===u||e===m||e===g||ie||e===x||Y||ae||ce||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===E||e.$$typeof===b||e.$$typeof===l||e.$$typeof===v||e.$$typeof===F||e.getModuleId!==void 0))}function fe(e,t,r){var d=e.displayName;if(d)return d;var y=t.displayName||t.name||"";return y!==""?r+"("+y+")":r}function U(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case n:return"Portal";case f:return"Profiler";case u:return"StrictMode";case m:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case l:var t=e;return U(t)+".Consumer";case b:var r=e;return U(r._context)+".Provider";case v:return fe(e,e.render,"ForwardRef");case E:var d=e.displayName||null;return d!==null?d:P(e.type)||"Memo";case C:{var y=e,k=y._payload,p=y._init;try{return P(p(k))}catch{return null}}}return null}var M=Object.assign,D=0,V,w,N,xe,Ae,Fe,De;function Ne(){}Ne.__reactDisabledLog=!0;function Et(){{if(D===0){V=console.log,w=console.info,N=console.warn,xe=console.error,Ae=console.group,Fe=console.groupCollapsed,De=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ne,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}D++}}function Tt(){{if(D--,D===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},e,{value:V}),info:M({},e,{value:w}),warn:M({},e,{value:N}),error:M({},e,{value:xe}),group:M({},e,{value:Ae}),groupCollapsed:M({},e,{value:Fe}),groupEnd:M({},e,{value:De})})}D<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var de=L.ReactCurrentDispatcher,ve;function Z(e,t,r){{if(ve===void 0)try{throw Error()}catch(y){var d=y.stack.trim().match(/\n( *(at )?)/);ve=d&&d[1]||""}return`
|
|
18
18
|
`+ve+e}}var he=!1,q;{var wt=typeof WeakMap=="function"?WeakMap:Map;q=new wt}function Ie(e,t){if(!e||he)return"";{var r=q.get(e);if(r!==void 0)return r}var d;he=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var k;k=de.current,de.current=null,Et();try{if(t){var p=function(){throw Error()};if(Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(I){d=I}Reflect.construct(e,[],p)}else{try{p.call()}catch(I){d=I}e.call(p.prototype)}}else{try{throw Error()}catch(I){d=I}e()}}catch(I){if(I&&d&&typeof I.stack=="string"){for(var h=I.stack.split(`
|
|
19
19
|
`),j=d.stack.split(`
|
|
20
20
|
`),T=h.length-1,R=j.length-1;T>=1&&R>=0&&h[T]!==j[R];)R--;for(;T>=1&&R>=0;T--,R--)if(h[T]!==j[R]){if(T!==1||R!==1)do if(T--,R--,R<0||h[T]!==j[R]){var A=`
|
|
21
|
-
`+h[T].replace(" at new "," at ");return e.displayName&&A.includes("<anonymous>")&&(A=A.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,A),A}while(T>=1&&R>=0);break}}}finally{he=!1,de.current=k,Tt(),Error.prepareStackTrace=y}var z=e?e.displayName||e.name:"",Xe=z?Z(z):"";return typeof e=="function"&&q.set(e,Xe),Xe}function Rt(e,t,r){return Ie(e,!1)}function St(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function $(e,t,r){if(e==null)return"";if(typeof e=="function")return Ie(e,St(e));if(typeof e=="string")return Z(e);switch(e){case m:return Z("Suspense");case g:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Rt(e.render);case
|
|
21
|
+
`+h[T].replace(" at new "," at ");return e.displayName&&A.includes("<anonymous>")&&(A=A.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,A),A}while(T>=1&&R>=0);break}}}finally{he=!1,de.current=k,Tt(),Error.prepareStackTrace=y}var z=e?e.displayName||e.name:"",Xe=z?Z(z):"";return typeof e=="function"&&q.set(e,Xe),Xe}function Rt(e,t,r){return Ie(e,!1)}function St(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function $(e,t,r){if(e==null)return"";if(typeof e=="function")return Ie(e,St(e));if(typeof e=="string")return Z(e);switch(e){case m:return Z("Suspense");case g:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Rt(e.render);case E:return $(e.type,t,r);case C:{var d=e,y=d._payload,k=d._init;try{return $(k(y),t,r)}catch{}}}return""}var ee=Object.prototype.hasOwnProperty,Le={},Ue=L.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,r=$(e.type,e._source,t?t.type:null);Ue.setExtraStackFrame(r)}else Ue.setExtraStackFrame(null)}function jt(e,t,r,d,y){{var k=Function.call.bind(ee);for(var p in e)if(k(e,p)){var h=void 0;try{if(typeof e[p]!="function"){var j=Error((d||"React class")+": "+r+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw j.name="Invariant Violation",j}h=e[p](t,p,d,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(T){h=T}h&&!(h instanceof Error)&&(te(y),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",d||"React class",r,p,typeof h),te(null)),h instanceof Error&&!(h.message in Le)&&(Le[h.message]=!0,te(y),S("Failed %s type: %s",r,h.message),te(null))}}}var Pt=Array.isArray;function pe(e){return Pt(e)}function Ct(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,r=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r}}function xt(e){try{return Me(e),!1}catch{return!0}}function Me(e){return""+e}function We(e){if(xt(e))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ct(e)),Me(e)}var H=L.ReactCurrentOwner,At={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ve,_e;_e={};function Ft(e){if(ee.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function Dt(e){if(ee.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Nt(e,t){if(typeof e.ref=="string"&&H.current&&t&&H.current.stateNode!==t){var r=P(H.current.type);_e[r]||(S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',P(H.current.type),e.ref),_e[r]=!0)}}function It(e,t){{var r=function(){Ye||(Ye=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}}function Lt(e,t){{var r=function(){Ve||(Ve=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}}var Ut=function(e,t,r,d,y,k,p){var h={$$typeof:a,type:e,key:t,ref:r,props:p,_owner:k};return h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(h,"_self",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.defineProperty(h,"_source",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h};function Mt(e,t,r,d,y){{var k,p={},h=null,j=null;r!==void 0&&(We(r),h=""+r),Dt(t)&&(We(t.key),h=""+t.key),Ft(t)&&(j=t.ref,Nt(t,y));for(k in t)ee.call(t,k)&&!At.hasOwnProperty(k)&&(p[k]=t[k]);if(e&&e.defaultProps){var T=e.defaultProps;for(k in T)p[k]===void 0&&(p[k]=T[k])}if(h||j){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;h&&It(p,R),j&&Lt(p,R)}return Ut(e,h,j,y,d,H.current,p)}}var ge=L.ReactCurrentOwner,Be=L.ReactDebugCurrentFrame;function B(e){if(e){var t=e._owner,r=$(e.type,e._source,t?t.type:null);Be.setExtraStackFrame(r)}else Be.setExtraStackFrame(null)}var ye;ye=!1;function be(e){return typeof e=="object"&&e!==null&&e.$$typeof===a}function ze(){{if(ge.current){var e=P(ge.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function Wt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),r=e.lineNumber;return`
|
|
24
24
|
|
|
25
25
|
Check your code at `+t+":"+r+"."}return""}}var Ge={};function Yt(e){{var t=ze();if(!t){var r=typeof e=="string"?e:e.displayName||e.name;r&&(t=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+r+">.")}return t}}function Je(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Yt(t);if(Ge[r])return;Ge[r]=!0;var d="";e&&e._owner&&e._owner!==ge.current&&(d=" It was passed a child from "+P(e._owner.type)+"."),B(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,d),B(null)}}function Ke(e,t){{if(typeof e!="object")return;if(pe(e))for(var r=0;r<e.length;r++){var d=e[r];be(d)&&Je(d,t)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var y=W(e);if(typeof y=="function"&&y!==e.entries)for(var k=y.call(e),p;!(p=k.next()).done;)be(p.value)&&Je(p.value,t)}}}function Vt(e){{var t=e.type;if(t==null||typeof t=="string")return;var r;if(typeof t=="function")r=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===v||t.$$typeof===O))r=t.propTypes;else return;if(r){var d=P(t);jt(r,e.props,"prop",d,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var y=P(t);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Bt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var d=t[r];if(d!=="children"&&d!=="key"){B(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),B(null);break}}e.ref!==null&&(B(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function He(e,t,r,d,y,k){{var p=ue(e);if(!p){var h="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(h+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var j=Wt(y);j?h+=j:h+=ze();var T;e===null?T="null":pe(e)?T="array":e!==void 0&&e.$$typeof===a?(T="<"+(P(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,h)}var R=Mt(e,t,r,y,k);if(R==null)return R;if(p){var A=t.children;if(A!==void 0)if(d)if(pe(A)){for(var z=0;z<A.length;z++)Ke(A[z],e);Object.freeze&&Object.freeze(A)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ke(A,e)}return e===o?Bt(R):Vt(R),R}}function zt(e,t,r){return He(e,t,r,!0)}function Gt(e,t,r){return He(e,t,r,!1)}var Jt=Gt,Kt=zt;J.Fragment=o,J.jsx=Jt,J.jsxs=Kt}()),J}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=Ze();var i=ne.exports;const Oe="default",qe=(s,a,n=!1)=>async(...o)=>await a().fetchWithTokens(s,n)(...o),$e=(s=null,a=Oe,n=!1)=>o=>u=>{const{fetch:f}=Ee(s||u.fetch,a,n);return i.jsx(o,{...u,fetch:f})},Ee=(s=null,a=Oe,n=!1)=>{const o=s||window.fetch,u=c.OidcClient.get;return{fetch:_.useCallback((b,l)=>qe(o,()=>u(a),n)(b,l),[o,a])}},Te=()=>i.jsx("div",{className:"oidc-authenticating",children:i.jsxs("div",{className:"oidc-authenticating__container",children:[i.jsx("h1",{className:"oidc-authenticating__title",children:"Error authentication"}),i.jsx("p",{className:"oidc-authenticating__content",children:"An error occurred during authentication."})]})}),et=()=>i.jsx("div",{className:"oidc-authenticating",children:i.jsxs("div",{className:"oidc-authenticating__container",children:[i.jsx("h1",{className:"oidc-authenticating__title",children:"Authentication in progress"}),i.jsx("p",{className:"oidc-authenticating__content",children:"You will be redirected to the login page."})]})}),tt=()=>Math.random().toString(36).substr(2,6),nt=(s,a)=>(n,o)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,o);const u=o||{bubbles:!1,cancelable:!1,detail:void 0},f=a.createEvent("CustomEvent");return f.initCustomEvent(n,u.bubbles,u.cancelable,u.detail),f.prototype=s.Event.prototype,f},rt=(s,a,n)=>({replaceState:(o,u)=>{const f=n(),b=u||s.history.state;s.history.replaceState({key:f,state:b},null,o),s.dispatchEvent(a("popstate"))}}),st=()=>rt(window,nt(window,document),tt),we=()=>i.jsx("div",{className:"oidc-callback",children:i.jsxs("div",{className:"oidc-callback__container",children:[i.jsx("h1",{className:"oidc-callback__title",children:"Authentication complete"}),i.jsx("p",{className:"oidc-callback__content",children:"You will be redirected to your application."})]})}),ot=({callBackError:s,callBackSuccess:a,configurationName:n,withCustomHistory:o})=>{const[u,f]=_.useState(!1);_.useEffect(()=>{let v=!0;return(async()=>{const g=c.OidcClient.get;try{const{callbackPath:O}=await g(n).loginCallbackAsync();(o?o():st()).replaceState(O||"/")}catch(O){v&&(console.warn(O),f(!0))}})(),()=>{v=!1}},[]);const b=s||Te,l=a||we;return u?i.jsx(b,{configurationName:n}):i.jsx(l,{configurationName:n})},at=()=>i.jsx("span",{className:"oidc-loading",children:"Loading"}),ct=()=>i.jsx("div",{className:"oidc-serviceworker",children:i.jsxs("div",{className:"oidc-serviceworker__container",children:[i.jsx("h1",{className:"oidc-serviceworker__title",children:"Unable to authenticate on this browser"}),i.jsx("p",{className:"oidc-serviceworker__content",children:"Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser."})]})}),it=()=>i.jsx("div",{className:"oidc-session-lost",children:i.jsxs("div",{className:"oidc-session-lost__container",children:[i.jsx("h1",{className:"oidc-session-lost__title",children:"Session timed out"}),i.jsx("p",{className:"oidc-session-lost__content",children:"Your session has expired. Please re-authenticate."})]})}),lt=({configurationName:s})=>(_.useEffect(()=>{(async()=>{const n=c.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),i.jsx(i.Fragment,{})),ut=({configurationName:s})=>{const a=c.getParseQueryStringFromLocation(window.location.href),n=c.OidcClient.get,o=n(s);let u=null;for(const[f,b]of Object.entries(a))f==="state"||f==="scope"||(u===null&&(u={}),u[f]=b);return _.useEffect(()=>{o.tokens||o.loginAsync(null,u,!0,a.scope)},[]),i.jsx(i.Fragment,{})},ft=({callbackErrorComponent:s,callbackSuccessComponent:a,redirect_uri:n,silent_redirect_uri:o,silent_login_uri:u,children:f,configurationName:b,withCustomHistory:l=null,location:v})=>{const m=window?c.getPath(window.location.href):"",[g,O]=_.useState(m);_.useEffect(()=>{const x=()=>O(c.getPath(window.location.href));return x(),window.addEventListener("popstate",x,!1),()=>window.removeEventListener("popstate",x,!1)},[]);const C=c.getPath(n);if(o&&g===c.getPath(o))return i.jsx(lt,{configurationName:b});if(u&&g===c.getPath(u))return i.jsx(ut,{configurationName:b});switch(g){case C:return i.jsx(ot,{callBackError:s,callBackSuccess:a,configurationName:b,withCustomHistory:l});default:return i.jsx(i.Fragment,{children:f})}},dt=_.memo(ft),Re={name:"",data:null},vt=({loadingComponent:s,children:a,configurationName:n})=>{const[o,u]=_.useState(!0),f=c.OidcClient.get,b=f(n);_.useEffect(()=>{let v=!0;return b&&b.tryKeepExistingSessionAsync().then(()=>{v&&u(!1)}),()=>{v=!1}},[n]);const l=s;return i.jsx(i.Fragment,{children:o?i.jsx(l,{configurationName:n}):i.jsx(i.Fragment,{children:a})})},K=({isLoading:s,loadingComponent:a,children:n,configurationName:o})=>{const u=a;return s?i.jsx(u,{configurationName:o,children:n}):i.jsx(i.Fragment,{children:n})},ht=({children:s,configuration:a,configurationName:n="default",callbackSuccessComponent:o=we,authenticatingComponent:u=et,loadingComponent:f=at,serviceWorkerNotSupportedComponent:b=ct,authenticatingErrorComponent:l=Te,sessionLostComponent:v=it,onSessionLost:m=null,onLogoutFromAnotherTab:g=null,onLogoutFromSameTab:O=null,withCustomHistory:C=null,onEvent:x=null,getFetch:X=null,location:Q=null})=>{const W=(D="default")=>c.OidcClient.getOrCreate(X??c.getFetchDefault,Q??new c.OidcLocation)(a,D),[L,S]=_.useState(!0),[oe,Y]=_.useState(Re),[ae,ce]=_.useState("default");_.useEffect(()=>{const V=W(n).subscribeEvents((w,N)=>{x&&x(n,w,N)});return()=>{W(n).removeEventSubscription(V)}},[n,x]),_.useEffect(()=>{const V=W(n).subscribeEvents((w,N)=>{if(w===c.OidcClient.eventNames.refreshTokensAsync_error||w===c.OidcClient.eventNames.syncTokensAsync_error){if(m!=null){m();return}Y({name:w,data:N})}else if(w===c.OidcClient.eventNames.logout_from_another_tab){if(g!=null){g();return}Y({name:w,data:N})}else w===c.OidcClient.eventNames.logout_from_same_tab?O!=null&&O():w===c.OidcClient.eventNames.loginAsync_begin||w===c.OidcClient.eventNames.loginCallbackAsync_end||w===c.OidcClient.eventNames.loginAsync_error||w===c.OidcClient.eventNames.loginCallbackAsync_error?Y({name:w,data:N}):w===c.OidcClient.eventNames.service_worker_not_supported_by_browser&&a.service_worker_only===!0&&Y({name:w,data:N})});return ce(n),S(!1),()=>{W(n).removeEventSubscription(V),Y(Re)}},[a,n]);const ie=v,le=u,F=f,ue=b,fe=l,U=L||ae!==n,P=W(n);switch(oe.name){case c.OidcClient.eventNames.service_worker_not_supported_by_browser:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(ue,{configurationName:n})});case c.OidcClient.eventNames.loginAsync_begin:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(le,{configurationName:n})});case c.OidcClient.eventNames.loginAsync_error:case c.OidcClient.eventNames.loginCallbackAsync_error:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(fe,{configurationName:n})});case c.OidcClient.eventNames.refreshTokensAsync_error:case c.OidcClient.eventNames.syncTokensAsync_error:case c.OidcClient.eventNames.logout_from_another_tab:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(ie,{configurationName:n})});default:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(dt,{redirect_uri:P.configuration.redirect_uri,silent_redirect_uri:P.configuration.silent_redirect_uri,silent_login_uri:P.configuration.silent_login_uri,callbackSuccessComponent:o,callbackErrorComponent:l,authenticatingComponent:u,configurationName:n,withCustomHistory:C,location:Q??new c.OidcLocation,children:i.jsx(vt,{loadingComponent:F,configurationName:n,children:s})})})}},Se=({children:s,callbackPath:a=null,extras:n=null,configurationName:o="default"})=>{const u=c.OidcClient.get,f=u(o);return _.useEffect(()=>{f.tokens||f.loginAsync(a,n)},[o,a,n]),f.tokens?i.jsx(i.Fragment,{children:s}):null},pt=(s,a=null,n=null,o="default")=>u=>i.jsx(Se,{callbackPath:a,extras:n,configurationName:o,children:i.jsx(s,{...u})}),re="default",se=(s,a)=>{let n=!1;return s(a)&&(n=s(a).tokens!=null),n},_t=(s=re)=>{const a=c.OidcClient.get,[n,o]=_.useState(se(a,s));return _.useEffect(()=>{let l=!0;const v=a(s);o(se(a,s));const m=v.subscribeEvents((g,O)=>{(g===c.OidcClient.eventNames.logout_from_another_tab||g===c.OidcClient.eventNames.logout_from_same_tab||g===c.OidcClient.eventNames.token_aquired)&&l&&o(se(a,s))});return()=>{l=!1,v.removeEventSubscription(m)}},[s]),{login:(l=void 0,v=null,m=!1)=>a(s).loginAsync(l,v,!1,void 0,m),logout:(l=void 0,v=null)=>a(s).logoutAsync(l,v),renewTokens:async(l=null)=>{const v=await a(s).renewTokensAsync(l);return{accessToken:v.accessToken,accessTokenPayload:v.accessTokenPayload,idToken:v.idToken,idTokenPayload:v.idTokenPayload}},isAuthenticated:n}},je={accessToken:null,accessTokenPayload:null},gt=s=>{const a=c.OidcClient.get,n=a(s);if(n.tokens){const o=n.tokens;return{accessToken:o.accessToken,accessTokenPayload:o.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:n.configuration.demonstrating_proof_of_possession?(u,f)=>n.generateDemonstrationOfProofOfPossessionAsync(o.accessToken,u,f):null}}return je};function yt(s,a){return s.configuration.demonstrating_proof_of_possession?(n,o,u={})=>s.generateDemonstrationOfProofOfPossessionAsync(a.accessToken,n,o,u):null}const bt=(s=re)=>{const a=c.OidcClient.get,[n,o]=_.useState(gt(s));return _.useEffect(()=>{let u=!0;const f=a(s);if(f.tokens){const l=f.tokens;o({accessToken:l.accessToken,accessTokenPayload:l.accessTokenPayload})}const b=f.subscribeEvents((l,v)=>{if((l===c.OidcClient.eventNames.token_renewed||l===c.OidcClient.eventNames.token_aquired||l===c.OidcClient.eventNames.logout_from_another_tab||l===c.OidcClient.eventNames.logout_from_same_tab||l===c.OidcClient.eventNames.refreshTokensAsync_error||l===c.OidcClient.eventNames.syncTokensAsync_error)&&u){const m=f.tokens;o(m!=null?{accessToken:m.accessToken,accessTokenPayload:m.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:yt(f,m)}:je)}});return()=>{u=!1,f.removeEventSubscription(b)}},[s]),n},Pe={idToken:null,idTokenPayload:null},mt=s=>{const a=c.OidcClient.get,n=a(s);if(n.tokens){const o=n.tokens;return{idToken:o.idToken,idTokenPayload:o.idTokenPayload}}return Pe},kt=(s=re)=>{const a=c.OidcClient.get,[n,o]=_.useState(mt(s));return _.useEffect(()=>{let u=!0;const f=a(s);if(f.tokens){const l=f.tokens;o({idToken:l.idToken,idTokenPayload:l.idTokenPayload})}const b=f.subscribeEvents((l,v)=>{if((l===c.OidcClient.eventNames.token_renewed||l===c.OidcClient.eventNames.token_aquired||l===c.OidcClient.eventNames.logout_from_another_tab||l===c.OidcClient.eventNames.logout_from_same_tab||l===c.OidcClient.eventNames.refreshTokensAsync_error||l===c.OidcClient.eventNames.syncTokensAsync_error)&&u){const m=f.tokens;o(m!=null?{idToken:m.idToken,idTokenPayload:m.idTokenPayload}:Pe)}});return()=>{u=!1,f.removeEventSubscription(b)}},[s]),n};var Ce=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Ce||{});const Ot=(s="default",a=!1)=>{const[n,o]=_.useState({user:null,status:"Unauthenticated"}),[u,f]=_.useState("");_.useEffect(()=>{const l=c.OidcClient.get(s);let v=!0;if(l&&l.tokens){o({...n,status:"Loading user"});const g=u!=="";l.userInfoAsync(g,a).then(O=>{v&&o({user:O,status:"User loaded"})}).catch(()=>o({...n,status:"Error loading user"}))}else o({user:null,status:"Unauthenticated"});const m=l.subscribeEvents((g,O)=>{(g===c.OidcClient.eventNames.logout_from_another_tab||g===c.OidcClient.eventNames.logout_from_same_tab)&&v&&o({user:null,status:"Unauthenticated"})});return()=>{v=!1,l.removeEventSubscription(m)}},[u]);const b=()=>{f(u+" ")};return{oidcUser:n.user,oidcUserLoadingState:n.status,reloadOidcUser:b}};Object.defineProperty(E,"OidcClient",{enumerable:!0,get:()=>c.OidcClient}),Object.defineProperty(E,"OidcLocation",{enumerable:!0,get:()=>c.OidcLocation}),Object.defineProperty(E,"TokenAutomaticRenewMode",{enumerable:!0,get:()=>c.TokenAutomaticRenewMode}),Object.defineProperty(E,"TokenRenewMode",{enumerable:!0,get:()=>c.TokenRenewMode}),E.OidcProvider=ht,E.OidcSecure=Se,E.OidcUserStatus=Ce,E.useOidc=_t,E.useOidcAccessToken=bt,E.useOidcFetch=Ee,E.useOidcIdToken=kt,E.useOidcUser=Ot,E.withOidcFetch=$e,E.withOidcSecure=pt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
27
|
+
Check the top-level render call using <`+r+">.")}return t}}function Je(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Yt(t);if(Ge[r])return;Ge[r]=!0;var d="";e&&e._owner&&e._owner!==ge.current&&(d=" It was passed a child from "+P(e._owner.type)+"."),B(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,d),B(null)}}function Ke(e,t){{if(typeof e!="object")return;if(pe(e))for(var r=0;r<e.length;r++){var d=e[r];be(d)&&Je(d,t)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var y=W(e);if(typeof y=="function"&&y!==e.entries)for(var k=y.call(e),p;!(p=k.next()).done;)be(p.value)&&Je(p.value,t)}}}function Vt(e){{var t=e.type;if(t==null||typeof t=="string")return;var r;if(typeof t=="function")r=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===v||t.$$typeof===E))r=t.propTypes;else return;if(r){var d=P(t);jt(r,e.props,"prop",d,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var y=P(t);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Bt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var d=t[r];if(d!=="children"&&d!=="key"){B(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),B(null);break}}e.ref!==null&&(B(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function He(e,t,r,d,y,k){{var p=ue(e);if(!p){var h="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(h+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var j=Wt(y);j?h+=j:h+=ze();var T;e===null?T="null":pe(e)?T="array":e!==void 0&&e.$$typeof===a?(T="<"+(P(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,h)}var R=Mt(e,t,r,y,k);if(R==null)return R;if(p){var A=t.children;if(A!==void 0)if(d)if(pe(A)){for(var z=0;z<A.length;z++)Ke(A[z],e);Object.freeze&&Object.freeze(A)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ke(A,e)}return e===o?Bt(R):Vt(R),R}}function zt(e,t,r){return He(e,t,r,!0)}function Gt(e,t,r){return He(e,t,r,!1)}var Jt=Gt,Kt=zt;J.Fragment=o,J.jsx=Jt,J.jsxs=Kt}()),J}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=Ze();var i=ne.exports;const Oe="default",qe=(s,a,n=!1)=>async(...o)=>await a().fetchWithTokens(s,n)(...o),$e=(s=null,a=Oe,n=!1)=>o=>u=>{const{fetch:f}=Ee(s||u.fetch,a,n);return i.jsx(o,{...u,fetch:f})},Ee=(s=null,a=Oe,n=!1)=>{const o=s||window.fetch,u=c.OidcClient.get;return{fetch:_.useCallback((b,l)=>qe(o,()=>u(a),n)(b,l),[o,a])}},Te=()=>i.jsx("div",{className:"oidc-authenticating",children:i.jsxs("div",{className:"oidc-authenticating__container",children:[i.jsx("h1",{className:"oidc-authenticating__title",children:"Error authentication"}),i.jsx("p",{className:"oidc-authenticating__content",children:"An error occurred during authentication."})]})}),et=()=>i.jsx("div",{className:"oidc-authenticating",children:i.jsxs("div",{className:"oidc-authenticating__container",children:[i.jsx("h1",{className:"oidc-authenticating__title",children:"Authentication in progress"}),i.jsx("p",{className:"oidc-authenticating__content",children:"You will be redirected to the login page."})]})}),tt=()=>Math.random().toString(36).substr(2,6),nt=(s,a)=>(n,o)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,o);const u=o||{bubbles:!1,cancelable:!1,detail:void 0},f=a.createEvent("CustomEvent");return f.initCustomEvent(n,u.bubbles,u.cancelable,u.detail),f.prototype=s.Event.prototype,f},rt=(s,a,n)=>({replaceState:(o,u)=>{const f=n(),b=u||s.history.state;s.history.replaceState({key:f,state:b},null,o),s.dispatchEvent(a("popstate"))}}),st=()=>rt(window,nt(window,document),tt),we=()=>i.jsx("div",{className:"oidc-callback",children:i.jsxs("div",{className:"oidc-callback__container",children:[i.jsx("h1",{className:"oidc-callback__title",children:"Authentication complete"}),i.jsx("p",{className:"oidc-callback__content",children:"You will be redirected to your application."})]})}),ot=({callBackError:s,callBackSuccess:a,configurationName:n,withCustomHistory:o})=>{const[u,f]=_.useState(!1);_.useEffect(()=>{let v=!0;return(async()=>{const g=c.OidcClient.get;try{const{callbackPath:E}=await g(n).loginCallbackAsync();(o?o():st()).replaceState(E||"/")}catch(E){v&&(console.warn(E),f(!0))}})(),()=>{v=!1}},[]);const b=s||Te,l=a||we;return u?i.jsx(b,{configurationName:n}):i.jsx(l,{configurationName:n})},at=()=>i.jsx("span",{className:"oidc-loading",children:"Loading"}),ct=()=>i.jsx("div",{className:"oidc-serviceworker",children:i.jsxs("div",{className:"oidc-serviceworker__container",children:[i.jsx("h1",{className:"oidc-serviceworker__title",children:"Unable to authenticate on this browser"}),i.jsx("p",{className:"oidc-serviceworker__content",children:"Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser."})]})}),it=()=>i.jsx("div",{className:"oidc-session-lost",children:i.jsxs("div",{className:"oidc-session-lost__container",children:[i.jsx("h1",{className:"oidc-session-lost__title",children:"Session timed out"}),i.jsx("p",{className:"oidc-session-lost__content",children:"Your session has expired. Please re-authenticate."})]})}),lt=({configurationName:s})=>(_.useEffect(()=>{(async()=>{const n=c.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),i.jsx(i.Fragment,{})),ut=({configurationName:s})=>{const a=c.getParseQueryStringFromLocation(window.location.href),n=c.OidcClient.get,o=n(s);let u=null;for(const[f,b]of Object.entries(a))f==="state"||f==="scope"||(u===null&&(u={}),u[f]=b);return _.useEffect(()=>{o.tokens||o.loginAsync(null,u,!0,a.scope)},[]),i.jsx(i.Fragment,{})},ft=({callbackErrorComponent:s,callbackSuccessComponent:a,redirect_uri:n,silent_redirect_uri:o,silent_login_uri:u,children:f,configurationName:b,withCustomHistory:l=null,location:v})=>{const m=window?c.getPath(window.location.href):"",[g,E]=_.useState(m);_.useEffect(()=>{const x=()=>E(c.getPath(window.location.href));return x(),window.addEventListener("popstate",x,!1),()=>window.removeEventListener("popstate",x,!1)},[]);const C=c.getPath(n);if(o&&g===c.getPath(o))return i.jsx(lt,{configurationName:b});if(u&&g===c.getPath(u))return i.jsx(ut,{configurationName:b});switch(g){case C:return i.jsx(ot,{callBackError:s,callBackSuccess:a,configurationName:b,withCustomHistory:l});default:return i.jsx(i.Fragment,{children:f})}},dt=_.memo(ft),Re={name:"",data:null},vt=({loadingComponent:s,children:a,configurationName:n})=>{const[o,u]=_.useState(!0),f=c.OidcClient.get,b=f(n);_.useEffect(()=>{let v=!0;return b&&b.tryKeepExistingSessionAsync().then(()=>{v&&u(!1)}),()=>{v=!1}},[n]);const l=s;return i.jsx(i.Fragment,{children:o?i.jsx(l,{configurationName:n}):i.jsx(i.Fragment,{children:a})})},K=({isLoading:s,loadingComponent:a,children:n,configurationName:o})=>{const u=a;return s?i.jsx(u,{configurationName:o,children:n}):i.jsx(i.Fragment,{children:n})},ht=({children:s,configuration:a,configurationName:n="default",callbackSuccessComponent:o=we,authenticatingComponent:u=et,loadingComponent:f=at,serviceWorkerNotSupportedComponent:b=ct,authenticatingErrorComponent:l=Te,sessionLostComponent:v=it,onSessionLost:m=null,onLogoutFromAnotherTab:g=null,onLogoutFromSameTab:E=null,withCustomHistory:C=null,onEvent:x=null,getFetch:X=null,location:Q=null})=>{const W=(D="default")=>c.OidcClient.getOrCreate(X??c.getFetchDefault,Q??new c.OidcLocation)(a,D),[L,S]=_.useState(!0),[oe,Y]=_.useState(Re),[ae,ce]=_.useState("default");_.useEffect(()=>{const V=W(n).subscribeEvents((w,N)=>{x&&x(n,w,N)});return()=>{W(n).removeEventSubscription(V)}},[n,x]),_.useEffect(()=>{const V=W(n).subscribeEvents((w,N)=>{if(w===c.OidcClient.eventNames.refreshTokensAsync_error||w===c.OidcClient.eventNames.syncTokensAsync_error){if(m!=null){m();return}Y({name:w,data:N})}else if(w===c.OidcClient.eventNames.logout_from_another_tab){if(g!=null){g();return}Y({name:w,data:N})}else w===c.OidcClient.eventNames.logout_from_same_tab?E!=null&&E():w===c.OidcClient.eventNames.loginAsync_begin||w===c.OidcClient.eventNames.loginCallbackAsync_end||w===c.OidcClient.eventNames.loginAsync_error||w===c.OidcClient.eventNames.loginCallbackAsync_error?Y({name:w,data:N}):w===c.OidcClient.eventNames.service_worker_not_supported_by_browser&&a.service_worker_only===!0&&Y({name:w,data:N})});return ce(n),S(!1),()=>{W(n).removeEventSubscription(V),Y(Re)}},[a,n]);const ie=v,le=u,F=f,ue=b,fe=l,U=L||ae!==n,P=W(n);switch(oe.name){case c.OidcClient.eventNames.service_worker_not_supported_by_browser:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(ue,{configurationName:n})});case c.OidcClient.eventNames.loginAsync_begin:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(le,{configurationName:n})});case c.OidcClient.eventNames.loginAsync_error:case c.OidcClient.eventNames.loginCallbackAsync_error:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(fe,{configurationName:n})});case c.OidcClient.eventNames.refreshTokensAsync_error:case c.OidcClient.eventNames.syncTokensAsync_error:case c.OidcClient.eventNames.logout_from_another_tab:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(ie,{configurationName:n})});default:return i.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(dt,{redirect_uri:P.configuration.redirect_uri,silent_redirect_uri:P.configuration.silent_redirect_uri,silent_login_uri:P.configuration.silent_login_uri,callbackSuccessComponent:o,callbackErrorComponent:l,authenticatingComponent:u,configurationName:n,withCustomHistory:C,location:Q??new c.OidcLocation,children:i.jsx(vt,{loadingComponent:F,configurationName:n,children:s})})})}},Se=({children:s,callbackPath:a=null,extras:n=null,configurationName:o="default"})=>{const u=c.OidcClient.get,f=u(o);return _.useEffect(()=>{f.tokens||f.loginAsync(a,n)},[o,a,n]),f.tokens?i.jsx(i.Fragment,{children:s}):null},pt=(s,a=null,n=null,o="default")=>u=>i.jsx(Se,{callbackPath:a,extras:n,configurationName:o,children:i.jsx(s,{...u})}),re="default",se=(s,a)=>{let n=!1;return s(a)&&(n=s(a).tokens!=null),n},_t=(s=re)=>{const a=c.OidcClient.get,[n,o]=_.useState(se(a,s));return _.useEffect(()=>{let l=!0;const v=a(s);o(se(a,s));const m=v.subscribeEvents((g,E)=>{(g===c.OidcClient.eventNames.logout_from_another_tab||g===c.OidcClient.eventNames.logout_from_same_tab||g===c.OidcClient.eventNames.token_aquired)&&l&&o(se(a,s))});return()=>{l=!1,v.removeEventSubscription(m)}},[s]),{login:(l=void 0,v=null,m=!1)=>a(s).loginAsync(l,v,!1,void 0,m),logout:(l=void 0,v=null)=>a(s).logoutAsync(l,v),renewTokens:async(l=null)=>{const v=await a(s).renewTokensAsync(l);return{accessToken:v.accessToken,accessTokenPayload:v.accessTokenPayload,idToken:v.idToken,idTokenPayload:v.idTokenPayload}},isAuthenticated:n}},je={accessToken:null,accessTokenPayload:null},gt=s=>{const a=c.OidcClient.get,n=a(s);if(n.tokens){const o=n.tokens;return{accessToken:o.accessToken,accessTokenPayload:o.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:n.configuration.demonstrating_proof_of_possession?(u,f)=>n.generateDemonstrationOfProofOfPossessionAsync(o.accessToken,u,f):null}}return je};function yt(s,a){return s.configuration.demonstrating_proof_of_possession?(n,o,u={})=>s.generateDemonstrationOfProofOfPossessionAsync(a.accessToken,n,o,u):null}const bt=(s=re)=>{const a=c.OidcClient.get,[n,o]=_.useState(gt(s));return _.useEffect(()=>{let u=!0;const f=a(s);if(f.tokens){const l=f.tokens;o({accessToken:l.accessToken,accessTokenPayload:l.accessTokenPayload})}const b=f.subscribeEvents((l,v)=>{if((l===c.OidcClient.eventNames.token_renewed||l===c.OidcClient.eventNames.token_aquired||l===c.OidcClient.eventNames.logout_from_another_tab||l===c.OidcClient.eventNames.logout_from_same_tab||l===c.OidcClient.eventNames.refreshTokensAsync_error||l===c.OidcClient.eventNames.syncTokensAsync_error)&&u){const m=f.tokens;o(m!=null?{accessToken:m.accessToken,accessTokenPayload:m.accessTokenPayload,generateDemonstrationOfProofOfPossessionAsync:yt(f,m)}:je)}});return()=>{u=!1,f.removeEventSubscription(b)}},[s]),n},Pe={idToken:null,idTokenPayload:null},mt=s=>{const a=c.OidcClient.get,n=a(s);if(n.tokens){const o=n.tokens;return{idToken:o.idToken,idTokenPayload:o.idTokenPayload}}return Pe},kt=(s=re)=>{const a=c.OidcClient.get,[n,o]=_.useState(mt(s));return _.useEffect(()=>{let u=!0;const f=a(s);if(f.tokens){const l=f.tokens;o({idToken:l.idToken,idTokenPayload:l.idTokenPayload})}const b=f.subscribeEvents((l,v)=>{if((l===c.OidcClient.eventNames.token_renewed||l===c.OidcClient.eventNames.token_aquired||l===c.OidcClient.eventNames.logout_from_another_tab||l===c.OidcClient.eventNames.logout_from_same_tab||l===c.OidcClient.eventNames.refreshTokensAsync_error||l===c.OidcClient.eventNames.syncTokensAsync_error)&&u){const m=f.tokens;o(m!=null?{idToken:m.idToken,idTokenPayload:m.idTokenPayload}:Pe)}});return()=>{u=!1,f.removeEventSubscription(b)}},[s]),n};var Ce=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(Ce||{});const Ot=(s="default",a=!1)=>{const[n,o]=_.useState({user:null,status:"Unauthenticated"}),[u,f]=_.useState("");_.useEffect(()=>{const l=c.OidcClient.get(s);let v=!0;if(l&&l.tokens){o({...n,status:"Loading user"});const g=u!=="";l.userInfoAsync(g,a).then(E=>{v&&o({user:E,status:"User loaded"})}).catch(()=>o({...n,status:"Error loading user"}))}else o({user:null,status:"Unauthenticated"});const m=l.subscribeEvents(g=>{(g===c.OidcClient.eventNames.logout_from_another_tab||g===c.OidcClient.eventNames.logout_from_same_tab)&&v&&o({user:null,status:"Unauthenticated"})});return()=>{v=!1,l.removeEventSubscription(m)}},[u]);const b=()=>{f(u+" ")};return{oidcUser:n.user,oidcUserLoadingState:n.status,reloadOidcUser:b}};Object.defineProperty(O,"OidcClient",{enumerable:!0,get:()=>c.OidcClient}),Object.defineProperty(O,"OidcLocation",{enumerable:!0,get:()=>c.OidcLocation}),Object.defineProperty(O,"TokenAutomaticRenewMode",{enumerable:!0,get:()=>c.TokenAutomaticRenewMode}),Object.defineProperty(O,"TokenRenewMode",{enumerable:!0,get:()=>c.TokenRenewMode}),O.OidcProvider=ht,O.OidcSecure=Se,O.OidcUserStatus=Ce,O.useOidc=_t,O.useOidcAccessToken=bt,O.useOidcFetch=Ee,O.useOidcIdToken=kt,O.useOidcUser=Ot,O.withOidcFetch=$e,O.withOidcSecure=pt,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/react-oidc",
|
|
3
|
-
"version": "7.22.
|
|
3
|
+
"version": "7.22.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -40,31 +40,31 @@
|
|
|
40
40
|
"lint": "eslint src"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@axa-fr/oidc-client-service-worker": "7.22.
|
|
44
|
-
"@axa-fr/oidc-client": "7.22.
|
|
43
|
+
"@axa-fr/oidc-client-service-worker": "7.22.2",
|
|
44
|
+
"@axa-fr/oidc-client": "7.22.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^17.0.0 || ^18.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@testing-library/jest-dom": "6.4.2",
|
|
51
|
-
"@testing-library/react": "
|
|
51
|
+
"@testing-library/react": "15.0.2",
|
|
52
52
|
"@testing-library/user-event": "14.5.2",
|
|
53
|
-
"@types/react": "^18.2.
|
|
53
|
+
"@types/react": "^18.2.78",
|
|
54
54
|
"@vitejs/plugin-react": "4.2.1",
|
|
55
|
-
"@vitest/coverage-v8": "1.
|
|
55
|
+
"@vitest/coverage-v8": "1.5.0",
|
|
56
56
|
"cpy": "11.0.1",
|
|
57
57
|
"cpy-cli": "^5.0.0",
|
|
58
58
|
"cross-env": "^7.0.3",
|
|
59
59
|
"jsdom": "24.0.0",
|
|
60
|
-
"msw": "2.
|
|
60
|
+
"msw": "2.2.13",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
63
|
"rimraf": "5.0.5",
|
|
64
|
-
"typescript": "5.4.
|
|
65
|
-
"vite": "5.
|
|
66
|
-
"vite-plugin-dts": "3.
|
|
67
|
-
"vitest": "1.
|
|
64
|
+
"typescript": "5.4.5",
|
|
65
|
+
"vite": "5.2.8",
|
|
66
|
+
"vite-plugin-dts": "3.8.3",
|
|
67
|
+
"vitest": "1.5.0"
|
|
68
68
|
},
|
|
69
69
|
"license": "MIT",
|
|
70
70
|
"publishConfig": {
|
package/src/User.ts
CHANGED
|
@@ -34,8 +34,7 @@ export const useOidcUser = <T extends OidcUserInfo = OidcUserInfo>(configuration
|
|
|
34
34
|
} else {
|
|
35
35
|
setOidcUser({ user: null, status: OidcUserStatus.Unauthenticated });
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
const newSubscriptionId = oidc.subscribeEvents((name: string, data: any) => {
|
|
37
|
+
const newSubscriptionId = oidc.subscribeEvents((name: string) => {
|
|
39
38
|
if (name === OidcClient.eventNames.logout_from_another_tab || name === OidcClient.eventNames.logout_from_same_tab) {
|
|
40
39
|
if (isMounted) {
|
|
41
40
|
setOidcUser({ user: null, status: OidcUserStatus.Unauthenticated });
|