@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
|
@@ -94,14 +94,14 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
94
94
|
|
|
95
95
|
const useEmbeddedWalletPassword = () => {
|
|
96
96
|
const { primaryWallet, setShowAuthFlow, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
97
|
-
const {
|
|
97
|
+
const { pushView } = ViewContext.useViewContext();
|
|
98
98
|
const createPassword = React.useCallback((isClaim, isSignUp) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
99
99
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: false });
|
|
100
100
|
if (isClaim) {
|
|
101
|
-
|
|
101
|
+
pushView('wallet-claim-intro');
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
|
-
|
|
104
|
+
pushView('create-password-view', {
|
|
105
105
|
isSignUp,
|
|
106
106
|
notCalledFromWalletUtils: true,
|
|
107
107
|
});
|
|
@@ -110,7 +110,7 @@ const useEmbeddedWalletPassword = () => {
|
|
|
110
110
|
dynamicEvents.dynamicEvents.once('embeddedWalletCreatePasswordCompleted', (password) => resolve(password));
|
|
111
111
|
dynamicEvents.dynamicEvents.once('embeddedWalletCreatePasswordFailed', (error) => reject(error));
|
|
112
112
|
});
|
|
113
|
-
}), [setShowAuthFlow,
|
|
113
|
+
}), [setShowAuthFlow, pushView]);
|
|
114
114
|
const claimWallet = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
115
115
|
try {
|
|
116
116
|
if (!primaryWallet) {
|
|
@@ -90,14 +90,14 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
90
90
|
|
|
91
91
|
const useEmbeddedWalletPassword = () => {
|
|
92
92
|
const { primaryWallet, setShowAuthFlow, environmentId } = useInternalDynamicContext();
|
|
93
|
-
const {
|
|
93
|
+
const { pushView } = useViewContext();
|
|
94
94
|
const createPassword = useCallback((isClaim, isSignUp) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
95
|
setShowAuthFlow(true, { ignoreIfIsEmbeddedWidget: false });
|
|
96
96
|
if (isClaim) {
|
|
97
|
-
|
|
97
|
+
pushView('wallet-claim-intro');
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
|
-
|
|
100
|
+
pushView('create-password-view', {
|
|
101
101
|
isSignUp,
|
|
102
102
|
notCalledFromWalletUtils: true,
|
|
103
103
|
});
|
|
@@ -106,7 +106,7 @@ const useEmbeddedWalletPassword = () => {
|
|
|
106
106
|
dynamicEvents.once('embeddedWalletCreatePasswordCompleted', (password) => resolve(password));
|
|
107
107
|
dynamicEvents.once('embeddedWalletCreatePasswordFailed', (error) => reject(error));
|
|
108
108
|
});
|
|
109
|
-
}), [setShowAuthFlow,
|
|
109
|
+
}), [setShowAuthFlow, pushView]);
|
|
110
110
|
const claimWallet = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
111
|
try {
|
|
112
112
|
if (!primaryWallet) {
|
package/src/lib/utils/hooks/useFunding/useConnectWalletForFunding/useConnectWalletForFunding.cjs
CHANGED
|
@@ -33,7 +33,7 @@ var resolvePromiseRef = require('../../../functions/resolvePromiseRef/resolvePro
|
|
|
33
33
|
var rejectPromiseRef = require('../../../functions/rejectPromiseRef/rejectPromiseRef.cjs');
|
|
34
34
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
35
35
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
36
|
-
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
36
|
+
var UserWalletsContext = require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
37
37
|
require('../../../../events/dynamicEvents.cjs');
|
|
38
38
|
require('../../../../context/VerificationContext/VerificationContext.cjs');
|
|
39
39
|
require('react-dom');
|
|
@@ -52,7 +52,7 @@ require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
|
52
52
|
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
53
53
|
require('@dynamic-labs/rpc-providers');
|
|
54
54
|
require('../../../../store/state/loadingAndLifecycle.cjs');
|
|
55
|
-
require('../../../../store/state/walletOptions/walletOptions.cjs');
|
|
55
|
+
var walletOptions = require('../../../../store/state/walletOptions/walletOptions.cjs');
|
|
56
56
|
var useHandleWalletItem = require('../../useWalletItemActions/useHandleWalletItem/useHandleWalletItem.cjs');
|
|
57
57
|
require('react-i18next');
|
|
58
58
|
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
@@ -99,8 +99,9 @@ var useInternalDynamicContext = require('../../../../context/DynamicContext/useD
|
|
|
99
99
|
|
|
100
100
|
const useConnectWalletForFunding = ({ externalWalletFundingEnabled, }) => {
|
|
101
101
|
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
102
|
-
const {
|
|
103
|
-
const
|
|
102
|
+
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
103
|
+
const userWallets = UserWalletsContext.useUserWallets();
|
|
104
|
+
const { walletOptions: walletOptions$1 } = useWalletOptions.useWalletOptions();
|
|
104
105
|
const internalConnectionPromiseRef = React.useRef(null);
|
|
105
106
|
const connectWalletPromiseRef = React.useRef(null);
|
|
106
107
|
const handleWalletMethod = React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -122,22 +123,38 @@ const useConnectWalletForFunding = ({ externalWalletFundingEnabled, }) => {
|
|
|
122
123
|
rejectPromiseRef.rejectPromiseRef(connectWalletPromiseRef, new utils.DynamicError('User cancelled'));
|
|
123
124
|
});
|
|
124
125
|
const getWalletAddress = React.useCallback((walletConnector) => {
|
|
125
|
-
const walletOption = walletOptions.find(({ key }) => key === walletConnector.key);
|
|
126
|
+
const walletOption = walletOptions$1.find(({ key }) => key === walletConnector.key);
|
|
126
127
|
if (!walletOption)
|
|
127
128
|
return Promise.reject(new utils.DynamicError(`Connect wallet for funding error: wallet option for ${walletConnector.key} not found`));
|
|
128
129
|
internalConnectionPromiseRef.current = new utils.DeferredPromise();
|
|
129
130
|
handleWalletItemClick(Object.assign(Object.assign({}, walletOption), { walletConnector }));
|
|
130
131
|
return internalConnectionPromiseRef.current.promise;
|
|
131
|
-
}, [handleWalletItemClick, walletOptions]);
|
|
132
|
-
|
|
132
|
+
}, [handleWalletItemClick, walletOptions$1]);
|
|
133
|
+
const hasWalletConnectWallet = userWallets.some((wallet) => wallet.connector.isWalletConnect);
|
|
134
|
+
// WC does not allow multiple sessions, so we have 2 cases here:
|
|
135
|
+
// 1. The user has a linked WalletConnect wallet.
|
|
136
|
+
// In this case, we should not do anything, and our logic will prevent other WCs from being
|
|
137
|
+
// selected for funding.
|
|
138
|
+
// 2. The user does not have a WalletConnect wallet linked.
|
|
139
|
+
// In this case, we should reset the WC session — this is because they might have just
|
|
140
|
+
// previously connected another WC wallet for funding and that session could still be active.
|
|
141
|
+
const resetWalletConnectSession = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
142
|
+
if (hasWalletConnectWallet)
|
|
143
|
+
return;
|
|
144
|
+
const walletOption = walletOptions.getWalletConnectorOptions().find(({ walletConnector }) => walletConnector.isWalletConnect);
|
|
145
|
+
yield (walletOption === null || walletOption === void 0 ? void 0 : walletOption.walletConnector.endSession());
|
|
146
|
+
yield (walletOption === null || walletOption === void 0 ? void 0 : walletOption.walletConnector.init());
|
|
147
|
+
}), [hasWalletConnectWallet]);
|
|
148
|
+
return React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
133
149
|
if (!externalWalletFundingEnabled) {
|
|
134
150
|
return Promise.reject(new Error('External wallet funding is not enabled'));
|
|
135
151
|
}
|
|
136
152
|
if (connectWalletPromiseRef.current) {
|
|
137
153
|
return connectWalletPromiseRef.current.promise;
|
|
138
154
|
}
|
|
155
|
+
resetWalletConnectSession();
|
|
139
156
|
connectWalletPromiseRef.current = new utils.DeferredPromise();
|
|
140
|
-
|
|
157
|
+
clearStackAndPush('external-funding-wallet-list', {
|
|
141
158
|
onSelectWallet: (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ walletConnector }) {
|
|
142
159
|
if (!connectWalletPromiseRef.current)
|
|
143
160
|
return;
|
|
@@ -176,9 +193,10 @@ const useConnectWalletForFunding = ({ externalWalletFundingEnabled, }) => {
|
|
|
176
193
|
performMultiWalletChecks: false,
|
|
177
194
|
});
|
|
178
195
|
return connectWalletPromiseRef.current.promise;
|
|
179
|
-
}, [
|
|
196
|
+
}), [
|
|
180
197
|
externalWalletFundingEnabled,
|
|
181
|
-
|
|
198
|
+
resetWalletConnectSession,
|
|
199
|
+
clearStackAndPush,
|
|
182
200
|
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain,
|
|
183
201
|
setShowAuthFlow,
|
|
184
202
|
getWalletAddress,
|
package/src/lib/utils/hooks/useFunding/useConnectWalletForFunding/useConnectWalletForFunding.js
CHANGED
|
@@ -29,7 +29,7 @@ import { resolvePromiseRef } from '../../../functions/resolvePromiseRef/resolveP
|
|
|
29
29
|
import { rejectPromiseRef } from '../../../functions/rejectPromiseRef/rejectPromiseRef.js';
|
|
30
30
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
31
31
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
32
|
-
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
32
|
+
import { useUserWallets } from '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
33
33
|
import '../../../../events/dynamicEvents.js';
|
|
34
34
|
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
35
35
|
import 'react-dom';
|
|
@@ -48,7 +48,7 @@ import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
|
48
48
|
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
49
49
|
import '@dynamic-labs/rpc-providers';
|
|
50
50
|
import '../../../../store/state/loadingAndLifecycle.js';
|
|
51
|
-
import '../../../../store/state/walletOptions/walletOptions.js';
|
|
51
|
+
import { getWalletConnectorOptions } from '../../../../store/state/walletOptions/walletOptions.js';
|
|
52
52
|
import { useHandleWalletItem } from '../../useWalletItemActions/useHandleWalletItem/useHandleWalletItem.js';
|
|
53
53
|
import 'react-i18next';
|
|
54
54
|
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
@@ -95,7 +95,8 @@ import { useInternalDynamicContext } from '../../../../context/DynamicContext/us
|
|
|
95
95
|
|
|
96
96
|
const useConnectWalletForFunding = ({ externalWalletFundingEnabled, }) => {
|
|
97
97
|
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext();
|
|
98
|
-
const {
|
|
98
|
+
const { clearStackAndPush } = useViewContext();
|
|
99
|
+
const userWallets = useUserWallets();
|
|
99
100
|
const { walletOptions } = useWalletOptions();
|
|
100
101
|
const internalConnectionPromiseRef = useRef(null);
|
|
101
102
|
const connectWalletPromiseRef = useRef(null);
|
|
@@ -125,15 +126,31 @@ const useConnectWalletForFunding = ({ externalWalletFundingEnabled, }) => {
|
|
|
125
126
|
handleWalletItemClick(Object.assign(Object.assign({}, walletOption), { walletConnector }));
|
|
126
127
|
return internalConnectionPromiseRef.current.promise;
|
|
127
128
|
}, [handleWalletItemClick, walletOptions]);
|
|
128
|
-
|
|
129
|
+
const hasWalletConnectWallet = userWallets.some((wallet) => wallet.connector.isWalletConnect);
|
|
130
|
+
// WC does not allow multiple sessions, so we have 2 cases here:
|
|
131
|
+
// 1. The user has a linked WalletConnect wallet.
|
|
132
|
+
// In this case, we should not do anything, and our logic will prevent other WCs from being
|
|
133
|
+
// selected for funding.
|
|
134
|
+
// 2. The user does not have a WalletConnect wallet linked.
|
|
135
|
+
// In this case, we should reset the WC session — this is because they might have just
|
|
136
|
+
// previously connected another WC wallet for funding and that session could still be active.
|
|
137
|
+
const resetWalletConnectSession = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
138
|
+
if (hasWalletConnectWallet)
|
|
139
|
+
return;
|
|
140
|
+
const walletOption = getWalletConnectorOptions().find(({ walletConnector }) => walletConnector.isWalletConnect);
|
|
141
|
+
yield (walletOption === null || walletOption === void 0 ? void 0 : walletOption.walletConnector.endSession());
|
|
142
|
+
yield (walletOption === null || walletOption === void 0 ? void 0 : walletOption.walletConnector.init());
|
|
143
|
+
}), [hasWalletConnectWallet]);
|
|
144
|
+
return useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
145
|
if (!externalWalletFundingEnabled) {
|
|
130
146
|
return Promise.reject(new Error('External wallet funding is not enabled'));
|
|
131
147
|
}
|
|
132
148
|
if (connectWalletPromiseRef.current) {
|
|
133
149
|
return connectWalletPromiseRef.current.promise;
|
|
134
150
|
}
|
|
151
|
+
resetWalletConnectSession();
|
|
135
152
|
connectWalletPromiseRef.current = new DeferredPromise();
|
|
136
|
-
|
|
153
|
+
clearStackAndPush('external-funding-wallet-list', {
|
|
137
154
|
onSelectWallet: (_a) => __awaiter(void 0, [_a], void 0, function* ({ walletConnector }) {
|
|
138
155
|
if (!connectWalletPromiseRef.current)
|
|
139
156
|
return;
|
|
@@ -172,9 +189,10 @@ const useConnectWalletForFunding = ({ externalWalletFundingEnabled, }) => {
|
|
|
172
189
|
performMultiWalletChecks: false,
|
|
173
190
|
});
|
|
174
191
|
return connectWalletPromiseRef.current.promise;
|
|
175
|
-
}, [
|
|
192
|
+
}), [
|
|
176
193
|
externalWalletFundingEnabled,
|
|
177
|
-
|
|
194
|
+
resetWalletConnectSession,
|
|
195
|
+
clearStackAndPush,
|
|
178
196
|
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain,
|
|
179
197
|
setShowAuthFlow,
|
|
180
198
|
getWalletAddress,
|
|
@@ -93,7 +93,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
93
93
|
|
|
94
94
|
const useHandleWalletsToConnect = () => {
|
|
95
95
|
const { bridgeChains, bridgeChainsToConnect, setShowAuthFlow, bridgeOnboardingCompleted, setBridgeOnboardingCompleted, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
96
|
-
const {
|
|
96
|
+
const { pushView, clearStackAndPushInitialView } = ViewContext.useViewContext();
|
|
97
97
|
const handleWalletsToConnect = ({ walletConnector, }) => {
|
|
98
98
|
if (!bridgeChains) {
|
|
99
99
|
setShowAuthFlow(false);
|
|
@@ -107,26 +107,26 @@ const useHandleWalletsToConnect = () => {
|
|
|
107
107
|
// Avoid showing wallet-list when wallet updates network to the correct one in run time (bridge mode)
|
|
108
108
|
if (bridgeChainsToConnect.length === 0) {
|
|
109
109
|
setShowAuthFlow(false);
|
|
110
|
-
return
|
|
110
|
+
return clearStackAndPushInitialView();
|
|
111
111
|
}
|
|
112
112
|
if (!walletConnector || !walletConnector.connectedChain) {
|
|
113
113
|
setShowAuthFlow(false);
|
|
114
|
-
return
|
|
114
|
+
return clearStackAndPushInitialView();
|
|
115
115
|
}
|
|
116
116
|
const restOfWallets = bridgeChainsToConnect.filter((wallet) => wallet.chain !== (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain));
|
|
117
117
|
const allWalletsConnected = restOfWallets.length === 0;
|
|
118
118
|
if (allWalletsConnected) {
|
|
119
119
|
if (!bridgeOnboardingCompleted) {
|
|
120
120
|
setBridgeOnboardingCompleted(true);
|
|
121
|
-
|
|
121
|
+
pushView('bridge-summary');
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
124
124
|
setShowAuthFlow(false);
|
|
125
|
-
|
|
125
|
+
clearStackAndPushInitialView();
|
|
126
126
|
}
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
pushView('bridge-next-wallet-connection');
|
|
130
130
|
};
|
|
131
131
|
return { handleWalletsToConnect };
|
|
132
132
|
};
|
|
@@ -89,7 +89,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
89
89
|
|
|
90
90
|
const useHandleWalletsToConnect = () => {
|
|
91
91
|
const { bridgeChains, bridgeChainsToConnect, setShowAuthFlow, bridgeOnboardingCompleted, setBridgeOnboardingCompleted, } = useInternalDynamicContext();
|
|
92
|
-
const {
|
|
92
|
+
const { pushView, clearStackAndPushInitialView } = useViewContext();
|
|
93
93
|
const handleWalletsToConnect = ({ walletConnector, }) => {
|
|
94
94
|
if (!bridgeChains) {
|
|
95
95
|
setShowAuthFlow(false);
|
|
@@ -103,26 +103,26 @@ const useHandleWalletsToConnect = () => {
|
|
|
103
103
|
// Avoid showing wallet-list when wallet updates network to the correct one in run time (bridge mode)
|
|
104
104
|
if (bridgeChainsToConnect.length === 0) {
|
|
105
105
|
setShowAuthFlow(false);
|
|
106
|
-
return
|
|
106
|
+
return clearStackAndPushInitialView();
|
|
107
107
|
}
|
|
108
108
|
if (!walletConnector || !walletConnector.connectedChain) {
|
|
109
109
|
setShowAuthFlow(false);
|
|
110
|
-
return
|
|
110
|
+
return clearStackAndPushInitialView();
|
|
111
111
|
}
|
|
112
112
|
const restOfWallets = bridgeChainsToConnect.filter((wallet) => wallet.chain !== (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain));
|
|
113
113
|
const allWalletsConnected = restOfWallets.length === 0;
|
|
114
114
|
if (allWalletsConnected) {
|
|
115
115
|
if (!bridgeOnboardingCompleted) {
|
|
116
116
|
setBridgeOnboardingCompleted(true);
|
|
117
|
-
|
|
117
|
+
pushView('bridge-summary');
|
|
118
118
|
}
|
|
119
119
|
else {
|
|
120
120
|
setShowAuthFlow(false);
|
|
121
|
-
|
|
121
|
+
clearStackAndPushInitialView();
|
|
122
122
|
}
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
pushView('bridge-next-wallet-connection');
|
|
126
126
|
};
|
|
127
127
|
return { handleWalletsToConnect };
|
|
128
128
|
};
|
package/src/lib/utils/hooks/useInitEmbeddedWalletAuthMethod/useInitEmbeddedWalletAuthMethod.cjs
CHANGED
|
@@ -97,7 +97,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
97
97
|
// This hook needs to be async that's why it's not using useMutation
|
|
98
98
|
const useInitEmbeddedWalletAuthMethod = () => {
|
|
99
99
|
const { primaryWallet, environmentId, user, projectSettings, setShowAuthFlow, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
100
|
-
const {
|
|
100
|
+
const { pushView } = ViewContext.useViewContext();
|
|
101
101
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
102
102
|
const [error, setError] = React.useState();
|
|
103
103
|
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
@@ -125,7 +125,7 @@ const useInitEmbeddedWalletAuthMethod = () => {
|
|
|
125
125
|
wallet: wallet,
|
|
126
126
|
});
|
|
127
127
|
if (showEmailBundle) {
|
|
128
|
-
|
|
128
|
+
pushView('passkey-recovery-bundle', {
|
|
129
129
|
authenticatorType,
|
|
130
130
|
currentAction,
|
|
131
131
|
});
|
package/src/lib/utils/hooks/useInitEmbeddedWalletAuthMethod/useInitEmbeddedWalletAuthMethod.js
CHANGED
|
@@ -93,7 +93,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
93
93
|
// This hook needs to be async that's why it's not using useMutation
|
|
94
94
|
const useInitEmbeddedWalletAuthMethod = () => {
|
|
95
95
|
const { primaryWallet, environmentId, user, projectSettings, setShowAuthFlow, } = useInternalDynamicContext();
|
|
96
|
-
const {
|
|
96
|
+
const { pushView } = useViewContext();
|
|
97
97
|
const [isLoading, setIsLoading] = useState(false);
|
|
98
98
|
const [error, setError] = useState();
|
|
99
99
|
const { getEOAWallet } = useSmartWallets();
|
|
@@ -121,7 +121,7 @@ const useInitEmbeddedWalletAuthMethod = () => {
|
|
|
121
121
|
wallet: wallet,
|
|
122
122
|
});
|
|
123
123
|
if (showEmailBundle) {
|
|
124
|
-
|
|
124
|
+
pushView('passkey-recovery-bundle', {
|
|
125
125
|
authenticatorType,
|
|
126
126
|
currentAction,
|
|
127
127
|
});
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
8
7
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
9
8
|
require('@dynamic-labs/sdk-api-core');
|
|
10
9
|
require('../../../shared/logger.cjs');
|
|
11
10
|
require('@dynamic-labs/iconic');
|
|
12
11
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
12
|
require('react/jsx-runtime');
|
|
13
|
+
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
require('@dynamic-labs/wallet-book');
|
|
15
15
|
require('@dynamic-labs/utils');
|
|
16
16
|
require('../../constants/colors.cjs');
|
|
@@ -94,49 +94,49 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
94
94
|
const useMfaModals = () => {
|
|
95
95
|
var _a;
|
|
96
96
|
const { setShowAuthFlow, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
97
|
-
const {
|
|
97
|
+
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
98
98
|
const isMfaEnabled = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.mfa) === null || _a === void 0 ? void 0 : _a.enabled;
|
|
99
99
|
const setShowMfaChooseType = React.useCallback((value) => {
|
|
100
100
|
if (value) {
|
|
101
101
|
if (!isMfaEnabled)
|
|
102
102
|
return;
|
|
103
|
-
|
|
103
|
+
clearStackAndPush('mfa-choose-device');
|
|
104
104
|
}
|
|
105
105
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
106
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
106
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
107
107
|
const setShowMfaQRCode = React.useCallback((value) => {
|
|
108
108
|
if (value) {
|
|
109
109
|
if (!isMfaEnabled)
|
|
110
110
|
return;
|
|
111
111
|
// If MFA is enabled, show the MFA setup view and set it as the initial setup
|
|
112
|
-
|
|
112
|
+
clearStackAndPush('mfa-secure-device', { isInitialSetup: true });
|
|
113
113
|
}
|
|
114
114
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
115
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
115
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
116
116
|
const setShowOTPVerification = React.useCallback((value) => {
|
|
117
117
|
if (value) {
|
|
118
118
|
if (!isMfaEnabled)
|
|
119
119
|
return;
|
|
120
|
-
|
|
120
|
+
clearStackAndPush('mfa-verification');
|
|
121
121
|
}
|
|
122
122
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
123
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
123
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
124
124
|
const setShowMfaViewBackupCodes = React.useCallback((value) => {
|
|
125
125
|
if (value) {
|
|
126
126
|
if (!isMfaEnabled)
|
|
127
127
|
return;
|
|
128
|
-
|
|
128
|
+
clearStackAndPush('mfa-display-backup-codes');
|
|
129
129
|
}
|
|
130
130
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
131
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
131
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
132
132
|
const setShowMfaEnterBackupCodes = React.useCallback((value) => {
|
|
133
133
|
if (value) {
|
|
134
134
|
if (!isMfaEnabled)
|
|
135
135
|
return;
|
|
136
|
-
|
|
136
|
+
clearStackAndPush('mfa-recovery');
|
|
137
137
|
}
|
|
138
138
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
139
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
139
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
140
140
|
return {
|
|
141
141
|
setShowMfaChooseType,
|
|
142
142
|
setShowMfaEnterBackupCodes,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
-
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
4
3
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
5
4
|
import '@dynamic-labs/sdk-api-core';
|
|
6
5
|
import '../../../shared/logger.js';
|
|
7
6
|
import '@dynamic-labs/iconic';
|
|
8
7
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
8
|
import 'react/jsx-runtime';
|
|
9
|
+
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import '@dynamic-labs/wallet-book';
|
|
11
11
|
import '@dynamic-labs/utils';
|
|
12
12
|
import '../../constants/colors.js';
|
|
@@ -90,49 +90,49 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
90
90
|
const useMfaModals = () => {
|
|
91
91
|
var _a;
|
|
92
92
|
const { setShowAuthFlow, projectSettings } = useInternalDynamicContext();
|
|
93
|
-
const {
|
|
93
|
+
const { clearStackAndPush } = useViewContext();
|
|
94
94
|
const isMfaEnabled = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.mfa) === null || _a === void 0 ? void 0 : _a.enabled;
|
|
95
95
|
const setShowMfaChooseType = useCallback((value) => {
|
|
96
96
|
if (value) {
|
|
97
97
|
if (!isMfaEnabled)
|
|
98
98
|
return;
|
|
99
|
-
|
|
99
|
+
clearStackAndPush('mfa-choose-device');
|
|
100
100
|
}
|
|
101
101
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
102
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
102
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
103
103
|
const setShowMfaQRCode = useCallback((value) => {
|
|
104
104
|
if (value) {
|
|
105
105
|
if (!isMfaEnabled)
|
|
106
106
|
return;
|
|
107
107
|
// If MFA is enabled, show the MFA setup view and set it as the initial setup
|
|
108
|
-
|
|
108
|
+
clearStackAndPush('mfa-secure-device', { isInitialSetup: true });
|
|
109
109
|
}
|
|
110
110
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
111
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
111
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
112
112
|
const setShowOTPVerification = useCallback((value) => {
|
|
113
113
|
if (value) {
|
|
114
114
|
if (!isMfaEnabled)
|
|
115
115
|
return;
|
|
116
|
-
|
|
116
|
+
clearStackAndPush('mfa-verification');
|
|
117
117
|
}
|
|
118
118
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
119
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
119
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
120
120
|
const setShowMfaViewBackupCodes = useCallback((value) => {
|
|
121
121
|
if (value) {
|
|
122
122
|
if (!isMfaEnabled)
|
|
123
123
|
return;
|
|
124
|
-
|
|
124
|
+
clearStackAndPush('mfa-display-backup-codes');
|
|
125
125
|
}
|
|
126
126
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
127
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
127
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
128
128
|
const setShowMfaEnterBackupCodes = useCallback((value) => {
|
|
129
129
|
if (value) {
|
|
130
130
|
if (!isMfaEnabled)
|
|
131
131
|
return;
|
|
132
|
-
|
|
132
|
+
clearStackAndPush('mfa-recovery');
|
|
133
133
|
}
|
|
134
134
|
setShowAuthFlow(value, { emitCancelAuth: true });
|
|
135
|
-
}, [isMfaEnabled, setShowAuthFlow,
|
|
135
|
+
}, [isMfaEnabled, setShowAuthFlow, clearStackAndPush]);
|
|
136
136
|
return {
|
|
137
137
|
setShowMfaChooseType,
|
|
138
138
|
setShowMfaEnterBackupCodes,
|
|
@@ -113,7 +113,7 @@ const usePasskeyRecovery = () => {
|
|
|
113
113
|
const { initAuthMethod } = useInitEmbeddedWalletAuthMethod.useInitEmbeddedWalletAuthMethod();
|
|
114
114
|
const { setDisplayedDestination: setEmailForVerification, setVerificationUUID, } = VerificationContext.useVerification();
|
|
115
115
|
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
116
|
-
const {
|
|
116
|
+
const { pushView } = ViewContext.useViewContext();
|
|
117
117
|
const wallet = (_a = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _a !== void 0 ? _a : primaryWallet;
|
|
118
118
|
const isSessionRestored = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
119
119
|
var _d, _e;
|
|
@@ -190,7 +190,7 @@ const usePasskeyRecovery = () => {
|
|
|
190
190
|
? Object.keys(supportedAuthenticators)
|
|
191
191
|
: [];
|
|
192
192
|
if (!hasRecoveryEmail) {
|
|
193
|
-
|
|
193
|
+
pushView('passkey-recovery-add-email', { shouldInitRecovery: true });
|
|
194
194
|
setShowAuthFlow(true, {
|
|
195
195
|
ignoreIfIsEmbeddedWidget: false,
|
|
196
196
|
performMultiWalletChecks: false,
|
|
@@ -198,9 +198,7 @@ const usePasskeyRecovery = () => {
|
|
|
198
198
|
}
|
|
199
199
|
else if (!authenticatorType &&
|
|
200
200
|
supportedAuthenticatorMethods.length > 1) {
|
|
201
|
-
|
|
202
|
-
currentAction,
|
|
203
|
-
});
|
|
201
|
+
pushView('embedded-wallet-auth-choice', { currentAction });
|
|
204
202
|
setShowAuthFlow(true, {
|
|
205
203
|
ignoreIfIsEmbeddedWidget: false,
|
|
206
204
|
performMultiWalletChecks: false,
|
|
@@ -232,7 +230,7 @@ const usePasskeyRecovery = () => {
|
|
|
232
230
|
environmentId,
|
|
233
231
|
user$1,
|
|
234
232
|
setShowAuthFlow,
|
|
235
|
-
|
|
233
|
+
pushView,
|
|
236
234
|
initAuthMethod,
|
|
237
235
|
iframeContainerRef,
|
|
238
236
|
]);
|
|
@@ -264,7 +262,7 @@ const usePasskeyRecovery = () => {
|
|
|
264
262
|
if (nextView === sdkApiCore.NextViewEnum.Done) {
|
|
265
263
|
return userProfile;
|
|
266
264
|
}
|
|
267
|
-
|
|
265
|
+
pushView('verify-email', { isEmailRecoveryFlow: true });
|
|
268
266
|
setEmailForVerification(emailInput);
|
|
269
267
|
setVerificationUUID(emailVerification === null || emailVerification === void 0 ? void 0 : emailVerification.verificationUUID);
|
|
270
268
|
return new Promise((resolve, reject) => {
|
|
@@ -109,7 +109,7 @@ const usePasskeyRecovery = () => {
|
|
|
109
109
|
const { initAuthMethod } = useInitEmbeddedWalletAuthMethod();
|
|
110
110
|
const { setDisplayedDestination: setEmailForVerification, setVerificationUUID, } = useVerification();
|
|
111
111
|
const { getEOAWallet } = useSmartWallets();
|
|
112
|
-
const {
|
|
112
|
+
const { pushView } = useViewContext();
|
|
113
113
|
const wallet = (_a = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _a !== void 0 ? _a : primaryWallet;
|
|
114
114
|
const isSessionRestored = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
115
115
|
var _d, _e;
|
|
@@ -186,7 +186,7 @@ const usePasskeyRecovery = () => {
|
|
|
186
186
|
? Object.keys(supportedAuthenticators)
|
|
187
187
|
: [];
|
|
188
188
|
if (!hasRecoveryEmail) {
|
|
189
|
-
|
|
189
|
+
pushView('passkey-recovery-add-email', { shouldInitRecovery: true });
|
|
190
190
|
setShowAuthFlow(true, {
|
|
191
191
|
ignoreIfIsEmbeddedWidget: false,
|
|
192
192
|
performMultiWalletChecks: false,
|
|
@@ -194,9 +194,7 @@ const usePasskeyRecovery = () => {
|
|
|
194
194
|
}
|
|
195
195
|
else if (!authenticatorType &&
|
|
196
196
|
supportedAuthenticatorMethods.length > 1) {
|
|
197
|
-
|
|
198
|
-
currentAction,
|
|
199
|
-
});
|
|
197
|
+
pushView('embedded-wallet-auth-choice', { currentAction });
|
|
200
198
|
setShowAuthFlow(true, {
|
|
201
199
|
ignoreIfIsEmbeddedWidget: false,
|
|
202
200
|
performMultiWalletChecks: false,
|
|
@@ -228,7 +226,7 @@ const usePasskeyRecovery = () => {
|
|
|
228
226
|
environmentId,
|
|
229
227
|
user,
|
|
230
228
|
setShowAuthFlow,
|
|
231
|
-
|
|
229
|
+
pushView,
|
|
232
230
|
initAuthMethod,
|
|
233
231
|
iframeContainerRef,
|
|
234
232
|
]);
|
|
@@ -260,7 +258,7 @@ const usePasskeyRecovery = () => {
|
|
|
260
258
|
if (nextView === NextViewEnum.Done) {
|
|
261
259
|
return userProfile;
|
|
262
260
|
}
|
|
263
|
-
|
|
261
|
+
pushView('verify-email', { isEmailRecoveryFlow: true });
|
|
264
262
|
setEmailForVerification(emailInput);
|
|
265
263
|
setVerificationUUID(emailVerification === null || emailVerification === void 0 ? void 0 : emailVerification.verificationUUID);
|
|
266
264
|
return new Promise((resolve, reject) => {
|