@axa-fr/react-oidc 7.29.3 → 7.29.5

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.
@@ -2,7 +2,7 @@ import { Fetch } from '@axa-fr/oidc-client';
2
2
  export interface ComponentWithOidcFetchProps {
3
3
  fetch?: Fetch;
4
4
  }
5
- export declare const withOidcFetch: (fetch?: Fetch, configurationName?: string, demonstratingProofOfPossession?: boolean) => (WrappedComponent: any) => (props: ComponentWithOidcFetchProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const withOidcFetch: (fetch?: Fetch, configurationName?: string, demonstratingProofOfPossession?: boolean) => (WrappedComponent: any) => (props: ComponentWithOidcFetchProps) => import("react").JSX.Element;
6
6
  export declare const useOidcFetch: (fetch?: Fetch, configurationName?: string, demonstratingProofOfPossession?: boolean) => {
7
7
  fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"FetchToken.d.ts","sourceRoot":"","sources":["../src/FetchToken.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAgBD,eAAO,MAAM,aAAa,GAEtB,QAAO,KAAY,EACnB,0BAA4C,EAC5C,iCAAgC,OAAe,MAEjD,qBAAgB,MACf,OAAO,2BAA2B,4CAOlC,CAAC;AAEJ,eAAO,MAAM,YAAY,GACvB,QAAO,KAAY,EACnB,0BAA4C,EAC5C,iCAAgC,OAAe;mBAQrC,WAAW,GAAG,GAAG,SAAS,WAAW;CAYhD,CAAC"}
1
+ {"version":3,"file":"FetchToken.d.ts","sourceRoot":"","sources":["../src/FetchToken.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAID,eAAO,MAAM,aAAa,GAEtB,QAAO,KAAY,EACnB,0BAA4C,EAC5C,iCAAgC,OAAe,MAEjD,qBAAgB,MACf,OAAO,2BAA2B,gCAOlC,CAAC;AAEJ,eAAO,MAAM,YAAY,GACvB,QAAO,KAAY,EACnB,0BAA4C,EAC5C,iCAAgC,OAAe;mBAQ/B,WAAW,GAAG,GAAG,SAAS,WAAW,KAAG,OAAO,CAAC,QAAQ,CAAC;CAW1E,CAAC"}
@@ -6,5 +6,5 @@ export type OidcSecureProps = {
6
6
  configurationName?: string;
7
7
  };
8
8
  export declare const OidcSecure: FC<PropsWithChildren<OidcSecureProps>>;
9
- export declare const withOidcSecure: (WrappedComponent: FC<PropsWithChildren<OidcSecureProps>>, callbackPath?: any, extras?: any, configurationName?: string) => (props: any) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const withOidcSecure: (WrappedComponent: FC<PropsWithChildren<OidcSecureProps>>, callbackPath?: any, extras?: any, configurationName?: string) => (props: any) => import("react").JSX.Element;
10
10
  //# sourceMappingURL=OidcSecure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OidcSecure.d.ts","sourceRoot":"","sources":["../src/OidcSecure.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAwB7D,CAAC;AAEF,eAAO,MAAM,cAAc,GAEvB,kBAAkB,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC,EACxD,kBAAmB,EACnB,YAAa,EACb,0BAA6B,MAE/B,UAAK,4CAMJ,CAAC"}
1
+ {"version":3,"file":"OidcSecure.d.ts","sourceRoot":"","sources":["../src/OidcSecure.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAwB7D,CAAC;AAEF,eAAO,MAAM,cAAc,GAEvB,kBAAkB,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC,EACxD,kBAAmB,EACnB,YAAa,EACb,0BAA6B,MAE/B,UAAK,gCAMJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReactOidc.d.ts","sourceRoot":"","sources":["../src/ReactOidc.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAU,MAAM,qBAAqB,CAAC;AAoBpE,eAAO,MAAM,OAAO,GAAI,0BAA4C;2BAkClD,MAAM,GAAG,SAAS,WACxB,SAAS,GAAG,SAAS,qCAEtB,MAAM,KACZ,OAAO,CAAC,OAAO,CAAC;4BASH,MAAM,GAAG,IAAI,GAAG,SAAS,WAC/B,SAAS,GAAG,SAAS,KAC5B,OAAO,CAAC,IAAI,CAAC;2BASN,SAAS,GAAG,SAAS,KAC5B,OAAO,CAAC,eAAe,GAAG,WAAW,CAAC;;CAoB1C,CAAC;AAyBF,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,kBAAkB,CAAC,EAAE,GAAG,CAAC;IACzB,6CAA6C,CAAC,EAAE,GAAG,CAAC;CACrD,CAAC;AASF,eAAO,MAAM,kBAAkB,GAAI,0BAA4C,oBA2C9E,CAAC;AAkBF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,cAAc,CAAC,EAAE,GAAG,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,0BAA4C,gBAsC1E,CAAC"}
1
+ {"version":3,"file":"ReactOidc.d.ts","sourceRoot":"","sources":["../src/ReactOidc.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAU,MAAM,qBAAqB,CAAC;AAwBpE,eAAO,MAAM,OAAO,GAAI,0BAA4C;2BAkClD,MAAM,GAAG,SAAS,WACxB,SAAS,GAAG,SAAS,qCAEtB,MAAM,KACZ,OAAO,CAAC,OAAO,CAAC;4BASH,MAAM,GAAG,IAAI,GAAG,SAAS,WAC/B,SAAS,GAAG,SAAS,KAC5B,OAAO,CAAC,IAAI,CAAC;2BASN,SAAS,GAAG,SAAS,KAC5B,OAAO,CAAC,eAAe,GAAG,WAAW,CAAC;;CAoB1C,CAAC;AAyBF,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,kBAAkB,CAAC,EAAE,GAAG,CAAC;IACzB,6CAA6C,CAAC,EAAE,GAAG,CAAC;CACrD,CAAC;AASF,eAAO,MAAM,kBAAkB,GAAI,0BAA4C,oBAoC9E,CAAC;AAkBF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,cAAc,CAAC,EAAE,GAAG,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,0BAA4C,gBA+B1E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SilentLogin.component.d.ts","sourceRoot":"","sources":["../../../src/core/default-component/SilentLogin.component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AAEjD,QAAA,MAAM,WAAW,EAAE,aAAa,CAAC,GAAG,CAyBnC,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"SilentLogin.component.d.ts","sourceRoot":"","sources":["../../../src/core/default-component/SilentLogin.component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AAEjD,QAAA,MAAM,WAAW,EAAE,aAAa,CAAC,GAAG,CAuBnC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"OidcRoutes.d.ts","sourceRoot":"","sources":["../../../src/core/routes/OidcRoutes.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,EAAE,aAAa,EAA8C,MAAM,OAAO,CAAC;AAKzF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,eAAe,GAAG;IACrB,wBAAwB,CAAC,EAAE,aAAa,CAAC;IACzC,sBAAsB,CAAC,EAAE,aAAa,CAAC;IACvC,uBAAuB,CAAC,EAAE,aAAa,CAAC;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,aAAa,CAAC;IACxC,qBAAqB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC;;AAuDF,wBAAsC"}
1
+ {"version":3,"file":"OidcRoutes.d.ts","sourceRoot":"","sources":["../../../src/core/routes/OidcRoutes.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,EAAE,aAAa,EAA8C,MAAM,OAAO,CAAC;AAKzF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,eAAe,GAAG;IACrB,wBAAwB,CAAC,EAAE,aAAa,CAAC;IACzC,sBAAsB,CAAC,EAAE,aAAa,CAAC;IACvC,uBAAuB,CAAC,EAAE,aAAa,CAAC;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,aAAa,CAAC;IACxC,qBAAqB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC;;AAiDF,wBAAsC"}
package/dist/index.js CHANGED
@@ -1,40 +1,40 @@
1
- import { OidcClient as e, OidcClient as t, OidcError as n, OidcErrorCode as r, OidcLocation as i, OidcLocation as a, OidcStateError as o, OidcStateErrorCode as s, PushedAuthorizationRequestError as c, PushedAuthorizationRequestErrorCode as l, TokenAutomaticRenewMode as u, TokenRenewMode as d, getFetchDefault as ee, getParseQueryStringFromLocation as f, getPath as p, isOidcError as m, isOidcStateError as h, isPushedAuthorizationRequestError as g } from "@axa-fr/oidc-client";
2
- import _, { useCallback as v, useEffect as y, useRef as b, useState as x } from "react";
3
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
1
+ import { OidcClient as e, OidcClient as t, OidcError as n, OidcErrorCode as r, OidcLocation as i, OidcLocation as a, OidcStateError as o, OidcStateErrorCode as s, PushedAuthorizationRequestError as c, PushedAuthorizationRequestErrorCode as l, TokenAutomaticRenewMode as u, TokenRenewMode as d, getFetchDefault as f, getParseQueryStringFromLocation as p, getPath as m, isOidcError as h, isOidcStateError as g, isPushedAuthorizationRequestError as _ } from "@axa-fr/oidc-client";
2
+ import v, { useCallback as y, useEffect as b, useRef as x, useState as S } from "react";
3
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
4
4
  //#region src/FetchToken.tsx
5
- var T = "default", E = (e, t, n = !1) => async (...r) => await t().fetchWithTokens(e, n)(...r), D = (e = null, t = T, n = !1) => (r) => (i) => {
5
+ var E = "default", D = (e = null, t = E, n = !1) => (r) => (i) => {
6
6
  let { fetch: a } = O(e || i.fetch, t, n);
7
- return /* @__PURE__ */ C(r, {
7
+ return /* @__PURE__ */ w(r, {
8
8
  ...i,
9
9
  fetch: a
10
10
  });
11
- }, O = (e = null, n = T, r = !1) => {
11
+ }, O = (e = null, n = E, r = !1) => {
12
12
  let i = e || window.fetch, a = t.getOrThrow;
13
- return { fetch: v((e, t) => E(i, () => a(n), r)(e, t), [
13
+ return { fetch: y(async (e, t) => await a(n).fetchWithTokens(i, r)(e, t), [
14
14
  i,
15
15
  n,
16
16
  r
17
17
  ]) };
18
- }, k = () => /* @__PURE__ */ C("div", {
18
+ }, k = () => /* @__PURE__ */ w("div", {
19
19
  className: "oidc-authenticating",
20
- children: /* @__PURE__ */ w("div", {
20
+ children: /* @__PURE__ */ T("div", {
21
21
  className: "oidc-authenticating__container",
22
- children: [/* @__PURE__ */ C("h1", {
22
+ children: [/* @__PURE__ */ w("h1", {
23
23
  className: "oidc-authenticating__title",
24
24
  children: "Error authentication"
25
- }), /* @__PURE__ */ C("p", {
25
+ }), /* @__PURE__ */ w("p", {
26
26
  className: "oidc-authenticating__content",
27
27
  children: "An error occurred during authentication."
28
28
  })]
29
29
  })
30
- }), te = () => /* @__PURE__ */ C("div", {
30
+ }), ee = () => /* @__PURE__ */ w("div", {
31
31
  className: "oidc-authenticating",
32
- children: /* @__PURE__ */ w("div", {
32
+ children: /* @__PURE__ */ T("div", {
33
33
  className: "oidc-authenticating__container",
34
- children: [/* @__PURE__ */ C("h1", {
34
+ children: [/* @__PURE__ */ w("h1", {
35
35
  className: "oidc-authenticating__title",
36
36
  children: "Authentication in progress"
37
- }), /* @__PURE__ */ C("p", {
37
+ }), /* @__PURE__ */ w("p", {
38
38
  className: "oidc-authenticating__content",
39
39
  children: "You will be redirected to the login page."
40
40
  })]
@@ -53,21 +53,21 @@ var T = "default", E = (e, t, n = !1) => async (...r) => await t().fetchWithToke
53
53
  key: a,
54
54
  state: o
55
55
  }, null, r), e.dispatchEvent(t("popstate"));
56
- } }), N = () => M(window, j(window, document), A), P = () => /* @__PURE__ */ C("div", {
56
+ } }), N = () => M(window, j(window, document), A), P = () => /* @__PURE__ */ w("div", {
57
57
  className: "oidc-callback",
58
- children: /* @__PURE__ */ w("div", {
58
+ children: /* @__PURE__ */ T("div", {
59
59
  className: "oidc-callback__container",
60
- children: [/* @__PURE__ */ C("h1", {
60
+ children: [/* @__PURE__ */ w("h1", {
61
61
  className: "oidc-callback__title",
62
62
  children: "Authentication complete"
63
- }), /* @__PURE__ */ C("p", {
63
+ }), /* @__PURE__ */ w("p", {
64
64
  className: "oidc-callback__content",
65
65
  children: "You will be redirected to your application."
66
66
  })]
67
67
  })
68
68
  }), F = 200, I = (e, t = window) => t.location.pathname === e || e === "/", L = ({ callBackError: e, callBackSuccess: n, configurationName: r, withCustomHistory: i, navigateAfterCallback: a }) => {
69
- let [o, s] = x(!1);
70
- return y(() => {
69
+ let [o, s] = S(!1);
70
+ return b(() => {
71
71
  let e = !0;
72
72
  return (async () => {
73
73
  let n = t.getOrThrow;
@@ -103,233 +103,228 @@ var T = "default", E = (e, t, n = !1) => async (...r) => await t().fetchWithToke
103
103
  })(), () => {
104
104
  e = !1;
105
105
  };
106
- }, []), C(o ? e || k : n || P, { configurationName: r });
107
- }, ne = () => /* @__PURE__ */ C("span", {
106
+ }, []), w(o ? e || k : n || P, { configurationName: r });
107
+ }, R = () => /* @__PURE__ */ w("span", {
108
108
  className: "oidc-loading",
109
109
  children: "Loading"
110
- }), re = () => /* @__PURE__ */ C("div", {
110
+ }), te = () => /* @__PURE__ */ w("div", {
111
111
  className: "oidc-loading-timeout",
112
- children: /* @__PURE__ */ w("div", {
112
+ children: /* @__PURE__ */ T("div", {
113
113
  className: "oidc-loading-timeout__container",
114
- children: [/* @__PURE__ */ C("h1", {
114
+ children: [/* @__PURE__ */ w("h1", {
115
115
  className: "oidc-loading-timeout__title",
116
116
  children: "Loading timeout"
117
- }), /* @__PURE__ */ C("p", {
117
+ }), /* @__PURE__ */ w("p", {
118
118
  className: "oidc-loading-timeout__content",
119
119
  children: "Authentication is taking longer than expected. Please try refreshing the page."
120
120
  })]
121
121
  })
122
- }), ie = () => /* @__PURE__ */ C("div", {
122
+ }), ne = () => /* @__PURE__ */ w("div", {
123
123
  className: "oidc-serviceworker",
124
- children: /* @__PURE__ */ w("div", {
124
+ children: /* @__PURE__ */ T("div", {
125
125
  className: "oidc-serviceworker__container",
126
- children: [/* @__PURE__ */ C("h1", {
126
+ children: [/* @__PURE__ */ w("h1", {
127
127
  className: "oidc-serviceworker__title",
128
128
  children: "Unable to authenticate on this browser"
129
- }), /* @__PURE__ */ C("p", {
129
+ }), /* @__PURE__ */ w("p", {
130
130
  className: "oidc-serviceworker__content",
131
131
  children: "Your browser is not secure enough to make authentication work. Try updating your browser or use a newer browser."
132
132
  })]
133
133
  })
134
- }), R = () => /* @__PURE__ */ C("div", {
134
+ }), re = () => /* @__PURE__ */ w("div", {
135
135
  className: "oidc-session-lost",
136
- children: /* @__PURE__ */ w("div", {
136
+ children: /* @__PURE__ */ T("div", {
137
137
  className: "oidc-session-lost__container",
138
- children: [/* @__PURE__ */ C("h1", {
138
+ children: [/* @__PURE__ */ w("h1", {
139
139
  className: "oidc-session-lost__title",
140
140
  children: "Session timed out"
141
- }), /* @__PURE__ */ C("p", {
141
+ }), /* @__PURE__ */ w("p", {
142
142
  className: "oidc-session-lost__content",
143
143
  children: "Your session has expired. Please re-authenticate."
144
144
  })]
145
145
  })
146
- }), z = ({ configurationName: e }) => (y(() => {
146
+ }), z = ({ configurationName: e }) => (b(() => {
147
147
  (async () => {
148
148
  t.getOrThrow(e).silentLoginCallbackAsync();
149
149
  })().catch((e) => {
150
150
  console.error("Error during silent login callback:", e);
151
151
  });
152
152
  }, [e]), null), B = ({ configurationName: e }) => {
153
- let n = f(window.location.href), r = t.getOrThrow, i = r(e), a = null;
154
- for (let [e, t] of Object.entries(n)) e === "state" || e === "scope" || (a === null && (a = {}), a[e] = t);
155
- return y(() => {
153
+ let n = p(window.location.href), r = t.getOrThrow, i = r(e), a = null;
154
+ for (let [e, t] of Object.entries(n)) e !== "state" && e !== "scope" && (a ??= {}, a[e] = t);
155
+ return b(() => {
156
156
  i.tokens || i.loginAsync(null, a, !0, n.scope);
157
- }, []), /* @__PURE__ */ C(S, {});
158
- }, V = _.memo(({ callbackErrorComponent: e, callbackSuccessComponent: t, redirect_uri: n, silent_redirect_uri: r, silent_login_uri: i, children: a, configurationName: o, withCustomHistory: s = null, navigateAfterCallback: c = null }) => {
159
- let [l, u] = x(window ? p(window.location.href) : "");
160
- y(() => {
161
- let e = () => u(p(window.location.href));
157
+ }, []), /* @__PURE__ */ w(C, {});
158
+ }, ie = v.memo(({ callbackErrorComponent: e, callbackSuccessComponent: t, redirect_uri: n, silent_redirect_uri: r, silent_login_uri: i, children: a, configurationName: o, withCustomHistory: s = null, navigateAfterCallback: c = null }) => {
159
+ let l = window ? m(window.location.href) : "", [u, d] = S(l);
160
+ b(() => {
161
+ let e = () => d(m(window.location.href));
162
162
  return e(), window.addEventListener("popstate", e, !1), () => window.removeEventListener("popstate", e, !1);
163
163
  }, []);
164
- let d = p(n);
165
- if (r && l === p(r)) return /* @__PURE__ */ C(z, { configurationName: o });
166
- if (i && l === p(i)) return /* @__PURE__ */ C(B, { configurationName: o });
167
- switch (l) {
168
- case d: return /* @__PURE__ */ C(L, {
169
- callBackError: e,
170
- callBackSuccess: t,
171
- configurationName: o,
172
- withCustomHistory: s,
173
- navigateAfterCallback: c
174
- });
175
- default: return /* @__PURE__ */ C(S, { children: a });
176
- }
177
- }), H = {
164
+ let f = m(n);
165
+ return r && u === m(r) ? /* @__PURE__ */ w(z, { configurationName: o }) : i && u === m(i) ? /* @__PURE__ */ w(B, { configurationName: o }) : u === f ? /* @__PURE__ */ w(L, {
166
+ callBackError: e,
167
+ callBackSuccess: t,
168
+ configurationName: o,
169
+ withCustomHistory: s,
170
+ navigateAfterCallback: c
171
+ }) : /* @__PURE__ */ w(C, { children: a });
172
+ }), V = {
178
173
  name: "",
179
174
  data: null
180
175
  }, ae = ({ loadingComponent: e, children: n, configurationName: r }) => {
181
- let [i, a] = x(!0), o = t.get, s = o(r);
182
- return y(() => {
176
+ let [i, a] = S(!0), o = t.get, s = o(r);
177
+ return b(() => {
183
178
  let e = !0;
184
179
  return s && s.tryKeepExistingSessionAsync().then(() => {
185
180
  e && a(!1);
186
181
  }), () => {
187
182
  e = !1;
188
183
  };
189
- }, [r]), /* @__PURE__ */ C(S, { children: i ? /* @__PURE__ */ C(e, { configurationName: r }) : /* @__PURE__ */ C(S, { children: n }) });
190
- }, U = ({ isLoading: e, loadingComponent: t, children: n, configurationName: r }) => e ? /* @__PURE__ */ C(t, {
184
+ }, [r]), /* @__PURE__ */ w(C, { children: i ? /* @__PURE__ */ w(e, { configurationName: r }) : /* @__PURE__ */ w(C, { children: n }) });
185
+ }, H = ({ isLoading: e, loadingComponent: t, children: n, configurationName: r }) => e ? /* @__PURE__ */ w(t, {
191
186
  configurationName: r,
192
187
  children: n
193
- }) : /* @__PURE__ */ C(S, { children: n }), W = 3e4, G = (e) => e === t.eventNames.token_acquired || e === t.eventNames.token_renewed || e === t.eventNames.loginCallbackAsync_end || e === t.eventNames.tryKeepExistingSessionAsync_end || e === t.eventNames.tryKeepExistingSessionAsync_error, K = ({ children: e, configuration: n, configurationName: r = "default", callbackSuccessComponent: i = P, authenticatingComponent: o = te, loadingComponent: s = ne, loadingTimeoutComponent: c = re, serviceWorkerNotSupportedComponent: l = ie, authenticatingErrorComponent: u = k, sessionLostComponent: d = R, onSessionLost: f = null, onLogoutFromAnotherTab: p = null, onLogoutFromSameTab: m = null, withCustomHistory: h = null, navigateAfterCallback: g = null, onEvent: _ = null, getFetch: v = null, location: b = null }) => {
188
+ }) : /* @__PURE__ */ w(C, { children: n }), oe = 3e4, se = (e) => e === t.eventNames.token_acquired || e === t.eventNames.token_renewed || e === t.eventNames.loginCallbackAsync_end || e === t.eventNames.tryKeepExistingSessionAsync_end || e === t.eventNames.tryKeepExistingSessionAsync_error, U = ({ children: e, configuration: n, configurationName: r = "default", callbackSuccessComponent: i = P, authenticatingComponent: o = ee, loadingComponent: s = R, loadingTimeoutComponent: c = te, serviceWorkerNotSupportedComponent: l = ne, authenticatingErrorComponent: u = k, sessionLostComponent: d = re, onSessionLost: p = null, onLogoutFromAnotherTab: m = null, onLogoutFromSameTab: h = null, withCustomHistory: g = null, navigateAfterCallback: _ = null, onEvent: v = null, getFetch: y = null, location: x = null }) => {
194
189
  if (n && n.redirect_uri && n.silent_redirect_uri && n.redirect_uri === n.silent_redirect_uri) throw Error("redirect_uri and silent_redirect_uri must be different");
195
- let S = (e = "default") => t.getOrCreate(v ?? ee, b ?? new a())(n, e), [w, T] = x(H), [E, D] = x(!0), [O, A] = x(r);
196
- y(() => {
197
- let e = S(r).subscribeEvents((e, t) => {
198
- _ && _(r, e, t);
190
+ let C = (e = "default") => t.getOrCreate(y ?? f, x ?? new a())(n, e), [T, E] = S(V), [D, O] = S(!0), [A, j] = S(r);
191
+ b(() => {
192
+ let e = C(r).subscribeEvents((e, t) => {
193
+ v && v(r, e, t);
199
194
  });
200
195
  return () => {
201
- S(r).removeEventSubscription(e);
196
+ C(r).removeEventSubscription(e);
202
197
  };
203
- }, [r, _]), y(() => {
204
- let e = S(r).subscribeEvents((e, r) => {
205
- if (e === t.eventNames.loginAsync_begin ? D(!0) : G(e) && D(!1), e === t.eventNames.refreshTokensAsync_error || e === t.eventNames.syncTokensAsync_error) {
206
- if (f != null) {
207
- f();
198
+ }, [r, v]), b(() => {
199
+ let e = C(r).subscribeEvents((e, r) => {
200
+ if (e === t.eventNames.loginAsync_begin ? O(!0) : se(e) && O(!1), e === t.eventNames.refreshTokensAsync_error || e === t.eventNames.syncTokensAsync_error) {
201
+ if (p != null) {
202
+ p();
208
203
  return;
209
204
  }
210
- T({
205
+ E({
211
206
  name: e,
212
207
  data: r
213
208
  });
214
209
  } else if (e === t.eventNames.logout_from_another_tab) {
215
- if (p != null) {
216
- p();
210
+ if (m != null) {
211
+ m();
217
212
  return;
218
213
  }
219
- T({
214
+ E({
220
215
  name: e,
221
216
  data: r
222
217
  });
223
- } else e === t.eventNames.logout_from_same_tab ? m?.() : (e === t.eventNames.loadingTimeout_error || e === t.eventNames.loginAsync_begin || e === t.eventNames.loginCallbackAsync_end || e === t.eventNames.loginAsync_error || e === t.eventNames.loginCallbackAsync_error || e === t.eventNames.service_worker_not_supported_by_browser && n.service_worker_only === !0) && T({
218
+ } else e === t.eventNames.logout_from_same_tab ? h?.() : (e === t.eventNames.loadingTimeout_error || e === t.eventNames.loginAsync_begin || e === t.eventNames.loginCallbackAsync_end || e === t.eventNames.loginAsync_error || e === t.eventNames.loginCallbackAsync_error || e === t.eventNames.service_worker_not_supported_by_browser && n.service_worker_only === !0) && E({
224
219
  name: e,
225
220
  data: r
226
221
  });
227
222
  });
228
223
  return queueMicrotask(() => {
229
- A(r);
224
+ j(r);
230
225
  }), () => {
231
- S(r).removeEventSubscription(e), T(H), D(!0);
226
+ C(r).removeEventSubscription(e), E(V), O(!0);
232
227
  };
233
- }, [n, r]), y(() => {
234
- let e = n?.loading_timeout_ms ?? W;
235
- if (e <= 0 || !E || S(r)?.tokens != null || !(w.name === "" || w.name === t.eventNames.loginAsync_begin)) return;
228
+ }, [n, r]), b(() => {
229
+ let e = n?.loading_timeout_ms ?? oe;
230
+ if (e <= 0 || !D || C(r)?.tokens != null || T.name !== "" && T.name !== t.eventNames.loginAsync_begin) return;
236
231
  let i = setTimeout(() => {
237
- S(r).publishEvent(t.eventNames.loadingTimeout_error, { timeoutMs: e });
232
+ C(r).publishEvent(t.eventNames.loadingTimeout_error, { timeoutMs: e });
238
233
  }, e);
239
234
  return () => clearTimeout(i);
240
235
  }, [
241
- w.name,
242
- E,
236
+ T.name,
237
+ D,
243
238
  r,
244
239
  n
245
240
  ]);
246
- let j = d, M = o, N = s, F = c, I = l, L = u, z = O !== r, B = S(r);
247
- switch (w.name) {
248
- case t.eventNames.service_worker_not_supported_by_browser: return /* @__PURE__ */ C(U, {
249
- loadingComponent: N,
250
- isLoading: z,
241
+ let M = d, N = o, F = s, I = c, L = l, z = u, B = A !== r, U = C(r);
242
+ switch (T.name) {
243
+ case t.eventNames.service_worker_not_supported_by_browser: return /* @__PURE__ */ w(H, {
244
+ loadingComponent: F,
245
+ isLoading: B,
251
246
  configurationName: r,
252
- children: /* @__PURE__ */ C(I, { configurationName: r })
247
+ children: /* @__PURE__ */ w(L, { configurationName: r })
253
248
  });
254
- case t.eventNames.loginAsync_begin: return /* @__PURE__ */ C(U, {
255
- loadingComponent: N,
256
- isLoading: z,
249
+ case t.eventNames.loginAsync_begin: return /* @__PURE__ */ w(H, {
250
+ loadingComponent: F,
251
+ isLoading: B,
257
252
  configurationName: r,
258
- children: /* @__PURE__ */ C(M, { configurationName: r })
253
+ children: /* @__PURE__ */ w(N, { configurationName: r })
259
254
  });
260
- case t.eventNames.loadingTimeout_error: return /* @__PURE__ */ C(U, {
261
- loadingComponent: N,
262
- isLoading: z,
255
+ case t.eventNames.loadingTimeout_error: return /* @__PURE__ */ w(H, {
256
+ loadingComponent: F,
257
+ isLoading: B,
263
258
  configurationName: r,
264
- children: /* @__PURE__ */ C(F, { configurationName: r })
259
+ children: /* @__PURE__ */ w(I, { configurationName: r })
265
260
  });
266
261
  case t.eventNames.loginAsync_error:
267
- case t.eventNames.loginCallbackAsync_error: return /* @__PURE__ */ C(U, {
268
- loadingComponent: N,
269
- isLoading: z,
262
+ case t.eventNames.loginCallbackAsync_error: return /* @__PURE__ */ w(H, {
263
+ loadingComponent: F,
264
+ isLoading: B,
270
265
  configurationName: r,
271
- children: /* @__PURE__ */ C(L, { configurationName: r })
266
+ children: /* @__PURE__ */ w(z, { configurationName: r })
272
267
  });
273
268
  case t.eventNames.refreshTokensAsync_error:
274
269
  case t.eventNames.syncTokensAsync_error:
275
- case t.eventNames.logout_from_another_tab: return /* @__PURE__ */ C(U, {
276
- loadingComponent: N,
277
- isLoading: z,
270
+ case t.eventNames.logout_from_another_tab: return /* @__PURE__ */ w(H, {
271
+ loadingComponent: F,
272
+ isLoading: B,
278
273
  configurationName: r,
279
- children: /* @__PURE__ */ C(j, { configurationName: r })
274
+ children: /* @__PURE__ */ w(M, { configurationName: r })
280
275
  });
281
- default: return /* @__PURE__ */ C(U, {
282
- loadingComponent: N,
283
- isLoading: z,
276
+ default: return /* @__PURE__ */ w(H, {
277
+ loadingComponent: F,
278
+ isLoading: B,
284
279
  configurationName: r,
285
- children: /* @__PURE__ */ C(V, {
286
- redirect_uri: B.configuration.redirect_uri,
287
- silent_redirect_uri: B.configuration.silent_redirect_uri,
288
- silent_login_uri: B.configuration.silent_login_uri,
280
+ children: /* @__PURE__ */ w(ie, {
281
+ redirect_uri: U.configuration.redirect_uri,
282
+ silent_redirect_uri: U.configuration.silent_redirect_uri,
283
+ silent_login_uri: U.configuration.silent_login_uri,
289
284
  callbackSuccessComponent: i,
290
285
  callbackErrorComponent: u,
291
286
  authenticatingComponent: o,
292
287
  configurationName: r,
293
- withCustomHistory: h,
294
- navigateAfterCallback: g,
295
- location: b ?? new a(),
296
- children: /* @__PURE__ */ C(ae, {
297
- loadingComponent: N,
288
+ withCustomHistory: g,
289
+ navigateAfterCallback: _,
290
+ location: x ?? new a(),
291
+ children: /* @__PURE__ */ w(ae, {
292
+ loadingComponent: F,
298
293
  configurationName: r,
299
294
  children: e
300
295
  })
301
296
  })
302
297
  });
303
298
  }
304
- }, q = ({ children: e, callbackPath: n = null, extras: r = null, configurationName: i = "default" }) => {
299
+ }, W = ({ children: e, callbackPath: n = null, extras: r = null, configurationName: i = "default" }) => {
305
300
  let a = t.getOrThrow, o = a(i);
306
- return y(() => {
301
+ return b(() => {
307
302
  !o.tokens && !o.isLoggingOut && o.loginAsync(n, r);
308
303
  }, [
309
304
  i,
310
305
  n,
311
306
  r
312
- ]), o.tokens ? /* @__PURE__ */ C(S, { children: e }) : null;
313
- }, oe = (e, t = null, n = null, r = "default") => (i) => /* @__PURE__ */ C(q, {
307
+ ]), o.tokens ? /* @__PURE__ */ w(C, { children: e }) : null;
308
+ }, G = (e, t = null, n = null, r = "default") => (i) => /* @__PURE__ */ w(W, {
314
309
  callbackPath: t,
315
310
  extras: n,
316
311
  configurationName: r,
317
- children: /* @__PURE__ */ C(e, { ...i })
318
- }), J = /* @__PURE__ */ new Set(), Y = (e) => {
319
- J.has(e) || (J.add(e), console.warn(`@axa-fr/react-oidc: no OIDC configuration found for "${e}". Make sure to wrap your component tree with <OidcProvider configurationName="${e}">. Hooks are returning safe default values (issue #1679).`));
320
- }, X = "default", Z = (e, t) => {
321
- let n = !1, r = e(t);
322
- return r && (n = r.tokens != null), n;
323
- }, se = (e = X) => {
324
- let n = t.get, [r, i] = x(() => Z(n, e));
325
- return y(() => {
312
+ children: /* @__PURE__ */ w(e, { ...i })
313
+ }), K = /* @__PURE__ */ new Set(), q = (e) => {
314
+ K.has(e) || (K.add(e), console.warn(`@axa-fr/react-oidc: no OIDC configuration found for "${e}". Make sure to wrap your component tree with <OidcProvider configurationName="${e}">. Hooks are returning safe default values (issue #1679).`));
315
+ }, J = "default", Y = (e, t) => {
316
+ let n = e(t);
317
+ return n ? n.tokens != null : !1;
318
+ }, X = (e) => e === t.eventNames.token_renewed || e === t.eventNames.token_acquired || e === t.eventNames.logout_from_another_tab || e === t.eventNames.logout_from_same_tab || e === t.eventNames.refreshTokensAsync_error || e === t.eventNames.syncTokensAsync_error, ce = (e = J) => {
319
+ let n = t.get, [r, i] = S(() => Y(n, e));
320
+ return b(() => {
326
321
  let r = !0, a = n(e);
327
322
  if (!a) {
328
- Y(e);
323
+ q(e);
329
324
  return;
330
325
  }
331
326
  let o = a.subscribeEvents((a, o) => {
332
- (a === t.eventNames.logout_from_another_tab || a === t.eventNames.logout_from_same_tab || a === t.eventNames.token_acquired) && r && i(Z(n, e));
327
+ (a === t.eventNames.logout_from_another_tab || a === t.eventNames.logout_from_same_tab || a === t.eventNames.token_acquired) && r && i(Y(n, e));
333
328
  });
334
329
  return () => {
335
330
  r = !1, a.removeEventSubscription(o);
@@ -337,15 +332,15 @@ var T = "default", E = (e, t, n = !1) => async (...r) => await t().fetchWithToke
337
332
  }, [e]), {
338
333
  login: (t = void 0, r = void 0, i = !1, a = void 0) => {
339
334
  let o = n(e);
340
- return o ? o.loginAsync(t, r, !1, a, i) : (Y(e), Promise.resolve());
335
+ return o ? o.loginAsync(t, r, !1, a, i) : (q(e), Promise.resolve());
341
336
  },
342
337
  logout: (t = void 0, r = void 0) => {
343
338
  let i = n(e);
344
- return i ? i.logoutAsync(t, r) : (Y(e), Promise.resolve());
339
+ return i ? i.logoutAsync(t, r) : (q(e), Promise.resolve());
345
340
  },
346
341
  renewTokens: async (t = void 0) => {
347
342
  let r = n(e);
348
- if (!r) return Y(e), {
343
+ if (!r) return q(e), {
349
344
  accessToken: null,
350
345
  accessTokenPayload: null,
351
346
  idToken: null,
@@ -361,12 +356,12 @@ var T = "default", E = (e, t, n = !1) => async (...r) => await t().fetchWithToke
361
356
  },
362
357
  isAuthenticated: r
363
358
  };
364
- }, Q = {
359
+ }, Z = {
365
360
  accessToken: null,
366
361
  accessTokenPayload: null
367
- }, ce = (e) => {
362
+ }, Q = (e) => {
368
363
  let n = t.get, r = n(e);
369
- if (!r) return Q;
364
+ if (!r) return Z;
370
365
  if (r.tokens) {
371
366
  let e = r.tokens;
372
367
  return {
@@ -375,31 +370,31 @@ var T = "default", E = (e, t, n = !1) => async (...r) => await t().fetchWithToke
375
370
  generateDemonstrationOfProofOfPossessionAsync: r.configuration.demonstrating_proof_of_possession ? (t, n) => r.generateDemonstrationOfProofOfPossessionAsync(e.accessToken, t, n) : null
376
371
  };
377
372
  }
378
- return Q;
373
+ return Z;
379
374
  };
380
375
  function le(e, t) {
381
376
  return e.configuration.demonstrating_proof_of_possession ? (n, r, i = {}) => e.generateDemonstrationOfProofOfPossessionAsync(t.accessToken, n, r, i) : null;
382
377
  }
383
- var ue = (e = X) => {
384
- let n = t.get, [r, i] = x(() => ce(e));
385
- return y(() => {
386
- let r = !0, a = n(e);
387
- if (!a) {
388
- Y(e);
378
+ var ue = (e = J) => {
379
+ let n = t.get, [r, i] = S(() => Q(e));
380
+ return b(() => {
381
+ let t = !0, r = n(e);
382
+ if (!r) {
383
+ q(e);
389
384
  return;
390
385
  }
391
- let o = a.subscribeEvents((e, n) => {
392
- if ((e === t.eventNames.token_renewed || e === t.eventNames.token_acquired || e === t.eventNames.logout_from_another_tab || e === t.eventNames.logout_from_same_tab || e === t.eventNames.refreshTokensAsync_error || e === t.eventNames.syncTokensAsync_error) && r) {
393
- let e = a.tokens;
394
- i(e == null ? Q : {
386
+ let a = r.subscribeEvents((e, n) => {
387
+ if (X(e) && t) {
388
+ let e = r.tokens;
389
+ i(e == null ? Z : {
395
390
  accessToken: e.accessToken,
396
391
  accessTokenPayload: e.accessTokenPayload,
397
- generateDemonstrationOfProofOfPossessionAsync: le(a, e)
392
+ generateDemonstrationOfProofOfPossessionAsync: le(r, e)
398
393
  });
399
394
  }
400
395
  });
401
396
  return () => {
402
- r = !1, a.removeEventSubscription(o);
397
+ t = !1, r.removeEventSubscription(a);
403
398
  };
404
399
  }, [e]), r;
405
400
  }, $ = {
@@ -416,17 +411,17 @@ var ue = (e = X) => {
416
411
  };
417
412
  }
418
413
  return $;
419
- }, fe = (e = X) => {
420
- let n = t.get, [r, i] = x(() => de(e));
421
- return y(() => {
422
- let r = !0, a = n(e);
423
- if (!a) {
424
- Y(e);
414
+ }, fe = (e = J) => {
415
+ let n = t.get, [r, i] = S(() => de(e));
416
+ return b(() => {
417
+ let t = !0, r = n(e);
418
+ if (!r) {
419
+ q(e);
425
420
  return;
426
421
  }
427
- let o = a.subscribeEvents((e, n) => {
428
- if ((e === t.eventNames.token_renewed || e === t.eventNames.token_acquired || e === t.eventNames.logout_from_another_tab || e === t.eventNames.logout_from_same_tab || e === t.eventNames.refreshTokensAsync_error || e === t.eventNames.syncTokensAsync_error) && r) {
429
- let e = a.tokens;
422
+ let a = r.subscribeEvents((e, n) => {
423
+ if (X(e) && t) {
424
+ let e = r.tokens;
430
425
  i(e == null ? $ : {
431
426
  idToken: e.idToken,
432
427
  idTokenPayload: e.idTokenPayload
@@ -434,20 +429,20 @@ var ue = (e = X) => {
434
429
  }
435
430
  });
436
431
  return () => {
437
- r = !1, a.removeEventSubscription(o);
432
+ t = !1, r.removeEventSubscription(a);
438
433
  };
439
434
  }, [e]), r;
440
435
  }, pe = /* @__PURE__ */ function(e) {
441
436
  return e.Unauthenticated = "Unauthenticated", e.Loading = "Loading user", e.Loaded = "User loaded", e.LoadingError = "Error loading user", e;
442
437
  }({}), me = (e = "default", n = !1) => {
443
- let r = t.get(e), i = r ? r.userInfo() : null, [a, o] = x({
438
+ let r = t.get(e), i = r ? r.userInfo() : null, [a, o] = S({
444
439
  user: i,
445
440
  status: i ? "User loaded" : "Unauthenticated"
446
- }), [s, c] = x(+!!i), l = b(+!!i);
447
- return y(() => {
441
+ }), [s, c] = S(+!!i), l = x(+!!i);
442
+ return b(() => {
448
443
  let r = t.get(e), i = !0;
449
444
  if (!r) {
450
- Y(e);
445
+ q(e);
451
446
  return;
452
447
  }
453
448
  if (r.tokens) {
@@ -495,4 +490,4 @@ var ue = (e = X) => {
495
490
  };
496
491
  };
497
492
  //#endregion
498
- export { e as OidcClient, n as OidcError, r as OidcErrorCode, i as OidcLocation, K as OidcProvider, q as OidcSecure, o as OidcStateError, s as OidcStateErrorCode, pe as OidcUserStatus, c as PushedAuthorizationRequestError, l as PushedAuthorizationRequestErrorCode, u as TokenAutomaticRenewMode, d as TokenRenewMode, m as isOidcError, h as isOidcStateError, g as isPushedAuthorizationRequestError, se as useOidc, ue as useOidcAccessToken, O as useOidcFetch, fe as useOidcIdToken, me as useOidcUser, D as withOidcFetch, oe as withOidcSecure };
493
+ export { e as OidcClient, n as OidcError, r as OidcErrorCode, i as OidcLocation, U as OidcProvider, W as OidcSecure, o as OidcStateError, s as OidcStateErrorCode, pe as OidcUserStatus, c as PushedAuthorizationRequestError, l as PushedAuthorizationRequestErrorCode, u as TokenAutomaticRenewMode, d as TokenRenewMode, h as isOidcError, g as isOidcStateError, _ as isPushedAuthorizationRequestError, ce as useOidc, ue as useOidcAccessToken, O as useOidcFetch, fe as useOidcIdToken, me as useOidcUser, D as withOidcFetch, G as withOidcSecure };