@digitaldefiance/express-suite-react-components 5.0.2 → 5.0.3

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.
Files changed (311) hide show
  1. package/package.json +5 -4
  2. package/src/auth/AdminRoute.d.ts +8 -0
  3. package/src/auth/AdminRoute.d.ts.map +1 -0
  4. package/src/auth/AdminRoute.js +28 -0
  5. package/src/auth/Private.d.ts +6 -0
  6. package/src/auth/Private.d.ts.map +1 -0
  7. package/src/auth/Private.js +14 -0
  8. package/src/auth/PrivateRoute.d.ts +8 -0
  9. package/src/auth/PrivateRoute.d.ts.map +1 -0
  10. package/src/auth/PrivateRoute.js +23 -0
  11. package/src/auth/UnAuth.d.ts +6 -0
  12. package/src/auth/UnAuth.d.ts.map +1 -0
  13. package/src/auth/UnAuth.js +14 -0
  14. package/src/auth/UnAuthRoute.d.ts +8 -0
  15. package/src/auth/UnAuthRoute.d.ts.map +1 -0
  16. package/src/auth/UnAuthRoute.js +22 -0
  17. package/src/auth/{index.ts → index.d.ts} +3 -2
  18. package/src/auth/index.d.ts.map +1 -0
  19. package/src/auth/index.js +12 -0
  20. package/src/components/ApiAccess.d.ts +16 -0
  21. package/src/components/ApiAccess.d.ts.map +1 -0
  22. package/src/components/ApiAccess.js +77 -0
  23. package/src/components/BackupCodeLoginForm.d.ts +43 -0
  24. package/src/components/BackupCodeLoginForm.d.ts.map +1 -0
  25. package/src/components/BackupCodeLoginForm.js +139 -0
  26. package/src/components/BackupCodesForm.d.ts +26 -0
  27. package/src/components/BackupCodesForm.d.ts.map +1 -0
  28. package/src/components/BackupCodesForm.js +120 -0
  29. package/src/components/CategoryMenu.d.ts +17 -0
  30. package/src/components/CategoryMenu.d.ts.map +1 -0
  31. package/src/components/CategoryMenu.js +65 -0
  32. package/src/components/ChangePasswordForm.d.ts +26 -0
  33. package/src/components/ChangePasswordForm.d.ts.map +1 -0
  34. package/src/components/ChangePasswordForm.js +78 -0
  35. package/src/components/ConfirmationDialog.d.ts +13 -0
  36. package/src/components/ConfirmationDialog.d.ts.map +1 -0
  37. package/src/components/ConfirmationDialog.js +10 -0
  38. package/src/components/CurrencyCodeSelector.d.ts +9 -0
  39. package/src/components/CurrencyCodeSelector.d.ts.map +1 -0
  40. package/src/components/CurrencyCodeSelector.js +31 -0
  41. package/src/components/CurrencyInput.d.ts +13 -0
  42. package/src/components/CurrencyInput.d.ts.map +1 -0
  43. package/src/components/CurrencyInput.js +22 -0
  44. package/src/components/DashboardPage.d.ts +8 -0
  45. package/src/components/DashboardPage.d.ts.map +1 -0
  46. package/src/components/DashboardPage.js +10 -0
  47. package/src/components/DropdownMenu.d.ts +13 -0
  48. package/src/components/DropdownMenu.d.ts.map +1 -0
  49. package/src/components/DropdownMenu.js +63 -0
  50. package/src/components/ExpirationSecondsSelector.d.ts +13 -0
  51. package/src/components/ExpirationSecondsSelector.d.ts.map +1 -0
  52. package/src/components/ExpirationSecondsSelector.js +32 -0
  53. package/src/components/FakeEmailAdminPanel.d.ts +23 -0
  54. package/src/components/FakeEmailAdminPanel.d.ts.map +1 -0
  55. package/src/components/FakeEmailAdminPanel.js +147 -0
  56. package/src/components/Flag.d.ts +20 -0
  57. package/src/components/Flag.d.ts.map +1 -0
  58. package/src/components/Flag.js +43 -0
  59. package/src/components/ForgotPasswordForm.d.ts +18 -0
  60. package/src/components/ForgotPasswordForm.d.ts.map +1 -0
  61. package/src/components/ForgotPasswordForm.js +61 -0
  62. package/src/components/LoginForm.d.ts +44 -0
  63. package/src/components/LoginForm.d.ts.map +1 -0
  64. package/src/components/LoginForm.js +123 -0
  65. package/src/components/LogoutPage.d.ts +8 -0
  66. package/src/components/LogoutPage.d.ts.map +1 -0
  67. package/src/components/LogoutPage.js +16 -0
  68. package/src/components/RegisterForm.d.ts +100 -0
  69. package/src/components/RegisterForm.d.ts.map +1 -0
  70. package/src/components/RegisterForm.js +306 -0
  71. package/src/components/ResetPasswordForm.d.ts +23 -0
  72. package/src/components/ResetPasswordForm.d.ts.map +1 -0
  73. package/src/components/ResetPasswordForm.js +78 -0
  74. package/src/components/SideMenu.d.ts +8 -0
  75. package/src/components/SideMenu.d.ts.map +1 -0
  76. package/src/components/SideMenu.js +25 -0
  77. package/src/components/SideMenuListItem.d.ts +13 -0
  78. package/src/components/SideMenuListItem.d.ts.map +1 -0
  79. package/src/components/SideMenuListItem.js +44 -0
  80. package/src/components/T.d.ts +7 -0
  81. package/src/components/T.d.ts.map +1 -0
  82. package/src/components/T.js +13 -0
  83. package/src/components/TDiv.d.ts +9 -0
  84. package/src/components/TDiv.d.ts.map +1 -0
  85. package/src/components/TDiv.js +14 -0
  86. package/src/components/TImgAlt.d.ts +10 -0
  87. package/src/components/TImgAlt.d.ts.map +1 -0
  88. package/src/components/TImgAlt.js +14 -0
  89. package/src/components/TopMenu.d.ts +50 -0
  90. package/src/components/TopMenu.d.ts.map +1 -0
  91. package/src/components/TopMenu.js +79 -0
  92. package/src/components/TotpSetupForm.d.ts +24 -0
  93. package/src/components/TotpSetupForm.d.ts.map +1 -0
  94. package/src/components/TotpSetupForm.js +82 -0
  95. package/src/components/TotpVerificationForm.d.ts +23 -0
  96. package/src/components/TotpVerificationForm.d.ts.map +1 -0
  97. package/src/components/TotpVerificationForm.js +66 -0
  98. package/src/components/TranslatedTitle.d.ts +8 -0
  99. package/src/components/TranslatedTitle.d.ts.map +1 -0
  100. package/src/components/TranslatedTitle.js +15 -0
  101. package/src/components/UserLanguageSelector.d.ts +4 -0
  102. package/src/components/UserLanguageSelector.d.ts.map +1 -0
  103. package/src/components/UserLanguageSelector.js +31 -0
  104. package/src/components/UserMenu.d.ts +4 -0
  105. package/src/components/UserMenu.d.ts.map +1 -0
  106. package/src/components/UserMenu.js +12 -0
  107. package/src/components/UserSettingsForm.d.ts +113 -0
  108. package/src/components/UserSettingsForm.d.ts.map +1 -0
  109. package/src/components/UserSettingsForm.js +269 -0
  110. package/src/components/VerifyEmailPage.d.ts +24 -0
  111. package/src/components/VerifyEmailPage.d.ts.map +1 -0
  112. package/src/components/VerifyEmailPage.js +81 -0
  113. package/src/components/{index.ts → index.d.ts} +1 -1
  114. package/src/components/index.d.ts.map +1 -0
  115. package/src/components/index.js +35 -0
  116. package/src/contexts/AuthProvider.d.ts +186 -0
  117. package/src/contexts/AuthProvider.d.ts.map +1 -0
  118. package/src/contexts/AuthProvider.js +515 -0
  119. package/src/contexts/I18nProvider.d.ts +27 -0
  120. package/src/contexts/I18nProvider.d.ts.map +1 -0
  121. package/src/contexts/I18nProvider.js +60 -0
  122. package/src/contexts/MenuContext.d.ts +28 -0
  123. package/src/contexts/MenuContext.d.ts.map +1 -0
  124. package/src/contexts/MenuContext.js +292 -0
  125. package/src/contexts/SuiteConfigProvider.d.ts +44 -0
  126. package/src/contexts/SuiteConfigProvider.d.ts.map +1 -0
  127. package/src/contexts/SuiteConfigProvider.js +43 -0
  128. package/src/contexts/ThemeProvider.d.ts +15 -0
  129. package/src/contexts/ThemeProvider.d.ts.map +1 -0
  130. package/src/contexts/ThemeProvider.js +36 -0
  131. package/src/contexts/{index.ts → index.d.ts} +1 -0
  132. package/src/contexts/index.d.ts.map +1 -0
  133. package/src/contexts/index.js +8 -0
  134. package/src/hooks/{index.ts → index.d.ts} +1 -0
  135. package/src/hooks/index.d.ts.map +1 -0
  136. package/src/hooks/index.js +9 -0
  137. package/src/hooks/useAuthenticatedApi.d.ts +34 -0
  138. package/src/hooks/useAuthenticatedApi.d.ts.map +1 -0
  139. package/src/hooks/useAuthenticatedApi.js +46 -0
  140. package/src/hooks/useBackupCodes.d.ts +15 -0
  141. package/src/hooks/useBackupCodes.d.ts.map +1 -0
  142. package/src/hooks/useBackupCodes.js +74 -0
  143. package/src/hooks/useEmailVerification.d.ts +10 -0
  144. package/src/hooks/useEmailVerification.d.ts.map +1 -0
  145. package/src/hooks/useEmailVerification.js +40 -0
  146. package/src/hooks/useExpiringValue.d.ts +14 -0
  147. package/src/hooks/useExpiringValue.d.ts.map +1 -0
  148. package/src/hooks/useExpiringValue.js +53 -0
  149. package/src/hooks/useLocalStorage.d.ts +2 -0
  150. package/src/hooks/useLocalStorage.d.ts.map +1 -0
  151. package/src/hooks/useLocalStorage.js +15 -0
  152. package/src/hooks/useUserSettings.d.ts +48 -0
  153. package/src/hooks/useUserSettings.d.ts.map +1 -0
  154. package/src/hooks/useUserSettings.js +171 -0
  155. package/src/{index.ts → index.d.ts} +1 -1
  156. package/src/index.d.ts.map +1 -0
  157. package/src/index.js +12 -0
  158. package/src/interfaces/IAppConfig.d.ts +8 -0
  159. package/src/interfaces/IAppConfig.d.ts.map +1 -0
  160. package/src/interfaces/IAppConfig.js +2 -0
  161. package/src/interfaces/ICategoryConfig.d.ts +41 -0
  162. package/src/interfaces/ICategoryConfig.d.ts.map +1 -0
  163. package/src/interfaces/ICategoryConfig.js +2 -0
  164. package/src/interfaces/IMenuConfig.d.ts +28 -0
  165. package/src/interfaces/IMenuConfig.d.ts.map +1 -0
  166. package/src/interfaces/IMenuConfig.js +2 -0
  167. package/src/interfaces/IMenuOption.d.ts +82 -0
  168. package/src/interfaces/IMenuOption.d.ts.map +1 -0
  169. package/src/interfaces/IMenuOption.js +2 -0
  170. package/src/interfaces/{index.ts → index.d.ts} +1 -0
  171. package/src/interfaces/index.d.ts.map +1 -0
  172. package/src/interfaces/index.js +7 -0
  173. package/src/services/__mocks__/authService.d.ts +21 -0
  174. package/src/services/__mocks__/authService.d.ts.map +1 -0
  175. package/src/services/__mocks__/authService.js +15 -0
  176. package/src/services/api.d.ts +3 -0
  177. package/src/services/api.d.ts.map +1 -0
  178. package/src/services/api.js +14 -0
  179. package/src/services/authService.d.ts +126 -0
  180. package/src/services/authService.d.ts.map +1 -0
  181. package/src/services/authService.js +471 -0
  182. package/src/services/authenticatedApi.d.ts +3 -0
  183. package/src/services/authenticatedApi.d.ts.map +1 -0
  184. package/src/services/authenticatedApi.js +18 -0
  185. package/src/services/index.d.ts +4 -0
  186. package/src/services/index.d.ts.map +1 -0
  187. package/src/services/index.js +6 -0
  188. package/src/types/MenuType.d.ts +11 -0
  189. package/src/types/MenuType.d.ts.map +1 -0
  190. package/src/types/MenuType.js +12 -0
  191. package/src/types/expirationSeconds.d.ts +3 -0
  192. package/src/types/expirationSeconds.d.ts.map +1 -0
  193. package/src/types/expirationSeconds.js +17 -0
  194. package/src/types/index.d.ts +2 -0
  195. package/src/types/index.d.ts.map +1 -0
  196. package/src/types/index.js +4 -0
  197. package/src/types/translation.d.ts +10 -0
  198. package/src/types/translation.d.ts.map +1 -0
  199. package/src/types/translation.js +9 -0
  200. package/src/wrappers/BackupCodeLoginWrapper.d.ts +8 -0
  201. package/src/wrappers/BackupCodeLoginWrapper.d.ts.map +1 -0
  202. package/src/wrappers/BackupCodeLoginWrapper.js +20 -0
  203. package/src/wrappers/BackupCodesWrapper.d.ts +7 -0
  204. package/src/wrappers/BackupCodesWrapper.d.ts.map +1 -0
  205. package/src/wrappers/BackupCodesWrapper.js +17 -0
  206. package/src/wrappers/ChangePasswordFormWrapper.d.ts +8 -0
  207. package/src/wrappers/ChangePasswordFormWrapper.d.ts.map +1 -0
  208. package/src/wrappers/ChangePasswordFormWrapper.js +21 -0
  209. package/src/wrappers/ForgotPasswordFormWrapper.d.ts +8 -0
  210. package/src/wrappers/ForgotPasswordFormWrapper.d.ts.map +1 -0
  211. package/src/wrappers/ForgotPasswordFormWrapper.js +29 -0
  212. package/src/wrappers/LoginFormWrapper.d.ts +21 -0
  213. package/src/wrappers/LoginFormWrapper.d.ts.map +1 -0
  214. package/src/wrappers/LoginFormWrapper.js +72 -0
  215. package/src/wrappers/LogoutPageWrapper.d.ts +9 -0
  216. package/src/wrappers/LogoutPageWrapper.d.ts.map +1 -0
  217. package/src/wrappers/LogoutPageWrapper.js +21 -0
  218. package/src/wrappers/RegisterFormWrapper.d.ts +20 -0
  219. package/src/wrappers/RegisterFormWrapper.d.ts.map +1 -0
  220. package/src/wrappers/RegisterFormWrapper.js +51 -0
  221. package/src/wrappers/ResetPasswordFormWrapper.d.ts +9 -0
  222. package/src/wrappers/ResetPasswordFormWrapper.d.ts.map +1 -0
  223. package/src/wrappers/ResetPasswordFormWrapper.js +34 -0
  224. package/src/wrappers/UserSettingsFormWrapper.d.ts +29 -0
  225. package/src/wrappers/UserSettingsFormWrapper.d.ts.map +1 -0
  226. package/src/wrappers/UserSettingsFormWrapper.js +95 -0
  227. package/src/wrappers/VerifyEmailPageWrapper.d.ts +8 -0
  228. package/src/wrappers/VerifyEmailPageWrapper.d.ts.map +1 -0
  229. package/src/wrappers/VerifyEmailPageWrapper.js +21 -0
  230. package/src/wrappers/{index.tsx → index.d.ts} +1 -10
  231. package/src/wrappers/index.d.ts.map +1 -0
  232. package/src/wrappers/index.js +24 -0
  233. package/LICENSE +0 -21
  234. package/src/auth/AdminRoute.tsx +0 -54
  235. package/src/auth/Private.tsx +0 -17
  236. package/src/auth/PrivateRoute.tsx +0 -28
  237. package/src/auth/UnAuth.tsx +0 -16
  238. package/src/auth/UnAuthRoute.tsx +0 -30
  239. package/src/components/ApiAccess.tsx +0 -175
  240. package/src/components/BackupCodeLoginForm.tsx +0 -489
  241. package/src/components/BackupCodesForm.tsx +0 -287
  242. package/src/components/CategoryMenu.tsx +0 -155
  243. package/src/components/ChangePasswordForm.tsx +0 -273
  244. package/src/components/ConfirmationDialog.tsx +0 -48
  245. package/src/components/CurrencyCodeSelector.tsx +0 -60
  246. package/src/components/CurrencyInput.tsx +0 -80
  247. package/src/components/DashboardPage.tsx +0 -24
  248. package/src/components/DropdownMenu.tsx +0 -105
  249. package/src/components/ExpirationSecondsSelector.tsx +0 -60
  250. package/src/components/FakeEmailAdminPanel.tsx +0 -374
  251. package/src/components/Flag.tsx +0 -52
  252. package/src/components/ForgotPasswordForm.tsx +0 -174
  253. package/src/components/LoginForm.tsx +0 -468
  254. package/src/components/LogoutPage.tsx +0 -21
  255. package/src/components/RegisterForm.tsx +0 -1169
  256. package/src/components/ResetPasswordForm.tsx +0 -247
  257. package/src/components/SideMenu.tsx +0 -46
  258. package/src/components/SideMenuListItem.tsx +0 -75
  259. package/src/components/T.tsx +0 -24
  260. package/src/components/TDiv.tsx +0 -26
  261. package/src/components/TImgAlt.tsx +0 -28
  262. package/src/components/TopMenu.tsx +0 -252
  263. package/src/components/TotpSetupForm.tsx +0 -188
  264. package/src/components/TotpVerificationForm.tsx +0 -148
  265. package/src/components/TranslatedTitle.tsx +0 -31
  266. package/src/components/UserLanguageSelector.tsx +0 -45
  267. package/src/components/UserMenu.tsx +0 -15
  268. package/src/components/UserSettingsForm.tsx +0 -904
  269. package/src/components/VerifyEmailPage.tsx +0 -222
  270. package/src/components/__tests__/RegisterForm.totp.spec.tsx +0 -377
  271. package/src/components/__tests__/TotpSetupForm.spec.tsx +0 -258
  272. package/src/components/__tests__/TotpVerificationForm.spec.tsx +0 -259
  273. package/src/components/__tests__/UserSettingsForm.totp.spec.tsx +0 -396
  274. package/src/contexts/AuthProvider.spec.tsx +0 -1284
  275. package/src/contexts/AuthProvider.tsx +0 -977
  276. package/src/contexts/I18nProvider.tsx +0 -164
  277. package/src/contexts/MenuContext.tsx +0 -426
  278. package/src/contexts/SuiteConfigProvider.tsx +0 -93
  279. package/src/contexts/ThemeProvider.tsx +0 -67
  280. package/src/hooks/useAuthenticatedApi.tsx +0 -67
  281. package/src/hooks/useBackupCodes.ts +0 -105
  282. package/src/hooks/useEmailVerification.ts +0 -54
  283. package/src/hooks/useExpiringValue.ts +0 -78
  284. package/src/hooks/useLocalStorage.ts +0 -18
  285. package/src/hooks/useUserSettings.ts +0 -271
  286. package/src/interfaces/IAppConfig.ts +0 -7
  287. package/src/interfaces/ICategoryConfig.ts +0 -41
  288. package/src/interfaces/IMenuConfig.ts +0 -28
  289. package/src/interfaces/IMenuOption.ts +0 -79
  290. package/src/services/__mocks__/authService.ts +0 -14
  291. package/src/services/__tests__/authService.totp.property.spec.ts +0 -360
  292. package/src/services/__tests__/authService.totp.spec.ts +0 -439
  293. package/src/services/api.ts +0 -13
  294. package/src/services/authService.ts +0 -692
  295. package/src/services/authenticatedApi.ts +0 -17
  296. package/src/services/index.ts +0 -3
  297. package/src/types/MenuType.ts +0 -15
  298. package/src/types/expirationSeconds.ts +0 -18
  299. package/src/types/index.ts +0 -1
  300. package/src/types/translation.ts +0 -20
  301. package/src/wrappers/BackupCodeLoginWrapper.tsx +0 -34
  302. package/src/wrappers/BackupCodesWrapper.tsx +0 -28
  303. package/src/wrappers/ChangePasswordFormWrapper.tsx +0 -34
  304. package/src/wrappers/ForgotPasswordFormWrapper.tsx +0 -45
  305. package/src/wrappers/LoginFormWrapper.tsx +0 -108
  306. package/src/wrappers/LogoutPageWrapper.tsx +0 -30
  307. package/src/wrappers/RegisterFormWrapper.tsx +0 -109
  308. package/src/wrappers/ResetPasswordFormWrapper.tsx +0 -57
  309. package/src/wrappers/UserSettingsFormWrapper.tsx +0 -140
  310. package/src/wrappers/VerifyEmailPageWrapper.tsx +0 -27
  311. package/src/wrappers/__tests__/LoginFormWrapper.totp.spec.tsx +0 -339
