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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +3 -4
  3. package/src/auth/AdminRoute.tsx +54 -0
  4. package/src/auth/Private.tsx +17 -0
  5. package/src/auth/PrivateRoute.tsx +28 -0
  6. package/src/auth/UnAuth.tsx +16 -0
  7. package/src/auth/UnAuthRoute.tsx +30 -0
  8. package/src/auth/{index.d.ts → index.ts} +2 -3
  9. package/src/components/ApiAccess.tsx +175 -0
  10. package/src/components/BackupCodeLoginForm.tsx +489 -0
  11. package/src/components/BackupCodesForm.tsx +287 -0
  12. package/src/components/CategoryMenu.tsx +155 -0
  13. package/src/components/ChangePasswordForm.tsx +273 -0
  14. package/src/components/ConfirmationDialog.tsx +48 -0
  15. package/src/components/CurrencyCodeSelector.tsx +60 -0
  16. package/src/components/CurrencyInput.tsx +80 -0
  17. package/src/components/DashboardPage.tsx +24 -0
  18. package/src/components/DropdownMenu.tsx +105 -0
  19. package/src/components/ExpirationSecondsSelector.tsx +60 -0
  20. package/src/components/FakeEmailAdminPanel.tsx +374 -0
  21. package/src/components/Flag.tsx +52 -0
  22. package/src/components/ForgotPasswordForm.tsx +174 -0
  23. package/src/components/LoginForm.tsx +468 -0
  24. package/src/components/LogoutPage.tsx +21 -0
  25. package/src/components/RegisterForm.tsx +1169 -0
  26. package/src/components/ResetPasswordForm.tsx +247 -0
  27. package/src/components/SideMenu.tsx +46 -0
  28. package/src/components/SideMenuListItem.tsx +75 -0
  29. package/src/components/T.tsx +24 -0
  30. package/src/components/TDiv.tsx +26 -0
  31. package/src/components/TImgAlt.tsx +28 -0
  32. package/src/components/TopMenu.tsx +252 -0
  33. package/src/components/TotpSetupForm.tsx +188 -0
  34. package/src/components/TotpVerificationForm.tsx +148 -0
  35. package/src/components/TranslatedTitle.tsx +31 -0
  36. package/src/components/UserLanguageSelector.tsx +45 -0
  37. package/src/components/UserMenu.tsx +15 -0
  38. package/src/components/UserSettingsForm.tsx +904 -0
  39. package/src/components/VerifyEmailPage.tsx +222 -0
  40. package/src/components/__tests__/RegisterForm.totp.spec.tsx +377 -0
  41. package/src/components/__tests__/TotpSetupForm.spec.tsx +258 -0
  42. package/src/components/__tests__/TotpVerificationForm.spec.tsx +259 -0
  43. package/src/components/__tests__/UserSettingsForm.totp.spec.tsx +396 -0
  44. package/src/components/{index.d.ts → index.ts} +1 -1
  45. package/src/contexts/AuthProvider.spec.tsx +1284 -0
  46. package/src/contexts/AuthProvider.tsx +977 -0
  47. package/src/contexts/I18nProvider.tsx +164 -0
  48. package/src/contexts/MenuContext.tsx +426 -0
  49. package/src/contexts/SuiteConfigProvider.tsx +93 -0
  50. package/src/contexts/ThemeProvider.tsx +67 -0
  51. package/src/contexts/{index.d.ts → index.ts} +0 -1
  52. package/src/hooks/{index.d.ts → index.ts} +0 -1
  53. package/src/hooks/useAuthenticatedApi.tsx +67 -0
  54. package/src/hooks/useBackupCodes.ts +105 -0
  55. package/src/hooks/useEmailVerification.ts +54 -0
  56. package/src/hooks/useExpiringValue.ts +78 -0
  57. package/src/hooks/useLocalStorage.ts +18 -0
  58. package/src/hooks/useUserSettings.ts +271 -0
  59. package/src/{index.d.ts → index.ts} +1 -1
  60. package/src/interfaces/IAppConfig.ts +7 -0
  61. package/src/interfaces/ICategoryConfig.ts +41 -0
  62. package/src/interfaces/IMenuConfig.ts +28 -0
  63. package/src/interfaces/IMenuOption.ts +79 -0
  64. package/src/interfaces/{index.d.ts → index.ts} +0 -1
  65. package/src/services/__mocks__/authService.ts +14 -0
  66. package/src/services/__tests__/authService.totp.property.spec.ts +360 -0
  67. package/src/services/__tests__/authService.totp.spec.ts +439 -0
  68. package/src/services/api.ts +13 -0
  69. package/src/services/authService.ts +692 -0
  70. package/src/services/authenticatedApi.ts +17 -0
  71. package/src/services/index.ts +3 -0
  72. package/src/types/MenuType.ts +15 -0
  73. package/src/types/expirationSeconds.ts +18 -0
  74. package/src/types/index.ts +1 -0
  75. package/src/types/translation.ts +20 -0
  76. package/src/wrappers/BackupCodeLoginWrapper.tsx +34 -0
  77. package/src/wrappers/BackupCodesWrapper.tsx +28 -0
  78. package/src/wrappers/ChangePasswordFormWrapper.tsx +34 -0
  79. package/src/wrappers/ForgotPasswordFormWrapper.tsx +45 -0
  80. package/src/wrappers/LoginFormWrapper.tsx +108 -0
  81. package/src/wrappers/LogoutPageWrapper.tsx +30 -0
  82. package/src/wrappers/RegisterFormWrapper.tsx +109 -0
  83. package/src/wrappers/ResetPasswordFormWrapper.tsx +57 -0
  84. package/src/wrappers/UserSettingsFormWrapper.tsx +140 -0
  85. package/src/wrappers/VerifyEmailPageWrapper.tsx +27 -0
  86. package/src/wrappers/__tests__/LoginFormWrapper.totp.spec.tsx +339 -0
  87. package/src/wrappers/{index.d.ts → index.tsx} +10 -1
  88. package/src/auth/AdminRoute.d.ts +0 -8
  89. package/src/auth/AdminRoute.d.ts.map +0 -1
  90. package/src/auth/AdminRoute.js +0 -28
  91. package/src/auth/Private.d.ts +0 -6
  92. package/src/auth/Private.d.ts.map +0 -1
  93. package/src/auth/Private.js +0 -14
  94. package/src/auth/PrivateRoute.d.ts +0 -8
  95. package/src/auth/PrivateRoute.d.ts.map +0 -1
  96. package/src/auth/PrivateRoute.js +0 -23
  97. package/src/auth/UnAuth.d.ts +0 -6
  98. package/src/auth/UnAuth.d.ts.map +0 -1
  99. package/src/auth/UnAuth.js +0 -14
  100. package/src/auth/UnAuthRoute.d.ts +0 -8
  101. package/src/auth/UnAuthRoute.d.ts.map +0 -1
  102. package/src/auth/UnAuthRoute.js +0 -22
  103. package/src/auth/index.d.ts.map +0 -1
  104. package/src/auth/index.js +0 -12
  105. package/src/components/ApiAccess.d.ts +0 -16
  106. package/src/components/ApiAccess.d.ts.map +0 -1
  107. package/src/components/ApiAccess.js +0 -77
  108. package/src/components/BackupCodeLoginForm.d.ts +0 -43
  109. package/src/components/BackupCodeLoginForm.d.ts.map +0 -1
  110. package/src/components/BackupCodeLoginForm.js +0 -139
  111. package/src/components/BackupCodesForm.d.ts +0 -26
  112. package/src/components/BackupCodesForm.d.ts.map +0 -1
  113. package/src/components/BackupCodesForm.js +0 -120
  114. package/src/components/CategoryMenu.d.ts +0 -17
  115. package/src/components/CategoryMenu.d.ts.map +0 -1
  116. package/src/components/CategoryMenu.js +0 -65
  117. package/src/components/ChangePasswordForm.d.ts +0 -26
  118. package/src/components/ChangePasswordForm.d.ts.map +0 -1
  119. package/src/components/ChangePasswordForm.js +0 -78
  120. package/src/components/ConfirmationDialog.d.ts +0 -13
  121. package/src/components/ConfirmationDialog.d.ts.map +0 -1
  122. package/src/components/ConfirmationDialog.js +0 -10
  123. package/src/components/CurrencyCodeSelector.d.ts +0 -9
  124. package/src/components/CurrencyCodeSelector.d.ts.map +0 -1
  125. package/src/components/CurrencyCodeSelector.js +0 -31
  126. package/src/components/CurrencyInput.d.ts +0 -13
  127. package/src/components/CurrencyInput.d.ts.map +0 -1
  128. package/src/components/CurrencyInput.js +0 -22
  129. package/src/components/DashboardPage.d.ts +0 -8
  130. package/src/components/DashboardPage.d.ts.map +0 -1
  131. package/src/components/DashboardPage.js +0 -10
  132. package/src/components/DropdownMenu.d.ts +0 -13
  133. package/src/components/DropdownMenu.d.ts.map +0 -1
  134. package/src/components/DropdownMenu.js +0 -63
  135. package/src/components/ExpirationSecondsSelector.d.ts +0 -13
  136. package/src/components/ExpirationSecondsSelector.d.ts.map +0 -1
  137. package/src/components/ExpirationSecondsSelector.js +0 -32
  138. package/src/components/FakeEmailAdminPanel.d.ts +0 -23
  139. package/src/components/FakeEmailAdminPanel.d.ts.map +0 -1
  140. package/src/components/FakeEmailAdminPanel.js +0 -147
  141. package/src/components/Flag.d.ts +0 -20
  142. package/src/components/Flag.d.ts.map +0 -1
  143. package/src/components/Flag.js +0 -43
  144. package/src/components/ForgotPasswordForm.d.ts +0 -18
  145. package/src/components/ForgotPasswordForm.d.ts.map +0 -1
  146. package/src/components/ForgotPasswordForm.js +0 -61
  147. package/src/components/LoginForm.d.ts +0 -44
  148. package/src/components/LoginForm.d.ts.map +0 -1
  149. package/src/components/LoginForm.js +0 -123
  150. package/src/components/LogoutPage.d.ts +0 -8
  151. package/src/components/LogoutPage.d.ts.map +0 -1
  152. package/src/components/LogoutPage.js +0 -16
  153. package/src/components/RegisterForm.d.ts +0 -100
  154. package/src/components/RegisterForm.d.ts.map +0 -1
  155. package/src/components/RegisterForm.js +0 -306
  156. package/src/components/ResetPasswordForm.d.ts +0 -23
  157. package/src/components/ResetPasswordForm.d.ts.map +0 -1
  158. package/src/components/ResetPasswordForm.js +0 -78
  159. package/src/components/SideMenu.d.ts +0 -8
  160. package/src/components/SideMenu.d.ts.map +0 -1
  161. package/src/components/SideMenu.js +0 -25
  162. package/src/components/SideMenuListItem.d.ts +0 -13
  163. package/src/components/SideMenuListItem.d.ts.map +0 -1
  164. package/src/components/SideMenuListItem.js +0 -44
  165. package/src/components/T.d.ts +0 -7
  166. package/src/components/T.d.ts.map +0 -1
  167. package/src/components/T.js +0 -13
  168. package/src/components/TDiv.d.ts +0 -9
  169. package/src/components/TDiv.d.ts.map +0 -1
  170. package/src/components/TDiv.js +0 -14
  171. package/src/components/TImgAlt.d.ts +0 -10
  172. package/src/components/TImgAlt.d.ts.map +0 -1
  173. package/src/components/TImgAlt.js +0 -14
  174. package/src/components/TopMenu.d.ts +0 -50
  175. package/src/components/TopMenu.d.ts.map +0 -1
  176. package/src/components/TopMenu.js +0 -79
  177. package/src/components/TotpSetupForm.d.ts +0 -24
  178. package/src/components/TotpSetupForm.d.ts.map +0 -1
  179. package/src/components/TotpSetupForm.js +0 -82
  180. package/src/components/TotpVerificationForm.d.ts +0 -23
  181. package/src/components/TotpVerificationForm.d.ts.map +0 -1
  182. package/src/components/TotpVerificationForm.js +0 -66
  183. package/src/components/TranslatedTitle.d.ts +0 -8
  184. package/src/components/TranslatedTitle.d.ts.map +0 -1
  185. package/src/components/TranslatedTitle.js +0 -15
  186. package/src/components/UserLanguageSelector.d.ts +0 -4
  187. package/src/components/UserLanguageSelector.d.ts.map +0 -1
  188. package/src/components/UserLanguageSelector.js +0 -31
  189. package/src/components/UserMenu.d.ts +0 -4
  190. package/src/components/UserMenu.d.ts.map +0 -1
  191. package/src/components/UserMenu.js +0 -12
  192. package/src/components/UserSettingsForm.d.ts +0 -113
  193. package/src/components/UserSettingsForm.d.ts.map +0 -1
  194. package/src/components/UserSettingsForm.js +0 -269
  195. package/src/components/VerifyEmailPage.d.ts +0 -24
  196. package/src/components/VerifyEmailPage.d.ts.map +0 -1
  197. package/src/components/VerifyEmailPage.js +0 -81
  198. package/src/components/index.d.ts.map +0 -1
  199. package/src/components/index.js +0 -35
  200. package/src/contexts/AuthProvider.d.ts +0 -186
  201. package/src/contexts/AuthProvider.d.ts.map +0 -1
  202. package/src/contexts/AuthProvider.js +0 -515
  203. package/src/contexts/I18nProvider.d.ts +0 -27
  204. package/src/contexts/I18nProvider.d.ts.map +0 -1
  205. package/src/contexts/I18nProvider.js +0 -60
  206. package/src/contexts/MenuContext.d.ts +0 -20
  207. package/src/contexts/MenuContext.d.ts.map +0 -1
  208. package/src/contexts/MenuContext.js +0 -275
  209. package/src/contexts/SuiteConfigProvider.d.ts +0 -44
  210. package/src/contexts/SuiteConfigProvider.d.ts.map +0 -1
  211. package/src/contexts/SuiteConfigProvider.js +0 -43
  212. package/src/contexts/ThemeProvider.d.ts +0 -15
  213. package/src/contexts/ThemeProvider.d.ts.map +0 -1
  214. package/src/contexts/ThemeProvider.js +0 -36
  215. package/src/contexts/index.d.ts.map +0 -1
  216. package/src/contexts/index.js +0 -8
  217. package/src/hooks/index.d.ts.map +0 -1
  218. package/src/hooks/index.js +0 -9
  219. package/src/hooks/useAuthenticatedApi.d.ts +0 -34
  220. package/src/hooks/useAuthenticatedApi.d.ts.map +0 -1
  221. package/src/hooks/useAuthenticatedApi.js +0 -46
  222. package/src/hooks/useBackupCodes.d.ts +0 -15
  223. package/src/hooks/useBackupCodes.d.ts.map +0 -1
  224. package/src/hooks/useBackupCodes.js +0 -74
  225. package/src/hooks/useEmailVerification.d.ts +0 -10
  226. package/src/hooks/useEmailVerification.d.ts.map +0 -1
  227. package/src/hooks/useEmailVerification.js +0 -40
  228. package/src/hooks/useExpiringValue.d.ts +0 -14
  229. package/src/hooks/useExpiringValue.d.ts.map +0 -1
  230. package/src/hooks/useExpiringValue.js +0 -53
  231. package/src/hooks/useLocalStorage.d.ts +0 -2
  232. package/src/hooks/useLocalStorage.d.ts.map +0 -1
  233. package/src/hooks/useLocalStorage.js +0 -15
  234. package/src/hooks/useUserSettings.d.ts +0 -48
  235. package/src/hooks/useUserSettings.d.ts.map +0 -1
  236. package/src/hooks/useUserSettings.js +0 -171
  237. package/src/index.d.ts.map +0 -1
  238. package/src/index.js +0 -12
  239. package/src/interfaces/IAppConfig.d.ts +0 -8
  240. package/src/interfaces/IAppConfig.d.ts.map +0 -1
  241. package/src/interfaces/IAppConfig.js +0 -2
  242. package/src/interfaces/ICategoryConfig.d.ts +0 -41
  243. package/src/interfaces/ICategoryConfig.d.ts.map +0 -1
  244. package/src/interfaces/ICategoryConfig.js +0 -2
  245. package/src/interfaces/IMenuConfig.d.ts +0 -28
  246. package/src/interfaces/IMenuConfig.d.ts.map +0 -1
  247. package/src/interfaces/IMenuConfig.js +0 -2
  248. package/src/interfaces/IMenuOption.d.ts +0 -82
  249. package/src/interfaces/IMenuOption.d.ts.map +0 -1
  250. package/src/interfaces/IMenuOption.js +0 -2
  251. package/src/interfaces/index.d.ts.map +0 -1
  252. package/src/interfaces/index.js +0 -7
  253. package/src/services/__mocks__/authService.d.ts +0 -21
  254. package/src/services/__mocks__/authService.d.ts.map +0 -1
  255. package/src/services/__mocks__/authService.js +0 -15
  256. package/src/services/api.d.ts +0 -3
  257. package/src/services/api.d.ts.map +0 -1
  258. package/src/services/api.js +0 -14
  259. package/src/services/authService.d.ts +0 -126
  260. package/src/services/authService.d.ts.map +0 -1
  261. package/src/services/authService.js +0 -471
  262. package/src/services/authenticatedApi.d.ts +0 -3
  263. package/src/services/authenticatedApi.d.ts.map +0 -1
  264. package/src/services/authenticatedApi.js +0 -18
  265. package/src/services/index.d.ts +0 -4
  266. package/src/services/index.d.ts.map +0 -1
  267. package/src/services/index.js +0 -6
  268. package/src/types/MenuType.d.ts +0 -11
  269. package/src/types/MenuType.d.ts.map +0 -1
  270. package/src/types/MenuType.js +0 -12
  271. package/src/types/expirationSeconds.d.ts +0 -3
  272. package/src/types/expirationSeconds.d.ts.map +0 -1
  273. package/src/types/expirationSeconds.js +0 -17
  274. package/src/types/index.d.ts +0 -2
  275. package/src/types/index.d.ts.map +0 -1
  276. package/src/types/index.js +0 -4
  277. package/src/types/translation.d.ts +0 -10
  278. package/src/types/translation.d.ts.map +0 -1
  279. package/src/types/translation.js +0 -9
  280. package/src/wrappers/BackupCodeLoginWrapper.d.ts +0 -8
  281. package/src/wrappers/BackupCodeLoginWrapper.d.ts.map +0 -1
  282. package/src/wrappers/BackupCodeLoginWrapper.js +0 -20
  283. package/src/wrappers/BackupCodesWrapper.d.ts +0 -7
  284. package/src/wrappers/BackupCodesWrapper.d.ts.map +0 -1
  285. package/src/wrappers/BackupCodesWrapper.js +0 -17
  286. package/src/wrappers/ChangePasswordFormWrapper.d.ts +0 -8
  287. package/src/wrappers/ChangePasswordFormWrapper.d.ts.map +0 -1
  288. package/src/wrappers/ChangePasswordFormWrapper.js +0 -21
  289. package/src/wrappers/ForgotPasswordFormWrapper.d.ts +0 -8
  290. package/src/wrappers/ForgotPasswordFormWrapper.d.ts.map +0 -1
  291. package/src/wrappers/ForgotPasswordFormWrapper.js +0 -29
  292. package/src/wrappers/LoginFormWrapper.d.ts +0 -21
  293. package/src/wrappers/LoginFormWrapper.d.ts.map +0 -1
  294. package/src/wrappers/LoginFormWrapper.js +0 -72
  295. package/src/wrappers/LogoutPageWrapper.d.ts +0 -9
  296. package/src/wrappers/LogoutPageWrapper.d.ts.map +0 -1
  297. package/src/wrappers/LogoutPageWrapper.js +0 -21
  298. package/src/wrappers/RegisterFormWrapper.d.ts +0 -20
  299. package/src/wrappers/RegisterFormWrapper.d.ts.map +0 -1
  300. package/src/wrappers/RegisterFormWrapper.js +0 -51
  301. package/src/wrappers/ResetPasswordFormWrapper.d.ts +0 -9
  302. package/src/wrappers/ResetPasswordFormWrapper.d.ts.map +0 -1
  303. package/src/wrappers/ResetPasswordFormWrapper.js +0 -34
  304. package/src/wrappers/UserSettingsFormWrapper.d.ts +0 -29
  305. package/src/wrappers/UserSettingsFormWrapper.d.ts.map +0 -1
  306. package/src/wrappers/UserSettingsFormWrapper.js +0 -95
  307. package/src/wrappers/VerifyEmailPageWrapper.d.ts +0 -8
  308. package/src/wrappers/VerifyEmailPageWrapper.d.ts.map +0 -1
  309. package/src/wrappers/VerifyEmailPageWrapper.js +0 -21
  310. package/src/wrappers/index.d.ts.map +0 -1
  311. package/src/wrappers/index.js +0 -24
