@dynamic-labs/sdk-react-core 4.57.1 → 4.58.0

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 (140) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/index.cjs +2 -0
  6. package/src/index.d.ts +1 -1
  7. package/src/index.js +1 -0
  8. package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.cjs +127 -0
  9. package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.d.ts +1 -1
  10. package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.js +123 -0
  11. package/src/lib/components/Typography/Typography.cjs +1 -0
  12. package/src/lib/components/Typography/Typography.js +1 -0
  13. package/src/lib/components/Typography/Typography.types.d.ts +1 -1
  14. package/src/lib/context/ViewContext/types/index.d.ts +1 -1
  15. package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +6 -0
  16. package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +6 -0
  17. package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +1 -1
  18. package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +1 -1
  19. package/src/lib/shared/assets/check-circle-filled.cjs +60 -0
  20. package/src/lib/shared/assets/check-circle-filled.js +36 -0
  21. package/src/lib/shared/assets/index.d.ts +16 -12
  22. package/src/lib/shared/assets/knowledge-check-icon.cjs +57 -0
  23. package/src/lib/shared/assets/knowledge-check-icon.js +33 -0
  24. package/src/lib/shared/assets/password-lock-icon.cjs +54 -0
  25. package/src/lib/shared/assets/password-lock-icon.js +30 -0
  26. package/src/lib/shared/assets/secure-action.cjs +54 -0
  27. package/src/lib/shared/assets/secure-action.js +30 -0
  28. package/src/lib/shared/assets/warning-circle-orange.cjs +57 -0
  29. package/src/lib/shared/assets/warning-circle-orange.js +33 -0
  30. package/src/lib/styles/index.shadow.cjs +1 -1
  31. package/src/lib/styles/index.shadow.js +1 -1
  32. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +4 -1
  33. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.d.ts +5 -1
  34. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +4 -1
  35. package/src/lib/utils/functions/reconcilePrimaryWallet/index.d.ts +1 -0
  36. package/src/lib/utils/functions/reconcilePrimaryWallet/reconcilePrimaryWallet.cjs +26 -0
  37. package/src/lib/utils/functions/reconcilePrimaryWallet/reconcilePrimaryWallet.d.ts +2 -0
  38. package/src/lib/utils/functions/reconcilePrimaryWallet/reconcilePrimaryWallet.js +22 -0
  39. package/src/lib/utils/hooks/index.d.ts +1 -0
  40. package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.cjs +30 -17
  41. package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.d.ts +0 -1
  42. package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.js +32 -19
  43. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +21 -12
  44. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -1
  45. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +21 -12
  46. package/src/lib/utils/hooks/useRefreshAuth/index.d.ts +1 -0
  47. package/src/lib/utils/hooks/useRefreshAuth/useRefreshAuth.cjs +49 -0
  48. package/src/lib/utils/hooks/useRefreshAuth/useRefreshAuth.d.ts +8 -0
  49. package/src/lib/utils/hooks/useRefreshAuth/useRefreshAuth.js +45 -0
  50. package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.cjs +13 -23
  51. package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.js +12 -22
  52. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +12 -10
  53. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +13 -11
  54. package/src/lib/utils/hooks/useWalletBackup/cloudProviders.cjs +2 -2
  55. package/src/lib/utils/hooks/useWalletBackup/cloudProviders.js +2 -2
  56. package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.cjs +2 -2
  57. package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.js +2 -2
  58. package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +2 -2
  59. package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +2 -2
  60. package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.cjs +1 -1
  61. package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.js +1 -1
  62. package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -1
  63. package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -1
  64. package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.cjs +1 -1
  65. package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.js +1 -1
  66. package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -1
  67. package/src/lib/views/EmailVerification/EmailVerification.js +1 -1
  68. package/src/lib/views/ExportSharesView/ExportSharesView.cjs +1 -1
  69. package/src/lib/views/ExportSharesView/ExportSharesView.js +1 -1
  70. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +1 -1
  71. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +1 -1
  72. package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.cjs +1 -1
  73. package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.js +1 -1
  74. package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +1 -1
  75. package/src/lib/views/MfaVerificationView/MfaVerificationView.js +1 -1
  76. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.cjs +1 -1
  77. package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.js +1 -1
  78. package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.cjs +1 -1
  79. package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.js +1 -1
  80. package/src/lib/views/SmsVerification/SmsVerification.cjs +1 -1
  81. package/src/lib/views/SmsVerification/SmsVerification.js +1 -1
  82. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +6 -5
  83. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +6 -5
  84. package/src/lib/views/WaasUpgradeView/WaasUpgradeView.cjs +1 -1
  85. package/src/lib/views/WaasUpgradeView/WaasUpgradeView.js +1 -1
  86. package/src/lib/views/WalletLockedView/WalletLockedView.cjs +1 -1
  87. package/src/lib/views/WalletLockedView/WalletLockedView.js +1 -1
  88. package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +2 -2
  89. package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +2 -2
  90. package/src/lib/views/viewToComponentMap.cjs +2 -0
  91. package/src/lib/views/viewToComponentMap.d.ts +1 -0
  92. package/src/lib/views/viewToComponentMap.js +2 -0
  93. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +1 -1
  94. package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +1 -1
  95. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +15 -3
  96. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +6 -0
  97. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +15 -3
  98. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
  99. package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +1 -1
  100. package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +1 -1
  101. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs +2 -2
  102. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.js +2 -2
  103. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.cjs +31 -10
  104. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js +31 -10
  105. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +1 -1
  106. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +1 -1
  107. package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.cjs +54 -0
  108. package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.d.ts +7 -0
  109. package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.js +50 -0
  110. package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/index.d.ts +2 -0
  111. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/PasswordRequirement.cjs +15 -0
  112. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/PasswordRequirement.d.ts +6 -0
  113. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/PasswordRequirement.js +11 -0
  114. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.cjs +57 -0
  115. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.d.ts +6 -0
  116. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.js +53 -0
  117. package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/index.d.ts +4 -0
  118. package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.cjs +83 -0
  119. package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.d.ts +7 -0
  120. package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.js +79 -0
  121. package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/index.d.ts +2 -0
  122. package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.cjs +27 -0
  123. package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.d.ts +5 -0
  124. package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.js +23 -0
  125. package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/index.d.ts +2 -0
  126. package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.cjs +37 -0
  127. package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.d.ts +6 -0
  128. package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.js +33 -0
  129. package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/index.d.ts +2 -0
  130. package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.cjs +76 -0
  131. package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.d.ts +6 -0
  132. package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.js +72 -0
  133. package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/index.d.ts +2 -0
  134. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupInfoView.cjs +1 -1
  135. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupInfoView.js +1 -1
  136. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView.cjs +1 -1
  137. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView.js +1 -1
  138. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.cjs +1 -1
  139. package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.js +1 -1
  140. package/src/lib/widgets/DynamicWidget/views/index.d.ts +6 -0
