@digitaldefiance/express-suite-react-components 2.9.11 → 2.9.12

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 (55) hide show
  1. package/package.json +3 -3
  2. package/src/components/ApiAccess.d.ts.map +1 -1
  3. package/src/components/ApiAccess.js +16 -9
  4. package/src/components/BackupCodeLoginForm.d.ts +2 -2
  5. package/src/components/BackupCodeLoginForm.d.ts.map +1 -1
  6. package/src/components/BackupCodeLoginForm.js +62 -29
  7. package/src/components/BackupCodesForm.d.ts.map +1 -1
  8. package/src/components/BackupCodesForm.js +29 -17
  9. package/src/components/ChangePasswordForm.d.ts.map +1 -1
  10. package/src/components/ChangePasswordForm.js +29 -17
  11. package/src/components/ExpirationSecondsSelector.d.ts +3 -3
  12. package/src/components/ExpirationSecondsSelector.d.ts.map +1 -1
  13. package/src/components/ExpirationSecondsSelector.js +1 -1
  14. package/src/components/Flag.d.ts.map +1 -1
  15. package/src/components/ForgotPasswordForm.d.ts.map +1 -1
  16. package/src/components/ForgotPasswordForm.js +16 -9
  17. package/src/components/LoginForm.d.ts +2 -2
  18. package/src/components/LoginForm.d.ts.map +1 -1
  19. package/src/components/LoginForm.js +52 -29
  20. package/src/components/RegisterForm.d.ts +5 -3
  21. package/src/components/RegisterForm.d.ts.map +1 -1
  22. package/src/components/RegisterForm.js +62 -27
  23. package/src/components/ResetPasswordForm.d.ts.map +1 -1
  24. package/src/components/ResetPasswordForm.js +25 -15
  25. package/src/components/TopMenu.d.ts.map +1 -1
  26. package/src/components/TopMenu.js +2 -3
  27. package/src/components/TranslatedTitle.d.ts +1 -1
  28. package/src/components/TranslatedTitle.d.ts.map +1 -1
  29. package/src/components/TranslatedTitle.js +1 -1
  30. package/src/components/UserSettingsForm.d.ts +4 -3
  31. package/src/components/UserSettingsForm.d.ts.map +1 -1
  32. package/src/components/UserSettingsForm.js +58 -25
  33. package/src/components/VerifyEmailPage.d.ts.map +1 -1
  34. package/src/components/VerifyEmailPage.js +20 -11
  35. package/src/contexts/AuthProvider.d.ts +4 -4
  36. package/src/contexts/AuthProvider.d.ts.map +1 -1
  37. package/src/contexts/AuthProvider.js +82 -27
  38. package/src/contexts/I18nProvider.d.ts.map +1 -1
  39. package/src/contexts/MenuContext.d.ts +2 -2
  40. package/src/contexts/MenuContext.d.ts.map +1 -1
  41. package/src/contexts/MenuContext.js +72 -43
  42. package/src/hooks/useBackupCodes.d.ts.map +1 -1
  43. package/src/hooks/useBackupCodes.js +8 -4
  44. package/src/hooks/useEmailVerification.d.ts.map +1 -1
  45. package/src/hooks/useEmailVerification.js +8 -4
  46. package/src/hooks/useUserSettings.d.ts +4 -2
  47. package/src/hooks/useUserSettings.d.ts.map +1 -1
  48. package/src/hooks/useUserSettings.js +30 -13
  49. package/src/services/authService.d.ts.map +1 -1
  50. package/src/services/authService.js +45 -63
  51. package/src/wrappers/BackupCodeLoginWrapper.d.ts.map +1 -1
  52. package/src/wrappers/BackupCodeLoginWrapper.js +0 -1
  53. package/src/wrappers/ChangePasswordFormWrapper.d.ts.map +1 -1
  54. package/src/wrappers/RegisterFormWrapper.d.ts.map +1 -1
  55. package/src/wrappers/RegisterFormWrapper.js +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitaldefiance/express-suite-react-components",
3
- "version": "2.9.11",
3
+ "version": "2.9.12",
4
4
  "homepage": "https://github.com/Digital-Defiance/react-components",
5
5
  "description": "React MUI components for Digital Defiance Express Suite",
6
6
  "repository": {
@@ -30,8 +30,8 @@
30
30
  "react-router-dom": "6.29.0"
31
31
  },
