@dynamic-labs/sdk-react-core 4.10.1 → 4.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/api.d.ts +1 -0
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +1 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +1 -1
- package/src/lib/components/DynamicSpinner/DynamicSpinner.d.ts +3 -0
- package/src/lib/components/DynamicSpinner/index.d.ts +1 -0
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +2 -5
- package/src/lib/components/IconWithSpinner/IconWithSpinner.d.ts +3 -3
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +2 -5
- package/src/lib/components/Popper/PopperContext/PopperContext.cjs +2 -2
- package/src/lib/components/Popper/PopperContext/PopperContext.d.ts +2 -1
- package/src/lib/components/Popper/PopperContext/PopperContext.js +2 -2
- package/src/lib/components/QrCodeWrapper/QrCodeWrapper.cjs +7 -7
- package/src/lib/components/QrCodeWrapper/QrCodeWrapper.js +7 -7
- package/src/lib/components/SocialSignIn/SocialSignIn.cjs +1 -1
- package/src/lib/components/SocialSignIn/SocialSignIn.js +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +8 -8
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +8 -8
- package/src/lib/components/Typography/Typography.cjs +1 -0
- package/src/lib/components/Typography/Typography.js +1 -0
- package/src/lib/components/Typography/Typography.types.d.ts +1 -1
- package/src/lib/components/index.d.ts +8 -7
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +4 -0
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +4 -0
- package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +3 -4
- package/src/lib/context/OnrampContext/OnrampContext.cjs +21 -8
- package/src/lib/context/OnrampContext/OnrampContext.d.ts +6 -2
- package/src/lib/context/OnrampContext/OnrampContext.js +21 -8
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +1 -1
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +1 -1
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +62 -23
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +57 -18
- package/src/lib/data/api/index.d.ts +1 -0
- package/src/lib/data/api/transactions/index.d.ts +1 -0
- package/src/lib/events/dynamicEvents.cjs +1 -0
- package/src/lib/events/dynamicEvents.d.ts +2 -2
- package/src/lib/events/dynamicEvents.js +1 -0
- package/src/lib/events/ui.d.ts +8 -0
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +8 -8
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +8 -8
- package/src/lib/shared/assets/index.d.ts +2 -1
- package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +6 -1
- package/src/lib/shared/types/wallets.d.ts +10 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/onrampConfigurationToOnrampOption/onrampConfigurationToOnrampOption.cjs +2 -21
- package/src/lib/utils/functions/onrampConfigurationToOnrampOption/onrampConfigurationToOnrampOption.d.ts +2 -4
- package/src/lib/utils/functions/onrampConfigurationToOnrampOption/onrampConfigurationToOnrampOption.js +2 -21
- package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.d.ts +1 -1
- package/src/lib/utils/hooks/useMfa/useMfa.cjs +1 -1
- package/src/lib/utils/hooks/useMfa/useMfa.js +1 -1
- package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.cjs +23 -82
- package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.js +23 -82
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -1
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.cjs +1 -1
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.js +1 -1
- package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.cjs +1 -1
- package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.js +1 -1
- package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.cjs +1 -1
- package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.js +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -1
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +1 -1
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +1 -1
- package/src/lib/views/MfaRecoveryView/MfaRecoveryView.cjs +1 -1
- package/src/lib/views/MfaRecoveryView/MfaRecoveryView.js +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/AddRecoveryEmail/AddRecoveryEmail.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/AddRecoveryEmail/AddRecoveryEmail.js +1 -1
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +1 -1
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +1 -1
- package/src/lib/views/WalletList/hooks/useTabState.cjs +29 -4
- package/src/lib/views/WalletList/hooks/useTabState.d.ts +2 -2
- package/src/lib/views/WalletList/hooks/useTabState.js +30 -5
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +1 -1
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeUserProfile/DynamicBridgeUserProfile.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ChooseOnrampProviderView/ChooseOnrampProviderView.cjs +5 -2
- package/src/lib/widgets/DynamicWidget/views/ChooseOnrampProviderView/ChooseOnrampProviderView.js +5 -2
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useFundingMethods.cjs +18 -5
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useFundingMethods.js +18 -5
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +2 -2
|
@@ -92,11 +92,11 @@ require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSucces
|
|
|
92
92
|
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
93
93
|
require('../../../../store/state/tokenBalances.cjs');
|
|
94
94
|
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
95
|
+
var EmailForm = require('../../../../components/EmailForm/EmailForm.cjs');
|
|
95
96
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
96
97
|
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
97
98
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
98
99
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
99
|
-
var EmailForm = require('../../../../components/EmailForm/EmailForm.cjs');
|
|
100
100
|
|
|
101
101
|
const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, className, style, }) => {
|
|
102
102
|
var _a;
|
|
@@ -88,11 +88,11 @@ import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccess
|
|
|
88
88
|
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
89
89
|
import '../../../../store/state/tokenBalances.js';
|
|
90
90
|
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
91
|
+
import { EmailForm } from '../../../../components/EmailForm/EmailForm.js';
|
|
91
92
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
92
93
|
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
93
94
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
94
95
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
95
|
-
import { EmailForm } from '../../../../components/EmailForm/EmailForm.js';
|
|
96
96
|
|
|
97
97
|
const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, className, style, }) => {
|
|
98
98
|
var _a;
|
|
@@ -96,9 +96,9 @@ require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanne
|
|
|
96
96
|
require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
97
97
|
require('../../store/state/tokenBalances.cjs');
|
|
98
98
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
99
|
-
var MfaRecoveryIcon = require('../../components/MfaRecoveryIcon/MfaRecoveryIcon.cjs');
|
|
100
99
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
101
100
|
require('../../components/IsBrowser/IsBrowser.cjs');
|
|
101
|
+
var MfaRecoveryIcon = require('../../components/MfaRecoveryIcon/MfaRecoveryIcon.cjs');
|
|
102
102
|
require('../../components/Popper/Popper/Popper.cjs');
|
|
103
103
|
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
104
104
|
|
|
@@ -92,9 +92,9 @@ import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner
|
|
|
92
92
|
import '../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
93
93
|
import '../../store/state/tokenBalances.js';
|
|
94
94
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
95
|
-
import { MfaRecoveryScreenIcon } from '../../components/MfaRecoveryIcon/MfaRecoveryIcon.js';
|
|
96
95
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
97
96
|
import '../../components/IsBrowser/IsBrowser.js';
|
|
97
|
+
import { MfaRecoveryScreenIcon } from '../../components/MfaRecoveryIcon/MfaRecoveryIcon.js';
|
|
98
98
|
import '../../components/Popper/Popper/Popper.js';
|
|
99
99
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
100
100
|
|
|
@@ -99,11 +99,11 @@ require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSucces
|
|
|
99
99
|
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
100
100
|
require('../../../../store/state/tokenBalances.cjs');
|
|
101
101
|
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
102
|
+
var EmailForm = require('../../../../components/EmailForm/EmailForm.cjs');
|
|
102
103
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
103
104
|
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
104
105
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
105
106
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
106
|
-
var EmailForm = require('../../../../components/EmailForm/EmailForm.cjs');
|
|
107
107
|
|
|
108
108
|
const AddRecoveryEmail = ({ canSkipAddingEmail = true, shouldInitRecovery = false, authenticatorType, currentAction, isFromEmailVerification = false, }) => {
|
|
109
109
|
const { user, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -95,11 +95,11 @@ import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccess
|
|
|
95
95
|
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
96
96
|
import '../../../../store/state/tokenBalances.js';
|
|
97
97
|
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
98
|
+
import { EmailForm } from '../../../../components/EmailForm/EmailForm.js';
|
|
98
99
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
99
100
|
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
100
101
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
101
102
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
102
|
-
import { EmailForm } from '../../../../components/EmailForm/EmailForm.js';
|
|
103
103
|
|
|
104
104
|
const AddRecoveryEmail = ({ canSkipAddingEmail = true, shouldInitRecovery = false, authenticatorType, currentAction, isFromEmailVerification = false, }) => {
|
|
105
105
|
const { user, setShowAuthFlow } = useInternalDynamicContext();
|
|
@@ -57,6 +57,7 @@ require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
|
57
57
|
require('react-i18next');
|
|
58
58
|
require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
59
59
|
require('../../../components/Alert/Alert.cjs');
|
|
60
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
60
61
|
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
61
62
|
require('../../../components/IconButton/IconButton.cjs');
|
|
62
63
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -72,7 +73,6 @@ require('../../../components/Popper/Popper/Popper.cjs');
|
|
|
72
73
|
require('../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
73
74
|
require('react-focus-lock');
|
|
74
75
|
require('qrcode');
|
|
75
|
-
require('../../../context/WalletContext/WalletContext.cjs');
|
|
76
76
|
require('formik');
|
|
77
77
|
require('../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
78
78
|
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
@@ -53,6 +53,7 @@ import '../../../store/state/walletOptions/walletOptions.js';
|
|
|
53
53
|
import 'react-i18next';
|
|
54
54
|
import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
55
55
|
import '../../../components/Alert/Alert.js';
|
|
56
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
56
57
|
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
57
58
|
import '../../../components/IconButton/IconButton.js';
|
|
58
59
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
@@ -68,7 +69,6 @@ import '../../../components/Popper/Popper/Popper.js';
|
|
|
68
69
|
import '../../../components/Popper/PopperContext/PopperContext.js';
|
|
69
70
|
import 'react-focus-lock';
|
|
70
71
|
import 'qrcode';
|
|
71
|
-
import '../../../context/WalletContext/WalletContext.js';
|
|
72
72
|
import 'formik';
|
|
73
73
|
import '../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
74
74
|
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
@@ -29,6 +29,7 @@ require('../../store/state/projectSettings/projectSettings.cjs');
|
|
|
29
29
|
require('../../config/ApiEndpoint.cjs');
|
|
30
30
|
require('../../store/state/user/user.cjs');
|
|
31
31
|
require('../../locale/locale.cjs');
|
|
32
|
+
var blockaid = require('../../data/api/transactions/blockaid.cjs');
|
|
32
33
|
require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
33
34
|
require('../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
34
35
|
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
@@ -43,7 +44,6 @@ var useForceUpdate = require('../../utils/hooks/useForceUpdate/useForceUpdate.cj
|
|
|
43
44
|
var useInterval = require('../../utils/hooks/useInterval/useInterval.cjs');
|
|
44
45
|
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
45
46
|
var useMutation = require('../../utils/hooks/useMutation/useMutation.cjs');
|
|
46
|
-
var blockaid = require('../../data/api/transactions/blockaid.cjs');
|
|
47
47
|
var usePromise = require('../../utils/hooks/usePromise/usePromise.cjs');
|
|
48
48
|
require('@dynamic-labs/types');
|
|
49
49
|
require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
@@ -25,6 +25,7 @@ import '../../store/state/projectSettings/projectSettings.js';
|
|
|
25
25
|
import '../../config/ApiEndpoint.js';
|
|
26
26
|
import '../../store/state/user/user.js';
|
|
27
27
|
import '../../locale/locale.js';
|
|
28
|
+
import { simulateBlockaidUserOperation, simulateBlockaidSVMTransaction, simulateBlockaidEVMTransaction } from '../../data/api/transactions/blockaid.js';
|
|
28
29
|
import '../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
29
30
|
import '../../store/state/primaryWalletId/primaryWalletId.js';
|
|
30
31
|
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
@@ -39,7 +40,6 @@ import { useForceUpdate } from '../../utils/hooks/useForceUpdate/useForceUpdate.
|
|
|
39
40
|
import { useInterval } from '../../utils/hooks/useInterval/useInterval.js';
|
|
40
41
|
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
41
42
|
import { useMutation } from '../../utils/hooks/useMutation/useMutation.js';
|
|
42
|
-
import { simulateBlockaidUserOperation, simulateBlockaidSVMTransaction, simulateBlockaidEVMTransaction } from '../../data/api/transactions/blockaid.js';
|
|
43
43
|
import { usePromise } from '../../utils/hooks/usePromise/usePromise.js';
|
|
44
44
|
import '@dynamic-labs/types';
|
|
45
45
|
import '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
@@ -4,19 +4,44 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
8
|
+
var logger = require('../../../shared/logger.cjs');
|
|
7
9
|
|
|
8
10
|
const useTabState = ({ settingsOverrides, }) => {
|
|
9
|
-
var _a, _b, _c;
|
|
11
|
+
var _a, _b, _c, _d;
|
|
10
12
|
const walletListViewSettings = (_a = settingsOverrides === null || settingsOverrides === void 0 ? void 0 : settingsOverrides.views) === null || _a === void 0 ? void 0 : _a.find((view) => view.type === 'wallet-list');
|
|
11
|
-
const [selectedTabIndex,
|
|
13
|
+
const [selectedTabIndex, _setSelectedTabIndex] = React.useState(0);
|
|
14
|
+
const setSelectedTabIndex = React.useCallback((value) => {
|
|
15
|
+
const validateSelectedTabIndex = (index) => {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const tab = (_a = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _a === void 0 ? void 0 : _a.items[index];
|
|
18
|
+
if (!tab) {
|
|
19
|
+
logger.logger.error(`Tab with index ${index} not found. Available tabs: ${JSON.stringify((_b = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _b === void 0 ? void 0 : _b.items)}`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
dynamicEvents.dynamicEvents.emit('walletTabSelected', { index, tab });
|
|
23
|
+
return index;
|
|
24
|
+
};
|
|
25
|
+
if (typeof value === 'number') {
|
|
26
|
+
const newIndex = validateSelectedTabIndex(value);
|
|
27
|
+
if (newIndex !== undefined)
|
|
28
|
+
_setSelectedTabIndex(newIndex);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
_setSelectedTabIndex((current) => {
|
|
32
|
+
var _a;
|
|
33
|
+
const newIndex = value(current);
|
|
34
|
+
return (_a = validateSelectedTabIndex(newIndex)) !== null && _a !== void 0 ? _a : current;
|
|
35
|
+
});
|
|
36
|
+
}, [(_b = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _b === void 0 ? void 0 : _b.items]);
|
|
12
37
|
const selectedTabSettings = selectedTabIndex === null
|
|
13
38
|
? undefined
|
|
14
|
-
: (
|
|
39
|
+
: (_c = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _c === void 0 ? void 0 : _c.items[selectedTabIndex];
|
|
15
40
|
return {
|
|
16
41
|
selectedTabIndex,
|
|
17
42
|
selectedTabSettings,
|
|
18
43
|
setSelectedTabIndex,
|
|
19
|
-
tabsItems: (
|
|
44
|
+
tabsItems: (_d = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _d === void 0 ? void 0 : _d.items,
|
|
20
45
|
};
|
|
21
46
|
};
|
|
22
47
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { SettingsOverrides } from '../../../context/DynamicContext/types';
|
|
3
3
|
export declare const useTabState: ({ settingsOverrides, }: {
|
|
4
4
|
settingsOverrides: SettingsOverrides | undefined;
|
|
5
5
|
}) => {
|
|
6
6
|
selectedTabIndex: number;
|
|
7
7
|
selectedTabSettings: import("../../../shared").WalletListViewTabItem | undefined;
|
|
8
|
-
setSelectedTabIndex:
|
|
8
|
+
setSelectedTabIndex: Dispatch<SetStateAction<number>>;
|
|
9
9
|
tabsItems: import("../../../shared").WalletListViewTabItem[] | undefined;
|
|
10
10
|
};
|
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
4
|
+
import { logger } from '../../../shared/logger.js';
|
|
3
5
|
|
|
4
6
|
const useTabState = ({ settingsOverrides, }) => {
|
|
5
|
-
var _a, _b, _c;
|
|
7
|
+
var _a, _b, _c, _d;
|
|
6
8
|
const walletListViewSettings = (_a = settingsOverrides === null || settingsOverrides === void 0 ? void 0 : settingsOverrides.views) === null || _a === void 0 ? void 0 : _a.find((view) => view.type === 'wallet-list');
|
|
7
|
-
const [selectedTabIndex,
|
|
9
|
+
const [selectedTabIndex, _setSelectedTabIndex] = useState(0);
|
|
10
|
+
const setSelectedTabIndex = useCallback((value) => {
|
|
11
|
+
const validateSelectedTabIndex = (index) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const tab = (_a = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _a === void 0 ? void 0 : _a.items[index];
|
|
14
|
+
if (!tab) {
|
|
15
|
+
logger.error(`Tab with index ${index} not found. Available tabs: ${JSON.stringify((_b = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _b === void 0 ? void 0 : _b.items)}`);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
dynamicEvents.emit('walletTabSelected', { index, tab });
|
|
19
|
+
return index;
|
|
20
|
+
};
|
|
21
|
+
if (typeof value === 'number') {
|
|
22
|
+
const newIndex = validateSelectedTabIndex(value);
|
|
23
|
+
if (newIndex !== undefined)
|
|
24
|
+
_setSelectedTabIndex(newIndex);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
_setSelectedTabIndex((current) => {
|
|
28
|
+
var _a;
|
|
29
|
+
const newIndex = value(current);
|
|
30
|
+
return (_a = validateSelectedTabIndex(newIndex)) !== null && _a !== void 0 ? _a : current;
|
|
31
|
+
});
|
|
32
|
+
}, [(_b = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _b === void 0 ? void 0 : _b.items]);
|
|
8
33
|
const selectedTabSettings = selectedTabIndex === null
|
|
9
34
|
? undefined
|
|
10
|
-
: (
|
|
35
|
+
: (_c = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _c === void 0 ? void 0 : _c.items[selectedTabIndex];
|
|
11
36
|
return {
|
|
12
37
|
selectedTabIndex,
|
|
13
38
|
selectedTabSettings,
|
|
14
39
|
setSelectedTabIndex,
|
|
15
|
-
tabsItems: (
|
|
40
|
+
tabsItems: (_d = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _d === void 0 ? void 0 : _d.items,
|
|
16
41
|
};
|
|
17
42
|
};
|
|
18
43
|
|
|
@@ -60,8 +60,8 @@ require('../../components/Alert/Alert.cjs');
|
|
|
60
60
|
var Typography = require('../../components/Typography/Typography.cjs');
|
|
61
61
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
62
62
|
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
|
|
63
|
-
require('../../components/IconButton/IconButton.cjs');
|
|
64
63
|
var IconWithSpinner = require('../../components/IconWithSpinner/IconWithSpinner.cjs');
|
|
64
|
+
require('../../components/IconButton/IconButton.cjs');
|
|
65
65
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
66
66
|
require('../../components/Input/Input.cjs');
|
|
67
67
|
require('../../components/IsBrowser/IsBrowser.cjs');
|
|
@@ -56,8 +56,8 @@ import '../../components/Alert/Alert.js';
|
|
|
56
56
|
import { Typography } from '../../components/Typography/Typography.js';
|
|
57
57
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
58
58
|
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
59
|
-
import '../../components/IconButton/IconButton.js';
|
|
60
59
|
import { iconRatio, IconWithSpinner } from '../../components/IconWithSpinner/IconWithSpinner.js';
|
|
60
|
+
import '../../components/IconButton/IconButton.js';
|
|
61
61
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
62
62
|
import '../../components/Input/Input.js';
|
|
63
63
|
import '../../components/IsBrowser/IsBrowser.js';
|
|
@@ -97,9 +97,9 @@ require('../../../../store/state/tokenBalances.cjs');
|
|
|
97
97
|
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
98
98
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
99
99
|
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
100
|
+
var OptionsSwitcher = require('../../../../components/OptionsSwitcher/OptionsSwitcher.cjs');
|
|
100
101
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
101
102
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
102
|
-
var OptionsSwitcher = require('../../../../components/OptionsSwitcher/OptionsSwitcher.cjs');
|
|
103
103
|
|
|
104
104
|
const options = [
|
|
105
105
|
{
|
|
@@ -93,9 +93,9 @@ import '../../../../store/state/tokenBalances.js';
|
|
|
93
93
|
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
94
94
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
95
95
|
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
96
|
+
import { OptionsSwitcher } from '../../../../components/OptionsSwitcher/OptionsSwitcher.js';
|
|
96
97
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
97
98
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
98
|
-
import { OptionsSwitcher } from '../../../../components/OptionsSwitcher/OptionsSwitcher.js';
|
|
99
99
|
|
|
100
100
|
const options = [
|
|
101
101
|
{
|
|
@@ -62,6 +62,7 @@ var classNames = require('../../../../utils/functions/classNames/classNames.cjs'
|
|
|
62
62
|
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
63
63
|
require('../../../../components/Alert/Alert.cjs');
|
|
64
64
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
65
|
+
var AuthProviderIcon = require('../../../../components/AuthProviderIcon/AuthProviderIcon.cjs');
|
|
65
66
|
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
66
67
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
67
68
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -77,7 +78,6 @@ require('../../../../components/Popper/Popper/Popper.cjs');
|
|
|
77
78
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
78
79
|
require('react-focus-lock');
|
|
79
80
|
require('qrcode');
|
|
80
|
-
var AuthProviderIcon = require('../../../../components/AuthProviderIcon/AuthProviderIcon.cjs');
|
|
81
81
|
require('formik');
|
|
82
82
|
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
83
83
|
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
@@ -58,6 +58,7 @@ import { classNames } from '../../../../utils/functions/classNames/classNames.js
|
|
|
58
58
|
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
59
59
|
import '../../../../components/Alert/Alert.js';
|
|
60
60
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
61
|
+
import { AuthProviderIcon } from '../../../../components/AuthProviderIcon/AuthProviderIcon.js';
|
|
61
62
|
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
62
63
|
import '../../../../components/IconButton/IconButton.js';
|
|
63
64
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
@@ -73,7 +74,6 @@ import '../../../../components/Popper/Popper/Popper.js';
|
|
|
73
74
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
74
75
|
import 'react-focus-lock';
|
|
75
76
|
import 'qrcode';
|
|
76
|
-
import { AuthProviderIcon } from '../../../../components/AuthProviderIcon/AuthProviderIcon.js';
|
|
77
77
|
import 'formik';
|
|
78
78
|
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
79
79
|
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
@@ -229,7 +229,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
229
229
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
230
230
|
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportPrivateKey.ReactComponent, { className: exportIconClasses }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.private_key_button', children: t('dyn_settings.export_section.private_key_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'embedded-reveal-button', onClick: handleExportWithPhraseClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
231
231
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
232
|
-
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: exportIconClasses }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }) }), jsxRuntime.jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick,
|
|
232
|
+
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: exportIconClasses }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }) }), jsxRuntime.jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', color: 'error-1', variant: 'body_small', weight: 'medium', className: 'account-and-security-settings-view__delete-account-container__delete-button', children: t('dyn_settings.delete_account.title') }) })] }));
|
|
233
233
|
};
|
|
234
234
|
|
|
235
235
|
exports.AccountAndSecuritySettingsView = AccountAndSecuritySettingsView;
|
|
@@ -225,7 +225,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
225
225
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
226
226
|
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.private_key_button', children: t('dyn_settings.export_section.private_key_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsx(TypographyButton, { dataTestId: 'embedded-reveal-button', onClick: handleExportWithPhraseClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
227
227
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
228
|
-
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }) }), jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsx(Typography, { onClick: handleDeleteAccountClick,
|
|
228
|
+
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: exportIconClasses }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }) }), jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsx(Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', color: 'error-1', variant: 'body_small', weight: 'medium', className: 'account-and-security-settings-view__delete-account-container__delete-button', children: t('dyn_settings.delete_account.title') }) })] }));
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
export { AccountAndSecuritySettingsView };
|
package/src/lib/widgets/DynamicWidget/views/ChooseOnrampProviderView/ChooseOnrampProviderView.cjs
CHANGED
|
@@ -103,12 +103,15 @@ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
103
103
|
const ChooseOnrampProviderView = () => {
|
|
104
104
|
const { t } = reactI18next.useTranslation();
|
|
105
105
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
106
|
-
const { enabledOnrampProviders } = OnrampContext.useOnrampContext();
|
|
106
|
+
const { enabledOnrampProviders, selectOnrampProvider } = OnrampContext.useOnrampContext();
|
|
107
107
|
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
108
108
|
const onrampOptions = React.useMemo(() => enabledOnrampProviders.filter(({ isPaymentMethod }) => !isPaymentMethod), [enabledOnrampProviders]);
|
|
109
109
|
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', id: 'back-button', "data-testid": 'back-button', onClick: () => setDynamicWidgetView('choose-wallet-funding-method'), children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
|
|
110
110
|
return (jsxRuntime.jsxs("div", { className: 'deposit-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, description: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'choose-onramp-provider__header-description', children: t('dyn_wallet_funding.onramp_provider_selection.description') }), children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', children: t('dyn_wallet_funding.onramp_provider_selection.title') }) }), jsxRuntime.jsx("div", { className: 'choose-wallet-funding-method__options', children: primaryWallet &&
|
|
111
|
-
onrampOptions.map((option) => (jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () =>
|
|
111
|
+
onrampOptions.map((option) => (jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => selectOnrampProvider({
|
|
112
|
+
provider: option,
|
|
113
|
+
wallet: primaryWallet,
|
|
114
|
+
}), leading: jsxRuntime.jsx(Icon.Icon, { className: 'choose-onramp-provider__options__option__icon', children: jsxRuntime.jsx("img", { src: option.iconUrl, alt: option.displayName }) }), typographyProps: { variant: 'body_normal', weight: 'medium' }, buttonVariant: 'card', className: 'choose-wallet-funding-method__options__option', description: option.description, children: option.displayName }, option.id))) })] }));
|
|
112
115
|
};
|
|
113
116
|
|
|
114
117
|
exports.ChooseOnrampProviderView = ChooseOnrampProviderView;
|
package/src/lib/widgets/DynamicWidget/views/ChooseOnrampProviderView/ChooseOnrampProviderView.js
CHANGED
|
@@ -99,12 +99,15 @@ import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
|
99
99
|
const ChooseOnrampProviderView = () => {
|
|
100
100
|
const { t } = useTranslation();
|
|
101
101
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
102
|
-
const { enabledOnrampProviders } = useOnrampContext();
|
|
102
|
+
const { enabledOnrampProviders, selectOnrampProvider } = useOnrampContext();
|
|
103
103
|
const { primaryWallet } = useInternalDynamicContext();
|
|
104
104
|
const onrampOptions = useMemo(() => enabledOnrampProviders.filter(({ isPaymentMethod }) => !isPaymentMethod), [enabledOnrampProviders]);
|
|
105
105
|
const backButton = (jsx(IconButton, { type: 'button', id: 'back-button', "data-testid": 'back-button', onClick: () => setDynamicWidgetView('choose-wallet-funding-method'), children: jsx(SvgArrowLeft, {}) }));
|
|
106
106
|
return (jsxs("div", { className: 'deposit-view', children: [jsx(ModalHeader, { leading: backButton, description: jsx(Typography, { variant: 'body_small', color: 'secondary', className: 'choose-onramp-provider__header-description', children: t('dyn_wallet_funding.onramp_provider_selection.description') }), children: jsx(Typography, { variant: 'title', children: t('dyn_wallet_funding.onramp_provider_selection.title') }) }), jsx("div", { className: 'choose-wallet-funding-method__options', children: primaryWallet &&
|
|
107
|
-
onrampOptions.map((option) => (jsx(TypographyButton, { onClick: () =>
|
|
107
|
+
onrampOptions.map((option) => (jsx(TypographyButton, { onClick: () => selectOnrampProvider({
|
|
108
|
+
provider: option,
|
|
109
|
+
wallet: primaryWallet,
|
|
110
|
+
}), leading: jsx(Icon, { className: 'choose-onramp-provider__options__option__icon', children: jsx("img", { src: option.iconUrl, alt: option.displayName }) }), typographyProps: { variant: 'body_normal', weight: 'medium' }, buttonVariant: 'card', className: 'choose-wallet-funding-method__options__option', description: option.description, children: option.displayName }, option.id))) })] }));
|
|
108
111
|
};
|
|
109
112
|
|
|
110
113
|
export { ChooseOnrampProviderView };
|
|
@@ -116,7 +116,7 @@ const useFundingMethods = () => {
|
|
|
116
116
|
const { t } = reactI18next.useTranslation();
|
|
117
117
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
118
118
|
const { externalWalletFundingEnabled } = useFundWithWallet.useInternalFundWithWallet();
|
|
119
|
-
const { enabledOnrampProviders } = OnrampContext.useOnrampContext();
|
|
119
|
+
const { enabledOnrampProviders, selectOnrampProvider } = OnrampContext.useOnrampContext();
|
|
120
120
|
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
121
121
|
const viewWalletsFilter = React.useMemo(() => (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain)
|
|
122
122
|
? index.FilterChain(primaryWallet.chain)
|
|
@@ -136,8 +136,16 @@ const useFundingMethods = () => {
|
|
|
136
136
|
}
|
|
137
137
|
onrampOptions.length > 1
|
|
138
138
|
? setDynamicWidgetView('choose-onramp-provider')
|
|
139
|
-
:
|
|
140
|
-
|
|
139
|
+
: selectOnrampProvider({
|
|
140
|
+
provider: onrampOptions[0],
|
|
141
|
+
wallet: primaryWallet,
|
|
142
|
+
});
|
|
143
|
+
}, [
|
|
144
|
+
onrampOptions,
|
|
145
|
+
setDynamicWidgetView,
|
|
146
|
+
primaryWallet,
|
|
147
|
+
selectOnrampProvider,
|
|
148
|
+
]);
|
|
141
149
|
const previewWalletIcons = React.useMemo(() => {
|
|
142
150
|
if (!externalWalletFundingEnabled)
|
|
143
151
|
return [];
|
|
@@ -162,12 +170,16 @@ const useFundingMethods = () => {
|
|
|
162
170
|
},
|
|
163
171
|
];
|
|
164
172
|
if (primaryWallet) {
|
|
165
|
-
paymentMethods.forEach((
|
|
173
|
+
paymentMethods.forEach((option) => {
|
|
174
|
+
const { id, iconUrl, displayName } = option;
|
|
166
175
|
methods.push({
|
|
167
176
|
icon: jsxRuntime.jsx("img", { src: iconUrl, alt: displayName }),
|
|
168
177
|
key: id,
|
|
169
178
|
label: displayName,
|
|
170
|
-
onClick: () =>
|
|
179
|
+
onClick: () => selectOnrampProvider({
|
|
180
|
+
provider: option,
|
|
181
|
+
wallet: primaryWallet,
|
|
182
|
+
}),
|
|
171
183
|
showChevron: false,
|
|
172
184
|
});
|
|
173
185
|
});
|
|
@@ -210,6 +222,7 @@ const useFundingMethods = () => {
|
|
|
210
222
|
filteredLinkedWallets.length,
|
|
211
223
|
externalWalletFundingEnabled,
|
|
212
224
|
paymentMethods,
|
|
225
|
+
selectOnrampProvider,
|
|
213
226
|
handleBuyCryptoClick,
|
|
214
227
|
previewOnrampIcons,
|
|
215
228
|
startLinkedWalletFunding,
|
|
@@ -112,7 +112,7 @@ const useFundingMethods = () => {
|
|
|
112
112
|
const { t } = useTranslation();
|
|
113
113
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
114
114
|
const { externalWalletFundingEnabled } = useInternalFundWithWallet();
|
|
115
|
-
const { enabledOnrampProviders } = useOnrampContext();
|
|
115
|
+
const { enabledOnrampProviders, selectOnrampProvider } = useOnrampContext();
|
|
116
116
|
const { primaryWallet } = useInternalDynamicContext();
|
|
117
117
|
const viewWalletsFilter = useMemo(() => (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain)
|
|
118
118
|
? FilterChain(primaryWallet.chain)
|
|
@@ -132,8 +132,16 @@ const useFundingMethods = () => {
|
|
|
132
132
|
}
|
|
133
133
|
onrampOptions.length > 1
|
|
134
134
|
? setDynamicWidgetView('choose-onramp-provider')
|
|
135
|
-
:
|
|
136
|
-
|
|
135
|
+
: selectOnrampProvider({
|
|
136
|
+
provider: onrampOptions[0],
|
|
137
|
+
wallet: primaryWallet,
|
|
138
|
+
});
|
|
139
|
+
}, [
|
|
140
|
+
onrampOptions,
|
|
141
|
+
setDynamicWidgetView,
|
|
142
|
+
primaryWallet,
|
|
143
|
+
selectOnrampProvider,
|
|
144
|
+
]);
|
|
137
145
|
const previewWalletIcons = useMemo(() => {
|
|
138
146
|
if (!externalWalletFundingEnabled)
|
|
139
147
|
return [];
|
|
@@ -158,12 +166,16 @@ const useFundingMethods = () => {
|
|
|
158
166
|
},
|
|
159
167
|
];
|
|
160
168
|
if (primaryWallet) {
|
|
161
|
-
paymentMethods.forEach((
|
|
169
|
+
paymentMethods.forEach((option) => {
|
|
170
|
+
const { id, iconUrl, displayName } = option;
|
|
162
171
|
methods.push({
|
|
163
172
|
icon: jsx("img", { src: iconUrl, alt: displayName }),
|
|
164
173
|
key: id,
|
|
165
174
|
label: displayName,
|
|
166
|
-
onClick: () =>
|
|
175
|
+
onClick: () => selectOnrampProvider({
|
|
176
|
+
provider: option,
|
|
177
|
+
wallet: primaryWallet,
|
|
178
|
+
}),
|
|
167
179
|
showChevron: false,
|
|
168
180
|
});
|
|
169
181
|
});
|
|
@@ -206,6 +218,7 @@ const useFundingMethods = () => {
|
|
|
206
218
|
filteredLinkedWallets.length,
|
|
207
219
|
externalWalletFundingEnabled,
|
|
208
220
|
paymentMethods,
|
|
221
|
+
selectOnrampProvider,
|
|
209
222
|
handleBuyCryptoClick,
|
|
210
223
|
previewOnrampIcons,
|
|
211
224
|
startLinkedWalletFunding,
|
|
@@ -37,6 +37,7 @@ require('../../../../store/state/projectSettings/projectSettings.cjs');
|
|
|
37
37
|
require('../../../../config/ApiEndpoint.cjs');
|
|
38
38
|
require('../../../../store/state/user/user.cjs');
|
|
39
39
|
require('../../../../locale/locale.cjs');
|
|
40
|
+
var blockaid = require('../../../../data/api/transactions/blockaid.cjs');
|
|
40
41
|
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
41
42
|
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
42
43
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
@@ -48,7 +49,6 @@ require('react-dom');
|
|
|
48
49
|
require('../../../../utils/functions/compareChains/compareChains.cjs');
|
|
49
50
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
50
51
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
51
|
-
var blockaid = require('../../../../data/api/transactions/blockaid.cjs');
|
|
52
52
|
require('bs58');
|
|
53
53
|
require('@dynamic-labs/types');
|
|
54
54
|
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
@@ -33,6 +33,7 @@ import '../../../../store/state/projectSettings/projectSettings.js';
|
|
|
33
33
|
import '../../../../config/ApiEndpoint.js';
|
|
34
34
|
import '../../../../store/state/user/user.js';
|
|
35
35
|
import '../../../../locale/locale.js';
|
|
36
|
+
import { isMaliciousUrl } from '../../../../data/api/transactions/blockaid.js';
|
|
36
37
|
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
37
38
|
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
38
39
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
@@ -44,7 +45,6 @@ import 'react-dom';
|
|
|
44
45
|
import '../../../../utils/functions/compareChains/compareChains.js';
|
|
45
46
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
46
47
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
47
|
-
import { isMaliciousUrl } from '../../../../data/api/transactions/blockaid.js';
|
|
48
48
|
import 'bs58';
|
|
49
49
|
import '@dynamic-labs/types';
|
|
50
50
|
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
@@ -13,9 +13,9 @@ require('@dynamic-labs/sdk-api-core');
|
|
|
13
13
|
require('../../../../shared/logger.cjs');
|
|
14
14
|
require('@dynamic-labs/iconic');
|
|
15
15
|
require('@dynamic-labs/wallet-connector-core');
|
|
16
|
+
var accountAndSecurity = require('../../../../shared/assets/account-and-security.cjs');
|
|
16
17
|
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
17
18
|
var connectedApps = require('../../../../shared/assets/connected-apps.cjs');
|
|
18
|
-
var accountAndSecurity = require('../../../../shared/assets/account-and-security.cjs');
|
|
19
19
|
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
20
20
|
require('@dynamic-labs/wallet-book');
|
|
21
21
|
require('@dynamic-labs/utils');
|
|
@@ -132,7 +132,7 @@ const SettingsView = () => {
|
|
|
132
132
|
const isMfaEnabled = Boolean((_c = (_b = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.security) === null || _b === void 0 ? void 0 : _b.mfa) === null || _c === void 0 ? void 0 : _c.enabled);
|
|
133
133
|
const isEmbeddedWallet = Boolean(wallet && ((_e = (_d = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _d === void 0 ? void 0 : _d.key) === null || _e === void 0 ? void 0 : _e.startsWith('turnkey')));
|
|
134
134
|
const shouldShowAccountAndSecuritySettings = isMfaEnabled || isEmbeddedWallet;
|
|
135
|
-
return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.general_section.title', 'General') })), shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(accountAndSecurity.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_connectivity_section.title') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connectedApps.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsxRuntime.jsx(EmptyScreen.EmptyScreen, {})) }), jsxRuntime.jsx("div", { className: 'settings-view__logout-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx("div", { className: 'settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick,
|
|
135
|
+
return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.general_section.title', 'General') })), shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(accountAndSecurity.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_connectivity_section.title') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connectedApps.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsxRuntime.jsx(EmptyScreen.EmptyScreen, {})) }), jsxRuntime.jsx("div", { className: 'settings-view__logout-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx("div", { className: 'settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', copykey: 'dyn_settings.delete_account.title', color: 'error-1', variant: 'body_small', className: 'settings-view__delete-account-container__delete-button', weight: 'medium', children: t('dyn_settings.delete_account.title') }) }))] }));
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
exports.SettingsView = SettingsView;
|