@dynamic-labs/sdk-react-core 4.59.1 → 4.60.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.
- package/CHANGELOG.md +23 -0
- package/package.cjs +2 -1
- package/package.js +2 -1
- package/package.json +13 -12
- package/src/index.cjs +4 -2
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -1
- package/src/lib/components/FormFieldLabel/FormFieldLabel.cjs +5 -1
- package/src/lib/components/FormFieldLabel/FormFieldLabel.d.ts +2 -1
- package/src/lib/components/FormFieldLabel/FormFieldLabel.js +5 -1
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +4 -2
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +4 -2
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/events/embeddedWallet.d.ts +15 -3
- package/src/lib/shared/assets/index.d.ts +1 -1
- package/src/lib/shared/assets/setup-password-terms-illustration.cjs +83 -0
- package/src/lib/shared/assets/setup-password-terms-illustration.js +59 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/index.d.ts +4 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +48 -6
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +8 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +49 -7
- package/src/lib/utils/hooks/useGetPasswordForSigning/index.d.ts +2 -0
- package/src/lib/utils/hooks/useGetPasswordForSigning/useGetPasswordForSigning.cjs +16 -0
- package/src/lib/utils/hooks/useGetPasswordForSigning/useGetPasswordForSigning.d.ts +5 -0
- package/src/lib/utils/hooks/useGetPasswordForSigning/useGetPasswordForSigning.js +12 -0
- package/src/lib/utils/hooks/usePromptWalletUnlock/index.d.ts +2 -0
- package/src/lib/utils/hooks/usePromptWalletUnlock/usePromptWalletUnlock.cjs +144 -0
- package/src/lib/utils/hooks/usePromptWalletUnlock/usePromptWalletUnlock.d.ts +5 -0
- package/src/lib/utils/hooks/usePromptWalletUnlock/usePromptWalletUnlock.js +140 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +14 -14
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +14 -14
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.cjs +13 -100
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.js +13 -100
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +10 -3
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +10 -3
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +2 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +3 -2
- package/src/lib/utils/hooks/useWalletUnlock/index.d.ts +2 -0
- package/src/lib/utils/hooks/useWalletUnlock/useWalletUnlock.d.ts +15 -0
- package/src/lib/views/NoAccess/NoAccess.cjs +1 -1
- package/src/lib/views/NoAccess/NoAccess.js +1 -1
- package/src/lib/views/{SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.cjs → UnlockWalletView/UnlockWalletView.cjs} +18 -13
- package/src/lib/views/UnlockWalletView/UnlockWalletView.d.ts +6 -0
- package/src/lib/views/{SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.js → UnlockWalletView/UnlockWalletView.js} +18 -13
- package/src/lib/views/UnlockWalletView/index.d.ts +2 -0
- package/src/lib/views/index.d.ts +3 -3
- package/src/lib/views/viewToComponentMap.cjs +3 -3
- package/src/lib/views/viewToComponentMap.d.ts +1 -1
- package/src/lib/views/viewToComponentMap.js +3 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +43 -43
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +43 -43
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.cjs +33 -19
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js +33 -19
- package/src/lib/widgets/DynamicWidget/views/EnterPasswordView/EnterPasswordView.cjs +61 -0
- package/src/lib/widgets/DynamicWidget/views/EnterPasswordView/EnterPasswordView.d.ts +9 -0
- package/src/lib/widgets/DynamicWidget/views/EnterPasswordView/EnterPasswordView.js +57 -0
- package/src/lib/widgets/DynamicWidget/views/EnterPasswordView/index.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.cjs +2 -3
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.js +2 -3
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.cjs +13 -6
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.js +13 -6
- package/src/lib/widgets/DynamicWidget/views/index.d.ts +1 -0
- package/src/lib/shared/assets/warning-circle-orange.cjs +0 -57
- package/src/lib/shared/assets/warning-circle-orange.js +0 -33
- package/src/lib/views/SetupPasswordForWalletCreationView/SetupPasswordForWalletCreationView.d.ts +0 -2
- package/src/lib/views/SetupPasswordForWalletCreationView/index.d.ts +0 -1
|
@@ -20,7 +20,6 @@ import '../../../../context/ViewContext/ViewContext.js';
|
|
|
20
20
|
import { SetupPasswordConfirmView } from '../../views/SetupPasswordConfirmView/SetupPasswordConfirmView.js';
|
|
21
21
|
import { SetupPasswordKnowledgeCheckView } from '../../views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.js';
|
|
22
22
|
import { SetupPasswordSuccessView } from '../../views/SetupPasswordSuccessView/SetupPasswordSuccessView.js';
|
|
23
|
-
import { WalletsDelegatedSettingsView } from '../../views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.js';
|
|
24
23
|
import 'react-i18next';
|
|
25
24
|
import '@dynamic-labs/wallet-connector-core';
|
|
26
25
|
import '../../../../shared/logger.js';
|
|
@@ -29,11 +28,13 @@ import '../../../../utils/constants/colors.js';
|
|
|
29
28
|
import '../../../../utils/constants/values.js';
|
|
30
29
|
import '@dynamic-labs/sdk-api-core';
|
|
31
30
|
import '../../../../shared/consts/index.js';
|
|
32
|
-
import '../../../../components/
|
|
33
|
-
import '
|
|
31
|
+
import '../../../../components/Input/Input.js';
|
|
32
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
33
|
+
import '../../../../components/Alert/Alert.js';
|
|
34
|
+
import '../../../../events/dynamicEvents.js';
|
|
34
35
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
35
36
|
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
36
|
-
import '../../../../
|
|
37
|
+
import '../../../../store/state/authMode/authMode.js';
|
|
37
38
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
38
39
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
39
40
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -51,7 +52,6 @@ import '../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLa
|
|
|
51
52
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
52
53
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
53
54
|
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
54
|
-
import '../../../../store/state/authMode/authMode.js';
|
|
55
55
|
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
56
56
|
import 'react-dom';
|
|
57
57
|
import '../../../../utils/functions/compareChains/compareChains.js';
|
|
@@ -59,6 +59,11 @@ import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbe
|
|
|
59
59
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
60
60
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
61
61
|
import 'bs58';
|
|
62
|
+
import '@dynamic-labs/types';
|
|
63
|
+
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
64
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
65
|
+
import '../../../../context/WalletContext/WalletContext.js';
|
|
66
|
+
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
62
67
|
import 'yup';
|
|
63
68
|
import '../../../../context/MockContext/MockContext.js';
|
|
64
69
|
import '../../../../views/CollectUserDataView/useFields.js';
|
|
@@ -66,45 +71,16 @@ import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
|
66
71
|
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
67
72
|
import '@dynamic-labs/rpc-providers';
|
|
68
73
|
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
69
|
-
import '../../../../
|
|
70
|
-
import '../../../../components/Alert/Alert.js';
|
|
71
|
-
import '../../../../context/WalletContext/WalletContext.js';
|
|
74
|
+
import '../../../../context/FooterAnimationContext/index.js';
|
|
72
75
|
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
73
|
-
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
74
|
-
import '../../../../components/Input/Input.js';
|
|
75
|
-
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
76
|
-
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
77
|
-
import '../../../../components/OverlayCard/OverlayCard.js';
|
|
78
76
|
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
79
77
|
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
80
78
|
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
81
|
-
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
82
|
-
import '../../../../components/Popper/Popper/Popper.js';
|
|
83
|
-
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
84
|
-
import 'react-focus-lock';
|
|
85
|
-
import 'qrcode';
|
|
86
|
-
import 'formik';
|
|
87
|
-
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
88
|
-
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
89
|
-
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
90
|
-
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
91
|
-
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
92
|
-
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
93
|
-
import '@hcaptcha/react-hcaptcha';
|
|
94
|
-
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
95
|
-
import '../../context/DynamicWidgetContext.js';
|
|
96
|
-
import '../../helpers/convertExchangeKeyAndProviderEnum.js';
|
|
97
|
-
import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
98
|
-
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
99
|
-
import '../../../../context/FooterAnimationContext/index.js';
|
|
100
|
-
import '../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
101
|
-
import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
102
|
-
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
103
|
-
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
104
|
-
import '../../../../store/state/sendBalances.js';
|
|
105
|
-
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
106
79
|
import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
80
|
+
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
107
81
|
import '../DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
82
|
+
import 'react-focus-lock';
|
|
83
|
+
import '../../context/DynamicWidgetContext.js';
|
|
108
84
|
import { ChooseLinkedWalletView } from '../../views/ChooseLinkedWalletView/ChooseLinkedWalletView.js';
|
|
109
85
|
import { ChooseOnrampProviderView } from '../../views/ChooseOnrampProviderView/ChooseOnrampProviderView.js';
|
|
110
86
|
import { ChooseWalletFundingMethod } from '../../views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.js';
|
|
@@ -121,16 +97,40 @@ import { ManageTotpMfaWidgetView } from '../../views/ManageTotpMfaWidgetView/Man
|
|
|
121
97
|
import { ReceiveWalletFunds } from '../../views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
122
98
|
import { RevokeAccessView } from '../../views/SessionManagementView/RevokeAccessView/RevokeAccessView.js';
|
|
123
99
|
import { SessionManagementInfoView } from '../../views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.js';
|
|
124
|
-
import '../../../../
|
|
125
|
-
import '../../../../../index.js';
|
|
126
|
-
import '../../../../store/state/tokenBalances.js';
|
|
127
|
-
import '../../../../store/state/multichainBalances.js';
|
|
128
|
-
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
100
|
+
import '../../../../components/IconButton/IconButton.js';
|
|
129
101
|
import '../../../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
130
102
|
import '../../../../utils/hooks/useWalletBackup/types.js';
|
|
131
103
|
import { WaasBackupInfoView } from '../../views/WaasBackupView/WaasBackupInfoView.js';
|
|
132
104
|
import '../../../../utils/hooks/useWalletBackup/cloudProviders.js';
|
|
133
105
|
import { WaasBackupView } from '../../views/WaasBackupView/WaasBackupView.js';
|
|
106
|
+
import { WalletsDelegatedSettingsView } from '../../views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.js';
|
|
107
|
+
import 'formik';
|
|
108
|
+
import '../../../../store/state/sendBalances.js';
|
|
109
|
+
import '../../../../components/OverlayCard/OverlayCard.js';
|
|
110
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
111
|
+
import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
112
|
+
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
113
|
+
import '../../../../../index.js';
|
|
114
|
+
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
115
|
+
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
116
|
+
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
117
|
+
import '../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
118
|
+
import '@hcaptcha/react-hcaptcha';
|
|
119
|
+
import '../../helpers/convertExchangeKeyAndProviderEnum.js';
|
|
120
|
+
import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
121
|
+
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
122
|
+
import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
123
|
+
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
124
|
+
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
125
|
+
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
126
|
+
import '../../../../store/state/tokenBalances.js';
|
|
127
|
+
import '../../../../store/state/multichainBalances.js';
|
|
128
|
+
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
129
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
130
|
+
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
131
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
132
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
133
|
+
import 'qrcode';
|
|
134
134
|
|
|
135
135
|
const mapViewToComponent = {
|
|
136
136
|
'account-and-security-settings': AccountAndSecuritySettingsView,
|
package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.cjs
CHANGED
|
@@ -3,43 +3,43 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var _tslib = require('../../../../../../../_virtual/_tslib.cjs');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var React = require('react');
|
|
8
9
|
var reactI18next = require('react-i18next');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
require('../../../../../
|
|
12
|
-
require('
|
|
10
|
+
require('@dynamic-labs-sdk/client/core');
|
|
11
|
+
require('@dynamic-labs/sdk-api-core');
|
|
12
|
+
require('../../../../../client/client.cjs');
|
|
13
|
+
require('@dynamic-labs-sdk/client');
|
|
14
|
+
require('../../../../../config/ApiEndpoint.cjs');
|
|
13
15
|
require('@dynamic-labs/iconic');
|
|
14
16
|
require('@dynamic-labs/wallet-connector-core');
|
|
15
17
|
var chevronLeft = require('../../../../../shared/assets/chevron-left.cjs');
|
|
16
18
|
var faceId = require('../../../../../shared/assets/face-id.cjs');
|
|
17
19
|
var lock = require('../../../../../shared/assets/lock.cjs');
|
|
18
20
|
require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
19
|
-
require('../../../../../shared/logger.cjs');
|
|
21
|
+
var logger = require('../../../../../shared/logger.cjs');
|
|
20
22
|
require('@dynamic-labs/wallet-book');
|
|
21
23
|
require('@dynamic-labs/utils');
|
|
22
24
|
require('../../../../../utils/constants/colors.cjs');
|
|
23
25
|
require('../../../../../utils/constants/values.cjs');
|
|
24
|
-
require('@dynamic-labs/sdk-api-core');
|
|
25
26
|
require('../../../../../shared/consts/index.cjs');
|
|
26
|
-
require('../../../../../events/dynamicEvents.cjs');
|
|
27
|
-
require('../../../../../../../_virtual/_tslib.cjs');
|
|
28
|
-
require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
29
|
-
require('../../../../../context/ErrorContext/ErrorContext.cjs');
|
|
30
27
|
require('@dynamic-labs/multi-wallet');
|
|
31
28
|
require('react-international-phone');
|
|
32
29
|
require('../../../../../store/state/nonce/nonce.cjs');
|
|
33
|
-
require('@dynamic-labs-sdk/client/core');
|
|
34
|
-
require('../../../../../client/client.cjs');
|
|
35
|
-
require('@dynamic-labs-sdk/client');
|
|
36
|
-
require('../../../../../config/ApiEndpoint.cjs');
|
|
37
|
-
var useProjectSettings = require('../../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
|
|
38
30
|
require('@dynamic-labs/locale');
|
|
39
31
|
require('../../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
40
32
|
require('../../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
41
33
|
require('../../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
42
34
|
require('../../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
35
|
+
require('../../../../../events/dynamicEvents.cjs');
|
|
36
|
+
var useProjectSettings = require('../../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
|
|
37
|
+
var Typography = require('../../../../../components/Typography/Typography.cjs');
|
|
38
|
+
var TypographyButton = require('../../../../../components/TypographyButton/TypographyButton.cjs');
|
|
39
|
+
require('../../../../../context/DynamicContext/DynamicContext.cjs');
|
|
40
|
+
require('../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
41
|
+
require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
42
|
+
require('../../../../../context/ErrorContext/ErrorContext.cjs');
|
|
43
43
|
require('../../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
44
44
|
require('../../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
45
45
|
require('../../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
@@ -135,11 +135,25 @@ const MfaSection = ({ isLoading }) => {
|
|
|
135
135
|
const handlePasskeyMfaClick = React.useCallback(() => setDynamicWidgetView('manage-passkeys-mfa'), [setDynamicWidgetView]);
|
|
136
136
|
const handlePasscodeClick = React.useCallback(() => {
|
|
137
137
|
setDynamicWidgetView('setup-password', {
|
|
138
|
-
onComplete: () => {
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
onComplete: (password) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
139
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address)) {
|
|
140
|
+
logger.logger.error('No wallet address available for password setup');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
const connector = wallet.connector;
|
|
145
|
+
yield connector.updatePassword({
|
|
146
|
+
accountAddress: wallet.address,
|
|
147
|
+
existingPassword: '',
|
|
148
|
+
newPassword: password,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
logger.logger.error('Failed to update password on modal', error);
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
141
155
|
});
|
|
142
|
-
}, [setDynamicWidgetView]);
|
|
156
|
+
}, [setDynamicWidgetView, wallet]);
|
|
143
157
|
if (!isMfaEnabled && !isWaasWallet) {
|
|
144
158
|
return null;
|
|
145
159
|
}
|
package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
|
|
2
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
4
|
import { useCallback } from 'react';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import '../../../../../
|
|
8
|
-
import '
|
|
6
|
+
import '@dynamic-labs-sdk/client/core';
|
|
7
|
+
import '@dynamic-labs/sdk-api-core';
|
|
8
|
+
import '../../../../../client/client.js';
|
|
9
|
+
import '@dynamic-labs-sdk/client';
|
|
10
|
+
import '../../../../../config/ApiEndpoint.js';
|
|
9
11
|
import '@dynamic-labs/iconic';
|
|
10
12
|
import '@dynamic-labs/wallet-connector-core';
|
|
11
13
|
import { ReactComponent as SvgChevronLeft } from '../../../../../shared/assets/chevron-left.js';
|
|
12
14
|
import { ReactComponent as SvgFaceId } from '../../../../../shared/assets/face-id.js';
|
|
13
15
|
import { ReactComponent as SvgLock } from '../../../../../shared/assets/lock.js';
|
|
14
16
|
import '../../../../../context/ViewContext/ViewContext.js';
|
|
15
|
-
import '../../../../../shared/logger.js';
|
|
17
|
+
import { logger } from '../../../../../shared/logger.js';
|
|
16
18
|
import '@dynamic-labs/wallet-book';
|
|
17
19
|
import '@dynamic-labs/utils';
|
|
18
20
|
import '../../../../../utils/constants/colors.js';
|
|
19
21
|
import '../../../../../utils/constants/values.js';
|
|
20
|
-
import '@dynamic-labs/sdk-api-core';
|
|
21
22
|
import '../../../../../shared/consts/index.js';
|
|
22
|
-
import '../../../../../events/dynamicEvents.js';
|
|
23
|
-
import '../../../../../../../_virtual/_tslib.js';
|
|
24
|
-
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
25
|
-
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
26
23
|
import '@dynamic-labs/multi-wallet';
|
|
27
24
|
import 'react-international-phone';
|
|
28
25
|
import '../../../../../store/state/nonce/nonce.js';
|
|
29
|
-
import '@dynamic-labs-sdk/client/core';
|
|
30
|
-
import '../../../../../client/client.js';
|
|
31
|
-
import '@dynamic-labs-sdk/client';
|
|
32
|
-
import '../../../../../config/ApiEndpoint.js';
|
|
33
|
-
import { useProjectSettings } from '../../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
34
26
|
import '@dynamic-labs/locale';
|
|
35
27
|
import '../../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
36
28
|
import '../../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
37
29
|
import '../../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
38
30
|
import '../../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
31
|
+
import '../../../../../events/dynamicEvents.js';
|
|
32
|
+
import { useProjectSettings } from '../../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
33
|
+
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
34
|
+
import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
|
|
35
|
+
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
36
|
+
import '../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
37
|
+
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
38
|
+
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
39
39
|
import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
40
40
|
import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
41
41
|
import '../../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
@@ -131,11 +131,25 @@ const MfaSection = ({ isLoading }) => {
|
|
|
131
131
|
const handlePasskeyMfaClick = useCallback(() => setDynamicWidgetView('manage-passkeys-mfa'), [setDynamicWidgetView]);
|
|
132
132
|
const handlePasscodeClick = useCallback(() => {
|
|
133
133
|
setDynamicWidgetView('setup-password', {
|
|
134
|
-
onComplete: () => {
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
onComplete: (password) => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address)) {
|
|
136
|
+
logger.error('No wallet address available for password setup');
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const connector = wallet.connector;
|
|
141
|
+
yield connector.updatePassword({
|
|
142
|
+
accountAddress: wallet.address,
|
|
143
|
+
existingPassword: '',
|
|
144
|
+
newPassword: password,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
logger.error('Failed to update password on modal', error);
|
|
149
|
+
}
|
|
150
|
+
}),
|
|
137
151
|
});
|
|
138
|
-
}, [setDynamicWidgetView]);
|
|
152
|
+
}, [setDynamicWidgetView, wallet]);
|
|
139
153
|
if (!isMfaEnabled && !isWaasWallet) {
|
|
140
154
|
return null;
|
|
141
155
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
var reactI18next = require('react-i18next');
|
|
10
|
+
var ErrorContainer = require('../../../../components/ErrorContainer/ErrorContainer.cjs');
|
|
11
|
+
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
12
|
+
var Input = require('../../../../components/Input/Input.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 passwordLockIcon = require('../../../../shared/assets/password-lock-icon.cjs');
|
|
17
|
+
require('@dynamic-labs/iconic');
|
|
18
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
19
|
+
|
|
20
|
+
const EnterPasswordView = ({ onContinue, title, description, buttonLabel, isLoading: externalLoading, }) => {
|
|
21
|
+
const { t } = reactI18next.useTranslation();
|
|
22
|
+
const [password, setPassword] = React.useState('');
|
|
23
|
+
const [showPassword, setShowPassword] = React.useState(false);
|
|
24
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
25
|
+
const [error, setError] = React.useState(null);
|
|
26
|
+
const handlePasswordChange = React.useCallback((e) => {
|
|
27
|
+
setPassword(e.target.value);
|
|
28
|
+
setError(null);
|
|
29
|
+
}, []);
|
|
30
|
+
const handleToggleVisibility = React.useCallback((hidden) => {
|
|
31
|
+
setShowPassword(!hidden);
|
|
32
|
+
}, []);
|
|
33
|
+
const handleContinue = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
if (!password) {
|
|
35
|
+
setError(t('dyn_enter_password.error.required'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
setIsLoading(true);
|
|
39
|
+
setError(null);
|
|
40
|
+
try {
|
|
41
|
+
yield onContinue(password);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
const errorMessage = err instanceof Error
|
|
45
|
+
? err.message
|
|
46
|
+
: t('dyn_enter_password.error.failed');
|
|
47
|
+
setError(errorMessage);
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
setIsLoading(false);
|
|
51
|
+
}
|
|
52
|
+
}), [password, onContinue, t]);
|
|
53
|
+
const loading = externalLoading || isLoading;
|
|
54
|
+
return (jsxRuntime.jsx("div", { className: 'enter-password-view', children: jsxRuntime.jsxs("div", { className: 'enter-password-view__body', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_enter_password.title', className: 'enter-password-view__title', style: { marginBottom: '24px', textAlign: 'center' }, children: title !== null && title !== void 0 ? title : t('dyn_enter_password.title') }), jsxRuntime.jsx("div", { className: 'enter-password-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: 'secondary', copykey: 'dyn_enter_password.description', className: 'enter-password-view__description', children: description !== null && description !== void 0 ? description : t('dyn_enter_password.description') }), error && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'enter-password-view__error', variant: 'error', withIcon: false, children: error })), jsxRuntime.jsx(Input.Input, { id: 'enter-password-input', type: showPassword ? 'text' : 'password', label: t('dyn_enter_password.label'), placeholder: t('dyn_enter_password.placeholder'), value: password, onChange: handlePasswordChange, variant: 'regular', suffix:
|
|
55
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
56
|
+
jsxRuntime.jsx(ToggleVisibilityButton.ToggleVisibilityButton, { initialState: true, onClick: handleToggleVisibility }) }), jsxRuntime.jsx("div", { className: 'enter-password-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'enter-password-continue-button', onClick: handleContinue, disabled: !password || loading, copykey: 'dyn_enter_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
|
|
57
|
+
color: 'inherit',
|
|
58
|
+
}, expanded: true, children: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : t('dyn_enter_password.button.continue') }) })] }) }));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.EnterPasswordView = EnterPasswordView;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export type EnterPasswordViewProps = {
|
|
3
|
+
onContinue: (password: string) => Promise<void>;
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
buttonLabel?: string;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const EnterPasswordView: FC<EnterPasswordViewProps>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useCallback } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.js';
|
|
7
|
+
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
8
|
+
import { Input } from '../../../../components/Input/Input.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 SvgPasswordLockIcon } from '../../../../shared/assets/password-lock-icon.js';
|
|
13
|
+
import '@dynamic-labs/iconic';
|
|
14
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
15
|
+
|
|
16
|
+
const EnterPasswordView = ({ onContinue, title, description, buttonLabel, isLoading: externalLoading, }) => {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const [password, setPassword] = useState('');
|
|
19
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
20
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
21
|
+
const [error, setError] = useState(null);
|
|
22
|
+
const handlePasswordChange = useCallback((e) => {
|
|
23
|
+
setPassword(e.target.value);
|
|
24
|
+
setError(null);
|
|
25
|
+
}, []);
|
|
26
|
+
const handleToggleVisibility = useCallback((hidden) => {
|
|
27
|
+
setShowPassword(!hidden);
|
|
28
|
+
}, []);
|
|
29
|
+
const handleContinue = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
if (!password) {
|
|
31
|
+
setError(t('dyn_enter_password.error.required'));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
setIsLoading(true);
|
|
35
|
+
setError(null);
|
|
36
|
+
try {
|
|
37
|
+
yield onContinue(password);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
const errorMessage = err instanceof Error
|
|
41
|
+
? err.message
|
|
42
|
+
: t('dyn_enter_password.error.failed');
|
|
43
|
+
setError(errorMessage);
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
setIsLoading(false);
|
|
47
|
+
}
|
|
48
|
+
}), [password, onContinue, t]);
|
|
49
|
+
const loading = externalLoading || isLoading;
|
|
50
|
+
return (jsx("div", { className: 'enter-password-view', children: jsxs("div", { className: 'enter-password-view__body', children: [jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_enter_password.title', className: 'enter-password-view__title', style: { marginBottom: '24px', textAlign: 'center' }, children: title !== null && title !== void 0 ? title : t('dyn_enter_password.title') }), jsx("div", { className: 'enter-password-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgPasswordLockIcon, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_enter_password.description', className: 'enter-password-view__description', children: description !== null && description !== void 0 ? description : t('dyn_enter_password.description') }), error && (jsx(ErrorContainer, { className: 'enter-password-view__error', variant: 'error', withIcon: false, children: error })), jsx(Input, { id: 'enter-password-input', type: showPassword ? 'text' : 'password', label: t('dyn_enter_password.label'), placeholder: t('dyn_enter_password.placeholder'), value: password, onChange: handlePasswordChange, variant: 'regular', suffix:
|
|
51
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
52
|
+
jsx(ToggleVisibilityButton, { initialState: true, onClick: handleToggleVisibility }) }), jsx("div", { className: 'enter-password-view__actions', children: jsx(TypographyButton, { dataTestId: 'enter-password-continue-button', onClick: handleContinue, disabled: !password || loading, copykey: 'dyn_enter_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
|
|
53
|
+
color: 'inherit',
|
|
54
|
+
}, expanded: true, children: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : t('dyn_enter_password.button.continue') }) })] }) }));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { EnterPasswordView };
|
package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.cjs
CHANGED
|
@@ -7,15 +7,14 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
9
|
var Checkbox = require('../../../../components/Checkbox/Checkbox.cjs');
|
|
10
|
-
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
11
10
|
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
12
11
|
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
13
12
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
14
13
|
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
15
14
|
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
15
|
+
var setupPasswordTermsIllustration = require('../../../../shared/assets/setup-password-terms-illustration.cjs');
|
|
16
16
|
require('@dynamic-labs/iconic');
|
|
17
17
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
-
var warningCircleOrange = require('../../../../shared/assets/warning-circle-orange.cjs');
|
|
19
18
|
|
|
20
19
|
const SetupPasswordTermsView = ({ onContinue, onBack, }) => {
|
|
21
20
|
const { t } = reactI18next.useTranslation();
|
|
@@ -29,7 +28,7 @@ const SetupPasswordTermsView = ({ onContinue, onBack, }) => {
|
|
|
29
28
|
}, []);
|
|
30
29
|
const allChecked = Object.values(checkedItems).every(Boolean);
|
|
31
30
|
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-terms-back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
32
|
-
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.terms.title', children: t('dyn_setup_password.terms.title') }) }), jsxRuntime.jsx("div", { className: 'setup-password-terms-view', children: jsxRuntime.jsxs("div", { className: 'setup-password-terms-view__body', children: [jsxRuntime.jsx("div", { className: 'setup-password-terms-view__icon-container', children: jsxRuntime.jsx(
|
|
31
|
+
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.terms.title', children: t('dyn_setup_password.terms.title') }) }), jsxRuntime.jsx("div", { className: 'setup-password-terms-view', children: jsxRuntime.jsxs("div", { className: 'setup-password-terms-view__body', children: [jsxRuntime.jsx("div", { className: 'setup-password-terms-view__icon-container', children: jsxRuntime.jsx(setupPasswordTermsIllustration.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.terms.description', className: 'setup-password-terms-view__description', children: t('dyn_setup_password.terms.description') }), jsxRuntime.jsxs("div", { className: 'setup-password-terms-view__checkboxes', children: [jsxRuntime.jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsxRuntime.jsx(Checkbox.Checkbox, { checked: checkedItems.term1, onChange: () => handleCheckboxChange('term1'), ariaLabel: t('dyn_setup_password.terms.checkbox_1') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_1', children: t('dyn_setup_password.terms.checkbox_1') })] }), jsxRuntime.jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsxRuntime.jsx(Checkbox.Checkbox, { checked: checkedItems.term2, onChange: () => handleCheckboxChange('term2'), ariaLabel: t('dyn_setup_password.terms.checkbox_2') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_2', children: t('dyn_setup_password.terms.checkbox_2') })] }), jsxRuntime.jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsxRuntime.jsx(Checkbox.Checkbox, { checked: checkedItems.term3, onChange: () => handleCheckboxChange('term3'), ariaLabel: t('dyn_setup_password.terms.checkbox_3') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_3', children: t('dyn_setup_password.terms.checkbox_3') })] })] }), jsxRuntime.jsx("div", { className: 'setup-password-terms-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-terms-continue-button', onClick: onContinue, disabled: !allChecked, copykey: 'dyn_setup_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
|
|
33
32
|
color: 'inherit',
|
|
34
33
|
}, expanded: true, children: t('dyn_setup_password.button.continue') }) })] }) })] }));
|
|
35
34
|
};
|
package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.js
CHANGED
|
@@ -3,15 +3,14 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState, useCallback } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Checkbox } from '../../../../components/Checkbox/Checkbox.js';
|
|
6
|
-
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
7
6
|
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
8
7
|
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
9
8
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
10
9
|
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
11
10
|
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
11
|
+
import { ReactComponent as SvgSetupPasswordTermsIllustration } from '../../../../shared/assets/setup-password-terms-illustration.js';
|
|
12
12
|
import '@dynamic-labs/iconic';
|
|
13
13
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
14
|
-
import { ReactComponent as SvgWarningCircleOrange } from '../../../../shared/assets/warning-circle-orange.js';
|
|
15
14
|
|
|
16
15
|
const SetupPasswordTermsView = ({ onContinue, onBack, }) => {
|
|
17
16
|
const { t } = useTranslation();
|
|
@@ -25,7 +24,7 @@ const SetupPasswordTermsView = ({ onContinue, onBack, }) => {
|
|
|
25
24
|
}, []);
|
|
26
25
|
const allChecked = Object.values(checkedItems).every(Boolean);
|
|
27
26
|
const backButton = (jsx(IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-terms-back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
28
|
-
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.terms.title', children: t('dyn_setup_password.terms.title') }) }), jsx("div", { className: 'setup-password-terms-view', children: jsxs("div", { className: 'setup-password-terms-view__body', children: [jsx("div", { className: 'setup-password-terms-view__icon-container', children: jsx(
|
|
27
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.terms.title', children: t('dyn_setup_password.terms.title') }) }), jsx("div", { className: 'setup-password-terms-view', children: jsxs("div", { className: 'setup-password-terms-view__body', children: [jsx("div", { className: 'setup-password-terms-view__icon-container', children: jsx(SvgSetupPasswordTermsIllustration, {}) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.terms.description', className: 'setup-password-terms-view__description', children: t('dyn_setup_password.terms.description') }), jsxs("div", { className: 'setup-password-terms-view__checkboxes', children: [jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsx(Checkbox, { checked: checkedItems.term1, onChange: () => handleCheckboxChange('term1'), ariaLabel: t('dyn_setup_password.terms.checkbox_1') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_1', children: t('dyn_setup_password.terms.checkbox_1') })] }), jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsx(Checkbox, { checked: checkedItems.term2, onChange: () => handleCheckboxChange('term2'), ariaLabel: t('dyn_setup_password.terms.checkbox_2') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_2', children: t('dyn_setup_password.terms.checkbox_2') })] }), jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsx(Checkbox, { checked: checkedItems.term3, onChange: () => handleCheckboxChange('term3'), ariaLabel: t('dyn_setup_password.terms.checkbox_3') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_3', children: t('dyn_setup_password.terms.checkbox_3') })] })] }), jsx("div", { className: 'setup-password-terms-view__actions', children: jsx(TypographyButton, { dataTestId: 'setup-password-terms-continue-button', onClick: onContinue, disabled: !allChecked, copykey: 'dyn_setup_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
|
|
29
28
|
color: 'inherit',
|
|
30
29
|
}, expanded: true, children: t('dyn_setup_password.button.continue') }) })] }) })] }));
|
|
31
30
|
};
|
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
9
|
-
var
|
|
9
|
+
var SetupPasswordConfirmView = require('../SetupPasswordConfirmView/SetupPasswordConfirmView.cjs');
|
|
10
10
|
var SetupPasswordEnterView = require('../SetupPasswordEnterView/SetupPasswordEnterView.cjs');
|
|
11
11
|
require('../../../../../../_virtual/_tslib.cjs');
|
|
12
12
|
require('@dynamic-labs/utils');
|
|
13
13
|
require('@dynamic-labs/iconic');
|
|
14
14
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
-
var SetupPasswordConfirmView = require('../SetupPasswordConfirmView/SetupPasswordConfirmView.cjs');
|
|
16
15
|
var SetupPasswordKnowledgeCheckView = require('../SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.cjs');
|
|
17
16
|
var SetupPasswordSuccessView = require('../SetupPasswordSuccessView/SetupPasswordSuccessView.cjs');
|
|
17
|
+
var SetupPasswordTermsView = require('../SetupPasswordTermsView/SetupPasswordTermsView.cjs');
|
|
18
18
|
|
|
19
19
|
const SetupPasswordView = ({ onComplete, onCancel, skipKnowledgeCheck = false, }) => {
|
|
20
20
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
@@ -61,14 +61,21 @@ const SetupPasswordView = ({ onComplete, onCancel, skipKnowledgeCheck = false, }
|
|
|
61
61
|
const handleKnowledgeCheckReviewTerms = React.useCallback(() => {
|
|
62
62
|
setCurrentStep('terms');
|
|
63
63
|
}, []);
|
|
64
|
+
const goToWallets = React.useCallback(() => {
|
|
65
|
+
setDynamicWidgetView('wallets');
|
|
66
|
+
}, [setDynamicWidgetView]);
|
|
64
67
|
const handleSuccess = React.useCallback(() => {
|
|
65
68
|
onComplete(password);
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
+
// Navigate to appropriate view based on where we came from:
|
|
70
|
+
// - If onCancel was provided (auto-create flow), go to wallets view
|
|
71
|
+
// - If onCancel wasn't provided (settings flow), go to account settings
|
|
72
|
+
if (onCancel) {
|
|
73
|
+
goToWallets();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
69
76
|
goToAccountAndSecurity();
|
|
70
77
|
}
|
|
71
|
-
}, [onComplete, password, onCancel, goToAccountAndSecurity]);
|
|
78
|
+
}, [onComplete, password, onCancel, goToAccountAndSecurity, goToWallets]);
|
|
72
79
|
switch (currentStep) {
|
|
73
80
|
case 'terms':
|
|
74
81
|
return (jsxRuntime.jsx(SetupPasswordTermsView.SetupPasswordTermsView, { onContinue: handleTermsContinue, onBack: handleCancel }));
|