@@ -0,0 +1,10 @@
1
+ export interface UseEmailVerificationResult {
2
+ isVerifying: boolean;
3
+ error: Error | null;
4
+ verifyEmail: (token: string) => Promise<{
5
+ success: boolean;
6
+ message?: string;
7
+ }>;
8
+ }
9
+ export declare const useEmailVerification: () => UseEmailVerificationResult;
10
+ //# sourceMappingURL=useEmailVerification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEmailVerification.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/hooks/useEmailVerification.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,CACX,KAAK,EAAE,MAAM,KACV,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,oBAAoB,QAAO,0BAqCvC,CAAC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useEmailVerification = void 0;
4
+ const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
5
+ const react_1 = require("react");
6
+ const contexts_1 = require("../contexts");
7
+ const services_1 = require("../services");
8
+ const useEmailVerification = () => {
9
+ const { baseUrl } = (0, contexts_1.useSuiteConfig)();
10
+ const api = (0, react_1.useMemo)(() => (0, services_1.createAuthenticatedApiClient)(baseUrl), [baseUrl]);
11
+ const [isVerifying, setIsVerifying] = (0, react_1.useState)(false);
12
+ const [error, setError] = (0, react_1.useState)(null);
13
+ const verifyEmail = (0, react_1.useCallback)(async (verificationToken) => {
14
+ setIsVerifying(true);
15
+ setError(null);
16
+ try {
17
+ const result = await api.post('/user/verify-email', {
18
+ token: verificationToken,
19
+ });
20
+ return { success: true, message: result.data.message };
21
+ }
22
+ catch (err) {
23
+ const axiosError = err;
24
+ const errorMessage = axiosError.response?.data?.message ||
25
+ (0, suite_core_lib_1.getSuiteCoreTranslation)(suite_core_lib_1.SuiteCoreStringKey.Error_VerificationFailed);
26
+ const error = new Error(errorMessage);
27
+ setError(error);
28
+ return { success: false, message: errorMessage };
29
+ }
30
+ finally {
31
+ setIsVerifying(false);
32
+ }
33
+ }, [api]);
34
+ return {
35
+ isVerifying,
36
+ error,
37
+ verifyEmail,
38
+ };
39
+ };
40
+ exports.useEmailVerification = useEmailVerification;
@@ -0,0 +1,14 @@
1
+ export interface TimerInfo {
2
+ timeout: NodeJS.Timeout;
3
+ startTime: number;
4
+ durationMs: number;
5
+ }
6
+ export interface ExpiringValueReturn<T> {
7
+ value: T | undefined;
8
+ setValue: (newValue: T, durationSeconds?: number, saveToStorage?: boolean) => () => void;
9
+ clearValue: () => void;
10
+ getRemainingTime: () => number;
11
+ isActive: boolean;
12
+ }
13
+ export declare function useExpiringValue<T>(defaultDurationSeconds: number, localStorageKey?: string): ExpiringValueReturn<T>;
14
+ //# sourceMappingURL=useExpiringValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useExpiringValue.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/hooks/useExpiringValue.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IACrB,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;IACzF,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,gBAAgB,EAAE,MAAM,MAAM,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,sBAAsB,EAAE,MAAM,EAC9B,eAAe,CAAC,EAAE,MAAM,GACvB,mBAAmB,CAAC,CAAC,CAAC,CA0DxB"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useExpiringValue = useExpiringValue;
4
+ const react_1 = require("react");
5
+ function useExpiringValue(defaultDurationSeconds, localStorageKey) {
6
+ const [value, _setValue] = (0, react_1.useState)(undefined);
7
+ const [timer, setTimer] = (0, react_1.useState)(undefined);
8
+ const [durationSeconds, _setDurationSeconds] = (0, react_1.useState)(() => {
9
+ if (localStorageKey) {
10
+ const stored = localStorage.getItem(localStorageKey);
11
+ return stored ? parseInt(stored, 10) : defaultDurationSeconds;
12
+ }
13
+ return defaultDurationSeconds;
14
+ });
15
+ const getRemainingTime = (0, react_1.useCallback)(() => {
16
+ if (!timer)
17
+ return 0;
18
+ const elapsed = Date.now() - timer.startTime;
19
+ const remaining = Math.max(0, timer.durationMs - elapsed);
20
+ return Math.ceil(remaining / 1000);
21
+ }, [timer]);
22
+ const setValue = (0, react_1.useCallback)((newValue, customDurationSeconds, saveToStorage) => {
23
+ const finalDurationSeconds = customDurationSeconds ?? durationSeconds;
24
+ if (saveToStorage && customDurationSeconds !== undefined && localStorageKey) {
25
+ _setDurationSeconds(customDurationSeconds);
26
+ localStorage.setItem(localStorageKey, customDurationSeconds.toString());
27
+ }
28
+ _setValue(newValue);
29
+ if (timer) {
30
+ clearTimeout(timer.timeout);
31
+ }
32
+ const startTime = Date.now();
33
+ const durationMs = finalDurationSeconds * 1000;
34
+ const timeout = setTimeout(() => {
35
+ _setValue(undefined);
36
+ setTimer(undefined);
37
+ }, durationMs);
38
+ setTimer({ timeout, startTime, durationMs });
39
+ return () => {
40
+ clearTimeout(timeout);
41
+ setTimer(undefined);
42
+ };
43
+ }, [durationSeconds, timer, localStorageKey]);
44
+ const clearValue = (0, react_1.useCallback)(() => {
45
+ if (timer) {
46
+ clearTimeout(timer.timeout);
47
+ setTimer(undefined);
48
+ }
49
+ _setValue(undefined);
50
+ }, [timer]);
51
+ const isActive = Boolean(timer && value !== undefined);
52
+ return { value, setValue, clearValue, getRemainingTime, isActive };
53
+ }
@@ -0,0 +1,2 @@
1
+ export declare function useLocalStorage<T>(key: string, defaultValue: T): [T, (value: T) => void];
2
+ //# sourceMappingURL=useLocalStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocalStorage.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/hooks/useLocalStorage.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAWzB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLocalStorage = useLocalStorage;
4
+ const react_1 = require("react");
5
+ const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
6
+ function useLocalStorage(key, defaultValue) {
7
+ const [storedValue, setStoredValue] = (0, react_1.useState)(() => {
8
+ return suite_core_lib_1.LocalStorageManager.getValue(key, defaultValue);
9
+ });
10
+ const setValue = (0, react_1.useCallback)((value) => {
11
+ setStoredValue(value);
12
+ suite_core_lib_1.LocalStorageManager.setValue(key, value);
13
+ }, [key]);
14
+ return [storedValue, setValue];
15
+ }
@@ -0,0 +1,48 @@
1
+ import { IUserSettings, IUserSettingsDTO } from '@digitaldefiance/suite-core-lib';
2
+ export interface UseUserSettingsOptions {
3
+ authenticatedApi: {
4
+ post: <T = unknown>(url: string, data: Record<string, unknown>) => Promise<{
5
+ data: T;
6
+ }>;
7
+ };
8
+ isAuthenticated: boolean;
9
+ }
10
+ export interface UseUserSettingsResult {
11
+ currentLanguage: string;
12
+ changeLanguage: (languageCode: string) => Promise<void>;
13
+ userSettings: IUserSettings | undefined;
14
+ setUserSettingAndUpdateSettings: (setting?: Partial<IUserSettings>) => Promise<void>;
15
+ toggleColorMode: () => Promise<void>;
16
+ }
17
+ /**
18
+ * Hook for managing user settings state and synchronization.
19
+ * Used by AuthProvider to handle user settings logic.
20
+ */
21
+ export declare const useUserSettings: ({ authenticatedApi, isAuthenticated, }: UseUserSettingsOptions) => UseUserSettingsResult;
22
+ export interface UserSettingsValues extends IUserSettingsDTO {
23
+ [key: string]: string | boolean | undefined;
24
+ }
25
+ export interface UseUserSettingsPublicResult {
26
+ settings: UserSettingsValues | null;
27
+ isLoading: boolean;
28
+ error: Error | null;
29
+ updateSettings: (values: UserSettingsValues) => Promise<{
30
+ success: boolean;
31
+ message: string;
32
+ } | {
33
+ error: string;
34
+ errorType?: string;
35
+ field?: string;
36
+ errors?: Array<{
37
+ path: string;
38
+ msg: string;
39
+ }>;
40
+ }>;
41
+ refreshSettings: () => Promise<void>;
42
+ }
43
+ /**
44
+ * Public hook for components to manage user settings.
45
+ * Provides a simpler API for fetching and updating settings.
46
+ */
47
+ export declare const useUserSettingsPublic: () => UseUserSettingsPublicResult;
48
+ //# sourceMappingURL=useUserSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUserSettings.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/hooks/useUserSettings.ts"],"names":[],"mappings":"AAQA,OAAO,EAGL,aAAa,EACb,gBAAgB,EAGjB,MAAM,iCAAiC,CAAC;AAYzC,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,GAAG,OAAO,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,OAAO,CAAC;YAAE,IAAI,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC;KAC3B,CAAC;IACF,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,YAAY,EAAE,aAAa,GAAG,SAAS,CAAC;IACxC,+BAA+B,EAAE,CAC/B,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,KAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,wCAG7B,sBAAsB,KAAG,qBAsF3B,CAAC;AAGF,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,cAAc,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CACnD;QACE,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,GACD;QACE,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC/C,CACJ,CAAC;IACF,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAO,2BAoGxC,CAAC"}
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useUserSettingsPublic = exports.useUserSettings = void 0;
4
+ const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
5
+ const i18n_lib_1 = require("@digitaldefiance/i18n-lib");
6
+ const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
7
+ const react_1 = require("react");
8
+ const contexts_1 = require("../contexts");
9
+ const defaultUserSettings = {
10
+ darkMode: false,
11
+ currency: new i18n_lib_1.CurrencyCode(i18n_lib_1.DefaultCurrencyCode),
12
+ timezone: new i18n_lib_1.Timezone(i18n_lib_1.DefaultTimezone),
13
+ siteLanguage: i18n_lib_1.DefaultLanguageCode,
14
+ directChallenge: false,
15
+ };
16
+ /**
17
+ * Hook for managing user settings state and synchronization.
18
+ * Used by AuthProvider to handle user settings logic.
19
+ */
20
+ const useUserSettings = ({ authenticatedApi, isAuthenticated, }) => {
21
+ const { setColorMode: themeSetPaletteMode, mode: currentThemeMode } = (0, contexts_1.useTheme)();
22
+ const { currentLanguage, changeLanguage } = (0, contexts_1.useI18n)();
23
+ const [userSettings, setUserSettings] = (0, react_1.useState)(undefined);
24
+ const setUserSettingAndUpdateSettings = (0, react_1.useCallback)(async (setting) => {
25
+ if (setting) {
26
+ // Merge settings with defaults and existing settings
27
+ const merged = {
28
+ ...defaultUserSettings,
29
+ ...(userSettings ? userSettings : {}),
30
+ ...setting,
31
+ };
32
+ // TypeScript requires all IUserSettings fields, but during initialization
33
+ // some fields like email may not be set yet. We'll use Partial until
34
+ // all required fields are available.
35
+ setUserSettings(merged);
36
+ if (setting.darkMode !== undefined) {
37
+ themeSetPaletteMode(setting.darkMode ? 'dark' : 'light');
38
+ }
39
+ if (setting.siteLanguage !== undefined &&
40
+ setting.siteLanguage !== currentLanguage) {
41
+ await changeLanguage(setting.siteLanguage);
42
+ }
43
+ // Send to server if authenticated and we have complete settings (including email)
44
+ if (isAuthenticated && merged.email) {
45
+ const dehydratedSettings = (0, suite_core_lib_1.dehydrateUserSettings)(merged);
46
+ await authenticatedApi.post('/user/settings', dehydratedSettings);
47
+ }
48
+ }
49
+ else {
50
+ setUserSettings(undefined);
51
+ themeSetPaletteMode('light');
52
+ }
53
+ }, [
54
+ isAuthenticated,
55
+ userSettings,
56
+ currentLanguage,
57
+ changeLanguage,
58
+ themeSetPaletteMode,
59
+ authenticatedApi,
60
+ ]);
61
+ const changeLanguageSetting = (0, react_1.useCallback)(async (languageCode) => {
62
+ await setUserSettingAndUpdateSettings({ siteLanguage: languageCode });
63
+ }, [setUserSettingAndUpdateSettings]);
64
+ const toggleColorMode = (0, react_1.useCallback)(async () => {
65
+ // When not authenticated, read from the current theme mode
66
+ // When authenticated, read from userSettings (synced with server)
67
+ const currentDarkMode = isAuthenticated
68
+ ? userSettings?.darkMode ?? false
69
+ : currentThemeMode === 'dark';
70
+ await setUserSettingAndUpdateSettings({ darkMode: !currentDarkMode });
71
+ }, [
72
+ isAuthenticated,
73
+ userSettings?.darkMode,
74
+ currentThemeMode,
75
+ setUserSettingAndUpdateSettings,
76
+ ]);
77
+ return {
78
+ changeLanguage: changeLanguageSetting,
79
+ currentLanguage,
80
+ userSettings,
81
+ setUserSettingAndUpdateSettings,
82
+ toggleColorMode,
83
+ };
84
+ };
85
+ exports.useUserSettings = useUserSettings;
86
+ /**
87
+ * Public hook for components to manage user settings.
88
+ * Provides a simpler API for fetching and updating settings.
89
+ */
90
+ const useUserSettingsPublic = () => {
91
+ const { userData, setUserSetting, userSettings } = (0, contexts_1.useAuth)();
92
+ const [settings, setSettings] = (0, react_1.useState)(null);
93
+ const [isLoading, setIsLoading] = (0, react_1.useState)(true);
94
+ const [error, setError] = (0, react_1.useState)(null);
95
+ const refreshSettings = (0, react_1.useCallback)(async () => {
96
+ setIsLoading(true);
97
+ setError(null);
98
+ try {
99
+ if (userSettings) {
100
+ const dehydratedSettings = (0, suite_core_lib_1.dehydrateUserSettings)(userSettings);
101
+ setSettings(dehydratedSettings);
102
+ }
103
+ else if (userData) {
104
+ const fallback = {
105
+ email: userData.email || '',
106
+ timezone: userData.timezone || 'UTC',
107
+ siteLanguage: userData.siteLanguage || 'en-US',
108
+ currency: userData.currency || 'USD',
109
+ darkMode: userData.darkMode || false,
110
+ directChallenge: userData.directChallenge || false,
111
+ ...(userData.displayName !== undefined ? { displayName: userData.displayName } : {}),
112
+ };
113
+ setSettings(fallback);
114
+ }
115
+ }
116
+ catch (err) {
117
+ setError(err instanceof Error
118
+ ? err
119
+ : new suite_core_lib_1.TranslatableSuiteError(suite_core_lib_1.SuiteCoreStringKey.Settings_RetrieveFailure));
120
+ }
121
+ finally {
122
+ setIsLoading(false);
123
+ }
124
+ }, [userSettings, userData]);
125
+ (0, react_1.useEffect)(() => {
126
+ refreshSettings();
127
+ }, [refreshSettings]);
128
+ const updateSettings = (0, react_1.useCallback)(async (values) => {
129
+ setIsLoading(true);
130
+ setError(null);
131
+ try {
132
+ await setUserSetting({
133
+ darkMode: values.darkMode,
134
+ currency: new i18n_lib_1.CurrencyCode(values.currency),
135
+ timezone: new i18n_lib_1.Timezone(values.timezone),
136
+ siteLanguage: values.siteLanguage,
137
+ email: new ecies_lib_1.EmailString(values.email),
138
+ directChallenge: values.directChallenge,
139
+ ...(values.displayName !== undefined ? { displayName: values.displayName } : {}),
140
+ });
141
+ setSettings(values);
142
+ return {
143
+ success: true,
144
+ message: (0, suite_core_lib_1.getSuiteCoreTranslation)(suite_core_lib_1.SuiteCoreStringKey.Settings_SaveSuccess),
145
+ };
146
+ }
147
+ catch (err) {
148
+ const axiosError = err;
149
+ const errorMessage = axiosError.response?.data?.message ||
150
+ (0, suite_core_lib_1.getSuiteCoreTranslation)(suite_core_lib_1.SuiteCoreStringKey.Settings_UpdateFailed);
151
+ setError(err instanceof Error ? err : new Error(errorMessage));
152
+ return {
153
+ error: errorMessage,
154
+ errorType: axiosError.response?.data?.errorType,
155
+ field: axiosError.response?.data?.field,
156
+ errors: axiosError.response?.data?.errors,
157
+ };
158
+ }
159
+ finally {
160
+ setIsLoading(false);
161
+ }
162
+ }, [setUserSetting]);
163
+ return {
164
+ settings,
165
+ isLoading,
166
+ error,
167
+ updateSettings,
168
+ refreshSettings,
169
+ };
170
+ };
171
+ exports.useUserSettingsPublic = useUserSettingsPublic;
@@ -1,4 +1,3 @@
1
- // Export all components
2
1
  export * from './auth';
