import { ActivationRequestFulfillmentType } from '@moonbase.sh/vue'; import { CartItem } from '@moonbase.sh/vue'; import { CheckoutPaymentFailure } from '@moonbase.sh/vue'; import { CheckoutRedirectMode } from '@moonbase.sh/vue'; import { CurrencyDisplay } from '@moonbase.sh/vue'; import { Download } from '@moonbase.sh/vue'; import { InjectionKey } from 'vue'; import { MarketingConsentType } from '@moonbase.sh/vue'; import { Money } from '@moonbase.sh/vue'; import { OpenOrder } from '@moonbase.sh/vue'; import { Order } from '@moonbase.sh/vue'; import { OwnedProduct } from '@moonbase.sh/vue'; import { Storefront } from '@moonbase.sh/vue'; import { StorefrontProduct } from '@moonbase.sh/vue'; import { StorefrontPromotion } from '@moonbase.sh/vue'; import { SubscribeResponse } from '@moonbase.sh/vue'; import { TrailingZeros } from '@moonbase.sh/vue'; import { User } from '@moonbase.sh/vue'; import { Voucher } from '@moonbase.sh/vue'; declare type DeepPartial = T extends object ? { [P in keyof T]?: T[P] extends HTMLElement | undefined ? T[P] : DeepPartial; } : T; export declare const eventEmitterKey: InjectionKey; export declare interface GoogleAnalyticsConfig { measurementId: string; } export declare interface GoogleTagManagerConfig { /** Not used: GTM reads `window.dataLayer` whichever container loaded it. */ containerId?: string; } export declare const instanceKey: InjectionKey; export declare interface IntegrationsConfig { metaPixel?: MetaPixelConfig; googleAnalytics?: GoogleAnalyticsConfig; googleTagManager?: GoogleTagManagerConfig; klaviyo?: KlaviyoConfig; tiktokPixel?: TikTokPixelConfig; } export declare interface KlaviyoConfig { companyId: string; } export declare interface MetaPixelConfig { pixelId: string; } declare const Moonbase_2: MoonbaseImpl; export default Moonbase_2; /** Families the widget ships with, served from Moonbase's own asset host. */ export declare type MoonbaseBuiltInFont = 'Inter' | 'Roboto' | 'EB Garamond' | 'Merriweather' | 'Poppins' | 'PT Serif' | 'Montserrat' | 'Aleo'; export declare interface MoonbaseCustomFont { /** * Any CSS `font-family` list — `'PingFang SC'`, `'"Noto Sans SC", sans-serif'`. Used verbatim, * with the widget's system stack appended as a last resort. */ family: string; /** * Stylesheet providing the face, injected as ``. Absolute or * page-relative. Omit it when the host page already loads the family. */ stylesheet?: string; } export declare enum MoonbaseEvent { SignedIn = "signed-in", SignedUp = "signed-up", SignedOut = "signed-out", Subscribed = "subscribed", RedeemedVoucher = "redeemed-voucher", JoinedGroup = "joined-group", StorefrontUpdated = "storefront-updated", PromotionShown = "promotion-shown", PromotionClicked = "promotion-clicked", PromotionDismissed = "promotion-dismissed", DownloadedProduct = "downloaded-product", ActivatedProduct = "activated-product", AddedToCart = "added-to-cart", CouponRejected = "coupon-rejected", CheckoutInitiated = "checkout-initiated", CheckoutBillingDetailsAdded = "checkout-billing-details-added", CheckoutCouponApplied = "checkout-coupon-applied", CheckoutCouponRemoved = "checkout-coupon-removed", CheckoutPaymentStarted = "checkout-payment-started", CheckoutPaymentFailed = "checkout-payment-failed", CheckoutClosed = "checkout-closed", CheckoutCompleted = "checkout-completed" } export declare interface MoonbaseEventArgs { [MoonbaseEvent.SignedIn]: { user: User; }; [MoonbaseEvent.SignedUp]: { user: User; }; [MoonbaseEvent.SignedOut]: { user: User; }; [MoonbaseEvent.Subscribed]: { email: string; name: string | null; /** * `confirmation_sent` when the account requires double opt-in: the visitor * is only on the list once they click the link in the email that went out. */ status: SubscribeResponse['status']; /** * The group IDs requested, normalized. Not necessarily the ones applied: the * API skips unknown groups and groups closed to sign-ups without a word. */ groupIds?: string[]; /** The drawer's own form, or a `data-moonbase-form` form on the host page. */ source: 'drawer' | 'form'; user?: User | null; }; [MoonbaseEvent.RedeemedVoucher]: { voucher: Voucher; user: User; }; [MoonbaseEvent.JoinedGroup]: { /** The group's ID. The API never tells a storefront a group's name. */ groupId: string; user: User; }; [MoonbaseEvent.StorefrontUpdated]: { storefront: Storefront; user?: User | null; }; [MoonbaseEvent.PromotionShown]: { promotion: StorefrontPromotion; surface: PromotionSurface; user?: User | null; }; [MoonbaseEvent.PromotionClicked]: { promotion: StorefrontPromotion; surface: PromotionSurface; /** Where the shopper is being sent — the promotion's own call-to-action URL. */ url: string; user?: User | null; }; [MoonbaseEvent.PromotionDismissed]: { promotion: StorefrontPromotion; surface: PromotionSurface; user?: User | null; }; [MoonbaseEvent.DownloadedProduct]: { product: OwnedProduct; download: Download; user?: User | null; }; [MoonbaseEvent.ActivatedProduct]: { product: StorefrontProduct; fulfillmentType: ActivationRequestFulfillmentType; user?: User | null; }; [MoonbaseEvent.AddedToCart]: { item: CartItem; currency: string; user?: User | null; }; [MoonbaseEvent.CouponRejected]: { code: string; /** * Why, as the buyer was told, when the checkout refused a code typed into * it. Absent for a code passed to the `purchase` intent. */ message?: string; user?: User | null; }; [MoonbaseEvent.CheckoutInitiated]: { order: OpenOrder; total: Money; user?: User | null; }; /** * The buyer saved their billing details in the checkout. Sent again each time * they change them. Only from the checkout that opens on the page, not the * hosted one a redirect goes to. */ [MoonbaseEvent.CheckoutBillingDetailsAdded]: { order: OpenOrder; user?: User | null; }; /** The buyer applied a coupon code in the checkout. On-page checkout only. */ [MoonbaseEvent.CheckoutCouponApplied]: { order: OpenOrder; code: string; user?: User | null; }; /** The buyer took a coupon off the order in the checkout. On-page checkout only. */ [MoonbaseEvent.CheckoutCouponRemoved]: { order: OpenOrder; code: string; user?: User | null; }; /** * The buyer submitted payment in the checkout. Each attempt is followed by * `checkout-payment-failed` or `checkout-completed`. On-page checkout only. */ [MoonbaseEvent.CheckoutPaymentStarted]: { order: OpenOrder; user?: User | null; }; /** * An attempt to pay failed: a declined card, or a 3-D Secure check the buyer * did not pass. The checkout stays open for them to try again. `error.reason` * says what kind of failure it was; the card issuer's own decline code is * never passed on. On-page checkout only: for every checkout, hosted * included, subscribe a webhook to `OrderPaymentFailed`. */ [MoonbaseEvent.CheckoutPaymentFailed]: { order: OpenOrder; error: CheckoutPaymentFailure; user?: User | null; }; [MoonbaseEvent.CheckoutClosed]: { /** * The cart. For a direct purchase (the `purchase` intent, a buy button) * this is not the order the checkout was for: read `checkoutOrder`. */ order: Order; /** The order the checkout was open for. Absent if it closed before it loaded. */ checkoutOrder?: Order; /** * Whether the checkout completed the order before it closed, the same * moment `checkout-completed` fires. An order that was paid but could not * be fulfilled is not completed, and fires neither. */ completed: boolean; user?: User | null; }; [MoonbaseEvent.CheckoutCompleted]: { order: Order; user?: User | null; }; } declare type MoonbaseEventEmitter = (eventType: TEvent, event: MoonbaseEventArgs[TEvent]) => void; /** * A font slot takes a built-in name, `'inherit'` (whatever the host page renders at that spot), * `'system'` (the widget's own system stack, no network), or a family of your own. */ export declare type MoonbaseFont = MoonbaseBuiltInFont | 'inherit' | 'system' | MoonbaseCustomFont; declare class MoonbaseImpl implements MoonbaseInstance { private initialized; private pinia; private storefront; private url; private options; private integrations; private completedOrderIds; setup(url: string, options?: DeepPartial): Promise; configure(options: DeepPartial): void; on(eventType: TEvent, callback: (event: MoonbaseEventArgs[TEvent]) => void): void; getAccessToken(): Promise; private handleLocationIntent; sign_in(parameters?: MoonbaseIntentArgs['sign_in']): void; sign_up(parameters?: MoonbaseIntentArgs['sign_up']): void; forgot_password(parameters?: MoonbaseIntentArgs['forgot_password']): void; reset_password(parameters?: MoonbaseIntentArgs['reset_password']): void; confirm_account(parameters?: MoonbaseIntentArgs['confirm_account']): void; confirm_email(parameters?: MoonbaseIntentArgs['confirm_email']): void; confirm_email_change(parameters?: MoonbaseIntentArgs['confirm_email_change']): void; subscribe(parameters?: MoonbaseIntentArgs['subscribe']): void; confirm_communication_preferences(parameters?: MoonbaseIntentArgs['confirm_communication_preferences']): void; manage_communication_preferences(parameters?: MoonbaseIntentArgs['manage_communication_preferences']): void; connect_account(parameters?: MoonbaseIntentArgs['connect_account']): void; join_group(parameters?: MoonbaseIntentArgs['join_group']): void; view_account(): void; view_products(): void; view_subscriptions(): void; redeem_voucher(parameters?: MoonbaseIntentArgs['redeem_voucher']): void; view_product(parameters?: MoonbaseIntentArgs['view_product']): void; download_product(parameters?: MoonbaseIntentArgs['download_product']): void; view_release_history(parameters?: MoonbaseIntentArgs['view_release_history']): void; activate_product(parameters?: MoonbaseIntentArgs['activate_product']): void; manage_subscription(parameters?: MoonbaseIntentArgs['manage_subscription']): void; view_cart(): void; add_to_cart(parameters?: MoonbaseIntentArgs['add_to_cart']): Promise; purchase(parameters?: MoonbaseIntentArgs['purchase']): Promise; checkout(parameters?: MoonbaseIntentArgs['checkout']): void; private checkoutCart; close_checkout(): void; view_about(): void; } export declare type MoonbaseInstance = MoonbaseInstanceIntents & { setup: (url: string, options: DeepPartial) => Promise; configure: (options: DeepPartial) => void; on: (eventType: TEvent, callback: (event: MoonbaseEventArgs[TEvent]) => void) => void; /** * The signed-in customer's access token, for calling your own API on their behalf, or * null when nobody is signed in. Renewed first when it is about to run out, so it is * always good for at least the next half minute. Verify it on your server with your * account's public key, at `/api/key/jwks` on your Moonbase address. */ getAccessToken: () => Promise; }; declare type MoonbaseInstanceIntents = { [intent in MoonbaseIntent]: (parameters?: MoonbaseIntentArgs[intent]) => void | Promise; }; export declare enum MoonbaseIntent { SignIn = "sign_in", SignUp = "sign_up", ForgotPassword = "forgot_password", ResetPassword = "reset_password", ConfirmAccount = "confirm_account", ConfirmEmail = "confirm_email", ConfirmEmailChange = "confirm_email_change", Subscribe = "subscribe", ConfirmCommunicationPreferences = "confirm_communication_preferences", ManageCommunicationPreferences = "manage_communication_preferences", ViewAccount = "view_account", ViewProducts = "view_products", ViewSubscriptions = "view_subscriptions", RedeemVoucher = "redeem_voucher", ConnectAccount = "connect_account", JoinGroup = "join_group", ViewProduct = "view_product", DownloadProduct = "download_product", ViewReleaseHistory = "view_release_history", ActivateProduct = "activate_product", ManageSubscription = "manage_subscription", ViewCart = "view_cart", Purchase = "purchase", AddToCart = "add_to_cart", Checkout = "checkout", CloseCheckout = "close_checkout", ViewAbout = "view_about" } export declare interface MoonbaseIntentArgs { [MoonbaseIntent.SignIn]: { email?: string; }; [MoonbaseIntent.SignUp]: { email?: string; /** * Comma-separated merchant-owned group IDs to join on sign-up, added to * whatever `options.groups.signUp` already names. */ groups?: string; }; [MoonbaseIntent.ForgotPassword]: { email?: string; }; [MoonbaseIntent.ResetPassword]: { email: string; code: string; }; [MoonbaseIntent.ConfirmAccount]: { email: string; code: string; }; [MoonbaseIntent.ConfirmEmail]: { email: string; code: string; }; [MoonbaseIntent.ConfirmEmailChange]: { email: string; code: string; }; [MoonbaseIntent.Subscribe]: { email?: string; /** Prefills the name field. */ name?: string; /** * Comma-separated merchant-owned group IDs to join on subscribe, added to * whatever `options.groups.subscribe` already names. */ groups?: string; }; [MoonbaseIntent.ConfirmCommunicationPreferences]: { email: string; token: string; }; [MoonbaseIntent.ManageCommunicationPreferences]: { email: string; token: string; }; [MoonbaseIntent.ViewAccount]: never; [MoonbaseIntent.ViewProducts]: never; [MoonbaseIntent.ViewSubscriptions]: never; [MoonbaseIntent.RedeemVoucher]: { code?: string; }; [MoonbaseIntent.ConnectAccount]: { provider_id: string; }; [MoonbaseIntent.JoinGroup]: { group_id: string; }; [MoonbaseIntent.ViewProduct]: { product_id: string; version?: string; }; [MoonbaseIntent.DownloadProduct]: { product_id: string; version?: string; key?: string; }; [MoonbaseIntent.ViewReleaseHistory]: { product_id: string; }; [MoonbaseIntent.ActivateProduct]: { token?: string; }; [MoonbaseIntent.ManageSubscription]: { subscription_id: string; }; [MoonbaseIntent.ViewCart]: never; [MoonbaseIntent.AddToCart]: { product_id?: string; bundle_id?: string; variation_id?: string; quantity?: number; offer_id?: string; show_cart?: boolean; /** * The customer's license this purchase upgrades or renews, for a product whose licenses cover * only some releases. Buying it extends that license instead of issuing another, at the price * the storefront quotes for that license. Each license is a cart line of its own, always one * unit. Products only. Left out, the purchase issues a new license. */ license_id?: string; }; [MoonbaseIntent.Purchase]: { product_id?: string; bundle_id?: string; variation_id?: string; quantity?: number; coupon_code?: string; /** The customer's license this purchase upgrades or renews, always one unit. Products only. */ license_id?: string; } | { product_id?: string; bundle_id?: string; variation_id?: string; quantity?: number; coupon_code?: string; /** The customer's license this purchase upgrades or renews, always one unit. Products only. */ license_id?: string; }[]; [MoonbaseIntent.Checkout]: { complete?: boolean; url?: string; }; [MoonbaseIntent.CloseCheckout]: never; [MoonbaseIntent.ViewAbout]: never; } export declare interface MoonbaseOptions { toolbar: { enabled: boolean; location: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; show: { cart: boolean; account: boolean; moonbase: boolean; }; }; auth: { signIn: { enabled: boolean; hint: string | undefined; }; signUp: { enabled: boolean; marketingConsent: MarketingConsentType; }; passwords: 'default' | 'lax'; }; communicationPreferences: { show: { newsletter: boolean; productUpdates: boolean; }; }; /** * IDs of the customer groups a visitor joins through each form. A group not open to public * sign-ups is skipped silently. A link adds to `signUp` and `subscribe` with `mb_groups` * (`?mb_intent=sign_up&mb_groups=beta,vip`), and a `data-moonbase-form="subscribe"` form with a * `groups` field. `checkout` is set here only. */ groups: { signUp: string[]; subscribe: string[]; checkout: string[]; }; checkout: { /** * Where checkout happens: * - `'auto'` (default): an overlay on desktop, the hosted checkout on mobile. * - `'always'` / `true`: always the hosted checkout. * - `'never'` / `false`: always the overlay, which can't offer Apple Pay or Google Pay. */ redirect: boolean | CheckoutRedirectMode; }; cart: { quantity: 'selectable' | 'single'; bundles: { /** * `'replace'` (default) takes a bundle's products out of the cart when it is added, if they are * sold the same way (subscription or one-off) as the bundle. `'append'` leaves them in. */ onAdd: 'append' | 'replace'; showProducts: boolean; }; offers: { label: string; /** * Put an eligible single-product offer on the line it targets without the buyer pressing its * card, which hides once the target is in the cart. Off by default. Never adds to the cart or * replaces an offer a line already has. */ autoApply: boolean; /** Offers on the whole cart, such as "10% off orders over $50". They apply once the cart qualifies. */ cartWide: { /** Show how far the cart is from the offer's threshold. `false` applies it without the meter. */ showProgress: boolean; /** Label for the saving row in the cart totals. */ savingLabel: string; }; }; leadMagnets: { quantity: 'selectable' | 'single'; }; /** * The smallest order the cart checks out, per currency in major units, e.g. `{ USD: 25, EUR: 25 }`. * Measured after discounts and offers, before coupons and tax. A currency left out has no * minimum, and a cart of only free items is exempt. `purchase()` is not held to it. Pass `{}` to * remove it. */ minimumTotal: Record; }; activation: { deviceTokenFileExtension: string; licenseTokenFileName: string; websiteLink: { enabled: boolean; label: string; }; }; promotions: { /** * Show running promotions as a banner or popup. Turn off to render them yourself from the * `promotion-shown` event or `usePromotions()` in `@moonbase.sh/vue`. */ enabled: boolean; /** Where the banner goes when the page has no `[data-moonbase-promotion]` container. */ location: 'top' | 'bottom'; /** Label for dismissing a promotion, and its only action when it has no link. */ dismissLabel: string; }; theme: { dark: boolean; colors: { primary: Record | string; background: 'white' | 'gray'; }; fonts: { /** * A built-in family the widget loads (`'Inter'`), `'inherit'` for the page's font, `'system'`, * `{ family }` for one the page already loads, or `{ family, stylesheet }` to load one. */ heading: MoonbaseFont; /** As `heading`, for body text. */ body: MoonbaseFont; }; corners: 'sharp' | 'soft' | 'round'; buttons: 'outlined' | 'light'; cards: 'outlined' | 'shadow' | 'white'; }; pricing: { /** Whole prices: `'auto'` (default) shows `$10`, `'always'` shows `$10.00`. */ trailingZeros: TrailingZeros; /** `'narrowSymbol'` (default) `$10`, `'symbol'` `US$10`, `'code'` `USD 10`, `'name'` `10 US dollars`. */ currencyDisplay: CurrencyDisplay; }; target: HTMLElement | undefined; /** Turn off the widget's scaling on pages with a fixed-width mobile viewport, such as Wix's `width=320`. */ disableViewportCompensation: boolean; /** * Forward storefront events to analytics SDKs the page already loads (`fbq`, `gtag`, * `dataLayer`, `klaviyo`, `ttq`). Pass a provider's config to turn it on. */ integrations: IntegrationsConfig; } /** Which surface a promotion was rendered on. */ export declare type PromotionSurface = 'banner' | 'popup'; export declare interface TikTokPixelConfig { pixelId: string; } export declare const urlKey: InjectionKey; export { }