@dynamic-labs/sdk-react-core 1.2.0-alpha.0 → 2.0.0-alpha.0

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 (77) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +10 -10
  5. package/src/index.cjs +1 -0
  6. package/src/index.js +1 -1
  7. package/src/lib/components/Badge/Badge.cjs +1 -1
  8. package/src/lib/components/Badge/Badge.d.ts +1 -1
  9. package/src/lib/components/Badge/Badge.js +1 -1
  10. package/src/lib/components/Badge/Badge.types.d.ts +1 -0
  11. package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +2 -13
  12. package/src/lib/components/IconWithSpinner/IconWithSpinner.js +2 -13
  13. package/src/lib/context/DynamicContext/DynamicContext.cjs +4 -2
  14. package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -1
  15. package/src/lib/context/DynamicContext/DynamicContext.js +5 -3
  16. package/src/lib/context/DynamicContext/types/index.d.ts +4 -2
  17. package/src/lib/locale/en/translation.cjs +8 -0
  18. package/src/lib/locale/en/translation.d.ts +8 -0
  19. package/src/lib/locale/en/translation.js +8 -0
  20. package/src/lib/main.global.cjs +1 -1
  21. package/src/lib/main.global.js +1 -1
  22. package/src/lib/shared/types/index.d.ts +5 -1
  23. package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs +23 -10
  24. package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.d.ts +7 -3
  25. package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.js +23 -10
  26. package/src/lib/styles/index.shadow.cjs +1 -1
  27. package/src/lib/styles/index.shadow.js +1 -1
  28. package/src/lib/utils/functions/walletFilters/index.cjs +6 -0
  29. package/src/lib/utils/functions/walletFilters/index.d.ts +5 -0
  30. package/src/lib/utils/functions/walletFilters/index.js +6 -1
  31. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +30 -8
  32. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.d.ts +3 -2
  33. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +30 -8
  34. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +1 -6
  35. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +1 -6
  36. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +9 -15
  37. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +10 -16
  38. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +21 -19
  39. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.d.ts +5 -1
  40. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +22 -20
  41. package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
  42. package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
  43. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +2 -1
  44. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +2 -1
  45. package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.cjs +21 -8
  46. package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.js +21 -8
  47. package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.cjs +1 -1
  48. package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.js +1 -1
  49. package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.cjs +3 -1
  50. package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.js +3 -1
  51. package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +3 -0
  52. package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +3 -0
  53. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +20 -1
  54. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.d.ts +2 -1
  55. package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +20 -2
  56. package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +6 -3
  57. package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.js +6 -3
  58. package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +4 -4
  59. package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +4 -4
  60. package/src/lib/views/WalletList/WalletList.cjs +12 -19
  61. package/src/lib/views/WalletList/WalletList.js +13 -20
  62. package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +5 -4
  63. package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +5 -4
  64. package/src/lib/views/WalletList/WalletListItem/WalletListItem.types.d.ts +2 -1
  65. package/src/lib/views/WalletList/hooks/useTabState.cjs +87 -0
  66. package/src/lib/views/WalletList/hooks/useTabState.d.ts +7 -0
  67. package/src/lib/views/WalletList/hooks/useTabState.js +83 -0
  68. package/src/lib/views/WalletList/utils/getEffectiveRecommendedWallets.cjs +12 -0
  69. package/src/lib/views/WalletList/utils/getEffectiveRecommendedWallets.d.ts +3 -0
  70. package/src/lib/views/WalletList/utils/getEffectiveRecommendedWallets.js +8 -0
  71. package/src/lib/views/WalletList/utils/getEffectiveWalletFilter.cjs +12 -0
  72. package/src/lib/views/WalletList/utils/getEffectiveWalletFilter.d.ts +2 -0
  73. package/src/lib/views/WalletList/utils/getEffectiveWalletFilter.js +8 -0
  74. package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -1
  75. package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -1
  76. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +10 -5
  77. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.js +10 -5
@@ -79,6 +79,24 @@ require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/Secon
79
79
  var EmbeddedAuthChoiceCards = require('../EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.cjs');
80
80
  var AuthChoiceInfo = require('./AuthChoiceInfo/AuthChoiceInfo.cjs');
81
81
 
