@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
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { ProjectSettings } from '@dynamic-labs/sdk-api';
|
|
1
2
|
import { GenericNetwork } from '@dynamic-labs/types';
|
|
2
3
|
export type fetchNetworkConfigurationsProps = {
|
|
3
4
|
authToken: string | undefined;
|
|
4
5
|
environmentId: string;
|
|
5
6
|
evmNetworks?: GenericNetwork[];
|
|
6
|
-
|
|
7
|
+
projectSettings?: ProjectSettings;
|
|
7
8
|
};
|
|
8
|
-
export declare const
|
|
9
|
+
export declare const useProcessNetworkConfigurations: ({ authToken, environmentId, evmNetworks: customerEvmNetworks, projectSettings, }: fetchNetworkConfigurationsProps) => {
|
|
9
10
|
configurations: import("@dynamic-labs/types").NetworkConfigurationMap | undefined;
|
|
10
11
|
handleRemoveLsNetworks: () => void;
|
|
11
12
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect } from 'react';
|
|
2
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
3
2
|
import { validateLocalStorageExpiry } from '../../../context/DynamicContext/validators.js';
|
|
4
|
-
import { fetchNetworkSettings } from '../../../data/api.js';
|
|
5
3
|
import '@dynamic-labs/sdk-api';
|
|
6
4
|
import '../../../shared/logger.js';
|
|
7
5
|
import '@dynamic-labs/iconic';
|
|
@@ -14,12 +12,12 @@ import '../../constants/colors.js';
|
|
|
14
12
|
import { LocalStorage } from '../../../shared/utils/classes/storage/localStorage.js';
|
|
15
13
|
import 'viem';
|
|
16
14
|
import { useLocalStorage } from '../../../shared/utils/hooks/useLocalStorage/useLocalStorage.js';
|
|
15
|
+
import '@dynamic-labs/utils';
|
|
17
16
|
import '../../../shared/consts/index.js';
|
|
18
17
|
import { usePrevious } from '../usePrevious/usePrevious.js';
|
|
19
18
|
import { mergeCustomerEvmNetworksWithServerNetworks } from './utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.js';
|
|
20
19
|
|
|
21
|
-
const
|
|
22
|
-
const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks: customerEvmNetworks, maxRetries = MAX_RETRIES, }) => {
|
|
20
|
+
const useProcessNetworkConfigurations = ({ authToken, environmentId, evmNetworks: customerEvmNetworks, projectSettings, }) => {
|
|
23
21
|
var _a;
|
|
24
22
|
/**
|
|
25
23
|
* This is the version of the local storage object. If the version changes, the local storage object will be removed.
|
|
@@ -28,7 +26,6 @@ const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks:
|
|
|
28
26
|
const VERSION = 2;
|
|
29
27
|
const [lsNetworks, setLsNetworks, removeLsNetworks] = useLocalStorage(NETWORKS_STORAGE_KEY, undefined, validateLocalStorageExpiry);
|
|
30
28
|
const [loading, setLoading] = useState(false);
|
|
31
|
-
const [retries, setRetries] = useState(0);
|
|
32
29
|
const [completed, setCompleted] = useState(false);
|
|
33
30
|
const [lsNetworksExists, setlsNetworksExists] = useState(Boolean(lsNetworks === null || lsNetworks === void 0 ? void 0 : lsNetworks.configurations) && (lsNetworks === null || lsNetworks === void 0 ? void 0 : lsNetworks.version) === VERSION);
|
|
34
31
|
// Stringify the objects for easy comparison
|
|
@@ -80,76 +77,65 @@ const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks:
|
|
|
80
77
|
handleRemoveLsNetworks,
|
|
81
78
|
]);
|
|
82
79
|
useEffect(() => {
|
|
83
|
-
|
|
80
|
+
var _a, _b, _c, _d;
|
|
81
|
+
if (!lsNetworksExists && !loading && (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks)) {
|
|
84
82
|
setLoading(true);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
environmentId,
|
|
132
|
-
expiry,
|
|
133
|
-
version: VERSION,
|
|
134
|
-
});
|
|
135
|
-
setlsNetworksExists(true);
|
|
136
|
-
})
|
|
137
|
-
.catch((e) => {
|
|
138
|
-
setRetries((currentRetries) => currentRetries + 1);
|
|
139
|
-
})
|
|
140
|
-
.finally(() => {
|
|
141
|
-
setLoading(false);
|
|
83
|
+
const { networks } = projectSettings;
|
|
84
|
+
const expiry = new Date().getTime() + 60000 * 5;
|
|
85
|
+
const evm = networks.find((configurations) => configurations.chainName === 'evm');
|
|
86
|
+
const solana = networks.find((configurations) => configurations.chainName === 'solana');
|
|
87
|
+
const cosmos = networks.find((configurations) => configurations.chainName === 'cosmos');
|
|
88
|
+
const starknet = networks.find((configurations) => configurations.chainName === 'starknet');
|
|
89
|
+
let mergedEvmNetworks;
|
|
90
|
+
const createNetwork = (network, parser = (input) => input) => ({
|
|
91
|
+
blockExplorerUrls: network.blockExplorerUrls,
|
|
92
|
+
chainId: parser(network.chainId),
|
|
93
|
+
iconUrls: network.iconUrls,
|
|
94
|
+
lcdUrl: network.lcdUrl,
|
|
95
|
+
name: network.name,
|
|
96
|
+
nativeCurrency: network.nativeCurrency,
|
|
97
|
+
networkId: parser(network.networkId),
|
|
98
|
+
privateCustomerRpcUrls: network.privateCustomerRpcUrls,
|
|
99
|
+
rpcUrls: network.rpcUrls,
|
|
100
|
+
vanityName: network.vanityName,
|
|
101
|
+
});
|
|
102
|
+
const cosmosNetworks = (_a = cosmos === null || cosmos === void 0 ? void 0 : cosmos.networks) === null || _a === void 0 ? void 0 : _a.map((net) => createNetwork(net, parseInt));
|
|
103
|
+
const serverNetworks = (_b = evm === null || evm === void 0 ? void 0 : evm.networks) === null || _b === void 0 ? void 0 : _b.map((net) => createNetwork(net, parseInt));
|
|
104
|
+
const starknetNetworks = (_c = starknet === null || starknet === void 0 ? void 0 : starknet.networks) === null || _c === void 0 ? void 0 : _c.map((net) => createNetwork(net));
|
|
105
|
+
const solanaNetworks = (_d = solana === null || solana === void 0 ? void 0 : solana.networks) === null || _d === void 0 ? void 0 : _d.map((net) => createNetwork(net));
|
|
106
|
+
if (!serverNetworks && (customerEvmNetworks === null || customerEvmNetworks === void 0 ? void 0 : customerEvmNetworks.length)) {
|
|
107
|
+
mergedEvmNetworks = customerEvmNetworks;
|
|
108
|
+
}
|
|
109
|
+
if (!customerEvmNetworks && (serverNetworks === null || serverNetworks === void 0 ? void 0 : serverNetworks.length)) {
|
|
110
|
+
mergedEvmNetworks = serverNetworks;
|
|
111
|
+
}
|
|
112
|
+
if (serverNetworks !== undefined &&
|
|
113
|
+
serverNetworks.length &&
|
|
114
|
+
customerEvmNetworks !== undefined &&
|
|
115
|
+
customerEvmNetworks.length) {
|
|
116
|
+
mergedEvmNetworks = mergeCustomerEvmNetworksWithServerNetworks(customerEvmNetworks, serverNetworks);
|
|
117
|
+
}
|
|
118
|
+
setLsNetworks({
|
|
119
|
+
configurations: {
|
|
120
|
+
cosmos: cosmosNetworks,
|
|
121
|
+
evm: mergedEvmNetworks,
|
|
122
|
+
solana: solanaNetworks,
|
|
123
|
+
starknet: starknetNetworks,
|
|
124
|
+
},
|
|
125
|
+
environmentId,
|
|
126
|
+
expiry,
|
|
127
|
+
version: VERSION,
|
|
142
128
|
});
|
|
129
|
+
setlsNetworksExists(true);
|
|
130
|
+
setLoading(false);
|
|
143
131
|
}
|
|
144
132
|
}, [
|
|
145
|
-
authToken,
|
|
146
133
|
environmentId,
|
|
147
134
|
loading,
|
|
148
135
|
customerEvmNetworks,
|
|
149
136
|
lsNetworksExists,
|
|
150
|
-
maxRetries,
|
|
151
|
-
retries,
|
|
152
137
|
setLsNetworks,
|
|
138
|
+
projectSettings,
|
|
153
139
|
]);
|
|
154
140
|
return {
|
|
155
141
|
configurations: lsNetworks === null || lsNetworks === void 0 ? void 0 : lsNetworks.configurations,
|
|
@@ -157,4 +143,4 @@ const useFetchNetworkConfigurations = ({ authToken, environmentId, evmNetworks:
|
|
|
157
143
|
};
|
|
158
144
|
};
|
|
159
145
|
|
|
160
|
-
export {
|
|
146
|
+
export { useProcessNetworkConfigurations };
|
|
@@ -27,7 +27,9 @@ require('@dynamic-labs/multi-wallet');
|
|
|
27
27
|
var getAuthToken = require('../../functions/getAuthToken/getAuthToken.cjs');
|
|
28
28
|
var getOauthLoginUrl = require('../../functions/getOauthLoginUrl/getOauthLoginUrl.cjs');
|
|
29
29
|
var getProviderByType = require('../../functions/getProviderByType/getProviderByType.cjs');
|
|
30
|
+
var isTurnkeyEnabled = require('../../functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
|
|
30
31
|
var randomString = require('../../functions/randomString/randomString.cjs');
|
|
32
|
+
var index = require('../../functions/storeAuthToken/index.cjs');
|
|
31
33
|
var stringifyURIQuery = require('../../functions/stringifyURIQuery/stringifyURIQuery.cjs');
|
|
32
34
|
var useCreateUserProfileByJWTCallback = require('../useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.cjs');
|
|
33
35
|
var ErrorContext = require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
@@ -58,6 +60,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
58
60
|
const { createEmbeddedWallet } = useEmbeddedWallet.useEmbeddedWallet();
|
|
59
61
|
const [isProcessing, setIsProcessing] = React.useState(false);
|
|
60
62
|
const [error, setError] = React.useState();
|
|
63
|
+
const isTurnkeyProviderEnabled = isTurnkeyEnabled.isTurnkeyEnabled(projectSettings);
|
|
61
64
|
const providersWaitingOauthMessage = React.useRef({});
|
|
62
65
|
const authWindowInterval = React.useRef();
|
|
63
66
|
const shouldPool = React.useRef(false);
|
|
@@ -147,22 +150,25 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
147
150
|
return;
|
|
148
151
|
}
|
|
149
152
|
setCallback('authSuccess');
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
if (isTurnkeyProviderEnabled &&
|
|
154
|
+
((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation)) {
|
|
155
|
+
try {
|
|
156
|
+
index.storeAuthToken(jwt);
|
|
157
|
+
// this function will check turnkey wallet enabled and create wallet if needed
|
|
158
|
+
// if not enabled, it will throw an error.
|
|
159
|
+
yield createEmbeddedWallet();
|
|
160
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
yield createUserProfileByJWT(jwt);
|
|
164
|
+
setShowAuthFlow(false);
|
|
165
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
166
|
+
}
|
|
154
167
|
return;
|
|
155
168
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
yield createEmbeddedWallet();
|
|
160
|
-
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
161
|
-
}
|
|
162
|
-
catch (e) {
|
|
163
|
-
setShowAuthFlow(false);
|
|
164
|
-
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
165
|
-
}
|
|
169
|
+
yield createUserProfileByJWT(jwt);
|
|
170
|
+
setShowAuthFlow(false);
|
|
171
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
166
172
|
}
|
|
167
173
|
catch (error) {
|
|
168
174
|
if (error instanceof utils.NoAccessError) {
|
|
@@ -23,7 +23,9 @@ import '@dynamic-labs/multi-wallet';
|
|
|
23
23
|
import { getAuthToken } from '../../functions/getAuthToken/getAuthToken.js';
|
|
24
24
|
import { getOauthLoginUrl } from '../../functions/getOauthLoginUrl/getOauthLoginUrl.js';
|
|
25
25
|
import { getProviderByType } from '../../functions/getProviderByType/getProviderByType.js';
|
|
26
|
+
import { isTurnkeyEnabled } from '../../functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
26
27
|
import { randomString } from '../../functions/randomString/randomString.js';
|
|
28
|
+
import { storeAuthToken } from '../../functions/storeAuthToken/index.js';
|
|
27
29
|
import { stringifyURIQuery } from '../../functions/stringifyURIQuery/stringifyURIQuery.js';
|
|
28
30
|
import { useCreateUserProfileByJWTCallback } from '../useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js';
|
|
29
31
|
import { useErrorContext } from '../../../context/ErrorContext/ErrorContext.js';
|
|
@@ -54,6 +56,7 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
54
56
|
const { createEmbeddedWallet } = useEmbeddedWallet();
|
|
55
57
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
56
58
|
const [error, setError] = useState();
|
|
59
|
+
const isTurnkeyProviderEnabled = isTurnkeyEnabled(projectSettings);
|
|
57
60
|
const providersWaitingOauthMessage = useRef({});
|
|
58
61
|
const authWindowInterval = useRef();
|
|
59
62
|
const shouldPool = useRef(false);
|
|
@@ -143,22 +146,25 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
143
146
|
return;
|
|
144
147
|
}
|
|
145
148
|
setCallback('authSuccess');
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
if (isTurnkeyProviderEnabled &&
|
|
150
|
+
((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation)) {
|
|
151
|
+
try {
|
|
152
|
+
storeAuthToken(jwt);
|
|
153
|
+
// this function will check turnkey wallet enabled and create wallet if needed
|
|
154
|
+
// if not enabled, it will throw an error.
|
|
155
|
+
yield createEmbeddedWallet();
|
|
156
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
yield createUserProfileByJWT(jwt);
|
|
160
|
+
setShowAuthFlow(false);
|
|
161
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
162
|
+
}
|
|
150
163
|
return;
|
|
151
164
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
yield createEmbeddedWallet();
|
|
156
|
-
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
157
|
-
}
|
|
158
|
-
catch (e) {
|
|
159
|
-
setShowAuthFlow(false);
|
|
160
|
-
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
161
|
-
}
|
|
165
|
+
yield createUserProfileByJWT(jwt);
|
|
166
|
+
setShowAuthFlow(false);
|
|
167
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
162
168
|
}
|
|
163
169
|
catch (error) {
|
|
164
170
|
if (error instanceof NoAccessError) {
|
|
@@ -25,6 +25,8 @@ require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
|
25
25
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
26
26
|
require('@dynamic-labs/multi-wallet');
|
|
27
27
|
require('@dynamic-labs/sdk-api');
|
|
28
|
+
var isTurnkeyEnabled = require('../../../functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
|
|
29
|
+
var index = require('../../../functions/storeAuthToken/index.cjs');
|
|
28
30
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
29
31
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
30
32
|
var useEmailVerificationRequest = require('../../authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs');
|
|
@@ -54,13 +56,14 @@ const userFieldsSchema = yup.object().shape({
|
|
|
54
56
|
username: yup.string(),
|
|
55
57
|
});
|
|
56
58
|
const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
57
|
-
const { authToken, onboardingOnlyJwt, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
59
|
+
const { authToken, onboardingOnlyJwt, environmentId, projectSettings, primaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
60
|
+
const isTurnkeyProviderEnabled = isTurnkeyEnabled.isTurnkeyEnabled(projectSettings);
|
|
58
61
|
const jwtToken = onboardingOnlyJwt || authToken;
|
|
59
62
|
const { setVerificationUUID, setEmail } = EmailVerificationContext.useEmailVerificationContext();
|
|
60
63
|
const { verifyEmail } = useEmailVerificationRequest.useEmailVerificationRequest();
|
|
61
64
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
62
65
|
return React.useCallback((userFields, userEnvironmentId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
-
var _a, _b, _c;
|
|
66
|
+
var _a, _b, _c, _d;
|
|
64
67
|
// `stripUnknown: true` will automatically strip out any values in the metadata object
|
|
65
68
|
// so we need to pull out the metadata object here and then re-add it after stripping unknown fields
|
|
66
69
|
const { metadata } = userFields;
|
|
@@ -72,6 +75,25 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
72
75
|
const decodedJwt = decodeJwt.decodeJwt(updateUserProfileResponse.jwt);
|
|
73
76
|
const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
74
77
|
const _isEmailVerificationRequired = isEmailVerificationRequired.isEmailVerificationRequired(updateUserProfileResponse);
|
|
78
|
+
// This is to handle properly the embedded wallet creation.
|
|
79
|
+
// In that case we shouldn't create a user. Only store the JWT in the localstorage
|
|
80
|
+
// The user will be created after generating the wallet.
|
|
81
|
+
// This should be called only when:
|
|
82
|
+
// Turnkey is enabled
|
|
83
|
+
// automaticEmbeddedWalletCreation is set to true
|
|
84
|
+
// there is no emailVerificationRequired -> it's already verified
|
|
85
|
+
// there is no primaryWallet -> it means that the user is already logged in
|
|
86
|
+
if (isTurnkeyProviderEnabled &&
|
|
87
|
+
((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation) &&
|
|
88
|
+
!_isEmailVerificationRequired &&
|
|
89
|
+
!primaryWallet) {
|
|
90
|
+
index.storeAuthToken(updateUserProfileResponse.jwt);
|
|
91
|
+
return {
|
|
92
|
+
isEmailVerificationRequired: false,
|
|
93
|
+
missingFields,
|
|
94
|
+
updateUserProfileResponse,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
75
97
|
if (!_isEmailVerificationRequired) {
|
|
76
98
|
// If email verification is not needed then we can update the user profile immediately.
|
|
77
99
|
yield updateUserProfileByJWT(updateUserProfileResponse.jwt);
|
|
@@ -82,8 +104,8 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
82
104
|
};
|
|
83
105
|
}
|
|
84
106
|
// We update EmailContext to use this information in the Email Verification view
|
|
85
|
-
setEmail((
|
|
86
|
-
setVerificationUUID((
|
|
107
|
+
setEmail((_c = updateUserProfileResponse.emailVerification) === null || _c === void 0 ? void 0 : _c.email);
|
|
108
|
+
setVerificationUUID((_d = updateUserProfileResponse.emailVerification) === null || _d === void 0 ? void 0 : _d.verificationUUID);
|
|
87
109
|
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
88
110
|
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
89
111
|
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
@@ -21,6 +21,8 @@ import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
|
21
21
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
22
22
|
import '@dynamic-labs/multi-wallet';
|
|
23
23
|
import '@dynamic-labs/sdk-api';
|
|
24
|
+
import { isTurnkeyEnabled } from '../../../functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
25
|
+
import { storeAuthToken } from '../../../functions/storeAuthToken/index.js';
|
|
24
26
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
25
27
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
26
28
|
import { useEmailVerificationRequest } from '../../authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js';
|
|
@@ -50,13 +52,14 @@ const userFieldsSchema = object().shape({
|
|
|
50
52
|
username: string(),
|
|
51
53
|
});
|
|
52
54
|
const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
53
|
-
const { authToken, onboardingOnlyJwt, environmentId } = useInternalDynamicContext();
|
|
55
|
+
const { authToken, onboardingOnlyJwt, environmentId, projectSettings, primaryWallet, } = useInternalDynamicContext();
|
|
56
|
+
const isTurnkeyProviderEnabled = isTurnkeyEnabled(projectSettings);
|
|
54
57
|
const jwtToken = onboardingOnlyJwt || authToken;
|
|
55
58
|
const { setVerificationUUID, setEmail } = useEmailVerificationContext();
|
|
56
59
|
const { verifyEmail } = useEmailVerificationRequest();
|
|
57
60
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
58
61
|
return useCallback((userFields, userEnvironmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
var _a, _b, _c;
|
|
62
|
+
var _a, _b, _c, _d;
|
|
60
63
|
// `stripUnknown: true` will automatically strip out any values in the metadata object
|
|
61
64
|
// so we need to pull out the metadata object here and then re-add it after stripping unknown fields
|
|
62
65
|
const { metadata } = userFields;
|
|
@@ -68,6 +71,25 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
68
71
|
const decodedJwt = decodeJwt(updateUserProfileResponse.jwt);
|
|
69
72
|
const missingFields = (_a = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
70
73
|
const _isEmailVerificationRequired = isEmailVerificationRequired(updateUserProfileResponse);
|
|
74
|
+
// This is to handle properly the embedded wallet creation.
|
|
75
|
+
// In that case we shouldn't create a user. Only store the JWT in the localstorage
|
|
76
|
+
// The user will be created after generating the wallet.
|
|
77
|
+
// This should be called only when:
|
|
78
|
+
// Turnkey is enabled
|
|
79
|
+
// automaticEmbeddedWalletCreation is set to true
|
|
80
|
+
// there is no emailVerificationRequired -> it's already verified
|
|
81
|
+
// there is no primaryWallet -> it means that the user is already logged in
|
|
82
|
+
if (isTurnkeyProviderEnabled &&
|
|
83
|
+
((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation) &&
|
|
84
|
+
!_isEmailVerificationRequired &&
|
|
85
|
+
!primaryWallet) {
|
|
86
|
+
storeAuthToken(updateUserProfileResponse.jwt);
|
|
87
|
+
return {
|
|
88
|
+
isEmailVerificationRequired: false,
|
|
89
|
+
missingFields,
|
|
90
|
+
updateUserProfileResponse,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
71
93
|
if (!_isEmailVerificationRequired) {
|
|
72
94
|
// If email verification is not needed then we can update the user profile immediately.
|
|
73
95
|
yield updateUserProfileByJWT(updateUserProfileResponse.jwt);
|
|
@@ -78,8 +100,8 @@ const useUpdateUser = (validationSchemaStripUnknown) => {
|
|
|
78
100
|
};
|
|
79
101
|
}
|
|
80
102
|
// We update EmailContext to use this information in the Email Verification view
|
|
81
|
-
setEmail((
|
|
82
|
-
setVerificationUUID((
|
|
103
|
+
setEmail((_c = updateUserProfileResponse.emailVerification) === null || _c === void 0 ? void 0 : _c.email);
|
|
104
|
+
setVerificationUUID((_d = updateUserProfileResponse.emailVerification) === null || _d === void 0 ? void 0 : _d.verificationUUID);
|
|
83
105
|
// DYN-2046 - Customers have the opportunity to programmatically use our email verification and profile editing.
|
|
84
106
|
// VerifyEmailFN was scoped to bypass the problem with memoization of the state at the beginning of Promise.
|
|
85
107
|
// setEmail and setVerificationUUID in the above lines will are not visible in this promise.
|
|
@@ -88,7 +88,7 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
88
88
|
if (!shouldConfirmAction()) {
|
|
89
89
|
return handler(transaction);
|
|
90
90
|
}
|
|
91
|
-
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { walletConnector: connector, title: t('dyn_send_transaction.confirmation.title'), transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
91
|
+
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { walletConnector: connector, copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
92
92
|
}), [openSendTransaction, shouldConfirmAction, t]);
|
|
93
93
|
const disabledConfirmationOnce = React.useCallback(() => {
|
|
94
94
|
confirmationStateRef.current = 'disabled';
|
|
@@ -84,7 +84,7 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
84
84
|
if (!shouldConfirmAction()) {
|
|
85
85
|
return handler(transaction);
|
|
86
86
|
}
|
|
87
|
-
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { walletConnector: connector, title: t('dyn_send_transaction.confirmation.title'), transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
87
|
+
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { walletConnector: connector, copykey: 'dyn_send_transaction.confirmation.title', title: t('dyn_send_transaction.confirmation.title'), transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
88
88
|
}), [openSendTransaction, shouldConfirmAction, t]);
|
|
89
89
|
const disabledConfirmationOnce = useCallback(() => {
|
|
90
90
|
confirmationStateRef.current = 'disabled';
|
|
@@ -88,7 +88,7 @@ const AccountExistsView = () => {
|
|
|
88
88
|
: t('dyn_account_exists.trail_message_email');
|
|
89
89
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [t('dyn_account_exists.description'), " ", jsxRuntime.jsx("strong", { children: email }), ' ', messageTrail] }));
|
|
90
90
|
};
|
|
91
|
-
return (jsxRuntime.jsxs("div", { className: 'account-exists__container', children: [jsxRuntime.jsx(iconic.UserProfileIcon, { className: 'account-exists__image' }), jsxRuntime.jsxs("div", { className: 'account-exists__main', children: [jsxRuntime.jsx("div", { className: 'account-exists__content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'account-exists__content--secondary', children: renderFullMessage() }) }), embeddedSocialSigninProvider ? (jsxRuntime.jsxs(IconListTile.IconListTile, { dataTestId: `inline-${embeddedSocialSigninProvider}`, onClick: () => handleNewLoging(), className: 'social-sign-in--tile', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: findSocialIcon(embeddedSocialSigninProvider), isSpinning: socialProvider === existingSocialSignInProvider, iconSize: 32 }), jsxRuntime.jsx(Typography.Typography, { variant: 'button_primary', children: t('dyn_account_exists.connect', {
|
|
91
|
+
return (jsxRuntime.jsxs("div", { className: 'account-exists__container', children: [jsxRuntime.jsx(iconic.UserProfileIcon, { className: 'account-exists__image' }), jsxRuntime.jsxs("div", { className: 'account-exists__main', children: [jsxRuntime.jsx("div", { className: 'account-exists__content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'account-exists__content--secondary', copykey: 'dyn_account_exists', children: renderFullMessage() }) }), embeddedSocialSigninProvider ? (jsxRuntime.jsxs(IconListTile.IconListTile, { dataTestId: `inline-${embeddedSocialSigninProvider}`, onClick: () => handleNewLoging(), className: 'social-sign-in--tile', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: findSocialIcon(embeddedSocialSigninProvider), isSpinning: socialProvider === existingSocialSignInProvider, iconSize: 32 }), jsxRuntime.jsx(Typography.Typography, { variant: 'button_primary', copykey: 'dyn_account_exists.connect', children: t('dyn_account_exists.connect', {
|
|
92
92
|
socialOauth: capitalize.capitalize(embeddedSocialSigninProvider === null || embeddedSocialSigninProvider === void 0 ? void 0 : embeddedSocialSigninProvider.toString()),
|
|
93
93
|
}) })] }, embeddedSocialSigninProvider)) : (jsxRuntime.jsx(LoginEmailForm.LoginEmailForm, { isLoading: false, currentEmail: email }))] })] }));
|
|
94
94
|
};
|
|
@@ -84,7 +84,7 @@ const AccountExistsView = () => {
|
|
|
84
84
|
: t('dyn_account_exists.trail_message_email');
|
|
85
85
|
return (jsxs(Fragment, { children: [t('dyn_account_exists.description'), " ", jsx("strong", { children: email }), ' ', messageTrail] }));
|
|
86
86
|
};
|
|
87
|
-
return (jsxs("div", { className: 'account-exists__container', children: [jsx(UserProfileIcon, { className: 'account-exists__image' }), jsxs("div", { className: 'account-exists__main', children: [jsx("div", { className: 'account-exists__content', children: jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'account-exists__content--secondary', children: renderFullMessage() }) }), embeddedSocialSigninProvider ? (jsxs(IconListTile, { dataTestId: `inline-${embeddedSocialSigninProvider}`, onClick: () => handleNewLoging(), className: 'social-sign-in--tile', children: [jsx(IconWithSpinner, { Icon: findSocialIcon(embeddedSocialSigninProvider), isSpinning: socialProvider === existingSocialSignInProvider, iconSize: 32 }), jsx(Typography, { variant: 'button_primary', children: t('dyn_account_exists.connect', {
|
|
87
|
+
return (jsxs("div", { className: 'account-exists__container', children: [jsx(UserProfileIcon, { className: 'account-exists__image' }), jsxs("div", { className: 'account-exists__main', children: [jsx("div", { className: 'account-exists__content', children: jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'account-exists__content--secondary', copykey: 'dyn_account_exists', children: renderFullMessage() }) }), embeddedSocialSigninProvider ? (jsxs(IconListTile, { dataTestId: `inline-${embeddedSocialSigninProvider}`, onClick: () => handleNewLoging(), className: 'social-sign-in--tile', children: [jsx(IconWithSpinner, { Icon: findSocialIcon(embeddedSocialSigninProvider), isSpinning: socialProvider === existingSocialSignInProvider, iconSize: 32 }), jsx(Typography, { variant: 'button_primary', copykey: 'dyn_account_exists.connect', children: t('dyn_account_exists.connect', {
|
|
88
88
|
socialOauth: capitalize(embeddedSocialSigninProvider === null || embeddedSocialSigninProvider === void 0 ? void 0 : embeddedSocialSigninProvider.toString()),
|
|
89
89
|
}) })] }, embeddedSocialSigninProvider)) : (jsx(LoginEmailForm, { isLoading: false, currentEmail: email }))] })] }));
|
|
90
90
|
};
|
|
@@ -43,7 +43,7 @@ const BridgeSummaryView = () => {
|
|
|
43
43
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
44
44
|
jsxRuntime.jsx(Balance.Balance, { address: wallet.address, connector: wallet.connector, network: wallet.chain }) }) }));
|
|
45
45
|
};
|
|
46
|
-
return (jsxRuntime.jsxs(ConnectedWalletsListLayout.ConnectedWalletsListLayout, { onClickClose: onClickClose, onClickAction: onClickClose, title: t('dyn_bridge.summary_view.title', { appName }), body: body, children: [primaryWallet && createPrimaryWalletCard(primaryWallet), jsxRuntime.jsx(SecondaryWallets.MemoSecondaryWallets, { hideUnlinkAction: true })] }));
|
|
46
|
+
return (jsxRuntime.jsxs(ConnectedWalletsListLayout.ConnectedWalletsListLayout, { onClickClose: onClickClose, onClickAction: onClickClose, copykey: 'dyn_bridge.summary_view.title', title: t('dyn_bridge.summary_view.title', { appName }), body: body, children: [primaryWallet && createPrimaryWalletCard(primaryWallet), jsxRuntime.jsx(SecondaryWallets.MemoSecondaryWallets, { hideUnlinkAction: true })] }));
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
exports.BridgeSummaryView = BridgeSummaryView;
|
|
@@ -39,7 +39,7 @@ const BridgeSummaryView = () => {
|
|
|
39
39
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
40
40
|
jsx(Balance, { address: wallet.address, connector: wallet.connector, network: wallet.chain }) }) }));
|
|
41
41
|
};
|
|
42
|
-
return (jsxs(ConnectedWalletsListLayout, { onClickClose: onClickClose, onClickAction: onClickClose, title: t('dyn_bridge.summary_view.title', { appName }), body: body, children: [primaryWallet && createPrimaryWalletCard(primaryWallet), jsx(MemoSecondaryWallets, { hideUnlinkAction: true })] }));
|
|
42
|
+
return (jsxs(ConnectedWalletsListLayout, { onClickClose: onClickClose, onClickAction: onClickClose, copykey: 'dyn_bridge.summary_view.title', title: t('dyn_bridge.summary_view.title', { appName }), body: body, children: [primaryWallet && createPrimaryWalletCard(primaryWallet), jsx(MemoSecondaryWallets, { hideUnlinkAction: true })] }));
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export { BridgeSummaryView };
|
|
@@ -47,7 +47,7 @@ const BridgeWelcomeView = () => {
|
|
|
47
47
|
return undefined;
|
|
48
48
|
})
|
|
49
49
|
.filter(isChainInfoDefined), [bridgeChains]);
|
|
50
|
-
return (jsxRuntime.jsx(BridgeWelcomeLayout.BridgeWelcomeLayout, { onClickClose: () => setShowAuthFlow(false), title: t('dyn_bridge.welcome_view.title', { appName }), body: body, chains: chains, actionButtonText: t('dyn_bridge.welcome_view.button'), onClickAction: () => setView('wallet-list') }));
|
|
50
|
+
return (jsxRuntime.jsx(BridgeWelcomeLayout.BridgeWelcomeLayout, { onClickClose: () => setShowAuthFlow(false), title: t('dyn_bridge.welcome_view.title', { appName }), copykey: 'dyn_bridge.welcome_view.title', body: body, chains: chains, actionButtonText: t('dyn_bridge.welcome_view.button'), onClickAction: () => setView('wallet-list') }));
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
exports.BridgeWelcomeView = BridgeWelcomeView;
|
|
@@ -43,7 +43,7 @@ const BridgeWelcomeView = () => {
|
|
|
43
43
|
return undefined;
|
|
44
44
|
})
|
|
45
45
|
.filter(isChainInfoDefined), [bridgeChains]);
|
|
46
|
-
return (jsx(BridgeWelcomeLayout, { onClickClose: () => setShowAuthFlow(false), title: t('dyn_bridge.welcome_view.title', { appName }), body: body, chains: chains, actionButtonText: t('dyn_bridge.welcome_view.button'), onClickAction: () => setView('wallet-list') }));
|
|
46
|
+
return (jsx(BridgeWelcomeLayout, { onClickClose: () => setShowAuthFlow(false), title: t('dyn_bridge.welcome_view.title', { appName }), copykey: 'dyn_bridge.welcome_view.title', body: body, chains: chains, actionButtonText: t('dyn_bridge.welcome_view.button'), onClickAction: () => setView('wallet-list') }));
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
export { BridgeWelcomeView };
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
7
8
|
var iconic = require('@dynamic-labs/iconic');
|
|
8
9
|
require('react');
|
|
9
10
|
require('@dynamic-labs/utils');
|
|
@@ -28,7 +29,6 @@ require('react-dom');
|
|
|
28
29
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
29
30
|
require('@dynamic-labs/types');
|
|
30
31
|
require('yup');
|
|
31
|
-
require('react-i18next');
|
|
32
32
|
require('../../context/MockContext/MockContext.cjs');
|
|
33
33
|
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
34
34
|
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
@@ -63,12 +63,13 @@ require('react-focus-lock');
|
|
|
63
63
|
var Captcha = require('../../components/Captcha/Captcha.cjs');
|
|
64
64
|
|
|
65
65
|
const CaptchaVerifyUser = () => {
|
|
66
|
+
const { t } = reactI18next.useTranslation();
|
|
66
67
|
const { captchaAuthState } = CaptchaContext.useCaptchaContext();
|
|
67
68
|
const handleSuccess = (captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
68
69
|
var _a;
|
|
69
70
|
yield ((_a = captchaAuthState === null || captchaAuthState === void 0 ? void 0 : captchaAuthState.onCaptchaSuccess) === null || _a === void 0 ? void 0 : _a.call(captchaAuthState, captchaToken));
|
|
70
71
|
});
|
|
71
|
-
return (jsxRuntime.jsxs("div", { className: 'captcha-verify-user__container', children: [jsxRuntime.jsx(iconic.CaptchaWaveIcon, { className: 'captcha-verify-user__icon' }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'captcha-verify-user__title',
|
|
72
|
+
return (jsxRuntime.jsxs("div", { className: 'captcha-verify-user__container', children: [jsxRuntime.jsx(iconic.CaptchaWaveIcon, { className: 'captcha-verify-user__icon' }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'captcha-verify-user__title', copykey: 'dyn_captcha.verify_user_title', children: t('dyn_captcha.verify_user_title') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'captcha-verify-user__subtitle', copykey: 'dyn_captcha.verify_user_subtitle', children: t('dyn_captcha.verify_user_subtitle') }), jsxRuntime.jsx(Captcha.Captcha, { handleSuccess: handleSuccess }), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'captcha-verify-user__dynamic-logo' })] }));
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
exports.CaptchaVerifyUser = CaptchaVerifyUser;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import { CaptchaWaveIcon } from '@dynamic-labs/iconic';
|
|
4
5
|
import 'react';
|
|
5
6
|
import '@dynamic-labs/utils';
|
|
@@ -24,7 +25,6 @@ import 'react-dom';
|
|
|
24
25
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
25
26
|
import '@dynamic-labs/types';
|
|
26
27
|
import 'yup';
|
|
27
|
-
import 'react-i18next';
|
|
28
28
|
import '../../context/MockContext/MockContext.js';
|
|
29
29
|
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
30
30
|
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
@@ -59,12 +59,13 @@ import 'react-focus-lock';
|
|
|
59
59
|
import { Captcha } from '../../components/Captcha/Captcha.js';
|
|
60
60
|
|
|
61
61
|
const CaptchaVerifyUser = () => {
|
|
62
|
+
const { t } = useTranslation();
|
|
62
63
|
const { captchaAuthState } = useCaptchaContext();
|
|
63
64
|
const handleSuccess = (captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
65
|
var _a;
|
|
65
66
|
yield ((_a = captchaAuthState === null || captchaAuthState === void 0 ? void 0 : captchaAuthState.onCaptchaSuccess) === null || _a === void 0 ? void 0 : _a.call(captchaAuthState, captchaToken));
|
|
66
67
|
});
|
|
67
|
-
return (jsxs("div", { className: 'captcha-verify-user__container', children: [jsx(CaptchaWaveIcon, { className: 'captcha-verify-user__icon' }), jsx(Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'captcha-verify-user__title',
|
|
68
|
+
return (jsxs("div", { className: 'captcha-verify-user__container', children: [jsx(CaptchaWaveIcon, { className: 'captcha-verify-user__icon' }), jsx(Typography, { weight: 'medium', variant: 'title', color: 'primary', className: 'captcha-verify-user__title', copykey: 'dyn_captcha.verify_user_title', children: t('dyn_captcha.verify_user_title') }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'captcha-verify-user__subtitle', copykey: 'dyn_captcha.verify_user_subtitle', children: t('dyn_captcha.verify_user_subtitle') }), jsx(Captcha, { handleSuccess: handleSuccess }), jsx(PoweredByDynamic, { classNameRoot: 'captcha-verify-user__dynamic-logo' })] }));
|
|
68
69
|
};
|
|
69
70
|
|
|
70
71
|
export { CaptchaVerifyUser };
|