@dynamic-labs/sdk-react-core 4.60.0 → 4.60.1
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 +15 -0
- package/package.cjs +4 -4
- package/package.js +4 -4
- package/package.json +15 -15
- package/src/index.cjs +4 -4
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -2
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +2 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +2 -1
- package/src/lib/shared/assets/error-circle-x.cjs +54 -0
- package/src/lib/shared/assets/error-circle-x.js +30 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/types/dynamicHandlers.d.ts +64 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.cjs +1 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.js +2 -1
- 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 +1 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +14 -13
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +3 -7
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +14 -13
- package/src/lib/utils/hooks/useGetWalletPassword/index.d.ts +2 -0
- package/src/lib/utils/hooks/useGetWalletPassword/useGetWalletPassword.cjs +130 -0
- package/src/lib/utils/hooks/useGetWalletPassword/useGetWalletPassword.d.ts +6 -0
- package/src/lib/utils/hooks/useGetWalletPassword/useGetWalletPassword.js +126 -0
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +1 -1
- package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +1 -1
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.cjs +87 -0
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.d.ts +3 -0
- package/src/lib/utils/hooks/useSetupPassword/useSetupPassword.js +88 -1
- package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.cjs +1 -1
- package/src/lib/utils/hooks/useSmartWallets/useSmartWallets.js +1 -1
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +1 -1
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +1 -1
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.cjs +1 -1
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.js +1 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +1 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +1 -1
- package/src/lib/views/UnlockWalletView/UnlockWalletView.cjs +32 -1
- package/src/lib/views/UnlockWalletView/UnlockWalletView.js +32 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/EnterPasswordView/EnterPasswordView.cjs +15 -5
- package/src/lib/widgets/DynamicWidget/views/EnterPasswordView/EnterPasswordView.js +15 -5
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.cjs +7 -15
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.d.ts +0 -1
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.js +7 -15
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.cjs +9 -2
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.js +9 -2
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.cjs +2 -5
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.js +2 -5
- package/src/lib/utils/hooks/useGetPasswordForSigning/index.d.ts +0 -2
- package/src/lib/utils/hooks/useGetPasswordForSigning/useGetPasswordForSigning.cjs +0 -16
- package/src/lib/utils/hooks/useGetPasswordForSigning/useGetPasswordForSigning.d.ts +0 -5
- package/src/lib/utils/hooks/useGetPasswordForSigning/useGetPasswordForSigning.js +0 -12
|
@@ -5,6 +5,9 @@ export declare const PASSWORD_SETUP_CANCELLED_ERROR = "Password setup cancelled"
|
|
|
5
5
|
* This hook checks if passcodeRequired is enabled in project settings,
|
|
6
6
|
* and if so, prompts the user to set up a password before creating wallets.
|
|
7
7
|
*
|
|
8
|
+
* If a custom setupWalletPassword handler is provided via DynamicContextProvider settings,
|
|
9
|
+
* it will be used instead of the default UI modal.
|
|
10
|
+
*
|
|
8
11
|
* @returns An object containing:
|
|
9
12
|
* - isPasscodeRequired: boolean indicating if password is required
|
|
10
13
|
* - setupPassword: function that shows the password setup flow and returns the password
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { useCallback } from 'react';
|
|
3
|
+
import { useRef, useCallback } from 'react';
|
|
4
4
|
import '@dynamic-labs-sdk/client/core';
|
|
5
5
|
import '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import '../../../client/client.js';
|
|
@@ -26,7 +26,82 @@ import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
|
26
26
|
import '../../functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
27
27
|
import '../../../events/dynamicEvents.js';
|
|
28
28
|
import { useProjectSettings } from '../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.js';
|
|
29
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
30
|
+
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
31
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
32
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
33
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
34
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
35
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
36
|
+
import '../../../store/state/authMode/authMode.js';
|
|
37
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
38
|
+
import 'react-dom';
|
|
39
|
+
import '../../functions/compareChains/compareChains.js';
|
|
40
|
+
import '../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
41
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
42
|
+
import '../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
43
|
+
import 'bs58';
|
|
44
|
+
import '@dynamic-labs/types';
|
|
45
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
46
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
47
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
48
|
+
import '../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
49
|
+
import 'yup';
|
|
50
|
+
import '../../../context/MockContext/MockContext.js';
|
|
51
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
52
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
53
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
54
|
+
import '@dynamic-labs/rpc-providers';
|
|
55
|
+
import '../../../store/state/walletOptions/walletOptions.js';
|
|
56
|
+
import 'react-i18next';
|
|
57
|
+
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
58
|
+
import '../../../components/Alert/Alert.js';
|
|
59
|
+
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
60
|
+
import '../../../components/IconButton/IconButton.js';
|
|
61
|
+
import '../../../components/InlineWidget/InlineWidget.js';
|
|
62
|
+
import '../../../components/Input/Input.js';
|
|
63
|
+
import '../../../components/IsBrowser/IsBrowser.js';
|
|
64
|
+
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
65
|
+
import '../../../components/OverlayCard/OverlayCard.js';
|
|
66
|
+
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
67
|
+
import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
68
|
+
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
69
|
+
import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
70
|
+
import '../../../components/Popper/Popper/Popper.js';
|
|
71
|
+
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
72
|
+
import 'react-focus-lock';
|
|
73
|
+
import 'qrcode';
|
|
74
|
+
import 'formik';
|
|
75
|
+
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
76
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
77
|
+
import '../useWalletBackup/useWalletBackup.js';
|
|
78
|
+
import '../useWalletBackup/types.js';
|
|
79
|
+
import '../useWalletBackup/cloudProviders.js';
|
|
80
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
81
|
+
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
82
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
83
|
+
import '@hcaptcha/react-hcaptcha';
|
|
29
84
|
import { useWidgetContext } from '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
85
|
+
import '../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
86
|
+
import '../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
87
|
+
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
88
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
89
|
+
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
90
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
91
|
+
import '../../../context/OnrampContext/OnrampContext.js';
|
|
92
|
+
import '../../../store/state/sendBalances.js';
|
|
93
|
+
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
94
|
+
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
95
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
96
|
+
import '../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
97
|
+
import '../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
98
|
+
import '../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
|
|
99
|
+
import '../../../../index.js';
|
|
100
|
+
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
101
|
+
import '../../../store/state/tokenBalances.js';
|
|
102
|
+
import '../../../store/state/multichainBalances.js';
|
|
103
|
+
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
104
|
+
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
30
105
|
|
|
31
106
|
const PASSWORD_SETUP_CANCELLED_ERROR = 'Password setup cancelled';
|
|
32
107
|
/**
|
|
@@ -35,6 +110,9 @@ const PASSWORD_SETUP_CANCELLED_ERROR = 'Password setup cancelled';
|
|
|
35
110
|
* This hook checks if passcodeRequired is enabled in project settings,
|
|
36
111
|
* and if so, prompts the user to set up a password before creating wallets.
|
|
37
112
|
*
|
|
113
|
+
* If a custom setupWalletPassword handler is provided via DynamicContextProvider settings,
|
|
114
|
+
* it will be used instead of the default UI modal.
|
|
115
|
+
*
|
|
38
116
|
* @returns An object containing:
|
|
39
117
|
* - isPasscodeRequired: boolean indicating if password is required
|
|
40
118
|
* - setupPassword: function that shows the password setup flow and returns the password
|
|
@@ -43,11 +121,20 @@ const useSetupPassword = () => {
|
|
|
43
121
|
var _a, _b;
|
|
44
122
|
const projectSettings = useProjectSettings();
|
|
45
123
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
124
|
+
const { handlers } = useInternalDynamicContext();
|
|
125
|
+
// Use ref pattern to avoid callback recreation when handlers change
|
|
126
|
+
const setupWalletPasswordHandlerRef = useRef(handlers === null || handlers === void 0 ? void 0 : handlers.setupWalletPassword);
|
|
127
|
+
setupWalletPasswordHandlerRef.current = handlers === null || handlers === void 0 ? void 0 : handlers.setupWalletPassword;
|
|
46
128
|
const isPasscodeRequired = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.waas) === null || _a === void 0 ? void 0 : _a.passcodeRequired) !== null && _b !== void 0 ? _b : false;
|
|
47
129
|
const setupPassword = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
130
|
if (!isPasscodeRequired) {
|
|
49
131
|
return undefined;
|
|
50
132
|
}
|
|
133
|
+
// If custom handler provided, use it
|
|
134
|
+
if (setupWalletPasswordHandlerRef.current) {
|
|
135
|
+
return setupWalletPasswordHandlerRef.current();
|
|
136
|
+
}
|
|
137
|
+
// Otherwise use default UI prompt
|
|
51
138
|
return new Promise((resolve, reject) => {
|
|
52
139
|
setDynamicWidgetView('setup-password', {
|
|
53
140
|
onCancel: () => {
|
|
@@ -77,6 +77,7 @@ require('qrcode');
|
|
|
77
77
|
require('formik');
|
|
78
78
|
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
79
79
|
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
80
|
+
require('../../functions/compareChains/compareChains.cjs');
|
|
80
81
|
require('../useWalletBackup/useWalletBackup.cjs');
|
|
81
82
|
require('../useWalletBackup/types.cjs');
|
|
82
83
|
require('../useWalletBackup/cloudProviders.cjs');
|
|
@@ -92,7 +93,6 @@ require('../../../context/FooterAnimationContext/index.cjs');
|
|
|
92
93
|
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
93
94
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
94
95
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
95
|
-
require('../../functions/compareChains/compareChains.cjs');
|
|
96
96
|
require('../../../store/state/sendBalances.cjs');
|
|
97
97
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
98
98
|
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -73,6 +73,7 @@ import 'qrcode';
|
|
|
73
73
|
import 'formik';
|
|
74
74
|
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
75
75
|
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
76
|
+
import '../../functions/compareChains/compareChains.js';
|
|
76
77
|
import '../useWalletBackup/useWalletBackup.js';
|
|
77
78
|
import '../useWalletBackup/types.js';
|
|
78
79
|
import '../useWalletBackup/cloudProviders.js';
|
|
@@ -88,7 +89,6 @@ import '../../../context/FooterAnimationContext/index.js';
|
|
|
88
89
|
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
89
90
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
90
91
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
91
|
-
import '../../functions/compareChains/compareChains.js';
|
|
92
92
|
import '../../../store/state/sendBalances.js';
|
|
93
93
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
94
94
|
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -81,6 +81,7 @@ require('qrcode');
|
|
|
81
81
|
require('formik');
|
|
82
82
|
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
83
83
|
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
84
|
+
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
84
85
|
require('../useWalletBackup/useWalletBackup.cjs');
|
|
85
86
|
require('../useWalletBackup/types.cjs');
|
|
86
87
|
require('../useWalletBackup/cloudProviders.cjs');
|
|
@@ -97,7 +98,6 @@ require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cj
|
|
|
97
98
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
98
99
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
99
100
|
var useWalletDelegation = require('../useWalletDelegation/useWalletDelegation.cjs');
|
|
100
|
-
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
101
101
|
require('../../../store/state/sendBalances.cjs');
|
|
102
102
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
103
103
|
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -77,6 +77,7 @@ import 'qrcode';
|
|
|
77
77
|
import 'formik';
|
|
78
78
|
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
79
79
|
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
80
|
+
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
80
81
|
import '../useWalletBackup/useWalletBackup.js';
|
|
81
82
|
import '../useWalletBackup/types.js';
|
|
82
83
|
import '../useWalletBackup/cloudProviders.js';
|
|
@@ -93,7 +94,6 @@ import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js'
|
|
|
93
94
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
94
95
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
95
96
|
import { useWalletDelegation } from '../useWalletDelegation/useWalletDelegation.js';
|
|
96
|
-
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
97
97
|
import '../../../store/state/sendBalances.js';
|
|
98
98
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
99
99
|
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -77,6 +77,7 @@ require('qrcode');
|
|
|
77
77
|
require('formik');
|
|
78
78
|
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
79
79
|
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
80
|
+
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
80
81
|
var types = require('./types.cjs');
|
|
81
82
|
var cloudProviders = require('./cloudProviders.cjs');
|
|
82
83
|
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
@@ -96,7 +97,6 @@ require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cj
|
|
|
96
97
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
97
98
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
98
99
|
var useRefreshAuth = require('../useRefreshAuth/useRefreshAuth.cjs');
|
|
99
|
-
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
100
100
|
require('../../../store/state/sendBalances.cjs');
|
|
101
101
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
102
102
|
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -73,6 +73,7 @@ import 'qrcode';
|
|
|
73
73
|
import 'formik';
|
|
74
74
|
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
75
75
|
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
76
|
+
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
76
77
|
import { CloudBackupProvider } from './types.js';
|
|
77
78
|
import { getSupportedProviders, CLOUD_PROVIDER_CONFIGS } from './cloudProviders.js';
|
|
78
79
|
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
@@ -92,7 +93,6 @@ import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js'
|
|
|
92
93
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
93
94
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
94
95
|
import { useRefreshAuth } from '../useRefreshAuth/useRefreshAuth.js';
|
|
95
|
-
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
96
96
|
import '../../../store/state/sendBalances.js';
|
|
97
97
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
98
98
|
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -81,6 +81,7 @@ require('qrcode');
|
|
|
81
81
|
require('formik');
|
|
82
82
|
require('../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
83
83
|
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
84
|
+
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
84
85
|
require('../useWalletBackup/useWalletBackup.cjs');
|
|
85
86
|
require('../useWalletBackup/types.cjs');
|
|
86
87
|
require('../useWalletBackup/cloudProviders.cjs');
|
|
@@ -98,7 +99,6 @@ require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
|
98
99
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
99
100
|
var waas = require('../../../data/api/waas/waas.cjs');
|
|
100
101
|
var useRefreshAuth = require('../useRefreshAuth/useRefreshAuth.cjs');
|
|
101
|
-
var useDynamicWaas = require('../useDynamicWaas/useDynamicWaas.cjs');
|
|
102
102
|
require('../../../store/state/sendBalances.cjs');
|
|
103
103
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
104
104
|
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -77,6 +77,7 @@ import 'qrcode';
|
|
|
77
77
|
import 'formik';
|
|
78
78
|
import '../useSubdomainCheck/useSubdomainCheck.js';
|
|
79
79
|
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
80
|
+
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
80
81
|
import '../useWalletBackup/useWalletBackup.js';
|
|
81
82
|
import '../useWalletBackup/types.js';
|
|
82
83
|
import '../useWalletBackup/cloudProviders.js';
|
|
@@ -94,7 +95,6 @@ import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
|
94
95
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
95
96
|
import { updateWaasWalletSettings } from '../../../data/api/waas/waas.js';
|
|
96
97
|
import { useRefreshAuth } from '../useRefreshAuth/useRefreshAuth.js';
|
|
97
|
-
import { useDynamicWaas } from '../useDynamicWaas/useDynamicWaas.js';
|
|
98
98
|
import '../../../store/state/sendBalances.js';
|
|
99
99
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
100
100
|
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -77,6 +77,7 @@ require('qrcode');
|
|
|
77
77
|
require('formik');
|
|
78
78
|
require('../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
79
79
|
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
80
|
+
var useDynamicWaas = require('../../utils/hooks/useDynamicWaas/useDynamicWaas.cjs');
|
|
80
81
|
var EnterPasswordView = require('../../widgets/DynamicWidget/views/EnterPasswordView/EnterPasswordView.cjs');
|
|
81
82
|
require('../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
|
|
82
83
|
require('../../utils/hooks/useWalletBackup/types.cjs');
|
|
@@ -110,18 +111,48 @@ var useInternalDynamicContext = require('../../context/DynamicContext/useDynamic
|
|
|
110
111
|
const UnlockWalletView = ({ accountAddress, chainName, }) => {
|
|
111
112
|
const { t } = reactI18next.useTranslation();
|
|
112
113
|
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
114
|
+
const { getWaasWalletConnector } = useDynamicWaas.useDynamicWaas();
|
|
113
115
|
const handleContinue = React.useCallback((password) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
+
const connector = getWaasWalletConnector(chainName);
|
|
117
|
+
if (!connector) {
|
|
118
|
+
const error = new Error(t('dyn_enter_password.error.failed'));
|
|
119
|
+
dynamicEvents.dynamicEvents.emit('walletUnlockAttempt', {
|
|
120
|
+
accountAddress,
|
|
121
|
+
chainName,
|
|
122
|
+
});
|
|
123
|
+
dynamicEvents.dynamicEvents.emit('walletUnlockFailed', {
|
|
124
|
+
accountAddress,
|
|
125
|
+
chainName,
|
|
126
|
+
error,
|
|
127
|
+
});
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
114
130
|
dynamicEvents.dynamicEvents.emit('walletUnlockAttempt', {
|
|
115
131
|
accountAddress,
|
|
116
132
|
chainName,
|
|
117
133
|
});
|
|
134
|
+
try {
|
|
135
|
+
yield connector.unlockWallet({ accountAddress, password });
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
dynamicEvents.dynamicEvents.emit('walletUnlockFailed', {
|
|
139
|
+
accountAddress,
|
|
140
|
+
chainName,
|
|
141
|
+
error,
|
|
142
|
+
});
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
dynamicEvents.dynamicEvents.emit('walletUnlockCompleted', {
|
|
146
|
+
accountAddress,
|
|
147
|
+
chainName,
|
|
148
|
+
});
|
|
118
149
|
dynamicEvents.dynamicEvents.emit('walletUnlockPasswordProvided', {
|
|
119
150
|
accountAddress,
|
|
120
151
|
chainName,
|
|
121
152
|
password,
|
|
122
153
|
});
|
|
123
154
|
setShowAuthFlow(false);
|
|
124
|
-
}), [accountAddress, chainName, setShowAuthFlow]);
|
|
155
|
+
}), [accountAddress, chainName, getWaasWalletConnector, setShowAuthFlow, t]);
|
|
125
156
|
return (jsxRuntime.jsx(EnterPasswordView.EnterPasswordView, { onContinue: handleContinue, title: t('dyn_unlock_wallet.title'), description: t('dyn_unlock_wallet.description'), buttonLabel: t('dyn_unlock_wallet.button.continue') }));
|
|
126
157
|
};
|
|
127
158
|
|
|
@@ -73,6 +73,7 @@ import 'qrcode';
|
|
|
73
73
|
import 'formik';
|
|
74
74
|
import '../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
75
75
|
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
76
|
+
import { useDynamicWaas } from '../../utils/hooks/useDynamicWaas/useDynamicWaas.js';
|
|
76
77
|
import { EnterPasswordView } from '../../widgets/DynamicWidget/views/EnterPasswordView/EnterPasswordView.js';
|
|
77
78
|
import '../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
78
79
|
import '../../utils/hooks/useWalletBackup/types.js';
|
|
@@ -106,18 +107,48 @@ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynam
|
|
|
106
107
|
const UnlockWalletView = ({ accountAddress, chainName, }) => {
|
|
107
108
|
const { t } = useTranslation();
|
|
108
109
|
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
110
|
+
const { getWaasWalletConnector } = useDynamicWaas();
|
|
109
111
|
const handleContinue = useCallback((password) => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
+
const connector = getWaasWalletConnector(chainName);
|
|
113
|
+
if (!connector) {
|
|
114
|
+
const error = new Error(t('dyn_enter_password.error.failed'));
|
|
115
|
+
dynamicEvents.emit('walletUnlockAttempt', {
|
|
116
|
+
accountAddress,
|
|
117
|
+
chainName,
|
|
118
|
+
});
|
|
119
|
+
dynamicEvents.emit('walletUnlockFailed', {
|
|
120
|
+
accountAddress,
|
|
121
|
+
chainName,
|
|
122
|
+
error,
|
|
123
|
+
});
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
110
126
|
dynamicEvents.emit('walletUnlockAttempt', {
|
|
111
127
|
accountAddress,
|
|
112
128
|
chainName,
|
|
113
129
|
});
|
|
130
|
+
try {
|
|
131
|
+
yield connector.unlockWallet({ accountAddress, password });
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
dynamicEvents.emit('walletUnlockFailed', {
|
|
135
|
+
accountAddress,
|
|
136
|
+
chainName,
|
|
137
|
+
error,
|
|
138
|
+
});
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
dynamicEvents.emit('walletUnlockCompleted', {
|
|
142
|
+
accountAddress,
|
|
143
|
+
chainName,
|
|
144
|
+
});
|
|
114
145
|
dynamicEvents.emit('walletUnlockPasswordProvided', {
|
|
115
146
|
accountAddress,
|
|
116
147
|
chainName,
|
|
117
148
|
password,
|
|
118
149
|
});
|
|
119
150
|
setShowAuthFlow(false);
|
|
120
|
-
}), [accountAddress, chainName, setShowAuthFlow]);
|
|
151
|
+
}), [accountAddress, chainName, getWaasWalletConnector, setShowAuthFlow, t]);
|
|
121
152
|
return (jsx(EnterPasswordView, { onContinue: handleContinue, title: t('dyn_unlock_wallet.title'), description: t('dyn_unlock_wallet.description'), buttonLabel: t('dyn_unlock_wallet.button.continue') }));
|
|
122
153
|
};
|
|
123
154
|
|
|
@@ -25,6 +25,8 @@ var SetupPasswordConfirmView = require('../../views/SetupPasswordConfirmView/Set
|
|
|
25
25
|
var SetupPasswordKnowledgeCheckView = require('../../views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.cjs');
|
|
26
26
|
var SetupPasswordSuccessView = require('../../views/SetupPasswordSuccessView/SetupPasswordSuccessView.cjs');
|
|
27
27
|
require('react-i18next');
|
|
28
|
+
require('../../../../components/Input/Input.cjs');
|
|
29
|
+
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
28
30
|
require('@dynamic-labs/wallet-connector-core');
|
|
29
31
|
require('../../../../shared/logger.cjs');
|
|
30
32
|
require('@dynamic-labs/wallet-book');
|
|
@@ -32,8 +34,6 @@ require('../../../../utils/constants/colors.cjs');
|
|
|
32
34
|
require('../../../../utils/constants/values.cjs');
|
|
33
35
|
require('@dynamic-labs/sdk-api-core');
|
|
34
36
|
require('../../../../shared/consts/index.cjs');
|
|
35
|
-
require('../../../../components/Input/Input.cjs');
|
|
36
|
-
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
37
37
|
require('../../../../components/Alert/Alert.cjs');
|
|
38
38
|
require('../../../../events/dynamicEvents.cjs');
|
|
39
39
|
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
@@ -21,6 +21,8 @@ import { SetupPasswordConfirmView } from '../../views/SetupPasswordConfirmView/S
|
|
|
21
21
|
import { SetupPasswordKnowledgeCheckView } from '../../views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.js';
|
|
22
22
|
import { SetupPasswordSuccessView } from '../../views/SetupPasswordSuccessView/SetupPasswordSuccessView.js';
|
|
23
23
|
import 'react-i18next';
|
|
24
|
+
import '../../../../components/Input/Input.js';
|
|
25
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
24
26
|
import '@dynamic-labs/wallet-connector-core';
|
|
25
27
|
import '../../../../shared/logger.js';
|
|
26
28
|
import '@dynamic-labs/wallet-book';
|
|
@@ -28,8 +30,6 @@ import '../../../../utils/constants/colors.js';
|
|
|
28
30
|
import '../../../../utils/constants/values.js';
|
|
29
31
|
import '@dynamic-labs/sdk-api-core';
|
|
30
32
|
import '../../../../shared/consts/index.js';
|
|
31
|
-
import '../../../../components/Input/Input.js';
|
|
32
|
-
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
33
33
|
import '../../../../components/Alert/Alert.js';
|
|
34
34
|
import '../../../../events/dynamicEvents.js';
|
|
35
35
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
@@ -7,16 +7,17 @@ var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var reactI18next = require('react-i18next');
|
|
10
|
-
var ErrorContainer = require('../../../../components/ErrorContainer/ErrorContainer.cjs');
|
|
11
10
|
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
12
11
|
var Input = require('../../../../components/Input/Input.cjs');
|
|
13
12
|
var ToggleVisibilityButton = require('../../../../components/ToggleVisibilityButton/ToggleVisibilityButton.cjs');
|
|
14
13
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
15
14
|
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
15
|
+
var errorCircleX = require('../../../../shared/assets/error-circle-x.cjs');
|
|
16
16
|
var passwordLockIcon = require('../../../../shared/assets/password-lock-icon.cjs');
|
|
17
17
|
require('@dynamic-labs/iconic');
|
|
18
18
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
19
19
|
|
|
20
|
+
const INVALID_PASSWORD_ERROR_MESSAGE = 'Decryption failed: Invalid password';
|
|
20
21
|
const EnterPasswordView = ({ onContinue, title, description, buttonLabel, isLoading: externalLoading, }) => {
|
|
21
22
|
const { t } = reactI18next.useTranslation();
|
|
22
23
|
const [password, setPassword] = React.useState('');
|
|
@@ -41,9 +42,18 @@ const EnterPasswordView = ({ onContinue, title, description, buttonLabel, isLoad
|
|
|
41
42
|
yield onContinue(password);
|
|
42
43
|
}
|
|
43
44
|
catch (err) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
let errorMessage;
|
|
46
|
+
if (err instanceof Error) {
|
|
47
|
+
if (err.message.includes(INVALID_PASSWORD_ERROR_MESSAGE)) {
|
|
48
|
+
errorMessage = t('dyn_enter_password.error.invalid_password');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
errorMessage = err.message;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
errorMessage = t('dyn_enter_password.error.failed');
|
|
56
|
+
}
|
|
47
57
|
setError(errorMessage);
|
|
48
58
|
}
|
|
49
59
|
finally {
|
|
@@ -51,7 +61,7 @@ const EnterPasswordView = ({ onContinue, title, description, buttonLabel, isLoad
|
|
|
51
61
|
}
|
|
52
62
|
}), [password, onContinue, t]);
|
|
53
63
|
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') }),
|
|
64
|
+
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') }), 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', error: Boolean(error), message: error ? (jsxRuntime.jsxs("span", { className: 'enter-password-view__error-message', children: [jsxRuntime.jsx(errorCircleX.ReactComponent, { width: 14, height: 14 }), error] })) : undefined, suffix:
|
|
55
65
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
56
66
|
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
67
|
color: 'inherit',
|
|
@@ -3,16 +3,17 @@ import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import { useState, useCallback } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.js';
|
|
7
6
|
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
8
7
|
import { Input } from '../../../../components/Input/Input.js';
|
|
9
8
|
import { ToggleVisibilityButton } from '../../../../components/ToggleVisibilityButton/ToggleVisibilityButton.js';
|
|
10
9
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
11
10
|
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
11
|
+
import { ReactComponent as SvgErrorCircleX } from '../../../../shared/assets/error-circle-x.js';
|
|
12
12
|
import { ReactComponent as SvgPasswordLockIcon } from '../../../../shared/assets/password-lock-icon.js';
|
|
13
13
|
import '@dynamic-labs/iconic';
|
|
14
14
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
15
15
|
|
|
16
|
+
const INVALID_PASSWORD_ERROR_MESSAGE = 'Decryption failed: Invalid password';
|
|
16
17
|
const EnterPasswordView = ({ onContinue, title, description, buttonLabel, isLoading: externalLoading, }) => {
|
|
17
18
|
const { t } = useTranslation();
|
|
18
19
|
const [password, setPassword] = useState('');
|
|
@@ -37,9 +38,18 @@ const EnterPasswordView = ({ onContinue, title, description, buttonLabel, isLoad
|
|
|
37
38
|
yield onContinue(password);
|
|
38
39
|
}
|
|
39
40
|
catch (err) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
let errorMessage;
|
|
42
|
+
if (err instanceof Error) {
|
|
43
|
+
if (err.message.includes(INVALID_PASSWORD_ERROR_MESSAGE)) {
|
|
44
|
+
errorMessage = t('dyn_enter_password.error.invalid_password');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
errorMessage = err.message;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
errorMessage = t('dyn_enter_password.error.failed');
|
|
52
|
+
}
|
|
43
53
|
setError(errorMessage);
|
|
44
54
|
}
|
|
45
55
|
finally {
|
|
@@ -47,7 +57,7 @@ const EnterPasswordView = ({ onContinue, title, description, buttonLabel, isLoad
|
|
|
47
57
|
}
|
|
48
58
|
}), [password, onContinue, t]);
|
|
49
59
|
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') }),
|
|
60
|
+
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') }), 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', error: Boolean(error), message: error ? (jsxs("span", { className: 'enter-password-view__error-message', children: [jsx(SvgErrorCircleX, { width: 14, height: 14 }), error] })) : undefined, suffix:
|
|
51
61
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
52
62
|
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
63
|
color: 'inherit',
|
|
@@ -36,7 +36,7 @@ const OPTIONS = [
|
|
|
36
36
|
value: 'c',
|
|
37
37
|
},
|
|
38
38
|
];
|
|
39
|
-
const SetupPasswordKnowledgeCheckView = ({ onContinue, onBack
|
|
39
|
+
const SetupPasswordKnowledgeCheckView = ({ onContinue, onBack }) => {
|
|
40
40
|
const { t } = reactI18next.useTranslation();
|
|
41
41
|
const [selectedAnswer, setSelectedAnswer] = React.useState('');
|
|
42
42
|
const [showError, setShowError] = React.useState(false);
|
|
@@ -53,31 +53,23 @@ const SetupPasswordKnowledgeCheckView = ({ onContinue, onBack, onReviewTerms })
|
|
|
53
53
|
}
|
|
54
54
|
}, [selectedAnswer, onContinue]);
|
|
55
55
|
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-knowledge-check-back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
56
|
-
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.knowledge_check.title', children: t('dyn_setup_password.knowledge_check.title') }) }), jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view', children: jsxRuntime.jsxs("div", { className: 'setup-password-knowledge-check-view__body', children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: 'setup-password-knowledge-check-view__content', children: [jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(knowledgeCheckIcon.ReactComponent, { width: 56, height: 56 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: '
|
|
56
|
+
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.knowledge_check.title', children: t('dyn_setup_password.knowledge_check.title') }) }), jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view', children: jsxRuntime.jsxs("div", { className: 'setup-password-knowledge-check-view__body', children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: 'setup-password-knowledge-check-view__content', children: [jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(knowledgeCheckIcon.ReactComponent, { width: 56, height: 56 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', weight: 'medium', copykey: 'dyn_setup_password.knowledge_check.description', className: 'setup-password-knowledge-check-view__description', children: t('dyn_setup_password.knowledge_check.description') })] }), jsxRuntime.jsxs("div", { className: 'setup-password-knowledge-check-view__alert', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', weight: 'semibold', copykey: 'dyn_setup_password.knowledge_check.question', className: 'setup-password-knowledge-check-view__question', children: t('dyn_setup_password.knowledge_check.question') }), jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view__options', children: OPTIONS.map((option) => {
|
|
57
57
|
const isSelected = selectedAnswer === option.value;
|
|
58
58
|
const hasError = showError && isSelected;
|
|
59
59
|
return (jsxRuntime.jsxs("div", { className: `setup-password-knowledge-check-view__option ${isSelected
|
|
60
60
|
? 'setup-password-knowledge-check-view__option--selected'
|
|
61
61
|
: ''} ${hasError
|
|
62
62
|
? 'setup-password-knowledge-check-view__option--error'
|
|
63
|
-
: ''}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (!showError) {
|
|
67
|
-
handleAnswerChange({
|
|
68
|
-
target: { value: option.value },
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}, children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: hasError
|
|
63
|
+
: ''}`, onClick: () => handleAnswerChange({
|
|
64
|
+
target: { value: option.value },
|
|
65
|
+
}), children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: hasError
|
|
72
66
|
? 'error-1'
|
|
73
67
|
: isSelected
|
|
74
68
|
? 'brand-primary'
|
|
75
69
|
: 'tertiary', weight: 'bold', className: 'setup-password-knowledge-check-view__option-label', children: option.label }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', children: t(option.translationKey) })] }, option.value));
|
|
76
|
-
}) })] })] }), jsxRuntime.jsxs("div", { children: [showError && (jsxRuntime.
|
|
77
|
-
color: 'inherit',
|
|
78
|
-
}, expanded: true, children: t('dyn_setup_password.knowledge_check.review_terms') }) })] })), !showError && (jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-knowledge-check-continue-button', onClick: handleContinue, disabled: !selectedAnswer, copykey: 'dyn_setup_password.button.confirm', buttonVariant: 'brand-primary', typographyProps: {
|
|
70
|
+
}) })] })] }), jsxRuntime.jsxs("div", { children: [showError && (jsxRuntime.jsx(Alert.Alert, { variant: 'error', icon: jsxRuntime.jsx(exclamationCircle.ReactComponent, {}), className: 'setup-password-knowledge-check-view__error', children: t('dyn_setup_password.knowledge_check.error') })), jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-knowledge-check-continue-button', onClick: handleContinue, disabled: !selectedAnswer, copykey: 'dyn_setup_password.button.confirm', buttonVariant: 'brand-primary', typographyProps: {
|
|
79
71
|
color: 'inherit',
|
|
80
|
-
}, expanded: true, children: t('dyn_setup_password.button.confirm') }) })
|
|
72
|
+
}, expanded: true, children: t('dyn_setup_password.button.confirm') }) })] })] }) })] }));
|
|
81
73
|
};
|
|
82
74
|
|
|
83
75
|
exports.SetupPasswordKnowledgeCheckView = SetupPasswordKnowledgeCheckView;
|