82
+ const titleDescriptionMap = {
83
+ helpSession: {
84
+ description: 'dyn_embedded_authenticator.need_help_description',
85
+ title: 'dyn_embedded_authenticator.need_help_title',
86
+ },
87
+ reveal: {
88
+ description: 'dyn_embedded_authenticator.reveal_description',
89
+ title: 'dyn_embedded_authenticator.reveal_title',
90
+ },
91
+ sendTransaction: {
92
+ description: 'dyn_embedded_authenticator.description',
93
+ title: 'dyn_embedded_authenticator.title',
94
+ },
95
+ signMessage: {
96
+ description: 'dyn_embedded_authenticator.description',
97
+ title: 'dyn_embedded_authenticator.title',
98
+ },
99
+ };
82
100
  const EmbeddedAuthChoice = ({ currentAction, }) => {
83
101
  const { t } = reactI18next.useTranslation();
84
102
  const { primaryWallet, projectSettings, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
@@ -88,7 +106,7 @@ const EmbeddedAuthChoice = ({ currentAction, }) => {
88
106
  var _a;
89
107
  const supportedAuths = getEnabledEmbeddedWalletsAuthenticators.getEnabledEmbeddedWalletsAuthenticators((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _a === void 0 ? void 0 : _a.supportedSecurityMethods);
90
108
  const supportedMethods = Object.keys(supportedAuths);
91
- if (currentAction !== 'helpSession') {
109
+ if (!currentAction || !['helpSession', 'reveal'].includes(currentAction)) {
92
110
  return supportedMethods.filter((auth) => auth !== 'email');
93
111
  }
94
112
  return supportedMethods;
@@ -104,18 +122,13 @@ const EmbeddedAuthChoice = ({ currentAction, }) => {
104
122
  const buttonCopyKey = isEmailAuthSessionActive()
105
123
  ? 'dyn_embedded_authenticator.passkey.auth_info.start_button'
106
124
  : 'dyn_embedded_authenticator.passkey.auth_info.add_button';
107
- const title = currentAction === 'helpSession'
108
- ? 'dyn_embedded_authenticator.need_help_title'
109
- : 'dyn_embedded_authenticator.title';
110
- const description = currentAction === 'helpSession'
111
- ? 'dyn_embedded_authenticator.need_help_description'
112
- : 'dyn_embedded_authenticator.description';
125
+ const { title, description } = titleDescriptionMap[currentAction || 'signMessage'];
113
126
  if (!(supportedAuthenticators === null || supportedAuthenticators === void 0 ? void 0 : supportedAuthenticators.length)) {
114
127
  return null;
115
128
  }
116
129
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: title, children: t(title) }) }), jsxRuntime.jsxs("div", { className: 'embedded-auth-choice', children: [jsxRuntime.jsx("div", { className: 'embedded-auth-choice__header', children: renderIcon() }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'embedded-auth-choice__subtitle', copykey: description, children: t(description) }), supportedAuthenticators.length > 1 ? (jsxRuntime.jsx(EmbeddedAuthChoiceCards.EmbeddedAuthChoiceCards, { currentAction: currentAction, supportedAuthenticators: supportedAuthenticators })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(AuthChoiceInfo.AuthChoiceInfo, { choice: 'passkey' }), jsxRuntime.jsx(Button.Button, { dataTestId: 'passkey-only-choice-button', buttonVariant: 'brand-primary', color: 'brand-primary', expanded: true, onClick: () => initPasskeyRecoveryProcess('passkey'), copykey: buttonCopyKey, typographyProps: {
117
130
  color: 'inherit',
118
- }, children: t(buttonCopyKey) })] })), jsxRuntime.jsx(Button.Button, { buttonVariant: 'primary', buttonClassName: 'embedded-auth-choice__skip-button', expanded: true, onClick: () => setShowAuthFlow(false), copykey: 'dyn_embedded_authenticator.skip', children: t('dyn_embedded_authenticator.skip') })] })] }));
131
+ }, children: t(buttonCopyKey) })] })), currentAction !== 'reveal' && (jsxRuntime.jsx(Button.Button, { buttonVariant: 'primary', buttonClassName: 'embedded-auth-choice__skip-button', expanded: true, onClick: () => setShowAuthFlow(false), copykey: 'dyn_embedded_authenticator.skip', children: t('dyn_embedded_authenticator.skip') }))] })] }));
119
132
  };
120
133
 
121
134
  exports.EmbeddedAuthChoice = EmbeddedAuthChoice;
@@ -75,6 +75,24 @@ import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/Second
75
75
  import { EmbeddedAuthChoiceCards } from '../EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.js';
76
76
  import { AuthChoiceInfo } from './AuthChoiceInfo/AuthChoiceInfo.js';
77
77
 
78
+ const titleDescriptionMap = {
79
+ helpSession: {
80
+ description: 'dyn_embedded_authenticator.need_help_description',
81
+ title: 'dyn_embedded_authenticator.need_help_title',
82
+ },
83
+ reveal: {
84
+ description: 'dyn_embedded_authenticator.reveal_description',
85
+ title: 'dyn_embedded_authenticator.reveal_title',
86
+ },
87
+ sendTransaction: {
88
+ description: 'dyn_embedded_authenticator.description',
89
+ title: 'dyn_embedded_authenticator.title',
90
+ },
91
+ signMessage: {
92
+ description: 'dyn_embedded_authenticator.description',
93
+ title: 'dyn_embedded_authenticator.title',
94
+ },
95
+ };
78
96
  const EmbeddedAuthChoice = ({ currentAction, }) => {
79
97
  const { t } = useTranslation();
80
98
  const { primaryWallet, projectSettings, setShowAuthFlow } = useInternalDynamicContext();
@@ -84,7 +102,7 @@ const EmbeddedAuthChoice = ({ currentAction, }) => {
84
102
  var _a;
85
103
  const supportedAuths = getEnabledEmbeddedWalletsAuthenticators((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets) === null || _a === void 0 ? void 0 : _a.supportedSecurityMethods);
86
104
  const supportedMethods = Object.keys(supportedAuths);
87
- if (currentAction !== 'helpSession') {
105
+ if (!currentAction || !['helpSession', 'reveal'].includes(currentAction)) {
88
106
  return supportedMethods.filter((auth) => auth !== 'email');
89
107
  }
90
108
  return supportedMethods;
@@ -100,18 +118,13 @@ const EmbeddedAuthChoice = ({ currentAction, }) => {
100
118
  const buttonCopyKey = isEmailAuthSessionActive()
101
119
  ? 'dyn_embedded_authenticator.passkey.auth_info.start_button'
102
120
  : 'dyn_embedded_authenticator.passkey.auth_info.add_button';
103
- const title = currentAction === 'helpSession'
104
- ? 'dyn_embedded_authenticator.need_help_title'
105
- : 'dyn_embedded_authenticator.title';
106
- const description = currentAction === 'helpSession'
107
- ? 'dyn_embedded_authenticator.need_help_description'
108
- : 'dyn_embedded_authenticator.description';
121
+ const { title, description } = titleDescriptionMap[currentAction || 'signMessage'];
109
122
  if (!(supportedAuthenticators === null || supportedAuthenticators === void 0 ? void 0 : supportedAuthenticators.length)) {
110
123
  return null;
111
124
  }
112
125
  return (jsxs(Fragment, { children: [jsx(ModalHeader, { children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: title, children: t(title) }) }), jsxs("div", { className: 'embedded-auth-choice', children: [jsx("div", { className: 'embedded-auth-choice__header', children: renderIcon() }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'embedded-auth-choice__subtitle', copykey: description, children: t(description) }), supportedAuthenticators.length > 1 ? (jsx(EmbeddedAuthChoiceCards, { currentAction: currentAction, supportedAuthenticators: supportedAuthenticators })) : (jsxs(Fragment, { children: [jsx(AuthChoiceInfo, { choice: 'passkey' }), jsx(Button, { dataTestId: 'passkey-only-choice-button', buttonVariant: 'brand-primary', color: 'brand-primary', expanded: true, onClick: () => initPasskeyRecoveryProcess('passkey'), copykey: buttonCopyKey, typographyProps: {
113
126
  color: 'inherit',
114
- }, children: t(buttonCopyKey) })] })), jsx(Button, { buttonVariant: 'primary', buttonClassName: 'embedded-auth-choice__skip-button', expanded: true, onClick: () => setShowAuthFlow(false), copykey: 'dyn_embedded_authenticator.skip', children: t('dyn_embedded_authenticator.skip') })] })] }));
127
+ }, children: t(buttonCopyKey) })] })), currentAction !== 'reveal' && (jsx(Button, { buttonVariant: 'primary', buttonClassName: 'embedded-auth-choice__skip-button', expanded: true, onClick: () => setShowAuthFlow(false), copykey: 'dyn_embedded_authenticator.skip', children: t('dyn_embedded_authenticator.skip') }))] })] }));
115
128
  };
