@dynamic-labs/sdk-react-core 4.18.6 → 4.18.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +12 -12
  5. package/src/lib/components/Button/Button.d.ts +1 -1
  6. package/src/lib/components/ModalHeader/ModalHeader.cjs +2 -1
  7. package/src/lib/components/ModalHeader/ModalHeader.js +2 -1
  8. package/src/lib/components/ModalHeader/ModalHeader.types.d.ts +3 -1
  9. package/src/lib/components/TypographyButton/TypographyButton.cjs +2 -0
  10. package/src/lib/components/TypographyButton/TypographyButton.js +2 -0
  11. package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +7 -1
  12. package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +8 -2
  13. package/src/lib/context/UserWalletsContext/UserWalletsContext.cjs +26 -3
  14. package/src/lib/context/UserWalletsContext/UserWalletsContext.js +27 -4
  15. package/src/lib/locale/en/translation.cjs +92 -0
  16. package/src/lib/locale/en/translation.d.ts +92 -0
  17. package/src/lib/locale/en/translation.js +92 -0
  18. package/src/lib/shared/assets/index.d.ts +1 -0
  19. package/src/lib/shared/assets/session.cjs +54 -0
  20. package/src/lib/shared/assets/session.js +30 -0
  21. package/src/lib/styles/index.shadow.cjs +1 -1
  22. package/src/lib/styles/index.shadow.js +1 -1
  23. package/src/lib/utils/functions/index.d.ts +1 -0
  24. package/src/lib/utils/functions/isZKSyncEnabled/index.d.ts +1 -0
  25. package/src/lib/utils/functions/isZKSyncEnabled/isZKSyncEnabled.cjs +11 -0
  26. package/src/lib/utils/functions/isZKSyncEnabled/isZKSyncEnabled.d.ts +2 -0
  27. package/src/lib/utils/functions/isZKSyncEnabled/isZKSyncEnabled.js +7 -0
  28. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -0
  29. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -0
  30. package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/useAllowClose.cjs +92 -4
  31. package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/useAllowClose.js +92 -4
  32. package/src/lib/utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs +3 -90
  33. package/src/lib/utils/hooks/useSubdomainCheck/useSubdomainCheck.js +3 -90
  34. package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.cjs +1 -3
  35. package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.js +1 -3
  36. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +6 -0
  37. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +3 -0
  38. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +6 -0
  39. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +3 -1
  40. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs +5 -1
  41. package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js +6 -2
  42. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.cjs +15 -0
  43. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.d.ts +2 -0
  44. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.js +11 -0
  45. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/index.d.ts +1 -0
  46. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.cjs +37 -0
  47. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.d.ts +2 -0
  48. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.js +33 -0
  49. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/index.d.ts +1 -0
  50. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.cjs +30 -0
  51. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.d.ts +10 -0
  52. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.js +26 -0
  53. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/index.d.ts +1 -0
  54. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.cjs +28 -0
  55. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.d.ts +2 -0
  56. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.js +24 -0
  57. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/index.d.ts +1 -0
  58. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.cjs +56 -0
  59. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.d.ts +8 -0
  60. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.js +52 -0
  61. package/src/lib/widgets/DynamicWidget/views/SessionManagementView/index.d.ts +1 -0
  62. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +5 -1
  63. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +5 -1
  64. package/src/lib/widgets/DynamicWidget/views/index.d.ts +1 -0
@@ -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,8 @@ 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 { RevokeAccessView } from '../../views/SessionManagementView/RevokeAccessView/RevokeAccessView.js';
19
+ import { SessionManagementInfoView } from '../../views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.js';
17
20
 