3
2
  export * from './components';
4
3
  export * from './contexts';
@@ -7,3 +6,4 @@ export * from './interfaces';
7
6
  export * from './services';
8
7
  export * from './types';
9
8
  export * from './wrappers';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-express-suite-react-components/src/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
package/src/index.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // Export all components
5
+ tslib_1.__exportStar(require("./auth"), exports);
6
+ tslib_1.__exportStar(require("./components"), exports);
7
+ tslib_1.__exportStar(require("./contexts"), exports);
8
+ tslib_1.__exportStar(require("./hooks"), exports);
9
+ tslib_1.__exportStar(require("./interfaces"), exports);
10
+ tslib_1.__exportStar(require("./services"), exports);
11
+ tslib_1.__exportStar(require("./types"), exports);
12
+ tslib_1.__exportStar(require("./wrappers"), exports);
@@ -0,0 +1,8 @@
1
+ export interface IAppConfig {
2
+ hostname: string;
3
+ siteTitle: string;
4
+ server: string;
5
+ /** Whether TOTP two-factor authentication is available on this deployment. */
6
+ totpAvailable?: boolean;
7
+ }
8
+ //# sourceMappingURL=IAppConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAppConfig.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/interfaces/IAppConfig.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,41 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ /**
3
+ * Configuration for a TopMenu category (mega-menu container).
4
+ *
5
+ * Categories let you group multiple icon dropdowns under a single AppBar
6
+ * button. Menus opt into a category by setting `IMenuConfig.category` (or
7
+ * `AdditionalDropdownMenu.category`) to this category's `id`. The TopMenu
8
+ * renders one icon button per category that has at least one matching menu;
9
+ * clicking it opens a popover containing the matching menus as icon tiles.
10
+ *
11
+ * Backwards compatibility: if `TopMenu` is not given a `categories` array,
12
+ * or if a menu does not declare a `category`, it renders inline in the AppBar
13
+ * exactly as before.
14
+ */
15
+ export interface ICategoryConfig {
16
+ /** Unique identifier referenced by `IMenuConfig.category`. */
17
+ id: string;
18
+ /** Icon shown on the AppBar trigger button. */
19
+ icon: ReactElement;
20
+ /**
21
+ * Optional accessible label / tooltip / panel header. Plain string for
22
+ * tooltip; render-prop or node for the panel header if `showHeader` is true.
23
+ */
24
+ label?: string;
25
+ /** Optional header content shown above the tile grid when `showHeader` is true. */
26
+ header?: ReactNode;
27
+ /** Show the `header` (or `label`) above the tile grid. Defaults to false. */
28
+ showHeader?: boolean;
29
+ /** Show the menu label under each tile inside the popover. Defaults to true. */
30
+ showLabels?: boolean;
31
+ /**
32
+ * Sort order for placement in the AppBar. Higher numbers render first
33
+ * (same convention as `IMenuConfig.priority`). Defaults to 0.
34
+ */
35
+ priority?: number;
36
+ /** Number of tile columns in the popover grid. Defaults to 3. */
37
+ columns?: number;
38
+ /** Hide the category trigger when it has no matching menus. Defaults to true. */
39
+ hideWhenEmpty?: boolean;
40
+ }
41
+ //# sourceMappingURL=ICategoryConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICategoryConfig.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/interfaces/ICategoryConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,IAAI,EAAE,YAAY,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gFAAgF;IAChF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ import { ReactElement } from 'react';
2
+ import { IMenuOption } from './IMenuOption';
3
+ import { createMenuType } from '../types';
4
+ export interface IMenuConfig {
5
+ menuType: ReturnType<typeof createMenuType>;
6
+ menuIcon: ReactElement;
7
+ priority?: number;
8
+ options: IMenuOption[];
9
+ isUserMenu?: boolean;
10
+ /** Optional callback invoked when the icon button is clicked. */
11
+ action?: () => void;
12
+ /** When true, the menu icon is hidden if there are no sub-options. Defaults to false. */
13
+ hideWhenEmpty?: boolean;
14
+ /**
15
+ * Optional category identifier. When the TopMenu is configured with matching
16
+ * `categories`, this menu is rendered as a tile inside that category's
17
+ * mega-menu popover instead of inline in the AppBar. When omitted (or no
18
+ * matching category exists), the menu renders inline as a normal dropdown.
19
+ */
20
+ category?: string;
21
+ /**
22
+ * Optional human-readable label. When the menu is rendered as a tile inside
23
+ * a category popover with `showLabels` enabled, this is shown under the icon.
24
+ * Also used as the IconButton tooltip. Falls back to `menuType` when omitted.
25
+ */
26
+ label?: string;
27
+ }
28
+ //# sourceMappingURL=IMenuConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMenuConfig.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/interfaces/IMenuConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IAC5C,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,yFAAyF;IACzF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,82 @@
1
+ import { ReactNode } from 'react';
2
+ import { To } from 'react-router';
3
+ import { MenuType } from '../types/MenuType';
4
+ import { SxProps } from '@mui/system';
5
+ import { Theme } from '@mui/material';
6
+ export interface IMenuOption {
7
+ /**
8
+ * Unique identifier for the menu option
9
+ */
10
+ id: string;
11
+ /**
12
+ * Text to display for the menu option
13
+ */
14
+ label: string | ReactNode | Array<ReactNode>;
15
+ /**
16
+ * Where the menu option should be displayed
17
+ */
18
+ includeOnMenus: MenuType[];
19
+ /**
20
+ * Display order for the menu option. Lower numbers are displayed first.
21
+ */
22
+ index: number;
23
+ /**
24
+ * Whether the menu option is a divider
25
+ */
26
+ divider?: boolean;
27
+ /**
28
+ * Icon to display for the menu option
29
+ */
30
+ icon?: ReactNode;
31
+ /**
32
+ * Link to navigate to when the menu option is clicked
33
+ * Mutually exclusive with `action`
34
+ * Can be a string, a react-router To object, or an object with pathname and optional state
35
+ */
36
+ link?: To | {
37
+ pathname: string;
38
+ state?: unknown;
39
+ };
40
+ /**
41
+ * Function to execute when the menu option is clicked
42
+ * Mutually exclusive with `link`
43
+ * @returns void
44
+ */
45
+ action?: () => void;
46
+ /**
47
+ * Whether the menu option requires authentication
48
+ * true = requires authentication
49
+ * false = requires unauthenticated
50
+ * undefined = always show
51
+ */
52
+ requiresAuth: boolean | undefined;
53
+ /**
54
+ * Whether the menu option requires the user to be a global admin
55
+ * true = only show to global admins
56
+ * undefined/false = no admin requirement
57
+ */
58
+ requiresAdmin?: boolean;
59
+ /**
60
+ * Custom filter function to determine if the menu option should be displayed
61
+ * @param option - The menu option to filter
62
+ * @returns boolean
63
+ */
64
+ filter?: (option: IMenuOption) => boolean;
65
+ /**
66
+ * Additional CSS properties
67
+ */
68
+ additionalSx?: SxProps<Theme>;
69
+ /**
70
+ * Additional CSS properties for the side menu variant
71
+ */
72
+ sideSx?: SxProps<Theme>;
73
+ /**
74
+ * Additional CSS properties for the side menu variant Icon sub item
75
+ */
76
+ sideIconSx?: SxProps<Theme>;
77
+ /**
78
+ * Additional CSS properties for the side menu variant Text sub item
79
+ */
80
+ sideTextSx?: SxProps<Theme>;
81
+ }
82
+ //# sourceMappingURL=IMenuOption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMenuOption.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/interfaces/IMenuOption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7C;;OAEG;IACH,cAAc,EAAE,QAAQ,EAAE,CAAC;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAClD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;;OAKG;IACH,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC;IAC1C;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CAC7B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,3 +2,4 @@ export * from './IAppConfig';
2
2
  export * from './IMenuOption';
