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

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 (314) 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 +19 -0
  117. package/src/contexts/AuthProvider.d.ts.map +1 -0
  118. package/src/contexts/AuthProvider.js +514 -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 +307 -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/auth-context.d.ts +172 -0
  132. package/src/contexts/auth-context.d.ts.map +1 -0
  133. package/src/contexts/auth-context.js +13 -0
  134. package/src/contexts/{index.ts → index.d.ts} +1 -0
  135. package/src/contexts/index.d.ts.map +1 -0
  136. package/src/contexts/index.js +8 -0
  137. package/src/hooks/{index.ts → index.d.ts} +1 -0
  138. package/src/hooks/index.d.ts.map +1 -0
  139. package/src/hooks/index.js +9 -0
  140. package/src/hooks/useAuthenticatedApi.d.ts +34 -0
  141. package/src/hooks/useAuthenticatedApi.d.ts.map +1 -0
  142. package/src/hooks/useAuthenticatedApi.js +46 -0
  143. package/src/hooks/useBackupCodes.d.ts +15 -0
  144. package/src/hooks/useBackupCodes.d.ts.map +1 -0
  145. package/src/hooks/useBackupCodes.js +74 -0
  146. package/src/hooks/useEmailVerification.d.ts +10 -0
  147. package/src/hooks/useEmailVerification.d.ts.map +1 -0
  148. package/src/hooks/useEmailVerification.js +40 -0
  149. package/src/hooks/useExpiringValue.d.ts +14 -0
  150. package/src/hooks/useExpiringValue.d.ts.map +1 -0
  151. package/src/hooks/useExpiringValue.js +53 -0
  152. package/src/hooks/useLocalStorage.d.ts +2 -0
  153. package/src/hooks/useLocalStorage.d.ts.map +1 -0
  154. package/src/hooks/useLocalStorage.js +15 -0
  155. package/src/hooks/useUserSettings.d.ts +48 -0
  156. package/src/hooks/useUserSettings.d.ts.map +1 -0
  157. package/src/hooks/useUserSettings.js +171 -0
  158. package/src/{index.ts → index.d.ts} +1 -1
  159. package/src/index.d.ts.map +1 -0
  160. package/src/index.js +12 -0
  161. package/src/interfaces/IAppConfig.d.ts +8 -0
  162. package/src/interfaces/IAppConfig.d.ts.map +1 -0
  163. package/src/interfaces/IAppConfig.js +2 -0
  164. package/src/interfaces/ICategoryConfig.d.ts +41 -0
  165. package/src/interfaces/ICategoryConfig.d.ts.map +1 -0
  166. package/src/interfaces/ICategoryConfig.js +2 -0
  167. package/src/interfaces/IMenuConfig.d.ts +28 -0
  168. package/src/interfaces/IMenuConfig.d.ts.map +1 -0
  169. package/src/interfaces/IMenuConfig.js +2 -0
  170. package/src/interfaces/IMenuOption.d.ts +82 -0
  171. package/src/interfaces/IMenuOption.d.ts.map +1 -0
  172. package/src/interfaces/IMenuOption.js +2 -0
  173. package/src/interfaces/{index.ts → index.d.ts} +1 -0
  174. package/src/interfaces/index.d.ts.map +1 -0
  175. package/src/interfaces/index.js +7 -0
  176. package/src/services/__mocks__/authService.d.ts +21 -0
  177. package/src/services/__mocks__/authService.d.ts.map +1 -0
  178. package/src/services/__mocks__/authService.js +15 -0
  179. package/src/services/api.d.ts +3 -0
  180. package/src/services/api.d.ts.map +1 -0
  181. package/src/services/api.js +14 -0
  182. package/src/services/authService.d.ts +126 -0
  183. package/src/services/authService.d.ts.map +1 -0
  184. package/src/services/authService.js +471 -0
  185. package/src/services/authenticatedApi.d.ts +3 -0
  186. package/src/services/authenticatedApi.d.ts.map +1 -0
  187. package/src/services/authenticatedApi.js +18 -0
  188. package/src/services/index.d.ts +4 -0
  189. package/src/services/index.d.ts.map +1 -0
  190. package/src/services/index.js +6 -0
  191. package/src/types/MenuType.d.ts +11 -0
  192. package/src/types/MenuType.d.ts.map +1 -0
  193. package/src/types/MenuType.js +12 -0
  194. package/src/types/expirationSeconds.d.ts +3 -0
  195. package/src/types/expirationSeconds.d.ts.map +1 -0
  196. package/src/types/expirationSeconds.js +17 -0
  197. package/src/types/index.d.ts +2 -0
  198. package/src/types/index.d.ts.map +1 -0
  199. package/src/types/index.js +4 -0
  200. package/src/types/translation.d.ts +10 -0
  201. package/src/types/translation.d.ts.map +1 -0
  202. package/src/types/translation.js +9 -0
  203. package/src/wrappers/BackupCodeLoginWrapper.d.ts +8 -0
  204. package/src/wrappers/BackupCodeLoginWrapper.d.ts.map +1 -0
  205. package/src/wrappers/BackupCodeLoginWrapper.js +20 -0
  206. package/src/wrappers/BackupCodesWrapper.d.ts +7 -0
  207. package/src/wrappers/BackupCodesWrapper.d.ts.map +1 -0
  208. package/src/wrappers/BackupCodesWrapper.js +17 -0
  209. package/src/wrappers/ChangePasswordFormWrapper.d.ts +8 -0
  210. package/src/wrappers/ChangePasswordFormWrapper.d.ts.map +1 -0
  211. package/src/wrappers/ChangePasswordFormWrapper.js +21 -0
  212. package/src/wrappers/ForgotPasswordFormWrapper.d.ts +8 -0
  213. package/src/wrappers/ForgotPasswordFormWrapper.d.ts.map +1 -0
  214. package/src/wrappers/ForgotPasswordFormWrapper.js +29 -0
  215. package/src/wrappers/LoginFormWrapper.d.ts +21 -0
  216. package/src/wrappers/LoginFormWrapper.d.ts.map +1 -0
  217. package/src/wrappers/LoginFormWrapper.js +72 -0
  218. package/src/wrappers/LogoutPageWrapper.d.ts +9 -0
  219. package/src/wrappers/LogoutPageWrapper.d.ts.map +1 -0
  220. package/src/wrappers/LogoutPageWrapper.js +21 -0
  221. package/src/wrappers/RegisterFormWrapper.d.ts +20 -0
  222. package/src/wrappers/RegisterFormWrapper.d.ts.map +1 -0
  223. package/src/wrappers/RegisterFormWrapper.js +51 -0
  224. package/src/wrappers/ResetPasswordFormWrapper.d.ts +9 -0
  225. package/src/wrappers/ResetPasswordFormWrapper.d.ts.map +1 -0
  226. package/src/wrappers/ResetPasswordFormWrapper.js +34 -0
  227. package/src/wrappers/UserSettingsFormWrapper.d.ts +29 -0
  228. package/src/wrappers/UserSettingsFormWrapper.d.ts.map +1 -0
  229. package/src/wrappers/UserSettingsFormWrapper.js +95 -0
  230. package/src/wrappers/VerifyEmailPageWrapper.d.ts +8 -0
  231. package/src/wrappers/VerifyEmailPageWrapper.d.ts.map +1 -0
  232. package/src/wrappers/VerifyEmailPageWrapper.js +21 -0
  233. package/src/wrappers/{index.tsx → index.d.ts} +1 -10
  234. package/src/wrappers/index.d.ts.map +1 -0
  235. package/src/wrappers/index.js +24 -0
  236. package/LICENSE +0 -21
  237. package/src/auth/AdminRoute.tsx +0 -54
  238. package/src/auth/Private.tsx +0 -17
  239. package/src/auth/PrivateRoute.tsx +0 -28
  240. package/src/auth/UnAuth.tsx +0 -16
  241. package/src/auth/UnAuthRoute.tsx +0 -30
  242. package/src/components/ApiAccess.tsx +0 -175
  243. package/src/components/BackupCodeLoginForm.tsx +0 -489
  244. package/src/components/BackupCodesForm.tsx +0 -287
  245. package/src/components/CategoryMenu.tsx +0 -155
  246. package/src/components/ChangePasswordForm.tsx +0 -273
  247. package/src/components/ConfirmationDialog.tsx +0 -48
  248. package/src/components/CurrencyCodeSelector.tsx +0 -60
  249. package/src/components/CurrencyInput.tsx +0 -80
  250. package/src/components/DashboardPage.tsx +0 -24
  251. package/src/components/DropdownMenu.tsx +0 -105
  252. package/src/components/ExpirationSecondsSelector.tsx +0 -60
  253. package/src/components/FakeEmailAdminPanel.tsx +0 -374
  254. package/src/components/Flag.tsx +0 -52
  255. package/src/components/ForgotPasswordForm.tsx +0 -174
  256. package/src/components/LoginForm.tsx +0 -468
  257. package/src/components/LogoutPage.tsx +0 -21
  258. package/src/components/RegisterForm.tsx +0 -1169
  259. package/src/components/ResetPasswordForm.tsx +0 -247
  260. package/src/components/SideMenu.tsx +0 -46
  261. package/src/components/SideMenuListItem.tsx +0 -75
  262. package/src/components/T.tsx +0 -24
  263. package/src/components/TDiv.tsx +0 -26
  264. package/src/components/TImgAlt.tsx +0 -28
  265. package/src/components/TopMenu.tsx +0 -252
  266. package/src/components/TotpSetupForm.tsx +0 -188
  267. package/src/components/TotpVerificationForm.tsx +0 -148
  268. package/src/components/TranslatedTitle.tsx +0 -31
  269. package/src/components/UserLanguageSelector.tsx +0 -45
  270. package/src/components/UserMenu.tsx +0 -15
  271. package/src/components/UserSettingsForm.tsx +0 -904
  272. package/src/components/VerifyEmailPage.tsx +0 -222
  273. package/src/components/__tests__/RegisterForm.totp.spec.tsx +0 -377
  274. package/src/components/__tests__/TotpSetupForm.spec.tsx +0 -258
  275. package/src/components/__tests__/TotpVerificationForm.spec.tsx +0 -259
  276. package/src/components/__tests__/UserSettingsForm.totp.spec.tsx +0 -396
  277. package/src/contexts/AuthProvider.spec.tsx +0 -1284
  278. package/src/contexts/AuthProvider.tsx +0 -977
  279. package/src/contexts/I18nProvider.tsx +0 -164
  280. package/src/contexts/MenuContext.tsx +0 -426
  281. package/src/contexts/SuiteConfigProvider.tsx +0 -93
  282. package/src/contexts/ThemeProvider.tsx +0 -67
  283. package/src/hooks/useAuthenticatedApi.tsx +0 -67
  284. package/src/hooks/useBackupCodes.ts +0 -105
  285. package/src/hooks/useEmailVerification.ts +0 -54
  286. package/src/hooks/useExpiringValue.ts +0 -78
  287. package/src/hooks/useLocalStorage.ts +0 -18
  288. package/src/hooks/useUserSettings.ts +0 -271
  289. package/src/interfaces/IAppConfig.ts +0 -7
  290. package/src/interfaces/ICategoryConfig.ts +0 -41
  291. package/src/interfaces/IMenuConfig.ts +0 -28
  292. package/src/interfaces/IMenuOption.ts +0 -79
  293. package/src/services/__mocks__/authService.ts +0 -14
  294. package/src/services/__tests__/authService.totp.property.spec.ts +0 -360
  295. package/src/services/__tests__/authService.totp.spec.ts +0 -439
  296. package/src/services/api.ts +0 -13
  297. package/src/services/authService.ts +0 -692
  298. package/src/services/authenticatedApi.ts +0 -17
  299. package/src/services/index.ts +0 -3
  300. package/src/types/MenuType.ts +0 -15
  301. package/src/types/expirationSeconds.ts +0 -18
  302. package/src/types/index.ts +0 -1
  303. package/src/types/translation.ts +0 -20
  304. package/src/wrappers/BackupCodeLoginWrapper.tsx +0 -34
  305. package/src/wrappers/BackupCodesWrapper.tsx +0 -28
  306. package/src/wrappers/ChangePasswordFormWrapper.tsx +0 -34
  307. package/src/wrappers/ForgotPasswordFormWrapper.tsx +0 -45
  308. package/src/wrappers/LoginFormWrapper.tsx +0 -108
  309. package/src/wrappers/LogoutPageWrapper.tsx +0 -30
  310. package/src/wrappers/RegisterFormWrapper.tsx +0 -109
  311. package/src/wrappers/ResetPasswordFormWrapper.tsx +0 -57
  312. package/src/wrappers/UserSettingsFormWrapper.tsx +0 -140
  313. package/src/wrappers/VerifyEmailPageWrapper.tsx +0 -27
  314. package/src/wrappers/__tests__/LoginFormWrapper.totp.spec.tsx +0 -339
