UNPKG

@qonversion/capacitor-plugin

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

583 lines 32.6 kB
import { EntitlementGrantType, EntitlementRenewState, EntitlementSource, ExperimentGroupType, IntroEligibilityStatus, OfferingTag, PricingPhaseRecurrenceMode, PricingPhaseType, ProductType, QonversionErrorCode, RemoteConfigurationAssignmentType, RemoteConfigurationSourceType, SKPeriodUnit, SKProductDiscountPaymentMode, SKProductDiscountType, SubscriptionPeriodUnit, TransactionEnvironment, TransactionOwnershipType, TransactionType, UserPropertyKey, } from "../dto/enums"; import { IntroEligibility } from "../dto/IntroEligibility"; import { Offering } from "../dto/Offering"; import { Offerings } from "../dto/Offerings"; import { Entitlement } from "../dto/Entitlement"; import { Product } from "../dto/Product"; import { SKProduct } from "../dto/storeProducts/SKProduct"; import { SKProductDiscount } from "../dto/storeProducts/SKProductDiscount"; import { SKSubscriptionPeriod } from "../dto/storeProducts/SKSubscriptionPeriod"; import { SkuDetails } from "../dto/storeProducts/SkuDetails"; import { ActionResult } from "../dto/ActionResult"; import { QonversionError } from "../dto/QonversionError"; import { User } from '../dto/User'; import { Experiment } from "../dto/Experiment"; import { ExperimentGroup } from "../dto/ExperimentGroup"; import { SubscriptionPeriod } from "../dto/SubscriptionPeriod"; import { RemoteConfig } from "../dto/RemoteConfig"; import { RemoteConfigList } from '../dto/RemoteConfigList'; import { UserProperties } from '../dto/UserProperties'; import { UserProperty } from '../dto/UserProperty'; import { RemoteConfigurationSource } from "../dto/RemoteConfigurationSource"; import { Transaction } from "../dto/Transaction"; import { ProductStoreDetails } from "../dto/storeProducts/ProductStoreDetails"; import { ProductOfferDetails } from "../dto/storeProducts/ProductOfferDetails"; import { ProductInAppDetails } from "../dto/storeProducts/ProductInAppDetails"; import { ProductPrice } from "../dto/storeProducts/ProductPrice"; import { ProductPricingPhase } from "../dto/storeProducts/ProductPricingPhase"; import { ProductInstallmentPlanDetails } from '../dto/storeProducts/ProductInstallmentPlanDetails'; import { PromotionalOffer } from '../dto/PromotionalOffer'; import { SKPaymentDiscount } from '../dto/storeProducts/SKPaymentDiscount'; const priceMicrosRatio = 1000000; class Mapper { static convertPromoOffer(promoOffer) { if (!promoOffer) { return null; } const productDiscount = this.convertProductDiscount(promoOffer.productDiscount); const paymentDiscount = this.convertPaymentDiscount(promoOffer.paymentDiscount); return new PromotionalOffer(productDiscount, paymentDiscount); } static convertEntitlements(entitlements) { let mappedPermissions = new Map(); if (!entitlements) { return mappedPermissions; } for (const [key, entitlement] of Object.entries(entitlements)) { let renewState; switch (entitlement.renewState) { case EntitlementRenewState.NON_RENEWABLE: renewState = EntitlementRenewState.NON_RENEWABLE; break; case EntitlementRenewState.WILL_RENEW: renewState = EntitlementRenewState.WILL_RENEW; break; case EntitlementRenewState.CANCELED: renewState = EntitlementRenewState.CANCELED; break; case EntitlementRenewState.BILLING_ISSUE: renewState = EntitlementRenewState.BILLING_ISSUE; break; default: renewState = EntitlementRenewState.UNKNOWN; break; } const entitlementSource = this.convertEntitlementSource(entitlement.source); const entitlementGrantType = this.convertEntitlementGrantType(entitlement.grantType); const transactions = []; if (Array.isArray(entitlement.transactions)) { entitlement.transactions.forEach((transaction) => { const mappedTransaction = this.convertTransaction(transaction); transactions.push(mappedTransaction); }); } const mappedPermission = new Entitlement(entitlement.id, entitlement.productId, entitlement.active, renewState, entitlementSource, entitlement.startedTimestamp, entitlement.renewsCount, entitlementGrantType, transactions, entitlement.expirationTimestamp, entitlement.trialStartTimestamp, entitlement.firstPurchaseTimestamp, entitlement.lastPurchaseTimestamp, entitlement.autoRenewDisableTimestamp, entitlement.lastActivatedOfferCode); mappedPermissions.set(key, mappedPermission); } return mappedPermissions; } static convertTransaction(transaction) { const environment = this.convertTransactionEnvironment(transaction.environment); const ownershipType = this.convertTransactionOwnershipType(transaction.ownershipType); const type = this.convertTransactionType(transaction.type); return new Transaction(transaction.originalTransactionId, transaction.transactionId, transaction.transactionTimestamp, environment, ownershipType, type, transaction.expirationTimestamp, transaction.transactionRevocationTimestamp, transaction.offerCode, transaction.promoOfferId); } static convertTransactionType(typeKey) { switch (typeKey) { case "SubscriptionStarted": return TransactionType.SUBSCRIPTION_STARTED; case "SubscriptionRenewed": return TransactionType.SUBSCRIPTION_RENEWED; case "TrialStarted": return TransactionType.TRIAL_STARTED; case "IntroStarted": return TransactionType.INTRO_STARTED; case "IntroRenewed": return TransactionType.INTRO_RENEWED; case "NonConsumablePurchase": return TransactionType.NON_CONSUMABLE_PURCHASE; } return TransactionType.UNKNOWN; } static convertTransactionOwnershipType(ownershipTypeKey) { switch (ownershipTypeKey) { case "Owner": return TransactionOwnershipType.OWNER; case "FamilySharing": return TransactionOwnershipType.FAMILY_SHARING; } return TransactionOwnershipType.OWNER; } static convertTransactionEnvironment(envKey) { switch (envKey) { case "Production": return TransactionEnvironment.PRODUCTION; case "Sandbox": return TransactionEnvironment.SANDBOX; } return TransactionEnvironment.PRODUCTION; } static convertEntitlementSource(sourceKey) { switch (sourceKey) { case "Unknown": return EntitlementSource.UNKNOWN; case "AppStore": return EntitlementSource.APP_STORE; case "PlayStore": return EntitlementSource.PLAY_STORE; case "Stripe": return EntitlementSource.STRIPE; case "Manual": return EntitlementSource.MANUAL; } return EntitlementSource.UNKNOWN; } static convertEntitlementGrantType(typeKey) { switch (typeKey) { case "Purchase": return EntitlementGrantType.PURCHASE; case "FamilySharing": return EntitlementGrantType.FAMILY_SHARING; case "OfferCode": return EntitlementGrantType.OFFER_CODE; case "Manual": return EntitlementGrantType.MANUAL; } return EntitlementGrantType.PURCHASE; } static convertDefinedUserPropertyKey(sourceKey) { switch (sourceKey) { case '_q_email': return UserPropertyKey.EMAIL; case '_q_name': return UserPropertyKey.NAME; case '_q_kochava_device_id': return UserPropertyKey.KOCHAVA_DEVICE_ID; case '_q_appsflyer_user_id': return UserPropertyKey.APPS_FLYER_USER_ID; case '_q_adjust_adid': return UserPropertyKey.ADJUST_AD_ID; case '_q_custom_user_id': return UserPropertyKey.CUSTOM_USER_ID; case '_q_fb_attribution': return UserPropertyKey.FACEBOOK_ATTRIBUTION; case '_q_firebase_instance_id': return UserPropertyKey.FIREBASE_APP_INSTANCE_ID; case '_q_app_set_id': return UserPropertyKey.APP_SET_ID; case '_q_advertising_id': return UserPropertyKey.ADVERTISING_ID; case "_q_appmetrica_device_id": return UserPropertyKey.APP_METRICA_DEVICE_ID; case "_q_appmetrica_user_profile_id": return UserPropertyKey.APP_METRICA_USER_PROFILE_ID; case "_q_pushwoosh_hwid": return UserPropertyKey.PUSH_WOOSH_HW_ID; case "_q_pushwoosh_user_id": return UserPropertyKey.PUSH_WOOSH_USER_ID; case "_q_tenjin_aiid": return UserPropertyKey.TENJIN_ANALYTICS_INSTALLATION_ID; } return UserPropertyKey.CUSTOM; } static convertUserProperties(properties) { const mappedProperties = properties.properties.map(propertyData => new UserProperty(propertyData.key, propertyData.value)); return new UserProperties(mappedProperties); } static convertProducts(products) { let mappedProducts = new Map(); if (!products) { return mappedProducts; } for (const [key, product] of Object.entries(products)) { const mappedProduct = this.convertProduct(product); mappedProducts.set(key, mappedProduct); } return mappedProducts; } static convertProduct(product) { var _a, _b, _c, _d, _e, _f, _g, _h, _j; const productType = Mapper.convertProductType(product.type); const subscriptionPeriod = Mapper.convertSubscriptionPeriod(product.subscriptionPeriod); const trialPeriod = Mapper.convertSubscriptionPeriod(product.trialPeriod); const offeringId = (_a = product.offeringId) !== null && _a !== void 0 ? _a : null; let skProduct = null; let skuDetails = null; let storeDetails = null; let price; let currencyCode; let storeTitle; let storeDescription; let prettyIntroductoryPrice; if (!!product.skProduct) { skProduct = Mapper.convertSKProduct(product.skProduct); price = parseFloat(skProduct.price); currencyCode = skProduct.currencyCode; storeTitle = skProduct.localizedTitle; storeDescription = skProduct.localizedDescription; if (skProduct.productDiscount) { prettyIntroductoryPrice = skProduct.productDiscount.currencySymbol + skProduct.productDiscount.price; } } else { let priceMicros = null; if (!!product.skuDetails) { skuDetails = Mapper.convertSkuDetails(product.skuDetails); storeTitle = skuDetails.title; storeDescription = skuDetails.description; priceMicros = skuDetails.priceAmountMicros; currencyCode = skuDetails.priceCurrencyCode; if (skuDetails.introductoryPrice.length > 0) { prettyIntroductoryPrice = skuDetails.introductoryPrice; } } if (!!product.storeDetails) { storeDetails = Mapper.convertProductStoreDetails(product.storeDetails); storeTitle = storeDetails.title; storeDescription = storeDetails.description; const defaultOffer = storeDetails.defaultSubscriptionOfferDetails; const inAppOffer = storeDetails.inAppOfferDetails; if (defaultOffer) { priceMicros = (_c = (_b = defaultOffer.basePlan) === null || _b === void 0 ? void 0 : _b.price) === null || _c === void 0 ? void 0 : _c.priceAmountMicros; currencyCode = (_e = (_d = defaultOffer.basePlan) === null || _d === void 0 ? void 0 : _d.price) === null || _e === void 0 ? void 0 : _e.priceCurrencyCode; prettyIntroductoryPrice = (_g = (_f = defaultOffer.introPhase) === null || _f === void 0 ? void 0 : _f.price) === null || _g === void 0 ? void 0 : _g.formattedPrice; } else if (inAppOffer) { priceMicros = inAppOffer.price.priceAmountMicros; currencyCode = inAppOffer.price.priceCurrencyCode; prettyIntroductoryPrice = undefined; } } price = priceMicros ? priceMicros / priceMicrosRatio : undefined; } const mappedProduct = new Product(product.id, product.storeId, (_h = product.basePlanId) !== null && _h !== void 0 ? _h : null, skuDetails, storeDetails, skProduct, offeringId, subscriptionPeriod, trialPeriod, productType, (_j = product.prettyPrice) !== null && _j !== void 0 ? _j : null, price, currencyCode, storeTitle, storeDescription, prettyIntroductoryPrice); return mappedProduct; } static convertOfferings(offerings) { if (!offerings) { return null; } if (!Array.isArray(offerings.availableOfferings) || offerings.availableOfferings.length === 0) { return null; } let mainOffering = null; if (offerings.main) { mainOffering = this.convertOffering(offerings.main); } const availableOfferings = []; offerings.availableOfferings.forEach((offering) => { const mappedOffering = this.convertOffering(offering); availableOfferings.push(mappedOffering); }); return new Offerings(mainOffering, availableOfferings); } static convertOffering(offering) { var _a; const products = []; offering.products.forEach((product) => { const mappedProduct = this.convertProduct(product); products.push(mappedProduct); }); const tag = (_a = OfferingTag[offering.tag]) !== null && _a !== void 0 ? _a : OfferingTag['0']; return new Offering(offering.id, tag, products); } static convertSkuDetails(skuDetails) { return new SkuDetails(skuDetails.description, skuDetails.freeTrialPeriod, skuDetails.iconUrl, skuDetails.introductoryPrice, skuDetails.introductoryPriceAmountMicros, skuDetails.introductoryPriceCycles, skuDetails.introductoryPricePeriod, skuDetails.originalJson, skuDetails.originalPrice, skuDetails.originalPriceAmountMicros, skuDetails.price, skuDetails.priceAmountMicros, skuDetails.priceCurrencyCode, skuDetails.sku, skuDetails.subscriptionPeriod, skuDetails.title, skuDetails.type, skuDetails.hashCode, skuDetails.toString); } static convertProductType(productType) { let type = ProductType.UNKNOWN; switch (productType) { case ProductType.TRIAL: type = ProductType.TRIAL; break; case ProductType.INTRO: type = ProductType.INTRO; break; case ProductType.SUBSCRIPTION: type = ProductType.SUBSCRIPTION; break; case ProductType.IN_APP: type = ProductType.IN_APP; break; } return type; } static convertSubscriptionPeriod(productPeriod) { if (!productPeriod) { return null; } const unit = Mapper.convertSubscriptionPeriodUnit(productPeriod.unit); return new SubscriptionPeriod(productPeriod.unitCount, unit, productPeriod.iso); } static convertSubscriptionPeriodUnit(unit) { let result = SubscriptionPeriodUnit.UNKNOWN; switch (unit) { case SubscriptionPeriodUnit.DAY: result = SubscriptionPeriodUnit.DAY; break; case SubscriptionPeriodUnit.WEEK: result = SubscriptionPeriodUnit.WEEK; break; case SubscriptionPeriodUnit.MONTH: result = SubscriptionPeriodUnit.MONTH; break; case SubscriptionPeriodUnit.YEAR: result = SubscriptionPeriodUnit.YEAR; break; } return result; } static convertProductPricingPhase(pricingPhase) { if (!pricingPhase) { return null; } const price = Mapper.convertProductPrice(pricingPhase.price); const billingPeriod = Mapper.convertSubscriptionPeriod(pricingPhase.billingPeriod); const recurrenceMode = Mapper.convertPrisingPhaseRecurrenceMode(pricingPhase.recurrenceMode); const type = Mapper.convertPrisingPhaseType(pricingPhase.type); return new ProductPricingPhase(price, billingPeriod, pricingPhase.billingCycleCount, recurrenceMode, type, pricingPhase.isTrial, pricingPhase.isIntro, pricingPhase.isBasePlan); } static convertPrisingPhaseRecurrenceMode(recurrenceMode) { let mode = PricingPhaseRecurrenceMode.UNKNOWN; switch (recurrenceMode) { case PricingPhaseRecurrenceMode.INFINITE_RECURRING: mode = PricingPhaseRecurrenceMode.INFINITE_RECURRING; break; case PricingPhaseRecurrenceMode.FINITE_RECURRING: mode = PricingPhaseRecurrenceMode.FINITE_RECURRING; break; case PricingPhaseRecurrenceMode.NON_RECURRING: mode = PricingPhaseRecurrenceMode.NON_RECURRING; break; } return mode; } static convertPrisingPhaseType(type) { let result = PricingPhaseType.UNKNOWN; switch (type) { case PricingPhaseType.REGULAR: result = PricingPhaseType.REGULAR; break; case PricingPhaseType.FREE_TRIAL: result = PricingPhaseType.FREE_TRIAL; break; case PricingPhaseType.DISCOUNTED_SINGLE_PAYMENT: result = PricingPhaseType.DISCOUNTED_SINGLE_PAYMENT; break; case PricingPhaseType.DISCOUNTED_RECURRING_PAYMENT: result = PricingPhaseType.DISCOUNTED_RECURRING_PAYMENT; break; } return result; } static convertProductInstallmentPlanDetails(installmentPlanDetails) { if (!installmentPlanDetails) { return null; } return new ProductInstallmentPlanDetails(installmentPlanDetails.commitmentPaymentsCount, installmentPlanDetails.subsequentCommitmentPaymentsCount); } static convertProductOfferDetails(offerDetails) { var _a; let basePlan = Mapper.convertProductPricingPhase(offerDetails.basePlan); let trialPhase = Mapper.convertProductPricingPhase(offerDetails.trialPhase); let introPhase = Mapper.convertProductPricingPhase(offerDetails.introPhase); let installmentPlanDetails = Mapper.convertProductInstallmentPlanDetails(offerDetails.installmentPlanDetails); let pricingPhases = offerDetails.pricingPhases.map(pricingPhase => Mapper.convertProductPricingPhase(pricingPhase)).filter(Boolean); return new ProductOfferDetails(offerDetails.basePlanId, (_a = offerDetails.offerId) !== null && _a !== void 0 ? _a : null, offerDetails.offerToken, offerDetails.tags, pricingPhases, basePlan, installmentPlanDetails, introPhase, trialPhase, offerDetails.hasTrial, offerDetails.hasIntro, offerDetails.hasTrialOrIntro); } static convertInAppOfferDetails(inAppOfferDetails) { let productPrice = this.convertProductPrice(inAppOfferDetails.price); return new ProductInAppDetails(productPrice); } static convertProductPrice(productPrice) { return new ProductPrice(productPrice.priceAmountMicros, productPrice.priceCurrencyCode, productPrice.formattedPrice, productPrice.isFree, productPrice.currencySymbol); } static convertProductStoreDetails(productStoreDetails) { var _a; let defaultSubscriptionOfferDetails = null; if (productStoreDetails.defaultSubscriptionOfferDetails != null) { defaultSubscriptionOfferDetails = this.convertProductOfferDetails(productStoreDetails.defaultSubscriptionOfferDetails); } let basePlanSubscriptionOfferDetails = null; if (productStoreDetails.basePlanSubscriptionOfferDetails != null) { basePlanSubscriptionOfferDetails = this.convertProductOfferDetails(productStoreDetails.basePlanSubscriptionOfferDetails); } let inAppOfferDetails = null; if (productStoreDetails.inAppOfferDetails != null) { inAppOfferDetails = this.convertInAppOfferDetails(productStoreDetails.inAppOfferDetails); } let subscriptionOfferDetails = null; if (productStoreDetails.subscriptionOfferDetails != null) { subscriptionOfferDetails = productStoreDetails.subscriptionOfferDetails.map(defaultOfferDetail => this.convertProductOfferDetails(defaultOfferDetail)); } const productType = Mapper.convertProductType(productStoreDetails.productType); return new ProductStoreDetails((_a = productStoreDetails.basePlanId) !== null && _a !== void 0 ? _a : null, productStoreDetails.productId, productStoreDetails.name, productStoreDetails.title, productStoreDetails.description, subscriptionOfferDetails, defaultSubscriptionOfferDetails, basePlanSubscriptionOfferDetails, inAppOfferDetails, productStoreDetails.hasTrialOffer, productStoreDetails.hasIntroOffer, productStoreDetails.hasTrialOrIntroOffer, productType, productStoreDetails.isInApp, productStoreDetails.isSubscription, productStoreDetails.isPrepaid, productStoreDetails.isInstallment); } static convertSKProduct(skProduct) { var _a; let subscriptionPeriod; if (skProduct.subscriptionPeriod != null) { subscriptionPeriod = this.convertSKSubscriptionPeriod(skProduct.subscriptionPeriod); } let discount; if (skProduct.introductoryPrice) { discount = this.convertProductDiscount(skProduct.introductoryPrice); } let discounts; if (Array.isArray(skProduct.discounts) && skProduct.discounts.length) { discounts = this.convertDiscounts(skProduct.discounts); } return new SKProduct(skProduct.localizedDescription, skProduct.localizedTitle, skProduct.price, skProduct.priceLocale.localeIdentifier, skProduct.productIdentifier, !!skProduct.isDownloadable, skProduct.downloadContentVersion, skProduct.downloadContentLengths, subscriptionPeriod, discount, discounts, skProduct.subscriptionGroupIdentifier, skProduct.isFamilyShareable, (_a = skProduct.priceLocale.currencyCode) !== null && _a !== void 0 ? _a : ""); } static convertSKSubscriptionPeriod(subscriptionPeriod) { return new SKSubscriptionPeriod(subscriptionPeriod.numberOfUnits, SKPeriodUnit[subscriptionPeriod.unit]); } static convertPaymentDiscount(discount) { return new SKPaymentDiscount(discount.identifier, discount.keyIdentifier, discount.nonce, discount.signature, discount.timestamp); } static convertProductDiscount(discount) { var _a; let subscriptionPeriod = undefined; if (discount.subscriptionPeriod != null) { subscriptionPeriod = this.convertSKSubscriptionPeriod(discount.subscriptionPeriod); } return new SKProductDiscount(discount.price, discount.priceLocale.localeIdentifier, discount.numberOfPeriods, subscriptionPeriod, SKProductDiscountPaymentMode[discount.paymentMode], discount.identifier, SKProductDiscountType[discount.type], (_a = discount.priceLocale.currencySymbol) !== null && _a !== void 0 ? _a : ""); } static convertDiscounts(discounts) { const mappedDiscounts = discounts.map((discount) => { return this.convertProductDiscount(discount); }); return mappedDiscounts; } static convertEligibility(eligibilityMap) { let mappedEligibility = new Map(); if (!eligibilityMap) { return mappedEligibility; } for (const [key, value] of Object.entries(eligibilityMap)) { const status = Mapper.convertEligibilityStatus(value.status); const eligibilityInfo = new IntroEligibility(status); mappedEligibility.set(key, eligibilityInfo); } return mappedEligibility; } static convertEligibilityStatus(status) { switch (status) { case "non_intro_or_trial_product": return IntroEligibilityStatus.NON_INTRO_OR_TRIAL_PRODUCT; case "intro_or_trial_eligible": return IntroEligibilityStatus.ELIGIBLE; case "intro_or_trial_ineligible": return IntroEligibilityStatus.INELIGIBLE; default: return IntroEligibilityStatus.UNKNOWN; } } static convertActionResult(payload) { return new ActionResult(payload["type"], payload["value"], this.convertQonversionError(payload["error"])); } static convertQonversionError(payload) { if (!payload) return undefined; const code = this.convertErrorCode(payload["code"]); return new QonversionError(code, payload["description"], payload["additionalMessage"], payload["domain"]); } static convertUserInfo(user) { return new User(user.qonversionId, user.identityId); } static convertRemoteConfig(remoteConfig) { var _a; let experiment = null; if (remoteConfig.experiment) { const groupType = this.convertGroupType(remoteConfig.experiment.group.type); const group = new ExperimentGroup(remoteConfig.experiment.group.id, remoteConfig.experiment.group.name, groupType); experiment = new Experiment(remoteConfig.experiment.id, remoteConfig.experiment.name, group); } const sourceType = this.convertRemoteConfigurationSourceType(remoteConfig.source.type); const assignmentType = this.convertRemoteConfigurationAssignmentType(remoteConfig.source.assignmentType); const source = new RemoteConfigurationSource(remoteConfig.source.id, remoteConfig.source.name, sourceType, assignmentType, (_a = remoteConfig.source.contextKey) !== null && _a !== void 0 ? _a : null); return new RemoteConfig(remoteConfig.payload, experiment, source); } static convertRemoteConfigList(remoteConfigList) { const remoteConfigs = remoteConfigList.remoteConfigs.map(config => this.convertRemoteConfig(config)); return new RemoteConfigList(remoteConfigs); } static convertRemoteConfigurationSourceType(type) { switch (type) { case "experiment_control_group": return RemoteConfigurationSourceType.EXPERIMENT_CONTROL_GROUP; case "experiment_treatment_group": return RemoteConfigurationSourceType.EXPERIMENT_TREATMENT_GROUP; case "remote_configuration": return RemoteConfigurationSourceType.REMOTE_CONFIGURATION; default: return RemoteConfigurationSourceType.UNKNOWN; } } static convertRemoteConfigurationAssignmentType(type) { switch (type) { case "auto": return RemoteConfigurationAssignmentType.AUTO; case "manual": return RemoteConfigurationAssignmentType.MANUAL; default: return RemoteConfigurationAssignmentType.UNKNOWN; } } static convertGroupType(type) { switch (type) { case "control": return ExperimentGroupType.CONTROL; case "treatment": return ExperimentGroupType.TREATMENT; default: return ExperimentGroupType.UNKNOWN; } } static convertErrorCode(code) { switch (code) { case QonversionErrorCode.UNKNOWN: return QonversionErrorCode.UNKNOWN; case QonversionErrorCode.API_RATE_LIMIT_EXCEEDED: return QonversionErrorCode.API_RATE_LIMIT_EXCEEDED; case QonversionErrorCode.APPLE_STORE_ERROR: return QonversionErrorCode.APPLE_STORE_ERROR; case QonversionErrorCode.BACKEND_ERROR: return QonversionErrorCode.BACKEND_ERROR; case QonversionErrorCode.BILLING_UNAVAILABLE: return QonversionErrorCode.BILLING_UNAVAILABLE; case QonversionErrorCode.CLIENT_INVALID: return QonversionErrorCode.CLIENT_INVALID; case QonversionErrorCode.CLOUD_SERVICE_NETWORK_CONNECTION_FAILED: return QonversionErrorCode.CLOUD_SERVICE_NETWORK_CONNECTION_FAILED; case QonversionErrorCode.CLOUD_SERVICE_PERMISSION_DENIED: return QonversionErrorCode.CLOUD_SERVICE_PERMISSION_DENIED; case QonversionErrorCode.CLOUD_SERVICE_REVOKED: return QonversionErrorCode.CLOUD_SERVICE_REVOKED; case QonversionErrorCode.FAILED_TO_RECEIVE_DATA: return QonversionErrorCode.FAILED_TO_RECEIVE_DATA; case QonversionErrorCode.FEATURE_NOT_SUPPORTED: return QonversionErrorCode.FEATURE_NOT_SUPPORTED; case QonversionErrorCode.FRAUD_PURCHASE: return QonversionErrorCode.FRAUD_PURCHASE; case QonversionErrorCode.INCORRECT_REQUEST: return QonversionErrorCode.INCORRECT_REQUEST; case QonversionErrorCode.INTERNAL_ERROR: return QonversionErrorCode.INTERNAL_ERROR; case QonversionErrorCode.INVALID_CLIENT_UID: return QonversionErrorCode.INVALID_CLIENT_UID; case QonversionErrorCode.INVALID_CREDENTIALS: return QonversionErrorCode.INVALID_CREDENTIALS; case QonversionErrorCode.INVALID_STORE_CREDENTIALS: return QonversionErrorCode.INVALID_STORE_CREDENTIALS; case QonversionErrorCode.LAUNCH_ERROR: return QonversionErrorCode.LAUNCH_ERROR; case QonversionErrorCode.NETWORK_CONNECTION_FAILED: return QonversionErrorCode.NETWORK_CONNECTION_FAILED; case QonversionErrorCode.OFFERINGS_NOT_FOUND: return QonversionErrorCode.OFFERINGS_NOT_FOUND; case QonversionErrorCode.PAYMENT_INVALID: return QonversionErrorCode.PAYMENT_INVALID; case QonversionErrorCode.PAYMENT_NOT_ALLOWED: return QonversionErrorCode.PAYMENT_NOT_ALLOWED; case QonversionErrorCode.PLAY_STORE_ERROR: return QonversionErrorCode.PLAY_STORE_ERROR; case QonversionErrorCode.PRIVACY_ACKNOWLEDGEMENT_REQUIRED: return QonversionErrorCode.PRIVACY_ACKNOWLEDGEMENT_REQUIRED; case QonversionErrorCode.PRODUCT_ALREADY_OWNED: return QonversionErrorCode.PRODUCT_ALREADY_OWNED; case QonversionErrorCode.PRODUCT_NOT_FOUND: return QonversionErrorCode.PRODUCT_NOT_FOUND; case QonversionErrorCode.PRODUCT_NOT_OWNED: return QonversionErrorCode.PRODUCT_NOT_OWNED; case QonversionErrorCode.PROJECT_CONFIG_ERROR: return QonversionErrorCode.PROJECT_CONFIG_ERROR; case QonversionErrorCode.PURCHASE_CANCELED: return QonversionErrorCode.PURCHASE_CANCELED; case QonversionErrorCode.PURCHASE_INVALID: return QonversionErrorCode.PURCHASE_INVALID; case QonversionErrorCode.PURCHASE_PENDING: return QonversionErrorCode.PURCHASE_PENDING; case QonversionErrorCode.PURCHASE_UNSPECIFIED: return QonversionErrorCode.PURCHASE_UNSPECIFIED; case QonversionErrorCode.RECEIPT_VALIDATION_ERROR: return QonversionErrorCode.RECEIPT_VALIDATION_ERROR; case QonversionErrorCode.REMOTE_CONFIGURATION_NOT_AVAILABLE: return QonversionErrorCode.REMOTE_CONFIGURATION_NOT_AVAILABLE; case QonversionErrorCode.RESPONSE_PARSING_FAILED: return QonversionErrorCode.RESPONSE_PARSING_FAILED; case QonversionErrorCode.STORE_PRODUCT_NOT_AVAILABLE: return QonversionErrorCode.STORE_PRODUCT_NOT_AVAILABLE; case QonversionErrorCode.UNAUTHORIZED_REQUEST_DATA: return QonversionErrorCode.UNAUTHORIZED_REQUEST_DATA; case QonversionErrorCode.UNKNOWN_CLIENT_PLATFORM: return QonversionErrorCode.UNKNOWN_CLIENT_PLATFORM; } return QonversionErrorCode.UNKNOWN; } } export default Mapper; //# sourceMappingURL=Mapper.js.map