@namiml/web-sdk
Version:
Nami Web SDK makes subscriptions & in-app purchases easy, with powerful built-in paywalls and A/B testing
21 lines (20 loc) • 1.97 kB
TypeScript
import { NamiProductDetails, NamiProductOffer, NamiSubscriptionPeriod } from "../../types/externals/product";
import { PricingPhase } from "../../types/products";
import { PaywallSKU } from "../../types/sku";
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): 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;