32
32
  "dependencies": {
33
- "@digitaldefiance/i18n-lib": "3.8.6",
34
- "@digitaldefiance/suite-core-lib": "3.6.14",
33
+ "@digitaldefiance/i18n-lib": "3.8.10",
34
+ "@digitaldefiance/suite-core-lib": "3.6.18",
35
35
  "@emotion/react": "^11.14.0",
36
36
  "@emotion/styled": "^11.14.0",
37
37
  "@mui/icons-material": "^7.0.2",
@@ -1 +1 @@
1
- {"version":3,"file":"ApiAccess.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ApiAccess.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AA4BrC,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,EAAE,CAAC,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CA8ExC,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"ApiAccess.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ApiAccess.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AA2BrC,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,EAAE,CAAC,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAmHxC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApiAccess = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
6
7
  const ContentCopy_1 = tslib_1.__importDefault(require("@mui/icons-material/ContentCopy"));
7
8
  const material_1 = require("@mui/material");
8
9
  const react_1 = require("react");
9
- const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
10
10
  const contexts_1 = require("../contexts");
11
11
  const ApiAccessContainer = (0, material_1.styled)(material_1.Box)(({ theme }) => ({
12
12
  display: 'flex',
@@ -36,13 +36,20 @@ const ApiAccess = ({ token: tokenProp, labels = {}, }) => {
36
36
  const [dialogOpen, setDialogOpen] = (0, react_1.useState)(false);
37
37
  const [isError, setIsError] = (0, react_1.useState)(false);
38
38
  const translatedLabels = {
39
- title: labels.title || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ApiAccess_Title),
40
- tokenNotAvailable: labels.tokenNotAvailable || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ApiAccess_TokenNotAvailable),
41
- copyButton: labels.copyButton || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_CopyToClipboard),
42
- notificationTitle: labels.notificationTitle || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Notification),
43
- copied: labels.copied || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_CopiedToClipboard),
44
- copyFailed: labels.copyFailed || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Error_FailedToCopy),
45
- ok: labels.ok || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_OK),
39
+ title: labels.title ||
40
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ApiAccess_Title),
41
+ tokenNotAvailable: labels.tokenNotAvailable ||
42
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ApiAccess_TokenNotAvailable),
43
+ copyButton: labels.copyButton ||
44
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_CopyToClipboard),
45
+ notificationTitle: labels.notificationTitle ||
46
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Notification),
47
+ copied: labels.copied ||
48
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_CopiedToClipboard),
49
+ copyFailed: labels.copyFailed ||
50
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Error_FailedToCopy),
51
+ ok: labels.ok ||
52
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_OK),
46
53
  };
47
54
  const copyToClipboard = async () => {
48
55
  if (token) {
@@ -51,7 +58,7 @@ const ApiAccess = ({ token: tokenProp, labels = {}, }) => {
51
58
  setIsError(false);
52
59
  setDialogOpen(true);
53
60
  }
54
- catch (err) {
61
+ catch {
55
62
  setIsError(true);
56
63
  }
57
64
  }
@@ -18,9 +18,9 @@ export interface BackupCodeLoginFormProps {
18
18
  error: string;
19
19
  status?: number;
20
20
  }>;
21
- onNavigate?: (path: string, state?: any) => void;
21
+ onNavigate?: (path: string, state?: Record<string, unknown>) => void;
22
22
  isAuthenticated?: boolean;
23
- validationSchema?: Yup.ObjectSchema<any>;
23
+ validationSchema?: Yup.ObjectSchema<BackupCodeLoginFormValues>;
24
24
  labels?: {
25
25
  title?: string;
26
26
  email?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"BackupCodeLoginForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/BackupCodeLoginForm.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAI3B,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,CACR,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,OAAO,EACxB,WAAW,CAAC,EAAE,MAAM,KACjB,OAAO,CACR;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GACzE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CACrC,CAAC;IACF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACjD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CA+P5D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"BackupCodeLoginForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/BackupCodeLoginForm.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,CACR,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,OAAO,EACxB,WAAW,CAAC,EAAE,MAAM,KACjB,OAAO,CACR;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GACzE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CACrC,CAAC;IACF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,yBAAyB,CAAC,CAAC;IAC/D,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAya5D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BackupCodeLoginForm = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
6
7
  const material_1 = require("@mui/material");
7
8
  const formik_1 = require("formik");
8
9
  const react_1 = require("react");
9
10
  const Yup = tslib_1.__importStar(require("yup"));
10
- const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
11
11
  const contexts_1 = require("../contexts");
12
12
  const BackupCodeLoginForm = ({ onSubmit, onNavigate, isAuthenticated = false, validationSchema, labels = {}, }) => {
13
13
  const { tComponent } = (0, contexts_1.useI18n)();
@@ -17,20 +17,34 @@ const BackupCodeLoginForm = ({ onSubmit, onNavigate, isAuthenticated = false, va
17
17
  const [successMessage, setSuccessMessage] = (0, react_1.useState)(null);
18
18
  const [codesRemaining, setCodesRemaining] = (0, react_1.useState)(null);
19
19
  const translatedLabels = {
20
- title: labels.title || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_Title),
21
- email: labels.email || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Email),
22
- username: labels.username || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Username),
23
- code: labels.code || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_BackupCode),
24
- newPassword: labels.newPassword || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_NewPassword),
25
- confirmPassword: labels.confirmPassword || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ConfirmNewPassword),
26
- recoverMnemonic: labels.recoverMnemonic || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_RecoverMnemonic),
27
- login: labels.login || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_Login),
28
- useUsername: labels.useUsername || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_UseUsername),
29
- useEmail: labels.useEmail || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_UseEmailAddress),
30
- dashboard: labels.dashboard || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Dashboard),
31
- generateNewCodes: labels.generateNewCodes || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_GenerateNewCodes),
32
- mnemonicLabel: labels.mnemonicLabel || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Mnemonic),
33
- codesRemaining: labels.codesRemaining || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_CodesRemainingTemplate),
20
+ title: labels.title ||
21
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_Title),
22
+ email: labels.email ||
23
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Email),
24
+ username: labels.username ||
25
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Username),
26
+ code: labels.code ||
27
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_BackupCode),
28
+ newPassword: labels.newPassword ||
29
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_NewPassword),
30
+ confirmPassword: labels.confirmPassword ||
31
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ConfirmNewPassword),
32
+ recoverMnemonic: labels.recoverMnemonic ||
33
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_RecoverMnemonic),
34
+ login: labels.login ||
35
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_Login),
36
+ useUsername: labels.useUsername ||
37
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_UseUsername),
38
+ useEmail: labels.useEmail ||
39
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Login_UseEmailAddress),
40
+ dashboard: labels.dashboard ||
41
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Dashboard),
42
+ generateNewCodes: labels.generateNewCodes ||
43
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_GenerateNewCodes),
44
+ mnemonicLabel: labels.mnemonicLabel ||
45
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Mnemonic),
46
+ codesRemaining: labels.codesRemaining ||
47
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_CodesRemainingTemplate),
34
48
  unexpectedError: tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_UnexpectedError),
