@pretzelai/react
Version:
A React Stripe Payment Modal Component
169 lines (164 loc) • 5.16 kB
TypeScript
import * as React from 'react';
import React__default from 'react';
import { z } from 'zod';
interface PaymentModalProps$1 {
isOpen: boolean;
publicKey: string;
priceId: string;
userEmail: string;
userId: string;
apiUrl?: string;
onClose?: () => void;
onPaymentSuccess: (paymentIntentId?: string) => void;
onPaymentError: (error?: string) => void;
}
declare const PaymentModal: ({ isOpen, publicKey, priceId, userEmail, userId, onClose, onPaymentSuccess, onPaymentError, apiUrl, }: PaymentModalProps$1) => React__default.JSX.Element | null;
declare const PlanSchema: z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
price: z.ZodNumber;
interval: z.ZodString;
features: z.ZodArray<z.ZodObject<{
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
text: string;
}, {
text: string;
}>, "many">;
buttonText: z.ZodString;
buttonOutline: z.ZodOptional<z.ZodBoolean>;
isPopular: z.ZodOptional<z.ZodBoolean>;
popularText: z.ZodOptional<z.ZodString>;
currency: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
title: string;
description: string;
price: number;
interval: string;
features: {
text: string;
}[];
buttonText: string;
buttonOutline?: boolean | undefined;
isPopular?: boolean | undefined;
popularText?: string | undefined;
currency?: string | undefined;
}, {
title: string;
description: string;
price: number;
interval: string;
features: {
text: string;
}[];
buttonText: string;
buttonOutline?: boolean | undefined;
isPopular?: boolean | undefined;
popularText?: string | undefined;
currency?: string | undefined;
}>;
type Plan = z.infer<typeof PlanSchema>;
declare const PricingTableSchema: z.ZodObject<{
heading: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
plans: z.ZodArray<z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
price: z.ZodNumber;
interval: z.ZodString;
features: z.ZodArray<z.ZodObject<{
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
text: string;
}, {
text: string;
}>, "many">;
buttonText: z.ZodString;
buttonOutline: z.ZodOptional<z.ZodBoolean>;
isPopular: z.ZodOptional<z.ZodBoolean>;
popularText: z.ZodOptional<z.ZodString>;
currency: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
title: string;
description: string;
price: number;
interval: string;
features: {
text: string;
}[];
buttonText: string;
buttonOutline?: boolean | undefined;
isPopular?: boolean | undefined;
popularText?: string | undefined;
currency?: string | undefined;
}, {
title: string;
description: string;
price: number;
interval: string;
features: {
text: string;
}[];
buttonText: string;
buttonOutline?: boolean | undefined;
isPopular?: boolean | undefined;
popularText?: string | undefined;
currency?: string | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
plans: {
title: string;
description: string;
price: number;
interval: string;
features: {
text: string;
}[];
buttonText: string;
buttonOutline?: boolean | undefined;
isPopular?: boolean | undefined;
popularText?: string | undefined;
currency?: string | undefined;
}[];
heading?: string | undefined;
description?: string | undefined;
}, {
plans: {
title: string;
description: string;
price: number;
interval: string;
features: {
text: string;
}[];
buttonText: string;
buttonOutline?: boolean | undefined;
isPopular?: boolean | undefined;
popularText?: string | undefined;
currency?: string | undefined;
}[];
heading?: string | undefined;
description?: string | undefined;
}>;
type PricingTableProps = z.infer<typeof PricingTableSchema>;
declare function PricingTable({ pricingData, theme, className, publicKey, redirectUrl, }: {
pricingData: Partial<PricingTableProps>;
theme?: "light" | "dark";
className?: string;
publicKey?: string;
redirectUrl?: string;
}): React.JSX.Element;
interface PaymentModalProps {
isOpen: boolean;
publicKey: string;
plan: Plan | null;
userEmail?: string;
userId?: string;
apiUrl?: string;
onClose?: () => void;
onPaymentSuccess?: (paymentIntentId?: string) => void;
onPaymentError?: (error?: string) => void;
}
declare const PaymentModalDemo: ({ isOpen, publicKey, plan, userEmail, userId, onClose, onPaymentSuccess, onPaymentError, apiUrl, }: PaymentModalProps) => React__default.JSX.Element | null;
export { PaymentModal, PaymentModalDemo, PricingTable };
export type { PaymentModalProps$1 as PaymentModalProps, PricingTableProps };