import { HostedPageInterface } from './hosted-page.interface'; /** * Type Definitions for Chargebee JS SDK. */ export declare enum CSSClass { focus = "focus", empty = "empty", invalid = "invalid", complete = "complete" } export declare enum InternalCSSClass { focus = "is-focused", empty = "is-empty", invalid = "is-invalid", complete = "is-complete", valid = "is-valid" } export declare enum Options { currency = "currency", classes = "classes", style = "style", fonts = "fonts", locale = "locale", placeholder = "placeholder", field = "field", icon = "icon", ariaLabel = "ariaLabel" } export declare enum StyleSections { base = "base", invalid = "invalid", empty = "empty" } export declare enum CustomCSSProperty { iconColor = "iconColor" } export declare enum StdCSSProperty { color = "color", background = "background", backgroundColor = "backgroundColor", letterSpacing = "letterSpacing", textAlign = "textAlign", textTransform = "textTransform", textDecoration = "textDecoration", textShadow = "textShadow", lineHeight = "lineHeight", webkitTextColor = "webkitTextColor" } export declare enum FontProperty { src = "src", fontFamily = "fontFamily", fontSize = "fontSize", fontSmoothing = "fontSmoothing", fontStyle = "fontStyle", fontWeight = "fontWeight", fontVariant = "fontVariant" } export declare enum PseudoCSSProperty { hover = ":hover", focus = ":focus", disabled = ":disabled", placeholder = "::placeholder", selection = "::selection", autofill = ":-webkit-autofill", focusPlaceholder = ":focus::placeholder" } export declare enum PlaceholderEnum { number = "number", expiry = "expiry", cvv = "cvv" } export declare enum FieldOption { required = "required", show = "show" } export declare enum Field { number = "number", expiry = "expiry", cvv = "cvv" } export declare enum AriaLabelEnum { number = "number", expiry = "expiry", cvv = "cvv" } export declare enum ComponentFieldType { Combined = "combined", Number = "number", CVV = "cvv", Expiry = "expiry" } export declare enum Events { blur = "blur", focus = "focus", error = "error", change = "change", ready = "ready", setTranslations = "setTranslations" } export declare enum ComponentType { Card = "card", Bank = "bank_account", IDeal = "ideal", Dotpay = "dotpay", Paypal = "paypal", Netbanking = "netbanking", Applepay = "applepay" } export declare enum PaymentIntentStatus { INITED = "inited", IN_PROGRESS = "in_progress", AUTHORIZED = "authorized", CONSUMED = "consumed" } export declare enum PaymentMethodType { CARD = "card", IDEAL = "ideal", SOFORT = "sofort", BANCONTACT = "bancontact", GOOGLE_PAY = "google_pay", PAYPAL_EXPRESS_CHECKOUT = "paypal_express_checkout", DOTPAY = "dotpay", GIROPAY = "giropay", Netbanking_EMANDATES = "netbanking_emandates", APPLEPAY = "apple_pay", UPI = "upi", DIRECT_DEBIT = "direct_debit" } export declare enum Gateway { STRIPE = "stripe", ADYEN = "adyen", BRAINTREE = "braintree", SPREEDLY = "spreedly", CHARGEBEE = "chargebee", CHECKOUT_COM = "checkout_com", CYBERSOURCE = "cybersource", BLUESNAP = "bluesnap", INGENICO_DIRECT = "ingenico_direct", WORLDPAY = "worldpay", AUTHORIZE_NET = "authorize_net", MOLLIE = "mollie", RAZORPAY = "razorpay", CHARGEBEE_PAYMENTS = "chargebee_payments" } export declare enum PaymentAttemptStatus { INITED = "inited", REQUIRES_IDENTIFICATION = "requires_identification", REQUIRES_CHALLENGE = "requires_challenge", REQUIRES_REDIRECTION = "requires_redirection", AUTHORIZED = "authorized", REFUSED = "refused" } export declare enum Layout { IN_APP = "in_app", FULL_PAGE = "full_page" } export declare enum Module { COMPONENTS = "components", THREE_DS_HANDLER = "3ds-handler", FUNCTIONS = "functions", IDEAL = "ideal", SOFORT = "sofort", GOOGLE_PAY = "google-pay", BANCONTACT = "bancontact", DOTPAY = "dotpay", GIROPAY = "giropay", PAYPAL = "paypal", NETBANKING_EMANDATES = "netbanking_emandates", APPLE_PAY = "apple-pay", UPI = "upi" } export type OpenCheckoutOptions = { hostedPage: () => Promise; layout: Layout; loaded: () => void; error: (error: string) => void; success(hostedPageId: string): void; close: () => void; step(currentStep: string): void; }; interface AddressDetails { first_name?: string; last_name?: string; company?: string; phone?: string; email?: string; line1?: string; line2?: string; city?: string; state?: string; state_code?: string; country?: string; zip?: string; } type BillingAddress = AddressDetails; type ShippingAddress = AddressDetails; interface AddOn { id: string; quantity?: number; quantity_in_decimal?: string; } type EventBasedAddon = { id?: string; quantity?: number; unit_price?: number; service_period_in_days?: number; on_event?: 'subscription_creation' | 'subscription_trial_start' | 'plan_activation' | 'subscription_activation'; charge_once?: boolean; charge_on?: 'immediately' | 'on_event'; }; type ChargeItem = AddOn; interface Product { setPlanQuantity(planQuantity: number): Product; setPlanQuantityInDecimal(decimalQuantity: string): Product; incrementPlanQuantity(): Product; decrementPlanQuantity(): Product; addAddon(addon: AddOn | string): Product; removeAddon(addon: AddOn | string): Product; setAddons(addons: Array): Product; incrementAddonQty(addonId: string): Product; decrementAddonQty(addonId: string): Product; addCoupon(couponCode: string): Product; removeCoupon(couponCode: string): Product; setCustomData(data: object /** Object containing subs custom fields */): Product; getLayout(): Layout; setLayout(layout: Layout): void; setCharges(charges: Array): Product; addCharge(chargeItem: ChargeItem): Product; removeCharge(chargeItemId: string): Product; incrementChargeQty(chargeItemId: string): Product; decrementChargeQty(chargeItemId: string): Product; } interface Cart { replaceProduct(product: Product): Cart; proceedToCheckout(): void; setBusinessEntity(businessEntityId: string): Promise; setAffiliateToken(token: string): Cart; setCustomer(customer: Customer): Cart; setShippingAddress(shippingAddress: ShippingAddress): Cart; } export interface PortalCallbacks { loaded: () => void; close: () => void; visit(sectionType: string): void; paymentSourceAdd: () => void; paymentSourceUpdate: () => void; paymentSourceRemove: () => void; subscriptionChanged(data: { subscription: { id: string; }; }): void; subscriptionCustomFieldsChanged(data: { subscription: { id: string; }; }): void; subscriptionCancelled(data: { subscription: { id: string; }; }): void; subscriptionResumed(data: { subscription: { id: string; }; }): void; subscriptionPaused(data: { subscription: { id: string; }; }): void; scheduledPauseRemoved(data: { subscription: { id: string; }; }): void; scheduledCancellationRemoved(data: { subscription: { id: string; }; }): void; subscriptionReactivated(data: { subscription: { id: string; }; }): void; } export declare enum PortalSectionTypeEnum { SUBSCRIPTION_DETAILS = "sub_details", SUBSCRIPTION_CANCELLATION = "sub_cancel", EDIT_SUBSCRIPTION = "edit_subscription", VIEW_SCHEDULED_CHANGES = "scheduled_changes", ACCOUNT_DETAILS = "account_details", EDIT_ACCOUNT_DETAILS = "portal_edit_account", ADDRESS = "portal_address", EDIT_BILLING_ADDRESS = "portal_edit_billing_address", EDIT_SHIPPING_ADDRESS = "portal_edit_shipping_address", EDIT_SUBSCRIPTION_CUSTOM_FIELDS = "portal_edit_subscription_cf", PAYMENT_SOURCES = "portal_payment_methods", ADD_PAYMENT_SOURCE = "portal_add_payment_method", EDIT_PAYMENT_SOURCE = "portal_edit_payment_method", VIEW_PAYMENT_SOURCE = "portal_view_payment_method", CHOOSE_PAYMENT_METHOD_FOR_SUBSCRIPTION = "portal_choose_payment_method", BILLING_HISTORY = "portal_billing_history" } export interface PortalForwardOptions { sectionType: string; params: { subscriptionId: string; paymentSourceId: string; }; } export interface PortalOpenSectionOptions { sectionType: string; params: { subscriptionId: string; }; } export interface Portal { open(options: PortalCallbacks, forwardOptions: PortalForwardOptions): void; openSection(options: PortalOpenSectionOptions, callbacks: PortalCallbacks): void; } interface SetCheckoutCallbacks { loaded: () => void; error: () => void; success(hostedPageId: string): void; close: () => void; step(currentStep: string): void; } interface SetPaymentIntentOptions { stripe: object; braintree: object; adyen: object; } type CardInfo = { number: string; expiryMonth: string; expiryYear: string; cvv: string; firstName?: string; lastName?: string; }; type PaymentInfo = { element?: any; card?: CardInfo; tokenizer?: () => void; cbToken?: string; cardComponent?: string; additionalData?: AdditionalData; }; interface ThreeDSHandler { setPaymentIntent(paymentIntent: PaymentIntent, options: SetPaymentIntentOptions): void; updatePaymentIntent(paymentIntent: PaymentIntent): void; handleCardPayment(paymentInfo: PaymentInfo, callbacks: Callbacks): Promise; getPaymentIntent(): PaymentIntent; } type PaymentCallbacks = { change: () => void; success: () => void; error: () => void; }; type PaymentOptions = { paymentIntent: () => void; paymentInfo: PaymentInfo; callbacks: PaymentCallbacks; redirectMode: boolean; }; type Subscription = { id?: string; plan_id: string; plan_quantity?: number; plan_unit_price?: number; setup_fee?: number; start_date?: number; trial_end?: number; }; type CommonSubscriptionEstimate = { customer?: Customer; subscription?: Subscription; billing_cycles?: number; terms_to_charge?: number; invoice_immediately?: boolean; billing_alignment_mode?: 'immediate' | 'delayed'; shipping_address?: ShippingAddress; billing_address?: BillingAddress; coupon_ids?: Array; addons?: Array; event_based_addons?: Array; mandatory_addons_to_remove?: Array; }; type CreateSubscriptionEstimate = CommonSubscriptionEstimate & { client_profile_id?: string; }; type UpdateSubscriptionEstimate = CommonSubscriptionEstimate & { replace_addon_list?: boolean; reactivate_from?: number; replace_coupon_list?: boolean; prorate?: boolean; end_of_term?: boolean; force_term_reset?: boolean; reactivate?: boolean; include_delayed_charges?: boolean; use_existing_balances?: boolean; }; type SubscriptionRenewalEstimate = { id: string; subscription?: { id: string; }; include_delayed_charges?: boolean; use_existing_balances?: boolean; ignore_scheduled_cancellation?: boolean; ignore_scheduled_changes?: boolean; }; interface EstimatesFunctions { createSubscriptionEstimate(payload: CreateSubscriptionEstimate): Promise /** Resource object representing estimate */; updateSubscriptionEstimate(payload: UpdateSubscriptionEstimate): Promise /** Resource object representing estimate */; renewSubscriptionEstimate(payload: SubscriptionRenewalEstimate): Promise /** Resource object representing estimate */; } type VatValidationParams = { country: string; vat_number: string; }; type VatValidationResponse = { status: 'VALID' | 'INVALID' | 'UNDETERMINED'; message: string; }; interface VatFunctions { validateVat(payload: VatValidationParams): VatValidationResponse; } export type ChargebeeInstance = { site: string; publishableKey: string; createComponent(type: ComponentType, options: ComponentOptions): ChargebeeComponent; tokenize(component: Component, additionalData: object): void; /** Checkout and Portal Integration */ setBusinessEntity(businessEntityId: string): Promise; openCheckout(options: OpenCheckoutOptions): void; getCart(): Cart; getProduct(checkoutButtonElement: HTMLElement): Product; initializeProduct(planId: string, planQuantity: number): Product; setCheckoutCallbacks(setterFunction: (cart: Cart) => SetCheckoutCallbacks): void; createChargebeePortal(): Portal; setPortalSession(setterFunction: () => void): Promise; logout(): void; closeAll(): void; setPortalCallbacks(callbacks: PortalCallbacks): void; /** Payment Integrations */ load(moduleName: string): Promise /** Promise resolves to corresponding module handler */; load3DSHandler(): Promise; create3DSHandler(): ThreeDSHandler; handlePayment(paymentMethodType: PaymentMethodType, paymentOptions: PaymentOptions): Promise /** Promise resolves to authorized payment intent */; /** Functions */ estimates: EstimatesFunctions; vat: VatFunctions; }; type ChargebeeComponent = { createField(fieldType: ComponentFieldType, options: ComponentOptions): ComponentField; at(id: string): ChargebeeComponent; on(event: Events, callback: () => void): ChargebeeComponent; mount(): Promise; destroy(): Promise; }; type ComponentField = { at(id: string): ComponentField; applyStyles(options: ComponentOptions): ComponentField; focus(): void; blur(): void; clear(): void; on(event: Events, callback: () => void): ComponentField; }; type ComponentOptions = { [Options.classes]?: Classes; [Options.style]?: Styles; [Options.fonts]?: Fonts; [Options.field]?: Fields; [Options.locale]?: string; [Options.placeholder]?: Placeholder | string; [Options.ariaLabel]?: AriaLabel | string; }; type Classes = { [CSSClass.focus]?: string; [CSSClass.empty]?: string; [CSSClass.invalid]?: string; [CSSClass.complete]?: string; }; type StyleBlock = CSSStyleBlock & PseudoStyleBlock; type Styles = { [StyleSections.base]: StyleBlock; [StyleSections.empty]: StyleBlock; [StyleSections.invalid]: StyleBlock; }; type Fonts = Array; type FontFace = { fontFamily: string; src?: string; fontStyle?: string; fontWeight?: string; }; export type FieldConfiguration = { [FieldOption.required]?: boolean; [FieldOption.show]?: boolean; }; type Fields = { [Field.number]?: FieldConfiguration; [Field.expiry]?: FieldConfiguration; [Field.cvv]?: FieldConfiguration; }; type FontURL = string; type Placeholder = { [PlaceholderEnum.number]?: string; [PlaceholderEnum.expiry]?: string; [PlaceholderEnum.cvv]?: string; }; type CSSStyleBlock = { [CustomCSSProperty.iconColor]?: string; [StdCSSProperty.color]?: string; [StdCSSProperty.letterSpacing]?: string; [StdCSSProperty.textAlign]?: string; [StdCSSProperty.textTransform]?: string; [StdCSSProperty.textDecoration]?: string; [StdCSSProperty.textShadow]?: string; [StdCSSProperty.lineHeight]?: string; [FontProperty.src]?: string; [FontProperty.fontFamily]?: string; [FontProperty.fontSize]?: string; [FontProperty.fontSmoothing]?: string; [FontProperty.fontStyle]?: string; [FontProperty.fontWeight]?: string; [FontProperty.fontVariant]?: string; }; type PseudoStyleBlock = { [PseudoCSSProperty.hover]?: CSSStyleBlock; [PseudoCSSProperty.focus]?: CSSStyleBlock; [PseudoCSSProperty.disabled]?: CSSStyleBlock; [PseudoCSSProperty.placeholder]?: CSSStyleBlock; [PseudoCSSProperty.selection]?: CSSStyleBlock; [PseudoCSSProperty.autofill]?: CSSStyleBlock; [PseudoCSSProperty.focusPlaceholder]?: CSSStyleBlock; }; type AriaLabel = { [AriaLabelEnum.number]?: string; [AriaLabelEnum.expiry]?: string; [AriaLabelEnum.cvv]?: string; }; type PayerInfo = { customer?: Customer; shipping_address?: Address; billing_address?: Address; }; type PaymentAttempt = { id: string; status: PaymentAttemptStatus; type: string; active: boolean; id_at_gateway?: string; action_payload: any; error_code?: string; error_text?: string; error_msg?: string; }; export type PaymentIntent = { id: string; status: PaymentIntentStatus; amount: number; currency_code: string; gateway_account_id: string; gateway: Gateway; active_payment_attempt?: PaymentAttempt; customer_id?: string; reference_id?: string; payment_method_type: PaymentMethodType; success_url?: string; business_entity_id?: string; payer_info?: PayerInfo; }; export type AdditionalData = { cardBillingAddress?: Address; billingAddress?: Address; customerBillingAddress?: Address; shippingAddress?: Address; customer?: Customer; email?: string; phone?: string; plan?: string; encryptedCardDetails?: string; vaultId?: string; locale?: string; mandate?: Mandate; }; type Mandate = { requireMandate: boolean; description?: string; }; type Customer = { firstName?: string; lastName?: string; email?: string; phone?: string; }; type Address = { firstName?: string; lastName?: string; phone?: string; addressLine1?: string; addressLine2?: string; addressLine3?: string; city?: string; state?: string; stateCode?: string; countryCode?: string; zip?: string | number; }; export type Callbacks = { success?: () => void; error?: () => void; change?: () => void; cancel?: () => void; }; export interface Component { name: string; type: ComponentType; status: number; focus: () => void; clear: () => void; blur: () => void; update: () => void; createField: () => void; mount(id?: string): Promise; framesCreated(): string[]; delegateEvent(event: CustomEvent): void; tokenize(data?: AdditionalData): Promise; authorizeWith3ds(paymentIntent: PaymentIntent, additionalData: AdditionalData, callbacks: Callbacks): Promise; } export {};