35
49
  };
36
50
  const yupFieldValidation = {
@@ -43,10 +57,8 @@ const BackupCodeLoginForm = ({ onSubmit, onNavigate, isAuthenticated = false, va
43
57
  code: Yup.string()
44
58
  .required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required))
45
59
  .matches(suite_core_lib_1.Constants.BACKUP_CODES.DisplayRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_InvalidBackupCode)),
46
- password: Yup.string()
47
- .matches(suite_core_lib_1.Constants.PasswordRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordRegexErrorTemplate)),
48
- confirmPassword: Yup.string()
49
- .oneOf([Yup.ref('newPassword')], tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMatch)),
60
+ password: Yup.string().matches(suite_core_lib_1.Constants.PasswordRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordRegexErrorTemplate)),
61
+ confirmPassword: Yup.string().oneOf([Yup.ref('newPassword')], tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMatch)),
50
62
  };
51
63
  const formik = (0, formik_1.useFormik)({
52
64
  initialValues: {
@@ -57,16 +69,21 @@ const BackupCodeLoginForm = ({ onSubmit, onNavigate, isAuthenticated = false, va
57
69
  confirmNewPassword: '',
58
70
  recoverMnemonic: false,
59
71
  },
60
- validationSchema: validationSchema ?? Yup.object({
61
- [loginType]: loginType === 'email' ? yupFieldValidation.email : yupFieldValidation.username,
62
- code: yupFieldValidation.code,
63
- newPassword: yupFieldValidation.password,
64
- confirmNewPassword: yupFieldValidation.confirmPassword,
65
- }),
72
+ validationSchema: validationSchema ??
73
+ Yup.object({
74
+ [loginType]: loginType === 'email'
75
+ ? yupFieldValidation.email
76
+ : yupFieldValidation.username,
77
+ code: yupFieldValidation.code,
78
+ newPassword: yupFieldValidation.password,
79
+ confirmNewPassword: yupFieldValidation.confirmPassword,
80
+ }),
66
81
  enableReinitialize: true,
67
82
  onSubmit: async (values, { setSubmitting }) => {
68
83
  try {
69
- const loginResult = await onSubmit(loginType === 'email' ? values.email : values.username, values.code, loginType === 'email', values.recoverMnemonic, values.newPassword && values.newPassword.length > 0 ? values.newPassword : undefined);
84
+ const loginResult = await onSubmit(loginType === 'email' ? values.email : values.username, values.code, loginType === 'email', values.recoverMnemonic, values.newPassword && values.newPassword.length > 0
85
+ ? values.newPassword
86
+ : undefined);
70
87
  if ('error' in loginResult) {
71
88
  setLoginError(loginResult.error);
72
89
  setCodesRemaining(null);
@@ -92,15 +109,31 @@ const BackupCodeLoginForm = ({ onSubmit, onNavigate, isAuthenticated = false, va
92
109
  }
93
110
  },
94
111
  });
95
- if (isAuthenticated && recoveredMnemonic === null && codesRemaining === null) {
112
+ if (isAuthenticated &&
113
+ recoveredMnemonic === null &&
114
+ codesRemaining === null) {
96
115
  onNavigate?.('/dashboard');
97
116
  return null;
98
117
  }
99
- return ((0, jsx_runtime_1.jsx)(material_1.Container, { component: "main", maxWidth: "xs", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { marginTop: 8, display: 'flex', flexDirection: 'column', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h1", variant: "h5", children: translatedLabels.title }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "form", onSubmit: formik.handleSubmit, sx: { mt: 1, width: '100%' }, children: [!isAuthenticated && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, id: loginType, label: loginType === 'email' ? translatedLabels.email : translatedLabels.username, name: loginType, autoComplete: loginType === 'email' ? 'email' : 'username', autoFocus: true, value: loginType === 'email' ? formik.values.email : formik.values.username, onChange: formik.handleChange, onBlur: formik.handleBlur, error: formik.touched[loginType] && Boolean(formik.errors[loginType]), helperText: formik.touched[loginType] && formik.errors[loginType], disabled: isAuthenticated }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "code", label: translatedLabels.code, id: "code", value: formik.values.code, onChange: formik.handleChange, onBlur: formik.handleBlur, error: formik.touched.code && Boolean(formik.errors.code), helperText: formik.touched.code && formik.errors.code, disabled: isAuthenticated }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, name: "newPassword", label: translatedLabels.newPassword, type: "password", id: "newPassword", value: formik.values.newPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: formik.touched.newPassword && Boolean(formik.errors.newPassword), helperText: formik.touched.newPassword && formik.errors.newPassword, disabled: isAuthenticated }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, name: "confirmNewPassword", label: translatedLabels.confirmPassword, type: "password", id: "confirmNewPassword", value: formik.values.confirmNewPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: formik.touched.confirmNewPassword && Boolean(formik.errors.confirmNewPassword), helperText: formik.touched.confirmNewPassword && formik.errors.confirmNewPassword, disabled: isAuthenticated }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: formik.values.recoverMnemonic, onChange: formik.handleChange, onBlur: formik.handleBlur, name: "recoverMnemonic" }), label: translatedLabels.recoverMnemonic, disabled: isAuthenticated })] })), successMessage && ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: "success.main", variant: "body2", sx: { mt: 1 }, children: successMessage })), recoveredMnemonic && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { mt: 2, p: 2, bgcolor: 'grey.100', borderRadius: 1 }, children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "subtitle2", gutterBottom: true, children: [translatedLabels.mnemonicLabel, ":"] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: { fontFamily: 'monospace' }, children: recoveredMnemonic }), (0, jsx_runtime_1.jsx)(material_1.Button, { fullWidth: true, variant: "contained", sx: { mt: 2 }, onClick: () => onNavigate?.('/dashboard'), children: translatedLabels.dashboard })] })), codesRemaining !== null && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { mt: 2 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: translatedLabels.codesRemaining.replace('{count}', String(codesRemaining)) }), (0, jsx_runtime_1.jsx)(material_1.Button, { fullWidth: true, variant: "contained", sx: { mt: 2 }, onClick: () => onNavigate?.('/backup-codes', { codeCount: codesRemaining }), children: translatedLabels.generateNewCodes })] })), loginError && ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: "error", variant: "body2", sx: { mt: 1 }, children: loginError })), !isAuthenticated && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { type: "submit", fullWidth: true, variant: "contained", sx: { mt: 3, mb: 2 }, disabled: formik.isSubmitting, children: translatedLabels.login }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: 'flex', justifyContent: 'center' }, children: (0, jsx_runtime_1.jsx)(material_1.Button, { fullWidth: true, variant: "text", onClick: () => {
118
+ return ((0, jsx_runtime_1.jsx)(material_1.Container, { component: "main", maxWidth: "xs", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
119
+ marginTop: 8,
120
+ display: 'flex',
121
+ flexDirection: 'column',
122
+ alignItems: 'center',
123
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h1", variant: "h5", children: translatedLabels.title }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "form", onSubmit: formik.handleSubmit, sx: { mt: 1, width: '100%' }, children: [!isAuthenticated && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, id: loginType, label: loginType === 'email'
124
+ ? translatedLabels.email
125
+ : translatedLabels.username, name: loginType, autoComplete: loginType === 'email' ? 'email' : 'username', autoFocus: true, value: loginType === 'email'
126
+ ? formik.values.email
127
+ : formik.values.username, onChange: formik.handleChange, onBlur: formik.handleBlur, error: formik.touched[loginType] && Boolean(formik.errors[loginType]), helperText: formik.touched[loginType] && formik.errors[loginType], disabled: isAuthenticated }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", required: true, fullWidth: true, name: "code", label: translatedLabels.code, id: "code", value: formik.values.code, onChange: formik.handleChange, onBlur: formik.handleBlur, error: formik.touched.code && Boolean(formik.errors.code), helperText: formik.touched.code && formik.errors.code, disabled: isAuthenticated }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, name: "newPassword", label: translatedLabels.newPassword, type: "password", id: "newPassword", value: formik.values.newPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: formik.touched.newPassword &&
128
+ Boolean(formik.errors.newPassword), helperText: formik.touched.newPassword && formik.errors.newPassword, disabled: isAuthenticated }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, name: "confirmNewPassword", label: translatedLabels.confirmPassword, type: "password", id: "confirmNewPassword", value: formik.values.confirmNewPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: formik.touched.confirmNewPassword &&
129
+ Boolean(formik.errors.confirmNewPassword), helperText: formik.touched.confirmNewPassword &&
130
+ formik.errors.confirmNewPassword, disabled: isAuthenticated }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: formik.values.recoverMnemonic, onChange: formik.handleChange, onBlur: formik.handleBlur, name: "recoverMnemonic" }), label: translatedLabels.recoverMnemonic, disabled: isAuthenticated })] })), successMessage && ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: "success.main", variant: "body2", sx: { mt: 1 }, children: successMessage })), recoveredMnemonic && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { mt: 2, p: 2, bgcolor: 'grey.100', borderRadius: 1 }, children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "subtitle2", gutterBottom: true, children: [translatedLabels.mnemonicLabel, ":"] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: { fontFamily: 'monospace' }, children: recoveredMnemonic }), (0, jsx_runtime_1.jsx)(material_1.Button, { fullWidth: true, variant: "contained", sx: { mt: 2 }, onClick: () => onNavigate?.('/dashboard'), children: translatedLabels.dashboard })] })), codesRemaining !== null && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { mt: 2 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: translatedLabels.codesRemaining.replace('{count}', String(codesRemaining)) }), (0, jsx_runtime_1.jsx)(material_1.Button, { fullWidth: true, variant: "contained", sx: { mt: 2 }, onClick: () => onNavigate?.('/backup-codes', { codeCount: codesRemaining }), children: translatedLabels.generateNewCodes })] })), loginError && ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: "error", variant: "body2", sx: { mt: 1 }, children: loginError })), !isAuthenticated && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { type: "submit", fullWidth: true, variant: "contained", sx: { mt: 3, mb: 2 }, disabled: formik.isSubmitting, children: translatedLabels.login }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: 'flex', justifyContent: 'center' }, children: (0, jsx_runtime_1.jsx)(material_1.Button, { fullWidth: true, variant: "text", onClick: () => {
100
131
  const newType = loginType === 'email' ? 'username' : 'email';
101
132
  formik.setFieldValue(loginType, '');
102
133
  setLoginType(newType);
103
- }, children: loginType === 'email' ? translatedLabels.useUsername : translatedLabels.useEmail }) })] }))] })] }) }));
134
+ }, children: loginType === 'email'
135
+ ? translatedLabels.useUsername
136
+ : translatedLabels.useEmail }) })] }))] })] }) }));
104
137
  };