18
21
  const mapViewToComponent = {
19
22
  'account-and-security-settings': AccountAndSecuritySettingsView,
@@ -30,6 +33,9 @@ const mapViewToComponent = {
30
33
  profile: ProfileView,
31
34
  'receive-wallet-funds': ReceiveWalletFunds,
32
35
  'send-balance': SendBalanceWidgetView,
36
+ 'session-management': SessionManagementView,
37
+ 'session-management-info': SessionManagementInfoView,
38
+ 'session-management-revoke-access': RevokeAccessView,
33
39
  settings: SettingsView,
34
40
  wallets: WalletsView,
35
41
  };
@@ -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", "session-management-revoke-access"];
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');
@@ -145,6 +147,7 @@ const AccountAndSecuritySettingsView = () => {
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')));
147
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]);
148
151
  const handleExportClick = React.useCallback((recoveryPhrase) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
149
152
  if (!isSessionKeyCompatible) {
150
153
  if (yield shouldInitRecovery()) {
@@ -184,6 +187,7 @@ const AccountAndSecuritySettingsView = () => {
184
187
  ]);
185
188
  const handleBackClick = React.useCallback(() => setDynamicWidgetView('settings'), [setDynamicWidgetView]);
186
189
  const handleMfaClick = React.useCallback(() => setDynamicWidgetView('manage-mfa'), [setDynamicWidgetView]);
190
+ const handleSessionManagementClick = React.useCallback(() => setDynamicWidgetView('session-management'), [setDynamicWidgetView]);
187
191
  const handlePasskeyButtonClick = React.useCallback(() => handlePasskeyClick(), [handlePasskeyClick]);
188
192
  const handleExportButtonClick = React.useCallback(() => handleExportClick(), [handleExportClick]);
189
193
  const handleExportWithPhraseClick = React.useCallback(() => handleExportClick(true), [handleExportClick]);
@@ -224,7 +228,7 @@ const AccountAndSecuritySettingsView = () => {
224
228
  // eslint-disable-next-line react/jsx-wrap-multilines
225
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:
226
230
  // eslint-disable-next-line react/jsx-wrap-multilines
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 &&
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 &&
228
232
  !hasRecoveryEmail &&
229
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:
230
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';
@@ -141,6 +143,7 @@ const AccountAndSecuritySettingsView = () => {
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')));
143
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]);
144
147
  const handleExportClick = useCallback((recoveryPhrase) => __awaiter(void 0, void 0, void 0, function* () {
145
148
  if (!isSessionKeyCompatible) {
146
149
  if (yield shouldInitRecovery()) {
@@ -180,6 +183,7 @@ const AccountAndSecuritySettingsView = () => {
180
183
  ]);
181
184
  const handleBackClick = useCallback(() => setDynamicWidgetView('settings'), [setDynamicWidgetView]);
182
185
  const handleMfaClick = useCallback(() => setDynamicWidgetView('manage-mfa'), [setDynamicWidgetView]);
186
+ const handleSessionManagementClick = useCallback(() => setDynamicWidgetView('session-management'), [setDynamicWidgetView]);
183
187
  const handlePasskeyButtonClick = useCallback(() => handlePasskeyClick(), [handlePasskeyClick]);
184
188
  const handleExportButtonClick = useCallback(() => handleExportClick(), [handleExportClick]);
185
189
  const handleExportWithPhraseClick = useCallback(() => handleExportClick(true), [handleExportClick]);
@@ -220,7 +224,7 @@ const AccountAndSecuritySettingsView = () => {
220
224
  // eslint-disable-next-line react/jsx-wrap-multilines
221
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:
222
226
  // eslint-disable-next-line react/jsx-wrap-multilines
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 &&
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 &&
224
228
  !hasRecoveryEmail &&
225
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:
226
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';
@@ -0,0 +1,37 @@
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 ModalHeader = require('../../../../../components/ModalHeader/ModalHeader.cjs');
9
+ var Typography = require('../../../../../components/Typography/Typography.cjs');
10
+ var IconButton = require('../../../../../components/IconButton/IconButton.cjs');
11
+ var DynamicWidgetContext = require('../../../context/DynamicWidgetContext.cjs');
12
+ require('react');
13
+ var close = require('../../../../../shared/assets/close.cjs');
14
+ require('@dynamic-labs/iconic');
15
+ require('../../../../../context/ViewContext/ViewContext.cjs');
16
+ var TypographyButton = require('../../../../../components/TypographyButton/TypographyButton.cjs');
17
+
18
+ const RevokeAccessView = () => {
19
+ const { t } = reactI18next.useTranslation();
20
+ const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
21
+ const handleCancel = () => {
22
+ setDynamicWidgetView('session-management');
23
+ };
24
+ const handleRevoke = () => {
25
+ // TODO: Implement revoke logic
26
+ setDynamicWidgetView('session-management', {
27
+ bannerMessage: {
28
+ message: 'revoked',
29
+ type: 'success',
30
+ },
31
+ });
32
+ };
33
+ const renderCloseButton = () => (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleCancel, "aria-label": t('dyn_session_management.aria.close_button_label'), children: jsxRuntime.jsx(close.ReactComponent, {}) }));
34
+ return (jsxRuntime.jsxs("div", { className: 'revoke-access-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: renderCloseButton(), children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.revoke_access_view.title', children: t('dyn_session_management.revoke_access_view.title') }) }), jsxRuntime.jsx("div", { className: 'revoke-access-view__body', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_session_management.revoke_access_view.description', align: 'center', children: t('dyn_session_management.revoke_access_view.description') }) }), jsxRuntime.jsxs("div", { className: 'revoke-access-view__footer', children: [jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'danger', buttonPadding: 'small', onClick: handleRevoke, dataTestId: 'revoke-access-confirm-button', copykey: 'dyn_session_management.revoke_access_view.revoke_button', expanded: true, children: t('dyn_session_management.revoke_access_view.revoke_button') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'small', onClick: handleCancel, dataTestId: 'revoke-access-cancel-button', copykey: 'dyn_session_management.revoke_access_view.cancel_button', expanded: true, children: t('dyn_session_management.revoke_access_view.cancel_button') })] })] }));
35
+ };
36
+
37
+ exports.RevokeAccessView = RevokeAccessView;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const RevokeAccessView: FC;
@@ -0,0 +1,33 @@
1
+ 'use client'
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { ModalHeader } from '../../../../../components/ModalHeader/ModalHeader.js';
5
+ import { Typography } from '../../../../../components/Typography/Typography.js';
6
+ import { IconButton } from '../../../../../components/IconButton/IconButton.js';
7
+ import { useWidgetContext } from '../../../context/DynamicWidgetContext.js';
8
+ import 'react';
9
+ import { ReactComponent as SvgClose } from '../../../../../shared/assets/close.js';
10
+ import '@dynamic-labs/iconic';
11
+ import '../../../../../context/ViewContext/ViewContext.js';
12
+ import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
13
+
14
+ const RevokeAccessView = () => {
15
+ const { t } = useTranslation();
16
+ const { setDynamicWidgetView } = useWidgetContext();
17
+ const handleCancel = () => {
18
+ setDynamicWidgetView('session-management');
19
+ };
20
+ const handleRevoke = () => {
21
+ // TODO: Implement revoke logic
22
+ setDynamicWidgetView('session-management', {
23
+ bannerMessage: {
24
+ message: 'revoked',
25
+ type: 'success',
26
+ },
27
+ });
28
+ };
29
+ const renderCloseButton = () => (jsx(IconButton, { onClick: handleCancel, "aria-label": t('dyn_session_management.aria.close_button_label'), children: jsx(SvgClose, {}) }));
30
+ return (jsxs("div", { className: 'revoke-access-view', children: [jsx(ModalHeader, { trailing: renderCloseButton(), children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.revoke_access_view.title', children: t('dyn_session_management.revoke_access_view.title') }) }), jsx("div", { className: 'revoke-access-view__body', children: jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_session_management.revoke_access_view.description', align: 'center', children: t('dyn_session_management.revoke_access_view.description') }) }), jsxs("div", { className: 'revoke-access-view__footer', children: [jsx(TypographyButton, { buttonVariant: 'danger', buttonPadding: 'small', onClick: handleRevoke, dataTestId: 'revoke-access-confirm-button', copykey: 'dyn_session_management.revoke_access_view.revoke_button', expanded: true, children: t('dyn_session_management.revoke_access_view.revoke_button') }), jsx(TypographyButton, { buttonPadding: 'small', onClick: handleCancel, dataTestId: 'revoke-access-cancel-button', copykey: 'dyn_session_management.revoke_access_view.cancel_button', expanded: true, children: t('dyn_session_management.revoke_access_view.cancel_button') })] })] }));
31
+ };
32
+
33
+ export { RevokeAccessView };
@@ -0,0 +1 @@
1
+ export * from './RevokeAccessView';
@@ -0,0 +1,30 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
8
+ var reactI18next = require('react-i18next');
9
+ var Typography = require('../../../../../components/Typography/Typography.cjs');
10
+ var TypographyButton = require('../../../../../components/TypographyButton/TypographyButton.cjs');
11
+ var IconButton = require('../../../../../components/IconButton/IconButton.cjs');
12
+ var chevronDown = require('../../../../../shared/assets/chevron-down.cjs');
13
+ require('@dynamic-labs/iconic');
14
+ require('../../../../../context/ViewContext/ViewContext.cjs');
15
+
16
+ const SessionListItem = ({ session, onRevokeAccessClick, }) => {
17
+ const { t } = reactI18next.useTranslation();
18
+ const [isExpanded, setIsExpanded] = React.useState(false);
19
+ const handleRevokeAccess = React.useCallback(() => {
20
+ onRevokeAccessClick(session.sessionId);
21
+ }, [onRevokeAccessClick, session.sessionId]);
22
+ const toggleExpanded = React.useCallback(() => {
23
+ setIsExpanded((prev) => !prev);
24
+ }, []);
25
+ return (jsxRuntime.jsxs("div", { className: 'session-management-session', children: [jsxRuntime.jsxs("div", { className: 'session-management-session__main', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', children: session.site }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleRevokeAccess, children: t('dyn_session_management.session_component.revoke_button') })] }), jsxRuntime.jsxs("div", { className: 'session-management-session__permissions-toggle', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: t('dyn_session_management.session_component.permission_details') }), jsxRuntime.jsx(IconButton.IconButton, { onClick: toggleExpanded, "aria-label": t(isExpanded
26
+ ? 'dyn_session_management.session_component.aria.collapse_permissions'
27
+ : 'dyn_session_management.session_component.aria.expand_permissions'), className: 'session-management-session__icon-button', children: jsxRuntime.jsx(chevronDown.ReactComponent, {}) })] }), isExpanded && (jsxRuntime.jsx("div", { className: 'session-management-session__permissions', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'bold', children: "TODO: Add permission details" }) }))] }));
28
+ };
29
+
30
+ exports.SessionListItem = SessionListItem;
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ interface SessionListItemProps {
3
+ session: {
4
+ sessionId: string;
5
+ site?: string;
6
+ };
7
+ onRevokeAccessClick: (sessionId: string) => void;
8
+ }
9
+ export declare const SessionListItem: FC<SessionListItemProps>;
10
+ export {};
@@ -0,0 +1,26 @@
1
+ 'use client'
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useState, useCallback } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Typography } from '../../../../../components/Typography/Typography.js';
6
+ import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
7
+ import { IconButton } from '../../../../../components/IconButton/IconButton.js';
8
+ import { ReactComponent as SvgChevronDown } from '../../../../../shared/assets/chevron-down.js';
9
+ import '@dynamic-labs/iconic';
10
+ import '../../../../../context/ViewContext/ViewContext.js';
11
+
12
+ const SessionListItem = ({ session, onRevokeAccessClick, }) => {
13
+ const { t } = useTranslation();
14
+ const [isExpanded, setIsExpanded] = useState(false);
15
+ const handleRevokeAccess = useCallback(() => {
16
+ onRevokeAccessClick(session.sessionId);
17
+ }, [onRevokeAccessClick, session.sessionId]);
18
+ const toggleExpanded = useCallback(() => {
19
+ setIsExpanded((prev) => !prev);
20
+ }, []);
21
+ return (jsxs("div", { className: 'session-management-session', children: [jsxs("div", { className: 'session-management-session__main', children: [jsx(Typography, { variant: 'body_normal', children: session.site }), jsx(TypographyButton, { onClick: handleRevokeAccess, children: t('dyn_session_management.session_component.revoke_button') })] }), jsxs("div", { className: 'session-management-session__permissions-toggle', children: [jsx(Typography, { variant: 'body_small', children: t('dyn_session_management.session_component.permission_details') }), jsx(IconButton, { onClick: toggleExpanded, "aria-label": t(isExpanded
22
+ ? 'dyn_session_management.session_component.aria.collapse_permissions'
23
+ : 'dyn_session_management.session_component.aria.expand_permissions'), className: 'session-management-session__icon-button', children: jsx(SvgChevronDown, {}) })] }), isExpanded && (jsx("div", { className: 'session-management-session__permissions', children: jsx(Typography, { variant: 'body_small', weight: 'bold', children: "TODO: Add permission details" }) }))] }));
24
+ };
25
+
26
+ export { SessionListItem };
@@ -0,0 +1 @@
1
+ export * from './SessionListItem';
@@ -0,0 +1,28 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
8
+ var reactI18next = require('react-i18next');
9
+ var ModalHeader = require('../../../../../components/ModalHeader/ModalHeader.cjs');
10
+ var Typography = require('../../../../../components/Typography/Typography.cjs');
11
+ var DynamicWidgetContext = require('../../../context/DynamicWidgetContext.cjs');
12
+ var chevronLeft = require('../../../../../shared/assets/chevron-left.cjs');
13
+ require('@dynamic-labs/iconic');
14
+ require('../../../../../context/ViewContext/ViewContext.cjs');
15
+ var IconButton = require('../../../../../components/IconButton/IconButton.cjs');
16
+ var TypographyButton = require('../../../../../components/TypographyButton/TypographyButton.cjs');
17
+
18
+ const SessionManagementInfoView = () => {
19
+ const { t } = reactI18next.useTranslation();
20
+ const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
21
+ const handleBack = React.useCallback(() => {
22
+ setDynamicWidgetView('session-management');
23
+ }, [setDynamicWidgetView]);
24
+ const renderBackButton = () => (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleBack, "aria-label": t('dyn_session_management.aria.back_button_label'), children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
25
+ return (jsxRuntime.jsxs("div", { className: 'session-management-info-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: renderBackButton(), children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', children: t('dyn_session_management.info_view.title') }) }), jsxRuntime.jsxs("div", { className: 'session-management-info-view__body', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', as: 'span', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', as: 'span', children: t('dyn_session_management.info_view.description_bold') }), t('dyn_session_management.info_view.description_2')] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', as: 'p', children: t('dyn_session_management.info_view.description_3') })] }), jsxRuntime.jsx("div", { className: 'session-management-info-view__footer', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: handleBack, expanded: true, copykey: 'dyn_session_management.info_view.continue_button', children: t('dyn_session_management.info_view.continue_button') }) })] }));
26
+ };
27
+
28
+ exports.SessionManagementInfoView = SessionManagementInfoView;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const SessionManagementInfoView: FC;
@@ -0,0 +1,24 @@
1
+ 'use client'
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useCallback } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { ModalHeader } from '../../../../../components/ModalHeader/ModalHeader.js';
6
+ import { Typography } from '../../../../../components/Typography/Typography.js';
7
+ import { useWidgetContext } from '../../../context/DynamicWidgetContext.js';
8
+ import { ReactComponent as SvgChevronLeft } from '../../../../../shared/assets/chevron-left.js';
9
+ import '@dynamic-labs/iconic';
10
+ import '../../../../../context/ViewContext/ViewContext.js';
11
+ import { IconButton } from '../../../../../components/IconButton/IconButton.js';
12
+ import { TypographyButton } from '../../../../../components/TypographyButton/TypographyButton.js';
13
+
14
+ const SessionManagementInfoView = () => {
15
+ const { t } = useTranslation();
16
+ const { setDynamicWidgetView } = useWidgetContext();
17
+ const handleBack = useCallback(() => {
18
+ setDynamicWidgetView('session-management');
19
+ }, [setDynamicWidgetView]);
20
+ const renderBackButton = () => (jsx(IconButton, { onClick: handleBack, "aria-label": t('dyn_session_management.aria.back_button_label'), children: jsx(SvgChevronLeft, {}) }));
21
+ return (jsxs("div", { className: 'session-management-info-view', children: [jsx(ModalHeader, { leading: renderBackButton(), children: jsx(Typography, { variant: 'title', color: 'primary', children: t('dyn_session_management.info_view.title') }) }), jsxs("div", { className: 'session-management-info-view__body', children: [jsxs(Typography, { variant: 'body_normal', as: 'span', children: [jsx(Typography, { variant: 'body_normal', weight: 'bold', as: 'span', children: t('dyn_session_management.info_view.description_bold') }), t('dyn_session_management.info_view.description_2')] }), jsx(Typography, { variant: 'body_normal', as: 'p', children: t('dyn_session_management.info_view.description_3') })] }), jsx("div", { className: 'session-management-info-view__footer', children: jsx(TypographyButton, { onClick: handleBack, expanded: true, copykey: 'dyn_session_management.info_view.continue_button', children: t('dyn_session_management.info_view.continue_button') }) })] }));
22
+ };
23
+
24
+ export { SessionManagementInfoView };
@@ -0,0 +1 @@
1
+ export * from './SessionManagementInfoView';
@@ -0,0 +1,56 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
8
+ var reactI18next = require('react-i18next');
9
+ var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
10
+ var footerInfoIcon = require('../../../../shared/assets/footer-info-icon.cjs');
11
+ require('@dynamic-labs/iconic');
12
+ require('../../../../context/ViewContext/ViewContext.cjs');
13
+ var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
14
+ var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
15
+ var Typography = require('../../../../components/Typography/Typography.cjs');
16
+ var IconButton = require('../../../../components/IconButton/IconButton.cjs');
17
+ var ErrorContainer = require('../../../../components/ErrorContainer/ErrorContainer.cjs');
18
+ var EmptySessionsView = require('./EmptySessionsView/EmptySessionsView.cjs');
19
+ var SessionListItem = require('./SessionListItem/SessionListItem.cjs');
20
+
21
+ const SessionManagementView = ({ bannerMessage, }) => {
22
+ const { t } = reactI18next.useTranslation();
23
+ const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
24
+ const sessions = React.useMemo(() => [
25
+ {
26
+ expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24),
27
+ permissions: [],
28
+ sessionId: '1',
29
+ site: 'app.lumfi.xyz',
30
+ url: 'https://app.lumfi.xyz',
31
+ },
32
+ {
33
+ expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24),
34
+ permissions: [],
35
+ sessionId: '2',
36
+ site: 'app.sophon.xyz',
37
+ url: 'https://app.sophon.xyz',
38
+ },
39
+ ], []);
40
+ const handleBackButtonClick = React.useCallback(() => {
41
+ setDynamicWidgetView('account-and-security-settings');
42
+ }, [setDynamicWidgetView]);
43
+ const handleInfoButtonClick = React.useCallback(() => {
44
+ setDynamicWidgetView('session-management-info');
45
+ }, [setDynamicWidgetView]);
46
+ const handleRevokeAccessClick = React.useCallback((sessionId) => {
47
+ setDynamicWidgetView('session-management-revoke-access', {
48
+ sessionId,
49
+ });
50
+ }, [setDynamicWidgetView]);
51
+ const renderBackButton = () => (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleBackButtonClick, "aria-label": t('dyn_session_management.aria.back_button_label'), children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
52
+ const renderInfoButton = () => (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleInfoButtonClick, "aria-label": t('dyn_session_management.aria.info_button_label'), children: jsxRuntime.jsx(footerInfoIcon.ReactComponent, {}) }));
53
+ return (jsxRuntime.jsxs("div", { className: 'session-management-view', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: renderBackButton(), trailing: renderInfoButton(), displayBorder: true, variant: 'filled', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.title', children: t('dyn_session_management.title') }) }), jsxRuntime.jsx("div", { className: 'session-management-view__banner', children: bannerMessage && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { variant: bannerMessage.type, withIcon: false, children: bannerMessage.message })) }), jsxRuntime.jsx("div", { className: 'session-management-view__body', children: sessions.length === 0 ? (jsxRuntime.jsx(EmptySessionsView.EmptySessionsView, {})) : (jsxRuntime.jsx("div", { className: 'session-management-view__sessions-container', children: sessions.map((session) => (jsxRuntime.jsx(SessionListItem.SessionListItem, { session: session, onRevokeAccessClick: handleRevokeAccessClick }, session.sessionId))) })) })] }));
54
+ };
55
+
56
+ exports.SessionManagementView = SessionManagementView;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ export interface SessionManagementViewProps {
3
+ bannerMessage?: {
4
+ type: 'success' | 'error';
5
+ message: string;
6
+ };
7
+ }
8
+ export declare const SessionManagementView: FC<SessionManagementViewProps>;
@@ -0,0 +1,52 @@
1
+ 'use client'
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useMemo, useCallback } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
6
+ import { ReactComponent as SvgFooterInfoIcon } from '../../../../shared/assets/footer-info-icon.js';
7
+ import '@dynamic-labs/iconic';
8
+ import '../../../../context/ViewContext/ViewContext.js';
9
+ import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
10
+ import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
11
+ import { Typography } from '../../../../components/Typography/Typography.js';
12
+ import { IconButton } from '../../../../components/IconButton/IconButton.js';
13
+ import { ErrorContainer } from '../../../../components/ErrorContainer/ErrorContainer.js';
14
+ import { EmptySessionsView } from './EmptySessionsView/EmptySessionsView.js';
15
+ import { SessionListItem } from './SessionListItem/SessionListItem.js';
16
+
17
+ const SessionManagementView = ({ bannerMessage, }) => {
18
+ const { t } = useTranslation();
19
+ const { setDynamicWidgetView } = useWidgetContext();
20
+ const sessions = useMemo(() => [
21
+ {
22
+ expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24),
23
+ permissions: [],
24
+ sessionId: '1',
25
+ site: 'app.lumfi.xyz',
26
+ url: 'https://app.lumfi.xyz',
27
+ },
28
+ {
29
+ expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24),
30
+ permissions: [],
31
+ sessionId: '2',
32
+ site: 'app.sophon.xyz',
33
+ url: 'https://app.sophon.xyz',
34
+ },
35
+ ], []);
36
+ const handleBackButtonClick = useCallback(() => {
37
+ setDynamicWidgetView('account-and-security-settings');
38
+ }, [setDynamicWidgetView]);
39
+ const handleInfoButtonClick = useCallback(() => {
40
+ setDynamicWidgetView('session-management-info');
41
+ }, [setDynamicWidgetView]);
42
+ const handleRevokeAccessClick = useCallback((sessionId) => {
43
+ setDynamicWidgetView('session-management-revoke-access', {
44
+ sessionId,
45
+ });
46
+ }, [setDynamicWidgetView]);
47
+ const renderBackButton = () => (jsx(IconButton, { onClick: handleBackButtonClick, "aria-label": t('dyn_session_management.aria.back_button_label'), children: jsx(SvgChevronLeft, {}) }));
48
+ const renderInfoButton = () => (jsx(IconButton, { onClick: handleInfoButtonClick, "aria-label": t('dyn_session_management.aria.info_button_label'), children: jsx(SvgFooterInfoIcon, {}) }));
49
+ return (jsxs("div", { className: 'session-management-view', children: [jsx(ModalHeader, { leading: renderBackButton(), trailing: renderInfoButton(), displayBorder: true, variant: 'filled', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_session_management.title', children: t('dyn_session_management.title') }) }), jsx("div", { className: 'session-management-view__banner', children: bannerMessage && (jsx(ErrorContainer, { variant: bannerMessage.type, withIcon: false, children: bannerMessage.message })) }), jsx("div", { className: 'session-management-view__body', children: sessions.length === 0 ? (jsx(EmptySessionsView, {})) : (jsx("div", { className: 'session-management-view__sessions-container', children: sessions.map((session) => (jsx(SessionListItem, { session: session, onRevokeAccessClick: handleRevokeAccessClick }, session.sessionId))) })) })] }));
50
+ };
51
+
52
+ export { SessionManagementView };
@@ -0,0 +1 @@
1
+ export * from './SessionManagementView';
@@ -37,6 +37,7 @@ require('../../../../locale/locale.cjs');
37
37
  require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
38
38
  require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
39
39
  require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
40
+ var isZKSyncEnabled = require('../../../../utils/functions/isZKSyncEnabled/isZKSyncEnabled.cjs');
40
41
  require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
41
42
  require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
42
43
  require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
@@ -135,7 +136,10 @@ const SettingsView = () => {
135
136
  const isV3WaasWallet = Boolean(wallet &&
136
137
  ((_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
138
  (wallet === null || wallet === void 0 ? void 0 : wallet.chain) === 'EVM');
138
- const shouldShowAccountAndSecuritySettings = isMfaEnabled || isEmbeddedWallet || isV3WaasWallet;
139
+ const shouldShowAccountAndSecuritySettings = isMfaEnabled ||
140
+ isEmbeddedWallet ||
141
+ isV3WaasWallet ||
142
+ isZKSyncEnabled.isZKSyncEnabled(projectSettings$1);
139
143
  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') }) }))] }));
140
144
  };
141
145
 
@@ -33,6 +33,7 @@ import '../../../../locale/locale.js';
33
33
  import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
34
34
  import '../../../../store/state/primaryWalletId/primaryWalletId.js';
35
35
  import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
36
+ import { isZKSyncEnabled } from '../../../../utils/functions/isZKSyncEnabled/isZKSyncEnabled.js';
36
37
  import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
37
38
  import '../../../../context/AccountExistsContext/AccountExistsContext.js';
38
39
  import '../../../../context/UserWalletsContext/UserWalletsContext.js';
@@ -131,7 +132,10 @@ const SettingsView = () => {
131
132
  const isV3WaasWallet = Boolean(wallet &&
132
133
  ((_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
134
  (wallet === null || wallet === void 0 ? void 0 : wallet.chain) === 'EVM');
134
- const shouldShowAccountAndSecuritySettings = isMfaEnabled || isEmbeddedWallet || isV3WaasWallet;
135
+ const shouldShowAccountAndSecuritySettings = isMfaEnabled ||
136
+ isEmbeddedWallet ||
137
+ isV3WaasWallet ||
138
+ isZKSyncEnabled(projectSettings);
135
139
  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') }) }))] }));
136
140
  };
137
141
 
@@ -5,3 +5,4 @@ export { SendBalanceWidgetView } from './SendBalanceWidgetView';
5
5
  export { ManagePasskeysWidgetView } from './ManagePasskeysWidgetView';
6
6
  export { SettingsView } from './SettingsView';
7
7
  export { AccountAndSecuritySettingsView } from './AccountAndSecuritySettingsView';
8
+ export { SessionManagementView } from './SessionManagementView';