@dynamic-labs/sdk-react-core 0.18.0-RC.11 → 0.18.0-RC.13
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 +31 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/lib/Main.cjs +2 -2
- package/src/lib/Main.js +2 -2
- package/src/lib/assets/index.d.ts +1 -0
- package/src/lib/assets/no-wallet-found.cjs +75 -0
- package/src/lib/assets/no-wallet-found.js +51 -0
- package/src/lib/components/TosAndPp/TosAndPp.cjs +18 -3
- package/src/lib/components/TosAndPp/TosAndPp.d.ts +1 -6
- package/src/lib/components/TosAndPp/TosAndPp.js +19 -4
- package/src/lib/components/WalletInformationCard/WalletInformationCard.cjs +33 -0
- package/src/lib/components/WalletInformationCard/WalletInformationCard.d.ts +11 -0
- package/src/lib/components/WalletInformationCard/WalletInformationCard.js +29 -0
- package/src/lib/components/WalletInformationCard/index.d.ts +1 -0
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +10 -7
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +8 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +10 -7
- package/src/lib/context/WalletContext/WalletContext.cjs +4 -2
- package/src/lib/context/WalletContext/WalletContext.d.ts +3 -1
- package/src/lib/context/WalletContext/WalletContext.js +4 -2
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +4 -3
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +4 -3
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.cjs +1 -0
- package/src/lib/utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.js +1 -0
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +5 -5
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +6 -6
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +9 -2
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +5 -2
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +9 -2
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +5 -3
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +5 -3
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +14 -27
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -3
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +15 -28
- package/src/lib/utils/hooks/useConnectWithEmail/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.cjs +1 -4
- package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.d.ts +1 -4
- package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.js +1 -4
- package/src/lib/utils/hooks/useEmailProvider/index.d.ts +1 -0
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +54 -0
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.d.ts +10 -0
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +50 -0
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +3 -0
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +3 -0
- package/src/lib/utils/hooks/useWalletConnectorEvents/useWalletConnectorEvents.cjs +17 -0
- package/src/lib/utils/hooks/useWalletConnectorEvents/useWalletConnectorEvents.d.ts +2 -0
- package/src/lib/utils/hooks/useWalletConnectorEvents/useWalletConnectorEvents.js +13 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +20 -3
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +3 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +20 -3
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +8 -8
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +8 -8
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +24 -51
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +24 -51
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +7 -5
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +7 -5
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +14 -14
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +14 -14
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +20 -24
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +21 -25
- package/src/lib/views/WalletList/{SearchInstead/SearchInstead.cjs → SearchNotFoundMessage/SearchNotFoundMessage.cjs} +2 -2
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.d.ts +8 -0
- package/src/lib/views/WalletList/{SearchInstead/SearchInstead.js → SearchNotFoundMessage/SearchNotFoundMessage.js} +2 -2
- package/src/lib/views/WalletList/SearchNotFoundMessage/index.d.ts +1 -0
- package/src/lib/views/WalletList/WalletList.cjs +3 -2
- package/src/lib/views/WalletList/WalletList.js +3 -2
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +27 -8
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.d.ts +0 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +28 -9
- package/src/lib/views/WalletList/SearchInstead/SearchInstead.d.ts +0 -2
- package/src/lib/views/WalletList/SearchInstead/index.d.ts +0 -1
|
@@ -35,6 +35,7 @@ import '../../context/MockContext/MockContext.js';
|
|
|
35
35
|
import { useConnectAndSign } from '../../utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js';
|
|
36
36
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
37
37
|
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
38
|
+
import { useWalletConnectorEvents } from '../../utils/hooks/useWalletConnectorEvents/useWalletConnectorEvents.js';
|
|
38
39
|
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
39
40
|
import '../../components/Popper/Popper/Popper.js';
|
|
40
41
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
@@ -44,27 +45,26 @@ import '../../components/InlineWidget/InlineWidget.js';
|
|
|
44
45
|
import { NetworkPicker } from '../../components/NetworkPicker/NetworkPicker.js';
|
|
45
46
|
import { UserAddress } from '../../components/UserAddress/UserAddress.js';
|
|
46
47
|
import { AuthProviderIcon } from '../../components/AuthProviderIcon/AuthProviderIcon.js';
|
|
47
|
-
import { useUpdateUserProfileByJWTCallback } from '../../utils/hooks/useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
48
48
|
import { SelectNetworkButton } from '../../components/SelectNetworkButton/SelectNetworkButton.js';
|
|
49
49
|
|
|
50
50
|
const NetworkNotSupported = () => {
|
|
51
51
|
var _a, _b, _c, _d;
|
|
52
|
-
const { onboardingOnlyJwt, network, onboardingImageUrl, selectedWalletConnector: walletConnector, decodedOnboardingOnlyToken,
|
|
53
|
-
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
52
|
+
const { onboardingOnlyJwt, network, onboardingImageUrl, selectedWalletConnector: walletConnector, decodedOnboardingOnlyToken, setNetwork, } = useInternalDynamicContext();
|
|
54
53
|
const finishConnectAndSign = useConnectAndSign();
|
|
55
54
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
55
|
+
const onChainChange = (network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
if (isSupportedNetwork({ network, walletConnector })) {
|
|
57
|
+
finishConnectAndSign({
|
|
58
|
+
walletConnector: walletConnector,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
// We can't listen on the network defined in the context,
|
|
63
|
+
// because events on the primaryWallet are defined after message is signed.
|
|
64
|
+
useWalletConnectorEvents(walletConnector, { onChainChange });
|
|
56
65
|
if (!walletConnector) {
|
|
57
66
|
return null;
|
|
58
67
|
}
|
|
59
|
-
const handleNetworkChange = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
if (!onboardingOnlyJwt) {
|
|
61
|
-
finishConnectAndSign({ walletConnector });
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
setCallback('authSuccess');
|
|
65
|
-
yield updateUserProfileByJWT(onboardingOnlyJwt);
|
|
66
|
-
setShowAuthFlow(false);
|
|
67
|
-
});
|
|
68
68
|
const userProfile = decodedOnboardingOnlyToken && createUserProfile(decodedOnboardingOnlyToken);
|
|
69
69
|
const evmNetworks = walletConnector.evmNetworks || [];
|
|
70
70
|
const _isSupportedNetwork = isSupportedNetwork({ network, walletConnector });
|
|
@@ -74,13 +74,13 @@ const NetworkNotSupported = () => {
|
|
|
74
74
|
networkChainId: networkId,
|
|
75
75
|
});
|
|
76
76
|
setNetwork(networkId);
|
|
77
|
-
|
|
77
|
+
finishConnectAndSign({ walletConnector });
|
|
78
78
|
}
|
|
79
79
|
catch (e) {
|
|
80
80
|
logger.debug(e);
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
return (jsxs("div", Object.assign({ className: 'network-not-supported', "data-testid": 'network-not-supported' }, { children: [onboardingImageUrl && (jsx("img", { className: 'network-not-supported__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsx(ErrorContainer, Object.assign({ variant: 'info', withIcon: false, className: 'network-not-supported__error--not-supported' }, { children: "This network is not available, please update." }))), jsxs("div", Object.assign({ className: 'network-not-supported__content-container' }, { children: [jsxs("div", Object.assign({ className: 'network-not-supported__img-container' }, { children: [((_a = userProfile === null || userProfile === void 0 ? void 0 : userProfile.ens) === null || _a === void 0 ? void 0 : _a.avatar) && (jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: jsx("img", { src: (_b = userProfile === null || userProfile === void 0 ? void 0 : userProfile.ens) === null || _b === void 0 ? void 0 : _b.avatar, alt: 'user ens avatar', className: 'network-not-supported__img' }) }))), !((_c = userProfile === null || userProfile === void 0 ? void 0 : userProfile.ens) === null || _c === void 0 ? void 0 : _c.avatar) && onboardingOnlyJwt && (jsx(AuthProviderIcon, { jwt: onboardingOnlyJwt })), !((_d = userProfile === null || userProfile === void 0 ? void 0 : userProfile.ens) === null || _d === void 0 ? void 0 : _d.avatar) && !onboardingOnlyJwt && (jsx(WalletIcon, { style: { height: 64, width: 64 }, walletName: walletConnector.name }))] })), jsx(UserAddress, { walletConnector: walletConnector, userProfile: userProfile }), jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: evmNetworks.length > 1 && (jsx(NetworkPicker, { evmNetworks: evmNetworks, connector: walletConnector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, showNetworkName: true, buttonClassName: 'network-not-supported__network-picker-button', mainClassName: 'network-not-supported__network-picker'
|
|
83
|
+
return (jsxs("div", Object.assign({ className: 'network-not-supported', "data-testid": 'network-not-supported' }, { children: [onboardingImageUrl && (jsx("img", { className: 'network-not-supported__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsx(ErrorContainer, Object.assign({ variant: 'info', withIcon: false, className: 'network-not-supported__error--not-supported' }, { children: "This network is not available, please update." }))), jsxs("div", Object.assign({ className: 'network-not-supported__content-container' }, { children: [jsxs("div", Object.assign({ className: 'network-not-supported__img-container' }, { children: [((_a = userProfile === null || userProfile === void 0 ? void 0 : userProfile.ens) === null || _a === void 0 ? void 0 : _a.avatar) && (jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: jsx("img", { src: (_b = userProfile === null || userProfile === void 0 ? void 0 : userProfile.ens) === null || _b === void 0 ? void 0 : _b.avatar, alt: 'user ens avatar', className: 'network-not-supported__img' }) }))), !((_c = userProfile === null || userProfile === void 0 ? void 0 : userProfile.ens) === null || _c === void 0 ? void 0 : _c.avatar) && onboardingOnlyJwt && (jsx(AuthProviderIcon, { jwt: onboardingOnlyJwt })), !((_d = userProfile === null || userProfile === void 0 ? void 0 : userProfile.ens) === null || _d === void 0 ? void 0 : _d.avatar) && !onboardingOnlyJwt && (jsx(WalletIcon, { style: { height: 64, width: 64 }, walletName: walletConnector.name }))] })), jsx(UserAddress, { walletConnector: walletConnector, userProfile: userProfile }), jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: evmNetworks.length > 1 && (jsx(NetworkPicker, { evmNetworks: evmNetworks, connector: walletConnector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, showNetworkName: true, buttonClassName: 'network-not-supported__network-picker-button', mainClassName: 'network-not-supported__network-picker' })) })), jsxs("div", Object.assign({ className: 'network-not-supported__welcome-container' }, { children: [jsx(Typography, Object.assign({ variant: 'title', color: 'primary', className: 'network-not-supported__welcome-title' }, { children: "Update Network" })), jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary' }, { children: "Your wallet is not connected to a supported network. Please update before continuing." }))] })), evmNetworks.length === 1 && (jsx(SelectNetworkButton, { onClick: onSelectNetworkButtonClick, networkId: evmNetworks[0].networkId, networkName: evmNetworks[0].vanityName || evmNetworks[0].name, networkIconUrl: evmNetworks[0].iconUrls[0] }))] }))] })));
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
export { NetworkNotSupported };
|
|
@@ -41,6 +41,7 @@ require('../../context/MockContext/MockContext.cjs');
|
|
|
41
41
|
var useConnectAndSign = require('../../utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs');
|
|
42
42
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
43
43
|
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
44
|
+
var useWalletConnectorEvents = require('../../utils/hooks/useWalletConnectorEvents/useWalletConnectorEvents.cjs');
|
|
44
45
|
require('../../components/Popper/Popper/Popper.cjs');
|
|
45
46
|
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
46
47
|
require('formik');
|
|
@@ -52,31 +53,26 @@ var useUpdateUserProfileByJWTCallback = require('../../utils/hooks/useUpdateUser
|
|
|
52
53
|
// as the wallet does not support programmatic network change.
|
|
53
54
|
const NetworkNotSupportedSwitchManual = () => {
|
|
54
55
|
var _a, _b;
|
|
55
|
-
const { user, onboardingOnlyJwt, selectedWalletConnector: walletConnector,
|
|
56
|
+
const { user, onboardingOnlyJwt, selectedWalletConnector: walletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
56
57
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
return () => {
|
|
77
|
-
walletConnector.teardownEventListeners();
|
|
78
|
-
};
|
|
79
|
-
}, [onboardingOnlyJwt, walletConnector, updateUserProfileByJWT]);
|
|
58
|
+
const finishConnectAndSign = useConnectAndSign.useConnectAndSign();
|
|
59
|
+
const onChainChange = React.useCallback((network) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
+
if (isSupportedNetwork.isSupportedNetwork({ network, walletConnector })) {
|
|
61
|
+
finishConnectAndSign({
|
|
62
|
+
walletConnector: walletConnector,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
+
[
|
|
68
|
+
finishConnectAndSign,
|
|
69
|
+
onboardingOnlyJwt,
|
|
70
|
+
updateUserProfileByJWT,
|
|
71
|
+
walletConnector,
|
|
72
|
+
]);
|
|
73
|
+
// We can't listen on the network defined in the context,
|
|
74
|
+
// because events on the primaryWallet are defined after message is signed.
|
|
75
|
+
useWalletConnectorEvents.useWalletConnectorEvents(walletConnector, { onChainChange });
|
|
80
76
|
const iconSize = 80;
|
|
81
77
|
const icon = (jsxRuntime.jsx(walletBook.WalletIcon, { walletName: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.name, style: {
|
|
82
78
|
height: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
4
|
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
5
5
|
import { Typography } from '../../components/Typography/Typography.js';
|
|
6
6
|
import '@dynamic-labs/sdk-api';
|
|
@@ -37,6 +37,7 @@ import '../../context/MockContext/MockContext.js';
|
|
|
37
37
|
import { useConnectAndSign } from '../../utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js';
|
|
38
38
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
39
39
|
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
40
|
+
import { useWalletConnectorEvents } from '../../utils/hooks/useWalletConnectorEvents/useWalletConnectorEvents.js';
|
|
40
41
|
import '../../components/Popper/Popper/Popper.js';
|
|
41
42
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
42
43
|
import 'formik';
|
|
@@ -48,31 +49,26 @@ import { useUpdateUserProfileByJWTCallback } from '../../utils/hooks/useUpdateUs
|
|
|
48
49
|
// as the wallet does not support programmatic network change.
|
|
49
50
|
const NetworkNotSupportedSwitchManual = () => {
|
|
50
51
|
var _a, _b;
|
|
51
|
-
const { user, onboardingOnlyJwt, selectedWalletConnector: walletConnector,
|
|
52
|
+
const { user, onboardingOnlyJwt, selectedWalletConnector: walletConnector, } = useInternalDynamicContext();
|
|
52
53
|
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
return () => {
|
|
73
|
-
walletConnector.teardownEventListeners();
|
|
74
|
-
};
|
|
75
|
-
}, [onboardingOnlyJwt, walletConnector, updateUserProfileByJWT]);
|
|
54
|
+
const finishConnectAndSign = useConnectAndSign();
|
|
55
|
+
const onChainChange = useCallback((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
if (isSupportedNetwork({ network, walletConnector })) {
|
|
57
|
+
finishConnectAndSign({
|
|
58
|
+
walletConnector: walletConnector,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
+
[
|
|
64
|
+
finishConnectAndSign,
|
|
65
|
+
onboardingOnlyJwt,
|
|
66
|
+
updateUserProfileByJWT,
|
|
67
|
+
walletConnector,
|
|
68
|
+
]);
|
|
69
|
+
// We can't listen on the network defined in the context,
|
|
70
|
+
// because events on the primaryWallet are defined after message is signed.
|
|
71
|
+
useWalletConnectorEvents(walletConnector, { onChainChange });
|
|
76
72
|
const iconSize = 80;
|
|
77
73
|
const icon = (jsx(WalletIcon, { walletName: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.name, style: {
|
|
78
74
|
height: pixelToRem(iconSize * iconRatio),
|
|
@@ -41,6 +41,6 @@ require('formik');
|
|
|
41
41
|
require('yup');
|
|
42
42
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
43
43
|
|
|
44
|
-
const
|
|
44
|
+
const SearchNotFoundMessage = ({ title, subtitle, image, }) => (jsxRuntime.jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [image && jsxRuntime.jsx("div", { children: image }), jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'regular' }, { children: title || "Don't see your wallet?" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'primary', variant: 'button_primary', weight: 'regular' }, { children: subtitle || 'Try search instead' }))] })));
|
|
45
45
|
|
|
46
|
-
exports.
|
|
46
|
+
exports.SearchNotFoundMessage = SearchNotFoundMessage;
|
|
@@ -37,6 +37,6 @@ import 'formik';
|
|
|
37
37
|
import 'yup';
|
|
38
38
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const SearchNotFoundMessage = ({ title, subtitle, image, }) => (jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [image && jsx("div", { children: image }), jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'regular' }, { children: title || "Don't see your wallet?" })), jsx(Typography, Object.assign({ color: 'primary', variant: 'button_primary', weight: 'regular' }, { children: subtitle || 'Try search instead' }))] })));
|
|
41
41
|
|
|
42
|
-
export {
|
|
42
|
+
export { SearchNotFoundMessage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SearchNotFoundMessage } from './SearchNotFoundMessage';
|
|
@@ -26,7 +26,8 @@ require('@dynamic-labs/utils');
|
|
|
26
26
|
var localStorage = require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
27
27
|
require('ethers');
|
|
28
28
|
require('../../shared/consts/index.cjs');
|
|
29
|
-
var
|
|
29
|
+
var noWalletFound = require('../../assets/no-wallet-found.cjs');
|
|
30
|
+
var SearchNotFoundMessage = require('./SearchNotFoundMessage/SearchNotFoundMessage.cjs');
|
|
30
31
|
var WalletListItem = require('./WalletListItem/WalletListItem.cjs');
|
|
31
32
|
|
|
32
33
|
localStorage.LocalStorage.setToLS(localStorage$1.WALLET_PICKER_SEARCH_KEY, '');
|
|
@@ -77,7 +78,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
77
78
|
};
|
|
78
79
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'wallet-list__container' }, { children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsxRuntime.jsx(Search.Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }))), jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('wallet-list__scroll-container', {
|
|
79
80
|
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
80
|
-
}), "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: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), walletsList.map((wallet) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key)))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(
|
|
81
|
+
}), "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: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try seaching for a different wallet', image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key))))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, {}))] }))] })), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
|
|
81
82
|
'wallet-list__tiny-footer--hidden': footerIsVisible,
|
|
82
83
|
}), "data-testid": 'wallet-list-tiny-footer' }))] }));
|
|
83
84
|
};
|
|
@@ -22,7 +22,8 @@ import '@dynamic-labs/utils';
|
|
|
22
22
|
import { LocalStorage } from '../../shared/utils/classes/storage/localStorage.js';
|
|
23
23
|
import 'ethers';
|
|
24
24
|
import '../../shared/consts/index.js';
|
|
25
|
-
import {
|
|
25
|
+
import { ReactComponent as SvgNoWalletFound } from '../../assets/no-wallet-found.js';
|
|
26
|
+
import { SearchNotFoundMessage } from './SearchNotFoundMessage/SearchNotFoundMessage.js';
|
|
26
27
|
import { WalletListItem } from './WalletListItem/WalletListItem.js';
|
|
27
28
|
|
|
28
29
|
LocalStorage.setToLS(WALLET_PICKER_SEARCH_KEY, '');
|
|
@@ -73,7 +74,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
73
74
|
};
|
|
74
75
|
return (jsxs(Fragment, { children: [jsxs("div", Object.assign({ className: 'wallet-list__container' }, { children: [error && jsx(ErrorContainer, { children: error }), !projectSettings ? (jsx(Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsx(Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }))), jsxs("div", Object.assign({ className: classNames('wallet-list__scroll-container', {
|
|
75
76
|
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
76
|
-
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [wallets.length === 0 && (jsx(ErrorContainer, { children: "Oops, no login methods have been configured." })), walletsList.map((wallet) => (jsx(WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key)))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(
|
|
77
|
+
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll }, { children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [wallets.length === 0 && (jsx(ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsx(SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try seaching for a different wallet', image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet) => (jsx(WalletListItem, { wallet: wallet, connectedWallets: connectedWallets, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key))))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchNotFoundMessage, {}))] }))] })), noDefaultFooter && (jsx("div", { className: classNames('wallet-list__tiny-footer', {
|
|
77
78
|
'wallet-list__tiny-footer--hidden': footerIsVisible,
|
|
78
79
|
}), "data-testid": 'wallet-list-tiny-footer' }))] }));
|
|
79
80
|
};
|
|
@@ -5,14 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
7
|
require('react');
|
|
8
|
-
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
9
8
|
require('@dynamic-labs/sdk-api');
|
|
10
9
|
require('../../../../shared/logger.cjs');
|
|
11
10
|
require('@dynamic-labs/iconic');
|
|
12
11
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
12
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
-
var unlink = require('../../../../shared/assets/unlink.cjs');
|
|
15
|
-
var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
16
13
|
require('@dynamic-labs/utils');
|
|
17
14
|
require('../../../../utils/constants/colors.cjs');
|
|
18
15
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
@@ -33,8 +30,6 @@ require('../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagic
|
|
|
33
30
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
34
31
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
35
32
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
36
|
-
var StatusDot = require('../../../../components/StatusDot/StatusDot.cjs');
|
|
37
|
-
var Button = require('../../../../components/Button/Button.cjs');
|
|
38
33
|
require('../../../../components/Alert/Alert.cjs');
|
|
39
34
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
40
35
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
@@ -44,9 +39,33 @@ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
44
39
|
require('formik');
|
|
45
40
|
require('yup');
|
|
46
41
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
42
|
+
var WalletInformationCard = require('../../../../components/WalletInformationCard/WalletInformationCard.cjs');
|
|
43
|
+
var DotsMenu = require('../../../DynamicWidget/components/DotsMenu/DotsMenu.cjs');
|
|
44
|
+
var useFetchNameService = require('../../../DynamicWidget/hooks/useFetchNameService/useFetchNameService.cjs');
|
|
47
45
|
|
|
48
|
-
const DynamicBridgeWalletCardBody = ({ walletAddress, walletBalance,
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const DynamicBridgeWalletCardBody = ({ walletAddress, walletBalance, walletName, onUnlinkClick }) => {
|
|
47
|
+
const nameService = useFetchNameService.useFetchNameService(walletAddress);
|
|
48
|
+
const options = [
|
|
49
|
+
{
|
|
50
|
+
Icon: null,
|
|
51
|
+
callback: () => (nameService === null || nameService === void 0 ? void 0 : nameService.name) && navigator.clipboard.writeText(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
52
|
+
hide: !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
53
|
+
text: 'Copy ENS',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
Icon: null,
|
|
57
|
+
callback: () => walletAddress && navigator.clipboard.writeText(walletAddress),
|
|
58
|
+
hide: !walletAddress,
|
|
59
|
+
text: 'Copy wallet address',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
Icon: null,
|
|
63
|
+
callback: () => onUnlinkClick === null || onUnlinkClick === void 0 ? void 0 : onUnlinkClick(),
|
|
64
|
+
hide: !onUnlinkClick,
|
|
65
|
+
text: 'Disconnect',
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
return (jsxRuntime.jsx(WalletInformationCard.WalletInformationCard, { ens: nameService === null || nameService === void 0 ? void 0 : nameService.name, address: walletAddress, icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletName: walletName }), balance: walletBalance, menu: jsxRuntime.jsx(DotsMenu.DotsMenu, { options: options }) }));
|
|
69
|
+
};
|
|
51
70
|
|
|
52
71
|
exports.DynamicBridgeWalletCardBody = DynamicBridgeWalletCardBody;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
3
3
|
import 'react';
|
|
4
|
-
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
5
4
|
import '@dynamic-labs/sdk-api';
|
|
6
5
|
import '../../../../shared/logger.js';
|
|
7
6
|
import '@dynamic-labs/iconic';
|
|
8
7
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
8
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
10
|
-
import { ReactComponent as SvgUnlink } from '../../../../shared/assets/unlink.js';
|
|
11
|
-
import { shortenWalletAddress } from '../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
12
9
|
import '@dynamic-labs/utils';
|
|
13
10
|
import '../../../../utils/constants/colors.js';
|
|
14
11
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
@@ -29,8 +26,6 @@ import '../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicI
|
|
|
29
26
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
30
27
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
31
28
|
import '../../../../components/IconButton/IconButton.js';
|
|
32
|
-
import { StatusDot } from '../../../../components/StatusDot/StatusDot.js';
|
|
33
|
-
import { Button } from '../../../../components/Button/Button.js';
|
|
34
29
|
import '../../../../components/Alert/Alert.js';
|
|
35
30
|
import '../../../../context/MockContext/MockContext.js';
|
|
36
31
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -40,9 +35,33 @@ import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
|
40
35
|
import 'formik';
|
|
41
36
|
import 'yup';
|
|
42
37
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
38
|
+
import { WalletInformationCard } from '../../../../components/WalletInformationCard/WalletInformationCard.js';
|
|
39
|
+
import { DotsMenu } from '../../../DynamicWidget/components/DotsMenu/DotsMenu.js';
|
|
40
|
+
import { useFetchNameService } from '../../../DynamicWidget/hooks/useFetchNameService/useFetchNameService.js';
|
|
43
41
|
|
|
44
|
-
const DynamicBridgeWalletCardBody = ({ walletAddress, walletBalance,
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const DynamicBridgeWalletCardBody = ({ walletAddress, walletBalance, walletName, onUnlinkClick }) => {
|
|
43
|
+
const nameService = useFetchNameService(walletAddress);
|
|
44
|
+
const options = [
|
|
45
|
+
{
|
|
46
|
+
Icon: null,
|
|
47
|
+
callback: () => (nameService === null || nameService === void 0 ? void 0 : nameService.name) && navigator.clipboard.writeText(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
48
|
+
hide: !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
49
|
+
text: 'Copy ENS',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
Icon: null,
|
|
53
|
+
callback: () => walletAddress && navigator.clipboard.writeText(walletAddress),
|
|
54
|
+
hide: !walletAddress,
|
|
55
|
+
text: 'Copy wallet address',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
Icon: null,
|
|
59
|
+
callback: () => onUnlinkClick === null || onUnlinkClick === void 0 ? void 0 : onUnlinkClick(),
|
|
60
|
+
hide: !onUnlinkClick,
|
|
61
|
+
text: 'Disconnect',
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
return (jsx(WalletInformationCard, { ens: nameService === null || nameService === void 0 ? void 0 : nameService.name, address: walletAddress, icon: jsx(WalletIcon, { walletName: walletName }), balance: walletBalance, menu: jsx(DotsMenu, { options: options }) }));
|
|
65
|
+
};
|
|
47
66
|
|
|
48
67
|
export { DynamicBridgeWalletCardBody };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SearchInstead } from './SearchInstead';
|