3
3
  export * from './IMenuConfig';
4
4
  export * from './ICategoryConfig';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./IAppConfig"), exports);
5
+ tslib_1.__exportStar(require("./IMenuOption"), exports);
6
+ tslib_1.__exportStar(require("./IMenuConfig"), exports);
7
+ tslib_1.__exportStar(require("./ICategoryConfig"), exports);
@@ -0,0 +1,21 @@
1
+ export declare const mockAuthService: {
2
+ verifyToken: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
3
+ directLogin: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
4
+ emailChallengeLogin: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
5
+ refreshToken: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
6
+ register: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
7
+ requestEmailLogin: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
8
+ backupCodeLogin: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
9
+ changePassword: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
10
+ };
11
+ export declare const createAuthService: import("jest-mock").Mock<() => {
12
+ verifyToken: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
13
+ directLogin: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
14
+ emailChallengeLogin: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
15
+ refreshToken: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
16
+ register: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
17
+ requestEmailLogin: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
18
+ backupCodeLogin: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
19
+ changePassword: import("jest-mock").Mock<import("jest-mock").UnknownFunction>;
20
+ }>;
21
+ //# sourceMappingURL=authService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authService.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-express-suite-react-components/src/services/__mocks__/authService.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;CAS3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;EAAiC,CAAC"}