@dynamic-labs/sdk-react-core 4.18.5 → 4.18.6
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 +14 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/index.cjs +2 -1
- package/src/index.js +2 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +7 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +8 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +1 -0
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +2 -1
- package/src/lib/context/OnrampContext/OnrampContext.cjs +30 -24
- package/src/lib/context/OnrampContext/OnrampContext.d.ts +1 -1
- package/src/lib/context/OnrampContext/OnrampContext.js +30 -24
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +8 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +9 -1
- package/src/lib/locale/en/translation.cjs +1 -1
- package/src/lib/locale/en/translation.js +1 -1
- package/src/lib/store/state/user/user.cjs +0 -7
- package/src/lib/store/state/user/user.js +0 -7
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +3 -0
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +3 -0
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +30 -3
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +31 -4
- package/src/lib/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +7 -0
- package/src/lib/utils/hooks/useGlobalLoading/useGlobalLoading.js +7 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +8 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +9 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +98 -14
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +98 -14
- package/src/lib/views/EmbeddedReveal/utils/waasExport/index.d.ts +1 -0
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.cjs +53 -0
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.d.ts +11 -0
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.js +48 -0
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs +3 -2
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js +3 -2
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +5 -2
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +5 -2
|
@@ -97,6 +97,7 @@ import '@hcaptcha/react-hcaptcha';
|
|
|
97
97
|
import { getProperErrorMessage } from '../../../modals/SignMessageConfirmationModal/getProperErrorMessage.js';
|
|
98
98
|
import { useWidgetContext } from '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
99
99
|
import { iframeContainerId, iframeElementId } from '../constants.js';
|
|
100
|
+
import { cleanupExport as cleanupExport$1, exportWaasCredential } from '../utils/waasExport/waasExport.js';
|
|
100
101
|
import '../../../context/FooterAnimationContext/index.js';
|
|
101
102
|
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
102
103
|
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
@@ -119,6 +120,8 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
119
120
|
const { primaryWallet, user, setShowAuthFlow, environmentId } = useInternalDynamicContext();
|
|
120
121
|
const { handleAcknowledgeExportPrompt } = useSyncEmbeddedWalletFlow();
|
|
121
122
|
const { isTurnkeyWallet } = useIsTurnkeyWallet();
|
|
123
|
+
//should use useIsWaasWallet hook
|
|
124
|
+
const isWaasWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => { var _a; return (_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('dynamicwaas'); });
|
|
122
125
|
const { setDynamicWidgetView } = useWidgetContext();
|
|
123
126
|
const { pushView } = useViewContext();
|
|
124
127
|
const { getEOAWallet, isSmartWallet } = useSmartWallets();
|
|
@@ -127,10 +130,17 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
127
130
|
if (!primaryWallet) {
|
|
128
131
|
throw new DynamicError('No primary wallet found', INVALID_WALLET_DATA);
|
|
129
132
|
}
|
|
130
|
-
|
|
133
|
+
let primaryTurnkeyWalletId;
|
|
134
|
+
try {
|
|
135
|
+
primaryTurnkeyWalletId = getPrimaryTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
// waas wallet
|
|
139
|
+
}
|
|
131
140
|
const walletProperties = (_b = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === primaryTurnkeyWalletId)) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
132
141
|
const isTurnkeyHDWallet = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeyHDWalletId;
|
|
133
142
|
const wallet = (_c = (primaryWallet && getEOAWallet(primaryWallet))) !== null && _c !== void 0 ? _c : primaryWallet;
|
|
143
|
+
const [showSkeleton, setShowSkeleton] = useState(false);
|
|
134
144
|
// eslint-disable-next-line arrow-body-style
|
|
135
145
|
useEffect(() => {
|
|
136
146
|
return () => {
|
|
@@ -139,6 +149,11 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
139
149
|
wallet: wallet,
|
|
140
150
|
});
|
|
141
151
|
}
|
|
152
|
+
if (isWaasWallet) {
|
|
153
|
+
cleanupExport$1({
|
|
154
|
+
wallet: wallet,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
142
157
|
};
|
|
143
158
|
// only run once on unmount
|
|
144
159
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -153,11 +168,14 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
153
168
|
if (isSessionKeyCompatibleWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
|
|
154
169
|
yield ((_e = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _e === void 0 ? void 0 : _e.createOrRestoreSession());
|
|
155
170
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
171
|
+
if (isTurnkeyWallet) {
|
|
172
|
+
return initExport({
|
|
173
|
+
iframeContainer: iframeContainerElement,
|
|
174
|
+
iframeElementId,
|
|
175
|
+
wallet: wallet,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return;
|
|
161
179
|
}));
|
|
162
180
|
const { mutate: handleExportWallet, isLoading, error, data, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
163
181
|
var _f, _g, _h;
|
|
@@ -187,6 +205,19 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
187
205
|
});
|
|
188
206
|
}
|
|
189
207
|
}
|
|
208
|
+
if (isWaasWallet) {
|
|
209
|
+
try {
|
|
210
|
+
return yield exportWaasCredential({
|
|
211
|
+
address: exportPrivateKey ? wallet === null || wallet === void 0 ? void 0 : wallet.address : undefined,
|
|
212
|
+
iframeContainer: iframeContainerRef.current,
|
|
213
|
+
user,
|
|
214
|
+
wallet: wallet,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
catch (_k) {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
190
221
|
return undefined;
|
|
191
222
|
}), {
|
|
192
223
|
onFailure: (err) => {
|
|
@@ -219,18 +250,38 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
219
250
|
!error && (jsxs("div", { className: 'embedded-reveal-view__zerodev-warning', children: [jsxs("div", { className: 'embedded-reveal-view__zerodev-warning__title-row', children: [jsx(SvgInfo, { className: 'embedded-reveal-view__zerodev-warning__icon' }), jsx(Typography, { variant: 'body_normal', weight: 'bold', copykey: 'dyn_embedded_reveal.aa_warning.title', children: t('dyn_embedded_reveal.aa_warning.title') })] }), jsxs(Typography, { variant: 'body_normal', weight: 'regular', copykey: 'dyn_embedded_reveal.aa_warning.subtitle', children: [t('dyn_embedded_reveal.aa_warning.subtitle'), jsx("button", { onClick: () => {
|
|
220
251
|
setShowAuthFlow(false);
|
|
221
252
|
setDynamicWidgetView('send-balance');
|
|
222
|
-
}, className: 'embedded-reveal-view__zerodev-warning__link-button', children: jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'primary', className: 'underline', copykey: 'dyn_embedded_reveal.aa_warning.button', children: t('dyn_embedded_reveal.aa_warning.button') }) })] })] })), jsx("div", { className: 'embedded-reveal-view__body__description', children: !isLoading && data && !error
|
|
253
|
+
}, className: 'embedded-reveal-view__zerodev-warning__link-button', children: jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'primary', className: 'underline', copykey: 'dyn_embedded_reveal.aa_warning.button', children: t('dyn_embedded_reveal.aa_warning.button') }) })] })] })), jsx("div", { className: 'embedded-reveal-view__body__description', children: !(!isLoading && data && !error) && (jsx("div", { className: 'embedded-reveal-view__header', children: jsx("div", { className: 'embedded-reveal-view__header__hero', children: jsx(SvgExportEmbeddedHero, {}) }) })) })] }));
|
|
223
254
|
useEffect(() => {
|
|
224
255
|
var _a;
|
|
225
256
|
if (((_a = iframeContainerRef === null || iframeContainerRef === void 0 ? void 0 : iframeContainerRef.current) === null || _a === void 0 ? void 0 : _a.children) && data) {
|
|
226
257
|
// eslint-disable-next-line prefer-destructuring
|
|
227
258
|
const iframeElement = iframeContainerRef.current.children[0];
|
|
228
259
|
iframeElement === null || iframeElement === void 0 ? void 0 : iframeElement.setAttribute('style', !isTurnkeyHDWallet || exportPrivateKey
|
|
229
|
-
? 'height:
|
|
230
|
-
: 'height:
|
|
260
|
+
? 'height: 88px; min-height: 88px; width: 100%; border: none; background: transparent; overflow: visible;'
|
|
261
|
+
: 'height: 120px; min-height: 120px; width: 100%; border: none; background: transparent; overflow: visible;');
|
|
262
|
+
}
|
|
263
|
+
}, [
|
|
264
|
+
iframeContainerRef,
|
|
265
|
+
data,
|
|
266
|
+
isTurnkeyHDWallet,
|
|
267
|
+
isWaasWallet,
|
|
268
|
+
exportPrivateKey,
|
|
269
|
+
]);
|
|
270
|
+
useEffect(() => {
|
|
271
|
+
if (data) {
|
|
272
|
+
// Show skeleton first
|
|
273
|
+
setShowSkeleton(true);
|
|
274
|
+
// After a delay, hide skeleton and show the iframe
|
|
275
|
+
const timer = setTimeout(() => {
|
|
276
|
+
setShowSkeleton(false);
|
|
277
|
+
}, 2000);
|
|
278
|
+
return () => clearTimeout(timer);
|
|
231
279
|
}
|
|
232
|
-
|
|
233
|
-
|
|
280
|
+
return;
|
|
281
|
+
}, [data]);
|
|
282
|
+
const closeButton = (jsx(IconButton, { onClick: () => {
|
|
283
|
+
setShowAuthFlow(false);
|
|
284
|
+
}, type: 'button', children: jsx(SvgClose, {}) }));
|
|
234
285
|
const hasInjectedCredential = !isLoading && data && !error;
|
|
235
286
|
const credentialTitle = !isTurnkeyHDWallet || exportPrivateKey
|
|
236
287
|
? t('dyn_embedded_reveal.private_key_title')
|
|
@@ -248,15 +299,48 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
248
299
|
const handleClickUnlink = () => {
|
|
249
300
|
pushView('embedded-delete-view');
|
|
250
301
|
};
|
|
251
|
-
|
|
302
|
+
// Extract nested ternaries into separate functions for clarity
|
|
303
|
+
const getBodyClassName = () => {
|
|
304
|
+
const baseClass = 'embedded-reveal-view__body';
|
|
305
|
+
if (isWaasWallet && hasInjectedCredential && title === credentialTitle) {
|
|
306
|
+
return `${baseClass} ${baseClass}--waas-credentials`;
|
|
307
|
+
}
|
|
308
|
+
return baseClass;
|
|
309
|
+
};
|
|
310
|
+
const getCredentialContainerClassName = () => {
|
|
311
|
+
const baseClass = 'embedded-reveal-view__body__credential-container';
|
|
312
|
+
if (title !== credentialTitle) {
|
|
313
|
+
return `${baseClass} ${baseClass}--hidden`;
|
|
314
|
+
}
|
|
315
|
+
if (isWaasWallet) {
|
|
316
|
+
return `${baseClass} ${baseClass}--waas`;
|
|
317
|
+
}
|
|
318
|
+
return baseClass;
|
|
319
|
+
};
|
|
320
|
+
const getIframeContainerClassName = () => {
|
|
321
|
+
const baseClass = 'embedded-reveal-view__body__iframe-container';
|
|
322
|
+
if (!data) {
|
|
323
|
+
return `${baseClass} ${baseClass}--hidden`;
|
|
324
|
+
}
|
|
325
|
+
if (showSkeleton) {
|
|
326
|
+
return `${baseClass} ${baseClass}--invisible`;
|
|
327
|
+
}
|
|
328
|
+
return baseClass;
|
|
329
|
+
};
|
|
330
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: isPromptForExport ? null : closeButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: title }) }), jsx("div", { className: 'embedded-reveal-view', children: jsxs("div", { className: getBodyClassName(), children: [(!isWaasWallet ||
|
|
331
|
+
!hasInjectedCredential ||
|
|
332
|
+
title !== credentialTitle) &&
|
|
333
|
+
contentHeader, isTurnkeyWallet || isWaasWallet ? (jsxs("div", { className: getCredentialContainerClassName(), children: [jsx("div", { id: iframeContainerId, className: getIframeContainerClassName(), ref: iframeContainerRef }), showSkeleton && data && (jsxs("div", { className: 'embedded-reveal-view__body__skeleton-container', children: [jsx("div", { className: 'embedded-reveal-view__body__skeleton-line', "data-testid": 'private-key-skeleton' }), jsx("div", { className: 'embedded-reveal-view__body__skeleton-line' }), jsx("div", { className: 'embedded-reveal-view__body__skeleton-line' }), jsx("div", { className: 'embedded-reveal-view__body__skeleton-line embedded-reveal-view__body__skeleton-line--short' })] }))] })) : null, hasInjectedCredential ? (jsxs(Fragment, { children: [jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', onClick: () => {
|
|
334
|
+
setShowAuthFlow(false);
|
|
335
|
+
}, loading: isLoading, copykey: 'dyn_embedded_reveal.done_button_label', typographyProps: {
|
|
252
336
|
color: 'inherit',
|
|
253
337
|
}, children: t('dyn_embedded_reveal.done_button_label') }), !exportPrivateKey && (jsx(TypographyButton, { buttonClassName: 'embedded-reveal-view__body__unlink_button', buttonVariant: 'tertiary', buttonPadding: 'none', copykey: 'dyn_embedded_reveal.unlink', onClick: handleClickUnlink, typographyProps: {
|
|
254
338
|
color: 'secondary',
|
|
255
339
|
variant: 'button_tertiary',
|
|
256
|
-
}, children: t('dyn_embedded_reveal.unlink') }))] })) : (jsxs(Fragment, { children: [jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsx(Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_embedded_reveal.prompt_for_export_description', children: t('dyn_embedded_reveal.prompt_for_export_description') })] }), errorText && jsx(ErrorContainer, { children: errorText }), jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgWalletV2, { height: 16, width: 16 }) }), jsxs("div", { className: 'embedded-reveal-view__body__card__statement__text', children: [jsxs(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.title', children: [t('dyn_embedded_reveal.statement_1.title'), ":"] }), jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgEyeOffIcon, { height: 16, width: 16 }) }), jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }) })] })] }), jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setAcknowledgement1(!acknowledgement1), children: [jsx("div", { children: jsx(Checkbox, { checked: acknowledgement1, onChange: () => setAcknowledgement1(!acknowledgement1), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'embedded-reveal-checkbox-1' }) }), jsx("div", { children: jsx(Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.checkbox_label', children: t('dyn_embedded_reveal.checkbox_label') }) })] }) }), jsx(NeedHelpSection, { isExport: true }), jsxs("div", { className: 'embedded-reveal-view__body__button_section', children: [isPromptForExport && (jsx(TypographyButton, { buttonPadding: '
|
|
340
|
+
}, children: t('dyn_embedded_reveal.unlink') }))] })) : (jsxs(Fragment, { children: [jsxs("div", { className: 'embedded-reveal-view__body__description', children: [jsx("div", { className: 'embedded-reveal-view__body__badge-container', children: jsx(Badge, { text: t('dyn_embedded_reveal.badge_label'), className: 'embedded-reveal-view__body__badge' }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'regular', copykey: 'dyn_embedded_reveal.prompt_for_export_description', children: t('dyn_embedded_reveal.prompt_for_export_description') })] }), errorText && jsx(ErrorContainer, { children: errorText }), jsxs("div", { className: 'embedded-reveal-view__body__card', children: [jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgWalletV2, { height: 16, width: 16 }) }), jsxs("div", { className: 'embedded-reveal-view__body__card__statement__text', children: [jsxs(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.title', children: [t('dyn_embedded_reveal.statement_1.title'), ":"] }), jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_1.description', children: t('dyn_embedded_reveal.statement_1.description') })] })] }), jsxs("div", { className: 'embedded-reveal-view__body__card__statement', children: [jsx("div", { className: 'embedded-reveal-view__body__card__icon', children: jsx(SvgEyeOffIcon, { height: 16, width: 16 }) }), jsx("div", { className: 'embedded-reveal-view__body__card__statement__text', children: jsx(Typography, { variant: 'body_small', color: 'primary', copykey: 'dyn_embedded_reveal.statement_2.title', children: t('dyn_embedded_reveal.statement_2.title') }) })] })] }), jsx("div", { className: 'embedded-reveal-view__body__confirm_card', children: jsxs("button", { className: 'embedded-reveal-view__body__card__acknowledgement', onClick: () => setAcknowledgement1(!acknowledgement1), children: [jsx("div", { children: jsx(Checkbox, { checked: acknowledgement1, onChange: () => setAcknowledgement1(!acknowledgement1), className: 'embedded-reveal-view__body__card__statement__checkbox', id: 'embedded-reveal-checkbox-1' }) }), jsx("div", { children: jsx(Typography, { variant: 'body_small', color: 'primary', style: { letterSpacing: '-0.15px' }, copykey: 'dyn_embedded_reveal.checkbox_label', children: t('dyn_embedded_reveal.checkbox_label') }) })] }) }), jsx(NeedHelpSection, { isExport: true }), jsxs("div", { className: 'embedded-reveal-view__body__button_section', children: [isPromptForExport && (jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'primary', onClick: () => {
|
|
257
341
|
handleAcknowledgeExportPrompt();
|
|
258
342
|
setShowAuthFlow(false);
|
|
259
|
-
}, dataTestId: 'embedded-reveal-button', copykey: 'dyn_embedded_reveal.skip_button_label', expanded: true, buttonClassName: 'embedded-reveal-view__body__button', children: t('dyn_embedded_reveal.skip_button_label') })), jsx(TypographyButton, { buttonPadding: '
|
|
343
|
+
}, dataTestId: 'embedded-reveal-button', copykey: 'dyn_embedded_reveal.skip_button_label', expanded: true, buttonClassName: 'embedded-reveal-view__body__button', children: t('dyn_embedded_reveal.skip_button_label') })), jsx(TypographyButton, { buttonPadding: 'medium', buttonVariant: 'brand-primary', typographyProps: {
|
|
260
344
|
color: 'inherit',
|
|
261
345
|
}, onClick: () => handleExportWallet(), disabled: !acknowledgement1 || exportLoading, loading: isLoading, dataTestId: 'embedded-reveal-button', copykey: 'dyn_embedded_reveal.reveal_button_label', style: { width: '100%' }, className: 'embedded-reveal-view__body__button', expanded: true, children: isPromptForExport
|
|
262
346
|
? t('dyn_embedded_reveal.backup_button_label')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './waasExport';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var errors = require('../../../../utils/constants/errors.cjs');
|
|
9
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
10
|
+
|
|
11
|
+
const handleExportInitCheck = ({ user, wallet, }) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
if (!user) {
|
|
14
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
15
|
+
}
|
|
16
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) || !(wallet === null || wallet === void 0 ? void 0 : wallet.id)) {
|
|
17
|
+
throw new utils.DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
18
|
+
}
|
|
19
|
+
const connector = wallet.connector;
|
|
20
|
+
const walletProperties = (_b = (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('dynamicwaas'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
21
|
+
if (!walletProperties) {
|
|
22
|
+
throw new utils.DynamicError('Invalid token!');
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
connector,
|
|
26
|
+
walletProperties,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const exportWaasCredential = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ user, wallet, address, iframeContainer, }) {
|
|
30
|
+
const { connector, walletProperties } = handleExportInitCheck({
|
|
31
|
+
user,
|
|
32
|
+
wallet,
|
|
33
|
+
});
|
|
34
|
+
connector.exportPrivateKey({
|
|
35
|
+
accountAddress: address || (walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.accountAddress),
|
|
36
|
+
displayContainer: iframeContainer,
|
|
37
|
+
});
|
|
38
|
+
return true;
|
|
39
|
+
});
|
|
40
|
+
const cleanupExport = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ wallet }) {
|
|
41
|
+
var _c;
|
|
42
|
+
const connector = wallet === null || wallet === void 0 ? void 0 : wallet.connector;
|
|
43
|
+
// clear iframeStamper and its reference
|
|
44
|
+
try {
|
|
45
|
+
(_c = connector === null || connector === void 0 ? void 0 : connector.getExportHandler()) === null || _c === void 0 ? void 0 : _c.clear();
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
logger.logger.error('Error cleaning up export:', error);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
exports.cleanupExport = cleanupExport;
|
|
53
|
+
exports.exportWaasCredential = exportWaasCredential;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Wallet } from '../../../../shared';
|
|
2
|
+
import { UserProfile } from '../../../../..';
|
|
3
|
+
export declare const exportWaasCredential: ({ user, wallet, address, iframeContainer, }: {
|
|
4
|
+
user: UserProfile | undefined;
|
|
5
|
+
wallet: Wallet | null;
|
|
6
|
+
address?: string;
|
|
7
|
+
iframeContainer: HTMLIFrameElement;
|
|
8
|
+
}) => Promise<boolean>;
|
|
9
|
+
export declare const cleanupExport: ({ wallet }: {
|
|
10
|
+
wallet: Wallet | null;
|
|
11
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
|
+
import { USER_NOT_LOGGED_IN } from '../../../../utils/constants/errors.js';
|
|
5
|
+
import { logger } from '../../../../shared/logger.js';
|
|
6
|
+
|
|
7
|
+
const handleExportInitCheck = ({ user, wallet, }) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
if (!user) {
|
|
10
|
+
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
11
|
+
}
|
|
12
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) || !(wallet === null || wallet === void 0 ? void 0 : wallet.id)) {
|
|
13
|
+
throw new DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
14
|
+
}
|
|
15
|
+
const connector = wallet.connector;
|
|
16
|
+
const walletProperties = (_b = (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('dynamicwaas'))) === null || _b === void 0 ? void 0 : _b.walletProperties;
|
|
17
|
+
if (!walletProperties) {
|
|
18
|
+
throw new DynamicError('Invalid token!');
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
connector,
|
|
22
|
+
walletProperties,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const exportWaasCredential = (_a) => __awaiter(void 0, [_a], void 0, function* ({ user, wallet, address, iframeContainer, }) {
|
|
26
|
+
const { connector, walletProperties } = handleExportInitCheck({
|
|
27
|
+
user,
|
|
28
|
+
wallet,
|
|
29
|
+
});
|
|
30
|
+
connector.exportPrivateKey({
|
|
31
|
+
accountAddress: address || (walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.accountAddress),
|
|
32
|
+
displayContainer: iframeContainer,
|
|
33
|
+
});
|
|
34
|
+
return true;
|
|
35
|
+
});
|
|
36
|
+
const cleanupExport = (_b) => __awaiter(void 0, [_b], void 0, function* ({ wallet }) {
|
|
37
|
+
var _c;
|
|
38
|
+
const connector = wallet === null || wallet === void 0 ? void 0 : wallet.connector;
|
|
39
|
+
// clear iframeStamper and its reference
|
|
40
|
+
try {
|
|
41
|
+
(_c = connector === null || connector === void 0 ? void 0 : connector.getExportHandler()) === null || _c === void 0 ? void 0 : _c.clear();
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
logger.error('Error cleaning up export:', error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export { cleanupExport, exportWaasCredential };
|
|
@@ -119,7 +119,7 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
119
119
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
120
120
|
|
|
121
121
|
const AccountAndSecuritySettingsView = () => {
|
|
122
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
122
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
123
123
|
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
124
124
|
const { primaryWallet, user, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
125
125
|
const projectSettings$1 = projectSettings.useProjectSettings();
|
|
@@ -144,6 +144,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
144
144
|
(eoaWallet && walletConnectorCore.isSessionKeyCompatibleWallet(eoaWallet));
|
|
145
145
|
const shouldShowPasskeyMFA = isPasskeyEnabled && isTurnkeyWallet && !isSessionKeyCompatible;
|
|
146
146
|
const isEmbeddedWallet = 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('turnkey')));
|
|
147
|
+
const isV3WaasWallet = Boolean(wallet && ((_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('dynamicwaas')));
|
|
147
148
|
const handleExportClick = React.useCallback((recoveryPhrase) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
148
149
|
if (!isSessionKeyCompatible) {
|
|
149
150
|
if (yield shouldInitRecovery()) {
|
|
@@ -223,7 +224,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
223
224
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
224
225
|
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:
|
|
225
226
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
226
|
-
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 }))] }), isEmbeddedWallet && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isTurnkeyWallet &&
|
|
227
|
+
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 }))] }), (isEmbeddedWallet || isV3WaasWallet) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isTurnkeyWallet &&
|
|
227
228
|
!hasRecoveryEmail &&
|
|
228
229
|
!isSessionKeyCompatible && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsxs("div", { className: identitySectionTitleClasses, 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:
|
|
229
230
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
@@ -115,7 +115,7 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
115
115
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
116
116
|
|
|
117
117
|
const AccountAndSecuritySettingsView = () => {
|
|
118
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
118
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
119
119
|
const { clearStackAndPush } = useViewContext();
|
|
120
120
|
const { primaryWallet, user, setShowAuthFlow } = useInternalDynamicContext();
|
|
121
121
|
const projectSettings = useProjectSettings();
|
|
@@ -140,6 +140,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
140
140
|
(eoaWallet && isSessionKeyCompatibleWallet(eoaWallet));
|
|
141
141
|
const shouldShowPasskeyMFA = isPasskeyEnabled && isTurnkeyWallet && !isSessionKeyCompatible;
|
|
142
142
|
const isEmbeddedWallet = 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('turnkey')));
|
|
143
|
+
const isV3WaasWallet = Boolean(wallet && ((_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('dynamicwaas')));
|
|
143
144
|
const handleExportClick = useCallback((recoveryPhrase) => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
145
|
if (!isSessionKeyCompatible) {
|
|
145
146
|
if (yield shouldInitRecovery()) {
|
|
@@ -219,7 +220,7 @@ const AccountAndSecuritySettingsView = () => {
|
|
|
219
220
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
220
221
|
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:
|
|
221
222
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
222
|
-
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 }))] }), isEmbeddedWallet && (jsxs(Fragment, { children: [isTurnkeyWallet &&
|
|
223
|
+
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 }))] }), (isEmbeddedWallet || isV3WaasWallet) && (jsxs(Fragment, { children: [isTurnkeyWallet &&
|
|
223
224
|
!hasRecoveryEmail &&
|
|
224
225
|
!isSessionKeyCompatible && (jsxs("div", { className: 'settings-view__body__section', children: [jsxs("div", { className: identitySectionTitleClasses, 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:
|
|
225
226
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
@@ -104,7 +104,7 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
104
104
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
105
105
|
|
|
106
106
|
const SettingsView = () => {
|
|
107
|
-
var _a, _b, _c, _d, _e;
|
|
107
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
108
108
|
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
109
109
|
const { primaryWallet, handleLogOut, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
110
110
|
const projectSettings$1 = projectSettings.useProjectSettings();
|
|
@@ -132,7 +132,10 @@ const SettingsView = () => {
|
|
|
132
132
|
const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
|
|
133
133
|
const isMfaEnabled = Boolean((_c = (_b = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.security) === null || _b === void 0 ? void 0 : _b.mfa) === null || _c === void 0 ? void 0 : _c.enabled);
|
|
134
134
|
const isEmbeddedWallet = Boolean(wallet && ((_e = (_d = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _d === void 0 ? void 0 : _d.key) === null || _e === void 0 ? void 0 : _e.startsWith('turnkey')));
|
|
135
|
-
const
|
|
135
|
+
const isV3WaasWallet = Boolean(wallet &&
|
|
136
|
+
((_g = (_f = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _f === void 0 ? void 0 : _f.key) === null || _g === void 0 ? void 0 : _g.startsWith('dynamicwaas')) &&
|
|
137
|
+
(wallet === null || wallet === void 0 ? void 0 : wallet.chain) === 'EVM');
|
|
138
|
+
const shouldShowAccountAndSecuritySettings = isMfaEnabled || isEmbeddedWallet || isV3WaasWallet;
|
|
136
139
|
return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.general_section.title', 'General') })), shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(accountAndSecurity.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_connectivity_section.title') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connectedApps.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsxRuntime.jsx(EmptyScreen.EmptyScreen, {})) }), jsxRuntime.jsx("div", { className: 'settings-view__logout-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsxRuntime.jsx("div", { className: 'settings-view__delete-account-container', children: jsxRuntime.jsx(Typography.Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', copykey: 'dyn_settings.delete_account.title', color: 'error-1', variant: 'body_small', className: 'settings-view__delete-account-container__delete-button', weight: 'medium', children: t('dyn_settings.delete_account.title') }) }))] }));
|
|
137
140
|
};
|
|
138
141
|
|
|
@@ -100,7 +100,7 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
100
100
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
101
101
|
|
|
102
102
|
const SettingsView = () => {
|
|
103
|
-
var _a, _b, _c, _d, _e;
|
|
103
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
104
104
|
const { clearStackAndPush } = useViewContext();
|
|
105
105
|
const { primaryWallet, handleLogOut, setShowAuthFlow } = useInternalDynamicContext();
|
|
106
106
|
const projectSettings = useProjectSettings();
|
|
@@ -128,7 +128,10 @@ const SettingsView = () => {
|
|
|
128
128
|
const wallet = eoaWallet !== null && eoaWallet !== void 0 ? eoaWallet : primaryWallet;
|
|
129
129
|
const isMfaEnabled = Boolean((_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security) === null || _b === void 0 ? void 0 : _b.mfa) === null || _c === void 0 ? void 0 : _c.enabled);
|
|
130
130
|
const isEmbeddedWallet = Boolean(wallet && ((_e = (_d = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _d === void 0 ? void 0 : _d.key) === null || _e === void 0 ? void 0 : _e.startsWith('turnkey')));
|
|
131
|
-
const
|
|
131
|
+
const isV3WaasWallet = Boolean(wallet &&
|
|
132
|
+
((_g = (_f = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _f === void 0 ? void 0 : _f.key) === null || _g === void 0 ? void 0 : _g.startsWith('dynamicwaas')) &&
|
|
133
|
+
(wallet === null || wallet === void 0 ? void 0 : wallet.chain) === 'EVM');
|
|
134
|
+
const shouldShowAccountAndSecuritySettings = isMfaEnabled || isEmbeddedWallet || isV3WaasWallet;
|
|
132
135
|
return (jsxs("div", { className: 'settings-view', children: [jsx("div", { className: 'settings-view__body', children: shouldShowAccountAndSecuritySettings || globalWallet ? (jsxs(Fragment, { children: [jsxs("div", { className: 'settings-view__body__section', children: [(shouldShowAccountAndSecuritySettings || globalWallet) && (jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.general_section.title', 'General') })), shouldShowAccountAndSecuritySettings && (jsx(TypographyButton, { dataTestId: 'account-and-security-button', buttonClassName: 'settings-view__body__section__button', onClick: handleAccountSecurityClick, startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgAccountAndSecurity, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.account_security.title', children: t('dyn_settings.account_security.title') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] }), globalWallet && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_connectivity_section.title') }), jsx(TypographyButton, { onClick: handleConnectedAppsClick, dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgConnectedApps, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] }))] })) : (jsx(EmptyScreen, {})) }), jsx("div", { className: 'settings-view__logout-button-container', children: jsx(TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) }), !shouldShowAccountAndSecuritySettings && (jsx("div", { className: 'settings-view__delete-account-container', children: jsx(Typography, { onClick: handleDeleteAccountClick, "data-testid": 'delete-account-button', copykey: 'dyn_settings.delete_account.title', color: 'error-1', variant: 'body_small', className: 'settings-view__delete-account-container__delete-button', weight: 'medium', children: t('dyn_settings.delete_account.title') }) }))] }));
|
|
133
136
|
};
|
|
134
137
|
|