react-native-purchases 9.9.0 → 9.10.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.
@@ -25,6 +25,6 @@ Pod::Spec.new do |spec|
25
25
  ]
26
26
 
27
27
  spec.dependency "React-Core"
28
- spec.dependency "PurchasesHybridCommon", '17.37.0'
28
+ spec.dependency "PurchasesHybridCommon", '17.40.0'
29
29
  spec.swift_version = '5.7'
30
30
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '9.9.0'
32
+ versionName '9.10.1'
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:17.37.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:17.40.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -49,8 +49,9 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
49
49
  private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
50
50
  private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
51
51
  private static final String TRACKED_EVENT = "Purchases-TrackedEvent";
52
+ private static final String DEBUG_EVENT = "Purchases-DebugEvent";
52
53
  public static final String PLATFORM_NAME = "react-native";
53
- public static final String PLUGIN_VERSION = "9.9.0";
54
+ public static final String PLUGIN_VERSION = "9.10.1";
54
55
 
55
56
  private final ReactApplicationContext reactContext;
56
57
 
@@ -302,6 +303,15 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
302
303
  });
303
304
  }
304
305
 
306
+ @ReactMethod
307
+ public void setDebugEventListener() {
308
+ CommonKt.setDebugEventListener(eventDetails -> {
309
+ reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
310
+ .emit(RNPurchasesModule.DEBUG_EVENT, convertMapToWriteableMap(eventDetails));
311
+ return null;
312
+ });
313
+ }
314
+
305
315
  @ReactMethod
306
316
  public void getCustomerInfo(final Promise promise) {
307
317
  CommonKt.getCustomerInfo(getOnResult(promise));
@@ -114,7 +114,6 @@ export default class Purchases {
114
114
  * @param {boolean} [diagnosticsEnabled=false] An optional boolean. Set this to true to enable SDK diagnostics.
115
115
  * @param {boolean} [automaticDeviceIdentifierCollectionEnabled=true] An optional boolean. Set this to true to allow the collection of identifiers when setting the identifier for an attribution network.
116
116
  * @param {String?} [preferredUILocaleOverride] An optional string. Set this to the preferred UI locale to use for RevenueCat UI components.
117
- * @param {TrackedEventListener?} [trackedEventListener] An optional listener for tracked feature events. This is a debug API for monitoring paywall and customer center events.
118
117
  *
119
118
  * @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
120
119
  */
package/dist/purchases.js CHANGED
@@ -75,6 +75,7 @@ var customerInfoUpdateListeners = [];
75
75
  var shouldPurchasePromoProductListeners = [];
76
76
  var customLogHandler;
77
77
  var trackedEventListeners = [];
78
+ var debugEventListeners = [];
78
79
  eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-CustomerInfoUpdated", function (customerInfo) {
79
80
  customerInfoUpdateListeners.forEach(function (listener) { return listener(customerInfo); });
80
81
  });
@@ -94,6 +95,9 @@ eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addList
94
95
  eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-TrackedEvent", function (eventDictionary) {
95
96
  trackedEventListeners.forEach(function (listener) { return listener({ eventDictionary: eventDictionary }); });
96
97
  });
