Skip to content

Commit

Permalink
chore: export cta related stuff (#794)
Browse files Browse the repository at this point in the history
* chore: export cta related stuff

* fix: storybook
  • Loading branch information
albertfolch-redeemeum committed Sep 16, 2024
1 parent 8910940 commit 0cf97da
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -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<QueryClientProviderProps>;

export const QueryClientProviderCustom: React.FC<
QueryClientProviderCustomProps
> = ({ ...props }) => {
return (
<QueryClientProvider client={queryClient} {...props}>
{props.children}
</QueryClientProvider>
);
};
import { QueryClientProviderCustom } from "./QueryClientProviderCustom";

export const withQueryClientProvider = <P extends object>(
WrappedComponent: React.ComponentType<P>
Expand Down
3 changes: 3 additions & 0 deletions packages/react-kit/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
5 changes: 4 additions & 1 deletion packages/react-kit/src/hooks/useCtaClickHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export function useCtaClickHandler<T>({
successPayload
}: {
waitBlocks: number;
coreSdk: CoreSDK;
coreSdk: Pick<
CoreSDK,
"relayNativeMetaTransaction" | "relayMetaTransaction" | "parseError"
>;
useMetaTx: boolean;
actions: Action[];
successPayload: T | ((receipt: providers.TransactionReceipt) => T);
Expand Down
4 changes: 3 additions & 1 deletion packages/react-kit/src/hooks/useMetaTx.ts
Original file line number Diff line number Diff line change
@@ -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<CoreSDK, "isMetaTxConfigSet" | "web3Lib"> | undefined
) {
const { signerAddress, signerContract } = useSignerAddress(coreSdk?.web3Lib);
const isMetaTx = coreSdk
? Boolean(coreSdk.isMetaTxConfigSet && signerAddress && !signerContract)
Expand Down
3 changes: 3 additions & 0 deletions packages/react-kit/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down
4 changes: 1 addition & 3 deletions packages/react-kit/src/stories/buttons/Upload.stories.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0cf97da

Please sign in to comment.