react-native-purchases 6.0.0-rc.1 → 6.0.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.
@@ -24,6 +24,6 @@ Pod::Spec.new do |spec|
24
24
  ]
25
25
 
26
26
  spec.dependency "React-Core"
27
- spec.dependency "PurchasesHybridCommon", '5.0.0-rc.1'
27
+ spec.dependency "PurchasesHybridCommon", '5.0.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 '6.0.0-rc.1'
32
+ versionName '6.0.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:5.0.0-rc.1'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:5.0.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -45,7 +45,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
45
45
  private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
46
46
  private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
47
47
  public static final String PLATFORM_NAME = "react-native";
48
- public static final String PLUGIN_VERSION = "5.17.0-SNAPSHOT";
48
+ public static final String PLUGIN_VERSION = "6.0.1";
49
49
 
50
50
  private final ReactApplicationContext reactContext;
51
51
 
@@ -146,9 +146,6 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
146
146
  if (googleOldProductId == null) {
147
147
  googleOldProductId = googleProductChangeInfo.hasKey("oldSKU") ? googleProductChangeInfo.getString("oldSKU") : null;
148
148
  }
149
- if (googleProrationMode == null) {
150
- googleProrationMode = googleProductChangeInfo.hasKey("prorationMode") ? googleProductChangeInfo.getInt("prorationMode") : null;
151
- }
152
149
  }
153
150
 
154
151
  Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
@@ -168,13 +165,23 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
168
165
  @ReactMethod