@@ -11,11 +11,11 @@ import { TypographyButton } from '../../../../../components/TypographyButton/Typ
11
11
  import '../../../../../context/DynamicContext/DynamicContext.js';
12
12
  import '../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
13
13
  import '@dynamic-labs/iconic';
14
+ import { ReactComponent as SvgBackupArrow } from '../../../../../shared/assets/backupArrow.js';
14
15
  import { ReactComponent as SvgChevronLeft } from '../../../../../shared/assets/chevron-left.js';
15
16
  import { ReactComponent as SvgExportPrivateKey } from '../../../../../shared/assets/export-private-key.js';
16
17
  import { ReactComponent as SvgExportRecoveryPhrase } from '../../../../../shared/assets/export-recovery-phrase.js';
17
18
  import { useViewContext } from '../../../../../context/ViewContext/ViewContext.js';
18
- import { ReactComponent as SvgBackupArrow } from '../../../../../shared/assets/backupArrow.js';
19
19
  import '../../../../../shared/logger.js';
20
20
  import '@dynamic-labs/wallet-book';
21
21
  import '@dynamic-labs/utils';
@@ -167,7 +167,7 @@ const EmbeddedWalletExportSection = () => {
167
167
  const exportButtonStartSlot = useMemo(() => (jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: isV3WaasWallet
168
168
  ? 'dyn_settings.export_section.export_button'
169
169
  : 'dyn_settings.export_section.private_key_button', children: isV3WaasWallet
170
- ? t('dyn_settings.export_section.export_button', 'Export')
170
+ ? t('dyn_settings.export_section.export_button')
171
171
  : t('dyn_settings.export_section.private_key_button') })] })), [exportIconClasses, isV3WaasWallet, t]);
172
172
  const recoveryPhraseButtonStartSlot = useMemo(() => (jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] })), [exportIconClasses, t]);
