UNPKG

react-native-qonversion

Version:

Qonversion provides full in-app purchases infrastructure, so you do not need to build your own server for receipt validation. Implement in-app subscriptions, validate user receipts, check subscription status, and provide access to your app features and co

68 lines 3.19 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const PurchaseModel_1 = __importDefault(require("./PurchaseModel")); const PurchaseUpdateModel_1 = __importDefault(require("./PurchaseUpdateModel")); class Product { constructor(qonversionID, storeID, basePlanID, skuDetails, storeDetails, skProduct, offeringId, subscriptionPeriod, trialPeriod, type, prettyPrice, price, currencyCode, storeTitle, storeDescription, prettyIntroductoryPrice) { this.qonversionID = qonversionID; this.storeID = storeID; this.basePlanID = basePlanID; this.skuDetails = skuDetails; this.storeDetails = storeDetails; this.skProduct = skProduct; this.offeringId = offeringId; this.subscriptionPeriod = subscriptionPeriod; this.trialPeriod = trialPeriod; this.type = type; this.prettyPrice = prettyPrice; this.price = price; this.currencyCode = currencyCode; this.storeTitle = storeTitle; this.storeDescription = storeDescription; this.prettyIntroductoryPrice = prettyIntroductoryPrice; } /** * Converts this product to purchase model to pass to {@link Qonversion.purchase}. * @param offerId concrete Android offer identifier if necessary. * If the products' base plan id is specified, but offer id is not provided for * purchase, then default offer will be used. * Ignored if base plan id is not specified. * Ignored for iOS. * To know how we choose the default offer, see {@link ProductStoreDetails.defaultSubscriptionOfferDetails}. * @returns purchase model to pass to the purchase method. */ toPurchaseModel(offerId = null) { return new PurchaseModel_1.default(this.qonversionID, offerId); } /** * Converts this product to purchase model to pass to {@link Qonversion.purchase}. * @param offer concrete Android offer which you'd like to purchase. * @return purchase model to pass to the purchase method. */ toPurchaseModelWithOffer(offer) { const model = this.toPurchaseModel(offer.offerId); // Remove offer for the case when provided offer details are for bare base plan. if (offer.offerId == null) { model.removeOffer(); } return model; } /** * Android only. * * Converts this product to purchase update (upgrade/downgrade) model * to pass to {@link Qonversion.updatePurchase}. * @param oldProductId Qonversion product identifier from which the upgrade/downgrade * will be initialized. * @param updatePolicy purchase update policy. * @return purchase model to pass to the update purchase method. */ toPurchaseUpdateModel(oldProductId, updatePolicy = null) { return new PurchaseUpdateModel_1.default(this.qonversionID, oldProductId, updatePolicy); } } exports.default = Product; //# sourceMappingURL=Product.js.map