105
138
  exports.BackupCodeLoginForm = BackupCodeLoginForm;
106
139
  exports.default = exports.BackupCodeLoginForm;
@@ -1 +1 @@
1
- {"version":3,"file":"BackupCodesForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/BackupCodesForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAI3B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC;QACnD,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC,CAAC;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAqKpD,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"BackupCodesForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/BackupCodesForm.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC;QACnD,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC,CAAC;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAkPpD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -3,33 +3,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BackupCodesForm = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
6
7
  const material_1 = require("@mui/material");
7
8
  const formik_1 = require("formik");
8
9
  const react_1 = require("react");
9
10
  const Yup = tslib_1.__importStar(require("yup"));
10
- const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
11
11
  const contexts_1 = require("../contexts");
12
12
  const BackupCodesForm = ({ onSubmit, backupCodesRemaining = null, mnemonicValidation, passwordValidation, labels = {}, }) => {
13
- const { t, tComponent } = (0, contexts_1.useI18n)();
13
+ const { tComponent } = (0, contexts_1.useI18n)();
14
14
  const [apiError, setApiError] = (0, react_1.useState)(null);
15
15
  const [apiSuccess, setApiSuccess] = (0, react_1.useState)(null);
16
16
  const [backupCodes, setBackupCodes] = (0, react_1.useState)(null);
17
17
  const validation = {
18
- mnemonic: mnemonicValidation || Yup.string()
19
- .trim()
20
- .matches(suite_core_lib_1.Constants.MnemonicRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_MnemonicRegex))
21
- .optional(),
22
- password: passwordValidation || Yup.string()
23
- .trim()
24
- .matches(suite_core_lib_1.Constants.PasswordRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordRegexErrorTemplate))
25
- .optional(),
18
+ mnemonic: mnemonicValidation ||
19
+ Yup.string()
20
+ .trim()
21
+ .matches(suite_core_lib_1.Constants.MnemonicRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_MnemonicRegex))
22
+ .optional(),
23
+ password: passwordValidation ||
24
+ Yup.string()
25
+ .trim()
26
+ .matches(suite_core_lib_1.Constants.PasswordRegex, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordRegexErrorTemplate))
27
+ .optional(),
26
28
  };
