@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
|
@@ -7,7 +7,6 @@ var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
8
|
var utils = require('@dynamic-labs/utils');
|
|
9
9
|
require('@dynamic-labs/sdk-api-core');
|
|
10
|
-
var decodeJwt = require('../../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
11
10
|
require('../../../../shared/logger.cjs');
|
|
12
11
|
require('@dynamic-labs/iconic');
|
|
13
12
|
require('react/jsx-runtime');
|
|
@@ -31,6 +30,7 @@ require('viem/chains');
|
|
|
31
30
|
var embeddedWallets = require('../../../../data/api/embeddedWallets/embeddedWallets.cjs');
|
|
32
31
|
require('../../../../locale/locale.cjs');
|
|
33
32
|
var user = require('../../../../data/api/user/user.cjs');
|
|
33
|
+
require('@dynamic-labs/store');
|
|
34
34
|
var constants = require('../../PasskeyRecovery/constants.cjs');
|
|
35
35
|
|
|
36
36
|
const initEmbeddedWalletSession = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ authenticatorType, iframeContainer, iframeElementId, environmentId, user, wallet, sessionExpiration, }) {
|
|
@@ -68,7 +68,7 @@ const initEmbeddedWalletSession = (_a) => _tslib.__awaiter(void 0, [_a], void 0,
|
|
|
68
68
|
: response.turnkeyUserId;
|
|
69
69
|
return;
|
|
70
70
|
});
|
|
71
|
-
const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({
|
|
71
|
+
const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ user, bundleInput, wallet, }) {
|
|
72
72
|
var _d, _e, _f, _g;
|
|
73
73
|
if (!bundleInput) {
|
|
74
74
|
throw new utils.DynamicError('Code must be informed');
|
|
@@ -78,11 +78,10 @@ const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], v
|
|
|
78
78
|
!walletConnectorCore.isPasskeyWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
|
|
79
79
|
throw new utils.DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
throw new utils.DynamicError('User must be logged in with a valid token');
|
|
81
|
+
if (!user) {
|
|
82
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
84
83
|
}
|
|
85
|
-
const organizationId = (_f = (_e = (_d =
|
|
84
|
+
const organizationId = (_f = (_e = (_d = user.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _e === void 0 ? void 0 : _e.walletProperties) === null || _f === void 0 ? void 0 : _f.turnkeySubOrganizationId;
|
|
86
85
|
const turnkeyRecoveryHandler = (_g = wallet.connector) === null || _g === void 0 ? void 0 : _g.getAuthenticatorHandler();
|
|
87
86
|
yield turnkeyRecoveryHandler.verifyRecoveryCode(bundleInput, organizationId);
|
|
88
87
|
const sessionSettings = {
|
|
@@ -92,10 +91,10 @@ const passkeyRecoveryBundleValidation = (_c) => _tslib.__awaiter(void 0, [_c], v
|
|
|
92
91
|
};
|
|
93
92
|
localStorage.LocalStorage.setToLS(localStorage$1.EMBEDDED_WALLET_SESSION_SETTINGS, sessionSettings);
|
|
94
93
|
});
|
|
95
|
-
const resentRecoveryEmail = (_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ authenticatorType,
|
|
94
|
+
const resentRecoveryEmail = (_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ authenticatorType, user, environmentId, wallet, }) {
|
|
96
95
|
var _j;
|
|
97
|
-
if (!
|
|
98
|
-
throw new utils.DynamicError(
|
|
96
|
+
if (!user) {
|
|
97
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
99
98
|
}
|
|
100
99
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
101
100
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -113,7 +112,7 @@ const resentRecoveryEmail = (_h) => _tslib.__awaiter(void 0, [_h], void 0, funct
|
|
|
113
112
|
walletId: wallet === null || wallet === void 0 ? void 0 : wallet.id,
|
|
114
113
|
});
|
|
115
114
|
});
|
|
116
|
-
const completePasskeyRecovery = (_k) => _tslib.__awaiter(void 0, [_k], void 0, function* ({
|
|
115
|
+
const completePasskeyRecovery = (_k) => _tslib.__awaiter(void 0, [_k], void 0, function* ({ user, environmentId, wallet, }) {
|
|
117
116
|
const { passkeyRecoveryResponse, connector } = yield recoverTurnkeyWallet({
|
|
118
117
|
addPasskeyAuthenticator: false,
|
|
119
118
|
environmentId,
|
|
@@ -239,14 +238,10 @@ const restoreEmbeddedWalletSession = (_r) => _tslib.__awaiter(void 0, [_r], void
|
|
|
239
238
|
yield turnkeyRecoveryHandler.verifyRecoveryCode(sessionSettings.emailCode, organizationId);
|
|
240
239
|
return true;
|
|
241
240
|
});
|
|
242
|
-
const addEmailRecovery = (_w) => _tslib.__awaiter(void 0, [_w], void 0, function* ({
|
|
241
|
+
const addEmailRecovery = (_w) => _tslib.__awaiter(void 0, [_w], void 0, function* ({ user: user$1, environmentId, wallet, }) {
|
|
243
242
|
var _x, _y;
|
|
244
|
-
if (!
|
|
245
|
-
throw new utils.DynamicError(
|
|
246
|
-
}
|
|
247
|
-
const decodedJwt = decodeJwt.decodeJwt(authToken);
|
|
248
|
-
if (!decodedJwt) {
|
|
249
|
-
throw new utils.DynamicError('User must be logged in with a valid token');
|
|
243
|
+
if (!(user$1 === null || user$1 === void 0 ? void 0 : user$1.email)) {
|
|
244
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
250
245
|
}
|
|
251
246
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
252
247
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -254,13 +249,13 @@ const addEmailRecovery = (_w) => _tslib.__awaiter(void 0, [_w], void 0, function
|
|
|
254
249
|
!walletConnectorCore.isEmailWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
|
|
255
250
|
throw new utils.DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
256
251
|
}
|
|
257
|
-
const { turnkeySubOrganizationId, turnkeyUserId } = (_y = (_x =
|
|
252
|
+
const { turnkeySubOrganizationId, turnkeyUserId } = (_y = (_x = user$1.verifiedCredentials) === null || _x === void 0 ? void 0 : _x.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _y === void 0 ? void 0 : _y.walletProperties;
|
|
258
253
|
if (!turnkeySubOrganizationId || !turnkeyUserId) {
|
|
259
254
|
throw new utils.DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing');
|
|
260
255
|
}
|
|
261
256
|
const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
|
|
262
257
|
const { signedRequest } = (yield turnkeyRecoveryHandler.addEmailRecovery({
|
|
263
|
-
email:
|
|
258
|
+
email: user$1.email,
|
|
264
259
|
organizationId: turnkeySubOrganizationId,
|
|
265
260
|
turnkeyUserId,
|
|
266
261
|
}));
|
|
@@ -268,7 +263,7 @@ const addEmailRecovery = (_w) => _tslib.__awaiter(void 0, [_w], void 0, function
|
|
|
268
263
|
environmentId,
|
|
269
264
|
updateRecoveryEmailRequest: { turnkeySignedRequest: signedRequest },
|
|
270
265
|
});
|
|
271
|
-
wallet.connector.setEmail(
|
|
266
|
+
wallet.connector.setEmail(user$1.email);
|
|
272
267
|
return user.refreshUserJwt({ environmentId });
|
|
273
268
|
});
|
|
274
269
|
|
|
@@ -14,19 +14,18 @@ export declare const initEmbeddedWalletSession: ({ authenticatorType, iframeCont
|
|
|
14
14
|
user: UserProfile;
|
|
15
15
|
passkeyRecoveryResponse: VerifyResponse;
|
|
16
16
|
} | undefined>;
|
|
17
|
-
export declare const passkeyRecoveryBundleValidation: ({
|
|
18
|
-
|
|
17
|
+
export declare const passkeyRecoveryBundleValidation: ({ user, bundleInput, wallet, }: {
|
|
18
|
+
user: UserProfile | undefined;
|
|
19
19
|
bundleInput: string | undefined;
|
|
20
20
|
wallet: Wallet | null;
|
|
21
21
|
}) => Promise<void>;
|
|
22
|
-
export declare const resentRecoveryEmail: ({ authenticatorType,
|
|
22
|
+
export declare const resentRecoveryEmail: ({ authenticatorType, user, environmentId, wallet, }: {
|
|
23
23
|
authenticatorType: AuthenticatorType;
|
|
24
|
-
|
|
24
|
+
user: UserProfile | undefined;
|
|
25
25
|
environmentId: string;
|
|
26
26
|
wallet: Wallet | null;
|
|
27
27
|
}) => Promise<InitPasskeyRecoveryResponse | InitEmailAuthResponse>;
|
|
28
|
-
export declare const completePasskeyRecovery: ({
|
|
29
|
-
authToken: string | undefined;
|
|
28
|
+
export declare const completePasskeyRecovery: ({ user, environmentId, wallet, }: {
|
|
30
29
|
environmentId: string;
|
|
31
30
|
wallet: Wallet | null;
|
|
32
31
|
user: UserProfile | undefined;
|
|
@@ -49,12 +48,8 @@ export declare const restoreEmbeddedWalletSession: ({ user, iframeContainer, ifr
|
|
|
49
48
|
wallet: Wallet | null;
|
|
50
49
|
sessionExpiration?: number;
|
|
51
50
|
}) => Promise<boolean>;
|
|
52
|
-
export declare const addEmailRecovery: ({
|
|
53
|
-
|
|
54
|
-
userEmail: string;
|
|
51
|
+
export declare const addEmailRecovery: ({ user, environmentId, wallet, }: {
|
|
52
|
+
user: UserProfile | undefined;
|
|
55
53
|
environmentId: string;
|
|
56
54
|
wallet: Wallet | null;
|
|
57
|
-
}) => Promise<
|
|
58
|
-
jwt: string;
|
|
59
|
-
minifiedJwt: string;
|
|
60
|
-
} | undefined>;
|
|
55
|
+
}) => Promise<UserProfile | undefined>;
|
|
@@ -3,7 +3,6 @@ import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { isPasskeyWalletConnector, isEmailWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
5
5
|
import '@dynamic-labs/sdk-api-core';
|
|
6
|
-
import { decodeJwt } from '../../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
7
6
|
import '../../../../shared/logger.js';
|
|
8
7
|
import '@dynamic-labs/iconic';
|
|
9
8
|
import 'react/jsx-runtime';
|
|
@@ -27,6 +26,7 @@ import 'viem/chains';
|
|
|
27
26
|
import { completePasskeyRecovery as completePasskeyRecovery$1, updatePasskeyRecoveryEmail, initEmbeddedWalletSession as initEmbeddedWalletSession$1 } from '../../../../data/api/embeddedWallets/embeddedWallets.js';
|
|
28
27
|
import '../../../../locale/locale.js';
|
|
29
28
|
import { refreshUserJwt } from '../../../../data/api/user/user.js';
|
|
29
|
+
import '@dynamic-labs/store';
|
|
30
30
|
import { iframeElementId } from '../../PasskeyRecovery/constants.js';
|
|
31
31
|
|
|
32
32
|
const initEmbeddedWalletSession = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authenticatorType, iframeContainer, iframeElementId, environmentId, user, wallet, sessionExpiration, }) {
|
|
@@ -64,7 +64,7 @@ const initEmbeddedWalletSession = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
|
64
64
|
: response.turnkeyUserId;
|
|
65
65
|
return;
|
|
66
66
|
});
|
|
67
|
-
const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0, function* ({
|
|
67
|
+
const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0, function* ({ user, bundleInput, wallet, }) {
|
|
68
68
|
var _d, _e, _f, _g;
|
|
69
69
|
if (!bundleInput) {
|
|
70
70
|
throw new DynamicError('Code must be informed');
|
|
@@ -74,11 +74,10 @@ const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0,
|
|
|
74
74
|
!isPasskeyWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
|
|
75
75
|
throw new DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
throw new DynamicError('User must be logged in with a valid token');
|
|
77
|
+
if (!user) {
|
|
78
|
+
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
80
79
|
}
|
|
81
|
-
const organizationId = (_f = (_e = (_d =
|
|
80
|
+
const organizationId = (_f = (_e = (_d = user.verifiedCredentials) === null || _d === void 0 ? void 0 : _d.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _e === void 0 ? void 0 : _e.walletProperties) === null || _f === void 0 ? void 0 : _f.turnkeySubOrganizationId;
|
|
82
81
|
const turnkeyRecoveryHandler = (_g = wallet.connector) === null || _g === void 0 ? void 0 : _g.getAuthenticatorHandler();
|
|
83
82
|
yield turnkeyRecoveryHandler.verifyRecoveryCode(bundleInput, organizationId);
|
|
84
83
|
const sessionSettings = {
|
|
@@ -88,10 +87,10 @@ const passkeyRecoveryBundleValidation = (_c) => __awaiter(void 0, [_c], void 0,
|
|
|
88
87
|
};
|
|
89
88
|
LocalStorage.setToLS(EMBEDDED_WALLET_SESSION_SETTINGS, sessionSettings);
|
|
90
89
|
});
|
|
91
|
-
const resentRecoveryEmail = (_h) => __awaiter(void 0, [_h], void 0, function* ({ authenticatorType,
|
|
90
|
+
const resentRecoveryEmail = (_h) => __awaiter(void 0, [_h], void 0, function* ({ authenticatorType, user, environmentId, wallet, }) {
|
|
92
91
|
var _j;
|
|
93
|
-
if (!
|
|
94
|
-
throw new DynamicError(
|
|
92
|
+
if (!user) {
|
|
93
|
+
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
95
94
|
}
|
|
96
95
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
97
96
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -109,7 +108,7 @@ const resentRecoveryEmail = (_h) => __awaiter(void 0, [_h], void 0, function* ({
|
|
|
109
108
|
walletId: wallet === null || wallet === void 0 ? void 0 : wallet.id,
|
|
110
109
|
});
|
|
111
110
|
});
|
|
112
|
-
const completePasskeyRecovery = (_k) => __awaiter(void 0, [_k], void 0, function* ({
|
|
111
|
+
const completePasskeyRecovery = (_k) => __awaiter(void 0, [_k], void 0, function* ({ user, environmentId, wallet, }) {
|
|
113
112
|
const { passkeyRecoveryResponse, connector } = yield recoverTurnkeyWallet({
|
|
114
113
|
addPasskeyAuthenticator: false,
|
|
115
114
|
environmentId,
|
|
@@ -235,14 +234,10 @@ const restoreEmbeddedWalletSession = (_r) => __awaiter(void 0, [_r], void 0, fun
|
|
|
235
234
|
yield turnkeyRecoveryHandler.verifyRecoveryCode(sessionSettings.emailCode, organizationId);
|
|
236
235
|
return true;
|
|
237
236
|
});
|
|
238
|
-
const addEmailRecovery = (_w) => __awaiter(void 0, [_w], void 0, function* ({
|
|
237
|
+
const addEmailRecovery = (_w) => __awaiter(void 0, [_w], void 0, function* ({ user, environmentId, wallet, }) {
|
|
239
238
|
var _x, _y;
|
|
240
|
-
if (!
|
|
241
|
-
throw new DynamicError(
|
|
242
|
-
}
|
|
243
|
-
const decodedJwt = decodeJwt(authToken);
|
|
244
|
-
if (!decodedJwt) {
|
|
245
|
-
throw new DynamicError('User must be logged in with a valid token');
|
|
239
|
+
if (!(user === null || user === void 0 ? void 0 : user.email)) {
|
|
240
|
+
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
246
241
|
}
|
|
247
242
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
248
243
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -250,13 +245,13 @@ const addEmailRecovery = (_w) => __awaiter(void 0, [_w], void 0, function* ({ au
|
|
|
250
245
|
!isEmailWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
|
|
251
246
|
throw new DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
252
247
|
}
|
|
253
|
-
const { turnkeySubOrganizationId, turnkeyUserId } = (_y = (_x =
|
|
248
|
+
const { turnkeySubOrganizationId, turnkeyUserId } = (_y = (_x = user.verifiedCredentials) === null || _x === void 0 ? void 0 : _x.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _y === void 0 ? void 0 : _y.walletProperties;
|
|
254
249
|
if (!turnkeySubOrganizationId || !turnkeyUserId) {
|
|
255
250
|
throw new DynamicError('The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing');
|
|
256
251
|
}
|
|
257
252
|
const turnkeyRecoveryHandler = wallet.connector.getAuthenticatorHandler();
|
|
258
253
|
const { signedRequest } = (yield turnkeyRecoveryHandler.addEmailRecovery({
|
|
259
|
-
email:
|
|
254
|
+
email: user.email,
|
|
260
255
|
organizationId: turnkeySubOrganizationId,
|
|
261
256
|
turnkeyUserId,
|
|
262
257
|
}));
|
|
@@ -264,7 +259,7 @@ const addEmailRecovery = (_w) => __awaiter(void 0, [_w], void 0, function* ({ au
|
|
|
264
259
|
environmentId,
|
|
265
260
|
updateRecoveryEmailRequest: { turnkeySignedRequest: signedRequest },
|
|
266
261
|
});
|
|
267
|
-
wallet.connector.setEmail(
|
|
262
|
+
wallet.connector.setEmail(user.email);
|
|
268
263
|
return refreshUserJwt({ environmentId });
|
|
269
264
|
});
|
|
270
265
|
|
|
@@ -84,7 +84,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
84
84
|
|
|
85
85
|
const useSmsVerification = (type) => {
|
|
86
86
|
const { verificationUUID, displayedDestination: formattedPhone, retryData, } = VerificationContext.useVerification();
|
|
87
|
-
const { environmentId,
|
|
87
|
+
const { environmentId, user, userWithMissingFields } = useInternalDynamicContext.useInternalDynamicContext();
|
|
88
88
|
const [error, setError] = React.useState();
|
|
89
89
|
const { verifyOtp } = useOtpVerificationRequest.useOtpVerificationRequest();
|
|
90
90
|
const { initAuth, completeAuth, cancelAuth } = useUserAuth.useUserAuth({
|
|
@@ -93,13 +93,16 @@ const useSmsVerification = (type) => {
|
|
|
93
93
|
/** Whether verification was successfully performed */
|
|
94
94
|
const isValidatedRef = React.useRef(false);
|
|
95
95
|
useOnUnmount.useOnUnmount(() => {
|
|
96
|
-
|
|
96
|
+
const phone = retryData !== null && retryData !== void 0 ? retryData : {
|
|
97
97
|
dialCode: '',
|
|
98
98
|
iso2: '',
|
|
99
99
|
phone: '',
|
|
100
|
-
}
|
|
100
|
+
};
|
|
101
101
|
if (!retryData)
|
|
102
102
|
logger.logger.warn('WARNING: emitted smsVerificationResult with incomplete params because retryData was undefined');
|
|
103
|
+
dynamicEvents.dynamicEvents.emit('smsVerificationResult', isValidatedRef.current, phone);
|
|
104
|
+
if (!isValidatedRef.current)
|
|
105
|
+
dynamicEvents.dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' }, 'user-cancelled');
|
|
103
106
|
});
|
|
104
107
|
const retryOneTimePassword = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
105
108
|
setError(undefined);
|
|
@@ -119,7 +122,7 @@ const useSmsVerification = (type) => {
|
|
|
119
122
|
});
|
|
120
123
|
});
|
|
121
124
|
const submitOtpForVerification = React.useCallback((verificationToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
122
|
-
if (!verificationUUID || (!
|
|
125
|
+
if (!verificationUUID || (!user && !userWithMissingFields)) {
|
|
123
126
|
yield cancelAuth();
|
|
124
127
|
return;
|
|
125
128
|
}
|
|
@@ -128,10 +131,10 @@ const useSmsVerification = (type) => {
|
|
|
128
131
|
updateJwtFunction: () => _tslib.__awaiter(void 0, void 0, void 0, function* () { return verifyOtp(verificationToken, 'sms', verificationUUID); }),
|
|
129
132
|
});
|
|
130
133
|
}), [
|
|
131
|
-
authToken,
|
|
132
134
|
cancelAuth,
|
|
133
135
|
completeAuth,
|
|
134
|
-
|
|
136
|
+
user,
|
|
137
|
+
userWithMissingFields,
|
|
135
138
|
verificationUUID,
|
|
136
139
|
verifyOtp,
|
|
137
140
|
]);
|
|
@@ -145,7 +148,7 @@ const useSmsVerification = (type) => {
|
|
|
145
148
|
onVerifySuccess: () => {
|
|
146
149
|
isValidatedRef.current = true;
|
|
147
150
|
},
|
|
148
|
-
options: { phone:
|
|
151
|
+
options: { phone: retryData },
|
|
149
152
|
showSuccessMessage: true,
|
|
150
153
|
verifyFunction: () => sms.signInWithSmsVerification({
|
|
151
154
|
environmentId,
|
|
@@ -153,7 +156,7 @@ const useSmsVerification = (type) => {
|
|
|
153
156
|
verificationUUID,
|
|
154
157
|
}),
|
|
155
158
|
});
|
|
156
|
-
}), [verificationUUID, initAuth,
|
|
159
|
+
}), [verificationUUID, initAuth, retryData, cancelAuth, environmentId]);
|
|
157
160
|
const { isLoading, mutate: onSubmit } = useMutation.useMutation(type === 'login' ? submitOtpForLogin : submitOtpForVerification, {
|
|
158
161
|
onFailure: (error) => {
|
|
159
162
|
setError(error);
|
|
@@ -80,7 +80,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
80
80
|
|
|
81
81
|
const useSmsVerification = (type) => {
|
|
82
82
|
const { verificationUUID, displayedDestination: formattedPhone, retryData, } = useVerification();
|
|
83
|
-
const { environmentId,
|
|
83
|
+
const { environmentId, user, userWithMissingFields } = useInternalDynamicContext();
|
|
84
84
|
const [error, setError] = useState();
|
|
85
85
|
const { verifyOtp } = useOtpVerificationRequest();
|
|
86
86
|
const { initAuth, completeAuth, cancelAuth } = useUserAuth({
|
|
@@ -89,13 +89,16 @@ const useSmsVerification = (type) => {
|
|
|
89
89
|
/** Whether verification was successfully performed */
|
|
90
90
|
const isValidatedRef = useRef(false);
|
|
91
91
|
useOnUnmount(() => {
|
|
92
|
-
|
|
92
|
+
const phone = retryData !== null && retryData !== void 0 ? retryData : {
|
|
93
93
|
dialCode: '',
|
|
94
94
|
iso2: '',
|
|
95
95
|
phone: '',
|
|
96
|
-
}
|
|
96
|
+
};
|
|
97
97
|
if (!retryData)
|
|
98
98
|
logger.warn('WARNING: emitted smsVerificationResult with incomplete params because retryData was undefined');
|
|
99
|
+
dynamicEvents.emit('smsVerificationResult', isValidatedRef.current, phone);
|
|
100
|
+
if (!isValidatedRef.current)
|
|
101
|
+
dynamicEvents.emit('authFailure', { option: phone, phone, type: 'sms' }, 'user-cancelled');
|
|
99
102
|
});
|
|
100
103
|
const retryOneTimePassword = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
104
|
setError(undefined);
|
|
@@ -115,7 +118,7 @@ const useSmsVerification = (type) => {
|
|
|
115
118
|
});
|
|
116
119
|
});
|
|
117
120
|
const submitOtpForVerification = useCallback((verificationToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
118
|
-
if (!verificationUUID || (!
|
|
121
|
+
if (!verificationUUID || (!user && !userWithMissingFields)) {
|
|
119
122
|
yield cancelAuth();
|
|
120
123
|
return;
|
|
121
124
|
}
|
|
@@ -124,10 +127,10 @@ const useSmsVerification = (type) => {
|
|
|
124
127
|
updateJwtFunction: () => __awaiter(void 0, void 0, void 0, function* () { return verifyOtp(verificationToken, 'sms', verificationUUID); }),
|
|
125
128
|
});
|
|
126
129
|
}), [
|
|
127
|
-
authToken,
|
|
128
130
|
cancelAuth,
|
|
129
131
|
completeAuth,
|
|
130
|
-
|
|
132
|
+
user,
|
|
133
|
+
userWithMissingFields,
|
|
131
134
|
verificationUUID,
|
|
132
135
|
verifyOtp,
|
|
133
136
|
]);
|
|
@@ -141,7 +144,7 @@ const useSmsVerification = (type) => {
|
|
|
141
144
|
onVerifySuccess: () => {
|
|
142
145
|
isValidatedRef.current = true;
|
|
143
146
|
},
|
|
144
|
-
options: { phone:
|
|
147
|
+
options: { phone: retryData },
|
|
145
148
|
showSuccessMessage: true,
|
|
146
149
|
verifyFunction: () => signInWithSmsVerification({
|
|
147
150
|
environmentId,
|
|
@@ -149,7 +152,7 @@ const useSmsVerification = (type) => {
|
|
|
149
152
|
verificationUUID,
|
|
150
153
|
}),
|
|
151
154
|
});
|
|
152
|
-
}), [verificationUUID, initAuth,
|
|
155
|
+
}), [verificationUUID, initAuth, retryData, cancelAuth, environmentId]);
|
|
153
156
|
const { isLoading, mutate: onSubmit } = useMutation(type === 'login' ? submitOtpForLogin : submitOtpForVerification, {
|
|
154
157
|
onFailure: (error) => {
|
|
155
158
|
setError(error);
|
|
@@ -140,7 +140,7 @@ const viewToComponentMap = {
|
|
|
140
140
|
'farcaster-connect-view': FarcasterConnectView.FarcasterConnectView,
|
|
141
141
|
'gate-blocked-wallet': NoAccess.NoAccess,
|
|
142
142
|
'login-with-email-or-wallet': LoginView.LoginView,
|
|
143
|
-
'login-with-email-or-wallet-full-wallet-list':
|
|
143
|
+
'login-with-email-or-wallet-full-wallet-list': WalletList.WalletList,
|
|
144
144
|
'login-with-email-verification': EmailVerification.EmailVerification,
|
|
145
145
|
'login-with-sms-verification': SmsVerification.SmsVerification,
|
|
146
146
|
'login-with-wallet-only': LoginView.LoginView,
|
|
@@ -20,7 +20,7 @@ export declare const viewToComponentMap: {
|
|
|
20
20
|
'farcaster-connect-view': ({ url }: import("./FarcasterConnectView/FarcasterConnectView").FarcasterConnectViewProps) => JSX.Element;
|
|
21
21
|
'gate-blocked-wallet': () => JSX.Element;
|
|
22
22
|
'login-with-email-or-wallet': () => JSX.Element;
|
|
23
|
-
'login-with-email-or-wallet-full-wallet-list': () => JSX.Element;
|
|
23
|
+
'login-with-email-or-wallet-full-wallet-list': ({ isWalletConnectList, }: import("./WalletList").WalletListProps) => JSX.Element;
|
|
24
24
|
'login-with-email-verification': import("react").FC<import("./EmailVerification/EmailVerification").EmailVerificationProps>;
|
|
25
25
|
'login-with-sms-verification': import("react").FC;
|
|
26
26
|
'login-with-wallet-only': () => JSX.Element;
|
|
@@ -136,7 +136,7 @@ const viewToComponentMap = {
|
|
|
136
136
|
'farcaster-connect-view': FarcasterConnectView,
|
|
137
137
|
'gate-blocked-wallet': NoAccess,
|
|
138
138
|
'login-with-email-or-wallet': LoginView,
|
|
139
|
-
'login-with-email-or-wallet-full-wallet-list':
|
|
139
|
+
'login-with-email-or-wallet-full-wallet-list': WalletList,
|
|
140
140
|
'login-with-email-verification': EmailVerification,
|
|
141
141
|
'login-with-sms-verification': SmsVerification,
|
|
142
142
|
'login-with-wallet-only': LoginView,
|
|
@@ -31,9 +31,9 @@ require('@dynamic-labs/store');
|
|
|
31
31
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
32
32
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
33
33
|
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
34
|
+
require('../../../events/dynamicEvents.cjs');
|
|
34
35
|
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
35
36
|
require('react-dom');
|
|
36
|
-
require('../../../events/dynamicEvents.cjs');
|
|
37
37
|
require('../../../context/WalletContext/WalletContext.cjs');
|
|
38
38
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
39
39
|
var useKYCFlag = require('../../../utils/hooks/useKYCFlag/useKYCFlag.cjs');
|
|
@@ -27,9 +27,9 @@ import '@dynamic-labs/store';
|
|
|
27
27
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
28
28
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
29
29
|
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
30
|
+
import '../../../events/dynamicEvents.js';
|
|
30
31
|
import '../../../context/VerificationContext/VerificationContext.js';
|
|
31
32
|
import 'react-dom';
|
|
32
|
-
import '../../../events/dynamicEvents.js';
|
|
33
33
|
import '../../../context/WalletContext/WalletContext.js';
|
|
34
34
|
import '../../../context/ThemeContext/ThemeContext.js';
|
|
35
35
|
import { useKYCFlag } from '../../../utils/hooks/useKYCFlag/useKYCFlag.js';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var helpers = require('../../../context/DynamicContext/helpers/helpers.cjs');
|
|
7
|
-
require('@dynamic-labs/sdk-api-core');
|
|
8
|
-
require('../../../shared/logger.cjs');
|
|
9
|
-
require('@dynamic-labs/iconic');
|
|
10
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
11
|
-
require('react/jsx-runtime');
|
|
12
|
-
require('../../../context/ViewContext/ViewContext.cjs');
|
|
13
|
-
require('react');
|
|
14
|
-
require('@dynamic-labs/wallet-book');
|
|
15
|
-
var localStorage$1 = require('../../constants/localStorage.cjs');
|
|
16
|
-
require('../../constants/colors.cjs');
|
|
17
|
-
require('../../constants/values.cjs');
|
|
18
|
-
var localStorage = require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
-
require('@dynamic-labs/utils');
|
|
20
|
-
require('../../../shared/consts/index.cjs');
|
|
21
|
-
|
|
22
|
-
const getOnboardingAuthToken = () => {
|
|
23
|
-
if (typeof window === 'undefined')
|
|
24
|
-
return undefined;
|
|
25
|
-
const token = localStorage.LocalStorage.getFromLS(localStorage$1.AUTH_ONBOARDING_TOKEN, true);
|
|
26
|
-
if (!token || helpers.isMinAuthTokenExpired(token))
|
|
27
|
-
return undefined;
|
|
28
|
-
return token;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
exports.getOnboardingAuthToken = getOnboardingAuthToken;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getOnboardingAuthToken: () => any;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { isMinAuthTokenExpired } from '../../../context/DynamicContext/helpers/helpers.js';
|
|
3
|
-
import '@dynamic-labs/sdk-api-core';
|
|
4
|
-
import '../../../shared/logger.js';
|
|
5
|
-
import '@dynamic-labs/iconic';
|
|
6
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
-
import 'react/jsx-runtime';
|
|
8
|
-
import '../../../context/ViewContext/ViewContext.js';
|
|
9
|
-
import 'react';
|
|
10
|
-
import '@dynamic-labs/wallet-book';
|
|
11
|
-
import { AUTH_ONBOARDING_TOKEN } from '../../constants/localStorage.js';
|
|
12
|
-
import '../../constants/colors.js';
|
|
13
|
-
import '../../constants/values.js';
|
|
14
|
-
import { LocalStorage } from '../../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
-
import '@dynamic-labs/utils';
|
|
16
|
-
import '../../../shared/consts/index.js';
|
|
17
|
-
|
|
18
|
-
const getOnboardingAuthToken = () => {
|
|
19
|
-
if (typeof window === 'undefined')
|
|
20
|
-
return undefined;
|
|
21
|
-
const token = LocalStorage.getFromLS(AUTH_ONBOARDING_TOKEN, true);
|
|
22
|
-
if (!token || isMinAuthTokenExpired(token))
|
|
23
|
-
return undefined;
|
|
24
|
-
return token;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export { getOnboardingAuthToken };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getOnboardingAuthToken } from './getOnboardingAuthToken';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
-
require('@dynamic-labs/utils');
|
|
8
|
-
require('@dynamic-labs/sdk-api-core');
|
|
9
|
-
require('../../../shared/logger.cjs');
|
|
10
|
-
require('@dynamic-labs/iconic');
|
|
11
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
-
require('react/jsx-runtime');
|
|
13
|
-
require('../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
-
require('react');
|
|
15
|
-
require('@dynamic-labs/wallet-book');
|
|
16
|
-
require('../../constants/colors.cjs');
|
|
17
|
-
require('../../constants/values.cjs');
|
|
18
|
-
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
-
require('../../../shared/consts/index.cjs');
|
|
20
|
-
require('../../../config/ApiEndpoint.cjs');
|
|
21
|
-
require('@dynamic-labs/multi-wallet');
|
|
22
|
-
var getMinAuthToken = require('../getMinAuthToken/getMinAuthToken.cjs');
|
|
23
|
-
require('react-international-phone');
|
|
24
|
-
require('viem');
|
|
25
|
-
require('viem/chains');
|
|
26
|
-
var updateJWTAndCreateUserProfile = require('../updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.cjs');
|
|
27
|
-
require('../../../locale/locale.cjs');
|
|
28
|
-
require('@dynamic-labs/store');
|
|
29
|
-
var wallets = require('../../../data/api/wallets/wallets.cjs');
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* A helper function that wraps the unlinkWallet function from the API.
|
|
33
|
-
* This function will store the updated JWT in local storage and return the decoded JWT.
|
|
34
|
-
*
|
|
35
|
-
* @throws Error if the authentication call returns no or invalid JWT
|
|
36
|
-
*/
|
|
37
|
-
const handleUnlinkHelper = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ environmentId, primaryWalletId, walletId, }) {
|
|
38
|
-
const token = getMinAuthToken.getMinAuthToken();
|
|
39
|
-
if (!token)
|
|
40
|
-
return;
|
|
41
|
-
const response = yield wallets.unlinkWallet({
|
|
42
|
-
environmentId,
|
|
43
|
-
primaryWalletId,
|
|
44
|
-
walletId,
|
|
45
|
-
});
|
|
46
|
-
return updateJWTAndCreateUserProfile.updateJWTAndCreateUserProfile(response === null || response === void 0 ? void 0 : response.jwt, response === null || response === void 0 ? void 0 : response.minifiedJwt);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
exports.handleUnlinkHelper = handleUnlinkHelper;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type HandleUnlinkHelperArgs = {
|
|
2
|
-
environmentId: string;
|
|
3
|
-
primaryWalletId: string | undefined;
|
|
4
|
-
walletId: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* A helper function that wraps the unlinkWallet function from the API.
|
|
8
|
-
* This function will store the updated JWT in local storage and return the decoded JWT.
|
|
9
|
-
*
|
|
10
|
-
* @throws Error if the authentication call returns no or invalid JWT
|
|
11
|
-
*/
|
|
12
|
-
export declare const handleUnlinkHelper: ({ environmentId, primaryWalletId, walletId, }: HandleUnlinkHelperArgs) => Promise<import("dist/packages/types/src").UserProfile | undefined>;
|
|
13
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import '@dynamic-labs/utils';
|
|
4
|
-
import '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import '../../../shared/logger.js';
|
|
6
|
-
import '@dynamic-labs/iconic';
|
|
7
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
-
import 'react/jsx-runtime';
|
|
9
|
-
import '../../../context/ViewContext/ViewContext.js';
|
|
10
|
-
import 'react';
|
|
11
|
-
import '@dynamic-labs/wallet-book';
|
|
12
|
-
import '../../constants/colors.js';
|
|
13
|
-
import '../../constants/values.js';
|
|
14
|
-
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
-
import '../../../shared/consts/index.js';
|
|
16
|
-
import '../../../config/ApiEndpoint.js';
|
|
17
|
-
import '@dynamic-labs/multi-wallet';
|
|
18
|
-
import { getMinAuthToken } from '../getMinAuthToken/getMinAuthToken.js';
|
|
19
|
-
import 'react-international-phone';
|
|
20
|
-
import 'viem';
|
|
21
|
-
import 'viem/chains';
|
|
22
|
-
import { updateJWTAndCreateUserProfile } from '../updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.js';
|
|
23
|
-
import '../../../locale/locale.js';
|
|
24
|
-
import '@dynamic-labs/store';
|
|
25
|
-
import { unlinkWallet } from '../../../data/api/wallets/wallets.js';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A helper function that wraps the unlinkWallet function from the API.
|
|
29
|
-
* This function will store the updated JWT in local storage and return the decoded JWT.
|
|
30
|
-
*
|
|
31
|
-
* @throws Error if the authentication call returns no or invalid JWT
|
|
32
|
-
*/
|
|
33
|
-
const handleUnlinkHelper = (_a) => __awaiter(void 0, [_a], void 0, function* ({ environmentId, primaryWalletId, walletId, }) {
|
|
34
|
-
const token = getMinAuthToken();
|
|
35
|
-
if (!token)
|
|
36
|
-
return;
|
|
37
|
-
const response = yield unlinkWallet({
|
|
38
|
-
environmentId,
|
|
39
|
-
primaryWalletId,
|
|
40
|
-
walletId,
|
|
41
|
-
});
|
|
42
|
-
return updateJWTAndCreateUserProfile(response === null || response === void 0 ? void 0 : response.jwt, response === null || response === void 0 ? void 0 : response.minifiedJwt);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export { handleUnlinkHelper };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './handleUnlinkHelper';
|