@dynamic-labs/sdk-react-core 4.61.2 → 4.61.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/lib/context/ViewContext/types/index.d.ts +1 -1
  6. package/src/lib/styles/index.shadow.cjs +1 -1
  7. package/src/lib/styles/index.shadow.js +1 -1
  8. package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
  9. package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
  10. package/src/lib/utils/hooks/index.d.ts +1 -0
  11. package/src/lib/utils/hooks/useIsPasswordEncrypted/index.d.ts +1 -0
  12. package/src/lib/utils/hooks/useIsPasswordEncrypted/useIsPasswordEncrypted.cjs +132 -0
  13. package/src/lib/utils/hooks/useIsPasswordEncrypted/useIsPasswordEncrypted.d.ts +1 -0
  14. package/src/lib/utils/hooks/useIsPasswordEncrypted/useIsPasswordEncrypted.js +128 -0
  15. package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.cjs +2 -2
  16. package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.js +3 -3
  17. package/src/lib/views/ResetPasswordForSettingsView/ResetPasswordForSettingsView.cjs +134 -0
  18. package/src/lib/views/ResetPasswordForSettingsView/ResetPasswordForSettingsView.d.ts +2 -0
  19. package/src/lib/views/ResetPasswordForSettingsView/ResetPasswordForSettingsView.js +130 -0
  20. package/src/lib/views/ResetPasswordForSettingsView/index.d.ts +1 -0
  21. package/src/lib/views/viewToComponentMap.cjs +2 -0
  22. package/src/lib/views/viewToComponentMap.d.ts +1 -0
  23. package/src/lib/views/viewToComponentMap.js +2 -0
  24. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.cjs +19 -5
  25. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js +19 -5
  26. package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.cjs +16 -33
  27. package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.js +17 -34
  28. package/src/lib/widgets/DynamicWidget/views/ResetPasswordCurrentView/ResetPasswordCurrentView.cjs +50 -0
  29. package/src/lib/widgets/DynamicWidget/views/ResetPasswordCurrentView/ResetPasswordCurrentView.d.ts +8 -0
  30. package/src/lib/widgets/DynamicWidget/views/ResetPasswordCurrentView/ResetPasswordCurrentView.js +46 -0
  31. package/src/lib/widgets/DynamicWidget/views/ResetPasswordCurrentView/index.d.ts +1 -0
  32. package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/ResetPasswordView.cjs +182 -0
  33. package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/ResetPasswordView.d.ts +5 -0
  34. package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/ResetPasswordView.js +178 -0
  35. package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/index.d.ts +1 -0
  36. package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.cjs +11 -4
  37. package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.d.ts +3 -0
  38. package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.js +11 -4
  39. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.cjs +16 -9
  40. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.d.ts +3 -0
  41. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.js +16 -9
  42. package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.cjs +2 -2
  43. package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.d.ts +2 -0
  44. package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.js +2 -2
@@ -10,6 +10,7 @@ import { ToggleVisibilityButton } from '../../../../components/ToggleVisibilityB
10
10
  import { Typography } from '../../../../components/Typography/Typography.js';
11
11
  import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
12
12
  import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
13
+ import { ReactComponent as SvgErrorCircleX } from '../../../../shared/assets/error-circle-x.js';
13
14
  import { ReactComponent as SvgPasswordLockIcon } from '../../../../shared/assets/password-lock-icon.js';
14
15
  import '@dynamic-labs/iconic';
15
16
  import '../../../../context/ViewContext/ViewContext.js';
@@ -25,29 +26,35 @@ const validatePassword = (password) => ({
25
26
  symbol: /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password),
26
27
  uppercase: /[A-Z]/.test(password),
27
28
  });
