@dynamic-labs/sdk-react-core 4.18.5 → 4.18.7

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +12 -12
  5. package/src/index.cjs +2 -1
  6. package/src/index.js +2 -1
  7. package/src/lib/components/Button/Button.d.ts +1 -1
  8. package/src/lib/components/ModalHeader/ModalHeader.cjs +2 -1
  9. package/src/lib/components/ModalHeader/ModalHeader.js +2 -1
  10. package/src/lib/components/ModalHeader/ModalHeader.types.d.ts +3 -1
  11. package/src/lib/components/TypographyButton/TypographyButton.cjs +2 -0
  12. package/src/lib/components/TypographyButton/TypographyButton.js +2 -0
  13. package/src/lib/context/DynamicContext/DynamicContext.cjs +7 -0
  14. package/src/lib/context/DynamicContext/DynamicContext.js +8 -1
  15. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +1 -0
  16. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +2 -1
  17. package/src/lib/context/OnrampContext/OnrampContext.cjs +30 -24
  18. package/src/lib/context/OnrampContext/OnrampContext.d.ts +1 -1
  19. package/src/lib/context/OnrampContext/OnrampContext.js +30 -24
  20. package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +8 -0
  21. package/src/lib/data/api/embeddedWallets/embeddedWallets.js +9 -1
  22. package/src/lib/locale/en/translation.cjs +54 -1
  23. package/src/lib/locale/en/translation.d.ts +53 -0
  24. package/src/lib/locale/en/translation.js +54 -1
  25. package/src/lib/shared/assets/index.d.ts +1 -0
  26. package/src/lib/shared/assets/session.cjs +54 -0
  27. package/src/lib/shared/assets/session.js +30 -0
  28. package/src/lib/store/state/user/user.cjs +0 -7
  29. package/src/lib/store/state/user/user.js +0 -7
  30. package/src/lib/styles/index.shadow.cjs +1 -1
  31. package/src/lib/styles/index.shadow.js +1 -1
  32. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +3 -0
  33. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +3 -0
  34. package/src/lib/utils/functions/index.d.ts +1 -0
  35. package/src/lib/utils/functions/isZKSyncEnabled/index.d.ts +1 -0
  36. package/src/lib/utils/functions/isZKSyncEnabled/isZKSyncEnabled.cjs +11 -0
  37. package/src/lib/utils/functions/isZKSyncEnabled/isZKSyncEnabled.d.ts +2 -0
  38. package/src/lib/utils/functions/isZKSyncEnabled/isZKSyncEnabled.js +7 -0
  39. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +30 -3
  40. package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +31 -4
  41. package/src/lib/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +7 -0
  42. package/src/lib/utils/hooks/useGlobalLoading/useGlobalLoading.js +7 -0
  43. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +8 -0
  44. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +9 -1
  45. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +98 -14
  46. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +98 -14
  47. package/src/lib/views/EmbeddedReveal/utils/waasExport/index.d.ts +1 -0
  48. package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.cjs +53 -0
  49. package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.d.ts +11 -0
  50. package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.js +48 -0
  51. package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.cjs +1 -3
  52. package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.js +1 -3
  53. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +4 -0
  54. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +2 -0
  55. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +4 -0
  56. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +3 -1
  57. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs +7 -2
  58. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js +8 -3
  59. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.cjs +15 -0
  60. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.d.ts +2 -0
  61. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.js +11 -0
  62. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/index.d.ts +1 -0
  63. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.cjs +28 -0
  64. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.d.ts +2 -0
  65. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.js +24 -0
  66. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/index.d.ts +1 -0
  67. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.cjs +33 -0
  68. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.d.ts +2 -0
  69. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.js +29 -0
  70. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/index.d.ts +1 -0
  71. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +9 -2
  72. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +9 -2
  73. package/src/lib/widgets/DynamicWidget/views/index.d.ts +1 -0
