react-luminus-components 1.3.22 → 1.3.24

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