@dynamic-labs/sdk-react-core 0.18.0-RC.6 → 0.18.0-RC.7
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 +19 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/index.cjs +4 -0
- package/src/index.js +2 -0
- package/src/lib/Main.cjs +2 -2
- package/src/lib/Main.js +2 -2
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +5 -3
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +6 -4
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.types.d.ts +1 -0
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +2 -5
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.d.ts +1 -9
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +2 -4
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.cjs +11 -0
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.d.ts +9 -0
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.js +7 -0
- package/src/lib/components/ModalHeader/ModalHeader.types.d.ts +1 -1
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +2 -3
- package/src/lib/components/OTPVerificationView/OTPVerificationView.d.ts +0 -2
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +2 -3
- package/src/lib/components/SelectWalletChainLayout/SelectWalletChainLayout.cjs +2 -1
- package/src/lib/components/SelectWalletChainLayout/SelectWalletChainLayout.js +2 -1
- package/src/lib/components/Tooltip/Tooltip.cjs +1 -1
- package/src/lib/components/Tooltip/Tooltip.js +1 -1
- package/src/lib/components/TosAndPp/TosAndPp.cjs +6 -5
- package/src/lib/components/TosAndPp/TosAndPp.d.ts +3 -4
- package/src/lib/components/TosAndPp/TosAndPp.js +6 -5
- package/src/lib/context/DynamicContext/DynamicContext.cjs +8 -14
- package/src/lib/context/DynamicContext/DynamicContext.js +9 -15
- package/src/lib/context/DynamicContext/helpers.cjs +1 -2
- package/src/lib/context/DynamicContext/helpers.js +1 -2
- package/src/lib/context/MockContext/MockContext.cjs +2 -14
- package/src/lib/context/MockContext/MockContext.js +2 -14
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/context/WalletContext/WalletContext.cjs +46 -0
- package/src/lib/context/WalletContext/WalletContext.d.ts +7 -0
- package/src/lib/context/WalletContext/WalletContext.js +41 -0
- package/src/lib/context/WalletContext/index.d.ts +1 -0
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +22 -63
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.d.ts +1 -6
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +23 -64
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +34 -15
- package/src/lib/layout/DynamicAuthLayout/Header/header.d.ts +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +35 -16
- package/src/lib/layout/DynamicAuthLayout/Header/header.types.d.ts +2 -0
- package/src/lib/layout/DynamicAuthLayout/{FooterContent/EmptyFooterContent/empty-footer-content.cjs → HelpContent/EmptyHelpContent/EmptyHelpContent.cjs} +2 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/EmptyHelpContent/EmptyHelpContent.d.ts +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/EmptyHelpContent/EmptyHelpContent.js +6 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/EmptyHelpContent/index.d.ts +1 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.cjs +36 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.d.ts +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.js +32 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.cjs +56 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.d.ts +2 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/HelpHeader.js +52 -0
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpHeader/index.d.ts +1 -0
- package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent/WalletListFooterContent.cjs → HelpContent/WalletListHelpContent/WalletListHelpContent.cjs} +3 -3
- package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent/WalletListFooterContent.d.ts → HelpContent/WalletListHelpContent/WalletListHelpContent.d.ts} +1 -1
- package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent/WalletListFooterContent.js → HelpContent/WalletListHelpContent/WalletListHelpContent.js} +3 -3
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/index.d.ts +1 -0
- package/src/lib/layout/DynamicAuthLayout/{FooterContent → HelpContent}/WalletMoreInfoContent/WalletMoreInfoContent.cjs +3 -5
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletMoreInfoContent/WalletMoreInfoContent.d.ts +7 -0
- package/src/lib/layout/DynamicAuthLayout/{FooterContent → HelpContent}/WalletMoreInfoContent/WalletMoreInfoContent.js +3 -5
- package/src/lib/layout/DynamicAuthLayout/HelpContent/index.d.ts +4 -0
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +49 -0
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.d.ts +2 -0
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +45 -0
- package/src/lib/layout/DynamicAuthLayout/ToSFooter/index.d.ts +1 -0
- package/src/lib/shared/assets/chevron-left.cjs +5 -5
- package/src/lib/shared/assets/chevron-left.js +5 -5
- package/src/lib/shared/assets/close.cjs +5 -5
- package/src/lib/shared/assets/close.js +5 -5
- package/src/lib/shared/assets/footer-info-icon.cjs +2 -2
- package/src/lib/shared/assets/footer-info-icon.js +2 -2
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/assets/question-mark.cjs +58 -0
- package/src/lib/shared/assets/question-mark.js +34 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.cjs +7 -27
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.d.ts +3 -4
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.js +8 -28
- package/src/lib/utils/hooks/index.d.ts +3 -0
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +9 -1
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +9 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +68 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.d.ts +10 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +64 -0
- package/src/lib/utils/hooks/useInterval/useInterval.d.ts +1 -0
- package/src/lib/utils/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +2 -0
- package/src/lib/utils/hooks/useTimeout/useTimeout.d.ts +1 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -1
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +2 -3
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +2 -3
- package/src/lib/views/EmailVerification/EmailVerification.cjs +2 -3
- package/src/lib/views/EmailVerification/EmailVerification.js +2 -3
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +2 -2
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +2 -2
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.cjs +3 -0
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.js +3 -0
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +2 -3
- package/src/lib/views/PendingConnectView/PendingConnectView.js +2 -3
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +2 -3
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +2 -3
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +2 -2
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.d.ts +1 -3
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +2 -2
- package/src/lib/views/QrCodeView/QrCodeView.cjs +2 -2
- package/src/lib/views/QrCodeView/QrCodeView.js +2 -2
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +2 -4
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +2 -4
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +63 -0
- package/src/lib/views/WalletLockedView/WalletLockedView.d.ts +2 -0
- package/src/lib/views/WalletLockedView/WalletLockedView.js +59 -0
- package/src/lib/views/WalletLockedView/index.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeConnectButton/DynamicBridgeConnectButton.cjs +23 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeConnectButton/DynamicBridgeConnectButton.d.ts +8 -0
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeConnectButton/DynamicBridgeConnectButton.js +19 -0
- package/src/lib/widgets/DynamicBridgeWidget/index.d.ts +1 -0
- package/src/lib/layout/DynamicAuthLayout/Footer/Footer.cjs +0 -67
- package/src/lib/layout/DynamicAuthLayout/Footer/Footer.d.ts +0 -10
- package/src/lib/layout/DynamicAuthLayout/Footer/Footer.js +0 -63
- package/src/lib/layout/DynamicAuthLayout/Footer/index.d.ts +0 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/EmptyFooterContent/empty-footer-content.d.ts +0 -2
- package/src/lib/layout/DynamicAuthLayout/FooterContent/EmptyFooterContent/empty-footer-content.js +0 -6
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/index.d.ts +0 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.d.ts +0 -8
- package/src/lib/layout/DynamicAuthLayout/FooterContent/index.d.ts +0 -3
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/Item/Item.cjs +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/Item/Item.d.ts +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/Item/Item.js +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/Item/index.d.ts +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/NewToWeb3WalletItem/NewToWeb3WalletItem.cjs +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/NewToWeb3WalletItem/NewToWeb3WalletItem.d.ts +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/NewToWeb3WalletItem/NewToWeb3WalletItem.js +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/NewToWeb3WalletItem/index.d.ts +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.d.ts +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent/WalletListFooterContent → HelpContent/WalletListHelpContent}/WalletExtensionOrAppContinueButton/index.d.ts +0 -0
- /package/src/lib/layout/DynamicAuthLayout/{FooterContent → HelpContent}/WalletMoreInfoContent/index.d.ts +0 -0
|
@@ -4,7 +4,7 @@ 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';
|
|
7
|
-
import {
|
|
7
|
+
import { AUTH_USER, AUTH_TOKEN, AUTH_MODE } from '../../utils/constants/localStorage.js';
|
|
8
8
|
import '../../utils/constants/colors.js';
|
|
9
9
|
import { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW } from '../../utils/constants/values.js';
|
|
10
10
|
import { decodeJwt } from '../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
@@ -35,7 +35,6 @@ import { ThemeContextProvider } from '../ThemeContext/ThemeContext.js';
|
|
|
35
35
|
import ApiEndpoint from '../../config/ApiEndpoint.js';
|
|
36
36
|
import { useFetchNetworkConfigurations } from '../../utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js';
|
|
37
37
|
import { useMultiWalletWidgetState } from '../../utils/hooks/multiWallet/useMultiWalletWidgetState/useMultiWalletWidgetState.js';
|
|
38
|
-
import { useSyncPrimaryWallet } from '../../utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js';
|
|
39
38
|
import { useWalletEventListeners } from '../../utils/hooks/useWalletEventListeners/useWalletEventListeners.js';
|
|
40
39
|
import { LoadingContextProvider } from '../LoadingContext/LoadingContext.js';
|
|
41
40
|
import { useFetchWalletsForChainsMap } from '../../utils/hooks/useFetchWalletsForChainsMap/useFetchWalletsForChainsMap.js';
|
|
@@ -75,6 +74,7 @@ import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceCon
|
|
|
75
74
|
import { usePrimaryWalletId } from '../../utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js';
|
|
76
75
|
import { MultiWalletStepSelectorModal } from '../../modals/MultiWalletStepSelectorModal/MultiWalletStepSelectorModal.js';
|
|
77
76
|
import { WalletGroupContextProvider } from '../WalletGroupContext/WalletGroupContext.js';
|
|
77
|
+
import { WalletContextProvider } from '../WalletContext/WalletContext.js';
|
|
78
78
|
import { initExpirationTime } from './helpers.js';
|
|
79
79
|
import { validateAuthUser } from './validators.js';
|
|
80
80
|
import { useCustomerCallbacks } from './useCustomerCallbacks/useCustomerCallbacks.js';
|
|
@@ -93,6 +93,11 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
93
93
|
ApiEndpoint.setBaseUrl((_a = process.env.DYNAMIC_API_BASE_URL) !== null && _a !== void 0 ? _a : apiBaseUrl);
|
|
94
94
|
LocalStorage.setSuffix(localStorageSuffix);
|
|
95
95
|
const isAuthenticated = Boolean(getAuthToken());
|
|
96
|
+
// HOTFIX - NEED TO BE REVISITED
|
|
97
|
+
// if there's user but not auth_token, remove user
|
|
98
|
+
if (!isAuthenticated) {
|
|
99
|
+
LocalStorage.removeFromLS(AUTH_USER);
|
|
100
|
+
}
|
|
96
101
|
const [onboardingOnlyJwt, setOnboardingOnlyJwt] = useState(undefined);
|
|
97
102
|
const [showAuthFlow, setShowAuthFlow] = useState(false);
|
|
98
103
|
const [showBridgeAuthFlow, setShowBridgeAuthFlow] = useState(false);
|
|
@@ -197,6 +202,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
197
202
|
yield connector.endSession();
|
|
198
203
|
}
|
|
199
204
|
(_f = connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector) === null || _f === void 0 ? void 0 : _f.endSession();
|
|
205
|
+
setAuthMode(initialAuthenticationMode);
|
|
200
206
|
setShowAuthFlow(false);
|
|
201
207
|
setMultiWalletWidgetState('idle');
|
|
202
208
|
removeAuthTokenAndUser();
|
|
@@ -225,18 +231,6 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
225
231
|
environmentId,
|
|
226
232
|
walletConnectors,
|
|
227
233
|
]);
|
|
228
|
-
useSyncPrimaryWallet({
|
|
229
|
-
canSync: didConnectedStateLoad,
|
|
230
|
-
computeConnectedStateForWallets,
|
|
231
|
-
handleLogOut,
|
|
232
|
-
multiWalletWidgetState,
|
|
233
|
-
primaryWallet,
|
|
234
|
-
secondaryWallets,
|
|
235
|
-
setMultiWalletWidgetState,
|
|
236
|
-
setPrimaryWallet,
|
|
237
|
-
setShowWidgetStatePopup,
|
|
238
|
-
showWidgetStatePopup,
|
|
239
|
-
});
|
|
240
234
|
const handleUnlinkWallet = useHandleUnlinkWallet({
|
|
241
235
|
environmentId,
|
|
242
236
|
primaryWalletId,
|
|
@@ -549,7 +543,7 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
549
543
|
setShowDynamicUserProfile(true);
|
|
550
544
|
}
|
|
551
545
|
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile, user]);
|
|
552
|
-
return (jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsx(WalletBookContextProvider, Object.assign({ walletBook: walletBook }, { children: jsx(ThemeContextProvider, Object.assign({ customerTheme: parseTheme(theme, ((_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _e === void 0 ? void 0 : _e.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsx(LoadingContextProvider, { children: jsx(ViewContextProvider, Object.assign({ initialView: loginWithEmail ? 'login-with-email-or-wallet' : 'wallet-list' }, { 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, {}), jsx(MultiWalletStepSelectorModal, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) })) }) })) })) })));
|
|
546
|
+
return (jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsx(WalletBookContextProvider, Object.assign({ walletBook: walletBook }, { children: jsx(ThemeContextProvider, Object.assign({ customerTheme: parseTheme(theme, ((_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _e === void 0 ? void 0 : _e.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsx(LoadingContextProvider, { children: jsx(ViewContextProvider, Object.assign({ initialView: loginWithEmail ? 'login-with-email-or-wallet' : 'wallet-list' }, { children: jsx(WalletContextProvider, Object.assign({ canSync: didConnectedStateLoad }, { 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, {}), jsx(MultiWalletStepSelectorModal, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) })) })) }) })) })) })));
|
|
553
547
|
};
|
|
554
548
|
|
|
555
549
|
export { DynamicContext, DynamicContextProvider };
|
|
@@ -11,7 +11,6 @@ require('react');
|
|
|
11
11
|
require('../../shared/logger.cjs');
|
|
12
12
|
require('@dynamic-labs/wallet-book');
|
|
13
13
|
require('@dynamic-labs/utils');
|
|
14
|
-
var localStorage$1 = require('../../utils/constants/localStorage.cjs');
|
|
15
14
|
require('../../utils/constants/colors.cjs');
|
|
16
15
|
var localStorage = require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
17
16
|
require('ethers');
|
|
@@ -33,7 +32,7 @@ const isAuthTokenExpired = (token) => {
|
|
|
33
32
|
return false;
|
|
34
33
|
};
|
|
35
34
|
const initExpirationTime = (logout) => {
|
|
36
|
-
const decodedJwt = decodeJwt.decodeJwt(localStorage.LocalStorage.
|
|
35
|
+
const decodedJwt = decodeJwt.decodeJwt(localStorage.LocalStorage.getAuthTokenValue());
|
|
37
36
|
if (!decodedJwt)
|
|
38
37
|
return clearTimeout(logoutTimer);
|
|
39
38
|
const tokenExp = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.exp;
|
|
@@ -7,7 +7,6 @@ import 'react';
|
|
|
7
7
|
import '../../shared/logger.js';
|
|
8
8
|
import '@dynamic-labs/wallet-book';
|
|
9
9
|
import '@dynamic-labs/utils';
|
|
10
|
-
import { AUTH_TOKEN } from '../../utils/constants/localStorage.js';
|
|
11
10
|
import '../../utils/constants/colors.js';
|
|
12
11
|
import { LocalStorage } from '../../shared/utils/classes/storage/localStorage.js';
|
|
13
12
|
import 'ethers';
|
|
@@ -29,7 +28,7 @@ const isAuthTokenExpired = (token) => {
|
|
|
29
28
|
return false;
|
|
30
29
|
};
|
|
31
30
|
const initExpirationTime = (logout) => {
|
|
32
|
-
const decodedJwt = decodeJwt(LocalStorage.
|
|
31
|
+
const decodedJwt = decodeJwt(LocalStorage.getAuthTokenValue());
|
|
33
32
|
if (!decodedJwt)
|
|
34
33
|
return clearTimeout(logoutTimer);
|
|
35
34
|
const tokenExp = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.exp;
|
|
@@ -8,18 +8,7 @@ var DynamicAuthLayout = require('../../layout/DynamicAuthLayout/DynamicAuthLayou
|
|
|
8
8
|
var index = require('../FooterAnimationContext/index.cjs');
|
|
9
9
|
var ThemeContext = require('../ThemeContext/ThemeContext.cjs');
|
|
10
10
|
var ViewContext = require('../ViewContext/ViewContext.cjs');
|
|
11
|
-
var useInternalDynamicContext = require('../DynamicContext/useInternalDynamicContext.cjs');
|
|
12
11
|
var ErrorContext = require('../ErrorContext/ErrorContext.cjs');
|
|
13
|
-
require('@dynamic-labs/sdk-api');
|
|
14
|
-
require('../../shared/logger.cjs');
|
|
15
|
-
require('@dynamic-labs/iconic');
|
|
16
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
17
|
-
require('@dynamic-labs/wallet-book');
|
|
18
|
-
require('@dynamic-labs/utils');
|
|
19
|
-
require('../../utils/constants/colors.cjs');
|
|
20
|
-
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
21
|
-
require('ethers');
|
|
22
|
-
var index$1 = require('../../shared/consts/index.cjs');
|
|
23
12
|
|
|
24
13
|
const MockContext = React.createContext(undefined);
|
|
25
14
|
const MockContextProvider = ({ children, walletName, view, mockedWalletConnector, customerTheme, dynamicLayoutClassName, }) => {
|
|
@@ -32,7 +21,6 @@ const MockContextProvider = ({ children, walletName, view, mockedWalletConnector
|
|
|
32
21
|
return (jsxRuntime.jsx(MockContext.Provider, Object.assign({ value: { mockedSDK: true } }, { children: jsxRuntime.jsx(ViewContext.ViewContext.Provider, Object.assign({ value: viewContextValue }, { children: jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, Object.assign({ customerTheme: customerTheme }, { children: jsxRuntime.jsx(index.FooterAnimationContextProvider, { children: jsxRuntime.jsx(MockContextWrapper, Object.assign({ dynamicLayoutClassName: dynamicLayoutClassName, mockedWalletConnector: mockedWalletConnector, walletName: walletName }, { children: children })) }) })) }) })) })));
|
|
33
22
|
};
|
|
34
23
|
const MockContextWrapper = ({ dynamicLayoutClassName, mockedWalletConnector, walletName, children, }) => {
|
|
35
|
-
const { appName, privacyPolicyUrl, termsOfServiceUrl } = useInternalDynamicContext.useInternalDynamicContext();
|
|
36
24
|
/* istanbul ignore next */
|
|
37
25
|
const onClose = () => new Promise(() => { });
|
|
38
26
|
const mockProjectSettings = {
|
|
@@ -44,12 +32,12 @@ const MockContextWrapper = ({ dynamicLayoutClassName, mockedWalletConnector, wal
|
|
|
44
32
|
sdk: { walletConnect: { projectId: '', v2Enabled: false } },
|
|
45
33
|
security: {},
|
|
46
34
|
};
|
|
47
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: 'mock-ctx__container', style: { position: 'relative' } }, { children: jsxRuntime.jsx(DynamicAuthLayout.DynamicAuthLayout, Object.assign({ className: dynamicLayoutClassName,
|
|
35
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: 'mock-ctx__container', style: { position: 'relative' } }, { children: jsxRuntime.jsx(DynamicAuthLayout.DynamicAuthLayout, Object.assign({ className: dynamicLayoutClassName, onClose: onClose, projectSettings: mockProjectSettings, transitionProps: {
|
|
48
36
|
isShown: true,
|
|
49
37
|
}, walletConnector: mockedWalletConnector !== null && mockedWalletConnector !== void 0 ? mockedWalletConnector : {
|
|
50
38
|
canConnectViaQrCode: true,
|
|
51
39
|
name: walletName,
|
|
52
|
-
}
|
|
40
|
+
} }, { children: children })) })));
|
|
53
41
|
};
|
|
54
42
|
const useMockContext = () => {
|
|
55
43
|
const context = React.useContext(MockContext);
|
|
@@ -4,18 +4,7 @@ import { DynamicAuthLayout } from '../../layout/DynamicAuthLayout/DynamicAuthLay
|
|
|
4
4
|
import { FooterAnimationContextProvider } from '../FooterAnimationContext/index.js';
|
|
5
5
|
import { ThemeContextProvider } from '../ThemeContext/ThemeContext.js';
|
|
6
6
|
import { ViewContext } from '../ViewContext/ViewContext.js';
|
|
7
|
-
import { useInternalDynamicContext } from '../DynamicContext/useInternalDynamicContext.js';
|
|
8
7
|
import { ErrorContextProvider } from '../ErrorContext/ErrorContext.js';
|
|
9
|
-
import '@dynamic-labs/sdk-api';
|
|
10
|
-
import '../../shared/logger.js';
|
|
11
|
-
import '@dynamic-labs/iconic';
|
|
12
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
13
|
-
import '@dynamic-labs/wallet-book';
|
|
14
|
-
import '@dynamic-labs/utils';
|
|
15
|
-
import '../../utils/constants/colors.js';
|
|
16
|
-
import '../../shared/utils/classes/storage/localStorage.js';
|
|
17
|
-
import 'ethers';
|
|
18
|
-
import { defaultWalletsForChains } from '../../shared/consts/index.js';
|
|
19
8
|
|
|
20
9
|
const MockContext = createContext(undefined);
|
|
21
10
|
const MockContextProvider = ({ children, walletName, view, mockedWalletConnector, customerTheme, dynamicLayoutClassName, }) => {
|
|
@@ -28,7 +17,6 @@ const MockContextProvider = ({ children, walletName, view, mockedWalletConnector
|
|
|
28
17
|
return (jsx(MockContext.Provider, Object.assign({ value: { mockedSDK: true } }, { children: jsx(ViewContext.Provider, Object.assign({ value: viewContextValue }, { children: jsx(ErrorContextProvider, { children: jsx(ThemeContextProvider, Object.assign({ customerTheme: customerTheme }, { children: jsx(FooterAnimationContextProvider, { children: jsx(MockContextWrapper, Object.assign({ dynamicLayoutClassName: dynamicLayoutClassName, mockedWalletConnector: mockedWalletConnector, walletName: walletName }, { children: children })) }) })) }) })) })));
|
|
29
18
|
};
|
|
30
19
|
const MockContextWrapper = ({ dynamicLayoutClassName, mockedWalletConnector, walletName, children, }) => {
|
|
31
|
-
const { appName, privacyPolicyUrl, termsOfServiceUrl } = useInternalDynamicContext();
|
|
32
20
|
/* istanbul ignore next */
|
|
33
21
|
const onClose = () => new Promise(() => { });
|
|
34
22
|
const mockProjectSettings = {
|
|
@@ -40,12 +28,12 @@ const MockContextWrapper = ({ dynamicLayoutClassName, mockedWalletConnector, wal
|
|
|
40
28
|
sdk: { walletConnect: { projectId: '', v2Enabled: false } },
|
|
41
29
|
security: {},
|
|
42
30
|
};
|
|
43
|
-
return (jsx("div", Object.assign({ className: 'mock-ctx__container', style: { position: 'relative' } }, { children: jsx(DynamicAuthLayout, Object.assign({ className: dynamicLayoutClassName,
|
|
31
|
+
return (jsx("div", Object.assign({ className: 'mock-ctx__container', style: { position: 'relative' } }, { children: jsx(DynamicAuthLayout, Object.assign({ className: dynamicLayoutClassName, onClose: onClose, projectSettings: mockProjectSettings, transitionProps: {
|
|
44
32
|
isShown: true,
|
|
45
33
|
}, walletConnector: mockedWalletConnector !== null && mockedWalletConnector !== void 0 ? mockedWalletConnector : {
|
|
46
34
|
canConnectViaQrCode: true,
|
|
47
35
|
name: walletName,
|
|
48
|
-
}
|
|
36
|
+
} }, { children: children })) })));
|
|
49
37
|
};
|
|
50
38
|
const useMockContext = () => {
|
|
51
39
|
const context = useContext(MockContext);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SetStateAction, Dispatch, PropsWithChildren, FC } from 'react';
|
|
2
|
-
export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'social-wrong-account';
|
|
2
|
+
export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account';
|
|
3
3
|
export type ViewContextProps = {
|
|
4
4
|
setView: Dispatch<SetStateAction<ViewType>>;
|
|
5
5
|
view: ViewType;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var useInternalDynamicContext = require('../DynamicContext/useInternalDynamicContext.cjs');
|
|
8
|
+
require('@dynamic-labs/sdk-api');
|
|
9
|
+
require('../../shared/logger.cjs');
|
|
10
|
+
require('@dynamic-labs/iconic');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
require('../ViewContext/ViewContext.cjs');
|
|
13
|
+
require('@dynamic-labs/wallet-book');
|
|
14
|
+
require('@dynamic-labs/utils');
|
|
15
|
+
require('../../utils/constants/colors.cjs');
|
|
16
|
+
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
17
|
+
require('ethers');
|
|
18
|
+
require('../../shared/consts/index.cjs');
|
|
19
|
+
require('@dynamic-labs/multi-wallet');
|
|
20
|
+
require('../ErrorContext/ErrorContext.cjs');
|
|
21
|
+
require('../../config/ApiEndpoint.cjs');
|
|
22
|
+
require('../AccessDeniedContext/AccessDeniedContext.cjs');
|
|
23
|
+
require('../CaptchaContext/CaptchaContext.cjs');
|
|
24
|
+
var useSyncPrimaryWallet = require('../../utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs');
|
|
25
|
+
|
|
26
|
+
const WalletContext = React.createContext(undefined);
|
|
27
|
+
const WalletContextProvider = ({ children, canSync, }) => {
|
|
28
|
+
const { computeConnectedStateForWallets, handleLogOut, multiWalletWidgetState, primaryWallet, secondaryWallets, setMultiWalletWidgetState, setPrimaryWallet, setShowWidgetStatePopup, showWidgetStatePopup, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
29
|
+
useSyncPrimaryWallet.useSyncPrimaryWallet({
|
|
30
|
+
canSync,
|
|
31
|
+
computeConnectedStateForWallets,
|
|
32
|
+
handleLogOut,
|
|
33
|
+
multiWalletWidgetState,
|
|
34
|
+
primaryWallet,
|
|
35
|
+
secondaryWallets,
|
|
36
|
+
setMultiWalletWidgetState,
|
|
37
|
+
setPrimaryWallet,
|
|
38
|
+
setShowWidgetStatePopup,
|
|
39
|
+
showWidgetStatePopup,
|
|
40
|
+
});
|
|
41
|
+
const value = undefined;
|
|
42
|
+
return (jsxRuntime.jsx(WalletContext.Provider, Object.assign({ value: value }, { children: children })));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.WalletContext = WalletContext;
|
|
46
|
+
exports.WalletContextProvider = WalletContextProvider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare const WalletContext: import("react").Context<undefined>;
|
|
3
|
+
export declare const WalletContextProvider: ({ children, canSync, }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
canSync: boolean;
|
|
6
|
+
}) => JSX.Element;
|
|
7
|
+
export declare const useWalletContext: () => never;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext } from 'react';
|
|
3
|
+
import { useInternalDynamicContext } from '../DynamicContext/useInternalDynamicContext.js';
|
|
4
|
+
import '@dynamic-labs/sdk-api';
|
|
5
|
+
import '../../shared/logger.js';
|
|
6
|
+
import '@dynamic-labs/iconic';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import '../ViewContext/ViewContext.js';
|
|
9
|
+
import '@dynamic-labs/wallet-book';
|
|
10
|
+
import '@dynamic-labs/utils';
|
|
11
|
+
import '../../utils/constants/colors.js';
|
|
12
|
+
import '../../shared/utils/classes/storage/localStorage.js';
|
|
13
|
+
import 'ethers';
|
|
14
|
+
import '../../shared/consts/index.js';
|
|
15
|
+
import '@dynamic-labs/multi-wallet';
|
|
16
|
+
import '../ErrorContext/ErrorContext.js';
|
|
17
|
+
import '../../config/ApiEndpoint.js';
|
|
18
|
+
import '../AccessDeniedContext/AccessDeniedContext.js';
|
|
19
|
+
import '../CaptchaContext/CaptchaContext.js';
|
|
20
|
+
import { useSyncPrimaryWallet } from '../../utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js';
|
|
21
|
+
|
|
22
|
+
const WalletContext = createContext(undefined);
|
|
23
|
+
const WalletContextProvider = ({ children, canSync, }) => {
|
|
24
|
+
const { computeConnectedStateForWallets, handleLogOut, multiWalletWidgetState, primaryWallet, secondaryWallets, setMultiWalletWidgetState, setPrimaryWallet, setShowWidgetStatePopup, showWidgetStatePopup, } = useInternalDynamicContext();
|
|
25
|
+
useSyncPrimaryWallet({
|
|
26
|
+
canSync,
|
|
27
|
+
computeConnectedStateForWallets,
|
|
28
|
+
handleLogOut,
|
|
29
|
+
multiWalletWidgetState,
|
|
30
|
+
primaryWallet,
|
|
31
|
+
secondaryWallets,
|
|
32
|
+
setMultiWalletWidgetState,
|
|
33
|
+
setPrimaryWallet,
|
|
34
|
+
setShowWidgetStatePopup,
|
|
35
|
+
showWidgetStatePopup,
|
|
36
|
+
});
|
|
37
|
+
const value = undefined;
|
|
38
|
+
return (jsx(WalletContext.Provider, Object.assign({ value: value }, { children: children })));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { WalletContext, WalletContextProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WalletContext';
|
|
@@ -3,104 +3,63 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var React = require('react');
|
|
7
6
|
var index = require('../../context/FooterAnimationContext/index.cjs');
|
|
8
7
|
var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
|
|
9
8
|
var getDynamicLayoutData = require('../../utils/functions/getDynamicLayoutData/getDynamicLayoutData.cjs');
|
|
10
9
|
require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
11
10
|
var SlideInUpTransition = require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
12
11
|
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
require('react');
|
|
13
|
+
require('@dynamic-labs/utils');
|
|
15
14
|
require('@dynamic-labs/sdk-api');
|
|
15
|
+
require('../../config/ApiEndpoint.cjs');
|
|
16
16
|
require('../../shared/logger.cjs');
|
|
17
17
|
require('@dynamic-labs/iconic');
|
|
18
18
|
require('@dynamic-labs/wallet-connector-core');
|
|
19
19
|
require('@dynamic-labs/wallet-book');
|
|
20
|
-
require('@dynamic-labs/utils');
|
|
21
20
|
require('../../utils/constants/colors.cjs');
|
|
22
21
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
23
22
|
require('ethers');
|
|
24
23
|
require('../../shared/consts/index.cjs');
|
|
25
|
-
var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
26
24
|
require('@dynamic-labs/multi-wallet');
|
|
27
|
-
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
28
|
-
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
29
|
-
require('react-dom');
|
|
30
|
-
require('react-focus-lock');
|
|
31
|
-
require('../../config/ApiEndpoint.cjs');
|
|
32
25
|
require('@dynamic-labs/rpc-providers');
|
|
26
|
+
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
33
27
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
34
28
|
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
29
|
+
require('react-dom');
|
|
30
|
+
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
31
|
+
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
32
|
+
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
33
|
+
require('react-focus-lock');
|
|
35
34
|
require('../../components/IconButton/IconButton.cjs');
|
|
36
|
-
var AnimatePresence = require('../../components/AnimatePresence/AnimatePresence.cjs');
|
|
37
|
-
require('../../components/Alert/Alert.cjs');
|
|
38
|
-
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
39
|
-
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
40
|
-
var MockContext = require('../../context/MockContext/MockContext.cjs');
|
|
41
|
-
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
42
|
-
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
43
35
|
var VerticalAccordion = require('../../components/Accordion/components/VerticalAccordion/VerticalAccordion.cjs');
|
|
44
36
|
var AccordionItem = require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
37
|
+
require('../../components/Alert/Alert.cjs');
|
|
45
38
|
require('../../components/Popper/Popper/Popper.cjs');
|
|
46
39
|
require('../../components/Popper/PopperContext/PopperContext.cjs');
|
|
47
40
|
require('formik');
|
|
48
41
|
require('yup');
|
|
49
|
-
|
|
42
|
+
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
43
|
+
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
44
|
+
require('../../context/MockContext/MockContext.cjs');
|
|
45
|
+
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
46
|
+
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
50
47
|
require('../../components/OverlayCard/OverlayCard.context.cjs');
|
|
51
48
|
var OverlayCardTarget = require('../../components/OverlayCard/OverlayCardTarget.cjs');
|
|
52
|
-
var
|
|
53
|
-
var emptyFooterContent = require('./FooterContent/EmptyFooterContent/empty-footer-content.cjs');
|
|
54
|
-
var WalletMoreInfoContent = require('./FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs');
|
|
55
|
-
var WalletListFooterContent = require('./FooterContent/WalletListFooterContent/WalletListFooterContent.cjs');
|
|
49
|
+
var useAuthLayoutChecks = require('../../utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs');
|
|
56
50
|
var header = require('./Header/header.cjs');
|
|
51
|
+
var ToSFooter = require('./ToSFooter/ToSFooter.cjs');
|
|
52
|
+
var HelpContent = require('./HelpContent/HelpContent.cjs');
|
|
57
53
|
|
|
58
|
-
const DynamicAuthLayout = ({
|
|
54
|
+
const DynamicAuthLayout = ({ children, onClose, transitionProps, projectSettings, walletConnector, className = '', }) => {
|
|
59
55
|
const { view } = ViewContext.useViewContext();
|
|
60
|
-
const {
|
|
61
|
-
const { headerData, footerData } = getDynamicLayoutData.getDynamicLayoutData({
|
|
56
|
+
const { headerData, helpHeaderData } = getDynamicLayoutData.getDynamicLayoutData({
|
|
62
57
|
view,
|
|
63
58
|
});
|
|
64
|
-
const footerRef = React.useRef(null);
|
|
65
59
|
const { isFooterExpanded } = index.useFooterAnimationContext();
|
|
66
|
-
const {
|
|
67
|
-
const renderFooterContent = () => {
|
|
68
|
-
switch (view) {
|
|
69
|
-
case 'wallet-connect-mobile-wallets-list':
|
|
70
|
-
case 'wallet-list':
|
|
71
|
-
case 'login-with-email-or-wallet-full-wallet-list':
|
|
72
|
-
return (jsxRuntime.jsx(WalletListFooterContent.WalletListFooterContent, { chains: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.chains, newToWeb3WalletChainMap: newToWeb3WalletChainMap }));
|
|
73
|
-
case 'pending-signature-without-back-button':
|
|
74
|
-
case 'pending-signature':
|
|
75
|
-
return (jsxRuntime.jsx(WalletMoreInfoContent.WalletMoreInfoContent, { appName: appName, variant: 'sign', walletName: walletName }));
|
|
76
|
-
case 'pending-connect':
|
|
77
|
-
return jsxRuntime.jsx(WalletMoreInfoContent.WalletMoreInfoContent, { appName: appName, variant: 'connect' });
|
|
78
|
-
case 'qr-code':
|
|
79
|
-
return jsxRuntime.jsx(WalletMoreInfoContent.WalletMoreInfoContent, { appName: appName, variant: 'connect' });
|
|
80
|
-
/* istanbul ignore next */
|
|
81
|
-
default:
|
|
82
|
-
return jsxRuntime.jsx(emptyFooterContent.EmptyFooterContent, {});
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const showFooter =
|
|
86
|
-
// Notice the negation here
|
|
87
|
-
!((view === 'qr-code' && !(walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.canConnectViaQrCode)) ||
|
|
88
|
-
view === 'no-qr-not-installed' ||
|
|
89
|
-
view === 'wallet-used' ||
|
|
90
|
-
view === 'chainalysis-blocked-wallet' ||
|
|
91
|
-
view === 'wallet-sign' ||
|
|
92
|
-
view === 'collect-user-data' ||
|
|
93
|
-
isUserLinkingWallet.isUserLinkingWallet(user, view, mockedSDK));
|
|
94
|
-
const showHeader = view !== 'collect-user-data' &&
|
|
95
|
-
view !== 'no-access' &&
|
|
96
|
-
view !== 'chainalysis-blocked-wallet' &&
|
|
97
|
-
view !== 'update-email' &&
|
|
98
|
-
view !== 'verify-email' &&
|
|
99
|
-
view !== 'network-not-supported' &&
|
|
100
|
-
view !== 'email-wallet-otp-verification-view';
|
|
101
|
-
const content = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showHeader && (jsxRuntime.jsx(header.Header, { onClose: onClose, heading: (headerData === null || headerData === void 0 ? void 0 : headerData.heading) || '', projectSettings: projectSettings })), children] }));
|
|
60
|
+
const { showHeader, showHelpContent, showToSFooter } = useAuthLayoutChecks.useAuthLayoutChecks(walletConnector);
|
|
102
61
|
const modalClassName = classNames.classNames(className, 'dynamic-auth-layout__container');
|
|
103
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: 'dynamic-auth-layout__modal' }, { children: jsxRuntime.jsx(SlideInUpTransition.SlideInUpTransition, Object.assign({ isShown: Boolean(transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.isShown) }, { children: jsxRuntime.jsx(OverlayCardTarget.OverlayCardTarget, { children: jsxRuntime.jsx("div", Object.assign({ className: modalClassName, "data-testid": 'dynamic-auth-modal' }, { children: jsxRuntime.jsxs(VerticalAccordion.VerticalAccordion, { children: [jsxRuntime.
|
|
62
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: 'dynamic-auth-layout__modal' }, { children: jsxRuntime.jsx(SlideInUpTransition.SlideInUpTransition, Object.assign({ isShown: Boolean(transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.isShown) }, { children: jsxRuntime.jsx(OverlayCardTarget.OverlayCardTarget, { children: jsxRuntime.jsx("div", Object.assign({ className: modalClassName, "data-testid": 'dynamic-auth-modal' }, { children: jsxRuntime.jsxs(VerticalAccordion.VerticalAccordion, { children: [jsxRuntime.jsxs(AccordionItem.AccordionItem, Object.assign({ isOpen: !isFooterExpanded, dimOnHide: true }, { children: [showHeader && (jsxRuntime.jsx(header.Header, { onClose: onClose, heading: (headerData === null || headerData === void 0 ? void 0 : headerData.heading) || '', projectSettings: projectSettings, walletConnector: walletConnector })), children, showToSFooter && jsxRuntime.jsx(ToSFooter.ToSFooter, {})] })), helpHeaderData && showHelpContent && (jsxRuntime.jsx(AccordionItem.AccordionItem, Object.assign({ isOpen: isFooterExpanded }, { children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx(HelpContent.HelpContent, {}) }, isFooterExpanded.toString()) })))] }) })) }) })) })));
|
|
104
63
|
};
|
|
105
64
|
|
|
106
65
|
exports.DynamicAuthLayout = DynamicAuthLayout;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
2
|
import type { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { ProjectSettings } from '@dynamic-labs/sdk-api';
|
|
4
|
-
import {
|
|
4
|
+
import { ModalProps } from '../../shared/types';
|
|
5
5
|
import { ITransitionOptions } from '../../components/Transition/transition.type';
|
|
6
6
|
interface Props {
|
|
7
|
-
appName?: string;
|
|
8
7
|
className?: string;
|
|
9
|
-
newToWeb3WalletChainMap: ChainToWalletMap;
|
|
10
|
-
privacyPolicyUrl: string | undefined;
|
|
11
8
|
projectSettings?: ProjectSettings;
|
|
12
|
-
termsOfServiceUrl: string | undefined;
|
|
13
9
|
transitionProps?: Pick<ITransitionOptions, 'isShown'>;
|
|
14
10
|
walletConnector?: WalletConnector | null;
|
|
15
|
-
walletName: string | undefined;
|
|
16
11
|
}
|
|
17
12
|
export declare const DynamicAuthLayout: FC<PropsWithChildren<Props> & ModalProps>;
|
|
18
13
|
export {};
|
|
@@ -1,102 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef } from 'react';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
2
|
import { useFooterAnimationContext } from '../../context/FooterAnimationContext/index.js';
|
|
4
3
|
import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
5
4
|
import { getDynamicLayoutData } from '../../utils/functions/getDynamicLayoutData/getDynamicLayoutData.js';
|
|
6
5
|
import '../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
7
6
|
import { SlideInUpTransition } from '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
8
7
|
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import 'react';
|
|
9
|
+
import '@dynamic-labs/utils';
|
|
11
10
|
import '@dynamic-labs/sdk-api';
|
|
11
|
+
import '../../config/ApiEndpoint.js';
|
|
12
12
|
import '../../shared/logger.js';
|
|
13
13
|
import '@dynamic-labs/iconic';
|
|
14
14
|
import '@dynamic-labs/wallet-connector-core';
|
|
15
15
|
import '@dynamic-labs/wallet-book';
|
|
16
|
-
import '@dynamic-labs/utils';
|
|
17
16
|
import '../../utils/constants/colors.js';
|
|
18
17
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
19
18
|
import 'ethers';
|
|
20
19
|
import '../../shared/consts/index.js';
|
|
21
|
-
import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
|
|
22
20
|
import '@dynamic-labs/multi-wallet';
|
|
23
|
-
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
24
|
-
import '../../context/ThemeContext/ThemeContext.js';
|
|
25
|
-
import 'react-dom';
|
|
26
|
-
import 'react-focus-lock';
|
|
27
|
-
import '../../config/ApiEndpoint.js';
|
|
28
21
|
import '@dynamic-labs/rpc-providers';
|
|
22
|
+
import '../../context/DynamicContext/DynamicContext.js';
|
|
29
23
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
30
24
|
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
25
|
+
import 'react-dom';
|
|
26
|
+
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
27
|
+
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
28
|
+
import '../../context/ThemeContext/ThemeContext.js';
|
|
29
|
+
import 'react-focus-lock';
|
|
31
30
|
import '../../components/IconButton/IconButton.js';
|
|
32
|
-
import { AnimatePresence } from '../../components/AnimatePresence/AnimatePresence.js';
|
|
33
|
-
import '../../components/Alert/Alert.js';
|
|
34
|
-
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
35
|
-
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
36
|
-
import { useMockContext } from '../../context/MockContext/MockContext.js';
|
|
37
|
-
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
38
|
-
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
39
31
|
import { VerticalAccordion } from '../../components/Accordion/components/VerticalAccordion/VerticalAccordion.js';
|
|
40
32
|
import { AccordionItem } from '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
33
|
+
import '../../components/Alert/Alert.js';
|
|
41
34
|
import '../../components/Popper/Popper/Popper.js';
|
|
42
35
|
import '../../components/Popper/PopperContext/PopperContext.js';
|
|
43
36
|
import 'formik';
|
|
44
37
|
import 'yup';
|
|
45
|
-
import
|
|
38
|
+
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
39
|
+
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
40
|
+
import '../../context/MockContext/MockContext.js';
|
|
41
|
+
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
42
|
+
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
46
43
|
import '../../components/OverlayCard/OverlayCard.context.js';
|
|
47
44
|
import { OverlayCardTarget } from '../../components/OverlayCard/OverlayCardTarget.js';
|
|
48
|
-
import {
|
|
49
|
-
import { EmptyFooterContent } from './FooterContent/EmptyFooterContent/empty-footer-content.js';
|
|
50
|
-
import { WalletMoreInfoContent } from './FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.js';
|
|
51
|
-
import { WalletListFooterContent } from './FooterContent/WalletListFooterContent/WalletListFooterContent.js';
|
|
45
|
+
import { useAuthLayoutChecks } from '../../utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js';
|
|
52
46
|
import { Header } from './Header/header.js';
|
|
47
|
+
import { ToSFooter } from './ToSFooter/ToSFooter.js';
|
|
48
|
+
import { HelpContent } from './HelpContent/HelpContent.js';
|
|
53
49
|
|
|
54
|
-
const DynamicAuthLayout = ({
|
|
50
|
+
const DynamicAuthLayout = ({ children, onClose, transitionProps, projectSettings, walletConnector, className = '', }) => {
|
|
55
51
|
const { view } = useViewContext();
|
|
56
|
-
const {
|
|
57
|
-
const { headerData, footerData } = getDynamicLayoutData({
|
|
52
|
+
const { headerData, helpHeaderData } = getDynamicLayoutData({
|
|
58
53
|
view,
|
|
59
54
|
});
|
|
60
|
-
const footerRef = useRef(null);
|
|
61
55
|
const { isFooterExpanded } = useFooterAnimationContext();
|
|
62
|
-
const {
|
|
63
|
-
const renderFooterContent = () => {
|
|
64
|
-
switch (view) {
|
|
65
|
-
case 'wallet-connect-mobile-wallets-list':
|
|
66
|
-
case 'wallet-list':
|
|
67
|
-
case 'login-with-email-or-wallet-full-wallet-list':
|
|
68
|
-
return (jsx(WalletListFooterContent, { chains: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.chains, newToWeb3WalletChainMap: newToWeb3WalletChainMap }));
|
|
69
|
-
case 'pending-signature-without-back-button':
|
|
70
|
-
case 'pending-signature':
|
|
71
|
-
return (jsx(WalletMoreInfoContent, { appName: appName, variant: 'sign', walletName: walletName }));
|
|
72
|
-
case 'pending-connect':
|
|
73
|
-
return jsx(WalletMoreInfoContent, { appName: appName, variant: 'connect' });
|
|
74
|
-
case 'qr-code':
|
|
75
|
-
return jsx(WalletMoreInfoContent, { appName: appName, variant: 'connect' });
|
|
76
|
-
/* istanbul ignore next */
|
|
77
|
-
default:
|
|
78
|
-
return jsx(EmptyFooterContent, {});
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const showFooter =
|
|
82
|
-
// Notice the negation here
|
|
83
|
-
!((view === 'qr-code' && !(walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.canConnectViaQrCode)) ||
|
|
84
|
-
view === 'no-qr-not-installed' ||
|
|
85
|
-
view === 'wallet-used' ||
|
|
86
|
-
view === 'chainalysis-blocked-wallet' ||
|
|
87
|
-
view === 'wallet-sign' ||
|
|
88
|
-
view === 'collect-user-data' ||
|
|
89
|
-
isUserLinkingWallet(user, view, mockedSDK));
|
|
90
|
-
const showHeader = view !== 'collect-user-data' &&
|
|
91
|
-
view !== 'no-access' &&
|
|
92
|
-
view !== 'chainalysis-blocked-wallet' &&
|
|
93
|
-
view !== 'update-email' &&
|
|
94
|
-
view !== 'verify-email' &&
|
|
95
|
-
view !== 'network-not-supported' &&
|
|
96
|
-
view !== 'email-wallet-otp-verification-view';
|
|
97
|
-
const content = (jsxs(Fragment, { children: [showHeader && (jsx(Header, { onClose: onClose, heading: (headerData === null || headerData === void 0 ? void 0 : headerData.heading) || '', projectSettings: projectSettings })), children] }));
|
|
56
|
+
const { showHeader, showHelpContent, showToSFooter } = useAuthLayoutChecks(walletConnector);
|
|
98
57
|
const modalClassName = classNames(className, 'dynamic-auth-layout__container');
|
|
99
|
-
return (jsx("div", Object.assign({ className: 'dynamic-auth-layout__modal' }, { children: jsx(SlideInUpTransition, Object.assign({ isShown: Boolean(transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.isShown) }, { children: jsx(OverlayCardTarget, { children: jsx("div", Object.assign({ className: modalClassName, "data-testid": 'dynamic-auth-modal' }, { children: jsxs(VerticalAccordion, { children: [
|
|
58
|
+
return (jsx("div", Object.assign({ className: 'dynamic-auth-layout__modal' }, { children: jsx(SlideInUpTransition, Object.assign({ isShown: Boolean(transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.isShown) }, { children: jsx(OverlayCardTarget, { children: jsx("div", Object.assign({ className: modalClassName, "data-testid": 'dynamic-auth-modal' }, { children: jsxs(VerticalAccordion, { children: [jsxs(AccordionItem, Object.assign({ isOpen: !isFooterExpanded, dimOnHide: true }, { children: [showHeader && (jsx(Header, { onClose: onClose, heading: (headerData === null || headerData === void 0 ? void 0 : headerData.heading) || '', projectSettings: projectSettings, walletConnector: walletConnector })), children, showToSFooter && jsx(ToSFooter, {})] })), helpHeaderData && showHelpContent && (jsx(AccordionItem, Object.assign({ isOpen: isFooterExpanded }, { children: jsx("div", { children: jsx(HelpContent, {}) }, isFooterExpanded.toString()) })))] }) })) }) })) })));
|
|
100
59
|
};
|
|
101
60
|
|
|
102
61
|
export { DynamicAuthLayout };
|