@dynamic-labs/sdk-react-core 3.0.0-alpha.38 → 3.0.0-alpha.39
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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/UserProfile/UserProfile.cjs +1 -1
- package/src/lib/components/UserProfile/UserProfile.js +1 -1
- package/src/lib/locale/en/translation.cjs +16 -0
- package/src/lib/locale/en/translation.d.ts +16 -0
- package/src/lib/locale/en/translation.js +16 -0
- package/src/lib/shared/assets/authenticator.cjs +54 -0
- package/src/lib/shared/assets/authenticator.js +30 -0
- package/src/lib/shared/assets/index.d.ts +2 -0
- package/src/lib/shared/assets/shield.cjs +59 -0
- package/src/lib/shared/assets/shield.js +35 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -1
- package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.cjs +1 -1
- package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.js +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +1 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/DynamicWidgetViews.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +6 -2
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +6 -2
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +3 -1
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.cjs +128 -0
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.d.ts +4 -0
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/ManageMfaWidgetView.js +123 -0
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/components/UserDeviceTile.cjs +109 -0
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/components/UserDeviceTile.d.ts +8 -0
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/components/UserDeviceTile.js +105 -0
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/components/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ManageMfaWidgetView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +14 -12
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +14 -12
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { DotsMenu } from '../../../components/DotsMenu/DotsMenu.js';
|
|
4
|
+
import '@dynamic-labs/sdk-api-core';
|
|
5
|
+
import '@dynamic-labs/utils';
|
|
6
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import '../../../../../shared/logger.js';
|
|
8
|
+
import '@dynamic-labs/iconic';
|
|
9
|
+
import '../../../../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import { ReactComponent as SvgAuthenticator } from '../../../../../shared/assets/authenticator.js';
|
|
12
|
+
import '@dynamic-labs/wallet-book';
|
|
13
|
+
import '../../../../../utils/constants/colors.js';
|
|
14
|
+
import '../../../../../utils/constants/values.js';
|
|
15
|
+
import '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
16
|
+
import '../../../../../shared/utils/classes/storage/sessionStorage.js';
|
|
17
|
+
import '../../../../../shared/consts/index.js';
|
|
18
|
+
import { getTimeSince } from '../../../helpers/getTimeSince.js';
|
|
19
|
+
import '../../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
20
|
+
import '../../../../../components/Alert/Alert.js';
|
|
21
|
+
import '../../../../../events/dynamicEvents.js';
|
|
22
|
+
import '../../../../../../../_virtual/_tslib.js';
|
|
23
|
+
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
24
|
+
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
25
|
+
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
26
|
+
import '@dynamic-labs/multi-wallet';
|
|
27
|
+
import 'react-international-phone';
|
|
28
|
+
import '../../../../../config/ApiEndpoint.js';
|
|
29
|
+
import '@dynamic-labs/store';
|
|
30
|
+
import '../../../../../locale/locale.js';
|
|
31
|
+
import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
32
|
+
import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
33
|
+
import '../../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
34
|
+
import '../../../../../context/VerificationContext/VerificationContext.js';
|
|
35
|
+
import 'react-dom';
|
|
36
|
+
import '../../../../../context/WalletContext/WalletContext.js';
|
|
37
|
+
import '../../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
38
|
+
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
39
|
+
import '../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
40
|
+
import '@dynamic-labs/types';
|
|
41
|
+
import '../../../../../context/LoadingContext/LoadingContext.js';
|
|
42
|
+
import 'yup';
|
|
43
|
+
import '../../../../../context/MockContext/MockContext.js';
|
|
44
|
+
import '../../../../../views/CollectUserDataView/useFields.js';
|
|
45
|
+
import '../../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
46
|
+
import '../../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
47
|
+
import '@dynamic-labs/rpc-providers';
|
|
48
|
+
import 'react-i18next';
|
|
49
|
+
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
50
|
+
import '../../../../../context/FooterAnimationContext/index.js';
|
|
51
|
+
import '../../../../../components/ShadowDOM/ShadowDOM.js';
|
|
52
|
+
import '../../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
53
|
+
import '../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
54
|
+
import '../../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
55
|
+
import '../../../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
56
|
+
import '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
57
|
+
import '../../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
58
|
+
import '../../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
59
|
+
import 'react-focus-lock';
|
|
60
|
+
import '../../../context/DynamicWidgetContext.js';
|
|
61
|
+
import 'formik';
|
|
62
|
+
import '../../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
63
|
+
import '../../../../../components/IconButton/IconButton.js';
|
|
64
|
+
import '../../../../../components/Input/Input.js';
|
|
65
|
+
import '../../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
66
|
+
import '../../../../../context/PasskeyContext/PasskeyContext.js';
|
|
67
|
+
import '../../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
68
|
+
import '../../../../../../polyfills.js';
|
|
69
|
+
import '../../../../../context/ErrorBoundary/ErrorBoundaryBase.js';
|
|
70
|
+
import '../../../../../context/ErrorBoundary/ErrorBoundaryContext.js';
|
|
71
|
+
import '../../../../DynamicBridgeWidget/context/DynamicBridgeWidgetContext/DynamicBridgeWidgetContext.js';
|
|
72
|
+
import '../../../components/DynamicWidgetCard/DynamicWidgetCard.js';
|
|
73
|
+
import '../../../../../components/IsBrowser/IsBrowser.js';
|
|
74
|
+
import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
75
|
+
import '../../../../../context/WidgetRegistry/WidgetRegistryContextProvider.js';
|
|
76
|
+
import '../../../../../context/FundingContext/FundingContext.js';
|
|
77
|
+
import '../../../../../components/Popper/Popper/Popper.js';
|
|
78
|
+
import '../../../../../components/Popper/PopperContext/PopperContext.js';
|
|
79
|
+
import '../../../../../views/WalletList/WalletList.js';
|
|
80
|
+
import '../../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
81
|
+
import '@hcaptcha/react-hcaptcha';
|
|
82
|
+
import '../../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
83
|
+
import '../../../../../context/SendBalanceContext/SendBalanceContext.js';
|
|
84
|
+
import '../../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
85
|
+
import '../../../../../context/ConnectWithOtpContext/constants.js';
|
|
86
|
+
import '../../../../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
87
|
+
import '../../../../../components/InlineWidget/InlineWidget.js';
|
|
88
|
+
import 'qrcode';
|
|
89
|
+
|
|
90
|
+
const UserDeviceTile = ({ userDevice, index, deleteDevice, }) => {
|
|
91
|
+
const optionsMenu = [
|
|
92
|
+
{
|
|
93
|
+
Icon: null,
|
|
94
|
+
callback: () => deleteDevice(userDevice.id),
|
|
95
|
+
text: 'Delete',
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
const timeSinceCreated = userDevice.createdAt && getTimeSince(new Date(userDevice.createdAt));
|
|
99
|
+
return (jsxs("div", { className: 'manage-mfa-widget-view__list-tile', children: [jsx(SvgAuthenticator, { className: 'manage-mfa-widget-view__list-tile__icon' }), jsxs("div", { className: 'manage-mfa-widget-view__list-tile__details', children: [jsxs(Typography, { variant: 'body_normal', color: 'primary', children: ["Authenticator App ", index + 1] }), timeSinceCreated && (jsxs(Typography, { variant: 'body_small', color: 'secondary', children: ["Created ", timeSinceCreated.value, " ", timeSinceCreated.unit, " ago"] }))] }), jsx("div", { style: {
|
|
100
|
+
cursor: 'pointer',
|
|
101
|
+
display: 'flex',
|
|
102
|
+
}, children: jsx(DotsMenu, { direction: 'left', "data-testid": 'dots-menu', options: optionsMenu, buttonClassName: 'manage-mfa-widget-view__list-tile__dots-menu', buttonClassNameWithOpenMenu: 'manage-mfa-widget-view__list-tile__dots-menu' }) })] }, userDevice.id));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export { UserDeviceTile };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UserDeviceTile } from './UserDeviceTile';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ManageMfaWidgetView } from './ManageMfaWidgetView';
|
|
@@ -29,6 +29,7 @@ var footerInfoIcon = require('../../../../shared/assets/footer-info-icon.cjs');
|
|
|
29
29
|
var logout = require('../../../../shared/assets/logout.cjs');
|
|
30
30
|
var signInWithEmail = require('../../../../shared/assets/sign-in-with-email.cjs');
|
|
31
31
|
var currency = require('../../../../shared/assets/currency.cjs');
|
|
32
|
+
var shield = require('../../../../shared/assets/shield.cjs');
|
|
32
33
|
require('@dynamic-labs/wallet-book');
|
|
33
34
|
require('../../../../utils/constants/colors.cjs');
|
|
34
35
|
require('../../../../utils/constants/values.cjs');
|
|
@@ -114,7 +115,7 @@ require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
|
114
115
|
require('qrcode');
|
|
115
116
|
|
|
116
117
|
const SettingsView = () => {
|
|
117
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
118
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
118
119
|
const { projectSettings, primaryWallet, user, handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
119
120
|
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
120
121
|
const { addEmbeddedWalletRecoveryEmail } = useEmbeddedWalletAuthenticator.useEmbeddedWalletAuthenticator();
|
|
@@ -173,19 +174,20 @@ const SettingsView = () => {
|
|
|
173
174
|
const isEmbeddedWallet = Boolean(wallet &&
|
|
174
175
|
(((_m = (_l = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _l === void 0 ? void 0 : _l.key) === null || _m === void 0 ? void 0 : _m.startsWith('turnkey')) ||
|
|
175
176
|
((_p = (_o = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _o === void 0 ? void 0 : _o.key) === null || _p === void 0 ? void 0 : _p.startsWith('coinbasempc'))));
|
|
176
|
-
const
|
|
177
|
-
isCoinbaseWallet;
|
|
177
|
+
const isMfaEnabled = Boolean((_r = (_q = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security) === null || _q === void 0 ? void 0 : _q.mfa) === null || _r === void 0 ? void 0 : _r.enabled);
|
|
178
178
|
return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { children: jsxRuntime.jsx("div", { className: 'settings-view__header', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_settings.title', children: t('dyn_settings.title') }) }) }), jsxRuntime.jsxs("div", { className: 'settings-view__body', children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_section.title') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'currency-button', buttonClassName: classNames.classNames('settings-view__body__section__button', 'settings-view__body__section__button__badge'), startSlot:
|
|
179
179
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
180
|
-
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(currency.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_section.currency.badge', children: t('dyn_settings.global_section.currency.title') }), jsxRuntime.jsx(Badge.Badge, { text: t('dyn_settings.global_section.currency.badge'), copykey: 'dyn_settings.global_section.currency.badge', variant: 'secondary' })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: true, showInternalLoading: false })] }),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
180
|
+
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(currency.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_section.currency.badge', children: t('dyn_settings.global_section.currency.title') }), jsxRuntime.jsx(Badge.Badge, { text: t('dyn_settings.global_section.currency.badge'), copykey: 'dyn_settings.global_section.currency.badge', variant: 'secondary' })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: true, showInternalLoading: false })] }), jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsxs("div", { className: classNames.classNames('settings-view__body__section__title', {
|
|
181
|
+
'settings-view__body__section__title__info-icon': !isTurnkeyWalletWithAuthenticator,
|
|
182
|
+
}), children: [t('dyn_settings.security_section.title'), !isTurnkeyWalletWithAuthenticator && (jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(footerInfoIcon.ReactComponent, { className: 'settings-view__body__section__title__info-icon' }) }))] }), isPasskeyEnabled && isTurnkeyWallet && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-passkeys-button', onClick: () => handlePasskeyClick(), buttonClassName: classNames.classNames('settings-view__body__section__button', {
|
|
183
|
+
'settings-view__body__section__button__badge': !isTurnkeyWalletWithAuthenticator,
|
|
184
|
+
}), startSlot:
|
|
185
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
186
|
+
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(PasskeyDeviceIcon.PasskeyDeviceIcon, { className: 'settings-view__body__section__button__icon', defaultIcon: jsxRuntime.jsx(androidTouchId.ReactComponent, { "data-testid": 'default-icon' }) }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.security_section.passkey_button', children: t('dyn_settings.security_section.passkey_button') }), !isTurnkeyWalletWithAuthenticator && (jsxRuntime.jsx(Badge.Badge, { text: t('dyn_settings.tags.recommended'), copykey: 'dyn_settings.tags.recommended', variant: 'secondary' }))] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })), isMfaEnabled && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-mfa-button', onClick: () => setDynamicWidgetView('manage-mfa'), buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
187
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
188
|
+
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(shield.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.security_section.mfa_button', children: t('dyn_settings.security_section.mfa_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), isCoinbaseWallet && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-password-button', onClick: () => createPassword(!hasClaimedCoinbaseMPC), buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
189
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
190
|
+
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(altKey.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.security_section.passkey_button', children: t('dyn_settings.security_section.password_button') })] }), endSlot: hasClaimedCoinbaseMPC ? (jsxRuntime.jsx(checkCircle.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--success' })) : undefined, showInternalLoading: false }))] }), isEmbeddedWallet && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isTurnkeyWallet &&
|
|
189
191
|
!hasRecoveryEmail &&
|
|
190
192
|
!isSessionKeyCompatibleWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsxs("div", { className: classNames.classNames('settings-view__body__section__title', 'settings-view__body__section__title__info-icon'), children: [t('dyn_settings.identity_section.title'), jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(footerInfoIcon.ReactComponent, { className: 'settings-view__body__section__title__info-icon', "data-testid": 'email-info-icon-title' }) })] }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-email-recovery-button', onClick: addEmbeddedWalletRecoveryEmail, buttonClassName: classNames.classNames('settings-view__body__section__button', 'settings-view__body__section__button__badge'), startSlot:
|
|
191
193
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
@@ -25,6 +25,7 @@ import { ReactComponent as SvgFooterInfoIcon } from '../../../../shared/assets/f
|
|
|
25
25
|
import { ReactComponent as SvgLogout } from '../../../../shared/assets/logout.js';
|
|
26
26
|
import { ReactComponent as SvgSignInWithEmail } from '../../../../shared/assets/sign-in-with-email.js';
|
|
27
27
|
import { ReactComponent as SvgCurrency } from '../../../../shared/assets/currency.js';
|
|
28
|
+
import { ReactComponent as SvgShield } from '../../../../shared/assets/shield.js';
|
|
28
29
|
import '@dynamic-labs/wallet-book';
|
|
29
30
|
import '../../../../utils/constants/colors.js';
|
|
30
31
|
import '../../../../utils/constants/values.js';
|
|
@@ -110,7 +111,7 @@ import '../../../../components/InlineWidget/InlineWidget.js';
|
|
|
110
111
|
import 'qrcode';
|
|
111
112
|
|
|
112
113
|
const SettingsView = () => {
|
|
113
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
114
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
114
115
|
const { projectSettings, primaryWallet, user, handleLogOut } = useInternalDynamicContext();
|
|
115
116
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
116
117
|
const { addEmbeddedWalletRecoveryEmail } = useEmbeddedWalletAuthenticator();
|
|
@@ -169,19 +170,20 @@ const SettingsView = () => {
|
|
|
169
170
|
const isEmbeddedWallet = Boolean(wallet &&
|
|
170
171
|
(((_m = (_l = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _l === void 0 ? void 0 : _l.key) === null || _m === void 0 ? void 0 : _m.startsWith('turnkey')) ||
|
|
171
172
|
((_p = (_o = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _o === void 0 ? void 0 : _o.key) === null || _p === void 0 ? void 0 : _p.startsWith('coinbasempc'))));
|
|
172
|
-
const
|
|
173
|
-
isCoinbaseWallet;
|
|
173
|
+
const isMfaEnabled = Boolean((_r = (_q = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security) === null || _q === void 0 ? void 0 : _q.mfa) === null || _r === void 0 ? void 0 : _r.enabled);
|
|
174
174
|
return (jsxs("div", { className: 'settings-view', children: [jsx(ModalHeader, { children: jsx("div", { className: 'settings-view__header', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_settings.title', children: t('dyn_settings.title') }) }) }), jsxs("div", { className: 'settings-view__body', children: [jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_section.title') }), jsx(TypographyButton, { dataTestId: 'currency-button', buttonClassName: classNames('settings-view__body__section__button', 'settings-view__body__section__button__badge'), startSlot:
|
|
175
175
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
176
|
-
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgCurrency, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_section.currency.badge', children: t('dyn_settings.global_section.currency.title') }), jsx(Badge, { text: t('dyn_settings.global_section.currency.badge'), copykey: 'dyn_settings.global_section.currency.badge', variant: 'secondary' })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: true, showInternalLoading: false })] }),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
176
|
+
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgCurrency, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_section.currency.badge', children: t('dyn_settings.global_section.currency.title') }), jsx(Badge, { text: t('dyn_settings.global_section.currency.badge'), copykey: 'dyn_settings.global_section.currency.badge', variant: 'secondary' })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: true, showInternalLoading: false })] }), jsxs("div", { className: 'settings-view__body__section', children: [jsxs("div", { className: classNames('settings-view__body__section__title', {
|
|
177
|
+
'settings-view__body__section__title__info-icon': !isTurnkeyWalletWithAuthenticator,
|
|
178
|
+
}), children: [t('dyn_settings.security_section.title'), !isTurnkeyWalletWithAuthenticator && (jsx(Icon, { size: 'small', children: jsx(SvgFooterInfoIcon, { className: 'settings-view__body__section__title__info-icon' }) }))] }), isPasskeyEnabled && isTurnkeyWallet && (jsx(TypographyButton, { dataTestId: 'manage-passkeys-button', onClick: () => handlePasskeyClick(), buttonClassName: classNames('settings-view__body__section__button', {
|
|
179
|
+
'settings-view__body__section__button__badge': !isTurnkeyWalletWithAuthenticator,
|
|
180
|
+
}), startSlot:
|
|
181
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
182
|
+
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(PasskeyDeviceIcon, { className: 'settings-view__body__section__button__icon', defaultIcon: jsx(SvgAndroidTouchId, { "data-testid": 'default-icon' }) }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.security_section.passkey_button', children: t('dyn_settings.security_section.passkey_button') }), !isTurnkeyWalletWithAuthenticator && (jsx(Badge, { text: t('dyn_settings.tags.recommended'), copykey: 'dyn_settings.tags.recommended', variant: 'secondary' }))] }), endSlot: renderPasskeysButtonEndSlot(), disabled: isLoading, showInternalLoading: false })), isMfaEnabled && (jsx(TypographyButton, { dataTestId: 'manage-mfa-button', onClick: () => setDynamicWidgetView('manage-mfa'), buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
183
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
184
|
+
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgShield, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.security_section.mfa_button', children: t('dyn_settings.security_section.mfa_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })), isCoinbaseWallet && (jsx(TypographyButton, { dataTestId: 'manage-password-button', onClick: () => createPassword(!hasClaimedCoinbaseMPC), buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
185
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
186
|
+
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgAltKey, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.security_section.passkey_button', children: t('dyn_settings.security_section.password_button') })] }), endSlot: hasClaimedCoinbaseMPC ? (jsx(SvgCheckCircle, { className: 'settings-view__body__section__button__icon-secondary--success' })) : undefined, showInternalLoading: false }))] }), isEmbeddedWallet && (jsxs(Fragment, { children: [isTurnkeyWallet &&
|
|
185
187
|
!hasRecoveryEmail &&
|
|
186
188
|
!isSessionKeyCompatibleWallet && (jsxs("div", { className: 'settings-view__body__section', children: [jsxs("div", { className: classNames('settings-view__body__section__title', 'settings-view__body__section__title__info-icon'), children: [t('dyn_settings.identity_section.title'), jsx(Icon, { size: 'small', children: jsx(SvgFooterInfoIcon, { className: 'settings-view__body__section__title__info-icon', "data-testid": 'email-info-icon-title' }) })] }), jsx(TypographyButton, { dataTestId: 'manage-email-recovery-button', onClick: addEmbeddedWalletRecoveryEmail, buttonClassName: classNames('settings-view__body__section__button', 'settings-view__body__section__button__badge'), startSlot:
|
|
187
189
|
// eslint-disable-next-line react/jsx-wrap-multilines
|