@@ -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
- const primaryTurnkeyWalletId = getPrimaryTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
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
- return initExport({
157
- iframeContainer: iframeContainerElement,
158
- iframeElementId,
159
- wallet: wallet,
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 ? (jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', children: t('dyn_embedded_reveal.reveal_description') })) : (jsx("div", { className: 'embedded-reveal-view__header', children: jsx("div", { className: 'embedded-reveal-view__header__hero', children: jsx(SvgExportEmbeddedHero, {}) }) })) })] }));
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: 60px'
230
- : 'height: 100px');
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
- }, [iframeContainerRef, data, isTurnkeyHDWallet, exportPrivateKey]);
233
- const closeButton = (jsx(IconButton, { onClick: () => setShowAuthFlow(false), type: 'button', children: jsx(SvgClose, {}) }));
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
- 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: 'embedded-reveal-view__body', children: [contentHeader, isTurnkeyWallet ? (jsx("div", { id: iframeContainerId, style: { display: data ? 'block' : 'none' }, ref: iframeContainerRef })) : null, hasInjectedCredential ? (jsxs(Fragment, { children: [jsx(TypographyButton, { buttonPadding: 'large', buttonVariant: 'brand-primary', onClick: () => setShowAuthFlow(false), loading: isLoading, copykey: 'dyn_embedded_reveal.done_button_label', typographyProps: {
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: 'large', buttonVariant: 'primary', onClick: () => {
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: 'large', buttonVariant: 'brand-primary', typographyProps: {
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 };
@@ -125,9 +125,7 @@ const UserDeleteAccountView = () => {
125
125
  const hasEmbeddedWallet = React.useMemo(() => user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((wallet) => wallet.walletProvider === sdkApiCore.WalletProviderEnum.EmbeddedWallet), [user]);
126
126
  return (jsxRuntime.jsx("div", { className: 'delete-account-view', children: jsxRuntime.jsxs("div", { className: 'delete-account-view__content', children: [jsxRuntime.jsx("div", { className: 'warning-section', children: jsxRuntime.jsxs("div", { className: 'warning-icon-container', children: [jsxRuntime.jsx(warningRed.ReactComponent, { className: 'warning-icon' }), jsxRuntime.jsx(exclamation.ReactComponent, { className: 'exclamation-icon' })] }) }), jsxRuntime.jsx("div", { className: 'message-box', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', children: t('dyn_settings.delete_account.description') }) }), jsxRuntime.jsxs("div", { className: 'confirmation-section', children: [jsxRuntime.jsxs("div", { className: 'checkbox-container', children: [jsxRuntime.jsx("input", { type: 'checkbox', checked: isBackupConfirmed, onChange: handleBackupConfirmChange, "data-testid": 'delete-account-checkbox' }), jsxRuntime.jsx(Typography.Typography, { className: 'checkbox-text', variant: 'body_small', children: hasEmbeddedWallet
127
127
  ? t('dyn_settings.delete_account.backup_confirmation_embedded')
128
- : t('dyn_settings.delete_account.backup_confirmation_no_embedded') })] }), jsxRuntime.jsxs("div", { className: 'input-section', children: [jsxRuntime.jsx(Typography.Typography, { className: 'input-label', variant: 'body_small', children: t('dyn_settings.delete_account.type_delete') }), jsxRuntime.jsx(Input.Input, { id: 'delete-confirmation', label: t('dyn_settings.delete_account.type_delete_label'), value: confirmText, onChange: handleConfirmTextChange, placeholder: 'DELETE', variant: 'dense', "data-testid": 'delete-account-input' })] }), error && (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'error-1', children: error.message }))] }), jsxRuntime.jsxs("div", { className: 'button-group', children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'cancel-button', buttonVariant: 'primary', type: 'button', onClick: handleCancel, copykey: 'dyn_settings.delete_account.cancel', children: t('dyn_settings.delete_account.cancel') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'delete-button', buttonVariant: 'primary', type: 'submit', onClick: handleDelete, disabled: !isDeleteEnabled, typographyProps: {
129
- color: isDeleteEnabled ? 'white' : 'tertiary',
130
- }, copykey: 'dyn_settings.delete_account.confirm', children: isLoading
128
+ : t('dyn_settings.delete_account.backup_confirmation_no_embedded') })] }), jsxRuntime.jsxs("div", { className: 'input-section', children: [jsxRuntime.jsx(Typography.Typography, { className: 'input-label', variant: 'body_small', children: t('dyn_settings.delete_account.type_delete') }), jsxRuntime.jsx(Input.Input, { id: 'delete-confirmation', label: t('dyn_settings.delete_account.type_delete_label'), value: confirmText, onChange: handleConfirmTextChange, placeholder: 'DELETE', variant: 'dense', "data-testid": 'delete-account-input' })] }), error && (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'error-1', children: error.message }))] }), jsxRuntime.jsxs("div", { className: 'button-group', children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'cancel-button', buttonVariant: 'primary', type: 'button', onClick: handleCancel, copykey: 'dyn_settings.delete_account.cancel', children: t('dyn_settings.delete_account.cancel') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'delete-button', buttonVariant: 'danger', type: 'submit', onClick: handleDelete, disabled: !isDeleteEnabled, copykey: 'dyn_settings.delete_account.confirm', children: isLoading
131
129
  ? t('dyn_settings.delete_account.deleting')
132
130
  : t('dyn_settings.delete_account.confirm') })] })] }) }));
