import "native-promise-only"; import { type ActivePaymentProductType, type AddressCallback, type AddressCallbackResult, CheckoutEvents, InternalCheckoutEvents, type SessionCancel, type SessionEvent, type SessionLoaded, type SessionLocked, type SessionLockFailed, type SessionNotFound, type SessionPaymentAuthorized, type SessionPaymentError, type SessionPaymentOnHold, type SessionUpdated, type SessionValidationCallback, type ValidateSession } from "./checkout.js"; import type { Session } from "./session.js"; import { type SubscriptionHandler } from "./subscribe.js"; export interface DinteroCheckoutInstance { /** * Remove iframe and all event listeners. */ destroy: () => void; iframe: HTMLIFrameElement; language: string; lockSession: () => Promise; refreshSession: () => Promise; setActivePaymentProductType: (paymentProductType: string) => void; submitValidationResult: (result: SessionValidationCallback) => void; submitAddressCallbackResult: (result: AddressCallbackResult) => void; options: InternalDinteroEmbedCheckoutOptions; handlers: ({ handler: SubscriptionHandler; eventTypes: InternalCheckoutEvents[]; } | { handler: SubscriptionHandler | undefined; eventTypes: CheckoutEvents[]; })[]; session: Session | undefined; popOutWindow: Window | undefined; } export interface DinteroCheckoutOptions { sid: string; endpoint?: string; language?: string; } export interface DinteroEmbedCheckoutOptions extends DinteroCheckoutOptions { container: HTMLDivElement; popOut?: boolean; ui?: "inline" | "fullscreen"; onPayment?: (event: SessionPaymentAuthorized | SessionPaymentOnHold, checkout: DinteroCheckoutInstance) => void; /** * @deprecated Since version 0.0.1. Will be deleted in version 1.0.0. Use onPayment instead. */ onPaymentAuthorized?: (event: SessionPaymentAuthorized, checkout: DinteroCheckoutInstance) => void; onSession?: (event: SessionLoaded | SessionUpdated, checkout: DinteroCheckoutInstance) => void; onPaymentError?: (event: SessionPaymentError, checkout: DinteroCheckoutInstance) => void; onSessionCancel?: (event: SessionCancel, checkout: DinteroCheckoutInstance) => void; onSessionNotFound?: (event: SessionNotFound, checkout: DinteroCheckoutInstance) => void; onSessionLocked?: (event: SessionLocked, checkout: DinteroCheckoutInstance, callback: () => void) => void; onSessionLockFailed?: (event: SessionLockFailed, checkout: DinteroCheckoutInstance) => void; onActivePaymentType?: (event: ActivePaymentProductType, checkout: DinteroCheckoutInstance) => void; onValidateSession?: (event: ValidateSession, checkout: DinteroCheckoutInstance, callback: (result: SessionValidationCallback) => void) => void; onAddressCallback?: (event: AddressCallback, checkout: DinteroCheckoutInstance, callback: (result: AddressCallbackResult) => void) => void; } interface InternalDinteroEmbedCheckoutOptions extends DinteroEmbedCheckoutOptions { innerContainer: HTMLDivElement; } /** * Show a dintero payment session in an embedded iframe. */ export declare const embed: (options: DinteroEmbedCheckoutOptions) => Promise; /** * Redirect the customer to a payment session in the Dintero Checkout. */ export declare const redirect: (options: DinteroCheckoutOptions) => void; export type { ActivePaymentProductType, SessionCancel, SessionLoaded, SessionLocked, SessionLockFailed, SessionNotFound, SessionPaymentAuthorized, SessionPaymentError, SessionPaymentOnHold, SessionUpdated, SessionValidationCallback, ValidateSession, } from "./checkout.js";