UNPKG

cordova-plugin-qonversion

Version:
305 lines (304 loc) 12 kB
import { AutomationsEventType, EntitlementSource, ExperimentGroupType, IntroEligibilityStatus, OfferingTag, PricingPhaseRecurrenceMode, PricingPhaseType, SubscriptionPeriodUnit, ProductType, RemoteConfigurationAssignmentType, RemoteConfigurationSourceType, SKPeriodUnit, SKProductDiscountPaymentMode, SKProductDiscountType, UserPropertyKey, TransactionType, TransactionOwnershipType, TransactionEnvironment, EntitlementGrantType, QonversionErrorCode } from "./enums"; import { IntroEligibility } from "./IntroEligibility"; import { Offering } from "./Offering"; import { Offerings } from "./Offerings"; import { Entitlement } from "./Entitlement"; import { Product } from "./Product"; import { SKProduct } from "./SKProduct"; import { SKProductDiscount } from "./SKProductDiscount"; import { SKSubscriptionPeriod } from "./SKSubscriptionPeriod"; import { SkuDetails } from "./SkuDetails"; import { ActionResult } from "./ActionResult"; import { QonversionError } from "./QonversionError"; import { AutomationsEvent } from "./AutomationsEvent"; import { User } from './User'; import { SubscriptionPeriod } from "./SubscriptionPeriod"; import { RemoteConfig } from "./RemoteConfig"; import { RemoteConfigList } from "./RemoteConfigList"; import { UserProperties } from './UserProperties'; import { Transaction } from "./Transaction"; import { ProductStoreDetails } from "./ProductStoreDetails"; import { ProductOfferDetails } from "./ProductOfferDetails"; import { ProductInAppDetails } from "./ProductInAppDetails"; import { ProductPrice } from "./ProductPrice"; import { ProductPricingPhase } from "./ProductPricingPhase"; import { ProductInstallmentPlanDetails } from "./ProductInstallmentPlanDetails"; import { ScreenPresentationConfig } from './ScreenPresentationConfig'; import { SKPaymentDiscount } from './SKPaymentDiscount'; import { PromotionalOffer } from './PromotionalOffer'; export type QProduct = { id: string; storeId: string; basePlanId?: string | null; type: string; subscriptionPeriod?: QSubscriptionPeriod | null; trialPeriod?: QSubscriptionPeriod | null; skuDetails?: QSkuDetails | null; storeDetails?: QProductStoreDetails; skProduct?: QSKProduct | null; prettyPrice?: string | null; offeringId?: string | null; }; type QProductStoreDetails = { basePlanId?: string | null; productId: string; name: string; title: string; description: string; subscriptionOfferDetails?: QProductOfferDetails[] | null; defaultSubscriptionOfferDetails?: QProductOfferDetails | null; basePlanSubscriptionOfferDetails?: QProductOfferDetails | null; inAppOfferDetails?: QProductInAppDetails | null; hasTrialOffer: boolean; hasIntroOffer: boolean; hasTrialOrIntroOffer: boolean; productType: string; isInApp: boolean; isSubscription: boolean; isPrepaid: boolean; isInstallment: boolean; }; type QSubscriptionPeriod = { unitCount: number; unit: string; iso: string; }; type QProductPricingPhase = { price: QProductPrice; billingPeriod: QSubscriptionPeriod; billingCycleCount: number; recurrenceMode: string; type: string; isTrial: boolean; isIntro: boolean; isBasePlan: boolean; }; type QProductInstallmentPlanDetails = { commitmentPaymentsCount: number; subsequentCommitmentPaymentsCount: number; }; type QProductOfferDetails = { basePlanId: string; offerId?: string | null; offerToken: string; tags: string[]; pricingPhases: QProductPricingPhase[]; basePlan?: QProductPricingPhase | null; installmentPlanDetails?: QProductInstallmentPlanDetails | null; trialPhase?: QProductPricingPhase | null; introPhase: QProductPricingPhase | null; hasTrial: boolean; hasIntro: boolean; hasTrialOrIntro: boolean; }; type QProductPrice = { priceAmountMicros: number; priceCurrencyCode: string; formattedPrice: string; isFree: boolean; currencySymbol: string; }; type QProductInAppDetails = { price: QProductPrice; }; type QSkuDetails = { description: string; freeTrialPeriod: string; iconUrl: string; introductoryPrice: string; introductoryPriceAmountMicros: number; introductoryPriceCycles: number; introductoryPricePeriod: string; originalJson: string; originalPrice: string; originalPriceAmountMicros: number; price: string; priceAmountMicros: number; priceCurrencyCode: string; sku: string; subscriptionPeriod: string; title: string; type: string; hashCode: number; toString: string; }; type QSKProduct = { subscriptionPeriod: null | QSKSubscriptionPeriod; introductoryPrice: QProductDiscount | null; discounts: Array<QProductDiscount> | null; localizedDescription: string | undefined; localizedTitle: string | undefined; price: string; priceLocale: QLocale; productIdentifier: string | undefined; isDownloadable: boolean | undefined; downloadContentVersion: string | undefined; downloadContentLengths: number[] | undefined; productDiscount: SKProductDiscount | undefined; subscriptionGroupIdentifier: string | undefined; isFamilyShareable: boolean | undefined; }; type QSKSubscriptionPeriod = { numberOfUnits: number; unit: keyof typeof SKPeriodUnit; }; export type QPromotionalOffer = { productDiscount: QProductDiscount; paymentDiscount: QPaymentDiscount; }; type QPaymentDiscount = { identifier: string; keyIdentifier: string; nonce: string; signature: string; timestamp: number; }; type QProductDiscount = { subscriptionPeriod: null | QSKSubscriptionPeriod; price: string; numberOfPeriods: number; paymentMode: keyof typeof SKProductDiscountPaymentMode; identifier?: string; type: keyof typeof SKProductDiscountType; priceLocale: QLocale; }; type QLocale = { currencySymbol: string | null; currencyCode: string | null; localeIdentifier: string; }; export type QEntitlement = { id: string; productId: string; active: boolean; renewState: string; source: string; startedTimestamp: number; expirationTimestamp: number; renewsCount: number; trialStartTimestamp: number; firstPurchaseTimestamp: number; lastPurchaseTimestamp: number; lastActivatedOfferCode: string; grantType: string; autoRenewDisableTimestamp: number; transactions: Array<QTransaction>; }; export type QTransaction = { originalTransactionId: string; transactionId: string; offerCode: string; transactionTimestamp: number; expirationTimestamp: number; transactionRevocationTimestamp: number; environment: string; ownershipType: string; type: string; promoOfferId: string; }; export type QOfferings = { availableOfferings?: Array<QOffering>; main: QOffering; }; type QOffering = { id: string; tag: keyof typeof OfferingTag; products: Array<QProduct>; }; export type QTrialIntroEligibility = { status: "non_intro_or_trial_product" | "intro_or_trial_eligible" | "intro_or_trial_ineligible"; }; type QAutomationsEvent = { type: AutomationsEventType; timestamp: number; }; export type QEmptySuccessResult = { success: boolean; }; export type QUser = { qonversionId: string; identityId?: string | null; }; export type QRemoteConfig = { payload: Record<string, Object>; experiment?: QExperiment | null; source: QRemoteConfigurationSource; }; export type QRemoteConfigList = { remoteConfigs: Array<QRemoteConfig>; }; type QRemoteConfigurationSource = { id: string; name: string; type: string; assignmentType: string; contextKey: string | null | undefined; }; type QExperiment = { id: string; name: string; group: QExperimentGroup; }; type QExperimentGroup = { id: string; name: string; type: string; }; type QUserProperty = { key: string; value: string; }; export type QUserProperties = { properties: QUserProperty[]; }; export type QAutomationEvent = { event: string; payload: Record<string, any>; }; declare class Mapper { static convertPromoOffer(promoOffer: QPromotionalOffer | null | undefined): PromotionalOffer | null; static convertEntitlements(entitlements: Record<string, QEntitlement> | null | undefined): Map<string, Entitlement>; static convertTransaction(transaction: QTransaction): Transaction; static convertTransactionType(typeKey: string): TransactionType; static convertTransactionOwnershipType(ownershipTypeKey: string): TransactionOwnershipType; static convertTransactionEnvironment(envKey: string): TransactionEnvironment; static convertEntitlementSource(sourceKey: string): EntitlementSource; static convertEntitlementGrantType(typeKey: string): EntitlementGrantType; static convertDefinedUserPropertyKey(sourceKey: string): UserPropertyKey; static convertUserProperties(properties: QUserProperties): UserProperties; static convertProducts(products: Record<string, QProduct> | null | undefined): Map<string, Product>; static convertProduct(product: QProduct): Product; static convertOfferings(offerings: QOfferings | null | undefined): Offerings | null; static convertOffering(offering: QOffering): Offering; static convertSkuDetails(skuDetails: QSkuDetails): SkuDetails; static convertProductType(productType: string): ProductType; static convertSubscriptionPeriod(productPeriod: QSubscriptionPeriod | null | undefined): SubscriptionPeriod | null; static convertSubscriptionPeriodUnit(unit: string): SubscriptionPeriodUnit; static convertProductPricingPhase(pricingPhase: QProductPricingPhase | null | undefined): ProductPricingPhase | null; static convertPrisingPhaseRecurrenceMode(recurrenceMode: string): PricingPhaseRecurrenceMode; static convertPrisingPhaseType(type: string): PricingPhaseType; static convertProductInstallmentPlanDetails(installmentPlanDetails: QProductInstallmentPlanDetails | null | undefined): ProductInstallmentPlanDetails | null; static convertProductOfferDetails(offerDetails: QProductOfferDetails): ProductOfferDetails; static convertInAppOfferDetails(inAppOfferDetails: QProductInAppDetails): ProductInAppDetails; static convertProductPrice(productPrice: QProductPrice): ProductPrice; static convertProductStoreDetails(productStoreDetails: QProductStoreDetails): ProductStoreDetails; static convertSKProduct(skProduct: QSKProduct): SKProduct; static convertSKSubscriptionPeriod(subscriptionPeriod: QSKSubscriptionPeriod): SKSubscriptionPeriod; static convertPaymentDiscount(discount: QPaymentDiscount): SKPaymentDiscount; static convertProductDiscount(discount: QProductDiscount): SKProductDiscount; static convertDiscounts(discounts: Array<QProductDiscount>): SKProductDiscount[]; static convertEligibility(eligibilityMap: Record<string, QTrialIntroEligibility> | null | undefined): Map<string, IntroEligibility>; static convertEligibilityStatus(status: string): IntroEligibilityStatus; static convertActionResult(payload: Record<string, any>): ActionResult; static convertQonversionError(payload: Record<string, string> | undefined): QonversionError | undefined; static convertAutomationsEvent(automationsEvent: QAutomationsEvent): AutomationsEvent; static convertUserInfo(user: QUser): User; static convertRemoteConfig(remoteConfig: QRemoteConfig): RemoteConfig; static convertRemoteConfigList(remoteConfigList: QRemoteConfigList): RemoteConfigList; static convertRemoteConfigurationSourceType(type: String): RemoteConfigurationSourceType; static convertRemoteConfigurationAssignmentType(type: String): RemoteConfigurationAssignmentType; static convertGroupType(type: String): ExperimentGroupType; static convertScreenPresentationConfig(config: ScreenPresentationConfig): Object; static convertErrorCode(code: string): QonversionErrorCode; } export default Mapper;