react-native-purchases 5.10.1 → 5.11.0

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.
@@ -24,6 +24,6 @@ Pod::Spec.new do |spec|
24
24
  ]
25
25
 
26
26
  spec.dependency "React-Core"
27
- spec.dependency "PurchasesHybridCommon", '4.13.2'
27
+ spec.dependency "PurchasesHybridCommon", '4.13.4'
28
28
  spec.swift_version = '5.0'
29
29
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '5.10.1'
32
+ versionName '5.11.0'
33
33
  }
34
34
 
35
35
  buildTypes {
@@ -121,6 +121,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
121
121
  dependencies {
122
122
  //noinspection GradleDynamicVersion
123
123
  api 'com.facebook.react:react-native:+'
124
- implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.13.2'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.13.4'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -385,6 +385,15 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
385
385
  });
386
386
  }
387
387
 
388
+ @ReactMethod
389
+ public void syncObserverModeAmazonPurchase(String productID, String receiptID,
390
+ String amazonUserID, String isoCurrencyCode,
391
+ Double price, final Promise promise) {
392
+ Purchases.getSharedInstance().syncObserverModeAmazonPurchase(productID, receiptID,
393
+ amazonUserID, isoCurrencyCode, price);
394
+ promise.resolve(null);
395
+ }
396
+
388
397
  // endregion
389
398
 
390
399
  //================================================================================
@@ -131,13 +131,13 @@ export default class Purchases {
131
131
  * Currently, these are only relevant for Google Play Android users:
132
132
  * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType
133
133
  * @readonly
134
- * @enum {string}
134
+ * @enum {string}
135
135
  */
136
136
  static BILLING_FEATURE: typeof BILLING_FEATURE;
137
137
  /**
138
138
  * Enum with possible return states for beginning refund request.
139
139
  * @readonly
140
- * @enum {string}
140
+ * @enum {string}
141
141
  */
142
142
  static REFUND_REQUEST_STATUS: typeof REFUND_REQUEST_STATUS;
143
143
  /**
@@ -366,6 +366,21 @@ export default class Purchases {
366
366
  * syncing purchases.
367
367
  */
368
368
  static syncPurchases(): Promise<void>;
369
+ /**
370
+ * This method will send a purchase to the RevenueCat backend. This function should only be called if you are
371
+ * in Amazon observer mode or performing a client side migration of your current users to RevenueCat.
372
+ *
373
+ * The receipt IDs are cached if successfully posted so they are not posted more than once.
374
+ *
375
+ * @param {string} productID Product ID associated to the purchase.
376
+ * @param {string} receiptID ReceiptId that represents the Amazon purchase.
377
+ * @param {string} amazonUserID Amazon's userID. This parameter will be ignored when syncing a Google purchase.
378
+ * @param {(string|null|undefined)} isoCurrencyCode Product's currency code in ISO 4217 format.
379
+ * @param {(number|null|undefined)} price Product's price.
380
+ * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
381
+ * syncing purchases.
382
+ */
383
+ static syncObserverModeAmazonPurchase(productID: string, receiptID: string, amazonUserID: string, isoCurrencyCode?: string | null, price?: number | null): Promise<void>;
369
384
  /**
370
385
  * @deprecated, use enableAdServicesAttributionTokenCollection instead.
371
386
  * Enable automatic collection of Apple Search Ad attribution. Disabled by default
@@ -681,5 +696,6 @@ export default class Purchases {
681
696
  static isConfigured(): Promise<boolean>;
682
697
  private static throwIfNotConfigured;
683
698
  private static throwIfAndroidPlatform;
699
+ private static throwIfIOSPlatform;
684
700
  private static convertIntToRefundRequestStatus;
685
701
  }
package/dist/purchases.js CHANGED
@@ -551,6 +551,36 @@ var Purchases = /** @class */ (function () {
551
551
  });
552
552
  });
553
553
  };
