react-native-purchases 5.0.0-beta.1 → 5.0.0-beta.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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ React Native Purchases is a client for the [RevenueCat](https://www.revenuecat.c
23
23
 
24
24
  ## Requirements
25
25
 
26
- The minimum React Native version this SDK requires is `0.58`.
26
+ The minimum React Native version this SDK requires is `0.64`.
27
27
 
28
28
  ## Installation
29
29
 
@@ -24,6 +24,6 @@ Pod::Spec.new do |spec|
24
24
  ]
25
25
 
26
26
  spec.dependency "React-Core"
27
- spec.dependency "PurchasesHybridCommon", '3.3.0'
27
+ spec.dependency "PurchasesHybridCommon", '4.1.0'
28
28
  spec.swift_version = '5.0'
29
29
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '5.0.0-beta.1'
32
+ versionName '5.0.0-beta.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:3.3.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.1.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '4.6.1'
32
+ versionName '5.0.0-beta.3'
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:3.3.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.1.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -1,5 +1,5 @@
1
1
  android.useAndroidX=true
2
- Purchases_kotlinVersion=1.5.31
2
+ Purchases_kotlinVersion=1.6.21
3
3
  Purchases_compileSdkVersion=28
4
4
  Purchases_targetSdkVersion=28
5
5
  Purchases_minSdkVersion=16
@@ -53,6 +53,7 @@ internal object RNPurchasesConverters {
53
53
  return array
54
54
  }
55
55
 
56
+ @Suppress("UNCHECKED_CAST")
56
57
  private fun convertArrayToWritableArray(array: Array<Any?>): WritableArray {
57
58
  val writableArray: WritableArray = WritableNativeArray()
58
59
  for (item in array) {
@@ -71,6 +72,7 @@ internal object RNPurchasesConverters {
71
72
  }
72
73
 
73
74
  @JvmStatic
75
+ @Suppress("UNCHECKED_CAST")
74
76
  fun convertMapToWriteableMap(map: Map<String, *>): WritableMap {
75
77
  val writableMap: WritableMap = WritableNativeMap()
76
78
  for ((key, value) in map) {
@@ -87,4 +89,4 @@ internal object RNPurchasesConverters {
87
89
  }
88
90
  return writableMap
89
91
  }
90
- }
92
+ }
@@ -16,6 +16,7 @@ import com.facebook.react.bridge.WritableArray;
16
16
  import com.facebook.react.modules.core.DeviceEventManagerModule;
17
17
  import com.revenuecat.purchases.CustomerInfo;
18
18
  import com.revenuecat.purchases.Purchases;
19
+ import com.revenuecat.purchases.Store;
19
20
  import com.revenuecat.purchases.common.PlatformInfo;
20
21
  import com.revenuecat.purchases.hybridcommon.CommonKt;
21
22
  import com.revenuecat.purchases.hybridcommon.ErrorContainer;
@@ -79,9 +80,13 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
79
80
  @ReactMethod
80
81
  public void setupPurchases(String apiKey, @Nullable String appUserID,
81
82
  boolean observerMode, @Nullable String userDefaultsSuiteName,
82
- @Nullable Boolean usesStoreKit2IfAvailable) {
83
+ @Nullable Boolean usesStoreKit2IfAvailable, boolean useAmazon) {
83
84
  PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION);
84
- CommonKt.configure(reactContext, apiKey, appUserID, observerMode, platformInfo);
85
+ Store store = Store.PLAY_STORE;
86
+ if (useAmazon) {
87
+ store = Store.AMAZON;
88
+ }
89
+ CommonKt.configure(reactContext, apiKey, appUserID, observerMode, platformInfo, store);
85
90
  Purchases.getSharedInstance().setUpdatedCustomerInfoListener(this);
86
91
  }
87
92
 
@@ -16,6 +16,7 @@ import com.facebook.react.bridge.WritableArray;
16
16
  import com.facebook.react.modules.core.DeviceEventManagerModule;
17
17
  import com.revenuecat.purchases.CustomerInfo;
18
18
  import com.revenuecat.purchases.Purchases;
19
+ import com.revenuecat.purchases.Store;
19
20
  import com.revenuecat.purchases.common.PlatformInfo;
20
21
  import com.revenuecat.purchases.hybridcommon.CommonKt;
21
22
  import com.revenuecat.purchases.hybridcommon.ErrorContainer;
@@ -79,9 +80,13 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
79
80
  @ReactMethod
80
81
  public void setupPurchases(String apiKey, @Nullable String appUserID,
81
82
  boolean observerMode, @Nullable String userDefaultsSuiteName,
82
- @Nullable Boolean usesStoreKit2IfAvailable) {
83
+ @Nullable Boolean usesStoreKit2IfAvailable, boolean useAmazon) {
83
84
  PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION);
84
- CommonKt.configure(reactContext, apiKey, appUserID, observerMode, platformInfo);
85
+ Store store = Store.PLAY_STORE;
86
+ if (useAmazon) {
87
+ store = Store.AMAZON;
88
+ }
89
+ CommonKt.configure(reactContext, apiKey, appUserID, observerMode, platformInfo, store);
85
90
  Purchases.getSharedInstance().setUpdatedCustomerInfoListener(this);
86
91
  }
87
92
 
package/dist/errors.d.ts CHANGED
@@ -34,6 +34,9 @@ export interface PurchasesError {
34
34
  export interface ErrorInfo {
35
35
  readableErrorCode: string;
36
36
  }
37
+ /**
38
+ * @internal
39
+ */
37
40
  export declare class UninitializedPurchasesError extends Error {
38
41
  constructor();
39
42
  }
package/dist/errors.js CHANGED
@@ -41,6 +41,9 @@ var PURCHASES_ERROR_CODE;
41
41
  PURCHASES_ERROR_CODE["INVALID_SUBSCRIBER_ATTRIBUTES_ERROR"] = "21";
42
42
  PURCHASES_ERROR_CODE["LOG_OUT_ANONYMOUS_USER_ERROR"] = "22";
43
43
  })(PURCHASES_ERROR_CODE = exports.PURCHASES_ERROR_CODE || (exports.PURCHASES_ERROR_CODE = {}));
