wcz-layout 6.7.2 → 7.6.1

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.

Potentially problematic release.


This version of wcz-layout might be problematic. Click here for more details.

Files changed (303) hide show
  1. package/dist/DialogsContext-BIhId-r8.js +7 -0
  2. package/dist/DialogsContext-BIhId-r8.js.map +1 -0
  3. package/dist/DialogsHooks-CZVdKmPv.js +207 -0
  4. package/dist/DialogsHooks-CZVdKmPv.js.map +1 -0
  5. package/dist/FileMeta-YGG9mxo_.js +36 -0
  6. package/dist/FileMeta-YGG9mxo_.js.map +1 -0
  7. package/dist/NotificationContext-DovR_auQ.js +7 -0
  8. package/dist/NotificationContext-DovR_auQ.js.map +1 -0
  9. package/dist/RouterListItemButton-DeaQB4ym.js +31 -0
  10. package/dist/RouterListItemButton-DeaQB4ym.js.map +1 -0
  11. package/dist/components/core/AppTitle.d.ts +2 -0
  12. package/dist/components/core/Fullscreen.d.ts +3 -0
  13. package/dist/components/core/Layout.d.ts +10 -0
  14. package/dist/{src/components/layout → components/core}/TypographyWithIcon.d.ts +1 -1
  15. package/dist/components/core/account/UserAvatar.d.ts +2 -0
  16. package/dist/components/core/account/UserMenu.d.ts +2 -0
  17. package/dist/components/core/navigation/NavigationContent.d.ts +11 -0
  18. package/dist/components/core/navigation/NavigationList.d.ts +22 -0
  19. package/dist/components/core/navigation/NavigationListItem.d.ts +16 -0
  20. package/dist/components/core/navigation/NavigationRail.d.ts +12 -0
  21. package/dist/{src/components/dataGrid → components/data-grid}/ChipInputCell.d.ts +3 -3
  22. package/dist/components/data-grid/EditableColumnHeader.d.ts +2 -0
  23. package/dist/components/file/Dropzone.d.ts +8 -0
  24. package/dist/components/file/FileViewer.d.ts +20 -0
  25. package/dist/components/file/fileViewer/FileViewerGrid.d.ts +17 -0
  26. package/dist/components/file/fileViewer/FileViewerList.d.ts +12 -0
  27. package/dist/components/file/fileViewer/ImageViewer.d.ts +6 -0
  28. package/dist/components/file/fileViewer/common/ActionsMenu.d.ts +15 -0
  29. package/dist/{src/components → components}/form/FormAutocomplete.d.ts +3 -3
  30. package/dist/{src/components → components}/form/FormCheckbox.d.ts +3 -3
  31. package/dist/components/form/FormDatePicker.d.ts +8 -0
  32. package/dist/components/form/FormDateRangePicker.d.ts +8 -0
  33. package/dist/components/form/FormDateTimePicker.d.ts +8 -0
  34. package/dist/components/form/FormDateTimeRangePicker.d.ts +8 -0
  35. package/dist/{src/components → components}/form/FormNumberField.d.ts +4 -7
  36. package/dist/{src/components → components}/form/FormRadioGroup.d.ts +4 -4
  37. package/dist/{src/components → components}/form/FormSlider.d.ts +3 -3
  38. package/dist/components/form/FormSubmitButton.d.ts +4 -0
  39. package/dist/{src/components → components}/form/FormSwitch.d.ts +3 -3
  40. package/dist/{src/components → components}/form/FormTextField.d.ts +3 -3
  41. package/dist/components/form/FormTimePicker.d.ts +8 -0
  42. package/dist/components/form/FormTimeRangePicker.d.ts +8 -0
  43. package/dist/components/router/RouterButton.d.ts +6 -0
  44. package/dist/components/router/RouterError.d.ts +7 -0
  45. package/dist/components/router/RouterFab.d.ts +6 -0
  46. package/dist/components/router/RouterGridActionsCellItem.d.ts +6 -0
  47. package/dist/components/router/RouterIconButton.d.ts +6 -0
  48. package/dist/components/router/RouterLink.d.ts +6 -0
  49. package/dist/components/router/RouterListItemButton.d.ts +6 -0
  50. package/dist/components/router/RouterNotFound.d.ts +1 -0
  51. package/dist/components/router/RouterTab.d.ts +6 -0
  52. package/dist/components.js +3255 -0
  53. package/dist/components.js.map +1 -0
  54. package/dist/contexts/DialogsContext.d.ts +6 -0
  55. package/dist/contexts/FileContext.d.ts +13 -0
  56. package/dist/contexts/NotificationContext.d.ts +9 -0
  57. package/dist/dist-Bxzg1_9c.js +152 -0
  58. package/dist/dist-Bxzg1_9c.js.map +1 -0
  59. package/dist/exports/components.d.ts +15 -0
  60. package/dist/exports/hooks.d.ts +7 -0
  61. package/dist/exports/index.d.ts +5 -0
  62. package/dist/exports/middleware.d.ts +2 -0
  63. package/dist/exports/models.d.ts +24 -0
  64. package/dist/exports/query.d.ts +3 -0
  65. package/dist/exports/utils.d.ts +6 -0
  66. package/dist/exports/vite.d.ts +1 -0
  67. package/dist/hooks/DialogsHooks.d.ts +42 -0
  68. package/dist/hooks/FormHooks.d.ts +52 -0
  69. package/dist/hooks/UseNotification.d.ts +1 -0
  70. package/dist/hooks/UseScanDetection.d.ts +28 -0
  71. package/dist/hooks.js +1075 -0
  72. package/dist/hooks.js.map +1 -0
  73. package/dist/index.js +1105 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/lib/auth/msalClient.d.ts +19 -0
  76. package/dist/lib/auth/msalServer.d.ts +11 -0
  77. package/dist/lib/auth/permissions.d.ts +4 -0
  78. package/dist/lib/auth/scopes.d.ts +4 -0
  79. package/dist/lib/db/collections/userCollection.d.ts +18 -0
  80. package/dist/lib/queryClient.d.ts +2 -0
  81. package/dist/lib/theme.d.ts +1 -0
  82. package/dist/lib/utils.d.ts +63 -0
  83. package/dist/lib/vite-plugin.d.ts +2 -0
  84. package/dist/middleware/authMiddleware.d.ts +22 -0
  85. package/dist/middleware/validationMiddleware.d.ts +4 -0
  86. package/dist/middleware.js +1051 -0
  87. package/dist/middleware.js.map +1 -0
  88. package/dist/models/LayoutOptions.d.ts +7 -0
  89. package/dist/models/Navigation.d.ts +18 -0
  90. package/dist/models/TokenPayload.d.ts +9 -0
  91. package/dist/models/User.d.ts +10 -0
  92. package/dist/models/VaultConfig.d.ts +9 -0
  93. package/dist/models/approval/Approval.d.ts +177 -0
  94. package/dist/models/approval/ApprovalEmployee.d.ts +7 -0
  95. package/dist/models/approval/ApprovalFlow.d.ts +49 -0
  96. package/dist/models/approval/ApprovalFlowStep.d.ts +29 -0
  97. package/dist/models/approval/ApprovalRequestType.d.ts +5 -0
  98. package/dist/models/approval/ApprovalStatus.d.ts +9 -0
  99. package/dist/models/approval/ApprovalStepResult.d.ts +11 -0
  100. package/dist/models/approval/StepApprovalOrder.d.ts +6 -0
  101. package/dist/models/email/Email.d.ts +13 -0
  102. package/dist/models/email/EmailAttachment.d.ts +6 -0
  103. package/dist/models/file/FileActions.d.ts +6 -0
  104. package/dist/models/file/FileMeta.d.ts +15 -0
  105. package/dist/models/peoplesoft/Department.d.ts +58 -0
  106. package/dist/models/peoplesoft/Employee.d.ts +46 -0
  107. package/dist/models/peoplesoft/EmployeeCategoryGroup.d.ts +6 -0
  108. package/dist/models/peoplesoft/EmployeeStatus.d.ts +6 -0
  109. package/dist/models.js +150 -0
  110. package/dist/models.js.map +1 -0
  111. package/dist/providers/DialogsProvider.d.ts +5 -0
  112. package/dist/providers/LayoutProvider.d.ts +12 -0
  113. package/dist/providers/MsalAuthProvider.d.ts +6 -0
  114. package/dist/providers/NotificationProvider.d.ts +7 -0
  115. package/dist/queries/ApprovalQueries.d.ts +661 -0
  116. package/dist/queries/FileQueries.d.ts +205 -0
  117. package/dist/queries/PeopleSoftQueries.d.ts +2173 -0
  118. package/dist/queries/index.d.ts +2958 -0
  119. package/dist/queries-D-DV5lCw.js +2941 -0
  120. package/dist/queries-D-DV5lCw.js.map +1 -0
  121. package/dist/query.js +3 -0
  122. package/dist/queryClient-B__OEZ70.js +7 -0
  123. package/dist/queryClient-B__OEZ70.js.map +1 -0
  124. package/dist/utils-C4oJ0tr5.js +157 -0
  125. package/dist/utils-C4oJ0tr5.js.map +1 -0
  126. package/dist/utils.js +35 -0
  127. package/dist/utils.js.map +1 -0
  128. package/dist/vite.js +110 -0
  129. package/dist/vite.js.map +1 -0
  130. package/package.json +132 -62
  131. package/dist/src/components/Layout.d.ts +0 -16
  132. package/dist/src/components/Layout.js +0 -122
  133. package/dist/src/components/Layout.js.map +0 -1
  134. package/dist/src/components/dataGrid/ChipInputCell.js +0 -17
  135. package/dist/src/components/dataGrid/ChipInputCell.js.map +0 -1
  136. package/dist/src/components/dataGrid/EditableColumnHeader.d.ts +0 -2
  137. package/dist/src/components/dataGrid/EditableColumnHeader.js +0 -7
  138. package/dist/src/components/dataGrid/EditableColumnHeader.js.map +0 -1
  139. package/dist/src/components/dataGrid/GridToolbar.d.ts +0 -8
  140. package/dist/src/components/dataGrid/GridToolbar.js +0 -40
  141. package/dist/src/components/dataGrid/GridToolbar.js.map +0 -1
  142. package/dist/src/components/dataGrid/TableContainer.d.ts +0 -3
  143. package/dist/src/components/dataGrid/TableContainer.js +0 -32
  144. package/dist/src/components/dataGrid/TableContainer.js.map +0 -1
  145. package/dist/src/components/form/FormAutocomplete.js +0 -10
  146. package/dist/src/components/form/FormAutocomplete.js.map +0 -1
  147. package/dist/src/components/form/FormCheckbox.js +0 -11
  148. package/dist/src/components/form/FormCheckbox.js.map +0 -1
  149. package/dist/src/components/form/FormDatePicker.d.ts +0 -9
  150. package/dist/src/components/form/FormDatePicker.js +0 -19
  151. package/dist/src/components/form/FormDatePicker.js.map +0 -1
  152. package/dist/src/components/form/FormDateTimePicker.d.ts +0 -9
  153. package/dist/src/components/form/FormDateTimePicker.js +0 -19
  154. package/dist/src/components/form/FormDateTimePicker.js.map +0 -1
  155. package/dist/src/components/form/FormNumberField.js +0 -12
  156. package/dist/src/components/form/FormNumberField.js.map +0 -1
  157. package/dist/src/components/form/FormRadioGroup.js +0 -11
  158. package/dist/src/components/form/FormRadioGroup.js.map +0 -1
  159. package/dist/src/components/form/FormSlider.js +0 -11
  160. package/dist/src/components/form/FormSlider.js.map +0 -1
  161. package/dist/src/components/form/FormSubmitButton.d.ts +0 -5
  162. package/dist/src/components/form/FormSubmitButton.js +0 -13
  163. package/dist/src/components/form/FormSubmitButton.js.map +0 -1
  164. package/dist/src/components/form/FormSwitch.js +0 -11
  165. package/dist/src/components/form/FormSwitch.js.map +0 -1
  166. package/dist/src/components/form/FormTextField.js +0 -11
  167. package/dist/src/components/form/FormTextField.js.map +0 -1
  168. package/dist/src/components/layout/AccountMenu.d.ts +0 -9
  169. package/dist/src/components/layout/AccountMenu.js +0 -44
  170. package/dist/src/components/layout/AccountMenu.js.map +0 -1
  171. package/dist/src/components/layout/DevelopmentBanner.d.ts +0 -7
  172. package/dist/src/components/layout/DevelopmentBanner.js +0 -29
  173. package/dist/src/components/layout/DevelopmentBanner.js.map +0 -1
  174. package/dist/src/components/layout/ErrorPage.d.ts +0 -2
  175. package/dist/src/components/layout/ErrorPage.js +0 -25
  176. package/dist/src/components/layout/ErrorPage.js.map +0 -1
  177. package/dist/src/components/layout/LayoutDialog.d.ts +0 -12
  178. package/dist/src/components/layout/LayoutDialog.js +0 -12
  179. package/dist/src/components/layout/LayoutDialog.js.map +0 -1
  180. package/dist/src/components/layout/LayoutSnackbar.d.ts +0 -8
  181. package/dist/src/components/layout/LayoutSnackbar.js +0 -25
  182. package/dist/src/components/layout/LayoutSnackbar.js.map +0 -1
  183. package/dist/src/components/layout/NavigationDrawer.d.ts +0 -11
  184. package/dist/src/components/layout/NavigationDrawer.js +0 -70
  185. package/dist/src/components/layout/NavigationDrawer.js.map +0 -1
  186. package/dist/src/components/layout/NotificationMenu.d.ts +0 -8
  187. package/dist/src/components/layout/NotificationMenu.js +0 -26
  188. package/dist/src/components/layout/NotificationMenu.js.map +0 -1
  189. package/dist/src/components/layout/TypographyWithIcon.js +0 -22
  190. package/dist/src/components/layout/TypographyWithIcon.js.map +0 -1
  191. package/dist/src/components/layout/Unauthorized.d.ts +0 -2
  192. package/dist/src/components/layout/Unauthorized.js +0 -26
  193. package/dist/src/components/layout/Unauthorized.js.map +0 -1
  194. package/dist/src/contexts/LayoutContext.d.ts +0 -40
  195. package/dist/src/contexts/LayoutContext.js +0 -60
  196. package/dist/src/contexts/LayoutContext.js.map +0 -1
  197. package/dist/src/contexts/UserContext.d.ts +0 -24
  198. package/dist/src/contexts/UserContext.js +0 -55
  199. package/dist/src/contexts/UserContext.js.map +0 -1
  200. package/dist/src/hooks/FormHooks.d.ts +0 -46
  201. package/dist/src/hooks/FormHooks.js +0 -31
  202. package/dist/src/hooks/FormHooks.js.map +0 -1
  203. package/dist/src/hooks/UseSnackbar.d.ts +0 -10
  204. package/dist/src/hooks/UseSnackbar.js +0 -23
  205. package/dist/src/hooks/UseSnackbar.js.map +0 -1
  206. package/dist/src/hooks/UseUser.d.ts +0 -10
  207. package/dist/src/hooks/UseUser.js +0 -25
  208. package/dist/src/hooks/UseUser.js.map +0 -1
  209. package/dist/src/index.d.ts +0 -20
  210. package/dist/src/index.js +0 -15
  211. package/dist/src/index.js.map +0 -1
  212. package/dist/src/models/Error.d.ts +0 -6
  213. package/dist/src/models/Error.js +0 -2
  214. package/dist/src/models/Error.js.map +0 -1
  215. package/dist/src/models/KeycloakSettings.d.ts +0 -8
  216. package/dist/src/models/KeycloakSettings.js +0 -2
  217. package/dist/src/models/KeycloakSettings.js.map +0 -1
  218. package/dist/src/models/LayoutPaletteColorOptions.d.ts +0 -6
  219. package/dist/src/models/LayoutPaletteColorOptions.js +0 -2
  220. package/dist/src/models/LayoutPaletteColorOptions.js.map +0 -1
  221. package/dist/src/models/LayoutRoute.d.ts +0 -14
  222. package/dist/src/models/LayoutRoute.js +0 -2
  223. package/dist/src/models/LayoutRoute.js.map +0 -1
  224. package/dist/src/models/Notification.d.ts +0 -9
  225. package/dist/src/models/Notification.js +0 -2
  226. package/dist/src/models/Notification.js.map +0 -1
  227. package/dist/src/models/PeoplesoftDepartment.d.ts +0 -14
  228. package/dist/src/models/PeoplesoftDepartment.js +0 -2
  229. package/dist/src/models/PeoplesoftDepartment.js.map +0 -1
  230. package/dist/src/models/PeoplesoftEmployee.d.ts +0 -34
  231. package/dist/src/models/PeoplesoftEmployee.js +0 -2
  232. package/dist/src/models/PeoplesoftEmployee.js.map +0 -1
  233. package/dist/src/models/Snackbar.d.ts +0 -15
  234. package/dist/src/models/Snackbar.js +0 -2
  235. package/dist/src/models/Snackbar.js.map +0 -1
  236. package/dist/src/models/User.d.ts +0 -27
  237. package/dist/src/models/User.js +0 -11
  238. package/dist/src/models/User.js.map +0 -1
  239. package/dist/src/models/types/EmployeeCategoryGroup.d.ts +0 -1
  240. package/dist/src/models/types/EmployeeCategoryGroup.js +0 -2
  241. package/dist/src/models/types/EmployeeCategoryGroup.js.map +0 -1
  242. package/dist/src/models/types/EmployeeStatus.d.ts +0 -1
  243. package/dist/src/models/types/EmployeeStatus.js +0 -2
  244. package/dist/src/models/types/EmployeeStatus.js.map +0 -1
  245. package/dist/src/utils/Auth.d.ts +0 -12
  246. package/dist/src/utils/Auth.js +0 -49
  247. package/dist/src/utils/Auth.js.map +0 -1
  248. package/dist/src/utils/Fetches.d.ts +0 -5
  249. package/dist/src/utils/Fetches.js +0 -66
  250. package/dist/src/utils/Fetches.js.map +0 -1
  251. package/dist/src/utils/FormUtils.d.ts +0 -7
  252. package/dist/src/utils/FormUtils.js +0 -9
  253. package/dist/src/utils/FormUtils.js.map +0 -1
  254. package/dist/src/utils/Helpers.d.ts +0 -11
  255. package/dist/src/utils/Helpers.js +0 -26
  256. package/dist/src/utils/Helpers.js.map +0 -1
  257. package/dist/tsconfig.tsbuildinfo +0 -1
  258. package/src/components/Layout.tsx +0 -183
  259. package/src/components/dataGrid/ChipInputCell.tsx +0 -31
  260. package/src/components/dataGrid/EditableColumnHeader.tsx +0 -7
  261. package/src/components/dataGrid/GridToolbar.tsx +0 -63
  262. package/src/components/dataGrid/TableContainer.tsx +0 -39
  263. package/src/components/form/FormAutocomplete.tsx +0 -34
  264. package/src/components/form/FormCheckbox.tsx +0 -32
  265. package/src/components/form/FormDatePicker.tsx +0 -34
  266. package/src/components/form/FormDateTimePicker.tsx +0 -34
  267. package/src/components/form/FormNumberField.tsx +0 -33
  268. package/src/components/form/FormRadioGroup.tsx +0 -43
  269. package/src/components/form/FormSlider.tsx +0 -28
  270. package/src/components/form/FormSubmitButton.tsx +0 -29
  271. package/src/components/form/FormSwitch.tsx +0 -32
  272. package/src/components/form/FormTextField.tsx +0 -26
  273. package/src/components/layout/AccountMenu.tsx +0 -160
  274. package/src/components/layout/DevelopmentBanner.tsx +0 -54
  275. package/src/components/layout/ErrorPage.tsx +0 -34
  276. package/src/components/layout/LayoutDialog.tsx +0 -50
  277. package/src/components/layout/LayoutSnackbar.tsx +0 -44
  278. package/src/components/layout/NavigationDrawer.tsx +0 -131
  279. package/src/components/layout/NotificationMenu.tsx +0 -76
  280. package/src/components/layout/TypographyWithIcon.tsx +0 -35
  281. package/src/components/layout/Unauthorized.tsx +0 -37
  282. package/src/contexts/LayoutContext.tsx +0 -127
  283. package/src/contexts/UserContext.tsx +0 -88
  284. package/src/hooks/FormHooks.ts +0 -33
  285. package/src/hooks/UseSnackbar.tsx +0 -28
  286. package/src/hooks/UseUser.tsx +0 -29
  287. package/src/index.ts +0 -27
  288. package/src/models/Error.tsx +0 -6
  289. package/src/models/KeycloakSettings.ts +0 -8
  290. package/src/models/LayoutPaletteColorOptions.tsx +0 -7
  291. package/src/models/LayoutRoute.ts +0 -15
  292. package/src/models/Notification.ts +0 -10
  293. package/src/models/PeoplesoftDepartment.ts +0 -15
  294. package/src/models/PeoplesoftEmployee.ts +0 -35
  295. package/src/models/Snackbar.ts +0 -16
  296. package/src/models/User.ts +0 -13
  297. package/src/models/types/EmployeeCategoryGroup.ts +0 -1
  298. package/src/models/types/EmployeeStatus.ts +0 -1
  299. package/src/utils/Auth.ts +0 -58
  300. package/src/utils/Fetches.ts +0 -83
  301. package/src/utils/FormUtils.ts +0 -22
  302. package/src/utils/Helpers.ts +0 -27
  303. package/tsconfig.json +0 -29
