@blocklet/payment-react
Version:
Reusable react components for payment kit v2
43 lines (42 loc) • 1.79 kB
TypeScript
import type { TPaymentCurrency, TPaymentMethodExpanded } from '@blocklet/payment-types';
import type { Axios } from 'axios';
export interface Settings {
paymentMethods: TPaymentMethodExpanded[];
baseCurrency: TPaymentCurrency;
}
export type PaymentContextType = {
livemode: boolean;
session: import('@arcblock/did-connect-react/lib/types').SessionContext['session'] & {
user: any;
};
connect: import('@arcblock/did-connect-react/lib/types').SessionContext['connectApi'];
prefix: string;
settings: Settings;
refresh: (forceRefresh?: boolean) => void;
getCurrency: (currencyId: string) => TPaymentCurrency | undefined;
getMethod: (methodId: string) => TPaymentMethodExpanded | undefined;
setLivemode: (livemode: boolean) => void;
api: Axios;
payable: boolean;
setPayable: (status: boolean) => void;
paymentState: {
paying: boolean;
stripePaying: boolean;
};
setPaymentState: (state: Partial<{
paying: boolean;
stripePaying: boolean;
}>) => void;
};
export type PaymentContextProps = {
session: import('@arcblock/did-connect-react/lib/types').SessionContext['session'];
connect: import('@arcblock/did-connect-react/lib/types').SessionContext['connectApi'];
children: any;
baseUrl?: string;
authToken?: string;
};
declare const PaymentContext: import("react").Context<PaymentContextType>;
declare const Consumer: import("react").Consumer<PaymentContextType>;
declare function PaymentProvider({ session, connect, children, baseUrl, authToken, }: PaymentContextProps): import("react").JSX.Element | null;
declare function usePaymentContext(): PaymentContextType;
export { PaymentContext, PaymentProvider, Consumer as SettingsConsumer, usePaymentContext };