27
29
  const translatedLabels = {
28
- codesRemaining: labels.codesRemaining || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_CodesRemainingTemplate),
29
- mnemonic: labels.mnemonic || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Mnemonic),
30
- password: labels.password || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Password),
31
- generateButton: labels.generateButton || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_GenerateNewCodes),
32
- successTitle: labels.successTitle || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_YourNewCodes),
30
+ codesRemaining: labels.codesRemaining ||
31
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_CodesRemainingTemplate),
32
+ mnemonic: labels.mnemonic ||
33
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Mnemonic),
34
+ password: labels.password ||
35
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Password),
36
+ generateButton: labels.generateButton ||
37
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_GenerateNewCodes),
38
+ successTitle: labels.successTitle ||
39
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.BackupCodeRecovery_YourNewCodes),
33
40
  xorError: tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_MnemonicOrPasswordRequired),
34
41
  unexpectedError: tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_UnexpectedError),
35
42
  };
@@ -95,14 +102,19 @@ const BackupCodesForm = ({ onSubmit, backupCodesRemaining = null, mnemonicValida
95
102
  }
96
103
  catch (e) {
97
104
  setApiSuccess(null);
98
- setApiError(e.response?.data?.message ?? translatedLabels.unexpectedError);
105
+ const error = e;
106
+ setApiError(error.response?.data?.message ?? translatedLabels.unexpectedError);
99
107
  }
100
108
  finally {
101
109
  setSubmitting(false);
102
110
  }
103
111
  },
104
112
  });
