import * as React from 'react'; import React__default, { MutableRefObject, ReactNode } from 'react'; import { W as WhopCheckoutSubmitDetails, a as WhopCheckoutAddress, b as WhopCheckoutState, c as WhopEmbeddedCheckoutStyleOptions, d as WhopEmbeddedCheckoutPrefillOptions, e as WhopEmbeddedCheckoutEnvironment } from '../util-CLRI9s90.js'; declare const accentColorValues: readonly ["tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "cyan", "teal", "jade", "green", "grass", "brown", "blue", "orange", "indigo", "sky", "mint", "yellow", "amber", "lime", "lemon", "magenta", "gold", "bronze", "gray"]; type AccentColor = (typeof accentColorValues)[number]; declare function isAccentColor(color?: string): color is AccentColor; interface WhopCheckoutEmbedControls { submit: (opts?: WhopCheckoutSubmitDetails) => Promise; getEmail: (timeout?: number) => Promise; setEmail: (email: string, timeout?: number) => Promise; setAddress: (address: WhopCheckoutAddress, timeout?: number) => Promise; getAddress: (timeout?: number) => Promise<{ address: WhopCheckoutAddress; isComplete: boolean; }>; } interface WhopCheckoutEmbedThemeOptions { /** * **Optional** - The accent color you want to use in the embed. * * defaults to `blue` */ accentColor?: AccentColor; /** * **Optional** - Set to true to enable high contrast mode. Only recommended when accent color is set to `gray` * * @default false */ highContrast?: boolean; } type WhopCheckoutEmbedProps = { /** * **Optional** - A ref to the embed controls. * * This can be used to submit the checkout form. */ ref?: MutableRefObject; /** * **Optional** - The theme you want to use for the checkout. * * Possible values are `light`, `dark` or `system`. * * @default "system" */ theme?: "light" | "dark" | "system"; /** * **Optional** - Turn on to hide the price in the embedded checkout form. * * @default false */ hidePrice?: boolean; /** * **Optional** - Set to `true` to skip the final redirect and keep the top frame loaded. * * @default false */ skipRedirect?: boolean; /** * **Optional** - A callback function that will be called when the checkout is complete. */ onComplete?: (( /** The plan id of the plan that was purchased. */ plan_id: string, /** The receipt id of the purchase. */ receipt_id?: string) => void) | (( /** The session id that was used to create the checkout. */ session_id: string, /** The setup intent that was created */ setup_intent_id?: string) => void); /** * **Optional** - A callback function that will be called when the checkout state changes. */ onStateChange?: ( /** The new state of the checkout. */ state: WhopCheckoutState) => void; /** * **Optional** - A callback function that will be called when the address validation error occurs. */ onAddressValidationError?: (error: { /** The error message of the address validation error. */ error_message: string; /** The error code of the address validation error. */ error_code: string; }) => void; /** * **Optional** - The UTM parameters to add to the checkout URL. * * **Note** - The keys must start with `utm_` */ utm?: Record; /** * **Optional** - The styles to apply to the checkout embed. */ styles?: WhopEmbeddedCheckoutStyleOptions; /** * **Optional** - The prefill options to apply to the checkout embed. * * Used to prefill the email in the embedded checkout form. * This setting can be helpful when integrating the embed into a funnel that collects the email prior to payment already. */ prefill?: WhopEmbeddedCheckoutPrefillOptions; /** * **Optional** - The theme options to apply to the checkout embed. */ themeOptions?: WhopCheckoutEmbedThemeOptions; /** * **Optional** - Set to `true` to hide the submit button in the embedded checkout form. * * @default false */ hideSubmitButton?: boolean; /** * **Optional** - Set to `true` to hide the terms and conditions in the embedded checkout form. * * @default false */ hideTermsAndConditions?: boolean; /** * **Optional** - Set to `true` to hide the email input in the embedded checkout form. * * @default false */ hideEmail?: boolean; /** * **Optional** - Set to `true` to disable the email input in the embedded checkout form. * * @default false */ disableEmail?: boolean; /** * **Optional** - Set to `true` to hide the address form in the embedded checkout form. * * @default false */ hideAddressForm?: boolean; /** * **Optional** - The affiliate code to use for the checkout. */ affiliateCode?: string; /** * **Optional** - The setup future usage to use for the checkout. When using the `chargeUser` API you need to set this to `off_session`. This will filter out payment methods that are not supported with that API. * * @default undefined */ setupFutureUsage?: "off_session"; /** * **Optional** - The url to redirect to after the checkout is completed or cancelled on the site of an external payment provider. * * @default undefined * @deprecated use `returnUrl` instead */ redirectUrl?: never; /** * **Optional** - The url to return to after payment authorization flows. * * @default undefined */ returnUrl?: string; /** * **Optional** - When a user gets redirected back to your page after payment authorization, you will receive a state_id in the query parameters. This state ID can be used to restore the previous state of the checkout embed. */ stateId?: string; /** * **Optional** - The promo code to use for the checkout. */ promoCode?: string; /** * **Optional** - The environment to use for the checkout. * * @default "production" */ environment?: WhopEmbeddedCheckoutEnvironment; } & ({ /** * **Required** - The plan id to use for the checkout. */ planId: string; } | { /** * **Required** - The session id to use for the checkout. * * This can be used to attach metadata to a checkout by first creating a session through the API and then passing the session id to the checkout element. */ sessionId: string; }); /** * This component can be used to embed whop checkout in your react app: * * ```tsx * import { WhopCheckoutEmbed } from "@whop/react/checkout"; * * export default function Home() { * return ; * } * ``` */ declare const WhopCheckoutEmbed: React__default.ForwardRefExoticComponent<(Omit<{ /** * **Optional** - A ref to the embed controls. * * This can be used to submit the checkout form. */ ref?: MutableRefObject; /** * **Optional** - The theme you want to use for the checkout. * * Possible values are `light`, `dark` or `system`. * * @default "system" */ theme?: "light" | "dark" | "system"; /** * **Optional** - Turn on to hide the price in the embedded checkout form. * * @default false */ hidePrice?: boolean; /** * **Optional** - Set to `true` to skip the final redirect and keep the top frame loaded. * * @default false */ skipRedirect?: boolean; /** * **Optional** - A callback function that will be called when the checkout is complete. */ onComplete?: (( /** The plan id of the plan that was purchased. */ plan_id: string, /** The receipt id of the purchase. */ receipt_id?: string) => void) | (( /** The session id that was used to create the checkout. */ session_id: string, /** The setup intent that was created */ setup_intent_id?: string) => void); /** * **Optional** - A callback function that will be called when the checkout state changes. */ onStateChange?: ( /** The new state of the checkout. */ state: WhopCheckoutState) => void; /** * **Optional** - A callback function that will be called when the address validation error occurs. */ onAddressValidationError?: (error: { /** The error message of the address validation error. */ error_message: string; /** The error code of the address validation error. */ error_code: string; }) => void; /** * **Optional** - The UTM parameters to add to the checkout URL. * * **Note** - The keys must start with `utm_` */ utm?: Record; /** * **Optional** - The styles to apply to the checkout embed. */ styles?: WhopEmbeddedCheckoutStyleOptions; /** * **Optional** - The prefill options to apply to the checkout embed. * * Used to prefill the email in the embedded checkout form. * This setting can be helpful when integrating the embed into a funnel that collects the email prior to payment already. */ prefill?: WhopEmbeddedCheckoutPrefillOptions; /** * **Optional** - The theme options to apply to the checkout embed. */ themeOptions?: WhopCheckoutEmbedThemeOptions; /** * **Optional** - Set to `true` to hide the submit button in the embedded checkout form. * * @default false */ hideSubmitButton?: boolean; /** * **Optional** - Set to `true` to hide the terms and conditions in the embedded checkout form. * * @default false */ hideTermsAndConditions?: boolean; /** * **Optional** - Set to `true` to hide the email input in the embedded checkout form. * * @default false */ hideEmail?: boolean; /** * **Optional** - Set to `true` to disable the email input in the embedded checkout form. * * @default false */ disableEmail?: boolean; /** * **Optional** - Set to `true` to hide the address form in the embedded checkout form. * * @default false */ hideAddressForm?: boolean; /** * **Optional** - The affiliate code to use for the checkout. */ affiliateCode?: string; /** * **Optional** - The setup future usage to use for the checkout. When using the `chargeUser` API you need to set this to `off_session`. This will filter out payment methods that are not supported with that API. * * @default undefined */ setupFutureUsage?: "off_session"; /** * **Optional** - The url to redirect to after the checkout is completed or cancelled on the site of an external payment provider. * * @default undefined * @deprecated use `returnUrl` instead */ redirectUrl?: never; /** * **Optional** - The url to return to after payment authorization flows. * * @default undefined */ returnUrl?: string; /** * **Optional** - When a user gets redirected back to your page after payment authorization, you will receive a state_id in the query parameters. This state ID can be used to restore the previous state of the checkout embed. */ stateId?: string; /** * **Optional** - The promo code to use for the checkout. */ promoCode?: string; /** * **Optional** - The environment to use for the checkout. * * @default "production" */ environment?: WhopEmbeddedCheckoutEnvironment; } & { /** * **Required** - The plan id to use for the checkout. */ planId: string; } & { /** * **Optional** - The fallback content to show while the checkout is loading. */ fallback?: ReactNode; }, "ref"> | Omit<{ /** * **Optional** - A ref to the embed controls. * * This can be used to submit the checkout form. */ ref?: MutableRefObject; /** * **Optional** - The theme you want to use for the checkout. * * Possible values are `light`, `dark` or `system`. * * @default "system" */ theme?: "light" | "dark" | "system"; /** * **Optional** - Turn on to hide the price in the embedded checkout form. * * @default false */ hidePrice?: boolean; /** * **Optional** - Set to `true` to skip the final redirect and keep the top frame loaded. * * @default false */ skipRedirect?: boolean; /** * **Optional** - A callback function that will be called when the checkout is complete. */ onComplete?: (( /** The plan id of the plan that was purchased. */ plan_id: string, /** The receipt id of the purchase. */ receipt_id?: string) => void) | (( /** The session id that was used to create the checkout. */ session_id: string, /** The setup intent that was created */ setup_intent_id?: string) => void); /** * **Optional** - A callback function that will be called when the checkout state changes. */ onStateChange?: ( /** The new state of the checkout. */ state: WhopCheckoutState) => void; /** * **Optional** - A callback function that will be called when the address validation error occurs. */ onAddressValidationError?: (error: { /** The error message of the address validation error. */ error_message: string; /** The error code of the address validation error. */ error_code: string; }) => void; /** * **Optional** - The UTM parameters to add to the checkout URL. * * **Note** - The keys must start with `utm_` */ utm?: Record; /** * **Optional** - The styles to apply to the checkout embed. */ styles?: WhopEmbeddedCheckoutStyleOptions; /** * **Optional** - The prefill options to apply to the checkout embed. * * Used to prefill the email in the embedded checkout form. * This setting can be helpful when integrating the embed into a funnel that collects the email prior to payment already. */ prefill?: WhopEmbeddedCheckoutPrefillOptions; /** * **Optional** - The theme options to apply to the checkout embed. */ themeOptions?: WhopCheckoutEmbedThemeOptions; /** * **Optional** - Set to `true` to hide the submit button in the embedded checkout form. * * @default false */ hideSubmitButton?: boolean; /** * **Optional** - Set to `true` to hide the terms and conditions in the embedded checkout form. * * @default false */ hideTermsAndConditions?: boolean; /** * **Optional** - Set to `true` to hide the email input in the embedded checkout form. * * @default false */ hideEmail?: boolean; /** * **Optional** - Set to `true` to disable the email input in the embedded checkout form. * * @default false */ disableEmail?: boolean; /** * **Optional** - Set to `true` to hide the address form in the embedded checkout form. * * @default false */ hideAddressForm?: boolean; /** * **Optional** - The affiliate code to use for the checkout. */ affiliateCode?: string; /** * **Optional** - The setup future usage to use for the checkout. When using the `chargeUser` API you need to set this to `off_session`. This will filter out payment methods that are not supported with that API. * * @default undefined */ setupFutureUsage?: "off_session"; /** * **Optional** - The url to redirect to after the checkout is completed or cancelled on the site of an external payment provider. * * @default undefined * @deprecated use `returnUrl` instead */ redirectUrl?: never; /** * **Optional** - The url to return to after payment authorization flows. * * @default undefined */ returnUrl?: string; /** * **Optional** - When a user gets redirected back to your page after payment authorization, you will receive a state_id in the query parameters. This state ID can be used to restore the previous state of the checkout embed. */ stateId?: string; /** * **Optional** - The promo code to use for the checkout. */ promoCode?: string; /** * **Optional** - The environment to use for the checkout. * * @default "production" */ environment?: WhopEmbeddedCheckoutEnvironment; } & { /** * **Required** - The session id to use for the checkout. * * This can be used to attach metadata to a checkout by first creating a session through the API and then passing the session id to the checkout element. */ sessionId: string; } & { /** * **Optional** - The fallback content to show while the checkout is loading. */ fallback?: ReactNode; }, "ref">) & React__default.RefAttributes>; declare function useCheckoutEmbedControls(): React.RefObject; export { type AccentColor, WhopCheckoutEmbed, type WhopCheckoutEmbedProps, type WhopCheckoutEmbedThemeOptions, WhopEmbeddedCheckoutEnvironment, WhopEmbeddedCheckoutPrefillOptions, WhopEmbeddedCheckoutStyleOptions, accentColorValues, isAccentColor, useCheckoutEmbedControls };