import { ActionType, AgreementConfiguration, AuthorizationFrequency, AuthorizationSource, BillingDetails, CustomerType, EnvironmentSettings, InstructionDirection, OperationType, SessionStatus, SessionType } from "@imburseag/types"; import { supportedCSSVariables, supportedLanguages, supportedModes } from "./consts"; export type Nullable = T | null; export interface ComponentResizeEventDetails { height: number; } export interface NoContentResponse { success: boolean; } export interface SuccessResponse { success: true; data: T; } export interface FailedResponse { success: false; error: string; } export type APIResponse = SuccessResponse | FailedResponse; export interface SessionStatusWordingProps { status: SessionStatus; type?: OperationType; direction?: InstructionDirection; isPaymentSession?: boolean; } export interface Environment extends EnvironmentSettings { apiBaseURL: string; } export type ThemeCSSVariables = (typeof supportedCSSVariables)[number]; export interface PaymentOptionsLanguage { noPaymentOptionsText: string; paymentAmountText: string; selectPaymentMethodText: Record; backToSelectPaymentMethodText: string; } export interface DeleteConfirmationLanguage { descriptionText: string; disclaimerText: string; errorText: string; deleteButtonText: string; cancelButtonText: string; dismissButtonText: string; } export interface FinancialInstrumentDetailsLanguage { card: CardDetailsLanguage; } export interface CardDetailsLanguage { expDate: string; } export interface TabsLanguage { savedInstrumentsText: TabLanguage; addInstrumentText: TabLanguage; } export interface TabLanguage { fullText: string; minifiedText: string; } export interface WalletErrorsLanguage { httpErrorText: string; declinedText: string; } export interface WalletLanguage { selectFinancialInstrumentText: string; addFinancialInstrumentText: string; payWithFinancialInstrumentText: string; deleteConfirmation: DeleteConfirmationLanguage; financialInstrumentDetails: FinancialInstrumentDetailsLanguage; tabs: TabsLanguage; errors: WalletErrorsLanguage; } interface SessionStatusLanguage { successText: string; failedText: string; processingText: string; } interface MandateSessionStatusLanguage { registration: SessionStatusLanguage; amendment: SessionStatusLanguage; } export interface StatusLanguage { paymentSession: Record; mandateSession: MandateSessionStatusLanguage; financialInstrumentSession: SessionStatusLanguage; } export type ErrorsLanguage = { [key in ErrorType]: string; }; export interface Language { loading: string; wallet: WalletLanguage; paymentOptions: PaymentOptionsLanguage; status: StatusLanguage; errors: ErrorsLanguage; } export type SupportedModes = (typeof supportedModes)[number]; export type SupportedLanguages = (typeof supportedLanguages)[number]; export type Languages = { [key in SupportedLanguages]: Language; }; export type CustomerToken = string; export type ErrorType = "customerForgotten" | "sessionError" | "componentError" | "sessionTokenInvalid" | "sessionTokenExpired" | "unsupportedLanguage"; export type ErrorState = IsErrorState | IsNotErrorState; type IsErrorState = { isError: true; type: ErrorType; }; type IsNotErrorState = { isError: false; }; export interface SessionCompletionEvent { sessionType: OperationType; selectedPaymentOption?: string; direction?: InstructionDirection; } export type Anything = any; export type CreateMandateAppComponentParams = { sessionType: SessionType | null; token: string; language: string; baseURL: string; returnURL: string; componentName: string; appBrandName: string; appID: string; sessionID: string; action: ActionType | null; mandateId: string; customerType: CustomerType; customer?: BillingDetails; agreement?: AgreementConfiguration | null; authorizationSource?: AuthorizationSource | null; authorizationFrequency?: AuthorizationFrequency | null; authorizationFrequencyOtherWording?: Record | null; }; export type CreateCheckoutAppComponentParams = { sessionType: SessionType | null; token: string; language: string; baseURL: string; returnURL: string; paymentMethodId: string; componentName: string; appBrandName: string; appID: string; sessionID: string; direction: InstructionDirection; amount: number; currency: string; customerType: CustomerType; customer?: BillingDetails; schemeSupportsWallet: boolean; paymentMethodSupportsWallet: boolean; agreement?: AgreementConfiguration | null; authorizationSource?: AuthorizationSource | null; authorizationFrequency?: AuthorizationFrequency | null; authorizationFrequencyOtherWording?: Record | null; }; export type IntegrationMode = "Iframe" | "HostedPage" | "CDN" | "SelfHosted" | "Unknown"; export type WalletCheckoutRequest = { financialInstrumentId: string; appPaymentMethodId: string; redirectUrl: string; }; export type WalletCheckoutResponse = { status: string; declineCode?: string; declineMessage?: string; actionType?: string; redirectUrl?: string; }; export {};