diff --git a/src/index.ts b/src/index.ts index 6538c821..0b55f9c3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,7 @@ import { AddressElementComponent, PaymentMethodMessagingElementComponent, TaxIdElementComponent, + CurrencySelectorElementComponent, } from './types'; import {isServer} from './utils/isServer'; @@ -76,6 +77,15 @@ export const CardCvcElement: CardCvcElementComponent = createElementComponent( isServer ); +/** + * Requires beta access: + * Contact [Stripe support](https://support.stripe.com/) for more information. + */ +export const CurrencySelectorElement: CurrencySelectorElementComponent = createElementComponent( + 'currencySelector', + isServer +); + /** * @docs https://stripe.com/docs/stripe-js/react#element-components */ diff --git a/src/types/index.ts b/src/types/index.ts index 63f1ed84..35ff89be 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -606,6 +606,36 @@ export type PaymentMethodMessagingElementComponent = FunctionComponent< PaymentMethodMessagingElementProps >; +export interface CurrencySelectorElementProps extends ElementProps { + /** + * Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. + * Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). + */ + onReady?: (element: stripeJs.StripeCurrencySelectorElement) => any; + + /** + * Triggered when the escape key is pressed within the Element. + */ + onEscape?: () => any; + + /** + * Triggered when the Element fails to load. + */ + onLoadError?: (event: { + elementType: 'currencySelector'; + error: StripeError; + }) => any; + + /** + * Triggered when the [loader](https://stripe.com/docs/js/elements_object/create#stripe_elements-options-loader) UI is mounted to the DOM and ready to be displayed. + */ + onLoaderStart?: (event: {elementType: 'currencySelector'}) => any; +} + +export type CurrencySelectorElementComponent = FunctionComponent< + CurrencySelectorElementProps +>; + declare module '@stripe/stripe-js' { interface StripeElements { /**