react-luminus-components 1.3.23 → 1.3.25

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.
Files changed (32) hide show
  1. package/dist/.vite/manifest.json +53 -50
  2. package/dist/{PrimaryButton-DJLMLJJ7.js → PrimaryButton-Bewa28m7.js} +1 -1
  3. package/dist/{PrimaryButton-Cx3E5x2b.cjs → PrimaryButton-DXGul-f9.cjs} +1 -1
  4. package/dist/{SimpleTooltip-CIPtCvs1.js → SimpleTooltip-B7H1sJLN.js} +1 -1
  5. package/dist/{SimpleTooltip-Dtb0OmTb.cjs → SimpleTooltip-Cssc2MLs.cjs} +1 -1
  6. package/dist/{UserAvatarToggle-CsTHq7yG.js → UserAvatarToggle-C1CRXpP2.js} +5 -0
  7. package/dist/{UserAvatarToggle-DJWp7_0z.cjs → UserAvatarToggle-DYIBvTYX.cjs} +1 -1
  8. package/dist/contexts/delegation/DelegationContext.d.ts +19 -3
  9. package/dist/contexts/delegation/DelegationProvider.d.ts +2 -1
  10. package/dist/contexts/index.d.ts +1 -0
  11. package/dist/contexts.cjs.js +1 -1
  12. package/dist/contexts.es.js +220 -191
  13. package/dist/{dateUtils-7nL2BXlo.js → dateUtils-C7tHbjab.js} +28 -23
  14. package/dist/{dateUtils-DUA3CKds.cjs → dateUtils-b-AkAh2Y.cjs} +1 -1
  15. package/dist/hooks/useGetApiData/useGetApiData.d.ts +1 -1
  16. package/dist/hooks.cjs.js +1 -1
  17. package/dist/hooks.es.js +516 -543
  18. package/dist/layout.cjs.js +1 -1
  19. package/dist/layout.es.js +3 -3
  20. package/dist/main.cjs.js +1 -1
  21. package/dist/main.es.js +4 -4
  22. package/dist/models/types/UseGetApiDataOptions.d.ts +1 -0
  23. package/dist/useLocalStorageState-CxsNjf78.cjs +1 -0
  24. package/dist/useLocalStorageState-DblJQuM7.js +73 -0
  25. package/dist/{usePermissions-DUTyAK35.cjs → usePermissions-BEKIk6u3.cjs} +1 -1
  26. package/dist/{usePermissions-B1eRrluF.js → usePermissions-avh3rydq.js} +1 -1
  27. package/dist/utils/date/dateUtils.d.ts +1 -0
  28. package/dist/utils.cjs.js +1 -1
  29. package/dist/utils.es.js +16 -15
  30. package/package.json +1 -1
  31. package/dist/useLocalStorageState-Cg6ipags.js +0 -40
  32. package/dist/useLocalStorageState-CkEIA-gx.cjs +0 -1
@@ -1,69 +1,70 @@
1
- import { j as a, am as F, Q as j, an as b, ao as z, ap as K, L as A, K as l, aq as H, ar as B, as as U, ab as q, ae as G, at as M, af as V, ah as L, ag as $, au as Q } from "./UserAvatarToggle-CsTHq7yG.js";
2
- import J, { useState as h, useCallback as f, useMemo as S, useContext as y, useEffect as P, useRef as W, useReducer as X } from "react";
1
+ import { j as a, am as H, Q as b, an as M, ao as q, ap as V, L as O, K as d, aq as $, ar as Q, as as D, ab as J, ae as F, at as z, af as W, ah as N, ag as X, au as Y } from "./UserAvatarToggle-C1CRXpP2.js";
2
+ import Z, { useState as h, useCallback as E, useMemo as C, useContext as L, useEffect as v, useRef as K, useReducer as ee } from "react";
3
3
  import "./latinize-BQrinury.js";
4
4
  import "react-hook-form";
