UNPKG

@namiml/web-sdk

Version:

Subscription monetization infrastructure — drop-in SDK with no-code paywalls, onboarding flows, A/B testing for web

27 lines (26 loc) 2.52 kB
import { NamiProductDetails, NamiProductOffer, NamiSubscriptionPeriod } from "../../types/externals/product"; import { PricingPhase, PaywallSKU } from "@namiml/sdk-core"; export declare const isSubscription: (productType?: string) => productType is "subscription"; export declare function getStandardBillingPeriod(product: NamiProductDetails): string | null; export declare function getFreeTrialPeriod(product: NamiProductDetails): string | null; export declare function getFreeTrialOffer(product: NamiProductDetails): NamiProductOffer | undefined; export declare function extractStandardPricingPhases(product: NamiProductDetails): PricingPhase[]; export declare function convertOfferToPricingPhase(offer: NamiProductOffer | null, subPeriod?: NamiSubscriptionPeriod): PricingPhase; export declare function convertISO8601PeriodToText(iso8601Period: string | null, singular?: boolean, justPeriod?: boolean, justNumber?: boolean, useAbbrev?: boolean): string | null; /** True if the billing period is month- or year-based (e.g. P1M, P12M, P1Y). Used to return n/a for durationInMonths when period is days/weeks. */ export declare function isMonthOrYearBillingPeriod(period: string | null): boolean; /** * Returns the localized frequency adverb for a period (e.g. "weekly", "monthly", "bi-annually", "yearly"). * Returns null for day-based periods (n/a). Uses nami_weekly, nami_monthly, nami_biannually, nami_yearly, etc. */ export declare function convertISO8601PeriodToPeriodly(iso8601Period: string | null): string | null; export declare function getCurrencyFormat(priceCurrencyCode: string): Intl.NumberFormat; export declare const getPriceDifference: (currentSkuPricePerMonth?: number, referencedSkuPricePerMonth?: number, currencyFormat?: Intl.NumberFormat) => string | null; export declare const getPercentagePriceDifference: (currentSkuPrice?: number, currentSkuDurationInMonths?: number, referencedSkuPrice?: number, referencedSkuPeriodInMonths?: number) => string | null; export declare const getReferenceSku: (skus: PaywallSKU[], referenceId: string) => PaywallSKU | undefined; export declare const getPricePerMonth: (phase: PricingPhase) => number; export declare const getPeriodNumberInDays: (billingPeriod: string) => number; export declare const getPeriodNumberInWeeks: (billingPeriod: string) => number; export declare const getBillingPeriodNumber: (billingPeriod: string) => number; export declare const formattedPrice: (price: number) => number; export declare function toDouble(num: number): number;