UNPKG

@chargebee/atomicpricing

Version:

JS wrapper for your Atomic Pricing hosted page

97 lines (96 loc) 3.48 kB
import { EventOptions, HostedPricingPage } 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; }; export type ViewPort = { width?: string; height?: string; defaultHeight?: string; }; export declare const OptionAttributes: { site: string; pricingPage: string; viewPort: { width: string; height: string; defaultHeight: string; }; host: string; preview: string; currency: string; period: string; periodUnit: string; showCurrencyDropdown: string; autoSelectLocalCurrency: string; integrationType: string; gtmId: string; }; export declare const unsafeInit: (querySelector?: string) => void; export declare const unsafeOpenPricingPage: ({ pricingPage, }: { pricingPage: (() => Promise<HostedPricingPage>) | Promise<HostedPricingPage>; }) => 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?: EventOptions) => 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 {};