Last active
February 5, 2021 18:32
-
-
Save hanakslr/b959bf9761bc100989a2c0d689472aef to your computer and use it in GitHub Desktop.
react-native-qonversion typings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module "react-native-qonversion" { | |
export default class Qonversion { | |
static setProperty(property: Property, value: string): void; | |
static launchWithKey(key: string, observerMode?: Boolean): Promise<LaunchResult>; | |
static setUserProperty(property: string, value: string): void; | |
static setUserId(userId: string): void; | |
static addAttributionData(data: Object, provider: Provider): void; | |
static checkPermissions(): Promise<Map<string, Permission>>; | |
static purchase(productId: string): Promise<Map<string, Permission>>; | |
static updatePurchase( | |
productId: string, | |
oldProductId: string, | |
prorationMode?: ProrationMode | |
): Promise<Map<string, Permission>>; | |
static products(): Promise<Map<string, Product>>; | |
static offerings(): Promise<Offerings>; | |
static restore(): Promise<Map<string, Permission>>; | |
static checkTrialIntroEligibilityForProductIds( | |
ids: string[] | |
): Promise<Map<string, Permission>>; | |
static experiments(): Promise<Map<string, ExperimentInfo>>; | |
static syncPurchases(): void; | |
static setDebugMode(): void; | |
} | |
export class LaunchResult { | |
uid: string; | |
timestamp: number; | |
products: Map<string, Product>; | |
permissions: Map<string, Permission>; | |
userProducts: Map<string, Product>; | |
constructor( | |
uid: string, | |
timestamp: number, | |
products: Map<string, Product>, | |
permissions: Map<string, Permission>, | |
userProducts: Map<string, Product> | |
); | |
} | |
export class Product { | |
qonversionID: string; | |
storeID: string; | |
type: ProductType; | |
duration: ProductDuration; | |
skuDetails: SkuDetails | null; | |
skProduct: SKProduct | null; | |
prettyPrice: string | undefined; | |
trialDuration: TrialDuration | undefined; | |
constructor( | |
qonversionID: string, | |
storeID: string, | |
type: ProductType, | |
duration: ProductDuration, | |
skuDetails: SkuDetails | null, | |
skProduct: SKProduct | null, | |
prettyPrice: string | undefined, | |
trialDuration: TrialDuration | undefined | |
); | |
} | |
export class Permission { | |
permissionID: string; | |
productID: string; | |
isActive: boolean; | |
renewState: RenewState; | |
startedDate: Date; | |
expirationDate: Date | undefined; | |
constructor( | |
permissionID: string, | |
productID: string, | |
isActive: boolean, | |
renewState: RenewState, | |
startedDate: Date, | |
expirationDate: Date | undefined | |
); | |
} | |
export class Offerings { | |
main: Offering | null; | |
availableOfferings: Offering[]; | |
constructor(main: Offering | null, availableOfferings: Offering[]); | |
offeringForIdentifier(identifier: string): Offering | undefined; | |
} | |
export class Offering { | |
id: string; | |
tag: OfferingTag; | |
products: Product[]; | |
constructor(id: string, tag: OfferingTag, products: Product[]); | |
productForIdentifier(identifier: string): Product | undefined; | |
} | |
export class IntroEligibility { | |
status: IntroEligibilityStatus | undefined; | |
constructor(status: IntroEligibilityStatus | undefined); | |
} | |
export class ExperimentInfo { | |
identifier: string; | |
group: ExperimentGroup; | |
constructor(identifier: string, group: ExperimentGroup); | |
} | |
export class ExperimentGroup { | |
type: ExperimentGroupType; | |
constructor(type: ExperimentGroupType); | |
} | |
export class SkuDetails { | |
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; | |
constructor( | |
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 | |
); | |
} | |
export class SKProduct { | |
localizedDescription: string | undefined; | |
localizedTitle: string | undefined; | |
price: string; | |
localeIdentifier: string | undefined; | |
productIdentifier: string | undefined; | |
isDownloadable: boolean; | |
downloadContentVersion: string | undefined; | |
downloadContentLengths: number[] | undefined; | |
subscriptionPeriod: SKSubscriptionPeriod | undefined; | |
productDiscount: SKProductDiscount | undefined; | |
discounts: SKProductDiscount[] | undefined; | |
subscriptionGroupIdentifier: string | undefined; | |
isFamilyShareable: boolean | undefined; | |
constructor( | |
localizedDescription: string | undefined, | |
localizedTitle: string | undefined, | |
price: string, | |
localeIdentifier: string | undefined, | |
productIdentifier: string | undefined, | |
isDownloadable: boolean, | |
downloadContentVersion: string | undefined, | |
downloadContentLengths: number[] | undefined, | |
subscriptionPeriod: SKSubscriptionPeriod | undefined, | |
productDiscount: SKProductDiscount | undefined, | |
discounts: SKProductDiscount[] | undefined, | |
subscriptionGroupIdentifier: string | undefined, | |
isFamilyShareable: boolean | undefined | |
); | |
} | |
export class SKSubscriptionPeriod { | |
numberOfUnits: number; | |
unit: SKPeriodUnit; | |
constructor(numberOfUnits: number, unit: SKPeriodUnit); | |
} | |
export class SKProductDiscount { | |
price: string; | |
localeIdentifier: string | undefined; | |
numberOfPeriods: number; | |
subscriptionPeriod: SKSubscriptionPeriod | undefined; | |
paymentMode: SKProductDiscountPaymentMode; | |
identifier: string | undefined; | |
type: SKProductDiscountType; | |
constructor( | |
price: string, | |
localeIdentifier: string | undefined, | |
numberOfPeriods: number, | |
subscriptionPeriod: SKSubscriptionPeriod | undefined, | |
paymentMode: SKProductDiscountPaymentMode, | |
identifier: string | undefined, | |
type: SKProductDiscountType | |
); | |
} | |
export type SKPeriodUnit = { | |
0: "DAY"; | |
1: "WEEK"; | |
2: "MONTH"; | |
3: "YEAR"; | |
}; | |
export type SKProductDiscountType = { | |
0: "INTRODUCTORY"; | |
1: "SUBSCRIPTION"; | |
}; | |
export type SKProductDiscountPaymentMode = { | |
0: "PAY_AS_YOU_GO"; | |
1: "PAY_UP_FRONT"; | |
2: "FREE_TRIAL"; | |
}; | |
export type OfferingTag = { | |
0: "NONE"; | |
1: "MAIN"; | |
}; | |
export type IntroEligibilityStatus = { | |
UNKNOWN: "unknown"; | |
NON_INTRO_OR_TRIAL_PRODUCT: "non_intro_or_trial_product"; | |
ELIGIBLE: "intro_or_trial_eligible"; | |
INELIGIBLE: "intro_or_trial_ineligible"; | |
}; | |
export type ExperimentGroupType = { | |
GROUP_TYPE_A: 0; | |
GROUP_TYPE_B: 1; | |
}; | |
export type ProductType = { | |
"0": "TRIAL"; | |
"1": "DIRECT_SUBSCRIPTION"; | |
"2": "ONE_TIME"; | |
}; | |
export type ProductDuration = { | |
0: "WEEKLY"; | |
1: "MONTHLY"; | |
2: "3_MONTHS"; | |
3: "6_MONTHS"; | |
4: "ANNUAL"; | |
5: "LIFETIME"; | |
}; | |
export type TrialDuration = { | |
"-1": "NOT_AVAILABLE"; | |
"1": "THREE_DAYS"; | |
"2": "WEEK"; | |
"3": "TWO_WEEKS"; | |
"4": "MONTH"; | |
"5": "TWO_MONTHS"; | |
"6": "THREE_MONTHS"; | |
"7": "SIX_MONTHS"; | |
"8": "YEAR"; | |
"9": "OTHER"; | |
}; | |
export type RenewState = { | |
NON_RENEWABLE: -1; | |
UNKNOWN: 0; | |
WILL_RENEW: 1; | |
CANCELED: 2; | |
BILLING_ISSUE: 3; | |
}; | |
export type Property = { | |
EMAIL: 0; | |
NAME: 1; | |
APPS_FLYER_USER_ID: 2; | |
ADJUST_USER_ID: 3; | |
KOCHAVA_DEVICE_ID: 4; | |
CUSTOM_USER_ID: 5; | |
FACEBOOK_ATTRIBUTION: 6; | |
}; | |
export type Provider = { | |
APPSFLYER: 0; | |
BRANCH: 1; | |
ADJUST: 2; | |
APPLE: 3; | |
}; | |
export type ProrationMode = { | |
UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY: 0; | |
IMMEDIATE_WITH_TIME_PRORATION: 1; | |
IMMEDIATE_AND_CHARGE_PRORATED_PRICE: 2; | |
IMMEDIATE_WITHOUT_PRORATION: 3; | |
DEFERRED: 4; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment