react-native-purchases 10.1.2 → 10.2.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", '18.7.0'
28
+ spec.dependency "PurchasesHybridCommon", '18.9.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 '10.1.2'
32
+ versionName '10.2.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:18.7.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.9.1'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -51,7 +51,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
51
51
  private static final String TRACKED_EVENT = "Purchases-TrackedEvent";
52
52
  private static final String DEBUG_EVENT = "Purchases-DebugEvent";
53
53
  public static final String PLATFORM_NAME = "react-native";
54
- public static final String PLUGIN_VERSION = "10.1.2";
54
+ public static final String PLUGIN_VERSION = "10.2.1";
55
55
 
56
56
  private final ReactApplicationContext reactContext;
57
57
 
@@ -626,6 +626,31 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
626
626
  CommonKt.trackCustomPaywallImpression(data.toHashMap());
627
627
  }
628
628
 
629
+ @ReactMethod
630
+ public void trackAdDisplayed(ReadableMap data) {
631
+ CommonKt.trackAdDisplayed(data.toHashMap());
632
+ }
633
+
634
+ @ReactMethod
635
+ public void trackAdOpened(ReadableMap data) {
636
+ CommonKt.trackAdOpened(data.toHashMap());
637
+ }
638
+
639
+ @ReactMethod
640
+ public void trackAdLoaded(ReadableMap data) {
641
+ CommonKt.trackAdLoaded(data.toHashMap());
642
+ }
643
+
644
+ @ReactMethod
645
+ public void trackAdRevenue(ReadableMap data) {
646
+ CommonKt.trackAdRevenue(data.toHashMap());
647
+ }
648
+
649
+ @ReactMethod
650
+ public void trackAdFailedToLoad(ReadableMap data) {
651
+ CommonKt.trackAdFailedToLoad(data.toHashMap());
652
+ }
653
+
629
654
  // endregion
630
655
 
631
656
  //================================================================================
@@ -83,4 +83,9 @@ export declare const browserNativeModuleRNPurchases: {
83
83
  getVirtualCurrencies: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesVirtualCurrencies>;
84
84
  invalidateVirtualCurrenciesCache: () => Promise<void>;
85
85
  getCachedVirtualCurrencies: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesVirtualCurrencies | null>;
86
+ trackAdDisplayed: (_data: any) => Promise<void>;
87
+ trackAdOpened: (_data: any) => Promise<void>;
88
+ trackAdLoaded: (_data: any) => Promise<void>;
89
+ trackAdRevenue: (_data: any) => Promise<void>;
90
+ trackAdFailedToLoad: (_data: any) => Promise<void>;
86
91
  };
@@ -591,4 +591,34 @@ exports.browserNativeModuleRNPurchases = {
591
591
  return [2 /*return*/, cachedVirtualCurrencies ? (0, typeGuards_1.validateAndTransform)(cachedVirtualCurrencies, typeGuards_1.isPurchasesVirtualCurrencies, 'PurchasesVirtualCurrencies') : null];
592
592
  });
593
593
  }); },
594
+ trackAdDisplayed: function (_data) { return __awaiter(void 0, void 0, void 0, function () {
595
+ return __generator(this, function (_a) {
596
+ (0, utils_1.methodNotSupportedOnWeb)('trackAdDisplayed');
597
+ return [2 /*return*/];
598
+ });
599
+ }); },
600
+ trackAdOpened: function (_data) { return __awaiter(void 0, void 0, void 0, function () {
601
+ return __generator(this, function (_a) {
602
+ (0, utils_1.methodNotSupportedOnWeb)('trackAdOpened');
603
+ return [2 /*return*/];
604
+ });
605
+ }); },
606
+ trackAdLoaded: function (_data) { return __awaiter(void 0, void 0, void 0, function () {
607
+ return __generator(this, function (_a) {
608
+ (0, utils_1.methodNotSupportedOnWeb)('trackAdLoaded');
609
+ return [2 /*return*/];
610
+ });
611
+ }); },
612
+ trackAdRevenue: function (_data) { return __awaiter(void 0, void 0, void 0, function () {
613
+ return __generator(this, function (_a) {
614
+ (0, utils_1.methodNotSupportedOnWeb)('trackAdRevenue');
615
+ return [2 /*return*/];
616
+ });
617
+ }); },
618
+ trackAdFailedToLoad: function (_data) { return __awaiter(void 0, void 0, void 0, function () {
619
+ return __generator(this, function (_a) {
620
+ (0, utils_1.methodNotSupportedOnWeb)('trackAdFailedToLoad');
621
+ return [2 /*return*/];
622
+ });
623
+ }); },
594
624
  };
@@ -20,6 +20,90 @@ export interface TrackCustomPaywallImpressionOptions {
20
20
  */
21
21
  offeringId?: string | null;
22
22
  }