116
129
 
117
130
  export { EmbeddedAuthChoice };
@@ -46,7 +46,6 @@ require('../../../../components/ShadowDOM/ShadowDOM.cjs');
46
46
  require('../../../../components/OverlayCard/OverlayCard.context.cjs');
47
47
  require('../../../../context/FooterAnimationContext/index.cjs');
48
48
  var Typography = require('../../../../components/Typography/Typography.cjs');
49
- var Badge = require('../../../../components/Badge/Badge.cjs');
50
49
  require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
51
50
  require('../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
52
51
  require('react-focus-lock');
@@ -64,6 +63,7 @@ require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSucces
64
63
  require('../../../../context/PasskeyContext/PasskeyContext.cjs');
65
64
  require('@dynamic-labs/viem-utils');
66
65
  require('../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
66
+ var Badge = require('../../../../components/Badge/Badge.cjs');
67
67
  require('../../../../components/InlineWidget/InlineWidget.cjs');
68
68
  require('../../../../components/IsBrowser/IsBrowser.cjs');
69
69
  require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
@@ -42,7 +42,6 @@ import '../../../../components/ShadowDOM/ShadowDOM.js';
42
42
  import '../../../../components/OverlayCard/OverlayCard.context.js';
43
43
  import '../../../../context/FooterAnimationContext/index.js';
44
44
  import { Typography } from '../../../../components/Typography/Typography.js';
45
- import { Badge } from '../../../../components/Badge/Badge.js';
46
45
  import '../../../../context/WalletGroupContext/WalletGroupContext.js';
47
46
  import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
48
47
  import 'react-focus-lock';
@@ -60,6 +59,7 @@ import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccess
60
59
  import '../../../../context/PasskeyContext/PasskeyContext.js';
61
60
  import '@dynamic-labs/viem-utils';
62
61
  import '../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
62
+ import { Badge } from '../../../../components/Badge/Badge.js';
63
63
  import '../../../../components/InlineWidget/InlineWidget.js';
64
64
  import '../../../../components/IsBrowser/IsBrowser.js';
65
65
  import '../../../../components/MenuList/Dropdown/Dropdown.js';
@@ -99,7 +99,9 @@ const EmbeddedAuthChoiceCards = ({ currentAction, supportedAuthenticators, }) =>
99
99
  description: t('dyn_embedded_authenticator.passkey.description'),
100
100
  descriptionKey: 'dyn_embedded_authenticator.passkey.description',
101
101
  icon: (jsxRuntime.jsx(PasskeyDeviceIcon.PasskeyDeviceIcon, { defaultIcon: jsxRuntime.jsx(androidTouchId.ReactComponent, { "data-testid": 'default-icon' }) })),
102
- titleKey: 'dyn_embedded_authenticator.passkey.title',
102
+ titleKey: currentAction === 'reveal'
103
+ ? 'dyn_embedded_authenticator.passkey.reveal_title'
104
+ : 'dyn_embedded_authenticator.passkey.title',
103
105
  },
104
106
  };
105
107
  const handleSelection = (authenticatorType) => () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -95,7 +95,9 @@ const EmbeddedAuthChoiceCards = ({ currentAction, supportedAuthenticators, }) =>
95
95
  description: t('dyn_embedded_authenticator.passkey.description'),
96
96
  descriptionKey: 'dyn_embedded_authenticator.passkey.description',
97
97
  icon: (jsx(PasskeyDeviceIcon, { defaultIcon: jsx(SvgAndroidTouchId, { "data-testid": 'default-icon' }) })),
98
- titleKey: 'dyn_embedded_authenticator.passkey.title',
98
+ titleKey: currentAction === 'reveal'
99
+ ? 'dyn_embedded_authenticator.passkey.reveal_title'
100
+ : 'dyn_embedded_authenticator.passkey.title',
99
101
  },
100
102
  };
101
103
  const handleSelection = (authenticatorType) => () => __awaiter(void 0, void 0, void 0, function* () {
@@ -112,6 +112,9 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
112
112
  if (authenticatorType === 'passkey') {
113
113
  return setView('passkey-recovery-complete');
114
114
  }
115
+ if (currentAction === 'reveal') {
116
+ return;
117
+ }
115
118
  setShowAuthFlow(false);
116
119
  }, 2000);
117
120
  }));
@@ -108,6 +108,9 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
108
108
  if (authenticatorType === 'passkey') {
109
109
  return setView('passkey-recovery-complete');
110
110
  }
111
+ if (currentAction === 'reveal') {
112
+ return;
113
+ }
111
114
  setShowAuthFlow(false);
112
115
  }, 2000);
113
116
  }));
