@bosonprotocol/react-kit 0.34.0-alpha.1 → 0.34.0-alpha.10
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/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/wallet/wallet-connection.d.ts +9559 -9559
- 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/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/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/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/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/wallet/wallet-connection.d.ts +9559 -9559
- 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/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/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/package.json +5 -5
- package/src/components/connection/utils.ts +0 -1
- package/src/components/queryClient/withQueryClientProvider.tsx +1 -26
- package/src/components/wallet2/selector/ChainSelector.tsx +25 -13
- package/src/components/wallet2/web3Status/index.tsx +43 -15
- 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/stories/ConnectWallet.stories.tsx +29 -5
- package/src/stories/buttons/Upload.stories.tsx +1 -3
|
@@ -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";
|
|
@@ -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,
|
|
@@ -58,7 +63,10 @@ const Component = ({
|
|
|
58
63
|
magicLoginButtonBorderRadiusPx,
|
|
59
64
|
onUserDisconnect
|
|
60
65
|
}: {
|
|
66
|
+
showStatusIcon: boolean;
|
|
67
|
+
rightConnectedChild?: ReactNode;
|
|
61
68
|
textColor: string;
|
|
69
|
+
connectWalletChild: string;
|
|
62
70
|
chainSelectorBackgroundColor: string | undefined;
|
|
63
71
|
connectWalletBorderRadius: string | undefined;
|
|
64
72
|
connectWalletSuccessButtonThemeKey: string | undefined;
|
|
@@ -114,9 +122,22 @@ const Component = ({
|
|
|
114
122
|
<ChainSelector
|
|
115
123
|
leftAlign={true}
|
|
116
124
|
backgroundColor={chainSelectorBackgroundColor}
|
|
125
|
+
config={config}
|
|
117
126
|
/>
|
|
118
127
|
<ConnectWallet
|
|
119
|
-
|
|
128
|
+
showStatusIcon={showStatusIcon}
|
|
129
|
+
connectWalletChild={connectWalletChild}
|
|
130
|
+
rightConnectedChild={rightConnectedChild}
|
|
131
|
+
connectWalletButtonTheme={{
|
|
132
|
+
...(connectWalletSuccessButtonThemeKey
|
|
133
|
+
? bosonButtonThemes({ withBosonStyle: false })[
|
|
134
|
+
connectWalletSuccessButtonThemeKey
|
|
135
|
+
]
|
|
136
|
+
: successButtonTheme),
|
|
137
|
+
borderRadius: connectWalletBorderRadius,
|
|
138
|
+
gap: "2px"
|
|
139
|
+
}}
|
|
140
|
+
connectedButtonTheme={{
|
|
120
141
|
...(connectWalletSuccessButtonThemeKey
|
|
121
142
|
? bosonButtonThemes({ withBosonStyle: false })[
|
|
122
143
|
connectWalletSuccessButtonThemeKey
|
|
@@ -283,6 +304,9 @@ export const CustomTheme = {
|
|
|
283
304
|
walletHoverFocusBackgroundColor: "#e89f0e",
|
|
284
305
|
walletHoverColor: "#ff0000",
|
|
285
306
|
magicLoginButtonThemeKey: "orangeInverse",
|
|
286
|
-
magicLoginButtonBorderRadiusPx: "50"
|
|
307
|
+
magicLoginButtonBorderRadiusPx: "50",
|
|
308
|
+
showStatusIcon: false,
|
|
309
|
+
connectWalletChild: <>Connect</>,
|
|
310
|
+
rightConnectedChild: <Wallet />
|
|
287
311
|
}
|
|
288
312
|
};
|
|
@@ -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
|