133
131
  };
@@ -121,9 +121,7 @@ const UserDeleteAccountView = () => {
121
121
  const hasEmbeddedWallet = useMemo(() => user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((wallet) => wallet.walletProvider === WalletProviderEnum.EmbeddedWallet), [user]);
122
122
  return (jsx("div", { className: 'delete-account-view', children: jsxs("div", { className: 'delete-account-view__content', children: [jsx("div", { className: 'warning-section', children: jsxs("div", { className: 'warning-icon-container', children: [jsx(SvgWarningRed, { className: 'warning-icon' }), jsx(SvgExclamation, { className: 'exclamation-icon' })] }) }), jsx("div", { className: 'message-box', children: jsx(Typography, { variant: 'body_normal', weight: 'bold', children: t('dyn_settings.delete_account.description') }) }), jsxs("div", { className: 'confirmation-section', children: [jsxs("div", { className: 'checkbox-container', children: [jsx("input", { type: 'checkbox', checked: isBackupConfirmed, onChange: handleBackupConfirmChange, "data-testid": 'delete-account-checkbox' }), jsx(Typography, { className: 'checkbox-text', variant: 'body_small', children: hasEmbeddedWallet
123
123
  ? t('dyn_settings.delete_account.backup_confirmation_embedded')
124
- : t('dyn_settings.delete_account.backup_confirmation_no_embedded') })] }), jsxs("div", { className: 'input-section', children: [jsx(Typography, { className: 'input-label', variant: 'body_small', children: t('dyn_settings.delete_account.type_delete') }), jsx(Input, { id: 'delete-confirmation', label: t('dyn_settings.delete_account.type_delete_label'), value: confirmText, onChange: handleConfirmTextChange, placeholder: 'DELETE', variant: 'dense', "data-testid": 'delete-account-input' })] }), error && (jsx(Typography, { variant: 'body_small', color: 'error-1', children: error.message }))] }), jsxs("div", { className: 'button-group', children: [jsx(TypographyButton, { buttonClassName: 'cancel-button', buttonVariant: 'primary', type: 'button', onClick: handleCancel, copykey: 'dyn_settings.delete_account.cancel', children: t('dyn_settings.delete_account.cancel') }), jsx(TypographyButton, { buttonClassName: 'delete-button', buttonVariant: 'primary', type: 'submit', onClick: handleDelete, disabled: !isDeleteEnabled, typographyProps: {
125
- color: isDeleteEnabled ? 'white' : 'tertiary',
126
- }, copykey: 'dyn_settings.delete_account.confirm', children: isLoading
124
+ : t('dyn_settings.delete_account.backup_confirmation_no_embedded') })] }), jsxs("div", { className: 'input-section', children: [jsx(Typography, { className: 'input-label', variant: 'body_small', children: t('dyn_settings.delete_account.type_delete') }), jsx(Input, { id: 'delete-confirmation', label: t('dyn_settings.delete_account.type_delete_label'), value: confirmText, onChange: handleConfirmTextChange, placeholder: 'DELETE', variant: 'dense', "data-testid": 'delete-account-input' })] }), error && (jsx(Typography, { variant: 'body_small', color: 'error-1', children: error.message }))] }), jsxs("div", { className: 'button-group', children: [jsx(TypographyButton, { buttonClassName: 'cancel-button', buttonVariant: 'primary', type: 'button', onClick: handleCancel, copykey: 'dyn_settings.delete_account.cancel', children: t('dyn_settings.delete_account.cancel') }), jsx(TypographyButton, { buttonClassName: 'delete-button', buttonVariant: 'danger', type: 'submit', onClick: handleDelete, disabled: !isDeleteEnabled, copykey: 'dyn_settings.delete_account.confirm', children: isLoading
127
125
  ? t('dyn_settings.delete_account.deleting')
128
126
  : t('dyn_settings.delete_account.confirm') })] })] }) }));