@@ -0,0 +1,17 @@
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;
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,21 @@
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;
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,29 @@
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;
@@ -0,0 +1,21 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,72 @@
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;
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,21 @@
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;
@@ -0,0 +1,20 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,51 @@
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;
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,34 @@
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;
@@ -0,0 +1,29 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,95 @@
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;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { VerifyEmailPage } from '../components/VerifyEmailPage';
3
+ export interface VerifyEmailPageWrapperProps {
4
+ onSuccess?: () => void;
5
+ componentProps?: Partial<React.ComponentProps<typeof VerifyEmailPage>>;
6
+ }
7
+ export declare const VerifyEmailPageWrapper: FC<VerifyEmailPageWrapperProps>;
8
+ //# sourceMappingURL=VerifyEmailPageWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VerifyEmailPageWrapper.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/VerifyEmailPageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAe,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAiBlE,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VerifyEmailPageWrapper = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const VerifyEmailPage_1 = require("../components/VerifyEmailPage");
7
+ const hooks_1 = require("../hooks");
8
+ const VerifyEmailPageWrapper = ({ onSuccess, componentProps = {}, }) => {
9
+ const searchParams = new URLSearchParams(window.location.search);
10
+ const token = searchParams.get('token');
11
+ const { verifyEmail } = (0, hooks_1.useEmailVerification)();
12
+ const handleVerify = (0, react_1.useCallback)(async (verificationToken) => {
13
+ const result = await verifyEmail(verificationToken);
14
+ if (result.success && onSuccess) {
15
+ onSuccess();
16
+ }
17
+ return result;
18
+ }, [verifyEmail, onSuccess]);
19
+ return (0, jsx_runtime_1.jsx)(VerifyEmailPage_1.VerifyEmailPage, { token: token, onVerify: handleVerify, ...componentProps });
20
+ };
21
+ exports.VerifyEmailPageWrapper = VerifyEmailPageWrapper;
@@ -1,30 +1,21 @@
1
- // Re-export all wrapper components from their individual files
2
1
  export { BackupCodeLoginWrapper } from './BackupCodeLoginWrapper';
