react-native-purchases 4.3.3 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { PURCHASES_ERROR_CODE } from "./errors";
1
+ import { PURCHASES_ERROR_CODE, UninitializedPurchasesError } from "./errors";
2
2
  import { PurchaserInfo } from "./purchaserInfo";
3
3
  import { PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferings, PurchasesProduct, UpgradeInfo, PurchasesPaymentDiscount, PurchasesPackage, IntroEligibility, PurchasesDiscount } from "./offerings";
4
4
  /**
@@ -7,11 +7,11 @@ import { PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferi
7
7
  * @param {Object} purchaserInfo Object containing info for the purchaser
8
8
  */
9
9
  export declare type PurchaserInfoUpdateListener = (purchaserInfo: PurchaserInfo) => void;
10
- export declare type ShouldPurchasePromoProductListener = (deferredPurchase: () => MakePurchasePromise) => void;
11
- declare type MakePurchasePromise = Promise<{
10
+ export declare type ShouldPurchasePromoProductListener = (deferredPurchase: () => Promise<MakePurchaseResult>) => void;
11
+ declare type MakePurchaseResult = {
12
12
  productIdentifier: string;
13
13
  purchaserInfo: PurchaserInfo;
14
- }>;
14
+ };
15
15
  export declare enum ATTRIBUTION_NETWORK {
16
16
  APPLE_SEARCH_ADS = 0,
17
17
  ADJUST = 1,
@@ -123,6 +123,7 @@ export default class Purchases {
123
123
  * @enum {string}
124
124
  */
125
125
  static PURCHASES_ERROR_CODE: typeof PURCHASES_ERROR_CODE;
126
+ static UninitializedPurchasesError: typeof UninitializedPurchasesError;
126
127
  /**
127
128
  * Sets up Purchases with your API key and an app user id.
128
129
  * @param {String} apiKey RevenueCat API Key. Needs to be a String
@@ -135,21 +136,26 @@ export default class Purchases {
135
136
  static setup(apiKey: string, appUserID?: string | null, observerMode?: boolean, userDefaultsSuiteName?: string): void;
136
137
  /**
137
138
  * @deprecated, configure behavior through the RevenueCat dashboard instead.
138
- * If an user tries to purchase a product that is active on the current app store account, we will treat it as a restore and alias
139
- * the new ID with the previous id.
140
- * @param {boolean} allowSharing Set this to true if you are passing in an appUserID but it is anonymous, this is true by default if you didn't pass an appUserID
139
+ * If an user tries to purchase a product that is active on the current app store account,
140
+ * we will treat it as a restore and alias the new ID with the previous id.
141
+ * @param {boolean} allowSharing Set this to true if you are passing in an appUserID but it is anonymous,
142
+ * this is true by default if you didn't pass an appUserID
143
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
141
144
  */
142
- static setAllowSharingStoreAccount(allowSharing: boolean): void;
145
+ static setAllowSharingStoreAccount(allowSharing: boolean): Promise<void>;
143
146
  /**
144
- * @param {boolean} finishTransactions Set finishTransactions to false if you aren't using Purchases SDK to make the purchase
147
+ * @param {boolean} finishTransactions Set finishTransactions to false if you aren't using Purchases SDK to
148
+ * make the purchase
149
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
145
150
  */
146
- static setFinishTransactions(finishTransactions: boolean): void;
151
+ static setFinishTransactions(finishTransactions: boolean): Promise<void>;
147
152
  /**
148
153
  * iOS only.
149
- * @param {boolean} simulatesAskToBuyInSandbox Set this property to true *only* when testing the ask-to-buy / SCA purchases flow.
150
- * More information: http://errors.rev.cat/ask-to-buy
154
+ * @param {boolean} simulatesAskToBuyInSandbox Set this property to true *only* when testing the ask-to-buy / SCA
155
+ * purchases flow. More information: http://errors.rev.cat/ask-to-buy
156
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
151
157
  */
152
- static setSimulatesAskToBuyInSandbox(simulatesAskToBuyInSandbox: boolean): void;
158
+ static setSimulatesAskToBuyInSandbox(simulatesAskToBuyInSandbox: boolean): Promise<void>;
153
159
  /**
154
160
  * Sets a function to be called on updated purchaser info
155
161
  * @param {PurchaserInfoUpdateListener} purchaserInfoUpdateListener PurchaserInfo update listener
@@ -173,7 +179,8 @@ export default class Purchases {
173
179
  static addShouldPurchasePromoProductListener(shouldPurchasePromoProductListener: ShouldPurchasePromoProductListener): void;
174
180
  /**
175
181
  * Removes a given ShouldPurchasePromoProductListener
176
- * @param {ShouldPurchasePromoProductListener} listenerToRemove ShouldPurchasePromoProductListener reference of the listener to remove
182
+ * @param {ShouldPurchasePromoProductListener} listenerToRemove ShouldPurchasePromoProductListener reference of
183
+ * the listener to remove
177
184
  * @returns {boolean} True if listener was removed, false otherwise
178
185
  */
179
186
  static removeShouldPurchasePromoProductListener(listenerToRemove: ShouldPurchasePromoProductListener): boolean;
@@ -184,21 +191,25 @@ export default class Purchases {
184
191
  * @param {Dict} data Attribution data from AppsFlyer, Adjust, or Branch
185
192
  * @param {ATTRIBUTION_NETWORKS} network Which network, see Purchases.ATTRIBUTION_NETWORKS
186
193
  * @param {String?} networkUserId An optional unique id for identifying the user. Needs to be a string.
194
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
187
195
  */
188
196
  static addAttributionData(data: {
189
197
  [key: string]: any;
190
- }, network: ATTRIBUTION_NETWORK, networkUserId?: string): void;
198
+ }, network: ATTRIBUTION_NETWORK, networkUserId?: string): Promise<void>;
191
199
  /**
192
200
  * Gets the map of entitlements -> offerings -> products
193
- * @returns {Promise<PurchasesOfferings>} Promise of entitlements structure
201
+ * @returns {Promise<PurchasesOfferings>} Promise of entitlements structure. The promise will be rejected if setup
202
+ * has not been called yet.
194
203
  */
195
204
  static getOfferings(): Promise<PurchasesOfferings>;
196
205
  /**
197
206
  * Fetch the product info
198
207
  * @param {String[]} productIdentifiers Array of product identifiers
199
208
  * @param {String} type Optional type of products to fetch, can be inapp or subs. Subs by default
200
- * @returns {Promise<PurchasesProduct[]>} A promise containing an array of products. The promise will be rejected if the products are not properly
201
- * configured in RevenueCat or if there is another error retrieving them. Rejections return an error code, and a userInfo object with more information.
209
+ * @returns {Promise<PurchasesProduct[]>} A promise containing an array of products. The promise will be rejected
210
+ * if the products are not properly configured in RevenueCat or if there is another error retrieving them.
211
+ * Rejections return an error code, and a userInfo object with more information. The promise will also be rejected
212
+ * if setup has not been called yet.
202
213
  */
203
214
  static getProducts(productIdentifiers: string[], type?: PURCHASE_TYPE): Promise<PurchasesProduct[]>;
204
215
  /**
@@ -210,9 +221,10 @@ export default class Purchases {
210
221
  * @param {String} type Optional type of product, can be inapp or subs. Subs by default
211
222
  * @returns {Promise<{ productIdentifier: string, purchaserInfo:PurchaserInfo }>} A promise of an object containing
212
223
  * a purchaser info object and a product identifier. Rejections return an error code,
213
- * a boolean indicating if the user cancelled the purchase, and an object with more information.
224
+ * a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will
225
+ * also be rejected if setup has not been called yet.
214
226
  */
215
- static purchaseProduct(productIdentifier: string, upgradeInfo?: UpgradeInfo | null, type?: PURCHASE_TYPE): MakePurchasePromise;
227
+ static purchaseProduct(productIdentifier: string, upgradeInfo?: UpgradeInfo | null, type?: PURCHASE_TYPE): Promise<MakePurchaseResult>;
216
228
  /**
217
229
  * iOS only. Purchase a product applying a given discount.
218
230
  *
@@ -220,9 +232,10 @@ export default class Purchases {
220
232
  * @param {PurchasesPaymentDiscount} discount Discount to apply to this package. Retrieve this discount using getPaymentDiscount.
221
233
  * @returns {Promise<{ productIdentifier: string, purchaserInfo:PurchaserInfo }>} A promise of an object containing
222
234
  * a purchaser info object and a product identifier. Rejections return an error code,
223
- * a boolean indicating if the user cancelled the purchase, and an object with more information.
235
+ * a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be
236
+ * rejected if setup has not been called yet.
224
237
  */
225
- static purchaseDiscountedProduct(product: PurchasesProduct, discount: PurchasesPaymentDiscount): MakePurchasePromise;
238
+ static purchaseDiscountedProduct(product: PurchasesProduct, discount: PurchasesPaymentDiscount): Promise<MakePurchaseResult>;
226
239
  /**
227
240
  * Make a purchase
228
241
  *
@@ -230,112 +243,136 @@ export default class Purchases {
230
243
  * @param {UpgradeInfo} upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU
231
244
  * and the optional prorationMode.
232
245
  * @returns {Promise<{ productIdentifier: string, purchaserInfo: PurchaserInfo }>} A promise of an object containing
233
- * a purchaser info object and a product identifier. Rejections return an error code,
234
- * a boolean indicating if the user cancelled the purchase, and an object with more information.
246
+ * a purchaser info object and a product identifier. Rejections return an error code, a boolean indicating if the
247
+ * user cancelled the purchase, and an object with more information. The promise will be also be rejected if setup
248
+ * has not been called yet.
235
249
  */
236
- static purchasePackage(aPackage: PurchasesPackage, upgradeInfo?: UpgradeInfo | null): MakePurchasePromise;
250
+ static purchasePackage(aPackage: PurchasesPackage, upgradeInfo?: UpgradeInfo | null): Promise<MakePurchaseResult>;
237
251
  /**
238
252
  * iOS only. Purchase a package applying a given discount.
239
253
  *
240
254
  * @param {PurchasesPackage} aPackage The Package you wish to purchase. You can get the Packages by calling getOfferings
241
255
  * @param {PurchasesPaymentDiscount} discount Discount to apply to this package. Retrieve this discount using getPaymentDiscount.
242
256
  * @returns {Promise<{ productIdentifier: string, purchaserInfo: PurchaserInfo }>} A promise of an object containing
243
- * a purchaser info object and a product identifier. Rejections return an error code,
244
- * a boolean indicating if the user cancelled the purchase, and an object with more information.
257
+ * a purchaser info object and a product identifier. Rejections return an error code, a boolean indicating if the
258
+ * user cancelled the purchase, and an object with more information. The promise will be also be rejected if setup
259
+ * has not been called yet.
245
260
  */
246
- static purchaseDiscountedPackage(aPackage: PurchasesPackage, discount: PurchasesPaymentDiscount): MakePurchasePromise;
261
+ static purchaseDiscountedPackage(aPackage: PurchasesPackage, discount: PurchasesPaymentDiscount): Promise<MakePurchaseResult>;
247
262
  /**
248
263
  * Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases.
249
- * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and a userInfo object with more information.
264
+ * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and an
265
+ * userInfo object with more information. The promise will be also be rejected if setup has not been called yet.
250
266
  */
251
267
  static restoreTransactions(): Promise<PurchaserInfo>;
252
268
  /**
253
269
  * Get the appUserID
254
- * @returns {string} The app user id in a promise
270
+ * @returns {Promise<string>} The app user id in a promise
255
271
  */
256
- static getAppUserID(): string;
272
+ static getAppUserID(): Promise<string>;
257
273
  /**
258
274
  * This function will logIn the current user with an appUserID. Typically this would be used after a log in
259
275
  * to identify a user without calling configure.
260
276
  * @param {String} appUserID The appUserID that should be linked to the currently user
261
- * @returns {Promise<LogInResult>} A promise of an object that contains the purchaserInfo after logging in, as well as a boolean indicating
262
- * whether the user has just been created for the first time in the RevenueCat backend.
277
+ * @returns {Promise<LogInResult>} A promise of an object that contains the purchaserInfo after logging in, as well
278
+ * as a boolean indicating whether the user has just been created for the first time in the RevenueCat backend. The
279
+ * promise will be rejected if setup has not been called yet or if there's an issue logging in.
263
280
  */
264
281
  static logIn(appUserID: string): Promise<LogInResult>;
265
282
  /**
266
283
  * Logs out the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache.
267
- * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and a userInfo object with more information.
284
+ * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code,
285
+ * and a userInfo object with more information. The promise will be rejected if setup has not been called yet or if
286
+ * there's an issue logging out.
268
287
  */
269
288
  static logOut(): Promise<PurchaserInfo>;
270
289
  /**
271
290
  * @deprecated, use logIn instead.
272
291
  * This function will alias two appUserIDs together.
273
- * @param {String} newAppUserID The new appUserID that should be linked to the currently identified appUserID. Needs to be a string.
274
- * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and a userInfo object with more information.
292
+ * @param {String} newAppUserID The new appUserID that should be linked to the currently identified appUserID.
293
+ * Needs to be a string.
294
+ * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and a
295
+ * userInfo object with more information. The promise will be rejected if setup has not been called yet or if
296
+ * there's an issue creating the alias.
275
297
  */
276
298
  static createAlias(newAppUserID: string): Promise<PurchaserInfo>;
277
299
  /**
278
300
  * @deprecated, use logIn instead.
279
- * This function will identify the current user with an appUserID. Typically this would be used after a logout to identify a new user without calling configure
301
+ * This function will identify the current user with an appUserID. Typically this would be used after a logout to
302
+ * identify a new user without calling configure
280
303
  * @param {String} newAppUserID The appUserID that should be linked to the currently user
281
- * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and a userInfo object with more information.
304
+ * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and an
305
+ * userInfo object with more information. The promise will be rejected if setup has not been called yet or if
306
+ * there's an issue identifying the user.
282
307
  */
283
308
  static identify(newAppUserID: string): Promise<PurchaserInfo>;
284
309
  /**
285
310
  * @deprecated, use logOut instead.
286
- * Resets the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache.
287
- * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and a userInfo object with more information.
311
+ * Resets the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the
312
+ * cache.
313
+ * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and an
314
+ * userInfo object with more information. The promise will be rejected if setup has not been called yet or if
315
+ * there's an issue resetting the user.
288
316
  */
289
317
  static reset(): Promise<PurchaserInfo>;
290
318
  /**
291
319
  * Enables/Disables debugs logs
292
320
  * @param {boolean} enabled Enable or not debug logs
293
321
  */
294
- static setDebugLogsEnabled(enabled: boolean): void;
322
+ static setDebugLogsEnabled(enabled: boolean): Promise<void>;
295
323
  /**
296
324
  * Gets current purchaser info
297
- * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and a userInfo object with more information.
325
+ * @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and an
326
+ * userInfo object with more information. The promise will be rejected if setup has not been called yet or if
327
+ * there's an issue getting the purchaser information.
298
328
  */
299
329
  static getPurchaserInfo(): Promise<PurchaserInfo>;
300
330
  /**
301
331
  * This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation
302
332
  * for subscriptions anytime a sync is needed, like after a successful purchase.
303
333
  *
304
- * @warning This function should only be called if you're not calling makePurchase.
334
+ * @warning This function should only be called if you're not calling purchaseProduct/purchasePackage.
335
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
336
+ * syncing purchases.
305
337
  */
306
- static syncPurchases(): void;
338
+ static syncPurchases(): Promise<void>;
307
339
  /**
308
340
  * Enable automatic collection of Apple Search Ad attribution. Disabled by default
309
341
  * @param {boolean} enabled Enable or not automatic apple search ads attribution collection
342
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
310
343
  */
311
- static setAutomaticAppleSearchAdsAttributionCollection(enabled: boolean): void;
344
+ static setAutomaticAppleSearchAdsAttributionCollection(enabled: boolean): Promise<void>;
312
345
  /**
313
346
  * @returns { Promise<boolean> } If the `appUserID` has been generated by RevenueCat or not.
347
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
314
348
  */
315
349
  static isAnonymous(): Promise<boolean>;
316
350
  /**
317
- * iOS only. Computes whether or not a user is eligible for the introductory pricing period of a given product.
318
- * You should use this method to determine whether or not you show the user the normal product price or the
319
- * introductory price. This also applies to trials (trials are considered a type of introductory pricing).
351
+ * iOS only. Computes whether or not a user is eligible for the introductory pricing period of a given product.
352
+ * You should use this method to determine whether or not you show the user the normal product price or the
353
+ * introductory price. This also applies to trials (trials are considered a type of introductory pricing).
320
354
  *
321
- * @note Subscription groups are automatically collected for determining eligibility. If RevenueCat can't
322
- * definitively compute the eligibility, most likely because of missing group information, it will return
323
- * `INTRO_ELIGIBILITY_STATUS_UNKNOWN`. The best course of action on unknown status is to display the non-intro
324
- * pricing, to not create a misleading situation. To avoid this, make sure you are testing with the latest version of
325
- * iOS so that the subscription group can be collected by the SDK. Android always returns INTRO_ELIGIBILITY_STATUS_UNKNOWN.
355
+ * @note Subscription groups are automatically collected for determining eligibility. If RevenueCat can't
356
+ * definitively compute the eligibility, most likely because of missing group information, it will return
357
+ * `INTRO_ELIGIBILITY_STATUS_UNKNOWN`. The best course of action on unknown status is to display the non-intro
358
+ * pricing, to not create a misleading situation. To avoid this, make sure you are testing with the latest version of
359
+ * iOS so that the subscription group can be collected by the SDK. Android always returns INTRO_ELIGIBILITY_STATUS_UNKNOWN.
326
360
  *
327
- * @param productIdentifiers Array of product identifiers for which you want to compute eligibility
328
- * @returns { Promise<[productId: string]: IntroEligibility> } A map of IntroEligility per productId
361
+ * @param productIdentifiers Array of product identifiers for which you want to compute eligibility
362
+ * @returns { Promise<[productId: string]: IntroEligibility> } A map of IntroEligility per productId. The promise
363
+ * will be rejected if setup has not been called yet or if there's in an error checking eligibility.
329
364
  */
330
365
  static checkTrialOrIntroductoryPriceEligibility(productIdentifiers: string[]): Promise<{
331
366
  [productId: string]: IntroEligibility;
332
367
  }>;
333
368
  /**
334
- * iOS only. Use this function to retrieve the `PurchasesPaymentDiscount` for a given `PurchasesPackage`.
369
+ * iOS only. Use this function to retrieve the `PurchasesPaymentDiscount` for a given `PurchasesPackage`.
335
370
  *
336
- * @param product The `PurchasesProduct` the user intends to purchase.
337
- * @param discount The `PurchasesDiscount` to apply to the product.
338
- * @returns { Promise<PurchasesPaymentDiscount> } Returns when the `PurchasesPaymentDiscount` is returned. Null is returned for Android and incompatible iOS versions.
371
+ * @param product The `PurchasesProduct` the user intends to purchase.
372
+ * @param discount The `PurchasesDiscount` to apply to the product.
373
+ * @returns { Promise<PurchasesPaymentDiscount> } Returns when the `PurchasesPaymentDiscount` is returned.
374
+ * Null is returned for Android and incompatible iOS versions. The promise will be rejected if setup has not been
375
+ * called yet or if there's an error getting the payment discount.
339
376
  */
340
377
  static getPaymentDiscount(product: PurchasesProduct, discount: PurchasesDiscount): Promise<PurchasesPaymentDiscount | undefined>;
341
378
  /**
@@ -347,13 +384,17 @@ export default class Purchases {
347
384
  *
348
385
  * This is useful for cases where purchaser information might have been updated outside of the app, like if a
349
386
  * promotional subscription is granted through the RevenueCat dashboard.
387
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or there's an error
388
+ * invalidating the purchaser info cache.
350
389
  */
351
- static invalidatePurchaserInfoCache(): void;
390
+ static invalidatePurchaserInfoCache(): Promise<void>;
352
391
  /** iOS only. Presents a code redemption sheet, useful for redeeming offer codes
353
392
  * Refer to https://docs.revenuecat.com/docs/ios-subscription-offers#offer-codes for more information on how
354
393
  * to configure and use offer codes
394
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or there's an error
395
+ * presenting the code redemption sheet.
355
396
  */
356
- static presentCodeRedemptionSheet(): void;
397
+ static presentCodeRedemptionSheet(): Promise<void>;
357
398
  /**
358
399
  * Subscriber attributes are useful for storing additional, structured information on a user.
359
400
  * Since attributes are writable using a public key they should not be used for
@@ -363,124 +404,178 @@ export default class Purchases {
363
404
  * restrictions refer to our guide: https://docs.revenuecat.com/docs/subscriber-attributes
364
405
  *
365
406
  * @param attributes Map of attributes by key. Set the value as an empty string to delete an attribute.
407
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or there's an error
408
+ * setting the subscriber attributes.
366
409
  */
367
410
  static setAttributes(attributes: {
368
411
  [key: string]: string | null;
369
- }): void;
412
+ }): Promise<void>;
370
413
  /**
371
414
  * Subscriber attribute associated with the email address for the user
372
415
  *
373
416
  * @param email Empty String or null will delete the subscriber attribute.
417
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
418
+ * setting the email.
374
419
  */
