@dynamic-labs/sdk-react-core 0.17.0-RC.15 → 0.17.0-RC.17
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 +32 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +8 -8
- package/src/lib/components/Divider/Divider.cjs +4 -1
- package/src/lib/components/Divider/Divider.d.ts +6 -2
- package/src/lib/components/Divider/Divider.js +4 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +40 -0
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.d.ts +17 -0
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +36 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.cjs +11 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.d.ts +12 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.js +7 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/TransactionRow/index.d.ts +1 -0
- package/src/lib/components/TransactionConfirmationPageLayout/components/index.d.ts +1 -0
- package/src/lib/components/TransactionConfirmationPageLayout/index.d.ts +2 -0
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +19 -7
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +19 -7
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +6 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +6 -1
- package/src/lib/data/api.cjs +2 -1
- package/src/lib/data/api.d.ts +1 -1
- package/src/lib/data/api.js +2 -1
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +18 -25
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +18 -25
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +0 -1
- package/src/lib/shared/types/index.d.ts +4 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/isWalletLinked/index.d.ts +1 -0
- package/src/lib/utils/functions/isWalletLinked/isWalletLinked.cjs +15 -0
- package/src/lib/utils/functions/isWalletLinked/isWalletLinked.d.ts +2 -0
- package/src/lib/utils/functions/isWalletLinked/isWalletLinked.js +11 -0
- package/src/lib/utils/hooks/multiWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWalletWidgetState/useMultiWalletWidgetState.cjs +0 -2
- package/src/lib/utils/hooks/multiWallet/useMultiWalletWidgetState/useMultiWalletWidgetState.js +0 -2
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +53 -6
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +8 -1
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +54 -7
- package/src/lib/utils/hooks/useConnectedAccountWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.cjs +30 -0
- package/src/lib/utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.d.ts +2 -0
- package/src/lib/utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.js +26 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +5 -4
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +5 -4
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +18 -6
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +18 -6
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +4 -5
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +4 -5
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +2 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetPrompts/DynamicWidgetPrompts.cjs +15 -5
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetPrompts/DynamicWidgetPrompts.js +15 -5
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +2 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.cjs +38 -6
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.d.ts +2 -1
- package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.js +39 -7
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +2 -2
- package/src/lib/widgets/DynamicWidget/{components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs → prompts/DefaultPromptModal/DefaultPromptModal.cjs} +6 -13
- package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.d.ts +13 -0
- package/src/lib/widgets/DynamicWidget/{components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js → prompts/DefaultPromptModal/DefaultPromptModal.js} +6 -13
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +17 -42
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +18 -43
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +40 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.d.ts +7 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +36 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +67 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.d.ts +8 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +63 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +57 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +53 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +44 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +40 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +64 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +60 -0
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.cjs +2 -33
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.js +2 -33
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +4 -6
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +5 -7
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.d.ts +0 -2
- package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.types.d.ts +0 -7
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.cjs +0 -61
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.d.ts +0 -7
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.js +0 -57
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/index.d.ts +0 -1
- /package/src/lib/widgets/DynamicWidget/{components → prompts/PendingSignModal}/DefaultPendingSignModalContent/index.d.ts +0 -0
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var IconWithSpinner = require('../../../../components/IconWithSpinner/IconWithSpinner.cjs');
|
|
7
|
+
var WidgetPortal = require('../../components/WidgetPortal/WidgetPortal.cjs');
|
|
8
8
|
require('react');
|
|
9
9
|
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
10
10
|
require('@dynamic-labs/sdk-api');
|
|
@@ -12,14 +12,15 @@ require('../../../../shared/logger.cjs');
|
|
|
12
12
|
require('@dynamic-labs/iconic');
|
|
13
13
|
require('@dynamic-labs/wallet-connector-core');
|
|
14
14
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
+
require('@dynamic-labs/utils');
|
|
15
16
|
require('../../../../utils/constants/colors.cjs');
|
|
16
17
|
require('ethers');
|
|
17
18
|
require('../../../../shared/consts/index.cjs');
|
|
18
19
|
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
19
20
|
require('@dynamic-labs/multi-wallet');
|
|
20
|
-
var pixelToRem = require('../../../../utils/functions/pixelToRem/pixelToRem.cjs');
|
|
21
21
|
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
22
22
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
23
|
+
var classNames = require('../../../../utils/functions/classNames/classNames.cjs');
|
|
23
24
|
require('react-dom');
|
|
24
25
|
require('react-focus-lock');
|
|
25
26
|
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
@@ -31,19 +32,11 @@ require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
|
31
32
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
32
33
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
33
34
|
require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
34
|
-
var Button = require('../../../../components/Button/Button.cjs');
|
|
35
35
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
36
36
|
require('../../../../components/Alert/Alert.cjs');
|
|
37
|
-
var IconWithSpinner = require('../../../../components/IconWithSpinner/IconWithSpinner.cjs');
|
|
38
37
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
39
38
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
40
|
-
var helpers = require('../../helpers/helpers.cjs');
|
|
41
39
|
|
|
42
|
-
const
|
|
43
|
-
const { name = '' } = walletConnector || {};
|
|
44
|
-
const iconSize = 80;
|
|
45
|
-
const icon = (jsxRuntime.jsx(walletBook.WalletIcon, { walletName: name, style: { height: pixelToRem.pixelToRem(iconSize), width: pixelToRem.pixelToRem(iconSize) } }));
|
|
46
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: 'default-pending-sign-modal-content__container' }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { iconSize: 80, Icon: icon, isSpinning: true }), name && (jsxRuntime.jsxs(Typography.Typography, Object.assign({ color: 'primary', className: 'default-pending-sign-modal-content__title', variant: 'body_normal', weight: 'medium' }, { children: ["Sign in with ", helpers.capitalize(name)] }))), jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'medium' }, { children: "Sign the message in your wallet to approve linking this wallet to your account" })), utils.isMobile() && !(walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.canConnectViaCustodialService) && (jsxRuntime.jsx(Button.Button, Object.assign({ onClick: onClickToSign }, { children: "Click to Sign" })))] })));
|
|
47
|
-
};
|
|
40
|
+
const DefaultPromptModal = ({ children, className = '', dataTestId = '', icon, showCloseButton = false, title, }) => (jsxRuntime.jsx(WidgetPortal.WidgetPortal, Object.assign({ showCloseButton: showCloseButton }, { children: jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('default-prompt-modal', className), "data-testid": dataTestId }, { children: [icon && jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: icon, iconSize: 96, isSpinning: true }), jsxRuntime.jsxs("div", Object.assign({ className: 'default-prompt-modal__content' }, { children: [title && (jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'title', color: 'primary', "data-testid": 'title' }, { children: title }))), children] }))] })) })));
|
|
48
41
|
|
|
49
|
-
exports.
|
|
42
|
+
exports.DefaultPromptModal = DefaultPromptModal;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { Iconic } from '@dynamic-labs/iconic';
|
|
3
|
+
import { Icon } from '../../../../shared';
|
|
4
|
+
type Props = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
dataTestId?: string;
|
|
8
|
+
icon?: Icon | Iconic | ReactElement;
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
title?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const DefaultPromptModal: FC<Props>;
|
|
13
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { IconWithSpinner } from '../../../../components/IconWithSpinner/IconWithSpinner.js';
|
|
3
|
+
import { WidgetPortal } from '../../components/WidgetPortal/WidgetPortal.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
6
6
|
import '@dynamic-labs/sdk-api';
|
|
@@ -8,14 +8,15 @@ import '../../../../shared/logger.js';
|
|
|
8
8
|
import '@dynamic-labs/iconic';
|
|
9
9
|
import '@dynamic-labs/wallet-connector-core';
|
|
10
10
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
11
|
+
import '@dynamic-labs/utils';
|
|
11
12
|
import '../../../../utils/constants/colors.js';
|
|
12
13
|
import 'ethers';
|
|
13
14
|
import '../../../../shared/consts/index.js';
|
|
14
15
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
15
16
|
import '@dynamic-labs/multi-wallet';
|
|
16
|
-
import { pixelToRem } from '../../../../utils/functions/pixelToRem/pixelToRem.js';
|
|
17
17
|
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
18
18
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
19
|
+
import { classNames } from '../../../../utils/functions/classNames/classNames.js';
|
|
19
20
|
import 'react-dom';
|
|
20
21
|
import 'react-focus-lock';
|
|
21
22
|
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
@@ -27,19 +28,11 @@ import '../../../../context/ErrorContext/ErrorContext.js';
|
|
|
27
28
|
import '../../../../context/MockContext/MockContext.js';
|
|
28
29
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
29
30
|
import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
30
|
-
import { Button } from '../../../../components/Button/Button.js';
|
|
31
31
|
import '../../../../components/IconButton/IconButton.js';
|
|
32
32
|
import '../../../../components/Alert/Alert.js';
|
|
33
|
-
import { IconWithSpinner } from '../../../../components/IconWithSpinner/IconWithSpinner.js';
|
|
34
33
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
35
34
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
36
|
-
import { capitalize } from '../../helpers/helpers.js';
|
|
37
35
|
|
|
38
|
-
const
|
|
39
|
-
const { name = '' } = walletConnector || {};
|
|
40
|
-
const iconSize = 80;
|
|
41
|
-
const icon = (jsx(WalletIcon, { walletName: name, style: { height: pixelToRem(iconSize), width: pixelToRem(iconSize) } }));
|
|
42
|
-
return (jsxs("div", Object.assign({ className: 'default-pending-sign-modal-content__container' }, { children: [jsx(IconWithSpinner, { iconSize: 80, Icon: icon, isSpinning: true }), name && (jsxs(Typography, Object.assign({ color: 'primary', className: 'default-pending-sign-modal-content__title', variant: 'body_normal', weight: 'medium' }, { children: ["Sign in with ", capitalize(name)] }))), jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_small', weight: 'medium' }, { children: "Sign the message in your wallet to approve linking this wallet to your account" })), isMobile() && !(walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.canConnectViaCustodialService) && (jsx(Button, Object.assign({ onClick: onClickToSign }, { children: "Click to Sign" })))] })));
|
|
43
|
-
};
|
|
36
|
+
const DefaultPromptModal = ({ children, className = '', dataTestId = '', icon, showCloseButton = false, title, }) => (jsx(WidgetPortal, Object.assign({ showCloseButton: showCloseButton }, { children: jsxs("div", Object.assign({ className: classNames('default-prompt-modal', className), "data-testid": dataTestId }, { children: [icon && jsx(IconWithSpinner, { Icon: icon, iconSize: 96, isSpinning: true }), jsxs("div", Object.assign({ className: 'default-prompt-modal__content' }, { children: [title && (jsx(Typography, Object.assign({ variant: 'title', color: 'primary', "data-testid": 'title' }, { children: title }))), children] }))] })) })));
|
|
44
37
|
|
|
45
|
-
export {
|
|
38
|
+
export { DefaultPromptModal };
|
|
@@ -51,7 +51,7 @@ const NoQrNotInstalledModalView = () => {
|
|
|
51
51
|
.filter(([, link]) => link !== '')
|
|
52
52
|
.filter(([name]) => name !== 'ios' && name !== 'android')
|
|
53
53
|
.map(([name, link]) => (jsxRuntime.jsx(WalletHelpLink.WalletHelpLink, { name: name, link: link, Icon: getBrowserIcon.getBrowserIcon(name) }, name))));
|
|
54
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: 'no-qr-code-not-installed-modal-view', "data-testid": 'no-qr-code-not-installed' }, { children: [jsxRuntime.jsx(walletBook.WalletIcon, { walletName: selectedWalletConnector.name, style: { height: pixelToRem.pixelToRem(64), width: pixelToRem.pixelToRem(64) } }), jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_normal' }, { children: ["We can\u2019t detect ", walletName, " extension"] })), Array.isArray(downloadLinks) && (jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'secondary' }, { children: "Select from your preferred options below:" }))), jsxRuntime.jsx("div", Object.assign({ className: 'no-qr-code-not-installed-modal-view__links-section' }, { children: downloadLinks })), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_mini', color: 'secondary' }, { children: "Refresh the page once installed" }))] })));
|
|
54
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: 'no-qr-code-not-installed-modal-view', "data-testid": 'no-qr-code-not-installed' }, { children: [jsxRuntime.jsx(walletBook.WalletIcon, { walletName: selectedWalletConnector.name, style: { height: pixelToRem.pixelToRem(64), width: pixelToRem.pixelToRem(64) } }), jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'primary' }, { children: ["We can\u2019t detect ", walletName, " extension"] })), Array.isArray(downloadLinks) && (jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'secondary' }, { children: "Select from your preferred options below:" }))), jsxRuntime.jsx("div", Object.assign({ className: 'no-qr-code-not-installed-modal-view__links-section' }, { children: downloadLinks })), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_mini', color: 'secondary' }, { children: "Refresh the page once installed" }))] })));
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
exports.NoQrNotInstalledModalView = NoQrNotInstalledModalView;
|
package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js
CHANGED
|
@@ -47,7 +47,7 @@ const NoQrNotInstalledModalView = () => {
|
|
|
47
47
|
.filter(([, link]) => link !== '')
|
|
48
48
|
.filter(([name]) => name !== 'ios' && name !== 'android')
|
|
49
49
|
.map(([name, link]) => (jsx(WalletHelpLink, { name: name, link: link, Icon: getBrowserIcon(name) }, name))));
|
|
50
|
-
return (jsxs("div", Object.assign({ className: 'no-qr-code-not-installed-modal-view', "data-testid": 'no-qr-code-not-installed' }, { children: [jsx(WalletIcon, { walletName: selectedWalletConnector.name, style: { height: pixelToRem(64), width: pixelToRem(64) } }), jsxs(Typography, Object.assign({ variant: 'body_normal' }, { children: ["We can\u2019t detect ", walletName, " extension"] })), Array.isArray(downloadLinks) && (jsx(Typography, Object.assign({ variant: 'body_normal', color: 'secondary' }, { children: "Select from your preferred options below:" }))), jsx("div", Object.assign({ className: 'no-qr-code-not-installed-modal-view__links-section' }, { children: downloadLinks })), jsx(Typography, Object.assign({ variant: 'body_mini', color: 'secondary' }, { children: "Refresh the page once installed" }))] })));
|
|
50
|
+
return (jsxs("div", Object.assign({ className: 'no-qr-code-not-installed-modal-view', "data-testid": 'no-qr-code-not-installed' }, { children: [jsx(WalletIcon, { walletName: selectedWalletConnector.name, style: { height: pixelToRem(64), width: pixelToRem(64) } }), jsxs(Typography, Object.assign({ variant: 'body_normal', color: 'primary' }, { children: ["We can\u2019t detect ", walletName, " extension"] })), Array.isArray(downloadLinks) && (jsx(Typography, Object.assign({ variant: 'body_normal', color: 'secondary' }, { children: "Select from your preferred options below:" }))), jsx("div", Object.assign({ className: 'no-qr-code-not-installed-modal-view__links-section' }, { children: downloadLinks })), jsx(Typography, Object.assign({ variant: 'body_mini', color: 'secondary' }, { children: "Refresh the page once installed" }))] })));
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
export { NoQrNotInstalledModalView };
|
|
@@ -6,56 +6,31 @@ var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
9
|
-
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
10
|
-
require('@dynamic-labs/sdk-api');
|
|
11
|
-
require('../../../../shared/logger.cjs');
|
|
12
|
-
require('@dynamic-labs/iconic');
|
|
13
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
-
require('@dynamic-labs/utils');
|
|
16
|
-
require('../../../../utils/constants/colors.cjs');
|
|
17
|
-
require('ethers');
|
|
18
|
-
require('../../../../shared/consts/index.cjs');
|
|
19
9
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
20
|
-
require('
|
|
21
|
-
var
|
|
22
|
-
require('
|
|
23
|
-
require('
|
|
24
|
-
require('react-dom');
|
|
25
|
-
require('react-focus-lock');
|
|
26
|
-
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
27
|
-
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
28
|
-
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
29
|
-
require('../../../../config/ApiEndpoint.cjs');
|
|
30
|
-
require('@dynamic-labs/rpc-providers');
|
|
31
|
-
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
32
|
-
require('../../../../context/MockContext/MockContext.cjs');
|
|
33
|
-
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
34
|
-
require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
35
|
-
require('../../../../components/IconButton/IconButton.cjs');
|
|
36
|
-
require('../../../../components/Alert/Alert.cjs');
|
|
37
|
-
var IconWithSpinner = require('../../../../components/IconWithSpinner/IconWithSpinner.cjs');
|
|
38
|
-
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
39
|
-
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
40
|
-
var WidgetPortal = require('../../components/WidgetPortal/WidgetPortal.cjs');
|
|
10
|
+
var useConnectedAccountWallet = require('../../../../utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.cjs');
|
|
11
|
+
var DefaultPromptModal = require('../DefaultPromptModal/DefaultPromptModal.cjs');
|
|
12
|
+
var SwitchAccountView = require('./SwitchAccountView/SwitchAccountView.cjs');
|
|
13
|
+
var SwitchOrUseActiveAccountView = require('./SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs');
|
|
41
14
|
|
|
42
15
|
const PendingAccountSwitchModal = () => {
|
|
43
|
-
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const { selectedWalletWithAction, primaryWallet, secondaryWallets } = useInternalDynamicContext.useInternalDynamicContext();
|
|
18
|
+
const selectedConnector = (_a = selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet) === null || _a === void 0 ? void 0 : _a.connector;
|
|
19
|
+
const isSameWallet = (selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.name) === (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.name);
|
|
20
|
+
const connectedWallet = useConnectedAccountWallet.useConnectedAccountWallet((_b = selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet) === null || _b === void 0 ? void 0 : _b.connector, secondaryWallets);
|
|
44
21
|
React.useEffect(() => {
|
|
22
|
+
//flow client library only supports one connected wallet at any given time.
|
|
45
23
|
const disconnectAndConnect = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
var _a;
|
|
47
|
-
if ((
|
|
24
|
+
var _a, _b;
|
|
25
|
+
if ((selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.connectedChain) !== 'FLOW') {
|
|
48
26
|
return;
|
|
49
|
-
|
|
50
|
-
(_a =
|
|
27
|
+
}
|
|
28
|
+
yield ((_a = selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.endSession) === null || _a === void 0 ? void 0 : _a.call(selectedConnector));
|
|
29
|
+
(_b = selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.connect) === null || _b === void 0 ? void 0 : _b.call(selectedConnector);
|
|
51
30
|
});
|
|
52
31
|
disconnectAndConnect();
|
|
53
|
-
}, [
|
|
54
|
-
|
|
55
|
-
height: pixelToRem.pixelToRem(96 * IconWithSpinner.iconRatio),
|
|
56
|
-
width: pixelToRem.pixelToRem(96 * IconWithSpinner.iconRatio),
|
|
57
|
-
} }));
|
|
58
|
-
return (jsxRuntime.jsxs(WidgetPortal.WidgetPortal, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'pending-account-switch-modal__prompt' }, { children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { isSpinning: true, iconSize: 96, Icon: icon }) })), jsxRuntime.jsxs("div", Object.assign({ className: 'pending-account-switch-modal__content' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ className: 'pending-account-switch-modal__title', color: 'primary', variant: 'body_normal', as: 'h6' }, { children: "Switch Connected Account" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_small', as: 'p', color: 'secondary', weight: 'regular', className: 'pending-account-switch-modal__text' }, { children: "To switch accounts within the same wallet, we need you to first switch the connected account in your wallet." }))] }))] }));
|
|
32
|
+
}, [selectedConnector]);
|
|
33
|
+
return (jsxRuntime.jsx(DefaultPromptModal.DefaultPromptModal, Object.assign({ showCloseButton: true, dataTestId: 'pending-account-switch', icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletName: selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.name }), title: `Switch wallet in ${selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet.connector.name}` }, { children: isSameWallet || !connectedWallet ? (jsxRuntime.jsx(SwitchAccountView.SwitchAccountView, { selectedWalletToSwitchTo: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet })) : (jsxRuntime.jsx(SwitchOrUseActiveAccountView.SwitchOrUseActiveAccountView, { connectedWallet: connectedWallet, selectedWalletToSwitchTo: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet })) })));
|
|
59
34
|
};
|
|
60
35
|
|
|
61
36
|
exports.PendingAccountSwitchModal = PendingAccountSwitchModal;
|
package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js
CHANGED
|
@@ -1,57 +1,32 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
-
import { jsx
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
5
|
-
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
6
|
-
import '@dynamic-labs/sdk-api';
|
|
7
|
-
import '../../../../shared/logger.js';
|
|
8
|
-
import '@dynamic-labs/iconic';
|
|
9
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
11
|
-
import '@dynamic-labs/utils';
|
|
12
|
-
import '../../../../utils/constants/colors.js';
|
|
13
|
-
import 'ethers';
|
|
14
|
-
import '../../../../shared/consts/index.js';
|
|
15
5
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
16
|
-
import '
|
|
17
|
-
import {
|
|
18
|
-
import '
|
|
19
|
-
import '
|
|
20
|
-
import 'react-dom';
|
|
21
|
-
import 'react-focus-lock';
|
|
22
|
-
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
23
|
-
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
24
|
-
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
25
|
-
import '../../../../config/ApiEndpoint.js';
|
|
26
|
-
import '@dynamic-labs/rpc-providers';
|
|
27
|
-
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
28
|
-
import '../../../../context/MockContext/MockContext.js';
|
|
29
|
-
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
30
|
-
import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
31
|
-
import '../../../../components/IconButton/IconButton.js';
|
|
32
|
-
import '../../../../components/Alert/Alert.js';
|
|
33
|
-
import { iconRatio, IconWithSpinner } from '../../../../components/IconWithSpinner/IconWithSpinner.js';
|
|
34
|
-
import '../../../../components/Popper/Popper/Popper.js';
|
|
35
|
-
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
36
|
-
import { WidgetPortal } from '../../components/WidgetPortal/WidgetPortal.js';
|
|
6
|
+
import { useConnectedAccountWallet } from '../../../../utils/hooks/useConnectedAccountWallet/useConnectedAccountWallet.js';
|
|
7
|
+
import { DefaultPromptModal } from '../DefaultPromptModal/DefaultPromptModal.js';
|
|
8
|
+
import { SwitchAccountView } from './SwitchAccountView/SwitchAccountView.js';
|
|
9
|
+
import { SwitchOrUseActiveAccountView } from './SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js';
|
|
37
10
|
|
|
38
11
|
const PendingAccountSwitchModal = () => {
|
|
39
|
-
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const { selectedWalletWithAction, primaryWallet, secondaryWallets } = useInternalDynamicContext();
|
|
14
|
+
const selectedConnector = (_a = selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet) === null || _a === void 0 ? void 0 : _a.connector;
|
|
15
|
+
const isSameWallet = (selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.name) === (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.name);
|
|
16
|
+
const connectedWallet = useConnectedAccountWallet((_b = selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet) === null || _b === void 0 ? void 0 : _b.connector, secondaryWallets);
|
|
40
17
|
useEffect(() => {
|
|
18
|
+
//flow client library only supports one connected wallet at any given time.
|
|
41
19
|
const disconnectAndConnect = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
-
var _a;
|
|
43
|
-
if ((
|
|
20
|
+
var _a, _b;
|
|
21
|
+
if ((selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.connectedChain) !== 'FLOW') {
|
|
44
22
|
return;
|
|
45
|
-
|
|
46
|
-
(_a =
|
|
23
|
+
}
|
|
24
|
+
yield ((_a = selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.endSession) === null || _a === void 0 ? void 0 : _a.call(selectedConnector));
|
|
25
|
+
(_b = selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.connect) === null || _b === void 0 ? void 0 : _b.call(selectedConnector);
|
|
47
26
|
});
|
|
48
27
|
disconnectAndConnect();
|
|
49
|
-
}, [
|
|
50
|
-
|
|
51
|
-
height: pixelToRem(96 * iconRatio),
|
|
52
|
-
width: pixelToRem(96 * iconRatio),
|
|
53
|
-
} }));
|
|
54
|
-
return (jsxs(WidgetPortal, { children: [jsx("div", Object.assign({ className: 'pending-account-switch-modal__prompt' }, { children: jsx(IconWithSpinner, { isSpinning: true, iconSize: 96, Icon: icon }) })), jsxs("div", Object.assign({ className: 'pending-account-switch-modal__content' }, { children: [jsx(Typography, Object.assign({ className: 'pending-account-switch-modal__title', color: 'primary', variant: 'body_normal', as: 'h6' }, { children: "Switch Connected Account" })), jsx(Typography, Object.assign({ variant: 'body_small', as: 'p', color: 'secondary', weight: 'regular', className: 'pending-account-switch-modal__text' }, { children: "To switch accounts within the same wallet, we need you to first switch the connected account in your wallet." }))] }))] }));
|
|
28
|
+
}, [selectedConnector]);
|
|
29
|
+
return (jsx(DefaultPromptModal, Object.assign({ showCloseButton: true, dataTestId: 'pending-account-switch', icon: jsx(WalletIcon, { walletName: selectedConnector === null || selectedConnector === void 0 ? void 0 : selectedConnector.name }), title: `Switch wallet in ${selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet.connector.name}` }, { children: isSameWallet || !connectedWallet ? (jsx(SwitchAccountView, { selectedWalletToSwitchTo: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet })) : (jsx(SwitchOrUseActiveAccountView, { connectedWallet: connectedWallet, selectedWalletToSwitchTo: selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet })) })));
|
|
55
30
|
};
|
|
56
31
|
|
|
57
32
|
export { PendingAccountSwitchModal };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
require('react');
|
|
7
|
+
var Typography = require('../../../../../components/Typography/Typography.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('../../../../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
var shortenWalletAddress = require('../../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
14
|
+
require('@dynamic-labs/utils');
|
|
15
|
+
require('../../../../../utils/constants/colors.cjs');
|
|
16
|
+
require('ethers');
|
|
17
|
+
require('../../../../../shared/consts/index.cjs');
|
|
18
|
+
require('../../../../../context/DynamicContext/DynamicContext.cjs');
|
|
19
|
+
require('@dynamic-labs/multi-wallet');
|
|
20
|
+
require('../../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
21
|
+
require('../../../../../context/ThemeContext/ThemeContext.cjs');
|
|
22
|
+
require('react-dom');
|
|
23
|
+
require('react-focus-lock');
|
|
24
|
+
require('../../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
25
|
+
require('../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
26
|
+
require('../../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
27
|
+
require('../../../../../config/ApiEndpoint.cjs');
|
|
28
|
+
require('@dynamic-labs/rpc-providers');
|
|
29
|
+
require('../../../../../context/ErrorContext/ErrorContext.cjs');
|
|
30
|
+
require('../../../../../context/MockContext/MockContext.cjs');
|
|
31
|
+
require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
32
|
+
require('../../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
33
|
+
require('../../../../../components/IconButton/IconButton.cjs');
|
|
34
|
+
require('../../../../../components/Alert/Alert.cjs');
|
|
35
|
+
require('../../../../../components/Popper/Popper/Popper.cjs');
|
|
36
|
+
require('../../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
37
|
+
|
|
38
|
+
const SwitchAccountView = ({ selectedWalletToSwitchTo }) => (jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content' }, { children: ["Switch to wallet", ' ', jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'span', weight: 'medium', color: 'primary' }, { children: shortenWalletAddress.shortenWalletAddress(selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.address, 3, 3) })), ' ', "in ", selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.name, " to make it active."] })));
|
|
39
|
+
|
|
40
|
+
exports.SwitchAccountView = SwitchAccountView;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { Typography } from '../../../../../components/Typography/Typography.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 '../../../../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import { shortenWalletAddress } from '../../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
10
|
+
import '@dynamic-labs/utils';
|
|
11
|
+
import '../../../../../utils/constants/colors.js';
|
|
12
|
+
import 'ethers';
|
|
13
|
+
import '../../../../../shared/consts/index.js';
|
|
14
|
+
import '../../../../../context/DynamicContext/DynamicContext.js';
|
|
15
|
+
import '@dynamic-labs/multi-wallet';
|
|
16
|
+
import '../../../../../components/ShadowDOM/ShadowDOM.js';
|
|
17
|
+
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
18
|
+
import 'react-dom';
|
|
19
|
+
import 'react-focus-lock';
|
|
20
|
+
import '../../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
21
|
+
import '../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
22
|
+
import '../../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
23
|
+
import '../../../../../config/ApiEndpoint.js';
|
|
24
|
+
import '@dynamic-labs/rpc-providers';
|
|
25
|
+
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
26
|
+
import '../../../../../context/MockContext/MockContext.js';
|
|
27
|
+
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
28
|
+
import '../../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
29
|
+
import '../../../../../components/IconButton/IconButton.js';
|
|
30
|
+
import '../../../../../components/Alert/Alert.js';
|
|
31
|
+
import '../../../../../components/Popper/Popper/Popper.js';
|
|
32
|
+
import '../../../../../components/Popper/PopperContext/PopperContext.js';
|
|
33
|
+
|
|
34
|
+
const SwitchAccountView = ({ selectedWalletToSwitchTo }) => (jsxs(Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content' }, { children: ["Switch to wallet", ' ', jsx(Typography, Object.assign({ as: 'span', weight: 'medium', color: 'primary' }, { children: shortenWalletAddress(selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.address, 3, 3) })), ' ', "in ", selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.name, " to make it active."] })));
|
|
35
|
+
|
|
36
|
+
export { SwitchAccountView };
|
package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SwitchAccountView';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
9
|
+
var Typography = require('../../../../../components/Typography/Typography.cjs');
|
|
10
|
+
require('@dynamic-labs/sdk-api');
|
|
11
|
+
require('../../../../../shared/logger.cjs');
|
|
12
|
+
require('@dynamic-labs/iconic');
|
|
13
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
14
|
+
require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
+
var shortenWalletAddress = require('../../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
17
|
+
require('../../../../../utils/constants/colors.cjs');
|
|
18
|
+
require('ethers');
|
|
19
|
+
require('../../../../../shared/consts/index.cjs');
|
|
20
|
+
var useInternalDynamicContext = require('../../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
21
|
+
require('@dynamic-labs/multi-wallet');
|
|
22
|
+
require('../../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
23
|
+
require('../../../../../context/ThemeContext/ThemeContext.cjs');
|
|
24
|
+
var Icon = require('../../../../../components/Icon/Icon.cjs');
|
|
25
|
+
require('react-dom');
|
|
26
|
+
require('react-focus-lock');
|
|
27
|
+
require('../../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
28
|
+
require('../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
29
|
+
require('../../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
30
|
+
require('../../../../../config/ApiEndpoint.cjs');
|
|
31
|
+
require('@dynamic-labs/rpc-providers');
|
|
32
|
+
require('../../../../../context/ErrorContext/ErrorContext.cjs');
|
|
33
|
+
require('../../../../../context/MockContext/MockContext.cjs');
|
|
34
|
+
require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
35
|
+
require('../../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
36
|
+
var Button = require('../../../../../components/Button/Button.cjs');
|
|
37
|
+
require('../../../../../components/IconButton/IconButton.cjs');
|
|
38
|
+
require('../../../../../components/Alert/Alert.cjs');
|
|
39
|
+
require('../../../../../components/Popper/Popper/Popper.cjs');
|
|
40
|
+
require('../../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
41
|
+
var Divider = require('../../../../../components/Divider/Divider.cjs');
|
|
42
|
+
|
|
43
|
+
const SwitchOrUseActiveAccountView = ({ connectedWallet, selectedWalletToSwitchTo, }) => {
|
|
44
|
+
const { setSelectedWalletWithAction, setSelectedWalletConnector, computeConnectedStateForWallets, setPrimaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
45
|
+
const onUseActiveWalletClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
if (!connectedWallet) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (connectedWallet.connector.connectedChain === 'FLOW') {
|
|
51
|
+
(_b = (_a = connectedWallet.connector).endSession) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
52
|
+
}
|
|
53
|
+
setSelectedWalletWithAction({ action: 'select', wallet: connectedWallet });
|
|
54
|
+
setPrimaryWallet(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.id);
|
|
55
|
+
computeConnectedStateForWallets();
|
|
56
|
+
setSelectedWalletConnector(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector);
|
|
57
|
+
}), [
|
|
58
|
+
connectedWallet,
|
|
59
|
+
setSelectedWalletWithAction,
|
|
60
|
+
setPrimaryWallet,
|
|
61
|
+
computeConnectedStateForWallets,
|
|
62
|
+
setSelectedWalletConnector,
|
|
63
|
+
]);
|
|
64
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content' }, { children: ["Wallet", ' ', jsxRuntime.jsx(Typography.Typography, Object.assign({ 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, Object.assign({ variant: 'body_normal', color: 'primary' }, { children: "Use your active wallet" })), jsxRuntime.jsxs(Button.Button, Object.assign({ buttonClassName: 'default-prompt-modal__button', buttonRounded: 'small', expanded: true, type: 'button', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, onClick: onUseActiveWalletClick, dataTestId: 'use-active-wallet-button' }, { children: ["Select", ' ', jsxRuntime.jsx(Icon.Icon, Object.assign({ size: 'xsmall' }, { children: jsxRuntime.jsx(walletBook.WalletIcon, { walletName: selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.name }) })), ' ', shortenWalletAddress.shortenWalletAddress(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.address, 3, 3)] }))] }));
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
exports.SwitchOrUseActiveAccountView = SwitchOrUseActiveAccountView;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Wallet } from '../../../../../shared';
|
|
3
|
+
type Props = {
|
|
4
|
+
connectedWallet: Wallet;
|
|
5
|
+
selectedWalletToSwitchTo: Wallet | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const SwitchOrUseActiveAccountView: ({ connectedWallet, selectedWalletToSwitchTo, }: Props) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
5
|
+
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
6
|
+
import '@dynamic-labs/sdk-api';
|
|
7
|
+
import '../../../../../shared/logger.js';
|
|
8
|
+
import '@dynamic-labs/iconic';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
10
|
+
import '../../../../../context/ViewContext/ViewContext.js';
|
|
11
|
+
import { shortenWalletAddress } from '../../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
13
|
+
import '../../../../../utils/constants/colors.js';
|
|
14
|
+
import 'ethers';
|
|
15
|
+
import '../../../../../shared/consts/index.js';
|
|
16
|
+
import { useInternalDynamicContext } from '../../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
17
|
+
import '@dynamic-labs/multi-wallet';
|
|
18
|
+
import '../../../../../components/ShadowDOM/ShadowDOM.js';
|
|
19
|
+
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
20
|
+
import { Icon } from '../../../../../components/Icon/Icon.js';
|
|
21
|
+
import 'react-dom';
|
|
22
|
+
import 'react-focus-lock';
|
|
23
|
+
import '../../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
24
|
+
import '../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
25
|
+
import '../../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
26
|
+
import '../../../../../config/ApiEndpoint.js';
|
|
27
|
+
import '@dynamic-labs/rpc-providers';
|
|
28
|
+
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
29
|
+
import '../../../../../context/MockContext/MockContext.js';
|
|
30
|
+
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
31
|
+
import '../../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
32
|
+
import { Button } from '../../../../../components/Button/Button.js';
|
|
33
|
+
import '../../../../../components/IconButton/IconButton.js';
|
|
34
|
+
import '../../../../../components/Alert/Alert.js';
|
|
35
|
+
import '../../../../../components/Popper/Popper/Popper.js';
|
|
36
|
+
import '../../../../../components/Popper/PopperContext/PopperContext.js';
|
|
37
|
+
import { Divider } from '../../../../../components/Divider/Divider.js';
|
|
38
|
+
|
|
39
|
+
const SwitchOrUseActiveAccountView = ({ connectedWallet, selectedWalletToSwitchTo, }) => {
|
|
40
|
+
const { setSelectedWalletWithAction, setSelectedWalletConnector, computeConnectedStateForWallets, setPrimaryWallet, } = useInternalDynamicContext();
|
|
41
|
+
const onUseActiveWalletClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
if (!connectedWallet) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (connectedWallet.connector.connectedChain === 'FLOW') {
|
|
47
|
+
(_b = (_a = connectedWallet.connector).endSession) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
48
|
+
}
|
|
49
|
+
setSelectedWalletWithAction({ action: 'select', wallet: connectedWallet });
|
|
50
|
+
setPrimaryWallet(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.id);
|
|
51
|
+
computeConnectedStateForWallets();
|
|
52
|
+
setSelectedWalletConnector(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.connector);
|
|
53
|
+
}), [
|
|
54
|
+
connectedWallet,
|
|
55
|
+
setSelectedWalletWithAction,
|
|
56
|
+
setPrimaryWallet,
|
|
57
|
+
computeConnectedStateForWallets,
|
|
58
|
+
setSelectedWalletConnector,
|
|
59
|
+
]);
|
|
60
|
+
return (jsxs(Fragment, { children: [jsxs(Typography, Object.assign({ variant: 'body_normal', color: 'secondary', weight: 'regular', "data-testid": 'content' }, { children: ["Wallet", ' ', jsx(Typography, Object.assign({ 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, Object.assign({ variant: 'body_normal', color: 'primary' }, { children: "Use your active wallet" })), jsxs(Button, Object.assign({ buttonClassName: 'default-prompt-modal__button', buttonRounded: 'small', expanded: true, type: 'button', buttonPadding: 'medium', typographyProps: { variant: 'button_secondary' }, onClick: onUseActiveWalletClick, dataTestId: 'use-active-wallet-button' }, { children: ["Select", ' ', jsx(Icon, Object.assign({ size: 'xsmall' }, { children: jsx(WalletIcon, { walletName: selectedWalletToSwitchTo === null || selectedWalletToSwitchTo === void 0 ? void 0 : selectedWalletToSwitchTo.connector.name }) })), ' ', shortenWalletAddress(connectedWallet === null || connectedWallet === void 0 ? void 0 : connectedWallet.address, 3, 3)] }))] }));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { SwitchOrUseActiveAccountView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SwitchOrUseActiveAccountView';
|