3
2
  export type { BackupCodeLoginWrapperProps } from './BackupCodeLoginWrapper';
4
-
5
3
  export { BackupCodesWrapper } from './BackupCodesWrapper';
6
4
  export type { BackupCodesWrapperProps } from './BackupCodesWrapper';
7
-
8
5
  export { ChangePasswordFormWrapper } from './ChangePasswordFormWrapper';
9
6
  export type { ChangePasswordFormWrapperProps } from './ChangePasswordFormWrapper';
10
-
11
7
  export { ForgotPasswordFormWrapper } from './ForgotPasswordFormWrapper';
12
8
  export type { ForgotPasswordFormWrapperProps } from './ForgotPasswordFormWrapper';
13
-
14
9
  export { LoginFormWrapper } from './LoginFormWrapper';
15
10
  export type { LoginFormWrapperProps } from './LoginFormWrapper';
16
-
17
11
  export { RegisterFormWrapper } from './RegisterFormWrapper';
18
12
  export type { RegisterFormWrapperProps } from './RegisterFormWrapper';
19
-
20
13
  export { ResetPasswordFormWrapper } from './ResetPasswordFormWrapper';
21
14
  export type { ResetPasswordFormWrapperProps } from './ResetPasswordFormWrapper';
22
-
23
15
  export { LogoutPageWrapper } from './LogoutPageWrapper';