44
+ /**
45
+ * @internal
46
+ */
44
47
  var UninitializedPurchasesError = /** @class */ (function (_super) {
45
48
  __extends(UninitializedPurchasesError, _super);
46
49
  function UninitializedPurchasesError() {
@@ -74,15 +74,15 @@ export interface PurchasesStoreProduct {
74
74
  /**
75
75
  * Formatted price of the item, including its currency sign.
76
76
  */
77
- readonly price_string: string;
77
+ readonly priceString: string;
78
78
  /**
79
79
  * Currency code for price and original price.
80
80
  */
81
- readonly currency_code: string;
81
+ readonly currencyCode: string;
82
82
  /**
83
83
  * Introductory price.
84
84
  */
85
- readonly intro_price: PurchasesIntroPrice | null;
85
+ readonly introPrice: PurchasesIntroPrice | null;
86
86
  /**
87
87
  * Collection of discount offers for a product. Null for Android.
88
88
  */
@@ -62,6 +62,17 @@ export interface LogInResult {
62
62
  */
63
63
  readonly created: boolean;
64
64
  }
65
+ /**
66
+ * Holds parameters to initialize the SDK.
67
+ */
68
+ export interface PurchasesConfiguration {
69
+ apiKey: string;
70
+ appUserID?: string | null;
71
+ observerMode?: boolean;
72
+ userDefaultsSuiteName?: string;
73
+ usesStoreKit2IfAvailable?: boolean;
74
+ useAmazon?: boolean;
75
+ }
65
76
  export default class Purchases {
66
77
  /**
67
78
  * Supported SKU types.
@@ -101,6 +112,9 @@ export default class Purchases {
101
112
  * @enum {string}
102
113
  */
103
114
  static PURCHASES_ERROR_CODE: typeof PURCHASES_ERROR_CODE;
115
+ /**
116
+ * @internal
117
+ */
104
118
  static UninitializedPurchasesError: typeof UninitializedPurchasesError;
105
119
  /**
106
120
  * Sets up Purchases with your API key and an app user id.
@@ -108,11 +122,12 @@ export default class Purchases {
108
122
  * @param {String?} appUserID An optional unique id for identifying the user. Needs to be a string.
109
123
  * @param {boolean} [observerMode=false] An optional boolean. Set this to TRUE if you have your own IAP implementation and want to use only RevenueCat's backend. Default is FALSE.
110
124
  * @param {boolean} [usesStoreKit2IfAvailable=false] An optional boolean. iOS-only. Set this to TRUE to enable StoreKit2 on compatible devices.
125
+ * @param {boolean} [useAmazon=false] An optional boolean. Android-only. Set this to TRUE to enable Amazon on compatible devices.
111
126
  * @param {String?} userDefaultsSuiteName An optional string. iOS-only, will be ignored for Android.
112
127
  * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults suite, otherwise it will use standardUserDefaults.
113
128
  * Default is null, which will make the SDK use standardUserDefaults.
114
129
  */
115
- static configure(apiKey: string, appUserID?: string | null, observerMode?: boolean, userDefaultsSuiteName?: string, usesStoreKit2IfAvailable?: boolean): void;
130
+ static configure({ apiKey, appUserID, observerMode, userDefaultsSuiteName, usesStoreKit2IfAvailable, useAmazon }: PurchasesConfiguration): void;
116
131
  /**
117
132
  * @deprecated, configure behavior through the RevenueCat dashboard instead.
118
133
  * If an user tries to purchase a product that is active on the current app store account,
@@ -231,7 +246,7 @@ export default class Purchases {
231
246
  * @returns {Promise<CustomerInfo>} A promise of a customer info object. Rejections return an error code, and an
232
247
  * userInfo object with more information. The promise will be also be rejected if setup has not been called yet.
233
248
  */
234
- static restoreTransactions(): Promise<CustomerInfo>;
249
+ static restorePurchases(): Promise<CustomerInfo>;
235
250
  /**
236
251
  * Get the appUserID
237
252
  * @returns {Promise<string>} The app user id in a promise
@@ -275,11 +290,17 @@ export default class Purchases {
275
290
  */
276
291
  static syncPurchases(): Promise<void>;
277
292
  /**
293
+ * @deprecated, use enableAdServicesAttributionTokenCollection instead.
278
294
  * Enable automatic collection of Apple Search Ad attribution. Disabled by default
279
295
  * @param {boolean} enabled Enable or not automatic apple search ads attribution collection
280
296
  * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
281
297
  */
282
298
  static setAutomaticAppleSearchAdsAttributionCollection(enabled: boolean): Promise<void>;
299
+ /**
300
+ * Enable automatic collection of Apple Search Ad attribution on iOS. Disabled by default
301
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
302
+ */
303
+ static enableAdServicesAttributionTokenCollection(): Promise<void>;
283
304
  /**
284
305
  * @returns { Promise<boolean> } If the `appUserID` has been generated by RevenueCat or not.
285
306
  * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
package/dist/purchases.js CHANGED
@@ -102,17 +102,20 @@ var Purchases = /** @class */ (function () {
102
102
  * @param {String?} appUserID An optional unique id for identifying the user. Needs to be a string.
103
103
  * @param {boolean} [observerMode=false] An optional boolean. Set this to TRUE if you have your own IAP implementation and want to use only RevenueCat's backend. Default is FALSE.
104
104
  * @param {boolean} [usesStoreKit2IfAvailable=false] An optional boolean. iOS-only. Set this to TRUE to enable StoreKit2 on compatible devices.
105
+ * @param {boolean} [useAmazon=false] An optional boolean. Android-only. Set this to TRUE to enable Amazon on compatible devices.
105
106
  * @param {String?} userDefaultsSuiteName An optional string. iOS-only, will be ignored for Android.
106
107
  * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults suite, otherwise it will use standardUserDefaults.
107
108
  * Default is null, which will make the SDK use standardUserDefaults.
108
109
  */
109
- Purchases.configure = function (apiKey, appUserID, observerMode, userDefaultsSuiteName, usesStoreKit2IfAvailable) {
110
- if (observerMode === void 0) { observerMode = false; }
111
- if (usesStoreKit2IfAvailable === void 0) { usesStoreKit2IfAvailable = false; }
110
+ Purchases.configure = function (_a) {
111
+ var apiKey = _a.apiKey, _b = _a.appUserID, appUserID = _b === void 0 ? null : _b, _c = _a.observerMode, observerMode = _c === void 0 ? false : _c, userDefaultsSuiteName = _a.userDefaultsSuiteName, _d = _a.usesStoreKit2IfAvailable, usesStoreKit2IfAvailable = _d === void 0 ? false : _d, _e = _a.useAmazon, useAmazon = _e === void 0 ? false : _e;
112
+ if (apiKey === undefined || typeof apiKey !== "string") {
113
+ throw new Error("Invalid API key. It must be called with an Object: configure({apiKey: \"key\"})");
114
+ }
112
115
  if (appUserID !== null && typeof appUserID !== "undefined" && typeof appUserID !== "string") {
113
116
  throw new Error("appUserID needs to be a string");
114
117
  }
115
- RNPurchases.setupPurchases(apiKey, appUserID, observerMode, userDefaultsSuiteName, usesStoreKit2IfAvailable);
118
+ RNPurchases.setupPurchases(apiKey, appUserID, observerMode, userDefaultsSuiteName, usesStoreKit2IfAvailable, useAmazon);
116
119
  };
117
120
  /**
118
121
  * @deprecated, configure behavior through the RevenueCat dashboard instead.
@@ -373,14 +376,14 @@ var Purchases = /** @class */ (function () {
373
376
  * @returns {Promise<CustomerInfo>} A promise of a customer info object. Rejections return an error code, and an
374
377
  * userInfo object with more information. The promise will be also be rejected if setup has not been called yet.
375
378
  */
376
- Purchases.restoreTransactions = function () {
379
+ Purchases.restorePurchases = function () {
377
380
  return __awaiter(this, void 0, void 0, function () {
378
381
  return __generator(this, function (_a) {
379
382
  switch (_a.label) {
380
383
  case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
381
384
  case 1:
382
385
  _a.sent();
383
- return [2 /*return*/, RNPurchases.restoreTransactions()];
386
+ return [2 /*return*/, RNPurchases.restorePurchases()];
384
387
  }
385
388
  });
386
389
  });
@@ -495,6 +498,7 @@ var Purchases = /** @class */ (function () {
495
498
  });
496
499
  };
497
500
  /**
501
+ * @deprecated, use enableAdServicesAttributionTokenCollection instead.
498
502
  * Enable automatic collection of Apple Search Ad attribution. Disabled by default
499
503
  * @param {boolean} enabled Enable or not automatic apple search ads attribution collection
500
504
  * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
@@ -509,6 +513,26 @@ var Purchases = /** @class */ (function () {
509
513
  });
510
514
  });
511
515
  };
516
+ /**
517
+ * Enable automatic collection of Apple Search Ad attribution on iOS. Disabled by default
518
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
519
+ */
520
+ Purchases.enableAdServicesAttributionTokenCollection = function () {
521
+ return __awaiter(this, void 0, void 0, function () {
522
+ return __generator(this, function (_a) {
523
+ switch (_a.label) {
524
+ case 0:
525
+ if (!(react_native_2.Platform.OS === "ios")) return [3 /*break*/, 2];
526
+ return [4 /*yield*/, Purchases.throwIfNotConfigured()];
527
+ case 1:
528
+ _a.sent();
529
+ RNPurchases.enableAdServicesAttributionTokenCollection();
530
+ _a.label = 2;
531
+ case 2: return [2 /*return*/];
532
+ }
533
+ });
534
+ });
535
+ };
512
536
  /**
513
537
  * @returns { Promise<boolean> } If the `appUserID` has been generated by RevenueCat or not.
514
538
  * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
@@ -1092,6 +1116,9 @@ var Purchases = /** @class */ (function () {
1092
1116
  * @enum {string}
1093
1117
  */
1094
1118
  Purchases.PURCHASES_ERROR_CODE = errors_1.PURCHASES_ERROR_CODE;
1119
+ /**
1120
+ * @internal
1121
+ */
1095
1122
  Purchases.UninitializedPurchasesError = errors_1.UninitializedPurchasesError;
1096
1123
  return Purchases;
1097
1124
  }());
package/ios/RNPurchases.m CHANGED
@@ -38,15 +38,16 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
38
38
  appUserID:(nullable NSString *)appUserID
39
39
  observerMode:(BOOL)observerMode
40
40
  userDefaultsSuiteName:(nullable NSString *)userDefaultsSuiteName
41
- usesStoreKit2IfAvailable:(BOOL)usesStoreKit2IfAvailable) {
41
+ usesStoreKit2IfAvailable:(BOOL)usesStoreKit2IfAvailable
42
+ useAmazon:(BOOL)useAmazon) {
42
43
  RCPurchases *purchases = [RCPurchases configureWithAPIKey:apiKey
43
- appUserID:appUserID
44
- observerMode:observerMode
45
- userDefaultsSuiteName:userDefaultsSuiteName
46
- platformFlavor:self.platformFlavor
47
- platformFlavorVersion:self.platformFlavorVersion
44
+ appUserID:appUserID
45
+ observerMode:observerMode
46
+ userDefaultsSuiteName:userDefaultsSuiteName
47
+ platformFlavor:self.platformFlavor
48
+ platformFlavorVersion:self.platformFlavorVersion
48
49
  usesStoreKit2IfAvailable:usesStoreKit2IfAvailable
49
- dangerousSettings:nil];
50
+ dangerousSettings:nil];
50
51
  purchases.delegate = self;
51
52
  }
52
53
 
@@ -103,8 +104,8 @@ RCT_REMAP_METHOD(purchasePackage,
103
104
  completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
104
105
  }
105
106
 
106
- RCT_REMAP_METHOD(restoreTransactions,
107
- restoreTransactionsWithResolve:(RCTPromiseResolveBlock)resolve
107
+ RCT_REMAP_METHOD(restorePurchases,
108
+ restorePurchasesWithResolve:(RCTPromiseResolveBlock)resolve
108
109
  reject:(RCTPromiseRejectBlock)reject) {
109
110
  [RCCommonFunctionality restorePurchasesWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve
110
111
  reject:reject]];
@@ -154,6 +155,15 @@ RCT_EXPORT_METHOD(setAutomaticAppleSearchAdsAttributionCollection:(BOOL)automati
154
155
  [RCCommonFunctionality setAutomaticAppleSearchAdsAttributionCollection:automaticAppleSearchAdsAttributionCollection];
155
156
  }
156
157
 
158
+ RCT_EXPORT_METHOD(enableAdServicesAttributionTokenCollection)
159
+ {
160
+ if (@available(iOS 14.3, macOS 11.1, macCatalyst 14.3, *)) {
161
+ [RCCommonFunctionality enableAdServicesAttributionTokenCollection];
162
+ } else {
163
+ NSLog(@"[Purchases] Warning: tried to enable AdServices attribution token collection, but it's only available on iOS 14.3 or greater or macOS 11.1 or greater.");
164
+ }
165
+ }
166
+
157
167
  RCT_REMAP_METHOD(isAnonymous,
158
168
  isAnonymousWithResolve:(RCTPromiseResolveBlock)resolve
159
169
  reject:(RCTPromiseRejectBlock)reject) {
@@ -336,7 +346,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
336
346
  }
337
347
 
338
348
  - (NSString *)platformFlavorVersion {
339
- return @"5.0.0-beta.1";
349
+ return @"5.0.0-beta.4";
340
350
  }
341
351
 
342
352
  @end
@@ -38,15 +38,16 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
38
38
  appUserID:(nullable NSString *)appUserID
39
39
  observerMode:(BOOL)observerMode
40
40
  userDefaultsSuiteName:(nullable NSString *)userDefaultsSuiteName
41
- usesStoreKit2IfAvailable:(BOOL)usesStoreKit2IfAvailable) {
41
+ usesStoreKit2IfAvailable:(BOOL)usesStoreKit2IfAvailable
42
+ useAmazon:(BOOL)useAmazon) {
42
43
  RCPurchases *purchases = [RCPurchases configureWithAPIKey:apiKey
43
- appUserID:appUserID
44
- observerMode:observerMode
45
- userDefaultsSuiteName:userDefaultsSuiteName
46
- platformFlavor:self.platformFlavor
47
- platformFlavorVersion:self.platformFlavorVersion
44
+ appUserID:appUserID
45
+ observerMode:observerMode
46
+ userDefaultsSuiteName:userDefaultsSuiteName
47
+ platformFlavor:self.platformFlavor
48
+ platformFlavorVersion:self.platformFlavorVersion
48
49
  usesStoreKit2IfAvailable:usesStoreKit2IfAvailable
49
- dangerousSettings:nil];
50
+ dangerousSettings:nil];
50
51
  purchases.delegate = self;
51
52
  }
52
53
 
@@ -103,8 +104,8 @@ RCT_REMAP_METHOD(purchasePackage,
103
104
  completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
104
105
  }
105
106
 
106
- RCT_REMAP_METHOD(restoreTransactions,
107
- restoreTransactionsWithResolve:(RCTPromiseResolveBlock)resolve
107
+ RCT_REMAP_METHOD(restorePurchases,
108
+ restorePurchasesWithResolve:(RCTPromiseResolveBlock)resolve
108
109
  reject:(RCTPromiseRejectBlock)reject) {
109
110
  [RCCommonFunctionality restorePurchasesWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve
110
111
  reject:reject]];
@@ -154,6 +155,15 @@ RCT_EXPORT_METHOD(setAutomaticAppleSearchAdsAttributionCollection:(BOOL)automati
154
155
  [RCCommonFunctionality setAutomaticAppleSearchAdsAttributionCollection:automaticAppleSearchAdsAttributionCollection];
155
156
  }
156
157
 
158
+ RCT_EXPORT_METHOD(enableAdServicesAttributionTokenCollection)
159
+ {
160
+ if (@available(iOS 14.3, macOS 11.1, macCatalyst 14.3, *)) {
161
+ [RCCommonFunctionality enableAdServicesAttributionTokenCollection];
162
+ } else {
163
+ NSLog(@"[Purchases] Warning: tried to enable AdServices attribution token collection, but it's only available on iOS 14.3 or greater or macOS 11.1 or greater.");
164
+ }
165
+ }
166
+
157
167
  RCT_REMAP_METHOD(isAnonymous,
158
168
  isAnonymousWithResolve:(RCTPromiseResolveBlock)resolve
159
169
  reject:(RCTPromiseRejectBlock)reject) {
@@ -336,7 +346,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
336
346
  }
337
347
 
338
348
  - (NSString *)platformFlavorVersion {
339
- return @"4.6.1";
349
+ return @"5.0.0-beta.3";
340
350
  }
341
351
 
342
352
  @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": "5.0.0-beta.1",
4
+ "version": "5.0.0-beta.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
  "types": "dist/index.d.ts",
@@ -70,6 +70,7 @@
70
70
  "ts-jest": "^24.1.0",
71
71
  "tslint": "^5.20.0",
72
72
  "tslint-config-prettier": "^1.18.0",
73
+ "typedoc": "^0.20.37",
73
74
  "typescript": "^3.8.3"
74
75
  },
75
76
  "jest": {
@@ -0,0 +1,9 @@
1
+ <!-- This file is used to redirect visitors to the latest version of the docs -->
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.0.0-beta.4/" />
6
+ </head>
7
+ <body>
8
+ </body>
9
+ </html>
@@ -0,0 +1,9 @@
1
+ <!-- This file is used to redirect visitors to the latest version of the docs -->
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.0.0-beta.3/" />
6
+ </head>
7
+ <body>
8
+ </body>
9
+ </html>
@@ -67,15 +67,9 @@ global.offeringsStub = {
67
67
  weekly: {
68
68
  offeringIdentifier: 'default',
69
69
  product: {
70
- intro_price_period_number_of_units: 7,
71
- intro_price_period_unit: 'DAY',
72
- intro_price_cycles: 3,
73
- intro_price_period: 'P1W',
74
- intro_price_string: '$4.99',
75
- intro_price: 4.99,
76
70
  description: 'Product with intro price',
77
- currency_code: 'USD',
78
- price_string: '$9.99',
71
+ currencyCode: 'USD',
72
+ priceString: '$9.99',
79
73
  price: 9.99,
80
74
  title: 'Introductory Price (PurchasesSample)',
81
75
  identifier: 'introductory_price'
@@ -87,15 +81,17 @@ global.offeringsStub = {
87
81
  twoMonth: {
88
82
  offeringIdentifier: 'default',
89
83
  product: {
90
- intro_price_period_number_of_units: 16,
91
- intro_price_period_unit: 'DAY',
92
- intro_price_cycles: 1,
93
- intro_price_period: 'P2W2D',
94
- intro_price_string: '$0.00',
95
- intro_price: 0,
84
+ introPrice: {
85
+ periodNumberOfUnits: 16,
86
+ periodUnit: 'DAY',
87
+ cycles: 1,
88
+ period: 'P2W2D',
89
+ priceString: '$0.00',
90
+ price: 0
91
+ },
96
92
  description: 'The best service, annually.',
97
- currency_code: 'USD',
98
- price_string: '$19.99',
93
+ currencyCode: 'USD',
94
+ priceString: '$19.99',
99
95
  price: 19.99,
100
96
  title: 'Annual Free Trial (PurchasesSample)',
101
97
  identifier: 'annual_freetrial'
@@ -106,15 +102,17 @@ global.offeringsStub = {
106
102
  threeMonth: {
107
103
  offeringIdentifier: 'default',
108
104
  product: {
109
- intro_price_period_number_of_units: 16,
110
- intro_price_period_unit: 'DAY',
111
- intro_price_cycles: 1,
112
- intro_price_period: 'P2W2D',
113
- intro_price_string: '$0.00',
114
- intro_price: 0,
105
+ introPrice: {
106
+ periodNumberOfUnits: 16,
107
+ periodUnit: 'DAY',
108
+ cycles: 1,
109
+ period: 'P2W2D',
110
+ priceString: '$0.00',
111
+ price: 0
112
+ },
115
113
  description: 'The best service, annually.',
116
- currency_code: 'USD',
117
- price_string: '$19.99',
114
+ currencyCode: 'USD',
115
+ priceString: '$19.99',
118
116
  price: 19.99,
119
117
  title: 'Annual Free Trial (PurchasesSample)',
120
118
  identifier: 'annual_freetrial'
@@ -125,15 +123,17 @@ global.offeringsStub = {
125
123
  sixMonth: {
126
124
  offeringIdentifier: 'default',
127
125
  product: {
128
- intro_price_period_number_of_units: 16,
129
- intro_price_period_unit: 'DAY',
130
- intro_price_cycles: 1,
131
- intro_price_period: 'P2W2D',
132
- intro_price_string: '$0.00',
133
- intro_price: 0,
126
+ introPrice: {
127
+ periodNumberOfUnits: 16,
128
+ periodUnit: 'DAY',
129
+ cycles: 1,
130
+ period: 'P2W2D',
131
+ priceString: '$0.00',
132
+ price: 0
133
+ },
134
134
  description: 'The best service, annually.',
135
- currency_code: 'USD',
136
- price_string: '$19.99',
135
+ currencyCode: 'USD',
136
+ priceString: '$19.99',
137
137
  price: 19.99,
138
138
  title: 'Annual Free Trial (PurchasesSample)',
139
139
  identifier: 'annual_freetrial'
@@ -144,15 +144,17 @@ global.offeringsStub = {
144
144
  annual: {
145
145
  offeringIdentifier: 'default',
146
146
  product: {
147
- intro_price_period_number_of_units: 16,
148
- intro_price_period_unit: 'DAY',
149
- intro_price_cycles: 1,
150
- intro_price_period: 'P2W2D',
151
- intro_price_string: '$0.00',
152
- intro_price: 0,
147
+ introPrice: {
148
+ periodNumberOfUnits: 16,
149
+ periodUnit: 'DAY',
150
+ cycles: 1,
151
+ period: 'P2W2D',
152
+ priceString: '$0.00',
153
+ price: 0
154
+ },
153
155
  description: 'The best service, annually.',
154
- currency_code: 'USD',
155
- price_string: '$19.99',
156
+ currencyCode: 'USD',
157
+ priceString: '$19.99',
156
158
  price: 19.99,
157
159
  title: 'Annual Free Trial (PurchasesSample)',
158
160
  identifier: 'annual_freetrial'
@@ -163,15 +165,10 @@ global.offeringsStub = {
163
165
  lifetime: {
164
166
  offeringIdentifier: 'default',
165
167
  product: {
166
- intro_price_period_number_of_units: null,
167
- intro_price_period_unit: null,
168
- intro_price_cycles: null,
169
- intro_price_period: null,
170
- intro_price_string: null,
171
- intro_price: null,
168
+ introPrice: null,
172
169
  description: 'you can eat it many times',
173
- currency_code: 'USD',
174
- price_string: '$4.99',
170
+ currencyCode: 'USD',
171
+ priceString: '$4.99',
175
172
  price: 4.99,
176
173
  title: 'Consumable (PurchasesSample)',
177
174
  identifier: 'consumable'
@@ -183,15 +180,17 @@ global.offeringsStub = {
183
180
  {
184
181
  offeringIdentifier: 'default',
185
182
  product: {
186
- intro_price_period_number_of_units: 16,
187
- intro_price_period_unit: 'DAY',
188
- intro_price_cycles: 1,
189
- intro_price_period: 'P2W2D',
190
- intro_price_string: '$0.00',
191
- intro_price: 0,
183
+ introPrice: {
184
+ periodNumberOfUnits: 16,
185
+ periodUnit: 'DAY',
186
+ cycles: 1,
187
+ period: 'P2W2D',
188
+ priceString: '$0.00',
189
+ price: 0
190
+ },
192
191
  description: 'The best service, annually.',
193
- currency_code: 'USD',
194
- price_string: '$19.99',
192
+ currencyCode: 'USD',
193
+ priceString: '$19.99',
195
194
  price: 19.99,
196
195
  title: 'Annual Free Trial (PurchasesSample)',
197
196
  identifier: 'annual_freetrial'
@@ -202,15 +201,17 @@ global.offeringsStub = {
202
201
  {
203
202
  offeringIdentifier: 'default',
204
203
  product: {
205
- intro_price_period_number_of_units: 16,
206
- intro_price_period_unit: 'DAY',
207
- intro_price_cycles: 1,
208
- intro_price_period: 'P2W2D',
209
- intro_price_string: '$0.00',
210
- intro_price: 0,
204
+ introPrice: {
205
+ periodNumberOfUnits: 16,
206
+ periodUnit: 'DAY',
207
+ cycles: 1,
208
+ period: 'P2W2D',
209
+ priceString: '$0.00',
210
+ price: 0
211
+ },
211
212
  description: 'The best service, annually.',
212
- currency_code: 'USD',
213
- price_string: '$19.99',
213
+ currencyCode: 'USD',
214
+ priceString: '$19.99',
214
215
  price: 19.99,
215
216
  title: 'Annual Free Trial (PurchasesSample)',
216
217
  identifier: 'annual_freetrial'
@@ -221,15 +222,17 @@ global.offeringsStub = {
221
222
  {
222
223
  offeringIdentifier: 'default',
223
224
  product: {
224
- intro_price_period_number_of_units: 16,
225
- intro_price_period_unit: 'DAY',
226
- intro_price_cycles: 1,
227
- intro_price_period: 'P2W2D',
228
- intro_price_string: '$0.00',
229
- intro_price: 0,
225
+ introPrice: {
226
+ periodNumberOfUnits: 16,
227
+ periodUnit: 'DAY',
228
+ cycles: 1,
229
+ period: 'P2W2D',
230
+ priceString: '$0.00',
231
+ price: 0
232
+ },
230
233
  description: 'The best service, annually.',
231
- currency_code: 'USD',
232
- price_string: '$19.99',
234
+ currencyCode: 'USD',
235
+ priceString: '$19.99',
233
236
  price: 19.99,
234
237
  title: 'Annual Free Trial (PurchasesSample)',
235
238
  identifier: 'annual_freetrial'
@@ -240,15 +243,17 @@ global.offeringsStub = {
240
243
  {
241
244
  offeringIdentifier: 'default',
242
245
  product: {
243
- intro_price_period_number_of_units: 16,
244
- intro_price_period_unit: 'DAY',
245
- intro_price_cycles: 1,
246
- intro_price_period: 'P2W2D',
247
- intro_price_string: '$0.00',
248
- intro_price: 0,
246
+ introPrice: {
247
+ periodNumberOfUnits: 16,
248
+ periodUnit: 'DAY',
249
+ cycles: 1,
250
+ period: 'P2W2D',
251
+ priceString: '$0.00',
252
+ price: 0
253
+ },
249
254
  description: 'The best service, annually.',
250
- currency_code: 'USD',
251
- price_string: '$19.99',
255
+ currencyCode: 'USD',
256
+ priceString: '$19.99',
252
257
  price: 19.99,
253
258
  title: 'Annual Free Trial (PurchasesSample)',
254
259
  identifier: 'annual_freetrial'
@@ -259,15 +264,17 @@ global.offeringsStub = {
259
264
  {
260
265
  offeringIdentifier: 'default',
261
266
  product: {
262
- intro_price_period_number_of_units: 7,
263
- intro_price_period_unit: 'DAY',
264
- intro_price_cycles: 3,
265
- intro_price_period: 'P1W',
266
- intro_price_string: '$4.99',
267
- intro_price: 4.99,
267
+ introPrice: {
268
+ periodNumberOfUnits: 7,
269
+ periodUnit: 'DAY',
270
+ cycles: 3,
271
+ period: 'P1W',
272
+ priceString: '$4.99',
273
+ price: 4.99
274
+ },
268
275
  description: 'Product with intro price',
269
- currency_code: 'USD',
270
- price_string: '$9.99',
276
+ currencyCode: 'USD',
277
+ priceString: '$9.99',
271
278
  price: 9.99,
272
279
  title: 'Introductory Price (PurchasesSample)',
273
280
  identifier: 'introductory_price'
@@ -278,15 +285,10 @@ global.offeringsStub = {
278
285
  {
279
286
  offeringIdentifier: 'default',
280
287
  product: {
281
- intro_price_period_number_of_units: null,
282
- intro_price_period_unit: null,
283
- intro_price_cycles: null,
284
- intro_price_period: null,
285
- intro_price_string: null,
286
- intro_price: null,
288
+ introPrice: null,
287
289
  description: 'you can eat it many times',
288
- currency_code: 'USD',
289
- price_string: '$4.99',
290
+ currencyCode: 'USD',
291
+ priceString: '$4.99',
290
292
  price: 4.99,
291
293
  title: 'Consumable (PurchasesSample)',
292
294
  identifier: 'consumable'
@@ -297,15 +299,17 @@ global.offeringsStub = {
297
299
  {
298
300
  offeringIdentifier: 'default',
299
301
  product: {
300
- intro_price_period_number_of_units: 16,
301
- intro_price_period_unit: 'DAY',
302
- intro_price_cycles: 1,
303
- intro_price_period: 'P2W2D',
304
- intro_price_string: '$0.00',
305
- intro_price: 0,
302
+ introPrice: {
303
+ periodNumberOfUnits: 16,
304
+ periodUnit: 'DAY',
305
+ cycles: 1,
306
+ period: 'P2W2D',
307
+ priceString: '$0.00',
308
+ price: 0
309
+ },
306
310
  description: 'The best service, annually.',
307
- currency_code: 'USD',
308
- price_string: '$19.99',
311
+ currencyCode: 'USD',
312
+ priceString: '$19.99',
309
313
  price: 19.99,
310
314
  title: 'Annual Free Trial (PurchasesSample)',
311
315
  identifier: 'annual_freetrial'
@@ -323,15 +327,17 @@ global.offeringsStub = {
323
327
  monthly: {
324
328
  offeringIdentifier: 'test',
325
329
  product: {
326
- intro_price_period_number_of_units: 7,
327
- intro_price_period_unit: 'DAY',
328
- intro_price_cycles: 3,
329
- intro_price_period: 'P1W',
330
- intro_price_string: '$4.99',
331
- intro_price: 4.99,
330
+ introPrice: {
331
+ periodNumberOfUnits: 7,
332
+ periodUnit: 'DAY',
333
+ cycles: 3,
334
+ period: 'P1W',
335
+ priceString: '$4.99',
336
+ price: 4.99
337
+ },
332
338
  description: 'Product with intro price',
333
- currency_code: 'USD',
334
- price_string: '$9.99',
339
+ currencyCode: 'USD',
340
+ priceString: '$9.99',
335
341
  price: 9.99,
336
342
  title: 'Introductory Price (PurchasesSample)',
337
343
  identifier: 'introductory_price'
@@ -348,15 +354,17 @@ global.offeringsStub = {
348
354
  {
349
355
  offeringIdentifier: 'test',
350
356
  product: {
351
- intro_price_period_number_of_units: 7,
352
- intro_price_period_unit: 'DAY',
353
- intro_price_cycles: 3,
354
- intro_price_period: 'P1W',
355
- intro_price_string: '$4.99',
356
- intro_price: 4.99,
357
+ introPrice: {
358
+ periodNumberOfUnits: 7,
359
+ periodUnit: 'DAY',
360
+ cycles: 3,
361
+ period: 'P1W',
362
+ priceString: '$4.99',
363
+ price: 4.99
364
+ },
357
365
  description: 'Product with intro price',
358
- currency_code: 'USD',
359
- price_string: '$9.99',
366
+ currencyCode: 'USD',
367
+ priceString: '$9.99',
360
368
  price: 9.99,
361
369
  title: 'Introductory Price (PurchasesSample)',
362
370
  identifier: 'introductory_price'
@@ -372,15 +380,17 @@ global.offeringsStub = {
372
380
  weekly: {
373
381
  offeringIdentifier: 'default',
374
382
  product: {
375
- intro_price_period_number_of_units: 7,
376
- intro_price_period_unit: 'DAY',
377
- intro_price_cycles: 3,
378
- intro_price_period: 'P1W',
379
- intro_price_string: '$4.99',
380
- intro_price: 4.99,
383
+ introPrice: {
384
+ periodNumberOfUnits: 7,
385
+ periodUnit: 'DAY',
386
+ cycles: 3,
387
+ period: 'P1W',
388
+ priceString: '$4.99',
389
+ price: 4.99
390
+ },
381
391
  description: 'Product with intro price',
382
- currency_code: 'USD',
383
- price_string: '$9.99',
392
+ currencyCode: 'USD',
393
+ priceString: '$9.99',
384
394
  price: 9.99,
385
395
  title: 'Introductory Price (PurchasesSample)',
386
396
  identifier: 'introductory_price'
@@ -392,15 +402,17 @@ global.offeringsStub = {
392
402
  twoMonth: {
393
403
  offeringIdentifier: 'default',
394
404
  product: {
395
- intro_price_period_number_of_units: 16,
396
- intro_price_period_unit: 'DAY',
397
- intro_price_cycles: 1,
398
- intro_price_period: 'P2W2D',
399
- intro_price_string: '$0.00',
400
- intro_price: 0,
405
+ introPrice: {
406
+ periodNumberOfUnits: 16,
407
+ periodUnit: 'DAY',
408
+ cycles: 1,
409
+ period: 'P2W2D',
410
+ priceString: '$0.00',
411
+ price: 0
412
+ },
401
413
  description: 'The best service, annually.',
402
- currency_code: 'USD',
403
- price_string: '$19.99',
414
+ currencyCode: 'USD',
415
+ priceString: '$19.99',
404
416
  price: 19.99,
405
417
  title: 'Annual Free Trial (PurchasesSample)',
406
418
  identifier: 'annual_freetrial'
@@ -411,15 +423,17 @@ global.offeringsStub = {
411
423
  threeMonth: {
412
424
  offeringIdentifier: 'default',
413
425
  product: {
414
- intro_price_period_number_of_units: 16,
415
- intro_price_period_unit: 'DAY',
416
- intro_price_cycles: 1,
417
- intro_price_period: 'P2W2D',
418
- intro_price_string: '$0.00',
419
- intro_price: 0,
426
+ introPrice: {
427
+ periodNumberOfUnits: 16,
428
+ periodUnit: 'DAY',
429
+ cycles: 1,
430
+ period: 'P2W2D',
431
+ priceString: '$0.00',
432
+ price: 0
433
+ },
420
434
  description: 'The best service, annually.',
421
- currency_code: 'USD',
422
- price_string: '$19.99',
435
+ currencyCode: 'USD',
436
+ priceString: '$19.99',
423
437
  price: 19.99,
424
438
  title: 'Annual Free Trial (PurchasesSample)',
425
439
  identifier: 'annual_freetrial'
@@ -430,15 +444,17 @@ global.offeringsStub = {
430
444
  sixMonth: {
431
445
  offeringIdentifier: 'default',
432
446
  product: {
433
- intro_price_period_number_of_units: 16,
434
- intro_price_period_unit: 'DAY',
435
- intro_price_cycles: 1,
436
- intro_price_period: 'P2W2D',
437
- intro_price_string: '$0.00',
438
- intro_price: 0,
447
+ introPrice: {
448
+ periodNumberOfUnits: 16,
449
+ periodUnit: 'DAY',
450
+ cycles: 1,
451
+ period: 'P2W2D',
452
+ priceString: '$0.00',
453
+ price: 0
454
+ },
439
455
  description: 'The best service, annually.',
440
- currency_code: 'USD',
441
- price_string: '$19.99',
456
+ currencyCode: 'USD',
457
+ priceString: '$19.99',
442
458
  price: 19.99,
443
459
  title: 'Annual Free Trial (PurchasesSample)',
444
460
  identifier: 'annual_freetrial'
@@ -449,15 +465,17 @@ global.offeringsStub = {
449
465
  annual: {
450
466
  offeringIdentifier: 'default',
451
467
  product: {
452
- intro_price_period_number_of_units: 16,
453
- intro_price_period_unit: 'DAY',
454
- intro_price_cycles: 1,
455
- intro_price_period: 'P2W2D',
456
- intro_price_string: '$0.00',
457
- intro_price: 0,
468
+ introPrice: {
469
+ periodNumberOfUnits: 16,
470
+ periodUnit: 'DAY',
471
+ cycles: 1,
472
+ period: 'P2W2D',
473
+ priceString: '$0.00',
474
+ price: 0
475
+ },
458
476
  description: 'The best service, annually.',
459
- currency_code: 'USD',
460
- price_string: '$19.99',
477
+ currencyCode: 'USD',
478
+ priceString: '$19.99',
461
479
  price: 19.99,
462
480
  title: 'Annual Free Trial (PurchasesSample)',
463
481
  identifier: 'annual_freetrial'
@@ -468,15 +486,10 @@ global.offeringsStub = {
468
486
  lifetime: {
469
487
  offeringIdentifier: 'default',
470
488
  product: {
471
- intro_price_period_number_of_units: null,
472
- intro_price_period_unit: null,
473
- intro_price_cycles: null,
474
- intro_price_period: null,
475
- intro_price_string: null,
476
- intro_price: null,
489
+ introPrice: null,
477
490
  description: 'you can eat it many times',
478
- currency_code: 'USD',
479
- price_string: '$4.99',
491
+ currencyCode: 'USD',
492
+ priceString: '$4.99',
480
493
  price: 4.99,
481
494
  title: 'Consumable (PurchasesSample)',
482
495
  identifier: 'consumable'
@@ -488,15 +501,17 @@ global.offeringsStub = {
488
501
  {
489
502
  offeringIdentifier: 'default',
490
503
  product: {
491
- intro_price_period_number_of_units: 16,
492
- intro_price_period_unit: 'DAY',
493
- intro_price_cycles: 1,
494
- intro_price_period: 'P2W2D',
495
- intro_price_string: '$0.00',
496
- intro_price: 0,
504
+ introPrice: {
505
+ periodNumberOfUnits: 16,
506
+ periodUnit: 'DAY',
507
+ cycles: 1,
508
+ period: 'P2W2D',
509
+ priceString: '$0.00',
510
+ price: 0
511
+ },
497
512
  description: 'The best service, annually.',
498
- currency_code: 'USD',
499
- price_string: '$19.99',
513
+ currencyCode: 'USD',
514
+ priceString: '$19.99',
500
515
  price: 19.99,
501
516
  title: 'Annual Free Trial (PurchasesSample)',
502
517
  identifier: 'annual_freetrial'
@@ -507,15 +522,17 @@ global.offeringsStub = {
507
522
  {
508
523
  offeringIdentifier: 'default',
509
524
  product: {
510
- intro_price_period_number_of_units: 16,
511
- intro_price_period_unit: 'DAY',
512
- intro_price_cycles: 1,
513
- intro_price_period: 'P2W2D',
514
- intro_price_string: '$0.00',
515
- intro_price: 0,
525
+ introPrice: {
526
+ periodNumberOfUnits: 16,
527
+ periodUnit: 'DAY',
528
+ cycles: 1,
529
+ period: 'P2W2D',
530
+ priceString: '$0.00',
531
+ price: 0
532
+ },
516
533
  description: 'The best service, annually.',
517
- currency_code: 'USD',
518
- price_string: '$19.99',
534
+ currencyCode: 'USD',
535
+ priceString: '$19.99',
519
536
  price: 19.99,
520
537
  title: 'Annual Free Trial (PurchasesSample)',
521
538
  identifier: 'annual_freetrial'
@@ -526,15 +543,17 @@ global.offeringsStub = {
526
543
  {
527
544
  offeringIdentifier: 'default',
528
545
  product: {
529
- intro_price_period_number_of_units: 16,
530
- intro_price_period_unit: 'DAY',
531
- intro_price_cycles: 1,
532
- intro_price_period: 'P2W2D',
533
- intro_price_string: '$0.00',
534
- intro_price: 0,
546
+ introPrice: {
547
+ periodNumberOfUnits: 16,
548
+ periodUnit: 'DAY',
549
+ cycles: 1,
550
+ period: 'P2W2D',
551
+ priceString: '$0.00',
552
+ price: 0
553
+ },
535
554
  description: 'The best service, annually.',
536
- currency_code: 'USD',
537
- price_string: '$19.99',
555
+ currencyCode: 'USD',
556
+ priceString: '$19.99',
538
557
  price: 19.99,
539
558
  title: 'Annual Free Trial (PurchasesSample)',
540
559
  identifier: 'annual_freetrial'
@@ -545,15 +564,17 @@ global.offeringsStub = {
545
564
  {
546
565
  offeringIdentifier: 'default',
547
566
  product: {
548
- intro_price_period_number_of_units: 16,
549
- intro_price_period_unit: 'DAY',
550
- intro_price_cycles: 1,
551
- intro_price_period: 'P2W2D',
552
- intro_price_string: '$0.00',
553
- intro_price: 0,
567
+ introPrice: {
568
+ periodNumberOfUnits: 16,
569
+ periodUnit: 'DAY',
570
+ cycles: 1,
571
+ period: 'P2W2D',
572
+ priceString: '$0.00',
573
+ price: 0
574
+ },
554
575
  description: 'The best service, annually.',
555
- currency_code: 'USD',
556
- price_string: '$19.99',
576
+ currencyCode: 'USD',
577
+ priceString: '$19.99',
557
578
  price: 19.99,
558
579
  title: 'Annual Free Trial (PurchasesSample)',
559
580
  identifier: 'annual_freetrial'
@@ -564,15 +585,17 @@ global.offeringsStub = {
564
585
  {
565
586
  offeringIdentifier: 'default',
566
587
  product: {
567
- intro_price_period_number_of_units: 7,
568
- intro_price_period_unit: 'DAY',
569
- intro_price_cycles: 3,
570
- intro_price_period: 'P1W',
571
- intro_price_string: '$4.99',
572
- intro_price: 4.99,
588
+ introPrice: {
589
+ periodNumberOfUnits: 7,
590
+ periodUnit: 'DAY',
591
+ cycles: 3,
592
+ period: 'P1W',
593
+ priceString: '$4.99',
594
+ price: 4.99
595
+ },
573
596
  description: 'Product with intro price',
574
- currency_code: 'USD',
575
- price_string: '$9.99',
597
+ currencyCode: 'USD',
598
+ priceString: '$9.99',
576
599
  price: 9.99,
577
600
  title: 'Introductory Price (PurchasesSample)',
578
601
  identifier: 'introductory_price'
@@ -583,15 +606,10 @@ global.offeringsStub = {
583
606
  {
584
607
  offeringIdentifier: 'default',
585
608
  product: {
586
- intro_price_period_number_of_units: null,
587
- intro_price_period_unit: null,
588
- intro_price_cycles: null,
589
- intro_price_period: null,
590
- intro_price_string: null,
591
- intro_price: null,
609
+ introPrice: null,
592
610
  description: 'you can eat it many times',
593
- currency_code: 'USD',
594
- price_string: '$4.99',
611
+ currencyCode: 'USD',
612
+ priceString: '$4.99',
595
613
  price: 4.99,
596
614
  title: 'Consumable (PurchasesSample)',
597
615
  identifier: 'consumable'
@@ -602,15 +620,17 @@ global.offeringsStub = {
602
620
  {
603
621
  offeringIdentifier: 'default',
604
622
  product: {
605
- intro_price_period_number_of_units: 16,
606
- intro_price_period_unit: 'DAY',
607
- intro_price_cycles: 1,
608
- intro_price_period: 'P2W2D',
609
- intro_price_string: '$0.00',
610
- intro_price: 0,
623
+ introPrice: {
624
+ periodNumberOfUnits: 16,
625
+ periodUnit: 'DAY',
626
+ cycles: 1,
627
+ period: 'P2W2D',
628
+ priceString: '$0.00',
629
+ price: 0
630
+ },
611
631
  description: 'The best service, annually.',
612
- currency_code: 'USD',
613
- price_string: '$19.99',
632
+ currencyCode: 'USD',
633
+ priceString: '$19.99',
614
634
  price: 19.99,
615
635
  title: 'Annual Free Trial (PurchasesSample)',
616
636
  identifier: 'annual_freetrial'
@@ -626,16 +646,10 @@ global.offeringsStub = {
626
646
  };
627
647
 
628
648
  global.productStub = {
629
- currency_code: "USD",
630
- intro_price: null,
631
- intro_price_string: null,
632
- intro_price_period: null,
633
- intro_price_cycles: null,
634
- intro_price_period_unit: null,
635
- intro_price_period_number_of_units: null,
636
- discounts: null,
649
+ currencyCode: "USD",
637
650
  introPrice: null,
638
- price_string: "$0.99",
651
+ discounts: null,
652
+ priceString: "$0.99",
639
653
  price: 0.99,
640
654
  description: "The best service.",
641
655
  title: "One Month Free Trial",
@@ -678,7 +692,7 @@ NativeModules.RNPurchases = {
678
692
  getOfferings: jest.fn(),
679
693
  getProductInfo: jest.fn(),
680
694
  makePurchase: jest.fn(),
681
- restoreTransactions: jest.fn(),
695
+ restorePurchases: jest.fn(),
682
696
  getAppUserID: jest.fn(),
683
697
  setDebugLogsEnabled: jest.fn(),
684
698
  getCustomerInfo: jest.fn(),
@@ -1,19 +0,0 @@
1
- const {exec} = require("child_process");
2
- const os = require("os");
3
-
4
- if (os.type() === "Linux") {
5
- console.log("Skipping iOS Dependencies");
6
- } else if (os.type() === "Darwin") {
7
- const downloadProcess = exec(
8
- "./scripts/download-purchases-framework.sh 3.14.1"
9
- );
10
- downloadProcess.stdout.pipe(process.stdout);
11
- const downloadProcessCommon = exec(
12
- "./scripts/download-purchases-common.sh 1.11.1"
13
- );
14
- downloadProcessCommon.stdout.pipe(process.stdout);
15
- } else if (os.type() === "Windows_NT") {
16
- console.log("Skipping iOS Dependencies");
17
- } else {
18
- throw new Error(`Unsupported OS found: ${os.type()}`);
19
- }