@dynamic-labs/sdk-react-core 4.50.5 → 4.51.2
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 +30 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +14 -14
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
- package/src/lib/context/CaptchaContext/CaptchaContext.cjs +88 -1
- package/src/lib/context/CaptchaContext/CaptchaContext.js +88 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +19 -0
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +20 -1
- package/src/lib/data/api/constants.cjs +12 -0
- package/src/lib/data/api/constants.d.ts +3 -0
- package/src/lib/data/api/constants.js +6 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +12 -1
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +12 -1
- package/src/lib/data/api/user/user.cjs +19 -0
- package/src/lib/data/api/user/user.d.ts +5 -0
- package/src/lib/data/api/user/user.js +19 -1
- package/src/lib/store/stateConfig.cjs +39 -35
- package/src/lib/store/stateConfig.js +39 -35
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.cjs +33 -1
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.d.ts +11 -0
- package/src/lib/utils/functions/clientSessionKeys/getClientSessionKeys.js +32 -2
- package/src/lib/utils/hooks/authenticationHooks/helpers/isConnectOnly.cjs +1 -32
- package/src/lib/utils/hooks/authenticationHooks/helpers/isConnectOnly.js +1 -32
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -1
- package/src/lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.cjs +1 -1
- package/src/lib/utils/hooks/useAuthenticatePasskeyMFA/useAuthenticatePasskeyMFA.js +1 -1
- package/src/lib/utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.cjs +1 -4
- package/src/lib/utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.js +1 -4
- package/src/lib/utils/hooks/useRegisterPasskey/useRegisterPasskey.cjs +8 -1
- package/src/lib/utils/hooks/useRegisterPasskey/useRegisterPasskey.js +8 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +2 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +4 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +2 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.cjs +131 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.d.ts +6 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.js +127 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs +3 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.d.ts +2 -0
- package/src/lib/utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js +3 -1
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +38 -15
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.d.ts +8 -2
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +38 -15
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +14 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.js +15 -3
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +10 -2
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +10 -2
- package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.cjs +18 -18
- package/src/lib/widgets/DynamicWidget/views/WalletsDelegatedSettingsView/WalletsDelegatedSettingsView.js +18 -18
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
9
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
10
|
+
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
11
|
+
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
12
|
+
require('@dynamic-labs/iconic');
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
+
require('react/jsx-runtime');
|
|
15
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
+
require('../../../../shared/logger.cjs');
|
|
17
|
+
require('@dynamic-labs/wallet-book');
|
|
18
|
+
require('../../../constants/colors.cjs');
|
|
19
|
+
require('../../../constants/values.cjs');
|
|
20
|
+
require('../../../../shared/consts/index.cjs');
|
|
21
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
22
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
23
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
|
+
require('@dynamic-labs/multi-wallet');
|
|
25
|
+
require('react-international-phone');
|
|
26
|
+
require('../../../../store/state/nonce/nonce.cjs');
|
|
27
|
+
require('@dynamic-labs-sdk/client/core');
|
|
28
|
+
var client = require('../../../../client/client.cjs');
|
|
29
|
+
require('@dynamic-labs-sdk/client');
|
|
30
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
31
|
+
require('@dynamic-labs/locale');
|
|
32
|
+
var user = require('../../../../data/api/user/user.cjs');
|
|
33
|
+
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
34
|
+
var primaryWalletId = require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
35
|
+
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
36
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
37
|
+
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
38
|
+
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
39
|
+
require('../../../../store/state/authMode/authMode.cjs');
|
|
40
|
+
require('../../../../context/VerificationContext/VerificationContext.cjs');
|
|
41
|
+
require('react-dom');
|
|
42
|
+
require('../../../functions/compareChains/compareChains.cjs');
|
|
43
|
+
require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
44
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
45
|
+
require('../useUpdateUser/userFieldsSchema.cjs');
|
|
46
|
+
require('bs58');
|
|
47
|
+
require('@dynamic-labs/types');
|
|
48
|
+
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
49
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
50
|
+
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
51
|
+
require('../../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
52
|
+
require('yup');
|
|
53
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
54
|
+
require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
55
|
+
require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
56
|
+
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
57
|
+
require('@dynamic-labs/rpc-providers');
|
|
58
|
+
require('../../../../store/state/walletOptions/walletOptions.cjs');
|
|
59
|
+
require('react-i18next');
|
|
60
|
+
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
61
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
62
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
63
|
+
require('../../../../components/IconButton/IconButton.cjs');
|
|
64
|
+
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
65
|
+
require('../../../../components/Input/Input.cjs');
|
|
66
|
+
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
67
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
68
|
+
require('../../../../components/OverlayCard/OverlayCard.cjs');
|
|
69
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
70
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
71
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
72
|
+
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
73
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
74
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
75
|
+
require('react-focus-lock');
|
|
76
|
+
require('qrcode');
|
|
77
|
+
require('formik');
|
|
78
|
+
require('../../useSubdomainCheck/useSubdomainCheck.cjs');
|
|
79
|
+
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
80
|
+
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
81
|
+
require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
82
|
+
require('../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
83
|
+
require('@hcaptcha/react-hcaptcha');
|
|
84
|
+
require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
85
|
+
require('../../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
86
|
+
require('../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
87
|
+
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
88
|
+
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
89
|
+
require('../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
90
|
+
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
91
|
+
require('../../../../context/OnrampContext/OnrampContext.cjs');
|
|
92
|
+
require('../../../../store/state/sendBalances.cjs');
|
|
93
|
+
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
94
|
+
require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
95
|
+
require('../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
96
|
+
require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
97
|
+
require('../../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
98
|
+
require('../../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
|
|
99
|
+
require('../../../../../index.cjs');
|
|
100
|
+
require('../../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
101
|
+
require('../../../../store/state/tokenBalances.cjs');
|
|
102
|
+
require('../../../../store/state/multichainBalances.cjs');
|
|
103
|
+
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
104
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
105
|
+
|
|
106
|
+
const useUnlinkUserEmail = () => {
|
|
107
|
+
const { environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
108
|
+
const unlinkUserEmail = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ verifiedCredentialId }) {
|
|
109
|
+
var _b;
|
|
110
|
+
const user$1 = (_b = client.getDynamicClient()) === null || _b === void 0 ? void 0 : _b.user;
|
|
111
|
+
const primaryWalletId$1 = primaryWalletId.getPrimaryWalletId();
|
|
112
|
+
if (!primaryWalletId$1) {
|
|
113
|
+
throw new utils.DynamicError('Primary wallet not found');
|
|
114
|
+
}
|
|
115
|
+
const verifiedCredential = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.find((credential) => credential.id === verifiedCredentialId);
|
|
116
|
+
if (!verifiedCredential) {
|
|
117
|
+
throw new utils.DynamicError('Verified credential not found');
|
|
118
|
+
}
|
|
119
|
+
if (verifiedCredential.format !== sdkApiCore.JwtVerifiedCredentialFormatEnum.Email) {
|
|
120
|
+
throw new utils.DynamicError('Verified credential is not an email');
|
|
121
|
+
}
|
|
122
|
+
return user.unlinkEmail({
|
|
123
|
+
environmentId,
|
|
124
|
+
primaryWalletId: primaryWalletId$1,
|
|
125
|
+
verifiedCredentialId,
|
|
126
|
+
});
|
|
127
|
+
}), [environmentId]);
|
|
128
|
+
return unlinkUserEmail;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
exports.useUnlinkUserEmail = useUnlinkUserEmail;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UserProfile } from '@dynamic-labs/types';
|
|
2
|
+
export type UnlinkUserEmailArgs = {
|
|
3
|
+
verifiedCredentialId: string;
|
|
4
|
+
};
|
|
5
|
+
export type UnlinkUserEmail = (args: UnlinkUserEmailArgs) => Promise<UserProfile | undefined>;
|
|
6
|
+
export declare const useUnlinkUserEmail: () => UnlinkUserEmail;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
5
|
+
import { JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
7
|
+
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
8
|
+
import '@dynamic-labs/iconic';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
+
import 'react/jsx-runtime';
|
|
11
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
12
|
+
import '../../../../shared/logger.js';
|
|
13
|
+
import '@dynamic-labs/wallet-book';
|
|
14
|
+
import '../../../constants/colors.js';
|
|
15
|
+
import '../../../constants/values.js';
|
|
16
|
+
import '../../../../shared/consts/index.js';
|
|
17
|
+
import '../../../../events/dynamicEvents.js';
|
|
18
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
19
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
20
|
+
import '@dynamic-labs/multi-wallet';
|
|
21
|
+
import 'react-international-phone';
|
|
22
|
+
import '../../../../store/state/nonce/nonce.js';
|
|
23
|
+
import '@dynamic-labs-sdk/client/core';
|
|
24
|
+
import { getDynamicClient } from '../../../../client/client.js';
|
|
25
|
+
import '@dynamic-labs-sdk/client';
|
|
26
|
+
import '../../../../config/ApiEndpoint.js';
|
|
27
|
+
import '@dynamic-labs/locale';
|
|
28
|
+
import { unlinkEmail } from '../../../../data/api/user/user.js';
|
|
29
|
+
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
30
|
+
import { getPrimaryWalletId } from '../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
31
|
+
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
32
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
33
|
+
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
34
|
+
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
35
|
+
import '../../../../store/state/authMode/authMode.js';
|
|
36
|
+
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
37
|
+
import 'react-dom';
|
|
38
|
+
import '../../../functions/compareChains/compareChains.js';
|
|
39
|
+
import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
40
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
41
|
+
import '../useUpdateUser/userFieldsSchema.js';
|
|
42
|
+
import 'bs58';
|
|
43
|
+
import '@dynamic-labs/types';
|
|
44
|
+
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
45
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
46
|
+
import '../../../../context/WalletContext/WalletContext.js';
|
|
47
|
+
import '../../useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
48
|
+
import 'yup';
|
|
49
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
50
|
+
import '../../../../views/CollectUserDataView/useFields.js';
|
|
51
|
+
import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
52
|
+
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
53
|
+
import '@dynamic-labs/rpc-providers';
|
|
54
|
+
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
55
|
+
import 'react-i18next';
|
|
56
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
57
|
+
import '../../../../components/Alert/Alert.js';
|
|
58
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
59
|
+
import '../../../../components/IconButton/IconButton.js';
|
|
60
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
61
|
+
import '../../../../components/Input/Input.js';
|
|
62
|
+
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
63
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
64
|
+
import '../../../../components/OverlayCard/OverlayCard.js';
|
|
65
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
66
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
67
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
68
|
+
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
69
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
70
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
71
|
+
import 'react-focus-lock';
|
|
72
|
+
import 'qrcode';
|
|
73
|
+
import 'formik';
|
|
74
|
+
import '../../useSubdomainCheck/useSubdomainCheck.js';
|
|
75
|
+
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
76
|
+
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
77
|
+
import '../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
78
|
+
import '../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
79
|
+
import '@hcaptcha/react-hcaptcha';
|
|
80
|
+
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
81
|
+
import '../../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
82
|
+
import '../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
83
|
+
import '../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
84
|
+
import '../../../../context/FooterAnimationContext/index.js';
|
|
85
|
+
import '../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
86
|
+
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
87
|
+
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
88
|
+
import '../../../../store/state/sendBalances.js';
|
|
89
|
+
import '../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
90
|
+
import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
91
|
+
import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
92
|
+
import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
93
|
+
import '../../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
94
|
+
import '../../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
|
|
95
|
+
import '../../../../../index.js';
|
|
96
|
+
import '../../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
97
|
+
import '../../../../store/state/tokenBalances.js';
|
|
98
|
+
import '../../../../store/state/multichainBalances.js';
|
|
99
|
+
import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
100
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
101
|
+
|
|
102
|
+
const useUnlinkUserEmail = () => {
|
|
103
|
+
const { environmentId } = useInternalDynamicContext();
|
|
104
|
+
const unlinkUserEmail = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ verifiedCredentialId }) {
|
|
105
|
+
var _b;
|
|
106
|
+
const user = (_b = getDynamicClient()) === null || _b === void 0 ? void 0 : _b.user;
|
|
107
|
+
const primaryWalletId = getPrimaryWalletId();
|
|
108
|
+
if (!primaryWalletId) {
|
|
109
|
+
throw new DynamicError('Primary wallet not found');
|
|
110
|
+
}
|
|
111
|
+
const verifiedCredential = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.id === verifiedCredentialId);
|
|
112
|
+
if (!verifiedCredential) {
|
|
113
|
+
throw new DynamicError('Verified credential not found');
|
|
114
|
+
}
|
|
115
|
+
if (verifiedCredential.format !== JwtVerifiedCredentialFormatEnum.Email) {
|
|
116
|
+
throw new DynamicError('Verified credential is not an email');
|
|
117
|
+
}
|
|
118
|
+
return unlinkEmail({
|
|
119
|
+
environmentId,
|
|
120
|
+
primaryWalletId,
|
|
121
|
+
verifiedCredentialId,
|
|
122
|
+
});
|
|
123
|
+
}), [environmentId]);
|
|
124
|
+
return unlinkUserEmail;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export { useUnlinkUserEmail };
|
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var useUpdateUser = require('./useUpdateUser/useUpdateUser.cjs');
|
|
7
7
|
var useUpdateUserWithModal = require('./useUpdateUserWithModal/useUpdateUserWithModal.cjs');
|
|
8
|
+
var unlinkUserEmail = require('./unlinkUserEmail/unlinkUserEmail.cjs');
|
|
8
9
|
|
|
9
10
|
// Hook only available internally
|
|
10
11
|
const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
11
12
|
const updateUser = useUpdateUser.useUpdateUser(validationSchemaStripUnknown);
|
|
12
13
|
const updateUserWithModal = useUpdateUserWithModal.useUpdateUserWithModal(updateUser);
|
|
13
|
-
|
|
14
|
+
const unlinkUserEmail$1 = unlinkUserEmail.useUnlinkUserEmail();
|
|
15
|
+
return { unlinkUserEmail: unlinkUserEmail$1, updateUser, updateUserWithModal };
|
|
14
16
|
};
|
|
15
17
|
// Hook exposed to the clients
|
|
16
18
|
// We do not want customers to be able to edit properties such as policiesConsent or captchaToken
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export declare const useUserUpdateRequestInternal: ({ validationSchemaStripUnknown, }: {
|
|
2
2
|
validationSchemaStripUnknown: boolean;
|
|
3
3
|
}) => {
|
|
4
|
+
unlinkUserEmail: import("./unlinkUserEmail/unlinkUserEmail").UnlinkUserEmail;
|
|
4
5
|
updateUser: import("./useUpdateUser").UpdateUser;
|
|
5
6
|
updateUserWithModal: (fields: import("./useUpdateUserWithModal").UpdateUserWithModalFields, options?: import("./useUpdateUserWithModal").UpdateUserWithModalOptions | undefined) => Promise<import("@dynamic-labs/sdk-api-core").UserFields>;
|
|
6
7
|
};
|
|
7
8
|
export declare const useUserUpdateRequest: () => {
|
|
9
|
+
unlinkUserEmail: import("./unlinkUserEmail/unlinkUserEmail").UnlinkUserEmail;
|
|
8
10
|
updateUser: import("./useUpdateUser").UpdateUser;
|
|
9
11
|
updateUserWithModal: (fields: import("./useUpdateUserWithModal").UpdateUserWithModalFields, options?: import("./useUpdateUserWithModal").UpdateUserWithModalOptions | undefined) => Promise<import("@dynamic-labs/sdk-api-core").UserFields>;
|
|
10
12
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { useUpdateUser } from './useUpdateUser/useUpdateUser.js';
|
|
3
3
|
import { useUpdateUserWithModal } from './useUpdateUserWithModal/useUpdateUserWithModal.js';
|
|
4
|
+
import { useUnlinkUserEmail } from './unlinkUserEmail/unlinkUserEmail.js';
|
|
4
5
|
|
|
5
6
|
// Hook only available internally
|
|
6
7
|
const useUserUpdateRequestInternal = ({ validationSchemaStripUnknown, }) => {
|
|
7
8
|
const updateUser = useUpdateUser(validationSchemaStripUnknown);
|
|
8
9
|
const updateUserWithModal = useUpdateUserWithModal(updateUser);
|
|
9
|
-
|
|
10
|
+
const unlinkUserEmail = useUnlinkUserEmail();
|
|
11
|
+
return { unlinkUserEmail, updateUser, updateUserWithModal };
|
|
10
12
|
};
|
|
11
13
|
// Hook exposed to the clients
|
|
12
14
|
// We do not want customers to be able to edit properties such as policiesConsent or captchaToken
|
|
@@ -115,11 +115,12 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
115
115
|
* Otherwise, returns all pending wallets from getWalletsDelegatedStatus.
|
|
116
116
|
*/
|
|
117
117
|
const getWalletsToDelegate = (wallets, getWalletsDelegatedStatus) => {
|
|
118
|
+
const walletsWithDelegationStatus = getWalletsDelegatedStatus().filter((wallet) => wallet.status === 'pending');
|
|
118
119
|
if (wallets && wallets.length > 0) {
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
return walletsWithDelegationStatus.filter((wallet) => wallets.some((w) => w.accountAddress === wallet.address &&
|
|
121
|
+
w.chainName === wallet.chain));
|
|
121
122
|
}
|
|
122
|
-
return
|
|
123
|
+
return walletsWithDelegationStatus;
|
|
123
124
|
};
|
|
124
125
|
// Hook to trigger wallet delegation modal
|
|
125
126
|
const useWalletDelegation = () => {
|
|
@@ -222,23 +223,45 @@ const useWalletDelegation = () => {
|
|
|
222
223
|
.filter((wallet) => wallet !== null);
|
|
223
224
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials, userWallets]);
|
|
224
225
|
const delegateKeyShares = React.useCallback((wallets) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
226
|
+
if (!delegatedAccessEnabled) {
|
|
227
|
+
throw new Error('Wallet delegation is not enabled for this project environment. Please check the project settings.');
|
|
228
|
+
}
|
|
229
|
+
// If wallets provided, only eligible wallets are returned; otherwise get pending wallets
|
|
230
|
+
const walletsToDelegate = getWalletsToDelegate(wallets, getWalletsDelegatedStatus).map((wallet) => ({
|
|
231
|
+
accountAddress: wallet.address,
|
|
232
|
+
chainName: wallet.chain,
|
|
233
|
+
}));
|
|
234
|
+
if (walletsToDelegate.length === 0) {
|
|
235
|
+
throw new Error('No eligible wallets to delegate, only Dynamic WaaS wallets are eligible for delegation');
|
|
236
|
+
}
|
|
232
237
|
for (const wallet of walletsToDelegate) {
|
|
233
238
|
const walletConnector = getWaasWalletConnector(wallet.chainName);
|
|
234
|
-
if (!walletConnector)
|
|
239
|
+
if (!walletConnector) {
|
|
240
|
+
logger.logger.warn('Wallet connector not found, skipping delegate', {
|
|
241
|
+
accountAddress: wallet.accountAddress,
|
|
242
|
+
chainName: wallet.chainName,
|
|
243
|
+
});
|
|
235
244
|
continue;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
yield walletConnector.delegateKeyShares({
|
|
248
|
+
accountAddress: wallet.accountAddress,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
logger.logger.error('Failed to delegate key shares:', {
|
|
253
|
+
error,
|
|
254
|
+
wallet,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
239
257
|
}
|
|
240
258
|
yield refresh();
|
|
241
|
-
}), [
|
|
259
|
+
}), [
|
|
260
|
+
getWaasWalletConnector,
|
|
261
|
+
refresh,
|
|
262
|
+
getWalletsDelegatedStatus,
|
|
263
|
+
delegatedAccessEnabled,
|
|
264
|
+
]);
|
|
242
265
|
const revokeDelegation = React.useCallback((wallets) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
243
266
|
// Get current wallet statuses to check which ones are actually delegated
|
|
244
267
|
const walletsWithStatus = getWalletsDelegatedStatus();
|
|
@@ -10,7 +10,10 @@ export type WalletWithStatus = Wallet & {
|
|
|
10
10
|
* If wallets are provided and not empty, converts them to WalletWithStatus[] with pending status.
|
|
11
11
|
* Otherwise, returns all pending wallets from getWalletsDelegatedStatus.
|
|
12
12
|
*/
|
|
13
|
-
export declare const getWalletsToDelegate: (wallets:
|
|
13
|
+
export declare const getWalletsToDelegate: (wallets: {
|
|
14
|
+
chainName: ChainEnum;
|
|
15
|
+
accountAddress: string;
|
|
16
|
+
}[] | undefined, getWalletsDelegatedStatus: () => WalletWithStatus[]) => WalletWithStatus[];
|
|
14
17
|
export declare const useWalletDelegation: () => {
|
|
15
18
|
readonly clearDelegationSessionState: () => void;
|
|
16
19
|
readonly delegateKeyShares: (wallets?: {
|
|
@@ -21,7 +24,10 @@ export declare const useWalletDelegation: () => {
|
|
|
21
24
|
readonly denyWalletDelegation: (walletId: string) => Promise<void>;
|
|
22
25
|
readonly dismissDelegationPrompt: (walletId?: string) => void;
|
|
23
26
|
readonly getWalletsDelegatedStatus: () => WalletWithStatus[];
|
|
24
|
-
readonly getWalletsToDelegate: (wallets:
|
|
27
|
+
readonly getWalletsToDelegate: (wallets: {
|
|
28
|
+
chainName: ChainEnum;
|
|
29
|
+
accountAddress: string;
|
|
30
|
+
}[] | undefined, getWalletsDelegatedStatus: () => WalletWithStatus[]) => WalletWithStatus[];
|
|
25
31
|
readonly initDelegationProcess: (options?: {
|
|
26
32
|
wallets?: Wallet[];
|
|
27
33
|
}) => Promise<void>;
|
|
@@ -111,11 +111,12 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
111
111
|
* Otherwise, returns all pending wallets from getWalletsDelegatedStatus.
|
|
112
112
|
*/
|
|
113
113
|
const getWalletsToDelegate = (wallets, getWalletsDelegatedStatus) => {
|
|
114
|
+
const walletsWithDelegationStatus = getWalletsDelegatedStatus().filter((wallet) => wallet.status === 'pending');
|
|
114
115
|
if (wallets && wallets.length > 0) {
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
return walletsWithDelegationStatus.filter((wallet) => wallets.some((w) => w.accountAddress === wallet.address &&
|
|
117
|
+
w.chainName === wallet.chain));
|
|
117
118
|
}
|
|
118
|
-
return
|
|
119
|
+
return walletsWithDelegationStatus;
|
|
119
120
|
};
|
|
120
121
|
// Hook to trigger wallet delegation modal
|
|
121
122
|
const useWalletDelegation = () => {
|
|
@@ -218,23 +219,45 @@ const useWalletDelegation = () => {
|
|
|
218
219
|
.filter((wallet) => wallet !== null);
|
|
219
220
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials, userWallets]);
|
|
220
221
|
const delegateKeyShares = useCallback((wallets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
222
|
+
if (!delegatedAccessEnabled) {
|
|
223
|
+
throw new Error('Wallet delegation is not enabled for this project environment. Please check the project settings.');
|
|
224
|
+
}
|
|
225
|
+
// If wallets provided, only eligible wallets are returned; otherwise get pending wallets
|
|
226
|
+
const walletsToDelegate = getWalletsToDelegate(wallets, getWalletsDelegatedStatus).map((wallet) => ({
|
|
227
|
+
accountAddress: wallet.address,
|
|
228
|
+
chainName: wallet.chain,
|
|
229
|
+
}));
|
|
230
|
+
if (walletsToDelegate.length === 0) {
|
|
231
|
+
throw new Error('No eligible wallets to delegate, only Dynamic WaaS wallets are eligible for delegation');
|
|
232
|
+
}
|
|
228
233
|
for (const wallet of walletsToDelegate) {
|
|
229
234
|
const walletConnector = getWaasWalletConnector(wallet.chainName);
|
|
230
|
-
if (!walletConnector)
|
|
235
|
+
if (!walletConnector) {
|
|
236
|
+
logger.warn('Wallet connector not found, skipping delegate', {
|
|
237
|
+
accountAddress: wallet.accountAddress,
|
|
238
|
+
chainName: wallet.chainName,
|
|
239
|
+
});
|
|
231
240
|
continue;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
241
|
+
}
|
|
242
|
+
try {
|
|
243
|
+
yield walletConnector.delegateKeyShares({
|
|
244
|
+
accountAddress: wallet.accountAddress,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
logger.error('Failed to delegate key shares:', {
|
|
249
|
+
error,
|
|
250
|
+
wallet,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
235
253
|
}
|
|
236
254
|
yield refresh();
|
|
237
|
-
}), [
|
|
255
|
+
}), [
|
|
256
|
+
getWaasWalletConnector,
|
|
257
|
+
refresh,
|
|
258
|
+
getWalletsDelegatedStatus,
|
|
259
|
+
delegatedAccessEnabled,
|
|
260
|
+
]);
|
|
238
261
|
const revokeDelegation = useCallback((wallets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
239
262
|
// Get current wallet statuses to check which ones are actually delegated
|
|
240
263
|
const walletsWithStatus = getWalletsDelegatedStatus();
|
|
@@ -107,7 +107,9 @@ require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds
|
|
|
107
107
|
var useNetworkDataFromWallet = require('../../utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.cjs');
|
|
108
108
|
var useTokenBalances = require('../../utils/hooks/useTokenBalances/useTokenBalances.cjs');
|
|
109
109
|
require('../../store/state/multichainBalances.cjs');
|
|
110
|
+
var usePromptMfaAuth = require('../../utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs');
|
|
110
111
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
112
|
+
var useIsMfaRequiredForAction = require('../../utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.cjs');
|
|
111
113
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
112
114
|
|
|
113
115
|
const usingNative = (token) => Boolean(token.isNative);
|
|
@@ -135,6 +137,8 @@ const getSupportedChainName = (connectedChain) => {
|
|
|
135
137
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
136
138
|
const [stage, setStage] = React.useState('form');
|
|
137
139
|
const { primaryWallet, walletUiUtils } = useInternalDynamicContext.useInternalDynamicContext();
|
|
140
|
+
const isMfaRequiredForAction = useIsMfaRequiredForAction.useIsMfaRequiredForAction();
|
|
141
|
+
const promptMfaAuth = usePromptMfaAuth.usePromptMfaAuth();
|
|
138
142
|
const { t } = reactI18next.useTranslation();
|
|
139
143
|
const [isNativeToken, setIsNativeToken] = React.useState(false);
|
|
140
144
|
const [currentToken, setCurrentToken] = React.useState(undefined);
|
|
@@ -221,10 +225,18 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
221
225
|
const buildFormStage = () => (jsxRuntime.jsx(SendBalancePageLayout.SendBalancePageLayout, { transaction: transaction, onClickBack: onClickBack, networkName: networkData.vanityName || networkData.name, networkIcon: currencyIcon, networkCurrencyDecimals: networkData.nativeCurrency.symbol === 'SOL'
|
|
222
226
|
? 9
|
|
223
227
|
: networkData.nativeCurrency.decimals, walletAddress: shortenWalletAddress.shortenWalletAddress(currentToken === null || currentToken === void 0 ? void 0 : currentToken.address), walletKey: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.key, onClickClose: onClickClose, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSubmit: () => setStage('confirmation'), tokenBalances: tokenBalances !== null && tokenBalances !== void 0 ? tokenBalances : (currentToken && [currentToken]), currentToken: currentToken, setCurrentToken: setCurrentToken, isLoading: isLoading, isNativeToken: isNativeToken }));
|
|
224
|
-
const buildTransactionStage = () => (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => {
|
|
228
|
+
const buildTransactionStage = () => (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
229
|
+
if (primaryWallet.connector.key === 'dynamicwaas') {
|
|
230
|
+
const isMfaRequired = yield isMfaRequiredForAction({
|
|
231
|
+
mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
|
|
232
|
+
});
|
|
233
|
+
if (isMfaRequired) {
|
|
234
|
+
yield promptMfaAuth({ createMfaToken: true });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
225
237
|
walletUiUtils.disabledConfirmationOnce();
|
|
226
238
|
return transaction.submit();
|
|
227
|
-
}, copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (txHash) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
239
|
+
}), copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (txHash) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
228
240
|
if (!txHash)
|
|
229
241
|
return;
|
|
230
242
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(txHash);
|
|
@@ -3,7 +3,7 @@ import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import { ChainEnum, MFAAction } from '@dynamic-labs/sdk-api-core';
|
|
7
7
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
8
8
|
import { isSendBalanceWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
9
9
|
import { ChainIcon } from '../../components/ChainIcon/ChainIcon.js';
|
|
@@ -103,7 +103,9 @@ import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.
|
|
|
103
103
|
import { useNetworkDataFromWallet } from '../../utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.js';
|
|
104
104
|
import { useTokenBalances } from '../../utils/hooks/useTokenBalances/useTokenBalances.js';
|
|
105
105
|
import '../../store/state/multichainBalances.js';
|
|
106
|
+
import { usePromptMfaAuth } from '../../utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js';
|
|
106
107
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
108
|
+
import { useIsMfaRequiredForAction } from '../../utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.js';
|
|
107
109
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
108
110
|
|
|
109
111
|
const usingNative = (token) => Boolean(token.isNative);
|
|
@@ -131,6 +133,8 @@ const getSupportedChainName = (connectedChain) => {
|
|
|
131
133
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
132
134
|
const [stage, setStage] = useState('form');
|
|
133
135
|
const { primaryWallet, walletUiUtils } = useInternalDynamicContext();
|
|
136
|
+
const isMfaRequiredForAction = useIsMfaRequiredForAction();
|
|
137
|
+
const promptMfaAuth = usePromptMfaAuth();
|
|
134
138
|
const { t } = useTranslation();
|
|
135
139
|
const [isNativeToken, setIsNativeToken] = useState(false);
|
|
136
140
|
const [currentToken, setCurrentToken] = useState(undefined);
|
|
@@ -217,10 +221,18 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
217
221
|
const buildFormStage = () => (jsx(SendBalancePageLayout, { transaction: transaction, onClickBack: onClickBack, networkName: networkData.vanityName || networkData.name, networkIcon: currencyIcon, networkCurrencyDecimals: networkData.nativeCurrency.symbol === 'SOL'
|
|
218
222
|
? 9
|
|
219
223
|
: networkData.nativeCurrency.decimals, walletAddress: shortenWalletAddress(currentToken === null || currentToken === void 0 ? void 0 : currentToken.address), walletKey: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.key, onClickClose: onClickClose, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSubmit: () => setStage('confirmation'), tokenBalances: tokenBalances !== null && tokenBalances !== void 0 ? tokenBalances : (currentToken && [currentToken]), currentToken: currentToken, setCurrentToken: setCurrentToken, isLoading: isLoading, isNativeToken: isNativeToken }));
|
|
220
|
-
const buildTransactionStage = () => (jsx(TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => {
|
|
224
|
+
const buildTransactionStage = () => (jsx(TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
225
|
+
if (primaryWallet.connector.key === 'dynamicwaas') {
|
|
226
|
+
const isMfaRequired = yield isMfaRequiredForAction({
|
|
227
|
+
mfaAction: MFAAction.WalletWaasSign,
|
|
228
|
+
});
|
|
229
|
+
if (isMfaRequired) {
|
|
230
|
+
yield promptMfaAuth({ createMfaToken: true });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
221
233
|
walletUiUtils.disabledConfirmationOnce();
|
|
222
234
|
return transaction.submit();
|
|
223
|
-
}, copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (txHash) => __awaiter(void 0, void 0, void 0, function* () {
|
|
235
|
+
}), copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), onClickBack: () => setStage('form'), onError: onError, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSuccess: (txHash) => __awaiter(void 0, void 0, void 0, function* () {
|
|
224
236
|
if (!txHash)
|
|
225
237
|
return;
|
|
226
238
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(txHash);
|
|
@@ -48,7 +48,15 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
48
48
|
const [agreementChecked, setAgreementChecked] = React.useState(false);
|
|
49
49
|
const [selectionInitialized, setSelectionInitialized] = React.useState(false);
|
|
50
50
|
// Get waas wallets that are not yet delegated or use provided wallets override
|
|
51
|
-
const waasWallets = React.useMemo(() =>
|
|
51
|
+
const waasWallets = React.useMemo(() => {
|
|
52
|
+
const walletsToDelegate = wallets
|
|
53
|
+
? wallets.map((wallet) => ({
|
|
54
|
+
accountAddress: wallet.address,
|
|
55
|
+
chainName: wallet.chain,
|
|
56
|
+
}))
|
|
57
|
+
: undefined;
|
|
58
|
+
return getWalletsToDelegate(walletsToDelegate, getWalletsDelegatedStatus);
|
|
59
|
+
}, [wallets, getWalletsDelegatedStatus, getWalletsToDelegate]);
|
|
52
60
|
// Auto-select wallets only on initial load
|
|
53
61
|
React.useEffect(() => {
|
|
54
62
|
if (selectionInitialized)
|
|
@@ -175,7 +183,7 @@ const WalletDelegationView = ({ wallets, }) => {
|
|
|
175
183
|
// Single wallet view
|
|
176
184
|
const displaySingleWallet = () => {
|
|
177
185
|
const [wallet] = waasWallets;
|
|
178
|
-
if (!wallet)
|
|
186
|
+
if (!wallet || !wallet.address)
|
|
179
187
|
return null;
|
|
180
188
|
return (jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__wallet-card-container', children: [jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__wallet-card', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'medium', color: 'primary', children: t('dyn_wallet_delegation.my_wallet') }), jsxRuntime.jsxs("div", { className: 'embedded-delegated-view__wallet-address', children: [jsxRuntime.jsx("div", { className: 'embedded-delegated-view__wallet-address-dot' }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', children: [wallet.address.slice(0, 6), "...", wallet.address.slice(-4)] })] })] }), jsxRuntime.jsx(AgreementSection.AgreementSection, { checked: agreementChecked, onToggle: () => setAgreementChecked(!agreementChecked), text: t('dyn_wallet_delegation.agreement_text') })] }));
|
|
181
189
|
};
|