169
166
  public void purchasePackage(final String packageIdentifier,
170
167
  final String offeringIdentifier,
171
- @Nullable final ReadableMap upgradeInfo,
168
+ @Nullable final ReadableMap googleProductChangeInfo,
172
169
  @Nullable final String discountTimestamp,
173
170
  @Nullable final ReadableMap googleInfo,
174
171
  final Promise promise) {
175
- String googleOldProductId = upgradeInfo != null && upgradeInfo.hasKey("oldSKU") ? upgradeInfo.getString("oldSKU") : null;
176
- Integer googleProrationMode = upgradeInfo != null && upgradeInfo.hasKey("prorationMode") ? upgradeInfo.getInt("prorationMode") : null;
172
+ String googleOldProductId = null;
173
+ Integer googleProrationMode = null;
174
+
175
+ if (googleProductChangeInfo != null) {
176
+ // GoogleProductChangeInfo in V6 and later
177
+ googleOldProductId = googleProductChangeInfo.hasKey("oldProductIdentifier") ? googleProductChangeInfo.getString("oldProductIdentifier") : null;
178
+ googleProrationMode = googleProductChangeInfo.hasKey("prorationMode") ? googleProductChangeInfo.getInt("prorationMode") : null;
177
179
 
180
+ // Legacy UpgradeInfo in V5 and earlier
181
+ if (googleOldProductId == null) {
182
+ googleOldProductId = googleProductChangeInfo.hasKey("oldSKU") ? googleProductChangeInfo.getString("oldSKU") : null;
183
+ }
184
+ }
178
185
  Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
179
186
 
180
187
  CommonKt.purchasePackage(
@@ -388,6 +388,10 @@ export interface SubscriptionOption {
388
388
  * The subscription period of fullPricePhase (after free and intro trials).
389
389
  */
390
390
  readonly billingPeriod: Period | null;
391
+ /**
392
+ * True if the subscription is pre-paid.
393
+ */
394
+ readonly isPrepaid: boolean;
391
395
  /**
392
396
  * The full price PricingPhase of the subscription.
393
397
  * Looks for the last price phase of the SubscriptionOption.
@@ -440,16 +444,34 @@ export interface PricingPhase {
440
444
  * Recurrence mode for a pricing phase
441
445
  */
442
446
  export declare enum RECURRENCE_MODE {
447
+ /**
448
+ * Pricing phase repeats infinitely until cancellation
449
+ */
443
450
  INFINITE_RECURRING = 1,
451
+ /**
452
+ * Pricing phase repeats for a fixed number of billing periods
453
+ */
444
454
  FINITE_RECURRING = 2,
455
+ /**
456
+ * Pricing phase does not repeat
457
+ */
445
458
  NON_RECURRING = 3
446
459
  }
447
460
  /**
448
461
  * Payment mode for offer pricing phases. Google Play only.
449
462
  */
450
463
  export declare enum OFFER_PAYMENT_MODE {
464
+ /**
465
+ * Subscribers don't pay until the specified period ends
466
+ */
451
467
  FREE_TRIAL = "FREE_TRIAL",
468
+ /**
469
+ * Subscribers pay up front for a specified period
470
+ */
452
471
  SINGLE_PAYMENT = "SINGLE_PAYMENT",
472
+ /**
473
+ * Subscribers pay a discounted amount for a specified number of periods
474
+ */
453
475
  DISCOUNTED_RECURRING_PAYMENT = "DISCOUNTED_RECURRING_PAYMENT"
454
476
  }
455
477
  /**
package/dist/offerings.js CHANGED
@@ -110,8 +110,17 @@ var PRORATION_MODE;
110
110
  */
111
111
  var RECURRENCE_MODE;
112
112
  (function (RECURRENCE_MODE) {
113
+ /**
114
+ * Pricing phase repeats infinitely until cancellation
115
+ */
113
116
  RECURRENCE_MODE[RECURRENCE_MODE["INFINITE_RECURRING"] = 1] = "INFINITE_RECURRING";
117
+ /**
118
+ * Pricing phase repeats for a fixed number of billing periods
119
+ */
114
120
  RECURRENCE_MODE[RECURRENCE_MODE["FINITE_RECURRING"] = 2] = "FINITE_RECURRING";
121
+ /**
122
+ * Pricing phase does not repeat
123
+ */
115
124
  RECURRENCE_MODE[RECURRENCE_MODE["NON_RECURRING"] = 3] = "NON_RECURRING";
116
125
  })(RECURRENCE_MODE = exports.RECURRENCE_MODE || (exports.RECURRENCE_MODE = {}));
117
126
  /**
@@ -119,8 +128,17 @@ var RECURRENCE_MODE;
119
128
  */
120
129
  var OFFER_PAYMENT_MODE;
121
130
  (function (OFFER_PAYMENT_MODE) {
131
+ /**
132
+ * Subscribers don't pay until the specified period ends
133
+ */
122
134
  OFFER_PAYMENT_MODE["FREE_TRIAL"] = "FREE_TRIAL";
135
+ /**
136
+ * Subscribers pay up front for a specified period
137
+ */
123
138
  OFFER_PAYMENT_MODE["SINGLE_PAYMENT"] = "SINGLE_PAYMENT";
139
+ /**
140
+ * Subscribers pay a discounted amount for a specified number of periods
141
+ */
124
142
  OFFER_PAYMENT_MODE["DISCOUNTED_RECURRING_PAYMENT"] = "DISCOUNTED_RECURRING_PAYMENT";
125
143
  })(OFFER_PAYMENT_MODE = exports.OFFER_PAYMENT_MODE || (exports.OFFER_PAYMENT_MODE = {}));
126
144
  /**
@@ -280,9 +280,6 @@ export default class Purchases {
280
280
  * @param {UpgradeInfo} upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU
281
281
  * and the optional prorationMode.
282
282
  * @param {String} type Optional type of product, can be inapp or subs. Subs by default
283
- * @param {boolean} googleIsPersonalizedPrice Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.
284
- * For compliance with EU regulations. User will see "This price has been customize for you" in the purchase dialog when true.
285
- * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.
286
283
  * @deprecated, use purchaseStoreProduct instead
287
284
  */
288
285
  static purchaseProduct(productIdentifier: string, upgradeInfo?: UpgradeInfo | null, type?: PURCHASE_TYPE): Promise<MakePurchaseResult>;
@@ -345,7 +342,7 @@ export default class Purchases {
345
342
  * user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure
346
343
  * has not been called yet.
347
344
  */
348
- static purchaseSubscriptionOption(subscriptionOption: SubscriptionOption, googleProductChangeInfo?: GoogleProductChangeInfo | null, googleIsPersonalizedPrice?: boolean | null): Promise<MakePurchaseResult>;
345
+ static purchaseSubscriptionOption(subscriptionOption: SubscriptionOption, googleProductChangeInfo?: GoogleProductChangeInfo, googleIsPersonalizedPrice?: boolean): Promise<MakePurchaseResult>;
349
346
  /**
350
347
  * iOS only. Purchase a package applying a given discount.
351
348
  *
package/dist/purchases.js CHANGED
@@ -301,9 +301,6 @@ var Purchases = /** @class */ (function () {
301
301
  * @param {UpgradeInfo} upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU
302
302
  * and the optional prorationMode.
303
303
  * @param {String} type Optional type of product, can be inapp or subs. Subs by default
304
- * @param {boolean} googleIsPersonalizedPrice Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.
305
- * For compliance with EU regulations. User will see "This price has been customize for you" in the purchase dialog when true.
306
- * See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.
307
304
  * @deprecated, use purchaseStoreProduct instead
308
305
  */
309
306
  Purchases.purchaseProduct = function (productIdentifier, upgradeInfo, type) {
package/ios/RNPurchases.m CHANGED
@@ -442,7 +442,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
442
442
  }
443
443
 
444
444
  - (NSString *)platformFlavorVersion {
445
- return @"6.0.0-rc.1";
445
+ return @"6.0.1";
446
446
  }
447
447
 
448
448
  @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": "6.0.0-rc.1",
4
+ "version": "6.0.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
  "types": "dist/index.d.ts",
@@ -2,7 +2,7 @@
2
2
  <!DOCTYPE html>
3
3
  <html>
4
4
  <head>
5
- <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/6.0.0-rc.1/" />
5
+ <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/6.0.1/" />
6
6
  </head>
7
7
  <body>
8
8
  </body>
@@ -758,6 +758,7 @@ NativeModules.RNPurchases = {
758
758
  setFinishTransactions: jest.fn(),
759
759
  purchaseProduct: jest.fn(),
760
760
  purchasePackage: jest.fn(),
761
+ purchaseSubscriptionOption: jest.fn(),
761
762
  isAnonymous: jest.fn(),
762
763
  makeDeferredPurchase: jest.fn(),
763
764
  checkTrialOrIntroductoryPriceEligibility: jest.fn(),