@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.
Files changed (79) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +9 -9
  5. package/src/lib/Main.cjs +2 -2
  6. package/src/lib/Main.js +2 -2
  7. package/src/lib/assets/index.d.ts +1 -0
  8. package/src/lib/assets/no-wallet-found.cjs +75 -0
  9. package/src/lib/assets/no-wallet-found.js +51 -0
  10. package/src/lib/components/TosAndPp/TosAndPp.cjs +18 -3
  11. package/src/lib/components/TosAndPp/TosAndPp.d.ts +1 -6
  12. package/src/lib/components/TosAndPp/TosAndPp.js +19 -4
  13. package/src/lib/components/WalletInformationCard/WalletInformationCard.cjs +33 -0
  14. package/src/lib/components/WalletInformationCard/WalletInformationCard.d.ts +11 -0
  15. package/src/lib/components/WalletInformationCard/WalletInformationCard.js +29 -0
  16. package/src/lib/components/WalletInformationCard/index.d.ts +1 -0
  17. package/src/lib/components/index.d.ts +1 -0
  18. package/src/lib/context/DynamicContext/DynamicContext.cjs +10 -7
  19. package/src/lib/context/DynamicContext/DynamicContext.d.ts +8 -2
  20. package/src/lib/context/DynamicContext/DynamicContext.js +10 -7
  21. package/src/lib/context/WalletContext/WalletContext.cjs +4 -2
  22. package/src/lib/context/WalletContext/WalletContext.d.ts +3 -1
  23. package/src/lib/context/WalletContext/WalletContext.js +4 -2
  24. package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +4 -3
  25. package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +4 -3
  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/isEmailProviderEnabled/isEmailProviderEnabled.cjs +1 -0
  29. package/src/lib/utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.js +1 -0
  30. package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.cjs +1 -1
  31. package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.js +1 -1
  32. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +5 -5
  33. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +6 -6
  34. package/src/lib/utils/hooks/index.d.ts +1 -0
  35. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +9 -2
  36. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +5 -2
  37. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +9 -2
  38. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +5 -3
  39. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +5 -3
  40. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +14 -27
  41. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -3
  42. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +15 -28
  43. package/src/lib/utils/hooks/useConnectWithEmail/index.d.ts +1 -0
  44. package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.cjs +1 -4
  45. package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.d.ts +1 -4
  46. package/src/lib/utils/hooks/useConnectWithEmail/useConnectWithEmail.js +1 -4
  47. package/src/lib/utils/hooks/useEmailProvider/index.d.ts +1 -0
  48. package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +54 -0
  49. package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.d.ts +10 -0
  50. package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +50 -0
  51. package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +3 -0
  52. package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +3 -0
  53. package/src/lib/utils/hooks/useWalletConnectorEvents/useWalletConnectorEvents.cjs +17 -0
  54. package/src/lib/utils/hooks/useWalletConnectorEvents/useWalletConnectorEvents.d.ts +2 -0
  55. package/src/lib/utils/hooks/useWalletConnectorEvents/useWalletConnectorEvents.js +13 -0
  56. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +20 -3
  57. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +3 -2
  58. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +20 -3
  59. package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +8 -8
  60. package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +8 -8
  61. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +24 -51
  62. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +24 -51
  63. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +7 -5
  64. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +7 -5
  65. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +14 -14
  66. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +14 -14
  67. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +20 -24
  68. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +21 -25
  69. package/src/lib/views/WalletList/{SearchInstead/SearchInstead.cjs → SearchNotFoundMessage/SearchNotFoundMessage.cjs} +2 -2
  70. package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.d.ts +8 -0
  71. package/src/lib/views/WalletList/{SearchInstead/SearchInstead.js → SearchNotFoundMessage/SearchNotFoundMessage.js} +2 -2
  72. package/src/lib/views/WalletList/SearchNotFoundMessage/index.d.ts +1 -0
  73. package/src/lib/views/WalletList/WalletList.cjs +3 -2
  74. package/src/lib/views/WalletList/WalletList.js +3 -2
  75. package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +27 -8
  76. package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.d.ts +0 -1
  77. package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +28 -9
  78. package/src/lib/views/WalletList/SearchInstead/SearchInstead.d.ts +0 -2
  79. 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, setShowAuthFlow, setCallback, setNetwork, } = useInternalDynamicContext();
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
- handleNetworkChange();
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', customCallbackOnSuccess: handleNetworkChange })) })), 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] }))] }))] })));
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, setShowAuthFlow, } = useInternalDynamicContext.useInternalDynamicContext();
56
+ const { user, onboardingOnlyJwt, selectedWalletConnector: walletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
56
57
  const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
57
- const finishSign = useConnectAndSign.useConnectAndSign();
58
- // Listen for network changes
59
- React.useEffect(() => {
60
- if (!walletConnector)
61
- return;
62
- const onChainChange = (network) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
63
- if (isSupportedNetwork.isSupportedNetwork({ network, walletConnector })) {
64
- if (onboardingOnlyJwt) {
65
- updateUserProfileByJWT(onboardingOnlyJwt);
66
- setShowAuthFlow(false);
67
- }
68
- else {
69
- finishSign({ walletConnector });
70
- }
71
- }
72
- });
73
- walletConnector.setupEventListeners({
74
- onChainChange,
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 { useEffect } from 'react';
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, setShowAuthFlow, } = useInternalDynamicContext();
52
+ const { user, onboardingOnlyJwt, selectedWalletConnector: walletConnector, } = useInternalDynamicContext();
52
53
  const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
53
- const finishSign = useConnectAndSign();
54
- // Listen for network changes
55
- useEffect(() => {
56
- if (!walletConnector)
57
- return;
58
- const onChainChange = (network) => __awaiter(void 0, void 0, void 0, function* () {
59
- if (isSupportedNetwork({ network, walletConnector })) {
60
- if (onboardingOnlyJwt) {
61
- updateUserProfileByJWT(onboardingOnlyJwt);
62
- setShowAuthFlow(false);
63
- }
64
- else {
65
- finishSign({ walletConnector });
66
- }
67
- }
68
- });
69
- walletConnector.setupEventListeners({
70
- onChainChange,
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 SearchInstead = () => (jsxRuntime.jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'regular' }, { children: "Don't see your wallet?" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'primary', variant: 'button_primary', weight: 'regular' }, { children: "Try search instead" }))] })));
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.SearchInstead = SearchInstead;
46
+ exports.SearchNotFoundMessage = SearchNotFoundMessage;
@@ -0,0 +1,8 @@
1
+ import { FC, ReactNode } from 'react';
2
+ interface Props {
3
+ title?: string;
4
+ subtitle?: string;
5
+ image?: ReactNode;
6
+ }
7
+ export declare const SearchNotFoundMessage: FC<Props>;
8
+ export {};
@@ -37,6 +37,6 @@ import 'formik';
37
37
  import 'yup';