@@ -217,6 +217,24 @@ const addNewPasskeyAuthenticator = ({ authToken, userEmail, environmentId, walle
217
217
  jwt,
218
218
  };
219
219
  });
220
+ const canRestoreEmbeddedWalletSession = (sessionExpirationTime) => {
221
+ if (!(sessionExpirationTime === null || sessionExpirationTime === void 0 ? void 0 : sessionExpirationTime.amount)) {
222
+ return false;
223
+ }
224
+ const sessionSettings = localStorage.LocalStorage.getFromLS(localStorage$1.EMBEDDED_WALLET_SESSION_SETTINGS);
225
+ if (!sessionSettings) {
226
+ return false;
227
+ }
228
+ const sessionExpiration = sessionExpirationTime.amount *
229
+ (sessionExpirationTime.unit === 'minutes' ? 60 : 3600);
230
+ const recoveryExpirationSeconds = (sessionSettings === null || sessionSettings === void 0 ? void 0 : sessionSettings.createdAt) + sessionExpiration * 1000;
231
+ const expirationTime = new Date(recoveryExpirationSeconds);
232
+ if (new Date() >= expirationTime) {
233
+ localStorage.LocalStorage.removeFromLS(localStorage$1.EMBEDDED_WALLET_SESSION_SETTINGS);
234
+ return false;
235
+ }
236
+ return true;
237
+ };
220
238
  const restoreEmbeddedWalletSession = ({ authToken, iframeContainer, iframeElementId, wallet, sessionExpiration, }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
221
239
  var _o, _p, _q, _r;
222
240
  if (!authToken) {
@@ -238,7 +256,7 @@ const restoreEmbeddedWalletSession = ({ authToken, iframeContainer, iframeElemen
238
256
  }
239
257
  const publicKey = yield turnkeyRecoveryHandler.initRecovery('email', iframeContainer, iframeElementId, sessionExpiration);
240
258
  if (!publicKey) {
241
- throw new utils.DynamicError('Something went wrong');
259
+ throw new utils.DynamicError('Could not open embedded wallet connection communication');
242
260
  }
243
261
  turnkeyRecoveryHandler.recoveryUserId = sessionSettings.userId;
244
262
  const organizationId = (_r = (_q = (_p = decodedJwt.verifiedCredentials) === null || _p === void 0 ? void 0 : _p.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _q === void 0 ? void 0 : _q.walletProperties) === null || _r === void 0 ? void 0 : _r.turnkeySubOrganizationId;
@@ -247,6 +265,7 @@ const restoreEmbeddedWalletSession = ({ authToken, iframeContainer, iframeElemen
247
265
  });
248
266
 
249
267
  exports.addNewPasskeyAuthenticator = addNewPasskeyAuthenticator;
268
+ exports.canRestoreEmbeddedWalletSession = canRestoreEmbeddedWalletSession;
250
269
  exports.completePasskeyRecovery = completePasskeyRecovery;
251
270
  exports.initEmbeddedWalletSession = initEmbeddedWalletSession;
252
271
  exports.passkeyRecoveryBundleValidation = passkeyRecoveryBundleValidation;
@@ -1,5 +1,5 @@
1
1
  import { AuthenticatorType } from '@dynamic-labs/wallet-connector-core';
2
- import { DynamicJwt, InitEmailAuthResponse, InitPasskeyRecoveryResponse } from '@dynamic-labs/sdk-api';
2
+ import { Duration, DynamicJwt, InitEmailAuthResponse, InitPasskeyRecoveryResponse } from '@dynamic-labs/sdk-api';
3
3
  import { Wallet } from '../../../../shared';
4
4
  export declare const initEmbeddedWalletSession: ({ authenticatorType, authToken, iframeContainer, iframeElementId, environmentId, userEmail, wallet, sessionExpiration, }: {
5
5
  authenticatorType: AuthenticatorType;
@@ -43,6 +43,7 @@ export declare const addNewPasskeyAuthenticator: ({ authToken, userEmail, enviro
43
43
  decodedJwt: Omit<DynamicJwt, "jwt">;
44
44
  jwt: string;
45
45
  }>;
46
+ export declare const canRestoreEmbeddedWalletSession: (sessionExpirationTime: Duration | undefined) => boolean;
46
47
  export declare const restoreEmbeddedWalletSession: ({ authToken, iframeContainer, iframeElementId, wallet, sessionExpiration, }: {
47
48
  authToken: string | undefined;
48
49
  iframeContainer: HTMLElement;
@@ -213,6 +213,24 @@ const addNewPasskeyAuthenticator = ({ authToken, userEmail, environmentId, walle
213
213
  jwt,
214
214
  };
215
215
  });
216
+ const canRestoreEmbeddedWalletSession = (sessionExpirationTime) => {
217
+ if (!(sessionExpirationTime === null || sessionExpirationTime === void 0 ? void 0 : sessionExpirationTime.amount)) {
218
+ return false;
219
+ }
220
+ const sessionSettings = LocalStorage.getFromLS(EMBEDDED_WALLET_SESSION_SETTINGS);
221
+ if (!sessionSettings) {
222
+ return false;
223
+ }
224
+ const sessionExpiration = sessionExpirationTime.amount *
225
+ (sessionExpirationTime.unit === 'minutes' ? 60 : 3600);
226
+ const recoveryExpirationSeconds = (sessionSettings === null || sessionSettings === void 0 ? void 0 : sessionSettings.createdAt) + sessionExpiration * 1000;
227
+ const expirationTime = new Date(recoveryExpirationSeconds);
228
+ if (new Date() >= expirationTime) {
229
+ LocalStorage.removeFromLS(EMBEDDED_WALLET_SESSION_SETTINGS);
230
+ return false;
231
+ }
232
+ return true;
233
+ };
216
234
  const restoreEmbeddedWalletSession = ({ authToken, iframeContainer, iframeElementId, wallet, sessionExpiration, }) => __awaiter(void 0, void 0, void 0, function* () {
217
235
  var _o, _p, _q, _r;
218
236
  if (!authToken) {
@@ -234,7 +252,7 @@ const restoreEmbeddedWalletSession = ({ authToken, iframeContainer, iframeElemen
234
252
  }
235
253
  const publicKey = yield turnkeyRecoveryHandler.initRecovery('email', iframeContainer, iframeElementId, sessionExpiration);
236
254
  if (!publicKey) {
237
- throw new DynamicError('Something went wrong');
255
+ throw new DynamicError('Could not open embedded wallet connection communication');
238
256
  }
239
257
  turnkeyRecoveryHandler.recoveryUserId = sessionSettings.userId;
240
258
  const organizationId = (_r = (_q = (_p = decodedJwt.verifiedCredentials) === null || _p === void 0 ? void 0 : _p.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey'))) === null || _q === void 0 ? void 0 : _q.walletProperties) === null || _r === void 0 ? void 0 : _r.turnkeySubOrganizationId;
@@ -242,4 +260,4 @@ const restoreEmbeddedWalletSession = ({ authToken, iframeContainer, iframeElemen
242
260
  return true;
243
261
  });
244
262
 
245
- export { addNewPasskeyAuthenticator, completePasskeyRecovery, initEmbeddedWalletSession, passkeyRecoveryBundleValidation, resentRecoveryEmail, restoreEmbeddedWalletSession };
263
+ export { addNewPasskeyAuthenticator, canRestoreEmbeddedWalletSession, completePasskeyRecovery, initEmbeddedWalletSession, passkeyRecoveryBundleValidation, resentRecoveryEmail, restoreEmbeddedWalletSession };
@@ -24,6 +24,7 @@ var pixelToRem = require('../../../../utils/functions/pixelToRem/pixelToRem.cjs'
24
24
  require('viem/chains');
25
25
  require('../../../../events/dynamicEvents.cjs');
26
26
  require('../../../../context/DynamicContext/DynamicContext.cjs');
27
+ var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
27
28
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
28
29
  require('../../../../context/ErrorContext/ErrorContext.cjs');
29
30
  require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
@@ -47,7 +48,6 @@ require('../../../../components/ShadowDOM/ShadowDOM.cjs');
47
48
  require('../../../../components/OverlayCard/OverlayCard.context.cjs');
48
49
  require('../../../../context/FooterAnimationContext/index.cjs');
49
50
  var Typography = require('../../../../components/Typography/Typography.cjs');
50
- var Badge = require('../../../../components/Badge/Badge.cjs');
51
51
  require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
52
52
  var ListTileAnimatedTrailing = require('../../../../components/ListTileAnimatedTrailing/ListTileAnimatedTrailing.cjs');
53
53
  require('../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
@@ -65,6 +65,7 @@ require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSucces
65
65
  require('../../../../context/PasskeyContext/PasskeyContext.cjs');
66
66
  require('@dynamic-labs/viem-utils');
67
67
  require('../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
68
+ var Badge = require('../../../../components/Badge/Badge.cjs');
68
69
  var ListTile = require('../../../../components/ListTile/ListTile.cjs');
69
70
  require('../../../../components/InlineWidget/InlineWidget.cjs');
70
71
  require('../../../../components/IsBrowser/IsBrowser.cjs');
@@ -77,18 +78,20 @@ require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
77
78
  require('../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
78
79
 
79
80
  const WalletGroupItem = ({ groupKey, wallet, onClick, }) => {
81
+ const { recommendedWallets } = useInternalDynamicContext.useInternalDynamicContext();
80
82
  const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
81
83
  const walletOverride = walletBook.findWalletGroupOverride(walletBook$1, groupKey, wallet.key);
82
84
  const walletData = walletBook.findWalletBookWallet(walletBook$1, wallet.key);
83
85
  const brand = (walletOverride === null || walletOverride === void 0 ? void 0 : walletOverride.brand) || (walletData === null || walletData === void 0 ? void 0 : walletData.brand);
84
86
  const name = (walletOverride === null || walletOverride === void 0 ? void 0 : walletOverride.name) || (walletData === null || walletData === void 0 ? void 0 : walletData.name);
85
87
  const icon = brand ? (jsxRuntime.jsx(walletBook.BrandIcon, { brand: brand, walletKey: wallet.key, style: { height: pixelToRem.pixelToRem(28), width: pixelToRem.pixelToRem(28) } })) : null;
86
- const label = getWalletListItemLabel.getWalletListItemLabel({
88
+ const labelSettings = getWalletListItemLabel.getWalletListItemLabel({
89
+ recommendedWallets,
87
90
  wallet,
88
91
  });
89
92
  const trailing = (jsxRuntime.jsx(ListTileAnimatedTrailing.ListTileAnimatedTrailing, { hoverElement:
90
93
  // eslint-disable-next-line react/jsx-wrap-multilines
91
- jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'mini', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }), children: label && (jsxRuntime.jsx(Badge.Badge, { dot: true, text: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: label }) })) }));
94
+ jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'mini', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }), children: labelSettings && (jsxRuntime.jsx(Badge.Badge, { dot: !labelSettings.isRecommended, variant: labelSettings.isRecommended ? 'primary' : 'secondary', text: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: labelSettings.label }) })) }));
92
95
  return (jsxRuntime.jsx(ListTile.ListTile, { onClick: onClick, leading: icon, trailing: trailing, children: name }));
93
96
  };
94
97
 
@@ -20,6 +20,7 @@ import { pixelToRem } from '../../../../utils/functions/pixelToRem/pixelToRem.js
20
20
  import 'viem/chains';
21
21
  import '../../../../events/dynamicEvents.js';
22
22
  import '../../../../context/DynamicContext/DynamicContext.js';
23
+ import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
23
24
  import '../../../../context/CaptchaContext/CaptchaContext.js';
24
25
  import '../../../../context/ErrorContext/ErrorContext.js';
25
26
  import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
@@ -43,7 +44,6 @@ import '../../../../components/ShadowDOM/ShadowDOM.js';
43
44
  import '../../../../components/OverlayCard/OverlayCard.context.js';
44
45
  import '../../../../context/FooterAnimationContext/index.js';
45
46
  import { Typography } from '../../../../components/Typography/Typography.js';
46
- import { Badge } from '../../../../components/Badge/Badge.js';
47
47
  import '../../../../context/WalletGroupContext/WalletGroupContext.js';
48
48
  import { ListTileAnimatedTrailing } from '../../../../components/ListTileAnimatedTrailing/ListTileAnimatedTrailing.js';
49
49
  import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
@@ -61,6 +61,7 @@ import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccess
61
61
  import '../../../../context/PasskeyContext/PasskeyContext.js';
62
62
  import '@dynamic-labs/viem-utils';
63
63
  import '../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
64
+ import { Badge } from '../../../../components/Badge/Badge.js';
64
65
  import { ListTile } from '../../../../components/ListTile/ListTile.js';
65
66
  import '../../../../components/InlineWidget/InlineWidget.js';
66
67
  import '../../../../components/IsBrowser/IsBrowser.js';
@@ -73,18 +74,20 @@ import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
73
74
  import '../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
74
75
 
75
76
  const WalletGroupItem = ({ groupKey, wallet, onClick, }) => {
77
+ const { recommendedWallets } = useInternalDynamicContext();
76
78
  const { walletBook } = useWalletBookContext();
77
79
  const walletOverride = findWalletGroupOverride(walletBook, groupKey, wallet.key);
78
80
  const walletData = findWalletBookWallet(walletBook, wallet.key);
79
81
  const brand = (walletOverride === null || walletOverride === void 0 ? void 0 : walletOverride.brand) || (walletData === null || walletData === void 0 ? void 0 : walletData.brand);
80
82
  const name = (walletOverride === null || walletOverride === void 0 ? void 0 : walletOverride.name) || (walletData === null || walletData === void 0 ? void 0 : walletData.name);
81
83
  const icon = brand ? (jsx(BrandIcon, { brand: brand, walletKey: wallet.key, style: { height: pixelToRem(28), width: pixelToRem(28) } })) : null;
82
- const label = getWalletListItemLabel({
84
+ const labelSettings = getWalletListItemLabel({
85
+ recommendedWallets,
83
86
  wallet,
84
87
  });
85
88
  const trailing = (jsx(ListTileAnimatedTrailing, { hoverElement:
86
89
  // eslint-disable-next-line react/jsx-wrap-multilines
87
- jsx(Icon, { color: 'text-tertiary', size: 'mini', children: jsx(SvgStroke, {}) }), children: label && (jsx(Badge, { dot: true, text: jsx(Typography, { variant: 'body_small', children: label }) })) }));
90
+ jsx(Icon, { color: 'text-tertiary', size: 'mini', children: jsx(SvgStroke, {}) }), children: labelSettings && (jsx(Badge, { dot: !labelSettings.isRecommended, variant: labelSettings.isRecommended ? 'primary' : 'secondary', text: jsx(Typography, { variant: 'body_small', children: labelSettings.label }) })) }));
88
91
  return (jsx(ListTile, { onClick: onClick, leading: icon, trailing: trailing, children: name }));
89
92
  };
90
93
 
@@ -19,9 +19,7 @@ var stroke = require('../../../../shared/assets/stroke.cjs');
19
19
  require('../../../../shared/consts/index.cjs');
20
20
  var Icon = require('../../../../components/Icon/Icon.cjs');
21
21
  var pixelToRem = require('../../../../utils/functions/pixelToRem/pixelToRem.cjs');
22
- var Badge = require('../../../../components/Badge/Badge.cjs');
23
22
  var ListTileAnimatedTrailing = require('../../../../components/ListTileAnimatedTrailing/ListTileAnimatedTrailing.cjs');
24
- var Typography = require('../../../../components/Typography/Typography.cjs');
25
23
  require('../../../../events/dynamicEvents.cjs');
26
24
  require('../../../../../../_virtual/_tslib.cjs');
27
25
  require('../../../../context/DynamicContext/DynamicContext.cjs');
@@ -51,6 +49,7 @@ require('../../../../components/Transition/OpacityTransition/OpacityTransition.c
51
49
  require('../../../../components/ShadowDOM/ShadowDOM.cjs');
52
50
  require('../../../../components/OverlayCard/OverlayCard.context.cjs');
53
51
  require('../../../../context/FooterAnimationContext/index.cjs');
52
+ var Typography = require('../../../../components/Typography/Typography.cjs');
54
53
  require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
55
54
  require('../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
56
55
  require('react-focus-lock');
@@ -66,6 +65,7 @@ require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSucces
66
65
  require('../../../../context/PasskeyContext/PasskeyContext.cjs');
67
66
  require('@dynamic-labs/viem-utils');
68
67
  require('../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
68
+ var Badge = require('../../../../components/Badge/Badge.cjs');
69
69
  var ListTile = require('../../../../components/ListTile/ListTile.cjs');
70
70
  require('../../../../components/InlineWidget/InlineWidget.cjs');
71
71
  require('../../../../components/IsBrowser/IsBrowser.cjs');
@@ -84,12 +84,12 @@ const WalletGroupItem = ({ wallet, onClick, }) => {
84
84
  const walletOverride = wallet.group
85
85
  ? walletBook.findWalletGroupOverride(walletBook$1, wallet.group, wallet.key)
86
86
  : undefined;
87
- const label = getWalletListItemLabel.getWalletListItemLabel({
87
+ const labelSettings = getWalletListItemLabel.getWalletListItemLabel({
88
88
  wallet,
89
89
  });
90
90
  const trailing = (jsxRuntime.jsx(ListTileAnimatedTrailing.ListTileAnimatedTrailing, { hoverElement:
91
91
  // eslint-disable-next-line react/jsx-wrap-multilines
92
- jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'mini', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }), children: label && (jsxRuntime.jsx(Badge.Badge, { dot: true, text: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: label }) })) }));
92
+ jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'mini', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }), children: labelSettings && (jsxRuntime.jsx(Badge.Badge, { dot: !labelSettings.isRecommended, variant: labelSettings.isRecommended ? 'primary' : 'secondary', text: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: labelSettings.label }) })) }));
93
93
  const renderChainIcon = React.useMemo(() => {
94
94
  const iconStyle = { height: pixelToRem.pixelToRem(28), width: pixelToRem.pixelToRem(28) };
95
95
  if (walletOverride === null || walletOverride === void 0 ? void 0 : walletOverride.brand) {
@@ -15,9 +15,7 @@ import { ReactComponent as SvgStroke } from '../../../../shared/assets/stroke.js
15
15
  import '../../../../shared/consts/index.js';
16
16
  import { Icon } from '../../../../components/Icon/Icon.js';
17
17
  import { pixelToRem } from '../../../../utils/functions/pixelToRem/pixelToRem.js';
18
- import { Badge } from '../../../../components/Badge/Badge.js';
19
18
  import { ListTileAnimatedTrailing } from '../../../../components/ListTileAnimatedTrailing/ListTileAnimatedTrailing.js';
20
- import { Typography } from '../../../../components/Typography/Typography.js';
21
19
  import '../../../../events/dynamicEvents.js';
22
20
  import '../../../../../../_virtual/_tslib.js';
23
21
  import '../../../../context/DynamicContext/DynamicContext.js';
@@ -47,6 +45,7 @@ import '../../../../components/Transition/OpacityTransition/OpacityTransition.js
47
45
  import '../../../../components/ShadowDOM/ShadowDOM.js';
48
46
  import '../../../../components/OverlayCard/OverlayCard.context.js';
49
47
  import '../../../../context/FooterAnimationContext/index.js';
48
+ import { Typography } from '../../../../components/Typography/Typography.js';
50
49
  import '../../../../context/WalletGroupContext/WalletGroupContext.js';
51
50
  import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
52
51
  import 'react-focus-lock';
@@ -62,6 +61,7 @@ import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccess
62
61
  import '../../../../context/PasskeyContext/PasskeyContext.js';
63
62
  import '@dynamic-labs/viem-utils';
64
63
  import '../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
64
+ import { Badge } from '../../../../components/Badge/Badge.js';
65
65
  import { ListTile } from '../../../../components/ListTile/ListTile.js';
66
66
  import '../../../../components/InlineWidget/InlineWidget.js';
67
67
  import '../../../../components/IsBrowser/IsBrowser.js';
@@ -80,12 +80,12 @@ const WalletGroupItem = ({ wallet, onClick, }) => {
80
80
  const walletOverride = wallet.group
81
81
  ? findWalletGroupOverride(walletBook, wallet.group, wallet.key)
82
82
  : undefined;
83
- const label = getWalletListItemLabel({
83
+ const labelSettings = getWalletListItemLabel({
84
84
  wallet,
85
85
  });
86
86
  const trailing = (jsx(ListTileAnimatedTrailing, { hoverElement:
87
87
  // eslint-disable-next-line react/jsx-wrap-multilines
88
- jsx(Icon, { color: 'text-tertiary', size: 'mini', children: jsx(SvgStroke, {}) }), children: label && (jsx(Badge, { dot: true, text: jsx(Typography, { variant: 'body_small', children: label }) })) }));
88
+ jsx(Icon, { color: 'text-tertiary', size: 'mini', children: jsx(SvgStroke, {}) }), children: labelSettings && (jsx(Badge, { dot: !labelSettings.isRecommended, variant: labelSettings.isRecommended ? 'primary' : 'secondary', text: jsx(Typography, { variant: 'body_small', children: labelSettings.label }) })) }));
89
89
  const renderChainIcon = useMemo(() => {
90
90
  const iconStyle = { height: pixelToRem(28), width: pixelToRem(28) };
91
91
  if (walletOverride === null || walletOverride === void 0 ? void 0 : walletOverride.brand) {
@@ -76,39 +76,32 @@ require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
76
76
  require('../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
77
77
  require('@dynamic-labs/viem-utils');
78
78
  require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
79
- var useViewSettings = require('../../utils/hooks/useViewSettings/useViewSettings.cjs');
80
79
  var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
81
80
  var index = require('../../utils/functions/walletFilters/index.cjs');
82
81
  var isUserLinkingWallet = require('../../shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.cjs');
83
82
  var SearchNotFoundMessage = require('./SearchNotFoundMessage/SearchNotFoundMessage.cjs');
84
83
  var WalletListGridTabs = require('./WalletListGridTabs/WalletListGridTabs.cjs');
84
+ var useTabState = require('./hooks/useTabState.cjs');
85
+ var getEffectiveWalletFilter = require('./utils/getEffectiveWalletFilter.cjs');
86
+ var getEffectiveRecommendedWallets = require('./utils/getEffectiveRecommendedWallets.cjs');
85
87
 
86
88
  localStorage.LocalStorage.setToLS(localStorage$1.WALLET_PICKER_SEARCH_KEY, '');
87
89
  const WalletList = ({ isWalletConnectList = false, }) => {
88
- var _a, _b;
89
- const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, user, } = useInternalDynamicContext.useInternalDynamicContext();
90
+ var _a;
91
+ const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, user, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
90
92
  const { view } = ViewContext.useViewContext();
91
- const [selectedTabIndex, setSelectedTabIndex] = React.useState(null);
93
+ const { selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useTabState.useTabState();
92
94
  const isLinkingWallet = isUserLinkingWallet.isUserLinkingWallet(user, view.type, false);
93
- const walletListViewSettings = useViewSettings.useViewSettings('wallet-list');
94
- const selectedTabSettings = selectedTabIndex === null
95
- ? undefined
96
- : (_a = walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) === null || _a === void 0 ? void 0 : _a.items[selectedTabIndex];
97
95
  const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
98
96
  const { error } = ErrorContext.useErrorContext();
99
97
  const { showDefaultFooter } = useAuthLayoutChecks.useAuthLayoutChecks();
100
98
  const [footerBorderIsVisible, setFooterBorderIsVisible] = React.useState(true);
101
99
  const { t } = reactI18next.useTranslation();
102
- const [filterValue, setFilterValue] = React.useState((_b = localStorage.LocalStorage.getFromLS(localStorage$1.WALLET_PICKER_SEARCH_KEY)) !== null && _b !== void 0 ? _b : '');
100
+ const [filterValue, setFilterValue] = React.useState((_a = localStorage.LocalStorage.getFromLS(localStorage$1.WALLET_PICKER_SEARCH_KEY)) !== null && _a !== void 0 ? _a : '');
103
101
  const getFilteredBridgeChains = (bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length) &&
104
102
  index.FilterBridgeChainsName(bridgeChainsToConnect[0].chain);
105
103
  const filteredBridgeChains = getFilteredBridgeChains && getFilteredBridgeChains(walletConnectorOptions);
106
- const effectiveWalletFilter = React.useMemo(() => {
107
- if (selectedTabSettings) {
108
- return selectedTabSettings === null || selectedTabSettings === void 0 ? void 0 : selectedTabSettings.walletsFilter;
109
- }
110
- return walletsFilter;
111
- }, [selectedTabSettings, walletsFilter]);
104
+ const effectiveRecommendedWallets = getEffectiveRecommendedWallets.getEffectiveRecommendedWallets(selectedTabSettings, recommendedWallets);
112
105
  const { numberOfWallets, walletsList } = walletListBuilder.walletListBuilder({
113
106
  authMode,
114
107
  connectedWallets,
@@ -118,11 +111,12 @@ const WalletList = ({ isWalletConnectList = false, }) => {
118
111
  lastUsedWalletKey: localStorage.LocalStorage.getFromLS(localStorage$1.LAST_USED_WALLET),
119
112
  multiWallet,
120
113
  numberOfWalletsToShow: defaultNumberOfWalletsToShow,
114
+ recommendedWallets: effectiveRecommendedWallets,
121
115
  searchFilter: filterValue,
122
116
  showMoreWalletsWithFilter: true,
123
117
  signWithEmailWalletName,
124
118
  walletBook: walletBook$1,
125
- walletsFilter: effectiveWalletFilter,
119
+ walletsFilter: getEffectiveWalletFilter.getEffectiveWalletFilter(selectedTabSettings, walletsFilter),
126
120
  });
127
121
  const isSearchEnabled = numberOfWallets > defaultNumberOfWalletsToShow &&
128
122
  walletsList.length !== numberOfWallets;
@@ -147,10 +141,9 @@ const WalletList = ({ isWalletConnectList = false, }) => {
147
141
  const searchContainer = !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__search-container', {
148
142
  'wallet-list__search-container--scroll': !error,
149
143
  }), children: jsxRuntime.jsx(Search.Search, { copykey: 'dyn_wallet_list.search.label', label: t('dyn_wallet_list.search.label', { numberOfWallets }), value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }) })));
150
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) && !isLinkingWallet && (jsxRuntime.jsx("div", { className: 'wallet-list__tabs-container', children: jsxRuntime.jsx(WalletListGridTabs.WalletListGridTabs, { items: walletListViewSettings.tabs.items, value: selectedTabIndex || 0, onSelect: setSelectedTabIndex }) })), searchContainer, Boolean(error) && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'wallet-list__error-container', withIcon: false, children: error })), jsxRuntime.jsx("div", { className: 'wallet-list__container', children: jsxRuntime.jsxs("div", { className: classNames.classNames('wallet-list__scroll-container', {
144
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(tabsItems === null || tabsItems === void 0 ? void 0 : tabsItems.length) && !isLinkingWallet && (jsxRuntime.jsx("div", { className: 'wallet-list__tabs-container', children: jsxRuntime.jsx(WalletListGridTabs.WalletListGridTabs, { items: tabsItems, value: selectedTabIndex || 0, onSelect: setSelectedTabIndex }) })), searchContainer, Boolean(error) && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'wallet-list__error-container', withIcon: false, children: error })), jsxRuntime.jsx("div", { className: 'wallet-list__container', children: jsxRuntime.jsxs("div", { className: classNames.classNames('wallet-list__scroll-container', {
151
145
  'wallet-list__scroll-container--error': Boolean(error),
152
- 'wallet-list__scroll-container--full-height': isSearchEnabled,
153
- }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [walletConnectorOptions.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { copykey: 'dyn_wallet_list.configuration_mismatch', children: t('dyn_wallet_list.configuration_mismatch') })), walletConnectorOptions.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: t('dyn_wallet_list.search.not_found.title'), subtitle: t('dyn_wallet_list.search.not_found.description'), image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet, index) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, onResetSearchValue: () => handleFilterValueChange('') }, `${wallet.key}_${index}`))))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, {}))] }) }), showDefaultFooter && (jsxRuntime.jsx(DefaultFooter.DefaultFooter, { hideBorder: !footerBorderIsVisible }))] }));
146
+ }), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [walletConnectorOptions.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { copykey: 'dyn_wallet_list.configuration_mismatch', children: t('dyn_wallet_list.configuration_mismatch') })), walletConnectorOptions.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: t('dyn_wallet_list.search.not_found.title'), subtitle: t('dyn_wallet_list.search.not_found.description'), image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet, index) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, onResetSearchValue: () => handleFilterValueChange(''), recommendedWallets: effectiveRecommendedWallets }, `${wallet.key}_${index}`))))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, {}))] }) }), showDefaultFooter && (jsxRuntime.jsx(DefaultFooter.DefaultFooter, { hideBorder: !footerBorderIsVisible }))] }));
154
147
  };
155
148
 
156
149
  exports.WalletList = WalletList;