375
- static setEmail(email: string | null): void;
420
+ static setEmail(email: string | null): Promise<void>;
376
421
  /**
377
422
  * Subscriber attribute associated with the phone number for the user
378
423
  *
379
424
  * @param phoneNumber Empty String or null will delete the subscriber attribute.
425
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
426
+ * setting the phone number.
380
427
  */
381
- static setPhoneNumber(phoneNumber: string | null): void;
428
+ static setPhoneNumber(phoneNumber: string | null): Promise<void>;
382
429
  /**
383
430
  * Subscriber attribute associated with the display name for the user
384
431
  *
385
432
  * @param displayName Empty String or null will delete the subscriber attribute.
433
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
434
+ * setting the display name.
386
435
  */
387
- static setDisplayName(displayName: string | null): void;
436
+ static setDisplayName(displayName: string | null): Promise<void>;
388
437
  /**
389
438
  * Subscriber attribute associated with the push token for the user
390
439
  *
391
440
  * @param pushToken null will delete the subscriber attribute.
441
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
442
+ * setting the push token.
392
443
  */
393
- static setPushToken(pushToken: string | null): void;
444
+ static setPushToken(pushToken: string | null): Promise<void>;
394
445
  /**
395
- * Set this property to your proxy URL before configuring Purchases *only* if you've received a proxy key value from your RevenueCat contact.
446
+ * Set this property to your proxy URL before configuring Purchases *only* if you've received a proxy key value
447
+ * from your RevenueCat contact.
448
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
449
+ * setting the proxy url.
396
450
  */
