@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
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { isPasskeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
5
|
-
import { decodeJwt } from '../../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
6
5
|
import '@dynamic-labs/sdk-api-core';
|
|
7
6
|
import '../../../../shared/logger.js';
|
|
8
7
|
import '@dynamic-labs/iconic';
|
|
@@ -15,7 +14,7 @@ import '../../../../utils/constants/values.js';
|
|
|
15
14
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
16
15
|
import '../../../../shared/consts/index.js';
|
|
17
16
|
import '../../../../config/ApiEndpoint.js';
|
|
18
|
-
import { INVALID_WALLET_DATA, ERROR_PROCESSING_REVEAL_REQUEST } from '../../../../utils/constants/errors.js';
|
|
17
|
+
import { INVALID_WALLET_DATA, ERROR_PROCESSING_REVEAL_REQUEST, USER_NOT_LOGGED_IN } from '../../../../utils/constants/errors.js';
|
|
19
18
|
import '@dynamic-labs/multi-wallet';
|
|
20
19
|
import 'react-international-phone';
|
|
21
20
|
import 'viem';
|
|
@@ -38,14 +37,10 @@ const initExport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ iframeCo
|
|
|
38
37
|
}
|
|
39
38
|
return turnkeyExportHandler;
|
|
40
39
|
});
|
|
41
|
-
const handleExportInitCheck = ({
|
|
40
|
+
const handleExportInitCheck = ({ user, wallet, }) => {
|
|
42
41
|
var _a, _b;
|
|
43
|
-
if (!
|
|
44
|
-
throw new DynamicError(
|
|
45
|
-
}
|
|
46
|
-
const decodedJwt = decodeJwt(authToken);
|
|
47
|
-
if (!decodedJwt) {
|
|
48
|
-
throw new DynamicError('User must be logged in with a valid token');
|
|
42
|
+
if (!user) {
|
|
43
|
+
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
49
44
|
}
|
|
50
45
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
51
46
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -53,8 +48,8 @@ const handleExportInitCheck = ({ authToken, userEmail, wallet, }) => {
|
|
|
53
48
|
throw new DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
54
49
|
}
|
|
55
50
|
const connector = wallet.connector;
|
|
56
|
-
connector.setEmail(
|
|
57
|
-
const walletProperties = (_b = (_a =
|
|
51
|
+
connector.setEmail(user.email);
|
|
52
|
+
const walletProperties = (_b = (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
58
53
|
const turnkeyHDWalletId = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
|
|
59
54
|
const privateKeyId = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyPrivateKeyId;
|
|
60
55
|
const organizationId = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeySubOrganizationId;
|
|
@@ -79,10 +74,9 @@ const extractExportBundle = ({ address, privateKeyId, activity, }) => {
|
|
|
79
74
|
: exportWalletResult;
|
|
80
75
|
return result === null || result === void 0 ? void 0 : result.exportBundle;
|
|
81
76
|
};
|
|
82
|
-
const exportCredential = (_c) => __awaiter(void 0, [_c], void 0, function* ({
|
|
77
|
+
const exportCredential = (_c) => __awaiter(void 0, [_c], void 0, function* ({ user, wallet, environmentId, address, }) {
|
|
83
78
|
const { connector, turnkeyHDWalletId, privateKeyId, organizationId } = handleExportInitCheck({
|
|
84
|
-
|
|
85
|
-
userEmail,
|
|
79
|
+
user,
|
|
86
80
|
wallet,
|
|
87
81
|
});
|
|
88
82
|
const turnkeyExportHandler = connector.getExportHandler();
|
|
@@ -23,35 +23,17 @@ var showFarcasterQrCodeView = require('./utils/showFarcasterQrCodeView/showFarca
|
|
|
23
23
|
const LoginView = () => {
|
|
24
24
|
var _a;
|
|
25
25
|
const { error } = ErrorContext.useErrorContext();
|
|
26
|
-
const {
|
|
26
|
+
const { setView } = ViewContext.useViewContext();
|
|
27
27
|
const { isWalletOnly, loginViewSections } = useLoginView.useLoginView();
|
|
28
28
|
const { enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
|
|
29
|
-
const [showWalletList, setShowWalletList] = React.useState(isWalletOnly);
|
|
30
|
-
React.useEffect(() => {
|
|
31
|
-
// toolkit log in with email was set to false
|
|
32
|
-
if (isWalletOnly) {
|
|
33
|
-
setView('login-with-wallet-only');
|
|
34
|
-
setShowWalletList(true);
|
|
35
|
-
}
|
|
36
|
-
// returning from 'View all wallets' button
|
|
37
|
-
if (!isWalletOnly && view.type === 'login-with-email-or-wallet') {
|
|
38
|
-
setShowWalletList(false);
|
|
39
|
-
}
|
|
40
|
-
// toolkit log in with email was set back to true
|
|
41
|
-
if (!isWalletOnly &&
|
|
42
|
-
(!showWalletList || view.type === 'login-with-wallet-only')) {
|
|
43
|
-
setView('login-with-email-or-wallet');
|
|
44
|
-
setShowWalletList(false);
|
|
45
|
-
}
|
|
46
|
-
}, [isWalletOnly, view.type]);
|
|
47
29
|
const { showDefaultFooter } = useAuthLayoutChecks.useAuthLayoutChecks();
|
|
48
30
|
const numOfWallets = ((_a = loginViewSections.find((section) => section.type === sdkApiCore.SdkViewSectionType.Wallet)) === null || _a === void 0 ? void 0 : _a.numOfItemsToDisplay) || 0;
|
|
49
|
-
const renderViewSections = React.useMemo(() => loginViewSections.map((viewSection, index) => (jsxRuntime.jsx("div", { className: classNames.classNames('login-view__scroll__section', `login-view__scroll__section--${viewSection.type}`), children: jsxRuntime.jsx(LoginViewSection.LoginViewSection, { gotToWalletList: () =>
|
|
31
|
+
const renderViewSections = React.useMemo(() => loginViewSections.map((viewSection, index) => (jsxRuntime.jsx("div", { className: classNames.classNames('login-view__scroll__section', `login-view__scroll__section--${viewSection.type}`), children: jsxRuntime.jsx(LoginViewSection.LoginViewSection, { gotToWalletList: () => setView('login-with-email-or-wallet-full-wallet-list'), index: index, viewSection: viewSection, walletCount: numOfWallets }) }, `${viewSection.type}__${index}`))), [loginViewSections, numOfWallets]);
|
|
50
32
|
const errorElement = error && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'login-view__error-container', withIcon: false, children: error }));
|
|
51
33
|
if (showFarcasterQrCodeView.showFarcasterQrCodeView(loginViewSections, enabledSocialProviders)) {
|
|
52
34
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [errorElement, jsxRuntime.jsx(FarcasterQrCodeView.FarcasterQrCodeView, {})] }));
|
|
53
35
|
}
|
|
54
|
-
if (
|
|
36
|
+
if (isWalletOnly) {
|
|
55
37
|
return jsxRuntime.jsx(WalletList.WalletList, {});
|
|
56
38
|
}
|
|
57
39
|
const shouldShowFooter = utils.isMobile() && showDefaultFooter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
4
|
import { SdkViewSectionType } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { isMobile } from '@dynamic-labs/utils';
|
|
6
6
|
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
@@ -19,35 +19,17 @@ import { showFarcasterQrCodeView } from './utils/showFarcasterQrCodeView/showFar
|
|
|
19
19
|
const LoginView = () => {
|
|
20
20
|
var _a;
|
|
21
21
|
const { error } = useErrorContext();
|
|
22
|
-
const {
|
|
22
|
+
const { setView } = useViewContext();
|
|
23
23
|
const { isWalletOnly, loginViewSections } = useLoginView();
|
|
24
24
|
const { enabledSocialProviders } = useSocialRedirectContext();
|
|
25
|
-
const [showWalletList, setShowWalletList] = useState(isWalletOnly);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
// toolkit log in with email was set to false
|
|
28
|
-
if (isWalletOnly) {
|
|
29
|
-
setView('login-with-wallet-only');
|
|
30
|
-
setShowWalletList(true);
|
|
31
|
-
}
|
|
32
|
-
// returning from 'View all wallets' button
|
|
33
|
-
if (!isWalletOnly && view.type === 'login-with-email-or-wallet') {
|
|
34
|
-
setShowWalletList(false);
|
|
35
|
-
}
|
|
36
|
-
// toolkit log in with email was set back to true
|
|
37
|
-
if (!isWalletOnly &&
|
|
38
|
-
(!showWalletList || view.type === 'login-with-wallet-only')) {
|
|
39
|
-
setView('login-with-email-or-wallet');
|
|
40
|
-
setShowWalletList(false);
|
|
41
|
-
}
|
|
42
|
-
}, [isWalletOnly, view.type]);
|
|
43
25
|
const { showDefaultFooter } = useAuthLayoutChecks();
|
|
44
26
|
const numOfWallets = ((_a = loginViewSections.find((section) => section.type === SdkViewSectionType.Wallet)) === null || _a === void 0 ? void 0 : _a.numOfItemsToDisplay) || 0;
|
|
45
|
-
const renderViewSections = useMemo(() => loginViewSections.map((viewSection, index) => (jsx("div", { className: classNames('login-view__scroll__section', `login-view__scroll__section--${viewSection.type}`), children: jsx(LoginViewSection, { gotToWalletList: () =>
|
|
27
|
+
const renderViewSections = useMemo(() => loginViewSections.map((viewSection, index) => (jsx("div", { className: classNames('login-view__scroll__section', `login-view__scroll__section--${viewSection.type}`), children: jsx(LoginViewSection, { gotToWalletList: () => setView('login-with-email-or-wallet-full-wallet-list'), index: index, viewSection: viewSection, walletCount: numOfWallets }) }, `${viewSection.type}__${index}`))), [loginViewSections, numOfWallets]);
|
|
46
28
|
const errorElement = error && (jsx(ErrorContainer, { className: 'login-view__error-container', withIcon: false, children: error }));
|
|
47
29
|
if (showFarcasterQrCodeView(loginViewSections, enabledSocialProviders)) {
|
|
48
30
|
return (jsxs(Fragment, { children: [errorElement, jsx(FarcasterQrCodeView, {})] }));
|
|
49
31
|
}
|
|
50
|
-
if (
|
|
32
|
+
if (isWalletOnly) {
|
|
51
33
|
return jsx(WalletList, {});
|
|
52
34
|
}
|
|
53
35
|
const shouldShowFooter = isMobile() && showDefaultFooter;
|
|
@@ -21,7 +21,7 @@ require('../../../../../utils/constants/colors.cjs');
|
|
|
21
21
|
require('../../../../../utils/constants/values.cjs');
|
|
22
22
|
require('../../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
23
23
|
require('../../../../../shared/consts/index.cjs');
|
|
24
|
-
require('../../../../../events/dynamicEvents.cjs');
|
|
24
|
+
var dynamicEvents = require('../../../../../events/dynamicEvents.cjs');
|
|
25
25
|
require('../../../../../context/ErrorContext/ErrorContext.cjs');
|
|
26
26
|
require('@dynamic-labs/multi-wallet');
|
|
27
27
|
var formatPhone = require('../../../../../utils/functions/formatPhone/formatPhone.cjs');
|
|
@@ -112,6 +112,16 @@ const useSubmitPhoneNumber = ({ onSubmit, onSubmitError, country, phone, setInva
|
|
|
112
112
|
setView('login-with-sms-verification');
|
|
113
113
|
setDisplayedDestination(formatPhone.formatPhone(phone));
|
|
114
114
|
setVerificationUUID(verificationUUID);
|
|
115
|
+
const phoneData = {
|
|
116
|
+
dialCode: country.dialCode,
|
|
117
|
+
iso2: country.iso2,
|
|
118
|
+
phone: phoneNumber,
|
|
119
|
+
};
|
|
120
|
+
dynamicEvents.dynamicEvents.emit('authInit', {
|
|
121
|
+
option: phoneData,
|
|
122
|
+
phone: phoneData,
|
|
123
|
+
type: 'sms',
|
|
124
|
+
});
|
|
115
125
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
|
|
116
126
|
}
|
|
117
127
|
catch (error) {
|
|
@@ -17,7 +17,7 @@ import '../../../../../utils/constants/colors.js';
|
|
|
17
17
|
import '../../../../../utils/constants/values.js';
|
|
18
18
|
import '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
19
19
|
import '../../../../../shared/consts/index.js';
|
|
20
|
-
import '../../../../../events/dynamicEvents.js';
|
|
20
|
+
import { dynamicEvents } from '../../../../../events/dynamicEvents.js';
|
|
21
21
|
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
22
22
|
import '@dynamic-labs/multi-wallet';
|
|
23
23
|
import { formatPhone } from '../../../../../utils/functions/formatPhone/formatPhone.js';
|
|
@@ -108,6 +108,16 @@ const useSubmitPhoneNumber = ({ onSubmit, onSubmitError, country, phone, setInva
|
|
|
108
108
|
setView('login-with-sms-verification');
|
|
109
109
|
setDisplayedDestination(formatPhone(phone));
|
|
110
110
|
setVerificationUUID(verificationUUID);
|
|
111
|
+
const phoneData = {
|
|
112
|
+
dialCode: country.dialCode,
|
|
113
|
+
iso2: country.iso2,
|
|
114
|
+
phone: phoneNumber,
|
|
115
|
+
};
|
|
116
|
+
dynamicEvents.emit('authInit', {
|
|
117
|
+
option: phoneData,
|
|
118
|
+
phone: phoneData,
|
|
119
|
+
type: 'sms',
|
|
120
|
+
});
|
|
111
121
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
|
|
112
122
|
}
|
|
113
123
|
catch (error) {
|
package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs
CHANGED
|
@@ -33,6 +33,7 @@ require('viem/chains');
|
|
|
33
33
|
require('../../config/ApiEndpoint.cjs');
|
|
34
34
|
require('../../locale/locale.cjs');
|
|
35
35
|
var user = require('../../data/api/user/user.cjs');
|
|
36
|
+
require('@dynamic-labs/store');
|
|
36
37
|
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
37
38
|
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
38
39
|
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
@@ -48,7 +49,6 @@ require('../../context/MockContext/MockContext.cjs');
|
|
|
48
49
|
require('../CollectUserDataView/useFields.cjs');
|
|
49
50
|
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
50
51
|
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
51
|
-
require('@dynamic-labs/store');
|
|
52
52
|
require('@dynamic-labs/rpc-providers');
|
|
53
53
|
var Typography = require('../../components/Typography/Typography.cjs');
|
|
54
54
|
require('../../context/FooterAnimationContext/index.cjs');
|
|
@@ -87,7 +87,7 @@ require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
|
87
87
|
|
|
88
88
|
const MergeUserAccountsWithSameEmailView = ({ returnToView }) => {
|
|
89
89
|
const { environmentId, setShowAuthFlow, setCallback, primaryWallet, user: user$1 } = useInternalDynamicContext.useInternalDynamicContext();
|
|
90
|
-
const
|
|
90
|
+
const handleVerifiedUser = useHandleVerifiedUser.useHandleVerifiedUser();
|
|
91
91
|
const { t } = reactI18next.useTranslation();
|
|
92
92
|
const { setError } = ErrorContext.useErrorContext();
|
|
93
93
|
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
@@ -98,7 +98,7 @@ const MergeUserAccountsWithSameEmailView = ({ returnToView }) => {
|
|
|
98
98
|
if (!userProfile) {
|
|
99
99
|
throw new utils.DynamicError('Something went wrong, please try again.');
|
|
100
100
|
}
|
|
101
|
-
yield
|
|
101
|
+
yield handleVerifiedUser(userProfile);
|
|
102
102
|
setShowAuthFlow(false);
|
|
103
103
|
setCallback('authSuccess');
|
|
104
104
|
}
|
package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js
CHANGED
|
@@ -29,6 +29,7 @@ import 'viem/chains';
|
|
|
29
29
|
import '../../config/ApiEndpoint.js';
|
|
30
30
|
import '../../locale/locale.js';
|
|
31
31
|
import { mergeUserAccounts } from '../../data/api/user/user.js';
|
|
32
|
+
import '@dynamic-labs/store';
|
|
32
33
|
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
33
34
|
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
34
35
|
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
@@ -44,7 +45,6 @@ import '../../context/MockContext/MockContext.js';
|
|
|
44
45
|
import '../CollectUserDataView/useFields.js';
|
|
45
46
|
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
46
47
|
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
47
|
-
import '@dynamic-labs/store';
|
|
48
48
|
import '@dynamic-labs/rpc-providers';
|
|
49
49
|
import { Typography } from '../../components/Typography/Typography.js';
|
|
50
50
|
import '../../context/FooterAnimationContext/index.js';
|
|
@@ -83,7 +83,7 @@ import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
|
83
83
|
|
|
84
84
|
const MergeUserAccountsWithSameEmailView = ({ returnToView }) => {
|
|
85
85
|
const { environmentId, setShowAuthFlow, setCallback, primaryWallet, user } = useInternalDynamicContext();
|
|
86
|
-
const
|
|
86
|
+
const handleVerifiedUser = useHandleVerifiedUser();
|
|
87
87
|
const { t } = useTranslation();
|
|
88
88
|
const { setError } = useErrorContext();
|
|
89
89
|
const { setView, goToInitialView } = useViewContext();
|
|
@@ -94,7 +94,7 @@ const MergeUserAccountsWithSameEmailView = ({ returnToView }) => {
|
|
|
94
94
|
if (!userProfile) {
|
|
95
95
|
throw new DynamicError('Something went wrong, please try again.');
|
|
96
96
|
}
|
|
97
|
-
yield
|
|
97
|
+
yield handleVerifiedUser(userProfile);
|
|
98
98
|
setShowAuthFlow(false);
|
|
99
99
|
setCallback('authSuccess');
|
|
100
100
|
}
|
|
@@ -90,7 +90,7 @@ require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
|
90
90
|
const NoAccess = () => {
|
|
91
91
|
const { deniedAddress, setDeniedAddress, setDeniedOauthProvider } = AccessDeniedContext.useAccessDeniedContext();
|
|
92
92
|
const { t } = reactI18next.useTranslation();
|
|
93
|
-
const { selectedWalletConnector: walletConnector, socialMediaIconUrl, notInTheListImageUrl,
|
|
93
|
+
const { selectedWalletConnector: walletConnector, socialMediaIconUrl, notInTheListImageUrl, accessDeniedButton, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
94
94
|
const { displayedDestination: email } = VerificationContext.useVerification();
|
|
95
95
|
const { goToInitialView } = ViewContext.useViewContext();
|
|
96
96
|
const { _socialMediaLinkText, _socialMediaUrl, isAccessListView, isGateBlockedView, subtitle, title, buttonTitle: _buttonTitle, } = useNoAccessText.useNoAccessText();
|
|
@@ -108,7 +108,7 @@ const NoAccess = () => {
|
|
|
108
108
|
return jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, {});
|
|
109
109
|
}
|
|
110
110
|
return (jsxRuntime.jsx(IconWithStatus.IconWithStatus, { containerClassName: 'wallet-no-access__icon--verified', Icon: iconic.SignInWithEmailIcon, iconSize: 50, InnerIcon: error.ReactComponent, variant: 'red' }));
|
|
111
|
-
}, [
|
|
111
|
+
}, [walletConnector]);
|
|
112
112
|
const formattedAddress = shortenWalletAddress.shortenWalletAddress(deniedAddress, 6, 4);
|
|
113
113
|
const buttonTitle = (accessDeniedButton === null || accessDeniedButton === void 0 ? void 0 : accessDeniedButton.title) || _buttonTitle;
|
|
114
114
|
const buttonAction = (accessDeniedButton === null || accessDeniedButton === void 0 ? void 0 : accessDeniedButton.action) || handleChangeWallet;
|
|
@@ -86,7 +86,7 @@ import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
|
86
86
|
const NoAccess = () => {
|
|
87
87
|
const { deniedAddress, setDeniedAddress, setDeniedOauthProvider } = useAccessDeniedContext();
|
|
88
88
|
const { t } = useTranslation();
|
|
89
|
-
const { selectedWalletConnector: walletConnector, socialMediaIconUrl, notInTheListImageUrl,
|
|
89
|
+
const { selectedWalletConnector: walletConnector, socialMediaIconUrl, notInTheListImageUrl, accessDeniedButton, } = useInternalDynamicContext();
|
|
90
90
|
const { displayedDestination: email } = useVerification();
|
|
91
91
|
const { goToInitialView } = useViewContext();
|
|
92
92
|
const { _socialMediaLinkText, _socialMediaUrl, isAccessListView, isGateBlockedView, subtitle, title, buttonTitle: _buttonTitle, } = useNoAccessText();
|
|
@@ -104,7 +104,7 @@ const NoAccess = () => {
|
|
|
104
104
|
return jsx(AuthProviderIcon, {});
|
|
105
105
|
}
|
|
106
106
|
return (jsx(IconWithStatus, { containerClassName: 'wallet-no-access__icon--verified', Icon: SignInWithEmailIcon, iconSize: 50, InnerIcon: SvgError, variant: 'red' }));
|
|
107
|
-
}, [
|
|
107
|
+
}, [walletConnector]);
|
|
108
108
|
const formattedAddress = shortenWalletAddress(deniedAddress, 6, 4);
|
|
109
109
|
const buttonTitle = (accessDeniedButton === null || accessDeniedButton === void 0 ? void 0 : accessDeniedButton.title) || _buttonTitle;
|
|
110
110
|
const buttonAction = (accessDeniedButton === null || accessDeniedButton === void 0 ? void 0 : accessDeniedButton.action) || handleChangeWallet;
|
|
@@ -10,7 +10,6 @@ var reactI18next = require('react-i18next');
|
|
|
10
10
|
var utils = require('@dynamic-labs/utils');
|
|
11
11
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
12
12
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
13
|
-
var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
14
13
|
require('../../../shared/logger.cjs');
|
|
15
14
|
require('@dynamic-labs/iconic');
|
|
16
15
|
require('@dynamic-labs/wallet-connector-core');
|
|
@@ -26,7 +25,6 @@ require('../../../events/dynamicEvents.cjs');
|
|
|
26
25
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
27
26
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
28
27
|
require('@dynamic-labs/multi-wallet');
|
|
29
|
-
var getAuthToken = require('../../../utils/functions/getAuthToken/getAuthToken.cjs');
|
|
30
28
|
require('react-international-phone');
|
|
31
29
|
require('viem');
|
|
32
30
|
require('viem/chains');
|
|
@@ -93,7 +91,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
93
91
|
|
|
94
92
|
const PasskeyIntroView = ({ chains }) => {
|
|
95
93
|
var _a;
|
|
96
|
-
const { walletConnectorOptions, environmentId, handleLogOut,
|
|
94
|
+
const { walletConnectorOptions, environmentId, handleLogOut, user, userWithMissingFields, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
97
95
|
const isEmailRecoveryFlow = ((_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
|
|
98
96
|
!getUserVerifiedCredentialType.getUserVerifiedCredentialType(user, sdkApiCore.JwtVerifiedCredentialFormatEnum.Email);
|
|
99
97
|
const { t } = reactI18next.useTranslation();
|
|
@@ -106,15 +104,11 @@ const PasskeyIntroView = ({ chains }) => {
|
|
|
106
104
|
React.useEffect(() => localStorage.LocalStorage.removeFromLS(localStorage$1.LAST_USED_WALLET), []);
|
|
107
105
|
const { createDynamicEmbeddedWalletMutation, isLoading, error } = useCreateDynamicEmbeddedWalletMutation.useCreateDynamicEmbeddedWalletMutation();
|
|
108
106
|
const handleCreateEmbeddedWallet = (withAuthenticator) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
109
|
-
|
|
110
|
-
const jwt = (_b = getAuthToken.getAuthToken()) !== null && _b !== void 0 ? _b : onboardingOnlyJwt;
|
|
111
|
-
const decodedJwt = decodeJwt.decodeJwt(jwt);
|
|
112
|
-
if (!jwt || !decodedJwt) {
|
|
107
|
+
if (!user && !userWithMissingFields) {
|
|
113
108
|
throw new Error('User is not logged in');
|
|
114
109
|
}
|
|
115
110
|
setCreateWalletWithAuthenticator(withAuthenticator);
|
|
116
111
|
yield createDynamicEmbeddedWalletMutation({
|
|
117
|
-
authToken: jwt,
|
|
118
112
|
chains,
|
|
119
113
|
environmentId,
|
|
120
114
|
walletConnectorOptions,
|
|
@@ -6,7 +6,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
6
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
7
7
|
import { JwtVerifiedCredentialFormatEnum } from '@dynamic-labs/sdk-api-core';
|
|
8
8
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
9
|
-
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
10
9
|
import '../../../shared/logger.js';
|
|
11
10
|
import '@dynamic-labs/iconic';
|
|
12
11
|
import '@dynamic-labs/wallet-connector-core';
|
|
@@ -22,7 +21,6 @@ import '../../../events/dynamicEvents.js';
|
|
|
22
21
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
23
22
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
24
23
|
import '@dynamic-labs/multi-wallet';
|
|
25
|
-
import { getAuthToken } from '../../../utils/functions/getAuthToken/getAuthToken.js';
|
|
26
24
|
import 'react-international-phone';
|
|
27
25
|
import 'viem';
|
|
28
26
|
import 'viem/chains';
|
|
@@ -89,7 +87,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
89
87
|
|
|
90
88
|
const PasskeyIntroView = ({ chains }) => {
|
|
91
89
|
var _a;
|
|
92
|
-
const { walletConnectorOptions, environmentId, handleLogOut,
|
|
90
|
+
const { walletConnectorOptions, environmentId, handleLogOut, user, userWithMissingFields, } = useInternalDynamicContext();
|
|
93
91
|
const isEmailRecoveryFlow = ((_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
|
|
94
92
|
!getUserVerifiedCredentialType(user, JwtVerifiedCredentialFormatEnum.Email);
|
|
95
93
|
const { t } = useTranslation();
|
|
@@ -102,15 +100,11 @@ const PasskeyIntroView = ({ chains }) => {
|
|
|
102
100
|
useEffect(() => LocalStorage.removeFromLS(LAST_USED_WALLET), []);
|
|
103
101
|
const { createDynamicEmbeddedWalletMutation, isLoading, error } = useCreateDynamicEmbeddedWalletMutation();
|
|
104
102
|
const handleCreateEmbeddedWallet = (withAuthenticator) => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
-
|
|
106
|
-
const jwt = (_b = getAuthToken()) !== null && _b !== void 0 ? _b : onboardingOnlyJwt;
|
|
107
|
-
const decodedJwt = decodeJwt(jwt);
|
|
108
|
-
if (!jwt || !decodedJwt) {
|
|
103
|
+
if (!user && !userWithMissingFields) {
|
|
109
104
|
throw new Error('User is not logged in');
|
|
110
105
|
}
|
|
111
106
|
setCreateWalletWithAuthenticator(withAuthenticator);
|
|
112
107
|
yield createDynamicEmbeddedWalletMutation({
|
|
113
|
-
authToken: jwt,
|
|
114
108
|
chains,
|
|
115
109
|
environmentId,
|
|
116
110
|
walletConnectorOptions,
|
|
@@ -94,7 +94,7 @@ require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs')
|
|
|
94
94
|
// eslint-disable-next-line no-useless-escape
|
|
95
95
|
const bundleRegex = new RegExp(/^([A-Za-z0-9\s_+@\.-]+)$/);
|
|
96
96
|
const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
|
|
97
|
-
const {
|
|
97
|
+
const { primaryWallet, environmentId, user, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
98
98
|
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
99
99
|
const [bundleInput, setBundleInput] = React.useState('');
|
|
100
100
|
const [resendingCode, setResendingCode] = React.useState(false);
|
|
@@ -104,8 +104,8 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
|
|
|
104
104
|
const { mutate, isLoading, error: error$1 } = useMutation.useMutation((bundleInput) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
105
105
|
const wallet = getEOAWallet.getEOAWallet(primaryWallet, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
106
106
|
yield passkeyRecovery.passkeyRecoveryBundleValidation({
|
|
107
|
-
authToken,
|
|
108
107
|
bundleInput,
|
|
108
|
+
user,
|
|
109
109
|
wallet,
|
|
110
110
|
});
|
|
111
111
|
setIsValid(true);
|
|
@@ -152,9 +152,9 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
|
|
|
152
152
|
try {
|
|
153
153
|
setResendingCode(true);
|
|
154
154
|
yield passkeyRecovery.resentRecoveryEmail({
|
|
155
|
-
authToken,
|
|
156
155
|
authenticatorType,
|
|
157
156
|
environmentId,
|
|
157
|
+
user,
|
|
158
158
|
wallet: primaryWallet,
|
|
159
159
|
});
|
|
160
160
|
}
|
|
@@ -90,7 +90,7 @@ import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
|
90
90
|
// eslint-disable-next-line no-useless-escape
|
|
91
91
|
const bundleRegex = new RegExp(/^([A-Za-z0-9\s_+@\.-]+)$/);
|
|
92
92
|
const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
|
|
93
|
-
const {
|
|
93
|
+
const { primaryWallet, environmentId, user, setShowAuthFlow } = useInternalDynamicContext();
|
|
94
94
|
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
95
95
|
const [bundleInput, setBundleInput] = useState('');
|
|
96
96
|
const [resendingCode, setResendingCode] = useState(false);
|
|
@@ -100,8 +100,8 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
|
|
|
100
100
|
const { mutate, isLoading, error } = useMutation((bundleInput) => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
101
|
const wallet = getEOAWallet(primaryWallet, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
102
102
|
yield passkeyRecoveryBundleValidation({
|
|
103
|
-
authToken,
|
|
104
103
|
bundleInput,
|
|
104
|
+
user,
|
|
105
105
|
wallet,
|
|
106
106
|
});
|
|
107
107
|
setIsValid(true);
|
|
@@ -148,9 +148,9 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
|
|
|
148
148
|
try {
|
|
149
149
|
setResendingCode(true);
|
|
150
150
|
yield resentRecoveryEmail({
|
|
151
|
-
authToken,
|
|
152
151
|
authenticatorType,
|
|
153
152
|
environmentId,
|
|
153
|
+
user,
|
|
154
154
|
wallet: primaryWallet,
|
|
155
155
|
});
|
|
156
156
|
}
|
|
@@ -90,13 +90,12 @@ require('../../../LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInS
|
|
|
90
90
|
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
91
91
|
|
|
92
92
|
const PasskeyCompleteRecovery = () => {
|
|
93
|
-
const {
|
|
93
|
+
const { primaryWallet, environmentId, user, setShowAuthFlow, setUser, setPasskeySuccessPopup, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
94
94
|
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
95
95
|
const { t } = reactI18next.useTranslation();
|
|
96
96
|
const { mutate: completeRecovery, isLoading, error, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
97
97
|
const wallet = getEOAWallet.getEOAWallet(primaryWallet, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
98
98
|
const { passkeyRecoveryResponse } = yield passkeyRecovery.completePasskeyRecovery({
|
|
99
|
-
authToken,
|
|
100
99
|
environmentId,
|
|
101
100
|
user,
|
|
102
101
|
wallet,
|
|
@@ -86,13 +86,12 @@ import '../../../LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSe
|
|
|
86
86
|
import '../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
87
87
|
|
|
88
88
|
const PasskeyCompleteRecovery = () => {
|
|
89
|
-
const {
|
|
89
|
+
const { primaryWallet, environmentId, user, setShowAuthFlow, setUser, setPasskeySuccessPopup, } = useInternalDynamicContext();
|
|
90
90
|
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
91
91
|
const { t } = useTranslation();
|
|
92
92
|
const { mutate: completeRecovery, isLoading, error, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
93
|
const wallet = getEOAWallet(primaryWallet, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
94
94
|
const { passkeyRecoveryResponse } = yield completePasskeyRecovery({
|
|
95
|
-
authToken,
|
|
96
95
|
environmentId,
|
|
97
96
|
user,
|
|
98
97
|
wallet,
|
package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs
CHANGED
|
@@ -29,10 +29,7 @@ var embeddedWallets = require('../../../../data/api/embeddedWallets/embeddedWall
|
|
|
29
29
|
require('../../../../locale/locale.cjs');
|
|
30
30
|
require('@dynamic-labs/store');
|
|
31
31
|
|
|
32
|
-
const createEmbeddedWalletRequest = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ user, walletConnector, environmentId,
|
|
33
|
-
if (!authToken) {
|
|
34
|
-
throw new utils.DynamicError('Auth token is not defined');
|
|
35
|
-
}
|
|
32
|
+
const createEmbeddedWalletRequest = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ user, walletConnector, environmentId, chains, webAuthnAttestation, withAuthenticator, }) {
|
|
36
33
|
if (!walletConnector) {
|
|
37
34
|
throw new utils.DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
38
35
|
}
|
package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
|
2
2
|
import { UserProfile } from '@dynamic-labs/types';
|
|
3
3
|
import { IEmailWalletConnector, IPasskeyWalletConnector, WebAuthnAttestation } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
type CreateEmbeddedWalletRequestProps = {
|
|
5
|
-
authToken: string | undefined;
|
|
6
5
|
environmentId: string;
|
|
7
6
|
user: UserProfile | undefined;
|
|
8
7
|
walletConnector: (IPasskeyWalletConnector & IEmailWalletConnector) | undefined;
|
|
@@ -10,7 +9,7 @@ type CreateEmbeddedWalletRequestProps = {
|
|
|
10
9
|
webAuthnAttestation?: WebAuthnAttestation;
|
|
11
10
|
withAuthenticator: boolean;
|
|
12
11
|
};
|
|
13
|
-
export declare const createEmbeddedWalletRequest: ({ user, walletConnector, environmentId,
|
|
12
|
+
export declare const createEmbeddedWalletRequest: ({ user, walletConnector, environmentId, chains, webAuthnAttestation, withAuthenticator, }: CreateEmbeddedWalletRequestProps) => Promise<{
|
|
14
13
|
embeddedWalletVerifiedCredential: import("@dynamic-labs/sdk-api-core").JwtVerifiedCredential;
|
|
15
14
|
jwt: string;
|
|
16
15
|
signersResponse: import("@dynamic-labs/sdk-api-core").VerifyResponse;
|
package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.js
CHANGED
|
@@ -25,10 +25,7 @@ import { createTurnkeyEmbeddedWallet } from '../../../../data/api/embeddedWallet
|
|
|
25
25
|
import '../../../../locale/locale.js';
|
|
26
26
|
import '@dynamic-labs/store';
|
|
27
27
|
|
|
28
|
-
const createEmbeddedWalletRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ user, walletConnector, environmentId,
|
|
29
|
-
if (!authToken) {
|
|
30
|
-
throw new DynamicError('Auth token is not defined');
|
|
31
|
-
}
|
|
28
|
+
const createEmbeddedWalletRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ user, walletConnector, environmentId, chains, webAuthnAttestation, withAuthenticator, }) {
|
|
32
29
|
if (!walletConnector) {
|
|
33
30
|
throw new DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
34
31
|
}
|