react-luminus-components 1.3.22 → 1.3.23

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.
@@ -1,9 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import { NameIdIntModel } from '@models/index';
2
3
  interface IDelegationContext {
3
- delegationId: number | null;
4
- setDelegationId: (delegationId: number | null) => void;
5
- delegationEmployeeName: string | null;
6
- setDelegationEmployeeName: React.Dispatch<React.SetStateAction<string | null>>;
4
+ delegation: NameIdIntModel | null;
5
+ setDelegation: React.Dispatch<React.SetStateAction<NameIdIntModel | null>>;
7
6
  }
8
7
  declare const DelegationContext: import("react").Context<IDelegationContext>;
9
8
  export default DelegationContext;
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./UserAvatarToggle-DJWp7_0z.cjs"),n=require("react");require("./latinize-DaqzUOla.cjs");require("react-hook-form");const T=require("./useLocalStorageState-CkEIA-gx.cjs"),c=require("./PrimaryButton-Cx3E5x2b.cjs"),h=({children:t})=>{const[i,s]=n.useState(!1),[r,o]=n.useState(""),a=n.useCallback(d=>{s(!0),o(d)},[]),u=n.useCallback(()=>{s(!1)},[]),l=n.useMemo(()=>({show:i,text:r,showConfirm:a,hideConfirm:u}),[i,r,a,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:i,text:s,onFinish:r}=T.usePrompt(),{options:o}=n.useContext(e.PromptContext),[a,u]=n.useState(o.defaultValue??""),l=n.useCallback(()=>{r(null)},[r]),d=n.useCallback(m=>{m.preventDefault(),!(o.required&&!a)&&r(a)},[r,o.required,a]);n.useEffect(()=>{i===!0&&u(o.defaultValue??"")},[i,o.defaultValue]);const E=n.useMemo(()=>({value:a,onChange:m=>u(m.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[a]);return e.jsxRuntimeExports.jsxs(c.Modal,{show:i,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",{...E,rows:5}):void 0,o.input==="input"?e.jsxRuntimeExports.jsx(c.FormControl,{...E,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&&!a,type:"submit",className:"flex-grow-1",children:t.confirm})]})]})]})},N=({children:t})=>{const[i,s]=n.useState(!1),[r,o]=n.useState(""),[a,u]=n.useState({input:"textarea",type:"text"}),l=n.useRef(()=>{}),d=n.useCallback(S=>{o(S),s(!0)},[]),E=n.useCallback(()=>{s(!1)},[]),m=n.useMemo(()=>({isShown:i,text:r,showPrompt:d,hidePrompt:E,resolveRef:l,options:a,setOptions:u}),[i,r,d,E,a]);return e.jsxRuntimeExports.jsxs(e.PromptContext.Provider,{value:m,children:[t,e.jsxRuntimeExports.jsx(L,{})]})},k=({cookieDomain:t,axiosOptions:i,LinkComponent:s,NavigateComponent:r,language:o,axiosTexts:a,confirmTexts:u,formValidationTexts:l,homeDashboardTexts:d,formSubmitTexts:E,appSearchTexts:m,customSelectTexts:S,errorBoundaryTexts:g,widgetTexts:f,children:R})=>{const p=n.useMemo(()=>({axiosOptions:i,cookieDomain:t,LinkComponent:s,NavigateComponent:r,language:o,axiosTexts:a,confirmTexts:u,formValidationTexts:l,homeDashboardTexts:d,formSubmitTexts:E,appSearchTexts:m,customSelectTexts:S,errorBoundaryTexts:g,widgetTexts:f}),[i,t,s,r,o,a,u,l,d,E,m,S,g,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,{}),R]})})})},A=({children:t})=>{const[i,s]=n.useState(!1),[r]=n.useState(new Set),o=n.useCallback(l=>{r.add(l),s(!0)},[r]),a=n.useCallback(l=>{r.delete(l),r.size===0&&s(!1)},[r]),u=n.useMemo(()=>({isLoading:i,startLoading:o,stopLoading:a}),[i,o,a]);return e.jsxRuntimeExports.jsxs(e.LoadingContext.Provider,{value:u,children:[i&&e.jsxRuntimeExports.jsx(c.Loading,{}),t]})};/*! @azure/msal-browser v3.14.0 2024-05-07 */class b{static getInteractionStatusFromEvent(i,s){switch(i.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(i.interactionType===e.InteractionType.Redirect||i.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(i.interactionType===e.InteractionType.Redirect||i.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 I={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},U=(t,i)=>{const{type:s,payload:r}=i;let o=t.inProgress;switch(s){case I.UNBLOCK_INPROGRESS:t.inProgress===e.InteractionStatus.Startup&&(o=e.InteractionStatus.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case I.EVENT:const u=r.message,l=b.getInteractionStatusFromEvent(u,t.inProgress);l&&(r.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 a=r.instance.getAllAccounts();return o!==t.inProgress&&!e.accountArraysAreEqual(a,t.accounts)?{...t,inProgress:o,accounts:a}:o!==t.inProgress?{...t,inProgress:o}:e.accountArraysAreEqual(a,t.accounts)?t:{...t,accounts:a}};function _({instance:t,children:i}){n.useEffect(()=>{t.initializeWrapperLibrary(e.WrapperSKU.React,j)},[t]);const s=n.useMemo(()=>t.getLogger().clone(O,j),[t]),[r,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:I.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:I.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{u&&(s.verbose(`MsalProvider - Removing event callback ${u}`),t.removeEventCallback(u))}},[t,s]);const a={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:s};return n.createElement(e.MsalContext.Provider,{value:a},i)}const M=({children:t})=>{const i=e.useAxios(),{msalInstance:s}=n.useContext(e.AuthContext),{delegation:r,setDelegation:o}=n.useContext(e.DelegationContext),{getToken:a}=e.useAuth(),[u,l]=n.useState(null),d=n.useCallback(async()=>{const x=await a();x&&l(x)},[a]);n.useEffect(()=>{d()},[d]);const m=n.useCallback(()=>{const x=localStorage.getItem("user")??null;return x?JSON.parse(x??""):null},[])(),[S,g]=n.useState({state:m?e.LoginState.LOGGED_IN:e.LoginState.LOGGING_IN,user:m}),f=n.useCallback(async x=>{let C=null;return await i.get("/user/detail",x?{headers:{Authorization:`Bearer ${x}`}}:void 0).then(y=>{C=y.data}).catch(()=>{C=null}),C},[i]),R=n.useCallback(()=>{localStorage.removeItem("user"),g({state:e.LoginState.LOGGED_OUT,user:null})},[]),p=n.useCallback(async x=>{g({state:e.LoginState.LOGGING_IN,user:null});const C=await f(x);return C?(g({state:e.LoginState.LOGGED_IN,user:C}),localStorage.setItem("user",JSON.stringify(C)),!0):(g({state:e.LoginState.LOGIN_FAILED,user:null}),!1)},[f]),v=n.useCallback(()=>{R()},[R]),P=n.useMemo(()=>({user:S.user,userLoginState:S,loginUser:p,logoutUser:v}),[S,p,v]);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,v]),n.useEffect(()=>{u&&p(u).catch(()=>{v(),o(null)})},[u,p,v,r==null?void 0:r.id,o]),e.jsxRuntimeExports.jsx(e.UserContext.Provider,{value:P,children:t})},w=({...t})=>{const{cookieDomain:i}=n.useContext(e.LuminusComponentsContext),[,s]=e.useCookies(["Authorization"]),r=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(a=>{if(a.eventType===c.EventType.LOGIN_SUCCESS||a.eventType===c.EventType.ACQUIRE_TOKEN_SUCCESS&&a.payload){const u=a.payload,l=u.account;t.msalInstance.setActiveAccount(l);const d=u.accessToken,E=u.expiresOn;s("Authorization",d,{path:"/",secure:!0,sameSite:"none",domain:i,expires:E??void 0})}a.error&&console.error("AuthProvider MSAL Error",a)});return()=>{o&&t.msalInstance.removeEventCallback(o)}}return()=>{}},[t,s,i]),e.jsxRuntimeExports.jsx(e.AuthContext.Provider,{value:r,children:t.useMsal?e.jsxRuntimeExports.jsx(_,{instance:t.msalInstance,children:t.children}):t.children})},G=({children:t})=>{const[i,s,r]=T.useLocalStorageState("user-delegation",null);n.useEffect(()=>{const a=()=>{r()};return window.addEventListener("focus",a),()=>{window.removeEventListener("focus",a)}},[r]);const o=n.useMemo(()=>({delegation:i,setDelegation:s}),[i,s]);return e.jsxRuntimeExports.jsx(e.DelegationContext.Provider,{value:o,children:t})},D=()=>{const{confirmTexts:t}=n.useContext(e.LuminusComponentsContext),{onConfirm:i,onCancel:s,text:r,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:r})}),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:i,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,111 +1,111 @@
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 F, Q as j, an as b, ao as z, ap as K, L as A, K as l, aq as H, ar as B, as as U, ab as q, ae as G, at as M, af as V, ah as L, ag as $, au as Q } from "./UserAvatarToggle-CsTHq7yG.js";
2
+ import J, { useState as h, useCallback as f, useMemo as S, useContext as y, useEffect as P, useRef as W, useReducer as X } from "react";
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";
5
+ import { u as Y, a as Z, b as ee } from "./useLocalStorageState-Cg6ipags.js";
6
+ import { M as C, b as te, P as p, L as ne, E as u } from "./PrimaryButton-DJLMLJJ7.js";
7
7
  const se = ({ children: e }) => {
8
- const [o, t] = h(!1), [r, n] = h(""), s = m((d) => {
8
+ const [r, t] = h(!1), [s, n] = h(""), o = f((d) => {
9
9
  t(!0), n(d);
10
- }, []), c = m(() => {
10
+ }, []), c = f(() => {
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: [
12
+ }, []), i = S(() => ({ show: r, text: s, showConfirm: o, hideConfirm: c }), [r, s, o, c]);
13
+ return /* @__PURE__ */ a.jsxs(F.Provider, { value: i, children: [
14
14
  /* @__PURE__ */ a.jsx(ue, {}),
15
15
  e
16
16
  ] });
17
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]);
18
+ const { confirmTexts: e } = y(j), { isShown: r, text: t, onFinish: s } = Y(), { options: n } = y(b), [o, c] = h(n.defaultValue ?? ""), i = f(() => {
19
+ s(null);
20
+ }, [s]), d = f((E) => {
21
+ E.preventDefault(), !(n.required && !o) && s(o);
22
+ }, [s, n.required, o]);
23
23
  P(() => {
24
- o === !0 && c(n.defaultValue ?? "");
25
- }, [o, n.defaultValue]);
26
- const f = C(() => ({
27
- value: s,
24
+ r === !0 && c(n.defaultValue ?? "");
25
+ }, [r, n.defaultValue]);
26
+ const g = 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(C, { show: r, size: "sm", centered: !0, onHide: i, children: [
34
+ /* @__PURE__ */ a.jsx(C.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(C.Title, { children: t }) }),
35
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(C.Body, { children: [
37
+ n.input === "textarea" ? /* @__PURE__ */ a.jsx("textarea", { ...g, rows: 5 }) : void 0,
38
+ n.input === "input" ? /* @__PURE__ */ a.jsx(te, { ...g, type: n.type }) : void 0
39
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(C.Footer, { className: "w-100 d-flex gap-5", children: [
41
+ /* @__PURE__ */ a.jsx(p, { variant: "outlined", color: "secondary", onClick: i, className: "flex-grow-1", children: e.cancel }),
42
+ /* @__PURE__ */ a.jsx(p, { color: "primary", disabled: n.required && !o, type: "submit", className: "flex-grow-1", children: e.confirm })
43
43
  ] })
44
44
  ] })
45
45
  ] });
46
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(() => {
47
+ const [r, t] = h(!1), [s, n] = h(""), [o, c] = h({ input: "textarea", type: "text" }), i = W(() => {
48
+ }), d = f((I) => {
49
+ n(I), t(!0);
50
+ }, []), g = f(() => {
51
51
  t(!1);
52
- }, []), E = C(() => ({
53
- isShown: o,
54
- text: r,
52
+ }, []), E = S(() => ({
53
+ isShown: r,
54
+ text: s,
55
55
  showPrompt: d,
56
- hidePrompt: f,
57
- resolveRef: l,
58
- options: s,
56
+ hidePrompt: g,
57
+ resolveRef: i,
58
+ options: o,
59
59
  setOptions: c
60
- }), [o, r, d, f, s]);
60
+ }), [r, s, d, g, o]);
61
61
  return /* @__PURE__ */ a.jsxs(b.Provider, { value: E, children: [
62
62
  e,
63
63
  /* @__PURE__ */ a.jsx(oe, {})
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
+ }, he = ({ cookieDomain: e, axiosOptions: r, LinkComponent: t, NavigateComponent: s, language: n, axiosTexts: o, confirmTexts: c, formValidationTexts: i, homeDashboardTexts: d, formSubmitTexts: g, appSearchTexts: E, customSelectTexts: I, errorBoundaryTexts: v, widgetTexts: R, children: _ }) => {
66
+ const N = S(() => ({
67
+ axiosOptions: r,
68
68
  cookieDomain: e,
69
69
  LinkComponent: t,
70
- NavigateComponent: r,
70
+ NavigateComponent: s,
71
71
  language: n,
72
- axiosTexts: s,
72
+ axiosTexts: o,
73
73
  confirmTexts: c,
74
- formValidationTexts: l,
74
+ formValidationTexts: i,
75
75
  homeDashboardTexts: d,
76
- formSubmitTexts: f,
76
+ formSubmitTexts: g,
77
77
  appSearchTexts: E,
78
- customSelectTexts: S,
78
+ customSelectTexts: I,
79
79
  errorBoundaryTexts: v,
80
80
  widgetTexts: R
81
81
  }), [
82
- o,
82
+ r,
83
83
  e,
84
84
  t,
85
- r,
86
- n,
87
85
  s,
86
+ n,
87
+ o,
88
88
  c,
89
- l,
89
+ i,
90
90
  d,
91
- f,
91
+ g,
92
92
  E,
93
- S,
93
+ I,
94
94
  v,
95
95
  R
96
96
  ]);
97
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
- p
99
+ _
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]);
101
+ }, Ce = ({ children: e }) => {
102
+ const [r, t] = h(!1), [s] = h(/* @__PURE__ */ new Set()), n = f((i) => {
103
+ s.add(i), t(!0);
104
+ }, [s]), o = f((i) => {
105
+ s.delete(i), s.size === 0 && t(!1);
106
+ }, [s]), c = S(() => ({ isLoading: r, startLoading: n, stopLoading: o }), [r, n, o]);
107
107
  return /* @__PURE__ */ a.jsxs(K.Provider, { value: c, children: [
108
- o && /* @__PURE__ */ a.jsx(ne, {}),
108
+ r && /* @__PURE__ */ a.jsx(ne, {}),
109
109
  e
110
110
  ] });
111
111
  };
@@ -116,42 +116,42 @@ class ae {
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
- return i.Login;
122
+ return l.Login;
123
123
  case u.SSO_SILENT_START:
124
- return i.SsoSilent;
124
+ return l.SsoSilent;
125
125
  case u.ACQUIRE_TOKEN_START:
126
- if (o.interactionType === _.Redirect || o.interactionType === _.Popup)
127
- return i.AcquireToken;
126
+ if (r.interactionType === A.Redirect || r.interactionType === A.Popup)
127
+ return l.AcquireToken;
128
128
  break;
129
129
  case u.HANDLE_REDIRECT_START:
130
- return i.HandleRedirect;
130
+ return l.HandleRedirect;
131
131
  case u.LOGOUT_START:
132
- return i.Logout;
132
+ return l.Logout;
133
133
  case u.SSO_SILENT_SUCCESS:
134
134
  case u.SSO_SILENT_FAILURE:
135
- if (t && t !== i.SsoSilent)
135
+ if (t && t !== l.SsoSilent)
136
136
  break;
137
- return i.None;
137
+ return l.None;
138
138
  case u.LOGOUT_END:
139
- if (t && t !== i.Logout)
139
+ if (t && t !== l.Logout)
140
140
  break;
141
- return i.None;
141
+ return l.None;
142
142
  case u.HANDLE_REDIRECT_END:
143
- if (t && t !== i.HandleRedirect)
143
+ if (t && t !== l.HandleRedirect)
144
144
  break;
145
- return i.None;
145
+ return l.None;
146
146
  case u.LOGIN_SUCCESS:
147
147
  case u.LOGIN_FAILURE:
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) {
152
- if (t && t !== i.Login && t !== i.AcquireToken)
151
+ if (r.interactionType === A.Redirect || r.interactionType === A.Popup) {
152
+ if (t && t !== l.Login && t !== l.AcquireToken)
153
153
  break;
154
- return i.None;
154
+ return l.None;
155
155
  }
156
156
  break;
157
157
  }
@@ -164,48 +164,48 @@ const ce = "@azure/msal-react", w = "2.0.16";
164
164
  const O = {
165
165
  UNBLOCK_INPROGRESS: "UNBLOCK_INPROGRESS",
166
166
  EVENT: "EVENT"
167
- }, le = (e, o) => {
168
- const { type: t, payload: r } = o;
167
+ }, ie = (e, r) => {
168
+ const { type: t, payload: s } = r;
169
169
  let n = e.inProgress;
170
170
  switch (t) {
171
171
  case O.UNBLOCK_INPROGRESS:
172
- e.inProgress === i.Startup && (n = i.None, r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));
172
+ e.inProgress === l.Startup && (n = l.None, s.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));
173
173
  break;
174
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);
175
+ const c = s.message, i = ae.getInteractionStatusFromEvent(c, e.inProgress);
176
+ i && (s.logger.info(`MsalProvider - ${c.eventType} results in setting inProgress from ${e.inProgress} to ${i}`), n = i);
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 = s.instance.getAllAccounts();
182
+ return n !== e.inProgress && !U(o, e.accounts) ? {
183
183
  ...e,
184
184
  inProgress: n,
185
- accounts: s
185
+ accounts: o
186
186
  } : n !== e.inProgress ? {
187
187
  ...e,
188
188
  inProgress: n
189
- } : U(s, e.accounts) ? e : {
189
+ } : U(o, e.accounts) ? e : {
190
190
  ...e,
191
- accounts: s
191
+ accounts: o
192
192
  };
193
193
  };
