react-luminus-components 1.2.79 → 1.2.81
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/README.md +355 -355
- package/dist/.vite/manifest.json +65 -65
- package/dist/{EventType-DyGsWo_d.cjs → EventType-BD9A1JYV.cjs} +1 -1
- package/dist/{EventType-CpXqyU6N.js → EventType-CFrd7EyJ.js} +1 -1
- package/dist/{UserAvatarToggle-ByG1NTlM.js → NoInputContainer-6brUvTDa.js} +640 -640
- package/dist/{UserAvatarToggle-cJKNvqKT.cjs → NoInputContainer-84nW-1Nk.cjs} +16 -16
- package/dist/SimpleTooltip-Vvq6ctZK.cjs +1 -0
- package/dist/SimpleTooltip-_bjk41Zj.js +5 -0
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +42 -42
- package/dist/{dateUtils-Crak7ii9.js → dateUtils-Clmwz8MD.js} +1 -1
- package/dist/{dateUtils-CWKBTsx7.cjs → dateUtils-DjdXQqjK.cjs} +1 -1
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +44 -44
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +13 -13
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +967 -967
- package/dist/models/texts/AxiosTexts.d.ts +1 -0
- package/dist/models/types/ApiErrorResult.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/textUtils-BZyf3rh0.js +41 -0
- package/dist/textUtils-DPetpRXS.cjs +1 -0
- package/dist/{useConfirm-C2tLxO-b.js → useConfirm-BN5n6cbc.js} +1 -1
- package/dist/useConfirm-OHtTp5zx.cjs +1 -0
- package/dist/{useFormControlType-oJGqgThz.js → useFormControlType-BAFqxupC.js} +3 -3
- package/dist/{usePermissions-CPbQAr2_.js → usePermissions--yvVao7K.js} +1 -1
- package/dist/usePermissions-L7MvTSTx.cjs +1 -0
- package/dist/utils/apiErrorFields/apiErrorFieldsUtils.d.ts +1 -1
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +15 -14
- package/package.json +100 -100
- package/dist/SimpleTooltip-CWolhOb-.cjs +0 -1
- package/dist/SimpleTooltip-Dlu42YM6.js +0 -5
- package/dist/textUtils-BbxuIsKq.js +0 -36
- package/dist/textUtils-CHVVh2oi.cjs +0 -1
- package/dist/useConfirm-HYlAqd-s.cjs +0 -1
- package/dist/usePermissions-BlYpl_RP.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("./NoInputContainer-84nW-1Nk.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;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { j as o, ab as t, aj as e } from "./NoInputContainer-6brUvTDa.js";
|
|
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
|
+
export {
|
|
4
|
+
l as S
|
|
5
|
+
};
|
package/dist/contexts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./NoInputContainer-84nW-1Nk.cjs"),n=require("react");require("react-hook-form");const v=require("./useConfirm-OHtTp5zx.cjs"),l=require("./EventType-BD9A1JYV.cjs"),y=({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]})},I=()=>{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:C=>i(C.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})]})]})},h=({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)},[]),C=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:C,children:[t,e.jsxRuntimeExports.jsx(I,{})]})},T=({cookieDomain:t,axiosInstance:r,LinkComponent:s,NavigateComponent:a,language:o,axiosTexts:c,confirmTexts:i,formValidationTexts:u,homeDashboardTexts:d,formSubmitTexts:x,appSearchTexts:C,customSelectTexts:p,errorBoundaryTexts:S,widgetTexts:E,children:m})=>{const R=n.useMemo(()=>({axiosInstance:r,cookieDomain:t,LinkComponent:s,NavigateComponent:a,language:o,axiosTexts:c,confirmTexts:i,formValidationTexts:u,homeDashboardTexts:d,formSubmitTexts:x,appSearchTexts:C,customSelectTexts:p,errorBoundaryTexts:S,widgetTexts:E}),[r,t,s,a,o,c,i,u,d,x,C,p,S,E]);return e.jsxRuntimeExports.jsx(e.LuminusComponentsContext.Provider,{value:R,children:e.jsxRuntimeExports.jsx(y,{children:e.jsxRuntimeExports.jsxs(h,{children:[e.jsxRuntimeExports.jsx(e.Ie,{}),m]})})})},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 g={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},L=(t,r)=>{const{type:s,payload:a}=r;let o=t.inProgress;switch(s){case g.UNBLOCK_INPROGRESS:t.inProgress===e.InteractionStatus.Startup&&(o=e.InteractionStatus.None,a.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case g.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:g.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:g.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 m=null;return await r.get("/user/detail",E?{headers:{Authorization:`Bearer ${E}`}}:void 0).then(R=>{m=R.data}).catch(()=>{m=null}),localStorage.setItem("user",JSON.stringify(m)),m},[r]),x=n.useCallback(()=>{localStorage.removeItem("user")},[]),C=n.useCallback(async E=>{o(!0);const m=await d(E);return o(!1),m?(u(m),!0):!1},[d]),p=n.useCallback(()=>{x(),u(null)},[x]),S=n.useMemo(()=>({user:i,loggingInProgress:a,loginUser:C,logoutUser:p}),[i,C,p,a]);return n.useEffect(()=>{u(c())},[c]),n.useEffect(()=>{if(s){const E=s.addEventCallback(m=>{if(m.eventType===l.EventType.LOGIN_SUCCESS&&m.payload){const R=m.payload;C(R.accessToken).catch(()=>p())}});return()=>{E&&s.removeEventCallback(E)}}return()=>{}},[s,C,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=T;exports.UserProvider=N;
|
package/dist/contexts.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { j as a, ak as j, Q as T, al as
|
|
1
|
+
import { j as a, ak as j, Q as T, al as A, am as k, an as O, M as N, 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-6brUvTDa.js";
|
|
2
2
|
import K, { useState as x, useCallback as E, useMemo as P, useContext as S, useEffect as I, useRef as H, useReducer as B } from "react";
|
|
3
3
|
import "react-hook-form";
|
|
4
|
-
import { u as D, a as V } from "./useConfirm-
|
|
5
|
-
import { M as v, L as $, E as u } from "./EventType-
|
|
4
|
+
import { u as D, a as V } from "./useConfirm-BN5n6cbc.js";
|
|
5
|
+
import { M as v, L as $, E as u } from "./EventType-CFrd7EyJ.js";
|
|
6
6
|
const q = ({ children: e }) => {
|
|
7
7
|
const [s, t] = x(!1), [o, n] = x(""), r = E((d) => {
|
|
8
8
|
t(!0), n(d);
|
|
@@ -14,7 +14,7 @@ const q = ({ children: e }) => {
|
|
|
14
14
|
e
|
|
15
15
|
] });
|
|
16
16
|
}, Q = () => {
|
|
17
|
-
const { confirmTexts: e } = S(T), { isShown: s, text: t, onFinish: o } = D(), { options: n } = S(
|
|
17
|
+
const { confirmTexts: e } = S(T), { isShown: s, text: t, onFinish: o } = D(), { options: n } = S(A), [r, c] = x(n.defaultValue ?? ""), i = E(() => {
|
|
18
18
|
o(null);
|
|
19
19
|
}, [o]), d = E(() => {
|
|
20
20
|
o(r);
|
|
@@ -22,7 +22,7 @@ const q = ({ children: e }) => {
|
|
|
22
22
|
I(() => {
|
|
23
23
|
s === !0 && c(n.defaultValue ?? "");
|
|
24
24
|
}, [s, n.defaultValue]);
|
|
25
|
-
const
|
|
25
|
+
const m = P(() => ({
|
|
26
26
|
value: r,
|
|
27
27
|
onChange: (h) => c(h.currentTarget.value),
|
|
28
28
|
className: "w-100",
|
|
@@ -32,8 +32,8 @@ const q = ({ children: e }) => {
|
|
|
32
32
|
return /* @__PURE__ */ a.jsxs(v, { show: s, size: "sm", centered: !0, onHide: i, children: [
|
|
33
33
|
/* @__PURE__ */ a.jsx(v.Header, { children: /* @__PURE__ */ a.jsx(v.Title, { children: t }) }),
|
|
34
34
|
/* @__PURE__ */ a.jsxs(v.Body, { children: [
|
|
35
|
-
n.input === "textarea" ? /* @__PURE__ */ a.jsx("textarea", { ...
|
|
36
|
-
n.input === "input" ? /* @__PURE__ */ a.jsx("input", { ...
|
|
35
|
+
n.input === "textarea" ? /* @__PURE__ */ a.jsx("textarea", { ...m, rows: 5 }) : void 0,
|
|
36
|
+
n.input === "input" ? /* @__PURE__ */ a.jsx("input", { ...m, type: n.type }) : void 0
|
|
37
37
|
] }),
|
|
38
38
|
/* @__PURE__ */ a.jsxs(v.Footer, { children: [
|
|
39
39
|
/* @__PURE__ */ a.jsx("button", { type: "button", className: "btn btn-secondary", onClick: i, children: e.cancel }),
|
|
@@ -44,22 +44,22 @@ const q = ({ children: e }) => {
|
|
|
44
44
|
const [s, t] = x(!1), [o, n] = x(""), [r, c] = x({ input: "textarea", type: "text" }), i = H(() => {
|
|
45
45
|
}), d = E((C) => {
|
|
46
46
|
n(C), t(!0);
|
|
47
|
-
}, []),
|
|
47
|
+
}, []), m = E(() => {
|
|
48
48
|
t(!1);
|
|
49
49
|
}, []), h = P(() => ({
|
|
50
50
|
isShown: s,
|
|
51
51
|
text: o,
|
|
52
52
|
showPrompt: d,
|
|
53
|
-
hidePrompt:
|
|
53
|
+
hidePrompt: m,
|
|
54
54
|
resolveRef: i,
|
|
55
55
|
options: r,
|
|
56
56
|
setOptions: c
|
|
57
|
-
}), [s, o, d,
|
|
58
|
-
return /* @__PURE__ */ a.jsxs(
|
|
57
|
+
}), [s, o, d, m, r]);
|
|
58
|
+
return /* @__PURE__ */ a.jsxs(A.Provider, { value: h, children: [
|
|
59
59
|
e,
|
|
60
60
|
/* @__PURE__ */ a.jsx(Q, {})
|
|
61
61
|
] });
|
|
62
|
-
}, ae = ({ cookieDomain: e, axiosInstance: s, LinkComponent: t, NavigateComponent: o, language: n, axiosTexts: r, confirmTexts: c, formValidationTexts: i, homeDashboardTexts: d, formSubmitTexts:
|
|
62
|
+
}, ae = ({ cookieDomain: e, axiosInstance: s, LinkComponent: t, NavigateComponent: o, language: n, axiosTexts: r, confirmTexts: c, formValidationTexts: i, homeDashboardTexts: d, formSubmitTexts: m, appSearchTexts: h, customSelectTexts: C, errorBoundaryTexts: y, widgetTexts: g, children: f }) => {
|
|
63
63
|
const R = P(() => ({
|
|
64
64
|
axiosInstance: s,
|
|
65
65
|
cookieDomain: e,
|
|
@@ -70,11 +70,11 @@ const q = ({ children: e }) => {
|
|
|
70
70
|
confirmTexts: c,
|
|
71
71
|
formValidationTexts: i,
|
|
72
72
|
homeDashboardTexts: d,
|
|
73
|
-
formSubmitTexts:
|
|
73
|
+
formSubmitTexts: m,
|
|
74
74
|
appSearchTexts: h,
|
|
75
75
|
customSelectTexts: C,
|
|
76
76
|
errorBoundaryTexts: y,
|
|
77
|
-
widgetTexts:
|
|
77
|
+
widgetTexts: g
|
|
78
78
|
}), [
|
|
79
79
|
s,
|
|
80
80
|
e,
|
|
@@ -85,11 +85,11 @@ const q = ({ children: e }) => {
|
|
|
85
85
|
c,
|
|
86
86
|
i,
|
|
87
87
|
d,
|
|
88
|
-
|
|
88
|
+
m,
|
|
89
89
|
h,
|
|
90
90
|
C,
|
|
91
91
|
y,
|
|
92
|
-
|
|
92
|
+
g
|
|
93
93
|
]);
|
|
94
94
|
return /* @__PURE__ */ a.jsx(T.Provider, { value: R, children: /* @__PURE__ */ a.jsx(q, { children: /* @__PURE__ */ a.jsxs(J, { children: [
|
|
95
95
|
/* @__PURE__ */ a.jsx(k, {}),
|
|
@@ -120,7 +120,7 @@ class W {
|
|
|
120
120
|
case u.SSO_SILENT_START:
|
|
121
121
|
return l.SsoSilent;
|
|
122
122
|
case u.ACQUIRE_TOKEN_START:
|
|
123
|
-
if (s.interactionType ===
|
|
123
|
+
if (s.interactionType === N.Redirect || s.interactionType === N.Popup)
|
|
124
124
|
return l.AcquireToken;
|
|
125
125
|
break;
|
|
126
126
|
case u.HANDLE_REDIRECT_START:
|
|
@@ -145,7 +145,7 @@ class W {
|
|
|
145
145
|
case u.ACQUIRE_TOKEN_SUCCESS:
|
|
146
146
|
case u.ACQUIRE_TOKEN_FAILURE:
|
|
147
147
|
case u.RESTORE_FROM_BFCACHE:
|
|
148
|
-
if (s.interactionType ===
|
|
148
|
+
if (s.interactionType === N.Redirect || s.interactionType === N.Popup) {
|
|
149
149
|
if (t && t !== l.Login && t !== l.AcquireToken)
|
|
150
150
|
break;
|
|
151
151
|
return l.None;
|
|
@@ -156,19 +156,19 @@ class W {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
/*! @azure/msal-react v2.0.16 2024-05-07 */
|
|
159
|
-
const
|
|
159
|
+
const Y = "@azure/msal-react", L = "2.0.16";
|
|
160
160
|
/*! @azure/msal-react v2.0.16 2024-05-07 */
|
|
161
|
-
const
|
|
161
|
+
const b = {
|
|
162
162
|
UNBLOCK_INPROGRESS: "UNBLOCK_INPROGRESS",
|
|
163
163
|
EVENT: "EVENT"
|
|
164
|
-
},
|
|
164
|
+
}, X = (e, s) => {
|
|
165
165
|
const { type: t, payload: o } = s;
|
|
166
166
|
let n = e.inProgress;
|
|
167
167
|
switch (t) {
|
|
168
|
-
case
|
|
168
|
+
case b.UNBLOCK_INPROGRESS:
|
|
169
169
|
e.inProgress === l.Startup && (n = l.None, o.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));
|
|
170
170
|
break;
|
|
171
|
-
case
|
|
171
|
+
case b.EVENT:
|
|
172
172
|
const c = o.message, i = W.getInteractionStatusFromEvent(c, e.inProgress);
|
|
173
173
|
i && (o.logger.info(`MsalProvider - ${c.eventType} results in setting inProgress from ${e.inProgress} to ${i}`), n = i);
|
|
174
174
|
break;
|
|
@@ -192,7 +192,7 @@ function Z({ instance: e, children: s }) {
|
|
|
192
192
|
I(() => {
|
|
193
193
|
e.initializeWrapperLibrary(U.React, L);
|
|
194
194
|
}, [e]);
|
|
195
|
-
const t = P(() => e.getLogger().clone(
|
|
195
|
+
const t = P(() => e.getLogger().clone(Y, L), [e]), [o, n] = B(X, void 0, () => ({
|
|
196
196
|
inProgress: l.Startup,
|
|
197
197
|
accounts: e.getAllAccounts()
|
|
198
198
|
}));
|
|
@@ -204,7 +204,7 @@ function Z({ instance: e, children: s }) {
|
|
|
204
204
|
logger: t,
|
|
205
205
|
message: i
|
|
206
206
|
},
|
|
207
|
-
type:
|
|
207
|
+
type: b.EVENT
|
|
208
208
|
});
|
|
209
209
|
});
|
|
210
210
|
return t.verbose(`MsalProvider - Registered event callback with id: ${c}`), e.initialize().then(() => {
|
|
@@ -215,7 +215,7 @@ function Z({ instance: e, children: s }) {
|
|
|
215
215
|
instance: e,
|
|
216
216
|
logger: t
|
|
217
217
|
},
|
|
218
|
-
type:
|
|
218
|
+
type: b.UNBLOCK_INPROGRESS
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
221
|
}).catch(() => {
|
|
@@ -232,37 +232,37 @@ function Z({ instance: e, children: s }) {
|
|
|
232
232
|
return K.createElement(w.Provider, { value: r }, s);
|
|
233
233
|
}
|
|
234
234
|
const ie = ({ children: e }) => {
|
|
235
|
-
const s = M(), { msalInstance: t } = S(
|
|
236
|
-
const
|
|
237
|
-
return
|
|
238
|
-
}, []), [c, i] = x(r()), d = E(async (
|
|
235
|
+
const s = M(), { msalInstance: t } = S(_), [o, n] = x(!1), r = E(() => {
|
|
236
|
+
const g = localStorage.getItem("user") ?? null;
|
|
237
|
+
return g ? JSON.parse(g) : null;
|
|
238
|
+
}, []), [c, i] = x(r()), d = E(async (g) => {
|
|
239
239
|
let f = null;
|
|
240
|
-
return await s.get("/user/detail",
|
|
240
|
+
return await s.get("/user/detail", g ? { headers: { Authorization: `Bearer ${g}` } } : void 0).then((R) => {
|
|
241
241
|
f = R.data;
|
|
242
242
|
}).catch(() => {
|
|
243
243
|
f = null;
|
|
244
244
|
}), localStorage.setItem("user", JSON.stringify(f)), f;
|
|
245
|
-
}, [s]),
|
|
245
|
+
}, [s]), m = E(() => {
|
|
246
246
|
localStorage.removeItem("user");
|
|
247
|
-
}, []), h = E(async (
|
|
247
|
+
}, []), h = E(async (g) => {
|
|
248
248
|
n(!0);
|
|
249
|
-
const f = await d(
|
|
249
|
+
const f = await d(g);
|
|
250
250
|
return n(!1), f ? (i(f), !0) : !1;
|
|
251
251
|
}, [d]), C = E(() => {
|
|
252
|
-
|
|
253
|
-
}, [
|
|
252
|
+
m(), i(null);
|
|
253
|
+
}, [m]), y = P(() => ({ user: c, loggingInProgress: o, loginUser: h, logoutUser: C }), [c, h, C, o]);
|
|
254
254
|
return I(() => {
|
|
255
255
|
i(r());
|
|
256
256
|
}, [r]), I(() => {
|
|
257
257
|
if (t) {
|
|
258
|
-
const
|
|
258
|
+
const g = t.addEventCallback((f) => {
|
|
259
259
|
if (f.eventType === u.LOGIN_SUCCESS && f.payload) {
|
|
260
260
|
const R = f.payload;
|
|
261
261
|
h(R.accessToken).catch(() => C());
|
|
262
262
|
}
|
|
263
263
|
});
|
|
264
264
|
return () => {
|
|
265
|
-
|
|
265
|
+
g && t.removeEventCallback(g);
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
268
|
return () => {
|
|
@@ -280,13 +280,13 @@ const ie = ({ children: e }) => {
|
|
|
280
280
|
if (r.eventType === u.LOGIN_SUCCESS || r.eventType === u.ACQUIRE_TOKEN_SUCCESS && r.payload) {
|
|
281
281
|
const c = r.payload, i = c.account;
|
|
282
282
|
e.msalInstance.setActiveAccount(i);
|
|
283
|
-
const d = c.accessToken,
|
|
283
|
+
const d = c.accessToken, m = c.expiresOn;
|
|
284
284
|
t("Authorization", d, {
|
|
285
285
|
path: "/",
|
|
286
286
|
secure: !0,
|
|
287
287
|
sameSite: "none",
|
|
288
288
|
domain: s,
|
|
289
|
-
expires:
|
|
289
|
+
expires: m ?? void 0
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
292
|
});
|
|
@@ -296,7 +296,7 @@ const ie = ({ children: e }) => {
|
|
|
296
296
|
}
|
|
297
297
|
return () => {
|
|
298
298
|
};
|
|
299
|
-
}, [e, t, s]), /* @__PURE__ */ a.jsx(
|
|
299
|
+
}, [e, t, s]), /* @__PURE__ */ a.jsx(_.Provider, { value: o, children: e.useMsal ? /* @__PURE__ */ a.jsx(Z, { instance: e.msalInstance, children: e.children }) : e.children });
|
|
300
300
|
}, ee = () => {
|
|
301
301
|
const { confirmTexts: e } = S(T), { onConfirm: s, onCancel: t, text: o, show: n } = V();
|
|
302
302
|
return /* @__PURE__ */ a.jsx(v, { show: n, size: "sm", centered: !0, onHide: t, children: /* @__PURE__ */ a.jsxs(v.Body, { children: [
|
|
@@ -308,7 +308,7 @@ const ie = ({ children: e }) => {
|
|
|
308
308
|
] }) });
|
|
309
309
|
};
|
|
310
310
|
export {
|
|
311
|
-
|
|
311
|
+
_ as AuthContext,
|
|
312
312
|
le as AuthProvider,
|
|
313
313
|
O as LoadingContext,
|
|
314
314
|
ce as LoadingProvider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const d=require("./textUtils-
|
|
1
|
+
"use strict";const d=require("./textUtils-DPetpRXS.cjs");function N(t,e){const n=I(t);let i;if(n.date){const s=U(n.date,2);i=w(s.restDateString,s.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const a=i.getTime();let o=0,u;if(n.time&&(o=h(n.time),isNaN(o)))return new Date(NaN);if(n.timezone){if(u=C(n.timezone),isNaN(u))return new Date(NaN)}else{const s=new Date(a+o),c=new Date(0);return c.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),c.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),c}return new Date(a+o+u)}const f={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},p=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,g=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,T=/^([+-])(\d{2})(?::?(\d{2}))?$/;function I(t){const e={},r=t.split(f.dateTimeDelimiter);let n;if(r.length>2)return e;if(/:/.test(r[0])?n=r[0]:(e.date=r[0],n=r[1],f.timeZoneDelimiter.test(e.date)&&(e.date=t.split(f.timeZoneDelimiter)[0],n=t.substr(e.date.length,t.length))),n){const i=f.timezone.exec(n);i?(e.time=n.replace(i[1],""),e.timezone=i[1]):e.time=n}return e}function U(t,e){const r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=t.match(r);if(!n)return{year:NaN,restDateString:""};const i=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:a===null?i:a*100,restDateString:t.slice((n[1]||n[2]).length)}}function w(t,e){if(e===null)return new Date(NaN);const r=t.match(p);if(!r)return new Date(NaN);const n=!!r[4],i=l(r[1]),a=l(r[2])-1,o=l(r[3]),u=l(r[4]),s=l(r[5])-1;if(n)return z(e,u,s)?x(e,u,s):new Date(NaN);{const c=new Date(0);return!y(e,a,o)||!O(e,i)?new Date(NaN):(c.setUTCFullYear(e,a,Math.max(i,o)),c)}}function l(t){return t?parseInt(t):1}function h(t){const e=t.match(g);if(!e)return NaN;const r=m(e[1]),n=m(e[2]),i=m(e[3]);return M(r,n,i)?r*d.millisecondsInHour+n*d.millisecondsInMinute+i*1e3:NaN}function m(t){return t&&parseFloat(t.replace(",","."))||0}function C(t){if(t==="Z")return 0;const e=t.match(T);if(!e)return 0;const r=e[1]==="+"?-1:1,n=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return S(n,i)?r*(n*d.millisecondsInHour+i*d.millisecondsInMinute):NaN}function x(t,e,r){const n=new Date(0);n.setUTCFullYear(t,0,4);const i=n.getUTCDay()||7,a=(e-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+a),n}const Y=[31,null,31,30,31,30,31,31,30,31,30,31];function D(t){return t%400===0||t%4===0&&t%100!==0}function y(t,e,r){return e>=0&&e<=11&&r>=1&&r<=(Y[e]||(D(t)?29:28))}function O(t,e){return e>=1&&e<=(D(t)?366:365)}function z(t,e,r){return e>=1&&e<=53&&r>=0&&r<=6}function M(t,e,r){return t===24?e===0&&r===0:r>=0&&r<60&&e>=0&&e<60&&t>=0&&t<25}function S(t,e){return e>=0&&e<=59}const Z=t=>{const e=N(t);return!Number.isNaN(e.getTime())};exports.isISODate=Z;
|