react-native-purchases 10.7.2 → 10.8.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.
@@ -25,6 +25,6 @@ Pod::Spec.new do |spec|
25
25
  ]
26
26
 
27
27
  spec.dependency "React-Core"
28
- spec.dependency "PurchasesHybridCommon", '18.31.0'
28
+ spec.dependency "PurchasesHybridCommon", '18.32.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.7.2'
32
+ versionName '10.8.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:18.31.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.32.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.7.2";
54
+ public static final String PLUGIN_VERSION = "10.8.0";
55
55
 
56
56
  private final ReactApplicationContext reactContext;
57
57
 
@@ -666,8 +666,11 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
666
666
  }
667
667
 
668
668
  @ReactMethod
669
- public void pollRewardVerification(String clientTransactionId, final Promise promise) {
670
- CommonKt.pollRewardVerification(clientTransactionId, getOnResult(promise));
669
+ public void pollRewardVerification(String clientTransactionId,
670
+ @Nullable ReadableMap trackingMetadata,
671
+ final Promise promise) {
672
+ Map<String, Object> mapTrackingMetadata = trackingMetadata != null ? mapWithoutNullValues(trackingMetadata) : null;
673
+ CommonKt.pollRewardVerification(clientTransactionId, getOnResult(promise), mapTrackingMetadata);
671
674
  }
672
675
 
673
676
  // endregion
@@ -1,4 +1,5 @@
1
1
  import { MakePurchaseResult } from '@revenuecat/purchases-typescript-internal';
2
+ import type { RewardedAdTrackingMetadata } from '../purchases';
2
3
  /**
3
4
  * Browser implementation of the native module. This will be used in the browser and Expo Go.
4
5
  */
@@ -92,5 +93,5 @@ export declare const browserNativeModuleRNPurchases: {
92
93
  trackAdRevenue: (_data: any) => Promise<void>;
93
94
  trackAdFailedToLoad: (_data: any) => Promise<void>;
94
95
  generateRewardVerificationToken: (_impressionId: string) => Promise<void>;
95
- pollRewardVerification: (_clientTransactionId: string) => Promise<void>;
96
+ pollRewardVerification: (_clientTransactionId: string, _trackingMetadata?: RewardedAdTrackingMetadata) => Promise<void>;
96
97
  };
@@ -43,7 +43,7 @@ var typeGuards_1 = require("./typeGuards");
43
43
  var environment_1 = require("../utils/environment");
44
44
  var utils_1 = require("./utils");
45
45
  var purchaseSimulatedPackageHelper_1 = require("./simulatedstore/purchaseSimulatedPackageHelper");
46
- var packageVersion = '9.1.0';
46
+ var packageVersion = '10.8.0';
47
47
  /**
48
48
  * Browser implementation of the native module. This will be used in the browser and Expo Go.
49
49
  */
@@ -645,7 +645,7 @@ exports.browserNativeModuleRNPurchases = {
645
645
  return [2 /*return*/];
646
646
  });
647
647
  }); },
