@axa-fr/react-oidc 7.11.0 → 7.12.1

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/index.d.ts CHANGED
@@ -4,4 +4,4 @@ export { OidcSecure, withOidcSecure } from './OidcSecure.js';
4
4
  export { useOidc, useOidcAccessToken, useOidcIdToken } from './ReactOidc.js';
5
5
  export { OidcUserStatus, useOidcUser } from './User.js';
6
6
  export type { AuthorityConfiguration, Fetch, OidcConfiguration, StringMap, } from '@axa-fr/oidc-client';
7
- export { type OidcUserInfo, TokenRenewMode } from '@axa-fr/oidc-client';
7
+ export { type OidcUserInfo, TokenRenewMode, OidcClient } from '@axa-fr/oidc-client';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import ke, { useCallback as mt, useState as A, useEffect as P } from "react";
2
2
  import { OidcClient as f, getParseQueryStringFromLocation as Et, getPath as z, OidcLocation as $e, getFetchDefault as Tt } from "@axa-fr/oidc-client";
3
- import { TokenRenewMode as nr } from "@axa-fr/oidc-client";
3
+ import { OidcClient as nr, TokenRenewMode as or } from "@axa-fr/oidc-client";
4
4
  var be = { exports: {} }, J = {};
5
5
  /**
6
6
  * @license React
@@ -947,10 +947,11 @@ const er = (o = "default") => {
947
947
  return { oidcUser: s.user, oidcUserLoadingState: s.status, reloadOidcUser: g };
948
948
  };
949
949
  export {
950
+ nr as OidcClient,
950
951
  Kt as OidcProvider,
951
952
  Mt as OidcSecure,
952
953
  Bt as OidcUserStatus,
953
- nr as TokenRenewMode,
954
+ or as TokenRenewMode,
954
955
  Xt as useOidc,
955
956
  Qt as useOidcAccessToken,
956
957
  xt as useOidcFetch,
@@ -1,4 +1,4 @@
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={};/**
1
+ (function(w,_){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"],_):(w=typeof globalThis<"u"?globalThis:w||self,_(w["react-oidc"]={},w.React,w.oidcClient))})(this,function(w,_,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 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={};/**
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,R={},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)&&(R[m]=v[m]);if(l&&l.defaultProps)for(m in v=l.defaultProps,v)R[m]===void 0&&(R[m]=v[m]);return{$$typeof:o,type:l,key:x,ref:P,props:R,_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=_,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`
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"),R=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===R||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 R: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
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
19
  `),j=d.stack.split(`
20
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`
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 R: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
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 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"})});
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===R))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:R}=await m(n).loginCallbackAsync();(a?a():st()).replaceState(R||"/")}catch(R){v&&(console.warn(R),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,R]=_.useState(k);_.useEffect(()=>{const P=()=>R(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:R=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?R!=null&&R():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,R)=>{(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(w,"OidcClient",{enumerable:!0,get:()=>i.OidcClient}),Object.defineProperty(w,"TokenRenewMode",{enumerable:!0,get:()=>i.TokenRenewMode}),w.OidcProvider=ht,w.OidcSecure=Se,w.OidcUserStatus=xe,w.useOidc=_t,w.useOidcAccessToken=yt,w.useOidcFetch=Ee,w.useOidcIdToken=kt,w.useOidcUser=mt,w.withOidcFetch=$e,w.withOidcSecure=pt,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/react-oidc",
3
- "version": "7.11.0",
3
+ "version": "7.12.1",
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.11.0",
44
- "@axa-fr/oidc-client": "7.11.0",
43
+ "@axa-fr/oidc-client-service-worker": "7.12.1",
44
+ "@axa-fr/oidc-client": "7.12.1",
45
45
  "base64-js": "1.5.1"
46
46
  },
47
47
  "peerDependencies": {
package/src/index.ts CHANGED
@@ -9,4 +9,4 @@ export type {
9
9
  OidcConfiguration,
10
10
  StringMap,
11
11
  } from '@axa-fr/oidc-client';
12
- export { type OidcUserInfo, TokenRenewMode } from '@axa-fr/oidc-client';
12
+ export { type OidcUserInfo, TokenRenewMode, OidcClient } from '@axa-fr/oidc-client';