@dynamic-labs/sdk-react-core 0.18.0-RC.14 → 0.18.0-RC.16
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 +33 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/index.cjs +2 -0
- package/src/index.js +1 -0
- package/src/lib/Main.cjs +45 -6
- package/src/lib/Main.js +45 -6
- package/src/lib/assets/no-wallet-found.cjs +8 -8
- package/src/lib/assets/no-wallet-found.js +8 -8
- package/src/lib/components/LogoutButton/LogoutButton.cjs +17 -3
- package/src/lib/components/LogoutButton/LogoutButton.js +17 -3
- package/src/lib/components/PoweredByDynamic/PoweredByDynamic.cjs +9 -1
- package/src/lib/components/PoweredByDynamic/PoweredByDynamic.js +9 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +1 -1
- package/src/lib/components/Toolkit/Toolkit.cjs +3 -3
- package/src/lib/components/Toolkit/Toolkit.js +3 -3
- package/src/lib/components/Toolkit/components/MultiWalletSwitch.cjs +18 -0
- package/src/lib/components/Toolkit/components/MultiWalletSwitch.d.ts +8 -0
- package/src/lib/components/Toolkit/components/MultiWalletSwitch.js +14 -0
- package/src/lib/components/Toolkit/components/index.d.ts +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +42 -12
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +5 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +43 -14
- package/src/lib/context/DynamicContext/helpers.cjs +5 -4
- package/src/lib/context/DynamicContext/helpers.d.ts +3 -1
- package/src/lib/context/DynamicContext/helpers.js +5 -4
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +1 -0
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.d.ts +2 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +1 -1
- package/src/lib/shared/types/index.d.ts +1 -0
- package/src/lib/shared/utils/classes/storage/localStorage.cjs +36 -24
- package/src/lib/shared/utils/classes/storage/localStorage.d.ts +16 -3
- package/src/lib/shared/utils/classes/storage/localStorage.js +37 -25
- package/src/lib/shared/utils/hooks/index.d.ts +1 -0
- package/src/lib/shared/utils/hooks/useEffectOnce/index.d.ts +1 -0
- package/src/lib/shared/utils/hooks/useEffectOnce/useEffectOnce.cjs +27 -0
- package/src/lib/shared/utils/hooks/useEffectOnce/useEffectOnce.d.ts +17 -0
- package/src/lib/shared/utils/hooks/useEffectOnce/useEffectOnce.js +23 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getAuthToken/getAuthToken.cjs +2 -1
- package/src/lib/utils/functions/getAuthToken/getAuthToken.d.ts +1 -1
- package/src/lib/utils/functions/getAuthToken/getAuthToken.js +2 -1
- package/src/lib/utils/functions/storeAuthToken/index.cjs +1 -3
- package/src/lib/utils/functions/storeAuthToken/index.js +1 -3
- package/src/lib/utils/hooks/index.d.ts +2 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs +17 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +8 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +13 -0
- package/src/lib/utils/hooks/useApplyWalletConnectorNetwork/useApplyWalletConnectorNetwork.cjs +29 -0
- package/src/lib/utils/hooks/useApplyWalletConnectorNetwork/useApplyWalletConnectorNetwork.d.ts +5 -0
- package/src/lib/utils/hooks/useApplyWalletConnectorNetwork/useApplyWalletConnectorNetwork.js +25 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +20 -5
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +5 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +20 -5
- package/src/lib/utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.cjs +11 -18
- package/src/lib/utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.js +11 -18
- package/src/lib/utils/hooks/useEventListener/index.d.ts +1 -0
- package/src/lib/utils/hooks/useEventListener/useEventListener.cjs +25 -0
- package/src/lib/utils/hooks/useEventListener/useEventListener.d.ts +1 -0
- package/src/lib/utils/hooks/useEventListener/useEventListener.js +21 -0
- package/src/lib/utils/hooks/usePromise/usePromise.cjs +71 -18
- package/src/lib/utils/hooks/usePromise/usePromise.d.ts +14 -0
- package/src/lib/utils/hooks/usePromise/usePromise.js +72 -19
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +1 -1
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +9 -8
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +9 -8
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +5 -9
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +5 -9
- package/src/lib/views/NoAccess/useNoAccessText.cjs +1 -1
- package/src/lib/views/NoAccess/useNoAccessText.js +1 -1
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.cjs +2 -1
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.d.ts +2 -2
- package/src/lib/views/WalletList/SearchNotFoundMessage/SearchNotFoundMessage.js +2 -1
- package/src/lib/views/WalletList/WalletList.cjs +1 -1
- package/src/lib/views/WalletList/WalletList.js +1 -1
- package/src/lib/components/Toolkit/components/BrandStyleSwitch.cjs +0 -22
- package/src/lib/components/Toolkit/components/BrandStyleSwitch.d.ts +0 -2
- package/src/lib/components/Toolkit/components/BrandStyleSwitch.js +0 -18
|
@@ -19,7 +19,6 @@ require('ethers');
|
|
|
19
19
|
require('../../shared/consts/index.cjs');
|
|
20
20
|
var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
21
21
|
require('@dynamic-labs/multi-wallet');
|
|
22
|
-
var createUserProfile = require('../../utils/functions/createUserProfile/createUserProfile.cjs');
|
|
23
22
|
var isSupportedNetwork = require('../../utils/functions/isSupportedNetwork/isSupportedNetwork.cjs');
|
|
24
23
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
25
24
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
@@ -48,12 +47,11 @@ require('yup');
|
|
|
48
47
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
49
48
|
var NetworkPicker = require('../../components/NetworkPicker/NetworkPicker.cjs');
|
|
50
49
|
var UserAddress = require('../../components/UserAddress/UserAddress.cjs');
|
|
51
|
-
var AuthProviderIcon = require('../../components/AuthProviderIcon/AuthProviderIcon.cjs');
|
|
52
50
|
var SelectNetworkButton = require('../../components/SelectNetworkButton/SelectNetworkButton.cjs');
|
|
51
|
+
var useApplyWalletConnectorNetwork = require('../../utils/hooks/useApplyWalletConnectorNetwork/useApplyWalletConnectorNetwork.cjs');
|
|
53
52
|
|
|
54
53
|
const NetworkNotSupported = () => {
|
|
55
|
-
|
|
56
|
-
const { onboardingOnlyJwt, network, onboardingImageUrl, selectedWalletConnector: walletConnector, decodedOnboardingOnlyToken, setNetwork, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
54
|
+
const { network, onboardingImageUrl, selectedWalletConnector: walletConnector, setNetwork, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
57
55
|
const finishConnectAndSign = useConnectAndSign.useConnectAndSign();
|
|
58
56
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = React.useState(false);
|
|
59
57
|
const onChainChange = (network) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -66,12 +64,13 @@ const NetworkNotSupported = () => {
|
|
|
66
64
|
// We can't listen on the network defined in the context,
|
|
67
65
|
// because events on the primaryWallet are defined after message is signed.
|
|
68
66
|
useWalletConnectorEvents.useWalletConnectorEvents(walletConnector, { onChainChange });
|
|
67
|
+
// Updates the contexts 'network' based on the selected wallet connector.
|
|
68
|
+
// It helps ensure that the 'network' is always in sync with the wallet's actual network,
|
|
69
|
+
// Prevents 'network' from being 'undefined'.
|
|
70
|
+
useApplyWalletConnectorNetwork.useApplyWalletConnectorNetwork({ walletConnector });
|
|
69
71
|
if (!walletConnector) {
|
|
70
72
|
return null;
|
|
71
73
|
}
|
|
72
|
-
const userProfile = decodedOnboardingOnlyToken && createUserProfile.createUserProfile(decodedOnboardingOnlyToken);
|
|
73
|
-
const evmNetworks = walletConnector.evmNetworks || [];
|
|
74
|
-
const _isSupportedNetwork = isSupportedNetwork.isSupportedNetwork({ network, walletConnector });
|
|
75
74
|
const onSelectNetworkButtonClick = (networkId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
76
75
|
try {
|
|
77
76
|
yield walletConnector.switchNetwork({
|
|
@@ -84,7 +83,9 @@ const NetworkNotSupported = () => {
|
|
|
84
83
|
logger.logger.debug(e);
|
|
85
84
|
}
|
|
86
85
|
});
|
|
87
|
-
|
|
86
|
+
const evmNetworks = walletConnector.evmNetworks || [];
|
|
87
|
+
const _isSupportedNetwork = isSupportedNetwork.isSupportedNetwork({ network, walletConnector });
|
|
88
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: 'network-not-supported', "data-testid": 'network-not-supported' }, { children: [onboardingImageUrl && (jsxRuntime.jsx("img", { className: 'network-not-supported__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, Object.assign({ variant: 'info', withIcon: false, className: 'network-not-supported__error--not-supported' }, { children: "This network is not available, please update." }))), jsxRuntime.jsxs("div", Object.assign({ className: 'network-not-supported__content-container' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'network-not-supported__img-container' }, { children: jsxRuntime.jsx(walletBook.WalletIcon, { style: { height: 64, width: 64 }, walletName: walletConnector.name }) })), jsxRuntime.jsx(UserAddress.UserAddress, { walletConnector: walletConnector }), jsxRuntime.jsx("div", Object.assign({ className: 'network-not-supported__network-container' }, { children: evmNetworks.length > 1 && (jsxRuntime.jsx(NetworkPicker.NetworkPicker, { evmNetworks: evmNetworks, connector: walletConnector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, showNetworkName: true, buttonClassName: 'network-not-supported__network-picker-button', mainClassName: 'network-not-supported__network-picker' })) })), jsxRuntime.jsxs("div", Object.assign({ className: 'network-not-supported__welcome-container' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'title', color: 'primary', className: 'network-not-supported__welcome-title' }, { children: "Update Network" })), jsxRuntime.jsx(Typography.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 && (jsxRuntime.jsx(SelectNetworkButton.SelectNetworkButton, { onClick: onSelectNetworkButtonClick, networkId: evmNetworks[0].networkId, networkName: evmNetworks[0].vanityName || evmNetworks[0].name, networkIconUrl: evmNetworks[0].iconUrls[0] }))] }))] })));
|
|
88
89
|
};
|
|
89
90
|
|
|
90
91
|
exports.NetworkNotSupported = NetworkNotSupported;
|
|
@@ -15,7 +15,6 @@ import 'ethers';
|
|
|
15
15
|
import '../../shared/consts/index.js';
|
|
16
16
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
|
|
17
17
|
import '@dynamic-labs/multi-wallet';
|
|
18
|
-
import { createUserProfile } from '../../utils/functions/createUserProfile/createUserProfile.js';
|
|
19
18
|
import { isSupportedNetwork } from '../../utils/functions/isSupportedNetwork/isSupportedNetwork.js';
|
|
20
19
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
21
20
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
@@ -44,12 +43,11 @@ import 'yup';
|
|
|
44
43
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
45
44
|
import { NetworkPicker } from '../../components/NetworkPicker/NetworkPicker.js';
|
|
46
45
|
import { UserAddress } from '../../components/UserAddress/UserAddress.js';
|
|
47
|
-
import { AuthProviderIcon } from '../../components/AuthProviderIcon/AuthProviderIcon.js';
|
|
48
46
|
import { SelectNetworkButton } from '../../components/SelectNetworkButton/SelectNetworkButton.js';
|
|
47
|
+
import { useApplyWalletConnectorNetwork } from '../../utils/hooks/useApplyWalletConnectorNetwork/useApplyWalletConnectorNetwork.js';
|
|
49
48
|
|
|
50
49
|
const NetworkNotSupported = () => {
|
|
51
|
-
|
|
52
|
-
const { onboardingOnlyJwt, network, onboardingImageUrl, selectedWalletConnector: walletConnector, decodedOnboardingOnlyToken, setNetwork, } = useInternalDynamicContext();
|
|
50
|
+
const { network, onboardingImageUrl, selectedWalletConnector: walletConnector, setNetwork, } = useInternalDynamicContext();
|
|
53
51
|
const finishConnectAndSign = useConnectAndSign();
|
|
54
52
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
55
53
|
const onChainChange = (network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -62,12 +60,13 @@ const NetworkNotSupported = () => {
|
|
|
62
60
|
// We can't listen on the network defined in the context,
|
|
63
61
|
// because events on the primaryWallet are defined after message is signed.
|
|
64
62
|
useWalletConnectorEvents(walletConnector, { onChainChange });
|
|
63
|
+
// Updates the contexts 'network' based on the selected wallet connector.
|
|
64
|
+
// It helps ensure that the 'network' is always in sync with the wallet's actual network,
|
|
65
|
+
// Prevents 'network' from being 'undefined'.
|
|
66
|
+
useApplyWalletConnectorNetwork({ walletConnector });
|
|
65
67
|
if (!walletConnector) {
|
|
66
68
|
return null;
|
|
67
69
|
}
|
|
68
|
-
const userProfile = decodedOnboardingOnlyToken && createUserProfile(decodedOnboardingOnlyToken);
|
|
69
|
-
const evmNetworks = walletConnector.evmNetworks || [];
|
|
70
|
-
const _isSupportedNetwork = isSupportedNetwork({ network, walletConnector });
|
|
71
70
|
const onSelectNetworkButtonClick = (networkId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
71
|
try {
|
|
73
72
|
yield walletConnector.switchNetwork({
|
|
@@ -80,7 +79,9 @@ const NetworkNotSupported = () => {
|
|
|
80
79
|
logger.debug(e);
|
|
81
80
|
}
|
|
82
81
|
});
|
|
83
|
-
|
|
82
|
+
const evmNetworks = walletConnector.evmNetworks || [];
|
|
83
|
+
const _isSupportedNetwork = isSupportedNetwork({ network, walletConnector });
|
|
84
|
+
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: [jsx("div", Object.assign({ className: 'network-not-supported__img-container' }, { children: jsx(WalletIcon, { style: { height: 64, width: 64 }, walletName: walletConnector.name }) })), jsx(UserAddress, { walletConnector: walletConnector }), 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
85
|
};
|
|
85
86
|
|
|
86
87
|
export { NetworkNotSupported };
|
|
@@ -47,14 +47,13 @@ require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
|
47
47
|
require('formik');
|
|
48
48
|
require('yup');
|
|
49
49
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
50
|
-
var
|
|
50
|
+
var useApplyWalletConnectorNetwork = require('../../utils/hooks/useApplyWalletConnectorNetwork/useApplyWalletConnectorNetwork.cjs');
|
|
51
51
|
|
|
52
52
|
// The component notifies the user about the required manual network change,
|
|
53
53
|
// as the wallet does not support programmatic network change.
|
|
54
54
|
const NetworkNotSupportedSwitchManual = () => {
|
|
55
55
|
var _a, _b;
|
|
56
|
-
const { user,
|
|
57
|
-
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback.useUpdateUserProfileByJWTCallback();
|
|
56
|
+
const { user, selectedWalletConnector: walletConnector } = useInternalDynamicContext.useInternalDynamicContext();
|
|
58
57
|
const finishConnectAndSign = useConnectAndSign.useConnectAndSign();
|
|
59
58
|
const onChainChange = React.useCallback((network) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
60
59
|
if (isSupportedNetwork.isSupportedNetwork({ network, walletConnector })) {
|
|
@@ -64,15 +63,12 @@ const NetworkNotSupportedSwitchManual = () => {
|
|
|
64
63
|
}
|
|
65
64
|
}),
|
|
66
65
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
-
[
|
|
68
|
-
finishConnectAndSign,
|
|
69
|
-
onboardingOnlyJwt,
|
|
70
|
-
updateUserProfileByJWT,
|
|
71
|
-
walletConnector,
|
|
72
|
-
]);
|
|
66
|
+
[finishConnectAndSign, walletConnector]);
|
|
73
67
|
// We can't listen on the network defined in the context,
|
|
74
68
|
// because events on the primaryWallet are defined after message is signed.
|
|
75
69
|
useWalletConnectorEvents.useWalletConnectorEvents(walletConnector, { onChainChange });
|
|
70
|
+
// Applies walletConnectors network to the context data
|
|
71
|
+
useApplyWalletConnectorNetwork.useApplyWalletConnectorNetwork({ walletConnector });
|
|
76
72
|
const iconSize = 80;
|
|
77
73
|
const icon = (jsxRuntime.jsx(walletBook.WalletIcon, { walletName: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.name, style: {
|
|
78
74
|
height: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
|
|
@@ -43,14 +43,13 @@ import '../../components/Popper/PopperContext/PopperContext.js';
|
|
|
43
43
|
import 'formik';
|
|
44
44
|
import 'yup';
|
|
45
45
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
46
|
-
import {
|
|
46
|
+
import { useApplyWalletConnectorNetwork } from '../../utils/hooks/useApplyWalletConnectorNetwork/useApplyWalletConnectorNetwork.js';
|
|
47
47
|
|
|
48
48
|
// The component notifies the user about the required manual network change,
|
|
49
49
|
// as the wallet does not support programmatic network change.
|
|
50
50
|
const NetworkNotSupportedSwitchManual = () => {
|
|
51
51
|
var _a, _b;
|
|
52
|
-
const { user,
|
|
53
|
-
const { updateUserProfileByJWT } = useUpdateUserProfileByJWTCallback();
|
|
52
|
+
const { user, selectedWalletConnector: walletConnector } = useInternalDynamicContext();
|
|
54
53
|
const finishConnectAndSign = useConnectAndSign();
|
|
55
54
|
const onChainChange = useCallback((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
55
|
if (isSupportedNetwork({ network, walletConnector })) {
|
|
@@ -60,15 +59,12 @@ const NetworkNotSupportedSwitchManual = () => {
|
|
|
60
59
|
}
|
|
61
60
|
}),
|
|
62
61
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
-
[
|
|
64
|
-
finishConnectAndSign,
|
|
65
|
-
onboardingOnlyJwt,
|
|
66
|
-
updateUserProfileByJWT,
|
|
67
|
-
walletConnector,
|
|
68
|
-
]);
|
|
62
|
+
[finishConnectAndSign, walletConnector]);
|
|
69
63
|
// We can't listen on the network defined in the context,
|
|
70
64
|
// because events on the primaryWallet are defined after message is signed.
|
|
71
65
|
useWalletConnectorEvents(walletConnector, { onChainChange });
|
|
66
|
+
// Applies walletConnectors network to the context data
|
|
67
|
+
useApplyWalletConnectorNetwork({ walletConnector });
|
|
72
68
|
const iconSize = 80;
|
|
73
69
|
const icon = (jsx(WalletIcon, { walletName: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.name, style: {
|
|
74
70
|
height: pixelToRem(iconSize * iconRatio),
|
|
@@ -84,7 +84,7 @@ const textData = {
|
|
|
84
84
|
_socialMediaLinkText: undefined,
|
|
85
85
|
_socialMediaUrl: undefined,
|
|
86
86
|
buttonTitle: 'Try a different wallet',
|
|
87
|
-
subtitle: '
|
|
87
|
+
subtitle: 'A NFT or a token is required to access this site.',
|
|
88
88
|
title: 'You cannot access the site',
|
|
89
89
|
},
|
|
90
90
|
};
|
|
@@ -80,7 +80,7 @@ const textData = {
|
|
|
80
80
|
_socialMediaLinkText: undefined,
|
|
81
81
|
_socialMediaUrl: undefined,
|
|
82
82
|
buttonTitle: 'Try a different wallet',
|
|
83
|
-
subtitle: '
|
|
83
|
+
subtitle: 'A NFT or a token is required to access this site.',
|
|
84
84
|
title: 'You cannot access the site',
|
|
85
85
|
},
|
|
86
86
|
};
|
|
@@ -20,6 +20,7 @@ require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
|
20
20
|
require('@dynamic-labs/multi-wallet');
|
|
21
21
|
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
22
22
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
23
|
+
var Icon = require('../../../components/Icon/Icon.cjs');
|
|
23
24
|
require('react-dom');
|
|
24
25
|
require('react-focus-lock');
|
|
25
26
|
require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
@@ -41,6 +42,6 @@ require('formik');
|
|
|
41
42
|
require('yup');
|
|
42
43
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
43
44
|
|
|
44
|
-
const SearchNotFoundMessage = ({ title, subtitle, image, }) => (jsxRuntime.jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [image && jsxRuntime.jsx(
|
|
45
|
+
const SearchNotFoundMessage = ({ title, subtitle, image, }) => (jsxRuntime.jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [image && (jsxRuntime.jsx(Icon.Icon, Object.assign({ className: 'search-instead__container__image', color: 'text-tertiary' }, { 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
46
|
|
|
46
47
|
exports.SearchNotFoundMessage = SearchNotFoundMessage;
|
|
@@ -16,6 +16,7 @@ import '../../../context/DynamicContext/DynamicContext.js';
|
|
|
16
16
|
import '@dynamic-labs/multi-wallet';
|
|
17
17
|
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
18
18
|
import '../../../context/ThemeContext/ThemeContext.js';
|
|
19
|
+
import { Icon } from '../../../components/Icon/Icon.js';
|
|
19
20
|
import 'react-dom';
|
|
20
21
|
import 'react-focus-lock';
|
|
21
22
|
import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
@@ -37,6 +38,6 @@ import 'formik';
|
|
|
37
38
|
import 'yup';
|
|
38
39
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
39
40
|
|
|
40
|
-
const SearchNotFoundMessage = ({ title, subtitle, image, }) => (jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [image && jsx(
|
|
41
|
+
const SearchNotFoundMessage = ({ title, subtitle, image, }) => (jsxs("div", Object.assign({ className: 'search-instead__container' }, { children: [image && (jsx(Icon, Object.assign({ className: 'search-instead__container__image', color: 'text-tertiary' }, { 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
42
|
|
|
42
43
|
export { SearchNotFoundMessage };
|
|
@@ -78,7 +78,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
78
78
|
};
|
|
79
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', {
|
|
80
80
|
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
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
|
|
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 searching for a different wallet', image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet) => (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key))))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, {}))] }))] })), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
|
|
82
82
|
'wallet-list__tiny-footer--hidden': footerIsVisible,
|
|
83
83
|
}), "data-testid": 'wallet-list-tiny-footer' }))] }));
|
|
84
84
|
};
|
|
@@ -74,7 +74,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
74
74
|
};
|
|
75
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', {
|
|
76
76
|
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
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
|
|
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 searching for a different wallet', image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet) => (jsx(WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key))))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchNotFoundMessage, {}))] }))] })), noDefaultFooter && (jsx("div", { className: classNames('wallet-list__tiny-footer', {
|
|
78
78
|
'wallet-list__tiny-footer--hidden': footerIsVisible,
|
|
79
79
|
}), "data-testid": 'wallet-list-tiny-footer' }))] }));
|
|
80
80
|
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var ThemeContext = require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
7
|
-
var Switch = require('../../Switch/Switch.cjs');
|
|
8
|
-
|
|
9
|
-
const BrandStyleSwitch = () => {
|
|
10
|
-
const { changeBrandStyle, theme } = ThemeContext.useThemeContext();
|
|
11
|
-
return (jsxRuntime.jsx(Switch.Switch, { firstButton: {
|
|
12
|
-
active: theme.brandStyle === 'bold',
|
|
13
|
-
handleButtonClick: () => changeBrandStyle('bold'),
|
|
14
|
-
name: 'Bold',
|
|
15
|
-
}, secondButton: {
|
|
16
|
-
active: theme.brandStyle === 'subtle',
|
|
17
|
-
handleButtonClick: () => changeBrandStyle('subtle'),
|
|
18
|
-
name: 'Subtle',
|
|
19
|
-
} }));
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
exports.BrandStyleSwitch = BrandStyleSwitch;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useThemeContext } from '../../../context/ThemeContext/ThemeContext.js';
|
|
3
|
-
import { Switch } from '../../Switch/Switch.js';
|
|
4
|
-
|
|
5
|
-
const BrandStyleSwitch = () => {
|
|
6
|
-
const { changeBrandStyle, theme } = useThemeContext();
|
|
7
|
-
return (jsx(Switch, { firstButton: {
|
|
8
|
-
active: theme.brandStyle === 'bold',
|
|
9
|
-
handleButtonClick: () => changeBrandStyle('bold'),
|
|
10
|
-
name: 'Bold',
|
|
11
|
-
}, secondButton: {
|
|
12
|
-
active: theme.brandStyle === 'subtle',
|
|
13
|
-
handleButtonClick: () => changeBrandStyle('subtle'),
|
|
14
|
-
name: 'Subtle',
|
|
15
|
-
} }));
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { BrandStyleSwitch };
|