react-native-purchases 9.7.2 → 9.7.4

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.29.0'
28
+ spec.dependency "PurchasesHybridCommon", '17.30.1'
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.7.2'
32
+ versionName '9.7.4'
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.29.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:17.30.1'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -28,6 +28,8 @@ import com.revenuecat.purchases.hybridcommon.OnResult;
28
28
  import com.revenuecat.purchases.hybridcommon.OnResultAny;
29
29
  import com.revenuecat.purchases.hybridcommon.OnResultList;
30
30
  import com.revenuecat.purchases.hybridcommon.SubscriberAttributesKt;
31
+
32
+ import kotlin.jvm.functions.Function1;
31
33
  import com.revenuecat.purchases.hybridcommon.mappers.CustomerInfoMapperKt;
32
34
  import com.revenuecat.purchases.interfaces.UpdatedCustomerInfoListener;
33
35
  import com.revenuecat.purchases.models.InAppMessageType;
@@ -46,8 +48,9 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
46
48
 
47
49
  private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
48
50
  private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
51
+ private static final String TRACKED_EVENT = "Purchases-TrackedEvent";
49
52
  public static final String PLATFORM_NAME = "react-native";
50
- public static final String PLUGIN_VERSION = "9.7.2";
53
+ public static final String PLUGIN_VERSION = "9.7.4";
51
54
 
52
55
  private final ReactApplicationContext reactContext;
53
56
 
@@ -290,6 +293,15 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
290
293
  });
291
294
  }
292
295
 
296
+ @ReactMethod
297
+ public void setTrackedEventListener() {
298
+ CommonKt.setTrackedEventListener(eventDetails -> {
299
+ reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
300
+ .emit(RNPurchasesModule.TRACKED_EVENT, convertMapToWriteableMap(eventDetails));
301
+ return null;
302
+ });
303
+ }
304
+
293
305
  @ReactMethod
294
306
  public void getCustomerInfo(final Promise promise) {
295
307
  CommonKt.getCustomerInfo(getOnResult(promise));
@@ -97,13 +97,7 @@ export default class Purchases {
97
97
  * @enum {string}
98
98
  */
99
99
  static PURCHASES_ARE_COMPLETED_BY_TYPE: typeof PURCHASES_ARE_COMPLETED_BY_TYPE;
100
- /**
101
- * @internal
102
- */
103
100
  static UninitializedPurchasesError: typeof UninitializedPurchasesError;
104
- /**
105
- * @internal
106
- */
107
101
  static UnsupportedPlatformError: typeof UnsupportedPlatformError;
108
102
  /**
109
103
  * Sets up Purchases with your API key and an app user id.
@@ -120,6 +114,7 @@ export default class Purchases {
120
114
  * @param {boolean} [diagnosticsEnabled=false] An optional boolean. Set this to true to enable SDK diagnostics.
121
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.
122
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.
123
118
  *
124
119
  * @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
125
120
  */
package/dist/purchases.js CHANGED
@@ -58,6 +58,7 @@ var eventEmitter = usingBrowserMode ? null : new react_native_1.NativeEventEmitt
58
58
  var customerInfoUpdateListeners = [];
59
59
  var shouldPurchasePromoProductListeners = [];
60
60
  var customLogHandler;
61
+ var trackedEventListeners = [];
61
62
  eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-CustomerInfoUpdated", function (customerInfo) {
62
63
  customerInfoUpdateListeners.forEach(function (listener) { return listener(customerInfo); });
63
64
  });
@@ -72,6 +73,9 @@ eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addList
72
73
  var logLevelEnum = purchases_typescript_internal_1.LOG_LEVEL[logLevel];
73
74
  customLogHandler(logLevelEnum, message);
74
75
  });