397
- static setProxyURL(url: string): void;
451
+ static setProxyURL(url: string): Promise<void>;
398
452
  /**
399
453
  * Automatically collect subscriber attributes associated with the device identifiers.
400
454
  * $idfa, $idfv, $ip on iOS
401
455
  * $gpsAdId, $androidId, $ip on Android
456
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
457
+ * setting collecting the device identifiers.
402
458
  */
403
- static collectDeviceIdentifiers(): void;
459
+ static collectDeviceIdentifiers(): Promise<void>;
404
460
  /**
405
461
  * Subscriber attribute associated with the Adjust Id for the user
406
462
  * Required for the RevenueCat Adjust integration
407
463
  *
408
464
  * @param adjustID Empty String or null will delete the subscriber attribute.
465
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
466
+ * setting Adjust ID.
409
467
  */
410
- static setAdjustID(adjustID: string | null): void;
468
+ static setAdjustID(adjustID: string | null): Promise<void>;
411
469
  /**
412
470
  * Subscriber attribute associated with the AppsFlyer Id for the user
413
471
  * Required for the RevenueCat AppsFlyer integration
414
472
  * @param appsflyerID Empty String or null will delete the subscriber attribute.
473
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
474
+ * setting the Appsflyer ID.
415
475
  */
416
- static setAppsflyerID(appsflyerID: string | null): void;
476
+ static setAppsflyerID(appsflyerID: string | null): Promise<void>;
417
477
  /**
418
478
  * Subscriber attribute associated with the Facebook SDK Anonymous Id for the user
419
479
  * Recommended for the RevenueCat Facebook integration
420
480
  *
421
481
  * @param fbAnonymousID Empty String or null will delete the subscriber attribute.
482
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
483
+ * setting the Facebook Anonymous ID.
422
484
  */