648
- pollRewardVerification: function (_clientTransactionId) { return __awaiter(void 0, void 0, void 0, function () {
648
+ pollRewardVerification: function (_clientTransactionId, _trackingMetadata) { return __awaiter(void 0, void 0, void 0, function () {
649
649
  return __generator(this, function (_a) {
650
650
  (0, utils_1.methodNotSupportedOnWeb)('pollRewardVerification');
651
651
  return [2 /*return*/];
@@ -86,19 +86,19 @@ function showSimulatedPurchaseAlert(packageIdentifier, offeringIdentifier, onPur
86
86
  if (offers.length > 0) {
87
87
  message += "\nOffers:\n".concat(offers.map(function (offer) { return "\u2022 ".concat(offer); }).join('\n'));
88
88
  }
89
- react_native_1.Alert.alert('Test Purchase', message, [
89
+ react_native_1.Alert.alert('Test Store Purchase', message, [
90
90
  {
91
91
  text: 'Cancel',
92
92
  style: 'cancel',
93
93
  onPress: handleCancel,
94
94
  },
95
95
  {
96
- text: 'Test Failed Purchase',
96
+ text: 'Test failed purchase',
97
97
  style: 'destructive',
98
98
  onPress: handleFailedPurchase,
99
99
  },
100
100
  {
101
- text: 'Test Valid Purchase',
101
+ text: 'Test valid purchase',
102
102
  onPress: function () { return handlePurchase(data); },
103
103
  },
104
104
  ], { cancelable: true, onDismiss: handleCancel });
@@ -176,6 +176,19 @@ export interface RewardVerificationResult {
176
176
  /** True when verification did not complete (rejected / timeout / network). */
177
177
  failed: boolean;
178
178
  }
179
+ /**
180
+ * Ad metadata for a rewarded ad, passed to {@link Purchases.pollRewardVerification}
181
+ * to have the SDK automatically track reward-verification events for it.
182
+ * @beta
183
+ */
184
+ export interface RewardedAdTrackingMetadata {
185
+ mediatorName: AdMediatorName;
186
+ adFormat: AdFormat;
187
+ adUnitId: string;
188
+ impressionId: string;
189
+ networkName?: string | null;
190
+ placement?: string | null;
191
+ }
179
192
  export default class Purchases {
180
193
  /**
181
194
  * Supported SKU types.
@@ -1090,10 +1103,13 @@ export default class Purchases {
1090
1103
  *
1091
1104
  * @param clientTransactionId - The `clientTransactionId` from
1092
1105
  * {@link Purchases.generateRewardVerificationToken}.
1106
+ * @param trackingMetadata - Pass to have the SDK automatically track
1107
+ * reward-verification events for the ad it belongs to; omit to poll
1108
+ * without tracking.
1093
1109
  * @returns {Promise<RewardVerificationResult>} promise with the verification result.
1094
1110
  * @beta
1095
1111
  */
1096
- static pollRewardVerification(clientTransactionId: string): Promise<RewardVerificationResult>;
1112
+ static pollRewardVerification(clientTransactionId: string, trackingMetadata?: RewardedAdTrackingMetadata): Promise<RewardVerificationResult>;
1097
1113
  private static throwIfAndroidPlatform;
1098
1114
  private static throwIfIOSPlatform;
1099
1115
  private static isPurchasesAreCompletedByMyApp;
package/dist/purchases.js CHANGED
@@ -2146,17 +2146,20 @@ var Purchases = /** @class */ (function () {
2146
2146
  *
2147
2147
  * @param clientTransactionId - The `clientTransactionId` from
2148
2148
  * {@link Purchases.generateRewardVerificationToken}.
2149
+ * @param trackingMetadata - Pass to have the SDK automatically track
2150
+ * reward-verification events for the ad it belongs to; omit to poll
2151
+ * without tracking.
2149
2152
  * @returns {Promise<RewardVerificationResult>} promise with the verification result.
2150
2153
  * @beta
2151
2154
  */
2152
- Purchases.pollRewardVerification = function (clientTransactionId) {
2155
+ Purchases.pollRewardVerification = function (clientTransactionId, trackingMetadata) {
2153
2156
  return __awaiter(this, void 0, void 0, function () {
2154
2157
  return __generator(this, function (_a) {
2155
2158
  switch (_a.label) {
2156
2159
  case 0: return [4 /*yield*/, throwIfNotConfigured()];
2157
2160
  case 1:
2158
2161
  _a.sent();
2159
- return [2 /*return*/, RNPurchases.pollRewardVerification(clientTransactionId)];
2162
+ return [2 /*return*/, RNPurchases.pollRewardVerification(clientTransactionId, trackingMetadata)];
2160
2163
  }
2161
2164
  });
2162
2165
  });
package/ios/RNPurchases.m CHANGED
@@ -714,9 +714,11 @@ RCT_EXPORT_METHOD(generateRewardVerificationToken:(NSString *)impressionId
714
714
  }
715
715
 
716
716
  RCT_EXPORT_METHOD(pollRewardVerification:(NSString *)clientTransactionId
717
- resolve:(RCTPromiseResolveBlock)resolve
718
- reject:(RCTPromiseRejectBlock)reject) {
717
+ trackingMetadata:(nullable NSDictionary *)trackingMetadata
718
+ resolve:(RCTPromiseResolveBlock)resolve
719
+ reject:(RCTPromiseRejectBlock)reject) {
719
720
  [RCCommonFunctionality pollRewardVerificationWithClientTransactionId:clientTransactionId
721
+ trackingMetadata:trackingMetadata.mappingNSNullToNil
720
722
  completion:[self getResponseCompletionBlockWithResolve:resolve
721
723
  reject:reject]];
722
724
  }
@@ -783,7 +785,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
783
785
  }
784
786
 
785
787
  - (NSString *)platformFlavorVersion {
786
- return @"10.7.2";
788
+ return @"10.8.0";
787
789
  }
788
790
 
789
791
  @end
@@ -7,7 +7,6 @@
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
- 3552B97D252CF5900098008A /* PurchasesPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3552B97C252CF5900098008A /* PurchasesPlugin.swift */; };
11
10
  B3E7B58A1CC2AC0600A0062D /* RNPurchases.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNPurchases.m */; };
12
11
  /* End PBXBuildFile section */
13
12
 
@@ -25,8 +24,6 @@
25
24
 
26
25
  /* Begin PBXFileReference section */
27
26
  134814201AA4EA6300B7C361 /* libRNPurchases.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNPurchases.a; sourceTree = BUILT_PRODUCTS_DIR; };
28
- 3552B97B252CF5900098008A /* RNPurchases-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNPurchases-Bridging-Header.h"; sourceTree = "<group>"; };
29
- 3552B97C252CF5900098008A /* PurchasesPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchasesPlugin.swift; sourceTree = "<group>"; };
30
27
  B3E7B5881CC2AC0600A0062D /* RNPurchases.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPurchases.h; sourceTree = "<group>"; };
31
28
  B3E7B5891CC2AC0600A0062D /* RNPurchases.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPurchases.m; sourceTree = "<group>"; };
32
29
  /* End PBXFileReference section */
@@ -60,12 +57,10 @@
60
57
  58B511D21A9E6C8500147676 = {
61
58
  isa = PBXGroup;
62
59
  children = (
63
- 3552B97C252CF5900098008A /* PurchasesPlugin.swift */,
64
60
  B3E7B5881CC2AC0600A0062D /* RNPurchases.h */,
65
61
  B3E7B5891CC2AC0600A0062D /* RNPurchases.m */,
66
62
  134814211AA4EA7D00B7C361 /* Products */,
67
63
  35493AC8202D4BCD004DFA39 /* Frameworks */,
68
- 3552B97B252CF5900098008A /* RNPurchases-Bridging-Header.h */,
69
64
  );
70
65
  sourceTree = "<group>";
71
66
  };
@@ -129,7 +124,6 @@
129
124
  buildActionMask = 2147483647;
130
125
  files = (
131
126
  B3E7B58A1CC2AC0600A0062D /* RNPurchases.m in Sources */,
132
- 3552B97D252CF5900098008A /* PurchasesPlugin.swift in Sources */,
133
127
  );
134
128
  runOnlyForDeploymentPostprocessing = 0;
135
129
  };
@@ -236,7 +230,6 @@
236
230
  OTHER_LDFLAGS = "-ObjC";
237
231
  PRODUCT_NAME = RNPurchases;
238
232
  SKIP_INSTALL = YES;
239
- SWIFT_OBJC_BRIDGING_HEADER = "RNPurchases-Bridging-Header.h";
240
233
  SWIFT_OPTIMIZATION_LEVEL = "-Onone";
241
234
  SWIFT_VERSION = 5.0;
242
235
  };
@@ -261,7 +254,6 @@
261
254
  OTHER_LDFLAGS = "-ObjC";
262
255
  PRODUCT_NAME = RNPurchases;
263
256
  SKIP_INSTALL = YES;
264
- SWIFT_OBJC_BRIDGING_HEADER = "RNPurchases-Bridging-Header.h";
265
257
  SWIFT_VERSION = 5.0;
266
258
  };
267
259
  name = Release;
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.7.2",
4
+ "version": "10.8.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
  "module": "dist/index.js",
@@ -118,7 +118,7 @@
118
118
  ]
119
119
  },
120
120
  "dependencies": {
121
- "@revenuecat/purchases-js-hybrid-mappings": "18.31.0",
122
- "@revenuecat/purchases-typescript-internal": "18.31.0"
121
+ "@revenuecat/purchases-js-hybrid-mappings": "18.32.1",
122
+ "@revenuecat/purchases-typescript-internal": "18.32.1"
123
123
  }
124
124
  }
@@ -1,4 +0,0 @@
1
- //
2
- // Use this file to import your target's public headers that you would like to expose to Swift.
3
- //
4
-