react-luminus-components 1.3.53 → 1.3.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +16 -16
- package/dist/contexts/delegation/DelegationContext.d.ts +2 -3
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +194 -172
- package/dist/{dateUtils-DYvDmQHJ.cjs → dateUtils-C3diP-K2.cjs} +1 -1
- package/dist/{dateUtils-C1hdRN9v.js → dateUtils-Cl2asrFg.js} +26 -25
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +2 -2
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1 -1
- package/dist/useLocalStorageState-CgLMkNbU.js +71 -0
- package/dist/useLocalStorageState-D9nsPMRG.cjs +1 -0
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +5 -5
- package/package.json +1 -1
- package/dist/useLocalStorageState-DWbVoRAx.js +0 -61
- package/dist/useLocalStorageState-DfNJr0hH.cjs +0 -1
package/dist/.vite/manifest.json
CHANGED
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"_nivo-pie.es-BehAujJ2.cjs"
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
|
-
"_dateUtils-
|
|
31
|
-
"file": "dateUtils-
|
|
30
|
+
"_dateUtils-C3diP-K2.cjs": {
|
|
31
|
+
"file": "dateUtils-C3diP-K2.cjs",
|
|
32
32
|
"name": "dateUtils",
|
|
33
33
|
"imports": [
|
|
34
|
-
"_nivo-pie.es
|
|
34
|
+
"_nivo-pie.es-BehAujJ2.cjs"
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
|
-
"_dateUtils-
|
|
38
|
-
"file": "dateUtils-
|
|
37
|
+
"_dateUtils-Cl2asrFg.js": {
|
|
38
|
+
"file": "dateUtils-Cl2asrFg.js",
|
|
39
39
|
"name": "dateUtils",
|
|
40
40
|
"imports": [
|
|
41
|
-
"_nivo-pie.es
|
|
41
|
+
"_nivo-pie.es--oXJjsfy.js"
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
44
|
"_nivo-pie.es--oXJjsfy.js": {
|
|
@@ -85,15 +85,15 @@
|
|
|
85
85
|
"file": "useEmployeePhotoPath-DjxgOb6H.js",
|
|
86
86
|
"name": "useEmployeePhotoPath"
|
|
87
87
|
},
|
|
88
|
-
"_useLocalStorageState-
|
|
89
|
-
"file": "useLocalStorageState-
|
|
88
|
+
"_useLocalStorageState-CgLMkNbU.js": {
|
|
89
|
+
"file": "useLocalStorageState-CgLMkNbU.js",
|
|
90
90
|
"name": "useLocalStorageState",
|
|
91
91
|
"imports": [
|
|
92
92
|
"_nivo-pie.es--oXJjsfy.js"
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
|
-
"_useLocalStorageState-
|
|
96
|
-
"file": "useLocalStorageState-
|
|
95
|
+
"_useLocalStorageState-D9nsPMRG.cjs": {
|
|
96
|
+
"file": "useLocalStorageState-D9nsPMRG.cjs",
|
|
97
97
|
"name": "useLocalStorageState",
|
|
98
98
|
"imports": [
|
|
99
99
|
"_nivo-pie.es-BehAujJ2.cjs"
|
|
@@ -122,8 +122,8 @@
|
|
|
122
122
|
"_nivo-pie.es-BehAujJ2.cjs",
|
|
123
123
|
"_useConfirm-C1L3EWPP.cjs",
|
|
124
124
|
"_PrimaryButton-BFR7py-F.cjs",
|
|
125
|
-
"_useLocalStorageState-
|
|
126
|
-
"_dateUtils-
|
|
125
|
+
"_useLocalStorageState-D9nsPMRG.cjs",
|
|
126
|
+
"_dateUtils-C3diP-K2.cjs"
|
|
127
127
|
]
|
|
128
128
|
},
|
|
129
129
|
"src/hooks/index.ts": {
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"imports": [
|
|
135
135
|
"_nivo-pie.es-BehAujJ2.cjs",
|
|
136
136
|
"_useConfirm-C1L3EWPP.cjs",
|
|
137
|
-
"_useLocalStorageState-
|
|
138
|
-
"_dateUtils-
|
|
137
|
+
"_useLocalStorageState-D9nsPMRG.cjs",
|
|
138
|
+
"_dateUtils-C3diP-K2.cjs",
|
|
139
139
|
"_useEmployeePhotoPath-BgHzjvUU.cjs",
|
|
140
140
|
"_usePermissions-D4uO_uyT.cjs"
|
|
141
141
|
]
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"imports": [
|
|
160
160
|
"_nivo-pie.es-BehAujJ2.cjs",
|
|
161
161
|
"_PrimaryButton-BFR7py-F.cjs",
|
|
162
|
-
"_dateUtils-
|
|
162
|
+
"_dateUtils-C3diP-K2.cjs",
|
|
163
163
|
"_SimpleTooltip-XWVJvT4P.cjs",
|
|
164
164
|
"_useEmployeePhotoPath-BgHzjvUU.cjs",
|
|
165
165
|
"_useConfirm-C1L3EWPP.cjs",
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
"isEntry": true,
|
|
174
174
|
"imports": [
|
|
175
175
|
"_nivo-pie.es-BehAujJ2.cjs",
|
|
176
|
-
"_dateUtils-
|
|
176
|
+
"_dateUtils-C3diP-K2.cjs",
|
|
177
177
|
"_searchUtils-BWbFBdlA.cjs",
|
|
178
178
|
"_SimpleTooltip-XWVJvT4P.cjs"
|
|
179
179
|
]
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NameIdIntModel } from '../../models/index';
|
|
2
1
|
import { GenericAbortSignal } from 'axios';
|
|
3
2
|
import { Dispatch, SetStateAction } from 'react';
|
|
4
3
|
|
|
@@ -15,8 +14,8 @@ interface UserDelegationModel {
|
|
|
15
14
|
to: string | null;
|
|
16
15
|
}
|
|
17
16
|
export interface IDelegationContext {
|
|
18
|
-
delegation:
|
|
19
|
-
setDelegation: Dispatch<SetStateAction<
|
|
17
|
+
delegation: UserDelegationModel | null;
|
|
18
|
+
setDelegation: Dispatch<SetStateAction<UserDelegationModel | null>>;
|
|
20
19
|
availableDelegations: UserDelegationModel[] | null;
|
|
21
20
|
setAvailableDelegations: React.Dispatch<React.SetStateAction<UserDelegationModel[] | null>>;
|
|
22
21
|
refreshAvailableDelegations: (signal?: GenericAbortSignal, loadCallCount?: number) => Promise<void>;
|
package/dist/contexts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./nivo-pie.es-BehAujJ2.cjs"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./nivo-pie.es-BehAujJ2.cjs"),t=require("react"),L=require("@azure/msal-browser"),k=require("@azure/msal-react");require("react-router-dom");require("react-hook-form");const I=require("./useConfirm-C1L3EWPP.cjs"),d=require("./PrimaryButton-BFR7py-F.cjs"),R=require("./useLocalStorageState-D9nsPMRG.cjs"),S=require("./dateUtils-C3diP-K2.cjs");function T(s){const u=e.toDate(s);return u.setHours(23,59,59,999),u}function M(){return T(Date.now())}function A(s,u){const n=+e.toDate(s),[o,r]=[+e.toDate(u.start),+e.toDate(u.end)].sort((a,i)=>a-i);return n>=o&&n<=r}function O(){return S.startOfDay(Date.now())}const N=({children:s})=>{const[u,n]=t.useState(!1),[o,r]=t.useState(""),a=t.useCallback(c=>{n(!0),r(c)},[]),i=t.useCallback(()=>{n(!1)},[]),l=t.useMemo(()=>({show:u,text:o,showConfirm:a,hideConfirm:i}),[u,o,a,i]);return e.jsxRuntimeExports.jsxs(e.ConfirmContext.Provider,{value:l,children:[e.jsxRuntimeExports.jsx(H,{}),s]})},U=()=>{const{texts:{confirm:s}}=t.useContext(e.LuminusComponentsContext),{isShown:u,text:n,onFinish:o}=R.usePrompt(),{options:r}=t.useContext(e.PromptContext),[a,i]=t.useState(r.defaultValue??""),l=t.useCallback(()=>{o(null)},[o]),c=t.useCallback(C=>{C.preventDefault(),!(r.required&&!a)&&o(a)},[o,r.required,a]);t.useEffect(()=>{u===!0&&i(r.defaultValue??"")},[u,r.defaultValue]);const m=t.useMemo(()=>({value:a,onChange:C=>i(C.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[a]);return e.jsxRuntimeExports.jsxs(d.Modal,{show:u,size:"sm",centered:!0,onHide:l,children:[e.jsxRuntimeExports.jsx(d.Modal.Header,{className:"justify-content-center",children:e.jsxRuntimeExports.jsx(d.Modal.Title,{children:n})}),e.jsxRuntimeExports.jsxs("form",{onSubmit:c,children:[e.jsxRuntimeExports.jsxs(d.Modal.Body,{children:[r.input==="textarea"?e.jsxRuntimeExports.jsx("textarea",{...m,rows:5}):void 0,r.input==="input"?e.jsxRuntimeExports.jsx(d.FormControl,{...m,type:r.type}):void 0]}),e.jsxRuntimeExports.jsxs(d.Modal.Footer,{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx(d.PrimaryButton,{variant:"outlined",color:"secondary",onClick:l,className:"flex-grow-1",children:s.cancel}),e.jsxRuntimeExports.jsx(d.PrimaryButton,{color:"primary",disabled:r.required&&!a,type:"submit",className:"flex-grow-1",children:s.confirm})]})]})]})},G=({children:s})=>{const[u,n]=t.useState(!1),[o,r]=t.useState(""),[a,i]=t.useState({input:"textarea",type:"text"}),l=t.useRef(()=>{}),c=t.useCallback(j=>{r(j),n(!0)},[]),m=t.useCallback(()=>{n(!1)},[]),C=t.useMemo(()=>({isShown:u,text:o,showPrompt:c,hidePrompt:m,resolveRef:l,options:a,setOptions:i}),[u,o,c,m,a]);return e.jsxRuntimeExports.jsxs(e.PromptContext.Provider,{value:C,children:[s,e.jsxRuntimeExports.jsx(U,{})]})},q=({cookieDomain:s,axiosOptions:u,language:n,texts:o,ProjectIconComponent:r,localizationContext:a,chartColorPalette:i,children:l})=>{const c=t.useMemo(()=>({axiosOptions:u,cookieDomain:s,language:n,texts:o,ProjectIconComponent:r,localizationContext:a,chartColorPalette:i}),[u,s,n,r,a,o,i]);return e.jsxRuntimeExports.jsx(e.LuminusComponentsContext.Provider,{value:c,children:e.jsxRuntimeExports.jsx(N,{children:e.jsxRuntimeExports.jsxs(G,{children:[e.jsxRuntimeExports.jsx(e.Ie,{}),l]})})})},_=({children:s})=>{const[u,n]=t.useState(!1),[o]=t.useState(new Set),r=t.useCallback(l=>{o.add(l),n(!0)},[o]),a=t.useCallback(l=>{o.delete(l),o.size===0&&n(!1)},[o]),i=t.useMemo(()=>({isLoading:u,startLoading:r,stopLoading:a}),[u,r,a]);return e.jsxRuntimeExports.jsxs(e.LoadingContext.Provider,{value:i,children:[u&&e.jsxRuntimeExports.jsx(d.Loading,{}),s]})},B=({children:s})=>{const u=e.useAxios(),{msalInstance:n}=t.useContext(e.AuthContext),{delegation:o,setDelegation:r,setAvailableDelegations:a,refreshAvailableDelegations:i}=t.useContext(e.DelegationContext),{getToken:l}=e.useAuth(),[c,m]=t.useState(null),C=t.useCallback(async()=>{const x=await l();x&&m(x)},[l]);t.useEffect(()=>{C()},[C]);const h=t.useCallback(()=>{const x=localStorage.getItem("user")??null;return x?JSON.parse(x??""):null},[])(),[v,E]=t.useState({state:h?e.LoginState.LOGGED_IN:e.LoginState.LOGGING_IN,user:h}),w=t.useCallback(async x=>{let f=null;return await u.get("/user/detail",x?{headers:{Authorization:`Bearer ${x}`}}:void 0).then(y=>{f=y.data}).catch(()=>{f=null}),f},[u]),D=t.useCallback(()=>{localStorage.removeItem("user"),E({state:e.LoginState.LOGGED_OUT,user:null}),r(null),a(null)},[a,r]),g=t.useCallback(async x=>{E({state:e.LoginState.LOGGING_IN,user:null});const f=await w(x);return f?(E({state:e.LoginState.LOGGED_IN,user:f}),localStorage.setItem("user",JSON.stringify(f)),await i(),!0):(E({state:e.LoginState.LOGIN_FAILED,user:null}),!1)},[w,i]),p=t.useCallback(()=>{D()},[D]);t.useEffect(()=>{if(n){const x=n.addEventCallback(f=>{if(f.eventType===L.EventType.LOGIN_SUCCESS&&f.payload){const y=f.payload;m(y.accessToken)}});return()=>{x&&n.removeEventCallback(x)}}return()=>{}},[n,g,p]);const b=t.useCallback(async x=>{x&&await g(x).catch(()=>{p(),r(null)})},[g,p,r]);t.useEffect(()=>{b(c)},[c,o==null?void 0:o.id,b]);const P=t.useMemo(()=>({user:v.user,userLoginState:v,loginUser:g,logoutUser:p}),[v,g,p]);return e.jsxRuntimeExports.jsx(e.UserContext.Provider,{value:P,children:s})},z=({...s})=>{const{cookieDomain:u}=t.useContext(e.LuminusComponentsContext),[,n]=e.useCookies(["Authorization"]),o=t.useMemo(()=>({useMsal:s.useMsal??!1,msalInstance:s.useMsal?s.msalInstance??null:null,msalScopes:s.useMsal?s.msalScopes??[]:[]}),[s]);return t.useEffect(()=>{if(s.useMsal){const r=s.msalInstance.addEventCallback(a=>{if(a.eventType===L.EventType.LOGIN_SUCCESS||a.eventType===L.EventType.ACQUIRE_TOKEN_SUCCESS&&a.payload){const i=a.payload,l=i.account;s.msalInstance.setActiveAccount(l);const c=i.accessToken,m=i.expiresOn;n("Authorization",c,{path:"/",secure:!0,sameSite:"none",domain:u,expires:m??void 0})}a.error&&console.error("AuthProvider MSAL Error",a)});return()=>{r&&s.msalInstance.removeEventCallback(r)}}return()=>{}},[s,n,u]),e.jsxRuntimeExports.jsx(e.AuthContext.Provider,{value:o,children:s.useMsal?e.jsxRuntimeExports.jsx(k.MsalProvider,{instance:s.msalInstance,children:s.children}):s.children})},F=({children:s,relativeEndpoint:u})=>{const[n,o,r]=R.useLocalStorageState("user-delegation",null),a=t.useMemo(()=>{if(!n)return null;const j=n.from?S.parseISO(n.from):O(),h=n.to?S.parseISO(n.to):M();return A(new Date(Date.now()),{start:j,end:h})?n:(o(null),null)},[n,o]),{data:i,setData:l,reloadData:c}=R.useGetApiData(u,{nullStateBeforeLoad:!1,nullStateOnFail:!0}),m=t.useRef(null);t.useEffect(()=>{const j=()=>{c(),m.current=window.setTimeout(j,S.msToStartOfNextDay()+5e3)};return j(),()=>{m.current!==null&&window.clearTimeout(m.current)}},[c]),t.useEffect(()=>{const j=()=>{r()};return window.addEventListener("focus",j),()=>{window.removeEventListener("focus",j)}},[r,c]);const C=t.useMemo(()=>({delegation:a,setDelegation:o,availableDelegations:i,setAvailableDelegations:l,refreshAvailableDelegations:c}),[a,o,i,l,c]);return e.jsxRuntimeExports.jsx(e.DelegationContext.Provider,{value:C,children:s})},H=()=>{const{texts:{confirm:s}}=t.useContext(e.LuminusComponentsContext),{onConfirm:u,onCancel:n,text:o,show:r}=I.useConfirm();return e.jsxRuntimeExports.jsxs(d.Modal,{show:r,size:"sm",centered:!0,onHide:n,children:[e.jsxRuntimeExports.jsx(d.Modal.Header,{className:"justify-content-center",children:e.jsxRuntimeExports.jsx(d.Modal.Title,{children:o})}),e.jsxRuntimeExports.jsx(d.Modal.Body,{children:e.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx(d.PrimaryButton,{type:"button",variant:"outlined",color:"secondary",className:"w-100",onClick:n,children:s.no}),e.jsxRuntimeExports.jsx(d.PrimaryButton,{type:"button",color:"primary",onClick:u,className:"w-100 ml",children:s.yes})]})})]})};exports.AuthContext=e.AuthContext;exports.DelegationContext=e.DelegationContext;exports.LoadingContext=e.LoadingContext;exports.LuminusComponentsContext=e.LuminusComponentsContext;exports.UserContext=e.UserContext;exports.AuthProvider=z;exports.DelegationProvider=F;exports.LoadingProvider=_;exports.LuminusComponentsProvider=q;exports.UserProvider=B;
|
package/dist/contexts.es.js
CHANGED
|
@@ -1,258 +1,280 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { EventType as
|
|
4
|
-
import { MsalProvider as
|
|
1
|
+
import { t as L, j as r, ar as F, U as P, as as G, at as B, ak as H, a5 as q, a9 as _, au as M, aa as V, ac as w, ab as J, av as K } from "./nivo-pie.es--oXJjsfy.js";
|
|
2
|
+
import { useState as v, useCallback as d, useMemo as S, useContext as j, useEffect as C, useRef as R } from "react";
|
|
3
|
+
import { EventType as O } from "@azure/msal-browser";
|
|
4
|
+
import { MsalProvider as Q } from "@azure/msal-react";
|
|
5
5
|
import "react-router-dom";
|
|
6
6
|
import "react-hook-form";
|
|
7
|
-
import { u as
|
|
8
|
-
import { f as
|
|
9
|
-
import { u as
|
|
10
|
-
import { m as
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
7
|
+
import { u as W } from "./useConfirm-DKlCFqR6.js";
|
|
8
|
+
import { f as g, b as $, P as T, L as X } from "./PrimaryButton-PdGX8VfF.js";
|
|
9
|
+
import { u as Y, a as Z, b as ee } from "./useLocalStorageState-CgLMkNbU.js";
|
|
10
|
+
import { e as te, p as U, m as se } from "./dateUtils-Cl2asrFg.js";
|
|
11
|
+
function ne(e) {
|
|
12
|
+
const a = L(e);
|
|
13
|
+
return a.setHours(23, 59, 59, 999), a;
|
|
14
|
+
}
|
|
15
|
+
function oe() {
|
|
16
|
+
return ne(Date.now());
|
|
17
|
+
}
|
|
18
|
+
function ae(e, a) {
|
|
19
|
+
const t = +L(e), [s, n] = [
|
|
20
|
+
+L(a.start),
|
|
21
|
+
+L(a.end)
|
|
22
|
+
].sort((o, i) => o - i);
|
|
23
|
+
return t >= s && t <= n;
|
|
24
|
+
}
|
|
25
|
+
function re() {
|
|
26
|
+
return te(Date.now());
|
|
27
|
+
}
|
|
28
|
+
const ie = ({ children: e }) => {
|
|
29
|
+
const [a, t] = v(!1), [s, n] = v(""), o = d((c) => {
|
|
30
|
+
t(!0), n(c);
|
|
14
31
|
}, []), i = d(() => {
|
|
15
|
-
|
|
16
|
-
}, []), l =
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
32
|
+
t(!1);
|
|
33
|
+
}, []), l = S(() => ({ show: a, text: s, showConfirm: o, hideConfirm: i }), [a, s, o, i]);
|
|
34
|
+
return /* @__PURE__ */ r.jsxs(F.Provider, { value: l, children: [
|
|
35
|
+
/* @__PURE__ */ r.jsx(ue, {}),
|
|
19
36
|
e
|
|
20
37
|
] });
|
|
21
|
-
},
|
|
22
|
-
const { texts: { confirm: e } } = j(
|
|
23
|
-
|
|
24
|
-
}, [
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
const
|
|
31
|
-
value:
|
|
32
|
-
onChange: (
|
|
38
|
+
}, le = () => {
|
|
39
|
+
const { texts: { confirm: e } } = j(P), { isShown: a, text: t, onFinish: s } = Y(), { options: n } = j(G), [o, i] = v(n.defaultValue ?? ""), l = d(() => {
|
|
40
|
+
s(null);
|
|
41
|
+
}, [s]), c = d((x) => {
|
|
42
|
+
x.preventDefault(), !(n.required && !o) && s(o);
|
|
43
|
+
}, [s, n.required, o]);
|
|
44
|
+
C(() => {
|
|
45
|
+
a === !0 && i(n.defaultValue ?? "");
|
|
46
|
+
}, [a, n.defaultValue]);
|
|
47
|
+
const m = S(() => ({
|
|
48
|
+
value: o,
|
|
49
|
+
onChange: (x) => i(x.currentTarget.value),
|
|
33
50
|
className: "w-100",
|
|
34
51
|
autoFocus: !0,
|
|
35
52
|
tabIndex: 0
|
|
36
|
-
}), [
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
42
|
-
|
|
53
|
+
}), [o]);
|
|
54
|
+
return /* @__PURE__ */ r.jsxs(g, { show: a, size: "sm", centered: !0, onHide: l, children: [
|
|
55
|
+
/* @__PURE__ */ r.jsx(g.Header, { className: "justify-content-center", children: /* @__PURE__ */ r.jsx(g.Title, { children: t }) }),
|
|
56
|
+
/* @__PURE__ */ r.jsxs("form", { onSubmit: c, children: [
|
|
57
|
+
/* @__PURE__ */ r.jsxs(g.Body, { children: [
|
|
58
|
+
n.input === "textarea" ? /* @__PURE__ */ r.jsx("textarea", { ...m, rows: 5 }) : void 0,
|
|
59
|
+
n.input === "input" ? /* @__PURE__ */ r.jsx($, { ...m, type: n.type }) : void 0
|
|
43
60
|
] }),
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ r.jsxs(g.Footer, { className: "w-100 d-flex gap-5", children: [
|
|
62
|
+
/* @__PURE__ */ r.jsx(T, { variant: "outlined", color: "secondary", onClick: l, className: "flex-grow-1", children: e.cancel }),
|
|
63
|
+
/* @__PURE__ */ r.jsx(T, { color: "primary", disabled: n.required && !o, type: "submit", className: "flex-grow-1", children: e.confirm })
|
|
47
64
|
] })
|
|
48
65
|
] })
|
|
49
66
|
] });
|
|
50
|
-
},
|
|
51
|
-
const [
|
|
52
|
-
}), c = d((
|
|
53
|
-
|
|
54
|
-
}, []),
|
|
55
|
-
|
|
56
|
-
}, []),
|
|
57
|
-
isShown:
|
|
58
|
-
text:
|
|
67
|
+
}, ce = ({ children: e }) => {
|
|
68
|
+
const [a, t] = v(!1), [s, n] = v(""), [o, i] = v({ input: "textarea", type: "text" }), l = R(() => {
|
|
69
|
+
}), c = d((h) => {
|
|
70
|
+
n(h), t(!0);
|
|
71
|
+
}, []), m = d(() => {
|
|
72
|
+
t(!1);
|
|
73
|
+
}, []), x = S(() => ({
|
|
74
|
+
isShown: a,
|
|
75
|
+
text: s,
|
|
59
76
|
showPrompt: c,
|
|
60
|
-
hidePrompt:
|
|
77
|
+
hidePrompt: m,
|
|
61
78
|
resolveRef: l,
|
|
62
|
-
options:
|
|
79
|
+
options: o,
|
|
63
80
|
setOptions: i
|
|
64
|
-
}), [
|
|
65
|
-
return /* @__PURE__ */
|
|
81
|
+
}), [a, s, c, m, o]);
|
|
82
|
+
return /* @__PURE__ */ r.jsxs(G.Provider, { value: x, children: [
|
|
66
83
|
e,
|
|
67
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ r.jsx(le, {})
|
|
68
85
|
] });
|
|
69
|
-
},
|
|
70
|
-
const c =
|
|
71
|
-
axiosOptions:
|
|
86
|
+
}, je = ({ cookieDomain: e, axiosOptions: a, language: t, texts: s, ProjectIconComponent: n, localizationContext: o, chartColorPalette: i, children: l }) => {
|
|
87
|
+
const c = S(() => ({
|
|
88
|
+
axiosOptions: a,
|
|
72
89
|
cookieDomain: e,
|
|
73
|
-
language:
|
|
74
|
-
texts:
|
|
75
|
-
ProjectIconComponent:
|
|
76
|
-
localizationContext:
|
|
90
|
+
language: t,
|
|
91
|
+
texts: s,
|
|
92
|
+
ProjectIconComponent: n,
|
|
93
|
+
localizationContext: o,
|
|
77
94
|
chartColorPalette: i
|
|
78
95
|
}), [
|
|
79
|
-
r,
|
|
80
|
-
e,
|
|
81
96
|
a,
|
|
97
|
+
e,
|
|
82
98
|
t,
|
|
83
|
-
|
|
99
|
+
n,
|
|
84
100
|
o,
|
|
101
|
+
s,
|
|
85
102
|
i
|
|
86
103
|
]);
|
|
87
|
-
return /* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
104
|
+
return /* @__PURE__ */ r.jsx(P.Provider, { value: c, children: /* @__PURE__ */ r.jsx(ie, { children: /* @__PURE__ */ r.jsxs(ce, { children: [
|
|
105
|
+
/* @__PURE__ */ r.jsx(B, {}),
|
|
89
106
|
l
|
|
90
107
|
] }) }) });
|
|
91
|
-
},
|
|
92
|
-
const [
|
|
93
|
-
|
|
94
|
-
}, [
|
|
95
|
-
|
|
96
|
-
}, [
|
|
97
|
-
return /* @__PURE__ */
|
|
98
|
-
|
|
108
|
+
}, ye = ({ children: e }) => {
|
|
109
|
+
const [a, t] = v(!1), [s] = v(/* @__PURE__ */ new Set()), n = d((l) => {
|
|
110
|
+
s.add(l), t(!0);
|
|
111
|
+
}, [s]), o = d((l) => {
|
|
112
|
+
s.delete(l), s.size === 0 && t(!1);
|
|
113
|
+
}, [s]), i = S(() => ({ isLoading: a, startLoading: n, stopLoading: o }), [a, n, o]);
|
|
114
|
+
return /* @__PURE__ */ r.jsxs(H.Provider, { value: i, children: [
|
|
115
|
+
a && /* @__PURE__ */ r.jsx(X, {}),
|
|
99
116
|
e
|
|
100
117
|
] });
|
|
101
|
-
},
|
|
102
|
-
const
|
|
118
|
+
}, pe = ({ children: e }) => {
|
|
119
|
+
const a = q(), { msalInstance: t } = j(_), { delegation: s, setDelegation: n, setAvailableDelegations: o, refreshAvailableDelegations: i } = j(M), { getToken: l } = V(), [c, m] = v(null), x = d(async () => {
|
|
103
120
|
const u = await l();
|
|
104
|
-
u &&
|
|
121
|
+
u && m(u);
|
|
105
122
|
}, [l]);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}, [
|
|
109
|
-
const
|
|
123
|
+
C(() => {
|
|
124
|
+
x();
|
|
125
|
+
}, [x]);
|
|
126
|
+
const I = d(() => {
|
|
110
127
|
const u = localStorage.getItem("user") ?? null;
|
|
111
128
|
return u ? JSON.parse(u ?? "") : null;
|
|
112
|
-
}, [])(), [
|
|
113
|
-
state:
|
|
114
|
-
user:
|
|
129
|
+
}, [])(), [b, D] = v({
|
|
130
|
+
state: I ? w.LOGGED_IN : w.LOGGING_IN,
|
|
131
|
+
user: I
|
|
115
132
|
}), k = d(async (u) => {
|
|
116
133
|
let f = null;
|
|
117
|
-
return await
|
|
118
|
-
f =
|
|
134
|
+
return await a.get("/user/detail", u ? { headers: { Authorization: `Bearer ${u}` } } : void 0).then((N) => {
|
|
135
|
+
f = N.data;
|
|
119
136
|
}).catch(() => {
|
|
120
137
|
f = null;
|
|
121
138
|
}), f;
|
|
122
|
-
}, [
|
|
123
|
-
localStorage.removeItem("user"),
|
|
124
|
-
state:
|
|
139
|
+
}, [a]), E = d(() => {
|
|
140
|
+
localStorage.removeItem("user"), D({
|
|
141
|
+
state: w.LOGGED_OUT,
|
|
125
142
|
user: null
|
|
126
|
-
}),
|
|
127
|
-
}, [
|
|
128
|
-
|
|
129
|
-
state:
|
|
143
|
+
}), n(null), o(null);
|
|
144
|
+
}, [o, n]), y = d(async (u) => {
|
|
145
|
+
D({
|
|
146
|
+
state: w.LOGGING_IN,
|
|
130
147
|
user: null
|
|
131
148
|
});
|
|
132
149
|
const f = await k(u);
|
|
133
|
-
return f ? (
|
|
134
|
-
state:
|
|
150
|
+
return f ? (D({
|
|
151
|
+
state: w.LOGGED_IN,
|
|
135
152
|
user: f
|
|
136
|
-
}), localStorage.setItem("user", JSON.stringify(f)), await i(), !0) : (
|
|
137
|
-
state:
|
|
153
|
+
}), localStorage.setItem("user", JSON.stringify(f)), await i(), !0) : (D({
|
|
154
|
+
state: w.LOGIN_FAILED,
|
|
138
155
|
user: null
|
|
139
156
|
}), !1);
|
|
140
|
-
}, [k, i]),
|
|
141
|
-
|
|
142
|
-
}, [
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
const u =
|
|
146
|
-
if (f.eventType ===
|
|
147
|
-
const
|
|
148
|
-
|
|
157
|
+
}, [k, i]), p = d(() => {
|
|
158
|
+
E();
|
|
159
|
+
}, [E]);
|
|
160
|
+
C(() => {
|
|
161
|
+
if (t) {
|
|
162
|
+
const u = t.addEventCallback((f) => {
|
|
163
|
+
if (f.eventType === O.LOGIN_SUCCESS && f.payload) {
|
|
164
|
+
const N = f.payload;
|
|
165
|
+
m(N.accessToken);
|
|
149
166
|
}
|
|
150
167
|
});
|
|
151
168
|
return () => {
|
|
152
|
-
u &&
|
|
169
|
+
u && t.removeEventCallback(u);
|
|
153
170
|
};
|
|
154
171
|
}
|
|
155
172
|
return () => {
|
|
156
173
|
};
|
|
157
|
-
}, [
|
|
158
|
-
const
|
|
159
|
-
u && await
|
|
160
|
-
|
|
174
|
+
}, [t, y, p]);
|
|
175
|
+
const A = d(async (u) => {
|
|
176
|
+
u && await y(u).catch(() => {
|
|
177
|
+
p(), n(null);
|
|
161
178
|
});
|
|
162
|
-
}, [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}, [c,
|
|
166
|
-
const
|
|
167
|
-
user:
|
|
168
|
-
userLoginState:
|
|
169
|
-
loginUser:
|
|
170
|
-
logoutUser:
|
|
171
|
-
}), [
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
},
|
|
174
|
-
const { cookieDomain:
|
|
179
|
+
}, [y, p, n]);
|
|
180
|
+
C(() => {
|
|
181
|
+
A(c);
|
|
182
|
+
}, [c, s == null ? void 0 : s.id, A]);
|
|
183
|
+
const z = S(() => ({
|
|
184
|
+
user: b.user,
|
|
185
|
+
userLoginState: b,
|
|
186
|
+
loginUser: y,
|
|
187
|
+
logoutUser: p
|
|
188
|
+
}), [b, y, p]);
|
|
189
|
+
return /* @__PURE__ */ r.jsx(J.Provider, { value: z, children: e });
|
|
190
|
+
}, Ie = ({ ...e }) => {
|
|
191
|
+
const { cookieDomain: a } = j(P), [, t] = K(["Authorization"]), s = S(() => ({
|
|
175
192
|
useMsal: e.useMsal ?? !1,
|
|
176
193
|
msalInstance: e.useMsal ? e.msalInstance ?? null : null,
|
|
177
194
|
msalScopes: e.useMsal ? e.msalScopes ?? [] : []
|
|
178
195
|
}), [e]);
|
|
179
|
-
return
|
|
196
|
+
return C(() => {
|
|
180
197
|
if (e.useMsal) {
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
const i =
|
|
198
|
+
const n = e.msalInstance.addEventCallback((o) => {
|
|
199
|
+
if (o.eventType === O.LOGIN_SUCCESS || o.eventType === O.ACQUIRE_TOKEN_SUCCESS && o.payload) {
|
|
200
|
+
const i = o.payload, l = i.account;
|
|
184
201
|
e.msalInstance.setActiveAccount(l);
|
|
185
|
-
const c = i.accessToken,
|
|
186
|
-
|
|
202
|
+
const c = i.accessToken, m = i.expiresOn;
|
|
203
|
+
t("Authorization", c, {
|
|
187
204
|
path: "/",
|
|
188
205
|
secure: !0,
|
|
189
206
|
sameSite: "none",
|
|
190
|
-
domain:
|
|
191
|
-
expires:
|
|
207
|
+
domain: a,
|
|
208
|
+
expires: m ?? void 0
|
|
192
209
|
});
|
|
193
210
|
}
|
|
194
|
-
|
|
211
|
+
o.error && console.error("AuthProvider MSAL Error", o);
|
|
195
212
|
});
|
|
196
213
|
return () => {
|
|
197
|
-
|
|
214
|
+
n && e.msalInstance.removeEventCallback(n);
|
|
198
215
|
};
|
|
199
216
|
}
|
|
200
217
|
return () => {
|
|
201
218
|
};
|
|
202
|
-
}, [e,
|
|
203
|
-
},
|
|
204
|
-
const [
|
|
219
|
+
}, [e, t, a]), /* @__PURE__ */ r.jsx(_.Provider, { value: s, children: e.useMsal ? /* @__PURE__ */ r.jsx(Q, { instance: e.msalInstance, children: e.children }) : e.children });
|
|
220
|
+
}, De = ({ children: e, relativeEndpoint: a }) => {
|
|
221
|
+
const [t, s, n] = Z("user-delegation", null), o = S(() => {
|
|
222
|
+
if (!t)
|
|
223
|
+
return null;
|
|
224
|
+
const h = t.from ? U(t.from) : re(), I = t.to ? U(t.to) : oe();
|
|
225
|
+
return ae(new Date(Date.now()), { start: h, end: I }) ? t : (s(null), null);
|
|
226
|
+
}, [t, s]), { data: i, setData: l, reloadData: c } = ee(a, {
|
|
205
227
|
nullStateBeforeLoad: !1,
|
|
206
228
|
nullStateOnFail: !0
|
|
207
|
-
}),
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
229
|
+
}), m = R(null);
|
|
230
|
+
C(() => {
|
|
231
|
+
const h = () => {
|
|
232
|
+
c(), m.current = window.setTimeout(h, se() + 5e3);
|
|
211
233
|
};
|
|
212
|
-
return
|
|
213
|
-
|
|
234
|
+
return h(), () => {
|
|
235
|
+
m.current !== null && window.clearTimeout(m.current);
|
|
214
236
|
};
|
|
215
|
-
}, [
|
|
216
|
-
const
|
|
217
|
-
|
|
237
|
+
}, [c]), C(() => {
|
|
238
|
+
const h = () => {
|
|
239
|
+
n();
|
|
218
240
|
};
|
|
219
|
-
return window.addEventListener("focus",
|
|
220
|
-
window.removeEventListener("focus",
|
|
241
|
+
return window.addEventListener("focus", h), () => {
|
|
242
|
+
window.removeEventListener("focus", h);
|
|
221
243
|
};
|
|
222
|
-
}, [
|
|
223
|
-
const x =
|
|
224
|
-
delegation:
|
|
225
|
-
setDelegation:
|
|
226
|
-
availableDelegations:
|
|
227
|
-
setAvailableDelegations:
|
|
228
|
-
refreshAvailableDelegations:
|
|
244
|
+
}, [n, c]);
|
|
245
|
+
const x = S(() => ({
|
|
246
|
+
delegation: o,
|
|
247
|
+
setDelegation: s,
|
|
248
|
+
availableDelegations: i,
|
|
249
|
+
setAvailableDelegations: l,
|
|
250
|
+
refreshAvailableDelegations: c
|
|
229
251
|
}), [
|
|
230
|
-
a,
|
|
231
252
|
o,
|
|
232
253
|
s,
|
|
233
254
|
i,
|
|
234
|
-
l
|
|
255
|
+
l,
|
|
256
|
+
c
|
|
235
257
|
]);
|
|
236
|
-
return /* @__PURE__ */
|
|
237
|
-
},
|
|
238
|
-
const { texts: { confirm: e } } = j(
|
|
239
|
-
return /* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ r.jsx(M.Provider, { value: x, children: e });
|
|
259
|
+
}, ue = () => {
|
|
260
|
+
const { texts: { confirm: e } } = j(P), { onConfirm: a, onCancel: t, text: s, show: n } = W();
|
|
261
|
+
return /* @__PURE__ */ r.jsxs(g, { show: n, size: "sm", centered: !0, onHide: t, children: [
|
|
262
|
+
/* @__PURE__ */ r.jsx(g.Header, { className: "justify-content-center", children: /* @__PURE__ */ r.jsx(g.Title, { children: s }) }),
|
|
263
|
+
/* @__PURE__ */ r.jsx(g.Body, { children: /* @__PURE__ */ r.jsxs("div", { className: "w-100 d-flex gap-5", children: [
|
|
264
|
+
/* @__PURE__ */ r.jsx(T, { type: "button", variant: "outlined", color: "secondary", className: "w-100", onClick: t, children: e.no }),
|
|
265
|
+
/* @__PURE__ */ r.jsx(T, { type: "button", color: "primary", onClick: a, className: "w-100 ml", children: e.yes })
|
|
244
266
|
] }) })
|
|
245
267
|
] });
|
|
246
268
|
};
|
|
247
269
|
export {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
270
|
+
_ as AuthContext,
|
|
271
|
+
Ie as AuthProvider,
|
|
272
|
+
M as DelegationContext,
|
|
273
|
+
De as DelegationProvider,
|
|
274
|
+
H as LoadingContext,
|
|
275
|
+
ye as LoadingProvider,
|
|
276
|
+
P as LuminusComponentsContext,
|
|
277
|
+
je as LuminusComponentsProvider,
|
|
278
|
+
J as UserContext,
|
|
279
|
+
pe as UserProvider
|
|
258
280
|
};
|