23
+ /**
24
+ * Predefined mediator name constants. Use these or pass any string for unlisted networks.
25
+ * @beta
26
+ */
27
+ export declare const AdMediatorName: {
28
+ readonly adMob: "AdMob";
29
+ readonly appLovin: "AppLovin";
30
+ };
31
+ /** @beta */
32
+ export type AdMediatorName = string;
33
+ /**
34
+ * Predefined ad format constants. Use these or pass any string for unlisted formats.
35
+ * @beta
36
+ */
37
+ export declare const AdFormat: {
38
+ readonly other: "other";
39
+ readonly banner: "banner";
40
+ readonly interstitial: "interstitial";
41
+ readonly rewarded: "rewarded";
42
+ readonly rewardedInterstitial: "rewarded_interstitial";
43
+ readonly nativeAd: "native";
44
+ readonly appOpen: "app_open";
45
+ };
46
+ /** @beta */
47
+ export type AdFormat = string;
48
+ /**
49
+ * Predefined precision constants for ad revenue. Use these or pass any string for unlisted values.
50
+ * @beta
51
+ */
52
+ export declare const AdRevenuePrecision: {
53
+ readonly exact: "exact";
54
+ readonly publisherDefined: "publisher_defined";
55
+ readonly estimated: "estimated";
56
+ readonly unknown: "unknown";
57
+ };
58
+ /** @beta */
59
+ export type AdRevenuePrecision = string;
60
+ /** @beta */
61
+ export interface AdDisplayedData {
62
+ mediatorName: AdMediatorName;
63
+ adFormat: AdFormat;
64
+ adUnitId: string;
65
+ impressionId: string;
66
+ networkName?: string | null;
67
+ placement?: string | null;
68
+ }
69
+ /** @beta */
70
+ export interface AdOpenedData {
71
+ mediatorName: AdMediatorName;
72
+ adFormat: AdFormat;
73
+ adUnitId: string;
74
+ impressionId: string;
75
+ networkName?: string | null;
76
+ placement?: string | null;
77
+ }
78
+ /** @beta */
79
+ export interface AdLoadedData {
80
+ mediatorName: AdMediatorName;
81
+ adFormat: AdFormat;
82
+ adUnitId: string;
83
+ impressionId: string;
84
+ networkName?: string | null;
85
+ placement?: string | null;
86
+ }
87
+ /** @beta */
88
+ export interface AdRevenueData {
89
+ mediatorName: AdMediatorName;
90
+ adFormat: AdFormat;
91
+ adUnitId: string;
92
+ impressionId: string;
93
+ revenueMicros: number;
94
+ currency: string;
95
+ precision: AdRevenuePrecision;
96
+ networkName?: string | null;
97
+ placement?: string | null;
98
+ }
99
+ /** @beta */
100
+ export interface AdFailedToLoadData {
101
+ mediatorName: AdMediatorName;
102
+ adFormat: AdFormat;
103
+ adUnitId: string;
104
+ mediatorErrorCode?: number | null;
105
+ placement?: string | null;
106
+ }
23
107
  export default class Purchases {
24
108
  /**
25
109
  * Supported SKU types.
@@ -865,6 +949,11 @@ export default class Purchases {
865
949
  * @returns {Promise<Boolean>} promise with boolean response
866
950
  */
867
951
  static isConfigured(): Promise<boolean>;
952
+ /**
953
+ * Provides access to ad lifecycle tracking methods.
954
+ * @beta
955
+ */
956
+ static get adTracker(): PurchasesAdTracker;
868
957
  /**
869
958
  * Tracks an impression of a custom (non-RevenueCat) paywall.
870
959
  * Call this method when your custom paywall is displayed to a user.
@@ -876,9 +965,20 @@ export default class Purchases {
876
965
  * If not provided, the SDK will use the current offering identifier from the cache.
877
966
  */
878
967
  static trackCustomPaywallImpression(params?: TrackCustomPaywallImpressionOptions): Promise<void>;
879
- private static throwIfNotConfigured;
880
968
  private static throwIfAndroidPlatform;
881
969
  private static throwIfIOSPlatform;
882
970
  private static isPurchasesAreCompletedByMyApp;
883
971
  private static convertIntToRefundRequestStatus;
884
972
  }
973
+ /**
974
+ * Provides methods for tracking ad lifecycle events.
975
+ * Access via {@link Purchases.adTracker}.
976
+ * @beta
977
+ */
978
+ export declare class PurchasesAdTracker {
979
+ trackAdDisplayed(data: AdDisplayedData): Promise<void>;
980
+ trackAdOpened(data: AdOpenedData): Promise<void>;
981
+ trackAdLoaded(data: AdLoadedData): Promise<void>;
982
+ trackAdRevenue(data: AdRevenueData): Promise<void>;
983
+ trackAdFailedToLoad(data: AdFailedToLoadData): Promise<void>;
984
+ }
package/dist/purchases.js CHANGED
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.WebPurchaseRedemptionResultType = exports.STOREKIT_VERSION = exports.LOG_LEVEL = exports.REFUND_REQUEST_STATUS = exports.BILLING_FEATURE = exports.PURCHASES_ARE_COMPLETED_BY_TYPE = exports.PURCHASE_TYPE = void 0;
39
+ exports.PurchasesAdTracker = exports.AdRevenuePrecision = exports.AdFormat = exports.AdMediatorName = exports.WebPurchaseRedemptionResultType = exports.STOREKIT_VERSION = exports.LOG_LEVEL = exports.REFUND_REQUEST_STATUS = exports.BILLING_FEATURE = exports.PURCHASES_ARE_COMPLETED_BY_TYPE = exports.PURCHASE_TYPE = void 0;
40
40
  var react_native_1 = require("react-native");
41
41
  var purchases_typescript_internal_1 = require("@revenuecat/purchases-typescript-internal");
42
42
  var environment_1 = require("./utils/environment");
@@ -64,6 +64,11 @@ var NATIVE_MODULE_ERROR = "[RevenueCat] Native module (RNPurchases) not found. T
64
64
  var usingBrowserMode = (0, environment_1.shouldUseBrowserMode)();
65
65
  var RNPurchases = usingBrowserMode ? nativeModule_1.browserNativeModuleRNPurchases : react_native_1.NativeModules.RNPurchases;
66
66
  // Only create event emitter if native module is available to avoid crash on import
67
+ //
68
+ // React Native 0.79+ requires native modules to implement addListener() and removeListeners()
69
+ // methods for NativeEventEmitter to work. Both iOS and Android native modules now have these.
70
+ // See: https://github.com/RevenueCat/react-native-purchases/issues/1298
71
+ // See: https://reactnative.dev/blog/2025/04/08/react-native-0.79 (Breaking Changes section)
67
72
  var eventEmitter = !usingBrowserMode && RNPurchases ? new react_native_1.NativeEventEmitter(RNPurchases) : null;
68
73
  // Helper function to check if native module is available - provides better error message than "Cannot read property X of null"
69
74
  function throwIfNativeModuleNotAvailable() {
@@ -75,6 +80,37 @@ var customerInfoUpdateListeners = [];
75
80
  var shouldPurchasePromoProductListeners = [];
76
81
  var customLogHandler;
77
82
  var trackedEventListeners = [];
83
+ /**
84
+ * Predefined mediator name constants. Use these or pass any string for unlisted networks.
85
+ * @beta
86
+ */
87
+ exports.AdMediatorName = {
88
+ adMob: "AdMob",
89
+ appLovin: "AppLovin",
90
+ };
91
+ /**
92
+ * Predefined ad format constants. Use these or pass any string for unlisted formats.
93
+ * @beta
94
+ */
95
+ exports.AdFormat = {
96
+ other: "other",
97
+ banner: "banner",
98
+ interstitial: "interstitial",
99
+ rewarded: "rewarded",
100
+ rewardedInterstitial: "rewarded_interstitial",
101
+ nativeAd: "native",
102
+ appOpen: "app_open",
103
+ };
104
+ /**
105
+ * Predefined precision constants for ad revenue. Use these or pass any string for unlisted values.
106
+ * @beta
107
+ */
108
+ exports.AdRevenuePrecision = {
109
+ exact: "exact",
110
+ publisherDefined: "publisher_defined",
111
+ estimated: "estimated",
112
+ unknown: "unknown",
113
+ };
78
114
  var debugEventListeners = [];
79
115
  eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-CustomerInfoUpdated", function (customerInfo) {
80
116
  customerInfoUpdateListeners.forEach(function (listener) { return listener(customerInfo); });
@@ -98,6 +134,22 @@ eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addList
98
134
  eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-DebugEvent", function (eventDictionary) {
99
135
  debugEventListeners.forEach(function (listener) { return listener({ eventDictionary: eventDictionary }); });
100
136
  });
