@bosonprotocol/react-kit 0.34.0-alpha.2 → 0.34.0-alpha.20
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/dist/cjs/components/connection/utils.d.ts.map +1 -1
- package/dist/cjs/components/connection/utils.js +0 -1
- package/dist/cjs/components/connection/utils.js.map +1 -1
- package/dist/cjs/components/currencyDisplay/CurrencyDisplay.d.ts +5 -2
- package/dist/cjs/components/currencyDisplay/CurrencyDisplay.d.ts.map +1 -1
- package/dist/cjs/components/currencyDisplay/CurrencyDisplay.js +6 -7
- package/dist/cjs/components/currencyDisplay/CurrencyDisplay.js.map +1 -1
- package/dist/cjs/components/exchangeCard/ExchangeCard.d.ts +1 -1
- package/dist/cjs/components/image/Image.styles.d.ts.map +1 -1
- package/dist/cjs/components/image/Image.styles.js +0 -2
- package/dist/cjs/components/image/Image.styles.js.map +1 -1
- package/dist/cjs/components/modal/components/Redeem/MyItems/Exchange.js +1 -1
- package/dist/cjs/components/modal/components/Redeem/MyItems/Exchange.js.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.d.ts +5 -2
- package/dist/cjs/components/productCard/ProductCard.d.ts.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.js +42 -34
- package/dist/cjs/components/productCard/ProductCard.js.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.styles.d.ts +111 -4
- package/dist/cjs/components/productCard/ProductCard.styles.d.ts.map +1 -1
- package/dist/cjs/components/productCard/ProductCard.styles.js +51 -26
- package/dist/cjs/components/productCard/ProductCard.styles.js.map +1 -1
- package/dist/cjs/components/productCard/commonStyles.d.ts.map +1 -1
- package/dist/cjs/components/productCard/commonStyles.js +0 -1
- package/dist/cjs/components/productCard/commonStyles.js.map +1 -1
- package/dist/cjs/components/queryClient/withQueryClientProvider.d.ts +0 -4
- package/dist/cjs/components/queryClient/withQueryClientProvider.d.ts.map +1 -1
- package/dist/cjs/components/queryClient/withQueryClientProvider.js +3 -26
- package/dist/cjs/components/queryClient/withQueryClientProvider.js.map +1 -1
- package/dist/cjs/components/skeleton/CollectionsCardSkeleton.d.ts.map +1 -1
- package/dist/cjs/components/skeleton/CollectionsCardSkeleton.js +39 -17
- package/dist/cjs/components/skeleton/CollectionsCardSkeleton.js.map +1 -1
- package/dist/cjs/components/skeleton/ProductCardSkeleton.d.ts.map +1 -1
- package/dist/cjs/components/skeleton/ProductCardSkeleton.js +18 -19
- package/dist/cjs/components/skeleton/ProductCardSkeleton.js.map +1 -1
- package/dist/cjs/components/wallet/wallet-connection.d.ts +9559 -9559
- package/dist/cjs/components/wallet2/accountDrawer/AuthenticatedHeader.d.ts +3 -3
- package/dist/cjs/components/wallet2/accountDrawer/AuthenticatedHeader.d.ts.map +1 -1
- package/dist/cjs/components/wallet2/accountDrawer/AuthenticatedHeader.js +2 -2
- package/dist/cjs/components/wallet2/accountDrawer/AuthenticatedHeader.js.map +1 -1
- package/dist/cjs/components/wallet2/accountDrawer/miniPortfolio/index.d.ts +3 -3
- package/dist/cjs/components/wallet2/accountDrawer/miniPortfolio/index.d.ts.map +1 -1
- package/dist/cjs/components/wallet2/accountDrawer/miniPortfolio/index.js +2 -2
- package/dist/cjs/components/wallet2/accountDrawer/miniPortfolio/index.js.map +1 -1
- package/dist/cjs/components/wallet2/accountDrawer/miniPortfolio/tokens/index.d.ts +5 -2
- package/dist/cjs/components/wallet2/accountDrawer/miniPortfolio/tokens/index.d.ts.map +1 -1
- package/dist/cjs/components/wallet2/accountDrawer/miniPortfolio/tokens/index.js +3 -2
- package/dist/cjs/components/wallet2/accountDrawer/miniPortfolio/tokens/index.js.map +1 -1
- package/dist/cjs/components/wallet2/selector/ChainSelector.d.ts +4 -1
- package/dist/cjs/components/wallet2/selector/ChainSelector.d.ts.map +1 -1
- package/dist/cjs/components/wallet2/selector/ChainSelector.js +2 -4
- package/dist/cjs/components/wallet2/selector/ChainSelector.js.map +1 -1
- package/dist/cjs/components/wallet2/walletModal/ConnectionErrorView.d.ts +6 -1
- package/dist/cjs/components/wallet2/walletModal/ConnectionErrorView.d.ts.map +1 -1
- package/dist/cjs/components/wallet2/walletModal/ConnectionErrorView.js +7 -5
- package/dist/cjs/components/wallet2/walletModal/ConnectionErrorView.js.map +1 -1
- package/dist/cjs/components/wallet2/walletModal/Option.d.ts +5 -1
- package/dist/cjs/components/wallet2/walletModal/Option.d.ts.map +1 -1
- package/dist/cjs/components/wallet2/walletModal/Option.js +5 -2
- package/dist/cjs/components/wallet2/walletModal/Option.js.map +1 -1
- package/dist/cjs/components/wallet2/walletModal/index.d.ts +5 -2
- package/dist/cjs/components/wallet2/walletModal/index.d.ts.map +1 -1
- package/dist/cjs/components/wallet2/walletModal/index.js +3 -3
- package/dist/cjs/components/wallet2/walletModal/index.js.map +1 -1
- package/dist/cjs/components/wallet2/web3Status/index.d.ts +14 -2
- package/dist/cjs/components/wallet2/web3Status/index.d.ts.map +1 -1
- package/dist/cjs/components/wallet2/web3Status/index.js +13 -5
- package/dist/cjs/components/wallet2/web3Status/index.js.map +1 -1
- package/dist/cjs/hooks/connection/useSyncChainQuery.js.map +1 -1
- package/dist/cjs/hooks/index.d.ts +5 -0
- package/dist/cjs/hooks/index.d.ts.map +1 -1
- package/dist/cjs/hooks/index.js +11 -1
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/useCtaClickHandler.d.ts +1 -1
- package/dist/cjs/hooks/useCtaClickHandler.d.ts.map +1 -1
- package/dist/cjs/hooks/useCtaClickHandler.js.map +1 -1
- package/dist/cjs/hooks/useMetaTx.d.ts +1 -1
- package/dist/cjs/hooks/useMetaTx.d.ts.map +1 -1
- package/dist/cjs/hooks/useMetaTx.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/signer/externalSigner.d.ts.map +1 -1
- package/dist/cjs/lib/signer/externalSigner.js +7 -0
- package/dist/cjs/lib/signer/externalSigner.js.map +1 -1
- package/dist/esm/components/connection/utils.d.ts.map +1 -1
- package/dist/esm/components/connection/utils.js +0 -1
- package/dist/esm/components/connection/utils.js.map +1 -1
- package/dist/esm/components/currencyDisplay/CurrencyDisplay.d.ts +5 -2
- package/dist/esm/components/currencyDisplay/CurrencyDisplay.d.ts.map +1 -1
- package/dist/esm/components/currencyDisplay/CurrencyDisplay.js +6 -7
- package/dist/esm/components/currencyDisplay/CurrencyDisplay.js.map +1 -1
- package/dist/esm/components/exchangeCard/ExchangeCard.d.ts +1 -1
- package/dist/esm/components/image/Image.styles.d.ts.map +1 -1
- package/dist/esm/components/image/Image.styles.js +0 -2
- package/dist/esm/components/image/Image.styles.js.map +1 -1
- package/dist/esm/components/modal/components/Redeem/MyItems/Exchange.js +1 -1
- package/dist/esm/components/modal/components/Redeem/MyItems/Exchange.js.map +1 -1
- package/dist/esm/components/productCard/ProductCard.d.ts +5 -2
- package/dist/esm/components/productCard/ProductCard.d.ts.map +1 -1
- package/dist/esm/components/productCard/ProductCard.js +20 -32
- package/dist/esm/components/productCard/ProductCard.js.map +1 -1
- package/dist/esm/components/productCard/ProductCard.styles.d.ts +111 -4
- package/dist/esm/components/productCard/ProductCard.styles.d.ts.map +1 -1
- package/dist/esm/components/productCard/ProductCard.styles.js +50 -24
- package/dist/esm/components/productCard/ProductCard.styles.js.map +1 -1
- package/dist/esm/components/productCard/commonStyles.d.ts.map +1 -1
- package/dist/esm/components/productCard/commonStyles.js +0 -1
- package/dist/esm/components/productCard/commonStyles.js.map +1 -1
- package/dist/esm/components/queryClient/withQueryClientProvider.d.ts +0 -4
- package/dist/esm/components/queryClient/withQueryClientProvider.d.ts.map +1 -1
- package/dist/esm/components/queryClient/withQueryClientProvider.js +1 -11
- package/dist/esm/components/queryClient/withQueryClientProvider.js.map +1 -1
- package/dist/esm/components/skeleton/CollectionsCardSkeleton.d.ts.map +1 -1
- package/dist/esm/components/skeleton/CollectionsCardSkeleton.js +39 -17
- package/dist/esm/components/skeleton/CollectionsCardSkeleton.js.map +1 -1
- package/dist/esm/components/skeleton/ProductCardSkeleton.d.ts.map +1 -1
- package/dist/esm/components/skeleton/ProductCardSkeleton.js +19 -20
- package/dist/esm/components/skeleton/ProductCardSkeleton.js.map +1 -1
- package/dist/esm/components/wallet/wallet-connection.d.ts +9559 -9559
- package/dist/esm/components/wallet2/accountDrawer/AuthenticatedHeader.d.ts +3 -3
- package/dist/esm/components/wallet2/accountDrawer/AuthenticatedHeader.d.ts.map +1 -1
- package/dist/esm/components/wallet2/accountDrawer/AuthenticatedHeader.js +2 -2
- package/dist/esm/components/wallet2/accountDrawer/AuthenticatedHeader.js.map +1 -1
- package/dist/esm/components/wallet2/accountDrawer/miniPortfolio/index.d.ts +3 -3
- package/dist/esm/components/wallet2/accountDrawer/miniPortfolio/index.d.ts.map +1 -1
- package/dist/esm/components/wallet2/accountDrawer/miniPortfolio/index.js +2 -2
- package/dist/esm/components/wallet2/accountDrawer/miniPortfolio/index.js.map +1 -1
- package/dist/esm/components/wallet2/accountDrawer/miniPortfolio/tokens/index.d.ts +5 -2
- package/dist/esm/components/wallet2/accountDrawer/miniPortfolio/tokens/index.d.ts.map +1 -1
- package/dist/esm/components/wallet2/accountDrawer/miniPortfolio/tokens/index.js +3 -2
- package/dist/esm/components/wallet2/accountDrawer/miniPortfolio/tokens/index.js.map +1 -1
- package/dist/esm/components/wallet2/selector/ChainSelector.d.ts +4 -1
- package/dist/esm/components/wallet2/selector/ChainSelector.d.ts.map +1 -1
- package/dist/esm/components/wallet2/selector/ChainSelector.js +3 -5
- package/dist/esm/components/wallet2/selector/ChainSelector.js.map +1 -1
- package/dist/esm/components/wallet2/walletModal/ConnectionErrorView.d.ts +6 -1
- package/dist/esm/components/wallet2/walletModal/ConnectionErrorView.d.ts.map +1 -1
- package/dist/esm/components/wallet2/walletModal/ConnectionErrorView.js +7 -5
- package/dist/esm/components/wallet2/walletModal/ConnectionErrorView.js.map +1 -1
- package/dist/esm/components/wallet2/walletModal/Option.d.ts +5 -1
- package/dist/esm/components/wallet2/walletModal/Option.d.ts.map +1 -1
- package/dist/esm/components/wallet2/walletModal/Option.js +5 -2
- package/dist/esm/components/wallet2/walletModal/Option.js.map +1 -1
- package/dist/esm/components/wallet2/walletModal/index.d.ts +5 -2
- package/dist/esm/components/wallet2/walletModal/index.d.ts.map +1 -1
- package/dist/esm/components/wallet2/walletModal/index.js +3 -3
- package/dist/esm/components/wallet2/walletModal/index.js.map +1 -1
- package/dist/esm/components/wallet2/web3Status/index.d.ts +14 -2
- package/dist/esm/components/wallet2/web3Status/index.d.ts.map +1 -1
- package/dist/esm/components/wallet2/web3Status/index.js +14 -6
- package/dist/esm/components/wallet2/web3Status/index.js.map +1 -1
- package/dist/esm/hooks/connection/useSyncChainQuery.js.map +1 -1
- package/dist/esm/hooks/index.d.ts +5 -0
- package/dist/esm/hooks/index.d.ts.map +1 -1
- package/dist/esm/hooks/index.js +5 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/useCtaClickHandler.d.ts +1 -1
- package/dist/esm/hooks/useCtaClickHandler.d.ts.map +1 -1
- package/dist/esm/hooks/useCtaClickHandler.js.map +1 -1
- package/dist/esm/hooks/useMetaTx.d.ts +1 -1
- package/dist/esm/hooks/useMetaTx.d.ts.map +1 -1
- package/dist/esm/hooks/useMetaTx.js.map +1 -1
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/signer/externalSigner.d.ts.map +1 -1
- package/dist/esm/lib/signer/externalSigner.js +7 -0
- package/dist/esm/lib/signer/externalSigner.js.map +1 -1
- package/package.json +5 -5
- package/src/components/connection/utils.ts +0 -1
- package/src/components/currencyDisplay/CurrencyDisplay.tsx +21 -18
- package/src/components/exchangeCard/ExchangeCard.tsx +1 -1
- package/src/components/image/Image.styles.ts +0 -2
- package/src/components/modal/components/Redeem/MyItems/Exchange.tsx +1 -1
- package/src/components/productCard/ProductCard.styles.ts +57 -26
- package/src/components/productCard/ProductCard.tsx +54 -56
- package/src/components/productCard/commonStyles.ts +0 -1
- package/src/components/queryClient/withQueryClientProvider.tsx +1 -26
- package/src/components/skeleton/CollectionsCardSkeleton.tsx +63 -39
- package/src/components/skeleton/ProductCardSkeleton.tsx +24 -37
- package/src/components/wallet2/accountDrawer/AuthenticatedHeader.tsx +5 -6
- package/src/components/wallet2/accountDrawer/miniPortfolio/index.tsx +8 -4
- package/src/components/wallet2/accountDrawer/miniPortfolio/tokens/index.tsx +8 -2
- package/src/components/wallet2/selector/ChainSelector.tsx +25 -13
- package/src/components/wallet2/walletModal/ConnectionErrorView.tsx +21 -6
- package/src/components/wallet2/walletModal/Option.tsx +9 -2
- package/src/components/wallet2/walletModal/index.tsx +11 -4
- package/src/components/wallet2/web3Status/index.tsx +43 -15
- package/src/hooks/connection/useSyncChainQuery.ts +1 -1
- package/src/hooks/index.ts +10 -0
- package/src/hooks/useCtaClickHandler.ts +4 -1
- package/src/hooks/useMetaTx.ts +3 -1
- package/src/index.tsx +4 -0
- package/src/lib/signer/externalSigner.ts +7 -0
- package/src/stories/ConnectWallet.stories.tsx +63 -6
- package/src/stories/ProductCard.stories.tsx +1 -7
- package/src/stories/buttons/Upload.stories.tsx +1 -3
|
@@ -5,12 +5,13 @@ import styled from "styled-components";
|
|
|
5
5
|
import { Typography } from "../../ui/Typography";
|
|
6
6
|
import { useCloseAccountDrawer } from "../accountDrawer";
|
|
7
7
|
import { flexColumnNoWrap } from "../styles";
|
|
8
|
-
import { Button } from "../../buttons/Button";
|
|
9
8
|
import {
|
|
10
9
|
ActivationStatus,
|
|
11
10
|
useActivationState
|
|
12
11
|
} from "../../connection/activate";
|
|
13
12
|
import { theme } from "../../../theme";
|
|
13
|
+
import { Grid } from "../../ui/Grid";
|
|
14
|
+
import { BaseButton, BaseButtonProps } from "../../buttons/BaseButton";
|
|
14
15
|
const colors = theme.colors.light;
|
|
15
16
|
const Wrapper = styled.div`
|
|
16
17
|
${flexColumnNoWrap};
|
|
@@ -27,8 +28,15 @@ const AlertTriangleIcon = styled(Warning)`
|
|
|
27
28
|
color: ${colors.red};
|
|
28
29
|
`;
|
|
29
30
|
|
|
31
|
+
export type ConnectionErrorViewProps = {
|
|
32
|
+
tryAgainTheme: BaseButtonProps["theme"];
|
|
33
|
+
backToWalletSelectionTheme: BaseButtonProps["theme"];
|
|
34
|
+
};
|
|
30
35
|
// TODO(cartcrom): move this to a top level modal, rather than inline in the drawer
|
|
31
|
-
export default function ConnectionErrorView(
|
|
36
|
+
export default function ConnectionErrorView({
|
|
37
|
+
tryAgainTheme,
|
|
38
|
+
backToWalletSelectionTheme
|
|
39
|
+
}: ConnectionErrorViewProps) {
|
|
32
40
|
const { activationState, tryActivation, cancelActivation } =
|
|
33
41
|
useActivationState();
|
|
34
42
|
const closeDrawer = useCloseAccountDrawer();
|
|
@@ -50,10 +58,17 @@ export default function ConnectionErrorView() {
|
|
|
50
58
|
The connection attempt failed. Please click try again and follow the
|
|
51
59
|
steps to connect in your wallet.
|
|
52
60
|
</Typography>
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
<Grid gap="1rem">
|
|
62
|
+
<BaseButton onClick={retry} theme={tryAgainTheme}>
|
|
63
|
+
Try Again
|
|
64
|
+
</BaseButton>
|
|
65
|
+
<BaseButton
|
|
66
|
+
onClick={cancelActivation}
|
|
67
|
+
theme={backToWalletSelectionTheme}
|
|
68
|
+
>
|
|
69
|
+
<Typography marginBottom={12}>Back to wallet selection</Typography>
|
|
70
|
+
</BaseButton>
|
|
71
|
+
</Grid>
|
|
57
72
|
</Wrapper>
|
|
58
73
|
);
|
|
59
74
|
}
|
|
@@ -110,6 +110,9 @@ export interface OptionProps {
|
|
|
110
110
|
hoverColor: CSSProperties["color"];
|
|
111
111
|
backgroundColor: CSSProperties["backgroundColor"];
|
|
112
112
|
borderRadius: CSSProperties["borderRadius"];
|
|
113
|
+
onOptionClick?: (arg0: {
|
|
114
|
+
activationState: ReturnType<typeof useActivationState>["activationState"];
|
|
115
|
+
}) => void;
|
|
113
116
|
}
|
|
114
117
|
export function Option({
|
|
115
118
|
connection,
|
|
@@ -117,7 +120,8 @@ export function Option({
|
|
|
117
120
|
hoverFocusBackgroundColor,
|
|
118
121
|
hoverColor,
|
|
119
122
|
backgroundColor,
|
|
120
|
-
borderRadius
|
|
123
|
+
borderRadius,
|
|
124
|
+
onOptionClick
|
|
121
125
|
}: OptionProps) {
|
|
122
126
|
const { activationState, tryActivation } = useActivationState();
|
|
123
127
|
const toggleAccountDrawer = useToggleAccountDrawer();
|
|
@@ -139,7 +143,10 @@ export function Option({
|
|
|
139
143
|
>
|
|
140
144
|
<OptionCardClickable
|
|
141
145
|
disabled={isSomeOptionPending}
|
|
142
|
-
onClick={
|
|
146
|
+
onClick={() => {
|
|
147
|
+
activate();
|
|
148
|
+
onOptionClick?.({ activationState });
|
|
149
|
+
}}
|
|
143
150
|
selected={isCurrentOptionPending}
|
|
144
151
|
data-testid={`wallet-option-${connection.type}`}
|
|
145
152
|
>
|
|
@@ -5,7 +5,9 @@ import styled, { CSSProperties } from "styled-components";
|
|
|
5
5
|
|
|
6
6
|
import { Grid } from "../../ui/Grid";
|
|
7
7
|
import { flexColumnNoWrap } from "../styles";
|
|
8
|
-
import ConnectionErrorView
|
|
8
|
+
import ConnectionErrorView, {
|
|
9
|
+
ConnectionErrorViewProps
|
|
10
|
+
} from "./ConnectionErrorView";
|
|
9
11
|
import { Option, OptionProps } from "./Option";
|
|
10
12
|
import {
|
|
11
13
|
ActivationStatus,
|
|
@@ -47,12 +49,17 @@ export type WalletModalProps = {
|
|
|
47
49
|
| "hoverColor"
|
|
48
50
|
| "backgroundColor"
|
|
49
51
|
| "borderRadius"
|
|
52
|
+
| "onOptionClick"
|
|
50
53
|
> & { iconBorderRadius: CSSProperties["borderRadius"] };
|
|
54
|
+
withMagicLogin?: boolean;
|
|
55
|
+
connectionErrorProps: ConnectionErrorViewProps;
|
|
51
56
|
};
|
|
52
57
|
export function WalletModal({
|
|
53
58
|
PrivacyPolicy,
|
|
54
59
|
magicLoginButtonProps,
|
|
55
|
-
optionProps
|
|
60
|
+
optionProps,
|
|
61
|
+
withMagicLogin = true,
|
|
62
|
+
connectionErrorProps
|
|
56
63
|
}: WalletModalProps) {
|
|
57
64
|
const chainId = useChainId();
|
|
58
65
|
const { config } = useConfigContext();
|
|
@@ -82,7 +89,7 @@ export function WalletModal({
|
|
|
82
89
|
Connect a wallet
|
|
83
90
|
</Grid>
|
|
84
91
|
{activationState.status === ActivationStatus.ERROR ? (
|
|
85
|
-
<ConnectionErrorView />
|
|
92
|
+
<ConnectionErrorView {...connectionErrorProps} />
|
|
86
93
|
) : (
|
|
87
94
|
<AutoColumn $gap="16px">
|
|
88
95
|
<OptionGrid
|
|
@@ -100,7 +107,7 @@ export function WalletModal({
|
|
|
100
107
|
/>
|
|
101
108
|
))}
|
|
102
109
|
</OptionGrid>
|
|
103
|
-
<MagicLoginButton {...magicLoginButtonProps} />
|
|
110
|
+
{withMagicLogin && <MagicLoginButton {...magicLoginButtonProps} />}
|
|
104
111
|
<PrivacyPolicy />
|
|
105
112
|
</AutoColumn>
|
|
106
113
|
)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useWeb3React } from "@web3-react/core";
|
|
2
|
-
import React, { memo, useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import React, { ReactNode, memo, useCallback, useEffect, useRef } from "react";
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
|
|
5
5
|
import { useIsMagicLoggedIn } from "../../../hooks";
|
|
@@ -64,7 +64,17 @@ const getCommonWalletButtonProps = (isXXS: boolean) =>
|
|
|
64
64
|
function Web3StatusInner({
|
|
65
65
|
showOnlyIcon,
|
|
66
66
|
errorButtonTheme,
|
|
67
|
-
|
|
67
|
+
connectedButtonTheme,
|
|
68
|
+
connectWalletButtonTheme,
|
|
69
|
+
connectWalletChild = <>Connect Wallet</>,
|
|
70
|
+
showStatusIcon = true,
|
|
71
|
+
wrongNetworkChild = <>Wrong network</>,
|
|
72
|
+
leftConnectWalletChild,
|
|
73
|
+
leftConnectedChild,
|
|
74
|
+
leftWrongNetworkChild,
|
|
75
|
+
rightConnectWalletChild,
|
|
76
|
+
rightConnectedChild,
|
|
77
|
+
rightWrongNetworkChild
|
|
68
78
|
}: ConnectWalletProps) {
|
|
69
79
|
const switchingChain = useAppSelector(
|
|
70
80
|
(state) => state.wallets.switchingChain
|
|
@@ -121,18 +131,21 @@ function Web3StatusInner({
|
|
|
121
131
|
disabled={Boolean(switchingChain)}
|
|
122
132
|
data-testid="web3-status-connected"
|
|
123
133
|
onClick={handleWalletDropdownClick}
|
|
124
|
-
theme={
|
|
134
|
+
theme={connectedButtonTheme}
|
|
125
135
|
>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
{showStatusIcon && (
|
|
137
|
+
<StatusIcon
|
|
138
|
+
account={account}
|
|
139
|
+
size={24}
|
|
140
|
+
connection={connection}
|
|
141
|
+
showMiniIcons={showOnlyIcon}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
{leftConnectedChild}
|
|
133
145
|
<AddressAndChevronContainer>
|
|
134
146
|
<Text>{ENSName || formatAddress(account)}</Text>
|
|
135
147
|
</AddressAndChevronContainer>
|
|
148
|
+
{rightConnectedChild}
|
|
136
149
|
</BaseButton>
|
|
137
150
|
);
|
|
138
151
|
}
|
|
@@ -163,7 +176,9 @@ function Web3StatusInner({
|
|
|
163
176
|
onClick={handleWalletDropdownClick}
|
|
164
177
|
theme={errorButtonTheme}
|
|
165
178
|
>
|
|
166
|
-
|
|
179
|
+
{leftWrongNetworkChild}
|
|
180
|
+
{wrongNetworkChild}
|
|
181
|
+
{rightWrongNetworkChild}
|
|
167
182
|
</BaseButton>
|
|
168
183
|
</Tooltip>
|
|
169
184
|
) : (
|
|
@@ -171,23 +186,36 @@ function Web3StatusInner({
|
|
|
171
186
|
onClick={handleWalletDropdownClick}
|
|
172
187
|
data-testid="navbar-connect-wallet"
|
|
173
188
|
{...getCommonWalletButtonProps(isXXS)}
|
|
174
|
-
theme={
|
|
189
|
+
theme={connectWalletButtonTheme}
|
|
175
190
|
style={{
|
|
176
191
|
...getCommonWalletButtonProps(isXXS).style
|
|
177
192
|
}}
|
|
178
193
|
>
|
|
179
|
-
|
|
194
|
+
{leftConnectWalletChild}
|
|
195
|
+
{connectWalletChild}
|
|
196
|
+
{rightConnectWalletChild}
|
|
180
197
|
</BaseButton>
|
|
181
198
|
)}
|
|
182
199
|
</Grid>
|
|
183
200
|
);
|
|
184
201
|
}
|
|
202
|
+
type SuccessButtonTheme = Omit<BaseButtonTheme, "color" | "background"> &
|
|
203
|
+
Required<Pick<BaseButtonTheme, "color" | "background">>;
|
|
185
204
|
|
|
186
205
|
export type ConnectWalletProps = {
|
|
187
206
|
showOnlyIcon?: boolean;
|
|
188
207
|
errorButtonTheme: BaseButtonTheme;
|
|
189
|
-
|
|
190
|
-
|
|
208
|
+
connectedButtonTheme: SuccessButtonTheme;
|
|
209
|
+
connectWalletButtonTheme: SuccessButtonTheme;
|
|
210
|
+
connectWalletChild?: ReactNode;
|
|
211
|
+
wrongNetworkChild?: ReactNode;
|
|
212
|
+
showStatusIcon?: boolean;
|
|
213
|
+
leftConnectedChild?: ReactNode;
|
|
214
|
+
rightConnectedChild?: ReactNode;
|
|
215
|
+
leftWrongNetworkChild?: ReactNode;
|
|
216
|
+
rightWrongNetworkChild?: ReactNode;
|
|
217
|
+
leftConnectWalletChild?: ReactNode;
|
|
218
|
+
rightConnectWalletChild?: ReactNode;
|
|
191
219
|
};
|
|
192
220
|
export const ConnectWallet = memo(function Web3Status(
|
|
193
221
|
props: ConnectWalletProps
|
|
@@ -35,7 +35,7 @@ export default function useSyncChainQuery() {
|
|
|
35
35
|
const parsedQs = useParsedQueryString();
|
|
36
36
|
const configIdRef = useRef(currentConfigId);
|
|
37
37
|
const accountRef = useRef(account);
|
|
38
|
-
const accountAlreadyConnected = useRef(account);
|
|
38
|
+
const accountAlreadyConnected = useRef<string | undefined>(account);
|
|
39
39
|
const disconnect = useCallback(() => {
|
|
40
40
|
accountAlreadyConnected.current = undefined;
|
|
41
41
|
_disconnect({ isUserDisconnecting: false });
|
package/src/hooks/index.ts
CHANGED
|
@@ -25,3 +25,13 @@ export * from "./ipfs/useIpfsStorage";
|
|
|
25
25
|
export * from "./location/buildUseSearchParams";
|
|
26
26
|
export * from "./form/useForm";
|
|
27
27
|
export * from "./useBreakpoints";
|
|
28
|
+
export * from "./useSignerAddress";
|
|
29
|
+
export * from "./useMetaTx";
|
|
30
|
+
export { useCtaClickHandler } from "./useCtaClickHandler";
|
|
31
|
+
export {
|
|
32
|
+
useToggleAccountDrawer,
|
|
33
|
+
useAccountDrawer,
|
|
34
|
+
useCloseAccountDrawer,
|
|
35
|
+
useOpenAccountDrawer
|
|
36
|
+
} from "../components/wallet2/accountDrawer/index";
|
|
37
|
+
export * from "./usePrevious";
|
|
@@ -20,7 +20,10 @@ export function useCtaClickHandler<T>({
|
|
|
20
20
|
successPayload
|
|
21
21
|
}: {
|
|
22
22
|
waitBlocks: number;
|
|
23
|
-
coreSdk:
|
|
23
|
+
coreSdk: Pick<
|
|
24
|
+
CoreSDK,
|
|
25
|
+
"relayNativeMetaTransaction" | "relayMetaTransaction" | "parseError"
|
|
26
|
+
>;
|
|
24
27
|
useMetaTx: boolean;
|
|
25
28
|
actions: Action[];
|
|
26
29
|
successPayload: T | ((receipt: providers.TransactionReceipt) => T);
|
package/src/hooks/useMetaTx.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { CoreSDK } from "@bosonprotocol/core-sdk";
|
|
2
2
|
import { useSignerAddress } from "./useSignerAddress";
|
|
3
3
|
|
|
4
|
-
export function useMetaTx(
|
|
4
|
+
export function useMetaTx(
|
|
5
|
+
coreSdk: Pick<CoreSDK, "isMetaTxConfigSet" | "web3Lib"> | undefined
|
|
6
|
+
) {
|
|
5
7
|
const { signerAddress, signerContract } = useSignerAddress(coreSdk?.web3Lib);
|
|
6
8
|
const isMetaTx = coreSdk
|
|
7
9
|
? Boolean(coreSdk.isMetaTxConfigSet && signerAddress && !signerContract)
|
package/src/index.tsx
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./components/buttons/BurgerButton";
|
|
|
3
3
|
export * from "./components/buttons/Button";
|
|
4
4
|
export * from "./components/buttons/CommitButtonView";
|
|
5
5
|
export * from "./components/config/ConfigProvider";
|
|
6
|
+
export * from "./components/cta/common/types";
|
|
6
7
|
export * from "./components/cta/dispute/DecideDisputeButton";
|
|
7
8
|
export * from "./components/cta/dispute/EscalateDisputeButton";
|
|
8
9
|
export * from "./components/cta/dispute/ExpireDisputeButton";
|
|
@@ -45,6 +46,8 @@ export * from "./components/modal/components/Redeem/DetailView/ExternalExchangeD
|
|
|
45
46
|
export * from "./components/portal/Portal";
|
|
46
47
|
export * from "./components/productCard/const";
|
|
47
48
|
export * from "./components/productCard/ProductCard";
|
|
49
|
+
export * from "./components/queryClient/withQueryClientProvider";
|
|
50
|
+
export * from "./components/queryClient/QueryClientProviderCustom";
|
|
48
51
|
export * from "./components/scroll/ScrollToID";
|
|
49
52
|
export * from "./components/scroll/ScrollToTop";
|
|
50
53
|
export * from "./components/searchBar/SearchBar";
|
|
@@ -85,6 +88,7 @@ export * from "./lib/magicLink/logout";
|
|
|
85
88
|
export * from "./lib/magicLink/provider";
|
|
86
89
|
export * from "./lib/offer/filter";
|
|
87
90
|
export * from "./lib/offer/getIsOfferExpired";
|
|
91
|
+
export * from "./lib/opensea/getOpenSeaUrl";
|
|
88
92
|
export * from "./lib/promises/promises";
|
|
89
93
|
export * from "./lib/url/url";
|
|
90
94
|
export * from "./theme";
|
|
@@ -152,6 +152,13 @@ const getExternalWeb3LibAdapterListener = ({
|
|
|
152
152
|
);
|
|
153
153
|
});
|
|
154
154
|
},
|
|
155
|
+
estimateGas: async (...args: any[]): Promise<BigNumberish> => {
|
|
156
|
+
return getDefaultHandleSignerFunction<BigNumberish>({
|
|
157
|
+
parentOrigin,
|
|
158
|
+
functionName: "estimateGas",
|
|
159
|
+
args
|
|
160
|
+
});
|
|
161
|
+
},
|
|
155
162
|
call: async (...args: any[]): Promise<string> => {
|
|
156
163
|
return getDefaultHandleSignerFunction<string>({
|
|
157
164
|
parentOrigin,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fn } from "@storybook/test";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
3
|
import { Meta } from "@storybook/react";
|
|
4
4
|
import {
|
|
5
5
|
ChainSelector,
|
|
@@ -17,8 +17,9 @@ import {
|
|
|
17
17
|
import { HashRouter, Route, Routes } from "react-router-dom";
|
|
18
18
|
import { bosonButtonThemeKeys } from "../components/ui/ThemedButton";
|
|
19
19
|
import { CSSProperties, createGlobalStyle } from "styled-components";
|
|
20
|
+
import { Wallet } from "phosphor-react";
|
|
20
21
|
const colors = theme.colors.light;
|
|
21
|
-
const successButtonTheme: ConnectWalletProps["
|
|
22
|
+
const successButtonTheme: ConnectWalletProps["connectWalletButtonTheme"] = {
|
|
22
23
|
...bosonButtonThemes({ withBosonStyle: false })["primary"],
|
|
23
24
|
color: "inherit",
|
|
24
25
|
background: "var(--buttonBgColor)"
|
|
@@ -30,13 +31,17 @@ const errorButtonTheme = bosonButtonThemes({ withBosonStyle: false })[
|
|
|
30
31
|
const envName =
|
|
31
32
|
(process.env.STORYBOOK_DATA_ENV_NAME as EnvironmentType) || "testing";
|
|
32
33
|
const envConfig = getEnvConfigs(envName);
|
|
33
|
-
const
|
|
34
|
+
const config = envConfig[0];
|
|
35
|
+
const configId = config.configId;
|
|
34
36
|
const ColorGlobalStyle = createGlobalStyle<{ color: CSSProperties["color"] }>`
|
|
35
37
|
html, body{
|
|
36
38
|
color: ${({ color }) => color};
|
|
37
39
|
}
|
|
38
40
|
`;
|
|
39
41
|
const Component = ({
|
|
42
|
+
showStatusIcon,
|
|
43
|
+
rightConnectedChild,
|
|
44
|
+
connectWalletChild,
|
|
40
45
|
textColor,
|
|
41
46
|
chainSelectorBackgroundColor,
|
|
42
47
|
connectWalletBorderRadius,
|
|
@@ -55,10 +60,16 @@ const Component = ({
|
|
|
55
60
|
walletHoverFocusBackgroundColor,
|
|
56
61
|
walletHoverColor,
|
|
57
62
|
magicLoginButtonThemeKey,
|
|
63
|
+
connectionErrorTryAgainButtonThemeKey,
|
|
64
|
+
connectionErrorBackToWalletSelectionButtonThemeKey,
|
|
58
65
|
magicLoginButtonBorderRadiusPx,
|
|
66
|
+
withMagicLogin,
|
|
59
67
|
onUserDisconnect
|
|
60
68
|
}: {
|
|
69
|
+
showStatusIcon: boolean;
|
|
70
|
+
rightConnectedChild?: ReactNode;
|
|
61
71
|
textColor: string;
|
|
72
|
+
connectWalletChild: string;
|
|
62
73
|
chainSelectorBackgroundColor: string | undefined;
|
|
63
74
|
connectWalletBorderRadius: string | undefined;
|
|
64
75
|
connectWalletSuccessButtonThemeKey: string | undefined;
|
|
@@ -76,7 +87,10 @@ const Component = ({
|
|
|
76
87
|
walletHoverFocusBackgroundColor: string | undefined;
|
|
77
88
|
walletHoverColor: string | undefined;
|
|
78
89
|
magicLoginButtonThemeKey: string | undefined;
|
|
90
|
+
connectionErrorTryAgainButtonThemeKey: string;
|
|
91
|
+
connectionErrorBackToWalletSelectionButtonThemeKey: string;
|
|
79
92
|
magicLoginButtonBorderRadiusPx: string | undefined;
|
|
93
|
+
withMagicLogin: boolean | undefined;
|
|
80
94
|
onUserDisconnect: () => unknown;
|
|
81
95
|
}) => {
|
|
82
96
|
return (
|
|
@@ -114,9 +128,22 @@ const Component = ({
|
|
|
114
128
|
<ChainSelector
|
|
115
129
|
leftAlign={true}
|
|
116
130
|
backgroundColor={chainSelectorBackgroundColor}
|
|
131
|
+
config={config}
|
|
117
132
|
/>
|
|
118
133
|
<ConnectWallet
|
|
119
|
-
|
|
134
|
+
showStatusIcon={showStatusIcon}
|
|
135
|
+
connectWalletChild={connectWalletChild}
|
|
136
|
+
rightConnectedChild={rightConnectedChild}
|
|
137
|
+
connectWalletButtonTheme={{
|
|
138
|
+
...(connectWalletSuccessButtonThemeKey
|
|
139
|
+
? bosonButtonThemes({ withBosonStyle: false })[
|
|
140
|
+
connectWalletSuccessButtonThemeKey
|
|
141
|
+
]
|
|
142
|
+
: successButtonTheme),
|
|
143
|
+
borderRadius: connectWalletBorderRadius,
|
|
144
|
+
gap: "2px"
|
|
145
|
+
}}
|
|
146
|
+
connectedButtonTheme={{
|
|
120
147
|
...(connectWalletSuccessButtonThemeKey
|
|
121
148
|
? bosonButtonThemes({ withBosonStyle: false })[
|
|
122
149
|
connectWalletSuccessButtonThemeKey
|
|
@@ -154,6 +181,7 @@ const Component = ({
|
|
|
154
181
|
disconnectColor={accountDrawerDisconnectColor}
|
|
155
182
|
onUserDisconnect={onUserDisconnect}
|
|
156
183
|
walletModalProps={{
|
|
184
|
+
withMagicLogin,
|
|
157
185
|
optionProps: {
|
|
158
186
|
backgroundColor: walletBackgroundColor,
|
|
159
187
|
color: walletColor,
|
|
@@ -175,6 +203,19 @@ const Component = ({
|
|
|
175
203
|
}
|
|
176
204
|
}
|
|
177
205
|
},
|
|
206
|
+
connectionErrorProps: {
|
|
207
|
+
tryAgainTheme: connectionErrorTryAgainButtonThemeKey
|
|
208
|
+
? bosonButtonThemes({ withBosonStyle: false })[
|
|
209
|
+
connectionErrorTryAgainButtonThemeKey
|
|
210
|
+
]
|
|
211
|
+
: successButtonTheme,
|
|
212
|
+
backToWalletSelectionTheme:
|
|
213
|
+
connectionErrorBackToWalletSelectionButtonThemeKey
|
|
214
|
+
? bosonButtonThemes({ withBosonStyle: false })[
|
|
215
|
+
connectionErrorBackToWalletSelectionButtonThemeKey
|
|
216
|
+
]
|
|
217
|
+
: successButtonTheme
|
|
218
|
+
},
|
|
178
219
|
PrivacyPolicy: () => <div>privacy policy</div>
|
|
179
220
|
}}
|
|
180
221
|
/>
|
|
@@ -224,6 +265,14 @@ export default {
|
|
|
224
265
|
magicLoginButtonThemeKey: {
|
|
225
266
|
control: "select",
|
|
226
267
|
options: bosonButtonThemeKeys
|
|
268
|
+
},
|
|
269
|
+
connectionErrorTryAgainButtonThemeKey: {
|
|
270
|
+
control: "select",
|
|
271
|
+
options: bosonButtonThemeKeys
|
|
272
|
+
},
|
|
273
|
+
connectionErrorBackToWalletSelectionButtonThemeKey: {
|
|
274
|
+
control: "select",
|
|
275
|
+
options: bosonButtonThemeKeys
|
|
227
276
|
}
|
|
228
277
|
},
|
|
229
278
|
decorators: [
|
|
@@ -258,7 +307,9 @@ export const BosonTheme = {
|
|
|
258
307
|
walletColor: colors.white,
|
|
259
308
|
walletHoverFocusBackgroundColor: colors.black,
|
|
260
309
|
walletHoverColor: colors.white,
|
|
261
|
-
magicLoginButtonThemeKey: undefined
|
|
310
|
+
magicLoginButtonThemeKey: undefined,
|
|
311
|
+
connectionErrorTryAgainButtonThemeKey: "orangeInverse",
|
|
312
|
+
connectionErrorBackToWalletSelectionButtonThemeKey: "orangeInverse"
|
|
262
313
|
}
|
|
263
314
|
};
|
|
264
315
|
|
|
@@ -283,6 +334,12 @@ export const CustomTheme = {
|
|
|
283
334
|
walletHoverFocusBackgroundColor: "#e89f0e",
|
|
284
335
|
walletHoverColor: "#ff0000",
|
|
285
336
|
magicLoginButtonThemeKey: "orangeInverse",
|
|
286
|
-
|
|
337
|
+
connectionErrorTryAgainButtonThemeKey: "orangeInverse",
|
|
338
|
+
connectionErrorBackToWalletSelectionButtonThemeKey: "orangeInverse",
|
|
339
|
+
magicLoginButtonBorderRadiusPx: "50",
|
|
340
|
+
withMagicLogin: true,
|
|
341
|
+
showStatusIcon: false,
|
|
342
|
+
connectWalletChild: <>Connect</>,
|
|
343
|
+
rightConnectedChild: <Wallet />
|
|
287
344
|
}
|
|
288
345
|
};
|
|
@@ -39,13 +39,7 @@ ProductCardPrimary.args = {
|
|
|
39
39
|
"https://images.unsplash.com/flagged/photo-1570612861542-284f4c12e75f?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1740&q=80",
|
|
40
40
|
avatarName: (
|
|
41
41
|
<>
|
|
42
|
-
<span
|
|
43
|
-
style={{
|
|
44
|
-
color: "green"
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
47
|
-
JSON Doe
|
|
48
|
-
</span>
|
|
42
|
+
<span>JSON Doe</span>
|
|
49
43
|
</>
|
|
50
44
|
),
|
|
51
45
|
asterisk: true,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { fn } from "@storybook/test";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { Meta } from "@storybook/react";
|
|
4
|
-
import { Upload } from "../..";
|
|
3
|
+
import { QueryClientProviderCustom, Upload } from "../..";
|
|
5
4
|
import { EnvironmentProvider } from "../../components/environment/EnvironmentProvider";
|
|
6
5
|
import { IpfsProvider } from "../../components/ipfs/IpfsProvider";
|
|
7
6
|
import { Formik } from "formik";
|
|
8
|
-
import { QueryClientProviderCustom } from "../../components/queryClient/withQueryClientProvider";
|
|
9
7
|
import {
|
|
10
8
|
bosonButtonThemeKeys,
|
|
11
9
|
bosonButtonThemes
|