package/dist/query.js ADDED
@@ -0,0 +1,3 @@
1
+ import { n as e, t } from "./queries-D-DV5lCw.js";
2
+ import { t as n } from "./queryClient-B__OEZ70.js";
3
+ export { t as query, n as queryClient, e as useUploadFile };
@@ -0,0 +1,7 @@
1
+ import { QueryClient as e } from "@tanstack/react-query";
2
+ //#region src/lib/queryClient.ts
3
+ var t = new e();
4
+ //#endregion
5
+ export { t };
6
+
7
+ //# sourceMappingURL=queryClient-B__OEZ70.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryClient-B__OEZ70.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,IAAaC,IAAc,IAAID,GAAa"}
@@ -0,0 +1,157 @@
1
+ import { permissions as e, scopes as t } from "virtual:wcz-layout";
2
+ import { z as n } from "zod";
3
+ import { EventType as r, InteractionRequiredAuthError as i, NavigationClient as a, PublicClientApplication as o } from "@azure/msal-browser";
4
+ import { createEnv as s } from "@t3-oss/env-core";
5
+ import { createClientOnlyFn as c, createIsomorphicFn as l } from "@tanstack/react-start";
6
+ //#region src/env.ts
7
+ var u = s({
8
+ clientPrefix: "VITE_",
9
+ client: {
10
+ VITE_ENTRA_CLIENT_ID: n.string(),
11
+ VITE_ENTRA_TENANT_ID: n.string(),
12
+ VITE_APP_TITLE: n.string(),
13
+ VITE_MUI_LICENSE_KEY: n.string()
14
+ },
15
+ runtimeEnv: import.meta.env,
16
+ emptyStringAsUndefined: !0
17
+ }), d = s({
18
+ server: {
19
+ ENTRA_CLIENT_ID: n.string(),
20
+ ENTRA_TENANT_ID: n.string(),
21
+ ENTRA_CLIENT_SECRET: n.string()
22
+ },
23
+ runtimeEnv: process.env,
24
+ emptyStringAsUndefined: !0
25
+ }), f = new o({ auth: {
26
+ clientId: u.VITE_ENTRA_CLIENT_ID,
27
+ authority: `https://login.microsoftonline.com/${u.VITE_ENTRA_TENANT_ID}`,
28
+ redirectUri: "/"
29
+ } });
30
+ f.initialize().then(() => (f.addEventCallback((e) => {
31
+ if (e.eventType === r.LOGIN_SUCCESS && e.payload) {
32
+ let t = e.payload.account;
33
+ f.setActiveAccount(t);
34
+ }
35
+ }), f.handleRedirectPromise())).then((e) => {
36
+ e?.account && f.setActiveAccount(e.account);
37
+ });
38
+ var p = class extends a {
39
+ constructor(e) {
40
+ super(), this.navigate = e;
41
+ }
42
+ async navigateInternal(e, t) {
43
+ let n = e.replace(location.origin, "");
44
+ return this.navigate({
45
+ to: n,
46
+ replace: t.noHistory
47
+ }), !1;
48
+ }
49
+ }, m = /* @__PURE__ */ new Set(), h = (e) => (m.add(e), () => {
50
+ m.delete(e);
51
+ }), g = l().server(() => null).client(async () => {
52
+ let e = f.getActiveAccount();
53
+ return e?.idToken ? E(T(e.idToken)) : null;
54
+ }), _ = c(async (e) => {
55
+ let n = f.getActiveAccount();
56
+ if (!n) throw Error("No active account. User not signed in.");
57
+ let r = [...t[e]];
58
+ try {
59
+ let { accessToken: e } = await f.acquireTokenSilent({
60
+ scopes: r,
61
+ account: n
62
+ });
63
+ return e;
64
+ } catch (e) {
65
+ throw e instanceof i && m.forEach((e) => e(r)), e;
66
+ }
67
+ }), v = "#00506E", y = "#64DC00", b = class {
68
+ static get isAndroid() {
69
+ return /android/i.test(this.userAgent);
70
+ }
71
+ static get isIOS() {
72
+ return /iPad|iPhone|iPod/.test(this.userAgent);
73
+ }
74
+ static get isWindows() {
75
+ return /windows/i.test(this.userAgent);
76
+ }
77
+ static get isMacOS() {
78
+ return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);
79
+ }
80
+ static get userAgent() {
81
+ return typeof navigator > "u" ? "" : navigator.userAgent;
82
+ }
83
+ }, x = (e) => ({
84
+ meta: [
85
+ { charSet: "utf-8" },
86
+ {
87
+ name: "viewport",
88
+ content: "width=device-width, initial-scale=1"
89
+ },
90
+ { title: u.VITE_APP_TITLE },
91
+ {
92
+ name: "og:type",
93
+ content: "website"
94
+ },
95
+ {
96
+ name: "og:title",
97
+ content: u.VITE_APP_TITLE
98
+ },
99
+ {
100
+ name: "og:image",
101
+ content: "/favicon-32x32.png"
102
+ }
103
+ ],
104
+ links: [
105
+ {
106
+ rel: "apple-touch-icon",
107
+ sizes: "180x180",
108
+ href: "/apple-touch-icon.png"
109
+ },
110
+ {
111
+ rel: "icon",
112
+ type: "image/png",
113
+ sizes: "32x32",
114
+ href: "/favicon-32x32.png"
115
+ },
116
+ {
117
+ rel: "icon",
118
+ type: "image/png",
119
+ sizes: "16x16",
120
+ href: "/favicon-16x16.png"
121
+ },
122
+ {
123
+ rel: "manifest",
124
+ href: e?.manifest || "/manifest.json"
125
+ },
126
+ {
127
+ rel: "icon",
128
+ href: "/favicon.ico"
129
+ }
130
+ ]
131
+ }), S = (e) => async () => {
132
+ let t = await g();
133
+ if (!t?.hasPermission(e)) throw Error("You do not have permission to access this page.");
134
+ return { user: t };
135
+ }, C = (e) => {
136
+ let { meta: t } = e.state;
137
+ return {
138
+ isTouched: t.isTouched,
139
+ hasError: !!t.errors.length,
140
+ helperText: t.errors[0]?.message
141
+ };
142
+ }, w = (e) => e.replaceAll(/([a-z])([A-Z])/g, "$1-$2").replaceAll(/[\s_]+/g, "-").replaceAll(/[^a-zA-Z0-9-]/g, "").toLowerCase().replaceAll(/-+/g, "-").replaceAll(/(^-|-$)/g, ""), T = (e) => {
143
+ let t = e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), n = decodeURIComponent(atob(t).split("").map((e) => "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2)).join(""));
144
+ return JSON.parse(n);
145
+ }, E = (t) => ({
146
+ id: t.sub,
147
+ name: t.name?.split("/")[0],
148
+ email: t.preferred_username?.toLowerCase(),
149
+ department: t.department?.toUpperCase() || "",
150
+ employeeId: t.employeeId?.toUpperCase() || "",
151
+ companyName: t.companyName || "",
152
+ hasPermission: (n) => e[n].some((e) => (t.groups ?? []).includes(e))
153
+ });
154
+ //#endregion
155
+ export { C as a, w as c, g as d, f, d as h, E as i, p as l, u as m, v as n, S as o, h as p, y as r, x as s, b as t, _ as u };
156
+
157
+ //# sourceMappingURL=utils-C4oJ0tr5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-C4oJ0tr5.js","names":["AuthenticationResult","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","initialize","then","addEventCallback","event","eventType","LOGIN_SUCCESS","payload","account","setActiveAccount","handleRedirectPromise","response","TanStackNavigationClient","constructor","navigate","ReturnType","navigateInternal","url","options","relative","replace","location","origin","to","noHistory","TokenInteractionListener","Array","tokenInteractionListeners","Set","subscribeToTokenInteractionRequired","listener","add","delete","getUser","server","client","Promise","getActiveAccount","idToken","getAccessToken","scopeKey","Error","accessToken","acquireTokenSilent","error","forEach","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/env.ts","../src/lib/auth/msalClient.ts","../src/lib/utils.ts"],"sourcesContent":["import { createEnv } from \"@t3-oss/env-core\";\nimport { z } from \"zod\";\n\nexport const clientEnv = createEnv({\n clientPrefix: \"VITE_\",\n client: {\n VITE_ENTRA_CLIENT_ID: z.string(),\n VITE_ENTRA_TENANT_ID: z.string(),\n VITE_APP_TITLE: z.string(),\n VITE_MUI_LICENSE_KEY: z.string(),\n },\n runtimeEnv: import.meta.env,\n emptyStringAsUndefined: true,\n});\n\nexport const serverEnv = createEnv({\n server: {\n ENTRA_CLIENT_ID: z.string(),\n ENTRA_TENANT_ID: z.string(),\n ENTRA_CLIENT_SECRET: z.string(),\n },\n runtimeEnv: process.env,\n emptyStringAsUndefined: true,\n});\n","import {\r\n AuthenticationResult,\r\n EventMessage,\r\n EventType,\r\n InteractionRequiredAuthError,\r\n NavigationClient,\r\n NavigationOptions,\r\n PublicClientApplication,\r\n} from \"@azure/msal-browser\";\r\nimport { useNavigate } from \"@tanstack/react-router\";\r\nimport { createClientOnlyFn, createIsomorphicFn } from \"@tanstack/react-start\";\r\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\r\nimport { clientEnv } from \"~/env\";\r\nimport { buildUser, decodeJwt } from \"~/lib/utils\";\r\nimport type { User } from \"~/models/User\";\r\n\r\nexport const pca = new PublicClientApplication({\r\n auth: {\r\n clientId: clientEnv.VITE_ENTRA_CLIENT_ID,\r\n authority: `https://login.microsoftonline.com/${clientEnv.VITE_ENTRA_TENANT_ID}`,\r\n redirectUri: \"/\",\r\n },\r\n});\r\n\r\npca\r\n .initialize()\r\n .then(() => {\r\n pca.addEventCallback((event: EventMessage) => {\r\n if (event.eventType === EventType.LOGIN_SUCCESS && event.payload) {\r\n const payload = event.payload as AuthenticationResult;\r\n const account = payload.account;\r\n pca.setActiveAccount(account);\r\n }\r\n });\r\n\r\n return pca.handleRedirectPromise();\r\n })\r\n .then((response) => {\r\n if (response?.account) pca.setActiveAccount(response.account);\r\n });\r\n\r\nexport class TanStackNavigationClient extends NavigationClient {\r\n constructor(private navigate: ReturnType<typeof useNavigate>) {\r\n super();\r\n }\r\n async navigateInternal(url: string, options: NavigationOptions) {\r\n const relative = url.replace(location.origin, \"\");\r\n this.navigate({ to: relative, replace: options.noHistory });\r\n return false;\r\n }\r\n}\r\n\r\ntype TokenInteractionListener = (scopes: Array<string>) => void;\r\n\r\nconst tokenInteractionListeners = new Set<TokenInteractionListener>();\r\n\r\nexport const subscribeToTokenInteractionRequired = (listener: TokenInteractionListener) => {\r\n tokenInteractionListeners.add(listener);\r\n\r\n return () => {\r\n tokenInteractionListeners.delete(listener);\r\n };\r\n};\r\n\r\nexport const getUser = createIsomorphicFn()\r\n .server(() => null)\r\n .client(async (): Promise<User | null> => {\r\n const account = pca.getActiveAccount();\r\n if (!account?.idToken) return null;\r\n\r\n return buildUser(decodeJwt(account.idToken));\r\n });\r\n\r\n/**\r\n * Token Acquisition: Get authenticated access token.\r\n * Use when: Making API calls from the browser to secured endpoints\r\n */\r\nexport const getAccessToken = createClientOnlyFn(async (scopeKey: keyof typeof definedScopes) => {\r\n const account = pca.getActiveAccount();\r\n if (!account) throw new Error(\"No active account. User not signed in.\");\r\n\r\n const scopes = [...definedScopes[scopeKey]];\r\n\r\n try {\r\n const { accessToken } = await pca.acquireTokenSilent({ scopes, account });\r\n return accessToken;\r\n } catch (error) {\r\n if (error instanceof InteractionRequiredAuthError) {\r\n tokenInteractionListeners.forEach((listener) => listener(scopes));\r\n }\r\n\r\n throw error;\r\n }\r\n});\r\n","import type { AnyFieldApi } from \"@tanstack/react-form\";\r\nimport { permissions } from \"virtual:wcz-layout\";\r\nimport { clientEnv } from \"~/env\";\r\nimport type { TokenPayload } from \"~/models/TokenPayload\";\r\nimport type { User } from \"~/models/User\";\r\nimport { getUser } from \"./auth/msalClient\";\r\n\r\nexport const WISTRON_PRIMARY_COLOR = \"#00506E\";\r\nexport const WISTRON_SECONDARY_COLOR = \"#64DC00\";\r\n\r\nexport class Platform {\r\n static get isAndroid() {\r\n return /android/i.test(this.userAgent);\r\n }\r\n static get isIOS() {\r\n return /iPad|iPhone|iPod/.test(this.userAgent);\r\n }\r\n static get isWindows() {\r\n return /windows/i.test(this.userAgent);\r\n }\r\n static get isMacOS() {\r\n return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);\r\n }\r\n\r\n private static get userAgent() {\r\n return typeof navigator === \"undefined\" ? \"\" : navigator.userAgent;\r\n }\r\n}\r\n\r\ninterface RootRouteHeadOptions {\r\n manifest?: string;\r\n}\r\n\r\nexport const rootRouteHead = (options?: RootRouteHeadOptions) => ({\r\n meta: [\r\n { charSet: \"utf-8\" },\r\n { name: \"viewport\", content: \"width=device-width, initial-scale=1\" },\r\n { title: clientEnv.VITE_APP_TITLE },\r\n { name: \"og:type\", content: \"website\" },\r\n { name: \"og:title\", content: clientEnv.VITE_APP_TITLE },\r\n { name: \"og:image\", content: \"/favicon-32x32.png\" },\r\n ],\r\n links: [\r\n { rel: \"apple-touch-icon\", sizes: \"180x180\", href: \"/apple-touch-icon.png\" },\r\n { rel: \"icon\", type: \"image/png\", sizes: \"32x32\", href: \"/favicon-32x32.png\" },\r\n { rel: \"icon\", type: \"image/png\", sizes: \"16x16\", href: \"/favicon-16x16.png\" },\r\n { rel: \"manifest\", href: options?.manifest || \"/manifest.json\" },\r\n { rel: \"icon\", href: \"/favicon.ico\" },\r\n ],\r\n});\r\n\r\nexport const requirePermission = (permissionKey: keyof typeof permissions) => {\r\n return async () => {\r\n const user = await getUser();\r\n\r\n if (!user?.hasPermission(permissionKey))\r\n throw new Error(\"You do not have permission to access this page.\");\r\n\r\n return { user };\r\n };\r\n};\r\n\r\n/* Internal Utils */\r\nexport type FormOmittedProps =\r\n | \"name\"\r\n | \"value\"\r\n | \"onChange\"\r\n | \"onBlur\"\r\n | \"error\"\r\n | \"helperText\"\r\n | \"renderInput\"\r\n | \"type\"\r\n | \"aria-label\";\r\n\r\nexport const getFieldStatus = (field: AnyFieldApi) => {\r\n const { meta } = field.state;\r\n\r\n const isTouched = meta.isTouched;\r\n const hasError = !!meta.errors.length;\r\n const helperText = meta.errors[0]?.message;\r\n\r\n return { isTouched, hasError, helperText };\r\n};\r\n\r\nexport const toKebabCase = (str: string): string => {\r\n return str\r\n .replaceAll(/([a-z])([A-Z])/g, \"$1-$2\")\r\n .replaceAll(/[\\s_]+/g, \"-\")\r\n .replaceAll(/[^a-zA-Z0-9-]/g, \"\")\r\n .toLowerCase()\r\n .replaceAll(/-+/g, \"-\")\r\n .replaceAll(/(^-|-$)/g, \"\");\r\n};\r\n\r\nexport const decodeJwt = (token: string) => {\r\n const base64Payload = token.split(\".\")[1];\r\n const base64 = base64Payload.replace(/-/g, \"+\").replace(/_/g, \"/\");\r\n const payload = decodeURIComponent(\r\n atob(base64)\r\n .split(\"\")\r\n .map((c) => \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2))\r\n .join(\"\"),\r\n );\r\n return JSON.parse(payload) as TokenPayload;\r\n};\r\n\r\nexport const buildUser = (payload: TokenPayload): User => ({\r\n id: payload.sub,\r\n name: payload.name?.split(\"/\")[0],\r\n email: payload.preferred_username?.toLowerCase(),\r\n department: payload.department?.toUpperCase() || \"\",\r\n employeeId: payload.employeeId?.toUpperCase() || \"\",\r\n companyName: payload.companyName || \"\",\r\n hasPermission: (key: keyof typeof permissions) => {\r\n const allowedGroups = permissions[key];\r\n return allowedGroups.some((k) => (payload.groups ?? []).includes(k));\r\n },\r\n});\r\n"],"mappings":";;;;;;AAGA,IAAa,IAAY,EAAU;CACjC,cAAc;CACd,QAAQ;EACN,sBAAsB,EAAE,QAAQ;EAChC,sBAAsB,EAAE,QAAQ;EAChC,gBAAgB,EAAE,QAAQ;EAC1B,sBAAsB,EAAE,QAAO;EAChC;CACD,YAAY,OAAA,KAAA;CACZ,wBAAwB;CACzB,CAAC,EAEW,IAAY,EAAU;CACjC,QAAQ;EACN,iBAAiB,EAAE,QAAQ;EAC3B,iBAAiB,EAAE,QAAQ;EAC3B,qBAAqB,EAAE,QAAO;EAC/B;CACD,YAAY,QAAQ;CACpB,wBAAwB;CACzB,CAAC,ECPWgB,IAAM,IAAIV,EAAwB,EAC7CW,MAAM;CACJC,UAAUN,EAAUO;CACpBC,WAAW,qCAAqCR,EAAUS;CAC1DC,aAAa;CACf,EACD,CAAC;AAEFN,EACGO,YAAY,CACZC,YACCR,EAAIS,kBAAkBC,MAAwB;AAC5C,KAAIA,EAAMC,cAAczB,EAAU0B,iBAAiBF,EAAMG,SAAS;EAEhE,IAAMC,IADUJ,EAAMG,QACEC;AACxBd,IAAIe,iBAAiBD,EAAQ;;EAE/B,EAEKd,EAAIgB,uBAAuB,EAClC,CACDR,MAAMS,MAAa;AAClB,CAAIA,GAAUH,WAASd,E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aC,MAAkB;CAE1C,IAAMG,IADgBH,EAAME,MAAM,IAAI,CAAC,GACVE,QAAQ,MAAM,IAAI,CAACA,QAAQ,MAAM,IAAI,EAC5DC,IAAUC,mBACdC,KAAKJ,EAAO,CACTD,MAAM,GAAG,CACTM,KAAKC,MAAM,OAAO,OAAOA,EAAEC,WAAW,EAAE,CAACC,SAAS,GAAG,EAAEC,MAAM,GAAG,CAAC,CACjEC,KAAK,GACV,CAAC;AACD,QAAOC,KAAKC,MAAMV,EAAQ;GAGfW,KAAaX,OAAiC;CACzDY,IAAIZ,EAAQa;CACZ/C,MAAMkC,EAAQlC,MAAM+B,MAAM,IAAI,CAAC;CAC/BiB,OAAOd,EAAQe,oBAAoBtB,aAAa;CAChDuB,YAAYhB,EAAQgB,YAAYC,aAAa,IAAI;CACjDC,YAAYlB,EAAQkB,YAAYD,aAAa,IAAI;CACjDE,aAAanB,EAAQmB,eAAe;CACpCzC,gBAAgB0C,MACQ3E,EAAY2E,GACbE,MAAMC,OAAOvB,EAAQwB,UAAU,EAAE,EAAEC,SAASF,EAAE,CAAC;CAEvE"}
package/dist/utils.js ADDED
@@ -0,0 +1,35 @@
1
+ import { h as e, o as t, t as n, u as r } from "./utils-C4oJ0tr5.js";
2
+ import { t as i } from "./dist-Bxzg1_9c.js";
3
+ import { t as a } from "i18next";
4
+ import { scopes as o } from "virtual:wcz-layout";
5
+ import { createEnv as s } from "@t3-oss/env-core";
6
+ import { createServerOnlyFn as c } from "@tanstack/react-start";
7
+ import { ConfidentialClientApplication as l } from "@azure/msal-node";
8
+ //#region src/lib/auth/msalServer.ts
9
+ var u = null;
10
+ function d() {
11
+ return u ??= new l({ auth: {
12
+ clientId: e.ENTRA_CLIENT_ID,
13
+ clientSecret: e.ENTRA_CLIENT_SECRET,
14
+ authority: `https://login.microsoftonline.com/${e.ENTRA_TENANT_ID}`
15
+ } }), u;
16
+ }
17
+ var f = c(async (e, t) => {
18
+ let n = d(), r = [...o[t]], i = await n.acquireTokenOnBehalfOf({
19
+ oboAssertion: e,
20
+ scopes: r
21
+ });
22
+ if (!i) throw Error("Failed to acquire OBO token");
23
+ return i.accessToken;
24
+ }), p = c(async (e) => {
25
+ let t = d(), n = o[e].map((e) => {
26
+ let t = e.lastIndexOf("/");
27
+ return `${e.substring(0, t)}/.default`;
28
+ }), r = [...new Set(n)], i = await t.acquireTokenByClientCredential({ scopes: r });
29
+ if (!i) throw Error("Failed to acquire app token");
30
+ return i.accessToken;
31
+ });
32
+ //#endregion
33
+ export { n as Platform, s as createEnv, r as getAccessToken, p as getAppToken, f as getTokenOnBehalfOf, t as requirePermission, a as t, i as uuidv7 };
34
+
35
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["createServerOnlyFn","ConfidentialClientApplication","scopes","definedScopes","serverEnv","ccaInstance","getCCA","auth","clientId","ENTRA_CLIENT_ID","clientSecret","ENTRA_CLIENT_SECRET","authority","ENTRA_TENANT_ID","getTokenOnBehalfOf","userToken","scopeKey","Promise","cca","result","acquireTokenOnBehalfOf","oboAssertion","Error","accessToken","getAppToken","defaultScopes","map","scope","lastSlash","lastIndexOf","baseUri","substring","uniqueScopes","Set","acquireTokenByClientCredential"],"sources":["../src/lib/auth/msalServer.ts"],"sourcesContent":["import { createServerOnlyFn } from \"@tanstack/react-start\";\nimport { ConfidentialClientApplication } from \"@azure/msal-node\";\nimport { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport { serverEnv } from \"~/env\";\n\n// Singleton instance for server\nlet ccaInstance: ConfidentialClientApplication | null = null;\nfunction getCCA(): ConfidentialClientApplication {\n ccaInstance ??= new ConfidentialClientApplication({\n auth: {\n clientId: serverEnv.ENTRA_CLIENT_ID,\n clientSecret: serverEnv.ENTRA_CLIENT_SECRET,\n authority: `https://login.microsoftonline.com/${serverEnv.ENTRA_TENANT_ID}`,\n },\n });\n return ccaInstance;\n}\n\n/**\n * On-Behalf-Of flow: Exchange user token for a token to call downstream API\n * Use when: Server needs to call microservice on behalf of the logged-in user\n */\nexport const getTokenOnBehalfOf = createServerOnlyFn(\n async (userToken: string, scopeKey: keyof typeof definedScopes): Promise<string> => {\n const cca = getCCA();\n const scopes = [...definedScopes[scopeKey]];\n const result = await cca.acquireTokenOnBehalfOf({\n oboAssertion: userToken,\n scopes,\n });\n if (!result) throw new Error(\"Failed to acquire OBO token\");\n return result.accessToken;\n },\n);\n\n/**\n * Client Credentials flow: Get app-only token (no user context)\n * Use when: Background jobs, scheduled tasks, service-to-service calls\n */\nexport const getAppToken = createServerOnlyFn(\n async (scopeKey: keyof typeof definedScopes): Promise<string> => {\n const cca = getCCA();\n const scopes = definedScopes[scopeKey];\n const defaultScopes = scopes.map((scope) => {\n const lastSlash = scope.lastIndexOf(\"/\");\n const baseUri = scope.substring(0, lastSlash);\n return `${baseUri}/.default`;\n });\n const uniqueScopes = [...new Set(defaultScopes)];\n const result = await cca.acquireTokenByClientCredential({ scopes: uniqueScopes });\n if (!result) throw new Error(\"Failed to acquire app token\");\n return result.accessToken;\n },\n);\n"],"mappings":";;;;;;;;AAMA,IAAIK,IAAoD;AACxD,SAASC,IAAwC;AAQ/C,QAPAD,MAAgB,IAAIJ,EAA8B,EAChDM,MAAM;EACJC,UAAUJ,EAAUK;EACpBC,cAAcN,EAAUO;EACxBC,WAAW,qCAAqCR,EAAUS;EAC5D,EACD,CAAC,EACKR;;AAOT,IAAaS,IAAqBd,EAChC,OAAOe,GAAmBC,MAA0D;CAClF,IAAME,IAAMZ,GAAQ,EACdJ,IAAS,CAAC,GAAGC,EAAca,GAAU,EACrCG,IAAS,MAAMD,EAAIE,uBAAuB;EAC9CC,cAAcN;EACdb,QAAAA;EACD,CAAC;AACF,KAAI,CAACiB,EAAQ,OAAUG,MAAM,8BAA8B;AAC3D,QAAOH,EAAOI;EAEjB,EAMYC,IAAcxB,EACzB,OAAOgB,MAA0D;CAC/D,IAAME,IAAMZ,GAAQ,EAEdmB,IADStB,EAAca,GACAU,KAAKC,MAAU;EAC1C,IAAMC,IAAYD,EAAME,YAAY,IAAI;AAExC,SAAO,GADSF,EAAMI,UAAU,GAAGH,EAAU,CAC5B;GACjB,EACII,IAAe,CAAC,GAAG,IAAIC,IAAIR,EAAc,CAAC,EAC1CN,IAAS,MAAMD,EAAIgB,+BAA+B,EAAEhC,QAAQ8B,GAAc,CAAC;AACjF,KAAI,CAACb,EAAQ,OAAUG,MAAM,8BAA8B;AAC3D,QAAOH,EAAOI;EAEjB"}
package/dist/vite.js ADDED
@@ -0,0 +1,110 @@
1
+ import e from "zod";
2
+ import t from "axios";
3
+ import n from "node:fs";
4
+ import r from "node:https";
5
+ import i from "node:path";
6
+ import { loadEnv as a } from "vite";
7
+ //#region src/models/VaultConfig.ts
8
+ var o = e.object({
9
+ VAULT_ADDRESS: e.url(),
10
+ VAULT_USERNAME: e.string().min(1),
11
+ VAULT_PASSWORD: e.string().min(1),
12
+ VAULT_SECRET_PATH: e.string().min(1),
13
+ VAULT_MOUNT_POINT: e.string().default("release")
14
+ });
15
+ //#endregion
16
+ //#region src/lib/vite-plugin.ts
17
+ async function s(e) {
18
+ let { VAULT_ADDRESS: n, VAULT_USERNAME: i, VAULT_PASSWORD: a, VAULT_SECRET_PATH: s, VAULT_MOUNT_POINT: c } = o.parse(e), l = t.create({
19
+ baseURL: n,
20
+ httpsAgent: new r.Agent({ rejectUnauthorized: !1 })
21
+ }), { data: u } = await l.post(`/v1/auth/userpass/login/${i}`, { password: a }), { data: d } = await l.get(`/v1/${c}/data/${s}`, { headers: { "X-Vault-Token": u.auth.client_token } }), f = d?.data?.data;
22
+ if (!f) throw Error("No secrets found");
23
+ return Object.fromEntries(Object.entries(f).map(([e, t]) => [e, typeof t == "string" ? t : JSON.stringify(t)]));
24
+ }
25
+ async function c(e) {
26
+ if (e !== "serve") return;
27
+ let t = a("development", process.cwd(), "");
28
+ if (t.VAULT_ADDRESS) try {
29
+ let e = await s(t);
30
+ Object.entries(e).forEach(([e, t]) => {
31
+ process.env[e] ??= t;
32
+ });
33
+ } catch (e) {
34
+ console.warn("[vite:wcz-layout] Vault failed:", e instanceof Error ? e.message : e);
35
+ }
36
+ }
37
+ function l(e, t) {
38
+ n.existsSync(e) || n.mkdirSync(e, { recursive: !0 });
39
+ let r = i.join(e, "en.json");
40
+ n.existsSync(r) || n.writeFileSync(r, JSON.stringify({}));
41
+ let a = n.readdirSync(e), o = {};
42
+ for (let r of a.filter((e) => e.endsWith(".json"))) {
43
+ let a = i.basename(r, ".json"), s = i.join(e, r);
44
+ try {
45
+ o[a] = { translation: JSON.parse(n.readFileSync(s, "utf-8")) };
46
+ } catch {
47
+ o[a] = { translation: {} };
48
+ }
49
+ t(s);
50
+ }
51
+ return o;
52
+ }
53
+ function u(e, t) {
54
+ let r = i.dirname(e);
55
+ n.existsSync(r) || n.mkdirSync(r, { recursive: !0 }), n.existsSync(e) || n.writeFileSync(e, "export const permissions = {\n admin: [\"wcz-developers\"]\n} as const;"), t(e);
56
+ }
57
+ function d(e, t) {
58
+ let r = i.dirname(e);
59
+ n.existsSync(r) || n.mkdirSync(r, { recursive: !0 }), n.existsSync(e) || n.writeFileSync(e, "export const scopes = {\n} as const;"), t(e);
60
+ }
61
+ function f() {
62
+ let e = "virtual:wcz-layout", t = "\0" + e, n, r, a;
63
+ return {
64
+ name: "vite:wcz-layout",
65
+ enforce: "pre",
66
+ configResolved(e) {
67
+ n = i.resolve(e.root, "src/locales"), r = i.resolve(e.root, "src/lib/auth/permissions.ts"), a = i.resolve(e.root, "src/lib/auth/scopes.ts");
68
+ },
69
+ async config(t, { command: n }) {
70
+ return await c(n), {
71
+ optimizeDeps: { exclude: [e] },
72
+ ssr: { noExternal: ["@mui/*", "@emotion/*"] }
73
+ };
74
+ },
75
+ configureServer(e) {
76
+ let i = (i) => {
77
+ if (i.includes(n) || i === r || i === a) {
78
+ let n = e.moduleGraph.getModuleById(t);
79
+ n && e.moduleGraph.invalidateModule(n), e.ws.send({
80
+ type: "full-reload",
81
+ path: "*"
82
+ });
83
+ }
84
+ };
85
+ e.watcher.add([
86
+ n,
87
+ r,
88
+ a
89
+ ]), e.watcher.on("add", i), e.watcher.on("change", i), e.watcher.on("unlink", i);
90
+ },
91
+ resolveId(n) {
92
+ return n === e ? t : null;
93
+ },
94
+ load(e) {
95
+ if (e !== t) return null;
96
+ let o = l(n, this.addWatchFile.bind(this));
97
+ u(r, this.addWatchFile.bind(this)), d(a, this.addWatchFile.bind(this));
98
+ let s = r.split(i.sep).join(i.posix.sep), c = a.split(i.sep).join(i.posix.sep);
99
+ return `
100
+ export const resources = ${JSON.stringify(o)};
101
+ export { permissions } from "${s}";
102
+ export { scopes } from "${c}";
103
+ `;
104
+ }
105
+ };
106
+ }
107
+ //#endregion
108
+ export { f as viteWczLayout };
109
+
110
+ //# sourceMappingURL=vite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.js","names":["z","VaultConfigSchema","object","VAULT_ADDRESS","url","VAULT_USERNAME","string","min","VAULT_PASSWORD","VAULT_SECRET_PATH","VAULT_MOUNT_POINT","default","VaultConfig","infer","fs","https","path","axios","loadEnv","VaultConfigSchema","Resource","Plugin","fetchVaultSecrets","env","Record","Promise","config","parse","VAULT_ADDRESS","VAULT_USERNAME","VAULT_PASSWORD","VAULT_SECRET_PATH","VAULT_MOUNT_POINT","client","create","baseURL","httpsAgent","Agent","rejectUnauthorized","data","loginData","post","password","secretData","get","headers","auth","client_token","secrets","Error","Object","fromEntries","entries","map","key","value","JSON","stringify","loadVaultSecrets","command","process","cwd","forEach","e","console","warn","message","loadLocaleResources","localesPath","addWatchFile","existsSync","mkdirSync","recursive","enPath","join","writeFileSync","files","readdirSync","resources","file","filter","f","endsWith","lang","basename","filePath","translation","readFileSync","ensurePermissionsFile","permissionsPath","dir","dirname","ensureScopesFile","scopesPath","viteWczLayout","virtualModuleId","resolvedVirtualModuleId","name","enforce","configResolved","resolvedConfig","resolve","root","_","optimizeDeps","exclude","ssr","noExternal","configureServer","server","refresh","includes","module","moduleGraph","getModuleById","invalidateModule","ws","send","type","watcher","add","on","resolveId","id","load","bind","normalizedPermissionsPath","split","sep","posix","normalizedScopesPath"],"sources":["../src/models/VaultConfig.ts","../src/lib/vite-plugin.ts"],"sourcesContent":["import z from \"zod\";\n\nexport const VaultConfigSchema = z.object({\n VAULT_ADDRESS: z.url(),\n VAULT_USERNAME: z.string().min(1),\n VAULT_PASSWORD: z.string().min(1),\n VAULT_SECRET_PATH: z.string().min(1),\n VAULT_MOUNT_POINT: z.string().default(\"release\"),\n});\n\nexport type VaultConfig = z.infer<typeof VaultConfigSchema>;\n","import fs from \"node:fs\";\nimport https from \"node:https\";\nimport path from \"node:path\";\nimport axios from \"axios\";\nimport { loadEnv } from \"vite\";\nimport { VaultConfigSchema } from \"../models/VaultConfig\";\nimport type { Resource } from \"i18next\";\nimport type { Plugin } from \"vite\";\n\nasync function fetchVaultSecrets(env: Record<string, string>): Promise<Record<string, string>> {\n const config = VaultConfigSchema.parse(env);\n const { VAULT_ADDRESS, VAULT_USERNAME, VAULT_PASSWORD, VAULT_SECRET_PATH, VAULT_MOUNT_POINT } =\n config;\n\n const client = axios.create({\n baseURL: VAULT_ADDRESS,\n httpsAgent: new https.Agent({ rejectUnauthorized: false }),\n });\n\n const { data: loginData } = await client.post(`/v1/auth/userpass/login/${VAULT_USERNAME}`, {\n password: VAULT_PASSWORD,\n });\n\n const { data: secretData } = await client.get(\n `/v1/${VAULT_MOUNT_POINT}/data/${VAULT_SECRET_PATH}`,\n {\n headers: { \"X-Vault-Token\": loginData.auth.client_token },\n },\n );\n\n const secrets = secretData?.data?.data;\n if (!secrets) throw new Error(\"No secrets found\");\n\n return Object.fromEntries(\n Object.entries(secrets).map(([key, value]) => [\n key,\n typeof value === \"string\" ? value : JSON.stringify(value),\n ]),\n );\n}\n\nasync function loadVaultSecrets(command: string): Promise<void> {\n if (command !== \"serve\") return;\n\n const env = loadEnv(\"development\", process.cwd(), \"\");\n if (!env.VAULT_ADDRESS) return;\n\n try {\n const secrets = await fetchVaultSecrets(env);\n Object.entries(secrets).forEach(([key, value]) => {\n process.env[key] ??= value;\n });\n } catch (e) {\n console.warn(\"[vite:wcz-layout] Vault failed:\", e instanceof Error ? e.message : e);\n }\n}\n\nfunction loadLocaleResources(localesPath: string, addWatchFile: (path: string) => void): Resource {\n if (!fs.existsSync(localesPath)) fs.mkdirSync(localesPath, { recursive: true });\n\n const enPath = path.join(localesPath, \"en.json\");\n if (!fs.existsSync(enPath)) fs.writeFileSync(enPath, JSON.stringify({}));\n\n const files = fs.readdirSync(localesPath);\n const resources: Resource = {};\n\n for (const file of files.filter((f) => f.endsWith(\".json\"))) {\n const lang = path.basename(file, \".json\");\n const filePath = path.join(localesPath, file);\n try {\n resources[lang] = { translation: JSON.parse(fs.readFileSync(filePath, \"utf-8\")) };\n } catch {\n resources[lang] = { translation: {} };\n }\n addWatchFile(filePath);\n }\n\n return resources;\n}\n\nfunction ensurePermissionsFile(\n permissionsPath: string,\n addWatchFile: (path: string) => void,\n): void {\n const dir = path.dirname(permissionsPath);\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n if (!fs.existsSync(permissionsPath)) {\n fs.writeFileSync(\n permissionsPath,\n 'export const permissions = {\\n admin: [\"wcz-developers\"]\\n} as const;',\n );\n }\n addWatchFile(permissionsPath);\n}\n\nfunction ensureScopesFile(scopesPath: string, addWatchFile: (path: string) => void): void {\n const dir = path.dirname(scopesPath);\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n if (!fs.existsSync(scopesPath)) {\n fs.writeFileSync(scopesPath, \"export const scopes = {\\n} as const;\");\n }\n addWatchFile(scopesPath);\n}\n\nexport function viteWczLayout(): Plugin {\n const virtualModuleId = \"virtual:wcz-layout\";\n const resolvedVirtualModuleId = \"\\0\" + virtualModuleId;\n\n let localesPath: string;\n let permissionsPath: string;\n let scopesPath: string;\n\n return {\n name: \"vite:wcz-layout\",\n enforce: \"pre\",\n configResolved(resolvedConfig) {\n localesPath = path.resolve(resolvedConfig.root, \"src/locales\");\n permissionsPath = path.resolve(resolvedConfig.root, \"src/lib/auth/permissions.ts\");\n scopesPath = path.resolve(resolvedConfig.root, \"src/lib/auth/scopes.ts\");\n },\n async config(_, { command }) {\n await loadVaultSecrets(command);\n\n return {\n optimizeDeps: { exclude: [virtualModuleId] },\n ssr: {\n noExternal: [\"@mui/*\", \"@emotion/*\"],\n },\n };\n },\n configureServer(server) {\n const refresh = (filePath: string) => {\n if (\n filePath.includes(localesPath) ||\n filePath === permissionsPath ||\n filePath === scopesPath\n ) {\n const module = server.moduleGraph.getModuleById(resolvedVirtualModuleId);\n if (module) server.moduleGraph.invalidateModule(module);\n server.ws.send({ type: \"full-reload\", path: \"*\" });\n }\n };\n\n server.watcher.add([localesPath, permissionsPath, scopesPath]);\n server.watcher.on(\"add\", refresh);\n server.watcher.on(\"change\", refresh);\n server.watcher.on(\"unlink\", refresh);\n },\n resolveId(id) {\n if (id === virtualModuleId) return resolvedVirtualModuleId;\n return null;\n },\n load(id) {\n if (id !== resolvedVirtualModuleId) return null;\n\n const resources = loadLocaleResources(localesPath, this.addWatchFile.bind(this));\n ensurePermissionsFile(permissionsPath, this.addWatchFile.bind(this));\n ensureScopesFile(scopesPath, this.addWatchFile.bind(this));\n\n const normalizedPermissionsPath = permissionsPath.split(path.sep).join(path.posix.sep);\n const normalizedScopesPath = scopesPath.split(path.sep).join(path.posix.sep);\n return `\n export const resources = ${JSON.stringify(resources)};\n export { permissions } from \"${normalizedPermissionsPath}\";\n export { scopes } from \"${normalizedScopesPath}\";\n `;\n },\n };\n}\n"],"mappings":";;;;;;;AAEA,IAAaC,IAAoBD,EAAEE,OAAO;CACxCC,eAAeH,EAAEI,KAAK;CACtBC,gBAAgBL,EAAEM,QAAQ,CAACC,IAAI,EAAE;CACjCC,gBAAgBR,EAAEM,QAAQ,CAACC,IAAI,EAAE;CACjCE,mBAAmBT,EAAEM,QAAQ,CAACC,IAAI,EAAE;CACpCG,mBAAmBV,EAAEM,QAAQ,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EAAgBsC,MAAM/G,EAAKgH,IAAI,CAACtD,KAAK1D,EAAKiH,MAAMD,IAAI,EAChFE,IAAuBrC,EAAWkC,MAAM/G,EAAKgH,IAAI,CAACtD,KAAK1D,EAAKiH,MAAMD,IAAI;AAC5E,UAAO;uCAC0BxE,KAAKC,UAAUqB,EAAU,CAAA;2CACrBgD,EAAyB;sCAC9BI,EAAoB;;;EAGvD"}
package/package.json CHANGED
@@ -1,62 +1,132 @@
1
- {
2
- "name": "wcz-layout",
3
- "license": "MIT",
4
- "author": "Dalibor Homola",
5
- "version": "6.7.2",
6
- "types": "dist/src/index.d.ts",
7
- "main": "dist/src/index.js",
8
- "module": "dist/src/index.js",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/src/index.d.ts",
12
- "import": "./dist/src/index.js",
13
- "default": "./dist/src/index.js"
14
- }
15
- },
16
- "scripts": {
17
- "npm-install": "npm install",
18
- "npm-update": "npm update",
19
- "analyze": "cem analyze --litelement",
20
- "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
21
- "build": "tsc && npm run analyze -- --exclude dist",
22
- "prepublish": "tsc && npm run analyze -- --exclude dist",
23
- "publish": "npm publish --tag legacy"
24
- },
25
- "dependencies": {
26
- "@azure/msal-browser": "^4.27.0",
27
- "@azure/msal-react": "^3.0.23",
28
- "uuidv7": "^1.0.1",
29
- "axios": "^1.13.2",
30
- "i18next": "^24.2.1",
31
- "i18next-browser-languagedetector": "^8.0.2",
32
- "i18next-http-backend": "^3.0.1",
33
- "react-i18next": "^15.0.1",
34
- "react-number-format": "^5.4.4",
35
- "use-local-storage-state": "^19.4.0",
36
- "zod-i18n-map": "^2.27.0"
37
- },
38
- "devDependencies": {
39
- "@custom-elements-manifest/analyzer": "^0.4.17",
40
- "@web/dev-server": "^0.1.28",
41
- "concurrently": "^5.3.0",
42
- "lit": "^2.0.2",
43
- "tslib": "^2.7.0",
44
- "typescript": "^5.5.4"
45
- },
46
- "peerDependencies": {
47
- "@emotion/react": "11.x",
48
- "@emotion/styled": "11.x",
49
- "@mui/icons-material": "6.x",
50
- "@mui/material": "6.x",
51
- "@mui/x-data-grid-premium": "7.x",
52
- "@mui/x-date-pickers-pro": "7.x",
53
- "@tanstack/react-query": "5.x",
54
- "@tanstack/react-form": "1.x",
55
- "moment": "2.x",
56
- "react": "18.x || 19.x",
57
- "react-dom": "18.x || 19.x",
58
- "react-router-dom": "6.x || 7.x",
59
- "zod": "3.x"
60
- },
61
- "customElements": "custom-elements.json"
62
- }
1
+ {
2
+ "name": "wcz-layout",
3
+ "version": "7.6.1",
4
+ "private": false,
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "type": "module",
9
+ "sideEffects": false,
10
+ "types": "./dist/exports/index.d.ts",
11
+ "typesVersions": {
12
+ "*": {
13
+ "components": [
14
+ "./dist/exports/components.d.ts"
15
+ ],
16
+ "hooks": [
17
+ "./dist/exports/hooks.d.ts"
18
+ ],
19
+ "middleware": [
20
+ "./dist/exports/middleware.d.ts"
21
+ ],
22
+ "models": [
23
+ "./dist/exports/models.d.ts"
24
+ ],
25
+ "query": [
26
+ "./dist/exports/query.d.ts"
27
+ ],
28
+ "utils": [
29
+ "./dist/exports/utils.d.ts"
30
+ ],
31
+ "vite": [
32
+ "./dist/exports/vite.d.ts"
33
+ ]
34
+ }
35
+ },
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/exports/index.d.ts",
39
+ "import": "./dist/index.js"
40
+ },
41
+ "./components": {
42
+ "types": "./dist/exports/components.d.ts",
43
+ "import": "./dist/components.js"
44
+ },
45
+ "./hooks": {
46
+ "types": "./dist/exports/hooks.d.ts",
47
+ "import": "./dist/hooks.js"
48
+ },
49
+ "./middleware": {
50
+ "types": "./dist/exports/middleware.d.ts",
51
+ "import": "./dist/middleware.js"
52
+ },
53
+ "./models": {
54
+ "types": "./dist/exports/models.d.ts",
55
+ "import": "./dist/models.js"
56
+ },
57
+ "./query": {
58
+ "types": "./dist/exports/query.d.ts",
59
+ "import": "./dist/query.js"
60
+ },
61
+ "./utils": {
62
+ "types": "./dist/exports/utils.d.ts",
63
+ "import": "./dist/utils.js"
64
+ },
65
+ "./vite": {
66
+ "types": "./dist/exports/vite.d.ts",
67
+ "import": "./dist/vite.js"
68
+ }
69
+ },
70
+ "scripts": {
71
+ "dev": "vite dev",
72
+ "npm:install": "npm install",
73
+ "npm:update": "npm update",
74
+ "ncu:install": "ncu -i",
75
+ "build": "vite build --config vite.build.config.ts",
76
+ "prepare": "husky",
77
+ "prepublishOnly": "npm run build"
78
+ },
79
+ "dependencies": {
80
+ "@azure/msal-browser": "^5.6.1",
81
+ "@azure/msal-node": "^5.1.1",
82
+ "@azure/msal-react": "^5.1.0",
83
+ "@t3-oss/env-core": "^0.13.11",
84
+ "i18next": "^25.10.9",
85
+ "i18next-browser-languagedetector": "^8.2.1",
86
+ "react-i18next": "^16.6.6"
87
+ },
88
+ "devDependencies": {
89
+ "@rolldown/plugin-babel": "^0.2.2",
90
+ "@types/file-saver": "^2.0.7",
91
+ "@types/node": "^25.3.5",
92
+ "@types/react": "^19.2.14",
93
+ "@types/react-dom": "^19.2.3",
94
+ "@vitejs/plugin-react": "^6.0.1",
95
+ "babel-plugin-react-compiler": "^1.0.0",
96
+ "file-saver": "^2.0.5",
97
+ "husky": "^9.1.7",
98
+ "jose": "^6.2.2",
99
+ "nitro": "^3.0.1-alpha.2",
100
+ "oxfmt": "^0.42.0",
101
+ "oxlint": "^1.57.0",
102
+ "react-dropzone": "^15.0.0",
103
+ "react-intersection-observer": "^10.0.3",
104
+ "react-number-format": "^5.4.5",
105
+ "tus-js-client": "^4.3.1",
106
+ "typescript": "^5.9.3",
107
+ "uuidv7": "^1.2.1",
108
+ "vite-plugin-checker": "^0.12.0",
109
+ "vite-plugin-dts": "^4.5.4"
110
+ },
111
+ "peerDependencies": {
112
+ "@emotion/react": "11.x",
113
+ "@emotion/styled": "11.x",
114
+ "@mui/icons-material": "7.x",
115
+ "@mui/material": "7.x",
116
+ "@mui/x-data-grid-premium": "8.x",
117
+ "@mui/x-date-pickers-pro": "8.x",
118
+ "@tanstack/query-db-collection": "1.x",
119
+ "@tanstack/react-db": "0.x",
120
+ "@tanstack/react-form": "1.x",
121
+ "@tanstack/react-query": "5.x",
122
+ "@tanstack/react-router": "1.x",
123
+ "@tanstack/react-router-ssr-query": "1.x",
124
+ "@tanstack/react-start": "1.x",
125
+ "axios": "1.x",
126
+ "dayjs": "1.x",
127
+ "react": "19.x",
128
+ "react-dom": "19.x",
129
+ "vite": "8.x",
130
+ "zod": "4.x"
131
+ }
132
+ }
@@ -1,16 +0,0 @@
1
- import React, { Dispatch, SetStateAction } from "react";
2
- import { LayoutPaletteColorOptions } from "../models/LayoutPaletteColorOptions";
3
- import { LayoutRoute } from "../models/LayoutRoute";
4
- import Notification from "../models/Notification";
5
- import { User } from "../models/User";
6
- interface LayoutProps {
7
- routes: LayoutRoute[];
8
- appVersion: string;
9
- colors: LayoutPaletteColorOptions;
10
- children: React.ReactNode;
11
- user: User;
12
- notifications: Notification[] | undefined;
13
- setNotifications: Dispatch<SetStateAction<Notification[] | undefined>>;
14
- }
15
- export declare const Layout: React.FC<LayoutProps>;
16
- export {};