import 'isomorphic-unfetch'; import Big from 'big.js'; import { Product, TourFormValue, LegacyHotelFormValue, GlobaltixFormValue, HotelbedsFormValue, HotelbedsStaticData, HotelbedsBookingForm, HotelbedsCheckRateResponse, OutboundFormValue, AnyTourFormValue, TourType } from './order-product-compute'; import React from "react"; import { FlightSearch, FlightDetail, PriceRules, Tour, PriceRule, Order, v2_PrivateTour, v2_GroupTour } from './types'; export interface TcResponse { loading?: boolean; error?: string; result?: T; } export interface LegacyHotelsParams { cityCode: string; checkInDate: string; checkOutDate: string; adults: number | string; children: number | string; } export interface FlightsParams { source: string; 'od1.origin_airport.code': string; 'od1.destination_airport.code'?: string; 'od1.origin_datetime': string; 'od2.origin_airport.code': string; 'od2.destination_airport.code'?: string; 'od2.origin_datetime'?: string; cabin?: string; ptc_adt: number; ptc_cnn: number; ptc_inf: number; } export interface FlightParams { source: string; 'od1.id': string; 'od2.id'?: string; ptc_adt: number; ptc_cnn: number; ptc_inf: number; 'pricing.id'?: string; } export interface LegacyHotelParams { hotelId: string; checkInDate: string; checkOutDate: string; adults: number | string; children: number | string; } export interface TourParams { 'categories.name': string; '~boolean': string; } export declare const setupUserback: (token?: string) => void; export declare const setupGtm: (Router: any, config: { [key: string]: any; tcUser: string; currency?: string; googleTagMangerId?: string; googleAnalyticsTrackingId?: string; }) => void; export declare const setupGtag: (Router: any, config: { [key: string]: any; tcUser: string; currency?: string; googleAnalyticsTrackingId?: string; }) => void; export declare const setupFacebookPixel: (Router: any, config: { [key: string]: any; tcUser: string; currency?: string; facebookPixelId?: string; }) => void; export declare function redirectToPayment(options: { orderRef: string; tcUser: string; paymentProcessor: string; amount?: string; successPage: string; failurePage: string; }): Promise; export declare function urlParam(params: any): string; export declare function isValidNumericId(id: any): boolean; export declare type TravelCloudClientConfig = { tcUser: string; domain?: string; defaultTitle?: string; companyName?: string; googleAPIKey?: string; facebookPixelId?: string; flightDataSource?: string; locale?: string; translation?: string; }; export declare class TravelCloudClient { config: TravelCloudClientConfig; get(endpoint: string, params: any, disableCache?: boolean, headers?: {}): Promise>; cancelPendingGetRequests(endpoint: string): void; post(endpoint: string, params: any, data: any, headers?: {}): Promise; constructor(config: TravelCloudClientConfig); getDocument(path: string, domain?: string): Promise; autoComplete(params: { type: string; search?: string; values?: string | string[]; }): Promise>; private autoCompleteTimeout; hotelbedsAutoComplete(params: { search: string; }): Promise; hotelbedsDefaultCityCodes(params: { search: string[]; }): Promise; iataAutoComplete(query: { query: string; airportCodes: string; }): Promise>; iataCarriers(query: { query: string; carrierCodes?: string; }): Promise>; priceRules(paramsRaw: any): Promise>; limits(limitCodes: string[], headers?: {}): Promise>; tours(paramsRaw: any): Promise>; privateTours(params?: {}): Promise>; privateTour(paramsRaw: any): Promise>; groupTours(params?: {}): Promise>; groupTour(paramsRaw: any): Promise>; generics(paramsRaw: any): Promise>; generic(paramsRaw: any): Promise>; documents(paramsRaw: any): Promise>; document(paramsRaw: any): Promise>; tour(paramsRaw: any): Promise>; globaltix(endpoint: string, params?: {}): Promise>; outboundGet(endpoint: string, params?: {}): Promise>; outboundPost(endpoint: string, params: {}, payload: any): Promise; cancelFlights(): void; flights(params: FlightsParams, sample?: boolean): Promise>; flightsChange(params: FlightsParams, sample?: boolean): Promise>; flight(params: FlightParams, sample?: boolean): Promise>; fareRules(params: any): Promise>; flightAncillaries(params: FlightParams): Promise>; legacyHotels(params: LegacyHotelsParams): Promise>; legacyHotel(params: LegacyHotelParams): Promise>; private removeKeys; hotelbedsCheckRates(rateKeys: string[]): Promise; hotelbedsAvailability(formValue: HotelbedsFormValue): Promise; hotelbedsFromStaticDataByDestinationCode(destinationCode: string): Promise; hotelbedsFromStaticData(codes: Array): Promise; hotelbedsCategories(): Promise; hotelbedsRateComments(hotel: number, codes: number[]): Promise; hotelbedsFacilityTypes(): Promise; hotelbedsTerminalTypes(): Promise; hotelbedsImageTypes(): Promise; getRoomCharacteristicMap(chArr: Array): Promise; boards(): Promise; hotelbedsSearch(searchFormValue: HotelbedsFormValue, limit?: number): Promise; order(params: any): Promise>; categories(params: any): Promise>; submitContactForm(structured: { referral_site: string; subject: string; customer_name: string; customer_email: string; }, unstructured: { [key: string]: string; }): Promise; emailAdmins(structured: { referral_site?: string; subject?: string; customer_name?: string; customer_email: string; admin_emails?: string[]; }, unstructured: { [key: string]: string; }): Promise; subscribeEdm(structured: { email: string; mailchimp_list_id?: string; sendinblue_list_ids?: string[]; hubspot_list_id?: number; attributes: { [key: string]: string; }; }): Promise; } export declare function validateEmail(email: any): boolean; export declare const validateFlightsParams: (state: any) => { source: any; "od1.origin_airport.code": any; "od1.origin_city.code": any; "od1.origin_datetime": any; "od1.destination_airport.code": any; "od1.destination_city.code": any; "od2.origin_airport.code": any; "od2.origin_city.code": any; "od2.origin_datetime": any; "od2.destination_airport.code": any; "od2.destination_city.code": any; "od3.origin_airport.code": any; "od3.origin_city.code": any; "od3.origin_datetime": any; "od3.destination_airport.code": any; "od3.destination_city.code": any; "od4.origin_airport.code": any; "od4.origin_city.code": any; "od4.origin_datetime": any; "od4.destination_airport.code": any; "od4.destination_city.code": any; ptc_adt: any; ptc_cnn: any; ptc_inf: any; cabin: any; }; export declare const validateFlightsChangeParams: (state: any) => { source: any; "od1.origin_airport.code": any; "od1.origin_city.code": any; "od1.origin_datetime": any; "od1.destination_airport.code": any; "od1.destination_city.code": any; "od2.origin_airport.code": any; "od2.origin_city.code": any; "od2.origin_datetime": any; "od2.destination_airport.code": any; "od2.destination_city.code": any; "od3.origin_airport.code": any; "od3.origin_city.code": any; "od3.origin_datetime": any; "od3.destination_airport.code": any; "od3.destination_city.code": any; "od4.origin_airport.code": any; "od4.origin_city.code": any; "od4.origin_datetime": any; "od4.destination_airport.code": any; "od4.destination_city.code": any; cabin: any; product_source_ref: any; }; export declare const validateFlightParams: (state: any) => { source: any; 'od1.id': any; 'od2.id': any; 'pricing.id': any; ptc_adt: any; ptc_cnn: any; ptc_inf: any; }; export declare const validateHotelbedsParams: (state: any) => boolean; export declare const validateLegacyHotelParams: (state: any) => { hotelId: any; checkInDate: string; duration: number; adults: any; children: any; }; export declare const validateLegacyHotelsParams: (state: any) => { cityCode: any; checkInDate: string; duration: number; adults: any; children: any; }; export declare function nextDeparture(options: any): any; export declare function dateToIsoDate(date: Date): string; export declare function extractValueFromFormState(form: any): any; export declare function mergeFormState(existing: any, updates: any): any; export declare const updateFormState: (rc: React.Component, key: string) => (changes: any) => void; export declare function sleep(ms: any): Promise; export declare class Cart { static localStorageTestKey: string; static localStorageOrderKey: string; static localStorageCustomerKey: string; static localStoragePriceRulesKey: string; static localStorageTokenKey: string; demo: boolean; limits: any; customer: any; order: any; lastComputed: any; private token; private openIdToken; private checkoutInProgreass; priceRules: TcResponse; private bcryptCache; private client; private onOrderChange; private onCustomerChange; private onPriceRulesChange; private getStateFromLocalStorage; constructor(options: { client: TravelCloudClient; priceRules?: any; onOrderChange: (order: any) => any; onCustomerChange: (customer: any) => any; onPriceRulesChange?: (priceRules: TcResponse) => any; }); saveOrderSnapshot(): void; restoreOrderSnapshot(): void; getPassword(email: string): Promise; login(email: string, login_password: string): Promise; openIdLogin(id_token: string): Promise<{ result: { email: any; name: any; openid_aud: any; openid_iss: any; openid_sub: any; }; }>; priceRulesWithCheckoutCode(code: string): PriceRules; setCheckoutCode(checkoutCode: string): void; payOrderWithCustomerCredit(ref: string, amount?: string): Promise; logout(): void; refreshCustomer(): Promise; addTour(tour: any, tourFormValue: TourFormValue, mock?: boolean): Product | null; addAnyTour(privateTour: v2_PrivateTour | v2_GroupTour, AnyTourFormValue: AnyTourFormValue, tourType: TourType, mock?: boolean): Product | null; addGlobaltix(item: any, globaltixFormValue: GlobaltixFormValue, mock?: boolean): Product | null; addLegacyHotel(details: any, legacyHotelFormValue: LegacyHotelFormValue, mock?: boolean): Product; addOutboundTour(details: any, outboundFormValue: OutboundFormValue, mock?: boolean): Product; addHotelbedsHotel(data: { static: any; checkrates: HotelbedsCheckRateResponse; }, bookingForm: HotelbedsBookingForm, mock?: boolean): Product; addFlight(flight: FlightDetail, pricing_id: string, mock?: boolean): Product; addFlightWithAncillaries(flight: FlightDetail, ancillaries: { pricing_id: string; seats?: any; services?: any; prime_workflow?: boolean; search_id?: string; }, mock?: boolean): Product; addFlightChangeWithAncillaries(flight: FlightDetail, pricingId: string, product_source_ref: string, ancillaries: { seats?: any; }, mock?: boolean): Product; addFlightChangeServices(flight: FlightDetail, product_source: string, product_source_ref: string, ancillaries: { services?: any; seats?: any; }, mock?: boolean): Product; addGeneric(generic: any, params: { generic_id: string; option_id: string; quantity: number; unstructured?: any; }, mock?: boolean): Product; checkout(checkoutFormValue: any): Promise>; reset(): this; addProduct(product: Product, mock?: boolean): Product | null; removeProductByIndex(index: any): void; removeProductByName(name: any): void; setPriceRules(priceRules: any): void; refreshPriceRules(force?: boolean): Promise; refreshLimits(limit_codes: string[]): Promise; getCombinedPriceRules(): PriceRule[]; private updateOrder; private updateCustomer; } export declare const useCart: (tcUser: string, priceRulesDefault?: {}) => { customer: any; order: any; cart: any; client: any; initCart: any; priceRules: any; }; /************ * Utilities * *************/ export declare function formatCurrency(x: any, decimalPlace?: number): string; export declare function objectEntries(obj: any): any[]; export declare function formArrayWrapper({ RenderForm, name, form }: { RenderForm: any; name: string; form: any; }): any; export declare function mapTourOptionDepartures(option: Tour["options"][0], func: (departure: Tour["options"][0]["departures"][0], departureDate: string) => T): T[]; export declare const isEmptyObject: (obj: any) => boolean; export declare function groupBy(arr: Array, callback: (any: any) => any, returnType?: string): any; export declare function identity(val: any): any; export declare const range: (count: number) => any; export declare function sortBy(arr: any, fn: (input: any) => any, sortOrder?: string): any[]; export declare function getHeadAndTail(arr: Array, fn: (input: T) => any): [T, T]; export declare function overlap(arr: any): Array>; export declare function chain(input: any, fns: Array<(arr: any) => any>): any; export declare function isDateRangeOverlap(range1: [Date, Date], range2: [Date, Date]): boolean; export declare function firstCapitalLastLower(name: string): string; export declare function parseCookie(rawCookie: string): {}; export declare function setCookie(key: any, value: any, response?: any): void; export declare function loadi18n(resources: any, defaultLocale: any, cookieSupport?: boolean, headers?: any): Promise; export declare function omit(pairs: any, keys: string[]): any; export declare function purify(pairs: any): any; export declare function resolvePath(...args: string[]): string; export declare type ProductBreakdown = { product_breakdown: { [price_type: string]: string; }; price_rule_items: any[]; product_total: Big; grand_total: Big; }; export declare function computeProductBreakdown(product: Product): ProductBreakdown;