diff --git a/packages/react-kit/src/components/queryClient/withQueryClientProvider.tsx b/packages/react-kit/src/components/queryClient/withQueryClientProvider.tsx index f03cbea24..d78dabaa4 100644 --- a/packages/react-kit/src/components/queryClient/withQueryClientProvider.tsx +++ b/packages/react-kit/src/components/queryClient/withQueryClientProvider.tsx @@ -1,30 +1,5 @@ -import { - QueryClient, - QueryClientProvider, - QueryClientProviderProps -} from "react-query"; - import React from "react"; - -const queryClient = new QueryClient({ - defaultOptions: { - queries: { - refetchOnWindowFocus: false - } - } -}); - -type QueryClientProviderCustomProps = Partial; - -export const QueryClientProviderCustom: React.FC< - QueryClientProviderCustomProps -> = ({ ...props }) => { - return ( - - {props.children} - - ); -}; +import { QueryClientProviderCustom } from "./QueryClientProviderCustom"; export const withQueryClientProvider =

( WrappedComponent: React.ComponentType

diff --git a/packages/react-kit/src/hooks/index.ts b/packages/react-kit/src/hooks/index.ts index 65284554e..8642bea8d 100644 --- a/packages/react-kit/src/hooks/index.ts +++ b/packages/react-kit/src/hooks/index.ts @@ -25,3 +25,6 @@ export * from "./ipfs/useIpfsStorage"; export * from "./location/buildUseSearchParams"; export * from "./form/useForm"; export * from "./useBreakpoints"; +export * from "./useSignerAddress"; +export * from "./useMetaTx"; +export { useCtaClickHandler } from "./useCtaClickHandler"; diff --git a/packages/react-kit/src/hooks/useCtaClickHandler.ts b/packages/react-kit/src/hooks/useCtaClickHandler.ts index 638b3f73e..668478fff 100644 --- a/packages/react-kit/src/hooks/useCtaClickHandler.ts +++ b/packages/react-kit/src/hooks/useCtaClickHandler.ts @@ -20,7 +20,10 @@ export function useCtaClickHandler({ successPayload }: { waitBlocks: number; - coreSdk: CoreSDK; + coreSdk: Pick< + CoreSDK, + "relayNativeMetaTransaction" | "relayMetaTransaction" | "parseError" + >; useMetaTx: boolean; actions: Action[]; successPayload: T | ((receipt: providers.TransactionReceipt) => T); diff --git a/packages/react-kit/src/hooks/useMetaTx.ts b/packages/react-kit/src/hooks/useMetaTx.ts index a8bf319ff..acc68375a 100644 --- a/packages/react-kit/src/hooks/useMetaTx.ts +++ b/packages/react-kit/src/hooks/useMetaTx.ts @@ -1,7 +1,9 @@ import { CoreSDK } from "@bosonprotocol/core-sdk"; import { useSignerAddress } from "./useSignerAddress"; -export function useMetaTx(coreSdk: CoreSDK | undefined) { +export function useMetaTx( + coreSdk: Pick | undefined +) { const { signerAddress, signerContract } = useSignerAddress(coreSdk?.web3Lib); const isMetaTx = coreSdk ? Boolean(coreSdk.isMetaTxConfigSet && signerAddress && !signerContract) diff --git a/packages/react-kit/src/index.tsx b/packages/react-kit/src/index.tsx index 248cbef85..4f0757d0b 100644 --- a/packages/react-kit/src/index.tsx +++ b/packages/react-kit/src/index.tsx @@ -3,6 +3,7 @@ export * from "./components/buttons/BurgerButton"; export * from "./components/buttons/Button"; export * from "./components/buttons/CommitButtonView"; export * from "./components/config/ConfigProvider"; +export * from "./components/cta/common/types"; export * from "./components/cta/dispute/DecideDisputeButton"; export * from "./components/cta/dispute/EscalateDisputeButton"; export * from "./components/cta/dispute/ExpireDisputeButton"; @@ -45,6 +46,8 @@ export * from "./components/modal/components/Redeem/DetailView/ExternalExchangeD export * from "./components/portal/Portal"; export * from "./components/productCard/const"; export * from "./components/productCard/ProductCard"; +export * from "./components/queryClient/withQueryClientProvider"; +export * from "./components/queryClient/QueryClientProviderCustom"; export * from "./components/scroll/ScrollToID"; export * from "./components/scroll/ScrollToTop"; export * from "./components/searchBar/SearchBar"; diff --git a/packages/react-kit/src/stories/buttons/Upload.stories.tsx b/packages/react-kit/src/stories/buttons/Upload.stories.tsx index 5e2d0fc8d..4230e0c3a 100644 --- a/packages/react-kit/src/stories/buttons/Upload.stories.tsx +++ b/packages/react-kit/src/stories/buttons/Upload.stories.tsx @@ -1,11 +1,9 @@ -import { fn } from "@storybook/test"; import React from "react"; import { Meta } from "@storybook/react"; -import { Upload } from "../.."; +import { QueryClientProviderCustom, Upload } from "../.."; import { EnvironmentProvider } from "../../components/environment/EnvironmentProvider"; import { IpfsProvider } from "../../components/ipfs/IpfsProvider"; import { Formik } from "formik"; -import { QueryClientProviderCustom } from "../../components/queryClient/withQueryClientProvider"; import { bosonButtonThemeKeys, bosonButtonThemes