supersub
Version:
Supersub JS Sdk
41 lines (40 loc) • 1.28 kB
TypeScript
import React from "react";
import { ReactNode, ReactElement } from "react";
type IModals = "subscription-modal";
declare const AcctProvider: ({ children }: AcctProviderProps) => React.JSX.Element;
export default AcctProvider;
interface AcctProviderProps {
children: ReactElement[] | ReactElement | ReactNode;
}
interface IOpenModalArgs {
modal?: IModals;
productId?: number;
apiKey?: string;
defaultPlanId?: number;
}
interface IGetProductArgs {
apiKey?: string;
productId?: number;
}
interface AcctContextType {
ready: boolean;
isMfaEnabled: boolean;
authenticated: boolean;
isSmartAccountReady: boolean;
smartAddress: string | undefined;
subscribeToPlan: () => void;
defaultPlanId: number | undefined;
selectedPlan: number | undefined;
updateSelectedPlan: (selectedPlan: number) => void;
activeModal: string;
closeModal: () => void;
productDetails: {
data: any;
error: boolean;
isLoading: boolean;
};
openSubscription: ({ modal, productId, apiKey }: IOpenModalArgs) => void;
getProductDetails: ({ productId, apiKey }: IGetProductArgs) => void;
}
export declare const AcctContext: React.Context<AcctContextType>;
export declare const useSuperSub: () => AcctContextType;