105
- return ((0, jsx_runtime_1.jsxs)(material_1.Container, { component: "main", maxWidth: "xs", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h1", variant: "h5", children: translatedLabels.codesRemaining.replace('{count}', String(backupCodesRemaining ?? 0)) }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "form", onSubmit: formik.handleSubmit, sx: { mt: 1, width: '100%' }, children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, id: "mnemonic", label: translatedLabels.mnemonic, type: "password", name: "mnemonic", autoComplete: "mnemonic", autoFocus: true, value: formik.values.mnemonic, onChange: formik.handleChange, onBlur: formik.handleBlur, error: (formik.touched.mnemonic || formik.submitCount > 0) && Boolean(formik.errors.mnemonic), helperText: (formik.touched.mnemonic || formik.submitCount > 0) && formik.errors.mnemonic }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, name: "password", label: translatedLabels.password, type: "password", id: "password", value: formik.values.password, onChange: formik.handleChange, onBlur: formik.handleBlur, error: (formik.touched.password || formik.submitCount > 0) && Boolean(formik.errors.password), helperText: (formik.touched.password || formik.submitCount > 0) && formik.errors.password }), (0, jsx_runtime_1.jsx)(material_1.Button, { type: "submit", fullWidth: true, variant: "contained", sx: { mt: 2 }, children: translatedLabels.generateButton })] }), apiError && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { mt: 2, mb: 2 }, children: apiError })), backupCodes && apiSuccess && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { mt: 2, mb: 2 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h2", variant: "h6", children: apiSuccess }), (0, jsx_runtime_1.jsx)("ul", { children: backupCodes.map((code, index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("pre", { children: code }) }, index))) })] }))] }));
113
+ return ((0, jsx_runtime_1.jsxs)(material_1.Container, { component: "main", maxWidth: "xs", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h1", variant: "h5", children: translatedLabels.codesRemaining.replace('{count}', String(backupCodesRemaining ?? 0)) }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "form", onSubmit: formik.handleSubmit, sx: { mt: 1, width: '100%' }, children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, id: "mnemonic", label: translatedLabels.mnemonic, type: "password", name: "mnemonic", autoComplete: "mnemonic", autoFocus: true, value: formik.values.mnemonic, onChange: formik.handleChange, onBlur: formik.handleBlur, error: (formik.touched.mnemonic || formik.submitCount > 0) &&
114
+ Boolean(formik.errors.mnemonic), helperText: (formik.touched.mnemonic || formik.submitCount > 0) &&
115
+ formik.errors.mnemonic }), (0, jsx_runtime_1.jsx)(material_1.TextField, { margin: "normal", fullWidth: true, name: "password", label: translatedLabels.password, type: "password", id: "password", value: formik.values.password, onChange: formik.handleChange, onBlur: formik.handleBlur, error: (formik.touched.password || formik.submitCount > 0) &&
116
+ Boolean(formik.errors.password), helperText: (formik.touched.password || formik.submitCount > 0) &&
117
+ formik.errors.password }), (0, jsx_runtime_1.jsx)(material_1.Button, { type: "submit", fullWidth: true, variant: "contained", sx: { mt: 2 }, children: translatedLabels.generateButton })] }), apiError && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { mt: 2, mb: 2 }, children: apiError })), backupCodes && apiSuccess && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { mt: 2, mb: 2 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h2", variant: "h6", children: apiSuccess }), (0, jsx_runtime_1.jsx)("ul", { children: backupCodes.map((code, index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("pre", { children: code }) }, index))) })] }))] }));
106
118
  };
107
119
  exports.BackupCodesForm = BackupCodesForm;
108
120
  exports.default = exports.BackupCodesForm;
@@ -1 +1 @@
1
- {"version":3,"file":"ChangePasswordForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ChangePasswordForm.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAI3B,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,OAAO,CAAC;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yBAAyB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IAC7C,qBAAqB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACzC,yBAAyB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;CAC9C;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAiJ1D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"ChangePasswordForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ChangePasswordForm.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,CACR,MAAM,EAAE,wBAAwB,KAC7B,OAAO,CAAC;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yBAAyB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IAC7C,qBAAqB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACzC,yBAAyB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;CAC9C;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAqO1D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -3,33 +3,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ChangePasswordForm = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
6
7
  const material_1 = require("@mui/material");
7
8
  const formik_1 = require("formik");
8
9
  const react_1 = require("react");
9
10
  const Yup = tslib_1.__importStar(require("yup"));
10
- const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
11
11
  const contexts_1 = require("../contexts");
12
12
  const ChangePasswordForm = ({ onSubmit, titleText, currentPasswordLabel, newPasswordLabel, confirmPasswordLabel, submitButtonText, submittingButtonText, successMessage, currentPasswordValidation, newPasswordValidation, confirmPasswordValidation, }) => {
13
- const { t, tComponent } = (0, contexts_1.useI18n)();
13
+ const { tComponent } = (0, contexts_1.useI18n)();
14
14
  const [success, setSuccess] = (0, react_1.useState)(false);
15
15
  const [apiError, setApiError] = (0, react_1.useState)('');
16
16
  const validation = {
17
- currentPassword: currentPasswordValidation || Yup.string().required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
18
- newPassword: newPasswordValidation || Yup.string()
19
- .min(suite_core_lib_1.Constants.PasswordMinLength, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMinLengthTemplate))
20
- .required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
21
- confirmPassword: confirmPasswordValidation || Yup.string()
22
- .oneOf([Yup.ref('newPassword')], tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMatch))
23
- .required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
17
+ currentPassword: currentPasswordValidation ||
18
+ Yup.string().required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
19
+ newPassword: newPasswordValidation ||
20
+ Yup.string()
21
+ .min(suite_core_lib_1.Constants.PasswordMinLength, tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMinLengthTemplate))
22
+ .required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
23
+ confirmPassword: confirmPasswordValidation ||
24
+ Yup.string()
25
+ .oneOf([Yup.ref('newPassword')], tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_PasswordMatch))
26
+ .required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
24
27
  };
