wcz-layout 6.7.2 → 8.3.2
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/Approval-BTJTexDo.js +143 -0
- package/dist/Approval-BTJTexDo.js.map +1 -0
- package/dist/DialogsContext-DLqA8RJ_.js +7 -0
- package/dist/DialogsContext-DLqA8RJ_.js.map +1 -0
- package/dist/Email-C9qwj7GD.js +20 -0
- package/dist/Email-C9qwj7GD.js.map +1 -0
- package/dist/FileMeta-DDqUju1Y.js +19 -0
- package/dist/FileMeta-DDqUju1Y.js.map +1 -0
- package/dist/FileMeta-ILLTOjaM.d.ts +20 -0
- package/dist/NotificationContext-CgwUOeW0.js +7 -0
- package/dist/NotificationContext-CgwUOeW0.js.map +1 -0
- package/dist/RouterListItemButton-owZVvuC_.js +78 -0
- package/dist/RouterListItemButton-owZVvuC_.js.map +1 -0
- package/dist/User-CT_IDGuG.d.ts +15 -0
- package/dist/apiMiddleware-CtY4rOFU.js +23 -0
- package/dist/apiMiddleware-CtY4rOFU.js.map +1 -0
- package/dist/components.d.ts +118 -0
- package/dist/components.js +1554 -0
- package/dist/components.js.map +1 -0
- package/dist/data/client.d.ts +3111 -0
- package/dist/data/client.js +188 -0
- package/dist/data/client.js.map +1 -0
- package/dist/data/server.d.ts +19 -0
- package/dist/data/server.js +16 -0
- package/dist/data/server.js.map +1 -0
- package/dist/data.d.ts +7 -0
- package/dist/data.js +2 -0
- package/dist/env-ON-cyE3N.js +31 -0
- package/dist/env-ON-cyE3N.js.map +1 -0
- package/dist/file-BUdLb7H1.js +148 -0
- package/dist/file-BUdLb7H1.js.map +1 -0
- package/dist/file-Dsht7yOP.js +100 -0
- package/dist/file-Dsht7yOP.js.map +1 -0
- package/dist/hooks.d.ts +226 -0
- package/dist/hooks.js +1180 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +2106 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware.d.ts +47 -0
- package/dist/middleware.js +80 -0
- package/dist/middleware.js.map +1 -0
- package/dist/models.d.ts +474 -0
- package/dist/models.js +74 -0
- package/dist/models.js.map +1 -0
- package/dist/msalClient-CYiQAFnY.d.ts +15 -0
- package/dist/msalServer-B9sVqpQ2.js +47 -0
- package/dist/msalServer-B9sVqpQ2.js.map +1 -0
- package/dist/peoplesoft-BCjRje6b.js +240 -0
- package/dist/peoplesoft-BCjRje6b.js.map +1 -0
- package/dist/peoplesoft-Cze2ngGd.d.ts +1150 -0
- package/dist/queryClient-D64McLhZ.js +7 -0
- package/dist/queryClient-D64McLhZ.js.map +1 -0
- package/dist/useDialogs-BJVhBr8S.js +248 -0
- package/dist/useDialogs-BJVhBr8S.js.map +1 -0
- package/dist/utils-BMUmv2ws.js +191 -0
- package/dist/utils-BMUmv2ws.js.map +1 -0
- package/dist/utils-CvvyM8Xw.d.ts +56 -0
- package/dist/utils.d.ts +21 -0
- package/dist/utils.js +6 -0
- package/dist/vite.d.ts +7 -0
- package/dist/vite.js +147 -0
- package/dist/vite.js.map +1 -0
- package/package.json +158 -62
- package/skills/client-db/SKILL.md +107 -0
- package/skills/data-grid/SKILL.md +147 -0
- package/skills/db-schema/SKILL.md +68 -0
- package/skills/dialogs/SKILL.md +79 -0
- package/skills/forms/SKILL.md +82 -0
- package/skills/general/SKILL.md +17 -0
- package/skills/notifications/SKILL.md +43 -0
- package/skills/routing/SKILL.md +123 -0
- package/skills/server-functions/SKILL.md +109 -0
- package/skills/services/SKILL.md +28 -0
- package/skills/services/docs/approval.md +204 -0
- package/skills/services/docs/email.md +32 -0
- package/skills/services/docs/file.md +85 -0
- package/skills/services/docs/peoplesoft.md +110 -0
- package/skills/start/SKILL.md +46 -0
- package/skills/start/steps/01-git-setup.md +10 -0
- package/skills/start/steps/02-project-name-setup.md +14 -0
- package/skills/start/steps/03-apm-setup.md +208 -0
- package/skills/start/steps/04-database-setup.md +37 -0
- package/skills/start/steps/05-entra-setup.md +59 -0
- package/skills/start/steps/06-vault-setup.md +53 -0
- package/skills/start/steps/07-generate-favicon.md +10 -0
- package/skills/start/steps/08-commit.md +15 -0
- package/dist/src/components/Layout.d.ts +0 -16
- package/dist/src/components/Layout.js +0 -122
- package/dist/src/components/Layout.js.map +0 -1
- package/dist/src/components/dataGrid/ChipInputCell.d.ts +0 -9
- package/dist/src/components/dataGrid/ChipInputCell.js +0 -17
- package/dist/src/components/dataGrid/ChipInputCell.js.map +0 -1
- package/dist/src/components/dataGrid/EditableColumnHeader.d.ts +0 -2
- package/dist/src/components/dataGrid/EditableColumnHeader.js +0 -7
- package/dist/src/components/dataGrid/EditableColumnHeader.js.map +0 -1
- package/dist/src/components/dataGrid/GridToolbar.d.ts +0 -8
- package/dist/src/components/dataGrid/GridToolbar.js +0 -40
- package/dist/src/components/dataGrid/GridToolbar.js.map +0 -1
- package/dist/src/components/dataGrid/TableContainer.d.ts +0 -3
- package/dist/src/components/dataGrid/TableContainer.js +0 -32
- package/dist/src/components/dataGrid/TableContainer.js.map +0 -1
- package/dist/src/components/form/FormAutocomplete.d.ts +0 -7
- package/dist/src/components/form/FormAutocomplete.js +0 -10
- package/dist/src/components/form/FormAutocomplete.js.map +0 -1
- package/dist/src/components/form/FormCheckbox.d.ts +0 -7
- package/dist/src/components/form/FormCheckbox.js +0 -11
- package/dist/src/components/form/FormCheckbox.js.map +0 -1
- package/dist/src/components/form/FormDatePicker.d.ts +0 -9
- package/dist/src/components/form/FormDatePicker.js +0 -19
- package/dist/src/components/form/FormDatePicker.js.map +0 -1
- package/dist/src/components/form/FormDateTimePicker.d.ts +0 -9
- package/dist/src/components/form/FormDateTimePicker.js +0 -19
- package/dist/src/components/form/FormDateTimePicker.js.map +0 -1
- package/dist/src/components/form/FormNumberField.d.ts +0 -12
- package/dist/src/components/form/FormNumberField.js +0 -12
- package/dist/src/components/form/FormNumberField.js.map +0 -1
- package/dist/src/components/form/FormRadioGroup.d.ts +0 -13
- package/dist/src/components/form/FormRadioGroup.js +0 -11
- package/dist/src/components/form/FormRadioGroup.js.map +0 -1
- package/dist/src/components/form/FormSlider.d.ts +0 -7
- package/dist/src/components/form/FormSlider.js +0 -11
- package/dist/src/components/form/FormSlider.js.map +0 -1
- package/dist/src/components/form/FormSubmitButton.d.ts +0 -5
- package/dist/src/components/form/FormSubmitButton.js +0 -13
- package/dist/src/components/form/FormSubmitButton.js.map +0 -1
- package/dist/src/components/form/FormSwitch.d.ts +0 -7
- package/dist/src/components/form/FormSwitch.js +0 -11
- package/dist/src/components/form/FormSwitch.js.map +0 -1
- package/dist/src/components/form/FormTextField.d.ts +0 -7
- package/dist/src/components/form/FormTextField.js +0 -11
- package/dist/src/components/form/FormTextField.js.map +0 -1
- package/dist/src/components/layout/AccountMenu.d.ts +0 -9
- package/dist/src/components/layout/AccountMenu.js +0 -44
- package/dist/src/components/layout/AccountMenu.js.map +0 -1
- package/dist/src/components/layout/DevelopmentBanner.d.ts +0 -7
- package/dist/src/components/layout/DevelopmentBanner.js +0 -29
- package/dist/src/components/layout/DevelopmentBanner.js.map +0 -1
- package/dist/src/components/layout/ErrorPage.d.ts +0 -2
- package/dist/src/components/layout/ErrorPage.js +0 -25
- package/dist/src/components/layout/ErrorPage.js.map +0 -1
- package/dist/src/components/layout/LayoutDialog.d.ts +0 -12
- package/dist/src/components/layout/LayoutDialog.js +0 -12
- package/dist/src/components/layout/LayoutDialog.js.map +0 -1
- package/dist/src/components/layout/LayoutSnackbar.d.ts +0 -8
- package/dist/src/components/layout/LayoutSnackbar.js +0 -25
- package/dist/src/components/layout/LayoutSnackbar.js.map +0 -1
- package/dist/src/components/layout/NavigationDrawer.d.ts +0 -11
- package/dist/src/components/layout/NavigationDrawer.js +0 -70
- package/dist/src/components/layout/NavigationDrawer.js.map +0 -1
- package/dist/src/components/layout/NotificationMenu.d.ts +0 -8
- package/dist/src/components/layout/NotificationMenu.js +0 -26
- package/dist/src/components/layout/NotificationMenu.js.map +0 -1
- package/dist/src/components/layout/TypographyWithIcon.d.ts +0 -7
- package/dist/src/components/layout/TypographyWithIcon.js +0 -22
- package/dist/src/components/layout/TypographyWithIcon.js.map +0 -1
- package/dist/src/components/layout/Unauthorized.d.ts +0 -2
- package/dist/src/components/layout/Unauthorized.js +0 -26
- package/dist/src/components/layout/Unauthorized.js.map +0 -1
- package/dist/src/contexts/LayoutContext.d.ts +0 -40
- package/dist/src/contexts/LayoutContext.js +0 -60
- package/dist/src/contexts/LayoutContext.js.map +0 -1
- package/dist/src/contexts/UserContext.d.ts +0 -24
- package/dist/src/contexts/UserContext.js +0 -55
- package/dist/src/contexts/UserContext.js.map +0 -1
- package/dist/src/hooks/FormHooks.d.ts +0 -46
- package/dist/src/hooks/FormHooks.js +0 -31
- package/dist/src/hooks/FormHooks.js.map +0 -1
- package/dist/src/hooks/UseSnackbar.d.ts +0 -10
- package/dist/src/hooks/UseSnackbar.js +0 -23
- package/dist/src/hooks/UseSnackbar.js.map +0 -1
- package/dist/src/hooks/UseUser.d.ts +0 -10
- package/dist/src/hooks/UseUser.js +0 -25
- package/dist/src/hooks/UseUser.js.map +0 -1
- package/dist/src/index.d.ts +0 -20
- package/dist/src/index.js +0 -15
- package/dist/src/index.js.map +0 -1
- package/dist/src/models/Error.d.ts +0 -6
- package/dist/src/models/Error.js +0 -2
- package/dist/src/models/Error.js.map +0 -1
- package/dist/src/models/KeycloakSettings.d.ts +0 -8
- package/dist/src/models/KeycloakSettings.js +0 -2
- package/dist/src/models/KeycloakSettings.js.map +0 -1
- package/dist/src/models/LayoutPaletteColorOptions.d.ts +0 -6
- package/dist/src/models/LayoutPaletteColorOptions.js +0 -2
- package/dist/src/models/LayoutPaletteColorOptions.js.map +0 -1
- package/dist/src/models/LayoutRoute.d.ts +0 -14
- package/dist/src/models/LayoutRoute.js +0 -2
- package/dist/src/models/LayoutRoute.js.map +0 -1
- package/dist/src/models/Notification.d.ts +0 -9
- package/dist/src/models/Notification.js +0 -2
- package/dist/src/models/Notification.js.map +0 -1
- package/dist/src/models/PeoplesoftDepartment.d.ts +0 -14
- package/dist/src/models/PeoplesoftDepartment.js +0 -2
- package/dist/src/models/PeoplesoftDepartment.js.map +0 -1
- package/dist/src/models/PeoplesoftEmployee.d.ts +0 -34
- package/dist/src/models/PeoplesoftEmployee.js +0 -2
- package/dist/src/models/PeoplesoftEmployee.js.map +0 -1
- package/dist/src/models/Snackbar.d.ts +0 -15
- package/dist/src/models/Snackbar.js +0 -2
- package/dist/src/models/Snackbar.js.map +0 -1
- package/dist/src/models/User.d.ts +0 -27
- package/dist/src/models/User.js +0 -11
- package/dist/src/models/User.js.map +0 -1
- package/dist/src/models/types/EmployeeCategoryGroup.d.ts +0 -1
- package/dist/src/models/types/EmployeeCategoryGroup.js +0 -2
- package/dist/src/models/types/EmployeeCategoryGroup.js.map +0 -1
- package/dist/src/models/types/EmployeeStatus.d.ts +0 -1
- package/dist/src/models/types/EmployeeStatus.js +0 -2
- package/dist/src/models/types/EmployeeStatus.js.map +0 -1
- package/dist/src/utils/Auth.d.ts +0 -12
- package/dist/src/utils/Auth.js +0 -49
- package/dist/src/utils/Auth.js.map +0 -1
- package/dist/src/utils/Fetches.d.ts +0 -5
- package/dist/src/utils/Fetches.js +0 -66
- package/dist/src/utils/Fetches.js.map +0 -1
- package/dist/src/utils/FormUtils.d.ts +0 -7
- package/dist/src/utils/FormUtils.js +0 -9
- package/dist/src/utils/FormUtils.js.map +0 -1
- package/dist/src/utils/Helpers.d.ts +0 -11
- package/dist/src/utils/Helpers.js +0 -26
- package/dist/src/utils/Helpers.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/components/Layout.tsx +0 -183
- package/src/components/dataGrid/ChipInputCell.tsx +0 -31
- package/src/components/dataGrid/EditableColumnHeader.tsx +0 -7
- package/src/components/dataGrid/GridToolbar.tsx +0 -63
- package/src/components/dataGrid/TableContainer.tsx +0 -39
- package/src/components/form/FormAutocomplete.tsx +0 -34
- package/src/components/form/FormCheckbox.tsx +0 -32
- package/src/components/form/FormDatePicker.tsx +0 -34
- package/src/components/form/FormDateTimePicker.tsx +0 -34
- package/src/components/form/FormNumberField.tsx +0 -33
- package/src/components/form/FormRadioGroup.tsx +0 -43
- package/src/components/form/FormSlider.tsx +0 -28
- package/src/components/form/FormSubmitButton.tsx +0 -29
- package/src/components/form/FormSwitch.tsx +0 -32
- package/src/components/form/FormTextField.tsx +0 -26
- package/src/components/layout/AccountMenu.tsx +0 -160
- package/src/components/layout/DevelopmentBanner.tsx +0 -54
- package/src/components/layout/ErrorPage.tsx +0 -34
- package/src/components/layout/LayoutDialog.tsx +0 -50
- package/src/components/layout/LayoutSnackbar.tsx +0 -44
- package/src/components/layout/NavigationDrawer.tsx +0 -131
- package/src/components/layout/NotificationMenu.tsx +0 -76
- package/src/components/layout/TypographyWithIcon.tsx +0 -35
- package/src/components/layout/Unauthorized.tsx +0 -37
- package/src/contexts/LayoutContext.tsx +0 -127
- package/src/contexts/UserContext.tsx +0 -88
- package/src/hooks/FormHooks.ts +0 -33
- package/src/hooks/UseSnackbar.tsx +0 -28
- package/src/hooks/UseUser.tsx +0 -29
- package/src/index.ts +0 -27
- package/src/models/Error.tsx +0 -6
- package/src/models/KeycloakSettings.ts +0 -8
- package/src/models/LayoutPaletteColorOptions.tsx +0 -7
- package/src/models/LayoutRoute.ts +0 -15
- package/src/models/Notification.ts +0 -10
- package/src/models/PeoplesoftDepartment.ts +0 -15
- package/src/models/PeoplesoftEmployee.ts +0 -35
- package/src/models/Snackbar.ts +0 -16
- package/src/models/User.ts +0 -13
- package/src/models/types/EmployeeCategoryGroup.ts +0 -1
- package/src/models/types/EmployeeStatus.ts +0 -1
- package/src/utils/Auth.ts +0 -58
- package/src/utils/Fetches.ts +0 -83
- package/src/utils/FormUtils.ts +0 -22
- package/src/utils/Helpers.ts +0 -27
- package/tsconfig.json +0 -29
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryClient-D64McLhZ.js","names":["QueryClient","queryClient"],"sources":["../src/lib/queryClient.ts"],"sourcesContent":["import { QueryClient } from \"@tanstack/react-query\";\n\nexport const queryClient = new QueryClient();\n"],"mappings":";;AAEA,MAAaC,cAAc,IAAID,YAAY"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { t as DialogsContext } from "./DialogsContext-DLqA8RJ_.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, useEventCallback } from "@mui/material";
|
|
4
|
+
import { useContext } from "react";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/hooks/useDialogs.tsx
|
|
8
|
+
function AlertDialog(t0) {
|
|
9
|
+
const $ = c(23);
|
|
10
|
+
if ($[0] !== "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875") {
|
|
11
|
+
for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
12
|
+
$[0] = "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875";
|
|
13
|
+
}
|
|
14
|
+
const { open, payload, onClose } = t0;
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
let t1;
|
|
17
|
+
if ($[1] !== onClose) {
|
|
18
|
+
t1 = () => onClose();
|
|
19
|
+
$[1] = onClose;
|
|
20
|
+
$[2] = t1;
|
|
21
|
+
} else t1 = $[2];
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[3] !== payload.title || $[4] !== t) {
|
|
24
|
+
t2 = payload.title ?? t("Layout.Dialog.Alert");
|
|
25
|
+
$[3] = payload.title;
|
|
26
|
+
$[4] = t;
|
|
27
|
+
$[5] = t2;
|
|
28
|
+
} else t2 = $[5];
|
|
29
|
+
let t3;
|
|
30
|
+
if ($[6] !== t2) {
|
|
31
|
+
t3 = /* @__PURE__ */ jsx(DialogTitle, { children: t2 });
|
|
32
|
+
$[6] = t2;
|
|
33
|
+
$[7] = t3;
|
|
34
|
+
} else t3 = $[7];
|
|
35
|
+
let t4;
|
|
36
|
+
if ($[8] !== payload.message) {
|
|
37
|
+
t4 = /* @__PURE__ */ jsx(DialogContent, { children: payload.message });
|
|
38
|
+
$[8] = payload.message;
|
|
39
|
+
$[9] = t4;
|
|
40
|
+
} else t4 = $[9];
|
|
41
|
+
let t5;
|
|
42
|
+
if ($[10] !== onClose) {
|
|
43
|
+
t5 = () => onClose();
|
|
44
|
+
$[10] = onClose;
|
|
45
|
+
$[11] = t5;
|
|
46
|
+
} else t5 = $[11];
|
|
47
|
+
let t6;
|
|
48
|
+
if ($[12] !== t) {
|
|
49
|
+
t6 = t("Layout.Dialog.Confirm");
|
|
50
|
+
$[12] = t;
|
|
51
|
+
$[13] = t6;
|
|
52
|
+
} else t6 = $[13];
|
|
53
|
+
let t7;
|
|
54
|
+
if ($[14] !== t5 || $[15] !== t6) {
|
|
55
|
+
t7 = /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, {
|
|
56
|
+
onClick: t5,
|
|
57
|
+
autoFocus: true,
|
|
58
|
+
children: t6
|
|
59
|
+
}) });
|
|
60
|
+
$[14] = t5;
|
|
61
|
+
$[15] = t6;
|
|
62
|
+
$[16] = t7;
|
|
63
|
+
} else t7 = $[16];
|
|
64
|
+
let t8;
|
|
65
|
+
if ($[17] !== open || $[18] !== t1 || $[19] !== t3 || $[20] !== t4 || $[21] !== t7) {
|
|
66
|
+
t8 = /* @__PURE__ */ jsxs(Dialog, {
|
|
67
|
+
maxWidth: "xs",
|
|
68
|
+
fullWidth: true,
|
|
69
|
+
open,
|
|
70
|
+
onClose: t1,
|
|
71
|
+
disableRestoreFocus: true,
|
|
72
|
+
children: [
|
|
73
|
+
t3,
|
|
74
|
+
t4,
|
|
75
|
+
t7
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
$[17] = open;
|
|
79
|
+
$[18] = t1;
|
|
80
|
+
$[19] = t3;
|
|
81
|
+
$[20] = t4;
|
|
82
|
+
$[21] = t7;
|
|
83
|
+
$[22] = t8;
|
|
84
|
+
} else t8 = $[22];
|
|
85
|
+
return t8;
|
|
86
|
+
}
|
|
87
|
+
function ConfirmDialog(t0) {
|
|
88
|
+
const $ = c(34);
|
|
89
|
+
if ($[0] !== "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875") {
|
|
90
|
+
for (let $i = 0; $i < 34; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
91
|
+
$[0] = "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875";
|
|
92
|
+
}
|
|
93
|
+
const { open, payload, onClose } = t0;
|
|
94
|
+
const { t } = useTranslation();
|
|
95
|
+
let t1;
|
|
96
|
+
if ($[1] !== onClose) {
|
|
97
|
+
t1 = () => onClose(false);
|
|
98
|
+
$[1] = onClose;
|
|
99
|
+
$[2] = t1;
|
|
100
|
+
} else t1 = $[2];
|
|
101
|
+
let t2;
|
|
102
|
+
if ($[3] !== payload.title || $[4] !== t) {
|
|
103
|
+
t2 = payload.title ?? t("Layout.Dialog.Confirm");
|
|
104
|
+
$[3] = payload.title;
|
|
105
|
+
$[4] = t;
|
|
106
|
+
$[5] = t2;
|
|
107
|
+
} else t2 = $[5];
|
|
108
|
+
let t3;
|
|
109
|
+
if ($[6] !== t2) {
|
|
110
|
+
t3 = /* @__PURE__ */ jsx(DialogTitle, { children: t2 });
|
|
111
|
+
$[6] = t2;
|
|
112
|
+
$[7] = t3;
|
|
113
|
+
} else t3 = $[7];
|
|
114
|
+
let t4;
|
|
115
|
+
if ($[8] !== payload.message) {
|
|
116
|
+
t4 = /* @__PURE__ */ jsx(DialogContent, { children: payload.message });
|
|
117
|
+
$[8] = payload.message;
|
|
118
|
+
$[9] = t4;
|
|
119
|
+
} else t4 = $[9];
|
|
120
|
+
let t5;
|
|
121
|
+
if ($[10] !== onClose) {
|
|
122
|
+
t5 = () => onClose(false);
|
|
123
|
+
$[10] = onClose;
|
|
124
|
+
$[11] = t5;
|
|
125
|
+
} else t5 = $[11];
|
|
126
|
+
let t6;
|
|
127
|
+
if ($[12] !== payload.cancelText || $[13] !== t) {
|
|
128
|
+
t6 = payload.cancelText ?? t("Layout.Dialog.Cancel");
|
|
129
|
+
$[12] = payload.cancelText;
|
|
130
|
+
$[13] = t;
|
|
131
|
+
$[14] = t6;
|
|
132
|
+
} else t6 = $[14];
|
|
133
|
+
let t7;
|
|
134
|
+
if ($[15] !== t5 || $[16] !== t6) {
|
|
135
|
+
t7 = /* @__PURE__ */ jsx(Button, {
|
|
136
|
+
onClick: t5,
|
|
137
|
+
children: t6
|
|
138
|
+
});
|
|
139
|
+
$[15] = t5;
|
|
140
|
+
$[16] = t6;
|
|
141
|
+
$[17] = t7;
|
|
142
|
+
} else t7 = $[17];
|
|
143
|
+
let t8;
|
|
144
|
+
if ($[18] !== onClose) {
|
|
145
|
+
t8 = () => onClose(true);
|
|
146
|
+
$[18] = onClose;
|
|
147
|
+
$[19] = t8;
|
|
148
|
+
} else t8 = $[19];
|
|
149
|
+
let t9;
|
|
150
|
+
if ($[20] !== t) {
|
|
151
|
+
t9 = t("Layout.Dialog.Confirm");
|
|
152
|
+
$[20] = t;
|
|
153
|
+
$[21] = t9;
|
|
154
|
+
} else t9 = $[21];
|
|
155
|
+
let t10;
|
|
156
|
+
if ($[22] !== t8 || $[23] !== t9) {
|
|
157
|
+
t10 = /* @__PURE__ */ jsx(Button, {
|
|
158
|
+
onClick: t8,
|
|
159
|
+
autoFocus: true,
|
|
160
|
+
children: t9
|
|
161
|
+
});
|
|
162
|
+
$[22] = t8;
|
|
163
|
+
$[23] = t9;
|
|
164
|
+
$[24] = t10;
|
|
165
|
+
} else t10 = $[24];
|
|
166
|
+
let t11;
|
|
167
|
+
if ($[25] !== t10 || $[26] !== t7) {
|
|
168
|
+
t11 = /* @__PURE__ */ jsxs(DialogActions, { children: [t7, t10] });
|
|
169
|
+
$[25] = t10;
|
|
170
|
+
$[26] = t7;
|
|
171
|
+
$[27] = t11;
|
|
172
|
+
} else t11 = $[27];
|
|
173
|
+
let t12;
|
|
174
|
+
if ($[28] !== open || $[29] !== t1 || $[30] !== t11 || $[31] !== t3 || $[32] !== t4) {
|
|
175
|
+
t12 = /* @__PURE__ */ jsxs(Dialog, {
|
|
176
|
+
maxWidth: "xs",
|
|
177
|
+
fullWidth: true,
|
|
178
|
+
open,
|
|
179
|
+
onClose: t1,
|
|
180
|
+
disableRestoreFocus: true,
|
|
181
|
+
children: [
|
|
182
|
+
t3,
|
|
183
|
+
t4,
|
|
184
|
+
t11
|
|
185
|
+
]
|
|
186
|
+
});
|
|
187
|
+
$[28] = open;
|
|
188
|
+
$[29] = t1;
|
|
189
|
+
$[30] = t11;
|
|
190
|
+
$[31] = t3;
|
|
191
|
+
$[32] = t4;
|
|
192
|
+
$[33] = t12;
|
|
193
|
+
} else t12 = $[33];
|
|
194
|
+
return t12;
|
|
195
|
+
}
|
|
196
|
+
function useDialogs() {
|
|
197
|
+
const $ = c(10);
|
|
198
|
+
if ($[0] !== "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875") {
|
|
199
|
+
for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
200
|
+
$[0] = "40306a49a490b7e6c84c5f6c47439f8c7b6ee1f8cf1389e00101b53c362d1875";
|
|
201
|
+
}
|
|
202
|
+
const { open, close } = useContext(DialogsContext);
|
|
203
|
+
let t0;
|
|
204
|
+
if ($[1] !== open) {
|
|
205
|
+
t0 = (message, t1) => {
|
|
206
|
+
const { ...options } = t1 === void 0 ? {} : t1;
|
|
207
|
+
return open(AlertDialog, {
|
|
208
|
+
...options,
|
|
209
|
+
message
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
$[1] = open;
|
|
213
|
+
$[2] = t0;
|
|
214
|
+
} else t0 = $[2];
|
|
215
|
+
const alert = useEventCallback(t0);
|
|
216
|
+
let t1;
|
|
217
|
+
if ($[3] !== open) {
|
|
218
|
+
t1 = (message_0, t2) => {
|
|
219
|
+
const { ...options_0 } = t2 === void 0 ? {} : t2;
|
|
220
|
+
return open(ConfirmDialog, {
|
|
221
|
+
...options_0,
|
|
222
|
+
message: message_0
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
$[3] = open;
|
|
226
|
+
$[4] = t1;
|
|
227
|
+
} else t1 = $[4];
|
|
228
|
+
const confirm = useEventCallback(t1);
|
|
229
|
+
let t2;
|
|
230
|
+
if ($[5] !== alert || $[6] !== close || $[7] !== confirm || $[8] !== open) {
|
|
231
|
+
t2 = {
|
|
232
|
+
alert,
|
|
233
|
+
confirm,
|
|
234
|
+
open,
|
|
235
|
+
close
|
|
236
|
+
};
|
|
237
|
+
$[5] = alert;
|
|
238
|
+
$[6] = close;
|
|
239
|
+
$[7] = confirm;
|
|
240
|
+
$[8] = open;
|
|
241
|
+
$[9] = t2;
|
|
242
|
+
} else t2 = $[9];
|
|
243
|
+
return t2;
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
export { useDialogs as t };
|
|
247
|
+
|
|
248
|
+
//# sourceMappingURL=useDialogs-BJVhBr8S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDialogs-BJVhBr8S.js","names":["Button","Dialog","DialogActions","DialogContent","DialogTitle","useEventCallback","useContext","useTranslation","DialogsContext","ReactNode","OpenDialogOptions","onClose","result","TResult","Promise","AlertOptions","title","ConfirmOptions","cancelText","DialogProps","payload","TPayload","open","OpenAlertDialog","message","options","OpenConfirmDialog","DialogComponent","React","ComponentType","OpenDialog","Component","CloseDialog","dialog","AlertDialogPayload","AlertDialogProps","AlertDialog","t0","$","_c","$i","Symbol","for","t","t1","t2","t3","t4","t5","t6","t7","t8","ConfirmDialogPayload","ConfirmDialogProps","ConfirmDialog","t9","t10","t11","t12","DialogHook","alert","confirm","close","useDialogs","undefined","message_0","options_0"],"sources":["../src/hooks/useDialogs.tsx"],"sourcesContent":["import {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n useEventCallback,\n} from \"@mui/material\";\nimport { useContext } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { DialogsContext } from \"../contexts/DialogsContext\";\nimport type { ReactNode } from \"react\";\n\nexport interface OpenDialogOptions<TResult> {\n onClose?: (result: TResult) => Promise<void>;\n}\n\nexport interface AlertOptions {\n title?: ReactNode;\n}\n\nexport interface ConfirmOptions {\n title?: ReactNode;\n cancelText?: ReactNode;\n}\n\nexport interface DialogProps<TPayload = undefined, TResult = void> {\n payload: TPayload;\n open: boolean;\n onClose: (result: TResult) => Promise<void>;\n}\n\nexport type OpenAlertDialog = (message: ReactNode, options?: AlertOptions) => Promise<void>;\n\nexport type OpenConfirmDialog = (message: ReactNode, options?: ConfirmOptions) => Promise<boolean>;\n\nexport type DialogComponent<TPayload, TResult> = React.ComponentType<\n DialogProps<TPayload, TResult>\n>;\n\nexport interface OpenDialog {\n <TPayload extends undefined, TResult>(\n Component: DialogComponent<TPayload, TResult>,\n payload?: TPayload,\n options?: OpenDialogOptions<TResult>,\n ): Promise<TResult>;\n <TPayload, TResult>(\n Component: DialogComponent<TPayload, TResult>,\n payload: TPayload,\n options?: OpenDialogOptions<TResult>,\n ): Promise<TResult>;\n}\n\nexport type CloseDialog = <TResult>(dialog: Promise<TResult>, result: TResult) => Promise<TResult>;\n\nexport interface AlertDialogPayload extends AlertOptions {\n message: ReactNode;\n}\n\nexport type AlertDialogProps = DialogProps<AlertDialogPayload, void>;\n\nexport function AlertDialog({ open, payload, onClose }: Readonly<AlertDialogProps>) {\n const { t } = useTranslation();\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth open={open} onClose={() => onClose()} disableRestoreFocus>\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Alert\")}</DialogTitle>\n <DialogContent>{payload.message}</DialogContent>\n <DialogActions>\n <Button onClick={() => onClose()} autoFocus>\n {t(\"Layout.Dialog.Confirm\")}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n\nexport interface ConfirmDialogPayload extends ConfirmOptions {\n message: ReactNode;\n}\n\nexport type ConfirmDialogProps = DialogProps<ConfirmDialogPayload, boolean>;\n\nexport function ConfirmDialog({ open, payload, onClose }: Readonly<ConfirmDialogProps>) {\n const { t } = useTranslation();\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth open={open} onClose={() => onClose(false)} disableRestoreFocus>\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Confirm\")}</DialogTitle>\n <DialogContent>{payload.message}</DialogContent>\n <DialogActions>\n <Button onClick={() => onClose(false)}>\n {payload.cancelText ?? t(\"Layout.Dialog.Cancel\")}\n </Button>\n <Button onClick={() => onClose(true)} autoFocus>\n {t(\"Layout.Dialog.Confirm\")}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n\ninterface DialogHook {\n alert: OpenAlertDialog;\n confirm: OpenConfirmDialog;\n open: OpenDialog;\n close: CloseDialog;\n}\n\nexport function useDialogs(): DialogHook {\n const { open, close } = useContext(DialogsContext);\n\n const alert = useEventCallback<OpenAlertDialog>((message, { ...options } = {}) =>\n open(AlertDialog, { ...options, message }),\n );\n\n const confirm = useEventCallback<OpenConfirmDialog>((message, { ...options } = {}) =>\n open(ConfirmDialog, { ...options, message }),\n );\n\n return { alert, confirm, open, close };\n}\n"],"mappings":";;;;;;;AA6DA,SAAOoC,YAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAD,EAAA,OAAA,oEAAA;EAAA,KAAA,IAAAE,KAAA,GAAAA,KAAA,IAAAA,MAAA,GAAAF,EAAAE,MAAAC,OAAAC,IAAA,2BAAA;EAAAJ,EAAA,KAAA;CAAA;CAAqB,MAAA,EAAAhB,MAAAF,SAAAT,YAAA0B;CAC1B,MAAA,EAAAM,MAAcpC,eAAe;CAAE,IAAAqC;CAAA,IAAAN,EAAA,OAAA3B,SAAA;EAGwBiC,W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AAC;EAAAc,EAAA,KAAAhB;EAAAgB,EAAA,KAAAD;CAAA,OAAAA,KAAAC,EAAA;CAD5C,MAAAsB,QAAcvD,iBAAkCgC,EAEhD;CAAE,IAAAO;CAAA,IAAAN,EAAA,OAAAhB,MAAA;EAEkDsB,MAAAqB,WAAApB,OAAA;GAAU,MAAA,EAAA,GAAAqB,cAAArB,OAAAmB,KAAAA,IAAA,CAAkB,IAAlBnB;GAAmB,OAC/EvB,KAAKgC,eAAe;IAAA,GAAK7B;IAAOD,SAAEA;GAAQ,CAAC;EAAC;EAAAc,EAAA,KAAAhB;EAAAgB,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAD9C,MAAAuB,UAAgBxD,iBAAoCuC,EAEpD;CAAE,IAAAC;CAAA,IAAAP,EAAA,OAAAsB,SAAAtB,EAAA,OAAAwB,SAAAxB,EAAA,OAAAuB,WAAAvB,EAAA,OAAAhB,MAAA;EAEKuB,KAAA;GAAAe;GAAAC;GAAAvC;GAAAwC;EAA8B;EAACxB,EAAA,KAAAsB;EAAAtB,EAAA,KAAAwB;EAAAxB,EAAA,KAAAuB;EAAAvB,EAAA,KAAAhB;EAAAgB,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAA/BO;AAA+B"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { t as clientEnv } from "./env-ON-cyE3N.js";
|
|
2
|
+
import { permissions, scopes } from "virtual:wcz-layout";
|
|
3
|
+
import { BrowserAuthError, EventType, InteractionRequiredAuthError, NavigationClient, PublicClientApplication } from "@azure/msal-browser";
|
|
4
|
+
import { createClientOnlyFn, createIsomorphicFn } from "@tanstack/react-start";
|
|
5
|
+
//#region src/lib/auth/msalClient.ts
|
|
6
|
+
const pca = new PublicClientApplication({ auth: {
|
|
7
|
+
clientId: clientEnv.VITE_ENTRA_CLIENT_ID,
|
|
8
|
+
authority: `https://login.microsoftonline.com/${clientEnv.VITE_ENTRA_TENANT_ID}`,
|
|
9
|
+
redirectUri: "/"
|
|
10
|
+
} });
|
|
11
|
+
const restoreActiveAccount = () => {
|
|
12
|
+
if (pca.getActiveAccount()) return;
|
|
13
|
+
const [firstAccount] = pca.getAllAccounts();
|
|
14
|
+
if (firstAccount) pca.setActiveAccount(firstAccount);
|
|
15
|
+
};
|
|
16
|
+
const initializeMsal = async () => {
|
|
17
|
+
if (globalThis.window === void 0) return;
|
|
18
|
+
await pca.initialize();
|
|
19
|
+
pca.addEventCallback((event) => {
|
|
20
|
+
if (event.eventType === EventType.LOGIN_SUCCESS && event.payload) {
|
|
21
|
+
const payload = event.payload;
|
|
22
|
+
pca.setActiveAccount(payload.account);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const response = await pca.handleRedirectPromise();
|
|
26
|
+
if (response?.account) {
|
|
27
|
+
pca.setActiveAccount(response.account);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
restoreActiveAccount();
|
|
31
|
+
};
|
|
32
|
+
const initializationPromise = initializeMsal();
|
|
33
|
+
await initializationPromise;
|
|
34
|
+
var TanStackNavigationClient = class extends NavigationClient {
|
|
35
|
+
navigate;
|
|
36
|
+
constructor(navigate) {
|
|
37
|
+
super();
|
|
38
|
+
this.navigate = navigate;
|
|
39
|
+
}
|
|
40
|
+
async navigateInternal(url, options) {
|
|
41
|
+
const relative = url.replace(location.origin, "");
|
|
42
|
+
this.navigate({
|
|
43
|
+
to: relative,
|
|
44
|
+
replace: options.noHistory
|
|
45
|
+
});
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const getUser = createIsomorphicFn().server(() => null).client(async () => {
|
|
50
|
+
await initializationPromise;
|
|
51
|
+
restoreActiveAccount();
|
|
52
|
+
const account = pca.getActiveAccount();
|
|
53
|
+
if (!account?.idToken) return null;
|
|
54
|
+
return buildUser(decodeJwt(account.idToken));
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Token Acquisition: Get authenticated access token.
|
|
58
|
+
* Use when: Making API calls from the browser to secured endpoints.
|
|
59
|
+
*/
|
|
60
|
+
const getAccessToken = createClientOnlyFn(async (scopeKey) => {
|
|
61
|
+
await initializationPromise;
|
|
62
|
+
restoreActiveAccount();
|
|
63
|
+
const account = pca.getActiveAccount();
|
|
64
|
+
if (!account) throw new Error("No active account. User not signed in.");
|
|
65
|
+
const scopes$1 = [...scopes[scopeKey]];
|
|
66
|
+
try {
|
|
67
|
+
const { accessToken } = await pca.acquireTokenSilent({
|
|
68
|
+
scopes: scopes$1,
|
|
69
|
+
account
|
|
70
|
+
});
|
|
71
|
+
return accessToken;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (error instanceof InteractionRequiredAuthError) {
|
|
74
|
+
try {
|
|
75
|
+
await pca.acquireTokenRedirect({
|
|
76
|
+
scopes: scopes$1,
|
|
77
|
+
account
|
|
78
|
+
});
|
|
79
|
+
} catch (redirectError) {
|
|
80
|
+
if (!(redirectError instanceof BrowserAuthError) || redirectError.errorCode !== "interaction_in_progress") throw redirectError;
|
|
81
|
+
}
|
|
82
|
+
await new Promise(() => {});
|
|
83
|
+
}
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/lib/utils.ts
|
|
89
|
+
const WISTRON_PRIMARY_COLOR = "#00506E";
|
|
90
|
+
const WISTRON_SECONDARY_COLOR = "#64DC00";
|
|
91
|
+
var Platform = class {
|
|
92
|
+
static get isAndroid() {
|
|
93
|
+
return /android/i.test(this.userAgent);
|
|
94
|
+
}
|
|
95
|
+
static get isIOS() {
|
|
96
|
+
return /iPad|iPhone|iPod/.test(this.userAgent);
|
|
97
|
+
}
|
|
98
|
+
static get isWindows() {
|
|
99
|
+
return /windows/i.test(this.userAgent);
|
|
100
|
+
}
|
|
101
|
+
static get isMacOS() {
|
|
102
|
+
return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);
|
|
103
|
+
}
|
|
104
|
+
static get userAgent() {
|
|
105
|
+
return typeof navigator === "undefined" ? "" : navigator.userAgent;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const rootRouteHead = (options) => ({
|
|
109
|
+
meta: [
|
|
110
|
+
{ charSet: "utf-8" },
|
|
111
|
+
{
|
|
112
|
+
name: "viewport",
|
|
113
|
+
content: "width=device-width, initial-scale=1"
|
|
114
|
+
},
|
|
115
|
+
{ title: clientEnv.VITE_APP_TITLE },
|
|
116
|
+
{
|
|
117
|
+
name: "og:type",
|
|
118
|
+
content: "website"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "og:title",
|
|
122
|
+
content: clientEnv.VITE_APP_TITLE
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "og:image",
|
|
126
|
+
content: "/favicon-32x32.png"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
links: [
|
|
130
|
+
{
|
|
131
|
+
rel: "apple-touch-icon",
|
|
132
|
+
sizes: "180x180",
|
|
133
|
+
href: "/apple-touch-icon.png"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
rel: "icon",
|
|
137
|
+
type: "image/png",
|
|
138
|
+
sizes: "32x32",
|
|
139
|
+
href: "/favicon-32x32.png"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
rel: "icon",
|
|
143
|
+
type: "image/png",
|
|
144
|
+
sizes: "16x16",
|
|
145
|
+
href: "/favicon-16x16.png"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
rel: "manifest",
|
|
149
|
+
href: options?.manifest || "/manifest.json"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
rel: "icon",
|
|
153
|
+
href: "/favicon.ico"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
});
|
|
157
|
+
const requirePermission = (permissionKey) => {
|
|
158
|
+
return async () => {
|
|
159
|
+
const user = await getUser();
|
|
160
|
+
if (!user?.hasPermission(permissionKey)) throw new Error("You do not have permission to access this page.");
|
|
161
|
+
return { user };
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
const getFieldStatus = (field) => {
|
|
165
|
+
const { meta } = field.state;
|
|
166
|
+
return {
|
|
167
|
+
isTouched: meta.isTouched,
|
|
168
|
+
hasError: !!meta.errors.length,
|
|
169
|
+
helperText: meta.errors[0]?.message
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
const decodeJwt = (token) => {
|
|
173
|
+
const base64 = token.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
174
|
+
const payload = decodeURIComponent(atob(base64).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join(""));
|
|
175
|
+
return JSON.parse(payload);
|
|
176
|
+
};
|
|
177
|
+
const buildUser = (payload) => ({
|
|
178
|
+
id: payload.sub,
|
|
179
|
+
name: payload.name?.split("/")[0],
|
|
180
|
+
email: payload.preferred_username?.toLowerCase(),
|
|
181
|
+
department: payload.department?.toUpperCase() || "",
|
|
182
|
+
employeeId: payload.employeeId?.toUpperCase() || "",
|
|
183
|
+
companyName: payload.companyName || "",
|
|
184
|
+
hasPermission: (key) => {
|
|
185
|
+
return permissions[key].some((k) => (payload.groups ?? []).includes(k));
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
//#endregion
|
|
189
|
+
export { getFieldStatus as a, TanStackNavigationClient as c, pca as d, buildUser as i, getAccessToken as l, WISTRON_PRIMARY_COLOR as n, requirePermission as o, WISTRON_SECONDARY_COLOR as r, rootRouteHead as s, Platform as t, getUser as u };
|
|
190
|
+
|
|
191
|
+
//# sourceMappingURL=utils-BMUmv2ws.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-BMUmv2ws.js","names":["AuthenticationResult","BrowserAuthError","EventMessage","EventType","InteractionRequiredAuthError","NavigationClient","NavigationOptions","PublicClientApplication","useNavigate","createClientOnlyFn","createIsomorphicFn","scopes","definedScopes","clientEnv","buildUser","decodeJwt","User","pca","auth","clientId","VITE_ENTRA_CLIENT_ID","authority","VITE_ENTRA_TENANT_ID","redirectUri","restoreActiveAccount","getActiveAccount","firstAccount","getAllAccounts","setActiveAccount","initializeMsal","globalThis","window","undefined","initialize","addEventCallback","event","eventType","LOGIN_SUCCESS","payload","account","response","handleRedirectPromise","initializationPromise","msalReady","TanStackNavigationClient","constructor","navigate","ReturnType","navigateInternal","url","options","relative","replace","location","origin","to","noHistory","getUser","server","client","Promise","idToken","getAccessToken","scopeKey","Error","accessToken","acquireTokenSilent","error","acquireTokenRedirect","redirectError","errorCode","AnyFieldApi","permissions","clientEnv","TokenPayload","User","getUser","WISTRON_PRIMARY_COLOR","WISTRON_SECONDARY_COLOR","Platform","isAndroid","test","userAgent","isIOS","isWindows","isMacOS","navigator","RootRouteHeadOptions","manifest","rootRouteHead","options","meta","charSet","name","content","title","VITE_APP_TITLE","links","rel","sizes","href","type","requirePermission","permissionKey","user","hasPermission","Error","FormOmittedProps","getFieldStatus","field","state","isTouched","hasError","errors","length","helperText","message","toKebabCase","str","replaceAll","toLowerCase","decodeJwt","token","base64Payload","split","base64","replace","payload","decodeURIComponent","atob","map","c","charCodeAt","toString","slice","join","JSON","parse","buildUser","id","sub","email","preferred_username","department","toUpperCase","employeeId","companyName","key","allowedGroups","some","k","groups","includes"],"sources":["../src/lib/auth/msalClient.ts","../src/lib/utils.ts"],"sourcesContent":["import {\n AuthenticationResult,\n BrowserAuthError,\n EventMessage,\n EventType,\n InteractionRequiredAuthError,\n NavigationClient,\n NavigationOptions,\n PublicClientApplication,\n} from \"@azure/msal-browser\";\nimport { useNavigate } from \"@tanstack/react-router\";\nimport { createClientOnlyFn, createIsomorphicFn } from \"@tanstack/react-start\";\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport { clientEnv } from \"~/env\";\nimport { buildUser, decodeJwt } from \"~/lib/utils\";\nimport type { User } from \"~/models/User\";\n\nexport const pca = new PublicClientApplication({\n auth: {\n clientId: clientEnv.VITE_ENTRA_CLIENT_ID,\n authority: `https://login.microsoftonline.com/${clientEnv.VITE_ENTRA_TENANT_ID}`,\n redirectUri: \"/\",\n },\n});\n\nconst restoreActiveAccount = () => {\n if (pca.getActiveAccount()) return;\n const [firstAccount] = pca.getAllAccounts();\n if (firstAccount) pca.setActiveAccount(firstAccount);\n};\n\nconst initializeMsal = async () => {\n if (globalThis.window === undefined) return;\n\n await pca.initialize();\n\n pca.addEventCallback((event: EventMessage) => {\n if (event.eventType === EventType.LOGIN_SUCCESS && event.payload) {\n const payload = event.payload as AuthenticationResult;\n pca.setActiveAccount(payload.account);\n }\n });\n\n const response = await pca.handleRedirectPromise();\n if (response?.account) {\n pca.setActiveAccount(response.account);\n return;\n }\n\n restoreActiveAccount();\n};\n\nconst initializationPromise = initializeMsal();\nawait initializationPromise;\n\nexport const msalReady = () => initializationPromise;\n\nexport class TanStackNavigationClient extends NavigationClient {\n constructor(private readonly navigate: ReturnType<typeof useNavigate>) {\n super();\n }\n async navigateInternal(url: string, options: NavigationOptions) {\n const relative = url.replace(location.origin, \"\");\n this.navigate({ to: relative, replace: options.noHistory });\n return false;\n }\n}\n\nexport const getUser = createIsomorphicFn()\n .server(() => null)\n .client(async (): Promise<User | null> => {\n await initializationPromise;\n restoreActiveAccount();\n\n const account = pca.getActiveAccount();\n if (!account?.idToken) return null;\n\n return buildUser(decodeJwt(account.idToken));\n });\n\n/**\n * Token Acquisition: Get authenticated access token.\n * Use when: Making API calls from the browser to secured endpoints.\n */\nexport const getAccessToken = createClientOnlyFn(async (scopeKey: keyof typeof definedScopes) => {\n await initializationPromise;\n restoreActiveAccount();\n\n const account = pca.getActiveAccount();\n if (!account) throw new Error(\"No active account. User not signed in.\");\n\n const scopes = [...definedScopes[scopeKey]];\n\n try {\n const { accessToken } = await pca.acquireTokenSilent({ scopes, account });\n return accessToken;\n } catch (error) {\n if (error instanceof InteractionRequiredAuthError) {\n try {\n await pca.acquireTokenRedirect({ scopes, account });\n } catch (redirectError) {\n // Another interaction is already in progress — MSAL will handle it.\n if (\n !(redirectError instanceof BrowserAuthError) ||\n redirectError.errorCode !== \"interaction_in_progress\"\n ) {\n throw redirectError;\n }\n }\n\n // Keep the caller suspended until the page navigates away so pending\n // server functions don't fire without an Authorization header.\n await new Promise<never>(() => {});\n }\n\n throw error;\n }\n});\n","import type { AnyFieldApi } from \"@tanstack/react-form\";\nimport { permissions } from \"virtual:wcz-layout\";\nimport { clientEnv } from \"~/env\";\nimport type { TokenPayload } from \"~/models/TokenPayload\";\nimport type { User } from \"~/models/User\";\nimport { getUser } from \"./auth/msalClient\";\n\nexport const WISTRON_PRIMARY_COLOR = \"#00506E\";\nexport const WISTRON_SECONDARY_COLOR = \"#64DC00\";\n\nexport class Platform {\n static get isAndroid() {\n return /android/i.test(this.userAgent);\n }\n static get isIOS() {\n return /iPad|iPhone|iPod/.test(this.userAgent);\n }\n static get isWindows() {\n return /windows/i.test(this.userAgent);\n }\n static get isMacOS() {\n return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);\n }\n\n private static get userAgent() {\n return typeof navigator === \"undefined\" ? \"\" : navigator.userAgent;\n }\n}\n\ninterface RootRouteHeadOptions {\n manifest?: string;\n}\n\nexport const rootRouteHead = (options?: RootRouteHeadOptions) => ({\n meta: [\n { charSet: \"utf-8\" },\n { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\n { title: clientEnv.VITE_APP_TITLE },\n { name: \"og:type\", content: \"website\" },\n { name: \"og:title\", content: clientEnv.VITE_APP_TITLE },\n { name: \"og:image\", content: \"/favicon-32x32.png\" },\n ],\n links: [\n { rel: \"apple-touch-icon\", sizes: \"180x180\", href: \"/apple-touch-icon.png\" },\n { rel: \"icon\", type: \"image/png\", sizes: \"32x32\", href: \"/favicon-32x32.png\" },\n { rel: \"icon\", type: \"image/png\", sizes: \"16x16\", href: \"/favicon-16x16.png\" },\n { rel: \"manifest\", href: options?.manifest || \"/manifest.json\" },\n { rel: \"icon\", href: \"/favicon.ico\" },\n ],\n});\n\nexport const requirePermission = (permissionKey: keyof typeof permissions) => {\n return async () => {\n const user = await getUser();\n\n if (!user?.hasPermission(permissionKey))\n throw new Error(\"You do not have permission to access this page.\");\n\n return { user };\n };\n};\n\n/* Internal Utils */\nexport type FormOmittedProps =\n | \"name\"\n | \"value\"\n | \"onChange\"\n | \"onBlur\"\n | \"error\"\n | \"helperText\"\n | \"renderInput\"\n | \"type\"\n | \"aria-label\";\n\nexport const getFieldStatus = (field: AnyFieldApi) => {\n const { meta } = field.state;\n\n const isTouched = meta.isTouched;\n const hasError = !!meta.errors.length;\n const helperText = meta.errors[0]?.message;\n\n return { isTouched, hasError, helperText };\n};\n\nexport const toKebabCase = (str: string): string => {\n return str\n .replaceAll(/([a-z])([A-Z])/g, \"$1-$2\")\n .replaceAll(/[\\s_]+/g, \"-\")\n .replaceAll(/[^a-zA-Z0-9-]/g, \"\")\n .toLowerCase()\n .replaceAll(/-+/g, \"-\")\n .replaceAll(/(^-|-$)/g, \"\");\n};\n\nexport const decodeJwt = (token: string) => {\n const base64Payload = token.split(\".\")[1];\n const base64 = base64Payload.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const payload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2))\n .join(\"\"),\n );\n return JSON.parse(payload) as TokenPayload;\n};\n\nexport const buildUser = (payload: TokenPayload): User => ({\n id: payload.sub,\n name: payload.name?.split(\"/\")[0],\n email: payload.preferred_username?.toLowerCase(),\n department: payload.department?.toUpperCase() || \"\",\n employeeId: payload.employeeId?.toUpperCase() || \"\",\n companyName: payload.companyName || \"\",\n hasPermission: (key: keyof typeof permissions) => {\n const allowedGroups = permissions[key];\n return allowedGroups.some((k) => (payload.groups ?? []).includes(k));\n },\n});\n"],"mappings":";;;;;AAiBA,MAAaiB,MAAM,IAAIV,wBAAwB,EAC7CW,MAAM;CACJC,UAAUN,UAAUO;CACpBC,WAAW,qCAAqCR,UAAUS;CAC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YhB,QAAQgB,YAAYC,YAAY,KAAK;CACjDC,YAAYlB,QAAQkB,YAAYD,YAAY,KAAK;CACjDE,aAAanB,QAAQmB,eAAe;CACpCzC,gBAAgB0C,QAAkC;EAEhD,OADsB3E,YAAY2E,KACbE,MAAMC,OAAOvB,QAAQwB,UAAU,CAAA,GAAIC,SAASF,CAAC,CAAC;CACrE;AACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { t as User } from "./User-CT_IDGuG.js";
|
|
2
|
+
import { permissions } from "virtual:wcz-layout";
|
|
3
|
+
//#region src/lib/utils.d.ts
|
|
4
|
+
declare const WISTRON_PRIMARY_COLOR = "#00506E";
|
|
5
|
+
declare const WISTRON_SECONDARY_COLOR = "#64DC00";
|
|
6
|
+
declare class Platform {
|
|
7
|
+
static get isAndroid(): boolean;
|
|
8
|
+
static get isIOS(): boolean;
|
|
9
|
+
static get isWindows(): boolean;
|
|
10
|
+
static get isMacOS(): boolean;
|
|
11
|
+
private static get userAgent();
|
|
12
|
+
}
|
|
13
|
+
interface RootRouteHeadOptions {
|
|
14
|
+
manifest?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const rootRouteHead: (options?: RootRouteHeadOptions) => {
|
|
17
|
+
meta: ({
|
|
18
|
+
charSet: string;
|
|
19
|
+
name?: undefined;
|
|
20
|
+
content?: undefined;
|
|
21
|
+
title?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
name: string;
|
|
24
|
+
content: string;
|
|
25
|
+
charSet?: undefined;
|
|
26
|
+
title?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
title: string;
|
|
29
|
+
charSet?: undefined;
|
|
30
|
+
name?: undefined;
|
|
31
|
+
content?: undefined;
|
|
32
|
+
})[];
|
|
33
|
+
links: ({
|
|
34
|
+
rel: string;
|
|
35
|
+
sizes: string;
|
|
36
|
+
href: string;
|
|
37
|
+
type?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
rel: string;
|
|
40
|
+
type: string;
|
|
41
|
+
sizes: string;
|
|
42
|
+
href: string;
|
|
43
|
+
} | {
|
|
44
|
+
rel: string;
|
|
45
|
+
href: string;
|
|
46
|
+
sizes?: undefined;
|
|
47
|
+
type?: undefined;
|
|
48
|
+
})[];
|
|
49
|
+
};
|
|
50
|
+
declare const requirePermission: (permissionKey: keyof typeof permissions) => () => Promise<{
|
|
51
|
+
user: User;
|
|
52
|
+
}>;
|
|
53
|
+
type FormOmittedProps = "name" | "value" | "onChange" | "onBlur" | "error" | "helperText" | "renderInput" | "type" | "aria-label";
|
|
54
|
+
//#endregion
|
|
55
|
+
export { requirePermission as a, WISTRON_SECONDARY_COLOR as i, Platform as n, rootRouteHead as o, WISTRON_PRIMARY_COLOR as r, FormOmittedProps as t };
|
|
56
|
+
//# sourceMappingURL=utils-CvvyM8Xw.d.ts.map
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { a as requirePermission, n as Platform } from "./utils-CvvyM8Xw.js";
|
|
2
|
+
import { t as getAccessToken } from "./msalClient-CYiQAFnY.js";
|
|
3
|
+
import i18next, { t } from "i18next";
|
|
4
|
+
import { scopes } from "virtual:wcz-layout";
|
|
5
|
+
import { createEnv } from "@t3-oss/env-core";
|
|
6
|
+
import { uuidv7 } from "uuidv7";
|
|
7
|
+
|
|
8
|
+
//#region src/lib/auth/msalServer.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* On-Behalf-Of flow: Exchange user token for a token to call downstream API
|
|
11
|
+
* Use when: Server needs to call microservice on behalf of the logged-in user
|
|
12
|
+
*/
|
|
13
|
+
declare const getTokenOnBehalfOf: (userToken: string, scopeKey: keyof typeof scopes) => Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Client Credentials flow: Get app-only token (no user context)
|
|
16
|
+
* Use when: Background jobs, scheduled tasks, service-to-service calls
|
|
17
|
+
*/
|
|
18
|
+
declare const getAppToken: (scopeKey: keyof typeof scopes) => Promise<string>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Platform, createEnv, getAccessToken, getAppToken, getTokenOnBehalfOf, i18next, requirePermission, t, uuidv7 };
|
|
21
|
+
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { l as getAccessToken, o as requirePermission, t as Platform } from "./utils-BMUmv2ws.js";
|
|
2
|
+
import { n as getTokenOnBehalfOf, t as getAppToken } from "./msalServer-B9sVqpQ2.js";
|
|
3
|
+
import i18next, { t } from "i18next";
|
|
4
|
+
import { createEnv } from "@t3-oss/env-core";
|
|
5
|
+
import { uuidv7 } from "uuidv7";
|
|
6
|
+
export { Platform, createEnv, getAccessToken, getAppToken, getTokenOnBehalfOf, i18next, requirePermission, t, uuidv7 };
|