@dynamic-labs/sdk-react-core 1.0.4 → 1.0.6
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 +18 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/index.cjs +1 -1
- package/src/index.js +1 -1
- package/src/lib/Main.cjs +25 -10
- package/src/lib/Main.js +25 -10
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +1 -1
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +1 -1
- package/src/lib/components/IconWithSpinner/Spinner/Spinner.cjs +1 -1
- package/src/lib/components/IconWithSpinner/Spinner/Spinner.js +1 -1
- package/src/lib/components/IconWithStatus/IconWithStatus.cjs +1 -1
- package/src/lib/components/IconWithStatus/IconWithStatus.js +1 -1
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +4 -1
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +4 -1
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +1 -1
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +1 -1
- package/src/lib/components/UserProfileForm/UserProfileForm.cjs +1 -1
- package/src/lib/components/UserProfileForm/UserProfileForm.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +2 -0
- package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.cjs +1 -1
- package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/DefaultFooter/DefaultFooter.cjs +12 -0
- package/src/lib/layout/DynamicAuthLayout/DefaultFooter/DefaultFooter.d.ts +6 -0
- package/src/lib/layout/DynamicAuthLayout/DefaultFooter/DefaultFooter.js +8 -0
- package/src/lib/layout/DynamicAuthLayout/DefaultFooter/index.d.ts +1 -0
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +1 -3
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +1 -3
- package/src/lib/shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.cjs +1 -2
- package/src/lib/shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.js +1 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getWalletIdentifier/getWalletIdentifier.cjs +7 -0
- package/src/lib/utils/functions/getWalletIdentifier/getWalletIdentifier.d.ts +2 -0
- package/src/lib/utils/functions/getWalletIdentifier/getWalletIdentifier.js +3 -0
- package/src/lib/utils/functions/getWalletIdentifier/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +5 -3
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs +1 -28
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js +1 -28
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +3 -2
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +3 -2
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +1 -1
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -1
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +6 -5
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.d.ts +2 -0
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +6 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +0 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +0 -3
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +7 -1
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.d.ts +4 -2
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +7 -1
- package/src/lib/utils/hooks/useKYCFlag/useKYCFlag.cjs +1 -1
- package/src/lib/utils/hooks/useKYCFlag/useKYCFlag.js +1 -1
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +1 -1
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +15 -21
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +15 -21
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +4 -26
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +4 -26
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs +1 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyMagicIsSetup/verifyMagicIsSetup.js +1 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.cjs +1 -1
- package/src/lib/utils/hooks/useWalletConnectorOptions/utils/verifyZeroDevIsSetup/verifyZeroDevIsSetup.js +1 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +7 -3
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +7 -3
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +1 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +1 -1
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.cjs +10 -6
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.js +10 -6
- package/src/lib/views/EmailVerification/EmailVerification.cjs +23 -34
- package/src/lib/views/EmailVerification/EmailVerification.js +23 -34
- package/src/lib/views/LoginView/LoginView.cjs +6 -1
- package/src/lib/views/LoginView/LoginView.js +6 -1
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +3 -4
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +3 -4
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +1 -1
- package/src/lib/views/LoginView/useLoginView.cjs +1 -1
- package/src/lib/views/LoginView/useLoginView.js +1 -1
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +2 -2
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +2 -2
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +1 -1
- package/src/lib/views/Passkey/utils/findEmailOtpWalletConnector/findEmailOtpWalletConnector.cjs +17 -0
- package/src/lib/views/Passkey/utils/findEmailOtpWalletConnector/findEmailOtpWalletConnector.d.ts +3 -0
- package/src/lib/views/Passkey/utils/findEmailOtpWalletConnector/findEmailOtpWalletConnector.js +13 -0
- package/src/lib/views/Passkey/utils/findEmailOtpWalletConnector/index.d.ts +1 -0
- package/src/lib/views/Passkey/utils/index.d.ts +1 -0
- package/src/lib/views/QrCodeView/QrCodeView.cjs +1 -1
- package/src/lib/views/QrCodeView/QrCodeView.js +1 -1
- package/src/lib/views/WalletList/WalletList.cjs +6 -7
- package/src/lib/views/WalletList/WalletList.js +6 -7
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +1 -6
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +1 -6
|
@@ -4,31 +4,14 @@ 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';
|
|
21
7
|
|
|
22
8
|
// Hook exposed to the public as a scoped function in useUserUpdateRequest result
|
|
23
9
|
const useEmailVerificationRequest = () => {
|
|
24
|
-
|
|
25
|
-
const { onboardingOnlyJwt, authToken, environmentId, projectSettings, primaryWallet, } = useInternalDynamicContext();
|
|
10
|
+
const { onboardingOnlyJwt, authToken, environmentId } = useInternalDynamicContext();
|
|
26
11
|
const jwtToken = onboardingOnlyJwt || authToken;
|
|
27
|
-
const isTurnkeyProviderEnabled = isTurnkeyEnabled(projectSettings);
|
|
28
12
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
29
13
|
const { verificationUUID: emailVerificationContextVerificationUUID } = useEmailVerificationContext();
|
|
30
14
|
const verifyEmail$1 = useCallback((verificationToken, verificationUUID) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
var _b;
|
|
32
15
|
if (!jwtToken)
|
|
33
16
|
throw new Error('No JWT token provided');
|
|
34
17
|
// VerificationUUID is saved in the context in case the view changes
|
|
@@ -40,22 +23,12 @@ const useEmailVerificationRequest = () => {
|
|
|
40
23
|
verificationToken,
|
|
41
24
|
verificationUUID: String(verificationUUID || emailVerificationContextVerificationUUID),
|
|
42
25
|
}, 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
|
-
}
|
|
50
26
|
yield updateUserProfileByJWT(verifyEmailResponse.jwt);
|
|
51
27
|
return verifyEmailResponse;
|
|
52
28
|
}), [
|
|
53
29
|
emailVerificationContextVerificationUUID,
|
|
54
30
|
environmentId,
|
|
55
|
-
isTurnkeyProviderEnabled,
|
|
56
31
|
jwtToken,
|
|
57
|
-
primaryWallet,
|
|
58
|
-
(_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.automaticEmbeddedWalletCreation,
|
|
59
32
|
updateUserProfileByJWT,
|
|
60
33
|
]);
|
|
61
34
|
return { verifyEmail: verifyEmail$1 };
|
|
@@ -64,7 +64,8 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
64
64
|
// Don't show empty footer during the login
|
|
65
65
|
((view === 'login-with-email-or-wallet' ||
|
|
66
66
|
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
67
|
-
view === 'login-with-wallet-only'
|
|
67
|
+
view === 'login-with-wallet-only' ||
|
|
68
|
+
view === 'multi-wallet-wallet-list') &&
|
|
68
69
|
(termsOfServiceUrl ||
|
|
69
70
|
privacyPolicyUrl ||
|
|
70
71
|
customPrivacyPolicy ||
|
|
@@ -94,7 +95,7 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
94
95
|
view === 'passkey-intro' ||
|
|
95
96
|
(view === 'merge-user-accounts' && !user);
|
|
96
97
|
const showQrCodePreHeader = view === 'qr-code' && showQrCodeMessage && !showQrCodeImage;
|
|
97
|
-
const showDefaultFooter = !showDynamicFooter && !showToSFooter;
|
|
98
|
+
const showDefaultFooter = !showConnectedWalletProgress && !showDynamicFooter && !showToSFooter;
|
|
98
99
|
return {
|
|
99
100
|
displayBorderBelowHeader,
|
|
100
101
|
isWalletListTypeView,
|
|
@@ -60,7 +60,8 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
60
60
|
// Don't show empty footer during the login
|
|
61
61
|
((view === 'login-with-email-or-wallet' ||
|
|
62
62
|
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
63
|
-
view === 'login-with-wallet-only'
|
|
63
|
+
view === 'login-with-wallet-only' ||
|
|
64
|
+
view === 'multi-wallet-wallet-list') &&
|
|
64
65
|
(termsOfServiceUrl ||
|
|
65
66
|
privacyPolicyUrl ||
|
|
66
67
|
customPrivacyPolicy ||
|
|
@@ -90,7 +91,7 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
90
91
|
view === 'passkey-intro' ||
|
|
91
92
|
(view === 'merge-user-accounts' && !user);
|
|
92
93
|
const showQrCodePreHeader = view === 'qr-code' && showQrCodeMessage && !showQrCodeImage;
|
|
93
|
-
const showDefaultFooter = !showDynamicFooter && !showToSFooter;
|
|
94
|
+
const showDefaultFooter = !showConnectedWalletProgress && !showDynamicFooter && !showToSFooter;
|
|
94
95
|
return {
|
|
95
96
|
displayBorderBelowHeader,
|
|
96
97
|
isWalletListTypeView,
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
7
7
|
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
8
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
8
9
|
require('@dynamic-labs/sdk-api');
|
|
9
10
|
require('../../../shared/logger.cjs');
|
|
10
11
|
require('@dynamic-labs/iconic');
|
|
11
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
12
12
|
require('react/jsx-runtime');
|
|
13
13
|
require('@dynamic-labs/wallet-book');
|
|
14
14
|
require('../../constants/colors.cjs');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
3
3
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
4
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
4
5
|
import '@dynamic-labs/sdk-api';
|
|
5
6
|
import '../../../shared/logger.js';
|
|
6
7
|
import '@dynamic-labs/iconic';
|
|
7
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import 'react/jsx-runtime';
|
|
9
9
|
import '@dynamic-labs/wallet-book';
|
|
10
10
|
import '../../constants/colors.js';
|
|
@@ -6,11 +6,11 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
|
6
6
|
var createEmbeddedWalletWithPasskey = require('../../../views/Passkey/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.cjs');
|
|
7
7
|
var findPasskeyEmailWalletConnector = require('../../../views/Passkey/utils/findPasskeyEmailWalletConnector/findPasskeyEmailWalletConnector.cjs');
|
|
8
8
|
var createPregeneratedWallet = require('../../../views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.cjs');
|
|
9
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
9
10
|
var createUserProfile = require('../../functions/createUserProfile/createUserProfile.cjs');
|
|
10
11
|
require('@dynamic-labs/sdk-api');
|
|
11
12
|
var logger = require('../../../shared/logger.cjs');
|
|
12
13
|
require('@dynamic-labs/iconic');
|
|
13
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
14
14
|
require('react/jsx-runtime');
|
|
15
15
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
16
16
|
require('react');
|
|
@@ -2,11 +2,11 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
|
2
2
|
import { createEmbeddedWalletWithPasskey } from '../../../views/Passkey/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.js';
|
|
3
3
|
import { findPasskeyEmailWalletConnector } from '../../../views/Passkey/utils/findPasskeyEmailWalletConnector/findPasskeyEmailWalletConnector.js';
|
|
4
4
|
import { createPregeneratedWallet } from '../../../views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.js';
|
|
5
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
5
6
|
import { createUserProfile } from '../../functions/createUserProfile/createUserProfile.js';
|
|
6
7
|
import '@dynamic-labs/sdk-api';
|
|
7
8
|
import { logger } from '../../../shared/logger.js';
|
|
8
9
|
import '@dynamic-labs/iconic';
|
|
9
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import '../../../context/ViewContext/ViewContext.js';
|
|
12
12
|
import 'react';
|
|
@@ -10,9 +10,9 @@ var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
|
10
10
|
var useWalletItemActions = require('../useWalletItemActions/useWalletItemActions.cjs');
|
|
11
11
|
var useConnectWithEmail = require('../useConnectWithEmail/useConnectWithEmail.cjs');
|
|
12
12
|
var api = require('../../../data/api.cjs');
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
14
|
require('../../../shared/logger.cjs');
|
|
14
15
|
require('@dynamic-labs/iconic');
|
|
15
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
16
16
|
require('react/jsx-runtime');
|
|
17
17
|
require('react');
|
|
18
18
|
require('@dynamic-labs/wallet-book');
|
|
@@ -22,8 +22,11 @@ require('viem');
|
|
|
22
22
|
require('@dynamic-labs/utils');
|
|
23
23
|
require('../../../shared/consts/index.cjs');
|
|
24
24
|
require('@dynamic-labs/multi-wallet');
|
|
25
|
+
var isProviderEnabled = require('../../functions/isProviderEnabled/isProviderEnabled.cjs');
|
|
25
26
|
var isTurnkeyEnabled = require('../../functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
|
|
26
27
|
|
|
28
|
+
const checkMagicOrBloctoEnabled = (providers) => isProviderEnabled.isProviderEnabled(providers || [], sdkApi.ProviderEnum.MagicLink) ||
|
|
29
|
+
isProviderEnabled.isProviderEnabled(providers || [], sdkApi.ProviderEnum.Blocto);
|
|
27
30
|
const useEmailProvider = ({ emailWalletConnector }) => {
|
|
28
31
|
const { projectSettings, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
29
32
|
const { setEmail: setEmailForVerification, setVerificationUUID } = EmailVerificationContext.useEmailVerificationContext();
|
|
@@ -38,10 +41,7 @@ const useEmailProvider = ({ emailWalletConnector }) => {
|
|
|
38
41
|
// this is enabled in the sense that we could use the given provider in the email form
|
|
39
42
|
// for magic, as long as there are magic credentials available, then could have an email
|
|
40
43
|
// address that is a magic address, even if magic was previously turned off in dashboard
|
|
41
|
-
const isMagicOrBloctoEnabled = isInjectedWalletProviderEnabled &&
|
|
42
|
-
Boolean(providers === null || providers === void 0 ? void 0 : providers.filter((provider) => (provider.provider === sdkApi.ProviderEnum.MagicLink &&
|
|
43
|
-
Boolean(provider.providerProjectId)) ||
|
|
44
|
-
(provider.enabledAt && provider.provider === sdkApi.ProviderEnum.Blocto)).length);
|
|
44
|
+
const isMagicOrBloctoEnabled = isInjectedWalletProviderEnabled && checkMagicOrBloctoEnabled(providers);
|
|
45
45
|
const handleEmailOnlyLoginSubmit = (emailInput, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
46
|
const { email, verificationUUID } = yield api.createEmailVerification({
|
|
47
47
|
captchaToken,
|
|
@@ -89,4 +89,5 @@ const useEmailProvider = ({ emailWalletConnector }) => {
|
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
+
exports.checkMagicOrBloctoEnabled = checkMagicOrBloctoEnabled;
|
|
92
93
|
exports.useEmailProvider = useEmailProvider;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { IEmailWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
import { Provider } from '@dynamic-labs/sdk-api';
|
|
2
3
|
type Props = {
|
|
3
4
|
emailWalletConnector: IEmailWalletConnector | undefined;
|
|
4
5
|
};
|
|
6
|
+
export declare const checkMagicOrBloctoEnabled: (providers: Provider[] | undefined) => boolean;
|
|
5
7
|
export declare const useEmailProvider: ({ emailWalletConnector }: Props) => {
|
|
6
8
|
handleEmailSubmitWithOptionalCaptcha: (emailInput: string, captchaToken?: string) => Promise<void>;
|
|
7
9
|
isEmailProviderLoading: boolean;
|
|
@@ -6,9 +6,9 @@ import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
|
6
6
|
import { useWalletItemActions } from '../useWalletItemActions/useWalletItemActions.js';
|
|
7
7
|
import { useConnectWithEmail } from '../useConnectWithEmail/useConnectWithEmail.js';
|
|
8
8
|
import { getEmailProvider, createEmailVerification } from '../../../data/api.js';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
9
10
|
import '../../../shared/logger.js';
|
|
10
11
|
import '@dynamic-labs/iconic';
|
|
11
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
12
12
|
import 'react/jsx-runtime';
|
|
13
13
|
import 'react';
|
|
14
14
|
import '@dynamic-labs/wallet-book';
|
|
@@ -18,8 +18,11 @@ import 'viem';
|
|
|
18
18
|
import '@dynamic-labs/utils';
|
|
19
19
|
import '../../../shared/consts/index.js';
|
|
20
20
|
import '@dynamic-labs/multi-wallet';
|
|
21
|
+
import { isProviderEnabled } from '../../functions/isProviderEnabled/isProviderEnabled.js';
|
|
21
22
|
import { isTurnkeyEnabled } from '../../functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
22
23
|
|
|
24
|
+
const checkMagicOrBloctoEnabled = (providers) => isProviderEnabled(providers || [], ProviderEnum.MagicLink) ||
|
|
25
|
+
isProviderEnabled(providers || [], ProviderEnum.Blocto);
|
|
23
26
|
const useEmailProvider = ({ emailWalletConnector }) => {
|
|
24
27
|
const { projectSettings, environmentId } = useInternalDynamicContext();
|
|
25
28
|
const { setEmail: setEmailForVerification, setVerificationUUID } = useEmailVerificationContext();
|
|
@@ -34,10 +37,7 @@ const useEmailProvider = ({ emailWalletConnector }) => {
|
|
|
34
37
|
// this is enabled in the sense that we could use the given provider in the email form
|
|
35
38
|
// for magic, as long as there are magic credentials available, then could have an email
|
|
36
39
|
// address that is a magic address, even if magic was previously turned off in dashboard
|
|
37
|
-
const isMagicOrBloctoEnabled = isInjectedWalletProviderEnabled &&
|
|
38
|
-
Boolean(providers === null || providers === void 0 ? void 0 : providers.filter((provider) => (provider.provider === ProviderEnum.MagicLink &&
|
|
39
|
-
Boolean(provider.providerProjectId)) ||
|
|
40
|
-
(provider.enabledAt && provider.provider === ProviderEnum.Blocto)).length);
|
|
40
|
+
const isMagicOrBloctoEnabled = isInjectedWalletProviderEnabled && checkMagicOrBloctoEnabled(providers);
|
|
41
41
|
const handleEmailOnlyLoginSubmit = (emailInput, captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
42
|
const { email, verificationUUID } = yield createEmailVerification({
|
|
43
43
|
captchaToken,
|
|
@@ -85,4 +85,4 @@ const useEmailProvider = ({ emailWalletConnector }) => {
|
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
export { useEmailProvider };
|
|
88
|
+
export { checkMagicOrBloctoEnabled, useEmailProvider };
|
|
@@ -27,14 +27,12 @@ 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');
|
|
31
30
|
|
|
32
31
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
33
32
|
const useEmbeddedWallet = () => {
|
|
34
33
|
const { projectSettings, onboardingOnlyJwt, setPrimaryWalletId, walletConnectorOptions, internalSetShowAuthFlow, internalEvents, primaryWallet, environmentId, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
35
34
|
const { setView } = ViewContext.useViewContext();
|
|
36
35
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation.useCreateDynamicEmbeddedWalletMutation();
|
|
37
|
-
const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback.useCreateUserProfileByJWTCallback();
|
|
38
36
|
const userHasEmbeddedWallet = () => {
|
|
39
37
|
var _a;
|
|
40
38
|
const jwt = (_a = getAuthToken.getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
@@ -87,7 +85,6 @@ const useEmbeddedWallet = () => {
|
|
|
87
85
|
// if user already has embedded wallet, set it as primary wallet
|
|
88
86
|
if (decodedJwt) {
|
|
89
87
|
(_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _a === void 0 ? void 0 : _a.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
90
|
-
yield createUserProfileByJWT(jwt);
|
|
91
88
|
const smartWallet$1 = smartWallet.findSmartWallet(embeddedWalletVerifiedCredential, decodedJwt.verifiedCredentials);
|
|
92
89
|
if (smartWallet$1) {
|
|
93
90
|
yield smartWallet.initializeSmartWallet({
|
|
@@ -23,14 +23,12 @@ 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';
|
|
27
26
|
|
|
28
27
|
// Hook exposed to customers and used internally to trigger embedded wallet creation
|
|
29
28
|
const useEmbeddedWallet = () => {
|
|
30
29
|
const { projectSettings, onboardingOnlyJwt, setPrimaryWalletId, walletConnectorOptions, internalSetShowAuthFlow, internalEvents, primaryWallet, environmentId, } = useInternalDynamicContext();
|
|
31
30
|
const { setView } = useViewContext();
|
|
32
31
|
const { createDynamicEmbeddedWalletMutation } = useCreateDynamicEmbeddedWalletMutation();
|
|
33
|
-
const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback();
|
|
34
32
|
const userHasEmbeddedWallet = () => {
|
|
35
33
|
var _a;
|
|
36
34
|
const jwt = (_a = getAuthToken()) !== null && _a !== void 0 ? _a : onboardingOnlyJwt;
|
|
@@ -83,7 +81,6 @@ const useEmbeddedWallet = () => {
|
|
|
83
81
|
// if user already has embedded wallet, set it as primary wallet
|
|
84
82
|
if (decodedJwt) {
|
|
85
83
|
(_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletConnector) === null || _a === void 0 ? void 0 : _a.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
86
|
-
yield createUserProfileByJWT(jwt);
|
|
87
84
|
const smartWallet = findSmartWallet(embeddedWalletVerifiedCredential, decodedJwt.verifiedCredentials);
|
|
88
85
|
if (smartWallet) {
|
|
89
86
|
yield initializeSmartWallet({
|
|
@@ -20,7 +20,7 @@ require('../../../shared/consts/index.cjs');
|
|
|
20
20
|
var handleUnlinkHelper = require('../../functions/handleUnlinkHelper/handleUnlinkHelper.cjs');
|
|
21
21
|
var isSameWalletName = require('../../functions/isSameWalletName/isSameWalletName.cjs');
|
|
22
22
|
|
|
23
|
-
const useHandleUnlinkWallet = ({ verifiedCredentials, environmentId, primaryWalletId, secondaryWallets, setUser, }) => {
|
|
23
|
+
const useHandleUnlinkWallet = ({ verifiedCredentials, environmentId, primaryWalletId, secondaryWallets, setUser, user, eventsCallbacks, }) => {
|
|
24
24
|
const callback = React.useCallback((walletId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
25
|
var _a;
|
|
26
26
|
// when we call handleUnlinkWallet on the same execution stack as setPrimaryWallet, the value of
|
|
@@ -35,6 +35,7 @@ const useHandleUnlinkWallet = ({ verifiedCredentials, environmentId, primaryWall
|
|
|
35
35
|
const currentPrimaryWalletId = (_a = localStorage.LocalStorage.getFromLS(localStorage$1.PRIMARY_WALLET_ID)) !== null && _a !== void 0 ? _a : primaryWalletId;
|
|
36
36
|
if (walletId === currentPrimaryWalletId)
|
|
37
37
|
return;
|
|
38
|
+
const vcWalletFromId = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((wallet) => wallet.id === walletId);
|
|
38
39
|
const newUser = yield handleUnlinkHelper.handleUnlinkHelper({
|
|
39
40
|
environmentId,
|
|
40
41
|
primaryWalletId: currentPrimaryWalletId,
|
|
@@ -50,12 +51,17 @@ const useHandleUnlinkWallet = ({ verifiedCredentials, environmentId, primaryWall
|
|
|
50
51
|
if (numberOfLinkedWallets === 1) {
|
|
51
52
|
yield (wallet === null || wallet === void 0 ? void 0 : wallet.connector.endSession());
|
|
52
53
|
}
|
|
54
|
+
if (vcWalletFromId && (eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onUnlinkSuccess)) {
|
|
55
|
+
eventsCallbacks.onUnlinkSuccess(vcWalletFromId);
|
|
56
|
+
}
|
|
53
57
|
}), [
|
|
54
58
|
primaryWalletId,
|
|
55
59
|
environmentId,
|
|
56
60
|
secondaryWallets,
|
|
57
61
|
setUser,
|
|
58
62
|
verifiedCredentials,
|
|
63
|
+
eventsCallbacks,
|
|
64
|
+
user,
|
|
59
65
|
]);
|
|
60
66
|
return callback;
|
|
61
67
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api';
|
|
3
|
-
import { UserProfile, Wallet } from '../../../shared';
|
|
3
|
+
import { DynamicEventsCallbacks, UserProfile, Wallet } from '../../../shared';
|
|
4
4
|
type UseHandleUnlinkProps = {
|
|
5
5
|
environmentId: string;
|
|
6
6
|
primaryWalletId: string | undefined;
|
|
7
7
|
secondaryWallets: Wallet[];
|
|
8
8
|
setUser: Dispatch<SetStateAction<UserProfile | undefined>>;
|
|
9
9
|
verifiedCredentials: JwtVerifiedCredential[];
|
|
10
|
+
eventsCallbacks: DynamicEventsCallbacks | undefined;
|
|
11
|
+
user: UserProfile | undefined;
|
|
10
12
|
};
|
|
11
|
-
export declare const useHandleUnlinkWallet: ({ verifiedCredentials, environmentId, primaryWalletId, secondaryWallets, setUser, }: UseHandleUnlinkProps) => (walletId: string) => Promise<void>;
|
|
13
|
+
export declare const useHandleUnlinkWallet: ({ verifiedCredentials, environmentId, primaryWalletId, secondaryWallets, setUser, user, eventsCallbacks, }: UseHandleUnlinkProps) => (walletId: string) => Promise<void>;
|
|
12
14
|
export {};
|
|
@@ -16,7 +16,7 @@ import '../../../shared/consts/index.js';
|
|
|
16
16
|
import { handleUnlinkHelper } from '../../functions/handleUnlinkHelper/handleUnlinkHelper.js';
|
|
17
17
|
import { isSameWalletName } from '../../functions/isSameWalletName/isSameWalletName.js';
|
|
18
18
|
|
|
19
|
-
const useHandleUnlinkWallet = ({ verifiedCredentials, environmentId, primaryWalletId, secondaryWallets, setUser, }) => {
|
|
19
|
+
const useHandleUnlinkWallet = ({ verifiedCredentials, environmentId, primaryWalletId, secondaryWallets, setUser, user, eventsCallbacks, }) => {
|
|
20
20
|
const callback = useCallback((walletId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
21
|
var _a;
|
|
22
22
|
// when we call handleUnlinkWallet on the same execution stack as setPrimaryWallet, the value of
|
|
@@ -31,6 +31,7 @@ const useHandleUnlinkWallet = ({ verifiedCredentials, environmentId, primaryWall
|
|
|
31
31
|
const currentPrimaryWalletId = (_a = LocalStorage.getFromLS(PRIMARY_WALLET_ID)) !== null && _a !== void 0 ? _a : primaryWalletId;
|
|
32
32
|
if (walletId === currentPrimaryWalletId)
|
|
33
33
|
return;
|
|
34
|
+
const vcWalletFromId = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((wallet) => wallet.id === walletId);
|
|
34
35
|
const newUser = yield handleUnlinkHelper({
|
|
35
36
|
environmentId,
|
|
36
37
|
primaryWalletId: currentPrimaryWalletId,
|
|
@@ -46,12 +47,17 @@ const useHandleUnlinkWallet = ({ verifiedCredentials, environmentId, primaryWall
|
|
|
46
47
|
if (numberOfLinkedWallets === 1) {
|
|
47
48
|
yield (wallet === null || wallet === void 0 ? void 0 : wallet.connector.endSession());
|
|
48
49
|
}
|
|
50
|
+
if (vcWalletFromId && (eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onUnlinkSuccess)) {
|
|
51
|
+
eventsCallbacks.onUnlinkSuccess(vcWalletFromId);
|
|
52
|
+
}
|
|
49
53
|
}), [
|
|
50
54
|
primaryWalletId,
|
|
51
55
|
environmentId,
|
|
52
56
|
secondaryWallets,
|
|
53
57
|
setUser,
|
|
54
58
|
verifiedCredentials,
|
|
59
|
+
eventsCallbacks,
|
|
60
|
+
user,
|
|
55
61
|
]);
|
|
56
62
|
return callback;
|
|
57
63
|
};
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
6
6
|
var useOnlyConnectedMode = require('../useOnlyConnectedMode/useOnlyConnectedMode.cjs');
|
|
7
7
|
var getUserProfileFields = require('../../functions/getUserProfileFields/getUserProfileFields.cjs');
|
|
8
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
8
9
|
require('@dynamic-labs/sdk-api');
|
|
9
10
|
require('../../../shared/logger.cjs');
|
|
10
11
|
require('@dynamic-labs/iconic');
|
|
11
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
12
12
|
require('react/jsx-runtime');
|
|
13
13
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
require('react');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
2
2
|
import { useOnlyConnectedMode } from '../useOnlyConnectedMode/useOnlyConnectedMode.js';
|
|
3
3
|
import { getUserProfileFields } from '../../functions/getUserProfileFields/getUserProfileFields.js';
|
|
4
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
4
5
|
import '@dynamic-labs/sdk-api';
|
|
5
6
|
import '../../../shared/logger.js';
|
|
6
7
|
import '@dynamic-labs/iconic';
|
|
7
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import 'react/jsx-runtime';
|
|
9
9
|
import '../../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import 'react';
|
|
@@ -7,10 +7,10 @@ var React = require('react');
|
|
|
7
7
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
8
8
|
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
9
9
|
var constants = require('../../../views/Passkey/PasskeyRecovery/constants.cjs');
|
|
10
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
10
11
|
require('@dynamic-labs/sdk-api');
|
|
11
12
|
require('../../../shared/logger.cjs');
|
|
12
13
|
require('@dynamic-labs/iconic');
|
|
13
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
14
14
|
require('react/jsx-runtime');
|
|
15
15
|
require('@dynamic-labs/wallet-book');
|
|
16
16
|
require('../../constants/colors.cjs');
|
|
@@ -3,10 +3,10 @@ import { useCallback } from 'react';
|
|
|
3
3
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
4
4
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
5
5
|
import { iframeContainerId } from '../../../views/Passkey/PasskeyRecovery/constants.js';
|
|
6
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
6
7
|
import '@dynamic-labs/sdk-api';
|
|
7
8
|
import '../../../shared/logger.js';
|
|
8
9
|
import '@dynamic-labs/iconic';
|
|
9
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import '@dynamic-labs/wallet-book';
|
|
12
12
|
import '../../constants/colors.js';
|
|
@@ -8,10 +8,10 @@ var types = require('@dynamic-labs/types');
|
|
|
8
8
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
9
9
|
var api = require('../../../data/api.cjs');
|
|
10
10
|
var useUpdateUserProfileByJWTCallback = require('../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.cjs');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
11
12
|
require('@dynamic-labs/sdk-api');
|
|
12
13
|
require('../../../shared/logger.cjs');
|
|
13
14
|
require('@dynamic-labs/iconic');
|
|
14
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
15
15
|
require('react/jsx-runtime');
|
|
16
16
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
17
17
|
require('@dynamic-labs/wallet-book');
|
|
@@ -4,10 +4,10 @@ import { SocialOAuthErrorCode } from '@dynamic-labs/types';
|
|
|
4
4
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
5
5
|
import { unlinkOAuth } from '../../../data/api.js';
|
|
6
6
|
import { useUpdateUserProfileByJWTCallback } from '../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
7
8
|
import '@dynamic-labs/sdk-api';
|
|
8
9
|
import '../../../shared/logger.js';
|
|
9
10
|
import '@dynamic-labs/iconic';
|
|
10
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
11
11
|
import 'react/jsx-runtime';
|
|
12
12
|
import '../../../context/ViewContext/ViewContext.js';
|
|
13
13
|
import '@dynamic-labs/wallet-book';
|
|
@@ -10,11 +10,11 @@ var utils = require('@dynamic-labs/utils');
|
|
|
10
10
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
11
11
|
var api = require('../../../data/api.cjs');
|
|
12
12
|
var useUpdateUserProfileByJWTCallback = require('../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.cjs');
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
14
|
var digestSHA256 = require('../../functions/digestSHA256/digestSHA256.cjs');
|
|
14
15
|
var encodeBase64URL = require('../../functions/encodeBase64URL/encodeBase64URL.cjs');
|
|
15
16
|
var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
16
17
|
require('@dynamic-labs/iconic');
|
|
17
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
18
18
|
require('react/jsx-runtime');
|
|
19
19
|
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
20
20
|
var logger = require('../../../shared/logger.cjs');
|
|
@@ -27,9 +27,7 @@ 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');
|
|
31
30
|
var randomString = require('../../functions/randomString/randomString.cjs');
|
|
32
|
-
var index = require('../../functions/storeAuthToken/index.cjs');
|
|
33
31
|
var stringifyURIQuery = require('../../functions/stringifyURIQuery/stringifyURIQuery.cjs');
|
|
34
32
|
var useCreateUserProfileByJWTCallback = require('../useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.cjs');
|
|
35
33
|
var ErrorContext = require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
@@ -60,7 +58,6 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
60
58
|
const { createEmbeddedWallet } = useEmbeddedWallet.useEmbeddedWallet();
|
|
61
59
|
const [isProcessing, setIsProcessing] = React.useState(false);
|
|
62
60
|
const [error, setError] = React.useState();
|
|
63
|
-
const isTurnkeyProviderEnabled = isTurnkeyEnabled.isTurnkeyEnabled(projectSettings);
|
|
64
61
|
const providersWaitingOauthMessage = React.useRef({});
|
|
65
62
|
const authWindowInterval = React.useRef();
|
|
66
63
|
const shouldPool = React.useRef(false);
|
|
@@ -150,25 +147,22 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
150
147
|
return;
|
|
151
148
|
}
|
|
152
149
|
setCallback('authSuccess');
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
}
|
|
150
|
+
yield createUserProfileByJWT(jwt);
|
|
151
|
+
if (!((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation)) {
|
|
152
|
+
setShowAuthFlow(false);
|
|
153
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
167
154
|
return;
|
|
168
155
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
156
|
+
try {
|
|
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
|
+
setShowAuthFlow(false);
|
|
164
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
165
|
+
}
|
|
172
166
|
}
|
|
173
167
|
catch (error) {
|
|
174
168
|
if (error instanceof utils.NoAccessError) {
|
|
@@ -6,11 +6,11 @@ import { isMobile, SocialAccountAlreadyExistsError, NoAccessError } from '@dynam
|
|
|
6
6
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
7
7
|
import { getOAuthResult, verifyOAuth, signInOAuth } from '../../../data/api.js';
|
|
8
8
|
import { useUpdateUserProfileByJWTCallback } from '../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
9
10
|
import { digestSHA256 } from '../../functions/digestSHA256/digestSHA256.js';
|
|
10
11
|
import { encodeBase64URL } from '../../functions/encodeBase64URL/encodeBase64URL.js';
|
|
11
12
|
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
12
13
|
import '@dynamic-labs/iconic';
|
|
13
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
14
14
|
import 'react/jsx-runtime';
|
|
15
15
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
16
16
|
import { logger } from '../../../shared/logger.js';
|
|
@@ -23,9 +23,7 @@ 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';
|
|
27
26
|
import { randomString } from '../../functions/randomString/randomString.js';
|
|
28
|
-
import { storeAuthToken } from '../../functions/storeAuthToken/index.js';
|
|
29
27
|
import { stringifyURIQuery } from '../../functions/stringifyURIQuery/stringifyURIQuery.js';
|
|
30
28
|
import { useCreateUserProfileByJWTCallback } from '../useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js';
|
|
31
29
|
import { useErrorContext } from '../../../context/ErrorContext/ErrorContext.js';
|
|
@@ -56,7 +54,6 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
56
54
|
const { createEmbeddedWallet } = useEmbeddedWallet();
|
|
57
55
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
58
56
|
const [error, setError] = useState();
|
|
59
|
-
const isTurnkeyProviderEnabled = isTurnkeyEnabled(projectSettings);
|
|
60
57
|
const providersWaitingOauthMessage = useRef({});
|
|
61
58
|
const authWindowInterval = useRef();
|
|
62
59
|
const shouldPool = useRef(false);
|
|
@@ -146,25 +143,22 @@ const useSocialAuth = ({ sessionTimeout, authMode, onSettled, onError, }) => {
|
|
|
146
143
|
return;
|
|
147
144
|
}
|
|
148
145
|
setCallback('authSuccess');
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
-
}
|
|
146
|
+
yield createUserProfileByJWT(jwt);
|
|
147
|
+
if (!((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.automaticEmbeddedWalletCreation)) {
|
|
148
|
+
setShowAuthFlow(false);
|
|
149
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
163
150
|
return;
|
|
164
151
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
152
|
+
try {
|
|
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
|
+
setShowAuthFlow(false);
|
|
160
|
+
onSettled === null || onSettled === void 0 ? void 0 : onSettled();
|
|
161
|
+
}
|
|
168
162
|
}
|
|
169
163
|
catch (error) {
|
|
170
164
|
if (error instanceof NoAccessError) {
|