UNPKG

@chargebee/atomicpricing

Version:

JS wrapper for your Atomic Pricing hosted page

82 lines (81 loc) 3.18 kB
import { EventOptions, EventOptionsLegacy, PricingPageSession } from './pricify/events/defn'; import { Address, Entity, Quantity, SubscriptionAttributes, Visitor } from './types'; type PricingPageContextEntry = { site: string; pricingPageId: string; sessionId?: string; frame: HTMLIFrameElement; iframeUrl: string; pageLoadPromise?: Promise<void>; pageLoadPromiseResolver?: () => void; }; type EventData = Visitor | Quantity | Address | Entity; declare const EventEntities: { readonly VISITOR: { readonly key: "VISITOR"; readonly eventKey: string; }; readonly BILLING_ADDRESS: { readonly key: "BILLING_ADDRESS"; readonly eventKey: string; }; readonly SHIPPING_ADDRESS: { readonly key: "SHIPPING_ADDRESS"; readonly eventKey: string; }; readonly QUANTITY: { readonly key: "QUANTITY"; readonly eventKey: string; }; readonly BUSINESS_ENTITY: { readonly key: "BUSINESS_ENTITY"; readonly eventKey: string; }; readonly PRICE_VARIANT: { readonly key: "PRICE_VARIANT"; readonly eventKey: string; }; readonly SUBSCRIPTION_ATTRIBUTES: { readonly key: "SUBSCRIPTION_ATTRIBUTES"; readonly eventKey: string; }; }; export type Options = { site: string; pricingPage?: string; viewPort: ViewPort; host?: string; preview?: string; currency?: string; period?: string; periodUnit?: string; showCurrencyDropdown?: string; autoSelectLocalCurrency?: string; integrationType?: string; sessionId?: string; gtmId?: string; }; type ViewPort = { width?: string; height?: string; defaultHeight?: string; }; export declare const unsafeInit: () => void; export declare const unsafeOpenPricingTable: ({ pricingTable, }: { pricingTable: () => Promise<PricingPageSession>; }) => Promise<void>; export declare const unsafeOpenPricingPage: ({ pricingPage, }: { pricingPage: () => Promise<PricingPageSession>; }) => Promise<void>; export declare function showLoader(element: HTMLDivElement, options: Options): void; export declare function initializeWithElement(element: HTMLDivElement, options: Options): void; export declare const getPricingPage: (site: string, pricingPageId?: string) => PricingPageContextEntry; export declare const setData: (entity: (typeof EventEntities)[keyof typeof EventEntities], data: EventData, options?: EventOptionsLegacy) => void; export declare const setVisitor: (visitor: Visitor, options?: EventOptions) => void; export declare const setSubscriptionAttributes: (subscriptionAttributes: SubscriptionAttributes, options?: EventOptions) => void; export declare const setBillingAddress: (billingAddress: Address, options?: EventOptions) => void; export declare const setShippingAddress: (shippingAddress: Address, options?: EventOptions) => void; export declare const setQuantity: (quantity: number, options?: EventOptions) => void; export declare const setBusinessEntity: (id: string, options?: EventOptions) => void; export declare const setPriceVariant: (id: string, options?: EventOptions) => void; export {};