import { Stripe, StripeCardCvcElement, StripeCardExpiryElement, StripeCardNumberElement, StripeLinkAuthenticationElement, PaymentRequestPaymentMethodEvent, PaymentRequestShippingOptionEvent, PaymentRequestShippingAddressEvent, PaymentRequestOptions, PaymentIntentResult, SetupIntentResult } from '@stripe/stripe-js'; /** * Internal util types */ export type StringifyBoolean = 'true' | 'false'; /** * Event object of `formSubmit` event */ export type FormSubmitEvent = { stripe: Stripe; cardNumberElement: StripeCardNumberElement; cardExpiryElement: StripeCardExpiryElement; cardCVCElement: StripeCardCvcElement; intentClientSecret?: string; zipCode?: string; }; /** * Handler function of the `formSubmit` event */ export type FormSubmitHandler = (event: Event, props: FormSubmitEvent) => Promise; /** * Event object of `stripeLoaded` event */ export type StripeLoadedEvent = { stripe: Stripe; }; /** * Handler function of the `stripeLoaded` event */ export type StripeDidLoadedHandler = (event: StripeLoadedEvent) => Promise; /** * Activity progress status */ export type ProgressStatus = '' | 'loading' | 'success' | 'failure'; /** * PaymentRequest Button API handlers */ export type PaymentRequestPaymentMethodEventHandler = (event: PaymentRequestPaymentMethodEvent, stripe: Stripe) => Promise; export type PaymentRequestShippingOptionEventHandler = (event: PaymentRequestShippingOptionEvent, stripe: Stripe) => Promise; export type PaymentRequestShippingAddressEventHandler = (event: PaymentRequestShippingAddressEvent, stripe: Stripe) => Promise; /** * PaymentRequest Button options */ export type PaymentRequestButtonOption = PaymentRequestOptions & { paymentRequestPaymentMethodHandler?: PaymentRequestPaymentMethodEventHandler; paymentRequestShippingAddressChangeHandler?: PaymentRequestShippingAddressEventHandler; paymentRequestShippingOptionChangeHandler?: PaymentRequestShippingOptionEventHandler; }; /** * Stripe XXXIntent types */ export type IntentType = 'setup' | 'payment'; export type DefaultFormSubmitResult = Error | PaymentIntentResult | SetupIntentResult; /** * Stripe.js client options * @see https://stripe.com/docs/js/initializing#init_stripe_js-options */ export type InitStripeOptions = { stripeAccount?: string; }; /** * Event object of Link Authentication Element 'change' event */ export type LinkAuthenticationElementChangeEvent = { stripe: Stripe; linkAuthenticationElement: StripeLinkAuthenticationElement; email?: string; }; /** * Handler function of the Link Authentication Element 'change' event */ export type LinkAuthenticationElementChangeHandler = (event: LinkAuthenticationElementChangeEvent) => Promise | void; /** * Currency Selector Element change event data */ export type CurrencySelectorChangeEvent = { currency: string; }; /** * Currency Selector Element change handler */ export type CurrencySelectorChangeHandler = (props: CurrencySelectorChangeEvent) => Promise;