@dynamic-labs/sdk-react-core 0.18.0-RC.14 → 0.18.0-RC.15
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 +20 -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/PoweredByDynamic/PoweredByDynamic.cjs +8 -1
- package/src/lib/components/PoweredByDynamic/PoweredByDynamic.js +8 -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/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
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js
CHANGED
|
@@ -32,7 +32,7 @@ import { PoweredByDynamic } from '../PoweredByDynamic/PoweredByDynamic.js';
|
|
|
32
32
|
const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBack, title, error, appOrigin, appLogoUrl, appName, onClickSend, disableSendButton, displayPoweredByDynamicFooter = false, warningMessage, children, }) => {
|
|
33
33
|
const closeButton = onClickClose && (jsx(IconButton, Object.assign({ type: 'button', onClick: onClickClose, "data-testid": 'close', disabled: isLoading }, { children: jsx(SvgClose, {}) })));
|
|
34
34
|
const backButton = onClickBack && (jsx(IconButton, Object.assign({ type: 'button', onClick: onClickBack, "data-testid": 'back-button' }, { children: jsx(SvgChevronLeft, {}) })));
|
|
35
|
-
return (jsxs(Fragment, { children: [jsx(ModalHeader, Object.assign({ trailing: closeButton, leading: backButton, alignContent: 'bottom' }, { children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, Object.assign({ color: 'brand-primary' }, { children: jsx(SvgSignCircle, Object.assign({}, props)) }))), iconSize: 64, isSpinning: true }) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__body' }, { children: [jsx(Typography, Object.assign({ variant: 'title', color: 'primary', className: 'transaction-confirmation__title' }, { children: title })), jsx(AnimatePresence, Object.assign({ animationComponent: jsx(VerticalDrawerTransition, {}) }, { children: error && (jsx("div", Object.assign({ className: 'transaction-confirmation__error' }, { children: jsx(Alert, Object.assign({ icon: 'error', variant: 'error' }, { children: error })) }))) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__content' }, { children: [jsx("div", Object.assign({ className: 'transaction-confirmation__app-origin-tile' }, { children: jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) })), jsx("div", Object.assign({ className: 'transaction-confirmation__rows' }, { children: children }))] })), jsx(AnimatePresence, Object.assign({ animationComponent: jsx(VerticalDrawerTransition, {}) }, { children: warningMessage && (jsx("div", Object.assign({ className: 'transaction-confirmation__warning' }, { children: jsx(Alert, Object.assign({ icon: 'error', variant: 'warning', contentDataTestId: 'warning_content' }, { children: warningMessage })) }))) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__actions' }, { children: [onClickClose && (jsx(Button, Object.assign({ buttonVariant: 'secondary', onClick: onClickClose, expanded: true, buttonPadding: 'large', buttonRounded: 'default', disabled: isLoading }, { children: "Cancel" }))), jsx(Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', onClick: onClickSend, expanded: true, buttonRounded: 'default', loading: isLoading, disabled: disableSendButton }, { children: "Send" }))] })), displayPoweredByDynamicFooter && (jsx(
|
|
35
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, Object.assign({ trailing: closeButton, leading: backButton, alignContent: 'bottom' }, { children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, Object.assign({ color: 'brand-primary' }, { children: jsx(SvgSignCircle, Object.assign({}, props)) }))), iconSize: 64, isSpinning: true }) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__body' }, { children: [jsx(Typography, Object.assign({ variant: 'title', color: 'primary', className: 'transaction-confirmation__title' }, { children: title })), jsx(AnimatePresence, Object.assign({ animationComponent: jsx(VerticalDrawerTransition, {}) }, { children: error && (jsx("div", Object.assign({ className: 'transaction-confirmation__error' }, { children: jsx(Alert, Object.assign({ icon: 'error', variant: 'error' }, { children: error })) }))) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__content' }, { children: [jsx("div", Object.assign({ className: 'transaction-confirmation__app-origin-tile' }, { children: jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) })), jsx("div", Object.assign({ className: 'transaction-confirmation__rows' }, { children: children }))] })), jsx(AnimatePresence, Object.assign({ animationComponent: jsx(VerticalDrawerTransition, {}) }, { children: warningMessage && (jsx("div", Object.assign({ className: 'transaction-confirmation__warning' }, { children: jsx(Alert, Object.assign({ icon: 'error', variant: 'warning', contentDataTestId: 'warning_content' }, { children: warningMessage })) }))) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__actions' }, { children: [onClickClose && (jsx(Button, Object.assign({ buttonVariant: 'secondary', onClick: onClickClose, expanded: true, buttonPadding: 'large', buttonRounded: 'default', disabled: isLoading }, { children: "Cancel" }))), jsx(Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', onClick: onClickSend, expanded: true, buttonRounded: 'default', loading: isLoading, disabled: disableSendButton }, { children: "Send" }))] })), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' }))] }))] }));
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export { TransactionConfirmationPageLayout };
|
|
@@ -53,7 +53,7 @@ var TransactionRow = require('../TransactionConfirmationPageLayout/components/Tr
|
|
|
53
53
|
const TransactionStatusLayout = ({ destinationAddress, amount, networkName, networkCurrency, NetworkIcon, onDone, displayPoweredByDynamicFooter = true, onClickClose, }) => {
|
|
54
54
|
const closeButton = onClickClose && (jsxRuntime.jsx(IconButton.IconButton, Object.assign({ type: 'button', onClick: onClickClose, "data-testid": 'close' }, { children: jsxRuntime.jsx(close.ReactComponent, {}) })));
|
|
55
55
|
const networkIcon = (jsxRuntime.jsx("div", Object.assign({ className: 'transaction-status-layout__network-icon' }, { children: NetworkIcon })));
|
|
56
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-status-layout' }, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ trailing: closeButton, alignContent: 'bottom' }, { children: jsxRuntime.jsx(IconWithStatus.IconWithStatus, { containerClassName: 'transaction-status-layout__status-icon', iconSize: 50, Icon: signCircle.ReactComponent, InnerIcon: check.ReactComponent }) })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-status-layout__body' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'title', color: 'primary', className: 'transaction-status-layout__title' }, { children: "Transaction successfully sent" })), jsxRuntime.jsx("div", Object.assign({ className: 'transaction-status-layout__content' }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-status-layout__rows' }, { children: [jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Recipient' }, { children: shortenWalletAddress.shortenWalletAddress(destinationAddress, 3, 3) })), jsxRuntime.jsxs(TransactionRow.TransactionRow, Object.assign({ label: 'Network' }, { children: [networkIcon, jsxRuntime.jsx("span", Object.assign({ className: 'transaction-status-layout__network-name' }, { children: networkName }))] })), jsxRuntime.jsxs(TransactionRow.TransactionRow, Object.assign({ label: 'Total amount' }, { children: [amount, jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'span', color: 'secondary', className: 'transaction-status-layout__network-currency' }, { children: networkCurrency }))] }))] })) })), jsxRuntime.jsx("div", Object.assign({ className: 'transaction-status-layout__actions' }, { children: jsxRuntime.jsx(Button.Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', expanded: true, buttonRounded: 'default', onClick: onDone }, { children: "Continue" })) })), displayPoweredByDynamicFooter && (jsxRuntime.jsx(
|
|
56
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-status-layout' }, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ trailing: closeButton, alignContent: 'bottom' }, { children: jsxRuntime.jsx(IconWithStatus.IconWithStatus, { containerClassName: 'transaction-status-layout__status-icon', iconSize: 50, Icon: signCircle.ReactComponent, InnerIcon: check.ReactComponent }) })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-status-layout__body' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'title', color: 'primary', className: 'transaction-status-layout__title' }, { children: "Transaction successfully sent" })), jsxRuntime.jsx("div", Object.assign({ className: 'transaction-status-layout__content' }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-status-layout__rows' }, { children: [jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Recipient' }, { children: shortenWalletAddress.shortenWalletAddress(destinationAddress, 3, 3) })), jsxRuntime.jsxs(TransactionRow.TransactionRow, Object.assign({ label: 'Network' }, { children: [networkIcon, jsxRuntime.jsx("span", Object.assign({ className: 'transaction-status-layout__network-name' }, { children: networkName }))] })), jsxRuntime.jsxs(TransactionRow.TransactionRow, Object.assign({ label: 'Total amount' }, { children: [amount, jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'span', color: 'secondary', className: 'transaction-status-layout__network-currency' }, { children: networkCurrency }))] }))] })) })), jsxRuntime.jsx("div", Object.assign({ className: 'transaction-status-layout__actions' }, { children: jsxRuntime.jsx(Button.Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', expanded: true, buttonRounded: 'default', onClick: onDone }, { children: "Continue" })) })), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-status-layout__footer' }))] }))] })));
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
exports.TransactionStatusLayout = TransactionStatusLayout;
|
|
@@ -49,7 +49,7 @@ import { TransactionRow } from '../TransactionConfirmationPageLayout/components/
|
|
|
49
49
|
const TransactionStatusLayout = ({ destinationAddress, amount, networkName, networkCurrency, NetworkIcon, onDone, displayPoweredByDynamicFooter = true, onClickClose, }) => {
|
|
50
50
|
const closeButton = onClickClose && (jsx(IconButton, Object.assign({ type: 'button', onClick: onClickClose, "data-testid": 'close' }, { children: jsx(SvgClose, {}) })));
|
|
51
51
|
const networkIcon = (jsx("div", Object.assign({ className: 'transaction-status-layout__network-icon' }, { children: NetworkIcon })));
|
|
52
|
-
return (jsxs("div", Object.assign({ className: 'transaction-status-layout' }, { children: [jsx(ModalHeader, Object.assign({ trailing: closeButton, alignContent: 'bottom' }, { children: jsx(IconWithStatus, { containerClassName: 'transaction-status-layout__status-icon', iconSize: 50, Icon: SvgSignCircle, InnerIcon: SvgCheck }) })), jsxs("div", Object.assign({ className: 'transaction-status-layout__body' }, { children: [jsx(Typography, Object.assign({ weight: 'medium', variant: 'title', color: 'primary', className: 'transaction-status-layout__title' }, { children: "Transaction successfully sent" })), jsx("div", Object.assign({ className: 'transaction-status-layout__content' }, { children: jsxs("div", Object.assign({ className: 'transaction-status-layout__rows' }, { children: [jsx(TransactionRow, Object.assign({ label: 'Recipient' }, { children: shortenWalletAddress(destinationAddress, 3, 3) })), jsxs(TransactionRow, Object.assign({ label: 'Network' }, { children: [networkIcon, jsx("span", Object.assign({ className: 'transaction-status-layout__network-name' }, { children: networkName }))] })), jsxs(TransactionRow, Object.assign({ label: 'Total amount' }, { children: [amount, jsx(Typography, Object.assign({ as: 'span', color: 'secondary', className: 'transaction-status-layout__network-currency' }, { children: networkCurrency }))] }))] })) })), jsx("div", Object.assign({ className: 'transaction-status-layout__actions' }, { children: jsx(Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', expanded: true, buttonRounded: 'default', onClick: onDone }, { children: "Continue" })) })), displayPoweredByDynamicFooter && (jsx(
|
|
52
|
+
return (jsxs("div", Object.assign({ className: 'transaction-status-layout' }, { children: [jsx(ModalHeader, Object.assign({ trailing: closeButton, alignContent: 'bottom' }, { children: jsx(IconWithStatus, { containerClassName: 'transaction-status-layout__status-icon', iconSize: 50, Icon: SvgSignCircle, InnerIcon: SvgCheck }) })), jsxs("div", Object.assign({ className: 'transaction-status-layout__body' }, { children: [jsx(Typography, Object.assign({ weight: 'medium', variant: 'title', color: 'primary', className: 'transaction-status-layout__title' }, { children: "Transaction successfully sent" })), jsx("div", Object.assign({ className: 'transaction-status-layout__content' }, { children: jsxs("div", Object.assign({ className: 'transaction-status-layout__rows' }, { children: [jsx(TransactionRow, Object.assign({ label: 'Recipient' }, { children: shortenWalletAddress(destinationAddress, 3, 3) })), jsxs(TransactionRow, Object.assign({ label: 'Network' }, { children: [networkIcon, jsx("span", Object.assign({ className: 'transaction-status-layout__network-name' }, { children: networkName }))] })), jsxs(TransactionRow, Object.assign({ label: 'Total amount' }, { children: [amount, jsx(Typography, Object.assign({ as: 'span', color: 'secondary', className: 'transaction-status-layout__network-currency' }, { children: networkCurrency }))] }))] })) })), jsx("div", Object.assign({ className: 'transaction-status-layout__actions' }, { children: jsx(Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', expanded: true, buttonRounded: 'default', onClick: onDone }, { children: "Continue" })) })), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'transaction-status-layout__footer' }))] }))] })));
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export { TransactionStatusLayout };
|
|
@@ -19,6 +19,7 @@ var localStorage = require('../../shared/utils/classes/storage/localStorage.cjs'
|
|
|
19
19
|
require('ethers');
|
|
20
20
|
var useLocalStorage = require('../../shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
|
|
21
21
|
var useGlobalLoading = require('../../shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs');
|
|
22
|
+
var useEffectOnce = require('../../shared/utils/hooks/useEffectOnce/useEffectOnce.cjs');
|
|
22
23
|
require('../../shared/consts/index.cjs');
|
|
23
24
|
var useFetchProjectSettings = require('../../utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs');
|
|
24
25
|
var useFetchNonce = require('../../utils/hooks/useFetchNonce/useFetchNonce.cjs');
|
|
@@ -36,6 +37,8 @@ require('../MockContext/MockContext.cjs');
|
|
|
36
37
|
var CaptchaContext = require('../CaptchaContext/CaptchaContext.cjs');
|
|
37
38
|
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
38
39
|
var ThemeContext = require('../ThemeContext/ThemeContext.cjs');
|
|
40
|
+
var useValidateSession = require('../../utils/hooks/useValidateSession/useValidateSession.cjs');
|
|
41
|
+
var useEventListener = require('../../utils/hooks/useEventListener/useEventListener.cjs');
|
|
39
42
|
var ApiEndpoint = require('../../config/ApiEndpoint.cjs');
|
|
40
43
|
var useFetchNetworkConfigurations = require('../../utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs');
|
|
41
44
|
var useMultiWalletWidgetState = require('../../utils/hooks/multiWallet/useMultiWalletWidgetState/useMultiWalletWidgetState.cjs');
|
|
@@ -78,8 +81,8 @@ var SendBalanceContext = require('../SendBalanceContext/SendBalanceContext.cjs')
|
|
|
78
81
|
var usePrimaryWalletId = require('../../utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs');
|
|
79
82
|
var WalletGroupContext = require('../WalletGroupContext/WalletGroupContext.cjs');
|
|
80
83
|
var WalletContext = require('../WalletContext/WalletContext.cjs');
|
|
81
|
-
var useValidateSession = require('../../utils/hooks/useValidateSession/useValidateSession.cjs');
|
|
82
84
|
var getMissingChains = require('../../utils/functions/getMissingChains/getMissingChains.cjs');
|
|
85
|
+
var useMultiWallet = require('../../utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs');
|
|
83
86
|
var helpers = require('./helpers.cjs');
|
|
84
87
|
var validators = require('./validators.cjs');
|
|
85
88
|
var useCustomerCallbacks = require('./useCustomerCallbacks/useCustomerCallbacks.cjs');
|
|
@@ -89,15 +92,19 @@ var useDisplayOrderState = require('./hooks/useDisplayOrderState/useDisplayOrder
|
|
|
89
92
|
var useNameService = require('./hooks/useNameService/useNameService.cjs');
|
|
90
93
|
var useSetShowAuthFlowWithInit = require('./hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.cjs');
|
|
91
94
|
|
|
95
|
+
const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9';
|
|
92
96
|
const EMPTY_INITIAL_USER = undefined;
|
|
93
97
|
const DynamicContext = React.createContext(undefined);
|
|
94
98
|
const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, appLogoUrl = 'https://demo.dynamic.xyz/assets/dynamic-logo.svg', appName = 'Dynamic Example', walletsByChain, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displayTermsOfService = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', multiWallet: deprecatedMultiWallet, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectV1Bridge, walletConnectors: walletConnectorsProp, socialProvidersFilter, }, children, theme, }) => {
|
|
95
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
99
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
96
100
|
if (!environmentId) {
|
|
97
101
|
throw new utils.MissingEnvironmentIdError();
|
|
98
102
|
}
|
|
99
103
|
logger.logger.setLogLevel(logLevel);
|
|
100
104
|
walletConnectorCore.logger.setLogLevel(logLevel);
|
|
105
|
+
if (environmentId === PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID) {
|
|
106
|
+
logger.logger.warn(`WARNING: DYNAMIC is using a test environment ID ${environmentId}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`);
|
|
107
|
+
}
|
|
101
108
|
ApiEndpoint.setBaseUrl((_a = process.env.DYNAMIC_API_BASE_URL) !== null && _a !== void 0 ? _a : apiBaseUrl);
|
|
102
109
|
localStorage.LocalStorage.setSuffix(localStorageSuffix);
|
|
103
110
|
const isAuthenticated = Boolean(getAuthToken.getAuthToken());
|
|
@@ -119,7 +126,18 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
119
126
|
const [multiWalletWidgetState, setMultiWalletWidgetState, { awaiting_account_switch: [accountSwitchState], awaiting_signature: [awaitingSignatureState], },] = useMultiWalletWidgetState.useMultiWalletWidgetState();
|
|
120
127
|
const [isVerifying, setIsVerifying] = React.useState(false);
|
|
121
128
|
const { projectSettings, isLoading: isProjectSettingsLoading } = useFetchProjectSettings.useFetchProjectSettings({ authToken: getAuthToken.getAuthToken(), environmentId });
|
|
122
|
-
const multiWallet
|
|
129
|
+
const { multiWallet, setMultiWallet } = useMultiWallet.useMultiWallet({
|
|
130
|
+
deprecatedMultiWallet,
|
|
131
|
+
multiWalletSettings: (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.multiWallet,
|
|
132
|
+
});
|
|
133
|
+
// for demo proposes when running single wallet
|
|
134
|
+
// it should not use bridge even having walletConnectV1Bridge set on settings
|
|
135
|
+
// but v2 if enabled
|
|
136
|
+
if (toolkitEnabled &&
|
|
137
|
+
((_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.walletConnect) === null || _d === void 0 ? void 0 : _d.v2Enabled) &&
|
|
138
|
+
!multiWallet) {
|
|
139
|
+
walletConnectV1Bridge = undefined;
|
|
140
|
+
}
|
|
123
141
|
// ensures that when user comes back to site and primary wallet is out of sync, we don't show widget popup
|
|
124
142
|
const [showWidgetStatePopup, setShowWidgetStatePopup] = React.useState(!multiWallet);
|
|
125
143
|
const walletBook$1 = walletBook.useWalletBookCdn();
|
|
@@ -151,19 +169,23 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
151
169
|
});
|
|
152
170
|
const [authMode, setAuthMode] = useLocalStorage.useLocalStorage(localStorage$1.AUTH_MODE, initialAuthenticationMode);
|
|
153
171
|
const { clearPrimaryWalletId, primaryWalletId, setPrimaryWalletId } = usePrimaryWalletId.usePrimaryWalletId();
|
|
154
|
-
const { connectWallet, removeConnectedWalletsInfo, connectedWalletsInfo, connectedWallet, getConnectedWalletById, connectedWallets, connectWalletByAddressAndChain, unlinkConnectedWallet, } = useConnectWallet.useConnectWallet({
|
|
172
|
+
const { connectWallet, removeConnectedWalletsInfo, connectedWalletsInfo, connectedWallet, getConnectedWalletById, connectedWallets, connectWalletByAddressAndChain, unlinkConnectedWallet, updateConnectedWalletById, } = useConnectWallet.useConnectWallet({
|
|
155
173
|
authMode,
|
|
156
174
|
clearPrimaryWalletId,
|
|
157
175
|
enableVisitTrackingOnConnectOnly,
|
|
158
176
|
environmentId,
|
|
177
|
+
onUnlink: (walletId, connectedWalletsInfo) => {
|
|
178
|
+
const missingChains = getMissingChains.getMissingChains(walletsByChain, connectedWalletsInfo);
|
|
179
|
+
setWalletsToConnectByChain(missingChains);
|
|
180
|
+
},
|
|
159
181
|
primaryWalletId,
|
|
160
182
|
setPrimaryWalletId,
|
|
161
183
|
wallets,
|
|
162
184
|
});
|
|
163
|
-
|
|
185
|
+
useEffectOnce.useEffectOnce(() => {
|
|
164
186
|
const missingChains = getMissingChains.getMissingChains(walletsByChain, connectedWalletsInfo);
|
|
165
187
|
setWalletsToConnectByChain(missingChains);
|
|
166
|
-
}
|
|
188
|
+
});
|
|
167
189
|
const [selectedWalletConnector, setSelectedWalletConnector] = React.useState(null);
|
|
168
190
|
//selected wallet to perform an action (become primary, unlink, etc)
|
|
169
191
|
const [selectedWalletWithAction, setSelectedWalletWithAction] = React.useState(null);
|
|
@@ -197,7 +219,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
197
219
|
wallets,
|
|
198
220
|
});
|
|
199
221
|
// until user completes onboarding, jwt is only stored in onboardingOnlyJwt
|
|
200
|
-
const authToken = (
|
|
222
|
+
const authToken = (_e = getAuthToken.getAuthToken()) !== null && _e !== void 0 ? _e : onboardingOnlyJwt;
|
|
201
223
|
const { getNameService, removeConnectedNameService } = useNameService.useNameService({
|
|
202
224
|
authToken,
|
|
203
225
|
currentWallet: primaryWallet !== null && primaryWallet !== void 0 ? primaryWallet : connectedWallet,
|
|
@@ -209,7 +231,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
209
231
|
clearOphanedWalletConnectSessions,
|
|
210
232
|
]);
|
|
211
233
|
const handleLogOut = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
212
|
-
var
|
|
234
|
+
var _j, _k;
|
|
213
235
|
clearAllWalletConnectSessions();
|
|
214
236
|
setWalletsToConnectByChain(walletsByChain);
|
|
215
237
|
setShowBridgeWidget(false);
|
|
@@ -222,7 +244,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
222
244
|
for (const connector of walletConnectors) {
|
|
223
245
|
yield connector.endSession();
|
|
224
246
|
}
|
|
225
|
-
yield ((
|
|
247
|
+
yield ((_j = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector) === null || _j === void 0 ? void 0 : _j.endSession());
|
|
226
248
|
setAuthMode(initialAuthenticationMode);
|
|
227
249
|
setShowAuthFlow(false);
|
|
228
250
|
setMultiWalletWidgetState('idle');
|
|
@@ -233,7 +255,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
233
255
|
removeConnectedUser();
|
|
234
256
|
clearPrimaryWalletId();
|
|
235
257
|
removeConnectedNameService();
|
|
236
|
-
(
|
|
258
|
+
(_k = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLogout) === null || _k === void 0 ? void 0 : _k.call(eventsCallbacks, user);
|
|
237
259
|
}), [
|
|
238
260
|
clearAllWalletConnectSessions,
|
|
239
261
|
walletsByChain,
|
|
@@ -252,10 +274,11 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
252
274
|
environmentId,
|
|
253
275
|
walletConnectors,
|
|
254
276
|
]);
|
|
277
|
+
useEventListener.useEventListener('logOut', handleLogOut);
|
|
255
278
|
let wcVersion;
|
|
256
279
|
if (projectSettings) {
|
|
257
280
|
wcVersion =
|
|
258
|
-
((
|
|
281
|
+
((_g = (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.walletConnect) === null || _g === void 0 ? void 0 : _g.v2Enabled) && !walletConnectV1Bridge
|
|
259
282
|
? 2
|
|
260
283
|
: 1;
|
|
261
284
|
}
|
|
@@ -307,6 +330,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
307
330
|
onLinkSuccess: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLinkSuccess,
|
|
308
331
|
onUserProfileUpdate: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onUserProfileUpdate,
|
|
309
332
|
},
|
|
333
|
+
connectedWallets,
|
|
310
334
|
handleLogOut,
|
|
311
335
|
isAuthenticated,
|
|
312
336
|
primaryWallet,
|
|
@@ -417,6 +441,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
417
441
|
setIsSingleWalletAccount,
|
|
418
442
|
setIsVerifying,
|
|
419
443
|
setLogInWithEmail,
|
|
444
|
+
setMultiWallet,
|
|
420
445
|
setMultiWalletWidgetState,
|
|
421
446
|
setNetwork,
|
|
422
447
|
setOnboardingOnlyJwt,
|
|
@@ -449,6 +474,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
449
474
|
theme,
|
|
450
475
|
toolkitEnabled,
|
|
451
476
|
unlinkConnectedWallet,
|
|
477
|
+
updateConnectedWalletById,
|
|
452
478
|
user,
|
|
453
479
|
walletConnector: (_b = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _b !== void 0 ? _b : null,
|
|
454
480
|
walletUiUtils,
|
|
@@ -523,6 +549,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
523
549
|
setCallback,
|
|
524
550
|
setConnectedUser,
|
|
525
551
|
setLogInWithEmail,
|
|
552
|
+
setMultiWallet,
|
|
526
553
|
setMultiWalletWidgetState,
|
|
527
554
|
setNetwork,
|
|
528
555
|
setPrimaryWallet,
|
|
@@ -552,6 +579,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
552
579
|
walletsByChain,
|
|
553
580
|
walletsFilter,
|
|
554
581
|
walletsToConnectByChain,
|
|
582
|
+
updateConnectedWalletById,
|
|
555
583
|
]);
|
|
556
584
|
React.useEffect(() => {
|
|
557
585
|
const addPrefetch = (attr) => {
|
|
@@ -595,7 +623,8 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
595
623
|
setShowDynamicUserProfile(true);
|
|
596
624
|
}
|
|
597
625
|
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile, user]);
|
|
598
|
-
return (jsxRuntime.jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, Object.assign({ walletBook: walletBook$1 }, { children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, Object.assign({ customerTheme: parseTheme.parseTheme(theme, ((
|
|
626
|
+
return (jsxRuntime.jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, Object.assign({ walletBook: walletBook$1 }, { children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, Object.assign({ customerTheme: parseTheme.parseTheme(theme, ((_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _h === void 0 ? void 0 : _h.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsx(ViewContext.ViewContextProvider, Object.assign({ initialView: helpers.getInitialView({
|
|
627
|
+
connectedWallets,
|
|
599
628
|
isBridgeFlow,
|
|
600
629
|
isUserConnected,
|
|
601
630
|
loginWithEmail,
|
|
@@ -604,3 +633,4 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
604
633
|
|
|
605
634
|
exports.DynamicContext = DynamicContext;
|
|
606
635
|
exports.DynamicContextProvider = DynamicContextProvider;
|
|
636
|
+
exports.PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID;
|
|
@@ -7,8 +7,10 @@ import { WalletOption, UserProfile, Wallet, MultiWalletWidgetState, AccountSwitc
|
|
|
7
7
|
import { ThemeData, ThemeSetting } from '../ThemeContext';
|
|
8
8
|
import { MultiWalletWidgetStateSetter } from '../../utils/hooks/multiWallet';
|
|
9
9
|
import { SocialNetworkIconType } from '../../utils/functions/getSocialNetworkIcon';
|
|
10
|
+
import type { ConnectedWalletConnectorType } from '../../utils/hooks/useConnectWallet/useConnectWallet';
|
|
10
11
|
import { Callback } from './useCustomerCallbacks';
|
|
11
12
|
import { DisplayOrder, SetDisplayOrderPriority } from './hooks';
|
|
13
|
+
export declare const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = "2762a57b-faa4-41ce-9f16-abff9300e2c9";
|
|
12
14
|
export type ChainsToConnect = {
|
|
13
15
|
chain: Chain;
|
|
14
16
|
numberOfWallets: number;
|
|
@@ -87,6 +89,7 @@ export interface IDynamicContext {
|
|
|
87
89
|
setIsSingleWalletAccount: Dispatch<SetStateAction<boolean>>;
|
|
88
90
|
setIsVerifying: Dispatch<SetStateAction<boolean>>;
|
|
89
91
|
setLogInWithEmail: Dispatch<SetStateAction<boolean>>;
|
|
92
|
+
setMultiWallet: (value: boolean) => void;
|
|
90
93
|
setMultiWalletWidgetState: MultiWalletWidgetStateSetter;
|
|
91
94
|
setNetwork: Dispatch<SetStateAction<number | string | undefined>>;
|
|
92
95
|
setOnboardingOnlyJwt: Dispatch<SetStateAction<string | undefined>>;
|
|
@@ -129,6 +132,7 @@ export interface IDynamicContext {
|
|
|
129
132
|
walletsFilter?: (options: WalletOption[]) => WalletOption[];
|
|
130
133
|
socialProvidersFilter?: SocialProviderFilter;
|
|
131
134
|
removeConnectedWalletsInfo: () => void;
|
|
135
|
+
updateConnectedWalletById: (walletId: string, payload: Partial<ConnectedWalletConnectorType>) => void;
|
|
132
136
|
}
|
|
133
137
|
export interface DynamicContextProps {
|
|
134
138
|
children: ReactNode;
|
|
@@ -159,7 +163,7 @@ export interface DynamicContextProps {
|
|
|
159
163
|
* @default WARN
|
|
160
164
|
*/
|
|
161
165
|
logLevel?: keyof typeof LogLevel;
|
|
162
|
-
/** @deprecated enable multi wallet in the
|
|
166
|
+
/** @deprecated enable multi wallet in the dashboard settings instead */
|
|
163
167
|
multiWallet?: boolean;
|
|
164
168
|
newToWeb3WalletChainMap?: ChainToWalletMap;
|
|
165
169
|
notInTheListImageUrl?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { createContext, useState,
|
|
3
|
+
import { createContext, useState, useCallback, useEffect, useMemo } from 'react';
|
|
4
4
|
import { useWalletBookCdn, getWalletBookCdnUrl, WalletBookContextProvider } from '@dynamic-labs/wallet-book';
|
|
5
5
|
import { logger as logger$1 } from '@dynamic-labs/wallet-connector-core';
|
|
6
6
|
import { ICONIC_SPRITE_URL } from '@dynamic-labs/iconic';
|
|
@@ -15,6 +15,7 @@ import { LocalStorage } from '../../shared/utils/classes/storage/localStorage.js
|
|
|
15
15
|
import 'ethers';
|
|
16
16
|
import { useLocalStorage } from '../../shared/utils/hooks/useLocalStorage/useLocalStorage.js';
|
|
17
17
|
import { useGlobalLoading } from '../../shared/utils/hooks/useGlobalLoading/useGlobalLoading.js';
|
|
18
|
+
import { useEffectOnce } from '../../shared/utils/hooks/useEffectOnce/useEffectOnce.js';
|
|
18
19
|
import '../../shared/consts/index.js';
|
|
19
20
|
import { useFetchProjectSettings } from '../../utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js';
|
|
20
21
|
import { useFetchNonce } from '../../utils/hooks/useFetchNonce/useFetchNonce.js';
|
|
@@ -32,6 +33,8 @@ import '../MockContext/MockContext.js';
|
|
|
32
33
|
import { CaptchaContextProvider } from '../CaptchaContext/CaptchaContext.js';
|
|
33
34
|
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
34
35
|
import { ThemeContextProvider } from '../ThemeContext/ThemeContext.js';
|
|
36
|
+
import { useValidateSession } from '../../utils/hooks/useValidateSession/useValidateSession.js';
|
|
37
|
+
import { useEventListener } from '../../utils/hooks/useEventListener/useEventListener.js';
|
|
35
38
|
import ApiEndpoint from '../../config/ApiEndpoint.js';
|
|
36
39
|
import { useFetchNetworkConfigurations } from '../../utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js';
|
|
37
40
|
import { useMultiWalletWidgetState } from '../../utils/hooks/multiWallet/useMultiWalletWidgetState/useMultiWalletWidgetState.js';
|
|
@@ -74,8 +77,8 @@ import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceCon
|
|
|
74
77
|
import { usePrimaryWalletId } from '../../utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js';
|
|
75
78
|
import { WalletGroupContextProvider } from '../WalletGroupContext/WalletGroupContext.js';
|
|
76
79
|
import { WalletContextProvider } from '../WalletContext/WalletContext.js';
|
|
77
|
-
import { useValidateSession } from '../../utils/hooks/useValidateSession/useValidateSession.js';
|
|
78
80
|
import { getMissingChains } from '../../utils/functions/getMissingChains/getMissingChains.js';
|
|
81
|
+
import { useMultiWallet } from '../../utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js';
|
|
79
82
|
import { initExpirationTime, getInitialView } from './helpers.js';
|
|
80
83
|
import { validateAuthUser } from './validators.js';
|
|
81
84
|
import { useCustomerCallbacks } from './useCustomerCallbacks/useCustomerCallbacks.js';
|
|
@@ -85,15 +88,19 @@ import { useDisplayOrderState } from './hooks/useDisplayOrderState/useDisplayOrd
|
|
|
85
88
|
import { useNameService } from './hooks/useNameService/useNameService.js';
|
|
86
89
|
import { useSetShowAuthFlowWithInit } from './hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.js';
|
|
87
90
|
|
|
91
|
+
const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9';
|
|
88
92
|
const EMPTY_INITIAL_USER = undefined;
|
|
89
93
|
const DynamicContext = createContext(undefined);
|
|
90
94
|
const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, appLogoUrl = 'https://demo.dynamic.xyz/assets/dynamic-logo.svg', appName = 'Dynamic Example', walletsByChain, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displayTermsOfService = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, eventsCallbacks, evmNetworks, walletsFilter, logLevel = 'WARN', multiWallet: deprecatedMultiWallet, notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectV1Bridge, walletConnectors: walletConnectorsProp, socialProvidersFilter, }, children, theme, }) => {
|
|
91
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
95
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
92
96
|
if (!environmentId) {
|
|
93
97
|
throw new MissingEnvironmentIdError();
|
|
94
98
|
}
|
|
95
99
|
logger.setLogLevel(logLevel);
|
|
96
100
|
logger$1.setLogLevel(logLevel);
|
|
101
|
+
if (environmentId === PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID) {
|
|
102
|
+
logger.warn(`WARNING: DYNAMIC is using a test environment ID ${environmentId}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`);
|
|
103
|
+
}
|
|
97
104
|
ApiEndpoint.setBaseUrl((_a = process.env.DYNAMIC_API_BASE_URL) !== null && _a !== void 0 ? _a : apiBaseUrl);
|
|
98
105
|
LocalStorage.setSuffix(localStorageSuffix);
|
|
99
106
|
const isAuthenticated = Boolean(getAuthToken());
|
|
@@ -115,7 +122,18 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
115
122
|
const [multiWalletWidgetState, setMultiWalletWidgetState, { awaiting_account_switch: [accountSwitchState], awaiting_signature: [awaitingSignatureState], },] = useMultiWalletWidgetState();
|
|
116
123
|
const [isVerifying, setIsVerifying] = useState(false);
|
|
117
124
|
const { projectSettings, isLoading: isProjectSettingsLoading } = useFetchProjectSettings({ authToken: getAuthToken(), environmentId });
|
|
118
|
-
const multiWallet
|
|
125
|
+
const { multiWallet, setMultiWallet } = useMultiWallet({
|
|
126
|
+
deprecatedMultiWallet,
|
|
127
|
+
multiWalletSettings: (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _b === void 0 ? void 0 : _b.multiWallet,
|
|
128
|
+
});
|
|
129
|
+
// for demo proposes when running single wallet
|
|
130
|
+
// it should not use bridge even having walletConnectV1Bridge set on settings
|
|
131
|
+
// but v2 if enabled
|
|
132
|
+
if (toolkitEnabled &&
|
|
133
|
+
((_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.walletConnect) === null || _d === void 0 ? void 0 : _d.v2Enabled) &&
|
|
134
|
+
!multiWallet) {
|
|
135
|
+
walletConnectV1Bridge = undefined;
|
|
136
|
+
}
|
|
119
137
|
// ensures that when user comes back to site and primary wallet is out of sync, we don't show widget popup
|
|
120
138
|
const [showWidgetStatePopup, setShowWidgetStatePopup] = useState(!multiWallet);
|
|
121
139
|
const walletBook = useWalletBookCdn();
|
|
@@ -147,19 +165,23 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
147
165
|
});
|
|
148
166
|
const [authMode, setAuthMode] = useLocalStorage(AUTH_MODE, initialAuthenticationMode);
|
|
149
167
|
const { clearPrimaryWalletId, primaryWalletId, setPrimaryWalletId } = usePrimaryWalletId();
|
|
150
|
-
const { connectWallet, removeConnectedWalletsInfo, connectedWalletsInfo, connectedWallet, getConnectedWalletById, connectedWallets, connectWalletByAddressAndChain, unlinkConnectedWallet, } = useConnectWallet({
|
|
168
|
+
const { connectWallet, removeConnectedWalletsInfo, connectedWalletsInfo, connectedWallet, getConnectedWalletById, connectedWallets, connectWalletByAddressAndChain, unlinkConnectedWallet, updateConnectedWalletById, } = useConnectWallet({
|
|
151
169
|
authMode,
|
|
152
170
|
clearPrimaryWalletId,
|
|
153
171
|
enableVisitTrackingOnConnectOnly,
|
|
154
172
|
environmentId,
|
|
173
|
+
onUnlink: (walletId, connectedWalletsInfo) => {
|
|
174
|
+
const missingChains = getMissingChains(walletsByChain, connectedWalletsInfo);
|
|
175
|
+
setWalletsToConnectByChain(missingChains);
|
|
176
|
+
},
|
|
155
177
|
primaryWalletId,
|
|
156
178
|
setPrimaryWalletId,
|
|
157
179
|
wallets,
|
|
158
180
|
});
|
|
159
|
-
|
|
181
|
+
useEffectOnce(() => {
|
|
160
182
|
const missingChains = getMissingChains(walletsByChain, connectedWalletsInfo);
|
|
161
183
|
setWalletsToConnectByChain(missingChains);
|
|
162
|
-
}
|
|
184
|
+
});
|
|
163
185
|
const [selectedWalletConnector, setSelectedWalletConnector] = useState(null);
|
|
164
186
|
//selected wallet to perform an action (become primary, unlink, etc)
|
|
165
187
|
const [selectedWalletWithAction, setSelectedWalletWithAction] = useState(null);
|
|
@@ -193,7 +215,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
193
215
|
wallets,
|
|
194
216
|
});
|
|
195
217
|
// until user completes onboarding, jwt is only stored in onboardingOnlyJwt
|
|
196
|
-
const authToken = (
|
|
218
|
+
const authToken = (_e = getAuthToken()) !== null && _e !== void 0 ? _e : onboardingOnlyJwt;
|
|
197
219
|
const { getNameService, removeConnectedNameService } = useNameService({
|
|
198
220
|
authToken,
|
|
199
221
|
currentWallet: primaryWallet !== null && primaryWallet !== void 0 ? primaryWallet : connectedWallet,
|
|
@@ -205,7 +227,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
205
227
|
clearOphanedWalletConnectSessions,
|
|
206
228
|
]);
|
|
207
229
|
const handleLogOut = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
208
|
-
var
|
|
230
|
+
var _j, _k;
|
|
209
231
|
clearAllWalletConnectSessions();
|
|
210
232
|
setWalletsToConnectByChain(walletsByChain);
|
|
211
233
|
setShowBridgeWidget(false);
|
|
@@ -218,7 +240,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
218
240
|
for (const connector of walletConnectors) {
|
|
219
241
|
yield connector.endSession();
|
|
220
242
|
}
|
|
221
|
-
yield ((
|
|
243
|
+
yield ((_j = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector) === null || _j === void 0 ? void 0 : _j.endSession());
|
|
222
244
|
setAuthMode(initialAuthenticationMode);
|
|
223
245
|
setShowAuthFlow(false);
|
|
224
246
|
setMultiWalletWidgetState('idle');
|
|
@@ -229,7 +251,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
229
251
|
removeConnectedUser();
|
|
230
252
|
clearPrimaryWalletId();
|
|
231
253
|
removeConnectedNameService();
|
|
232
|
-
(
|
|
254
|
+
(_k = eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLogout) === null || _k === void 0 ? void 0 : _k.call(eventsCallbacks, user);
|
|
233
255
|
}), [
|
|
234
256
|
clearAllWalletConnectSessions,
|
|
235
257
|
walletsByChain,
|
|
@@ -248,10 +270,11 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
248
270
|
environmentId,
|
|
249
271
|
walletConnectors,
|
|
250
272
|
]);
|
|
273
|
+
useEventListener('logOut', handleLogOut);
|
|
251
274
|
let wcVersion;
|
|
252
275
|
if (projectSettings) {
|
|
253
276
|
wcVersion =
|
|
254
|
-
((
|
|
277
|
+
((_g = (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.walletConnect) === null || _g === void 0 ? void 0 : _g.v2Enabled) && !walletConnectV1Bridge
|
|
255
278
|
? 2
|
|
256
279
|
: 1;
|
|
257
280
|
}
|
|
@@ -303,6 +326,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
303
326
|
onLinkSuccess: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onLinkSuccess,
|
|
304
327
|
onUserProfileUpdate: eventsCallbacks === null || eventsCallbacks === void 0 ? void 0 : eventsCallbacks.onUserProfileUpdate,
|
|
305
328
|
},
|
|
329
|
+
connectedWallets,
|
|
306
330
|
handleLogOut,
|
|
307
331
|
isAuthenticated,
|
|
308
332
|
primaryWallet,
|
|
@@ -413,6 +437,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
413
437
|
setIsSingleWalletAccount,
|
|
414
438
|
setIsVerifying,
|
|
415
439
|
setLogInWithEmail,
|
|
440
|
+
setMultiWallet,
|
|
416
441
|
setMultiWalletWidgetState,
|
|
417
442
|
setNetwork,
|
|
418
443
|
setOnboardingOnlyJwt,
|
|
@@ -445,6 +470,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
445
470
|
theme,
|
|
446
471
|
toolkitEnabled,
|
|
447
472
|
unlinkConnectedWallet,
|
|
473
|
+
updateConnectedWalletById,
|
|
448
474
|
user,
|
|
449
475
|
walletConnector: (_b = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _b !== void 0 ? _b : null,
|
|
450
476
|
walletUiUtils,
|
|
@@ -519,6 +545,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
519
545
|
setCallback,
|
|
520
546
|
setConnectedUser,
|
|
521
547
|
setLogInWithEmail,
|
|
548
|
+
setMultiWallet,
|
|
522
549
|
setMultiWalletWidgetState,
|
|
523
550
|
setNetwork,
|
|
524
551
|
setPrimaryWallet,
|
|
@@ -548,6 +575,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
548
575
|
walletsByChain,
|
|
549
576
|
walletsFilter,
|
|
550
577
|
walletsToConnectByChain,
|
|
578
|
+
updateConnectedWalletById,
|
|
551
579
|
]);
|
|
552
580
|
useEffect(() => {
|
|
553
581
|
const addPrefetch = (attr) => {
|
|
@@ -591,11 +619,12 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
591
619
|
setShowDynamicUserProfile(true);
|
|
592
620
|
}
|
|
593
621
|
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile, user]);
|
|
594
|
-
return (jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsx(WalletBookContextProvider, Object.assign({ walletBook: walletBook }, { children: jsx(ThemeContextProvider, Object.assign({ customerTheme: parseTheme(theme, ((
|
|
622
|
+
return (jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsx(WalletBookContextProvider, Object.assign({ walletBook: walletBook }, { children: jsx(ThemeContextProvider, Object.assign({ customerTheme: parseTheme(theme, ((_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _h === void 0 ? void 0 : _h.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsx(LoadingContextProvider, { children: jsx(ViewContextProvider, Object.assign({ initialView: getInitialView({
|
|
623
|
+
connectedWallets,
|
|
595
624
|
isBridgeFlow,
|
|
596
625
|
isUserConnected,
|
|
597
626
|
loginWithEmail,
|
|
598
627
|
}) }, { children: jsx(WalletContextProvider, Object.assign({ canSync: didConnectedStateLoad, connectWalletByAddressAndChain: connectWalletByAddressAndChain }, { children: jsx(QrCodeContextProvider, { children: jsx(EmailVerificationContextProvider, { children: jsx(ErrorContextProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(CaptchaContextProvider, { children: jsx(FundingContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsxs(WalletGroupContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) })) })) }) })) })) })));
|
|
599
628
|
};
|
|
600
629
|
|
|
601
|
-
export { DynamicContext, DynamicContextProvider };
|
|
630
|
+
export { DynamicContext, DynamicContextProvider, PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID };
|
|
@@ -12,8 +12,9 @@ require('../../shared/logger.cjs');
|
|
|
12
12
|
require('@dynamic-labs/wallet-book');
|
|
13
13
|
require('@dynamic-labs/utils');
|
|
14
14
|
require('../../utils/constants/colors.cjs');
|
|
15
|
-
|
|
15
|
+
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
16
16
|
require('ethers');
|
|
17
|
+
var getAuthToken = require('../../utils/functions/getAuthToken/getAuthToken.cjs');
|
|
17
18
|
|
|
18
19
|
let logoutTimer;
|
|
19
20
|
const isAuthTokenExpired = (token) => {
|
|
@@ -32,7 +33,7 @@ const isAuthTokenExpired = (token) => {
|
|
|
32
33
|
return false;
|
|
33
34
|
};
|
|
34
35
|
const initExpirationTime = (logout) => {
|
|
35
|
-
const decodedJwt = decodeJwt.decodeJwt(
|
|
36
|
+
const decodedJwt = decodeJwt.decodeJwt(getAuthToken.getAuthToken());
|
|
36
37
|
if (!decodedJwt)
|
|
37
38
|
return clearTimeout(logoutTimer);
|
|
38
39
|
const tokenExp = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.exp;
|
|
@@ -53,14 +54,14 @@ const initExpirationTime = (logout) => {
|
|
|
53
54
|
const expiryTimeout = Math.min(expirationTimeInMs, 2147483647);
|
|
54
55
|
logoutTimer = setTimeout(logout, expiryTimeout);
|
|
55
56
|
};
|
|
56
|
-
const getInitialView = ({ loginWithEmail, isBridgeFlow, isUserConnected, }) => {
|
|
57
|
+
const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isUserConnected, }) => {
|
|
57
58
|
if (loginWithEmail) {
|
|
58
59
|
return 'login-with-email-or-wallet';
|
|
59
60
|
}
|
|
60
61
|
if (isUserConnected) {
|
|
61
62
|
return 'wallet-list';
|
|
62
63
|
}
|
|
63
|
-
if (isBridgeFlow) {
|
|
64
|
+
if (isBridgeFlow && !connectedWallets.length) {
|
|
64
65
|
return 'bridge-welcome';
|
|
65
66
|
}
|
|
66
67
|
return 'wallet-list';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Wallet } from '../../shared';
|
|
1
2
|
import { ViewType } from '../ViewContext';
|
|
2
3
|
export declare const isAuthTokenExpired: (token: string) => boolean;
|
|
3
4
|
export declare const initExpirationTime: (logout: VoidFunction) => void;
|
|
4
|
-
export declare const getInitialView: ({ loginWithEmail, isBridgeFlow, isUserConnected, }: {
|
|
5
|
+
export declare const getInitialView: ({ connectedWallets, loginWithEmail, isBridgeFlow, isUserConnected, }: {
|
|
6
|
+
connectedWallets: Wallet[];
|
|
5
7
|
loginWithEmail: boolean;
|
|
6
8
|
isBridgeFlow: boolean;
|
|
7
9
|
isUserConnected: boolean;
|
|
@@ -8,8 +8,9 @@ import '../../shared/logger.js';
|
|
|
8
8
|
import '@dynamic-labs/wallet-book';
|
|
9
9
|
import '@dynamic-labs/utils';
|
|
10
10
|
import '../../utils/constants/colors.js';
|
|
11
|
-
import
|
|
11
|
+
import '../../shared/utils/classes/storage/localStorage.js';
|
|
12
12
|
import 'ethers';
|
|
13
|
+
import { getAuthToken } from '../../utils/functions/getAuthToken/getAuthToken.js';
|
|
13
14
|
|
|
14
15
|
let logoutTimer;
|
|
15
16
|
const isAuthTokenExpired = (token) => {
|
|
@@ -28,7 +29,7 @@ const isAuthTokenExpired = (token) => {
|
|
|
28
29
|
return false;
|
|
29
30
|
};
|
|
30
31
|
const initExpirationTime = (logout) => {
|
|
31
|
-
const decodedJwt = decodeJwt(
|
|
32
|
+
const decodedJwt = decodeJwt(getAuthToken());
|
|
32
33
|
if (!decodedJwt)
|
|
33
34
|
return clearTimeout(logoutTimer);
|
|
34
35
|
const tokenExp = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.exp;
|
|
@@ -49,14 +50,14 @@ const initExpirationTime = (logout) => {
|
|
|
49
50
|
const expiryTimeout = Math.min(expirationTimeInMs, 2147483647);
|
|
50
51
|
logoutTimer = setTimeout(logout, expiryTimeout);
|
|
51
52
|
};
|
|
52
|
-
const getInitialView = ({ loginWithEmail, isBridgeFlow, isUserConnected, }) => {
|
|
53
|
+
const getInitialView = ({ connectedWallets, loginWithEmail, isBridgeFlow, isUserConnected, }) => {
|
|
53
54
|
if (loginWithEmail) {
|
|
54
55
|
return 'login-with-email-or-wallet';
|
|
55
56
|
}
|
|
56
57
|
if (isUserConnected) {
|
|
57
58
|
return 'wallet-list';
|
|
58
59
|
}
|
|
59
|
-
if (isBridgeFlow) {
|
|
60
|
+
if (isBridgeFlow && !connectedWallets.length) {
|
|
60
61
|
return 'bridge-welcome';
|
|
61
62
|
}
|
|
62
63
|
return 'wallet-list';
|
|
@@ -19,7 +19,7 @@ require('@dynamic-labs/multi-wallet');
|
|
|
19
19
|
var getAuthToken = require('../../../utils/functions/getAuthToken/getAuthToken.cjs');
|
|
20
20
|
var isConnectOnly = require('../../../utils/hooks/authenticationHooks/helpers/isConnectOnly.cjs');
|
|
21
21
|
|
|
22
|
-
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, }, handleLogOut, primaryWallet, user, isAuthenticated, authMode, }) => {
|
|
22
|
+
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, }, handleLogOut, primaryWallet, user, isAuthenticated, authMode, connectedWallets, }) => {
|
|
23
23
|
const [callbackQueue, setCallbackQueue] = React.useState([]);
|
|
24
24
|
const isConnectOnlyAndCallbackIsConnectSuccess = React.useCallback((next) => isConnectOnly.isConnectOnly(user, authMode) && next === 'connectSuccess', [authMode, user]);
|
|
25
25
|
React.useEffect(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Callback, UseCustomerCallbacksArgs } from './types';
|
|
2
|
-
export declare const useCustomerCallbacks: ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, }, handleLogOut, primaryWallet, user, isAuthenticated, authMode, }: UseCustomerCallbacksArgs) => {
|
|
1
|
+
import type { Callback, UseCustomerCallbacksArgs } from './types';
|
|
2
|
+
export declare const useCustomerCallbacks: ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, }, handleLogOut, primaryWallet, user, isAuthenticated, authMode, connectedWallets, }: UseCustomerCallbacksArgs) => {
|
|
3
3
|
setCallback: (callback: Callback) => void;
|
|
4
4
|
};
|
|
@@ -15,7 +15,7 @@ import '@dynamic-labs/multi-wallet';
|
|
|
15
15
|
import { getAuthToken } from '../../../utils/functions/getAuthToken/getAuthToken.js';
|
|
16
16
|
import { isConnectOnly } from '../../../utils/hooks/authenticationHooks/helpers/isConnectOnly.js';
|
|
17
17
|
|
|
18
|
-
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, }, handleLogOut, primaryWallet, user, isAuthenticated, authMode, }) => {
|
|
18
|
+
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onLinkSuccess, onUserProfileUpdate, onConnectSuccess, }, handleLogOut, primaryWallet, user, isAuthenticated, authMode, connectedWallets, }) => {
|
|
19
19
|
const [callbackQueue, setCallbackQueue] = useState([]);
|
|
20
20
|
const isConnectOnlyAndCallbackIsConnectSuccess = useCallback((next) => isConnectOnly(user, authMode) && next === 'connectSuccess', [authMode, user]);
|
|
21
21
|
useEffect(() => {
|