@dynamic-labs/sdk-react-core 0.19.3 → 1.0.0-alpha.1
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 +41 -24
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +10 -10
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +2 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +3 -2
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +3 -3
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +3 -3
- package/src/lib/context/CaptchaContext/CaptchaContext.cjs +27 -1
- package/src/lib/context/CaptchaContext/CaptchaContext.d.ts +14 -0
- package/src/lib/context/CaptchaContext/CaptchaContext.js +28 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +11 -11
- package/src/lib/context/DynamicContext/DynamicContext.js +11 -11
- package/src/lib/context/DynamicContext/hooks/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.cjs +20 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.d.ts +10 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.js +16 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +2 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +6 -4
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +6 -4
- package/src/lib/data/api.cjs +6 -3
- package/src/lib/data/api.d.ts +5 -3
- package/src/lib/data/api.js +6 -3
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +42 -26
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +42 -26
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +9 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +9 -3
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +5 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +5 -2
- package/src/lib/utils/hooks/index.d.ts +0 -1
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +4 -4
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +4 -4
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +39 -5
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.d.ts +1 -2
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +40 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +13 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +13 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +10 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +10 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +8 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +9 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +4 -3
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +5 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +4 -3
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +3 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +3 -1
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.cjs +0 -1
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.js +0 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +15 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +15 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +9 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.d.ts +3 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +5 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +36 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.d.ts +10 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +29 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +4 -4
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +3 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +4 -4
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +8 -7
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +8 -7
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +0 -1
- package/src/lib/utils/hooks/useWallets/useWallets.js +0 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +9 -41
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.d.ts +1 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +9 -41
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +1 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +1 -1
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +38 -34
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +38 -34
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +20 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +20 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +17 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +17 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.cjs +15 -3
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.js +15 -3
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.cjs +1 -2
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.d.ts +1 -1
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.js +1 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +16 -8
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +16 -8
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs +5 -2
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts +2 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js +5 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +2 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +6 -7
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +6 -7
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +4 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +4 -3
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +3 -5
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +3 -5
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +2 -4
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +2 -4
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +3 -5
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +3 -5
- package/src/lib/utils/hooks/useMultiWalletFlag/index.d.ts +0 -1
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs +0 -36
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.d.ts +0 -2
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js +0 -31
|
@@ -15,7 +15,7 @@ import '../../../../shared/consts/index.js';
|
|
|
15
15
|
import '@dynamic-labs/multi-wallet';
|
|
16
16
|
import '@dynamic-labs/rpc-providers';
|
|
17
17
|
import '../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
18
|
-
import '../../../../context/DynamicContext/
|
|
18
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
19
19
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
20
20
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
21
21
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
@@ -51,7 +51,6 @@ import '@dynamic-labs/types';
|
|
|
51
51
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
52
52
|
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
53
53
|
import { useKYCFlag } from '../../../../utils/hooks/useKYCFlag/useKYCFlag.js';
|
|
54
|
-
import { useMultiWalletFlag } from '../../../../utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js';
|
|
55
54
|
import { DynamicWidgetWalletHeader } from './DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js';
|
|
56
55
|
|
|
57
56
|
const options = [
|
|
@@ -66,19 +65,19 @@ const options = [
|
|
|
66
65
|
];
|
|
67
66
|
const DynamicWidgetHeader = ({ variant, }) => {
|
|
68
67
|
const { dynamicWidgetView, setDynamicWidgetView } = useWidgetContext();
|
|
68
|
+
const { multiWallet } = useInternalDynamicContext();
|
|
69
69
|
const isKYCEnabled = useKYCFlag();
|
|
70
|
-
const isMultiWalletEnabled = useMultiWalletFlag();
|
|
71
70
|
// Marks 'Profile' view as active when client goes to 'Edit Profile' view
|
|
72
71
|
const dynamicWidgetSwitcherOverwriteValue = useMemo(() => {
|
|
73
|
-
if (!isKYCEnabled && !
|
|
72
|
+
if (!isKYCEnabled && !multiWallet)
|
|
74
73
|
return 'wallets';
|
|
75
74
|
if (dynamicWidgetView === 'edit-profile')
|
|
76
75
|
return 'profile';
|
|
77
76
|
return dynamicWidgetView;
|
|
78
|
-
}, [dynamicWidgetView, isKYCEnabled,
|
|
79
|
-
return (jsxs("div", { className: 'dynamic-widget-header', children: [isKYCEnabled &&
|
|
77
|
+
}, [dynamicWidgetView, isKYCEnabled, multiWallet]);
|
|
78
|
+
return (jsxs("div", { className: 'dynamic-widget-header', children: [isKYCEnabled && multiWallet && (jsx(OptionsSwitcher, { rootClassName: 'dynamic-widget-header__switcher', value: dynamicWidgetSwitcherOverwriteValue, options: options, onChange: (view) => setDynamicWidgetView(view) })), (dynamicWidgetSwitcherOverwriteValue === 'wallets' ||
|
|
80
79
|
(dynamicWidgetSwitcherOverwriteValue === 'profile' &&
|
|
81
|
-
!
|
|
80
|
+
!multiWallet)) && jsx(DynamicWidgetWalletHeader, { variant: variant })] }));
|
|
82
81
|
};
|
|
83
82
|
const MemoizedDynamicWidgetHeader = React__default.memo(DynamicWidgetHeader);
|
|
84
83
|
|
|
@@ -68,7 +68,7 @@ require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
|
68
68
|
const Wallet = ({ wallet, ens }) => {
|
|
69
69
|
var _a;
|
|
70
70
|
const { id: walletId, connector, address } = wallet;
|
|
71
|
-
const { computeConnectedStateForWallets, setPrimaryWallet,
|
|
71
|
+
const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnectorKey, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, user, projectSettings, authMode, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
72
72
|
const email = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((verifiedCredential) => verifiedCredential.format === 'email')) === null || _a === void 0 ? void 0 : _a.email;
|
|
73
73
|
const iconSize = 20;
|
|
74
74
|
const options = [
|
|
@@ -90,7 +90,8 @@ const Wallet = ({ wallet, ens }) => {
|
|
|
90
90
|
callback: () => helpers.copyToClipboard(address || ''),
|
|
91
91
|
text: 'Copy address',
|
|
92
92
|
});
|
|
93
|
-
if (!walletConnectorCore.isEmbeddedConnector(connector)
|
|
93
|
+
if (!walletConnectorCore.isEmbeddedConnector(connector) &&
|
|
94
|
+
!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.multiWalletUnlinkDisabled)) {
|
|
94
95
|
options.push({
|
|
95
96
|
Icon: jsxRuntime.jsx(unlink.ReactComponent, {}),
|
|
96
97
|
callback: () => setSelectedWalletWithAction({ action: 'unlink', wallet }),
|
|
@@ -117,7 +118,7 @@ const Wallet = ({ wallet, ens }) => {
|
|
|
117
118
|
setSelectedWalletWithAction({ action: 'select', wallet });
|
|
118
119
|
setPrimaryWallet(walletId);
|
|
119
120
|
computeConnectedStateForWallets();
|
|
120
|
-
|
|
121
|
+
setSelectedWalletConnectorKey(connector.key);
|
|
121
122
|
});
|
|
122
123
|
return (jsxRuntime.jsxs("div", { className: 'wallet__container', "data-testid": 'wallet', children: [jsxRuntime.jsxs("div", { className: 'wallet__row', children: [jsxRuntime.jsx("div", { className: 'wallet__icon-container', children: jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { iconSize: iconSize, jwt: authToken, wallet: wallet, showStatus: true }) }), (ens === null || ens === void 0 ? void 0 : ens.name) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, { className: 'wallet__ens-name', variant: 'body_small', color: 'primary', truncate: true, children: ens === null || ens === void 0 ? void 0 : ens.name }), jsxRuntime.jsx("div", { className: 'wallet__row__seperator' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_mini', color: 'secondary', children: shortenWalletAddress.shortenWalletAddress(address, 3, 3) })] })) : (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(address, 4, 4) }))] }), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'wallet__menu', direction: 'left' })] }));
|
|
123
124
|
};
|
|
@@ -64,7 +64,7 @@ import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
|
64
64
|
const Wallet = ({ wallet, ens }) => {
|
|
65
65
|
var _a;
|
|
66
66
|
const { id: walletId, connector, address } = wallet;
|
|
67
|
-
const { computeConnectedStateForWallets, setPrimaryWallet,
|
|
67
|
+
const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnectorKey, setShowWidgetStatePopup, setSelectedWalletWithAction, authToken, primaryWallet, user, projectSettings, authMode, } = useInternalDynamicContext();
|
|
68
68
|
const email = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((verifiedCredential) => verifiedCredential.format === 'email')) === null || _a === void 0 ? void 0 : _a.email;
|
|
69
69
|
const iconSize = 20;
|
|
70
70
|
const options = [
|
|
@@ -86,7 +86,8 @@ const Wallet = ({ wallet, ens }) => {
|
|
|
86
86
|
callback: () => copyToClipboard(address || ''),
|
|
87
87
|
text: 'Copy address',
|
|
88
88
|
});
|
|
89
|
-
if (!isEmbeddedConnector(connector)
|
|
89
|
+
if (!isEmbeddedConnector(connector) &&
|
|
90
|
+
!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.multiWalletUnlinkDisabled)) {
|
|
90
91
|
options.push({
|
|
91
92
|
Icon: jsx(SvgUnlink, {}),
|
|
92
93
|
callback: () => setSelectedWalletWithAction({ action: 'unlink', wallet }),
|
|
@@ -113,7 +114,7 @@ const Wallet = ({ wallet, ens }) => {
|
|
|
113
114
|
setSelectedWalletWithAction({ action: 'select', wallet });
|
|
114
115
|
setPrimaryWallet(walletId);
|
|
115
116
|
computeConnectedStateForWallets();
|
|
116
|
-
|
|
117
|
+
setSelectedWalletConnectorKey(connector.key);
|
|
117
118
|
});
|
|
118
119
|
return (jsxs("div", { className: 'wallet__container', "data-testid": 'wallet', children: [jsxs("div", { className: 'wallet__row', children: [jsx("div", { className: 'wallet__icon-container', children: jsx(AuthProviderIcon, { iconSize: iconSize, jwt: authToken, wallet: wallet, showStatus: true }) }), (ens === null || ens === void 0 ? void 0 : ens.name) ? (jsxs(Fragment, { children: [jsx(Typography, { className: 'wallet__ens-name', variant: 'body_small', color: 'primary', truncate: true, children: ens === null || ens === void 0 ? void 0 : ens.name }), jsx("div", { className: 'wallet__row__seperator' }), jsx(Typography, { variant: 'body_mini', color: 'secondary', children: shortenWalletAddress(address, 3, 3) })] })) : (jsx(Typography, { variant: 'body_small', color: 'primary', children: shortenWalletAddress(address, 4, 4) }))] }), jsx(DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'wallet__menu', direction: 'left' })] }));
|
|
119
120
|
};
|
|
@@ -55,22 +55,20 @@ require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.c
|
|
|
55
55
|
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
56
56
|
var useViewController = require('../hooks/useViewController/useViewController.cjs');
|
|
57
57
|
var useKYCFlag = require('../../../utils/hooks/useKYCFlag/useKYCFlag.cjs');
|
|
58
|
-
var useMultiWalletFlag = require('../../../utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs');
|
|
59
58
|
|
|
60
59
|
const DynamicWidgetContext = React.createContext(undefined);
|
|
61
60
|
const DynamicWidgetContextProvider = ({ children, }) => {
|
|
62
61
|
const widgetRef = React.useRef(null);
|
|
63
62
|
const inlineControlsRef = React.useRef(null);
|
|
64
63
|
const availableWalletsContainerRef = React.useRef(null);
|
|
65
|
-
const { setShowDynamicUserProfile, showDynamicUserProfile } = useInternalDynamicContext.useInternalDynamicContext();
|
|
64
|
+
const { setShowDynamicUserProfile, showDynamicUserProfile, multiWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
66
65
|
const isKYCEnabled = useKYCFlag.useKYCFlag();
|
|
67
|
-
const
|
|
68
|
-
const { view: dynamicWidgetView, setView: setDynamicWidgetView, goToInitialView: goToInitialDynamicWidgetView, } = useViewController.useViewController(isKYCEnabled && !isMultiWalletEnabled ? 'profile' : 'wallets');
|
|
66
|
+
const { view: dynamicWidgetView, setView: setDynamicWidgetView, goToInitialView: goToInitialDynamicWidgetView, } = useViewController.useViewController(isKYCEnabled && !multiWallet ? 'profile' : 'wallets');
|
|
69
67
|
const goToProfileView = React.useCallback(() => {
|
|
70
68
|
if (isKYCEnabled)
|
|
71
69
|
return setDynamicWidgetView('profile');
|
|
72
70
|
setDynamicWidgetView('wallets');
|
|
73
|
-
}, [isKYCEnabled,
|
|
71
|
+
}, [isKYCEnabled, multiWallet]);
|
|
74
72
|
const value = React.useMemo(() => ({
|
|
75
73
|
availableWalletsContainerRef,
|
|
76
74
|
dynamicWidgetView,
|
|
@@ -51,22 +51,20 @@ import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js
|
|
|
51
51
|
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
52
52
|
import { useViewController } from '../hooks/useViewController/useViewController.js';
|
|
53
53
|
import { useKYCFlag } from '../../../utils/hooks/useKYCFlag/useKYCFlag.js';
|
|
54
|
-
import { useMultiWalletFlag } from '../../../utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js';
|
|
55
54
|
|
|
56
55
|
const DynamicWidgetContext = createContext(undefined);
|
|
57
56
|
const DynamicWidgetContextProvider = ({ children, }) => {
|
|
58
57
|
const widgetRef = useRef(null);
|
|
59
58
|
const inlineControlsRef = useRef(null);
|
|
60
59
|
const availableWalletsContainerRef = useRef(null);
|
|
61
|
-
const { setShowDynamicUserProfile, showDynamicUserProfile } = useInternalDynamicContext();
|
|
60
|
+
const { setShowDynamicUserProfile, showDynamicUserProfile, multiWallet } = useInternalDynamicContext();
|
|
62
61
|
const isKYCEnabled = useKYCFlag();
|
|
63
|
-
const
|
|
64
|
-
const { view: dynamicWidgetView, setView: setDynamicWidgetView, goToInitialView: goToInitialDynamicWidgetView, } = useViewController(isKYCEnabled && !isMultiWalletEnabled ? 'profile' : 'wallets');
|
|
62
|
+
const { view: dynamicWidgetView, setView: setDynamicWidgetView, goToInitialView: goToInitialDynamicWidgetView, } = useViewController(isKYCEnabled && !multiWallet ? 'profile' : 'wallets');
|
|
65
63
|
const goToProfileView = useCallback(() => {
|
|
66
64
|
if (isKYCEnabled)
|
|
67
65
|
return setDynamicWidgetView('profile');
|
|
68
66
|
setDynamicWidgetView('wallets');
|
|
69
|
-
}, [isKYCEnabled,
|
|
67
|
+
}, [isKYCEnabled, multiWallet]);
|
|
70
68
|
const value = useMemo(() => ({
|
|
71
69
|
availableWalletsContainerRef,
|
|
72
70
|
dynamicWidgetView,
|
|
@@ -62,7 +62,7 @@ require('../../../../../components/InlineWidget/InlineWidget.cjs');
|
|
|
62
62
|
require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
63
63
|
|
|
64
64
|
const SwitchOrUseActiveAccountView = ({ connectedWallet, selectedWalletToSwitchTo, }) => {
|
|
65
|
-
const { setSelectedWalletWithAction,
|
|
65
|
+
const { setSelectedWalletWithAction, setSelectedWalletConnectorKey, computeConnectedStateForWallets, setPrimaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
66
66
|
const onUseActiveWalletClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
67
67
|
var _a, _b;
|
|
68
68
|
if (!connectedWallet) {
|
|
@@ -74,13 +74,13 @@ const SwitchOrUseActiveAccountView = ({ connectedWallet, selectedWalletToSwitchT
|
|
|
74
74
|
setSelectedWalletWithAction({ action: 'select', wallet: connectedWallet });
|
|
75
75
|
setPrimaryWallet(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.id);
|
|
76
76
|
computeConnectedStateForWallets();
|
|
77
|
-
|
|
77
|
+
setSelectedWalletConnectorKey(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector.key);
|
|
78
78
|
}), [
|
|
79
79
|
connectedWallet,
|
|
80
80
|
setSelectedWalletWithAction,
|
|
81
81
|
setPrimaryWallet,
|
|
82
82
|
computeConnectedStateForWallets,
|
|
83
|
-
|
|
83
|
+
setSelectedWalletConnectorKey,
|
|
84
84
|
]);
|
|
85
85
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: ["Wallet", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.address, 3, 3) }), ' ', "is not active in ", selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.name, ". To make active, open your ", selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.name, " wallet and switch to this account."] }), jsxRuntime.jsx(Divider.Divider, { fullWidth: true, text: 'Or' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: "Use your active wallet" }), jsxRuntime.jsxs(Button.Button, { buttonClassName: 'default-prompt-modal__button', expanded: true, type: 'button', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, onClick: onUseActiveWalletClick, dataTestId: 'use-active-wallet-button', children: ["Select", ' ', jsxRuntime.jsx(Icon.Icon, { size: 'xsmall', children: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.key }) }), ' ', shortenWalletAddress.shortenWalletAddress(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.address, 3, 3)] })] }));
|
|
86
86
|
};
|
|
@@ -58,7 +58,7 @@ import '../../../../../components/InlineWidget/InlineWidget.js';
|
|
|
58
58
|
import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
59
59
|
|
|
60
60
|
const SwitchOrUseActiveAccountView = ({ connectedWallet, selectedWalletToSwitchTo, }) => {
|
|
61
|
-
const { setSelectedWalletWithAction,
|
|
61
|
+
const { setSelectedWalletWithAction, setSelectedWalletConnectorKey, computeConnectedStateForWallets, setPrimaryWallet, } = useInternalDynamicContext();
|
|
62
62
|
const onUseActiveWalletClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
63
|
var _a, _b;
|
|
64
64
|
if (!connectedWallet) {
|
|
@@ -70,13 +70,13 @@ const SwitchOrUseActiveAccountView = ({ connectedWallet, selectedWalletToSwitchT
|
|
|
70
70
|
setSelectedWalletWithAction({ action: 'select', wallet: connectedWallet });
|
|
71
71
|
setPrimaryWallet(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.id);
|
|
72
72
|
computeConnectedStateForWallets();
|
|
73
|
-
|
|
73
|
+
setSelectedWalletConnectorKey(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector.key);
|
|
74
74
|
}), [
|
|
75
75
|
connectedWallet,
|
|
76
76
|
setSelectedWalletWithAction,
|
|
77
77
|
setPrimaryWallet,
|
|
78
78
|
computeConnectedStateForWallets,
|
|
79
|
-
|
|
79
|
+
setSelectedWalletConnectorKey,
|
|
80
80
|
]);
|
|
81
81
|
return (jsxs(Fragment, { children: [jsxs(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content', children: ["Wallet", ' ', jsx(Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress(selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.address, 3, 3) }), ' ', "is not active in ", selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.name, ". To make active, open your ", selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.name, " wallet and switch to this account."] }), jsx(Divider, { fullWidth: true, text: 'Or' }), jsx(Typography, { variant: 'body_normal', color: 'primary', children: "Use your active wallet" }), jsxs(Button, { buttonClassName: 'default-prompt-modal__button', expanded: true, type: 'button', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, onClick: onUseActiveWalletClick, dataTestId: 'use-active-wallet-button', children: ["Select", ' ', jsx(Icon, { size: 'xsmall', children: jsx(WalletIcon, { walletKey: selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.key }) }), ' ', shortenWalletAddress(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.address, 3, 3)] })] }));
|
|
82
82
|
};
|
|
@@ -11,10 +11,10 @@ var EmailOTPConnectorPendingSignModalContent = require('../../components/EmailOT
|
|
|
11
11
|
var DefaultPendingSignModalContent = require('./DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs');
|
|
12
12
|
|
|
13
13
|
const PendingSignModal = () => {
|
|
14
|
-
const { selectedWalletConnector,
|
|
14
|
+
const { selectedWalletConnector, setSelectedWalletConnectorKey, setMultiWalletWidgetState, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
15
15
|
const handleOnClickBackdrop = () => {
|
|
16
16
|
setMultiWalletWidgetState('idle');
|
|
17
|
-
|
|
17
|
+
setSelectedWalletConnectorKey(null);
|
|
18
18
|
};
|
|
19
19
|
if (selectedWalletConnector !== null) {
|
|
20
20
|
if (walletConnectorCore.isEmailOTPWalletConnector(selectedWalletConnector)) {
|
|
@@ -7,10 +7,10 @@ import { EmailOTPConnectorPendingSignModalContent } from '../../components/Email
|
|
|
7
7
|
import { DefaultPendingSignModalContent } from './DefaultPendingSignModalContent/DefaultPendingSignModalContent.js';
|
|
8
8
|
|
|
9
9
|
const PendingSignModal = () => {
|
|
10
|
-
const { selectedWalletConnector,
|
|
10
|
+
const { selectedWalletConnector, setSelectedWalletConnectorKey, setMultiWalletWidgetState, } = useInternalDynamicContext();
|
|
11
11
|
const handleOnClickBackdrop = () => {
|
|
12
12
|
setMultiWalletWidgetState('idle');
|
|
13
|
-
|
|
13
|
+
setSelectedWalletConnectorKey(null);
|
|
14
14
|
};
|
|
15
15
|
if (selectedWalletConnector !== null) {
|
|
16
16
|
if (isEmailOTPWalletConnector(selectedWalletConnector)) {
|
|
@@ -52,7 +52,6 @@ var UserProfileForm = require('../../../../components/UserProfileForm/UserProfil
|
|
|
52
52
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
53
53
|
require('../../../../components/Alert/Alert.cjs');
|
|
54
54
|
var useKYCFlag = require('../../../../utils/hooks/useKYCFlag/useKYCFlag.cjs');
|
|
55
|
-
var useMultiWalletFlag = require('../../../../utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs');
|
|
56
55
|
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
57
56
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
58
57
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
@@ -63,7 +62,7 @@ require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
|
63
62
|
|
|
64
63
|
const EditProfileView = ({ rootClassName, }) => {
|
|
65
64
|
const { setView } = ViewContext.useViewContext();
|
|
66
|
-
const { internalSetShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
65
|
+
const { internalSetShowAuthFlow, multiWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
67
66
|
const { goToProfileView } = DynamicWidgetContext.useWidgetContext();
|
|
68
67
|
const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
|
|
69
68
|
validationSchemaStripUnknown: true,
|
|
@@ -77,8 +76,7 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
77
76
|
}
|
|
78
77
|
}), [goToProfileView, internalSetShowAuthFlow, setView, updateUser]);
|
|
79
78
|
const isKYCEnabled = useKYCFlag.useKYCFlag();
|
|
80
|
-
|
|
81
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My information" })), jsxRuntime.jsx(UserProfileForm.UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|
|
79
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!multiWallet && isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My information" })), jsxRuntime.jsx(UserProfileForm.UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|
|
82
80
|
};
|
|
83
81
|
|
|
84
82
|
exports.EditProfileView = EditProfileView;
|
|
@@ -48,7 +48,6 @@ import { UserProfileForm } from '../../../../components/UserProfileForm/UserProf
|
|
|
48
48
|
import '../../../../components/IconButton/IconButton.js';
|
|
49
49
|
import '../../../../components/Alert/Alert.js';
|
|
50
50
|
import { useKYCFlag } from '../../../../utils/hooks/useKYCFlag/useKYCFlag.js';
|
|
51
|
-
import { useMultiWalletFlag } from '../../../../utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js';
|
|
52
51
|
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
53
52
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
54
53
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
@@ -59,7 +58,7 @@ import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
|
59
58
|
|
|
60
59
|
const EditProfileView = ({ rootClassName, }) => {
|
|
61
60
|
const { setView } = useViewContext();
|
|
62
|
-
const { internalSetShowAuthFlow } = useInternalDynamicContext();
|
|
61
|
+
const { internalSetShowAuthFlow, multiWallet } = useInternalDynamicContext();
|
|
63
62
|
const { goToProfileView } = useWidgetContext();
|
|
64
63
|
const { updateUser } = useUserUpdateRequestInternal({
|
|
65
64
|
validationSchemaStripUnknown: true,
|
|
@@ -73,8 +72,7 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
73
72
|
}
|
|
74
73
|
}), [goToProfileView, internalSetShowAuthFlow, setView, updateUser]);
|
|
75
74
|
const isKYCEnabled = useKYCFlag();
|
|
76
|
-
|
|
77
|
-
return (jsxs(Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsx(Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My information" })), jsx(UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|
|
75
|
+
return (jsxs(Fragment, { children: [!multiWallet && isKYCEnabled && (jsx(Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My information" })), jsx(UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|
|
78
76
|
};
|
|
79
77
|
|
|
80
78
|
export { EditProfileView };
|
|
@@ -57,7 +57,6 @@ var Button = require('../../../../components/Button/Button.cjs');
|
|
|
57
57
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
58
58
|
require('../../../../components/Alert/Alert.cjs');
|
|
59
59
|
var useKYCFlag = require('../../../../utils/hooks/useKYCFlag/useKYCFlag.cjs');
|
|
60
|
-
var useMultiWalletFlag = require('../../../../utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs');
|
|
61
60
|
var LogoutButton = require('../../../../components/LogoutButton/LogoutButton.cjs');
|
|
62
61
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
63
62
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
@@ -65,16 +64,15 @@ require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
|
65
64
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
66
65
|
|
|
67
66
|
const WalletsView = () => {
|
|
68
|
-
const { setShowAuthFlow,
|
|
67
|
+
const { setShowAuthFlow, setSelectedWalletConnectorKey, user, authMode, multiWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
69
68
|
const isKYCEnabled = useKYCFlag.useKYCFlag();
|
|
70
|
-
const isMultiWalletEnabled = useMultiWalletFlag.useMultiWalletFlag();
|
|
71
69
|
const { setView } = ViewContext.useViewContext();
|
|
72
70
|
const addNewWallet = () => {
|
|
73
71
|
setView('multi-wallet-wallet-list');
|
|
74
72
|
setShowAuthFlow(true);
|
|
75
|
-
|
|
73
|
+
setSelectedWalletConnectorKey(null);
|
|
76
74
|
};
|
|
77
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!
|
|
75
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!multiWallet && !isKYCEnabled && (jsxRuntime.jsxs("div", { className: 'dynamic-widget-index-view__email-container', children: [jsxRuntime.jsx(Typography.Typography, { children: user === null || user === void 0 ? void 0 : user.email }), jsxRuntime.jsx(SingleWalletButtons.SingleWalletButtons, {})] })), multiWallet && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DynamicWidgetWallets.DynamicWidgetWallets, {}), jsxRuntime.jsx(DynamicWidgetFooter.DynamicWidgetFooter, { children: jsxRuntime.jsxs("div", { className: 'dynamic-widget-index-view__footer', children: [jsxRuntime.jsxs(Button.Button, { buttonClassName: 'dynamic-widget-footer__button', buttonVariant: 'tertiary', buttonPadding: 'none', onClick: addNewWallet, typographyProps: {
|
|
78
76
|
color: 'secondary',
|
|
79
77
|
variant: 'button_tertiary',
|
|
80
78
|
}, startSlot: jsxRuntime.jsx(add.ReactComponent, {}), children: [authMode === 'connect-only' ? 'Connect' : 'Link', " a new wallet"] }), jsxRuntime.jsx(LogoutButton.LogoutButton, { isTextButton: true, buttonClassName: 'dynamic-widget-footer__button' })] }) })] }))] }));
|
|
@@ -53,7 +53,6 @@ import { Button } from '../../../../components/Button/Button.js';
|
|
|
53
53
|
import '../../../../components/IconButton/IconButton.js';
|
|
54
54
|
import '../../../../components/Alert/Alert.js';
|
|
55
55
|
import { useKYCFlag } from '../../../../utils/hooks/useKYCFlag/useKYCFlag.js';
|
|
56
|
-
import { useMultiWalletFlag } from '../../../../utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js';
|
|
57
56
|
import { LogoutButton } from '../../../../components/LogoutButton/LogoutButton.js';
|
|
58
57
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
59
58
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
@@ -61,16 +60,15 @@ import '../../../../components/InlineWidget/InlineWidget.js';
|
|
|
61
60
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
62
61
|
|
|
63
62
|
const WalletsView = () => {
|
|
64
|
-
const { setShowAuthFlow,
|
|
63
|
+
const { setShowAuthFlow, setSelectedWalletConnectorKey, user, authMode, multiWallet, } = useInternalDynamicContext();
|
|
65
64
|
const isKYCEnabled = useKYCFlag();
|
|
66
|
-
const isMultiWalletEnabled = useMultiWalletFlag();
|
|
67
65
|
const { setView } = useViewContext();
|
|
68
66
|
const addNewWallet = () => {
|
|
69
67
|
setView('multi-wallet-wallet-list');
|
|
70
68
|
setShowAuthFlow(true);
|
|
71
|
-
|
|
69
|
+
setSelectedWalletConnectorKey(null);
|
|
72
70
|
};
|
|
73
|
-
return (jsxs(Fragment, { children: [!
|
|
71
|
+
return (jsxs(Fragment, { children: [!multiWallet && !isKYCEnabled && (jsxs("div", { className: 'dynamic-widget-index-view__email-container', children: [jsx(Typography, { children: user === null || user === void 0 ? void 0 : user.email }), jsx(SingleWalletButtons, {})] })), multiWallet && (jsxs(Fragment, { children: [jsx(DynamicWidgetWallets, {}), jsx(DynamicWidgetFooter, { children: jsxs("div", { className: 'dynamic-widget-index-view__footer', children: [jsxs(Button, { buttonClassName: 'dynamic-widget-footer__button', buttonVariant: 'tertiary', buttonPadding: 'none', onClick: addNewWallet, typographyProps: {
|
|
74
72
|
color: 'secondary',
|
|
75
73
|
variant: 'button_tertiary',
|
|
76
74
|
}, startSlot: jsx(SvgAdd, {}), children: [authMode === 'connect-only' ? 'Connect' : 'Link', " a new wallet"] }), jsx(LogoutButton, { isTextButton: true, buttonClassName: 'dynamic-widget-footer__button' })] }) })] }))] }));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useMultiWalletFlag } from './useMultiWalletFlag';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var useInternalDynamicContext = require('../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
6
|
-
require('@dynamic-labs/sdk-api');
|
|
7
|
-
require('../../../shared/logger.cjs');
|
|
8
|
-
require('@dynamic-labs/iconic');
|
|
9
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
-
require('react/jsx-runtime');
|
|
11
|
-
require('../../../context/ViewContext/ViewContext.cjs');
|
|
12
|
-
require('react');
|
|
13
|
-
require('@dynamic-labs/wallet-book');
|
|
14
|
-
var isSSR = require('../../../shared/utils/functions/isSSR/isSSR.cjs');
|
|
15
|
-
require('../../constants/colors.cjs');
|
|
16
|
-
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
17
|
-
require('viem');
|
|
18
|
-
require('@dynamic-labs/utils');
|
|
19
|
-
require('../../../shared/consts/index.cjs');
|
|
20
|
-
|
|
21
|
-
const isMultiWalletEnabledInURL = () => {
|
|
22
|
-
const flag = 'multiwallet.widget';
|
|
23
|
-
const searchParams = new URLSearchParams(!isSSR.isSSR() ? window.location.search : '');
|
|
24
|
-
// by default, enable the widget
|
|
25
|
-
if (!searchParams.has(flag)) {
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
return searchParams.get(flag) === 'true';
|
|
29
|
-
};
|
|
30
|
-
const useMultiWalletFlag = () => {
|
|
31
|
-
const { multiWallet: isMultiWalletEnabled } = useInternalDynamicContext.useInternalDynamicContext();
|
|
32
|
-
return isMultiWalletEnabled && isMultiWalletEnabledInURL();
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
exports.isMultiWalletEnabledInURL = isMultiWalletEnabledInURL;
|
|
36
|
-
exports.useMultiWalletFlag = useMultiWalletFlag;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useInternalDynamicContext } from '../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
2
|
-
import '@dynamic-labs/sdk-api';
|
|
3
|
-
import '../../../shared/logger.js';
|
|
4
|
-
import '@dynamic-labs/iconic';
|
|
5
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import 'react/jsx-runtime';
|
|
7
|
-
import '../../../context/ViewContext/ViewContext.js';
|
|
8
|
-
import 'react';
|
|
9
|
-
import '@dynamic-labs/wallet-book';
|
|
10
|
-
import { isSSR } from '../../../shared/utils/functions/isSSR/isSSR.js';
|
|
11
|
-
import '../../constants/colors.js';
|
|
12
|
-
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
13
|
-
import 'viem';
|
|
14
|
-
import '@dynamic-labs/utils';
|
|
15
|
-
import '../../../shared/consts/index.js';
|
|
16
|
-
|
|
17
|
-
const isMultiWalletEnabledInURL = () => {
|
|
18
|
-
const flag = 'multiwallet.widget';
|
|
19
|
-
const searchParams = new URLSearchParams(!isSSR() ? window.location.search : '');
|
|
20
|
-
// by default, enable the widget
|
|
21
|
-
if (!searchParams.has(flag)) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
return searchParams.get(flag) === 'true';
|
|
25
|
-
};
|
|
26
|
-
const useMultiWalletFlag = () => {
|
|
27
|
-
const { multiWallet: isMultiWalletEnabled } = useInternalDynamicContext();
|
|
28
|
-
return isMultiWalletEnabled && isMultiWalletEnabledInURL();
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export { isMultiWalletEnabledInURL, useMultiWalletFlag };
|