5
- import { u as Y, a as Z, b as ee } from "./useLocalStorageState-Cg6ipags.js";
6
- import { M as C, b as te, P as p, L as ne, E as u } from "./PrimaryButton-DJLMLJJ7.js";
7
- const se = ({ children: e }) => {
8
- const [r, t] = h(!1), [s, n] = h(""), o = f((d) => {
9
- t(!0), n(d);
10
- }, []), c = f(() => {
5
+ import { u as te, a as ne, b as se, c as oe } from "./useLocalStorageState-DblJQuM7.js";
6
+ import { M as S, b as re, P as _, L as ae, E as f } from "./PrimaryButton-Bewa28m7.js";
7
+ import { m as ce } from "./dateUtils-C7tHbjab.js";
8
+ const le = ({ children: e }) => {
9
+ const [r, t] = h(!1), [s, n] = h(""), o = E((i) => {
10
+ t(!0), n(i);
11
+ }, []), c = E(() => {
11
12
  t(!1);
12
- }, []), i = S(() => ({ show: r, text: s, showConfirm: o, hideConfirm: c }), [r, s, o, c]);
13
- return /* @__PURE__ */ a.jsxs(F.Provider, { value: i, children: [
14
- /* @__PURE__ */ a.jsx(ue, {}),
13
+ }, []), l = C(() => ({ show: r, text: s, showConfirm: o, hideConfirm: c }), [r, s, o, c]);
14
+ return /* @__PURE__ */ a.jsxs(H.Provider, { value: l, children: [
15
+ /* @__PURE__ */ a.jsx(Ee, {}),
15
16
  e
16
17
  ] });
17
- }, oe = () => {
18
- const { confirmTexts: e } = y(j), { isShown: r, text: t, onFinish: s } = Y(), { options: n } = y(b), [o, c] = h(n.defaultValue ?? ""), i = f(() => {
18
+ }, ie = () => {
19
+ const { confirmTexts: e } = L(b), { isShown: r, text: t, onFinish: s } = te(), { options: n } = L(M), [o, c] = h(n.defaultValue ?? ""), l = E(() => {
19
20
  s(null);
20
- }, [s]), d = f((E) => {
21
- E.preventDefault(), !(n.required && !o) && s(o);
21
+ }, [s]), i = E((u) => {
22
+ u.preventDefault(), !(n.required && !o) && s(o);
22
23
  }, [s, n.required, o]);
23
- P(() => {
24
+ v(() => {
24
25
  r === !0 && c(n.defaultValue ?? "");
25
26
  }, [r, n.defaultValue]);
26
- const g = S(() => ({
27
+ const g = C(() => ({
27
28
  value: o,
28
- onChange: (E) => c(E.currentTarget.value),
29
+ onChange: (u) => c(u.currentTarget.value),
29
30
  className: "w-100",
30
31
  autoFocus: !0,
31
32
  tabIndex: 0
32
33
  }), [o]);
33
- return /* @__PURE__ */ a.jsxs(C, { show: r, size: "sm", centered: !0, onHide: i, children: [
34
- /* @__PURE__ */ a.jsx(C.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(C.Title, { children: t }) }),
35
- /* @__PURE__ */ a.jsxs("form", { onSubmit: d, children: [
36
- /* @__PURE__ */ a.jsxs(C.Body, { children: [
34
+ return /* @__PURE__ */ a.jsxs(S, { show: r, size: "sm", centered: !0, onHide: l, children: [
35
+ /* @__PURE__ */ a.jsx(S.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(S.Title, { children: t }) }),
36
+ /* @__PURE__ */ a.jsxs("form", { onSubmit: i, children: [
37
+ /* @__PURE__ */ a.jsxs(S.Body, { children: [
37
38
  n.input === "textarea" ? /* @__PURE__ */ a.jsx("textarea", { ...g, rows: 5 }) : void 0,
38
- n.input === "input" ? /* @__PURE__ */ a.jsx(te, { ...g, type: n.type }) : void 0
39
+ n.input === "input" ? /* @__PURE__ */ a.jsx(re, { ...g, type: n.type }) : void 0
39
40
  ] }),
40
- /* @__PURE__ */ a.jsxs(C.Footer, { className: "w-100 d-flex gap-5", children: [
41
- /* @__PURE__ */ a.jsx(p, { variant: "outlined", color: "secondary", onClick: i, className: "flex-grow-1", children: e.cancel }),
42
- /* @__PURE__ */ a.jsx(p, { color: "primary", disabled: n.required && !o, type: "submit", className: "flex-grow-1", children: e.confirm })
41
+ /* @__PURE__ */ a.jsxs(S.Footer, { className: "w-100 d-flex gap-5", children: [
42
+ /* @__PURE__ */ a.jsx(_, { variant: "outlined", color: "secondary", onClick: l, className: "flex-grow-1", children: e.cancel }),
43
+ /* @__PURE__ */ a.jsx(_, { color: "primary", disabled: n.required && !o, type: "submit", className: "flex-grow-1", children: e.confirm })
43
44
  ] })
44
45
  ] })
45
46
  ] });
46
- }, re = ({ children: e }) => {
47
- const [r, t] = h(!1), [s, n] = h(""), [o, c] = h({ input: "textarea", type: "text" }), i = W(() => {
48
- }), d = f((I) => {
49
- n(I), t(!0);
50
- }, []), g = f(() => {
47
+ }, ue = ({ children: e }) => {
48
+ const [r, t] = h(!1), [s, n] = h(""), [o, c] = h({ input: "textarea", type: "text" }), l = K(() => {
49
+ }), i = E((T) => {
50
+ n(T), t(!0);
51
+ }, []), g = E(() => {
51
52
  t(!1);
52
- }, []), E = S(() => ({
53
+ }, []), u = C(() => ({
53
54
  isShown: r,
54
55
  text: s,
55
- showPrompt: d,
56
+ showPrompt: i,
56
57
  hidePrompt: g,
57
- resolveRef: i,
58
+ resolveRef: l,
58
59
  options: o,
59
60
  setOptions: c
60
- }), [r, s, d, g, o]);
61
- return /* @__PURE__ */ a.jsxs(b.Provider, { value: E, children: [
61
+ }), [r, s, i, g, o]);
62
+ return /* @__PURE__ */ a.jsxs(M.Provider, { value: u, children: [
62
63
  e,
63
- /* @__PURE__ */ a.jsx(oe, {})
64
+ /* @__PURE__ */ a.jsx(ie, {})
64
65
  ] });
65
- }, he = ({ cookieDomain: e, axiosOptions: r, LinkComponent: t, NavigateComponent: s, language: n, axiosTexts: o, confirmTexts: c, formValidationTexts: i, homeDashboardTexts: d, formSubmitTexts: g, appSearchTexts: E, customSelectTexts: I, errorBoundaryTexts: v, widgetTexts: R, children: _ }) => {
66
- const N = S(() => ({
66
+ }, Ne = ({ cookieDomain: e, axiosOptions: r, LinkComponent: t, NavigateComponent: s, language: n, axiosTexts: o, confirmTexts: c, formValidationTexts: l, homeDashboardTexts: i, formSubmitTexts: g, appSearchTexts: u, customSelectTexts: T, errorBoundaryTexts: y, widgetTexts: I, children: P }) => {
67
+ const p = C(() => ({
67
68
  axiosOptions: r,
68
69
  cookieDomain: e,
69
70
  LinkComponent: t,
@@ -71,13 +72,13 @@ const se = ({ children: e }) => {
71
72
  language: n,
72
73
  axiosTexts: o,
73
74
  confirmTexts: c,
74
- formValidationTexts: i,
75
- homeDashboardTexts: d,
75
+ formValidationTexts: l,
76
+ homeDashboardTexts: i,
76
77
  formSubmitTexts: g,
77
- appSearchTexts: E,
78
- customSelectTexts: I,
79
- errorBoundaryTexts: v,
80
- widgetTexts: R
78
+ appSearchTexts: u,
79
+ customSelectTexts: T,
80
+ errorBoundaryTexts: y,
81
+ widgetTexts: I
81
82
  }), [
82
83
  r,
83
84
  e,
@@ -86,31 +87,31 @@ const se = ({ children: e }) => {
86
87
  n,
87
88
  o,
88
89
  c,
90
+ l,
89
91
  i,
90
- d,
91
92
  g,
92
- E,
93
- I,
94
- v,
95
- R
93
+ u,
94
+ T,
95
+ y,
96
+ I
96
97
  ]);
97
- return /* @__PURE__ */ a.jsx(j.Provider, { value: N, children: /* @__PURE__ */ a.jsx(se, { children: /* @__PURE__ */ a.jsxs(re, { children: [
98
- /* @__PURE__ */ a.jsx(z, {}),
99
- _
98
+ return /* @__PURE__ */ a.jsx(b.Provider, { value: p, children: /* @__PURE__ */ a.jsx(le, { children: /* @__PURE__ */ a.jsxs(ue, { children: [
99
+ /* @__PURE__ */ a.jsx(q, {}),
100
+ P
100
101
  ] }) }) });
101
- }, Ce = ({ children: e }) => {
102
- const [r, t] = h(!1), [s] = h(/* @__PURE__ */ new Set()), n = f((i) => {
103
- s.add(i), t(!0);
104
- }, [s]), o = f((i) => {
105
- s.delete(i), s.size === 0 && t(!1);
106
- }, [s]), c = S(() => ({ isLoading: r, startLoading: n, stopLoading: o }), [r, n, o]);
107
- return /* @__PURE__ */ a.jsxs(K.Provider, { value: c, children: [
108
- r && /* @__PURE__ */ a.jsx(ne, {}),
102
+ }, Le = ({ children: e }) => {
103
+ const [r, t] = h(!1), [s] = h(/* @__PURE__ */ new Set()), n = E((l) => {
104
+ s.add(l), t(!0);
105
+ }, [s]), o = E((l) => {
106
+ s.delete(l), s.size === 0 && t(!1);
107
+ }, [s]), c = C(() => ({ isLoading: r, startLoading: n, stopLoading: o }), [r, n, o]);
108
+ return /* @__PURE__ */ a.jsxs(V.Provider, { value: c, children: [
109
+ r && /* @__PURE__ */ a.jsx(ae, {}),
109
110
  e
110
111
  ] });
111
112
  };
112
113
  /*! @azure/msal-browser v3.14.0 2024-05-07 */
113
- class ae {
114
+ class de {
114
115
  /**
115
116
  * Gets interaction status from event message
116
117
  * @param message
@@ -118,40 +119,40 @@ class ae {
118
119
  */
119
120
  static getInteractionStatusFromEvent(r, t) {
120
121
  switch (r.eventType) {
121
- case u.LOGIN_START:
122
- return l.Login;
123
- case u.SSO_SILENT_START:
124
- return l.SsoSilent;
125
- case u.ACQUIRE_TOKEN_START:
126
- if (r.interactionType === A.Redirect || r.interactionType === A.Popup)
127
- return l.AcquireToken;
122
+ case f.LOGIN_START:
123
+ return d.Login;
124
+ case f.SSO_SILENT_START:
125
+ return d.SsoSilent;
126
+ case f.ACQUIRE_TOKEN_START:
127
+ if (r.interactionType === O.Redirect || r.interactionType === O.Popup)
128
+ return d.AcquireToken;
128
129
  break;
129
- case u.HANDLE_REDIRECT_START:
130
- return l.HandleRedirect;
131
- case u.LOGOUT_START:
132
- return l.Logout;
133
- case u.SSO_SILENT_SUCCESS:
134
- case u.SSO_SILENT_FAILURE:
135
- if (t && t !== l.SsoSilent)
130
+ case f.HANDLE_REDIRECT_START:
131
+ return d.HandleRedirect;
132
+ case f.LOGOUT_START:
133
+ return d.Logout;
134
+ case f.SSO_SILENT_SUCCESS:
135
+ case f.SSO_SILENT_FAILURE:
136
+ if (t && t !== d.SsoSilent)
136
137
  break;
137
- return l.None;
138
- case u.LOGOUT_END:
139
- if (t && t !== l.Logout)
138
+ return d.None;
139
+ case f.LOGOUT_END:
140
+ if (t && t !== d.Logout)
140
141
  break;
141
- return l.None;
142
- case u.HANDLE_REDIRECT_END:
143
- if (t && t !== l.HandleRedirect)
142
+ return d.None;
143
+ case f.HANDLE_REDIRECT_END:
144
+ if (t && t !== d.HandleRedirect)
144
145
  break;
145
- return l.None;
146
- case u.LOGIN_SUCCESS:
147
- case u.LOGIN_FAILURE:
148
- case u.ACQUIRE_TOKEN_SUCCESS:
149
- case u.ACQUIRE_TOKEN_FAILURE:
150
- case u.RESTORE_FROM_BFCACHE:
151
- if (r.interactionType === A.Redirect || r.interactionType === A.Popup) {
152
- if (t && t !== l.Login && t !== l.AcquireToken)
146
+ return d.None;
147
+ case f.LOGIN_SUCCESS:
148
+ case f.LOGIN_FAILURE:
149
+ case f.ACQUIRE_TOKEN_SUCCESS:
150
+ case f.ACQUIRE_TOKEN_FAILURE:
151
+ case f.RESTORE_FROM_BFCACHE:
152
+ if (r.interactionType === O.Redirect || r.interactionType === O.Popup) {
153
+ if (t && t !== d.Login && t !== d.AcquireToken)
153
154
  break;
154
- return l.None;
155
+ return d.None;
155
156
  }
156
157
  break;
157
158
  }
@@ -159,55 +160,55 @@ class ae {
159
160
  }
160
161
  }
161
162
  /*! @azure/msal-react v2.0.16 2024-05-07 */
162
- const ce = "@azure/msal-react", w = "2.0.16";
163
+ const fe = "@azure/msal-react", G = "2.0.16";
163
164
  /*! @azure/msal-react v2.0.16 2024-05-07 */
164
- const O = {
165
+ const w = {
165
166
  UNBLOCK_INPROGRESS: "UNBLOCK_INPROGRESS",
166
167
  EVENT: "EVENT"
167
- }, ie = (e, r) => {
168
+ }, me = (e, r) => {
168
169
  const { type: t, payload: s } = r;
169
170
  let n = e.inProgress;
170
171
  switch (t) {
171
- case O.UNBLOCK_INPROGRESS:
172
- e.inProgress === l.Startup && (n = l.None, s.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));
172
+ case w.UNBLOCK_INPROGRESS:
173
+ e.inProgress === d.Startup && (n = d.None, s.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));
173
174
  break;
174
- case O.EVENT:
175
- const c = s.message, i = ae.getInteractionStatusFromEvent(c, e.inProgress);
176
- i && (s.logger.info(`MsalProvider - ${c.eventType} results in setting inProgress from ${e.inProgress} to ${i}`), n = i);
175
+ case w.EVENT:
176
+ const c = s.message, l = de.getInteractionStatusFromEvent(c, e.inProgress);
177
+ l && (s.logger.info(`MsalProvider - ${c.eventType} results in setting inProgress from ${e.inProgress} to ${l}`), n = l);
177
178
  break;
178
179
  default:
179
180
  throw new Error(`Unknown action type: ${t}`);
180
181
  }
181
182
  const o = s.instance.getAllAccounts();
182
- return n !== e.inProgress && !U(o, e.accounts) ? {
183
+ return n !== e.inProgress && !D(o, e.accounts) ? {
183
184
  ...e,
184
185
  inProgress: n,
185
186
  accounts: o
186
187
  } : n !== e.inProgress ? {
187
188
  ...e,
188
189
  inProgress: n
189
- } : U(o, e.accounts) ? e : {
190
+ } : D(o, e.accounts) ? e : {
190
191
  ...e,
191
192
  accounts: o
192
193
  };
193
194
  };
194
- function le({ instance: e, children: r }) {
195
- P(() => {
196
- e.initializeWrapperLibrary(H.React, w);
195
+ function ge({ instance: e, children: r }) {
196
+ v(() => {
197
+ e.initializeWrapperLibrary($.React, G);
197
198
  }, [e]);
198
- const t = S(() => e.getLogger().clone(ce, w), [e]), [s, n] = X(ie, void 0, () => ({
199
- inProgress: l.Startup,
199
+ const t = C(() => e.getLogger().clone(fe, G), [e]), [s, n] = ee(me, void 0, () => ({
200
+ inProgress: d.Startup,
200
201
  accounts: e.getAllAccounts()
201
202
  }));
202
- P(() => {
203
- const c = e.addEventCallback((i) => {
203
+ v(() => {
204
+ const c = e.addEventCallback((l) => {
204
205
  n({
205
206
  payload: {
206
207
  instance: e,
207
208
  logger: t,
208
- message: i
209
+ message: l
209
210
  },
210
- type: O.EVENT
211
+ type: w.EVENT
211
212
  });
212
213
  });
213
214
  return t.verbose(`MsalProvider - Registered event callback with id: ${c}`), e.initialize().then(() => {
@@ -218,7 +219,7 @@ function le({ instance: e, children: r }) {
218
219
  instance: e,
219
220
  logger: t
220
221
  },
221
- type: O.UNBLOCK_INPROGRESS
222
+ type: w.UNBLOCK_INPROGRESS
222
223
  });
223
224
  });
224
225
  }).catch(() => {
@@ -232,61 +233,56 @@ function le({ instance: e, children: r }) {
232
233
  accounts: s.accounts,
233
234
  logger: t
234
235
  };
235
- return J.createElement(B.Provider, { value: o }, r);
236
+ return Z.createElement(Q.Provider, { value: o }, r);
236
237
  }
237
- const Se = ({ children: e }) => {
238
- const r = q(), { msalInstance: t } = y(G), { delegation: s, setDelegation: n } = y(M), { getToken: o } = V(), [c, i] = h(null), d = f(async () => {
239
- const m = await o();
240
- m && i(m);
241
- }, [o]);
242
- P(() => {
243
- d();
244
- }, [d]);
245
- const E = f(() => {
238
+ const Te = ({ children: e }) => {
239
+ const r = J(), { msalInstance: t } = L(F), { delegation: s, setDelegation: n, setAvailableDelegations: o, refreshAvailableDelegations: c } = L(z), { getToken: l } = W(), [i, g] = h(null), u = E(async () => {
240
+ const m = await l();
241
+ m && g(m);
242
+ }, [l]);
243
+ v(() => {
244
+ u();
245
+ }, [u]);
246
+ const y = E(() => {
246
247
  const m = localStorage.getItem("user") ?? null;
247
248
  return m ? JSON.parse(m ?? "") : null;
248
- }, [])(), [I, v] = h({
249
- state: E ? L.LOGGED_IN : L.LOGGING_IN,
250
- user: E
251
- }), R = f(async (m) => {
249
+ }, [])(), [I, P] = h({
250
+ state: y ? N.LOGGED_IN : N.LOGGING_IN,
251
+ user: y
252
+ }), p = E(async (m) => {
252
253
  let x = null;
253
- return await r.get("/user/detail", m ? { headers: { Authorization: `Bearer ${m}` } } : void 0).then((k) => {
254
- x = k.data;
254
+ return await r.get("/user/detail", m ? { headers: { Authorization: `Bearer ${m}` } } : void 0).then((j) => {
255
+ x = j.data;
255
256
  }).catch(() => {
256
257
  x = null;
257
258
  }), x;
258
- }, [r]), _ = f(() => {
259
- localStorage.removeItem("user"), v({
260
- state: L.LOGGED_OUT,
259
+ }, [r]), k = E(() => {
260
+ localStorage.removeItem("user"), P({
261
+ state: N.LOGGED_OUT,
261
262
  user: null
262
- });
263
- }, []), N = f(async (m) => {
264
- v({
265
- state: L.LOGGING_IN,
263
+ }), n(null), o(null);
264
+ }, [o, n]), R = E(async (m) => {
265
+ P({
266
+ state: N.LOGGING_IN,
266
267
  user: null
267
268
  });
268
- const x = await R(m);
269
- return x ? (v({
270
- state: L.LOGGED_IN,
269
+ const x = await p(m);
270
+ return x ? (P({
271
+ state: N.LOGGED_IN,
271
272
  user: x
272
- }), localStorage.setItem("user", JSON.stringify(x)), !0) : (v({
273
- state: L.LOGIN_FAILED,
273
+ }), localStorage.setItem("user", JSON.stringify(x)), await c(), !0) : (P({
274
+ state: N.LOGIN_FAILED,
274
275
  user: null
275
276
  }), !1);
276
- }, [R]), T = f(() => {
277
- _();
278
- }, [_]), D = S(() => ({
279
- user: I.user,
280
- userLoginState: I,
281
- loginUser: N,
282
- logoutUser: T
283
- }), [I, N, T]);
284
- return P(() => {
277
+ }, [p, c]), A = E(() => {
278
+ k();
279
+ }, [k]);
280
+ v(() => {
285
281
  if (t) {
286
282
  const m = t.addEventCallback((x) => {
287
- if (x.eventType === u.LOGIN_SUCCESS && x.payload) {
288
- const k = x.payload;
289
- i(k.accessToken);
283
+ if (x.eventType === f.LOGIN_SUCCESS && x.payload) {
284
+ const j = x.payload;
285
+ g(j.accessToken);
290
286
  }
291
287
  });
292
288
  return () => {
@@ -295,25 +291,36 @@ const Se = ({ children: e }) => {
295
291
  }
296
292
  return () => {
297
293
  };
298
- }, [t, N, T]), P(() => {
299
- c && N(c).catch(() => {
300
- T(), n(null);
294
+ }, [t, R, A]);
295
+ const U = E(async (m) => {
296
+ m && await R(m).catch(() => {
297
+ A(), n(null);
301
298
  });
302
- }, [c, N, T, s == null ? void 0 : s.id, n]), /* @__PURE__ */ a.jsx($.Provider, { value: D, children: e });
303
- }, Ie = ({ ...e }) => {
304
- const { cookieDomain: r } = y(j), [, t] = Q(["Authorization"]), s = S(() => ({
299
+ }, [R, A, n]);
300
+ v(() => {
301
+ U(i);
302
+ }, [i, s == null ? void 0 : s.id, U]);
303
+ const B = C(() => ({
304
+ user: I.user,
305
+ userLoginState: I,
306
+ loginUser: R,
307
+ logoutUser: A
308
+ }), [I, R, A]);
309
+ return /* @__PURE__ */ a.jsx(X.Provider, { value: B, children: e });
310
+ }, ye = ({ ...e }) => {
311
+ const { cookieDomain: r } = L(b), [, t] = Y(["Authorization"]), s = C(() => ({
305
312
  useMsal: e.useMsal ?? !1,
306
313
  msalInstance: e.useMsal ? e.msalInstance ?? null : null,
307
314
  msalScopes: e.useMsal ? e.msalScopes ?? [] : []
308
315
  }), [e]);
309
- return P(() => {
316
+ return v(() => {
310
317
  if (e.useMsal) {
311
318
  const n = e.msalInstance.addEventCallback((o) => {
312
- if (o.eventType === u.LOGIN_SUCCESS || o.eventType === u.ACQUIRE_TOKEN_SUCCESS && o.payload) {
313
- const c = o.payload, i = c.account;
314
- e.msalInstance.setActiveAccount(i);
315
- const d = c.accessToken, g = c.expiresOn;
316
- t("Authorization", d, {
319
+ if (o.eventType === f.LOGIN_SUCCESS || o.eventType === f.ACQUIRE_TOKEN_SUCCESS && o.payload) {
320
+ const c = o.payload, l = c.account;
321
+ e.msalInstance.setActiveAccount(l);
322
+ const i = c.accessToken, g = c.expiresOn;
323
+ t("Authorization", i, {
317
324
  path: "/",
318
325
  secure: !0,
319
326
  sameSite: "none",
@@ -329,38 +336,60 @@ const Se = ({ children: e }) => {
329
336
  }
330
337
  return () => {
331
338
  };
332
- }, [e, t, r]), /* @__PURE__ */ a.jsx(G.Provider, { value: s, children: e.useMsal ? /* @__PURE__ */ a.jsx(le, { instance: e.msalInstance, children: e.children }) : e.children });
333
- }, Pe = ({ children: e }) => {
334
- const [r, t, s] = Z("user-delegation", null);
335
- P(() => {
336
- const o = () => {
337
- s();
339
+ }, [e, t, r]), /* @__PURE__ */ a.jsx(F.Provider, { value: s, children: e.useMsal ? /* @__PURE__ */ a.jsx(ge, { instance: e.msalInstance, children: e.children }) : e.children });
340
+ }, Re = ({ children: e, relativeEndpoint: r }) => {
341
+ const [t, s, n] = ne("user-delegation", null), { data: o, setData: c, reloadData: l } = se(r, {
342
+ nullStateBeforeLoad: !1,
343
+ nullStateOnFail: !0
344
+ }), i = K(null);
345
+ v(() => {
346
+ const u = () => {
347
+ l(), i.current = window.setTimeout(u, ce() + 5e3);
348
+ };
349
+ return u(), () => {
350
+ i.current !== null && window.clearTimeout(i.current);
351
+ };
352
+ }, [l]), v(() => {
353
+ const u = () => {
354
+ n();
338
355
  };
339
- return window.addEventListener("focus", o), () => {
340
- window.removeEventListener("focus", o);
356
+ return window.addEventListener("focus", u), () => {
357
+ window.removeEventListener("focus", u);
341
358
  };
342
- }, [s]);
343
- const n = S(() => ({ delegation: r, setDelegation: t }), [r, t]);
344
- return /* @__PURE__ */ a.jsx(M.Provider, { value: n, children: e });
345
- }, ue = () => {
346
- const { confirmTexts: e } = y(j), { onConfirm: r, onCancel: t, text: s, show: n } = ee();
347
- return /* @__PURE__ */ a.jsxs(C, { show: n, size: "sm", centered: !0, onHide: t, children: [
348
- /* @__PURE__ */ a.jsx(C.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(C.Title, { children: s }) }),
349
- /* @__PURE__ */ a.jsx(C.Body, { children: /* @__PURE__ */ a.jsxs("div", { className: "w-100 d-flex gap-5", children: [
350
- /* @__PURE__ */ a.jsx(p, { type: "button", variant: "outlined", color: "secondary", className: "w-100", onClick: t, children: e.no }),
351
- /* @__PURE__ */ a.jsx(p, { type: "button", color: "primary", onClick: r, className: "w-100 ml", children: e.yes })
359
+ }, [n, l]);
360
+ const g = C(() => ({
361
+ delegation: t,
362
+ setDelegation: s,
363
+ availableDelegations: o,
364
+ setAvailableDelegations: c,
365
+ refreshAvailableDelegations: l
366
+ }), [
367
+ t,
368
+ s,
369
+ o,
370
+ c,
371
+ l
372
+ ]);
373
+ return /* @__PURE__ */ a.jsx(z.Provider, { value: g, children: e });
374
+ }, Ee = () => {
375
+ const { confirmTexts: e } = L(b), { onConfirm: r, onCancel: t, text: s, show: n } = oe();
376
+ return /* @__PURE__ */ a.jsxs(S, { show: n, size: "sm", centered: !0, onHide: t, children: [
377
+ /* @__PURE__ */ a.jsx(S.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(S.Title, { children: s }) }),
378
+ /* @__PURE__ */ a.jsx(S.Body, { children: /* @__PURE__ */ a.jsxs("div", { className: "w-100 d-flex gap-5", children: [
379
+ /* @__PURE__ */ a.jsx(_, { type: "button", variant: "outlined", color: "secondary", className: "w-100", onClick: t, children: e.no }),
380
+ /* @__PURE__ */ a.jsx(_, { type: "button", color: "primary", onClick: r, className: "w-100 ml", children: e.yes })
352
381
  ] }) })
353
382
  ] });
354
383
  };
355
384
  export {
356
- G as AuthContext,
357
- Ie as AuthProvider,
358
- M as DelegationContext,
359
- Pe as DelegationProvider,
360
- K as LoadingContext,
361
- Ce as LoadingProvider,
362
- j as LuminusComponentsContext,
363
- he as LuminusComponentsProvider,
364
- $ as UserContext,
365
- Se as UserProvider
385
+ F as AuthContext,
386
+ ye as AuthProvider,
387
+ z as DelegationContext,
388
+ Re as DelegationProvider,
389
+ V as LoadingContext,
390
+ Le as LoadingProvider,
391
+ b as LuminusComponentsContext,
392
+ Ne as LuminusComponentsProvider,
393
+ X as UserContext,
394
+ Te as UserProvider
366
395
  };