import { EnvironmentOptions } from '../../types/internal'; import { ElementEventHandler, ElementEventType } from '../../interfaces/ElementEvent/types'; import UseCase, { UseCaseOrString } from '../../interfaces/UseCase/types'; import { ForageElementBase, ForageElementOptions } from '../../interfaces/Element/types'; import { FrameMessageTransmitterType } from '../../services/frame-messaging/transmitter'; import { Appearance } from '../../interfaces'; import { IframeEventCallback, SubmitFailureEvent, SubmitSuccessEvent } from '../../services/frame-messaging/receiver/iframe-events.interface'; import { IframeConfig, PaymentSheetConfig } from '../../services/frame-messaging/transmitter/sdk-cmds.interface'; import { Transmitter } from '../../services/frame-messaging/transmitter/types'; export declare class ForageElement implements ForageElementBase { private _merchantId; private _sessionToken; private _environment; private _useCase; private _useCaseToElementNameMap; private _frameId; private _appearance?; protected _elementOptions?: ElementOptions; private _paymentSheetConfig?; private _htmlContainerElement; private _forageInputIframe; private _mounted; private _destroyed; protected _transmitter: TransmitterType | null; private _receiver; protected _useCdn: boolean; constructor({ merchantId, sessionToken, environment, useCase, appearance, elementOptions, paymentSheetConfig, useCaseToElementNameMap, useCdn, }: { merchantId: string; sessionToken: string; environment: EnvironmentOptions; useCase: UseCaseOrString; useCaseToElementNameMap?: Record; appearance?: Appearance; elementOptions?: ElementOptions; paymentSheetConfig?: PaymentSheetConfig; useCdn: boolean; }); on: (type: ElementEventType, handler: ElementEventHandler) => void; mount: (htmlContainerElementId: string) => void; focus: () => void; clear: () => void; destroy: () => void; _onSubmitSuccess: (callback: IframeEventCallback) => void; _onSubmitFailure: (callback: IframeEventCallback) => void; _getUsecase: () => UseCase; _getTransmitter: () => NonNullable; _isMounted: () => boolean; _isNotMounted: () => boolean; _isDestroyed: () => boolean; protected _initializeTransmitter(env: EnvironmentOptions, frame: Transmitter): void; protected _sendInitializeIframeCmd(iframeConfig: IframeConfig): void; /** * @throws {Error} if _elementOptions is invalid */ protected _validateElementOptions(elementOptions: T | undefined): void; protected _getCommonIframeConfig: () => IframeConfig; /** * @description Verifies that the element is mounted, not destroyed, and has active transmitter */ private _canTransmitToElement; /** * @description We wait for the forage-input-iframe to send an INPUT_HELLO signal * before we send the INITIALIZE_IFRAME command * We log a warning if it takes longer than MOUNT_TIMEOUT_WARNING_MS seconds * * @throws {ForageError} We reject with timeout error if it takes * longer than MOUNT_TIMEOUT_FATAL_ERROR_MS seconds * to receive the INPUT_HELLO command */ private _waitForHelloCmd; }