28
- const SetupPasswordEnterView = ({ onContinue, onBack, }) => {
29
+ const SetupPasswordEnterView = ({ onContinue, onBack, title, description, oldPassword, }) => {
29
30
  const { t } = useTranslation();
30
31
  const [password, setPassword] = useState('');
31
32
  const [showPassword, setShowPassword] = useState(false);
33
+ const [samePasswordError, setSamePasswordError] = useState(false);
32
34
  const requirements = validatePassword(password);
33
35
  const allValid = Object.values(requirements).every(Boolean);
34
36
  const handlePasswordChange = useCallback((e) => {
35
37
  setPassword(e.target.value);
38
+ setSamePasswordError(false);
36
39
  }, []);
37
40
  const handleToggleVisibility = useCallback((hidden) => {
38
41
  setShowPassword(!hidden);
39
42
  }, []);
40
43
  const handleContinue = useCallback(() => {
41
- if (allValid) {
42
- onContinue(password);
44
+ if (!allValid)
45
+ return;
46
+ if (oldPassword && password === oldPassword) {
47
+ setSamePasswordError(true);
48
+ return;
43
49
  }
44
- }, [allValid, onContinue, password]);
50
+ onContinue(password);
51
+ }, [allValid, onContinue, password, oldPassword]);
45
52
  const backButton = (jsx(IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-enter-back-button', children: jsx(SvgChevronLeft, {}) }));
46
- return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.enter.title', children: t('dyn_setup_password.enter.title') }) }), jsx("div", { className: 'setup-password-enter-view', children: jsxs("div", { className: 'setup-password-enter-view__body', children: [jsx("div", { className: 'setup-password-enter-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgPasswordLockIcon, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.enter.description', className: 'setup-password-enter-view__description', children: t('dyn_setup_password.enter.description') }), jsx(Input, { id: 'setup-password-enter-password-input', type: showPassword ? 'text' : 'password', label: t('dyn_setup_password.enter.label'), placeholder: t('dyn_setup_password.enter.placeholder'), value: password, onChange: handlePasswordChange, variant: 'regular', suffix:
47
- // eslint-disable-next-line react/jsx-wrap-multilines
48
- jsx(ToggleVisibilityButton, { initialState: true, onClick: handleToggleVisibility }) }), jsxs("div", { className: 'setup-password-enter-view__requirements', children: [jsx(PasswordRequirement, { met: requirements.length, text: t('dyn_setup_password.enter.requirement_length') }), jsx(PasswordRequirement, { met: requirements.uppercase, text: t('dyn_setup_password.enter.requirement_uppercase') }), jsx(PasswordRequirement, { met: requirements.lowercase, text: t('dyn_setup_password.enter.requirement_lowercase') }), jsx(PasswordRequirement, { met: requirements.number, text: t('dyn_setup_password.enter.requirement_number') }), jsx(PasswordRequirement, { met: requirements.symbol, text: t('dyn_setup_password.enter.requirement_symbol') })] }), jsx("div", { className: 'setup-password-enter-view__actions', children: jsx(TypographyButton, { dataTestId: 'setup-password-enter-continue-button', onClick: handleContinue, disabled: !allValid, copykey: 'dyn_setup_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
49
- color: 'inherit',
50
- }, expanded: true, children: t('dyn_setup_password.button.continue') }) })] }) })] }));
53
+ return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.enter.title', children: title !== null && title !== void 0 ? title : t('dyn_setup_password.enter.title') }) }), jsxs("div", { className: 'setup-password-enter-view', children: [jsxs("div", { className: 'setup-password-enter-view__body', children: [jsx("div", { className: 'setup-password-enter-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgPasswordLockIcon, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.enter.description', className: 'setup-password-enter-view__description', children: description !== null && description !== void 0 ? description : t('dyn_setup_password.enter.description') }), jsx(Input, { id: 'setup-password-enter-password-input', type: showPassword ? 'text' : 'password', label: t('dyn_setup_password.enter.label'), placeholder: t('dyn_setup_password.enter.placeholder'), value: password, onChange: handlePasswordChange, variant: 'regular', suffix:
54
+ // eslint-disable-next-line react/jsx-wrap-multilines
55
+ jsx(ToggleVisibilityButton, { initialState: true, onClick: handleToggleVisibility }) }), jsxs("div", { className: 'setup-password-enter-view__requirements', children: [jsx(PasswordRequirement, { met: requirements.length, text: t('dyn_setup_password.enter.requirement_length') }), jsx(PasswordRequirement, { met: requirements.uppercase, text: t('dyn_setup_password.enter.requirement_uppercase') }), jsx(PasswordRequirement, { met: requirements.lowercase, text: t('dyn_setup_password.enter.requirement_lowercase') }), jsx(PasswordRequirement, { met: requirements.number, text: t('dyn_setup_password.enter.requirement_number') }), jsx(PasswordRequirement, { met: requirements.symbol, text: t('dyn_setup_password.enter.requirement_symbol') })] }), samePasswordError && (jsxs("div", { className: 'setup-password-enter-view__same-password-error', children: [jsx(Icon, { color: 'text-error', size: 'medium', children: jsx(SvgErrorCircleX, {}) }), jsx(Typography, { variant: 'body_small', color: 'error-1', children: t('dyn_reset_password.enter.same_password_error') })] }))] }), jsx("div", { className: 'setup-password-enter-view__actions', children: jsx(TypographyButton, { dataTestId: 'setup-password-enter-continue-button', onClick: handleContinue, disabled: !allValid, copykey: 'dyn_setup_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
56
+ color: 'inherit',
57
+ }, expanded: true, children: t('dyn_setup_password.button.continue') }) })] })] }));
51
58
  };
52
59
 
53
60
  export { SetupPasswordEnterView };