554
+ /**
555
+ * This method will send a purchase to the RevenueCat backend. This function should only be called if you are
556
+ * in Amazon observer mode or performing a client side migration of your current users to RevenueCat.
557
+ *
558
+ * The receipt IDs are cached if successfully posted so they are not posted more than once.
559
+ *
560
+ * @param {string} productID Product ID associated to the purchase.
561
+ * @param {string} receiptID ReceiptId that represents the Amazon purchase.
562
+ * @param {string} amazonUserID Amazon's userID. This parameter will be ignored when syncing a Google purchase.
563
+ * @param {(string|null|undefined)} isoCurrencyCode Product's currency code in ISO 4217 format.
564
+ * @param {(number|null|undefined)} price Product's price.
565
+ * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
566
+ * syncing purchases.
567
+ */
568
+ Purchases.syncObserverModeAmazonPurchase = function (productID, receiptID, amazonUserID, isoCurrencyCode, price) {
569
+ return __awaiter(this, void 0, void 0, function () {
570
+ return __generator(this, function (_a) {
571
+ switch (_a.label) {
572
+ case 0: return [4 /*yield*/, Purchases.throwIfIOSPlatform()];
573
+ case 1:
574
+ _a.sent();
575
+ return [4 /*yield*/, Purchases.throwIfNotConfigured()];
576
+ case 2:
577
+ _a.sent();
578
+ RNPurchases.syncObserverModeAmazonPurchase(productID, receiptID, amazonUserID, isoCurrencyCode, price);
579
+ return [2 /*return*/];
580
+ }
581
+ });
582
+ });
583
+ };
554
584
  /**
555
585
  * @deprecated, use enableAdServicesAttributionTokenCollection instead.
556
586
  * Enable automatic collection of Apple Search Ad attribution. Disabled by default
@@ -1308,6 +1338,16 @@ var Purchases = /** @class */ (function () {
1308
1338
  });
1309
1339
  });
1310
1340
  };
1341
+ Purchases.throwIfIOSPlatform = function () {
1342
+ return __awaiter(this, void 0, void 0, function () {
1343
+ return __generator(this, function (_a) {
1344
+ if (react_native_2.Platform.OS === "ios") {
1345
+ throw new errors_1.UnsupportedPlatformError();
1346
+ }
1347
+ return [2 /*return*/];
1348
+ });
1349
+ });
1350
+ };
1311
1351
  Purchases.convertIntToRefundRequestStatus = function (refundRequestStatusInt) {
1312
1352
  switch (refundRequestStatusInt) {
1313
1353
  case 0:
@@ -1329,13 +1369,13 @@ var Purchases = /** @class */ (function () {
1329
1369
  * Currently, these are only relevant for Google Play Android users:
1330
1370
  * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType
1331
1371
  * @readonly
1332
- * @enum {string}
1372
+ * @enum {string}
1333
1373
  */
1334
1374
  Purchases.BILLING_FEATURE = BILLING_FEATURE;
1335
1375
  /**
1336
1376
  * Enum with possible return states for beginning refund request.
1337
1377
  * @readonly
1338
- * @enum {string}
1378
+ * @enum {string}
1339
1379
  */
1340
1380
  Purchases.REFUND_REQUEST_STATUS = REFUND_REQUEST_STATUS;
1341
1381
  /**
package/ios/RNPurchases.m CHANGED
@@ -439,7 +439,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
439
439
  }
440
440
 
441
441
  - (NSString *)platformFlavorVersion {
442
- return @"5.10.1";
442
+ return @"5.11.0";
443
443
  }
444
444
 
445
445
  @end
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-purchases",
3
3
  "title": "React Native Purchases",
4
- "version": "5.10.1",
4
+ "version": "5.11.0",
5
5
  "description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android. ",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -2,7 +2,7 @@
2
2
  <!DOCTYPE html>
3
3
  <html>
4
4
  <head>
5
- <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.10.1/" />
5
+ <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.11.0/" />
6
6
  </head>
7
7
  <body>
8
8
  </body>
@@ -743,6 +743,7 @@ NativeModules.RNPurchases = {
743
743
  logIn: jest.fn(),
744
744
  logOut: jest.fn(),
745
745
  syncPurchases: jest.fn(),
746
+ syncObserverModeAmazonPurchase: jest.fn(),
746
747
  setFinishTransactions: jest.fn(),
747
748
  purchaseProduct: jest.fn(),
748
749
  purchasePackage: jest.fn(),