423
- static setFBAnonymousID(fbAnonymousID: string | null): void;
485
+ static setFBAnonymousID(fbAnonymousID: string | null): Promise<void>;
424
486
  /**
425
487
  * Subscriber attribute associated with the mParticle Id for the user
426
488
  * Recommended for the RevenueCat mParticle integration
427
489
  *
428
490
  * @param mparticleID Empty String or null will delete the subscriber attribute.
491
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
492
+ * setting the Mparticle ID.
429
493
  */
430
- static setMparticleID(mparticleID: string | null): void;
494
+ static setMparticleID(mparticleID: string | null): Promise<void>;
431
495
  /**
432
496
  * Subscriber attribute associated with the OneSignal Player Id for the user
433
497
  * Required for the RevenueCat OneSignal integration
434
498
  *
435
499
  * @param onesignalID Empty String or null will delete the subscriber attribute.
500
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
501
+ * setting the Onesignal ID.
502
+ */
503
+ static setOnesignalID(onesignalID: string | null): Promise<void>;
504
+ /**
505
+ * Subscriber attribute associated with the Airship Channel Id for the user
506
+ * Required for the RevenueCat Airship integration
507
+ *
508
+ * @param airshipChannelID Empty String or null will delete the subscriber attribute.
509
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
510
+ * setting the Airship Channel ID.
436
511
  */
