@axa-fr/react-oidc 7.7.2 → 7.8.0

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.
@@ -1,4 +1,4 @@
1
- (function(R,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react"),require("@axa-fr/oidc-client")):typeof define=="function"&&define.amd?define(["exports","react","@axa-fr/oidc-client"],g):(R=typeof globalThis<"u"?globalThis:R||self,g(R["react-oidc"]={},R.React,R.oidcClient))})(this,function(R,g,l){"use strict";var ne={exports:{}},G={};/**
1
+ (function(R,_){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"],_):(R=typeof globalThis<"u"?globalThis:R||self,_(R["react-oidc"]={},R.React,R.oidcClient))})(this,function(R,_,i){"use strict";var ne={exports:{}},J={};/**
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 ke;function Qe(){if(ke)return G;ke=1;var s=g,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(c,v,k){var y,O={},j=null,C=null;k!==void 0&&(j=""+k),v.key!==void 0&&(j=""+v.key),v.ref!==void 0&&(C=v.ref);for(y in v)a.call(v,y)&&!u.hasOwnProperty(y)&&(O[y]=v[y]);if(c&&c.defaultProps)for(y in v=c.defaultProps,v)O[y]===void 0&&(O[y]=v[y]);return{$$typeof:o,type:c,key:j,ref:C,props:O,_owner:d.current}}return G.Fragment=n,G.jsx=h,G.jsxs=h,G}var H={};/**
9
+ */var ke;function Qe(){if(ke)return J;ke=1;var s=_,o=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,f=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function y(l,v,k){var m,w={},x=null,P=null;k!==void 0&&(x=""+k),v.key!==void 0&&(x=""+v.key),v.ref!==void 0&&(P=v.ref);for(m in v)a.call(v,m)&&!u.hasOwnProperty(m)&&(w[m]=v[m]);if(l&&l.defaultProps)for(m in v=l.defaultProps,v)w[m]===void 0&&(w[m]=v[m]);return{$$typeof:o,type:l,key:x,ref:P,props:w,_owner:f.current}}return J.Fragment=n,J.jsx=y,J.jsxs=y,J}var G={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,14 +14,14 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var me;function Ze(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){var s=g,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"),c=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),X=Symbol.iterator,Q="@@iterator";function M(e){if(e===null||typeof e!="object")return null;var t=X&&e[X]||e[Q];return typeof t=="function"?t:null}var L=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(e){{for(var t=arguments.length,r=new Array(t>1?t-1:0),f=1;f<t;f++)r[f-1]=arguments[f];oe("error",e,r)}}function oe(e,t,r){{var f=L.ReactDebugCurrentFrame,b=f.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,ce=!1,ie=!1,le=!1,F;F=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===a||e===u||le||e===d||e===k||e===y||ie||e===C||Y||ae||ce||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===O||e.$$typeof===h||e.$$typeof===c||e.$$typeof===v||e.$$typeof===F||e.getModuleId!==void 0))}function de(e,t,r){var f=e.displayName;if(f)return f;var b=t.displayName||t.name||"";return b!==""?r+"("+b+")":r}function U(e){return e.displayName||"Context"}function x(e){if(e==null)return null;if(typeof e.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case a:return"Fragment";case n:return"Portal";case u:return"Profiler";case d:return"StrictMode";case k:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case c:var t=e;return U(t)+".Consumer";case h:var r=e;return U(r._context)+".Provider";case v:return de(e,e.render,"ForwardRef");case O:var f=e.displayName||null;return f!==null?f:x(e.type)||"Memo";case j:{var b=e,m=b._payload,_=b._init;try{return x(_(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&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=L.ReactCurrentDispatcher,ve;function Z(e,t,r){{if(ve===void 0)try{throw Error()}catch(b){var f=b.stack.trim().match(/\n( *(at )?)/);ve=f&&f[1]||""}return`
18
- `+ve+e}}var he=!1,q;{var Tt=typeof WeakMap=="function"?WeakMap:Map;q=new Tt}function Ie(e,t){if(!e||he)return"";{var r=q.get(e);if(r!==void 0)return r}var f;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){f=I}Reflect.construct(e,[],_)}else{try{_.call()}catch(I){f=I}e.call(_.prototype)}}else{try{throw Error()}catch(I){f=I}e()}}catch(I){if(I&&f&&typeof I.stack=="string"){for(var p=I.stack.split(`
19
- `),P=f.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 A=`
21
- `+p[E].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(E>=1&&w>=0);break}}}finally{he=!1,fe.current=m,Et(),Error.prepareStackTrace=b}var z=e?e.displayName||e.name:"",Xe=z?Z(z):"";return typeof e=="function"&&q.set(e,Xe),Xe}function wt(e,t,r){return Ie(e,!1)}function Rt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function $(e,t,r){if(e==null)return"";if(typeof e=="function")return Ie(e,Rt(e));if(typeof e=="string")return Z(e);switch(e){case k:return Z("Suspense");case y:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return wt(e.render);case O:return $(e.type,t,r);case j:{var f=e,b=f._payload,m=f._init;try{return $(m(b),t,r)}catch{}}}return""}var ee=Object.prototype.hasOwnProperty,Le={},Ue=L.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,r=$(e.type,e._source,t?t.type:null);Ue.setExtraStackFrame(r)}else Ue.setExtraStackFrame(null)}function St(e,t,r,f,b){{var m=Function.call.bind(ee);for(var _ in e)if(m(e,_)){var p=void 0;try{if(typeof e[_]!="function"){var P=Error((f||"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,_,f,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){p=E}p&&!(p instanceof Error)&&(te(b),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).",f||"React class",r,_,typeof p),te(null)),p instanceof Error&&!(p.message in Le)&&(Le[p.message]=!0,te(b),S("Failed %s type: %s",r,p.message),te(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 S("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(ee.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function Ft(e){if(ee.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Nt(e,t){if(typeof e.ref=="string"&&K.current&&t&&K.current.stateNode!==t){var r=x(K.current.type);_e[r]||(S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',x(K.current.type),e.ref),_e[r]=!0)}}function Dt(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 It(e,t){{var r=function(){Ve||(Ve=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}}var Lt=function(e,t,r,f,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:f}),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,f,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)ee.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,f,K.current,_)}}var ge=L.ReactCurrentOwner,Be=L.ReactDebugCurrentFrame;function B(e){if(e){var t=e._owner,r=$(e.type,e._source,t?t.type:null);Be.setExtraStackFrame(r)}else Be.setExtraStackFrame(null)}var ye;ye=!1;function be(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function ze(){{if(ge.current){var e=x(ge.current.type);if(e)return`
17
+ */var me;function Ze(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){var s=_,o=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),l=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),X=Symbol.iterator,Q="@@iterator";function M(e){if(e===null||typeof e!="object")return null;var t=X&&e[X]||e[Q];return typeof t=="function"?t:null}var L=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(e){{for(var t=arguments.length,r=new Array(t>1?t-1:0),d=1;d<t;d++)r[d-1]=arguments[d];oe("error",e,r)}}function oe(e,t,r){{var d=L.ReactDebugCurrentFrame,g=d.getStackAddendum();g!==""&&(t+="%s",r=r.concat([g]));var b=r.map(function(p){return String(p)});b.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,b)}}var Y=!1,ae=!1,ce=!1,ie=!1,le=!1,F;F=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===a||e===u||le||e===f||e===k||e===m||ie||e===P||Y||ae||ce||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===w||e.$$typeof===y||e.$$typeof===l||e.$$typeof===v||e.$$typeof===F||e.getModuleId!==void 0))}function de(e,t,r){var d=e.displayName;if(d)return d;var g=t.displayName||t.name||"";return g!==""?r+"("+g+")":r}function U(e){return e.displayName||"Context"}function C(e){if(e==null)return null;if(typeof e.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case a:return"Fragment";case n:return"Portal";case u:return"Profiler";case f:return"StrictMode";case k:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case l:var t=e;return U(t)+".Consumer";case y:var r=e;return U(r._context)+".Provider";case v:return de(e,e.render,"ForwardRef");case w:var d=e.displayName||null;return d!==null?d:C(e.type)||"Memo";case x:{var g=e,b=g._payload,p=g._init;try{return C(p(b))}catch{return null}}}return null}var W=Object.assign,N=0,V,E,I,Pe,Ae,Fe,Ne;function Ie(){}Ie.__reactDisabledLog=!0;function Ot(){{if(N===0){V=console.log,E=console.info,I=console.warn,Pe=console.error,Ae=console.group,Fe=console.groupCollapsed,Ne=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ie,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}}function Et(){{if(N--,N===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:V}),info:W({},e,{value:E}),warn:W({},e,{value:I}),error:W({},e,{value:Pe}),group:W({},e,{value:Ae}),groupCollapsed:W({},e,{value:Fe}),groupEnd:W({},e,{value:Ne})})}N<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=L.ReactCurrentDispatcher,ve;function Z(e,t,r){{if(ve===void 0)try{throw Error()}catch(g){var d=g.stack.trim().match(/\n( *(at )?)/);ve=d&&d[1]||""}return`
18
+ `+ve+e}}var he=!1,q;{var Tt=typeof WeakMap=="function"?WeakMap:Map;q=new Tt}function De(e,t){if(!e||he)return"";{var r=q.get(e);if(r!==void 0)return r}var d;he=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var b;b=fe.current,fe.current=null,Ot();try{if(t){var p=function(){throw Error()};if(Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(D){d=D}Reflect.construct(e,[],p)}else{try{p.call()}catch(D){d=D}e.call(p.prototype)}}else{try{throw Error()}catch(D){d=D}e()}}catch(D){if(D&&d&&typeof D.stack=="string"){for(var h=D.stack.split(`
19
+ `),j=d.stack.split(`
20
+ `),O=h.length-1,T=j.length-1;O>=1&&T>=0&&h[O]!==j[T];)T--;for(;O>=1&&T>=0;O--,T--)if(h[O]!==j[T]){if(O!==1||T!==1)do if(O--,T--,T<0||h[O]!==j[T]){var A=`
21
+ `+h[O].replace(" at new "," at ");return e.displayName&&A.includes("<anonymous>")&&(A=A.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,A),A}while(O>=1&&T>=0);break}}}finally{he=!1,fe.current=b,Et(),Error.prepareStackTrace=g}var z=e?e.displayName||e.name:"",Xe=z?Z(z):"";return typeof e=="function"&&q.set(e,Xe),Xe}function wt(e,t,r){return De(e,!1)}function Rt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function $(e,t,r){if(e==null)return"";if(typeof e=="function")return De(e,Rt(e));if(typeof e=="string")return Z(e);switch(e){case k:return Z("Suspense");case m:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return wt(e.render);case w:return $(e.type,t,r);case x:{var d=e,g=d._payload,b=d._init;try{return $(b(g),t,r)}catch{}}}return""}var ee=Object.prototype.hasOwnProperty,Le={},Ue=L.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,r=$(e.type,e._source,t?t.type:null);Ue.setExtraStackFrame(r)}else Ue.setExtraStackFrame(null)}function St(e,t,r,d,g){{var b=Function.call.bind(ee);for(var p in e)if(b(e,p)){var h=void 0;try{if(typeof e[p]!="function"){var j=Error((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(O){h=O}h&&!(h instanceof Error)&&(te(g),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",d||"React class",r,p,typeof h),te(null)),h instanceof Error&&!(h.message in Le)&&(Le[h.message]=!0,te(g),S("Failed %s type: %s",r,h.message),te(null))}}}var jt=Array.isArray;function pe(e){return jt(e)}function Ct(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,r=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r}}function xt(e){try{return We(e),!1}catch{return!0}}function We(e){return""+e}function Me(e){if(xt(e))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ct(e)),We(e)}var H=L.ReactCurrentOwner,Pt={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ve,_e;_e={};function At(e){if(ee.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function Ft(e){if(ee.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Nt(e,t){if(typeof e.ref=="string"&&H.current&&t&&H.current.stateNode!==t){var r=C(H.current.type);_e[r]||(S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',C(H.current.type),e.ref),_e[r]=!0)}}function It(e,t){{var r=function(){Ye||(Ye=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}}function Dt(e,t){{var r=function(){Ve||(Ve=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}}var Lt=function(e,t,r,d,g,b,p){var h={$$typeof:o,type:e,key:t,ref:r,props:p,_owner:b};return h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(h,"_self",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.defineProperty(h,"_source",{configurable:!1,enumerable:!1,writable:!1,value:g}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h};function Ut(e,t,r,d,g){{var b,p={},h=null,j=null;r!==void 0&&(Me(r),h=""+r),Ft(t)&&(Me(t.key),h=""+t.key),At(t)&&(j=t.ref,Nt(t,g));for(b in t)ee.call(t,b)&&!Pt.hasOwnProperty(b)&&(p[b]=t[b]);if(e&&e.defaultProps){var O=e.defaultProps;for(b in O)p[b]===void 0&&(p[b]=O[b])}if(h||j){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;h&&It(p,T),j&&Dt(p,T)}return Lt(e,h,j,g,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===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
- 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=`
25
+ Check your code at `+t+":"+r+"."}return""}}var Je={};function Mt(e){{var t=ze();if(!t){var r=typeof e=="string"?e:e.displayName||e.name;r&&(t=`
26
26
 
27
- Check the top-level render call using <`+r+">.")}return t}}function 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 f="";e&&e._owner&&e._owner!==ge.current&&(f=" It was passed a child from "+x(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,f),B(null)}}function Je(e,t){{if(typeof e!="object")return;if(pe(e))for(var r=0;r<e.length;r++){var f=e[r];be(f)&&He(f,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===v||t.$$typeof===O))r=t.propTypes;else return;if(r){var f=x(t);St(r,e.props,"prop",f,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var b=x(t);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var f=t[r];if(f!=="children"&&f!=="key"){B(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",f),B(null);break}}e.ref!==null&&(B(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function Ke(e,t,r,f,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="<"+(x(e.type)||"Unknown")+" />",p=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,p)}var w=Ut(e,t,r,b,m);if(w==null)return w;if(_){var A=t.children;if(A!==void 0)if(f)if(pe(A)){for(var z=0;z<A.length;z++)Je(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 Je(A,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 i=ne.exports;const Oe="default",qe=(s,o)=>async(...n)=>{var j;const[a,d,...u]=n,h=d?{...d}:{method:"GET"};let c=new Headers;h.headers&&(c=h.headers instanceof Headers?h.headers:new Headers(h.headers));const v=o(),k=await v.getValidTokenAsync(),y=(j=k==null?void 0:k.tokens)==null?void 0:j.accessToken;if(c.has("Accept")||c.set("Accept","application/json"),y){if(v.configuration.demonstrating_proof_of_possession){const C=await v.generateDemonstrationOfProofOfPossessionAsync(y,a.toString(),h.method);c.set("Authorization",`PoP ${y}`),c.set("DPoP",C)}else c.set("Authorization",`Bearer ${y}`);h.credentials||(h.credentials="same-origin")}const O={...h,headers:c};return await s(a,O,...u)},$e=(s=null,o=Oe)=>n=>a=>{const{fetch:d}=Ee(s||a.fetch,o);return i.jsx(n,{...a,fetch:d})},Ee=(s=null,o=Oe)=>{const n=s||window.fetch,a=l.OidcClient.get;return{fetch:g.useCallback((u,h)=>qe(n,()=>a(o))(u,h),[n,o])}},Te=()=>i.jsx("div",{className:"oidc-authenticating",children:i.jsxs("div",{className:"oidc-authenticating__container",children:[i.jsx("h1",{className:"oidc-authenticating__title",children:"Error authentication"}),i.jsx("p",{className:"oidc-authenticating__content",children:"An error occurred during authentication."})]})}),et=()=>i.jsx("div",{className:"oidc-authenticating",children:i.jsxs("div",{className:"oidc-authenticating__container",children:[i.jsx("h1",{className:"oidc-authenticating__title",children:"Authentication in progress"}),i.jsx("p",{className:"oidc-authenticating__content",children:"You will be redirected to the login page."})]})}),tt=()=>Math.random().toString(36).substr(2,6),nt=(s,o)=>(n,a)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,a);const 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=()=>i.jsx("div",{className:"oidc-callback",children:i.jsxs("div",{className:"oidc-callback__container",children:[i.jsx("h1",{className:"oidc-callback__title",children:"Authentication complete"}),i.jsx("p",{className:"oidc-callback__content",children:"You will be redirected to your application."})]})}),ot=({callBackError:s,callBackSuccess:o,configurationName:n,withCustomHistory:a})=>{const[d,u]=g.useState(!1);g.useEffect(()=>{let v=!0;return(async()=>{const y=l.OidcClient.get;try{const{callbackPath:O}=await y(n).loginCallbackAsync();(a?a():st()).replaceState(O||"/")}catch(O){v&&(console.warn(O),u(!0))}})(),()=>{v=!1}},[]);const h=s||Te,c=o||we;return d?i.jsx(h,{configurationName:n}):i.jsx(c,{configurationName:n})},at=()=>i.jsx("span",{className:"oidc-loading",children:"Loading"}),ct=()=>i.jsx("div",{className:"oidc-serviceworker",children:i.jsxs("div",{className:"oidc-serviceworker__container",children:[i.jsx("h1",{className:"oidc-serviceworker__title",children:"Unable to authenticate on this browser"}),i.jsx("p",{className:"oidc-serviceworker__content",children:"Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser."})]})}),it=()=>i.jsx("div",{className:"oidc-session-lost",children:i.jsxs("div",{className:"oidc-session-lost__container",children:[i.jsx("h1",{className:"oidc-session-lost__title",children:"Session timed out"}),i.jsx("p",{className:"oidc-session-lost__content",children:"Your session has expired. Please re-authenticate."})]})}),lt=({configurationName:s})=>(g.useEffect(()=>{(async()=>{const n=l.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),i.jsx(i.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 g.useEffect(()=>{a.tokens||a.loginAsync(null,d,!0,o.scope)},[]),i.jsx(i.Fragment,{})},dt=({callbackErrorComponent:s,callbackSuccessComponent:o,redirect_uri:n,silent_redirect_uri:a,silent_login_uri:d,children:u,configurationName:h,withCustomHistory:c=null,location:v})=>{const k=window?l.getPath(window.location.href):"",[y,O]=g.useState(k);g.useEffect(()=>{const C=()=>O(l.getPath(window.location.href));return C(),window.addEventListener("popstate",C,!1),()=>window.removeEventListener("popstate",C,!1)},[]);const j=l.getPath(n);if(a&&y===l.getPath(a))return i.jsx(lt,{configurationName:h});if(d&&y===l.getPath(d))return i.jsx(ut,{configurationName:h});switch(y){case j:return i.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:h,withCustomHistory:c});default:return i.jsx(i.Fragment,{children:u})}},ft=g.memo(dt),Re={name:"",data:null},vt=({loadingComponent:s,children:o,configurationName:n})=>{const[a,d]=g.useState(!0),u=l.OidcClient.get,h=u(n);g.useEffect(()=>{let v=!0;return h&&h.tryKeepExistingSessionAsync().then(()=>{v&&d(!1)}),()=>{v=!1}},[n]);const c=s;return i.jsx(i.Fragment,{children:a?i.jsx(c,{configurationName:n}):i.jsx(i.Fragment,{children:o})})},J=({isLoading:s,loadingComponent:o,children:n,configurationName:a})=>{const d=o;return s?i.jsx(d,{configurationName:a,children:n}):i.jsx(i.Fragment,{children:n})},ht=({children:s,configuration:o,configurationName:n="default",callbackSuccessComponent:a=we,authenticatingComponent:d=et,loadingComponent:u=at,serviceWorkerNotSupportedComponent:h=ct,authenticatingErrorComponent:c=Te,sessionLostComponent:v=it,onSessionLost:k=null,onLogoutFromAnotherTab:y=null,onLogoutFromSameTab:O=null,withCustomHistory:j=null,onEvent:C=null,getFetch:X=null,location:Q=null})=>{const M=(N="default")=>l.OidcClient.getOrCreate(X??l.getFetchDefault,Q??new l.OidcLocation)(o,N),[L,S]=g.useState(!0),[oe,Y]=g.useState(Re),[ae,ce]=g.useState("default");g.useEffect(()=>{const V=M(n).subscribeEvents((T,D)=>{C&&C(n,T,D)});return()=>{M(n).removeEventSubscription(V)}},[n,C]),g.useEffect(()=>{const V=M(n).subscribeEvents((T,D)=>{if(T===l.OidcClient.eventNames.refreshTokensAsync_error||T===l.OidcClient.eventNames.syncTokensAsync_error){if(k!=null){k();return}Y({name:T,data:D})}else if(T===l.OidcClient.eventNames.logout_from_another_tab){if(y!=null){y();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 ce(n),S(!1),()=>{M(n).removeEventSubscription(V),Y(Re)}},[o,n]);const ie=v,le=d,F=u,ue=h,de=c,U=L||ae!==n,x=M(n);switch(oe.name){case l.OidcClient.eventNames.service_worker_not_supported_by_browser:return i.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(ue,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_begin:return i.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(le,{configurationName:n})});case l.OidcClient.eventNames.loginAsync_error:case l.OidcClient.eventNames.loginCallbackAsync_error:return i.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:i.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 i.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(ie,{configurationName:n})});default:return i.jsx(J,{loadingComponent:F,isLoading:U,configurationName:n,children:i.jsx(ft,{redirect_uri:x.configuration.redirect_uri,silent_redirect_uri:x.configuration.silent_redirect_uri,silent_login_uri:x.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:c,authenticatingComponent:d,configurationName:n,withCustomHistory:j,location:Q??new l.OidcLocation,children:i.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 g.useEffect(()=>{u.tokens||u.loginAsync(o,n)},[a,o,n]),u.tokens?i.jsx(i.Fragment,{children:s}):null},pt=(s,o=null,n=null,a="default")=>d=>i.jsx(Se,{callbackPath:o,extras:n,configurationName:a,children:i.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]=g.useState(se(o,s));return g.useEffect(()=>{let c=!0;const v=o(s);a(se(o,s));const k=v.subscribeEvents((y,O)=>{(y===l.OidcClient.eventNames.logout_from_another_tab||y===l.OidcClient.eventNames.logout_from_same_tab||y===l.OidcClient.eventNames.token_aquired)&&c&&a(se(o,s))});return()=>{c=!1,v.removeEventSubscription(k)}},[s]),{login:(c=void 0,v=null,k=!1)=>o(s).loginAsync(c,v,!1,void 0,k),logout:(c=void 0,v=null)=>o(s).logoutAsync(c,v),renewTokens:async(c=null)=>{const v=await o(s).renewTokensAsync(c);return{accessToken:v.accessToken,accessTokenPayload:v.accessTokenPayload,idToken:v.idToken,idTokenPayload:v.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=re)=>{const o=l.OidcClient.get,[n,a]=g.useState(gt(s));return g.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const c=u.tokens;a({accessToken:c.accessToken,accessTokenPayload:c.accessTokenPayload})}const h=u.subscribeEvents((c,v)=>{if((c===l.OidcClient.eventNames.token_renewed||c===l.OidcClient.eventNames.token_aquired||c===l.OidcClient.eventNames.logout_from_another_tab||c===l.OidcClient.eventNames.logout_from_same_tab||c===l.OidcClient.eventNames.refreshTokensAsync_error||c===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const k=u.tokens;a(k!=null?{accessToken:k.accessToken,accessTokenPayload:k.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=re)=>{const o=l.OidcClient.get,[n,a]=g.useState(bt(s));return g.useEffect(()=>{let d=!0;const u=o(s);if(u.tokens){const c=u.tokens;a({idToken:c.idToken,idTokenPayload:c.idTokenPayload})}const h=u.subscribeEvents((c,v)=>{if((c===l.OidcClient.eventNames.token_renewed||c===l.OidcClient.eventNames.token_aquired||c===l.OidcClient.eventNames.logout_from_another_tab||c===l.OidcClient.eventNames.logout_from_same_tab||c===l.OidcClient.eventNames.refreshTokensAsync_error||c===l.OidcClient.eventNames.syncTokensAsync_error)&&d){const k=u.tokens;a(k!=null?{idToken:k.idToken,idTokenPayload:k.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]=g.useState({user:null,status:"Unauthenticated"}),[a,d]=g.useState(""),u=l.OidcClient.get(s);g.useEffect(()=>{let c=!0;if(u&&u.tokens){n({...o,status:"Loading user"});const v=a!=="";u.userInfoAsync(v).then(k=>{c&&n({user:k,status:"User loaded"})}).catch(()=>n({...o,status:"Error loading user"}))}else n({user:null,status:"Unauthenticated"});return()=>{c=!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"})});
27
+ Check the top-level render call using <`+r+">.")}return t}}function Ge(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var r=Mt(t);if(Je[r])return;Je[r]=!0;var d="";e&&e._owner&&e._owner!==ge.current&&(d=" It was passed a child from "+C(e._owner.type)+"."),B(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,d),B(null)}}function Ke(e,t){{if(typeof e!="object")return;if(pe(e))for(var r=0;r<e.length;r++){var d=e[r];be(d)&&Ge(d,t)}else if(be(e))e._store&&(e._store.validated=!0);else if(e){var g=M(e);if(typeof g=="function"&&g!==e.entries)for(var b=g.call(e),p;!(p=b.next()).done;)be(p.value)&&Ge(p.value,t)}}}function Yt(e){{var t=e.type;if(t==null||typeof t=="string")return;var r;if(typeof t=="function")r=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===v||t.$$typeof===w))r=t.propTypes;else return;if(r){var d=C(t);St(r,e.props,"prop",d,e)}else if(t.PropTypes!==void 0&&!ye){ye=!0;var g=C(t);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",g||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vt(e){{for(var t=Object.keys(e.props),r=0;r<t.length;r++){var d=t[r];if(d!=="children"&&d!=="key"){B(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),B(null);break}}e.ref!==null&&(B(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function He(e,t,r,d,g,b){{var p=ue(e);if(!p){var h="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(h+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var j=Wt(g);j?h+=j:h+=ze();var O;e===null?O="null":pe(e)?O="array":e!==void 0&&e.$$typeof===o?(O="<"+(C(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):O=typeof e,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",O,h)}var T=Ut(e,t,r,g,b);if(T==null)return T;if(p){var A=t.children;if(A!==void 0)if(d)if(pe(A)){for(var z=0;z<A.length;z++)Ke(A[z],e);Object.freeze&&Object.freeze(A)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ke(A,e)}return e===a?Vt(T):Yt(T),T}}function Bt(e,t,r){return He(e,t,r,!0)}function zt(e,t,r){return He(e,t,r,!1)}var Jt=zt,Gt=Bt;G.Fragment=a,G.jsx=Jt,G.jsxs=Gt}()),G}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=Ze();var c=ne.exports;const Oe="default",qe=(s,o)=>async(...n)=>await o().fetchWithTokens(s)(...n),$e=(s=null,o=Oe)=>n=>a=>{const{fetch:f}=Ee(s||a.fetch,o);return c.jsx(n,{...a,fetch:f})},Ee=(s=null,o=Oe)=>{const n=s||window.fetch,a=i.OidcClient.get;return{fetch:_.useCallback((u,y)=>{const v=qe(n,()=>a(o));return console.log("newFetch",u),v(u,y)},[n,o])}},Te=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Error authentication"}),c.jsx("p",{className:"oidc-authenticating__content",children:"An error occurred during authentication."})]})}),et=()=>c.jsx("div",{className:"oidc-authenticating",children:c.jsxs("div",{className:"oidc-authenticating__container",children:[c.jsx("h1",{className:"oidc-authenticating__title",children:"Authentication in progress"}),c.jsx("p",{className:"oidc-authenticating__content",children:"You will be redirected to the login page."})]})}),tt=()=>Math.random().toString(36).substr(2,6),nt=(s,o)=>(n,a)=>{if(typeof s.CustomEvent=="function")return new s.CustomEvent(n,a);const f=a||{bubbles:!1,cancelable:!1,detail:void 0},u=o.createEvent("CustomEvent");return u.initCustomEvent(n,f.bubbles,f.cancelable,f.detail),u.prototype=s.Event.prototype,u},rt=(s,o,n)=>({replaceState:(a,f)=>{const u=n(),y=f||s.history.state;s.history.replaceState({key:u,state:y},null,a),s.dispatchEvent(o("popstate"))}}),st=()=>rt(window,nt(window,document),tt),we=()=>c.jsx("div",{className:"oidc-callback",children:c.jsxs("div",{className:"oidc-callback__container",children:[c.jsx("h1",{className:"oidc-callback__title",children:"Authentication complete"}),c.jsx("p",{className:"oidc-callback__content",children:"You will be redirected to your application."})]})}),ot=({callBackError:s,callBackSuccess:o,configurationName:n,withCustomHistory:a})=>{const[f,u]=_.useState(!1);_.useEffect(()=>{let v=!0;return(async()=>{const m=i.OidcClient.get;try{const{callbackPath:w}=await m(n).loginCallbackAsync();(a?a():st()).replaceState(w||"/")}catch(w){v&&(console.warn(w),u(!0))}})(),()=>{v=!1}},[]);const y=s||Te,l=o||we;return f?c.jsx(y,{configurationName:n}):c.jsx(l,{configurationName:n})},at=()=>c.jsx("span",{className:"oidc-loading",children:"Loading"}),ct=()=>c.jsx("div",{className:"oidc-serviceworker",children:c.jsxs("div",{className:"oidc-serviceworker__container",children:[c.jsx("h1",{className:"oidc-serviceworker__title",children:"Unable to authenticate on this browser"}),c.jsx("p",{className:"oidc-serviceworker__content",children:"Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser."})]})}),it=()=>c.jsx("div",{className:"oidc-session-lost",children:c.jsxs("div",{className:"oidc-session-lost__container",children:[c.jsx("h1",{className:"oidc-session-lost__title",children:"Session timed out"}),c.jsx("p",{className:"oidc-session-lost__content",children:"Your session has expired. Please re-authenticate."})]})}),lt=({configurationName:s})=>(_.useEffect(()=>{(async()=>{const n=i.OidcClient.get;n(s).silentLoginCallbackAsync()})()},[]),c.jsx(c.Fragment,{})),ut=({configurationName:s})=>{const o=i.getParseQueryStringFromLocation(window.location.href),n=i.OidcClient.get,a=n(s);let f=null;for(const[u,y]of Object.entries(o))u==="state"||u==="scope"||(f===null&&(f={}),f[u]=y);return _.useEffect(()=>{a.tokens||a.loginAsync(null,f,!0,o.scope)},[]),c.jsx(c.Fragment,{})},dt=({callbackErrorComponent:s,callbackSuccessComponent:o,redirect_uri:n,silent_redirect_uri:a,silent_login_uri:f,children:u,configurationName:y,withCustomHistory:l=null,location:v})=>{const k=window?i.getPath(window.location.href):"",[m,w]=_.useState(k);_.useEffect(()=>{const P=()=>w(i.getPath(window.location.href));return P(),window.addEventListener("popstate",P,!1),()=>window.removeEventListener("popstate",P,!1)},[]);const x=i.getPath(n);if(a&&m===i.getPath(a))return c.jsx(lt,{configurationName:y});if(f&&m===i.getPath(f))return c.jsx(ut,{configurationName:y});switch(m){case x:return c.jsx(ot,{callBackError:s,callBackSuccess:o,configurationName:y,withCustomHistory:l});default:return c.jsx(c.Fragment,{children:u})}},ft=_.memo(dt),Re={name:"",data:null},vt=({loadingComponent:s,children:o,configurationName:n})=>{const[a,f]=_.useState(!0),u=i.OidcClient.get,y=u(n);_.useEffect(()=>{let v=!0;return y&&y.tryKeepExistingSessionAsync().then(()=>{v&&f(!1)}),()=>{v=!1}},[n]);const l=s;return c.jsx(c.Fragment,{children:a?c.jsx(l,{configurationName:n}):c.jsx(c.Fragment,{children:o})})},K=({isLoading:s,loadingComponent:o,children:n,configurationName:a})=>{const f=o;return s?c.jsx(f,{configurationName:a,children:n}):c.jsx(c.Fragment,{children:n})},ht=({children:s,configuration:o,configurationName:n="default",callbackSuccessComponent:a=we,authenticatingComponent:f=et,loadingComponent:u=at,serviceWorkerNotSupportedComponent:y=ct,authenticatingErrorComponent:l=Te,sessionLostComponent:v=it,onSessionLost:k=null,onLogoutFromAnotherTab:m=null,onLogoutFromSameTab:w=null,withCustomHistory:x=null,onEvent:P=null,getFetch:X=null,location:Q=null})=>{const M=(N="default")=>i.OidcClient.getOrCreate(X??i.getFetchDefault,Q??new i.OidcLocation)(o,N),[L,S]=_.useState(!0),[oe,Y]=_.useState(Re),[ae,ce]=_.useState("default");_.useEffect(()=>{const V=M(n).subscribeEvents((E,I)=>{P&&P(n,E,I)});return()=>{M(n).removeEventSubscription(V)}},[n,P]),_.useEffect(()=>{const V=M(n).subscribeEvents((E,I)=>{if(E===i.OidcClient.eventNames.refreshTokensAsync_error||E===i.OidcClient.eventNames.syncTokensAsync_error){if(k!=null){k();return}Y({name:E,data:I})}else if(E===i.OidcClient.eventNames.logout_from_another_tab){if(m!=null){m();return}Y({name:E,data:I})}else E===i.OidcClient.eventNames.logout_from_same_tab?w!=null&&w():E===i.OidcClient.eventNames.loginAsync_begin||E===i.OidcClient.eventNames.loginCallbackAsync_end||E===i.OidcClient.eventNames.loginAsync_error||E===i.OidcClient.eventNames.loginCallbackAsync_error?Y({name:E,data:I}):E===i.OidcClient.eventNames.service_worker_not_supported_by_browser&&o.service_worker_only===!0&&Y({name:E,data:I})});return ce(n),S(!1),()=>{M(n).removeEventSubscription(V),Y(Re)}},[o,n]);const ie=v,le=f,F=u,ue=y,de=l,U=L||ae!==n,C=M(n);switch(oe.name){case i.OidcClient.eventNames.service_worker_not_supported_by_browser:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(ue,{configurationName:n})});case i.OidcClient.eventNames.loginAsync_begin:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(le,{configurationName:n})});case i.OidcClient.eventNames.loginAsync_error:case i.OidcClient.eventNames.loginCallbackAsync_error:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(de,{configurationName:n})});case i.OidcClient.eventNames.refreshTokensAsync_error:case i.OidcClient.eventNames.syncTokensAsync_error:case i.OidcClient.eventNames.logout_from_another_tab:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(ie,{configurationName:n})});default:return c.jsx(K,{loadingComponent:F,isLoading:U,configurationName:n,children:c.jsx(ft,{redirect_uri:C.configuration.redirect_uri,silent_redirect_uri:C.configuration.silent_redirect_uri,silent_login_uri:C.configuration.silent_login_uri,callbackSuccessComponent:a,callbackErrorComponent:l,authenticatingComponent:f,configurationName:n,withCustomHistory:x,location:Q??new i.OidcLocation,children:c.jsx(vt,{loadingComponent:F,configurationName:n,children:s})})})}},Se=({children:s,callbackPath:o=null,extras:n=null,configurationName:a="default"})=>{const f=i.OidcClient.get,u=f(a);return _.useEffect(()=>{u.tokens||u.loginAsync(o,n)},[a,o,n]),u.tokens?c.jsx(c.Fragment,{children:s}):null},pt=(s,o=null,n=null,a="default")=>f=>c.jsx(Se,{callbackPath:o,extras:n,configurationName:a,children:c.jsx(s,{...f})}),re="default",se=(s,o)=>{let n=!1;return s(o)&&(n=s(o).tokens!=null),n},_t=(s=re)=>{const o=i.OidcClient.get,[n,a]=_.useState(se(o,s));return _.useEffect(()=>{let l=!0;const v=o(s);a(se(o,s));const k=v.subscribeEvents((m,w)=>{(m===i.OidcClient.eventNames.logout_from_another_tab||m===i.OidcClient.eventNames.logout_from_same_tab||m===i.OidcClient.eventNames.token_aquired)&&l&&a(se(o,s))});return()=>{l=!1,v.removeEventSubscription(k)}},[s]),{login:(l=void 0,v=null,k=!1)=>o(s).loginAsync(l,v,!1,void 0,k),logout:(l=void 0,v=null)=>o(s).logoutAsync(l,v),renewTokens:async(l=null)=>{const v=await o(s).renewTokensAsync(l);return{accessToken:v.accessToken,accessTokenPayload:v.accessTokenPayload,idToken:v.idToken,idTokenPayload:v.idTokenPayload}},isAuthenticated:n}},je={accessToken:null,accessTokenPayload:null},gt=s=>{const o=i.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{accessToken:a.accessToken,accessTokenPayload:a.accessTokenPayload}}return je},yt=(s=re)=>{const o=i.OidcClient.get,[n,a]=_.useState(gt(s));return _.useEffect(()=>{let f=!0;const u=o(s);if(u.tokens){const l=u.tokens;a({accessToken:l.accessToken,accessTokenPayload:l.accessTokenPayload})}const y=u.subscribeEvents((l,v)=>{if((l===i.OidcClient.eventNames.token_renewed||l===i.OidcClient.eventNames.token_aquired||l===i.OidcClient.eventNames.logout_from_another_tab||l===i.OidcClient.eventNames.logout_from_same_tab||l===i.OidcClient.eventNames.refreshTokensAsync_error||l===i.OidcClient.eventNames.syncTokensAsync_error)&&f){const k=u.tokens;a(k!=null?{accessToken:k.accessToken,accessTokenPayload:k.accessTokenPayload}:je)}});return()=>{f=!1,u.removeEventSubscription(y)}},[s]),n},Ce={idToken:null,idTokenPayload:null},bt=s=>{const o=i.OidcClient.get,n=o(s);if(n.tokens){const a=n.tokens;return{idToken:a.idToken,idTokenPayload:a.idTokenPayload}}return Ce},kt=(s=re)=>{const o=i.OidcClient.get,[n,a]=_.useState(bt(s));return _.useEffect(()=>{let f=!0;const u=o(s);if(u.tokens){const l=u.tokens;a({idToken:l.idToken,idTokenPayload:l.idTokenPayload})}const y=u.subscribeEvents((l,v)=>{if((l===i.OidcClient.eventNames.token_renewed||l===i.OidcClient.eventNames.token_aquired||l===i.OidcClient.eventNames.logout_from_another_tab||l===i.OidcClient.eventNames.logout_from_same_tab||l===i.OidcClient.eventNames.refreshTokensAsync_error||l===i.OidcClient.eventNames.syncTokensAsync_error)&&f){const k=u.tokens;a(k!=null?{idToken:k.idToken,idTokenPayload:k.idTokenPayload}:Ce)}});return()=>{f=!1,u.removeEventSubscription(y)}},[s]),n};var xe=(s=>(s.Unauthenticated="Unauthenticated",s.Loading="Loading user",s.Loaded="User loaded",s.LoadingError="Error loading user",s))(xe||{});const mt=(s="default")=>{const[o,n]=_.useState({user:null,status:"Unauthenticated"}),[a,f]=_.useState(""),u=i.OidcClient.get(s);_.useEffect(()=>{let l=!0;if(u&&u.tokens){n({...o,status:"Loading user"});const v=a!=="";u.userInfoAsync(v).then(k=>{l&&n({user:k,status:"User loaded"})}).catch(()=>n({...o,status:"Error loading user"}))}else n({user:null,status:"Unauthenticated"});return()=>{l=!1}},[a]);const y=()=>{f(a+" ")};return{oidcUser:o.user,oidcUserLoadingState:o.status,reloadOidcUser:y}};Object.defineProperty(R,"TokenRenewMode",{enumerable:!0,get:()=>i.TokenRenewMode}),R.OidcProvider=ht,R.OidcSecure=Se,R.OidcUserStatus=xe,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.7.2",
3
+ "version": "7.8.0",
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.7.2",
44
- "@axa-fr/oidc-client": "7.7.2",
43
+ "@axa-fr/oidc-client-service-worker": "7.8.0",
44
+ "@axa-fr/oidc-client": "7.8.0",
45
45
  "base64-js": "1.5.1"
46
46
  },
47
47
  "peerDependencies": {
@@ -58,7 +58,7 @@
58
58
  "cpy-cli": "^5.0.0",
59
59
  "cross-env": "^7.0.3",
60
60
  "jsdom": "22.1.0",
61
- "msw": "1.2.2",
61
+ "msw": "2.0.0",
62
62
  "react": "^18.2.0",
63
63
  "react-dom": "^18.2.0",
64
64
  "rimraf": "5.0.1",
@@ -8,38 +8,9 @@ export interface ComponentWithOidcFetchProps {
8
8
  const defaultConfigurationName = 'default';
9
9
 
10
10
  const fetchWithToken = (fetch: Fetch, getOidcWithConfigurationName: () => OidcClient | null) => async (...params: Parameters<Fetch>) => {
11
- const [url, options, ...rest] = params;
12
- const optionTmp = options ? { ...options } : { method: 'GET' };
13
-
14
- let headers = new Headers();
15
- if (optionTmp.headers) {
16
- headers = !(optionTmp.headers instanceof Headers)
17
- ? new Headers(optionTmp.headers)
18
- : optionTmp.headers;
19
- }
20
11
  const oidc = getOidcWithConfigurationName();
21
-
22
- // @ts-ignore
23
- const getValidToken = await oidc.getValidTokenAsync();
24
- const accessToken = getValidToken?.tokens?.accessToken;
25
-
26
- if (!headers.has('Accept')) {
27
- headers.set('Accept', 'application/json');
28
- }
29
- if (accessToken) {
30
- if(oidc.configuration.demonstrating_proof_of_possession){
31
- const demonstrationOdProofOfPossession = await oidc.generateDemonstrationOfProofOfPossessionAsync(accessToken, url.toString(), optionTmp.method);
32
- headers.set('Authorization', `PoP ${accessToken}`);
33
- headers.set('DPoP', demonstrationOdProofOfPossession);
34
- } else{
35
- headers.set('Authorization', `Bearer ${accessToken}`);
36
- }
37
- if (!optionTmp.credentials) {
38
- optionTmp.credentials = 'same-origin';
39
- }
40
- }
41
- const newOptions = { ...optionTmp, headers };
42
- return await fetch(url, newOptions, ...rest);
12
+ const newFetch = oidc.fetchWithTokens(fetch);
13
+ return await newFetch(...params);
43
14
  };
44
15
 
45
16
  export const withOidcFetch = (fetch: Fetch = null, configurationName = defaultConfigurationName) => (
@@ -57,6 +28,7 @@ export const useOidcFetch = (fetch: Fetch = null, configurationName = defaultCon
57
28
  (input: RequestInfo | URL, init?: RequestInit) => {
58
29
  const getOidcWithConfigurationName = () => getOidc(configurationName);
59
30
  const newFetch = fetchWithToken(previousFetch, getOidcWithConfigurationName);
31
+ console.log('newFetch', input)
60
32
  return newFetch(input, init);
61
33
  },
62
34
  [previousFetch, configurationName],