@dynamic-labs/sdk-react-core 1.2.0-alpha.0 → 1.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/index.cjs +1 -0
- package/src/index.js +1 -1
- package/src/lib/components/Badge/Badge.cjs +1 -1
- package/src/lib/components/Badge/Badge.d.ts +1 -1
- package/src/lib/components/Badge/Badge.js +1 -1
- package/src/lib/components/Badge/Badge.types.d.ts +1 -0
- package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +2 -13
- package/src/lib/components/IconWithSpinner/IconWithSpinner.js +2 -13
- package/src/lib/context/DynamicContext/DynamicContext.cjs +4 -2
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +5 -3
- package/src/lib/context/DynamicContext/types/index.d.ts +3 -2
- package/src/lib/locale/en/translation.cjs +8 -0
- package/src/lib/locale/en/translation.d.ts +8 -0
- package/src/lib/locale/en/translation.js +8 -0
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/shared/types/index.d.ts +5 -1
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs +23 -10
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.d.ts +7 -3
- package/src/lib/shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.js +23 -10
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/walletFilters/index.cjs +6 -0
- package/src/lib/utils/functions/walletFilters/index.d.ts +5 -0
- package/src/lib/utils/functions/walletFilters/index.js +6 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +30 -8
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.d.ts +3 -2
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +30 -8
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +1 -6
- package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +1 -6
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +9 -15
- package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +10 -16
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +21 -19
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.d.ts +5 -1
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +22 -20
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +2 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +2 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.cjs +21 -8
- package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.js +21 -8
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.cjs +1 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/ActionCard/ActionCard.js +1 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.cjs +3 -1
- package/src/lib/views/Passkey/EmbeddedAuthChoiceCards/EmbeddedAuthChoiceCards.js +3 -1
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +3 -0
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +3 -0
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +20 -1
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.d.ts +2 -1
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +20 -2
- package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +6 -3
- package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.js +6 -3
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +4 -4
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +4 -4
- package/src/lib/views/WalletList/WalletList.cjs +2 -2
- package/src/lib/views/WalletList/WalletList.js +2 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +6 -3
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +6 -3
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +10 -5
- 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
|
|
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
|
|
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
|
|
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
|
|
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: '
|
|
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: '
|
|
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('
|
|
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('
|
|
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 };
|
package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs
CHANGED
|
@@ -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
|
|
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:
|
|
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
|
|
package/src/lib/views/SelectWalletInWalletGroupView/components/WalletGroupItem/WalletGroupItem.js
CHANGED
|
@@ -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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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) {
|
|
@@ -86,7 +86,7 @@ var WalletListGridTabs = require('./WalletListGridTabs/WalletListGridTabs.cjs');
|
|
|
86
86
|
localStorage.LocalStorage.setToLS(localStorage$1.WALLET_PICKER_SEARCH_KEY, '');
|
|
87
87
|
const WalletList = ({ isWalletConnectList = false, }) => {
|
|
88
88
|
var _a, _b;
|
|
89
|
-
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, user, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
89
|
+
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, user, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
90
90
|
const { view } = ViewContext.useViewContext();
|
|
91
91
|
const [selectedTabIndex, setSelectedTabIndex] = React.useState(null);
|
|
92
92
|
const isLinkingWallet = isUserLinkingWallet.isUserLinkingWallet(user, view.type, false);
|
|
@@ -118,6 +118,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
118
118
|
lastUsedWalletKey: localStorage.LocalStorage.getFromLS(localStorage$1.LAST_USED_WALLET),
|
|
119
119
|
multiWallet,
|
|
120
120
|
numberOfWalletsToShow: defaultNumberOfWalletsToShow,
|
|
121
|
+
recommendedWallets,
|
|
121
122
|
searchFilter: filterValue,
|
|
122
123
|
showMoreWalletsWithFilter: true,
|
|
123
124
|
signWithEmailWalletName,
|
|
@@ -149,7 +150,6 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
149
150
|
}), 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
151
|
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', {
|
|
151
152
|
'wallet-list__scroll-container--error': Boolean(error),
|
|
152
|
-
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
153
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 }))] }));
|
|
154
154
|
};
|
|
155
155
|
|
|
@@ -82,7 +82,7 @@ import { WalletListGridTabs } from './WalletListGridTabs/WalletListGridTabs.js';
|
|
|
82
82
|
LocalStorage.setToLS(WALLET_PICKER_SEARCH_KEY, '');
|
|
83
83
|
const WalletList = ({ isWalletConnectList = false, }) => {
|
|
84
84
|
var _a, _b;
|
|
85
|
-
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, user, } = useInternalDynamicContext();
|
|
85
|
+
const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, user, recommendedWallets, } = useInternalDynamicContext();
|
|
86
86
|
const { view } = useViewContext();
|
|
87
87
|
const [selectedTabIndex, setSelectedTabIndex] = useState(null);
|
|
88
88
|
const isLinkingWallet = isUserLinkingWallet(user, view.type, false);
|
|
@@ -114,6 +114,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
114
114
|
lastUsedWalletKey: LocalStorage.getFromLS(LAST_USED_WALLET),
|
|
115
115
|
multiWallet,
|
|
116
116
|
numberOfWalletsToShow: defaultNumberOfWalletsToShow,
|
|
117
|
+
recommendedWallets,
|
|
117
118
|
searchFilter: filterValue,
|
|
118
119
|
showMoreWalletsWithFilter: true,
|
|
119
120
|
signWithEmailWalletName,
|
|
@@ -145,7 +146,6 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
145
146
|
}), children: jsx(Search, { copykey: 'dyn_wallet_list.search.label', label: t('dyn_wallet_list.search.label', { numberOfWallets }), value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }) })));
|
|
146
147
|
return (jsxs(Fragment, { children: [(walletListViewSettings === null || walletListViewSettings === void 0 ? void 0 : walletListViewSettings.tabs) && !isLinkingWallet && (jsx("div", { className: 'wallet-list__tabs-container', children: jsx(WalletListGridTabs, { items: walletListViewSettings.tabs.items, value: selectedTabIndex || 0, onSelect: setSelectedTabIndex }) })), searchContainer, Boolean(error) && (jsx(ErrorContainer, { className: 'wallet-list__error-container', withIcon: false, children: error })), jsx("div", { className: 'wallet-list__container', children: jsxs("div", { className: classNames('wallet-list__scroll-container', {
|
|
147
148
|
'wallet-list__scroll-container--error': Boolean(error),
|
|
148
|
-
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
149
149
|
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [walletConnectorOptions.length === 0 && (jsx(ErrorContainer, { copykey: 'dyn_wallet_list.configuration_mismatch', children: t('dyn_wallet_list.configuration_mismatch') })), walletConnectorOptions.length && walletsList.length === 0 ? (jsx(SearchNotFoundMessage, { title: t('dyn_wallet_list.search.not_found.title'), subtitle: t('dyn_wallet_list.search.not_found.description'), image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet, index) => (jsx(WalletListItem, { wallet: wallet, onResetSearchValue: () => handleFilterValueChange('') }, `${wallet.key}_${index}`))))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchNotFoundMessage, {}))] }) }), showDefaultFooter && (jsx(DefaultFooter, { hideBorder: !footerBorderIsVisible }))] }));
|
|
150
150
|
};
|
|
151
151
|
|
|
@@ -19,6 +19,7 @@ var getWalletListItemLabel = require('../../../shared/utils/functions/getWalletL
|
|
|
19
19
|
require('viem');
|
|
20
20
|
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
21
21
|
require('../../../shared/consts/index.cjs');
|
|
22
|
+
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
22
23
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
23
24
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
25
|
require('../../../utils/constants/colors.cjs');
|
|
@@ -48,7 +49,6 @@ require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
|
48
49
|
require('../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
49
50
|
require('../../../context/FooterAnimationContext/index.cjs');
|
|
50
51
|
var Typography = require('../../../components/Typography/Typography.cjs');
|
|
51
|
-
var Badge = require('../../../components/Badge/Badge.cjs');
|
|
52
52
|
var isWalletGroup = require('../../../utils/functions/walletListBuilder/utils/isWalletGroup/isWalletGroup.cjs');
|
|
53
53
|
var WalletGroupContext = require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
54
54
|
var ListTileAnimatedTrailing = require('../../../components/ListTileAnimatedTrailing/ListTileAnimatedTrailing.cjs');
|
|
@@ -67,6 +67,7 @@ require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBa
|
|
|
67
67
|
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
68
68
|
require('@dynamic-labs/viem-utils');
|
|
69
69
|
require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
70
|
+
var Badge = require('../../../components/Badge/Badge.cjs');
|
|
70
71
|
var ListTile = require('../../../components/ListTile/ListTile.cjs');
|
|
71
72
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
72
73
|
require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
@@ -79,12 +80,14 @@ require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
|
79
80
|
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
80
81
|
|
|
81
82
|
const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, tile = ({ leading, name, onClick, trailing }) => (jsxRuntime.jsx(ListTile.ListTile, { leading: leading, trailing: trailing, onClick: onClick, className: 'wallet-list-item__tile', dataTestId: 'ListTile', children: name })), }) => {
|
|
83
|
+
const { recommendedWallets } = useInternalDynamicContext.useInternalDynamicContext();
|
|
82
84
|
const { navigateToWalletGroup } = WalletGroupContext.useWalletGroupContext();
|
|
83
85
|
const { setView } = ViewContext.useViewContext();
|
|
84
86
|
const _isWalletGroup = isWalletGroup.isWalletGroup(wallet);
|
|
85
87
|
const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
|
|
86
88
|
const { handleWalletItemClick } = useWalletItemActions.useWalletItemActions();
|
|
87
|
-
const
|
|
89
|
+
const labelSettings = getWalletListItemLabel.getWalletListItemLabel({
|
|
90
|
+
recommendedWallets,
|
|
88
91
|
wallet,
|
|
89
92
|
});
|
|
90
93
|
const Tile = tile;
|
|
@@ -112,7 +115,7 @@ const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, tile = (
|
|
|
112
115
|
const leading = (jsxRuntime.jsx(walletBook.WalletIcon, { className: 'wallet-list-item__leading', walletKey: wallet.key, style: { height: pixelToRem.pixelToRem(28), width: pixelToRem.pixelToRem(28) } }));
|
|
113
116
|
const trailing = (jsxRuntime.jsx(ListTileAnimatedTrailing.ListTileAnimatedTrailing, { hoverElement:
|
|
114
117
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
115
|
-
jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'mini', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }), children:
|
|
118
|
+
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 }) })) }));
|
|
116
119
|
return (jsxRuntime.jsx(Tile, { leading: leading, trailing: trailing, name: name, onClick: handleClick }));
|
|
117
120
|
};
|
|
118
121
|
|