24
16
  export type { LogoutPageWrapperProps } from './LogoutPageWrapper';
25
-
26
17
  export { VerifyEmailPageWrapper } from './VerifyEmailPageWrapper';
27
18
  export type { VerifyEmailPageWrapperProps } from './VerifyEmailPageWrapper';
28
-
29
19
  export { UserSettingsFormWrapper } from './UserSettingsFormWrapper';
30
20
  export type { UserSettingsFormWrapperProps } from './UserSettingsFormWrapper';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/wrappers/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAElF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,YAAY,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserSettingsFormWrapper = exports.VerifyEmailPageWrapper = exports.LogoutPageWrapper = exports.ResetPasswordFormWrapper = exports.RegisterFormWrapper = exports.LoginFormWrapper = exports.ForgotPasswordFormWrapper = exports.ChangePasswordFormWrapper = exports.BackupCodesWrapper = exports.BackupCodeLoginWrapper = void 0;
4
+ // Re-export all wrapper components from their individual files
5
+ var BackupCodeLoginWrapper_1 = require("./BackupCodeLoginWrapper");
6
+ Object.defineProperty(exports, "BackupCodeLoginWrapper", { enumerable: true, get: function () { return BackupCodeLoginWrapper_1.BackupCodeLoginWrapper; } });
7
+ var BackupCodesWrapper_1 = require("./BackupCodesWrapper");
8
+ Object.defineProperty(exports, "BackupCodesWrapper", { enumerable: true, get: function () { return BackupCodesWrapper_1.BackupCodesWrapper; } });
9
+ var ChangePasswordFormWrapper_1 = require("./ChangePasswordFormWrapper");
10
+ Object.defineProperty(exports, "ChangePasswordFormWrapper", { enumerable: true, get: function () { return ChangePasswordFormWrapper_1.ChangePasswordFormWrapper; } });
11
+ var ForgotPasswordFormWrapper_1 = require("./ForgotPasswordFormWrapper");
12
+ Object.defineProperty(exports, "ForgotPasswordFormWrapper", { enumerable: true, get: function () { return ForgotPasswordFormWrapper_1.ForgotPasswordFormWrapper; } });
13
+ var LoginFormWrapper_1 = require("./LoginFormWrapper");
14
+ Object.defineProperty(exports, "LoginFormWrapper", { enumerable: true, get: function () { return LoginFormWrapper_1.LoginFormWrapper; } });
15
+ var RegisterFormWrapper_1 = require("./RegisterFormWrapper");
16
+ Object.defineProperty(exports, "RegisterFormWrapper", { enumerable: true, get: function () { return RegisterFormWrapper_1.RegisterFormWrapper; } });
17
+ var ResetPasswordFormWrapper_1 = require("./ResetPasswordFormWrapper");
18
+ Object.defineProperty(exports, "ResetPasswordFormWrapper", { enumerable: true, get: function () { return ResetPasswordFormWrapper_1.ResetPasswordFormWrapper; } });
19
+ var LogoutPageWrapper_1 = require("./LogoutPageWrapper");
20
+ Object.defineProperty(exports, "LogoutPageWrapper", { enumerable: true, get: function () { return LogoutPageWrapper_1.LogoutPageWrapper; } });
21
+ var VerifyEmailPageWrapper_1 = require("./VerifyEmailPageWrapper");
22
+ Object.defineProperty(exports, "VerifyEmailPageWrapper", { enumerable: true, get: function () { return VerifyEmailPageWrapper_1.VerifyEmailPageWrapper; } });
23
+ var UserSettingsFormWrapper_1 = require("./UserSettingsFormWrapper");
24
+ Object.defineProperty(exports, "UserSettingsFormWrapper", { enumerable: true, get: function () { return UserSettingsFormWrapper_1.UserSettingsFormWrapper; } });
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Digital Defiance, Jessica Mulein
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.