129
127
  };
@@ -10,6 +10,7 @@ var SendBalanceWidgetView = require('../../views/SendBalanceWidgetView/SendBalan
10
10
  var ManagePasskeysWidgetView = require('../../views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.cjs');
11
11
  var SettingsView = require('../../views/SettingsView/SettingsView.cjs');
12
12
  var AccountAndSecuritySettingsView = require('../../views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs');
13
+ var SessionManagementView = require('../../views/SessionManagementView/SessionManagementView.cjs');
13
14
  var ChooseLinkedWalletView = require('../../views/ChooseLinkedWalletView/ChooseLinkedWalletView.cjs');
14
15
  var ChooseOnrampProviderView = require('../../views/ChooseOnrampProviderView/ChooseOnrampProviderView.cjs');
15
16
  var ChooseWalletFundingMethod = require('../../views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.cjs');
@@ -18,6 +19,7 @@ var DepositView = require('../../views/DepositView/DepositView.cjs');
18
19
  var GlobalWalletView = require('../../views/GlobalWalletView/GlobalWalletView.cjs');
19
20
  var ManageMfaWidgetView = require('../../views/ManageMfaWidgetView/ManageMfaWidgetView.cjs');
20
21
  var ReceiveWalletFunds = require('../../views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
22
+ var SessionManagementInfoView = require('../../views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.cjs');
21
23
 
22
24
  const mapViewToComponent = {
23
25
  'account-and-security-settings': AccountAndSecuritySettingsView.AccountAndSecuritySettingsView,
@@ -34,6 +36,8 @@ const mapViewToComponent = {
34
36
  profile: ProfileView.ProfileView,
35
37
  'receive-wallet-funds': ReceiveWalletFunds.ReceiveWalletFunds,
36
38
  'send-balance': SendBalanceWidgetView.SendBalanceWidgetView,
39
+ 'session-management': SessionManagementView.SessionManagementView,
40
+ 'session-management-info': SessionManagementInfoView.SessionManagementInfoView,
37
41
  settings: SettingsView.SettingsView,
38
42
  wallets: WalletsView.WalletsView,
39
43
  };
@@ -18,6 +18,8 @@ export declare const mapViewToComponent: {
18
18
  profile: import("react").FC;
19
19
  'receive-wallet-funds': import("react").FC<import("../../views/ReceiveWalletFunds/types").ReceiveWalletFundsProps>;
20
20
  'send-balance': import("react").FC;
21
+ 'session-management': import("react").FC;
22
+ 'session-management-info': import("react").FC;
21
23
  settings: import("react").FC;
22
24
  wallets: import("react").FC;
23
25
  };
@@ -6,6 +6,7 @@ import { SendBalanceWidgetView } from '../../views/SendBalanceWidgetView/SendBal
6
6
  import { ManagePasskeysWidgetView } from '../../views/ManagePasskeysWidgetView/ManagePasskeysWidgetView.js';
7
7
  import { SettingsView } from '../../views/SettingsView/SettingsView.js';
8
8
  import { AccountAndSecuritySettingsView } from '../../views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js';
9
+ import { SessionManagementView } from '../../views/SessionManagementView/SessionManagementView.js';
9
10
  import { ChooseLinkedWalletView } from '../../views/ChooseLinkedWalletView/ChooseLinkedWalletView.js';
10
11
  import { ChooseOnrampProviderView } from '../../views/ChooseOnrampProviderView/ChooseOnrampProviderView.js';
11
12
  import { ChooseWalletFundingMethod } from '../../views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.js';
@@ -14,6 +15,7 @@ import { DepositView } from '../../views/DepositView/DepositView.js';
14
15
  import { GlobalWalletView } from '../../views/GlobalWalletView/GlobalWalletView.js';
15
16
  import { ManageMfaWidgetView } from '../../views/ManageMfaWidgetView/ManageMfaWidgetView.js';
16
17
  import { ReceiveWalletFunds } from '../../views/ReceiveWalletFunds/ReceiveWalletFunds.js';
18
+ import { SessionManagementInfoView } from '../../views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.js';
17
19
 
18
20
  const mapViewToComponent = {
19
21
  'account-and-security-settings': AccountAndSecuritySettingsView,
@@ -30,6 +32,8 @@ const mapViewToComponent = {
30
32
  profile: ProfileView,
31
33
  'receive-wallet-funds': ReceiveWalletFunds,
32
34
  'send-balance': SendBalanceWidgetView,
35
+ 'session-management': SessionManagementView,
36
+ 'session-management-info': SessionManagementInfoView,
33
37
  settings: SettingsView,
34
38
  wallets: WalletsView,
35
39
  };
@@ -9,9 +9,11 @@ export declare const DynamicPasskeyWidgetViews: readonly ["manage-passkeys"];
9
9
  export declare const DynamicMfaWidgetViews: readonly ["manage-mfa", "manage-mfa-no-footer"];
10
10
  export type DynamicPasskeyWidgetViewsType = typeof DynamicPasskeyWidgetViews[number];
11
11
  export type DynamicMfaWidgetViewsType = typeof DynamicMfaWidgetViews[number];
12
+ export declare const DynamicSessionManagementViews: readonly ["session-management", "session-management-info"];
13
+ export type DynamicSessionManagementViewsType = typeof DynamicSessionManagementViews[number];
12
14
  export declare const DynamicTransactionsWidgetViews: readonly ["send-balance"];
13
15
  export type DynamicTransactionsWidgetViewsType = typeof DynamicTransactionsWidgetViews[number];
14
- export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | 'choose-wallet-funding-method' | 'receive-wallet-funds' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType | 'connected-apps' | 'deposit-view' | 'choose-onramp-provider' | 'choose-linked-wallet';
16
+ export type DynamicWidgetViews = 'wallets' | 'profile' | 'edit-profile' | 'choose-wallet-funding-method' | 'receive-wallet-funds' | DynamicTransactionsWidgetViewsType | DynamicPasskeyWidgetViewsType | DynamicMfaWidgetViewsType | DynamicSettingsType | DynamicGlobalWalletType | DynamicSessionManagementViewsType | 'connected-apps' | 'deposit-view' | 'choose-onramp-provider' | 'choose-linked-wallet';
15
17
  export type DynamicWidgetViewMapConstraint = Record<DynamicWidgetViews, FC<any>>;
16
18
  export type DynamicWidgetViewMap = typeof mapViewToComponent;
17
19
  export type SetDynamicWidgetView = <T extends DynamicWidgetViews>(view: T, props?: ComponentProps<DynamicWidgetViewMap[T]>) => void;
@@ -22,6 +22,7 @@ var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
22
22
  var exportPrivateKey = require('../../../../shared/assets/export-private-key.cjs');
23
23
  var exportRecoveryPhrase = require('../../../../shared/assets/export-recovery-phrase.cjs');
24
24
  var footerInfoIcon = require('../../../../shared/assets/footer-info-icon.cjs');
25
+ var session = require('../../../../shared/assets/session.cjs');
25
26
  var shield = require('../../../../shared/assets/shield.cjs');
26
27
  var signInWithEmail = require('../../../../shared/assets/sign-in-with-email.cjs');
27
28
  var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
@@ -43,6 +44,7 @@ require('../../../../locale/locale.cjs');
43
44
  require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
44
45
  require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
45
46
  require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
47
+ var isZKSyncEnabled = require('../../../../utils/functions/isZKSyncEnabled/isZKSyncEnabled.cjs');
46
48
  require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
47
49
  require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
48
50
  require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
@@ -119,7 +121,7 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
119
121
  var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
120
122
 
121
123
  const AccountAndSecuritySettingsView = () => {
122
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
124
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
123
125
  const { clearStackAndPush } = ViewContext.useViewContext();
124
126
  const { primaryWallet, user, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
125
127
  const projectSettings$1 = projectSettings.useProjectSettings();
@@ -144,6 +146,8 @@ const AccountAndSecuritySettingsView = () => {
144
146
  (eoaWallet && walletConnectorCore.isSessionKeyCompatibleWallet(eoaWallet));
145
147
  const shouldShowPasskeyMFA = isPasskeyEnabled && isTurnkeyWallet && !isSessionKeyCompatible;
146
148
  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')));
149
+ 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')));
150
+ const isZKSyncWallet = React.useMemo(() => isZKSyncEnabled.isZKSyncEnabled(projectSettings$1), [projectSettings$1]);
147
151
  const handleExportClick = React.useCallback((recoveryPhrase) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
148
152
  if (!isSessionKeyCompatible) {
149
153
  if (yield shouldInitRecovery()) {
@@ -183,6 +187,7 @@ const AccountAndSecuritySettingsView = () => {
183
187
  ]);
184
188
  const handleBackClick = React.useCallback(() => setDynamicWidgetView('settings'), [setDynamicWidgetView]);
185
189
  const handleMfaClick = React.useCallback(() => setDynamicWidgetView('manage-mfa'), [setDynamicWidgetView]);
190
+ const handleSessionManagementClick = React.useCallback(() => setDynamicWidgetView('session-management'), [setDynamicWidgetView]);
186
191
  const handlePasskeyButtonClick = React.useCallback(() => handlePasskeyClick(), [handlePasskeyClick]);
187
192
  const handleExportButtonClick = React.useCallback(() => handleExportClick(), [handleExportClick]);
188
193
  const handleExportWithPhraseClick = React.useCallback(() => handleExportClick(true), [handleExportClick]);
@@ -223,7 +228,7 @@ const AccountAndSecuritySettingsView = () => {
223
228
  // eslint-disable-next-line react/jsx-wrap-multilines
224
229
  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
230
  // 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 &&
231
+ 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 }))] }), isZKSyncWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: identitySectionTitleClasses, children: t('dyn_settings.session_management.title') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'session-management-button', onClick: handleSessionManagementClick, buttonClassName: 'settings-view__body__section__button', startSlot: jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(session.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.session_management.session_management_button', children: t('dyn_settings.session_management.session_management_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
232
  !hasRecoveryEmail &&
228
233
  !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
234
  // eslint-disable-next-line react/jsx-wrap-multilines
@@ -1,7 +1,7 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../../_virtual/_tslib.js';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { useState, useCallback, useMemo } from 'react';
4
+ import { useState, useMemo, useCallback } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { isSessionKeyCompatibleWallet } from '@dynamic-labs/wallet-connector-core';
7
7
  import { Typography } from '../../../../components/Typography/Typography.js';
@@ -18,6 +18,7 @@ import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chev
18
18
  import { ReactComponent as SvgExportPrivateKey } from '../../../../shared/assets/export-private-key.js';
19
19
  import { ReactComponent as SvgExportRecoveryPhrase } from '../../../../shared/assets/export-recovery-phrase.js';
20
20
  import { ReactComponent as SvgFooterInfoIcon } from '../../../../shared/assets/footer-info-icon.js';
21
+ import { ReactComponent as SvgSession } from '../../../../shared/assets/session.js';
21
22
  import { ReactComponent as SvgShield } from '../../../../shared/assets/shield.js';
22
23
  import { ReactComponent as SvgSignInWithEmail } from '../../../../shared/assets/sign-in-with-email.js';
23
24
  import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
@@ -39,6 +40,7 @@ import '../../../../locale/locale.js';
39
40
  import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
40
41
  import '../../../../store/state/primaryWalletId/primaryWalletId.js';
41
42
  import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
43
+ import { isZKSyncEnabled } from '../../../../utils/functions/isZKSyncEnabled/isZKSyncEnabled.js';
42
44
  import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
43
45
  import '../../../../context/AccountExistsContext/AccountExistsContext.js';
44
46
  import '../../../../context/UserWalletsContext/UserWalletsContext.js';
@@ -115,7 +117,7 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
115
117
  import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
116
118
 
117
119
  const AccountAndSecuritySettingsView = () => {
118
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
120
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
119
121
  const { clearStackAndPush } = useViewContext();
120
122
  const { primaryWallet, user, setShowAuthFlow } = useInternalDynamicContext();
121
123
  const projectSettings = useProjectSettings();
@@ -140,6 +142,8 @@ const AccountAndSecuritySettingsView = () => {
140
142
  (eoaWallet && isSessionKeyCompatibleWallet(eoaWallet));
141
143
  const shouldShowPasskeyMFA = isPasskeyEnabled && isTurnkeyWallet && !isSessionKeyCompatible;
142
144
  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')));
145
+ 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')));
146
+ const isZKSyncWallet = useMemo(() => isZKSyncEnabled(projectSettings), [projectSettings]);
143
147
  const handleExportClick = useCallback((recoveryPhrase) => __awaiter(void 0, void 0, void 0, function* () {
144
148
  if (!isSessionKeyCompatible) {
145
149
  if (yield shouldInitRecovery()) {
@@ -179,6 +183,7 @@ const AccountAndSecuritySettingsView = () => {
179
183
  ]);
180
184
  const handleBackClick = useCallback(() => setDynamicWidgetView('settings'), [setDynamicWidgetView]);
181
185
  const handleMfaClick = useCallback(() => setDynamicWidgetView('manage-mfa'), [setDynamicWidgetView]);
186
+ const handleSessionManagementClick = useCallback(() => setDynamicWidgetView('session-management'), [setDynamicWidgetView]);
182
187
  const handlePasskeyButtonClick = useCallback(() => handlePasskeyClick(), [handlePasskeyClick]);
183
188
  const handleExportButtonClick = useCallback(() => handleExportClick(), [handleExportClick]);
184
189
  const handleExportWithPhraseClick = useCallback(() => handleExportClick(true), [handleExportClick]);
@@ -219,7 +224,7 @@ const AccountAndSecuritySettingsView = () => {
219
224
  // eslint-disable-next-line react/jsx-wrap-multilines
220
225
  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
226
  // 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 &&
227
+ 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 }))] }), isZKSyncWallet && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: identitySectionTitleClasses, children: t('dyn_settings.session_management.title') }), jsx(TypographyButton, { dataTestId: 'session-management-button', onClick: handleSessionManagementClick, buttonClassName: 'settings-view__body__section__button', startSlot: jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgSession, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.session_management.session_management_button', children: t('dyn_settings.session_management.session_management_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: isLoading, showInternalLoading: false })] })), (isEmbeddedWallet || isV3WaasWallet) && (jsxs(Fragment, { children: [isTurnkeyWallet &&
223
228
  !hasRecoveryEmail &&
224
229
  !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
230
  // eslint-disable-next-line react/jsx-wrap-multilines
@@ -0,0 +1,15 @@
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 Typography = require('../../../../../components/Typography/Typography.cjs');
9
+
10
+ const EmptySessionsView = () => {
11
+ const { t } = reactI18next.useTranslation();
12
+ return (jsxRuntime.jsx("div", { className: 'empty-sessions-view', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children: t('dyn_session_management.empty_sessions_view.title') }) }));
13
+ };
14
+
15
+ exports.EmptySessionsView = EmptySessionsView;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const EmptySessionsView: FC;
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Typography } from '../../../../../components/Typography/Typography.js';
5
+
6
+ const EmptySessionsView = () => {
7
+ const { t } = useTranslation();
8
+ return (jsx("div", { className: 'empty-sessions-view', children: jsx(Typography, { variant: 'body_normal', color: 'secondary', children: t('dyn_session_management.empty_sessions_view.title') }) }));
9
+ };
10
+
11
+ export { EmptySessionsView };
@@ -0,0 +1 @@
1
+ export * from './EmptySessionsView';