437
- static setOnesignalID(onesignalID: string | null): void;
512
+ static setAirshipChannelID(airshipChannelID: string | null): Promise<void>;
438
513
  /**
439
514
  * Subscriber attribute associated with the install media source for the user
440
515
  *
441
516
  * @param mediaSource Empty String or null will delete the subscriber attribute.
517
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
518
+ * setting the media source.
442
519
  */
443
- static setMediaSource(mediaSource: string | null): void;
520
+ static setMediaSource(mediaSource: string | null): Promise<void>;
444
521
  /**
445
522
  * Subscriber attribute associated with the install campaign for the user
446
523
  *
447
524
  * @param campaign Empty String or null will delete the subscriber attribute.
525
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
526
+ * setting the campaign.
448
527
  */
449
- static setCampaign(campaign: string | null): void;
528
+ static setCampaign(campaign: string | null): Promise<void>;
450
529
  /**
451
530
  * Subscriber attribute associated with the install ad group for the user
452
531
  *
453
532
  * @param adGroup Empty String or null will delete the subscriber attribute.
533
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
534
+ * setting ad group.
454
535
  */
455
- static setAdGroup(adGroup: string | null): void;
536
+ static setAdGroup(adGroup: string | null): Promise<void>;
456
537
  /**
457
538
  * Subscriber attribute associated with the install ad for the user
458
539
  *
459
540
  * @param ad Empty String or null will delete the subscriber attribute.
541
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
542
+ * setting the ad subscriber attribute.
460
543
  */