38
38
  import '../../../components/InlineWidget/InlineWidget.js';
39
39
 
40
- const SearchInstead = () => (jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'regular' }, { children: "Don't see your wallet?" })), jsx(Typography, Object.assign({ color: 'primary', variant: 'button_primary', weight: 'regular' }, { children: "Try search instead" }))] })));
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 { SearchInstead };
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 SearchInstead = require('./SearchInstead/SearchInstead.cjs');
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(SearchInstead.SearchInstead, {}))] }))] })), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
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 { SearchInstead } from './SearchInstead/SearchInstead.js';
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(SearchInstead, {}))] }))] })), noDefaultFooter && (jsx("div", { className: classNames('wallet-list__tiny-footer', {
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, walletCurrency, walletName, onUnlinkClick, }) => (jsxRuntime.jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__body' }, { children: [jsxRuntime.jsx(walletBook.WalletIcon, { className: 'dynamic-bridge-wallet-card__wallet-icon', walletName: walletName }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__wallet-address' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: shortenWalletAddress.shortenWalletAddress(walletAddress, 3, 3) })), jsxRuntime.jsx(StatusDot.StatusDot, { variant: 'green' })] })), jsxRuntime.jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__balance' }, { children: [walletBalance, jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'medium', as: 'span', color: 'secondary' }, { children: walletCurrency }))] }))] }), onUnlinkClick && (jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: 'dynamic-bridge-wallet-card__unlink-button', buttonPadding: 'none', buttonVariant: 'secondary', typographyProps: {
49
- color: 'secondary',
50
- }, startSlot: jsxRuntime.jsx(unlink.ReactComponent, {}), onClick: onUnlinkClick }, { children: "Unlink" })))] })));
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;
@@ -2,7 +2,6 @@ import { FC, ReactElement } from 'react';
2
2
  export type DynamicBridgeWalletCardBodyProps = {
3
3
  walletName: string;
4
4
  walletAddress: string;
5
- walletCurrency?: string;
6
5
  walletBalance?: ReactElement;
7
6
  onUnlinkClick?: () => void;
8
7
  };
@@ -1,14 +1,11 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
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, walletCurrency, walletName, onUnlinkClick, }) => (jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__body' }, { children: [jsx(WalletIcon, { className: 'dynamic-bridge-wallet-card__wallet-icon', walletName: walletName }), jsxs("div", { children: [jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__wallet-address' }, { children: [jsx(Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: shortenWalletAddress(walletAddress, 3, 3) })), jsx(StatusDot, { variant: 'green' })] })), jsxs("div", Object.assign({ className: 'dynamic-bridge-wallet-card__balance' }, { children: [walletBalance, jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'medium', as: 'span', color: 'secondary' }, { children: walletCurrency }))] }))] }), onUnlinkClick && (jsx(Button, Object.assign({ buttonClassName: 'dynamic-bridge-wallet-card__unlink-button', buttonPadding: 'none', buttonVariant: 'secondary', typographyProps: {
45
- color: 'secondary',
46
- }, startSlot: jsx(SvgUnlink, {}), onClick: onUnlinkClick }, { children: "Unlink" })))] })));
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,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const SearchInstead: () => JSX.Element;
@@ -1 +0,0 @@
1
- export { SearchInstead } from './SearchInstead';