react-native-purchases 10.7.2 → 10.8.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.31.0'
28
+ spec.dependency "PurchasesHybridCommon", '18.33.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.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.31.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.33.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.1";
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.1';
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 });
@@ -43,17 +43,14 @@ export interface TrackCustomPaywallImpressionOptions {
43
43
  }
44
44
  /**
45
45
  * Predefined mediator name constants. Use these or pass any string for unlisted networks.
46
- * @beta
47
46
  */
48
47
  export declare const AdMediatorName: {
49
48
  readonly adMob: "AdMob";
50
49
  readonly appLovin: "AppLovin";
51
50
  };
52
- /** @beta */
53
51
  export type AdMediatorName = string;
54
52
  /**
55
53
  * Predefined ad format constants. Use these or pass any string for unlisted formats.
56
- * @beta
57
54
  */
58
55
  export declare const AdFormat: {
59
56
  readonly other: "other";
@@ -64,11 +61,9 @@ export declare const AdFormat: {
64
61
  readonly nativeAd: "native";
65
62
  readonly appOpen: "app_open";
66
63
  };
67
- /** @beta */
68
64
  export type AdFormat = string;
69
65
  /**
70
66
  * Predefined precision constants for ad revenue. Use these or pass any string for unlisted values.
71
- * @beta
72
67
  */
73
68
  export declare const AdRevenuePrecision: {
74
69
  readonly exact: "exact";
@@ -76,9 +71,7 @@ export declare const AdRevenuePrecision: {
76
71
  readonly estimated: "estimated";
77
72
  readonly unknown: "unknown";
78
73
  };
79
- /** @beta */
80
74
  export type AdRevenuePrecision = string;
81
- /** @beta */
82
75
  export interface AdDisplayedData {
83
76
  mediatorName: AdMediatorName;
84
77
  adFormat: AdFormat;
@@ -87,7 +80,6 @@ export interface AdDisplayedData {
87
80
  networkName?: string | null;
88
81
  placement?: string | null;
89
82
  }
90
- /** @beta */
91
83
  export interface AdOpenedData {
92
84
  mediatorName: AdMediatorName;
93
85
  adFormat: AdFormat;
@@ -96,7 +88,6 @@ export interface AdOpenedData {
96
88
  networkName?: string | null;
97
89
  placement?: string | null;
98
90
  }
99
- /** @beta */
100
91
  export interface AdLoadedData {
101
92
  mediatorName: AdMediatorName;
102
93
  adFormat: AdFormat;
@@ -105,7 +96,6 @@ export interface AdLoadedData {
105
96
  networkName?: string | null;
106
97
  placement?: string | null;
107
98
  }
108
- /** @beta */
109
99
  export interface AdRevenueData {
110
100
  mediatorName: AdMediatorName;
111
101
  adFormat: AdFormat;
@@ -117,7 +107,6 @@ export interface AdRevenueData {
117
107
  networkName?: string | null;
118
108
  placement?: string | null;
119
109
  }
120
- /** @beta */
121
110
  export interface AdFailedToLoadData {
122
111
  mediatorName: AdMediatorName;
123
112
  adFormat: AdFormat;
@@ -129,7 +118,6 @@ export interface AdFailedToLoadData {
129
118
  * Token generated for a rewarded ad impression. Pass `clientTransactionId` to
130
119
  * the ad network as server-side verification custom data, then to
131
120
  * {@link Purchases.pollRewardVerification} to await the reward.
132
- * @beta
133
121
  */
134
122
  export interface RewardVerificationToken {
135
123
  customData: string;
@@ -138,16 +126,13 @@ export interface RewardVerificationToken {
138
126
  }
139
127
  /**
140
128
  * A reward granted after a verified rewarded ad. Discriminated by `type`.
141
- * @beta
142
129
  */
143
130
  export type VerifiedReward = VerifiedVirtualCurrencyReward | VerifiedEntitlementReward | VerifiedNoReward | VerifiedUnsupportedReward;
144
- /** @beta */
145
131
  export interface VerifiedVirtualCurrencyReward {
146
132
  type: "virtual_currency";
147
133
  code: string;
148
134
  amount: number;
149
135
  }
150
- /** @beta */
151
136
  export interface VerifiedEntitlementReward {
152
137
  type: "entitlement";
153
138
  identifier: string;
@@ -156,17 +141,16 @@ export interface VerifiedEntitlementReward {
156
141
  /** Expiration date in milliseconds since epoch. */
157
142
  expiresAtMillis: number;
158
143
  }
159
- /** Verification completed but nothing was granted. @beta */
144
+ /** Verification completed but nothing was granted. */
160
145
  export interface VerifiedNoReward {
161
146
  type: "no_reward";
162
147
  }
163
- /** Verification completed but the reward type isn't modeled by this SDK version. @beta */
148
+ /** Verification completed but the reward type isn't modeled by this SDK version. */
164
149
  export interface VerifiedUnsupportedReward {
165
150
  type: "unsupported_reward";
166
151
  }
167
152
  /**
168
153
  * Result of polling for reward verification.
169
- * @beta
170
154
  */
171
155
  export interface RewardVerificationResult {
172
156
  /** The primary reward when verification succeeded; absent on failure. */
@@ -176,6 +160,18 @@ export interface RewardVerificationResult {
176
160
  /** True when verification did not complete (rejected / timeout / network). */
177
161
  failed: boolean;
178
162
  }
163
+ /**
164
+ * Ad metadata for a rewarded ad, passed to {@link Purchases.pollRewardVerification}
165
+ * to have the SDK automatically track reward-verification events for it.
166
+ */
167
+ export interface RewardedAdTrackingMetadata {
168
+ mediatorName: AdMediatorName;
169
+ adFormat: AdFormat;
170
+ adUnitId: string;
171
+ impressionId: string;
172
+ networkName?: string | null;
173
+ placement?: string | null;
174
+ }
179
175
  export default class Purchases {
180
176
  /**
181
177
  * Supported SKU types.
@@ -1053,7 +1049,6 @@ export default class Purchases {
1053
1049
  static isConfigured(): Promise<boolean>;
1054
1050
  /**
1055
1051
  * Provides access to ad lifecycle tracking methods.
1056
- * @beta
1057
1052
  */
1058
1053
  static get adTracker(): PurchasesAdTracker;
1059
1054
  /**
@@ -1078,7 +1073,6 @@ export default class Purchases {
1078
1073
  *
1079
1074
  * @param impressionId - The impression identifier of the rewarded ad.
1080
1075
  * @returns {Promise<RewardVerificationToken>} promise with the generated token.
1081
- * @beta
1082
1076
  */
1083
1077
  static generateRewardVerificationToken(impressionId: string): Promise<RewardVerificationToken>;
1084
1078
  /**
@@ -1090,10 +1084,12 @@ export default class Purchases {
1090
1084
  *
1091
1085
  * @param clientTransactionId - The `clientTransactionId` from
1092
1086
  * {@link Purchases.generateRewardVerificationToken}.
1087
+ * @param trackingMetadata - Pass to have the SDK automatically track
1088
+ * reward-verification events for the ad it belongs to; omit to poll
1089
+ * without tracking.
1093
1090
  * @returns {Promise<RewardVerificationResult>} promise with the verification result.
1094
- * @beta
1095
1091
  */
1096
- static pollRewardVerification(clientTransactionId: string): Promise<RewardVerificationResult>;
1092
+ static pollRewardVerification(clientTransactionId: string, trackingMetadata?: RewardedAdTrackingMetadata): Promise<RewardVerificationResult>;
1097
1093
  private static throwIfAndroidPlatform;
1098
1094
  private static throwIfIOSPlatform;
1099
1095
  private static isPurchasesAreCompletedByMyApp;
@@ -1102,7 +1098,6 @@ export default class Purchases {
1102
1098
  /**
1103
1099
  * Provides methods for tracking ad lifecycle events.
1104
1100
  * Access via {@link Purchases.adTracker}.
1105
- * @beta
1106
1101
  */
1107
1102
  export declare class PurchasesAdTracker {
1108
1103
  trackAdDisplayed(data: AdDisplayedData): Promise<void>;
package/dist/purchases.js CHANGED
@@ -82,7 +82,6 @@ var customLogHandler;
82
82
  var trackedEventListeners = [];
83
83
  /**
84
84
  * Predefined mediator name constants. Use these or pass any string for unlisted networks.
85
- * @beta
86
85
  */
87
86
  exports.AdMediatorName = {
88
87
  adMob: "AdMob",
@@ -90,7 +89,6 @@ exports.AdMediatorName = {
90
89
  };
91
90
  /**
92
91
  * Predefined ad format constants. Use these or pass any string for unlisted formats.
93
- * @beta
94
92
  */
95
93
  exports.AdFormat = {
96
94
  other: "other",
@@ -103,7 +101,6 @@ exports.AdFormat = {
103
101
  };
104
102
  /**
105
103
  * Predefined precision constants for ad revenue. Use these or pass any string for unlisted values.
106
- * @beta
107
104
  */
108
105
  exports.AdRevenuePrecision = {
109
106
  exact: "exact",
@@ -2069,7 +2066,6 @@ var Purchases = /** @class */ (function () {
2069
2066
  Object.defineProperty(Purchases, "adTracker", {
2070
2067
  /**
2071
2068
  * Provides access to ad lifecycle tracking methods.
2072
- * @beta
2073
2069
  */
2074
2070
  get: function () {
2075
2071
  if (!adTrackerSingleton) {
@@ -2123,7 +2119,6 @@ var Purchases = /** @class */ (function () {
2123
2119
  *
2124
2120
  * @param impressionId - The impression identifier of the rewarded ad.
2125
2121
  * @returns {Promise<RewardVerificationToken>} promise with the generated token.
2126
- * @beta
2127
2122
  */
2128
2123
  Purchases.generateRewardVerificationToken = function (impressionId) {
2129
2124
  return __awaiter(this, void 0, void 0, function () {
@@ -2146,17 +2141,19 @@ var Purchases = /** @class */ (function () {
2146
2141
  *
2147
2142
  * @param clientTransactionId - The `clientTransactionId` from
2148
2143
  * {@link Purchases.generateRewardVerificationToken}.
2144
+ * @param trackingMetadata - Pass to have the SDK automatically track
2145
+ * reward-verification events for the ad it belongs to; omit to poll
2146
+ * without tracking.
2149
2147
  * @returns {Promise<RewardVerificationResult>} promise with the verification result.
2150
- * @beta
2151
2148
  */
2152
- Purchases.pollRewardVerification = function (clientTransactionId) {
2149
+ Purchases.pollRewardVerification = function (clientTransactionId, trackingMetadata) {
2153
2150
  return __awaiter(this, void 0, void 0, function () {
2154
2151
  return __generator(this, function (_a) {
2155
2152
  switch (_a.label) {
2156
2153
  case 0: return [4 /*yield*/, throwIfNotConfigured()];
2157
2154
  case 1:
2158
2155
  _a.sent();
2159
- return [2 /*return*/, RNPurchases.pollRewardVerification(clientTransactionId)];
2156
+ return [2 /*return*/, RNPurchases.pollRewardVerification(clientTransactionId, trackingMetadata)];
2160
2157
  }
2161
2158
  });
2162
2159
  });
@@ -2300,7 +2297,6 @@ var adTrackerSingleton;
2300
2297
  /**
2301
2298
  * Provides methods for tracking ad lifecycle events.
2302
2299
  * Access via {@link Purchases.adTracker}.
2303
- * @beta
2304
2300
  */
2305
2301
  var PurchasesAdTracker = /** @class */ (function () {
2306
2302
  function PurchasesAdTracker() {
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.1";
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.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",
@@ -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.33.1",
122
+ "@revenuecat/purchases-typescript-internal": "18.33.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
-