react-luminus-components 1.3.20 → 1.3.22

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