25
28
  const labels = {
26
- title: titleText || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ChangePassword),
27
- currentPassword: currentPasswordLabel || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_CurrentPassword),
28
- newPassword: newPasswordLabel || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_NewPassword),
29
- confirmPassword: confirmPasswordLabel || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ConfirmNewPassword),
30
- submitButton: submitButtonText || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ChangePassword),
31
- submittingButton: submittingButtonText || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ChangingPassword),
32
- success: successMessage || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.PasswordChange_Success),
29
+ title: titleText ||
30
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ChangePassword),
31
+ currentPassword: currentPasswordLabel ||
32
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_CurrentPassword),
33
+ newPassword: newPasswordLabel ||
34
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_NewPassword),
35
+ confirmPassword: confirmPasswordLabel ||
36
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ConfirmNewPassword),
37
+ submitButton: submitButtonText ||
38
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ChangePassword),
39
+ submittingButton: submittingButtonText ||
40
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_ChangingPassword),
41
+ success: successMessage ||
42
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.PasswordChange_Success),
33
43
  };
34
44
  const formik = (0, formik_1.useFormik)({
35
45
  initialValues: {
@@ -60,7 +70,9 @@ const ChangePasswordForm = ({ onSubmit, titleText, currentPasswordLabel, newPass
60
70
  display: 'flex',
61
71
  flexDirection: 'column',
62
72
  alignItems: 'center',
63
- }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h4", component: "h1", gutterBottom: true, children: labels.title }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "form", onSubmit: formik.handleSubmit, sx: { mt: 1, width: '100%' }, children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "currentPassword", name: "currentPassword", label: labels.currentPassword, type: "password", value: formik.values.currentPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.currentPassword && formik.errors.currentPassword), helperText: formik.touched.currentPassword && formik.errors.currentPassword, margin: "normal" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "newPassword", name: "newPassword", label: labels.newPassword, type: "password", value: formik.values.newPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.newPassword && formik.errors.newPassword), helperText: formik.touched.newPassword && formik.errors.newPassword, margin: "normal" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "confirmPassword", name: "confirmPassword", label: labels.confirmPassword, type: "password", value: formik.values.confirmPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.confirmPassword && formik.errors.confirmPassword), helperText: formik.touched.confirmPassword && formik.errors.confirmPassword, margin: "normal" }), apiError && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { mt: 2, mb: 2 }, children: apiError })), success && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "success", sx: { mt: 2, mb: 2 }, children: labels.success })), (0, jsx_runtime_1.jsx)(material_1.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", sx: { mt: 3, mb: 2 }, disabled: formik.isSubmitting, children: formik.isSubmitting ? labels.submittingButton : labels.submitButton })] })] }) }));
73
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h4", component: "h1", gutterBottom: true, children: labels.title }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "form", onSubmit: formik.handleSubmit, sx: { mt: 1, width: '100%' }, children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "currentPassword", name: "currentPassword", label: labels.currentPassword, type: "password", value: formik.values.currentPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.currentPassword && formik.errors.currentPassword), helperText: formik.touched.currentPassword && formik.errors.currentPassword, margin: "normal" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "newPassword", name: "newPassword", label: labels.newPassword, type: "password", value: formik.values.newPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.newPassword && formik.errors.newPassword), helperText: formik.touched.newPassword && formik.errors.newPassword, margin: "normal" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, id: "confirmPassword", name: "confirmPassword", label: labels.confirmPassword, type: "password", value: formik.values.confirmPassword, onChange: formik.handleChange, onBlur: formik.handleBlur, error: Boolean(formik.touched.confirmPassword && formik.errors.confirmPassword), helperText: formik.touched.confirmPassword && formik.errors.confirmPassword, margin: "normal" }), apiError && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { mt: 2, mb: 2 }, children: apiError })), success && ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "success", sx: { mt: 2, mb: 2 }, children: labels.success })), (0, jsx_runtime_1.jsx)(material_1.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", sx: { mt: 3, mb: 2 }, disabled: formik.isSubmitting, children: formik.isSubmitting
74
+ ? labels.submittingButton
75
+ : labels.submitButton })] })] }) }));
64
76
  };
65
77
  exports.ChangePasswordForm = ChangePasswordForm;
66
78
  exports.default = exports.ChangePasswordForm;
@@ -1,13 +1,13 @@
1
1
  import { FormikProps } from 'formik';
2
2
  import { FC } from 'react';
