@dynamic-labs/sdk-react-core 4.61.2 → 4.61.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.
- package/CHANGELOG.md +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useIsPasswordEncrypted/index.d.ts +1 -0
- package/src/lib/utils/hooks/useIsPasswordEncrypted/useIsPasswordEncrypted.cjs +132 -0
- package/src/lib/utils/hooks/useIsPasswordEncrypted/useIsPasswordEncrypted.d.ts +1 -0
- package/src/lib/utils/hooks/useIsPasswordEncrypted/useIsPasswordEncrypted.js +128 -0
- package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.cjs +2 -2
- package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.js +3 -3
- package/src/lib/views/ResetPasswordForSettingsView/ResetPasswordForSettingsView.cjs +134 -0
- package/src/lib/views/ResetPasswordForSettingsView/ResetPasswordForSettingsView.d.ts +2 -0
- package/src/lib/views/ResetPasswordForSettingsView/ResetPasswordForSettingsView.js +130 -0
- package/src/lib/views/ResetPasswordForSettingsView/index.d.ts +1 -0
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +1 -0
- package/src/lib/views/SendBalanceView/SendBalanceView.js +1 -0
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.cjs +19 -5
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js +19 -5
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.cjs +16 -33
- package/src/lib/widgets/DynamicWidget/views/ExportAndRecoveryView/ExportAndRecoveryView.js +17 -34
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordCurrentView/ResetPasswordCurrentView.cjs +50 -0
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordCurrentView/ResetPasswordCurrentView.d.ts +8 -0
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordCurrentView/ResetPasswordCurrentView.js +46 -0
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordCurrentView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/ResetPasswordView.cjs +182 -0
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/ResetPasswordView.d.ts +5 -0
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/ResetPasswordView.js +178 -0
- package/src/lib/widgets/DynamicWidget/views/ResetPasswordView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.cjs +11 -4
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.d.ts +3 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.js +11 -4
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.cjs +16 -9
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.d.ts +3 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.js +16 -9
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.js +2 -2
package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.js
CHANGED
|
@@ -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
|
-
|
|
44
|
+
if (!allValid)
|
|
45
|
+
return;
|
|
46
|
+
if (oldPassword && password === oldPassword) {
|
|
47
|
+
setSamePasswordError(true);
|
|
48
|
+
return;
|
|
43
49
|
}
|
|
44
|
-
|
|
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') }) }),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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 };
|
package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.cjs
CHANGED
|
@@ -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
|
};
|
package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.js
CHANGED
|
@@ -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
|
};
|