194
- function ie({ instance: e, children: o }) {
194
+ function le({ instance: e, children: r }) {
195
195
  P(() => {
196
196
  e.initializeWrapperLibrary(H.React, w);
197
197
  }, [e]);
198
- const t = C(() => e.getLogger().clone(ce, w), [e]), [r, n] = X(le, void 0, () => ({
199
- inProgress: i.Startup,
198
+ const t = S(() => e.getLogger().clone(ce, w), [e]), [s, n] = X(ie, void 0, () => ({
199
+ inProgress: l.Startup,
200
200
  accounts: e.getAllAccounts()
201
201
  }));
202
202
  P(() => {
203
- const c = e.addEventCallback((l) => {
203
+ const c = e.addEventCallback((i) => {
204
204
  n({
205
205
  payload: {
206
206
  instance: e,
207
207
  logger: t,
208
- message: l
208
+ message: i
209
209
  },
210
210
  type: O.EVENT
211
211
  });
@@ -226,46 +226,46 @@ 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: s.inProgress,
232
+ accounts: s.accounts,
233
233
  logger: t
234
234
  };
235
- return J.createElement(B.Provider, { value: s }, o);
235
+ return J.createElement(B.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]);
237
+ const Se = ({ children: e }) => {
238
+ const r = q(), { msalInstance: t } = y(G), { delegation: s, setDelegation: n } = y(M), { getToken: o } = V(), [c, i] = h(null), d = f(async () => {
239
+ const m = await o();
240
+ m && i(m);
241
+ }, [o]);
242
242
  P(() => {
243
243
  d();
244
244
  }, [d]);
245
- const E = m(() => {
246
- const g = localStorage.getItem("user") ?? null;
247
- return g ? JSON.parse(g ?? "") : null;
248
- }, [])(), [S, v] = h({
245
+ const E = f(() => {
246
+ const m = localStorage.getItem("user") ?? null;
247
+ return m ? JSON.parse(m ?? "") : null;
248
+ }, [])(), [I, v] = h({
249
249
  state: E ? L.LOGGED_IN : L.LOGGING_IN,
250
250
  user: E
251
- }), R = m(async (g) => {
251
+ }), R = f(async (m) => {
252
252
  let x = null;
253
- return await o.get("/user/detail", g ? { headers: { Authorization: `Bearer ${g}` } } : void 0).then((k) => {
253
+ return await r.get("/user/detail", m ? { headers: { Authorization: `Bearer ${m}` } } : void 0).then((k) => {
254
254
  x = k.data;
255
255
  }).catch(() => {
256
256
  x = null;
257
257
  }), x;
258
- }, [o]), p = m(() => {
258
+ }, [r]), _ = f(() => {
259
259
  localStorage.removeItem("user"), v({
260
260
  state: L.LOGGED_OUT,
261
261
  user: null
262
262
  });
263
- }, []), N = m(async (g) => {
263
+ }, []), N = f(async (m) => {
264
264
  v({
265
265
  state: L.LOGGING_IN,
266
266
  user: null
267
267
  });
268
- const x = await R(g);
268
+ const x = await R(m);
269
269
  return x ? (v({
270
270
  state: L.LOGGED_IN,
271
271
  user: x
@@ -273,24 +273,24 @@ const Ce = ({ children: e }) => {
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,
276
+ }, [R]), T = f(() => {
277
+ _();
278
+ }, [_]), D = S(() => ({
279
+ user: I.user,
280
+ userLoginState: I,
281
281
  loginUser: N,
282
282
  logoutUser: T
283
- }), [S, N, T]);
283
+ }), [I, N, T]);
284
284
  return P(() => {
285
285
  if (t) {
286
- const g = t.addEventCallback((x) => {
286
+ const m = t.addEventCallback((x) => {
287
287
  if (x.eventType === u.LOGIN_SUCCESS && x.payload) {
288
288
  const k = x.payload;
289
- l(k.accessToken);
289
+ i(k.accessToken);
290
290
  }
291
291
  });
292
292
  return () => {
293
- g && t.removeEventCallback(g);
293
+ m && t.removeEventCallback(m);
294
294
  };
295
295
  }
296
296
  return () => {
@@ -299,29 +299,29 @@ const Ce = ({ children: e }) => {
299
299
  c && N(c).catch(() => {
300
300
  T(), n(null);
301
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(() => ({
302
+ }, [c, N, T, s == null ? void 0 : s.id, n]), /* @__PURE__ */ a.jsx($.Provider, { value: D, children: e });
303
+ }, Ie = ({ ...e }) => {
304
+ const { cookieDomain: r } = y(j), [, t] = Q(["Authorization"]), s = S(() => ({
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
309
  return P(() => {
310
310
  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;
314
- e.msalInstance.setActiveAccount(l);
315
- const d = c.accessToken, f = c.expiresOn;
311
+ const n = e.msalInstance.addEventCallback((o) => {
312
+ if (o.eventType === u.LOGIN_SUCCESS || o.eventType === u.ACQUIRE_TOKEN_SUCCESS && o.payload) {
313
+ const c = o.payload, i = c.account;
314
+ e.msalInstance.setActiveAccount(i);
315
+ const d = c.accessToken, g = c.expiresOn;
316
316
  t("Authorization", d, {
317
317
  path: "/",
318
318
  secure: !0,
319
319
  sameSite: "none",
320
- domain: o,
321
- expires: f ?? void 0
320
+ domain: r,
321
+ expires: g ?? void 0
322
322
  });
323
323
  }
324
- s.error && console.error("AuthProvider MSAL Error", s);
324
+ o.error && console.error("AuthProvider MSAL Error", o);
325
325
  });
326
326
  return () => {
327
327
  n && e.msalInstance.removeEventCallback(n);
@@ -329,43 +329,38 @@ const Ce = ({ children: e }) => {
329
329
  }
330
330
  return () => {
331
331
  };
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 });
332
+ }, [e, t, r]), /* @__PURE__ */ a.jsx(G.Provider, { value: s, children: e.useMsal ? /* @__PURE__ */ a.jsx(le, { instance: e.msalInstance, children: e.children }) : e.children });
333
333
  }, Pe = ({ children: e }) => {
334
- const [o, t] = h(null), [r, n, s] = Z("delegationId", null);
334
+ const [r, t, s] = Z("user-delegation", null);
335
335
  P(() => {
336
- const l = () => {
336
+ const o = () => {
337
337
  s();
338
338
  };
339
- return window.addEventListener("focus", l), () => {
340
- window.removeEventListener("focus", l);
339
+ return window.addEventListener("focus", o), () => {
340
+ window.removeEventListener("focus", o);
341
341
  };
342
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 });
343
+ const n = S(() => ({ delegation: r, setDelegation: t }), [r, t]);
344
+ return /* @__PURE__ */ a.jsx(M.Provider, { value: n, children: e });
350
345
  }, 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 })
346
+ const { confirmTexts: e } = y(j), { onConfirm: r, onCancel: t, text: s, show: n } = ee();
347
+ return /* @__PURE__ */ a.jsxs(C, { show: n, size: "sm", centered: !0, onHide: t, children: [
348
+ /* @__PURE__ */ a.jsx(C.Header, { className: "justify-content-center", children: /* @__PURE__ */ a.jsx(C.Title, { children: s }) }),
349
+ /* @__PURE__ */ a.jsx(C.Body, { children: /* @__PURE__ */ a.jsxs("div", { className: "w-100 d-flex gap-5", children: [
350
+ /* @__PURE__ */ a.jsx(p, { type: "button", variant: "outlined", color: "secondary", className: "w-100", onClick: t, children: e.no }),
351
+ /* @__PURE__ */ a.jsx(p, { type: "button", color: "primary", onClick: r, className: "w-100 ml", children: e.yes })
357
352
  ] }) })
358
353
  ] });
359
354
  };
360
355
  export {
361
356
  G as AuthContext,
362
- Se as AuthProvider,
357
+ Ie as AuthProvider,
363
358
  M as DelegationContext,
364
359
  Pe as DelegationProvider,
365
360
  K as LoadingContext,
366
- Ie as LoadingProvider,
361
+ Ce as LoadingProvider,
367
362
  j as LuminusComponentsContext,
368
363
  he as LuminusComponentsProvider,
369
364
  $ as UserContext,
370
- Ce as UserProvider
365
+ Se as UserProvider
371
366
  };