461
- static setAd(ad: string | null): void;
544
+ static setAd(ad: string | null): Promise<void>;
462
545
  /**
463
546
  * Subscriber attribute associated with the install keyword for the user
464
547
  *
465
548
  * @param keyword Empty String or null will delete the subscriber attribute.
549
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
550
+ * setting the keyword.
466
551
  */
467
- static setKeyword(keyword: string | null): void;
552
+ static setKeyword(keyword: string | null): Promise<void>;
468
553
  /**
469
554
  * Subscriber attribute associated with the install ad creative for the user
470
555
  *
471
556
  * @param creative Empty String or null will delete the subscriber attribute.
557
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet or if there's an error
558
+ * setting the creative subscriber attribute.
472
559
  */
473
- static setCreative(creative: string | null): void;
560
+ static setCreative(creative: string | null): Promise<void>;
474
561
  /**
475
562
  * Check if billing is supported for the current user (meaning IN-APP purchases are supported)
476
563
  * and optionally, whether a list of specified feature types are supported.
477
564
  *
478
565
  * Note: Billing features are only relevant to Google Play Android users.
479
566
  * For other stores and platforms, billing features won't be checked.
567
+ *
480
568
  * @param feature An array of feature types to check for support. Feature types must be one of
481
569
  * [BILLING_FEATURE]. By default, is an empty list and no specific feature support will be checked.
482
- * @returns {Promise<Boolean>} promise with boolean response
570
+ * @returns {Promise<Boolean>} promise with boolean response. True if billing is supported, false otherwise.
483
571
  */
484
572
  static canMakePayments(features?: BILLING_FEATURE[]): Promise<boolean>;
573
+ /**
574
+ * Check if setup has finished and Purchases has been configured.
575
+ *
576
+ * @returns {Promise<Boolean>} promise with boolean response
577
+ */
578
+ static isConfigured(): Promise<boolean>;
579
+ private static throwIfNotConfigured;
485
580
  }
486
581
  export {};