3
- export interface ExpirationSecondsSelectorProps {
3
+ export interface ExpirationSecondsSelectorProps<T = Record<string, unknown>> {
4
4
  name: string;
5
5
  label: string;
6
- formik: FormikProps<any>;
6
+ formik: FormikProps<T>;
7
7
  optionValues: number[];
8
8
  optionNames: string[];
9
9
  onChange?: (value: number) => void;
10
10
  }
11
- export declare const ExpirationSecondsSelector: FC<ExpirationSecondsSelectorProps>;
11
+ export declare const ExpirationSecondsSelector: FC<ExpirationSecondsSelectorProps<Record<string, unknown>>>;
12
12
  export default ExpirationSecondsSelector;
13
13
  //# sourceMappingURL=ExpirationSecondsSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpirationSecondsSelector.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ExpirationSecondsSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAe,EAAE,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CAiDxE,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"ExpirationSecondsSelector.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ExpirationSecondsSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAe,EAAE,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,WAAW,8BAA8B,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,eAAO,MAAM,yBAAyB,EAAE,EAAE,CACxC,8BAA8B,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA2CxD,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExpirationSecondsSelector = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
- const ExpirationSecondsSelector = ({ name, label, formik, optionValues, optionNames, onChange, }) => {
6
+ const ExpirationSecondsSelector = ({ name, label, formik, optionValues, optionNames, onChange }) => {
7
7
  return ((0, jsx_runtime_1.jsx)(material_1.TextField, { select: true, fullWidth: true, label: label, name: name, value: formik.values[name] ?? '', onChange: (event) => {
8
8
  const selectedValue = event.target.value;
9
9
  formik.setFieldValue(name, selectedValue);
@@ -1 +1 @@
1
- {"version":3,"file":"Flag.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/Flag.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CA6B9B,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Flag.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/Flag.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CA6B9B,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ForgotPasswordForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ForgotPasswordForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAI3B,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,eAAe,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACnC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CA+F1D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"ForgotPasswordForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/ForgotPasswordForm.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,eAAe,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACnC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CA0I1D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -3,26 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ForgotPasswordForm = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
6
7
  const material_1 = require("@mui/material");
7
8
  const formik_1 = require("formik");
8
9
  const react_1 = require("react");
9
10
  const Yup = tslib_1.__importStar(require("yup"));
10
- const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
11
11
  const contexts_1 = require("../contexts");
12
12
  const ForgotPasswordForm = ({ onSubmit, emailValidation, labels = {}, }) => {
13
13
  const { tComponent } = (0, contexts_1.useI18n)();
14
14
  const [success, setSuccess] = (0, react_1.useState)(false);
15
15
  const [apiError, setApiError] = (0, react_1.useState)('');
16
16
  const validation = {
17
- email: emailValidation || Yup.string()
18
- .email(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_InvalidEmail))
19
- .required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
17
+ email: emailValidation ||
18
+ Yup.string()
19
+ .email(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_InvalidEmail))
20
+ .required(tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Validation_Required)),
20
21
  };
21
22
  const translatedLabels = {
22
- title: labels.title || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_Title),
23
- email: labels.email || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Email),
24
- sendResetLink: labels.sendResetLink || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_SendResetLink),
25
- successMessage: labels.successMessage || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.PasswordReset_Success),
23
+ title: labels.title ||
24
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_Title),
25
+ email: labels.email ||
26
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.Common_Email),
27
+ sendResetLink: labels.sendResetLink ||
28
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_SendResetLink),
29
+ successMessage: labels.successMessage ||
30
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.PasswordReset_Success),
26
31
  };
27
32
  const formik = (0, formik_1.useFormik)({
28
33
  initialValues: {
@@ -38,7 +43,9 @@ const ForgotPasswordForm = ({ onSubmit, emailValidation, labels = {}, }) => {
38
43
  setApiError('');
39
44
  }
40
45
  catch (error) {
41
- setApiError(error.response?.data?.message || tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_Error));
46
+ const err = error;
47
+ setApiError(err.response?.data?.message ||
48
+ tComponent(suite_core_lib_1.SuiteCoreComponentId, suite_core_lib_1.SuiteCoreStringKey.ForgotPassword_Error));
42
49
  setSuccess(false);
43
50
  }
44
51
  },
@@ -6,7 +6,7 @@ export interface LoginFormValues {
6
6
  username?: string;
7
7
  password?: string;
8
8
  mnemonic?: string;
9
- [key: string]: any;
9
+ [key: string]: string | boolean | undefined;
10
10
  }
11
11
  export interface LoginFormProps {
12
12
  onSubmit: (values: LoginFormValues) => Promise<void>;
@@ -36,7 +36,7 @@ export interface LoginFormProps {
36
36
  passwordValidation?: Yup.StringSchema;
37
37
  mnemonicValidation?: Yup.StringSchema;
38
38
  additionalFields?: (formik: ReturnType<typeof useFormik<LoginFormValues>>) => React.ReactNode;
39
- additionalInitialValues?: Record<string, any>;
39
+ additionalInitialValues?: Record<string, string | boolean>;
40
40
  additionalValidation?: Record<string, Yup.Schema>;
41
41
  }
42
42
  export declare const LoginForm: FC<LoginFormProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"LoginForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/LoginForm.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAI3B,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACjC,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACnC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,eAAe,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAC9F,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAsPxC,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"LoginForm.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-express-suite-react-components/src/components/LoginForm.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAG3B,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACjC,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACnC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,kBAAkB,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC;IACtC,gBAAgB,CAAC,EAAE,CACjB,MAAM,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,eAAe,CAAC,CAAC,KAClD,KAAK,CAAC,SAAS,CAAC;IACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;IAC3D,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAoYxC,CAAC;AAEF,eAAe,SAAS,CAAC"}