@dynamic-labs/sdk-react-core 2.1.0-alpha.22 → 2.1.0-alpha.23
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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/index.d.ts +5 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +2 -6
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +2 -6
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.cjs +11 -5
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.js +11 -5
- package/src/lib/context/DynamicContext/DynamicContext.cjs +8 -17
- package/src/lib/context/DynamicContext/DynamicContext.js +8 -17
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +0 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +0 -2
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +1 -3
- package/src/lib/context/DynamicContext/hooks/useIsAuthenticated/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useIsAuthenticated/useIsAuthenticated.cjs +37 -0
- package/src/lib/context/DynamicContext/hooks/useIsAuthenticated/useIsAuthenticated.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useIsAuthenticated/useIsAuthenticated.js +33 -0
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +9 -1
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +9 -1
- package/src/lib/context/DynamicContext/types/index.d.ts +1 -4
- package/src/lib/context/LoadingContext/LoadingContext.cjs +1 -1
- package/src/lib/context/LoadingContext/LoadingContext.js +1 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.cjs +1 -1
- package/src/lib/context/PhantomRedirectContext/useResponseHandlers.js +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +1 -1
- package/src/lib/data/api/api.cjs +1 -3
- package/src/lib/data/api/api.js +1 -3
- package/src/lib/data/api/user/user.cjs +9 -6
- package/src/lib/data/api/user/user.d.ts +5 -5
- package/src/lib/data/api/user/user.js +9 -6
- package/src/lib/data/api/wallets/wallets.cjs +6 -3
- package/src/lib/data/api/wallets/wallets.d.ts +3 -2
- package/src/lib/data/api/wallets/wallets.js +7 -4
- package/src/lib/events/auth.d.ts +38 -0
- package/src/lib/events/dynamicEvents.d.ts +8 -32
- package/src/lib/events/embeddedWallet.d.ts +14 -0
- package/src/lib/events/otp.d.ts +5 -0
- package/src/lib/events/passkey.d.ts +5 -0
- package/src/lib/events/social.d.ts +3 -0
- package/src/lib/events/ui.d.ts +10 -0
- package/src/lib/events/wallets.d.ts +7 -0
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +6 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +6 -1
- package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +11 -0
- package/src/lib/store/utils/storeAuthTokenAndUser/storeAuthTokenAndUser.cjs +1 -2
- package/src/lib/store/utils/storeAuthTokenAndUser/storeAuthTokenAndUser.d.ts +6 -2
- package/src/lib/store/utils/storeAuthTokenAndUser/storeAuthTokenAndUser.js +1 -2
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +0 -2
- package/src/lib/utils/constants/localStorage.d.ts +0 -1
- package/src/lib/utils/constants/localStorage.js +1 -2
- package/src/lib/utils/functions/index.d.ts +0 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.cjs +12 -7
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.js +13 -8
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +1 -1
- package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.d.ts +2 -2
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -2
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.d.ts +1 -2
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -2
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +29 -14
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +29 -14
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +4 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +4 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.cjs +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.js +2 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +4 -5
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +5 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +0 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +0 -1
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +2 -2
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +2 -2
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +8 -6
- package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +8 -6
- package/src/lib/utils/hooks/useHandleVerificationRequired/useHandleVerificationRequired.cjs +4 -4
- package/src/lib/utils/hooks/useHandleVerificationRequired/useHandleVerificationRequired.d.ts +4 -3
- package/src/lib/utils/hooks/useHandleVerificationRequired/useHandleVerificationRequired.js +4 -4
- package/src/lib/utils/hooks/useHandleVerifiedUser/useHandleVerifiedUser.cjs +1 -16
- package/src/lib/utils/hooks/useHandleVerifiedUser/useHandleVerifiedUser.d.ts +1 -4
- package/src/lib/utils/hooks/useHandleVerifiedUser/useHandleVerifiedUser.js +1 -16
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.js +1 -1
- package/src/lib/utils/hooks/useMfa/useMfa.cjs +37 -20
- package/src/lib/utils/hooks/useMfa/useMfa.js +37 -20
- package/src/lib/utils/hooks/useNetworkNotSupported/useNetworkNotSupported.cjs +1 -1
- package/src/lib/utils/hooks/useNetworkNotSupported/useNetworkNotSupported.js +1 -1
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +13 -12
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +13 -12
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +6 -11
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.d.ts +3 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +6 -11
- package/src/lib/utils/hooks/useSetWalletConnectorVerifiedCredentials/useSetWalletConnectorVerifiedCredentials.cjs +3 -22
- package/src/lib/utils/hooks/useSetWalletConnectorVerifiedCredentials/useSetWalletConnectorVerifiedCredentials.d.ts +2 -1
- package/src/lib/utils/hooks/useSetWalletConnectorVerifiedCredentials/useSetWalletConnectorVerifiedCredentials.js +3 -22
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +8 -8
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +8 -8
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +39 -27
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +5 -3
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +39 -27
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +39 -33
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.d.ts +2 -2
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +39 -33
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.types.d.ts +7 -24
- package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.cjs +1 -1
- package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.js +1 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +9 -16
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +10 -17
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +1 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +21 -3
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +21 -3
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +10 -26
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.d.ts +1 -2
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +10 -26
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +4 -6
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +4 -6
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +3 -5
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +3 -5
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.cjs +3 -5
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.js +3 -5
- package/src/lib/views/EmailVerification/EmailVerification.cjs +8 -5
- package/src/lib/views/EmailVerification/EmailVerification.js +8 -5
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +5 -0
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +5 -0
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +3 -6
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +3 -6
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +7 -13
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.d.ts +3 -3
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +8 -14
- package/src/lib/views/LoginView/LoginView.cjs +3 -21
- package/src/lib/views/LoginView/LoginView.js +4 -22
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/useSubmitPhoneNumber/useSubmitPhoneNumber.cjs +11 -1
- package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/useSubmitPhoneNumber/useSubmitPhoneNumber.js +11 -1
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs +3 -3
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js +3 -3
- package/src/lib/views/NoAccess/NoAccess.cjs +2 -2
- package/src/lib/views/NoAccess/NoAccess.js +2 -2
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +2 -8
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +2 -8
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +3 -3
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +3 -3
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +1 -2
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +1 -2
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs +1 -4
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.d.ts +1 -2
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.js +1 -4
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +15 -20
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.d.ts +8 -13
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +15 -20
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +11 -8
- package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +11 -8
- package/src/lib/views/viewToComponentMap.cjs +1 -1
- package/src/lib/views/viewToComponentMap.d.ts +1 -1
- package/src/lib/views/viewToComponentMap.js +1 -1
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +1 -1
- package/src/lib/utils/functions/getOnboardingAuthToken/getOnboardingAuthToken.cjs +0 -31
- package/src/lib/utils/functions/getOnboardingAuthToken/getOnboardingAuthToken.d.ts +0 -1
- package/src/lib/utils/functions/getOnboardingAuthToken/getOnboardingAuthToken.js +0 -27
- package/src/lib/utils/functions/getOnboardingAuthToken/index.d.ts +0 -1
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.cjs +0 -49
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.d.ts +0 -13
- package/src/lib/utils/functions/handleUnlinkHelper/handleUnlinkHelper.js +0 -45
- package/src/lib/utils/functions/handleUnlinkHelper/index.d.ts +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { OtpDestination, PhoneData, UserProfile } from '@dynamic-labs/types';
|
|
3
|
+
import { AuthEventPayload } from '../../events/auth';
|
|
3
4
|
import { Wallet } from './wallets';
|
|
4
5
|
export type DynamicEventsCallbacks = {
|
|
5
6
|
onSignedMessage?: (params: {
|
|
@@ -18,6 +19,16 @@ export type DynamicEventsCallbacks = {
|
|
|
18
19
|
onEmbeddedWalletCreated?: OnEmbeddedWalletCreated;
|
|
19
20
|
onWalletAdded?: OnWalletAdded;
|
|
20
21
|
onWalletRemoved?: OnWalletRemoved;
|
|
22
|
+
/**
|
|
23
|
+
* Informs an auth attempt failed.
|
|
24
|
+
* In general triggered when an error occurs or when user cancels out.
|
|
25
|
+
* For email/sms, specifically happens when users cancels the OTP verification.
|
|
26
|
+
*/
|
|
27
|
+
onAuthFailure?: (data: AuthEventPayload, reason: 'user-cancelled' | {
|
|
28
|
+
error: unknown;
|
|
29
|
+
}) => void;
|
|
30
|
+
/** Informs an auth attempt initialized, and provides insight into which auth option it is */
|
|
31
|
+
onAuthInit?: (data: AuthEventPayload) => void;
|
|
21
32
|
};
|
|
22
33
|
export type OnAuthSuccess = (params: {
|
|
23
34
|
authToken: string;
|
|
@@ -27,8 +27,7 @@ require('../../../config/ApiEndpoint.cjs');
|
|
|
27
27
|
require('../../../locale/locale.cjs');
|
|
28
28
|
var userActions = require('../../actions/userActions/userActions.cjs');
|
|
29
29
|
|
|
30
|
-
const storeAuthTokenAndUser = (
|
|
31
|
-
const { user, jwt, minifiedJwt } = data;
|
|
30
|
+
const storeAuthTokenAndUser = ({ user, jwt, minifiedJwt, }) => {
|
|
32
31
|
if (jwt && minifiedJwt) {
|
|
33
32
|
index.storeAuthToken(jwt, minifiedJwt);
|
|
34
33
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SdkUser } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { UserProfile } from '../../../..';
|
|
3
|
-
export declare const storeAuthTokenAndUser: (
|
|
3
|
+
export declare const storeAuthTokenAndUser: ({ user, jwt, minifiedJwt, }: {
|
|
4
|
+
user: SdkUser;
|
|
5
|
+
jwt?: string;
|
|
6
|
+
minifiedJwt?: string;
|
|
7
|
+
}) => UserProfile;
|
|
@@ -23,8 +23,7 @@ import '../../../config/ApiEndpoint.js';
|
|
|
23
23
|
import '../../../locale/locale.js';
|
|
24
24
|
import { setUser } from '../../actions/userActions/userActions.js';
|
|
25
25
|
|
|
26
|
-
const storeAuthTokenAndUser = (
|
|
27
|
-
const { user, jwt, minifiedJwt } = data;
|
|
26
|
+
const storeAuthTokenAndUser = ({ user, jwt, minifiedJwt, }) => {
|
|
28
27
|
if (jwt && minifiedJwt) {
|
|
29
28
|
storeAuthToken(jwt, minifiedJwt);
|
|
30
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AUTH_TOKEN, AUTH_MIN_TOKEN,
|
|
1
|
+
export { AUTH_TOKEN, AUTH_MIN_TOKEN, STORE_STORAGE_KEY, LAST_USED_WALLET, NETWORKS_STORAGE_KEY, NONCE_STORAGE_KEY, PRIMARY_WALLET_ID, THEME, WALLET_PICKER_SEARCH_KEY, AUTH_MODE, PHANTOM_SIGNATURE_STATE, PROJECT_SETTINGS_STORAGE_KEY, } from './localStorage';
|
|
2
2
|
export { BASE_LIGHT_1, BASE_LIGHT_2, BASE_LIGHT_3, BASE_LIGHT_4, BASE_LIGHT_5, BASE_DARK_5, TEXT_LIGHT_PRIMARY, TEXT_LIGHT_SECONDARY, TEXT_LIGHT_TERTIARY, TEXT_LIGHT_LINK, CONNECTION_LIGHT_GREEN, CONNECTION_LIGHT_ORANGE, ERROR_LIGHT_1, ERROR_LIGHT_2, OVERLAY_LIGHT, HOVER_LIGHT, LOADING_ANIMATION_GRADIENT_LIGHT, BASE_DARK_1, BASE_DARK_2, BASE_DARK_3, BASE_DARK_4, DYNAMIC_CONNECT_BUTTON_BACKGROUND, DYNAMIC_CONNECT_BUTTON_BORDER, DYNAMIC_CONNECT_BUTTON_COLOR, TEXT_DARK_PRIMARY, TEXT_DARK_SECONDARY, TEXT_DARK_TERTIARY, TEXT_DARK_LINK, BRAND_HOVER, BRAND_PRIMARY, BRAND_SECONDARY, CONNECTION_DARK_GREEN, CONNECTION_DARK_ORANGE, ERROR_DARK_1, ERROR_DARK_2, OVERLAY_DARK, HOVER_DARK, LOADING_ANIMATION_GRADIENT_DARK, SHADOW_DOWN_1, SHADOW_DOWN_2, SHADOW_DOWN_3, SHADOW_UP_1, BRAND_HOVER_COLOR, BRAND_PRIMARY_COLOR, BRAND_SECONDARY_COLOR, } from './colors';
|
|
3
3
|
export { BORDER_SQUARE, BORDER_ROUNDED, BORDER_RADIUS } from './theme';
|
|
4
4
|
export { TITLE, BODY_NORMAL, BODY_SMALL, BODY_MINI, BUTTON_PRIMARY, BUTTON_SECONDARY, NUMBERS_BIG, NUMBERS_MEDIUM, } from './typography';
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
const AUTH_TOKEN = 'dynamic_authentication_token';
|
|
7
7
|
const AUTH_MIN_TOKEN = 'dynamic_min_authentication_token';
|
|
8
|
-
const AUTH_ONBOARDING_TOKEN = 'dynamic_onboarding_authentication_token';
|
|
9
8
|
const LAST_USED_WALLET = 'dynamic_last_used_wallet';
|
|
10
9
|
const NETWORKS_STORAGE_KEY = 'dynamic_networks';
|
|
11
10
|
const NONCE_STORAGE_KEY = 'dynamic_nonce';
|
|
@@ -30,7 +29,6 @@ const STORE_STORAGE_KEY = 'dynamic_store';
|
|
|
30
29
|
|
|
31
30
|
exports.AUTH_MIN_TOKEN = AUTH_MIN_TOKEN;
|
|
32
31
|
exports.AUTH_MODE = AUTH_MODE;
|
|
33
|
-
exports.AUTH_ONBOARDING_TOKEN = AUTH_ONBOARDING_TOKEN;
|
|
34
32
|
exports.AUTH_TOKEN = AUTH_TOKEN;
|
|
35
33
|
exports.BRIDGE_ONBOARDING_COMPLETED = BRIDGE_ONBOARDING_COMPLETED;
|
|
36
34
|
exports.CONNECTED_WALLETS_INFO = CONNECTED_WALLETS_INFO;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const AUTH_TOKEN = "dynamic_authentication_token";
|
|
2
2
|
export declare const AUTH_MIN_TOKEN = "dynamic_min_authentication_token";
|
|
3
|
-
export declare const AUTH_ONBOARDING_TOKEN = "dynamic_onboarding_authentication_token";
|
|
4
3
|
export declare const LAST_USED_WALLET = "dynamic_last_used_wallet";
|
|
5
4
|
export declare const NETWORKS_STORAGE_KEY = "dynamic_networks";
|
|
6
5
|
export declare const NONCE_STORAGE_KEY = "dynamic_nonce";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
const AUTH_TOKEN = 'dynamic_authentication_token';
|
|
3
3
|
const AUTH_MIN_TOKEN = 'dynamic_min_authentication_token';
|
|
4
|
-
const AUTH_ONBOARDING_TOKEN = 'dynamic_onboarding_authentication_token';
|
|
5
4
|
const LAST_USED_WALLET = 'dynamic_last_used_wallet';
|
|
6
5
|
const NETWORKS_STORAGE_KEY = 'dynamic_networks';
|
|
7
6
|
const NONCE_STORAGE_KEY = 'dynamic_nonce';
|
|
@@ -24,4 +23,4 @@ const PHONE_INPUT_DEFAULT_COUNTRY = 'dynamic_phone_input_default_country';
|
|
|
24
23
|
const PHANTOM_SIGNATURE_STATE = 'phantom_verification_type';
|
|
25
24
|
const STORE_STORAGE_KEY = 'dynamic_store';
|
|
26
25
|
|
|
27
|
-
export { AUTH_MIN_TOKEN, AUTH_MODE,
|
|
26
|
+
export { AUTH_MIN_TOKEN, AUTH_MODE, AUTH_TOKEN, BRIDGE_ONBOARDING_COMPLETED, CONNECTED_WALLETS_INFO, CONNECTED_WALLET_NAME_SERVICE, DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS, EMBEDDED_WALLET_SECURE_BANNER, EMBEDDED_WALLET_SESSION_SETTINGS, LAST_USED_WALLET, NETWORKS_STORAGE_KEY, NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY, NONCE_STORAGE_KEY, PHANTOM_SIGNATURE_STATE, PHONE_INPUT_DEFAULT_COUNTRY, PRIMARY_WALLET_ID, PROJECT_SETTINGS_STORAGE_KEY, STORE_STORAGE_KEY, WAGMI_LAST_SESSION_SETTINGS, WALLET_PICKER_SEARCH_KEY };
|
|
@@ -12,7 +12,6 @@ export * from './getAppOrigin';
|
|
|
12
12
|
export * from './getAuthToken';
|
|
13
13
|
export * from './getMinAuthToken';
|
|
14
14
|
export * from './getProjectSettingsFromLs';
|
|
15
|
-
export * from './getOnboardingAuthToken';
|
|
16
15
|
export * from './getEnabledKYC';
|
|
17
16
|
export * from './validatePhoneLength';
|
|
18
17
|
export * from './getEnabledOAuthProviders';
|
|
@@ -40,8 +40,8 @@ require('react-dom');
|
|
|
40
40
|
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
41
41
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
42
42
|
require('@dynamic-labs/types');
|
|
43
|
-
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
44
43
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
44
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
45
45
|
require('yup');
|
|
46
46
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
47
47
|
require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
@@ -36,8 +36,8 @@ import 'react-dom';
|
|
|
36
36
|
import '../../../../context/WalletContext/WalletContext.js';
|
|
37
37
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
38
38
|
import '@dynamic-labs/types';
|
|
39
|
-
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
40
39
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
40
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
41
41
|
import 'yup';
|
|
42
42
|
import '../../../../context/MockContext/MockContext.js';
|
|
43
43
|
import '../../../../views/CollectUserDataView/useFields.js';
|
|
@@ -40,8 +40,8 @@ require('react-dom');
|
|
|
40
40
|
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
41
41
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
42
42
|
require('@dynamic-labs/types');
|
|
43
|
-
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
44
43
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
44
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
45
45
|
require('yup');
|
|
46
46
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
47
47
|
require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
@@ -36,8 +36,8 @@ import 'react-dom';
|
|
|
36
36
|
import '../../../../context/WalletContext/WalletContext.js';
|
|
37
37
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
38
38
|
import '@dynamic-labs/types';
|
|
39
|
-
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
40
39
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
40
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
41
41
|
import 'yup';
|
|
42
42
|
import '../../../../context/MockContext/MockContext.js';
|
|
43
43
|
import '../../../../views/CollectUserDataView/useFields.js';
|
|
@@ -22,6 +22,7 @@ require('../../../../shared/consts/index.cjs');
|
|
|
22
22
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
23
23
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
24
24
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
|
+
var errors = require('../../../constants/errors.cjs');
|
|
25
26
|
require('@dynamic-labs/multi-wallet');
|
|
26
27
|
require('react-international-phone');
|
|
27
28
|
require('viem');
|
|
@@ -86,14 +87,13 @@ require('../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/Passke
|
|
|
86
87
|
* This is to avoid a circular logic issue, as handleVerificationRequired needs to use the logic in this file as well.
|
|
87
88
|
*/
|
|
88
89
|
const useOtpVerificationRequestRaw = () => {
|
|
89
|
-
const {
|
|
90
|
-
const jwtToken = onboardingOnlyJwt || minAuthToken;
|
|
90
|
+
const { environmentId, user, userWithMissingFields } = useInternalDynamicContext.useInternalDynamicContext();
|
|
91
91
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
92
92
|
const { verificationUUID: contextVerificationUUID } = VerificationContext.useVerification();
|
|
93
93
|
const verifyOtp = React.useCallback((handleVerificationRequired, verificationToken, destination, localVerificationUUID) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
94
94
|
var _a;
|
|
95
|
-
if (!
|
|
96
|
-
throw new utils.DynamicError(
|
|
95
|
+
if (!user && !userWithMissingFields)
|
|
96
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
97
97
|
// VerificationUUID is saved in the context in case the view changes
|
|
98
98
|
// after a profile update (changing the view from edit profile to verify email)
|
|
99
99
|
if (!localVerificationUUID && !contextVerificationUUID)
|
|
@@ -105,10 +105,9 @@ const useOtpVerificationRequestRaw = () => {
|
|
|
105
105
|
verificationToken,
|
|
106
106
|
verificationUUID,
|
|
107
107
|
});
|
|
108
|
-
// check if decoded JWT still somehow has missing fields, we can't proceed if it does
|
|
109
108
|
const updatedUser = updateSelfResponse.user;
|
|
110
109
|
const missingFields = (_a = updatedUser === null || updatedUser === void 0 ? void 0 : updatedUser.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
111
|
-
const requiredVerificationDestination = useHandleVerificationRequired.
|
|
110
|
+
const requiredVerificationDestination = useHandleVerificationRequired.getVerificationDestination(updateSelfResponse.nextView);
|
|
112
111
|
if (requiredVerificationDestination)
|
|
113
112
|
return handleVerificationRequired({
|
|
114
113
|
destination: requiredVerificationDestination,
|
|
@@ -124,7 +123,13 @@ const useOtpVerificationRequestRaw = () => {
|
|
|
124
123
|
missingFields,
|
|
125
124
|
updateUserProfileResponse: updateSelfResponse,
|
|
126
125
|
};
|
|
127
|
-
}), [
|
|
126
|
+
}), [
|
|
127
|
+
contextVerificationUUID,
|
|
128
|
+
environmentId,
|
|
129
|
+
updateUserProfileByJWT,
|
|
130
|
+
user,
|
|
131
|
+
userWithMissingFields,
|
|
132
|
+
]);
|
|
128
133
|
return { verifyOtp };
|
|
129
134
|
};
|
|
130
135
|
/**
|
|
@@ -18,6 +18,7 @@ import '../../../../shared/consts/index.js';
|
|
|
18
18
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
19
19
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
20
20
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
21
|
+
import { USER_NOT_LOGGED_IN } from '../../../constants/errors.js';
|
|
21
22
|
import '@dynamic-labs/multi-wallet';
|
|
22
23
|
import 'react-international-phone';
|
|
23
24
|
import 'viem';
|
|
@@ -34,7 +35,7 @@ import { useUpdateUserProfileByJWTCallback } from '../../useUpdateUserProfileByJ
|
|
|
34
35
|
import 'react-dom';
|
|
35
36
|
import '../../../../context/WalletContext/WalletContext.js';
|
|
36
37
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
37
|
-
import { useHandleVerificationRequired,
|
|
38
|
+
import { useHandleVerificationRequired, getVerificationDestination } from '../../useHandleVerificationRequired/useHandleVerificationRequired.js';
|
|
38
39
|
import '@dynamic-labs/types';
|
|
39
40
|
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
40
41
|
import 'yup';
|
|
@@ -82,14 +83,13 @@ import '../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/Passkey
|
|
|
82
83
|
* This is to avoid a circular logic issue, as handleVerificationRequired needs to use the logic in this file as well.
|
|
83
84
|
*/
|
|
84
85
|
const useOtpVerificationRequestRaw = () => {
|
|
85
|
-
const {
|
|
86
|
-
const jwtToken = onboardingOnlyJwt || minAuthToken;
|
|
86
|
+
const { environmentId, user, userWithMissingFields } = useInternalDynamicContext();
|
|
87
87
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
88
88
|
const { verificationUUID: contextVerificationUUID } = useVerification();
|
|
89
89
|
const verifyOtp = useCallback((handleVerificationRequired, verificationToken, destination, localVerificationUUID) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
90
|
var _a;
|
|
91
|
-
if (!
|
|
92
|
-
throw new DynamicError(
|
|
91
|
+
if (!user && !userWithMissingFields)
|
|
92
|
+
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
93
93
|
// VerificationUUID is saved in the context in case the view changes
|
|
94
94
|
// after a profile update (changing the view from edit profile to verify email)
|
|
95
95
|
if (!localVerificationUUID && !contextVerificationUUID)
|
|
@@ -101,10 +101,9 @@ const useOtpVerificationRequestRaw = () => {
|
|
|
101
101
|
verificationToken,
|
|
102
102
|
verificationUUID,
|
|
103
103
|
});
|
|
104
|
-
// check if decoded JWT still somehow has missing fields, we can't proceed if it does
|
|
105
104
|
const updatedUser = updateSelfResponse.user;
|
|
106
105
|
const missingFields = (_a = updatedUser === null || updatedUser === void 0 ? void 0 : updatedUser.missingFields) !== null && _a !== void 0 ? _a : [];
|
|
107
|
-
const requiredVerificationDestination =
|
|
106
|
+
const requiredVerificationDestination = getVerificationDestination(updateSelfResponse.nextView);
|
|
108
107
|
if (requiredVerificationDestination)
|
|
109
108
|
return handleVerificationRequired({
|
|
110
109
|
destination: requiredVerificationDestination,
|
|
@@ -120,7 +119,13 @@ const useOtpVerificationRequestRaw = () => {
|
|
|
120
119
|
missingFields,
|
|
121
120
|
updateUserProfileResponse: updateSelfResponse,
|
|
122
121
|
};
|
|
123
|
-
}), [
|
|
122
|
+
}), [
|
|
123
|
+
contextVerificationUUID,
|
|
124
|
+
environmentId,
|
|
125
|
+
updateUserProfileByJWT,
|
|
126
|
+
user,
|
|
127
|
+
userWithMissingFields,
|
|
128
|
+
]);
|
|
124
129
|
return { verifyOtp };
|
|
125
130
|
};
|
|
126
131
|
/**
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs
CHANGED
|
@@ -34,8 +34,8 @@ require('react-dom');
|
|
|
34
34
|
require('../../../../context/WalletContext/WalletContext.cjs');
|
|
35
35
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
36
36
|
require('@dynamic-labs/types');
|
|
37
|
-
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
38
37
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
38
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
39
39
|
require('yup');
|
|
40
40
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
41
41
|
require('../../../../views/CollectUserDataView/useFields.cjs');
|
package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js
CHANGED
|
@@ -30,8 +30,8 @@ import 'react-dom';
|
|
|
30
30
|
import '../../../../context/WalletContext/WalletContext.js';
|
|
31
31
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
32
32
|
import '@dynamic-labs/types';
|
|
33
|
-
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
34
33
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
34
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
35
35
|
import 'yup';
|
|
36
36
|
import '../../../../context/MockContext/MockContext.js';
|
|
37
37
|
import '../../../../views/CollectUserDataView/useFields.js';
|
|
@@ -2,7 +2,7 @@ import { DynamicEvents } from '../../../../events';
|
|
|
2
2
|
import { EventArgs } from '../types';
|
|
3
3
|
type DynamicEventListener<E extends keyof DynamicEvents> = (...args: EventArgs<DynamicEvents, E>) => void;
|
|
4
4
|
/** Allows us to subscribe to all dynamicEvents with a hook, even the internal ones */
|
|
5
|
-
export declare const useInternalDynamicEvents: <E extends keyof
|
|
5
|
+
export declare const useInternalDynamicEvents: <E extends keyof import("../../../../events/auth").AuthEvents | keyof import("../../../../events/ui").UIEvents | keyof import("../../../../events/otp").OTPEvents | keyof import("../../../../events/wallets").WalletEvents | keyof import("../../../../events/passkey").PasskeyEvents | "farcasterConnectCancelled" | keyof import("../../../../events/embeddedWallet").EmbeddedWalletEvents>(event: E, listener: DynamicEventListener<E>) => void;
|
|
6
6
|
/** Allows subscribing to dynamic events directly inside components with a hook */
|
|
7
|
-
export declare const useDynamicEvents: <E extends "
|
|
7
|
+
export declare const useDynamicEvents: <E extends "logout" | "emailVerificationResult" | "embeddedWalletCreated">(event: E, listener: DynamicEventListener<E>) => void;
|
|
8
8
|
export {};
|
|
@@ -94,7 +94,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
94
94
|
const embeddedChains = embeddedChainConfig
|
|
95
95
|
.filter((chain) => chain.enabled)
|
|
96
96
|
.map((c) => (c.name === 'SOL' ? sdkApiCore.ChainEnum.Sol : sdkApiCore.ChainEnum.Evm));
|
|
97
|
-
const createDynamicEmbeddedWalletMutation = React.useCallback((_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({
|
|
97
|
+
const createDynamicEmbeddedWalletMutation = React.useCallback((_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }) {
|
|
98
98
|
var _d, _e;
|
|
99
99
|
setIsLoading(true);
|
|
100
100
|
if (!user) {
|
|
@@ -102,7 +102,6 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
102
102
|
}
|
|
103
103
|
try {
|
|
104
104
|
const { embeddedWalletVerifiedCredential, signersResponse, walletConnector, } = yield createEmbeddedWalletRequest.createEmbeddedWalletRequest({
|
|
105
|
-
authToken,
|
|
106
105
|
chains: chains !== null && chains !== void 0 ? chains : embeddedChains,
|
|
107
106
|
environmentId,
|
|
108
107
|
user,
|
|
@@ -2,7 +2,6 @@ import { ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
|
2
2
|
import { WebAuthnAttestation } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { WalletOption } from '../../../shared';
|
|
4
4
|
type MutationProps = {
|
|
5
|
-
authToken: string | undefined;
|
|
6
5
|
environmentId: string;
|
|
7
6
|
walletConnectorOptions: WalletOption[];
|
|
8
7
|
withAuthenticator: boolean;
|
|
@@ -12,7 +11,7 @@ type MutationProps = {
|
|
|
12
11
|
chains?: ChainEnum[];
|
|
13
12
|
};
|
|
14
13
|
export declare const useCreateDynamicEmbeddedWalletMutation: () => {
|
|
15
|
-
createDynamicEmbeddedWalletMutation: ({
|
|
14
|
+
createDynamicEmbeddedWalletMutation: ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }: MutationProps) => Promise<void>;
|
|
16
15
|
error: unknown;
|
|
17
16
|
isLoading: boolean;
|
|
18
17
|
};
|
|
@@ -90,7 +90,7 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
90
90
|
const embeddedChains = embeddedChainConfig
|
|
91
91
|
.filter((chain) => chain.enabled)
|
|
92
92
|
.map((c) => (c.name === 'SOL' ? ChainEnum.Sol : ChainEnum.Evm));
|
|
93
|
-
const createDynamicEmbeddedWalletMutation = useCallback((_c) => __awaiter(void 0, [_c], void 0, function* ({
|
|
93
|
+
const createDynamicEmbeddedWalletMutation = useCallback((_c) => __awaiter(void 0, [_c], void 0, function* ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }) {
|
|
94
94
|
var _d, _e;
|
|
95
95
|
setIsLoading(true);
|
|
96
96
|
if (!user) {
|
|
@@ -98,7 +98,6 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
98
98
|
}
|
|
99
99
|
try {
|
|
100
100
|
const { embeddedWalletVerifiedCredential, signersResponse, walletConnector, } = yield createEmbeddedWalletRequest({
|
|
101
|
-
authToken,
|
|
102
101
|
chains: chains !== null && chains !== void 0 ? chains : embeddedChains,
|
|
103
102
|
environmentId,
|
|
104
103
|
user,
|
|
@@ -18,7 +18,7 @@ require('../../constants/values.cjs');
|
|
|
18
18
|
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
19
|
require('@dynamic-labs/utils');
|
|
20
20
|
require('../../../shared/consts/index.cjs');
|
|
21
|
-
require('../../../events/dynamicEvents.cjs');
|
|
21
|
+
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
22
22
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
23
23
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
24
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -120,21 +120,36 @@ const useEmailProvider = ({ emailWalletConnector }) => {
|
|
|
120
120
|
yield handleEmailOnlyLoginSubmit(emailInput, captchaToken);
|
|
121
121
|
});
|
|
122
122
|
const handleEmailSubmitWithOptionalCaptcha = (emailInput, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
dynamicEvents.dynamicEvents.emit('authInit', {
|
|
124
|
+
email: emailInput,
|
|
125
|
+
option: emailInput,
|
|
126
|
+
type: 'email',
|
|
127
|
+
});
|
|
128
|
+
try {
|
|
129
|
+
if ((emailWalletConnector !== undefined ||
|
|
130
|
+
isTurnkeyEnabled.isTurnkeyEnabled(projectSettings)) &&
|
|
131
|
+
(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.confirmEmailProviderForVerify)) {
|
|
132
|
+
// see: https://linear.app/dynamic-labs/issue/DYN-2517
|
|
133
|
+
// if confirmWalletTransfers setting is true, check api first to confirm emailProvider
|
|
134
|
+
const { emailProvider } = yield email.getEmailProvider({
|
|
135
|
+
email: emailInput,
|
|
136
|
+
environmentId,
|
|
137
|
+
});
|
|
138
|
+
if (emailProvider === sdkApiCore.ProviderEnum.Dynamic) {
|
|
139
|
+
yield handleEmailOnlyLoginSubmit(emailInput, captchaToken);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
135
142
|
}
|
|
143
|
+
yield submitEmail(emailInput, captchaToken);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
dynamicEvents.dynamicEvents.emit('authFailure', {
|
|
147
|
+
email: emailInput,
|
|
148
|
+
option: emailInput,
|
|
149
|
+
type: 'email',
|
|
150
|
+
}, { error });
|
|
151
|
+
throw error;
|
|
136
152
|
}
|
|
137
|
-
yield submitEmail(emailInput, captchaToken);
|
|
138
153
|
});
|
|
139
154
|
return {
|
|
140
155
|
handleEmailSubmitWithOptionalCaptcha,
|
|
@@ -14,7 +14,7 @@ import '../../constants/values.js';
|
|
|
14
14
|
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
15
15
|
import '@dynamic-labs/utils';
|
|
16
16
|
import '../../../shared/consts/index.js';
|
|
17
|
-
import '../../../events/dynamicEvents.js';
|
|
17
|
+
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
18
18
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
19
19
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
20
20
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -116,21 +116,36 @@ const useEmailProvider = ({ emailWalletConnector }) => {
|
|
|
116
116
|
yield handleEmailOnlyLoginSubmit(emailInput, captchaToken);
|
|
117
117
|
});
|
|
118
118
|
const handleEmailSubmitWithOptionalCaptcha = (emailInput, captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
119
|
+
dynamicEvents.emit('authInit', {
|
|
120
|
+
email: emailInput,
|
|
121
|
+
option: emailInput,
|
|
122
|
+
type: 'email',
|
|
123
|
+
});
|
|
124
|
+
try {
|
|
125
|
+
if ((emailWalletConnector !== undefined ||
|
|
126
|
+
isTurnkeyEnabled(projectSettings)) &&
|
|
127
|
+
(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.confirmEmailProviderForVerify)) {
|
|
128
|
+
// see: https://linear.app/dynamic-labs/issue/DYN-2517
|
|
129
|
+
// if confirmWalletTransfers setting is true, check api first to confirm emailProvider
|
|
130
|
+
const { emailProvider } = yield getEmailProvider({
|
|
131
|
+
email: emailInput,
|
|
132
|
+
environmentId,
|
|
133
|
+
});
|
|
134
|
+
if (emailProvider === ProviderEnum.Dynamic) {
|
|
135
|
+
yield handleEmailOnlyLoginSubmit(emailInput, captchaToken);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
131
138
|
}
|
|
139
|
+
yield submitEmail(emailInput, captchaToken);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
dynamicEvents.emit('authFailure', {
|
|
143
|
+
email: emailInput,
|
|
144
|
+
option: emailInput,
|
|
145
|
+
type: 'email',
|
|
146
|
+
}, { error });
|
|
147
|
+
throw error;
|
|
132
148
|
}
|
|
133
|
-
yield submitEmail(emailInput, captchaToken);
|
|
134
149
|
});
|
|
135
150
|
return {
|
|
136
151
|
handleEmailSubmitWithOptionalCaptcha,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
9
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
9
10
|
require('@dynamic-labs/sdk-api-core');
|
|
10
11
|
require('../../../shared/logger.cjs');
|
|
@@ -16,11 +17,11 @@ require('@dynamic-labs/wallet-book');
|
|
|
16
17
|
require('../../constants/colors.cjs');
|
|
17
18
|
require('../../constants/values.cjs');
|
|
18
19
|
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
-
require('@dynamic-labs/utils');
|
|
20
20
|
require('../../../shared/consts/index.cjs');
|
|
21
21
|
require('../../../events/dynamicEvents.cjs');
|
|
22
22
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
23
23
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
|
+
var errors = require('../../constants/errors.cjs');
|
|
24
25
|
require('@dynamic-labs/multi-wallet');
|
|
25
26
|
require('react-international-phone');
|
|
26
27
|
var isTurnkeyEnabled = require('../../functions/isTurnkeyEnabled/isTurnkeyEnabled.cjs');
|
|
@@ -126,10 +127,10 @@ const useEmbeddedWallet = () => {
|
|
|
126
127
|
*/
|
|
127
128
|
const revealWalletKey = (options) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
128
129
|
if (!user) {
|
|
129
|
-
throw new
|
|
130
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
130
131
|
}
|
|
131
132
|
if (!userHasEmbeddedWallet()) {
|
|
132
|
-
throw new
|
|
133
|
+
throw new utils.DynamicError('Embedded wallet not found');
|
|
133
134
|
}
|
|
134
135
|
if (isTurnkeyWallet) {
|
|
135
136
|
return revealTurnkeyEmbeddedWalletKey(options);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
5
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
5
6
|
import '@dynamic-labs/sdk-api-core';
|
|
6
7
|
import '../../../shared/logger.js';
|
|
@@ -12,11 +13,11 @@ import '@dynamic-labs/wallet-book';
|
|
|
12
13
|
import '../../constants/colors.js';
|
|
13
14
|
import '../../constants/values.js';
|
|
14
15
|
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
-
import '@dynamic-labs/utils';
|
|
16
16
|
import '../../../shared/consts/index.js';
|
|
17
17
|
import '../../../events/dynamicEvents.js';
|
|
18
18
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
19
19
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
20
|
+
import { USER_NOT_LOGGED_IN } from '../../constants/errors.js';
|
|
20
21
|
import '@dynamic-labs/multi-wallet';
|
|
21
22
|
import 'react-international-phone';
|
|
22
23
|
import { isTurnkeyEnabled } from '../../functions/isTurnkeyEnabled/isTurnkeyEnabled.js';
|
|
@@ -122,10 +123,10 @@ const useEmbeddedWallet = () => {
|
|
|
122
123
|
*/
|
|
123
124
|
const revealWalletKey = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
125
|
if (!user) {
|
|
125
|
-
throw new
|
|
126
|
+
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
126
127
|
}
|
|
127
128
|
if (!userHasEmbeddedWallet()) {
|
|
128
|
-
throw new
|
|
129
|
+
throw new DynamicError('Embedded wallet not found');
|
|
129
130
|
}
|
|
130
131
|
if (isTurnkeyWallet) {
|
|
131
132
|
return revealTurnkeyEmbeddedWalletKey(options);
|
|
@@ -118,7 +118,7 @@ const useMPCEmbeddedWallet = () => {
|
|
|
118
118
|
if ((userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.length) &&
|
|
119
119
|
!embeddedWalletVerifiedCredential &&
|
|
120
120
|
!isManualMode) {
|
|
121
|
-
throw new
|
|
121
|
+
throw new utils.EmbeddedWalletException('User already has a linked branded wallet, and manual mode creation is not enabled.');
|
|
122
122
|
}
|
|
123
123
|
validateMPCProviderEnabled.validateMPCProviderEnabled(projectSettings);
|
|
124
124
|
const connector = (_b = findCoinbaseMPCWallet.findCoinbaseMPCWallet(walletConnectorOptions)) === null || _b === void 0 ? void 0 : _b.walletConnector;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { isCoinbaseMpcWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
5
|
+
import { DynamicError, EmbeddedWalletException } from '@dynamic-labs/utils';
|
|
6
6
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
7
7
|
import '@dynamic-labs/sdk-api-core';
|
|
8
8
|
import '../../../../shared/logger.js';
|
|
@@ -114,7 +114,7 @@ const useMPCEmbeddedWallet = () => {
|
|
|
114
114
|
if ((userWalletsCredentials === null || userWalletsCredentials === void 0 ? void 0 : userWalletsCredentials.length) &&
|
|
115
115
|
!embeddedWalletVerifiedCredential &&
|
|
116
116
|
!isManualMode) {
|
|
117
|
-
throw new
|
|
117
|
+
throw new EmbeddedWalletException('User already has a linked branded wallet, and manual mode creation is not enabled.');
|
|
118
118
|
}
|
|
119
119
|
validateMPCProviderEnabled(projectSettings);
|
|
120
120
|
const connector = (_b = findCoinbaseMPCWallet(walletConnectorOptions)) === null || _b === void 0 ? void 0 : _b.walletConnector;
|