173
173
  if (!isEmbeddedWallet) {
@@ -8,24 +8,23 @@ var React = require('react');
8
8
  var reactI18next = require('react-i18next');
9
9
  var Typography = require('../../../../../components/Typography/Typography.cjs');
10
10
  var TypographyButton = require('../../../../../components/TypographyButton/TypographyButton.cjs');
11
+ require('../../../../../context/DynamicContext/DynamicContext.cjs');
12
+ require('../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
13
+ require('@dynamic-labs/iconic');
14
+ require('@dynamic-labs/wallet-connector-core');
11
15
  var chevronLeft = require('../../../../../shared/assets/chevron-left.cjs');
12
16
  var faceId = require('../../../../../shared/assets/face-id.cjs');
13
17
  var lock = require('../../../../../shared/assets/lock.cjs');
14
- require('@dynamic-labs/iconic');
15
18
  require('../../../../../context/ViewContext/ViewContext.cjs');
16
- require('../../../../../events/dynamicEvents.cjs');
17
- require('../../../../../../../_virtual/_tslib.cjs');
18
- require('@dynamic-labs/utils');
19
- require('../../../../../context/DynamicContext/DynamicContext.cjs');
20
- require('../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
21
- require('@dynamic-labs/wallet-connector-core');
22
19
  require('../../../../../shared/logger.cjs');
23
20
  require('@dynamic-labs/wallet-book');
21
+ require('@dynamic-labs/utils');
24
22
  require('../../../../../utils/constants/colors.cjs');
25
23
  require('../../../../../utils/constants/values.cjs');
26
24
  require('@dynamic-labs/sdk-api-core');
27
25
  require('../../../../../shared/consts/index.cjs');
28
- require('../../../../../store/state/authMode/authMode.cjs');
26
+ require('../../../../../events/dynamicEvents.cjs');
27
+ require('../../../../../../../_virtual/_tslib.cjs');
29
28
  require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
30
29
  require('../../../../../context/ErrorContext/ErrorContext.cjs');
31
30
  require('@dynamic-labs/multi-wallet');
@@ -35,6 +34,7 @@ require('@dynamic-labs-sdk/client/core');
35
34
  require('../../../../../client/client.cjs');
36
35
  require('@dynamic-labs-sdk/client');
37
36
  require('../../../../../config/ApiEndpoint.cjs');
37
+ var useProjectSettings = require('../../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
38
38
  require('@dynamic-labs/locale');
39
39
  require('../../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
40
40
  require('../../../../../store/state/primaryWalletId/primaryWalletId.cjs');
@@ -43,11 +43,13 @@ require('../../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTy
43
43
  require('../../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
44
44
  require('../../../../../context/AccountExistsContext/AccountExistsContext.cjs');
45
45
  require('../../../../../context/UserWalletsContext/UserWalletsContext.cjs');
46
+ require('../../../../../store/state/authMode/authMode.cjs');
46
47
  require('../../../../../context/VerificationContext/VerificationContext.cjs');
47
48
  require('react-dom');
48
49
  require('../../../../../utils/functions/compareChains/compareChains.cjs');
49
50
  require('../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
50
51
  require('../../../../../context/ThemeContext/ThemeContext.cjs');
52
+ var useSmartWallets = require('../../../../../utils/hooks/useSmartWallets/useSmartWallets.cjs');
51
53
  require('../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
52
54
  require('bs58');
53
55
  require('@dynamic-labs/types');
@@ -112,21 +114,40 @@ require('../../../../../store/state/tokenBalances.cjs');
112
114
  require('../../../../../store/state/multichainBalances.cjs');
113
115
  require('../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
114
116
  var useIsPasskeysMfaEnabled = require('../../../../../utils/hooks/useIsPasskeysMfaEnabled/useIsPasskeysMfaEnabled.cjs');
117
+ var useInternalDynamicContext = require('../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
115
118
 
116
119
  const MfaSection = ({ isLoading }) => {
120
+ var _a, _b, _c;
117
121
  const { t } = reactI18next.useTranslation();
118
122
  const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
123
+ const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
124
+ const { getEOAWallet } = useSmartWallets.useSmartWallets();
125
+ const projectSettings = useProjectSettings.useProjectSettings();
119
126
  const isMfaEnabled = useIsMfaEnabled.useIsMfaEnabled();
120
127
  const isTotpMfaEnabled = useIsTotpMfaEnabled.useIsTotpMfaEnabled();
121
128
  const isPasskeyMfaEnabled = useIsPasskeysMfaEnabled.useIsPasskeysMfaEnabled();
129
+ const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
130
+ const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
131
+ const isWaasWallet = Boolean(wallet && ((_b = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.startsWith('dynamicwaas')));
132
+ const isPasscodeRequired = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.waas) === null || _c === void 0 ? void 0 : _c.passcodeRequired;
133
+ const shouldShowPasswordSetup = isWaasWallet && isPasscodeRequired;
122
134
  const handleTotpMfaClick = React.useCallback(() => setDynamicWidgetView('manage-totp-mfa'), [setDynamicWidgetView]);
123
135
  const handlePasskeyMfaClick = React.useCallback(() => setDynamicWidgetView('manage-passkeys-mfa'), [setDynamicWidgetView]);
124
- if (!isMfaEnabled) {
136
+ const handlePasscodeClick = React.useCallback(() => {
137
+ setDynamicWidgetView('setup-password', {
138
+ onComplete: () => {
139
+ // Password setup completed
140
+ },
141
+ });
142
+ }, [setDynamicWidgetView]);
143
+ if (!isMfaEnabled && !isWaasWallet) {
125
144
  return null;
126
145
  }
127
146
  return (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.mfa_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.mfa_section.title') }) }), isPasskeyMfaEnabled && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-passkeys-mfa-button', onClick: handlePasskeyMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
128
147
  // eslint-disable-next-line react/jsx-wrap-multilines
129
- jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(faceId.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.mfa_section.passkey_button', children: t('dyn_settings.mfa_section.passkey_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), isTotpMfaEnabled && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-totp-mfa-button', onClick: handleTotpMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
148
+ jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(faceId.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.mfa_section.passkey_button', children: t('dyn_settings.mfa_section.passkey_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), shouldShowPasswordSetup && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'password-setup-button', onClick: handlePasscodeClick, buttonClassName: 'settings-view__body__section__button', startSlot:
149
+ // eslint-disable-next-line react/jsx-wrap-multilines
150
+ jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(lock.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.password.set_button', children: t('dyn_settings.account_security.password.set_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), isTotpMfaEnabled && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-totp-mfa-button', onClick: handleTotpMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
130
151
  // eslint-disable-next-line react/jsx-wrap-multilines
131
152
  jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(lock.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.mfa_section.totp_button', children: t('dyn_settings.mfa_section.totp_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false }))] }));
132
153
  };
@@ -4,24 +4,23 @@ import { useCallback } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { Typography } from '../../../../../components/Typography/Typography.js';
6
6
  import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
7
+ import '../../../../../context/DynamicContext/DynamicContext.js';
8
+ import '../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
9
+ import '@dynamic-labs/iconic';
10
+ import '@dynamic-labs/wallet-connector-core';
7
11
  import { ReactComponent as SvgChevronLeft } from '../../../../../shared/assets/chevron-left.js';
8
12
  import { ReactComponent as SvgFaceId } from '../../../../../shared/assets/face-id.js';
9
13
  import { ReactComponent as SvgLock } from '../../../../../shared/assets/lock.js';
10
- import '@dynamic-labs/iconic';
11
14
  import '../../../../../context/ViewContext/ViewContext.js';
12
- import '../../../../../events/dynamicEvents.js';
13
- import '../../../../../../../_virtual/_tslib.js';
14
- import '@dynamic-labs/utils';
15
- import '../../../../../context/DynamicContext/DynamicContext.js';
16
- import '../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
17
- import '@dynamic-labs/wallet-connector-core';
18
15
  import '../../../../../shared/logger.js';
19
16
  import '@dynamic-labs/wallet-book';
17
+ import '@dynamic-labs/utils';
20
18
  import '../../../../../utils/constants/colors.js';
21
19
  import '../../../../../utils/constants/values.js';
22
20
  import '@dynamic-labs/sdk-api-core';
23
21
  import '../../../../../shared/consts/index.js';
24
- import '../../../../../store/state/authMode/authMode.js';
22
+ import '../../../../../events/dynamicEvents.js';
23
+ import '../../../../../../../_virtual/_tslib.js';
25
24
  import '../../../../../context/CaptchaContext/CaptchaContext.js';
26
25
  import '../../../../../context/ErrorContext/ErrorContext.js';
27
26
  import '@dynamic-labs/multi-wallet';
@@ -31,6 +30,7 @@ import '@dynamic-labs-sdk/client/core';
31
30
  import '../../../../../client/client.js';
32
31
  import '@dynamic-labs-sdk/client';
33
32
  import '../../../../../config/ApiEndpoint.js';
33
+ import { useProjectSettings } from '../../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
34
34
  import '@dynamic-labs/locale';
35
35
  import '../../../../../store/state/dynamicContextProps/dynamicContextProps.js';
36
36
  import '../../../../../store/state/primaryWalletId/primaryWalletId.js';
@@ -39,11 +39,13 @@ import '../../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTyp
39
39
  import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
40
40
  import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
41
41
  import '../../../../../context/UserWalletsContext/UserWalletsContext.js';
42
+ import '../../../../../store/state/authMode/authMode.js';
42
43
  import '../../../../../context/VerificationContext/VerificationContext.js';
43
44
  import 'react-dom';
44
45
  import '../../../../../utils/functions/compareChains/compareChains.js';
45
46
  import '../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
46
47
  import '../../../../../context/ThemeContext/ThemeContext.js';
48
+ import { useSmartWallets } from '../../../../../utils/hooks/useSmartWallets/useSmartWallets.js';
47
49
  import '../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
48
50
  import 'bs58';
49
51
  import '@dynamic-labs/types';
@@ -108,21 +110,40 @@ import '../../../../../store/state/tokenBalances.js';
108
110
  import '../../../../../store/state/multichainBalances.js';
109
111
  import '../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
110
112
  import { useIsPasskeysMfaEnabled } from '../../../../../utils/hooks/useIsPasskeysMfaEnabled/useIsPasskeysMfaEnabled.js';
113
+ import { useInternalDynamicContext } from '../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
111
114
 
112
115
  const MfaSection = ({ isLoading }) => {
116
+ var _a, _b, _c;
113
117
  const { t } = useTranslation();
114
118
  const { setDynamicWidgetView } = useWidgetContext();
119
+ const { primaryWallet } = useInternalDynamicContext();
120
+ const { getEOAWallet } = useSmartWallets();
121
+ const projectSettings = useProjectSettings();
115
122
  const isMfaEnabled = useIsMfaEnabled();
116
123
  const isTotpMfaEnabled = useIsTotpMfaEnabled();
117
124
  const isPasskeyMfaEnabled = useIsPasskeysMfaEnabled();
125
+ const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
126
+ const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
127
+ const isWaasWallet = Boolean(wallet && ((_b = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.startsWith('dynamicwaas')));
128
+ const isPasscodeRequired = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.waas) === null || _c === void 0 ? void 0 : _c.passcodeRequired;
129
+ const shouldShowPasswordSetup = isWaasWallet && isPasscodeRequired;
118
130
  const handleTotpMfaClick = useCallback(() => setDynamicWidgetView('manage-totp-mfa'), [setDynamicWidgetView]);
119
131
  const handlePasskeyMfaClick = useCallback(() => setDynamicWidgetView('manage-passkeys-mfa'), [setDynamicWidgetView]);
120
- if (!isMfaEnabled) {
132
+ const handlePasscodeClick = useCallback(() => {
133
+ setDynamicWidgetView('setup-password', {
134
+ onComplete: () => {
135
+ // Password setup completed
136
+ },
137
+ });
138
+ }, [setDynamicWidgetView]);
139
+ if (!isMfaEnabled && !isWaasWallet) {
121
140
  return null;
122
141
  }
123
142
  return (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: jsx(Typography, { copykey: 'dyn_settings.mfa_section.title', color: 'secondary', weight: 'medium', children: t('dyn_settings.mfa_section.title') }) }), isPasskeyMfaEnabled && (jsx(TypographyButton, { dataTestId: 'manage-passkeys-mfa-button', onClick: handlePasskeyMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
124
143
  // eslint-disable-next-line react/jsx-wrap-multilines
125
- jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgFaceId, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.mfa_section.passkey_button', children: t('dyn_settings.mfa_section.passkey_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), isTotpMfaEnabled && (jsx(TypographyButton, { dataTestId: 'manage-totp-mfa-button', onClick: handleTotpMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
144
+ jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgFaceId, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.mfa_section.passkey_button', children: t('dyn_settings.mfa_section.passkey_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), shouldShowPasswordSetup && (jsx(TypographyButton, { dataTestId: 'password-setup-button', onClick: handlePasscodeClick, buttonClassName: 'settings-view__body__section__button', startSlot:
145
+ // eslint-disable-next-line react/jsx-wrap-multilines
146
+ jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgLock, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.password.set_button', children: t('dyn_settings.account_security.password.set_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), isTotpMfaEnabled && (jsx(TypographyButton, { dataTestId: 'manage-totp-mfa-button', onClick: handleTotpMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
126
147
  // eslint-disable-next-line react/jsx-wrap-multilines
127
148
  jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgLock, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.mfa_section.totp_button', children: t('dyn_settings.mfa_section.totp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false }))] }));
128
149
  };
@@ -14,9 +14,9 @@ require('@dynamic-labs/iconic');
14
14
  require('@dynamic-labs/wallet-connector-core');
15
15
  var accountAndSecurity = require('../../../../shared/assets/account-and-security.cjs');
16
16
  var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
17
+ var connect = require('../../../../shared/assets/connect.cjs');
17
18
  var connectedApps = require('../../../../shared/assets/connected-apps.cjs');
18
19
  var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
19
- var connect = require('../../../../shared/assets/connect.cjs');
20
20
  require('../../../../shared/logger.cjs');
21
21
  require('@dynamic-labs/wallet-book');
22
22
  require('@dynamic-labs/utils');
@@ -10,9 +10,9 @@ import '@dynamic-labs/iconic';
10
10
  import '@dynamic-labs/wallet-connector-core';
11
11
  import { ReactComponent as SvgAccountAndSecurity } from '../../../../shared/assets/account-and-security.js';
12
12
  import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
13
+ import { ReactComponent as SvgConnect } from '../../../../shared/assets/connect.js';
13
14
  import { ReactComponent as SvgConnectedApps } from '../../../../shared/assets/connected-apps.js';
14
15
  import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
15
- import { ReactComponent as SvgConnect } from '../../../../shared/assets/connect.js';
16
16
  import '../../../../shared/logger.js';
17
17
  import '@dynamic-labs/wallet-book';
18
18
  import '@dynamic-labs/utils';
@@ -0,0 +1,54 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
8
+ var reactI18next = require('react-i18next');
9
+ var Icon = require('../../../../components/Icon/Icon.cjs');
10
+ var IconButton = require('../../../../components/IconButton/IconButton.cjs');
11
+ var Input = require('../../../../components/Input/Input.cjs');
12
+ var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
13
+ var ToggleVisibilityButton = require('../../../../components/ToggleVisibilityButton/ToggleVisibilityButton.cjs');
14
+ var Typography = require('../../../../components/Typography/Typography.cjs');
15
+ var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
16
+ var checkCircle = require('../../../../shared/assets/check-circle.cjs');
17
+ var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
18
+ var exclamationCircle = require('../../../../shared/assets/exclamation-circle.cjs');
19
+ var secureAction = require('../../../../shared/assets/secure-action.cjs');
20
+ require('@dynamic-labs/iconic');
21
+ require('../../../../context/ViewContext/ViewContext.cjs');
22
+
23
+ const SetupPasswordConfirmView = ({ password, onContinue, onBack, }) => {
24
+ const { t } = reactI18next.useTranslation();
25
+ const [confirmPassword, setConfirmPassword] = React.useState('');
26
+ const [showPassword, setShowPassword] = React.useState(false);
27
+ const [hasInteracted, setHasInteracted] = React.useState(false);
28
+ const passwordsMatch = password === confirmPassword;
29
+ const isValid = passwordsMatch && confirmPassword.length > 0;
30
+ const handlePasswordChange = React.useCallback((e) => {
31
+ setConfirmPassword(e.target.value);
32
+ setHasInteracted(true);
33
+ }, []);
34
+ const handleToggleVisibility = React.useCallback((hidden) => {
35
+ setShowPassword(!hidden);
36
+ }, []);
37
+ const handleContinue = React.useCallback(() => {
38
+ if (isValid) {
39
+ onContinue();
40
+ }
41
+ }, [isValid, onContinue]);
42
+ const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-confirm-back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
43
+ const showMatchMessage = hasInteracted && confirmPassword.length > 0;
44
+ const matchMessage = passwordsMatch
45
+ ? t('dyn_setup_password.confirm.match')
46
+ : t('dyn_setup_password.confirm.mismatch');
47
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.confirm.title', children: t('dyn_setup_password.confirm.title') }) }), jsxRuntime.jsxs("div", { className: 'setup-password-confirm-view', children: [jsxRuntime.jsxs("div", { className: 'setup-password-confirm-view__body', children: [jsxRuntime.jsx("div", { className: 'setup-password-confirm-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(secureAction.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.confirm.description', className: 'setup-password-confirm-view__description', children: t('dyn_setup_password.confirm.description') }), jsxRuntime.jsxs("div", { className: 'setup-password-confirm-view__input-container', children: [jsxRuntime.jsx(Input.Input, { id: 'setup-password-confirm-password-input', type: showPassword ? 'text' : 'password', label: t('dyn_setup_password.confirm.label'), placeholder: t('dyn_setup_password.confirm.placeholder'), value: confirmPassword, onChange: handlePasswordChange, variant: 'regular', error: !passwordsMatch && hasInteracted && confirmPassword.length > 0, suffix:
48
+ // eslint-disable-next-line react/jsx-wrap-multilines
49
+ jsxRuntime.jsx(ToggleVisibilityButton.ToggleVisibilityButton, { initialState: true, onClick: handleToggleVisibility }) }), showMatchMessage && (jsxRuntime.jsxs("div", { className: 'setup-password-confirm-view__match-indicator', children: [jsxRuntime.jsx(Icon.Icon, { color: passwordsMatch ? 'success-1' : 'text-error', size: 'medium', children: passwordsMatch ? (jsxRuntime.jsx(checkCircle.ReactComponent, {})) : (jsxRuntime.jsx(exclamationCircle.ReactComponent, {})) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: passwordsMatch ? 'secondary' : 'error-1', children: matchMessage })] }))] })] }), jsxRuntime.jsx("div", { className: 'setup-password-confirm-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-confirm-continue-button', onClick: handleContinue, disabled: !isValid, copykey: 'dyn_setup_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
50
+ color: 'inherit',
51
+ }, expanded: true, children: t('dyn_setup_password.button.continue') }) })] })] }));
52
+ };
53
+
54
+ exports.SetupPasswordConfirmView = SetupPasswordConfirmView;
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ export type SetupPasswordConfirmViewProps = {
3
+ password: string;
4
+ onContinue: () => void;
5
+ onBack: () => void;
6
+ };
7
+ export declare const SetupPasswordConfirmView: FC<SetupPasswordConfirmViewProps>;
@@ -0,0 +1,50 @@
1
+ 'use client'
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { useState, useCallback } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Icon } from '../../../../components/Icon/Icon.js';
6
+ import { IconButton } from '../../../../components/IconButton/IconButton.js';
7
+ import { Input } from '../../../../components/Input/Input.js';
8
+ import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
9
+ import { ToggleVisibilityButton } from '../../../../components/ToggleVisibilityButton/ToggleVisibilityButton.js';
10
+ import { Typography } from '../../../../components/Typography/Typography.js';
11
+ import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
12
+ import { ReactComponent as SvgCheckCircle } from '../../../../shared/assets/check-circle.js';
13
+ import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
14
+ import { ReactComponent as SvgExclamationCircle } from '../../../../shared/assets/exclamation-circle.js';
15
+ import { ReactComponent as SvgSecureAction } from '../../../../shared/assets/secure-action.js';
16
+ import '@dynamic-labs/iconic';
17
+ import '../../../../context/ViewContext/ViewContext.js';
18
+
19
+ const SetupPasswordConfirmView = ({ password, onContinue, onBack, }) => {
20
+ const { t } = useTranslation();
21
+ const [confirmPassword, setConfirmPassword] = useState('');
22
+ const [showPassword, setShowPassword] = useState(false);
23
+ const [hasInteracted, setHasInteracted] = useState(false);
24
+ const passwordsMatch = password === confirmPassword;
25
+ const isValid = passwordsMatch && confirmPassword.length > 0;
26
+ const handlePasswordChange = useCallback((e) => {
27
+ setConfirmPassword(e.target.value);
28
+ setHasInteracted(true);
29
+ }, []);
30
+ const handleToggleVisibility = useCallback((hidden) => {
31
+ setShowPassword(!hidden);
32
+ }, []);
33
+ const handleContinue = useCallback(() => {
34
+ if (isValid) {
35
+ onContinue();
36
+ }
37
+ }, [isValid, onContinue]);
38
+ const backButton = (jsx(IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-confirm-back-button', children: jsx(SvgChevronLeft, {}) }));
39
+ const showMatchMessage = hasInteracted && confirmPassword.length > 0;
40
+ const matchMessage = passwordsMatch
41
+ ? t('dyn_setup_password.confirm.match')
42
+ : t('dyn_setup_password.confirm.mismatch');
43
+ return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.confirm.title', children: t('dyn_setup_password.confirm.title') }) }), jsxs("div", { className: 'setup-password-confirm-view', children: [jsxs("div", { className: 'setup-password-confirm-view__body', children: [jsx("div", { className: 'setup-password-confirm-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgSecureAction, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.confirm.description', className: 'setup-password-confirm-view__description', children: t('dyn_setup_password.confirm.description') }), jsxs("div", { className: 'setup-password-confirm-view__input-container', children: [jsx(Input, { id: 'setup-password-confirm-password-input', type: showPassword ? 'text' : 'password', label: t('dyn_setup_password.confirm.label'), placeholder: t('dyn_setup_password.confirm.placeholder'), value: confirmPassword, onChange: handlePasswordChange, variant: 'regular', error: !passwordsMatch && hasInteracted && confirmPassword.length > 0, suffix:
44
+ // eslint-disable-next-line react/jsx-wrap-multilines
45
+ jsx(ToggleVisibilityButton, { initialState: true, onClick: handleToggleVisibility }) }), showMatchMessage && (jsxs("div", { className: 'setup-password-confirm-view__match-indicator', children: [jsx(Icon, { color: passwordsMatch ? 'success-1' : 'text-error', size: 'medium', children: passwordsMatch ? (jsx(SvgCheckCircle, {})) : (jsx(SvgExclamationCircle, {})) }), jsx(Typography, { variant: 'body_small', color: passwordsMatch ? 'secondary' : 'error-1', children: matchMessage })] }))] })] }), jsx("div", { className: 'setup-password-confirm-view__actions', children: jsx(TypographyButton, { dataTestId: 'setup-password-confirm-continue-button', onClick: handleContinue, disabled: !isValid, copykey: 'dyn_setup_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
46
+ color: 'inherit',
47
+ }, expanded: true, children: t('dyn_setup_password.button.continue') }) })] })] }));
48
+ };
49
+
50
+ export { SetupPasswordConfirmView };
@@ -0,0 +1,2 @@
1
+ export { SetupPasswordConfirmView } from './SetupPasswordConfirmView';
2
+ export type { SetupPasswordConfirmViewProps } from './SetupPasswordConfirmView';
@@ -0,0 +1,15 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var Typography = require('../../../../components/Typography/Typography.cjs');
8
+ require('react');
9
+ var checkCircle = require('../../../../shared/assets/check-circle.cjs');
10
+ require('@dynamic-labs/iconic');
11
+ require('../../../../context/ViewContext/ViewContext.cjs');
12
+
13
+ const PasswordRequirement = ({ met, text, }) => (jsxRuntime.jsxs("div", { className: 'password-requirement', children: [met ? (jsxRuntime.jsx("div", { className: 'password-requirement__icon-wrapper', children: jsxRuntime.jsx(checkCircle.ReactComponent, {}) })) : (jsxRuntime.jsx("div", { className: 'password-requirement__circle' })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: met ? 'primary' : 'secondary', weight: 'regular', children: text })] }));
14
+
15
+ exports.PasswordRequirement = PasswordRequirement;
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ export type PasswordRequirementProps = {
3
+ met: boolean;
4
+ text: string;
5
+ };
6
+ export declare const PasswordRequirement: FC<PasswordRequirementProps>;
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { Typography } from '../../../../components/Typography/Typography.js';
4
+ import 'react';
5
+ import { ReactComponent as SvgCheckCircle } from '../../../../shared/assets/check-circle.js';
6
+ import '@dynamic-labs/iconic';
7
+ import '../../../../context/ViewContext/ViewContext.js';
8
+
9
+ const PasswordRequirement = ({ met, text, }) => (jsxs("div", { className: 'password-requirement', children: [met ? (jsx("div", { className: 'password-requirement__icon-wrapper', children: jsx(SvgCheckCircle, {}) })) : (jsx("div", { className: 'password-requirement__circle' })), jsx(Typography, { variant: 'body_small', color: met ? 'primary' : 'secondary', weight: 'regular', children: text })] }));
10
+
11
+ export { PasswordRequirement };
@@ -0,0 +1,57 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
8
+ var reactI18next = require('react-i18next');
9
+ var Icon = require('../../../../components/Icon/Icon.cjs');
10
+ var IconButton = require('../../../../components/IconButton/IconButton.cjs');
11
+ var Input = require('../../../../components/Input/Input.cjs');
12
+ var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
13
+ var ToggleVisibilityButton = require('../../../../components/ToggleVisibilityButton/ToggleVisibilityButton.cjs');
14
+ var Typography = require('../../../../components/Typography/Typography.cjs');
15
+ var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
16
+ var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
17
+ var passwordLockIcon = require('../../../../shared/assets/password-lock-icon.cjs');
18
+ require('@dynamic-labs/iconic');
19
+ require('../../../../context/ViewContext/ViewContext.cjs');
20
+ var PasswordRequirement = require('./PasswordRequirement.cjs');
21
+
22
+ const PASSWORD_MIN_LENGTH = 8;
23
+ const PASSWORD_MAX_LENGTH = 70;
24
+ const validatePassword = (password) => ({
25
+ length: password.length >= PASSWORD_MIN_LENGTH &&
26
+ password.length <= PASSWORD_MAX_LENGTH,
27
+ lowercase: /[a-z]/.test(password),
28
+ number: /\d/.test(password),
29
+ symbol: /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password),
30
+ uppercase: /[A-Z]/.test(password),
31
+ });
32
+ const SetupPasswordEnterView = ({ onContinue, onBack, }) => {
33
+ const { t } = reactI18next.useTranslation();
34
+ const [password, setPassword] = React.useState('');
35
+ const [showPassword, setShowPassword] = React.useState(false);
36
+ const requirements = validatePassword(password);
37
+ const allValid = Object.values(requirements).every(Boolean);
38
+ const handlePasswordChange = React.useCallback((e) => {
39
+ setPassword(e.target.value);
40
+ }, []);
41
+ const handleToggleVisibility = React.useCallback((hidden) => {
42
+ setShowPassword(!hidden);
43
+ }, []);
44
+ const handleContinue = React.useCallback(() => {
45
+ if (allValid) {
46
+ onContinue(password);
47
+ }
48
+ }, [allValid, onContinue, password]);
49
+ const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-enter-back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
50
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.enter.title', children: t('dyn_setup_password.enter.title') }) }), jsxRuntime.jsx("div", { className: 'setup-password-enter-view', children: jsxRuntime.jsxs("div", { className: 'setup-password-enter-view__body', children: [jsxRuntime.jsx("div", { className: 'setup-password-enter-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(passwordLockIcon.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(Typography.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') }), jsxRuntime.jsx(Input.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:
51
+ // eslint-disable-next-line react/jsx-wrap-multilines
52
+ jsxRuntime.jsx(ToggleVisibilityButton.ToggleVisibilityButton, { initialState: true, onClick: handleToggleVisibility }) }), jsxRuntime.jsxs("div", { className: 'setup-password-enter-view__requirements', children: [jsxRuntime.jsx(PasswordRequirement.PasswordRequirement, { met: requirements.length, text: t('dyn_setup_password.enter.requirement_length') }), jsxRuntime.jsx(PasswordRequirement.PasswordRequirement, { met: requirements.uppercase, text: t('dyn_setup_password.enter.requirement_uppercase') }), jsxRuntime.jsx(PasswordRequirement.PasswordRequirement, { met: requirements.lowercase, text: t('dyn_setup_password.enter.requirement_lowercase') }), jsxRuntime.jsx(PasswordRequirement.PasswordRequirement, { met: requirements.number, text: t('dyn_setup_password.enter.requirement_number') }), jsxRuntime.jsx(PasswordRequirement.PasswordRequirement, { met: requirements.symbol, text: t('dyn_setup_password.enter.requirement_symbol') })] }), jsxRuntime.jsx("div", { className: 'setup-password-enter-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-enter-continue-button', onClick: handleContinue, disabled: !allValid, copykey: 'dyn_setup_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
53
+ color: 'inherit',
54
+ }, expanded: true, children: t('dyn_setup_password.button.continue') }) })] }) })] }));
55
+ };
56
+
57
+ exports.SetupPasswordEnterView = SetupPasswordEnterView;
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ export type SetupPasswordEnterViewProps = {
3
+ onContinue: (password: string) => void;
4
+ onBack: () => void;
5
+ };
6
+ export declare const SetupPasswordEnterView: FC<SetupPasswordEnterViewProps>;
@@ -0,0 +1,53 @@
1
+ 'use client'
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { useState, useCallback } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Icon } from '../../../../components/Icon/Icon.js';
6
+ import { IconButton } from '../../../../components/IconButton/IconButton.js';
7
+ import { Input } from '../../../../components/Input/Input.js';
8
+ import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
9
+ import { ToggleVisibilityButton } from '../../../../components/ToggleVisibilityButton/ToggleVisibilityButton.js';
10
+ import { Typography } from '../../../../components/Typography/Typography.js';
11
+ import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
12
+ import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
13
+ import { ReactComponent as SvgPasswordLockIcon } from '../../../../shared/assets/password-lock-icon.js';
14
+ import '@dynamic-labs/iconic';
15
+ import '../../../../context/ViewContext/ViewContext.js';
16
+ import { PasswordRequirement } from './PasswordRequirement.js';
17
+
18
+ const PASSWORD_MIN_LENGTH = 8;
19
+ const PASSWORD_MAX_LENGTH = 70;
20
+ const validatePassword = (password) => ({
21
+ length: password.length >= PASSWORD_MIN_LENGTH &&
22
+ password.length <= PASSWORD_MAX_LENGTH,
23
+ lowercase: /[a-z]/.test(password),
24
+ number: /\d/.test(password),
25
+ symbol: /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password),
26
+ uppercase: /[A-Z]/.test(password),
27
+ });
28
+ const SetupPasswordEnterView = ({ onContinue, onBack, }) => {
29
+ const { t } = useTranslation();
30
+ const [password, setPassword] = useState('');
31
+ const [showPassword, setShowPassword] = useState(false);
32
+ const requirements = validatePassword(password);
33
+ const allValid = Object.values(requirements).every(Boolean);
34
+ const handlePasswordChange = useCallback((e) => {
35
+ setPassword(e.target.value);
36
+ }, []);
37
+ const handleToggleVisibility = useCallback((hidden) => {
38
+ setShowPassword(!hidden);
39
+ }, []);
40
+ const handleContinue = useCallback(() => {
41
+ if (allValid) {
42
+ onContinue(password);
43
+ }
44
+ }, [allValid, onContinue, password]);
45
+ 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') }) })] }) })] }));
51
+ };
52
+
53
+ export { SetupPasswordEnterView };
@@ -0,0 +1,4 @@
1
+ export { SetupPasswordEnterView } from './SetupPasswordEnterView';
2
+ export type { SetupPasswordEnterViewProps } from './SetupPasswordEnterView';
3
+ export { PasswordRequirement } from './PasswordRequirement';
4
+ export type { PasswordRequirementProps } from './PasswordRequirement';