@dynamic-labs/sdk-react-core 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +13 -13
- package/src/lib/components/Alert/Alert.types.d.ts +2 -1
- package/src/lib/components/Button/Button.cjs +2 -2
- package/src/lib/components/Button/Button.d.ts +2 -1
- package/src/lib/components/Button/Button.js +2 -2
- package/src/lib/components/CopyButton/CopyButton.d.ts +2 -1
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +2 -2
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.d.ts +3 -2
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +2 -2
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.cjs +1 -1
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.d.ts +2 -1
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.js +1 -1
- package/src/lib/components/ErrorContainer/ErrorContainer.cjs +2 -2
- package/src/lib/components/ErrorContainer/ErrorContainer.d.ts +2 -1
- package/src/lib/components/ErrorContainer/ErrorContainer.js +2 -2
- package/src/lib/components/Input/Input.types.d.ts +2 -1
- package/src/lib/components/ListTile/ListTile.cjs +1 -1
- package/src/lib/components/ListTile/ListTile.js +1 -1
- package/src/lib/components/ListTile/ListTile.types.d.ts +2 -1
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.cjs +9 -5
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.d.ts +1 -1
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.js +9 -5
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +3 -3
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +3 -3
- package/src/lib/components/NetworkPicker/components/UnsupportedNetwork/UnsupportedNetwork.cjs +1 -1
- package/src/lib/components/NetworkPicker/components/UnsupportedNetwork/UnsupportedNetwork.js +1 -1
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +7 -6
- package/src/lib/components/OTPVerificationView/OTPVerificationView.d.ts +1 -1
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +7 -6
- package/src/lib/components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs +1 -1
- package/src/lib/components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js +1 -1
- package/src/lib/components/Search/Search.cjs +1 -1
- package/src/lib/components/Search/Search.d.ts +2 -1
- package/src/lib/components/Search/Search.js +1 -1
- package/src/lib/components/SecureTurnkeyWalletCard/SecureTurnkeyWalletCard.cjs +2 -2
- package/src/lib/components/SecureTurnkeyWalletCard/SecureTurnkeyWalletCard.js +2 -2
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +3 -3
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +3 -3
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +1 -1
- package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.cjs +1 -1
- package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.js +1 -1
- package/src/lib/components/TextButton/TextButton.d.ts +2 -1
- package/src/lib/components/Tooltip/Tooltip.cjs +2 -2
- package/src/lib/components/Tooltip/Tooltip.d.ts +2 -1
- package/src/lib/components/Tooltip/Tooltip.js +2 -2
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +3 -3
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.d.ts +2 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +3 -3
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.cjs +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.d.ts +2 -1
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.js +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
- package/src/lib/components/Typography/Typography.types.d.ts +2 -1
- package/src/lib/components/UserProfile/UserProfile.cjs +2 -2
- package/src/lib/components/UserProfile/UserProfile.d.ts +1 -0
- package/src/lib/components/UserProfile/UserProfile.js +2 -2
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +2 -2
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.d.ts +3 -2
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -2
- package/src/lib/data/api.cjs +0 -13
- package/src/lib/data/api.d.ts +1 -2
- package/src/lib/data/api.js +1 -13
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +2 -2
- package/src/lib/layout/DynamicAuthLayout/Header/header.d.ts +2 -2
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +2 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/PasskeyInfoHelper.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/PasskeyInfoHelper/PasskeyInfoHelper.js +1 -1
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.cjs +2 -2
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.d.ts +2 -1
- package/src/lib/layouts/BridgeWelcomeLayout/BridgeWelcomeLayout.js +2 -2
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.cjs +2 -2
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.d.ts +2 -1
- package/src/lib/layouts/ConnectedWalletsListLayout/ConnectedWalletsListLayout.js +2 -2
- package/src/lib/locale/en/translation.cjs +124 -1
- package/src/lib/locale/en/translation.d.ts +124 -1
- package/src/lib/locale/en/translation.js +124 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +1 -1
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +2 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +2 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +2 -1
- package/src/lib/shared/types/index.d.ts +3 -0
- package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.cjs +5 -3
- package/src/lib/utils/functions/walletListBuilder/utils/groupWalletOptions/groupWalletOptions.js +5 -3
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs +28 -1
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js +28 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.d.ts +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +51 -7
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.d.ts +3 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +51 -7
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +3 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +3 -0
- package/src/lib/utils/hooks/useProcessNetworkConfigurations/index.d.ts +1 -0
- package/src/lib/utils/hooks/{useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs → useProcessNetworkConfigurations/useProcessNetworkConfigurations.cjs} +53 -67
- package/src/lib/utils/hooks/{useFetchNetworkConfigurations/useFetchNetworkConfigurations.d.ts → useProcessNetworkConfigurations/useProcessNetworkConfigurations.d.ts} +3 -2
- package/src/lib/utils/hooks/{useFetchNetworkConfigurations/useFetchNetworkConfigurations.js → useProcessNetworkConfigurations/useProcessNetworkConfigurations.js} +53 -67
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +20 -14
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +20 -14
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +26 -4
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +26 -4
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +1 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +1 -1
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +1 -1
- package/src/lib/views/AccountExistsView/AccountExistsView.js +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +1 -1
- package/src/lib/views/BridgeWelcomeView/BridgeWelcomeView.cjs +1 -1
- package/src/lib/views/BridgeWelcomeView/BridgeWelcomeView.js +1 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +3 -2
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +3 -2
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +4 -4
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +4 -4
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +9 -8
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +9 -8
- package/src/lib/views/CollectUserDataView/useFields.cjs +11 -0
- package/src/lib/views/CollectUserDataView/useFields.d.ts +11 -0
- package/src/lib/views/CollectUserDataView/useFields.js +11 -0
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +3 -3
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +3 -3
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +1 -1
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +1 -1
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +2 -2
- package/src/lib/views/EmailUpdate/EmailUpdate.js +2 -2
- package/src/lib/views/EmailVerification/EmailVerification.cjs +35 -24
- package/src/lib/views/EmailVerification/EmailVerification.js +35 -24
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +2 -3
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +2 -3
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +2 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.d.ts +3 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +2 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.js +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +1 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +3 -3
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +3 -3
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +2 -2
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +2 -2
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +3 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +3 -1
- package/src/lib/views/NoAccess/NoAccess.cjs +1 -1
- package/src/lib/views/NoAccess/NoAccess.js +1 -1
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +6 -2
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +6 -2
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +10 -5
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +10 -5
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +3 -3
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +3 -3
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +7 -4
- package/src/lib/views/PendingConnectView/PendingConnectView.js +7 -4
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +8 -5
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +8 -5
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +11 -8
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +11 -8
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +1 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.js +1 -1
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.d.ts +2 -1
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +1 -1
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +1 -1
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +4 -3
- package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +4 -3
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +8 -6
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.d.ts +2 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +8 -6
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +1 -1
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +1 -1
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.cjs +1 -1
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.js +1 -1
- package/src/lib/views/WalletList/WalletList.cjs +6 -9
- package/src/lib/views/WalletList/WalletList.js +6 -9
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +3 -2
- package/src/lib/views/WalletLockedView/WalletLockedView.js +3 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +4 -3
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +4 -3
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +5 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +5 -3
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.d.ts +3 -2
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +1 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/index.d.ts +0 -1
- /package/src/lib/utils/hooks/{useFetchNetworkConfigurations → useProcessNetworkConfigurations}/utils/index.d.ts +0 -0
- /package/src/lib/utils/hooks/{useFetchNetworkConfigurations → useProcessNetworkConfigurations}/utils/mergeCustomerEvmNetworksWithServerNetworks/index.d.ts +0 -0
- /package/src/lib/utils/hooks/{useFetchNetworkConfigurations → useProcessNetworkConfigurations}/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.cjs +0 -0
- /package/src/lib/utils/hooks/{useFetchNetworkConfigurations → useProcessNetworkConfigurations}/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.d.ts +0 -0
- /package/src/lib/utils/hooks/{useFetchNetworkConfigurations → useProcessNetworkConfigurations}/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.js +0 -0
|
@@ -4,14 +4,31 @@ import { useInternalDynamicContext } from '../../../../context/DynamicContext/us
|
|
|
4
4
|
import { verifyEmail } from '../../../../data/api.js';
|
|
5
5
|
import { useUpdateUserProfileByJWTCallback } from '../../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
6
6
|
import { useEmailVerificationContext } from '../../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
7
|
+
import '@dynamic-labs/sdk-api';
|
|
8
|
+
import '../../../../shared/logger.js';
|
|
9
|
+
import '@dynamic-labs/iconic';
|
|
10
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
11
|
+
import 'react/jsx-runtime';
|
|
12
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
13
|
+
import '@dynamic-labs/wallet-book';
|
|
14
|
+
import '../../../constants/colors.js';
|
|
15
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
16
|
+
import 'viem';
|
|
17
|
+
import '@dynamic-labs/utils';
|
|
18
|
+
import '../../../../shared/consts/index.js';
|
|
19
|
+
import '@dynamic-labs/multi-wallet';
|
|
20
|
+
import { isTurnkeyEnabled } from '../../../functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
7
21
|
|
|
8
22
|
// Hook exposed to the public as a scoped function in useUserUpdateRequest result
|
|
9
23
|
const useEmailVerificationRequest = () => {
|
|
10
|
-
|
|
24
|
+
var _a;
|
|
25
|
+
const { onboardingOnlyJwt, authToken, environmentId, projectSettings, primaryWallet, } = useInternalDynamicContext();
|
|
11
26
|
const jwtToken = onboardingOnlyJwt || authToken;
|
|
27
|
+
const isTurnkeyProviderEnabled = isTurnkeyEnabled(projectSettings);
|
|
12
28
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
13
29
|
const { verificationUUID: emailVerificationContextVerificationUUID } = useEmailVerificationContext();
|
|
14
30
|
const verifyEmail$1 = useCallback((verificationToken, verificationUUID) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
var _b;
|
|
15
32
|
if (!jwtToken)
|
|
16
33
|
throw new Error('No JWT token provided');
|
|
17
34
|
// VerificationUUID is saved in the context in case the view changes
|
|
@@ -23,12 +40,22 @@ const useEmailVerificationRequest = () => {
|
|
|
23
40
|
verificationToken,
|
|
24
41
|
verificationUUID: String(verificationUUID || emailVerificationContextVerificationUUID),
|
|
25
42
|
}, jwtToken);
|
|
43
|
+
if (isTurnkeyProviderEnabled &&
|
|
44
|
+
((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation) &&
|
|
45
|
+
!primaryWallet) {
|
|
46
|
+
// Don't create the user right now
|
|
47
|
+
// It will be done after the wallet creation
|
|
48
|
+
return verifyEmailResponse;
|
|
49
|
+
}
|
|
26
50
|
yield updateUserProfileByJWT(verifyEmailResponse.jwt);
|
|
27
51
|
return verifyEmailResponse;
|
|
28
52
|
}), [
|
|
29
53
|
emailVerificationContextVerificationUUID,
|
|
30
54
|
environmentId,
|
|
55
|
+
isTurnkeyProviderEnabled,
|
|
31
56
|
jwtToken,
|
|
57
|
+
primaryWallet,
|
|
58
|
+
(_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.automaticEmbeddedWalletCreation,
|
|
32
59
|
updateUserProfileByJWT,
|
|
33
60
|
]);
|
|
34
61
|
return { verifyEmail: verifyEmail$1 };
|
|
@@ -94,12 +94,14 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
94
94
|
view === 'passkey-intro' ||
|
|
95
95
|
(view === 'merge-user-accounts' && !user);
|
|
96
96
|
const showQrCodePreHeader = view === 'qr-code' && showQrCodeMessage && !showQrCodeImage;
|
|
97
|
+
const showDefaultFooter = !showDynamicFooter && !showToSFooter;
|
|
97
98
|
return {
|
|
98
99
|
displayBorderBelowHeader,
|
|
99
100
|
isWalletListTypeView,
|
|
100
101
|
showBackButton,
|
|
101
102
|
showCloseButton,
|
|
102
103
|
showConnectedWalletProgress,
|
|
104
|
+
showDefaultFooter,
|
|
103
105
|
showDynamicFooter,
|
|
104
106
|
showHeader,
|
|
105
107
|
showHelpContent,
|
|
@@ -5,6 +5,7 @@ export declare const useAuthLayoutChecks: (walletConnector?: WalletConnector | n
|
|
|
5
5
|
showBackButton: boolean;
|
|
6
6
|
showCloseButton: boolean;
|
|
7
7
|
showConnectedWalletProgress: boolean;
|
|
8
|
+
showDefaultFooter: boolean;
|
|
8
9
|
showDynamicFooter: boolean;
|
|
9
10
|
showHeader: boolean;
|
|
10
11
|
showHelpContent: boolean;
|
|
@@ -90,12 +90,14 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
90
90
|
view === 'passkey-intro' ||
|
|
91
91
|
(view === 'merge-user-accounts' && !user);
|
|
92
92
|
const showQrCodePreHeader = view === 'qr-code' && showQrCodeMessage && !showQrCodeImage;
|
|
93
|
+
const showDefaultFooter = !showDynamicFooter && !showToSFooter;
|
|
93
94
|
return {
|
|
94
95
|
displayBorderBelowHeader,
|
|
95
96
|
isWalletListTypeView,
|
|
96
97
|
showBackButton,
|
|
97
98
|
showCloseButton,
|
|
98
99
|
showConnectedWalletProgress,
|
|
100
|
+
showDefaultFooter,
|
|
99
101
|
showDynamicFooter,
|
|
100
102
|
showHeader,
|
|
101
103
|
showHelpContent,
|
|
@@ -12,101 +12,145 @@ const useDynamicLayoutData = ({ view, authMode, }) => {
|
|
|
12
12
|
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
13
13
|
if (view === 'no-access') {
|
|
14
14
|
const headerData = {
|
|
15
|
+
copykey: 'dyn_no_access.title',
|
|
15
16
|
heading: t('dyn_no_access.title'),
|
|
16
17
|
};
|
|
17
18
|
return { headerData };
|
|
18
19
|
}
|
|
19
20
|
const helpHeaderMap = {
|
|
20
21
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
22
|
+
copykey: 'dyn_login.helper.all_wallet_list',
|
|
21
23
|
heading: t('dyn_login.helper.all_wallet_list'),
|
|
22
24
|
},
|
|
23
25
|
'login-with-wallet-only': {
|
|
26
|
+
copykey: 'dyn_login.helper.wallet_only',
|
|
24
27
|
heading: t('dyn_login.helper.wallet_only'),
|
|
25
28
|
},
|
|
26
29
|
'passkey-intro': {
|
|
30
|
+
copykey: 'dyn_passkey_intro.helper.title',
|
|
27
31
|
heading: t('dyn_passkey_intro.helper.title'),
|
|
28
32
|
},
|
|
29
33
|
'pending-connect': {
|
|
34
|
+
copykey: 'dyn_login.helper.pending_connect.title',
|
|
30
35
|
heading: t('dyn_login.helper.pending_connect.title'),
|
|
31
36
|
},
|
|
32
37
|
'pending-signature': {
|
|
38
|
+
copykey: 'dyn_login.helper.pending_signature.title',
|
|
33
39
|
heading: t('dyn_login.helper.pending_signature.title'),
|
|
34
40
|
},
|
|
35
41
|
'pending-signature-without-back-button': {
|
|
42
|
+
copykey: 'dyn_login.helper.pending_signature_without_back_button.title',
|
|
36
43
|
heading: t('dyn_login.helper.pending_signature_without_back_button.title'),
|
|
37
44
|
},
|
|
38
45
|
'qr-code': {
|
|
46
|
+
copykey: 'dyn_login.helper.qr_code.title',
|
|
39
47
|
heading: t('dyn_login.helper.qr_code.title'),
|
|
40
48
|
},
|
|
41
49
|
'wallet-connect-mobile-wallets-list': {
|
|
50
|
+
copykey: 'dyn_wallet_conect.mobile.wallet_list.helper',
|
|
42
51
|
heading: t('dyn_wallet_conect.mobile.wallet_list.helper'),
|
|
43
52
|
},
|
|
44
53
|
'wallet-list': {
|
|
54
|
+
copykey: 'dyn_wallet_list.helper',
|
|
45
55
|
heading: t('dyn_wallet_list.helper'),
|
|
46
56
|
},
|
|
47
57
|
};
|
|
48
58
|
const headerMap = {
|
|
49
|
-
'account-exists': {
|
|
59
|
+
'account-exists': {
|
|
60
|
+
copykey: 'dyn_account_exists.title',
|
|
61
|
+
heading: t('dyn_account_exists.title'),
|
|
62
|
+
},
|
|
50
63
|
'chainalysis-blocked-wallet': {
|
|
64
|
+
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
51
65
|
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
52
66
|
},
|
|
53
|
-
'login-with-email-or-wallet': {
|
|
67
|
+
'login-with-email-or-wallet': {
|
|
68
|
+
copykey: 'dyn_login.title.all',
|
|
69
|
+
heading: t('dyn_login.title.all'),
|
|
70
|
+
},
|
|
54
71
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
72
|
+
copykey: 'dyn_login.title.all_wallet_list',
|
|
55
73
|
heading: t('dyn_login.title.all_wallet_list'),
|
|
56
74
|
},
|
|
57
75
|
'login-with-email-verification': {
|
|
58
|
-
|
|
76
|
+
copykey: 'dyn_otp_verification.title',
|
|
77
|
+
heading: t('dyn_otp_verification.title'),
|
|
59
78
|
},
|
|
60
79
|
'login-with-wallet-only': {
|
|
80
|
+
copykey: 'dyn_login.title.wallet_only',
|
|
61
81
|
heading: t('dyn_login.title.wallet_only'),
|
|
62
82
|
},
|
|
63
83
|
'multi-wallet-wallet-list': {
|
|
84
|
+
copykey: authMode === 'connect-only'
|
|
85
|
+
? 'dyn_wallet_list.title.connect'
|
|
86
|
+
: 'dyn_wallet_list.title.link',
|
|
64
87
|
heading: authMode === 'connect-only'
|
|
65
88
|
? t('dyn_wallet_list.title.connect')
|
|
66
89
|
: t('dyn_wallet_list.title.link'),
|
|
67
90
|
},
|
|
68
91
|
'network-not-supported': {
|
|
69
|
-
|
|
92
|
+
copykey: 'dyn_network_not_supported.title',
|
|
93
|
+
heading: t('dyn_network_not_supported.title'),
|
|
70
94
|
},
|
|
71
95
|
'passkey-recovery-bundle': {
|
|
96
|
+
copykey: isTurnkeyWalletWithoutAuthenticator
|
|
97
|
+
? 'dyn_passkey_secure_modal.code.title'
|
|
98
|
+
: 'dyn_passkey_recovery.code.title',
|
|
72
99
|
heading: isTurnkeyWalletWithoutAuthenticator
|
|
73
100
|
? t('dyn_passkey_secure_modal.code.title')
|
|
74
101
|
: t('dyn_passkey_recovery.code.title'),
|
|
75
102
|
},
|
|
76
103
|
'passkey-recovery-complete': {
|
|
104
|
+
copykey: isTurnkeyWalletWithoutAuthenticator
|
|
105
|
+
? 'dyn_passkey_secure_modal.complete.title'
|
|
106
|
+
: 'dyn_passkey_recovery.complete.title',
|
|
77
107
|
heading: isTurnkeyWalletWithoutAuthenticator
|
|
78
108
|
? t('dyn_passkey_secure_modal.complete.title')
|
|
79
109
|
: t('dyn_passkey_recovery.complete.title'),
|
|
80
110
|
},
|
|
81
111
|
'passkey-recovery-start': {
|
|
112
|
+
copykey: isTurnkeyWalletWithoutAuthenticator
|
|
113
|
+
? 'dyn_passkey_secure_modal.start.title'
|
|
114
|
+
: 'dyn_passkey_recovery.start.title',
|
|
82
115
|
heading: isTurnkeyWalletWithoutAuthenticator
|
|
83
116
|
? t('dyn_passkey_secure_modal.start.title')
|
|
84
117
|
: t('dyn_passkey_recovery.start.title'),
|
|
85
118
|
},
|
|
86
119
|
'pending-connect': {
|
|
120
|
+
copykey: 'dyn_login.connect_wallet.title',
|
|
87
121
|
heading: t('dyn_login.connect_wallet.title'),
|
|
88
122
|
},
|
|
89
123
|
'pending-signature': {
|
|
124
|
+
copykey: 'dyn_login.sign_wallet.title',
|
|
90
125
|
heading: t('dyn_login.sign_wallet.title'),
|
|
91
126
|
},
|
|
92
127
|
'qr-code': {
|
|
128
|
+
copykey: 'dyn_login.qr_code.title',
|
|
93
129
|
heading: t('dyn_login.qr_code.title'),
|
|
94
130
|
},
|
|
95
131
|
'verify-email': {
|
|
96
|
-
|
|
132
|
+
copykey: 'dyn_otp_verification.title',
|
|
133
|
+
heading: t('dyn_otp_verification.title'),
|
|
97
134
|
},
|
|
98
135
|
'wallet-connect-mobile-wallets-list': {
|
|
136
|
+
copykey: 'dyn_wallet_conect.mobile.wallet_list.title',
|
|
99
137
|
heading: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(iconic.WalletConnectIcon, { style: { height: '1.5rem', width: '1.5rem' } }), ' ', t('dyn_wallet_conect.mobile.wallet_list.title')] })),
|
|
100
138
|
},
|
|
101
139
|
'wallet-group': {
|
|
140
|
+
copykey: 'dyn_login.wallet_group.title',
|
|
102
141
|
heading: t('dyn_login.wallet_group.title'),
|
|
103
142
|
},
|
|
104
143
|
'wallet-list': {
|
|
144
|
+
copykey: 'dyn_wallet_list.title.select',
|
|
105
145
|
heading: t('dyn_wallet_list.title.select'),
|
|
106
146
|
},
|
|
107
|
-
'wallet-sign': {
|
|
147
|
+
'wallet-sign': {
|
|
148
|
+
copykey: 'dyn_wallet_transfer.sign.title',
|
|
149
|
+
heading: t('dyn_wallet_transfer.sign.title'),
|
|
150
|
+
},
|
|
108
151
|
'wallet-used': {
|
|
109
|
-
|
|
152
|
+
copykey: 'dyn_wallet_link.title',
|
|
153
|
+
heading: t('dyn_wallet_link.title'),
|
|
110
154
|
},
|
|
111
155
|
};
|
|
112
156
|
const helpHeaderData = helpHeaderMap[view];
|
|
@@ -3,9 +3,11 @@ import { ViewType } from '../../../context/ViewContext';
|
|
|
3
3
|
import { AuthModeType } from '../../../shared';
|
|
4
4
|
interface FooterContentProps {
|
|
5
5
|
heading: string;
|
|
6
|
+
copykey: string;
|
|
6
7
|
}
|
|
7
8
|
interface HeaderContentProps {
|
|
8
9
|
heading: string | JSX.Element;
|
|
10
|
+
copykey: string;
|
|
9
11
|
}
|
|
10
12
|
interface DynamicLayoutProps {
|
|
11
13
|
view: ViewType;
|
|
@@ -13,6 +15,7 @@ interface DynamicLayoutProps {
|
|
|
13
15
|
}
|
|
14
16
|
export declare const useDynamicLayoutData: ({ view, authMode, }: DynamicLayoutProps) => {
|
|
15
17
|
headerData: {
|
|
18
|
+
copykey: string;
|
|
16
19
|
heading: string;
|
|
17
20
|
};
|
|
18
21
|
helpHeaderData?: undefined;
|
|
@@ -8,101 +8,145 @@ const useDynamicLayoutData = ({ view, authMode, }) => {
|
|
|
8
8
|
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
9
9
|
if (view === 'no-access') {
|
|
10
10
|
const headerData = {
|
|
11
|
+
copykey: 'dyn_no_access.title',
|
|
11
12
|
heading: t('dyn_no_access.title'),
|
|
12
13
|
};
|
|
13
14
|
return { headerData };
|
|
14
15
|
}
|
|
15
16
|
const helpHeaderMap = {
|
|
16
17
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
18
|
+
copykey: 'dyn_login.helper.all_wallet_list',
|
|
17
19
|
heading: t('dyn_login.helper.all_wallet_list'),
|
|
18
20
|
},
|
|
19
21
|
'login-with-wallet-only': {
|
|
22
|
+
copykey: 'dyn_login.helper.wallet_only',
|
|
20
23
|
heading: t('dyn_login.helper.wallet_only'),
|
|
21
24
|
},
|
|
22
25
|
'passkey-intro': {
|
|
26
|
+
copykey: 'dyn_passkey_intro.helper.title',
|
|
23
27
|
heading: t('dyn_passkey_intro.helper.title'),
|
|
24
28
|
},
|
|
25
29
|
'pending-connect': {
|
|
30
|
+
copykey: 'dyn_login.helper.pending_connect.title',
|
|
26
31
|
heading: t('dyn_login.helper.pending_connect.title'),
|
|
27
32
|
},
|
|
28
33
|
'pending-signature': {
|
|
34
|
+
copykey: 'dyn_login.helper.pending_signature.title',
|
|
29
35
|
heading: t('dyn_login.helper.pending_signature.title'),
|
|
30
36
|
},
|
|
31
37
|
'pending-signature-without-back-button': {
|
|
38
|
+
copykey: 'dyn_login.helper.pending_signature_without_back_button.title',
|
|
32
39
|
heading: t('dyn_login.helper.pending_signature_without_back_button.title'),
|
|
33
40
|
},
|
|
34
41
|
'qr-code': {
|
|
42
|
+
copykey: 'dyn_login.helper.qr_code.title',
|
|
35
43
|
heading: t('dyn_login.helper.qr_code.title'),
|
|
36
44
|
},
|
|
37
45
|
'wallet-connect-mobile-wallets-list': {
|
|
46
|
+
copykey: 'dyn_wallet_conect.mobile.wallet_list.helper',
|
|
38
47
|
heading: t('dyn_wallet_conect.mobile.wallet_list.helper'),
|
|
39
48
|
},
|
|
40
49
|
'wallet-list': {
|
|
50
|
+
copykey: 'dyn_wallet_list.helper',
|
|
41
51
|
heading: t('dyn_wallet_list.helper'),
|
|
42
52
|
},
|
|
43
53
|
};
|
|
44
54
|
const headerMap = {
|
|
45
|
-
'account-exists': {
|
|
55
|
+
'account-exists': {
|
|
56
|
+
copykey: 'dyn_account_exists.title',
|
|
57
|
+
heading: t('dyn_account_exists.title'),
|
|
58
|
+
},
|
|
46
59
|
'chainalysis-blocked-wallet': {
|
|
60
|
+
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
47
61
|
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
48
62
|
},
|
|
49
|
-
'login-with-email-or-wallet': {
|
|
63
|
+
'login-with-email-or-wallet': {
|
|
64
|
+
copykey: 'dyn_login.title.all',
|
|
65
|
+
heading: t('dyn_login.title.all'),
|
|
66
|
+
},
|
|
50
67
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
68
|
+
copykey: 'dyn_login.title.all_wallet_list',
|
|
51
69
|
heading: t('dyn_login.title.all_wallet_list'),
|
|
52
70
|
},
|
|
53
71
|
'login-with-email-verification': {
|
|
54
|
-
|
|
72
|
+
copykey: 'dyn_otp_verification.title',
|
|
73
|
+
heading: t('dyn_otp_verification.title'),
|
|
55
74
|
},
|
|
56
75
|
'login-with-wallet-only': {
|
|
76
|
+
copykey: 'dyn_login.title.wallet_only',
|
|
57
77
|
heading: t('dyn_login.title.wallet_only'),
|
|
58
78
|
},
|
|
59
79
|
'multi-wallet-wallet-list': {
|
|
80
|
+
copykey: authMode === 'connect-only'
|
|
81
|
+
? 'dyn_wallet_list.title.connect'
|
|
82
|
+
: 'dyn_wallet_list.title.link',
|
|
60
83
|
heading: authMode === 'connect-only'
|
|
61
84
|
? t('dyn_wallet_list.title.connect')
|
|
62
85
|
: t('dyn_wallet_list.title.link'),
|
|
63
86
|
},
|
|
64
87
|
'network-not-supported': {
|
|
65
|
-
|
|
88
|
+
copykey: 'dyn_network_not_supported.title',
|
|
89
|
+
heading: t('dyn_network_not_supported.title'),
|
|
66
90
|
},
|
|
67
91
|
'passkey-recovery-bundle': {
|
|
92
|
+
copykey: isTurnkeyWalletWithoutAuthenticator
|
|
93
|
+
? 'dyn_passkey_secure_modal.code.title'
|
|
94
|
+
: 'dyn_passkey_recovery.code.title',
|
|
68
95
|
heading: isTurnkeyWalletWithoutAuthenticator
|
|
69
96
|
? t('dyn_passkey_secure_modal.code.title')
|
|
70
97
|
: t('dyn_passkey_recovery.code.title'),
|
|
71
98
|
},
|
|
72
99
|
'passkey-recovery-complete': {
|
|
100
|
+
copykey: isTurnkeyWalletWithoutAuthenticator
|
|
101
|
+
? 'dyn_passkey_secure_modal.complete.title'
|
|
102
|
+
: 'dyn_passkey_recovery.complete.title',
|
|
73
103
|
heading: isTurnkeyWalletWithoutAuthenticator
|
|
74
104
|
? t('dyn_passkey_secure_modal.complete.title')
|
|
75
105
|
: t('dyn_passkey_recovery.complete.title'),
|
|
76
106
|
},
|
|
77
107
|
'passkey-recovery-start': {
|
|
108
|
+
copykey: isTurnkeyWalletWithoutAuthenticator
|
|
109
|
+
? 'dyn_passkey_secure_modal.start.title'
|
|
110
|
+
: 'dyn_passkey_recovery.start.title',
|
|
78
111
|
heading: isTurnkeyWalletWithoutAuthenticator
|
|
79
112
|
? t('dyn_passkey_secure_modal.start.title')
|
|
80
113
|
: t('dyn_passkey_recovery.start.title'),
|
|
81
114
|
},
|
|
82
115
|
'pending-connect': {
|
|
116
|
+
copykey: 'dyn_login.connect_wallet.title',
|
|
83
117
|
heading: t('dyn_login.connect_wallet.title'),
|
|
84
118
|
},
|
|
85
119
|
'pending-signature': {
|
|
120
|
+
copykey: 'dyn_login.sign_wallet.title',
|
|
86
121
|
heading: t('dyn_login.sign_wallet.title'),
|
|
87
122
|
},
|
|
88
123
|
'qr-code': {
|
|
124
|
+
copykey: 'dyn_login.qr_code.title',
|
|
89
125
|
heading: t('dyn_login.qr_code.title'),
|
|
90
126
|
},
|
|
91
127
|
'verify-email': {
|
|
92
|
-
|
|
128
|
+
copykey: 'dyn_otp_verification.title',
|
|
129
|
+
heading: t('dyn_otp_verification.title'),
|
|
93
130
|
},
|
|
94
131
|
'wallet-connect-mobile-wallets-list': {
|
|
132
|
+
copykey: 'dyn_wallet_conect.mobile.wallet_list.title',
|
|
95
133
|
heading: (jsxs(Fragment, { children: [jsx(WalletConnectIcon, { style: { height: '1.5rem', width: '1.5rem' } }), ' ', t('dyn_wallet_conect.mobile.wallet_list.title')] })),
|
|
96
134
|
},
|
|
97
135
|
'wallet-group': {
|
|
136
|
+
copykey: 'dyn_login.wallet_group.title',
|
|
98
137
|
heading: t('dyn_login.wallet_group.title'),
|
|
99
138
|
},
|
|
100
139
|
'wallet-list': {
|
|
140
|
+
copykey: 'dyn_wallet_list.title.select',
|
|
101
141
|
heading: t('dyn_wallet_list.title.select'),
|
|
102
142
|
},
|
|
103
|
-
'wallet-sign': {
|
|
143
|
+
'wallet-sign': {
|
|
144
|
+
copykey: 'dyn_wallet_transfer.sign.title',
|
|
145
|
+
heading: t('dyn_wallet_transfer.sign.title'),
|
|
146
|
+
},
|
|
104
147
|
'wallet-used': {
|
|
105
|
-
|
|
148
|
+
copykey: 'dyn_wallet_link.title',
|
|
149
|
+
heading: t('dyn_wallet_link.title'),
|
|
106
150
|
},
|
|
107
151
|
};
|
|
108
152
|
const helpHeaderData = helpHeaderMap[view];
|
|
@@ -27,12 +27,14 @@ var isEmbeddedWalletPresent = require('../../functions/isEmbeddedWalletPresent/i
|
|
|
27
27
|
var isTurnkeyEnabled = require('../../functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
|
|
28
28
|
var smartWallet = require('../useWalletConnectors/utils/smartWallet/smartWallet.cjs');
|
|
29
29
|
var useCreateDynamicEmbeddedWalletMutation = require('../useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs');
|
|
30
|
+
var useCreateUserProfileByJWTCallback = require('../useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.cjs');
|
|
30
31
|
|
|
31
32
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
32
33
|
const useEmbeddedWallet = () => {
|
|
33
34
|
const { projectSettings, onboardingOnlyJwt, setPrimaryWalletId, walletConnectorOptions, internalSetShowAuthFlow, internalEvents, primaryWallet, environmentId, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
34
35
|
const { setView } = ViewContext.useViewContext();
|
|
35
36
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation.useCreateDynamicEmbeddedWalletMutation();
|
|
37
|
+
const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback.useCreateUserProfileByJWTCallback();
|
|
36
38
|
const userHasEmbeddedWallet = () => {
|
|
37
39
|
var _a;
|
|
38
40
|
const jwt = (_a = getAuthToken.getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
@@ -85,6 +87,7 @@ const useEmbeddedWallet = () => {
|
|
|
85
87
|
// if user already has embedded wallet, set it as primary wallet
|
|
86
88
|
if (decodedJwt) {
|
|
87
89
|
(_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _a === void 0 ? void 0 : _a.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
90
|
+
yield createUserProfileByJWT(jwt);
|
|
88
91
|
const smartWallet$1 = smartWallet.findSmartWallet(embeddedWalletVerifiedCredential, decodedJwt.verifiedCredentials);
|
|
89
92
|
if (smartWallet$1) {
|
|
90
93
|
yield smartWallet.initializeSmartWallet({
|
|
@@ -23,12 +23,14 @@ import { isEmbeddedWalletPresent } from '../../functions/isEmbeddedWalletPresent
|
|
|
23
23
|
import { isTurnkeyEnabled } from '../../functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
24
24
|
import { findSmartWallet, initializeSmartWallet } from '../useWalletConnectors/utils/smartWallet/smartWallet.js';
|
|
25
25
|
import { useCreateDynamicEmbeddedWalletMutation } from '../useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js';
|
|
26
|
+
import { useCreateUserProfileByJWTCallback } from '../useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js';
|
|
26
27
|
|
|
27
28
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
28
29
|
const useEmbeddedWallet = () => {
|
|
29
30
|
const { projectSettings, onboardingOnlyJwt, setPrimaryWalletId, walletConnectorOptions, internalSetShowAuthFlow, internalEvents, primaryWallet, environmentId, } = useInternalDynamicContext();
|
|
30
31
|
const { setView } = useViewContext();
|
|
31
32
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation();
|
|
33
|
+
const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback();
|
|
32
34
|
const userHasEmbeddedWallet = () => {
|
|
33
35
|
var _a;
|
|
34
36
|
const jwt = (_a = getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
@@ -81,6 +83,7 @@ const useEmbeddedWallet = () => {
|
|
|
81
83
|
// if user already has embedded wallet, set it as primary wallet
|
|
82
84
|
if (decodedJwt) {
|
|
83
85
|
(_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _a === void 0 ? void 0 : _a.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
86
|
+
yield createUserProfileByJWT(jwt);
|
|
84
87
|
const smartWallet = findSmartWallet(embeddedWalletVerifiedCredential, decodedJwt.verifiedCredentials);
|
|
85
88
|
if (smartWallet) {
|
|
86
89
|
yield initializeSmartWallet({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useProcessNetworkConfigurations } from './useProcessNetworkConfigurations';
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var utils = require('@dynamic-labs/utils');
|
|
7
6
|
var validators = require('../../../context/DynamicContext/validators.cjs');
|
|
8
|
-
var api = require('../../../data/api.cjs');
|
|
9
7
|
require('@dynamic-labs/sdk-api');
|
|
10
8
|
require('../../../shared/logger.cjs');
|
|
11
9
|
require('@dynamic-labs/iconic');
|
|
@@ -18,12 +16,12 @@ require('../../constants/colors.cjs');
|
|
|
18
16
|
var localStorage$1 = require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
17
|
require('viem');
|
|
20
18
|
var useLocalStorage = require('../../../shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
|
|
19
|
+
require('@dynamic-labs/utils');
|
|
21
20
|
require('../../../shared/consts/index.cjs');
|
|
22
21
|
var usePrevious = require('../usePrevious/usePrevious.cjs');
|
|
23
22
|
var mergeCustomerEvmNetworksWithServerNetworks = require('./utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.cjs');
|
|
24
23
|
|
|
25
|
-
const
|
|
26
|
-
const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks: customerEvmNetworks, maxRetries = MAX_RETRIES, }) => {
|
|
24
|
+
const useProcessNetworkConfigurations = ({ authToken, environmentId, evmNetworks: customerEvmNetworks, projectSettings, }) => {
|
|
27
25
|
var _a;
|
|
28
26
|
/**
|
|
29
27
|
* This is the version of the local storage object. If the version changes, the local storage object will be removed.
|
|
@@ -32,7 +30,6 @@ const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks:
|
|
|
32
30
|
const VERSION = 2;
|
|
33
31
|
const [lsNetworks, setLsNetworks, removeLsNetworks] = useLocalStorage.useLocalStorage(localStorage.NETWORKS_STORAGE_KEY, undefined, validators.validateLocalStorageExpiry);
|
|
34
32
|
const [loading, setLoading] = React.useState(false);
|
|
35
|
-
const [retries, setRetries] = React.useState(0);
|
|
36
33
|
const [completed, setCompleted] = React.useState(false);
|
|
37
34
|
const [lsNetworksExists, setlsNetworksExists] = React.useState(Boolean(lsNetworks === null || lsNetworks === void 0 ? void 0 : lsNetworks.configurations) && (lsNetworks === null || lsNetworks === void 0 ? void 0 : lsNetworks.version) === VERSION);
|
|
38
35
|
// Stringify the objects for easy comparison
|
|
@@ -84,76 +81,65 @@ const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks:
|
|
|
84
81
|
handleRemoveLsNetworks,
|
|
85
82
|
]);
|
|
86
83
|
React.useEffect(() => {
|
|
87
|
-
|
|
84
|
+
var _a, _b, _c, _d;
|
|
85
|
+
if (!lsNetworksExists && !loading && (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks)) {
|
|
88
86
|
setLoading(true);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
environmentId,
|
|
136
|
-
expiry,
|
|
137
|
-
version: VERSION,
|
|
138
|
-
});
|
|
139
|
-
setlsNetworksExists(true);
|
|
140
|
-
})
|
|
141
|
-
.catch((e) => {
|
|
142
|
-
setRetries((currentRetries) => currentRetries + 1);
|
|
143
|
-
})
|
|
144
|
-
.finally(() => {
|
|
145
|
-
setLoading(false);
|
|
87
|
+
const { networks } = projectSettings;
|
|
88
|
+
const expiry = new Date().getTime() + 60000 * 5;
|
|
89
|
+
const evm = networks.find((configurations) => configurations.chainName === 'evm');
|
|
90
|
+
const solana = networks.find((configurations) => configurations.chainName === 'solana');
|
|
91
|
+
const cosmos = networks.find((configurations) => configurations.chainName === 'cosmos');
|
|
92
|
+
const starknet = networks.find((configurations) => configurations.chainName === 'starknet');
|
|
93
|
+
let mergedEvmNetworks;
|
|
94
|
+
const createNetwork = (network, parser = (input) => input) => ({
|
|
95
|
+
blockExplorerUrls: network.blockExplorerUrls,
|
|
96
|
+
chainId: parser(network.chainId),
|
|
97
|
+
iconUrls: network.iconUrls,
|
|
98
|
+
lcdUrl: network.lcdUrl,
|
|
99
|
+
name: network.name,
|
|
100
|
+
nativeCurrency: network.nativeCurrency,
|
|
101
|
+
networkId: parser(network.networkId),
|
|
102
|
+
privateCustomerRpcUrls: network.privateCustomerRpcUrls,
|
|
103
|
+
rpcUrls: network.rpcUrls,
|
|
104
|
+
vanityName: network.vanityName,
|
|
105
|
+
});
|
|
106
|
+
const cosmosNetworks = (_a = cosmos === null || cosmos === void 0 ? void 0 : cosmos.networks) === null || _a === void 0 ? void 0 : _a.map((net) => createNetwork(net, parseInt));
|
|
107
|
+
const serverNetworks = (_b = evm === null || evm === void 0 ? void 0 : evm.networks) === null || _b === void 0 ? void 0 : _b.map((net) => createNetwork(net, parseInt));
|
|
108
|
+
const starknetNetworks = (_c = starknet === null || starknet === void 0 ? void 0 : starknet.networks) === null || _c === void 0 ? void 0 : _c.map((net) => createNetwork(net));
|
|
109
|
+
const solanaNetworks = (_d = solana === null || solana === void 0 ? void 0 : solana.networks) === null || _d === void 0 ? void 0 : _d.map((net) => createNetwork(net));
|
|
110
|
+
if (!serverNetworks && (customerEvmNetworks === null || customerEvmNetworks === void 0 ? void 0 : customerEvmNetworks.length)) {
|
|
111
|
+
mergedEvmNetworks = customerEvmNetworks;
|
|
112
|
+
}
|
|
113
|
+
if (!customerEvmNetworks && (serverNetworks === null || serverNetworks === void 0 ? void 0 : serverNetworks.length)) {
|
|
114
|
+
mergedEvmNetworks = serverNetworks;
|
|
115
|
+
}
|
|
116
|
+
if (serverNetworks !== undefined &&
|
|
117
|
+
serverNetworks.length &&
|
|
118
|
+
customerEvmNetworks !== undefined &&
|
|
119
|
+
customerEvmNetworks.length) {
|
|
120
|
+
mergedEvmNetworks = mergeCustomerEvmNetworksWithServerNetworks.mergeCustomerEvmNetworksWithServerNetworks(customerEvmNetworks, serverNetworks);
|
|
121
|
+
}
|
|
122
|
+
setLsNetworks({
|
|
123
|
+
configurations: {
|
|
124
|
+
cosmos: cosmosNetworks,
|
|
125
|
+
evm: mergedEvmNetworks,
|
|
126
|
+
solana: solanaNetworks,
|
|
127
|
+
starknet: starknetNetworks,
|
|
128
|
+
},
|
|
129
|
+
environmentId,
|
|
130
|
+
expiry,
|
|
131
|
+
version: VERSION,
|
|
146
132
|
});
|
|
133
|
+
setlsNetworksExists(true);
|
|
134
|
+
setLoading(false);
|
|
147
135
|
}
|
|
148
136
|
}, [
|
|
149
|
-
authToken,
|
|
150
137
|
environmentId,
|
|
151
138
|
loading,
|
|
152
139
|
customerEvmNetworks,
|
|
153
140
|
lsNetworksExists,
|
|
154
|
-
maxRetries,
|
|
155
|
-
retries,
|
|
156
141
|
setLsNetworks,
|
|
142
|
+
projectSettings,
|
|
157
143
|
]);
|
|
158
144
|
return {
|
|
159
145
|
configurations: lsNetworks === null || lsNetworks === void 0 ? void 0 : lsNetworks.configurations,
|
|
@@ -161,4 +147,4 @@ const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks:
|
|
|
161
147
|
};
|
|
162
148
|
};
|
|
163
149
|
|
|
164
|
-
exports.
|
|
150
|
+
exports.useProcessNetworkConfigurations = useProcessNetworkConfigurations;
|