import { PaymentSheetConfig } from '../../services/frame-messaging/transmitter/sdk-cmds.interface'; import { ElementEventHandler, ElementEventType } from '../ElementEvent/types'; export interface ForageElementStyle { /** * The [border-color](https://developer.mozilla.org/en-US/docs/Web/CSS/border-color) CSS property. */ borderColor?: string; /** * The [border-width](https://developer.mozilla.org/en-US/docs/Web/CSS/border-width) CSS property. */ borderWidth?: string; } /** @deprecated Use `ForageElementStyle` instead */ export type ForageEbtElementStyle = ForageElementStyle; export interface ForageElementOptions { style?: ForageElementStyle; /** required when using the 'payment_sheet' useCase */ paymentSheet?: PaymentSheetConfig; } export interface ForageElementBase { /** * Attaches the Forage Element to an HTML container element with id `htmlContainerElementId`. * * You need to create a container HTML element to mount a Forage element. * The container element should be a `
` element with a unique `id` attribute. */ mount: (htmlContainerElementId: string) => void; /** * Attaches an event handler to the Forage Element. * The handler is called when an event of the specified `type` occurs. * * @example * The change event is triggered when the Forage Element's value changes. * * ```js * tokenizeCardElement.on('change', (event) => { * if (event.error) { * // show validation error to customer * } * }) * ``` */ on: (type: ElementEventType, handler: ElementEventHandler) => void; /** * Removes the value from the Forage Element. */ clear: () => void; /** * Focuses the Forage Element. */ focus: () => void; /** * Calling .destroy() removes the element from the DOM and destroys it. * A destroyed element can not be re-mounted to the DOM. */ destroy: () => void; } export type ForageCardElement = ForageElementBase; export type ForagePinElement = ForageElementBase; export type ForagePaymentSheetElement = ForageElementBase; /** * @deprecated Use `ForageCardElement` instead. */ export type ForageEbtCardNumberElement = ForageElementBase; /** * @deprecated Use `ForagePinElement` instead. */ export type ForageEbtBalanceElement = ForageElementBase; /** * @deprecated Use `ForagePinElement` instead. */ export type ForageEbtPaymentElement = ForageElementBase;