@dynamic-labs/sdk-react-core 1.0.0-alpha.7 → 1.0.0-alpha.8
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 +12 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +1 -1
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +1 -1
- package/src/lib/components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs +68 -0
- package/src/lib/components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.d.ts +6 -0
- package/src/lib/components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js +64 -0
- package/src/lib/components/PasskeyCreatedSuccessBanner/index.d.ts +1 -0
- package/src/lib/components/SecureTurnkeyWalletCard/SecureTurnkeyWalletCard.cjs +24 -0
- package/src/lib/components/SecureTurnkeyWalletCard/SecureTurnkeyWalletCard.d.ts +6 -0
- package/src/lib/components/SecureTurnkeyWalletCard/SecureTurnkeyWalletCard.js +20 -0
- package/src/lib/components/SecureTurnkeyWalletCard/index.d.ts +1 -0
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +4 -1
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +4 -1
- package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.cjs +5 -2
- package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.js +5 -2
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +6 -2
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +6 -2
- package/src/lib/components/index.d.ts +2 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +7 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +7 -1
- package/src/lib/context/DynamicContext/hooks/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useShowPasskeyCreateSuccess/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useShowPasskeyCreateSuccess/useShowPasskeyCreateSuccess.cjs +23 -0
- package/src/lib/context/DynamicContext/hooks/useShowPasskeyCreateSuccess/useShowPasskeyCreateSuccess.d.ts +4 -0
- package/src/lib/context/DynamicContext/hooks/useShowPasskeyCreateSuccess/useShowPasskeyCreateSuccess.js +19 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +2 -0
- package/src/lib/data/api.cjs +14 -11
- package/src/lib/data/api.d.ts +2 -2
- package/src/lib/data/api.js +14 -11
- package/src/lib/locale/en/translation.cjs +70 -0
- package/src/lib/locale/en/translation.d.ts +70 -0
- package/src/lib/locale/en/translation.js +70 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +6 -2
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +6 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/index.d.ts +1 -0
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +83 -0
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.d.ts +15 -0
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +79 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +11 -3
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +11 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +57 -33
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +57 -33
- package/src/lib/utils/hooks/useIsTurnkeyWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs +37 -0
- package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.d.ts +6 -0
- package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js +33 -0
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +1 -1
- package/src/lib/views/AccountExistsView/AccountExistsView.js +1 -1
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +1 -1
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +2 -5
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +2 -5
- package/src/lib/views/LoginView/useLoginView.cjs +101 -84
- package/src/lib/views/LoginView/useLoginView.js +102 -85
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +20 -50
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.d.ts +1 -6
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +20 -50
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +7 -2
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +7 -2
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +11 -7
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +11 -7
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +8 -10
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +8 -10
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.cjs +56 -0
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.d.ts +13 -0
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/createPregeneratedWallet.js +52 -0
- package/src/lib/views/Passkey/utils/createPregeneratedWallet/index.d.ts +1 -0
- package/src/lib/views/Passkey/utils/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +4 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +4 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +8 -5
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +8 -5
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +11 -2
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +11 -2
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.js +2 -1
- package/src/lib/utils/functions/getEnabledProviders/index.cjs +0 -7
- package/src/lib/utils/functions/getEnabledProviders/index.js +0 -3
|
@@ -9,7 +9,6 @@ import { logger } from '../../../../shared/logger.js';
|
|
|
9
9
|
import '@dynamic-labs/iconic';
|
|
10
10
|
import '@dynamic-labs/wallet-connector-core';
|
|
11
11
|
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
12
|
-
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
13
12
|
import { ReactComponent as SvgClose } from '../../../../shared/assets/close.js';
|
|
14
13
|
import { ReactComponent as SvgSignInWithEmail } from '../../../../shared/assets/sign-in-with-email.js';
|
|
15
14
|
import '@dynamic-labs/wallet-book';
|
|
@@ -34,6 +33,7 @@ import '../../../../components/OverlayCard/OverlayCard.context.js';
|
|
|
34
33
|
import '../../../../context/FooterAnimationContext/index.js';
|
|
35
34
|
import '../../../../context/MockContext/MockContext.js';
|
|
36
35
|
import '../../../../context/QrCodeContext/QrCodeContext.js';
|
|
36
|
+
import { useIsTurnkeyWallet } from '../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js';
|
|
37
37
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
38
38
|
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
39
39
|
import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
@@ -45,11 +45,12 @@ import '../../../../context/ThemeContext/ThemeContext.js';
|
|
|
45
45
|
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
46
46
|
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
47
47
|
import 'i18next';
|
|
48
|
-
import
|
|
48
|
+
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
49
49
|
import 'yup';
|
|
50
50
|
import { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.js';
|
|
51
51
|
import '../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
52
52
|
import '@dynamic-labs/types';
|
|
53
|
+
import { useMutation } from '../../../../utils/hooks/useMutation/useMutation.js';
|
|
53
54
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
54
55
|
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
55
56
|
import 'formik';
|
|
@@ -59,7 +60,6 @@ import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
|
59
60
|
import '../../../../components/Alert/Alert.js';
|
|
60
61
|
import { iframeContainerId, iframeElementId } from '../constants.js';
|
|
61
62
|
import '../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
62
|
-
import { useMutation } from '../../../../utils/hooks/useMutation/useMutation.js';
|
|
63
63
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
64
64
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
65
65
|
import { NeedHelpSection } from '../../../../components/NeedHelpSection/NeedHelpSection.js';
|
|
@@ -70,8 +70,8 @@ import { initPasskeyRecovery } from '../../utils/passkeyRecovery/passkeyRecovery
|
|
|
70
70
|
|
|
71
71
|
const PasskeyInitRecovery = () => {
|
|
72
72
|
const { authToken, primaryWallet, environmentId, internalEvents, setShowAuthFlow, } = useInternalDynamicContext();
|
|
73
|
+
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
73
74
|
const { setView } = useViewContext();
|
|
74
|
-
const { setDynamicWidgetView } = useWidgetContext();
|
|
75
75
|
useElementById(iframeContainerId);
|
|
76
76
|
const { t } = useTranslation();
|
|
77
77
|
const { mutate: initRecovery, isLoading, error, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -99,13 +99,11 @@ const PasskeyInitRecovery = () => {
|
|
|
99
99
|
return 'Something went wrong.';
|
|
100
100
|
}, [error]);
|
|
101
101
|
const EmailIcon = (jsx(Icon, { color: 'brand-primary', children: jsx(SvgSignInWithEmail, {}) }));
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
};
|
|
102
|
+
const translationKey = isTurnkeyWalletWithoutAuthenticator
|
|
103
|
+
? 'dyn_passkey_secure_modal'
|
|
104
|
+
: 'dyn_passkey_recovery';
|
|
106
105
|
const closeButton = (jsx(IconButton, { type: 'button', onClick: () => setShowAuthFlow(false), "data-testid": 'close-button', children: jsx(SvgClose, {}) }));
|
|
107
|
-
|
|
108
|
-
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, trailing: closeButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: t('dyn_passkey_recovery.start.title') }) }), jsxs("div", { className: 'passkey-recovery-view', children: [jsx(IconWithSpinner, { Icon: EmailIcon, isSpinning: isLoading, iconSize: 96 }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-recovery-view__subtitle', children: t('dyn_passkey_recovery.start.description') }), errorText && jsx(ErrorContainer, { children: errorText }), jsx("div", { className: 'passkey-recovery-view__actions', children: jsx(Button, { buttonPadding: 'large', dataTestId: 'passkey-recovery-button', onClick: () => initRecovery(), disabled: isLoading, showInternalLoading: false, children: jsx("div", { children: jsx(Typography, { children: t('dyn_passkey_recovery.start.start_button') }) }) }) }), jsx(NeedHelpSection, {})] })] }));
|
|
106
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: t(`${translationKey}.start.title`) }) }), jsxs("div", { className: 'passkey-recovery-view', children: [jsx(IconWithSpinner, { Icon: EmailIcon, isSpinning: isLoading, iconSize: 96 }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-recovery-view__subtitle', children: t(`${translationKey}.start.description`) }), errorText && jsx(ErrorContainer, { children: errorText }), jsx("div", { className: 'passkey-recovery-view__actions', children: jsx(Button, { buttonPadding: 'large', dataTestId: 'passkey-recovery-button', onClick: () => initRecovery(), disabled: isLoading, showInternalLoading: false, children: jsx("div", { children: jsx(Typography, { children: t(`${translationKey}.start.start_button`) }) }) }) }), jsx(NeedHelpSection, {})] })] }));
|
|
109
107
|
};
|
|
110
108
|
|
|
111
109
|
export { PasskeyInitRecovery };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
|
+
var decodeJwt = require('../../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
8
|
+
require('@dynamic-labs/iconic');
|
|
9
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
+
require('react/jsx-runtime');
|
|
11
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
12
|
+
require('react');
|
|
13
|
+
require('../../../../shared/logger.cjs');
|
|
14
|
+
require('@dynamic-labs/wallet-book');
|
|
15
|
+
require('../../../../utils/constants/colors.cjs');
|
|
16
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
17
|
+
require('viem');
|
|
18
|
+
require('../../../../shared/consts/index.cjs');
|
|
19
|
+
var api = require('../../../../data/api.cjs');
|
|
20
|
+
var findEmbeddedWalletFromVerifiedCredentials = require('../../../../utils/functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.cjs');
|
|
21
|
+
require('@dynamic-labs/multi-wallet');
|
|
22
|
+
require('@dynamic-labs/sdk-api');
|
|
23
|
+
|
|
24
|
+
const createPregeneratedWallet = ({ user, walletConnector, environmentId, authToken, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
if (!authToken) {
|
|
26
|
+
throw new utils.DynamicError('Auth token is not defined');
|
|
27
|
+
}
|
|
28
|
+
if (!walletConnector) {
|
|
29
|
+
throw new utils.DynamicError('PasskeyWalletConnector not found');
|
|
30
|
+
}
|
|
31
|
+
if (!user) {
|
|
32
|
+
throw new utils.DynamicError('User is not defined');
|
|
33
|
+
}
|
|
34
|
+
walletConnector.setEmail(user.email);
|
|
35
|
+
const signersResponse = yield api.createTurnkeyEvmEmbeddedWallet({
|
|
36
|
+
environmentId,
|
|
37
|
+
userJwt: authToken,
|
|
38
|
+
});
|
|
39
|
+
const { jwt } = signersResponse;
|
|
40
|
+
const decodedJwt = decodeJwt.decodeJwt(jwt);
|
|
41
|
+
if (decodedJwt === undefined)
|
|
42
|
+
throw new utils.DynamicError('Invalid token!');
|
|
43
|
+
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials.findEmbeddedWalletFromVerifiedCredentials(jwt);
|
|
44
|
+
if (!embeddedWalletVerifiedCredential) {
|
|
45
|
+
throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found');
|
|
46
|
+
}
|
|
47
|
+
walletConnector.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
48
|
+
return {
|
|
49
|
+
decodedJwt,
|
|
50
|
+
embeddedWalletVerifiedCredential,
|
|
51
|
+
jwt,
|
|
52
|
+
walletConnector,
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
exports.createPregeneratedWallet = createPregeneratedWallet;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IEmailWalletConnector, IPasskeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
import { UserProfile } from '../../../../shared';
|
|
3
|
+
export declare const createPregeneratedWallet: ({ user, walletConnector, environmentId, authToken, }: {
|
|
4
|
+
authToken: string | undefined;
|
|
5
|
+
environmentId: string;
|
|
6
|
+
user: UserProfile | undefined;
|
|
7
|
+
walletConnector: (IPasskeyWalletConnector & IEmailWalletConnector) | undefined;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
decodedJwt: Omit<import("@dynamic-labs/sdk-api").DynamicJwt, "jwt">;
|
|
10
|
+
embeddedWalletVerifiedCredential: import("@dynamic-labs/sdk-api").JwtVerifiedCredential;
|
|
11
|
+
jwt: string;
|
|
12
|
+
walletConnector: IPasskeyWalletConnector & IEmailWalletConnector;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
3
|
+
import { decodeJwt } from '../../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
4
|
+
import '@dynamic-labs/iconic';
|
|
5
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
8
|
+
import 'react';
|
|
9
|
+
import '../../../../shared/logger.js';
|
|
10
|
+
import '@dynamic-labs/wallet-book';
|
|
11
|
+
import '../../../../utils/constants/colors.js';
|
|
12
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
13
|
+
import 'viem';
|
|
14
|
+
import '../../../../shared/consts/index.js';
|
|
15
|
+
import { createTurnkeyEvmEmbeddedWallet } from '../../../../data/api.js';
|
|
16
|
+
import { findEmbeddedWalletFromVerifiedCredentials } from '../../../../utils/functions/findEmbeddedWalletFromVerifiedCredentials/findEmbeddedWalletFromVerifiedCredentials.js';
|
|
17
|
+
import '@dynamic-labs/multi-wallet';
|
|
18
|
+
import '@dynamic-labs/sdk-api';
|
|
19
|
+
|
|
20
|
+
const createPregeneratedWallet = ({ user, walletConnector, environmentId, authToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
if (!authToken) {
|
|
22
|
+
throw new DynamicError('Auth token is not defined');
|
|
23
|
+
}
|
|
24
|
+
if (!walletConnector) {
|
|
25
|
+
throw new DynamicError('PasskeyWalletConnector not found');
|
|
26
|
+
}
|
|
27
|
+
if (!user) {
|
|
28
|
+
throw new DynamicError('User is not defined');
|
|
29
|
+
}
|
|
30
|
+
walletConnector.setEmail(user.email);
|
|
31
|
+
const signersResponse = yield createTurnkeyEvmEmbeddedWallet({
|
|
32
|
+
environmentId,
|
|
33
|
+
userJwt: authToken,
|
|
34
|
+
});
|
|
35
|
+
const { jwt } = signersResponse;
|
|
36
|
+
const decodedJwt = decodeJwt(jwt);
|
|
37
|
+
if (decodedJwt === undefined)
|
|
38
|
+
throw new DynamicError('Invalid token!');
|
|
39
|
+
const embeddedWalletVerifiedCredential = findEmbeddedWalletFromVerifiedCredentials(jwt);
|
|
40
|
+
if (!embeddedWalletVerifiedCredential) {
|
|
41
|
+
throw new DynamicError('EmbeddedWalletVerifiedCredential not found');
|
|
42
|
+
}
|
|
43
|
+
walletConnector.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
44
|
+
return {
|
|
45
|
+
decodedJwt,
|
|
46
|
+
embeddedWalletVerifiedCredential,
|
|
47
|
+
jwt,
|
|
48
|
+
walletConnector,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export { createPregeneratedWallet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createPregeneratedWallet } from './createPregeneratedWallet';
|
|
@@ -45,6 +45,7 @@ require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
45
45
|
require('react-focus-lock');
|
|
46
46
|
require('formik');
|
|
47
47
|
require('yup');
|
|
48
|
+
var useMutation = require('../../utils/hooks/useMutation/useMutation.cjs');
|
|
48
49
|
require('../../components/OverlayCard/OverlayCard.context.cjs');
|
|
49
50
|
var TransactionConfirmationPageLayout = require('../../components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs');
|
|
50
51
|
var TransactionRow = require('../../components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.cjs');
|
|
@@ -70,7 +71,6 @@ var useTransactionGas = require('./hooks/useTransactionGas/useTransactionGas.cjs
|
|
|
70
71
|
var useTransactionTotal = require('./hooks/useTransactionTotal/useTransactionTotal.cjs');
|
|
71
72
|
var transactionErrorMessage = require('./helpers/transactionErrorMessage.cjs');
|
|
72
73
|
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
73
|
-
var useMutation = require('../../utils/hooks/useMutation/useMutation.cjs');
|
|
74
74
|
|
|
75
75
|
const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess, onClickBack, onClickClose, title, displayPoweredByDynamicFooter = false, provider, }) => {
|
|
76
76
|
const { appName, appLogoUrl, primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
@@ -41,6 +41,7 @@ import '../../components/Popper/PopperContext/PopperContext.js';
|
|
|
41
41
|
import 'react-focus-lock';
|
|
42
42
|
import 'formik';
|
|
43
43
|
import 'yup';
|
|
44
|
+
import { useMutation } from '../../utils/hooks/useMutation/useMutation.js';
|
|
44
45
|
import '../../components/OverlayCard/OverlayCard.context.js';
|
|
45
46
|
import { TransactionConfirmationPageLayout } from '../../components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js';
|
|
46
47
|
import { TransactionRow } from '../../components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.js';
|
|
@@ -66,7 +67,6 @@ import { useTransactionGas } from './hooks/useTransactionGas/useTransactionGas.j
|
|
|
66
67
|
import { useTransactionTotal } from './hooks/useTransactionTotal/useTransactionTotal.js';
|
|
67
68
|
import { transactionErrorMessage } from './helpers/transactionErrorMessage.js';
|
|
68
69
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
69
|
-
import { useMutation } from '../../utils/hooks/useMutation/useMutation.js';
|
|
70
70
|
|
|
71
71
|
const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess, onClickBack, onClickClose, title, displayPoweredByDynamicFooter = false, provider, }) => {
|
|
72
72
|
const { appName, appLogoUrl, primaryWallet } = useInternalDynamicContext();
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs
CHANGED
|
@@ -36,6 +36,7 @@ require('../../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
|
36
36
|
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
37
37
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
38
38
|
require('../../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
39
|
+
var useIsTurnkeyWallet = require('../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
|
|
39
40
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
40
41
|
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
41
42
|
require('../DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
@@ -73,6 +74,7 @@ const ActiveWalletInformation = () => {
|
|
|
73
74
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = React.useState(false);
|
|
74
75
|
const { primaryWallet, authToken, network, projectSettings, handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
75
76
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
77
|
+
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
76
78
|
const address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
77
79
|
const nameService = useFetchNameService.useFetchNameService(address);
|
|
78
80
|
const { data: testnet } = usePromise.usePromise(() => isTestnet.isTestnet(primaryWallet), { deps: [network] });
|
|
@@ -113,9 +115,10 @@ const ActiveWalletInformation = () => {
|
|
|
113
115
|
const evmNetworks = ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) &&
|
|
114
116
|
(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector).evmNetworks) ||
|
|
115
117
|
[];
|
|
118
|
+
const showTestnetAlert = testnet && !isTurnkeyWalletWithoutAuthenticator;
|
|
116
119
|
return (jsxRuntime.jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information__header', children: [jsxRuntime.jsx("div", { className: 'active-wallet-information__avatar--centered', children: (nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsxRuntime.jsx("div", { className: 'active-wallet-information__avatar', children: jsxRuntime.jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsxRuntime.jsx("div", { className: 'active-wallet-information__wallet-img', children: jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })) }), jsxRuntime.jsxs("div", { className: 'active-wallet-information__details', children: [jsxRuntime.jsxs("div", { className: classNames.classNames('active-wallet-information__actions-container', {
|
|
117
120
|
'active-wallet-information__actions-container--centered': !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
118
|
-
}), children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: nameService === null || nameService === void 0 ? void 0 : nameService.name }), jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'regular' : 'medium', variant: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'body_small' : 'body_normal', color: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'secondary' : 'primary', children: shortenWalletAddress.shortenWalletAddress(address, 4, 4) })] }), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu' })] }), jsxRuntime.jsx(NetworkPicker.NetworkPicker, { currentNetwork: network, connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', evmNetworks: evmNetworks, showNetworkName: true })] })] }),
|
|
121
|
+
}), children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: nameService === null || nameService === void 0 ? void 0 : nameService.name }), jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'regular' : 'medium', variant: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'body_small' : 'body_normal', color: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'secondary' : 'primary', children: shortenWalletAddress.shortenWalletAddress(address, 4, 4) })] }), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu' })] }), jsxRuntime.jsx(NetworkPicker.NetworkPicker, { currentNetwork: network, connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', evmNetworks: evmNetworks, showNetworkName: true })] })] }), showTestnetAlert && (jsxRuntime.jsx(Alert.Alert, { variant: 'warning', children: t('dyn_active_wallet_info.testnet_warning') }))] }), jsxRuntime.jsxs("div", { className: 'balance-container', children: [jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_small', children: "Balance" }), primaryWallet && (jsxRuntime.jsx(Balance.Balance, { className: 'balance-container__balance', connector: primaryWallet.connector, address: primaryWallet.address, network: network }))] })] }));
|
|
119
122
|
};
|
|
120
123
|
|
|
121
124
|
exports.ActiveWalletInformation = ActiveWalletInformation;
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js
CHANGED
|
@@ -32,6 +32,7 @@ import '../../../../components/OverlayCard/OverlayCard.context.js';
|
|
|
32
32
|
import '../../../../context/FooterAnimationContext/index.js';
|
|
33
33
|
import '../../../../context/MockContext/MockContext.js';
|
|
34
34
|
import '../../../../context/QrCodeContext/QrCodeContext.js';
|
|
35
|
+
import { useIsTurnkeyWallet } from '../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js';
|
|
35
36
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
36
37
|
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
37
38
|
import '../DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
@@ -69,6 +70,7 @@ const ActiveWalletInformation = () => {
|
|
|
69
70
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
70
71
|
const { primaryWallet, authToken, network, projectSettings, handleLogOut } = useInternalDynamicContext();
|
|
71
72
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
73
|
+
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
72
74
|
const address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
73
75
|
const nameService = useFetchNameService(address);
|
|
74
76
|
const { data: testnet } = usePromise(() => isTestnet(primaryWallet), { deps: [network] });
|
|
@@ -109,9 +111,10 @@ const ActiveWalletInformation = () => {
|
|
|
109
111
|
const evmNetworks = ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) &&
|
|
110
112
|
(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector).evmNetworks) ||
|
|
111
113
|
[];
|
|
114
|
+
const showTestnetAlert = testnet && !isTurnkeyWalletWithoutAuthenticator;
|
|
112
115
|
return (jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information__header', children: [jsx("div", { className: 'active-wallet-information__avatar--centered', children: (nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("div", { className: 'active-wallet-information__avatar', children: jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsx("div", { className: 'active-wallet-information__wallet-img', children: jsx(AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })) }), jsxs("div", { className: 'active-wallet-information__details', children: [jsxs("div", { className: classNames('active-wallet-information__actions-container', {
|
|
113
116
|
'active-wallet-information__actions-container--centered': !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
114
|
-
}), children: [jsxs("div", { children: [jsx(Typography, { className: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: nameService === null || nameService === void 0 ? void 0 : nameService.name }), jsx(Typography, { className: 'active-wallet-information__address', weight: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'regular' : 'medium', variant: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'body_small' : 'body_normal', color: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'secondary' : 'primary', children: shortenWalletAddress(address, 4, 4) })] }), jsx(DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu' })] }), jsx(NetworkPicker, { currentNetwork: network, connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', evmNetworks: evmNetworks, showNetworkName: true })] })] }),
|
|
117
|
+
}), children: [jsxs("div", { children: [jsx(Typography, { className: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: nameService === null || nameService === void 0 ? void 0 : nameService.name }), jsx(Typography, { className: 'active-wallet-information__address', weight: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'regular' : 'medium', variant: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'body_small' : 'body_normal', color: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'secondary' : 'primary', children: shortenWalletAddress(address, 4, 4) })] }), jsx(DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu' })] }), jsx(NetworkPicker, { currentNetwork: network, connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', evmNetworks: evmNetworks, showNetworkName: true })] })] }), showTestnetAlert && (jsx(Alert, { variant: 'warning', children: t('dyn_active_wallet_info.testnet_warning') }))] }), jsxs("div", { className: 'balance-container', children: [jsx(Typography, { color: 'secondary', variant: 'body_small', children: "Balance" }), primaryWallet && (jsx(Balance, { className: 'balance-container__balance', connector: primaryWallet.connector, address: primaryWallet.address, network: network }))] })] }));
|
|
115
118
|
};
|
|
116
119
|
|
|
117
120
|
export { ActiveWalletInformation };
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs
CHANGED
|
@@ -41,6 +41,7 @@ require('react-focus-lock');
|
|
|
41
41
|
require('formik');
|
|
42
42
|
require('yup');
|
|
43
43
|
require('../../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
44
|
+
var PasskeyCreatedSuccessBanner = require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
44
45
|
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
45
46
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
46
47
|
require('../../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
@@ -85,7 +86,7 @@ const DynamicWidgetHeader = ({ variant, }) => {
|
|
|
85
86
|
return 'profile';
|
|
86
87
|
return dynamicWidgetView;
|
|
87
88
|
}, [dynamicWidgetView, isKYCEnabled, multiWallet]);
|
|
88
|
-
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-header', children: [isKYCEnabled && multiWallet && (jsxRuntime.jsx(OptionsSwitcher.OptionsSwitcher, { rootClassName: 'dynamic-widget-header__switcher', value: dynamicWidgetSwitcherOverwriteValue, options: options, onChange: (view) => setDynamicWidgetView(view) })), (dynamicWidgetSwitcherOverwriteValue === 'wallets' ||
|
|
89
|
+
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-header', children: [isKYCEnabled && multiWallet && (jsxRuntime.jsx(OptionsSwitcher.OptionsSwitcher, { rootClassName: 'dynamic-widget-header__switcher', value: dynamicWidgetSwitcherOverwriteValue, options: options, onChange: (view) => setDynamicWidgetView(view) })), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, { className: 'dynamic-widget-header__passkey-success' }), (dynamicWidgetSwitcherOverwriteValue === 'wallets' ||
|
|
89
90
|
(dynamicWidgetSwitcherOverwriteValue === 'profile' &&
|
|
90
91
|
!multiWallet)) && jsxRuntime.jsx(DynamicWidgetWalletHeader.DynamicWidgetWalletHeader, { variant: variant })] }));
|
|
91
92
|
};
|
|
@@ -37,6 +37,7 @@ import 'react-focus-lock';
|
|
|
37
37
|
import 'formik';
|
|
38
38
|
import 'yup';
|
|
39
39
|
import '../../../../components/OverlayCard/OverlayCard.context.js';
|
|
40
|
+
import { PasskeyCreatedSuccessBanner } from '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
40
41
|
import '../../../../context/FooterAnimationContext/index.js';
|
|
41
42
|
import '../../../../context/MockContext/MockContext.js';
|
|
42
43
|
import '../../../../context/QrCodeContext/QrCodeContext.js';
|
|
@@ -77,7 +78,7 @@ const DynamicWidgetHeader = ({ variant, }) => {
|
|
|
77
78
|
return 'profile';
|
|
78
79
|
return dynamicWidgetView;
|
|
79
80
|
}, [dynamicWidgetView, isKYCEnabled, multiWallet]);
|
|
80
|
-
return (jsxs("div", { className: 'dynamic-widget-header', children: [isKYCEnabled && multiWallet && (jsx(OptionsSwitcher, { rootClassName: 'dynamic-widget-header__switcher', value: dynamicWidgetSwitcherOverwriteValue, options: options, onChange: (view) => setDynamicWidgetView(view) })), (dynamicWidgetSwitcherOverwriteValue === 'wallets' ||
|
|
81
|
+
return (jsxs("div", { className: 'dynamic-widget-header', children: [isKYCEnabled && multiWallet && (jsx(OptionsSwitcher, { rootClassName: 'dynamic-widget-header__switcher', value: dynamicWidgetSwitcherOverwriteValue, options: options, onChange: (view) => setDynamicWidgetView(view) })), jsx(PasskeyCreatedSuccessBanner, { className: 'dynamic-widget-header__passkey-success' }), (dynamicWidgetSwitcherOverwriteValue === 'wallets' ||
|
|
81
82
|
(dynamicWidgetSwitcherOverwriteValue === 'profile' &&
|
|
82
83
|
!multiWallet)) && jsx(DynamicWidgetWalletHeader, { variant: variant })] }));
|
|
83
84
|
};
|
|
@@ -36,6 +36,7 @@ require('../../../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
|
36
36
|
require('../../../../../context/FooterAnimationContext/index.cjs');
|
|
37
37
|
require('../../../../../context/MockContext/MockContext.cjs');
|
|
38
38
|
require('../../../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
39
|
+
var useIsTurnkeyWallet = require('../../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
|
|
39
40
|
var Typography = require('../../../../../components/Typography/Typography.cjs');
|
|
40
41
|
require('../../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
41
42
|
require('../DynamicWidgetHeader.cjs');
|
|
@@ -56,6 +57,7 @@ require('formik');
|
|
|
56
57
|
var Button = require('../../../../../components/Button/Button.cjs');
|
|
57
58
|
require('../../../../../components/IconButton/IconButton.cjs');
|
|
58
59
|
require('../../../../../components/Alert/Alert.cjs');
|
|
60
|
+
var SecureTurnkeyWalletCard = require('../../../../../components/SecureTurnkeyWalletCard/SecureTurnkeyWalletCard.cjs');
|
|
59
61
|
require('../../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
60
62
|
require('../../../../../components/InlineWidget/InlineWidget.cjs');
|
|
61
63
|
require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
@@ -76,6 +78,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
76
78
|
const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
77
79
|
const { primaryWallet, user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
78
80
|
const { open: openSendBalanceModal } = SendBalanceContext.useSendBalance();
|
|
81
|
+
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
79
82
|
const { supportsFunding, setShowFunding, fundingEnabled } = FundingContext.useFundingContext();
|
|
80
83
|
const { setDynamicWidgetView, setIsOpen } = DynamicWidgetContext.useWidgetContext();
|
|
81
84
|
const isSendBalanceEnabled = React.useMemo(() => {
|
|
@@ -113,11 +116,11 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
|
113
116
|
}
|
|
114
117
|
};
|
|
115
118
|
const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
|
|
116
|
-
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [renderWalletHeader(), primaryWallet ? (jsxRuntime.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [renderWalletHeader(), primaryWallet ? (jsxRuntime.jsxs("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: [jsxRuntime.jsx(SecureTurnkeyWalletCard.SecureTurnkeyWalletCard, { className: 'dynamic-widget-wallet-header__wallet-info__secure-wallet' }), isActionsVisible && (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding || isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
120
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
121
|
+
jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-secondary', children: jsxRuntime.jsx(add.ReactComponent, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, disabled: isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
122
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
123
|
+
jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-secondary', children: jsxRuntime.jsx(send.ReactComponent, {}) }), children: "Send" }))] }))] })) : (jsxRuntime.jsx(Typography.Typography, { className: 'dynamic-widget-wallet-header__email', variant: 'body_normal', weight: 'regular', children: renderEmailOrSocialHeader() }))] }));
|
|
121
124
|
};
|
|
122
125
|
React__default["default"].memo(DynamicWidgetWalletHeader);
|
|
123
126
|
|
|
@@ -32,6 +32,7 @@ import '../../../../../components/OverlayCard/OverlayCard.context.js';
|
|
|
32
32
|
import '../../../../../context/FooterAnimationContext/index.js';
|
|
33
33
|
import '../../../../../context/MockContext/MockContext.js';
|
|
34
34
|
import '../../../../../context/QrCodeContext/QrCodeContext.js';
|
|
35
|
+
import { useIsTurnkeyWallet } from '../../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js';
|
|
35
36
|
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
36
37
|
import '../../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
37
38
|
import '../DynamicWidgetHeader.js';
|
|
@@ -52,6 +53,7 @@ import 'formik';
|
|
|
52
53
|
import { Button } from '../../../../../components/Button/Button.js';
|
|
53
54
|
import '../../../../../components/IconButton/IconButton.js';
|
|
54
55
|
import '../../../../../components/Alert/Alert.js';
|
|
56
|
+
import { SecureTurnkeyWalletCard } from '../../../../../components/SecureTurnkeyWalletCard/SecureTurnkeyWalletCard.js';
|
|
55
57
|
import '../../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
56
58
|
import '../../../../../components/InlineWidget/InlineWidget.js';
|
|
57
59
|
import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
@@ -68,6 +70,7 @@ import { UserAvatar } from '../../../../../components/UserAvatar/UserAvatar.js';
|
|
|
68
70
|
const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
69
71
|
const { primaryWallet, user } = useInternalDynamicContext();
|
|
70
72
|
const { open: openSendBalanceModal } = useSendBalance();
|
|
73
|
+
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
71
74
|
const { supportsFunding, setShowFunding, fundingEnabled } = useFundingContext();
|
|
72
75
|
const { setDynamicWidgetView, setIsOpen } = useWidgetContext();
|
|
73
76
|
const isSendBalanceEnabled = useMemo(() => {
|
|
@@ -105,11 +108,11 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
|
105
108
|
}
|
|
106
109
|
};
|
|
107
110
|
const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
|
|
108
|
-
return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [renderWalletHeader(), primaryWallet ? (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [renderWalletHeader(), primaryWallet ? (jsxs("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: [jsx(SecureTurnkeyWalletCard, { className: 'dynamic-widget-wallet-header__wallet-info__secure-wallet' }), isActionsVisible && (jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsx(Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding || isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
112
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
113
|
+
jsx(Icon, { size: 'small', color: 'text-secondary', children: jsx(SvgAdd, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsx(Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, disabled: isTurnkeyWalletWithoutAuthenticator, startSlot:
|
|
114
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
115
|
+
jsx(Icon, { size: 'small', color: 'text-secondary', children: jsx(SvgSend, {}) }), children: "Send" }))] }))] })) : (jsx(Typography, { className: 'dynamic-widget-wallet-header__email', variant: 'body_normal', weight: 'regular', children: renderEmailOrSocialHeader() }))] }));
|
|
113
116
|
};
|
|
114
117
|
React__default.memo(DynamicWidgetWalletHeader);
|
|
115
118
|
|
|
@@ -46,13 +46,13 @@ require('../../context/DynamicWidgetContext.cjs');
|
|
|
46
46
|
require('yup');
|
|
47
47
|
require('../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
48
48
|
require('@dynamic-labs/types');
|
|
49
|
+
var useMutation = require('../../../../utils/hooks/useMutation/useMutation.cjs');
|
|
49
50
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
50
51
|
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
51
52
|
require('formik');
|
|
52
53
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
53
54
|
require('../../../../components/Alert/Alert.cjs');
|
|
54
55
|
require('../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
55
|
-
var useMutation = require('../../../../utils/hooks/useMutation/useMutation.cjs');
|
|
56
56
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
57
57
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
58
58
|
var OTPVerificationView = require('../../../../components/OTPVerificationView/OTPVerificationView.cjs');
|
|
@@ -42,13 +42,13 @@ import '../../context/DynamicWidgetContext.js';
|
|
|
42
42
|
import 'yup';
|
|
43
43
|
import '../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
44
44
|
import '@dynamic-labs/types';
|
|
45
|
+
import { useMutation } from '../../../../utils/hooks/useMutation/useMutation.js';
|
|
45
46
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
46
47
|
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
47
48
|
import 'formik';
|
|
48
49
|
import '../../../../components/IconButton/IconButton.js';
|
|
49
50
|
import '../../../../components/Alert/Alert.js';
|
|
50
51
|
import '../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
51
|
-
import { useMutation } from '../../../../utils/hooks/useMutation/useMutation.js';
|
|
52
52
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
53
53
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
54
54
|
import { OTPVerificationView } from '../../../../components/OTPVerificationView/OTPVerificationView.js';
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var classNames = require('../../../../utils/functions/classNames/classNames.cjs');
|
|
6
7
|
require('react');
|
|
7
8
|
require('@dynamic-labs/utils');
|
|
8
9
|
require('@dynamic-labs/sdk-api');
|
|
@@ -11,7 +12,7 @@ require('../../../../shared/logger.cjs');
|
|
|
11
12
|
require('@dynamic-labs/iconic');
|
|
12
13
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
14
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
-
var
|
|
15
|
+
var embeddedWalletIcon = require('../../../../shared/assets/embedded-wallet-icon.cjs');
|
|
15
16
|
require('@dynamic-labs/wallet-book');
|
|
16
17
|
require('../../../../utils/constants/colors.cjs');
|
|
17
18
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
@@ -34,6 +35,7 @@ require('../../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
|
34
35
|
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
35
36
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
36
37
|
require('../../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
38
|
+
var useIsTurnkeyWallet = require('../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
|
|
37
39
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
38
40
|
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
39
41
|
require('../DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
@@ -60,6 +62,13 @@ require('../../../../components/Popper/Popper/Popper.cjs');
|
|
|
60
62
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
61
63
|
require('react-focus-lock');
|
|
62
64
|
|
|
63
|
-
const EmptyWallets = ({ text }) =>
|
|
65
|
+
const EmptyWallets = ({ text }) => {
|
|
66
|
+
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
67
|
+
return (jsxRuntime.jsxs("div", { className: classNames.classNames('empty-wallet__container', {
|
|
68
|
+
'empty-wallet__container--big': !isTurnkeyWalletWithoutAuthenticator,
|
|
69
|
+
}), children: [jsxRuntime.jsx(Icon.Icon, { className: 'empty-wallet__icon', size: 'medium', children: jsxRuntime.jsx(embeddedWalletIcon.ReactComponent, {}) }), jsxRuntime.jsx("div", { className: classNames.classNames({
|
|
70
|
+
'empty-wallet__text-container': !isTurnkeyWalletWithoutAuthenticator,
|
|
71
|
+
}), children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: text }) })] }));
|
|
72
|
+
};
|
|
64
73
|
|
|
65
74
|
exports.EmptyWallets = EmptyWallets;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { classNames } from '../../../../utils/functions/classNames/classNames.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
import '@dynamic-labs/utils';
|
|
4
5
|
import '@dynamic-labs/sdk-api';
|
|
@@ -7,7 +8,7 @@ import '../../../../shared/logger.js';
|
|
|
7
8
|
import '@dynamic-labs/iconic';
|
|
8
9
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
10
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
10
|
-
import { ReactComponent as
|
|
11
|
+
import { ReactComponent as SvgEmbeddedWalletIcon } from '../../../../shared/assets/embedded-wallet-icon.js';
|
|
11
12
|
import '@dynamic-labs/wallet-book';
|
|
12
13
|
import '../../../../utils/constants/colors.js';
|
|
13
14
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
@@ -30,6 +31,7 @@ import '../../../../components/OverlayCard/OverlayCard.context.js';
|
|
|
30
31
|
import '../../../../context/FooterAnimationContext/index.js';
|
|
31
32
|
import '../../../../context/MockContext/MockContext.js';
|
|
32
33
|
import '../../../../context/QrCodeContext/QrCodeContext.js';
|
|
34
|
+
import { useIsTurnkeyWallet } from '../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js';
|
|
33
35
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
34
36
|
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
35
37
|
import '../DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
@@ -56,6 +58,13 @@ import '../../../../components/Popper/Popper/Popper.js';
|
|
|
56
58
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
57
59
|
import 'react-focus-lock';
|
|
58
60
|
|
|
59
|
-
const EmptyWallets = ({ text }) =>
|
|
61
|
+
const EmptyWallets = ({ text }) => {
|
|
62
|
+
const { isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
63
|
+
return (jsxs("div", { className: classNames('empty-wallet__container', {
|
|
64
|
+
'empty-wallet__container--big': !isTurnkeyWalletWithoutAuthenticator,
|
|
65
|
+
}), children: [jsx(Icon, { className: 'empty-wallet__icon', size: 'medium', children: jsx(SvgEmbeddedWalletIcon, {}) }), jsx("div", { className: classNames({
|
|
66
|
+
'empty-wallet__text-container': !isTurnkeyWalletWithoutAuthenticator,
|
|
67
|
+
}), children: jsx(Typography, { variant: 'body_small', color: 'secondary', children: text }) })] }));
|
|
68
|
+
};
|
|
60
69
|
|
|
61
70
|
export { EmptyWallets };
|
package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs
CHANGED
|
@@ -58,6 +58,7 @@ var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
|
58
58
|
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
59
59
|
require('../../../../components/Alert/Alert.cjs');
|
|
60
60
|
var usePasskeyRecovery = require('../../../../utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs');
|
|
61
|
+
var PasskeyCreatedSuccessBanner = require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
61
62
|
var PasskeyCard = require('./PasskeyCard/PasskeyCard.cjs');
|
|
62
63
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
63
64
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
@@ -90,7 +91,7 @@ const ManagePasskeysWidgetView = () => {
|
|
|
90
91
|
}, [getPasskeysData]);
|
|
91
92
|
const isRecoveryEnabled = Boolean(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.passkeyEmbeddedWalletRecoveryEnabled);
|
|
92
93
|
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: goToInitialDynamicWidgetView, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
93
|
-
return (jsxRuntime.jsxs("div", { className: 'manage-passkeys-widget-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', children: t('dyn_manage_passkeys.title') }) }) }), jsxRuntime.jsxs("div", { className: 'manage-passkeys-widget-view__body', children: [jsxRuntime.jsx("div", { className: 'manage-passkeys-widget-view__body__cards', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 1, className: 'manage-passkeys-widget-view__body__cards__skeleton' })) : (userPasskeys.map((passkey) => (jsxRuntime.jsx(PasskeyCard.PasskeyCard, { passkey: passkey }, passkey.id)))) }), isRecoveryEnabled && (jsxRuntime.jsx(Button.Button, { buttonPadding: 'large', buttonClassName: 'manage-passkeys-widget-view__body__recovery-button', onClick: initPasskeyRecoveryProcess, children: t('dyn_manage_passkeys.recovery_button') })), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {})] })] }));
|
|
94
|
+
return (jsxRuntime.jsxs("div", { className: 'manage-passkeys-widget-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', children: t('dyn_manage_passkeys.title') }) }) }), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'manage-passkeys-widget-view__body', children: [jsxRuntime.jsx("div", { className: 'manage-passkeys-widget-view__body__cards', children: isLoading ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 1, className: 'manage-passkeys-widget-view__body__cards__skeleton' })) : (userPasskeys.map((passkey) => (jsxRuntime.jsx(PasskeyCard.PasskeyCard, { passkey: passkey }, passkey.id)))) }), isRecoveryEnabled && (jsxRuntime.jsx(Button.Button, { buttonPadding: 'large', buttonClassName: 'manage-passkeys-widget-view__body__recovery-button', onClick: initPasskeyRecoveryProcess, showInternalLoading: false, children: t('dyn_manage_passkeys.recovery_button') })), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {})] })] }));
|
|
94
95
|
};
|
|
95
96
|
|
|
96
97
|
exports.ManagePasskeysWidgetView = ManagePasskeysWidgetView;
|