@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.
29 lines (28 loc) • 1.03 kB
TypeScript
import React from 'react';
import type { EmbedEventCallbacks, CustomerInfo } from '../types';
type JourneyType = 'enroll' | 'upgrade' | 'conversion' | string;
export type JourneyOptions = {
domain?: string;
success_url?: string;
[key: string]: any;
};
export type JourneyContextValue = {
id: string;
type: JourneyType;
options: JourneyOptions;
customer?: CustomerInfo;
lastCheckoutId?: string;
registerEmbedEvents: (key: string, callbacks: Partial<EmbedEventCallbacks>) => () => void;
emit: <K extends keyof EmbedEventCallbacks>(eventName: K, ...args: Parameters<NonNullable<EmbedEventCallbacks[K]>>) => void;
};
export declare const useJourney: () => JourneyContextValue;
export declare const useJourneyOptional: () => JourneyContextValue | null;
export type JourneyProps = {
id: string;
type: JourneyType;
options: JourneyOptions;
customer?: CustomerInfo;
children: React.ReactNode;
};
export declare const Journey: React.FC<JourneyProps>;
export default Journey;