@@ -14,12 +14,12 @@ var checkCircleFilled = require('../../../../shared/assets/check-circle-filled.c
14
14
  require('@dynamic-labs/iconic');
15
15
  require('../../../../context/ViewContext/ViewContext.cjs');
16
16
 
17
- const SetupPasswordSuccessView = ({ onDone, }) => {
17
+ const SetupPasswordSuccessView = ({ onDone, title, description, }) => {
18
18
  const { t } = reactI18next.useTranslation();
19
19
  const handleDone = React.useCallback(() => {
20
20
  onDone();
21
21
  }, [onDone]);
22
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.success.title', children: t('dyn_setup_password.success.title') }) }), jsxRuntime.jsxs("div", { className: 'setup-password-success-view', children: [jsxRuntime.jsx("div", { className: 'setup-password-success-view__content', children: jsxRuntime.jsxs("div", { className: 'setup-password-success-view__body', children: [jsxRuntime.jsx("div", { className: 'setup-password-success-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(checkCircleFilled.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.success.description', className: 'setup-password-success-view__description', children: t('dyn_setup_password.success.description') })] }) }), jsxRuntime.jsx("div", { className: 'setup-password-success-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-success-done-button', onClick: handleDone, copykey: 'dyn_setup_password.button.done', buttonVariant: 'brand-primary', typographyProps: {
22
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.success.title', children: title !== null && title !== void 0 ? title : t('dyn_setup_password.success.title') }) }), jsxRuntime.jsxs("div", { className: 'setup-password-success-view', children: [jsxRuntime.jsx("div", { className: 'setup-password-success-view__content', children: jsxRuntime.jsxs("div", { className: 'setup-password-success-view__body', children: [jsxRuntime.jsx("div", { className: 'setup-password-success-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(checkCircleFilled.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.success.description', className: 'setup-password-success-view__description', children: description !== null && description !== void 0 ? description : t('dyn_setup_password.success.description') })] }) }), jsxRuntime.jsx("div", { className: 'setup-password-success-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-success-done-button', onClick: handleDone, copykey: 'dyn_setup_password.button.done', buttonVariant: 'brand-primary', typographyProps: {
23
23
  color: 'inherit',
24
24
  }, expanded: true, children: t('dyn_setup_password.button.done') }) })] })] }));
25
25
  };
@@ -1,5 +1,7 @@
1
1
  import { FC } from 'react';
2
2
  export type SetupPasswordSuccessViewProps = {
3
3
  onDone: () => void;
4
+ title?: string;
5
+ description?: string;
4
6
  };
5
7
  export declare const SetupPasswordSuccessView: FC<SetupPasswordSuccessViewProps>;
@@ -10,12 +10,12 @@ import { ReactComponent as SvgCheckCircleFilled } from '../../../../shared/asset
10
10
  import '@dynamic-labs/iconic';
11
11
  import '../../../../context/ViewContext/ViewContext.js';
12
12
 
13
- const SetupPasswordSuccessView = ({ onDone, }) => {
13
+ const SetupPasswordSuccessView = ({ onDone, title, description, }) => {
14
14
  const { t } = useTranslation();
15
15
  const handleDone = useCallback(() => {
16
16
  onDone();
17
17
  }, [onDone]);
18
- return (jsxs(Fragment, { children: [jsx(ModalHeader, { children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.success.title', children: t('dyn_setup_password.success.title') }) }), jsxs("div", { className: 'setup-password-success-view', children: [jsx("div", { className: 'setup-password-success-view__content', children: jsxs("div", { className: 'setup-password-success-view__body', children: [jsx("div", { className: 'setup-password-success-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgCheckCircleFilled, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.success.description', className: 'setup-password-success-view__description', children: t('dyn_setup_password.success.description') })] }) }), jsx("div", { className: 'setup-password-success-view__actions', children: jsx(TypographyButton, { dataTestId: 'setup-password-success-done-button', onClick: handleDone, copykey: 'dyn_setup_password.button.done', buttonVariant: 'brand-primary', typographyProps: {
18
+ return (jsxs(Fragment, { children: [jsx(ModalHeader, { children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.success.title', children: title !== null && title !== void 0 ? title : t('dyn_setup_password.success.title') }) }), jsxs("div", { className: 'setup-password-success-view', children: [jsx("div", { className: 'setup-password-success-view__content', children: jsxs("div", { className: 'setup-password-success-view__body', children: [jsx("div", { className: 'setup-password-success-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgCheckCircleFilled, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.success.description', className: 'setup-password-success-view__description', children: description !== null && description !== void 0 ? description : t('dyn_setup_password.success.description') })] }) }), jsx("div", { className: 'setup-password-success-view__actions', children: jsx(TypographyButton, { dataTestId: 'setup-password-success-done-button', onClick: handleDone, copykey: 'dyn_setup_password.button.done', buttonVariant: 'brand-primary', typographyProps: {
19
19
  color: 'inherit',
20
20
  }, expanded: true, children: t('dyn_setup_password.button.done') }) })] })] }));
21
21
  };