76
+ eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-TrackedEvent", function (eventDictionary) {
77
+ trackedEventListeners.forEach(function (listener) { return listener({ eventDictionary: eventDictionary }); });
78
+ });
75
79
  var Purchases = /** @class */ (function () {
76
80
  function Purchases() {
77
81
  }
@@ -90,6 +94,7 @@ var Purchases = /** @class */ (function () {
90
94
  * @param {boolean} [diagnosticsEnabled=false] An optional boolean. Set this to true to enable SDK diagnostics.
91
95
  * @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.
92
96
  * @param {String?} [preferredUILocaleOverride] An optional string. Set this to the preferred UI locale to use for RevenueCat UI components.
97
+ * @param {TrackedEventListener?} [trackedEventListener] An optional listener for tracked feature events. This is a debug API for monitoring paywall and customer center events.
93
98
  *
94
99
  * @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
95
100
  */
@@ -635,6 +640,45 @@ var Purchases = /** @class */ (function () {
635
640
  RNPurchases.setLogHandler();
636
641
  }
637
642
  };
643
+ /**
644
+ * Sets a function to be called when a feature event is tracked by RevenueCatUI.
645
+ * This is a debug API for monitoring paywall and customer center events not meant for public use.
646
+ * Currently only works on Android.
647
+ * @internal
648
+ * @param {TrackedEventListener} trackedEventListener TrackedEvent listener
649
+ */
650
+ Purchases.addTrackedEventListener = function (trackedEventListener) {
651
+ return __awaiter(this, void 0, void 0, function () {
652
+ var isFirstListener;
653
+ return __generator(this, function (_a) {
654
+ switch (_a.label) {
655
+ case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
656
+ case 1:
657
+ _a.sent();
658
+ if (react_native_2.Platform.OS === "android") {
659
+ if (typeof trackedEventListener !== "function") {
660
+ throw new Error("addTrackedEventListener needs a function");
661
+ }
662
+ isFirstListener = trackedEventListeners.length === 0;
663
+ trackedEventListeners.push(trackedEventListener);
664
+ if (isFirstListener && !usingBrowserMode) {
665
+ RNPurchases.setTrackedEventListener();
666
+ }
667
+ }
668
+ return [2 /*return*/];
669
+ }
670
+ });
671
+ });
672
+ };
673
+ /**
674
+ * Removes a given TrackedEventListener.
675
+ * This is a debug API not meant for public use.
676
+ * @internal
677
+ * @param trackedEventListener TrackedEvent listener to remove
678
+ */
679
+ Purchases.removeTrackedEventListener = function (trackedEventListener) {
680
+ trackedEventListeners = trackedEventListeners.filter(function (listener) { return listener !== trackedEventListener; });
681
+ };
638
682
  /**
639
683
  * Gets current customer info
640
684
  * @returns {Promise<CustomerInfo>} A promise of a customer info object. Rejections return an error code, and an
@@ -1959,13 +2003,7 @@ var Purchases = /** @class */ (function () {
1959
2003
  * @enum {string}
1960
2004
  */
1961
2005
  Purchases.PURCHASES_ARE_COMPLETED_BY_TYPE = purchases_typescript_internal_1.PURCHASES_ARE_COMPLETED_BY_TYPE;
1962
- /**
1963
- * @internal
1964
- */
1965
2006
  Purchases.UninitializedPurchasesError = purchases_typescript_internal_1.UninitializedPurchasesError;
1966
- /**
1967
- * @internal
1968
- */
1969
2007
  Purchases.UnsupportedPlatformError = purchases_typescript_internal_1.UnsupportedPlatformError;
1970
2008
  return Purchases;
1971
2009
  }());
package/ios/RNPurchases.m CHANGED
@@ -672,7 +672,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
672
672
  }
673
673
 
674
674
  - (NSString *)platformFlavorVersion {
675
- return @"9.7.2";
675
+ return @"9.7.4";
676
676
  }
677
677
 
678
678
  @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.7.2",
4
+ "version": "9.7.4",
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.29.0",
118
- "@revenuecat/purchases-typescript-internal": "17.29.0"
117
+ "@revenuecat/purchases-js-hybrid-mappings": "17.30.1",
118
+ "@revenuecat/purchases-typescript-internal": "17.30.1"
119
119
  }
120
120
  }