@@ -1 +0,0 @@
1
- {"version":3,"file":"MenuType.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/types/MenuType.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC;AAGjE,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM,KAAG,QAA0B,CAAC;AAGvE,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AAGX,MAAM,MAAM,eAAe,GAAG,OAAO,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MenuTypes = exports.createMenuType = void 0;
4
- // Factory function to create menu types
5
- const createMenuType = (id) => id;
6
- exports.createMenuType = createMenuType;
7
- // Built-in menu types
8
- exports.MenuTypes = {
9
- SideMenu: (0, exports.createMenuType)('SideMenu'),
10
- TopMenu: (0, exports.createMenuType)('TopMenu'),
11
- UserMenu: (0, exports.createMenuType)('UserMenu'),
12
- };
@@ -1,3 +0,0 @@
1
- export declare const ExpirationSecondsOptionValues: number[];
2
- export declare function createExpirationSecondsOptionNames(secondsLabel: string, minuteLabel: string, minutesLabel: string): string[];
3
- //# sourceMappingURL=expirationSeconds.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expirationSeconds.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/types/expirationSeconds.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,UAAqC,CAAC;AAEhF,wBAAgB,kCAAkC,CAChD,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,MAAM,EAAE,CAWV"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExpirationSecondsOptionValues = void 0;
4
- exports.createExpirationSecondsOptionNames = createExpirationSecondsOptionNames;
5
- exports.ExpirationSecondsOptionValues = [0, 10, 30, 45, 60, 120, 300, 600];
6
- function createExpirationSecondsOptionNames(secondsLabel, minuteLabel, minutesLabel) {
7
- return [
8
- `0 ${secondsLabel}`,
9
- `10 ${secondsLabel}`,
10
- `30 ${secondsLabel}`,
11
- `45 ${secondsLabel}`,
12
- `1 ${minuteLabel}`,
13
- `2 ${minutesLabel}`,
14
- `5 ${minutesLabel}`,
15
- `10 ${minutesLabel}`,
16
- ];
17
- }
@@ -1,2 +0,0 @@
1
- export * from './MenuType';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./MenuType"), exports);
@@ -1,10 +0,0 @@
1
- /**
2
- * Translation function type for components
3
- * Accepts a key and optional variables, returns translated string
4
- */
5
- export type TranslationFunction = (key: string, variables?: Record<string, string | number>) => string;
6
- /**
7
- * Helper to get translated text or fallback to provided string
8
- */
9
- export declare function getTranslatedText(t: TranslationFunction | undefined, key: string, fallback: string, variables?: Record<string, string | number>): string;
10
- //# sourceMappingURL=translation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/types/translation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACxC,MAAM,CAAC;AAEZ;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,CAAC,EAAE,mBAAmB,GAAG,SAAS,EAClC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAC1C,MAAM,CAER"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTranslatedText = getTranslatedText;
4
- /**
5
- * Helper to get translated text or fallback to provided string
6
- */
7
- function getTranslatedText(t, key, fallback, variables) {
8
- return t ? t(key, variables) : fallback;
9
- }
@@ -1,8 +0,0 @@
1
- import { FC } from 'react';
2
- import { BackupCodeLoginForm } from '../components/BackupCodeLoginForm';
3
- export interface BackupCodeLoginWrapperProps {
4
- onSuccess?: () => void;
5
- componentProps?: Partial<React.ComponentProps<typeof BackupCodeLoginForm>>;
6
- }
7
- export declare const BackupCodeLoginWrapper: FC<BackupCodeLoginWrapperProps>;
8
- //# sourceMappingURL=BackupCodeLoginWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BackupCodeLoginWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/BackupCodeLoginWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC;CAC5E;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAuBlE,CAAC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BackupCodeLoginWrapper = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_router_1 = require("react-router");
6
- const BackupCodeLoginForm_1 = require("../components/BackupCodeLoginForm");
7
- const contexts_1 = require("../contexts");
8
- const BackupCodeLoginWrapper = ({ onSuccess, componentProps = {}, }) => {
9
- const { backupCodeLogin, isAuthenticated } = (0, contexts_1.useAuth)();
10
- const navigate = (0, react_router_1.useNavigate)();
11
- const handleSubmit = async (...args) => {
12
- const result = await backupCodeLogin(...args);
13
- if ('token' in result && onSuccess) {
14
- onSuccess();
15
- }
16
- return result;
17
- };
18
- return ((0, jsx_runtime_1.jsx)(BackupCodeLoginForm_1.BackupCodeLoginForm, { onSubmit: handleSubmit, onNavigate: navigate, isAuthenticated: isAuthenticated, ...componentProps }));
19
- };
20
- exports.BackupCodeLoginWrapper = BackupCodeLoginWrapper;
@@ -1,7 +0,0 @@
1
- import { FC } from 'react';
2
- import { BackupCodesForm } from '../components/BackupCodesForm';
3
- export interface BackupCodesWrapperProps {
4
- componentProps?: Partial<React.ComponentProps<typeof BackupCodesForm>>;
5
- }
6
- export declare const BackupCodesWrapper: FC<BackupCodesWrapperProps>;
7
- //# sourceMappingURL=BackupCodesWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BackupCodesWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/BackupCodesWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,MAAM,WAAW,uBAAuB;IACtC,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAkB1D,CAAC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BackupCodesWrapper = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_router_1 = require("react-router");
6
- const BackupCodesForm_1 = require("../components/BackupCodesForm");
7
- const hooks_1 = require("../hooks");
8
- const BackupCodesWrapper = ({ componentProps = {}, }) => {
9
- const location = (0, react_router_1.useLocation)();
10
- const initialCodeCount = location.state?.codeCount ?? null;
11
- const { backupCodesRemaining, generateBackupCodes } = (0, hooks_1.useBackupCodes)({ initialCodeCount });
12
- const handleSubmit = async (values) => {
13
- return await generateBackupCodes(values.password, values.mnemonic);
14
- };
15
- return ((0, jsx_runtime_1.jsx)(BackupCodesForm_1.BackupCodesForm, { onSubmit: handleSubmit, backupCodesRemaining: backupCodesRemaining, ...componentProps }));
16
- };
17
- exports.BackupCodesWrapper = BackupCodesWrapper;
@@ -1,8 +0,0 @@
1
- import { FC } from 'react';
2
- import { ChangePasswordForm } from '../components/ChangePasswordForm';
3
- export interface ChangePasswordFormWrapperProps {
4
- onSuccess?: () => void;
5
- componentProps?: Partial<React.ComponentProps<typeof ChangePasswordForm>>;
6
- }
7
- export declare const ChangePasswordFormWrapper: FC<ChangePasswordFormWrapperProps>;
8
- //# sourceMappingURL=ChangePasswordFormWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChangePasswordFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/ChangePasswordFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,MAAM,WAAW,8BAA8B;IAC7C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;CAC3E;AAED,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CAwBxE,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChangePasswordFormWrapper = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const ChangePasswordForm_1 = require("../components/ChangePasswordForm");
6
- const contexts_1 = require("../contexts");
7
- const ChangePasswordFormWrapper = ({ onSuccess, componentProps = {}, }) => {
8
- const { changePassword } = (0, contexts_1.useAuth)();
9
- const handleSubmit = async (values) => {
10
- const result = await changePassword(values.currentPassword, values.newPassword);
11
- if ('error' in result) {
12
- return { error: result.error };
13
- }
14
- if (onSuccess) {
15
- onSuccess();
16
- }
17
- return result;
18
- };
19
- return (0, jsx_runtime_1.jsx)(ChangePasswordForm_1.ChangePasswordForm, { onSubmit: handleSubmit, ...componentProps });
20
- };
21
- exports.ChangePasswordFormWrapper = ChangePasswordFormWrapper;
@@ -1,8 +0,0 @@
1
- import { FC } from 'react';
2
- import { ForgotPasswordFormProps } from '../components/ForgotPasswordForm';
3
- export interface ForgotPasswordFormWrapperProps {
4
- onSuccess?: () => void;
5
- componentProps?: Partial<Omit<ForgotPasswordFormProps, 'onSubmit'>>;
6
- }
7
- export declare const ForgotPasswordFormWrapper: FC<ForgotPasswordFormWrapperProps>;
8
- //# sourceMappingURL=ForgotPasswordFormWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ForgotPasswordFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/ForgotPasswordFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,OAAO,EAEL,uBAAuB,EAExB,MAAM,kCAAkC,CAAC;AAG1C,MAAM,WAAW,8BAA8B;IAC7C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC,CAAC;CACrE;AAED,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CA2BxE,CAAC"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ForgotPasswordFormWrapper = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
6
- const ForgotPasswordForm_1 = require("../components/ForgotPasswordForm");
7
- const contexts_1 = require("../contexts");
8
- const ForgotPasswordFormWrapper = ({ onSuccess, componentProps = {}, }) => {
9
- const { baseUrl } = (0, contexts_1.useSuiteConfig)();
10
- const handleSubmit = async (values) => {
11
- const res = await fetch(`${baseUrl}/user/forgot-password`, {
12
- method: 'POST',
13
- headers: { 'Content-Type': 'application/json' },
14
- body: JSON.stringify({ email: values.email }),
15
- });
16
- if (!res.ok) {
17
- const body = await res.json().catch(() => ({}));
18
- if (body.message) {
19
- throw new Error(body.message);
20
- }
21
- throw new suite_core_lib_1.TranslatableSuiteError(suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_Error);
22
- }
23
- if (onSuccess) {
24
- onSuccess();
25
- }
26
- };
27
- return (0, jsx_runtime_1.jsx)(ForgotPasswordForm_1.ForgotPasswordForm, { onSubmit: handleSubmit, ...componentProps });
28
- };
29
- exports.ForgotPasswordFormWrapper = ForgotPasswordFormWrapper;
@@ -1,21 +0,0 @@
1
- import { FC } from 'react';
2
- import { IRequestUserDTO } from '@digitaldefiance/suite-core-lib';
3
- import { LoginFormProps } from '../components/LoginForm';
4
- export interface LoginFormWrapperProps {
5
- onSuccess?: () => void;
6
- redirectTo?: string;
7
- componentProps?: Partial<Omit<LoginFormProps, 'onSubmit'>>;
8
- /**
9
- * Called when the user submits a TOTP verification code during login.
10
- * Typically wired to `AuthService.verifyTotpLogin(pendingTotpToken, code)`.
11
- * When not provided, the wrapper cannot complete TOTP-protected logins.
12
- */
13
- onVerifyTotp?: (code: string, pendingTotpToken: string) => Promise<{
14
- token: string;
15
- user: IRequestUserDTO;
16
- } | {
17
- error: string;
18
- }>;
19
- }
20
- export declare const LoginFormWrapper: FC<LoginFormWrapperProps>;
21
- //# sourceMappingURL=LoginFormWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoginFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/LoginFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAGrC,OAAO,EAAE,eAAe,EAA8C,MAAM,iCAAiC,CAAC;AAC9G,OAAO,EAA8B,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIrF,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;IAC3D;;;;OAIG;IACH,YAAY,CAAC,EAAE,CACb,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,KACrB,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5E;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAoFtD,CAAC"}
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LoginFormWrapper = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const react_router_1 = require("react-router");
7
- const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
8
- const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
9
- const LoginForm_1 = require("../components/LoginForm");
10
- const TotpVerificationForm_1 = require("../components/TotpVerificationForm");
11
- const contexts_1 = require("../contexts");
12
- const LoginFormWrapper = ({ onSuccess, redirectTo, componentProps = {}, onVerifyTotp, }) => {
13
- const { directLogin, passwordLogin, verifyTotpLogin, setUser } = (0, contexts_1.useAuth)();
14
- const navigate = (0, react_router_1.useNavigate)();
15
- const { routes } = (0, contexts_1.useSuiteConfig)();
16
- const [pendingTotpToken, setPendingTotpToken] = (0, react_1.useState)(null);
17
- const handleLoginSuccess = () => {
18
- if (onSuccess) {
19
- onSuccess();
20
- }
21
- navigate(redirectTo || routes.dashboard || '/dashboard');
22
- };
23
- const handleSubmit = async (values) => {
24
- const email = values.email && values.email.trim().length > 0 ? new ecies_lib_1.EmailString(values.email) : undefined;
25
- const username = values.username && values.username.trim() ? values.username : undefined;
26
- if (values.password) {
27
- const result = await passwordLogin(new ecies_lib_1.SecureString(values.password), username, email);
28
- if ('error' in result) {
29
- throw new Error(result.error);
30
- }
31
- if ('pendingTotpToken' in result) {
32
- setPendingTotpToken(result.pendingTotpToken);
33
- return;
34
- }
35
- handleLoginSuccess();
36
- }
37
- else if (values.mnemonic) {
38
- const result = await directLogin(new ecies_lib_1.SecureString(values.mnemonic), username, email);
39
- if ('error' in result) {
40
- throw new Error(result.error);
41
- }
42
- if ('pendingTotpToken' in result) {
43
- setPendingTotpToken(result.pendingTotpToken);
44
- return;
45
- }
46
- handleLoginSuccess();
47
- }
48
- else {
49
- throw new suite_core_lib_1.TranslatableSuiteError(suite_core_lib_1.SuiteCoreStringKey.Error_NoPasswordOrMnemonicProvided);
50
- }
51
- };
52
- const handleTotpSubmit = async (code, token) => {
53
- // Use the explicitly provided callback, or fall back to verifyTotpLogin from AuthContext
54
- const verifyFn = onVerifyTotp ?? ((c, t) => verifyTotpLogin(t, c));
55
- const result = await verifyFn(code, token);
56
- if ('error' in result) {
57
- return result;
58
- }
59
- // Store the full JWT and complete the login flow
60
- localStorage.setItem('authToken', result.token);
61
- localStorage.setItem('user', JSON.stringify(result.user));
62
- // Update auth context so PrivateRoute guards see the user as authenticated
63
- await setUser(result.user);
64
- handleLoginSuccess();
65
- return result;
66
- };
67
- if (pendingTotpToken) {
68
- return ((0, jsx_runtime_1.jsx)(TotpVerificationForm_1.TotpVerificationForm, { pendingTotpToken: pendingTotpToken, onSubmit: handleTotpSubmit }));
69
- }
70
- return (0, jsx_runtime_1.jsx)(LoginForm_1.LoginForm, { onSubmit: handleSubmit, ...componentProps });
71
- };
72
- exports.LoginFormWrapper = LoginFormWrapper;
@@ -1,9 +0,0 @@
1
- import { FC } from 'react';
2
- import { LogoutPage } from '../components/LogoutPage';
3
- export interface LogoutPageWrapperProps {
4
- onSuccess?: () => void;
5
- redirectTo?: string;
6
- componentProps?: Partial<React.ComponentProps<typeof LogoutPage>>;
7
- }
8
- export declare const LogoutPageWrapper: FC<LogoutPageWrapperProps>;
9
- //# sourceMappingURL=LogoutPageWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogoutPageWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/LogoutPageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAkBxD,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogoutPageWrapper = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_router_1 = require("react-router");
6
- const LogoutPage_1 = require("../components/LogoutPage");
7
- const contexts_1 = require("../contexts");
8
- const LogoutPageWrapper = ({ onSuccess, redirectTo, componentProps = {}, }) => {
9
- const { logout } = (0, contexts_1.useAuth)();
10
- const navigate = (0, react_router_1.useNavigate)();
11
- const { routes } = (0, contexts_1.useSuiteConfig)();
12
- const handleLogout = async () => {
13
- await logout();
14
- if (onSuccess) {
15
- onSuccess();
16
- }
17
- navigate(redirectTo || routes.login || '/login');
18
- };
19
- return (0, jsx_runtime_1.jsx)(LogoutPage_1.LogoutPage, { onLogout: handleLogout, onNavigate: navigate, ...componentProps });
20
- };
21
- exports.LogoutPageWrapper = LogoutPageWrapper;
@@ -1,20 +0,0 @@
1
- import { FC } from 'react';
2
- import { RegisterFormProps } from '../components/RegisterForm';
3
- export interface RegisterFormWrapperProps {
4
- onSuccess?: () => void;
5
- /**
6
- * When true, offer the TOTP setup step after successful registration.
7
- * Typically sourced from window.APP_CONFIG.totpAvailable.
8
- * Defaults to false.
9
- *
10
- * NOTE: This requires the registration endpoint to return a session token
11
- * so the user is authenticated when the TOTP setup call is made. If
12
- * registration does not issue a token (the default in this suite), leave
13
- * this false and direct users to enable TOTP from their settings page
14
- * after logging in.
15
- */
16
- enableTotpSetup?: boolean;
17
- componentProps?: Partial<Omit<RegisterFormProps, 'onSubmit' | 'timezones' | 'getInitialTimezone'>>;
18
- }
19
- export declare const RegisterFormWrapper: FC<RegisterFormWrapperProps>;
20
- //# sourceMappingURL=RegisterFormWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RegisterFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/RegisterFormWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAEL,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AAGpC,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CACtB,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,WAAW,GAAG,oBAAoB,CAAC,CACzE,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAgF5D,CAAC"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RegisterFormWrapper = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
6
- const RegisterForm_1 = require("../components/RegisterForm");
7
- const contexts_1 = require("../contexts");
8
- const RegisterFormWrapper = ({ onSuccess, enableTotpSetup = false, componentProps = {}, }) => {
9
- const { register, setUpBrowserPasswordLogin, setupTotp, confirmTotp } = (0, contexts_1.useAuth)();
10
- const { timezones } = (0, contexts_1.useSuiteConfig)();
11
- const handleSubmit = async (values, usePassword) => {
12
- const result = await register(values.username, values.email, values.timezone || 'UTC', values.password, values.mnemonic, values.displayName, values.directChallenge);
13
- if ('error' in result) {
14
- return result;
15
- }
16
- // After successful registration with a password, set up the browser-side
17
- // password login bundle (encrypts mnemonic with password and stores in localStorage).
18
- // This is required for subsequent password-based logins to work.
19
- if (usePassword && values.password && result.mnemonic) {
20
- const setupResult = await setUpBrowserPasswordLogin(new ecies_lib_1.SecureString(result.mnemonic), new ecies_lib_1.SecureString(values.password));
21
- if ('error' in setupResult) {
22
- // Password login setup failed — still return success for registration
23
- // but log the issue. The user can set up password login later.
24
- console.warn('Registration succeeded but browser password login setup failed:', setupResult.error);
25
- }
26
- }
27
- if (onSuccess) {
28
- onSuccess();
29
- }
30
- // Don't navigate away — let RegisterForm show the success message
31
- // (mnemonic grid or email verification notice). The user navigates
32
- // manually via the "Proceed to login" / "I Have Saved My Recovery
33
- // Phrase" button.
34
- return result;
35
- };
36
- const defaultTimezones = timezones || [
37
- 'UTC',
38
- 'America/New_York',
39
- 'America/Los_Angeles',
40
- 'Europe/London',
41
- ];
42
- const totpProps = enableTotpSetup
43
- ? {
44
- enableTotpSetup: true,
45
- onTotpSetup: setupTotp,
46
- onTotpConfirm: confirmTotp,
47
- }
48
- : {};
49
- return ((0, jsx_runtime_1.jsx)(RegisterForm_1.RegisterForm, { onSubmit: handleSubmit, timezones: defaultTimezones, getInitialTimezone: () => Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC', ...totpProps, ...componentProps }));
50
- };
51
- exports.RegisterFormWrapper = RegisterFormWrapper;
@@ -1,9 +0,0 @@
1
- import { FC } from 'react';
2
- import { ResetPasswordFormProps } from '../components/ResetPasswordForm';
3
- export interface ResetPasswordFormWrapperProps {
4
- onSuccess?: () => void;
5
- redirectTo?: string;
6
- componentProps?: Partial<Omit<ResetPasswordFormProps, 'onSubmit' | 'token'>>;
7
- }
8
- export declare const ResetPasswordFormWrapper: FC<ResetPasswordFormWrapperProps>;
9
- //# sourceMappingURL=ResetPasswordFormWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResetPasswordFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/ResetPasswordFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAM3B,OAAO,EAEL,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AAGzC,MAAM,WAAW,6BAA6B;IAC5C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;CAC9E;AAED,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CAsCtE,CAAC"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResetPasswordFormWrapper = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_router_1 = require("react-router");
6
- const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
7
- const ResetPasswordForm_1 = require("../components/ResetPasswordForm");
8
- const contexts_1 = require("../contexts");
9
- const ResetPasswordFormWrapper = ({ onSuccess, redirectTo, componentProps = {}, }) => {
10
- const { baseUrl, routes } = (0, contexts_1.useSuiteConfig)();
11
- const navigate = (0, react_router_1.useNavigate)();
12
- const [searchParams] = (0, react_router_1.useSearchParams)();
13
- const token = searchParams.get('token');
14
- const handleSubmit = async (resetToken, password) => {
15
- const res = await fetch(`${baseUrl}/user/reset-password`, {
16
- method: 'POST',
17
- headers: { 'Content-Type': 'application/json' },
18
- body: JSON.stringify({ token: resetToken, password }),
19
- });
20
- if (!res.ok) {
21
- const body = await res.json().catch(() => ({}));
22
- if (body.message) {
23
- throw new Error(body.message);
24
- }
25
- throw new suite_core_lib_1.TranslatableSuiteError(suite_core_lib_1.SuiteCoreStringKey.Error_PasswordChange);
26
- }
27
- if (onSuccess) {
28
- onSuccess();
29
- }
30
- navigate(redirectTo || routes.login || '/login');
31
- };
32
- return ((0, jsx_runtime_1.jsx)(ResetPasswordForm_1.ResetPasswordForm, { token: token, onSubmit: handleSubmit, ...componentProps }));
33
- };
34
- exports.ResetPasswordFormWrapper = ResetPasswordFormWrapper;
@@ -1,29 +0,0 @@
1
- import { FC } from 'react';
2
- import { UserSettingsFormProps } from '../components/UserSettingsForm';
3
- import { IConstants } from '@digitaldefiance/suite-core-lib';
4
- import { IECIESConfig } from '@digitaldefiance/ecies-lib';
5
- export interface UserSettingsFormWrapperProps {
6
- onSuccess?: () => void;
7
- /**
8
- * Constants for AuthService (required for TOTP methods).
9
- * If not provided, TOTP callbacks will not be wired up.
10
- */
11
- constants?: IConstants;
12
- /**
13
- * ECIES config for AuthService (required for TOTP methods).
14
- * If not provided, TOTP callbacks will not be wired up.
15
- */
16
- eciesConfig?: IECIESConfig;
17
- /**
18
- * Email domain for AuthService (required for TOTP methods).
19
- */
20
- emailDomain?: string;
21
- /**
22
- * When false (default), TOTP management controls are not shown.
23
- * Set to true when TOTP_AVAILABLE is enabled in the server environment.
24
- */
25
- totpAvailable?: boolean;
26
- componentProps?: Partial<Omit<UserSettingsFormProps, 'initialValues' | 'onSubmit' | 'languages'>>;
27
- }
28
- export declare const UserSettingsFormWrapper: FC<UserSettingsFormWrapperProps>;
29
- //# sourceMappingURL=UserSettingsFormWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserSettingsFormWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/UserSettingsFormWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA6C,MAAM,OAAO,CAAC;AACtE,OAAO,EAA4C,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAGjH,OAAO,EAA2B,UAAU,EAAsB,MAAM,iCAAiC,CAAC;AAG1G,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,WAAW,4BAA4B;IAC3C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,eAAe,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC;CACnG;AAED,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CA0GpE,CAAC"}
@@ -1,95 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserSettingsFormWrapper = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const UserSettingsForm_1 = require("../components/UserSettingsForm");
7
- const contexts_1 = require("../contexts");
8
- const hooks_1 = require("../hooks");
9
- const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
10
- const authService_1 = require("../services/authService");
11
- const authenticatedApi_1 = require("../services/authenticatedApi");
12
- const UserSettingsFormWrapper = ({ onSuccess, constants, eciesConfig, emailDomain = '', totpAvailable = false, componentProps = {}, }) => {
13
- const { settings, updateSettings } = (0, hooks_1.useUserSettingsPublic)();
14
- const { languages, baseUrl } = (0, contexts_1.useSuiteConfig)();
15
- // Fetch totpEnabled from the settings API
16
- const [totpEnabled, setTotpEnabled] = (0, react_1.useState)(undefined);
17
- const authenticatedApi = (0, react_1.useMemo)(() => (0, authenticatedApi_1.createAuthenticatedApiClient)(baseUrl), [baseUrl]);
18
- const authService = (0, react_1.useMemo)(() => {
19
- if (!constants || !eciesConfig)
20
- return null;
21
- return (0, authService_1.createAuthService)(constants, baseUrl, eciesConfig, emailDomain);
22
- }, [constants, eciesConfig, baseUrl, emailDomain]);
23
- // Fetch totpEnabled from GET /user/settings.
24
- // We gate on totpAvailable (no point fetching if TOTP isn't enabled on this
25
- // deployment) but NOT on isAuthenticated — isAuthenticated can be false
26
- // transiently (e.g. verify 403 on page refresh with a stale token) even
27
- // when the user has a valid session token in localStorage. The
28
- // authenticatedApi interceptor attaches the token automatically; if the
29
- // call fails we leave totpEnabled undefined so no TOTP controls are shown.
30
- (0, react_1.useEffect)(() => {
31
- if (!totpAvailable)
32
- return;
33
- authenticatedApi
34
- .get('/user/settings')
35
- .then((res) => {
36
- setTotpEnabled(res.data?.settings?.totpEnabled ?? false);
37
- })
38
- .catch(() => {
39
- // If the endpoint fails, leave totpEnabled undefined (no TOTP controls shown)
40
- });
41
- }, [totpAvailable, authenticatedApi]);
42
- const handleSubmit = async (values) => {
43
- const result = await updateSettings(values);
44
- if ('success' in result && result.success && onSuccess) {
45
- onSuccess();
46
- }
47
- return result;
48
- };
49
- // TOTP callbacks — only wired when authService is available
50
- const handleTotpSetup = (0, react_1.useCallback)(async () => {
51
- if (!authService)
52
- return { error: 'AuthService not configured' };
53
- return authService.setupTotp();
54
- }, [authService]);
55
- const handleTotpConfirm = (0, react_1.useCallback)(async (code) => {
56
- if (!authService)
57
- return { error: 'AuthService not configured' };
58
- const result = await authService.confirmTotp(code);
59
- if ('success' in result && result.success) {
60
- setTotpEnabled(true);
61
- }
62
- return result;
63
- }, [authService]);
64
- const handleTotpDisable = (0, react_1.useCallback)(async (code) => {
65
- if (!authService)
66
- return { error: 'AuthService not configured' };
67
- const result = await authService.disableTotp(code);
68
- if ('success' in result && result.success) {
69
- setTotpEnabled(false);
70
- }
71
- return result;
72
- }, [authService]);
73
- const handleTotpReset = (0, react_1.useCallback)(async (code) => {
74
- if (!authService)
75
- return { error: 'AuthService not configured' };
76
- return authService.resetTotp(code);
77
- }, [authService]);
78
- // Only show loading on initial load, not during updates
79
- // Once we have settings, keep showing the form even during updates
80
- if (!settings) {
81
- return (0, jsx_runtime_1.jsxs)("div", { children: [(0, suite_core_lib_1.getSuiteCoreTranslation)(suite_core_lib_1.SuiteCoreStringKey.Common_Loading), "..."] });
82
- }
83
- // Only pass TOTP props when totpAvailable is true, authService is available, and totpEnabled has been fetched
84
- const totpProps = totpAvailable && authService && totpEnabled !== undefined
85
- ? {
86
- totpEnabled,
87
- onTotpSetup: handleTotpSetup,
88
- onTotpConfirm: handleTotpConfirm,
89
- onTotpDisable: handleTotpDisable,
90
- onTotpReset: handleTotpReset,
91
- }
92
- : {};
93
- return ((0, jsx_runtime_1.jsx)(UserSettingsForm_1.UserSettingsForm, { initialValues: settings, onSubmit: handleSubmit, languages: languages, ...totpProps, ...componentProps }));
94
- };
95
- exports.UserSettingsFormWrapper = UserSettingsFormWrapper;