@dynamic-labs/sdk-react-core 4.22.0 → 4.22.1
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 +2 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/index.cjs +2 -2
- package/src/index.js +1 -1
- package/src/lib/widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js +1 -0
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs +7 -26
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js +8 -27
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletRecoveryEmailSection/EmbeddedWalletRecoveryEmailSection.cjs +140 -0
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletRecoveryEmailSection/EmbeddedWalletRecoveryEmailSection.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletRecoveryEmailSection/EmbeddedWalletRecoveryEmailSection.js +136 -0
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletRecoveryEmailSection/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
package/package.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "4.22.
|
|
6
|
+
var version = "4.22.1";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.706",
|
|
9
9
|
"@dynamic-labs-sdk/client": "0.0.1-alpha.8",
|
|
10
10
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
11
11
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "4.22.
|
|
2
|
+
var version = "4.22.1";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.0.706",
|
|
5
5
|
"@dynamic-labs-sdk/client": "0.0.1-alpha.8",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
7
7
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.22.
|
|
3
|
+
"version": "4.22.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
5
|
+
"@dynamic-labs/sdk-api-core": "0.0.706",
|
|
6
6
|
"@dynamic-labs-sdk/client": "0.0.1-alpha.8",
|
|
7
7
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
8
8
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"yup": "0.32.11",
|
|
16
16
|
"react-international-phone": "4.5.0",
|
|
17
17
|
"bs58": "5.0.0",
|
|
18
|
-
"@dynamic-labs/assert-package-version": "4.22.
|
|
19
|
-
"@dynamic-labs/iconic": "4.22.
|
|
20
|
-
"@dynamic-labs/logger": "4.22.
|
|
21
|
-
"@dynamic-labs/multi-wallet": "4.22.
|
|
22
|
-
"@dynamic-labs/rpc-providers": "4.22.
|
|
23
|
-
"@dynamic-labs/store": "4.22.
|
|
24
|
-
"@dynamic-labs/types": "4.22.
|
|
25
|
-
"@dynamic-labs/utils": "4.22.
|
|
26
|
-
"@dynamic-labs/wallet-book": "4.22.
|
|
27
|
-
"@dynamic-labs/wallet-connector-core": "4.22.
|
|
18
|
+
"@dynamic-labs/assert-package-version": "4.22.1",
|
|
19
|
+
"@dynamic-labs/iconic": "4.22.1",
|
|
20
|
+
"@dynamic-labs/logger": "4.22.1",
|
|
21
|
+
"@dynamic-labs/multi-wallet": "4.22.1",
|
|
22
|
+
"@dynamic-labs/rpc-providers": "4.22.1",
|
|
23
|
+
"@dynamic-labs/store": "4.22.1",
|
|
24
|
+
"@dynamic-labs/types": "4.22.1",
|
|
25
|
+
"@dynamic-labs/utils": "4.22.1",
|
|
26
|
+
"@dynamic-labs/wallet-book": "4.22.1",
|
|
27
|
+
"@dynamic-labs/wallet-connector-core": "4.22.1",
|
|
28
28
|
"eventemitter3": "5.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -130,8 +130,8 @@ require('./lib/components/OverlayCard/OverlayCard.cjs');
|
|
|
130
130
|
require('./lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
131
131
|
require('./lib/context/PasskeyContext/PasskeyContext.cjs');
|
|
132
132
|
require('./lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
133
|
-
var useEmbeddedWalletAuthenticator = require('./lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.cjs');
|
|
134
133
|
var useEmbeddedReveal = require('./lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs');
|
|
134
|
+
var useEmbeddedWalletAuthenticator = require('./lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.cjs');
|
|
135
135
|
require('./lib/context/OnrampContext/OnrampContext.cjs');
|
|
136
136
|
var index$2 = require('./lib/utils/functions/walletFilters/index.cjs');
|
|
137
137
|
var useFundWithWallet = require('./lib/utils/hooks/useFundWithWallet/useFundWithWallet.cjs');
|
|
@@ -261,8 +261,8 @@ exports.ShadowDOM = ShadowDOM.ShadowDOM;
|
|
|
261
261
|
exports.useMultiWalletPromptState = useMultiWalletPromptState.useMultiWalletPromptState;
|
|
262
262
|
exports.DynamicWidgetContextProvider = DynamicWidgetContext.DynamicWidgetContextProvider;
|
|
263
263
|
exports.useSwitchWallet = useSwitchWallet.useSwitchWallet;
|
|
264
|
-
exports.useEmbeddedWalletAuthenticator = useEmbeddedWalletAuthenticator.useEmbeddedWalletAuthenticator;
|
|
265
264
|
exports.useEmbeddedReveal = useEmbeddedReveal.useEmbeddedReveal;
|
|
265
|
+
exports.useEmbeddedWalletAuthenticator = useEmbeddedWalletAuthenticator.useEmbeddedWalletAuthenticator;
|
|
266
266
|
exports.FilterAndSortWallets = index$2.FilterAndSortWallets;
|
|
267
267
|
exports.FilterBridgeChainsName = index$2.FilterBridgeChainsName;
|
|
268
268
|
exports.FilterChain = index$2.FilterChain;
|
package/src/index.js
CHANGED
|
@@ -126,8 +126,8 @@ import './lib/components/OverlayCard/OverlayCard.js';
|
|
|
126
126
|
import './lib/views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
127
127
|
import './lib/context/PasskeyContext/PasskeyContext.js';
|
|
128
128
|
import './lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
129
|
-
export { useEmbeddedWalletAuthenticator } from './lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.js';
|
|
130
129
|
export { useEmbeddedReveal } from './lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js';
|
|
130
|
+
export { useEmbeddedWalletAuthenticator } from './lib/utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.js';
|
|
131
131
|
import './lib/context/OnrampContext/OnrampContext.js';
|
|
132
132
|
export { FilterAndSortWallets, FilterBridgeChainsName, FilterChain, FilterWallets, RemoveWallets, SortWallets, UniswapFilter } from './lib/utils/functions/walletFilters/index.js';
|
|
133
133
|
export { useFundWithWallet } from './lib/utils/hooks/useFundWithWallet/useFundWithWallet.js';
|
|
@@ -7,6 +7,7 @@ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
|
7
7
|
|
|
8
8
|
const EXCHANGE_TO_PROVIDER_OVERRIDES = {
|
|
9
9
|
[sdkApiCore.ExchangeKeyEnum.Coinbase]: sdkApiCore.ProviderEnum.Coinbasesocial,
|
|
10
|
+
[sdkApiCore.ExchangeKeyEnum.Kraken]: sdkApiCore.ProviderEnum.Kraken,
|
|
10
11
|
};
|
|
11
12
|
const PROVIDER_TO_EXCHANGE_OVERRIDES = Object.fromEntries(Object.entries(EXCHANGE_TO_PROVIDER_OVERRIDES).map(([exchange, provider]) => [
|
|
12
13
|
provider,
|
|
@@ -3,6 +3,7 @@ import { ExchangeKeyEnum, ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
|
3
3
|
|
|
4
4
|
const EXCHANGE_TO_PROVIDER_OVERRIDES = {
|
|
5
5
|
[ExchangeKeyEnum.Coinbase]: ProviderEnum.Coinbasesocial,
|
|
6
|
+
[ExchangeKeyEnum.Kraken]: ProviderEnum.Kraken,
|
|
6
7
|
};
|
|
7
8
|
const PROVIDER_TO_EXCHANGE_OVERRIDES = Object.fromEntries(Object.entries(EXCHANGE_TO_PROVIDER_OVERRIDES).map(([exchange, provider]) => [
|
|
8
9
|
provider,
|
|
@@ -14,9 +14,7 @@ var add = require('../../../../shared/assets/add.cjs');
|
|
|
14
14
|
var androidTouchId = require('../../../../shared/assets/android-touch-id.cjs');
|
|
15
15
|
var checkCircle = require('../../../../shared/assets/check-circle.cjs');
|
|
16
16
|
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
17
|
-
var footerInfoIcon = require('../../../../shared/assets/footer-info-icon.cjs');
|
|
18
17
|
var shield = require('../../../../shared/assets/shield.cjs');
|
|
19
|
-
var signInWithEmail = require('../../../../shared/assets/sign-in-with-email.cjs');
|
|
20
18
|
require('@dynamic-labs/iconic');
|
|
21
19
|
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
22
20
|
var spinner = require('../../../../components/Spinner/spinner.cjs');
|
|
@@ -82,7 +80,6 @@ require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTar
|
|
|
82
80
|
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
83
81
|
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
84
82
|
require('react-focus-lock');
|
|
85
|
-
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
86
83
|
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
87
84
|
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
88
85
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
@@ -97,9 +94,9 @@ require('../../../../components/OverlayCard/OverlayCard.cjs');
|
|
|
97
94
|
require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
98
95
|
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
99
96
|
require('../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
100
|
-
var useEmbeddedWalletAuthenticator = require('../../../../utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.cjs');
|
|
101
97
|
var PasskeyDeviceIcon = require('../../../../views/Passkey/PasskeyDeviceIcon/PasskeyDeviceIcon.cjs');
|
|
102
98
|
var EmbeddedWalletExportSection = require('./EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs');
|
|
99
|
+
var EmbeddedWalletRecoveryEmailSection = require('./EmbeddedWalletRecoveryEmailSection/EmbeddedWalletRecoveryEmailSection.cjs');
|
|
103
100
|
var ZKSyncSessionsSection = require('./ZKSyncSessionsSection/ZKSyncSessionsSection.cjs');
|
|
104
101
|
require('../../../../context/OnrampContext/OnrampContext.cjs');
|
|
105
102
|
require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
@@ -121,27 +118,23 @@ require('../../../../components/Popper/Popper/Popper.cjs');
|
|
|
121
118
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
122
119
|
|
|
123
120
|
const AccountAndSecuritySettingsView = () => {
|
|
124
|
-
var _a, _b, _c, _d, _e, _f
|
|
121
|
+
var _a, _b, _c, _d, _e, _f;
|
|
122
|
+
const { t } = reactI18next.useTranslation();
|
|
125
123
|
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
124
|
+
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
126
125
|
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
127
126
|
const projectSettings$1 = projectSettings.useProjectSettings();
|
|
128
|
-
const {
|
|
129
|
-
const { addEmbeddedWalletRecoveryEmail } = useEmbeddedWalletAuthenticator.useEmbeddedWalletAuthenticator();
|
|
130
|
-
const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator, hasRecoveryEmail, } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
131
|
-
const { t } = reactI18next.useTranslation();
|
|
127
|
+
const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
132
128
|
const { initPasskeyRecoveryProcess } = usePasskeyRecovery.usePasskeyRecovery();
|
|
133
|
-
const [isLoading, setIsLoading] = React.useState(false);
|
|
134
129
|
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
130
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
135
131
|
const isPasskeyEnabled = Boolean((_d = (_c = (_b = (_a = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.supportedSecurityMethods) === null || _c === void 0 ? void 0 : _c.passkey) === null || _d === void 0 ? void 0 : _d.isEnabled);
|
|
136
132
|
const isTurnkeyWalletWithAuthenticator = isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator;
|
|
137
133
|
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
138
|
-
const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
|
|
139
134
|
const isMfaEnabled = Boolean((_f = (_e = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.security) === null || _e === void 0 ? void 0 : _e.mfa) === null || _f === void 0 ? void 0 : _f.enabled);
|
|
140
135
|
const isSessionKeyCompatible = (primaryWallet && walletConnectorCore.isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
141
136
|
(eoaWallet && walletConnectorCore.isSessionKeyCompatibleWallet(eoaWallet));
|
|
142
137
|
const shouldShowPasskeyMFA = isPasskeyEnabled && isTurnkeyWallet && !isSessionKeyCompatible;
|
|
143
|
-
const isEmbeddedWallet = Boolean(wallet && ((_h = (_g = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _g === void 0 ? void 0 : _g.key) === null || _h === void 0 ? void 0 : _h.startsWith('turnkey')));
|
|
144
|
-
const isV3WaasWallet = Boolean(wallet && ((_k = (_j = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _j === void 0 ? void 0 : _j.key) === null || _k === void 0 ? void 0 : _k.startsWith('dynamicwaas')));
|
|
145
138
|
const handlePasskeyClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
146
139
|
if (isTurnkeyWalletWithoutAuthenticator) {
|
|
147
140
|
try {
|
|
@@ -182,13 +175,6 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
182
175
|
return jsxRuntime.jsx(spinner.Spinner, {});
|
|
183
176
|
return jsxRuntime.jsx(add.ReactComponent, {});
|
|
184
177
|
};
|
|
185
|
-
const renderEmailButtonEndSlot = () => {
|
|
186
|
-
if (hasRecoveryEmail)
|
|
187
|
-
return (jsxRuntime.jsx(checkCircle.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--success' }));
|
|
188
|
-
if (isLoading)
|
|
189
|
-
return jsxRuntime.jsx(spinner.Spinner, {});
|
|
190
|
-
return jsxRuntime.jsx(add.ReactComponent, { "data-testid": 'email-add-icon' });
|
|
191
|
-
};
|
|
192
178
|
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
193
179
|
const securitySectionTitleClasses = React.useMemo(() => classNames.classNames('settings-view__body__section__title', {
|
|
194
180
|
'settings-view__body__section__title__info-icon': !isTurnkeyWalletWithAuthenticator,
|
|
@@ -196,17 +182,12 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
196
182
|
const passkeyButtonClasses = React.useMemo(() => classNames.classNames('settings-view__body__section__button', {
|
|
197
183
|
'settings-view__body__section__button__badge': !isTurnkeyWalletWithAuthenticator,
|
|
198
184
|
}), [isTurnkeyWalletWithAuthenticator]);
|
|
199
|
-
const emailButtonClasses = React.useMemo(() => classNames.classNames('settings-view__body__section__button', 'settings-view__body__section__button__badge'), []);
|
|
200
185
|
return (jsxRuntime.jsxs("div", { className: 'account-and-security-settings-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', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') }) }) }), jsxRuntime.jsx("div", { className: 'account-wrap', children: jsxRuntime.jsxs("div", { className: 'settings-view__body', children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [shouldShowPasskeyMFA ||
|
|
201
186
|
(isMfaEnabled && (jsxRuntime.jsx("div", { className: securitySectionTitleClasses, children: jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.security_section.title', children: t('dyn_settings.security_section.title') }) }))), shouldShowPasskeyMFA && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'manage-passkeys-button', onClick: handlePasskeyButtonClick, buttonClassName: passkeyButtonClasses, startSlot:
|
|
202
187
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
203
188
|
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: handleMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
204
189
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
205
|
-
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 }))] }), jsxRuntime.jsx(ZKSyncSessionsSection.ZKSyncSessionsSection, { isLoading: isLoading }), (
|
|
206
|
-
!hasRecoveryEmail &&
|
|
207
|
-
!isSessionKeyCompatible && (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: [jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.identity_section.title', 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: emailButtonClasses, startSlot:
|
|
208
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
209
|
-
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(signInWithEmail.ReactComponent, { className: 'settings-view__body__section__button__icon email' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.identity_section.add_email_button', children: t('dyn_settings.identity_section.add_email_button') }), jsxRuntime.jsx(Badge.Badge, { text: t('dyn_settings.tags.recommended'), copykey: 'dyn_settings.tags.recommended', variant: 'secondary' })] }), endSlot: renderEmailButtonEndSlot(), disabled: isLoading || hasRecoveryEmail, showInternalLoading: false })] })), jsxRuntime.jsx(EmbeddedWalletExportSection.EmbeddedWalletExportSection, {})] }))] }) }), jsxRuntime.jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', color: 'error-1', variant: 'body_small', weight: 'medium', className: 'account-and-security-settings-view__delete-account-container__delete-button', copykey: 'dyn_settings.delete_account.title', children: t('dyn_settings.delete_account.title') }) })] }));
|
|
190
|
+
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 }))] }), jsxRuntime.jsx(ZKSyncSessionsSection.ZKSyncSessionsSection, { isLoading: isLoading }), jsxRuntime.jsx(EmbeddedWalletRecoveryEmailSection.EmbeddedWalletRecoveryEmailSection, {}), jsxRuntime.jsx(EmbeddedWalletExportSection.EmbeddedWalletExportSection, {})] }) }), jsxRuntime.jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', color: 'error-1', variant: 'body_small', weight: 'medium', className: 'account-and-security-settings-view__delete-account-container__delete-button', copykey: 'dyn_settings.delete_account.title', children: t('dyn_settings.delete_account.title') }) })] }));
|
|
210
191
|
};
|
|
211
192
|
|
|
212
193
|
exports.AccountAndSecuritySettingsView = AccountAndSecuritySettingsView;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { jsx, jsxs
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import { useState, useCallback, useMemo } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
|
|
@@ -10,9 +10,7 @@ import { ReactComponent as SvgAdd } from '../../../../shared/assets/add.js';
|
|
|
10
10
|
import { ReactComponent as SvgAndroidTouchId } from '../../../../shared/assets/android-touch-id.js';
|
|
11
11
|
import { ReactComponent as SvgCheckCircle } from '../../../../shared/assets/check-circle.js';
|
|
12
12
|
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
13
|
-
import { ReactComponent as SvgFooterInfoIcon } from '../../../../shared/assets/footer-info-icon.js';
|
|
14
13
|
import { ReactComponent as SvgShield } from '../../../../shared/assets/shield.js';
|
|
15
|
-
import { ReactComponent as SvgSignInWithEmail } from '../../../../shared/assets/sign-in-with-email.js';
|
|
16
14
|
import '@dynamic-labs/iconic';
|
|
17
15
|
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
18
16
|
import { Spinner } from '../../../../components/Spinner/spinner.js';
|
|
@@ -78,7 +76,6 @@ import '../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarg
|
|
|
78
76
|
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
79
77
|
import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
80
78
|
import 'react-focus-lock';
|
|
81
|
-
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
82
79
|
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
83
80
|
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
84
81
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
@@ -93,9 +90,9 @@ import '../../../../components/OverlayCard/OverlayCard.js';
|
|
|
93
90
|
import '../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
94
91
|
import '../../../../context/PasskeyContext/PasskeyContext.js';
|
|
95
92
|
import '../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
96
|
-
import { useEmbeddedWalletAuthenticator } from '../../../../utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.js';
|
|
97
93
|
import { PasskeyDeviceIcon } from '../../../../views/Passkey/PasskeyDeviceIcon/PasskeyDeviceIcon.js';
|
|
98
94
|
import { EmbeddedWalletExportSection } from './EmbeddedWalletExportSection/EmbeddedWalletExportSection.js';
|
|
95
|
+
import { EmbeddedWalletRecoveryEmailSection } from './EmbeddedWalletRecoveryEmailSection/EmbeddedWalletRecoveryEmailSection.js';
|
|
99
96
|
import { ZKSyncSessionsSection } from './ZKSyncSessionsSection/ZKSyncSessionsSection.js';
|
|
100
97
|
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
101
98
|
import '../../helpers/convertExchangeKeyAndProviderEnum.js';
|
|
@@ -117,27 +114,23 @@ import '../../../../components/Popper/Popper/Popper.js';
|
|
|
117
114
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
118
115
|
|
|
119
116
|
const AccountAndSecuritySettingsView = () => {
|
|
120
|
-
var _a, _b, _c, _d, _e, _f
|
|
117
|
+
var _a, _b, _c, _d, _e, _f;
|
|
118
|
+
const { t } = useTranslation();
|
|
121
119
|
const { clearStackAndPush } = useViewContext();
|
|
120
|
+
const { setDynamicWidgetView } = useWidgetContext();
|
|
122
121
|
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext();
|
|
123
122
|
const projectSettings = useProjectSettings();
|
|
124
|
-
const {
|
|
125
|
-
const { addEmbeddedWalletRecoveryEmail } = useEmbeddedWalletAuthenticator();
|
|
126
|
-
const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator, hasRecoveryEmail, } = useIsTurnkeyWallet();
|
|
127
|
-
const { t } = useTranslation();
|
|
123
|
+
const { isTurnkeyWallet, isTurnkeyWalletWithoutAuthenticator } = useIsTurnkeyWallet();
|
|
128
124
|
const { initPasskeyRecoveryProcess } = usePasskeyRecovery();
|
|
129
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
130
125
|
const { getEOAWallet } = useSmartWallets();
|
|
126
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
131
127
|
const isPasskeyEnabled = Boolean((_d = (_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.supportedSecurityMethods) === null || _c === void 0 ? void 0 : _c.passkey) === null || _d === void 0 ? void 0 : _d.isEnabled);
|
|
132
128
|
const isTurnkeyWalletWithAuthenticator = isTurnkeyWallet && !isTurnkeyWalletWithoutAuthenticator;
|
|
133
129
|
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
134
|
-
const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
|
|
135
130
|
const isMfaEnabled = Boolean((_f = (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security) === null || _e === void 0 ? void 0 : _e.mfa) === null || _f === void 0 ? void 0 : _f.enabled);
|
|
136
131
|
const isSessionKeyCompatible = (primaryWallet && isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
137
132
|
(eoaWallet && isSessionKeyCompatibleWallet(eoaWallet));
|
|
138
133
|
const shouldShowPasskeyMFA = isPasskeyEnabled && isTurnkeyWallet && !isSessionKeyCompatible;
|
|
139
|
-
const isEmbeddedWallet = Boolean(wallet && ((_h = (_g = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _g === void 0 ? void 0 : _g.key) === null || _h === void 0 ? void 0 : _h.startsWith('turnkey')));
|
|
140
|
-
const isV3WaasWallet = Boolean(wallet && ((_k = (_j = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _j === void 0 ? void 0 : _j.key) === null || _k === void 0 ? void 0 : _k.startsWith('dynamicwaas')));
|
|
141
134
|
const handlePasskeyClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
142
135
|
if (isTurnkeyWalletWithoutAuthenticator) {
|
|
143
136
|
try {
|
|
@@ -178,13 +171,6 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
178
171
|
return jsx(Spinner, {});
|
|
179
172
|
return jsx(SvgAdd, {});
|
|
180
173
|
};
|
|
181
|
-
const renderEmailButtonEndSlot = () => {
|
|
182
|
-
if (hasRecoveryEmail)
|
|
183
|
-
return (jsx(SvgCheckCircle, { className: 'settings-view__body__section__button__icon-secondary--success' }));
|
|
184
|
-
if (isLoading)
|
|
185
|
-
return jsx(Spinner, {});
|
|
186
|
-
return jsx(SvgAdd, { "data-testid": 'email-add-icon' });
|
|
187
|
-
};
|
|
188
174
|
const backButton = (jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
189
175
|
const securitySectionTitleClasses = useMemo(() => classNames('settings-view__body__section__title', {
|
|
190
176
|
'settings-view__body__section__title__info-icon': !isTurnkeyWalletWithAuthenticator,
|
|
@@ -192,17 +178,12 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
192
178
|
const passkeyButtonClasses = useMemo(() => classNames('settings-view__body__section__button', {
|
|
193
179
|
'settings-view__body__section__button__badge': !isTurnkeyWalletWithAuthenticator,
|
|
194
180
|
}), [isTurnkeyWalletWithAuthenticator]);
|
|
195
|
-
const emailButtonClasses = useMemo(() => classNames('settings-view__body__section__button', 'settings-view__body__section__button__badge'), []);
|
|
196
181
|
return (jsxs("div", { className: 'account-and-security-settings-view', children: [jsx(ModalHeader, { leading: backButton, children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') }) }) }), jsx("div", { className: 'account-wrap', children: jsxs("div", { className: 'settings-view__body', children: [jsxs("div", { className: 'settings-view__body__section', children: [shouldShowPasskeyMFA ||
|
|
197
182
|
(isMfaEnabled && (jsx("div", { className: securitySectionTitleClasses, children: jsx(Typography, { copykey: 'dyn_settings.security_section.title', children: t('dyn_settings.security_section.title') }) }))), shouldShowPasskeyMFA && (jsx(TypographyButton, { dataTestId: 'manage-passkeys-button', onClick: handlePasskeyButtonClick, buttonClassName: passkeyButtonClasses, startSlot:
|
|
198
183
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
199
184
|
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: handleMfaClick, buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
200
185
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
201
|
-
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 }))] }), jsx(ZKSyncSessionsSection, { isLoading: isLoading }), (
|
|
202
|
-
!hasRecoveryEmail &&
|
|
203
|
-
!isSessionKeyCompatible && (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: [jsx(Typography, { copykey: 'dyn_settings.identity_section.title', 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: emailButtonClasses, startSlot:
|
|
204
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
205
|
-
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgSignInWithEmail, { className: 'settings-view__body__section__button__icon email' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.identity_section.add_email_button', children: t('dyn_settings.identity_section.add_email_button') }), jsx(Badge, { text: t('dyn_settings.tags.recommended'), copykey: 'dyn_settings.tags.recommended', variant: 'secondary' })] }), endSlot: renderEmailButtonEndSlot(), disabled: isLoading || hasRecoveryEmail, showInternalLoading: false })] })), jsx(EmbeddedWalletExportSection, {})] }))] }) }), jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsx(Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', color: 'error-1', variant: 'body_small', weight: 'medium', className: 'account-and-security-settings-view__delete-account-container__delete-button', copykey: 'dyn_settings.delete_account.title', children: t('dyn_settings.delete_account.title') }) })] }));
|
|
186
|
+
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 }))] }), jsx(ZKSyncSessionsSection, { isLoading: isLoading }), jsx(EmbeddedWalletRecoveryEmailSection, {}), jsx(EmbeddedWalletExportSection, {})] }) }), jsx("div", { className: 'account-and-security-settings-view__delete-account-container', children: jsx(Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', color: 'error-1', variant: 'body_small', weight: 'medium', className: 'account-and-security-settings-view__delete-account-container__delete-button', copykey: 'dyn_settings.delete_account.title', children: t('dyn_settings.delete_account.title') }) })] }));
|
|
206
187
|
};
|
|
207
188
|
|
|
208
189
|
export { AccountAndSecuritySettingsView };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
+
var classNames = require('../../../../../utils/functions/classNames/classNames.cjs');
|
|
10
|
+
require('../../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
11
|
+
require('react');
|
|
12
|
+
var add = require('../../../../../shared/assets/add.cjs');
|
|
13
|
+
var checkCircle = require('../../../../../shared/assets/check-circle.cjs');
|
|
14
|
+
var footerInfoIcon = require('../../../../../shared/assets/footer-info-icon.cjs');
|
|
15
|
+
var signInWithEmail = require('../../../../../shared/assets/sign-in-with-email.cjs');
|
|
16
|
+
require('@dynamic-labs/iconic');
|
|
17
|
+
require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
+
require('../../../../../../../_virtual/_tslib.cjs');
|
|
19
|
+
var spinner = require('../../../../../components/Spinner/spinner.cjs');
|
|
20
|
+
require('../../../../../components/Alert/Alert.cjs');
|
|
21
|
+
require('../../../../../events/dynamicEvents.cjs');
|
|
22
|
+
require('@dynamic-labs/utils');
|
|
23
|
+
require('../../../../../context/DynamicContext/DynamicContext.cjs');
|
|
24
|
+
require('../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
25
|
+
require('@dynamic-labs/sdk-api-core');
|
|
26
|
+
require('../../../../../shared/logger.cjs');
|
|
27
|
+
require('@dynamic-labs/wallet-book');
|
|
28
|
+
require('../../../../../utils/constants/colors.cjs');
|
|
29
|
+
require('../../../../../utils/constants/values.cjs');
|
|
30
|
+
require('../../../../../shared/consts/index.cjs');
|
|
31
|
+
require('../../../../../store/state/authMode/authMode.cjs');
|
|
32
|
+
var useInternalDynamicContext = require('../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
33
|
+
require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
34
|
+
require('../../../../../context/ErrorContext/ErrorContext.cjs');
|
|
35
|
+
require('@dynamic-labs/multi-wallet');
|
|
36
|
+
require('react-international-phone');
|
|
37
|
+
require('../../../../../store/state/nonce/nonce.cjs');
|
|
38
|
+
require('@dynamic-labs-sdk/client/core');
|
|
39
|
+
require('@dynamic-labs-sdk/client');
|
|
40
|
+
require('../../../../../client/client.cjs');
|
|
41
|
+
require('../../../../../store/state/projectSettings/projectSettings.cjs');
|
|
42
|
+
require('../../../../../config/ApiEndpoint.cjs');
|
|
43
|
+
require('../../../../../locale/locale.cjs');
|
|
44
|
+
require('../../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
45
|
+
require('../../../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
46
|
+
require('../../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
47
|
+
require('../../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
48
|
+
require('../../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
49
|
+
require('../../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
50
|
+
require('../../../../../context/VerificationContext/VerificationContext.cjs');
|
|
51
|
+
require('react-dom');
|
|
52
|
+
require('../../../../../utils/functions/compareChains/compareChains.cjs');
|
|
53
|
+
require('../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
54
|
+
require('../../../../../context/ThemeContext/ThemeContext.cjs');
|
|
55
|
+
var useSmartWallets = require('../../../../../utils/hooks/useSmartWallets/useSmartWallets.cjs');
|
|
56
|
+
require('../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
57
|
+
var useIsTurnkeyWallet = require('../../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs');
|
|
58
|
+
require('bs58');
|
|
59
|
+
require('@dynamic-labs/types');
|
|
60
|
+
require('../../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
61
|
+
require('../../../../../context/LoadingContext/LoadingContext.cjs');
|
|
62
|
+
require('../../../../../context/WalletContext/WalletContext.cjs');
|
|
63
|
+
require('../../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
64
|
+
require('yup');
|
|
65
|
+
require('../../../../../context/MockContext/MockContext.cjs');
|
|
66
|
+
require('../../../../../views/CollectUserDataView/useFields.cjs');
|
|
67
|
+
require('../../../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
68
|
+
require('../../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
69
|
+
require('@dynamic-labs/rpc-providers');
|
|
70
|
+
require('../../../../../store/state/walletOptions/walletOptions.cjs');
|
|
71
|
+
var Typography = require('../../../../../components/Typography/Typography.cjs');
|
|
72
|
+
require('../../../../../context/FooterAnimationContext/index.cjs');
|
|
73
|
+
require('../../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
74
|
+
require('../../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
75
|
+
require('../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
76
|
+
require('../../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
77
|
+
require('../../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
78
|
+
require('../../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
79
|
+
require('../../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
80
|
+
require('react-focus-lock');
|
|
81
|
+
var Icon = require('../../../../../components/Icon/Icon.cjs');
|
|
82
|
+
require('../../../context/DynamicWidgetContext.cjs');
|
|
83
|
+
require('../../../../../components/IconButton/IconButton.cjs');
|
|
84
|
+
require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
85
|
+
var Badge = require('../../../../../components/Badge/Badge.cjs');
|
|
86
|
+
var TypographyButton = require('../../../../../components/TypographyButton/TypographyButton.cjs');
|
|
87
|
+
require('formik');
|
|
88
|
+
require('../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
89
|
+
require('../../../../../store/state/sendBalances.cjs');
|
|
90
|
+
require('../../../../../components/Input/Input.cjs');
|
|
91
|
+
require('../../../../../components/OverlayCard/OverlayCard.cjs');
|
|
92
|
+
require('../../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
93
|
+
require('../../../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
94
|
+
require('../../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
95
|
+
var useEmbeddedWalletAuthenticator = require('../../../../../utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.cjs');
|
|
96
|
+
require('../../../../../context/OnrampContext/OnrampContext.cjs');
|
|
97
|
+
require('../../../helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
98
|
+
require('qrcode');
|
|
99
|
+
require('../../ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
100
|
+
require('../../../../../../index.cjs');
|
|
101
|
+
require('../../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
102
|
+
require('../../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
103
|
+
require('../../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
104
|
+
require('@hcaptcha/react-hcaptcha');
|
|
105
|
+
require('../../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
106
|
+
require('../../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
107
|
+
require('../../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
108
|
+
require('../../../../../store/state/tokenBalances.cjs');
|
|
109
|
+
require('../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
110
|
+
require('../../../../../components/InlineWidget/InlineWidget.cjs');
|
|
111
|
+
require('../../../../../components/IsBrowser/IsBrowser.cjs');
|
|
112
|
+
require('../../../../../components/Popper/Popper/Popper.cjs');
|
|
113
|
+
require('../../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
114
|
+
|
|
115
|
+
const EmbeddedWalletRecoveryEmailSection = ({ isLoading = false, }) => {
|
|
116
|
+
const { t } = reactI18next.useTranslation();
|
|
117
|
+
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
118
|
+
const { getEOAWallet } = useSmartWallets.useSmartWallets();
|
|
119
|
+
const { isTurnkeyWallet, hasRecoveryEmail } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
120
|
+
const { addEmbeddedWalletRecoveryEmail } = useEmbeddedWalletAuthenticator.useEmbeddedWalletAuthenticator();
|
|
121
|
+
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
122
|
+
const isSessionKeyCompatible = (primaryWallet && walletConnectorCore.isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
123
|
+
(eoaWallet && walletConnectorCore.isSessionKeyCompatibleWallet(eoaWallet));
|
|
124
|
+
const renderEmailButtonEndSlot = () => {
|
|
125
|
+
if (hasRecoveryEmail)
|
|
126
|
+
return (jsxRuntime.jsx(checkCircle.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--success' }));
|
|
127
|
+
if (isLoading) {
|
|
128
|
+
return jsxRuntime.jsx(spinner.Spinner, {});
|
|
129
|
+
}
|
|
130
|
+
return jsxRuntime.jsx(add.ReactComponent, { "data-testid": 'email-add-icon' });
|
|
131
|
+
};
|
|
132
|
+
if (!isTurnkeyWallet || isSessionKeyCompatible || hasRecoveryEmail) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
return (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: [jsxRuntime.jsx(Typography.Typography, { copykey: 'dyn_settings.identity_section.title', 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:
|
|
136
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
137
|
+
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(signInWithEmail.ReactComponent, { className: 'settings-view__body__section__button__icon email' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.identity_section.add_email_button', children: t('dyn_settings.identity_section.add_email_button') }), jsxRuntime.jsx(Badge.Badge, { text: t('dyn_settings.tags.recommended'), copykey: 'dyn_settings.tags.recommended', variant: 'secondary' })] }), endSlot: renderEmailButtonEndSlot(), disabled: isLoading || hasRecoveryEmail, showInternalLoading: false })] }));
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
exports.EmbeddedWalletRecoveryEmailSection = EmbeddedWalletRecoveryEmailSection;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { classNames } from '../../../../../utils/functions/classNames/classNames.js';
|
|
6
|
+
import '../../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import { ReactComponent as SvgAdd } from '../../../../../shared/assets/add.js';
|
|
9
|
+
import { ReactComponent as SvgCheckCircle } from '../../../../../shared/assets/check-circle.js';
|
|
10
|
+
import { ReactComponent as SvgFooterInfoIcon } from '../../../../../shared/assets/footer-info-icon.js';
|
|
11
|
+
import { ReactComponent as SvgSignInWithEmail } from '../../../../../shared/assets/sign-in-with-email.js';
|
|
12
|
+
import '@dynamic-labs/iconic';
|
|
13
|
+
import '../../../../../context/ViewContext/ViewContext.js';
|
|
14
|
+
import '../../../../../../../_virtual/_tslib.js';
|
|
15
|
+
import { Spinner } from '../../../../../components/Spinner/spinner.js';
|
|
16
|
+
import '../../../../../components/Alert/Alert.js';
|
|
17
|
+
import '../../../../../events/dynamicEvents.js';
|
|
18
|
+
import '@dynamic-labs/utils';
|
|
19
|
+
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
20
|
+
import '../../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
21
|
+
import '@dynamic-labs/sdk-api-core';
|
|
22
|
+
import '../../../../../shared/logger.js';
|
|
23
|
+
import '@dynamic-labs/wallet-book';
|
|
24
|
+
import '../../../../../utils/constants/colors.js';
|
|
25
|
+
import '../../../../../utils/constants/values.js';
|
|
26
|
+
import '../../../../../shared/consts/index.js';
|
|
27
|
+
import '../../../../../store/state/authMode/authMode.js';
|
|
28
|
+
import { useInternalDynamicContext } from '../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
29
|
+
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
30
|
+
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
31
|
+
import '@dynamic-labs/multi-wallet';
|
|
32
|
+
import 'react-international-phone';
|
|
33
|
+
import '../../../../../store/state/nonce/nonce.js';
|
|
34
|
+
import '@dynamic-labs-sdk/client/core';
|
|
35
|
+
import '@dynamic-labs-sdk/client';
|
|
36
|
+
import '../../../../../client/client.js';
|
|
37
|
+
import '../../../../../store/state/projectSettings/projectSettings.js';
|
|
38
|
+
import '../../../../../config/ApiEndpoint.js';
|
|
39
|
+
import '../../../../../locale/locale.js';
|
|
40
|
+
import '../../../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
41
|
+
import '../../../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
42
|
+
import '../../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
43
|
+
import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
44
|
+
import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
45
|
+
import '../../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
46
|
+
import '../../../../../context/VerificationContext/VerificationContext.js';
|
|
47
|
+
import 'react-dom';
|
|
48
|
+
import '../../../../../utils/functions/compareChains/compareChains.js';
|
|
49
|
+
import '../../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
50
|
+
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
51
|
+
import { useSmartWallets } from '../../../../../utils/hooks/useSmartWallets/useSmartWallets.js';
|
|
52
|
+
import '../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
53
|
+
import { useIsTurnkeyWallet } from '../../../../../utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js';
|
|
54
|
+
import 'bs58';
|
|
55
|
+
import '@dynamic-labs/types';
|
|
56
|
+
import '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
57
|
+
import '../../../../../context/LoadingContext/LoadingContext.js';
|
|
58
|
+
import '../../../../../context/WalletContext/WalletContext.js';
|
|
59
|
+
import '../../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
60
|
+
import 'yup';
|
|
61
|
+
import '../../../../../context/MockContext/MockContext.js';
|
|
62
|
+
import '../../../../../views/CollectUserDataView/useFields.js';
|
|
63
|
+
import '../../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
64
|
+
import '../../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
65
|
+
import '@dynamic-labs/rpc-providers';
|
|
66
|
+
import '../../../../../store/state/walletOptions/walletOptions.js';
|
|
67
|
+
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
68
|
+
import '../../../../../context/FooterAnimationContext/index.js';
|
|
69
|
+
import '../../../../../components/ShadowDOM/ShadowDOM.js';
|
|
70
|
+
import '../../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
71
|
+
import '../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
72
|
+
import '../../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
73
|
+
import '../../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
74
|
+
import '../../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
75
|
+
import '../../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
76
|
+
import 'react-focus-lock';
|
|
77
|
+
import { Icon } from '../../../../../components/Icon/Icon.js';
|
|
78
|
+
import '../../../context/DynamicWidgetContext.js';
|
|
79
|
+
import '../../../../../components/IconButton/IconButton.js';
|
|
80
|
+
import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
81
|
+
import { Badge } from '../../../../../components/Badge/Badge.js';
|
|
82
|
+
import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
|
|
83
|
+
import 'formik';
|
|
84
|
+
import '../../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
85
|
+
import '../../../../../store/state/sendBalances.js';
|
|
86
|
+
import '../../../../../components/Input/Input.js';
|
|
87
|
+
import '../../../../../components/OverlayCard/OverlayCard.js';
|
|
88
|
+
import '../../../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
89
|
+
import '../../../../../context/PasskeyContext/PasskeyContext.js';
|
|
90
|
+
import '../../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
91
|
+
import { useEmbeddedWalletAuthenticator } from '../../../../../utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.js';
|
|
92
|
+
import '../../../../../context/OnrampContext/OnrampContext.js';
|
|
93
|
+
import '../../../helpers/convertExchangeKeyAndProviderEnum.js';
|
|
94
|
+
import 'qrcode';
|
|
95
|
+
import '../../ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
96
|
+
import '../../../../../../index.js';
|
|
97
|
+
import '../../../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
98
|
+
import '../../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
99
|
+
import '../../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
100
|
+
import '@hcaptcha/react-hcaptcha';
|
|
101
|
+
import '../../../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
102
|
+
import '../../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
103
|
+
import '../../../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
104
|
+
import '../../../../../store/state/tokenBalances.js';
|
|
105
|
+
import '../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
106
|
+
import '../../../../../components/InlineWidget/InlineWidget.js';
|
|
107
|
+
import '../../../../../components/IsBrowser/IsBrowser.js';
|
|
108
|
+
import '../../../../../components/Popper/Popper/Popper.js';
|
|
109
|
+
import '../../../../../components/Popper/PopperContext/PopperContext.js';
|
|
110
|
+
|
|
111
|
+
const EmbeddedWalletRecoveryEmailSection = ({ isLoading = false, }) => {
|
|
112
|
+
const { t } = useTranslation();
|
|
113
|
+
const { primaryWallet } = useInternalDynamicContext();
|
|
114
|
+
const { getEOAWallet } = useSmartWallets();
|
|
115
|
+
const { isTurnkeyWallet, hasRecoveryEmail } = useIsTurnkeyWallet();
|
|
116
|
+
const { addEmbeddedWalletRecoveryEmail } = useEmbeddedWalletAuthenticator();
|
|
117
|
+
const eoaWallet = primaryWallet && getEOAWallet(primaryWallet);
|
|
118
|
+
const isSessionKeyCompatible = (primaryWallet && isSessionKeyCompatibleWallet(primaryWallet)) ||
|
|
119
|
+
(eoaWallet && isSessionKeyCompatibleWallet(eoaWallet));
|
|
120
|
+
const renderEmailButtonEndSlot = () => {
|
|
121
|
+
if (hasRecoveryEmail)
|
|
122
|
+
return (jsx(SvgCheckCircle, { className: 'settings-view__body__section__button__icon-secondary--success' }));
|
|
123
|
+
if (isLoading) {
|
|
124
|
+
return jsx(Spinner, {});
|
|
125
|
+
}
|
|
126
|
+
return jsx(SvgAdd, { "data-testid": 'email-add-icon' });
|
|
127
|
+
};
|
|
128
|
+
if (!isTurnkeyWallet || isSessionKeyCompatible || hasRecoveryEmail) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
return (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: [jsx(Typography, { copykey: 'dyn_settings.identity_section.title', 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:
|
|
132
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
133
|
+
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgSignInWithEmail, { className: 'settings-view__body__section__button__icon email' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.identity_section.add_email_button', children: t('dyn_settings.identity_section.add_email_button') }), jsx(Badge, { text: t('dyn_settings.tags.recommended'), copykey: 'dyn_settings.tags.recommended', variant: 'secondary' })] }), endSlot: renderEmailButtonEndSlot(), disabled: isLoading || hasRecoveryEmail, showInternalLoading: false })] }));
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export { EmbeddedWalletRecoveryEmailSection };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EmbeddedWalletRecoveryEmailSection } from './EmbeddedWalletRecoveryEmailSection';
|