98
+ eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-DebugEvent", function (eventDictionary) {
99
+ debugEventListeners.forEach(function (listener) { return listener({ eventDictionary: eventDictionary }); });
100
+ });
97
101
  var Purchases = /** @class */ (function () {
98
102
  function Purchases() {
99
103
  }
@@ -112,7 +116,6 @@ var Purchases = /** @class */ (function () {
112
116
  * @param {boolean} [diagnosticsEnabled=false] An optional boolean. Set this to true to enable SDK diagnostics.
113
117
  * @param {boolean} [automaticDeviceIdentifierCollectionEnabled=true] An optional boolean. Set this to true to allow the collection of identifiers when setting the identifier for an attribution network.
114
118
  * @param {String?} [preferredUILocaleOverride] An optional string. Set this to the preferred UI locale to use for RevenueCat UI components.
115
- * @param {TrackedEventListener?} [trackedEventListener] An optional listener for tracked feature events. This is a debug API for monitoring paywall and customer center events.
116
119
  *
117
120
  * @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
118
121
  */
@@ -698,6 +701,45 @@ var Purchases = /** @class */ (function () {
698
701
  Purchases.removeTrackedEventListener = function (trackedEventListener) {
699
702
  trackedEventListeners = trackedEventListeners.filter(function (listener) { return listener !== trackedEventListener; });
700
703
  };
704
+ /**
705
+ * Sets a function to be called when a debug event is tracked by RevenueCat.
706
+ * This is a debug API for monitoring debug events not meant for public use.
707
+ * Currently only works on Android.
708
+ * @internal
709
+ * @param {DebugEventListener} debugEventListener DebugEvent listener
710
+ */
711
+ Purchases.addDebugEventListener = function (debugEventListener) {
712
+ return __awaiter(this, void 0, void 0, function () {
713
+ var isFirstListener;
714
+ return __generator(this, function (_a) {
715
+ switch (_a.label) {
716
+ case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
717
+ case 1:
718
+ _a.sent();
719
+ if (react_native_2.Platform.OS === "android") {
720
+ if (typeof debugEventListener !== "function") {
721
+ throw new Error("addDebugEventListener needs a function");
722
+ }
723
+ isFirstListener = debugEventListeners.length === 0;
724
+ debugEventListeners.push(debugEventListener);
725
+ if (isFirstListener && !usingBrowserMode) {
726
+ RNPurchases.setDebugEventListener();
727
+ }
728
+ }
729
+ return [2 /*return*/];
730
+ }
731
+ });
732
+ });
733
+ };
734
+ /**
735
+ * Removes a given DebugEventListener.
736
+ * This is a debug API not meant for public use.
737
+ * @internal
738
+ * @param debugEventListener DebugEventListener listener to remove
739
+ */
740
+ Purchases.removeDebugEventListener = function (debugEventListener) {
741
+ debugEventListeners = debugEventListeners.filter(function (listener) { return listener !== debugEventListener; });
742
+ };
701
743
  /**
702
744
  * Gets current customer info
703
745
  * @returns {Promise<CustomerInfo>} A promise of a customer info object. Rejections return an error code, and an
package/ios/RNPurchases.m CHANGED
@@ -29,6 +29,7 @@ NSString *RNPurchasesCustomerInfoUpdatedEvent = @"Purchases-CustomerInfoUpdated"
29
29
  NSString *RNPurchasesShouldPurchasePromoProductEvent = @"Purchases-ShouldPurchasePromoProduct";
30
30
  NSString *RNPurchasesLogHandlerEvent = @"Purchases-LogHandlerEvent";
31
31
  NSString *RNPurchasesTrackedEvent = @"Purchases-TrackedEvent";
32
+ NSString *RNPurchasesDebugEvent = @"Purchases-DebugEvent";
32
33
 
33
34
  @implementation RNPurchases
34
35
 
@@ -40,7 +41,8 @@ NSString *RNPurchasesTrackedEvent = @"Purchases-TrackedEvent";
40
41
  return @[RNPurchasesCustomerInfoUpdatedEvent,
41
42
  RNPurchasesShouldPurchasePromoProductEvent,
42
43
  RNPurchasesLogHandlerEvent,
43
- RNPurchasesTrackedEvent];
44
+ RNPurchasesTrackedEvent,
45
+ RNPurchasesDebugEvent];
44
46
  }
45
47
 
46
48
  - (void)sendEventWithName:(NSString *)name body:(id)body {
@@ -673,7 +675,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
673
675
  }
674
676
 
675
677
  - (NSString *)platformFlavorVersion {
676
- return @"9.9.0";
678
+ return @"9.10.1";
677
679
  }
678
680
 
679
681
  @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": "9.9.0",
4
+ "version": "9.10.1",
5
5
  "description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android. ",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -114,7 +114,7 @@
114
114
  ]
115
115
  },
116
116
  "dependencies": {
117
- "@revenuecat/purchases-js-hybrid-mappings": "17.37.0",
118
- "@revenuecat/purchases-typescript-internal": "17.37.0"
117
+ "@revenuecat/purchases-js-hybrid-mappings": "17.40.0",
118
+ "@revenuecat/purchases-typescript-internal": "17.40.0"
119
119
  }
120
120
  }