137
+ function throwIfNotConfigured() {
138
+ return __awaiter(this, void 0, void 0, function () {
139
+ var isConfigured;
140
+ return __generator(this, function (_a) {
141
+ switch (_a.label) {
142
+ case 0: return [4 /*yield*/, Purchases.isConfigured()];
143
+ case 1:
144
+ isConfigured = _a.sent();
145
+ if (!isConfigured) {
146
+ throw new purchases_typescript_internal_1.UninitializedPurchasesError();
147
+ }
148
+ return [2 /*return*/];
149
+ }
150
+ });
151
+ });
152
+ }
101
153
  var Purchases = /** @class */ (function () {
102
154
  function Purchases() {
103
155
  }
@@ -189,7 +241,7 @@ var Purchases = /** @class */ (function () {
189
241
  return __awaiter(this, void 0, void 0, function () {
190
242
  return __generator(this, function (_a) {
191
243
  switch (_a.label) {
192
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
244
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
193
245
  case 1:
194
246
  _a.sent();
195
247
  RNPurchases.setAllowSharingStoreAccount(allowSharing);
@@ -274,7 +326,7 @@ var Purchases = /** @class */ (function () {
274
326
  return __awaiter(this, void 0, void 0, function () {
275
327
  return __generator(this, function (_a) {
276
328
  switch (_a.label) {
277
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
329
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
278
330
  case 1:
279
331
  _a.sent();
280
332
  return [2 /*return*/, RNPurchases.getOfferings()];
@@ -293,7 +345,7 @@ var Purchases = /** @class */ (function () {
293
345
  return __awaiter(this, void 0, void 0, function () {
294
346
  return __generator(this, function (_a) {
295
347
  switch (_a.label) {
296
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
348
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
297
349
  case 1:
298
350
  _a.sent();
299
351
  return [2 /*return*/, RNPurchases.getCurrentOfferingForPlacement(placementIdentifier)];
@@ -312,7 +364,7 @@ var Purchases = /** @class */ (function () {
312
364
  return __awaiter(this, void 0, void 0, function () {
313
365
  return __generator(this, function (_a) {
314
366
  switch (_a.label) {
315
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
367
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
316
368
  case 1:
317
369
  _a.sent();
318
370
  return [2 /*return*/, RNPurchases.syncAttributesAndOfferingsIfNeeded()];
@@ -334,7 +386,7 @@ var Purchases = /** @class */ (function () {
334
386
  return __awaiter(this, void 0, void 0, function () {
335
387
  return __generator(this, function (_a) {
336
388
  switch (_a.label) {
337
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
389
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
338
390
  case 1:
339
391
  _a.sent();
340
392
  return [2 /*return*/, RNPurchases.setAppstackAttributionParams(data)];
@@ -356,7 +408,7 @@ var Purchases = /** @class */ (function () {
356
408
  if (type === void 0) { type = purchases_typescript_internal_1.PRODUCT_CATEGORY.SUBSCRIPTION; }
357
409
  return __generator(this, function (_a) {
358
410
  switch (_a.label) {
359
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
411
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
360
412
  case 1:
361
413
  _a.sent();
362
414
  return [2 /*return*/, RNPurchases.getProductInfo(productIdentifiers, type)];
@@ -378,7 +430,7 @@ var Purchases = /** @class */ (function () {
378
430
  if (type === void 0) { type = purchases_typescript_internal_1.PURCHASE_TYPE.SUBS; }
379
431
  return __generator(this, function (_a) {
380
432
  switch (_a.label) {
381
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
433
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
382
434
  case 1:
383
435
  _a.sent();
384
436
  return [2 /*return*/, RNPurchases.purchaseProduct(productIdentifier, upgradeInfo, type, null, null, null).catch(function (error) {
@@ -408,7 +460,7 @@ var Purchases = /** @class */ (function () {
408
460
  return __awaiter(this, void 0, void 0, function () {
409
461
  return __generator(this, function (_a) {
410
462
  switch (_a.label) {
411
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
463
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
412
464
  case 1:
413
465
  _a.sent();
414
466
  return [2 /*return*/, RNPurchases.purchaseProduct(product.identifier, productChangeInfo, product.productCategory, null, googleIsPersonalizedPrice == null
@@ -439,7 +491,7 @@ var Purchases = /** @class */ (function () {
439
491
  return __awaiter(this, void 0, void 0, function () {
440
492
  return __generator(this, function (_a) {
441
493
  switch (_a.label) {
442
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
494
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
443
495
  case 1:
444
496
  _a.sent();
445
497
  if (typeof discount === "undefined" || discount == null) {
@@ -473,7 +525,7 @@ var Purchases = /** @class */ (function () {
473
525
  return __awaiter(this, void 0, void 0, function () {
474
526
  return __generator(this, function (_a) {
475
527
  switch (_a.label) {
476
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
528
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
477
529
  case 1:
478
530
  _a.sent();
479
531
  return [2 /*return*/, RNPurchases.purchasePackage(aPackage.identifier, aPackage.presentedOfferingContext, productChangeInfo || upgradeInfo, null, googleIsPersonalizedPrice == null
@@ -505,7 +557,7 @@ var Purchases = /** @class */ (function () {
505
557
  return __awaiter(this, void 0, void 0, function () {
506
558
  return __generator(this, function (_a) {
507
559
  switch (_a.label) {
508
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
560
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
509
561
  case 1:
510
562
  _a.sent();
511
563
  return [4 /*yield*/, Purchases.throwIfIOSPlatform()];
@@ -536,7 +588,7 @@ var Purchases = /** @class */ (function () {
536
588
  return __awaiter(this, void 0, void 0, function () {
537
589
  return __generator(this, function (_a) {
538
590
  switch (_a.label) {
539
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
591
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
540
592
  case 1:
541
593
  _a.sent();
542
594
  if (typeof discount === "undefined" || discount == null) {
@@ -560,7 +612,7 @@ var Purchases = /** @class */ (function () {
560
612
  return __awaiter(this, void 0, void 0, function () {
561
613
  return __generator(this, function (_a) {
562
614
  switch (_a.label) {
563
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
615
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
564
616
  case 1:
565
617
  _a.sent();
566
618
  return [2 /*return*/, RNPurchases.restorePurchases()];
@@ -576,7 +628,7 @@ var Purchases = /** @class */ (function () {
576
628
  return __awaiter(this, void 0, void 0, function () {
577
629
  return __generator(this, function (_a) {
578
630
  switch (_a.label) {
579
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
631
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
580
632
  case 1:
581
633
  _a.sent();
582
634
  return [2 /*return*/, RNPurchases.getAppUserID()];
@@ -592,7 +644,7 @@ var Purchases = /** @class */ (function () {
592
644
  return __awaiter(this, void 0, void 0, function () {
593
645
  return __generator(this, function (_a) {
594
646
  switch (_a.label) {
595
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
647
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
596
648
  case 1:
597
649
  _a.sent();
598
650
  return [2 /*return*/, RNPurchases.getStorefront()];
@@ -612,7 +664,7 @@ var Purchases = /** @class */ (function () {
612
664
  return __awaiter(this, void 0, void 0, function () {
613
665
  return __generator(this, function (_a) {
614
666
  switch (_a.label) {
615
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
667
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
616
668
  case 1:
617
669
  _a.sent();
618
670
  // noinspection SuspiciousTypeOfGuard
@@ -634,7 +686,7 @@ var Purchases = /** @class */ (function () {
634
686
  return __awaiter(this, void 0, void 0, function () {
635
687
  return __generator(this, function (_a) {
636
688
  switch (_a.label) {
637
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
689
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
638
690
  case 1:
639
691
  _a.sent();
640
692
  return [2 /*return*/, RNPurchases.logOut()];
@@ -696,7 +748,7 @@ var Purchases = /** @class */ (function () {
696
748
  var isFirstListener;
697
749
  return __generator(this, function (_a) {
698
750
  switch (_a.label) {
699
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
751
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
700
752
  case 1:
701
753
  _a.sent();
702
754
  if (react_native_2.Platform.OS === "android" || react_native_2.Platform.OS === "ios") {
@@ -735,7 +787,7 @@ var Purchases = /** @class */ (function () {
735
787
  var isFirstListener;
736
788
  return __generator(this, function (_a) {
737
789
  switch (_a.label) {
738
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
790
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
739
791
  case 1:
740
792
  _a.sent();
741
793
  if (react_native_2.Platform.OS === "android") {
@@ -772,7 +824,7 @@ var Purchases = /** @class */ (function () {
772
824
  return __awaiter(this, void 0, void 0, function () {
773
825
  return __generator(this, function (_a) {
774
826
  switch (_a.label) {
775
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
827
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
776
828
  case 1:
777
829
  _a.sent();
778
830
  return [2 /*return*/, RNPurchases.getCustomerInfo()];
@@ -793,7 +845,7 @@ var Purchases = /** @class */ (function () {
793
845
  return __awaiter(this, void 0, void 0, function () {
794
846
  return __generator(this, function (_a) {
795
847
  switch (_a.label) {
796
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
848
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
797
849
  case 1:
798
850
  _a.sent();
799
851
  RNPurchases.syncPurchases();
@@ -815,7 +867,7 @@ var Purchases = /** @class */ (function () {
815
867
  var customerInfo;
816
868
  return __generator(this, function (_a) {
817
869
  switch (_a.label) {
818
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
870
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
819
871
  case 1:
820
872
  _a.sent();
821
873
  return [4 /*yield*/, RNPurchases.syncPurchasesForResult()];
@@ -847,7 +899,7 @@ var Purchases = /** @class */ (function () {
847
899
  case 0: return [4 /*yield*/, Purchases.throwIfIOSPlatform()];
848
900
  case 1:
849
901
  _a.sent();
850
- return [4 /*yield*/, Purchases.throwIfNotConfigured()];
902
+ return [4 /*yield*/, throwIfNotConfigured()];
851
903
  case 2:
852
904
  _a.sent();
853
905
  RNPurchases.syncAmazonPurchase(productID, receiptID, amazonUserID, isoCurrencyCode, price);
@@ -879,7 +931,7 @@ var Purchases = /** @class */ (function () {
879
931
  case 0: return [4 /*yield*/, Purchases.throwIfIOSPlatform()];
880
932
  case 1:
881
933
  _a.sent();
882
- return [4 /*yield*/, Purchases.throwIfNotConfigured()];
934
+ return [4 /*yield*/, throwIfNotConfigured()];
883
935
  case 2:
884
936
  _a.sent();
885
937
  RNPurchases.syncObserverModeAmazonPurchase(productID, receiptID, amazonUserID, isoCurrencyCode, price);
@@ -910,7 +962,7 @@ var Purchases = /** @class */ (function () {
910
962
  case 0: return [4 /*yield*/, Purchases.throwIfAndroidPlatform()];
911
963
  case 1:
912
964
  _a.sent();
913
- return [4 /*yield*/, Purchases.throwIfNotConfigured()];
965
+ return [4 /*yield*/, throwIfNotConfigured()];
914
966
  case 2:
915
967
  _a.sent();
916
968
  return [2 /*return*/, RNPurchases.recordPurchaseForProductID(productID)];
@@ -928,7 +980,7 @@ var Purchases = /** @class */ (function () {
928
980
  switch (_a.label) {
929
981
  case 0:
930
982
  if (!(react_native_2.Platform.OS === "ios")) return [3 /*break*/, 2];
931
- return [4 /*yield*/, Purchases.throwIfNotConfigured()];
983
+ return [4 /*yield*/, throwIfNotConfigured()];
932
984
  case 1:
933
985
  _a.sent();
934
986
  RNPurchases.enableAdServicesAttributionTokenCollection();
@@ -946,7 +998,7 @@ var Purchases = /** @class */ (function () {
946
998
  return __awaiter(this, void 0, void 0, function () {
947
999
  return __generator(this, function (_a) {
948
1000
  switch (_a.label) {
949
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1001
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
950
1002
  case 1:
951
1003
  _a.sent();
952
1004
  return [2 /*return*/, RNPurchases.isAnonymous()];
@@ -973,7 +1025,7 @@ var Purchases = /** @class */ (function () {
973
1025
  return __awaiter(this, void 0, void 0, function () {
974
1026
  return __generator(this, function (_a) {
975
1027
  switch (_a.label) {
976
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1028
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
977
1029
  case 1:
978
1030
  _a.sent();
979
1031
  return [2 /*return*/, RNPurchases.checkTrialOrIntroductoryPriceEligibility(productIdentifiers)];
@@ -994,7 +1046,7 @@ var Purchases = /** @class */ (function () {
994
1046
  return __awaiter(this, void 0, void 0, function () {
995
1047
  return __generator(this, function (_a) {
996
1048
  switch (_a.label) {
997
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1049
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
998
1050
  case 1:
999
1051
  _a.sent();
1000
1052
  if (react_native_2.Platform.OS === "android") {
@@ -1021,7 +1073,7 @@ var Purchases = /** @class */ (function () {
1021
1073
  return __awaiter(this, void 0, void 0, function () {
1022
1074
  return __generator(this, function (_a) {
1023
1075
  switch (_a.label) {
1024
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1076
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1025
1077
  case 1:
1026
1078
  _a.sent();
1027
1079
  if (react_native_2.Platform.OS === "android") {
@@ -1045,7 +1097,7 @@ var Purchases = /** @class */ (function () {
1045
1097
  return __awaiter(this, void 0, void 0, function () {
1046
1098
  return __generator(this, function (_a) {
1047
1099
  switch (_a.label) {
1048
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1100
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1049
1101
  case 1:
1050
1102
  _a.sent();
1051
1103
  if (react_native_2.Platform.OS === "android") {
@@ -1072,7 +1124,7 @@ var Purchases = /** @class */ (function () {
1072
1124
  return __awaiter(this, void 0, void 0, function () {
1073
1125
  return __generator(this, function (_a) {
1074
1126
  switch (_a.label) {
1075
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1127
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1076
1128
  case 1:
1077
1129
  _a.sent();
1078
1130
  if (typeof winBackOffer === "undefined" || winBackOffer == null) {
@@ -1106,7 +1158,7 @@ var Purchases = /** @class */ (function () {
1106
1158
  return __awaiter(this, void 0, void 0, function () {
1107
1159
  return __generator(this, function (_a) {
1108
1160
  switch (_a.label) {
1109
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1161
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1110
1162
  case 1:
1111
1163
  _a.sent();
1112
1164
  if (typeof winBackOffer === "undefined" || winBackOffer == null) {
@@ -1140,7 +1192,7 @@ var Purchases = /** @class */ (function () {
1140
1192
  return __awaiter(this, void 0, void 0, function () {
1141
1193
  return __generator(this, function (_a) {
1142
1194
  switch (_a.label) {
1143
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1195
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1144
1196
  case 1:
1145
1197
  _a.sent();
1146
1198
  RNPurchases.invalidateCustomerInfoCache();
@@ -1161,7 +1213,7 @@ var Purchases = /** @class */ (function () {
1161
1213
  switch (_a.label) {
1162
1214
  case 0:
1163
1215
  if (!(react_native_2.Platform.OS === "ios")) return [3 /*break*/, 2];
1164
- return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1216
+ return [4 /*yield*/, throwIfNotConfigured()];
1165
1217
  case 1:
1166
1218
  _a.sent();
1167
1219
  RNPurchases.presentCodeRedemptionSheet();
@@ -1187,7 +1239,7 @@ var Purchases = /** @class */ (function () {
1187
1239
  return __awaiter(this, void 0, void 0, function () {
1188
1240
  return __generator(this, function (_a) {
1189
1241
  switch (_a.label) {
1190
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1242
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1191
1243
  case 1:
1192
1244
  _a.sent();
1193
1245
  RNPurchases.setAttributes(attributes);
@@ -1207,7 +1259,7 @@ var Purchases = /** @class */ (function () {
1207
1259
  return __awaiter(this, void 0, void 0, function () {
1208
1260
  return __generator(this, function (_a) {
1209
1261
  switch (_a.label) {
1210
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1262
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1211
1263
  case 1:
1212
1264
  _a.sent();
1213
1265
  RNPurchases.setEmail(email);
@@ -1227,7 +1279,7 @@ var Purchases = /** @class */ (function () {
1227
1279
  return __awaiter(this, void 0, void 0, function () {
1228
1280
  return __generator(this, function (_a) {
1229
1281
  switch (_a.label) {
1230
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1282
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1231
1283
  case 1:
1232
1284
  _a.sent();
1233
1285
  RNPurchases.setPhoneNumber(phoneNumber);
@@ -1247,7 +1299,7 @@ var Purchases = /** @class */ (function () {
1247
1299
  return __awaiter(this, void 0, void 0, function () {
1248
1300
  return __generator(this, function (_a) {
1249
1301
  switch (_a.label) {
1250
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1302
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1251
1303
  case 1:
1252
1304
  _a.sent();
1253
1305
  RNPurchases.setDisplayName(displayName);
@@ -1267,7 +1319,7 @@ var Purchases = /** @class */ (function () {
1267
1319
  return __awaiter(this, void 0, void 0, function () {
1268
1320
  return __generator(this, function (_a) {
1269
1321
  switch (_a.label) {
1270
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1322
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1271
1323
  case 1:
1272
1324
  _a.sent();
1273
1325
  RNPurchases.setPushToken(pushToken);
@@ -1299,7 +1351,7 @@ var Purchases = /** @class */ (function () {
1299
1351
  return __awaiter(this, void 0, void 0, function () {
1300
1352
  return __generator(this, function (_a) {
1301
1353
  switch (_a.label) {
1302
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1354
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1303
1355
  case 1:
1304
1356
  _a.sent();
1305
1357
  RNPurchases.collectDeviceIdentifiers();
@@ -1320,7 +1372,7 @@ var Purchases = /** @class */ (function () {
1320
1372
  return __awaiter(this, void 0, void 0, function () {
1321
1373
  return __generator(this, function (_a) {
1322
1374
  switch (_a.label) {
1323
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1375
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1324
1376
  case 1:
1325
1377
  _a.sent();
1326
1378
  RNPurchases.setAdjustID(adjustID);
@@ -1340,7 +1392,7 @@ var Purchases = /** @class */ (function () {
1340
1392
  return __awaiter(this, void 0, void 0, function () {
1341
1393
  return __generator(this, function (_a) {
1342
1394
  switch (_a.label) {
1343
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1395
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1344
1396
  case 1:
1345
1397
  _a.sent();
1346
1398
  RNPurchases.setAppsflyerID(appsflyerID);
@@ -1361,7 +1413,7 @@ var Purchases = /** @class */ (function () {
1361
1413
  return __awaiter(this, void 0, void 0, function () {
1362
1414
  return __generator(this, function (_a) {
1363
1415
  switch (_a.label) {
1364
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1416
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1365
1417
  case 1:
1366
1418
  _a.sent();
1367
1419
  RNPurchases.setFBAnonymousID(fbAnonymousID);
@@ -1382,7 +1434,7 @@ var Purchases = /** @class */ (function () {
1382
1434
  return __awaiter(this, void 0, void 0, function () {
1383
1435
  return __generator(this, function (_a) {
1384
1436
  switch (_a.label) {
1385
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1437
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1386
1438
  case 1:
1387
1439
  _a.sent();
1388
1440
  RNPurchases.setMparticleID(mparticleID);
@@ -1403,7 +1455,7 @@ var Purchases = /** @class */ (function () {
1403
1455
  return __awaiter(this, void 0, void 0, function () {
1404
1456
  return __generator(this, function (_a) {
1405
1457
  switch (_a.label) {
1406
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1458
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1407
1459
  case 1:
1408
1460
  _a.sent();
1409
1461
  RNPurchases.setCleverTapID(cleverTapID);
@@ -1424,7 +1476,7 @@ var Purchases = /** @class */ (function () {
1424
1476
  return __awaiter(this, void 0, void 0, function () {
1425
1477
  return __generator(this, function (_a) {
1426
1478
  switch (_a.label) {
1427
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1479
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1428
1480
  case 1:
1429
1481
  _a.sent();
1430
1482
  RNPurchases.setMixpanelDistinctID(mixpanelDistinctID);
@@ -1445,7 +1497,7 @@ var Purchases = /** @class */ (function () {
1445
1497
  return __awaiter(this, void 0, void 0, function () {
1446
1498
  return __generator(this, function (_a) {
1447
1499
  switch (_a.label) {
1448
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1500
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1449
1501
  case 1:
1450
1502
  _a.sent();
1451
1503
  RNPurchases.setFirebaseAppInstanceID(firebaseAppInstanceID);
@@ -1466,7 +1518,7 @@ var Purchases = /** @class */ (function () {
1466
1518
  return __awaiter(this, void 0, void 0, function () {
1467
1519
  return __generator(this, function (_a) {
1468
1520
  switch (_a.label) {
1469
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1521
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1470
1522
  case 1:
1471
1523
  _a.sent();
1472
1524
  RNPurchases.setTenjinAnalyticsInstallationID(tenjinAnalyticsInstallationID);
@@ -1487,7 +1539,7 @@ var Purchases = /** @class */ (function () {
1487
1539
  return __awaiter(this, void 0, void 0, function () {
1488
1540
  return __generator(this, function (_a) {
1489
1541
  switch (_a.label) {
1490
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1542
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1491
1543
  case 1:
1492
1544
  _a.sent();
1493
1545
  RNPurchases.setKochavaDeviceID(kochavaDeviceID);
@@ -1508,7 +1560,7 @@ var Purchases = /** @class */ (function () {
1508
1560
  return __awaiter(this, void 0, void 0, function () {
1509
1561
  return __generator(this, function (_a) {
1510
1562
  switch (_a.label) {
1511
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1563
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1512
1564
  case 1:
1513
1565
  _a.sent();
1514
1566
  RNPurchases.setOnesignalID(onesignalID);
@@ -1529,7 +1581,7 @@ var Purchases = /** @class */ (function () {
1529
1581
  return __awaiter(this, void 0, void 0, function () {
1530
1582
  return __generator(this, function (_a) {
1531
1583
  switch (_a.label) {
1532
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1584
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1533
1585
  case 1:
1534
1586
  _a.sent();
1535
1587
  RNPurchases.setAirshipChannelID(airshipChannelID);
@@ -1549,7 +1601,7 @@ var Purchases = /** @class */ (function () {
1549
1601
  return __awaiter(this, void 0, void 0, function () {
1550
1602
  return __generator(this, function (_a) {
1551
1603
  switch (_a.label) {
1552
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1604
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1553
1605
  case 1:
1554
1606
  _a.sent();
1555
1607
  RNPurchases.setMediaSource(mediaSource);
@@ -1569,7 +1621,7 @@ var Purchases = /** @class */ (function () {
1569
1621
  return __awaiter(this, void 0, void 0, function () {
1570
1622
  return __generator(this, function (_a) {
1571
1623
  switch (_a.label) {
1572
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1624
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1573
1625
  case 1:
1574
1626
  _a.sent();
1575
1627
  RNPurchases.setCampaign(campaign);
@@ -1589,7 +1641,7 @@ var Purchases = /** @class */ (function () {
1589
1641
  return __awaiter(this, void 0, void 0, function () {
1590
1642
  return __generator(this, function (_a) {
1591
1643
  switch (_a.label) {
1592
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1644
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1593
1645
  case 1:
1594
1646
  _a.sent();
1595
1647
  RNPurchases.setAdGroup(adGroup);
@@ -1609,7 +1661,7 @@ var Purchases = /** @class */ (function () {
1609
1661
  return __awaiter(this, void 0, void 0, function () {
1610
1662
  return __generator(this, function (_a) {
1611
1663
  switch (_a.label) {
1612
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1664
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1613
1665
  case 1:
1614
1666
  _a.sent();
1615
1667
  RNPurchases.setAd(ad);
@@ -1629,7 +1681,7 @@ var Purchases = /** @class */ (function () {
1629
1681
  return __awaiter(this, void 0, void 0, function () {
1630
1682
  return __generator(this, function (_a) {
1631
1683
  switch (_a.label) {
1632
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1684
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1633
1685
  case 1:
1634
1686
  _a.sent();
1635
1687
  RNPurchases.setKeyword(keyword);
@@ -1649,7 +1701,7 @@ var Purchases = /** @class */ (function () {
1649
1701
  return __awaiter(this, void 0, void 0, function () {
1650
1702
  return __generator(this, function (_a) {
1651
1703
  switch (_a.label) {
1652
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1704
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1653
1705
  case 1:
1654
1706
  _a.sent();
1655
1707
  RNPurchases.setCreative(creative);
@@ -1669,7 +1721,7 @@ var Purchases = /** @class */ (function () {
1669
1721
  return __awaiter(this, void 0, void 0, function () {
1670
1722
  return __generator(this, function (_a) {
1671
1723
  switch (_a.label) {
1672
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1724
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1673
1725
  case 1:
1674
1726
  _a.sent();
1675
1727
  RNPurchases.overridePreferredLocale(locale);
@@ -1717,7 +1769,7 @@ var Purchases = /** @class */ (function () {
1717
1769
  var refundRequestStatusInt;
1718
1770
  return __generator(this, function (_a) {
1719
1771
  switch (_a.label) {
1720
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1772
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1721
1773
  case 1:
1722
1774
  _a.sent();
1723
1775
  return [4 /*yield*/, Purchases.throwIfAndroidPlatform()];
@@ -1750,7 +1802,7 @@ var Purchases = /** @class */ (function () {
1750
1802
  var refundRequestStatusInt;
1751
1803
  return __generator(this, function (_a) {
1752
1804
  switch (_a.label) {
1753
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1805
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1754
1806
  case 1:
1755
1807
  _a.sent();
1756
1808
  return [4 /*yield*/, Purchases.throwIfAndroidPlatform()];
@@ -1783,7 +1835,7 @@ var Purchases = /** @class */ (function () {
1783
1835
  var refundRequestStatusInt;
1784
1836
  return __generator(this, function (_a) {
1785
1837
  switch (_a.label) {
1786
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1838
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1787
1839
  case 1:
1788
1840
  _a.sent();
1789
1841
  return [4 /*yield*/, Purchases.throwIfAndroidPlatform()];
@@ -1807,7 +1859,7 @@ var Purchases = /** @class */ (function () {
1807
1859
  return __awaiter(this, void 0, void 0, function () {
1808
1860
  return __generator(this, function (_a) {
1809
1861
  switch (_a.label) {
1810
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1862
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1811
1863
  case 1:
1812
1864
  _a.sent();
1813
1865
  return [4 /*yield*/, Purchases.throwIfAndroidPlatform()];
@@ -1833,7 +1885,7 @@ var Purchases = /** @class */ (function () {
1833
1885
  return __awaiter(this, void 0, void 0, function () {
1834
1886
  return __generator(this, function (_a) {
1835
1887
  switch (_a.label) {
1836
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1888
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1837
1889
  case 1:
1838
1890
  _a.sent();
1839
1891
  return [2 /*return*/, RNPurchases.showInAppMessages(messageTypes)];
@@ -1870,7 +1922,7 @@ var Purchases = /** @class */ (function () {
1870
1922
  return __awaiter(this, void 0, void 0, function () {
1871
1923
  return __generator(this, function (_a) {
1872
1924
  switch (_a.label) {
1873
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1925
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1874
1926
  case 1:
1875
1927
  _a.sent();
1876
1928
  return [2 /*return*/, RNPurchases.redeemWebPurchase(webPurchaseRedemption.redemptionLink)];
@@ -1888,7 +1940,7 @@ var Purchases = /** @class */ (function () {
1888
1940
  return __awaiter(this, void 0, void 0, function () {
1889
1941
  return __generator(this, function (_a) {
1890
1942
  switch (_a.label) {
1891
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1943
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1892
1944
  case 1:
1893
1945
  _a.sent();
1894
1946
  return [2 /*return*/, RNPurchases.getVirtualCurrencies()];
@@ -1910,7 +1962,7 @@ var Purchases = /** @class */ (function () {
1910
1962
  return __awaiter(this, void 0, void 0, function () {
1911
1963
  return __generator(this, function (_a) {
1912
1964
  switch (_a.label) {
1913
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1965
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1914
1966
  case 1:
1915
1967
  _a.sent();
1916
1968
  RNPurchases.invalidateVirtualCurrenciesCache();
@@ -1932,7 +1984,7 @@ var Purchases = /** @class */ (function () {
1932
1984
  var result;
1933
1985
  return __generator(this, function (_a) {
1934
1986
  switch (_a.label) {
1935
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
1987
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1936
1988
  case 1:
1937
1989
  _a.sent();
1938
1990
  return [4 /*yield*/, RNPurchases.getCachedVirtualCurrencies()];
@@ -1957,6 +2009,20 @@ var Purchases = /** @class */ (function () {
1957
2009
  }
1958
2010
  return RNPurchases.isConfigured();
1959
2011
  };
2012
+ Object.defineProperty(Purchases, "adTracker", {
2013
+ /**
2014
+ * Provides access to ad lifecycle tracking methods.
2015
+ * @beta
2016
+ */
2017
+ get: function () {
2018
+ if (!adTrackerSingleton) {
2019
+ adTrackerSingleton = new PurchasesAdTracker();
2020
+ }
2021
+ return adTrackerSingleton;
2022
+ },
2023
+ enumerable: false,
2024
+ configurable: true
2025
+ });
1960
2026
  /**
1961
2027
  * Tracks an impression of a custom (non-RevenueCat) paywall.
1962
2028
  * Call this method when your custom paywall is displayed to a user.
@@ -1971,7 +2037,7 @@ var Purchases = /** @class */ (function () {
1971
2037
  return __awaiter(this, void 0, void 0, function () {
1972
2038
  return __generator(this, function (_a) {
1973
2039
  switch (_a.label) {
1974
- case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
2040
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1975
2041
  case 1:
1976
2042
  _a.sent();
1977
2043
  RNPurchases.trackCustomPaywallImpression(params !== null && params !== void 0 ? params : {});
@@ -1980,22 +2046,6 @@ var Purchases = /** @class */ (function () {
1980
2046
  });
1981
2047
  });
1982
2048
  };
1983
- Purchases.throwIfNotConfigured = function () {
1984
- return __awaiter(this, void 0, void 0, function () {
1985
- var isConfigured;
1986
- return __generator(this, function (_a) {
1987
- switch (_a.label) {
1988
- case 0: return [4 /*yield*/, Purchases.isConfigured()];
1989
- case 1:
1990
- isConfigured = _a.sent();
1991
- if (!isConfigured) {
1992
- throw new purchases_typescript_internal_1.UninitializedPurchasesError();
1993
- }
1994
- return [2 /*return*/];
1995
- }
1996
- });
1997
- });
1998
- };
1999
2049
  Purchases.throwIfAndroidPlatform = function () {
2000
2050
  return __awaiter(this, void 0, void 0, function () {
2001
2051
  return __generator(this, function (_a) {
@@ -2131,3 +2181,80 @@ var Purchases = /** @class */ (function () {
2131
2181
  return Purchases;
2132
2182
  }());
2133
2183
  exports.default = Purchases;
2184
+ var adTrackerSingleton;
2185
+ /**
2186
+ * Provides methods for tracking ad lifecycle events.
2187
+ * Access via {@link Purchases.adTracker}.
2188
+ * @beta
2189
+ */
2190
+ var PurchasesAdTracker = /** @class */ (function () {
2191
+ function PurchasesAdTracker() {
2192
+ }
2193
+ PurchasesAdTracker.prototype.trackAdDisplayed = function (data) {
2194
+ return __awaiter(this, void 0, void 0, function () {
2195
+ return __generator(this, function (_a) {
2196
+ switch (_a.label) {
2197
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
2198
+ case 1:
2199
+ _a.sent();
2200
+ RNPurchases.trackAdDisplayed(data);
2201
+ return [2 /*return*/];
2202
+ }
2203
+ });
2204
+ });
2205
+ };
2206
+ PurchasesAdTracker.prototype.trackAdOpened = function (data) {
2207
+ return __awaiter(this, void 0, void 0, function () {
2208
+ return __generator(this, function (_a) {
2209
+ switch (_a.label) {
2210
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
2211
+ case 1:
2212
+ _a.sent();
2213
+ RNPurchases.trackAdOpened(data);
2214
+ return [2 /*return*/];
2215
+ }
2216
+ });
2217
+ });
2218
+ };
2219
+ PurchasesAdTracker.prototype.trackAdLoaded = function (data) {
2220
+ return __awaiter(this, void 0, void 0, function () {
2221
+ return __generator(this, function (_a) {
2222
+ switch (_a.label) {
2223
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
2224
+ case 1:
2225
+ _a.sent();
2226
+ RNPurchases.trackAdLoaded(data);
2227
+ return [2 /*return*/];
2228
+ }
2229
+ });
2230
+ });
2231
+ };
2232
+ PurchasesAdTracker.prototype.trackAdRevenue = function (data) {
2233
+ return __awaiter(this, void 0, void 0, function () {
2234
+ return __generator(this, function (_a) {
2235
+ switch (_a.label) {
2236
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
2237
+ case 1:
2238
+ _a.sent();
2239
+ RNPurchases.trackAdRevenue(data);
2240
+ return [2 /*return*/];
2241
+ }
2242
+ });
2243
+ });
2244
+ };
2245
+ PurchasesAdTracker.prototype.trackAdFailedToLoad = function (data) {
2246
+ return __awaiter(this, void 0, void 0, function () {
2247
+ return __generator(this, function (_a) {
2248
+ switch (_a.label) {
2249
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
2250
+ case 1:
2251
+ _a.sent();
2252
+ RNPurchases.trackAdFailedToLoad(data);
2253
+ return [2 /*return*/];
2254
+ }
2255
+ });
2256
+ });
2257
+ };
2258
+ return PurchasesAdTracker;
2259
+ }());
2260
+ exports.PurchasesAdTracker = PurchasesAdTracker;
package/ios/RNPurchases.m CHANGED
@@ -55,6 +55,27 @@ NSString *RNPurchasesDebugEvent = @"Purchases-DebugEvent";
55
55
 
56
56
  RCT_EXPORT_MODULE();
57
57
 
58
+ // Required for RN 0.79+ NativeEventEmitter (JavaScript class) support
59
+ //
60
+ // In JavaScript: new NativeEventEmitter(RNPurchases)
61
+ // NativeEventEmitter checks if the native module has addListener/removeListeners methods.
62
+ // Without these exported methods, construction throws in RN 0.79+.
63
+ //
64
+ // WHY export them here when our parent class RCTEventEmitter already has them?
65
+ // React Native's bridge only exposes methods that are EXPLICITLY exported with RCT_EXPORT_METHOD.
66
+ // Parent class methods are NOT automatically visible to JavaScript. We must re-export them here
67
+ // to make them callable from JS, then call [super] to use the parent's implementation.
68
+ //
69
+ // See: https://github.com/RevenueCat/react-native-purchases/issues/1298
70
+ // See: https://github.com/facebook/react-native/blob/main/packages/react-native/React/Modules/RCTEventEmitter.m#L101-L125
71
+ RCT_EXPORT_METHOD(addListener:(NSString *)eventName) {
72
+ [super addListener:eventName];
73
+ }
74
+
75
+ RCT_EXPORT_METHOD(removeListeners:(double)count) {
76
+ [super removeListeners:count];
77
+ }
78
+
58
79
  RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
59
80
  appUserID:(nullable NSString *)appUserID
60
81
  purchasesAreCompletedBy:(nullable NSString *)purchasesAreCompletedBy
@@ -635,6 +656,46 @@ RCT_EXPORT_METHOD(trackCustomPaywallImpression:(NSDictionary *)data) {
635
656
  }
636
657
  }
637
658
 
659
+ RCT_EXPORT_METHOD(trackAdDisplayed:(NSDictionary *)data) {
660
+ if (@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)) {
661
+ [RCCommonFunctionality trackAdDisplayed:data];
662
+ } else {
663
+ NSLog(@"[Purchases] Warning: tried to call trackAdDisplayed, but it's only available on iOS 15.0 or greater.");
664
+ }
665
+ }
666
+
667
+ RCT_EXPORT_METHOD(trackAdOpened:(NSDictionary *)data) {
668
+ if (@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)) {
669
+ [RCCommonFunctionality trackAdOpened:data];
670
+ } else {
671
+ NSLog(@"[Purchases] Warning: tried to call trackAdOpened, but it's only available on iOS 15.0 or greater.");
672
+ }
673
+ }
674
+
675
+ RCT_EXPORT_METHOD(trackAdLoaded:(NSDictionary *)data) {
676
+ if (@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)) {
677
+ [RCCommonFunctionality trackAdLoaded:data];
678
+ } else {
679
+ NSLog(@"[Purchases] Warning: tried to call trackAdLoaded, but it's only available on iOS 15.0 or greater.");
680
+ }
681
+ }
682
+
683
+ RCT_EXPORT_METHOD(trackAdRevenue:(NSDictionary *)data) {
684
+ if (@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)) {
685
+ [RCCommonFunctionality trackAdRevenue:data];
686
+ } else {
687
+ NSLog(@"[Purchases] Warning: tried to call trackAdRevenue, but it's only available on iOS 15.0 or greater.");
688
+ }
689
+ }
690
+
691
+ RCT_EXPORT_METHOD(trackAdFailedToLoad:(NSDictionary *)data) {
692
+ if (@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)) {
693
+ [RCCommonFunctionality trackAdFailedToLoad:data];
694
+ } else {
695
+ NSLog(@"[Purchases] Warning: tried to call trackAdFailedToLoad, but it's only available on iOS 15.0 or greater.");
696
+ }
697
+ }
698
+
638
699
  #pragma mark -
639
700
  #pragma mark Delegate Methods
640
701
  - (void)purchases:(RCPurchases *)purchases receivedUpdatedCustomerInfo:(RCCustomerInfo *)customerInfo {
@@ -697,7 +758,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
697
758
  }
698
759
 
699
760
  - (NSString *)platformFlavorVersion {
700
- return @"10.1.2";
761
+ return @"10.2.1";
701
762
  }
702
763
 
703
764
  @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": "10.1.2",
4
+ "version": "10.2.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",
@@ -115,7 +115,7 @@
115
115
  ]
116
116
  },
117
117
  "dependencies": {
118
- "@revenuecat/purchases-js-hybrid-mappings": "18.7.0",
119
- "@revenuecat/purchases-typescript-internal": "18.7.0"
118
+ "@revenuecat/purchases-js-hybrid-mappings": "18.9.1",
119
+ "@revenuecat/purchases-typescript-internal": "18.9.1"
120
120
  }
121
121
  }