UNPKG

@plandalf/react

Version:

React checkout components for Plandalf Checkout — an embedded and popup checkout alternative to Stripe Checkout and SamCart, with a built-in billing portal.

54 lines (53 loc) 2 kB
import { CustomerInfo, EmbedEventCallbacks } from '../types'; import type { JourneyContextValue } from '../context/Journey'; export type EventCallbacks = { onSuccess?: () => void; onInit?: () => void; onCancel?: () => void; onPageChange?: () => void; onCheckoutInit?: () => void; onCheckoutResized?: () => void; }; export declare function useEmbedEvents(journey: JourneyContextValue | null, callbacks: Partial<EmbedEventCallbacks>): { onInit: (checkoutId: string) => void; onPageChange: (checkoutId: string, pageId: string) => void; onPaymentInit: (checkoutId: string) => void; onSubmit: (checkoutId: string) => void; onSuccess: (data: any) => void; onComplete: (checkout: any) => void; onCancel: (data: any) => void; onClosed: (data: any) => void; onLineItemChange: (data: any) => void; onResize: (data: any) => void; onError: (error: any) => void; }; export declare function useNumiFrame({ offerId, domain, inheritParameters, parameters, customer, dynamicResize }: { offerId: string; domain?: string; inheritParameters?: boolean; parameters?: Record<string, any>; customer?: CustomerInfo; dynamicResize?: boolean; }): { iframeUrl: string; origin: string; embedId: string | undefined; }; export declare function useBillingPortalFrame({ domain, inheritParameters, parameters, customerToken, returnUrl, dynamicResize }: { domain?: string; inheritParameters?: boolean; parameters?: Record<string, any>; customerToken?: string; returnUrl?: string; dynamicResize?: boolean; }): { iframeUrl: string; origin: string; embedId: string | undefined; }; export declare const useMessageListener: (embed: any, eventName: string, fn: (data: any) => void, options?: { disabled?: boolean; }) => void; export declare function useNumiEvents(embed: any, events: any): void; declare const useIframeMessage: (callbacks: EventCallbacks) => void; export default useIframeMessage;