react-luminus-components 1.2.73 → 1.2.75
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/.vite/manifest.json +42 -42
- package/dist/{EventType-CtFbVRB_.js → EventType-CYj5c_TM.js} +1 -1
- package/dist/{EventType-BYwx1aU3.cjs → EventType-LFHQrrOn.cjs} +1 -1
- package/dist/{NoInputContainer-BMw6_o8g.cjs → NoInputContainer-Ceb-y7u0.cjs} +14 -14
- package/dist/{NoInputContainer-B6VOLjlx.js → NoInputContainer-CzSDOA31.js} +196 -191
- package/dist/{SimpleTooltip-BRu35hBA.cjs → SimpleTooltip-BAljsAeT.cjs} +1 -1
- package/dist/{SimpleTooltip-AU3G1UCk.js → SimpleTooltip-CUAvaEIL.js} +1 -1
- package/dist/components/Tooltip/HtmlTooltip/HtmlTooltip.d.ts +2 -2
- package/dist/contexts/auth/AuthContext.d.ts +0 -1
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +123 -126
- package/dist/hooks/useAuth/hooks/useMsalAuth.d.ts +1 -1
- package/dist/hooks/useAuth/useAuth.d.ts +1 -1
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +4 -4
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +3 -3
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +53 -53
- package/dist/{useConfirm-Csp-DPDa.js → useConfirm-C1e4wjoh.js} +1 -1
- package/dist/{useConfirm-XkaUQify.cjs → useConfirm-CgzfU9AB.cjs} +1 -1
- package/dist/{usePermissions-BGA3fWpK.cjs → usePermissions--HXCgQlu.cjs} +1 -1
- package/dist/{usePermissions-YJIPNrrU.js → usePermissions-Crr2ZkmJ.js} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("./NoInputContainer-
|
|
1
|
+
"use strict";const t=require("./NoInputContainer-Ceb-y7u0.cjs"),r=({text:o,placement:e,children:i})=>t.jsxRuntimeExports.jsx(t.OverlayTrigger,{placement:e,overlay:t.jsxRuntimeExports.jsx(t.Tooltip,{className:"luminus-tooltip",children:o}),children:i});exports.SimpleTooltip=r;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as o, ab as t, aj as e } from "./NoInputContainer-
|
|
1
|
+
import { j as o, ab as t, aj as e } from "./NoInputContainer-CzSDOA31.js";
|
|
2
2
|
const l = ({ text: s, placement: r, children: a }) => /* @__PURE__ */ o.jsx(t, { placement: r, overlay: /* @__PURE__ */ o.jsx(e, { className: "luminus-tooltip", children: s }), children: a });
|
|
3
3
|
export {
|
|
4
4
|
l as S
|
package/dist/contexts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./NoInputContainer-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./NoInputContainer-Ceb-y7u0.cjs"),n=require("react"),v=require("./useConfirm-CgzfU9AB.cjs");require("react-hook-form");const l=require("./EventType-LFHQrrOn.cjs"),y=()=>{const{confirmTexts:t}=n.useContext(e.LuminusComponentsContext),{isShown:r,text:s,onFinish:a}=v.usePrompt(),{options:o}=n.useContext(e.PromptContext),[c,i]=n.useState(o.defaultValue??""),u=n.useCallback(()=>{a(null)},[a]),d=n.useCallback(()=>{a(c)},[a,c]);n.useEffect(()=>{r===!0&&i(o.defaultValue??"")},[r,o.defaultValue]);const x=n.useMemo(()=>({value:c,onChange:m=>i(m.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[c]);return e.jsxRuntimeExports.jsxs(l.Modal,{show:r,size:"sm",centered:!0,onHide:u,children:[e.jsxRuntimeExports.jsx(l.Modal.Header,{children:e.jsxRuntimeExports.jsx(l.Modal.Title,{children:s})}),e.jsxRuntimeExports.jsxs(l.Modal.Body,{children:[o.input==="textarea"?e.jsxRuntimeExports.jsx("textarea",{...x,rows:5}):void 0,o.input==="input"?e.jsxRuntimeExports.jsx("input",{...x,type:o.type}):void 0]}),e.jsxRuntimeExports.jsxs(l.Modal.Footer,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary",onClick:u,children:t.cancel}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary ml",onClick:d,disabled:o.required&&!c,children:t.confirm})]})]})},I=({children:t})=>{const[r,s]=n.useState(!1),[a,o]=n.useState(""),[c,i]=n.useState({input:"textarea",type:"text"}),u=n.useRef(()=>{}),d=n.useCallback(p=>{o(p),s(!0)},[]),x=n.useCallback(()=>{s(!1)},[]),m=n.useMemo(()=>({isShown:r,text:a,showPrompt:d,hidePrompt:x,resolveRef:u,options:c,setOptions:i}),[r,a,d,x,c]);return e.jsxRuntimeExports.jsxs(e.PromptContext.Provider,{value:m,children:[t,e.jsxRuntimeExports.jsx(y,{})]})},T=({children:t})=>{const[r,s]=n.useState(!1),[a,o]=n.useState(""),c=n.useCallback(d=>{s(!0),o(d)},[]),i=n.useCallback(()=>{s(!1)},[]),u=n.useMemo(()=>({show:r,text:a,showConfirm:c,hideConfirm:i}),[r,a,c,i]);return e.jsxRuntimeExports.jsxs(e.ConfirmContext.Provider,{value:u,children:[e.jsxRuntimeExports.jsx(U,{}),t]})},h=({cookieDomain:t,axiosInstance:r,LinkComponent:s,NavigateComponent:a,language:o,axiosTexts:c,confirmTexts:i,formValidationTexts:u,homeDashboardTexts:d,formSubmitTexts:x,appSearchTexts:m,customSelectTexts:p,children:S})=>{const E=n.useMemo(()=>({axiosInstance:r,cookieDomain:t,LinkComponent:s,NavigateComponent:a,language:o,axiosTexts:c,confirmTexts:i,formValidationTexts:u,homeDashboardTexts:d,formSubmitTexts:x,appSearchTexts:m,customSelectTexts:p}),[r,t,s,a,o,c,i,u,d,x,m,p]);return e.jsxRuntimeExports.jsx(e.LuminusComponentsContext.Provider,{value:E,children:e.jsxRuntimeExports.jsx(T,{children:e.jsxRuntimeExports.jsxs(I,{children:[e.jsxRuntimeExports.jsx(e.Ie,{}),S]})})})},j=({children:t})=>{const[r,s]=n.useState(!1),[a]=n.useState(new Set),o=n.useCallback(u=>{a.add(u),s(!0)},[a]),c=n.useCallback(u=>{a.delete(u),a.size===0&&s(!1)},[a]),i=n.useMemo(()=>({isLoading:r,startLoading:o,stopLoading:c}),[r,o,c]);return e.jsxRuntimeExports.jsxs(e.LoadingContext.Provider,{value:i,children:[r&&e.jsxRuntimeExports.jsx(l.Loading,{}),t]})};/*! @azure/msal-browser v3.14.0 2024-05-07 */class P{static getInteractionStatusFromEvent(r,s){switch(r.eventType){case l.EventType.LOGIN_START:return e.InteractionStatus.Login;case l.EventType.SSO_SILENT_START:return e.InteractionStatus.SsoSilent;case l.EventType.ACQUIRE_TOKEN_START:if(r.interactionType===e.InteractionType.Redirect||r.interactionType===e.InteractionType.Popup)return e.InteractionStatus.AcquireToken;break;case l.EventType.HANDLE_REDIRECT_START:return e.InteractionStatus.HandleRedirect;case l.EventType.LOGOUT_START:return e.InteractionStatus.Logout;case l.EventType.SSO_SILENT_SUCCESS:case l.EventType.SSO_SILENT_FAILURE:if(s&&s!==e.InteractionStatus.SsoSilent)break;return e.InteractionStatus.None;case l.EventType.LOGOUT_END:if(s&&s!==e.InteractionStatus.Logout)break;return e.InteractionStatus.None;case l.EventType.HANDLE_REDIRECT_END:if(s&&s!==e.InteractionStatus.HandleRedirect)break;return e.InteractionStatus.None;case l.EventType.LOGIN_SUCCESS:case l.EventType.LOGIN_FAILURE:case l.EventType.ACQUIRE_TOKEN_SUCCESS:case l.EventType.ACQUIRE_TOKEN_FAILURE:case l.EventType.RESTORE_FROM_BFCACHE:if(r.interactionType===e.InteractionType.Redirect||r.interactionType===e.InteractionType.Popup){if(s&&s!==e.InteractionStatus.Login&&s!==e.InteractionStatus.AcquireToken)break;return e.InteractionStatus.None}break}return null}}/*! @azure/msal-react v2.0.16 2024-05-07 */const b="@azure/msal-react",f="2.0.16";/*! @azure/msal-react v2.0.16 2024-05-07 */const R={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},L=(t,r)=>{const{type:s,payload:a}=r;let o=t.inProgress;switch(s){case R.UNBLOCK_INPROGRESS:t.inProgress===e.InteractionStatus.Startup&&(o=e.InteractionStatus.None,a.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case R.EVENT:const i=a.message,u=P.getInteractionStatusFromEvent(i,t.inProgress);u&&(a.logger.info(`MsalProvider - ${i.eventType} results in setting inProgress from ${t.inProgress} to ${u}`),o=u);break;default:throw new Error(`Unknown action type: ${s}`)}const c=a.instance.getAllAccounts();return o!==t.inProgress&&!e.accountArraysAreEqual(c,t.accounts)?{...t,inProgress:o,accounts:c}:o!==t.inProgress?{...t,inProgress:o}:e.accountArraysAreEqual(c,t.accounts)?t:{...t,accounts:c}};function k({instance:t,children:r}){n.useEffect(()=>{t.initializeWrapperLibrary(e.WrapperSKU.React,f)},[t]);const s=n.useMemo(()=>t.getLogger().clone(b,f),[t]),[a,o]=n.useReducer(L,void 0,()=>({inProgress:e.InteractionStatus.Startup,accounts:t.getAllAccounts()}));n.useEffect(()=>{const i=t.addEventCallback(u=>{o({payload:{instance:t,logger:s,message:u},type:R.EVENT})});return s.verbose(`MsalProvider - Registered event callback with id: ${i}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{o({payload:{instance:t,logger:s},type:R.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{i&&(s.verbose(`MsalProvider - Removing event callback ${i}`),t.removeEventCallback(i))}},[t,s]);const c={instance:t,inProgress:a.inProgress,accounts:a.accounts,logger:s};return n.createElement(e.MsalContext.Provider,{value:c},r)}const N=({children:t})=>{const r=e.useAxios(),{msalInstance:s}=n.useContext(e.AuthContext),[a,o]=n.useState(!1),c=n.useCallback(()=>{const E=localStorage.getItem("user")??null;return E?JSON.parse(E):null},[]),[i,u]=n.useState(c()),d=n.useCallback(async E=>{let C=null;return await r.get("/user/detail",E?{headers:{Authorization:`Bearer ${E}`}}:void 0).then(g=>{C=g.data}).catch(()=>{C=null}),localStorage.setItem("user",JSON.stringify(C)),C},[r]),x=n.useCallback(()=>{localStorage.removeItem("user")},[]),m=n.useCallback(async E=>{o(!0);const C=await d(E);return o(!1),C?(u(C),!0):!1},[d]),p=n.useCallback(()=>{x(),u(null)},[x]),S=n.useMemo(()=>({user:i,loggingInProgress:a,loginUser:m,logoutUser:p}),[i,m,p,a]);return n.useEffect(()=>{u(c())},[c]),n.useEffect(()=>{if(s){const E=s.addEventCallback(C=>{if(C.eventType===l.EventType.LOGIN_SUCCESS&&C.payload){const g=C.payload;m(g.accessToken).catch(()=>p())}});return()=>{E&&s.removeEventCallback(E)}}return()=>{}},[s,m,p]),e.jsxRuntimeExports.jsx(e.UserContext.Provider,{value:S,children:t})},A=({...t})=>{const{cookieDomain:r}=n.useContext(e.LuminusComponentsContext),[,s]=e.useCookies(["Authorization"]),a=n.useMemo(()=>({useMsal:t.useMsal??!1,msalInstance:t.useMsal?t.msalInstance??null:null,msalScopes:t.useMsal?t.msalScopes??[]:[]}),[t]);return n.useEffect(()=>{if(t.useMsal){const o=t.msalInstance.addEventCallback(c=>{if(c.eventType===l.EventType.LOGIN_SUCCESS||c.eventType===l.EventType.ACQUIRE_TOKEN_SUCCESS&&c.payload){const i=c.payload,u=i.account;t.msalInstance.setActiveAccount(u);const d=i.accessToken,x=i.expiresOn;s("Authorization",d,{path:"/",secure:!0,sameSite:"none",domain:r,expires:x??void 0})}});return()=>{o&&t.msalInstance.removeEventCallback(o)}}return()=>{}},[t,s,r]),e.jsxRuntimeExports.jsx(e.AuthContext.Provider,{value:a,children:t.useMsal?e.jsxRuntimeExports.jsx(k,{instance:t.msalInstance,children:t.children}):t.children})},U=()=>{const{confirmTexts:t}=n.useContext(e.LuminusComponentsContext),{onConfirm:r,onCancel:s,text:a,show:o}=v.useConfirm();return e.jsxRuntimeExports.jsx(l.Modal,{show:o,size:"sm",centered:!0,onHide:s,children:e.jsxRuntimeExports.jsxs(l.Modal.Body,{children:[e.jsxRuntimeExports.jsx("div",{className:"mb-5 text-center",children:e.jsxRuntimeExports.jsx(e.Typography,{variant:"h6",children:a})}),e.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary w-100",onClick:s,children:t.no}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary w-100 ml",onClick:r,children:t.yes})]})]})})};exports.AuthContext=e.AuthContext;exports.LoadingContext=e.LoadingContext;exports.LuminusComponentsContext=e.LuminusComponentsContext;exports.UserContext=e.UserContext;exports.AuthProvider=A;exports.LoadingProvider=j;exports.LuminusComponentsProvider=h;exports.UserProvider=N;
|
package/dist/contexts.es.js
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import { Q as T, ak as
|
|
2
|
-
import K, { useContext as
|
|
3
|
-
import { u as D, a as V } from "./useConfirm-
|
|
1
|
+
import { Q as T, ak as A, j as a, al as j, am as k, an as O, M as R, L as l, ao as U, ap as w, aq as p, a4 as M, a8 as _, aa as G, ar as z, Y as F } from "./NoInputContainer-CzSDOA31.js";
|
|
2
|
+
import K, { useContext as y, useState as h, useCallback as m, useEffect as I, useMemo as P, useRef as B, useReducer as H } from "react";
|
|
3
|
+
import { u as D, a as V } from "./useConfirm-C1e4wjoh.js";
|
|
4
4
|
import "react-hook-form";
|
|
5
|
-
import { M as v, L as $, E as u } from "./EventType-
|
|
5
|
+
import { M as v, L as $, E as u } from "./EventType-CYj5c_TM.js";
|
|
6
6
|
const q = () => {
|
|
7
|
-
const { confirmTexts: e } =
|
|
8
|
-
|
|
9
|
-
}, [
|
|
10
|
-
|
|
11
|
-
}, [
|
|
7
|
+
const { confirmTexts: e } = y(T), { isShown: s, text: t, onFinish: o } = D(), { options: n } = y(A), [r, c] = h(n.defaultValue ?? ""), i = m(() => {
|
|
8
|
+
o(null);
|
|
9
|
+
}, [o]), d = m(() => {
|
|
10
|
+
o(r);
|
|
11
|
+
}, [o, r]);
|
|
12
12
|
I(() => {
|
|
13
|
-
s === !0 &&
|
|
14
|
-
}, [s,
|
|
13
|
+
s === !0 && c(n.defaultValue ?? "");
|
|
14
|
+
}, [s, n.defaultValue]);
|
|
15
15
|
const g = P(() => ({
|
|
16
16
|
value: r,
|
|
17
|
-
onChange: (
|
|
17
|
+
onChange: (E) => c(E.currentTarget.value),
|
|
18
18
|
className: "w-100",
|
|
19
19
|
autoFocus: !0,
|
|
20
20
|
tabIndex: 0
|
|
21
21
|
}), [r]);
|
|
22
|
-
return /* @__PURE__ */ a.jsxs(v, { show: s, size: "sm", centered: !0, onHide:
|
|
22
|
+
return /* @__PURE__ */ a.jsxs(v, { show: s, size: "sm", centered: !0, onHide: i, children: [
|
|
23
23
|
/* @__PURE__ */ a.jsx(v.Header, { children: /* @__PURE__ */ a.jsx(v.Title, { children: t }) }),
|
|
24
24
|
/* @__PURE__ */ a.jsxs(v.Body, { children: [
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
n.input === "textarea" ? /* @__PURE__ */ a.jsx("textarea", { ...g, rows: 5 }) : void 0,
|
|
26
|
+
n.input === "input" ? /* @__PURE__ */ a.jsx("input", { ...g, type: n.type }) : void 0
|
|
27
27
|
] }),
|
|
28
28
|
/* @__PURE__ */ a.jsxs(v.Footer, { children: [
|
|
29
|
-
/* @__PURE__ */ a.jsx("button", { type: "button", className: "btn btn-secondary", onClick:
|
|
30
|
-
/* @__PURE__ */ a.jsx("button", { type: "button", className: "btn btn-primary ml", onClick: d, disabled:
|
|
29
|
+
/* @__PURE__ */ a.jsx("button", { type: "button", className: "btn btn-secondary", onClick: i, children: e.cancel }),
|
|
30
|
+
/* @__PURE__ */ a.jsx("button", { type: "button", className: "btn btn-primary ml", onClick: d, disabled: n.required && !r, children: e.confirm })
|
|
31
31
|
] })
|
|
32
32
|
] });
|
|
33
33
|
}, Q = ({ children: e }) => {
|
|
34
|
-
const [s, t] =
|
|
35
|
-
}), d =
|
|
36
|
-
|
|
37
|
-
}, []), g =
|
|
34
|
+
const [s, t] = h(!1), [o, n] = h(""), [r, c] = h({ input: "textarea", type: "text" }), i = B(() => {
|
|
35
|
+
}), d = m((C) => {
|
|
36
|
+
n(C), t(!0);
|
|
37
|
+
}, []), g = m(() => {
|
|
38
38
|
t(!1);
|
|
39
|
-
}, []),
|
|
39
|
+
}, []), E = P(() => ({
|
|
40
40
|
isShown: s,
|
|
41
|
-
text:
|
|
41
|
+
text: o,
|
|
42
42
|
showPrompt: d,
|
|
43
43
|
hidePrompt: g,
|
|
44
|
-
resolveRef:
|
|
44
|
+
resolveRef: i,
|
|
45
45
|
options: r,
|
|
46
|
-
setOptions:
|
|
47
|
-
}), [s,
|
|
48
|
-
return /* @__PURE__ */ a.jsxs(
|
|
46
|
+
setOptions: c
|
|
47
|
+
}), [s, o, d, g, r]);
|
|
48
|
+
return /* @__PURE__ */ a.jsxs(A.Provider, { value: E, children: [
|
|
49
49
|
e,
|
|
50
50
|
/* @__PURE__ */ a.jsx(q, {})
|
|
51
51
|
] });
|
|
52
52
|
}, J = ({ children: e }) => {
|
|
53
|
-
const [s, t] =
|
|
54
|
-
t(!0),
|
|
55
|
-
}, []),
|
|
53
|
+
const [s, t] = h(!1), [o, n] = h(""), r = m((d) => {
|
|
54
|
+
t(!0), n(d);
|
|
55
|
+
}, []), c = m(() => {
|
|
56
56
|
t(!1);
|
|
57
|
-
}, []),
|
|
58
|
-
return /* @__PURE__ */ a.jsxs(
|
|
57
|
+
}, []), i = P(() => ({ show: s, text: o, showConfirm: r, hideConfirm: c }), [s, o, r, c]);
|
|
58
|
+
return /* @__PURE__ */ a.jsxs(j.Provider, { value: i, children: [
|
|
59
59
|
/* @__PURE__ */ a.jsx(ee, {}),
|
|
60
60
|
e
|
|
61
61
|
] });
|
|
62
|
-
}, ae = ({ cookieDomain: e, axiosInstance: s, LinkComponent: t, NavigateComponent:
|
|
63
|
-
const
|
|
62
|
+
}, ae = ({ cookieDomain: e, axiosInstance: s, LinkComponent: t, NavigateComponent: o, language: n, axiosTexts: r, confirmTexts: c, formValidationTexts: i, homeDashboardTexts: d, formSubmitTexts: g, appSearchTexts: E, customSelectTexts: C, children: N }) => {
|
|
63
|
+
const f = P(() => ({
|
|
64
64
|
axiosInstance: s,
|
|
65
65
|
cookieDomain: e,
|
|
66
66
|
LinkComponent: t,
|
|
67
|
-
NavigateComponent:
|
|
68
|
-
language:
|
|
67
|
+
NavigateComponent: o,
|
|
68
|
+
language: n,
|
|
69
69
|
axiosTexts: r,
|
|
70
|
-
confirmTexts:
|
|
71
|
-
formValidationTexts:
|
|
70
|
+
confirmTexts: c,
|
|
71
|
+
formValidationTexts: i,
|
|
72
72
|
homeDashboardTexts: d,
|
|
73
73
|
formSubmitTexts: g,
|
|
74
|
-
appSearchTexts:
|
|
75
|
-
customSelectTexts:
|
|
74
|
+
appSearchTexts: E,
|
|
75
|
+
customSelectTexts: C
|
|
76
76
|
}), [
|
|
77
77
|
s,
|
|
78
78
|
e,
|
|
79
79
|
t,
|
|
80
|
-
n,
|
|
81
80
|
o,
|
|
81
|
+
n,
|
|
82
82
|
r,
|
|
83
|
-
i,
|
|
84
83
|
c,
|
|
84
|
+
i,
|
|
85
85
|
d,
|
|
86
86
|
g,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
E,
|
|
88
|
+
C
|
|
89
89
|
]);
|
|
90
|
-
return /* @__PURE__ */ a.jsx(T.Provider, { value:
|
|
91
|
-
/* @__PURE__ */ a.jsx(
|
|
90
|
+
return /* @__PURE__ */ a.jsx(T.Provider, { value: f, children: /* @__PURE__ */ a.jsx(J, { children: /* @__PURE__ */ a.jsxs(Q, { children: [
|
|
91
|
+
/* @__PURE__ */ a.jsx(k, {}),
|
|
92
92
|
N
|
|
93
93
|
] }) }) });
|
|
94
94
|
}, ce = ({ children: e }) => {
|
|
95
|
-
const [s, t] =
|
|
96
|
-
|
|
97
|
-
}, [
|
|
98
|
-
|
|
99
|
-
}, [
|
|
100
|
-
return /* @__PURE__ */ a.jsxs(
|
|
95
|
+
const [s, t] = h(!1), [o] = h(/* @__PURE__ */ new Set()), n = m((i) => {
|
|
96
|
+
o.add(i), t(!0);
|
|
97
|
+
}, [o]), r = m((i) => {
|
|
98
|
+
o.delete(i), o.size === 0 && t(!1);
|
|
99
|
+
}, [o]), c = P(() => ({ isLoading: s, startLoading: n, stopLoading: r }), [s, n, r]);
|
|
100
|
+
return /* @__PURE__ */ a.jsxs(O.Provider, { value: c, children: [
|
|
101
101
|
s && /* @__PURE__ */ a.jsx($, {}),
|
|
102
102
|
e
|
|
103
103
|
] });
|
|
@@ -116,7 +116,7 @@ class W {
|
|
|
116
116
|
case u.SSO_SILENT_START:
|
|
117
117
|
return l.SsoSilent;
|
|
118
118
|
case u.ACQUIRE_TOKEN_START:
|
|
119
|
-
if (s.interactionType ===
|
|
119
|
+
if (s.interactionType === R.Redirect || s.interactionType === R.Popup)
|
|
120
120
|
return l.AcquireToken;
|
|
121
121
|
break;
|
|
122
122
|
case u.HANDLE_REDIRECT_START:
|
|
@@ -141,7 +141,7 @@ class W {
|
|
|
141
141
|
case u.ACQUIRE_TOKEN_SUCCESS:
|
|
142
142
|
case u.ACQUIRE_TOKEN_FAILURE:
|
|
143
143
|
case u.RESTORE_FROM_BFCACHE:
|
|
144
|
-
if (s.interactionType ===
|
|
144
|
+
if (s.interactionType === R.Redirect || s.interactionType === R.Popup) {
|
|
145
145
|
if (t && t !== l.Login && t !== l.AcquireToken)
|
|
146
146
|
break;
|
|
147
147
|
return l.None;
|
|
@@ -154,31 +154,31 @@ class W {
|
|
|
154
154
|
/*! @azure/msal-react v2.0.16 2024-05-07 */
|
|
155
155
|
const Y = "@azure/msal-react", L = "2.0.16";
|
|
156
156
|
/*! @azure/msal-react v2.0.16 2024-05-07 */
|
|
157
|
-
const
|
|
157
|
+
const S = {
|
|
158
158
|
UNBLOCK_INPROGRESS: "UNBLOCK_INPROGRESS",
|
|
159
159
|
EVENT: "EVENT"
|
|
160
160
|
}, X = (e, s) => {
|
|
161
|
-
const { type: t, payload:
|
|
162
|
-
let
|
|
161
|
+
const { type: t, payload: o } = s;
|
|
162
|
+
let n = e.inProgress;
|
|
163
163
|
switch (t) {
|
|
164
|
-
case
|
|
165
|
-
e.inProgress === l.Startup && (
|
|
164
|
+
case S.UNBLOCK_INPROGRESS:
|
|
165
|
+
e.inProgress === l.Startup && (n = l.None, o.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));
|
|
166
166
|
break;
|
|
167
|
-
case
|
|
168
|
-
const
|
|
169
|
-
|
|
167
|
+
case S.EVENT:
|
|
168
|
+
const c = o.message, i = W.getInteractionStatusFromEvent(c, e.inProgress);
|
|
169
|
+
i && (o.logger.info(`MsalProvider - ${c.eventType} results in setting inProgress from ${e.inProgress} to ${i}`), n = i);
|
|
170
170
|
break;
|
|
171
171
|
default:
|
|
172
172
|
throw new Error(`Unknown action type: ${t}`);
|
|
173
173
|
}
|
|
174
|
-
const r =
|
|
175
|
-
return
|
|
174
|
+
const r = o.instance.getAllAccounts();
|
|
175
|
+
return n !== e.inProgress && !p(r, e.accounts) ? {
|
|
176
176
|
...e,
|
|
177
|
-
inProgress:
|
|
177
|
+
inProgress: n,
|
|
178
178
|
accounts: r
|
|
179
|
-
} :
|
|
179
|
+
} : n !== e.inProgress ? {
|
|
180
180
|
...e,
|
|
181
|
-
inProgress:
|
|
181
|
+
inProgress: n
|
|
182
182
|
} : p(r, e.accounts) ? e : {
|
|
183
183
|
...e,
|
|
184
184
|
accounts: r
|
|
@@ -188,118 +188,115 @@ function Z({ instance: e, children: s }) {
|
|
|
188
188
|
I(() => {
|
|
189
189
|
e.initializeWrapperLibrary(U.React, L);
|
|
190
190
|
}, [e]);
|
|
191
|
-
const t = P(() => e.getLogger().clone(Y, L), [e]), [
|
|
191
|
+
const t = P(() => e.getLogger().clone(Y, L), [e]), [o, n] = H(X, void 0, () => ({
|
|
192
192
|
inProgress: l.Startup,
|
|
193
193
|
accounts: e.getAllAccounts()
|
|
194
194
|
}));
|
|
195
195
|
I(() => {
|
|
196
|
-
const
|
|
197
|
-
|
|
196
|
+
const c = e.addEventCallback((i) => {
|
|
197
|
+
n({
|
|
198
198
|
payload: {
|
|
199
199
|
instance: e,
|
|
200
200
|
logger: t,
|
|
201
|
-
message:
|
|
201
|
+
message: i
|
|
202
202
|
},
|
|
203
|
-
type:
|
|
203
|
+
type: S.EVENT
|
|
204
204
|
});
|
|
205
205
|
});
|
|
206
|
-
return t.verbose(`MsalProvider - Registered event callback with id: ${
|
|
206
|
+
return t.verbose(`MsalProvider - Registered event callback with id: ${c}`), e.initialize().then(() => {
|
|
207
207
|
e.handleRedirectPromise().catch(() => {
|
|
208
208
|
}).finally(() => {
|
|
209
|
-
|
|
209
|
+
n({
|
|
210
210
|
payload: {
|
|
211
211
|
instance: e,
|
|
212
212
|
logger: t
|
|
213
213
|
},
|
|
214
|
-
type:
|
|
214
|
+
type: S.UNBLOCK_INPROGRESS
|
|
215
215
|
});
|
|
216
216
|
});
|
|
217
217
|
}).catch(() => {
|
|
218
218
|
}), () => {
|
|
219
|
-
|
|
219
|
+
c && (t.verbose(`MsalProvider - Removing event callback ${c}`), e.removeEventCallback(c));
|
|
220
220
|
};
|
|
221
221
|
}, [e, t]);
|
|
222
222
|
const r = {
|
|
223
223
|
instance: e,
|
|
224
|
-
inProgress:
|
|
225
|
-
accounts:
|
|
224
|
+
inProgress: o.inProgress,
|
|
225
|
+
accounts: o.accounts,
|
|
226
226
|
logger: t
|
|
227
227
|
};
|
|
228
228
|
return K.createElement(w.Provider, { value: r }, s);
|
|
229
229
|
}
|
|
230
230
|
const ie = ({ children: e }) => {
|
|
231
|
-
const s = M(), { msalInstance: t } =
|
|
232
|
-
const
|
|
233
|
-
return
|
|
234
|
-
}, []), [
|
|
235
|
-
let
|
|
236
|
-
return await s.get("/user/detail",
|
|
237
|
-
|
|
231
|
+
const s = M(), { msalInstance: t } = y(_), [o, n] = h(!1), r = m(() => {
|
|
232
|
+
const f = localStorage.getItem("user") ?? null;
|
|
233
|
+
return f ? JSON.parse(f) : null;
|
|
234
|
+
}, []), [c, i] = h(r()), d = m(async (f) => {
|
|
235
|
+
let x = null;
|
|
236
|
+
return await s.get("/user/detail", f ? { headers: { Authorization: `Bearer ${f}` } } : void 0).then((b) => {
|
|
237
|
+
x = b.data;
|
|
238
238
|
}).catch(() => {
|
|
239
|
-
|
|
240
|
-
}), localStorage.setItem("user", JSON.stringify(
|
|
241
|
-
}, [s]), g =
|
|
239
|
+
x = null;
|
|
240
|
+
}), localStorage.setItem("user", JSON.stringify(x)), x;
|
|
241
|
+
}, [s]), g = m(() => {
|
|
242
242
|
localStorage.removeItem("user");
|
|
243
|
-
}, []),
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
return
|
|
247
|
-
}, [d]),
|
|
248
|
-
g(),
|
|
249
|
-
}, [g]), N = P(() => ({ user:
|
|
243
|
+
}, []), E = m(async (f) => {
|
|
244
|
+
n(!0);
|
|
245
|
+
const x = await d(f);
|
|
246
|
+
return n(!1), x ? (i(x), !0) : !1;
|
|
247
|
+
}, [d]), C = m(() => {
|
|
248
|
+
g(), i(null);
|
|
249
|
+
}, [g]), N = P(() => ({ user: c, loggingInProgress: o, loginUser: E, logoutUser: C }), [c, E, C, o]);
|
|
250
250
|
return I(() => {
|
|
251
|
-
|
|
251
|
+
i(r());
|
|
252
252
|
}, [r]), I(() => {
|
|
253
253
|
if (t) {
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
const b =
|
|
257
|
-
|
|
254
|
+
const f = t.addEventCallback((x) => {
|
|
255
|
+
if (x.eventType === u.LOGIN_SUCCESS && x.payload) {
|
|
256
|
+
const b = x.payload;
|
|
257
|
+
E(b.accessToken).catch(() => C());
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
return () => {
|
|
261
|
-
|
|
261
|
+
f && t.removeEventCallback(f);
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
264
|
return () => {
|
|
265
265
|
};
|
|
266
|
-
}, [t,
|
|
266
|
+
}, [t, E, C]), /* @__PURE__ */ a.jsx(G.Provider, { value: N, children: e });
|
|
267
267
|
}, le = ({ ...e }) => {
|
|
268
|
-
const { cookieDomain: s } =
|
|
268
|
+
const { cookieDomain: s } = y(T), [, t] = z(["Authorization"]), o = P(() => ({
|
|
269
269
|
useMsal: e.useMsal ?? !1,
|
|
270
|
-
storedToken: (n == null ? void 0 : n.token) ?? null,
|
|
271
270
|
msalInstance: e.useMsal ? e.msalInstance ?? null : null,
|
|
272
271
|
msalScopes: e.useMsal ? e.msalScopes ?? [] : []
|
|
273
|
-
}), [e
|
|
272
|
+
}), [e]);
|
|
274
273
|
return I(() => {
|
|
275
274
|
if (e.useMsal) {
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
278
|
-
const
|
|
279
|
-
e.msalInstance.setActiveAccount(
|
|
280
|
-
const
|
|
281
|
-
|
|
275
|
+
const n = e.msalInstance.addEventCallback((r) => {
|
|
276
|
+
if (r.eventType === u.LOGIN_SUCCESS || r.eventType === u.ACQUIRE_TOKEN_SUCCESS && r.payload) {
|
|
277
|
+
const c = r.payload, i = c.account;
|
|
278
|
+
e.msalInstance.setActiveAccount(i);
|
|
279
|
+
const d = c.accessToken, g = c.expiresOn;
|
|
280
|
+
t("Authorization", d, {
|
|
281
|
+
path: "/",
|
|
282
|
+
secure: !0,
|
|
283
|
+
sameSite: "none",
|
|
284
|
+
domain: s,
|
|
285
|
+
expires: g ?? void 0
|
|
286
|
+
});
|
|
282
287
|
}
|
|
283
288
|
});
|
|
284
289
|
return () => {
|
|
285
|
-
|
|
290
|
+
n && e.msalInstance.removeEventCallback(n);
|
|
286
291
|
};
|
|
287
292
|
}
|
|
288
293
|
return () => {
|
|
289
294
|
};
|
|
290
|
-
}, [e]),
|
|
291
|
-
n && t("Authorization", n.token, {
|
|
292
|
-
path: "/",
|
|
293
|
-
secure: !0,
|
|
294
|
-
sameSite: "none",
|
|
295
|
-
domain: s,
|
|
296
|
-
expires: n.expiresOn ?? void 0
|
|
297
|
-
});
|
|
298
|
-
}, [n, s, t]), /* @__PURE__ */ a.jsx(A.Provider, { value: r, children: e.useMsal ? /* @__PURE__ */ a.jsx(Z, { instance: e.msalInstance, children: e.children }) : e.children });
|
|
295
|
+
}, [e, t, s]), /* @__PURE__ */ a.jsx(_.Provider, { value: o, children: e.useMsal ? /* @__PURE__ */ a.jsx(Z, { instance: e.msalInstance, children: e.children }) : e.children });
|
|
299
296
|
}, ee = () => {
|
|
300
|
-
const { confirmTexts: e } =
|
|
301
|
-
return /* @__PURE__ */ a.jsx(v, { show:
|
|
302
|
-
/* @__PURE__ */ a.jsx("div", { className: "mb-5 text-center", children: /* @__PURE__ */ a.jsx(F, { variant: "h6", children:
|
|
297
|
+
const { confirmTexts: e } = y(T), { onConfirm: s, onCancel: t, text: o, show: n } = V();
|
|
298
|
+
return /* @__PURE__ */ a.jsx(v, { show: n, size: "sm", centered: !0, onHide: t, children: /* @__PURE__ */ a.jsxs(v.Body, { children: [
|
|
299
|
+
/* @__PURE__ */ a.jsx("div", { className: "mb-5 text-center", children: /* @__PURE__ */ a.jsx(F, { variant: "h6", children: o }) }),
|
|
303
300
|
/* @__PURE__ */ a.jsxs("div", { className: "w-100 d-flex gap-5", children: [
|
|
304
301
|
/* @__PURE__ */ a.jsx("button", { type: "button", className: "btn btn-secondary w-100", onClick: t, children: e.no }),
|
|
305
302
|
/* @__PURE__ */ a.jsx("button", { type: "button", className: "btn btn-primary w-100 ml", onClick: s, children: e.yes })
|
|
@@ -307,9 +304,9 @@ const ie = ({ children: e }) => {
|
|
|
307
304
|
] }) });
|
|
308
305
|
};
|
|
309
306
|
export {
|
|
310
|
-
|
|
307
|
+
_ as AuthContext,
|
|
311
308
|
le as AuthProvider,
|
|
312
|
-
|
|
309
|
+
O as LoadingContext,
|
|
313
310
|
ce as LoadingProvider,
|
|
314
311
|
T as LuminusComponentsContext,
|
|
315
312
|
ae as LuminusComponentsProvider,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const useAuth: () => {
|
|
2
2
|
isAuthenticated: () => boolean;
|
|
3
3
|
isAuthenticating: () => boolean;
|
|
4
|
-
getToken: () => string | null;
|
|
4
|
+
getToken: (() => string | null) | (() => Promise<string | null>);
|
|
5
5
|
login: (kid: string, password: string) => Promise<string | null>;
|
|
6
6
|
logout: () => void;
|
|
7
7
|
};
|