@dynamic-labs/sdk-react-core 4.4.2 → 4.4.4
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 +20 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/Main.cjs +3 -3
- package/src/lib/Main.js +3 -3
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +2 -3
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +2 -3
- package/src/lib/components/HardwareWalletToggle/HardwareWalletToggle.cjs +12 -11
- package/src/lib/components/HardwareWalletToggle/HardwareWalletToggle.js +12 -11
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +2 -2
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +2 -2
- package/src/lib/components/QrCodeWrapper/QrCodeContainer/QrCodeContainer.cjs +2 -2
- package/src/lib/components/QrCodeWrapper/QrCodeContainer/QrCodeContainer.js +2 -2
- package/src/lib/components/Toggle/Toggle.cjs +1 -5
- package/src/lib/components/Toggle/Toggle.d.ts +6 -2
- package/src/lib/components/Toggle/Toggle.js +1 -5
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +2 -2
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +2 -2
- package/src/lib/components/TransactionConfirmationPageLayout/utils.cjs +2 -2
- package/src/lib/components/TransactionConfirmationPageLayout/utils.d.ts +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/utils.js +2 -2
- package/src/lib/context/CaptchaContext/CaptchaContext.cjs +3 -3
- package/src/lib/context/CaptchaContext/CaptchaContext.js +3 -3
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.cjs +1 -1
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +7 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +8 -2
- package/src/lib/context/MockContext/MockContext.cjs +0 -2
- package/src/lib/context/MockContext/MockContext.js +0 -2
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +5 -5
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +5 -5
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +8 -9
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +8 -9
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +8 -3
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +8 -3
- package/src/lib/context/ViewContext/ViewContext.cjs +0 -2
- package/src/lib/context/ViewContext/ViewContext.d.ts +0 -10
- package/src/lib/context/ViewContext/ViewContext.js +0 -2
- package/src/lib/context/ViewContext/types/index.d.ts +1 -2
- package/src/lib/context/WalletGroupContext/WalletGroupContext.cjs +3 -3
- package/src/lib/context/WalletGroupContext/WalletGroupContext.js +3 -3
- package/src/lib/data/api/exchangeRates/exchangeRates.cjs +9 -5
- package/src/lib/data/api/exchangeRates/exchangeRates.js +9 -5
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +2 -6
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +2 -6
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +4 -4
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +4 -4
- package/src/lib/store/internalImplementation/store.cjs +1 -0
- package/src/lib/store/internalImplementation/store.d.ts +5 -1
- package/src/lib/store/internalImplementation/store.js +1 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.cjs +4 -0
- package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.js +4 -0
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.cjs +3 -3
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.d.ts +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.js +3 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +8 -8
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +8 -8
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +7 -7
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +7 -7
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +2 -2
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs +5 -0
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js +5 -0
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +3 -3
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +3 -3
- package/src/lib/utils/hooks/useDynamicModals/useDynamicModals.cjs +3 -3
- package/src/lib/utils/hooks/useDynamicModals/useDynamicModals.js +3 -3
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +3 -3
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +3 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +3 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +3 -3
- package/src/lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.cjs +2 -2
- package/src/lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.js +2 -2
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +4 -4
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +4 -4
- package/src/lib/utils/hooks/useFunding/useConnectWalletForFunding/useConnectWalletForFunding.cjs +28 -10
- package/src/lib/utils/hooks/useFunding/useConnectWalletForFunding/useConnectWalletForFunding.js +25 -7
- package/src/lib/utils/hooks/useHandleWalletsToConnect/useHandleWalletsToConnect.cjs +6 -6
- package/src/lib/utils/hooks/useHandleWalletsToConnect/useHandleWalletsToConnect.js +6 -6
- package/src/lib/utils/hooks/useInitEmbeddedWalletAuthMethod/useInitEmbeddedWalletAuthMethod.cjs +2 -2
- package/src/lib/utils/hooks/useInitEmbeddedWalletAuthMethod/useInitEmbeddedWalletAuthMethod.js +2 -2
- package/src/lib/utils/hooks/useMfaModals/useMfaModals.cjs +12 -12
- package/src/lib/utils/hooks/useMfaModals/useMfaModals.js +12 -12
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +5 -7
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +5 -7
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +38 -24
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +3 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +38 -24
- package/src/lib/utils/hooks/useSwitchNetwork/useSwitchNetwork.cjs +3 -3
- package/src/lib/utils/hooks/useSwitchNetwork/useSwitchNetwork.js +3 -3
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.cjs +5 -5
- package/src/lib/utils/hooks/useSyncMfaFlow/useSyncMfaFlow.js +5 -5
- package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.cjs +5 -5
- package/src/lib/utils/hooks/useSyncOnboardingFlow/useSyncOnboardingFlow.js +5 -5
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +9 -9
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +9 -9
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs +6 -6
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js +6 -6
- package/src/lib/utils/hooks/useValidateSession/handleStoreVersionChanged/handleStoreVersionChanged.cjs +12 -0
- package/src/lib/utils/hooks/useValidateSession/handleStoreVersionChanged/handleStoreVersionChanged.d.ts +7 -0
- package/src/lib/utils/hooks/useValidateSession/handleStoreVersionChanged/handleStoreVersionChanged.js +8 -0
- package/src/lib/utils/hooks/useValidateSession/handleStoreVersionChanged/index.d.ts +1 -0
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +5 -3
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.d.ts +3 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +5 -3
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +12 -12
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +12 -12
- package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.cjs +8 -8
- package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.js +8 -8
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +14 -22
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.d.ts +6 -5
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +14 -22
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.cjs +3 -3
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +3 -3
- package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.cjs +2 -2
- package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.js +2 -2
- package/src/lib/views/BridgeWelcomeView/BridgeWelcomeView.cjs +2 -2
- package/src/lib/views/BridgeWelcomeView/BridgeWelcomeView.js +2 -2
- package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.cjs +2 -2
- package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.js +2 -2
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +3 -3
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +3 -3
- package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -4
- package/src/lib/views/EmailVerification/EmailVerification.js +4 -4
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +2 -2
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +2 -2
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +4 -4
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +4 -4
- package/src/lib/views/LoginView/LoginView.cjs +2 -2
- package/src/lib/views/LoginView/LoginView.js +2 -2
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +4 -4
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +4 -4
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/useSubmitPhoneNumber/useSubmitPhoneNumber.cjs +3 -3
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/useSubmitPhoneNumber/useSubmitPhoneNumber.js +3 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +5 -5
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +5 -5
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +3 -3
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +3 -3
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs +4 -4
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js +4 -4
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +4 -9
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +4 -9
- package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.cjs +8 -10
- package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.js +8 -10
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +5 -5
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +5 -5
- package/src/lib/views/NoAccess/NoAccess.cjs +2 -2
- package/src/lib/views/NoAccess/NoAccess.js +2 -2
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +2 -4
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +2 -4
- package/src/lib/views/SandboxMaximumThresholdReached/SandboxMaximumThresholdReached.cjs +2 -2
- package/src/lib/views/SandboxMaximumThresholdReached/SandboxMaximumThresholdReached.js +2 -2
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +2 -2
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +2 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +2 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +2 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +2 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +2 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +2 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.js +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.cjs +3 -3
- package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.js +3 -3
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +9 -4
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +10 -5
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/useStartExternalWalletFunding.cjs +0 -17
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useStartExternalWalletFunding/useStartExternalWalletFunding.js +0 -17
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +3 -3
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.cjs +4 -4
- package/src/lib/widgets/DynamicWidget/views/GlobalWalletView/GlobalWalletView.js +4 -4
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +2 -2
package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.cjs
CHANGED
|
@@ -39,6 +39,10 @@ const groupWalletOptions = (walletGroups, walletOptionList) => {
|
|
|
39
39
|
return output.push(currentWalletOption);
|
|
40
40
|
}
|
|
41
41
|
const walletGroupData = walletGroups[currentWalletOption.group];
|
|
42
|
+
// If for some reason this is undefined, ignore it
|
|
43
|
+
if (!walletGroupData) {
|
|
44
|
+
return output.push(currentWalletOption);
|
|
45
|
+
}
|
|
42
46
|
const walletGroup = {
|
|
43
47
|
groupedWallets: [currentWalletOption],
|
|
44
48
|
key: walletGroupData.key,
|
package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.js
CHANGED
|
@@ -35,6 +35,10 @@ const groupWalletOptions = (walletGroups, walletOptionList) => {
|
|
|
35
35
|
return output.push(currentWalletOption);
|
|
36
36
|
}
|
|
37
37
|
const walletGroupData = walletGroups[currentWalletOption.group];
|
|
38
|
+
// If for some reason this is undefined, ignore it
|
|
39
|
+
if (!walletGroupData) {
|
|
40
|
+
return output.push(currentWalletOption);
|
|
41
|
+
}
|
|
38
42
|
const walletGroup = {
|
|
39
43
|
groupedWallets: [currentWalletOption],
|
|
40
44
|
key: walletGroupData.key,
|
|
@@ -7,7 +7,7 @@ var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var getWalletProvider = require('../../../functions/getWalletProvider/getWalletProvider.cjs');
|
|
8
8
|
|
|
9
9
|
const specialCareWallets = ['bloctoevm', 'perawallet', 'metamaskstarknet'];
|
|
10
|
-
const showPendingConnectView = (walletConnector,
|
|
10
|
+
const showPendingConnectView = (walletConnector, pushView) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
11
|
const walletProvider = getWalletProvider.getWalletProvider(walletConnector);
|
|
12
12
|
// We don't want to show the pending connect view for qrCode and walletConnect
|
|
13
13
|
// They have their own view with qrCode so we don't need to show the pending connect view
|
|
@@ -19,13 +19,13 @@ const showPendingConnectView = (walletConnector, setView) => _tslib.__awaiter(vo
|
|
|
19
19
|
// bloctoevm and some other wallets works different as Justin mentioned in this commit:
|
|
20
20
|
// https://github.com/dynamic-labs/DynamicAuth/commit/57233d3620611bc91439f3d4587b8516f8d16f99
|
|
21
21
|
// It needs to show the connect view before getting connected accounts
|
|
22
|
-
|
|
22
|
+
pushView('pending-connect');
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const connectedAccounts = yield walletConnector.getConnectedAccounts();
|
|
26
26
|
/* istanbul ignore else */
|
|
27
27
|
if (connectedAccounts.length === 0) {
|
|
28
|
-
|
|
28
|
+
pushView('pending-connect');
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
import { ViewType } from '../../../../context/ViewContext';
|
|
3
|
-
export declare const showPendingConnectView: (walletConnector: WalletConnector,
|
|
3
|
+
export declare const showPendingConnectView: (walletConnector: WalletConnector, pushView: (view: ViewType) => void) => Promise<void>;
|
|
@@ -3,7 +3,7 @@ import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { getWalletProvider } from '../../../functions/getWalletProvider/getWalletProvider.js';
|
|
4
4
|
|
|
5
5
|
const specialCareWallets = ['bloctoevm', 'perawallet', 'metamaskstarknet'];
|
|
6
|
-
const showPendingConnectView = (walletConnector,
|
|
6
|
+
const showPendingConnectView = (walletConnector, pushView) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
7
|
const walletProvider = getWalletProvider(walletConnector);
|
|
8
8
|
// We don't want to show the pending connect view for qrCode and walletConnect
|
|
9
9
|
// They have their own view with qrCode so we don't need to show the pending connect view
|
|
@@ -15,13 +15,13 @@ const showPendingConnectView = (walletConnector, setView) => __awaiter(void 0, v
|
|
|
15
15
|
// bloctoevm and some other wallets works different as Justin mentioned in this commit:
|
|
16
16
|
// https://github.com/dynamic-labs/DynamicAuth/commit/57233d3620611bc91439f3d4587b8516f8d16f99
|
|
17
17
|
// It needs to show the connect view before getting connected accounts
|
|
18
|
-
|
|
18
|
+
pushView('pending-connect');
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
const connectedAccounts = yield walletConnector.getConnectedAccounts();
|
|
22
22
|
/* istanbul ignore else */
|
|
23
23
|
if (connectedAccounts.length === 0) {
|
|
24
|
-
|
|
24
|
+
pushView('pending-connect');
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
9
|
var CaptchaContext = require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
10
10
|
require('react');
|
|
11
11
|
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
@@ -99,7 +99,7 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
99
99
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
100
100
|
|
|
101
101
|
const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = true, } = {}) => {
|
|
102
|
-
const {
|
|
102
|
+
const { pushView, clearStackAndPushInitialView, replaceView } = ViewContext.useViewContext();
|
|
103
103
|
const { engageCaptcha, getCaptchaToken } = CaptchaContext.useCaptchaContext();
|
|
104
104
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
105
105
|
const { authMode, connectWallet, displaySiweStatement, environmentId, projectSettings, networkValidationMode, setIsSingleWalletAccount, user, walletUiUtils, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -130,18 +130,18 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
130
130
|
if (!userCancelled)
|
|
131
131
|
logger.logger.debug(err);
|
|
132
132
|
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString());
|
|
133
|
-
|
|
133
|
+
clearStackAndPushInitialView();
|
|
134
134
|
};
|
|
135
135
|
return (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ walletConnector, getAddressOpts = undefined, }) {
|
|
136
136
|
var _b;
|
|
137
137
|
try {
|
|
138
|
-
yield showPendingConnectView.showPendingConnectView(walletConnector,
|
|
138
|
+
yield showPendingConnectView.showPendingConnectView(walletConnector, pushView);
|
|
139
139
|
if (walletConnectorCore.isEmailWalletConnector(walletConnector)) {
|
|
140
140
|
if (walletConnectorCore.isEmailOTPWalletConnector(walletConnector)) {
|
|
141
|
-
|
|
141
|
+
pushView('email-wallet-otp-verification-view');
|
|
142
142
|
}
|
|
143
143
|
else if (!walletConnectorCore.isBloctoConnector(walletConnector)) {
|
|
144
|
-
|
|
144
|
+
pushView('wait-for-email-confirmation-view');
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
const connectionResult = yield connectWallet(walletConnector, getAddressOpts, {
|
|
@@ -160,9 +160,9 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
160
160
|
networkValidationMode === 'sign-in';
|
|
161
161
|
if (!usesSupportedNetwork && isNetworkValidationEnabledForSignIn) {
|
|
162
162
|
if (!isProgrammableNetworkSwitchSupported.isProgrammableNetworkSwitchSupported(walletConnector)) {
|
|
163
|
-
return
|
|
163
|
+
return pushView('network-not-supported-manual');
|
|
164
164
|
}
|
|
165
|
-
return
|
|
165
|
+
return pushView('network-not-supported');
|
|
166
166
|
}
|
|
167
167
|
if (isConnectOnly.isConnectOnly(user, authMode)) {
|
|
168
168
|
utils.StorageService.setItem(localStorage.LAST_USED_WALLET, walletConnector.key);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { isEmailWalletConnector, isEmailOTPWalletConnector, isBloctoConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
3
|
import { StorageService } from '@dynamic-labs/utils';
|
|
4
|
+
import { isEmailWalletConnector, isEmailOTPWalletConnector, isBloctoConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { useCaptchaContext } from '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
@@ -95,7 +95,7 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
95
95
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
96
96
|
|
|
97
97
|
const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = true, } = {}) => {
|
|
98
|
-
const {
|
|
98
|
+
const { pushView, clearStackAndPushInitialView, replaceView } = useViewContext();
|
|
99
99
|
const { engageCaptcha, getCaptchaToken } = useCaptchaContext();
|
|
100
100
|
const { setErrorMessage } = useErrorContext();
|
|
101
101
|
const { authMode, connectWallet, displaySiweStatement, environmentId, projectSettings, networkValidationMode, setIsSingleWalletAccount, user, walletUiUtils, } = useInternalDynamicContext();
|
|
@@ -126,18 +126,18 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
126
126
|
if (!userCancelled)
|
|
127
127
|
logger.debug(err);
|
|
128
128
|
setErrorMessage((_a = err === null || err === void 0 ? void 0 : err.code) === null || _a === void 0 ? void 0 : _a.toString());
|
|
129
|
-
|
|
129
|
+
clearStackAndPushInitialView();
|
|
130
130
|
};
|
|
131
131
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ walletConnector, getAddressOpts = undefined, }) {
|
|
132
132
|
var _b;
|
|
133
133
|
try {
|
|
134
|
-
yield showPendingConnectView(walletConnector,
|
|
134
|
+
yield showPendingConnectView(walletConnector, pushView);
|
|
135
135
|
if (isEmailWalletConnector(walletConnector)) {
|
|
136
136
|
if (isEmailOTPWalletConnector(walletConnector)) {
|
|
137
|
-
|
|
137
|
+
pushView('email-wallet-otp-verification-view');
|
|
138
138
|
}
|
|
139
139
|
else if (!isBloctoConnector(walletConnector)) {
|
|
140
|
-
|
|
140
|
+
pushView('wait-for-email-confirmation-view');
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
const connectionResult = yield connectWallet(walletConnector, getAddressOpts, {
|
|
@@ -156,9 +156,9 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
156
156
|
networkValidationMode === 'sign-in';
|
|
157
157
|
if (!usesSupportedNetwork && isNetworkValidationEnabledForSignIn) {
|
|
158
158
|
if (!isProgrammableNetworkSwitchSupported(walletConnector)) {
|
|
159
|
-
return
|
|
159
|
+
return pushView('network-not-supported-manual');
|
|
160
160
|
}
|
|
161
|
-
return
|
|
161
|
+
return pushView('network-not-supported');
|
|
162
162
|
}
|
|
163
163
|
if (isConnectOnly(user, authMode)) {
|
|
164
164
|
StorageService.setItem(LAST_USED_WALLET, walletConnector.key);
|
|
@@ -99,7 +99,7 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
99
99
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
100
100
|
|
|
101
101
|
const useConnectAndSignSplitSteps = () => {
|
|
102
|
-
const {
|
|
102
|
+
const { pushView, clearStackAndPushInitialView } = ViewContext.useViewContext();
|
|
103
103
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
104
104
|
const { getCaptchaToken, engageCaptcha } = CaptchaContext.useCaptchaContext();
|
|
105
105
|
const { connectWallet, displaySiweStatement, projectSettings, environmentId, networkValidationMode, setIsSingleWalletAccount, setShowAuthFlow, user, authMode, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -120,7 +120,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
120
120
|
*/
|
|
121
121
|
if (err instanceof utils.MissingPublicAddressError && utils.isMobile())
|
|
122
122
|
return;
|
|
123
|
-
|
|
123
|
+
clearStackAndPushInitialView();
|
|
124
124
|
setErrorMessage((_a = err.code) !== null && _a !== void 0 ? _a : err.toString());
|
|
125
125
|
};
|
|
126
126
|
// This method is similar to useConnectAndSign, but it skips signing for now
|
|
@@ -130,7 +130,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
130
130
|
const onlyConnectUser = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ walletConnector, getAddressOpts = undefined, shouldShowPendingConnectView = true, }) {
|
|
131
131
|
var _b;
|
|
132
132
|
if (shouldShowPendingConnectView)
|
|
133
|
-
yield showPendingConnectView.showPendingConnectView(walletConnector,
|
|
133
|
+
yield showPendingConnectView.showPendingConnectView(walletConnector, pushView);
|
|
134
134
|
try {
|
|
135
135
|
yield connectWallet(walletConnector, getAddressOpts);
|
|
136
136
|
if (isConnectOnly.isConnectOnly(user, authMode)) {
|
|
@@ -143,13 +143,13 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
143
143
|
authMethod: 'wallet',
|
|
144
144
|
onCaptchaSuccess: (_captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
145
145
|
setShowAuthFlow(true);
|
|
146
|
-
|
|
146
|
+
pushView('pending-signature');
|
|
147
147
|
}),
|
|
148
148
|
});
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
setShowAuthFlow(true);
|
|
152
|
-
|
|
152
|
+
pushView('pending-signature');
|
|
153
153
|
}
|
|
154
154
|
catch (err) {
|
|
155
155
|
onErrorHandler(err);
|
|
@@ -173,9 +173,9 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
173
173
|
networkValidationMode === 'sign-in';
|
|
174
174
|
if (!usesSupportedNetwork && isNetworkValidationEnabledForSignIn) {
|
|
175
175
|
if (!isProgrammableNetworkSwitchSupported.isProgrammableNetworkSwitchSupported(walletConnector)) {
|
|
176
|
-
return
|
|
176
|
+
return pushView('network-not-supported-manual');
|
|
177
177
|
}
|
|
178
|
-
return
|
|
178
|
+
return pushView('network-not-supported');
|
|
179
179
|
}
|
|
180
180
|
yield verifyWallet({
|
|
181
181
|
captchaToken: getCaptchaToken(),
|
|
@@ -95,7 +95,7 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
95
95
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
96
96
|
|
|
97
97
|
const useConnectAndSignSplitSteps = () => {
|
|
98
|
-
const {
|
|
98
|
+
const { pushView, clearStackAndPushInitialView } = useViewContext();
|
|
99
99
|
const { setErrorMessage } = useErrorContext();
|
|
100
100
|
const { getCaptchaToken, engageCaptcha } = useCaptchaContext();
|
|
101
101
|
const { connectWallet, displaySiweStatement, projectSettings, environmentId, networkValidationMode, setIsSingleWalletAccount, setShowAuthFlow, user, authMode, } = useInternalDynamicContext();
|
|
@@ -116,7 +116,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
116
116
|
*/
|
|
117
117
|
if (err instanceof MissingPublicAddressError && isMobile())
|
|
118
118
|
return;
|
|
119
|
-
|
|
119
|
+
clearStackAndPushInitialView();
|
|
120
120
|
setErrorMessage((_a = err.code) !== null && _a !== void 0 ? _a : err.toString());
|
|
121
121
|
};
|
|
122
122
|
// This method is similar to useConnectAndSign, but it skips signing for now
|
|
@@ -126,7 +126,7 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
126
126
|
const onlyConnectUser = (_a) => __awaiter(void 0, [_a], void 0, function* ({ walletConnector, getAddressOpts = undefined, shouldShowPendingConnectView = true, }) {
|
|
127
127
|
var _b;
|
|
128
128
|
if (shouldShowPendingConnectView)
|
|
129
|
-
yield showPendingConnectView(walletConnector,
|
|
129
|
+
yield showPendingConnectView(walletConnector, pushView);
|
|
130
130
|
try {
|
|
131
131
|
yield connectWallet(walletConnector, getAddressOpts);
|
|
132
132
|
if (isConnectOnly(user, authMode)) {
|
|
@@ -139,13 +139,13 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
139
139
|
authMethod: 'wallet',
|
|
140
140
|
onCaptchaSuccess: (_captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
141
141
|
setShowAuthFlow(true);
|
|
142
|
-
|
|
142
|
+
pushView('pending-signature');
|
|
143
143
|
}),
|
|
144
144
|
});
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
setShowAuthFlow(true);
|
|
148
|
-
|
|
148
|
+
pushView('pending-signature');
|
|
149
149
|
}
|
|
150
150
|
catch (err) {
|
|
151
151
|
onErrorHandler(err);
|
|
@@ -169,9 +169,9 @@ const useConnectAndSignSplitSteps = () => {
|
|
|
169
169
|
networkValidationMode === 'sign-in';
|
|
170
170
|
if (!usesSupportedNetwork && isNetworkValidationEnabledForSignIn) {
|
|
171
171
|
if (!isProgrammableNetworkSwitchSupported(walletConnector)) {
|
|
172
|
-
return
|
|
172
|
+
return pushView('network-not-supported-manual');
|
|
173
173
|
}
|
|
174
|
-
return
|
|
174
|
+
return pushView('network-not-supported');
|
|
175
175
|
}
|
|
176
176
|
yield verifyWallet({
|
|
177
177
|
captchaToken: getCaptchaToken(),
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs
CHANGED
|
@@ -93,7 +93,7 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
93
93
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
94
94
|
|
|
95
95
|
const useSignConnectOnlyUser = () => {
|
|
96
|
-
const {
|
|
96
|
+
const { pushView } = ViewContext.useViewContext();
|
|
97
97
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
98
98
|
const { getCaptchaToken } = CaptchaContext.useCaptchaContext();
|
|
99
99
|
const { connectWallet, displaySiweStatement, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, setSelectedWalletConnectorKey, walletUiUtils, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -114,7 +114,7 @@ const useSignConnectOnlyUser = () => {
|
|
|
114
114
|
// We don't want to show the back button in the pending signature view
|
|
115
115
|
// because we don't want to go back to the wallet-list
|
|
116
116
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
117
|
-
|
|
117
|
+
pushView('pending-signature-without-back-button');
|
|
118
118
|
setShowAuthFlow(true);
|
|
119
119
|
// Wallet should be already connected at this point
|
|
120
120
|
// We just need to verify it
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js
CHANGED
|
@@ -89,7 +89,7 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
89
89
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
90
90
|
|
|
91
91
|
const useSignConnectOnlyUser = () => {
|
|
92
|
-
const {
|
|
92
|
+
const { pushView } = useViewContext();
|
|
93
93
|
const { setErrorMessage } = useErrorContext();
|
|
94
94
|
const { getCaptchaToken } = useCaptchaContext();
|
|
95
95
|
const { connectWallet, displaySiweStatement, projectSettings, environmentId, setIsSingleWalletAccount, setShowAuthFlow, setSelectedWalletConnectorKey, walletUiUtils, } = useInternalDynamicContext();
|
|
@@ -110,7 +110,7 @@ const useSignConnectOnlyUser = () => {
|
|
|
110
110
|
// We don't want to show the back button in the pending signature view
|
|
111
111
|
// because we don't want to go back to the wallet-list
|
|
112
112
|
setSelectedWalletConnectorKey(walletConnector.key);
|
|
113
|
-
|
|
113
|
+
pushView('pending-signature-without-back-button');
|
|
114
114
|
setShowAuthFlow(true);
|
|
115
115
|
// Wallet should be already connected at this point
|
|
116
116
|
// We just need to verify it
|
|
@@ -128,6 +128,11 @@ const useVerifyOnAwaitingSignature = () => {
|
|
|
128
128
|
setMultiWalletWidgetState,
|
|
129
129
|
triggerConnectAndSign,
|
|
130
130
|
]);
|
|
131
|
+
// This is the effect that triggers the connect and sign flow
|
|
132
|
+
// when the multi wallet widget is in the awaiting_signature state
|
|
133
|
+
// with linking_new_wallet signature sub state.
|
|
134
|
+
// This is a very, very bad pattern and should be refactored if possible,
|
|
135
|
+
// though that would be a lot of work and this works for now.
|
|
131
136
|
React.useEffect(() => {
|
|
132
137
|
if (!legacyIsVerifying &&
|
|
133
138
|
!isVerifying.current &&
|
package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js
CHANGED
|
@@ -124,6 +124,11 @@ const useVerifyOnAwaitingSignature = () => {
|
|
|
124
124
|
setMultiWalletWidgetState,
|
|
125
125
|
triggerConnectAndSign,
|
|
126
126
|
]);
|
|
127
|
+
// This is the effect that triggers the connect and sign flow
|
|
128
|
+
// when the multi wallet widget is in the awaiting_signature state
|
|
129
|
+
// with linking_new_wallet signature sub state.
|
|
130
|
+
// This is a very, very bad pattern and should be refactored if possible,
|
|
131
|
+
// though that would be a lot of work and this works for now.
|
|
127
132
|
useEffect(() => {
|
|
128
133
|
if (!legacyIsVerifying &&
|
|
129
134
|
!isVerifying.current &&
|
|
@@ -97,7 +97,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
97
97
|
|
|
98
98
|
const useConnectedWalletsNetworkValidation = () => {
|
|
99
99
|
const { connectedWallets, selectedWalletConnector, setSelectedWalletConnectorKey, setShowAuthFlow, bridgeChainsToConnect, sdkHasLoaded, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
100
|
-
const {
|
|
100
|
+
const { pushView } = ViewContext.useViewContext();
|
|
101
101
|
const isLoggedIn = useIsLoggedIn.useIsLoggedIn();
|
|
102
102
|
const getConnectedWalletsWithInvalidNetwork = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
103
103
|
const connectedWalletsWithInvalidNetwork = [];
|
|
@@ -133,13 +133,13 @@ const useConnectedWalletsNetworkValidation = () => {
|
|
|
133
133
|
: 'network-not-supported-manual';
|
|
134
134
|
// Doesn't rerender if it's already true
|
|
135
135
|
setShowAuthFlow(true);
|
|
136
|
-
|
|
136
|
+
pushView(networkNotSupportedView);
|
|
137
137
|
}), [
|
|
138
138
|
getConnectedWalletsWithInvalidNetwork,
|
|
139
139
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key,
|
|
140
140
|
setSelectedWalletConnectorKey,
|
|
141
141
|
setShowAuthFlow,
|
|
142
|
-
|
|
142
|
+
pushView,
|
|
143
143
|
]);
|
|
144
144
|
const uniqueConnectors = React.useMemo(() => {
|
|
145
145
|
const connectors = connectedWallets.map(({ connector }) => connector);
|
|
@@ -93,7 +93,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
93
93
|
|
|
94
94
|
const useConnectedWalletsNetworkValidation = () => {
|
|
95
95
|
const { connectedWallets, selectedWalletConnector, setSelectedWalletConnectorKey, setShowAuthFlow, bridgeChainsToConnect, sdkHasLoaded, } = useInternalDynamicContext();
|
|
96
|
-
const {
|
|
96
|
+
const { pushView } = useViewContext();
|
|
97
97
|
const isLoggedIn = useIsLoggedIn();
|
|
98
98
|
const getConnectedWalletsWithInvalidNetwork = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
99
|
const connectedWalletsWithInvalidNetwork = [];
|
|
@@ -129,13 +129,13 @@ const useConnectedWalletsNetworkValidation = () => {
|
|
|
129
129
|
: 'network-not-supported-manual';
|
|
130
130
|
// Doesn't rerender if it's already true
|
|
131
131
|
setShowAuthFlow(true);
|
|
132
|
-
|
|
132
|
+
pushView(networkNotSupportedView);
|
|
133
133
|
}), [
|
|
134
134
|
getConnectedWalletsWithInvalidNetwork,
|
|
135
135
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key,
|
|
136
136
|
setSelectedWalletConnectorKey,
|
|
137
137
|
setShowAuthFlow,
|
|
138
|
-
|
|
138
|
+
pushView,
|
|
139
139
|
]);
|
|
140
140
|
const uniqueConnectors = useMemo(() => {
|
|
141
141
|
const connectors = connectedWallets.map(({ connector }) => connector);
|
|
@@ -105,7 +105,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
105
105
|
const useDynamicModals = () => {
|
|
106
106
|
const { projectSettings, user, multiWallet, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
107
107
|
const isLoggedIn = useIsLoggedIn.useIsLoggedIn();
|
|
108
|
-
const {
|
|
108
|
+
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
109
109
|
const canLink = isAllowedToLinkWallet.isAllowedToLinkWallet(projectSettings, user === null || user === void 0 ? void 0 : user.verifiedCredentials, multiWallet);
|
|
110
110
|
const { setShowMfaChooseType, setShowMfaEnterBackupCodes, setShowMfaQRCode, setShowMfaViewBackupCodes, setShowOTPVerification, } = useMfaModals.useMfaModals();
|
|
111
111
|
const setSetShowLinkNewWalletModalWithInit = React.useCallback((value) => {
|
|
@@ -119,7 +119,7 @@ const useDynamicModals = () => {
|
|
|
119
119
|
logger.logger.warn('setShowLinkNewWalletModal was called but the user is not allowed to link a wallet. This results in a no-op. Please double check that multi-wallet is enabled in the dashboard. For more information, see: https://docs.dynamic.xyz/branded-wallets/multi-wallet');
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
clearStackAndPush('multi-wallet-wallet-list');
|
|
123
123
|
}
|
|
124
124
|
setShowAuthFlow(value, {
|
|
125
125
|
emitCancelAuth: true,
|
|
@@ -127,7 +127,7 @@ const useDynamicModals = () => {
|
|
|
127
127
|
initializeWalletConnect: true,
|
|
128
128
|
performMultiWalletChecks: false,
|
|
129
129
|
});
|
|
130
|
-
}, [canLink, isLoggedIn, setShowAuthFlow,
|
|
130
|
+
}, [canLink, isLoggedIn, setShowAuthFlow, clearStackAndPush]);
|
|
131
131
|
return {
|
|
132
132
|
setShowLinkNewWalletModal: setSetShowLinkNewWalletModalWithInit,
|
|
133
133
|
setShowMfaChooseType,
|
|
@@ -101,7 +101,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
101
101
|
const useDynamicModals = () => {
|
|
102
102
|
const { projectSettings, user, multiWallet, setShowAuthFlow } = useInternalDynamicContext();
|
|
103
103
|
const isLoggedIn = useIsLoggedIn();
|
|
104
|
-
const {
|
|
104
|
+
const { clearStackAndPush } = useViewContext();
|
|
105
105
|
const canLink = isAllowedToLinkWallet(projectSettings, user === null || user === void 0 ? void 0 : user.verifiedCredentials, multiWallet);
|
|
106
106
|
const { setShowMfaChooseType, setShowMfaEnterBackupCodes, setShowMfaQRCode, setShowMfaViewBackupCodes, setShowOTPVerification, } = useMfaModals();
|
|
107
107
|
const setSetShowLinkNewWalletModalWithInit = useCallback((value) => {
|
|
@@ -115,7 +115,7 @@ const useDynamicModals = () => {
|
|
|
115
115
|
logger.warn('setShowLinkNewWalletModal was called but the user is not allowed to link a wallet. This results in a no-op. Please double check that multi-wallet is enabled in the dashboard. For more information, see: https://docs.dynamic.xyz/branded-wallets/multi-wallet');
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
clearStackAndPush('multi-wallet-wallet-list');
|
|
119
119
|
}
|
|
120
120
|
setShowAuthFlow(value, {
|
|
121
121
|
emitCancelAuth: true,
|
|
@@ -123,7 +123,7 @@ const useDynamicModals = () => {
|
|
|
123
123
|
initializeWalletConnect: true,
|
|
124
124
|
performMultiWalletChecks: false,
|
|
125
125
|
});
|
|
126
|
-
}, [canLink, isLoggedIn, setShowAuthFlow,
|
|
126
|
+
}, [canLink, isLoggedIn, setShowAuthFlow, clearStackAndPush]);
|
|
127
127
|
return {
|
|
128
128
|
setShowLinkNewWalletModal: setSetShowLinkNewWalletModalWithInit,
|
|
129
129
|
setShowMfaChooseType,
|
|
@@ -100,7 +100,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
100
100
|
const useEmbeddedReveal = () => {
|
|
101
101
|
const { primaryWallet, projectSettings, user, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
102
102
|
const { userHasEmbeddedWallet } = useEmbeddedWallet.useEmbeddedWallet();
|
|
103
|
-
const {
|
|
103
|
+
const { pushView } = ViewContext.useViewContext();
|
|
104
104
|
const { isTurnkeyWallet } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
105
105
|
const turnkeyChecks = ({ user, recoveryPhrase, }) => {
|
|
106
106
|
var _a, _b;
|
|
@@ -144,7 +144,7 @@ const useEmbeddedReveal = () => {
|
|
|
144
144
|
ignoreIfIsEmbeddedWidget: false,
|
|
145
145
|
performMultiWalletChecks: false,
|
|
146
146
|
});
|
|
147
|
-
|
|
147
|
+
pushView('embedded-reveal-view', {
|
|
148
148
|
exportPrivateKey: !recoveryPhrase,
|
|
149
149
|
isPromptForExport,
|
|
150
150
|
});
|
|
@@ -152,7 +152,7 @@ const useEmbeddedReveal = () => {
|
|
|
152
152
|
dynamicEvents.dynamicEvents.once('embeddedWalletRevealCompleted', (wallet) => resolve(wallet));
|
|
153
153
|
dynamicEvents.dynamicEvents.once('embeddedWalletRevealFailed', (error) => reject(error));
|
|
154
154
|
});
|
|
155
|
-
}), [primaryWallet, isTurnkeyWallet, setShowAuthFlow,
|
|
155
|
+
}), [primaryWallet, isTurnkeyWallet, setShowAuthFlow, pushView, user]);
|
|
156
156
|
return {
|
|
157
157
|
initExportProcess,
|
|
158
158
|
};
|
|
@@ -96,7 +96,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
96
96
|
const useEmbeddedReveal = () => {
|
|
97
97
|
const { primaryWallet, projectSettings, user, setShowAuthFlow } = useInternalDynamicContext();
|
|
98
98
|
const { userHasEmbeddedWallet } = useEmbeddedWallet();
|
|
99
|
-
const {
|
|
99
|
+
const { pushView } = useViewContext();
|
|
100
100
|
const { isTurnkeyWallet } = useIsTurnkeyWallet();
|
|
101
101
|
const turnkeyChecks = ({ user, recoveryPhrase, }) => {
|
|
102
102
|
var _a, _b;
|
|
@@ -140,7 +140,7 @@ const useEmbeddedReveal = () => {
|
|
|
140
140
|
ignoreIfIsEmbeddedWidget: false,
|
|
141
141
|
performMultiWalletChecks: false,
|
|
142
142
|
});
|
|
143
|
-
|
|
143
|
+
pushView('embedded-reveal-view', {
|
|
144
144
|
exportPrivateKey: !recoveryPhrase,
|
|
145
145
|
isPromptForExport,
|
|
146
146
|
});
|
|
@@ -148,7 +148,7 @@ const useEmbeddedReveal = () => {
|
|
|
148
148
|
dynamicEvents.once('embeddedWalletRevealCompleted', (wallet) => resolve(wallet));
|
|
149
149
|
dynamicEvents.once('embeddedWalletRevealFailed', (error) => reject(error));
|
|
150
150
|
});
|
|
151
|
-
}), [primaryWallet, isTurnkeyWallet, setShowAuthFlow,
|
|
151
|
+
}), [primaryWallet, isTurnkeyWallet, setShowAuthFlow, pushView, user]);
|
|
152
152
|
return {
|
|
153
153
|
initExportProcess,
|
|
154
154
|
};
|
|
@@ -105,7 +105,7 @@ var useInternalDynamicContext = require('../../../../../context/DynamicContext/u
|
|
|
105
105
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
106
106
|
const useTurnkey = () => {
|
|
107
107
|
const { projectSettings, walletConnectorOptions, setShowAuthFlow, environmentId, user, primaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
108
|
-
const {
|
|
108
|
+
const { pushView } = ViewContext.useViewContext();
|
|
109
109
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation.useCreateDynamicEmbeddedWalletMutation();
|
|
110
110
|
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
111
111
|
const startHeadlessEmbeddedWalletCreationFlow = React.useCallback((chains, options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -141,7 +141,7 @@ const useTurnkey = () => {
|
|
|
141
141
|
ignoreIfIsEmbeddedWidget: false,
|
|
142
142
|
performMultiWalletChecks: false,
|
|
143
143
|
});
|
|
144
|
-
|
|
144
|
+
pushView('passkey-intro', { chains });
|
|
145
145
|
return new Promise((resolve, reject) => {
|
|
146
146
|
dynamicEvents.dynamicEvents.once('embeddedWalletCreated', (wallet) => resolve(wallet));
|
|
147
147
|
dynamicEvents.dynamicEvents.once('embeddedWalletFailed', (error) => {
|
|
@@ -156,7 +156,7 @@ const useTurnkey = () => {
|
|
|
156
156
|
reject(error);
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
|
-
}), [setShowAuthFlow,
|
|
159
|
+
}), [setShowAuthFlow, pushView]);
|
|
160
160
|
const returnEmbeddedWallet = React.useCallback((embeddedWalletVerifiedCredential) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
161
161
|
var _a, _b;
|
|
162
162
|
const { chain } = embeddedWalletVerifiedCredential;
|
|
@@ -101,7 +101,7 @@ import { useInternalDynamicContext } from '../../../../../context/DynamicContext
|
|
|
101
101
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
102
102
|
const useTurnkey = () => {
|
|
103
103
|
const { projectSettings, walletConnectorOptions, setShowAuthFlow, environmentId, user, primaryWallet, } = useInternalDynamicContext();
|
|
104
|
-
const {
|
|
104
|
+
const { pushView } = useViewContext();
|
|
105
105
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation();
|
|
106
106
|
const { getEOAWallet } = useSmartWallets();
|
|
107
107
|
const startHeadlessEmbeddedWalletCreationFlow = useCallback((chains, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -137,7 +137,7 @@ const useTurnkey = () => {
|
|
|
137
137
|
ignoreIfIsEmbeddedWidget: false,
|
|
138
138
|
performMultiWalletChecks: false,
|
|
139
139
|
});
|
|
140
|
-
|
|
140
|
+
pushView('passkey-intro', { chains });
|
|
141
141
|
return new Promise((resolve, reject) => {
|
|
142
142
|
dynamicEvents.once('embeddedWalletCreated', (wallet) => resolve(wallet));
|
|
143
143
|
dynamicEvents.once('embeddedWalletFailed', (error) => {
|
|
@@ -152,7 +152,7 @@ const useTurnkey = () => {
|
|
|
152
152
|
reject(error);
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
|
-
}), [setShowAuthFlow,
|
|
155
|
+
}), [setShowAuthFlow, pushView]);
|
|
156
156
|
const returnEmbeddedWallet = useCallback((embeddedWalletVerifiedCredential) => __awaiter(void 0, void 0, void 0, function* () {
|
|
157
157
|
var _a, _b;
|
|
158
158
|
const { chain } = embeddedWalletVerifiedCredential;
|
package/src/lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.cjs
CHANGED
|
@@ -95,7 +95,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
95
95
|
const useEmbeddedWalletAuthenticator = () => {
|
|
96
96
|
const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery.usePasskeyRecovery();
|
|
97
97
|
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
98
|
-
const {
|
|
98
|
+
const { pushView } = ViewContext.useViewContext();
|
|
99
99
|
const createOrRefreshAuthenticatorSession = (authenticatorType) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
100
100
|
// user has passkey authenticator set up OR active session
|
|
101
101
|
// there is no need to create or refresh the authenticator
|
|
@@ -105,7 +105,7 @@ const useEmbeddedWalletAuthenticator = () => {
|
|
|
105
105
|
return initPasskeyRecoveryProcess(authenticatorType);
|
|
106
106
|
});
|
|
107
107
|
const addEmbeddedWalletRecoveryEmail = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
-
|
|
108
|
+
pushView('passkey-recovery-add-email');
|
|
109
109
|
setShowAuthFlow(true);
|
|
110
110
|
});
|
|
111
111
|
return {
|
package/src/lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.js
CHANGED
|
@@ -91,7 +91,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
91
91
|
const useEmbeddedWalletAuthenticator = () => {
|
|
92
92
|
const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery();
|
|
93
93
|
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
94
|
-
const {
|
|
94
|
+
const { pushView } = useViewContext();
|
|
95
95
|
const createOrRefreshAuthenticatorSession = (authenticatorType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
96
96
|
// user has passkey authenticator set up OR active session
|
|
97
97
|
// there is no need to create or refresh the authenticator
|
|
@@ -101,7 +101,7 @@ const useEmbeddedWalletAuthenticator = () => {
|
|
|
101
101
|
return initPasskeyRecoveryProcess(authenticatorType);
|
|
102
102
|
});
|
|
103
103
|
const addEmbeddedWalletRecoveryEmail = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
|
-
|
|
104
|
+
pushView('passkey-recovery-add-email');
|
|
105
105
|
setShowAuthFlow(true);
|
|
106
106
|
});
|
|
107
107
|
return {
|