@adyen/adyen-web
Version:
[](https://www.npmjs.com/package/@adyen/adyen-web)
87 lines (86 loc) • 3.46 kB
TypeScript
import { h } from 'preact';
import BaseElement from './BaseElement';
import { PaymentAction } from '../types';
import { PaymentResponse } from './types';
import { IUIElement, PayButtonFunctionProps, RawPaymentResponse, UIElementProps } from './types';
import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';
import { UIElementStatus } from './types';
import { CoreOptions } from '../core/types';
import Core from '../core';
import { AnalyticsInitialEvent, SendAnalyticsObject } from '../core/Analytics/types';
export declare class UIElement<P extends UIElementProps = any> extends BaseElement<P> implements IUIElement {
protected componentRef: any;
elementRef: UIElement;
constructor(props: P);
setState(newState: object): void;
protected onChange(): object;
protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent): Promise<any>;
/**
* A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:
* - mounted,
* - a PM has been selected
* - onSubmit has been called (as a result of the pay button being pressed)
*
* In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created
*/
protected submitAnalytics(analyticsObj: SendAnalyticsObject): void;
private onSubmit;
private onValid;
onComplete(state: any): void;
/**
* Submit payment method data. If the form is not valid, it will trigger validation.
*/
submit(): void;
showValidation(): this;
setElementStatus(status: UIElementStatus, props?: any): this;
setStatus(status: UIElementStatus, props?: any): this;
private submitPayment;
private submitAdditionalDetails;
protected handleError: (error: AdyenCheckoutError) => void;
protected handleAdditionalDetails: (state: any) => any;
handleAction(action: PaymentAction, props?: {}): UIElement | null;
protected handleOrder: (response: PaymentResponse) => void;
protected handleFinalResult: (result: PaymentResponse) => PaymentResponse;
/**
* Handles a session /payments or /payments/details response.
* The component will handle automatically actions, orders, and final results.
* @param rawResponse -
*/
protected handleResponse(rawResponse: RawPaymentResponse): void;
/**
* Call update on parent instance
* This function exist to make safe access to the protect _parentInstance
* @param options - CoreOptions
*/
updateParent(options?: CoreOptions): Promise<Core>;
setComponentRef: (ref: any) => void;
/**
* Get the current validation status of the element
*/
get isValid(): boolean;
/**
* Get the element icon URL for the current environment
*/
get icon(): string;
/**
* Get the element's displayable name
*/
get displayName(): string;
/**
* Used to display the second line of a payment method item
*/
get additionalInfo(): string;
/**
* Get the element accessible name, used in the aria-label of the button that controls selected payment method
*/
get accessibleName(): string;
/**
* Return the type of an element
*/
get type(): string;
/**
* Get the payButton component for the current element
*/
protected payButton: (props: PayButtonFunctionProps) => h.JSX.Element;
}
export default UIElement;