react-native-purchases 10.0.1 → 10.1.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.
- package/RNPurchases.podspec +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +69 -36
- package/android/src/main/java/com/revenuecat/purchases/react/UpgradeInfo.java +19 -0
- package/dist/purchases.d.ts +21 -14
- package/dist/purchases.js +23 -16
- package/ios/RNPurchases.m +1 -1
- package/package.json +3 -3
- package/android/src/main/java/com/revenuecat/purchases/react/GoogleUpgradeInfo.java +0 -19
package/RNPurchases.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -29,7 +29,7 @@ android {
|
|
|
29
29
|
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
30
30
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
31
31
|
versionCode 1
|
|
32
|
-
versionName '10.0
|
|
32
|
+
versionName '10.1.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.
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.4.0'
|
|
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.0
|
|
54
|
+
public static final String PLUGIN_VERSION = "10.1.0";
|
|
55
55
|
|
|
56
56
|
private final ReactApplicationContext reactContext;
|
|
57
57
|
|
|
@@ -181,7 +181,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
181
181
|
@Nullable final ReadableMap googleInfo,
|
|
182
182
|
@Nullable final ReadableMap presentedOfferingContext,
|
|
183
183
|
final Promise promise) {
|
|
184
|
-
|
|
184
|
+
UpgradeInfo upgradeInfo = getUpgradeInfo(googleProductChangeInfo);
|
|
185
185
|
|
|
186
186
|
Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
|
|
187
187
|
|
|
@@ -191,15 +191,19 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
CommonKt.purchaseProduct(
|
|
194
|
-
getReactApplicationContext().getCurrentActivity(),
|
|
195
|
-
productIdentifier,
|
|
196
|
-
type,
|
|
197
|
-
null,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
googleIsPersonalized,
|
|
201
|
-
mapPresentedOfferingContext,
|
|
202
|
-
getOnResult(promise)
|
|
194
|
+
getReactApplicationContext().getCurrentActivity(), // activity
|
|
195
|
+
productIdentifier, // productIdentifier
|
|
196
|
+
type, // type
|
|
197
|
+
null, // googleBasePlanId
|
|
198
|
+
upgradeInfo.getOldProductIdentifier(), // googleOldProductId
|
|
199
|
+
null, // googleReplacementModeInt
|
|
200
|
+
googleIsPersonalized, // googleIsPersonalizedPrice
|
|
201
|
+
mapPresentedOfferingContext, // presentedOfferingContext
|
|
202
|
+
getOnResult(promise), // onResult
|
|
203
|
+
null, // addOnStoreProducts
|
|
204
|
+
null, // addOnSubscriptionOptions
|
|
205
|
+
null, // addOnPackages
|
|
206
|
+
upgradeInfo.getReplacementMode());
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
@ReactMethod
|
|
@@ -209,20 +213,24 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
209
213
|
@Nullable final String discountTimestamp,
|
|
210
214
|
@Nullable final ReadableMap googleInfo,
|
|
211
215
|
final Promise promise) {
|
|
212
|
-
|
|
216
|
+
UpgradeInfo upgradeInfo = getUpgradeInfo(googleProductChangeInfo);
|
|
213
217
|
|
|
214
218
|
Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
|
|
215
219
|
|
|
216
220
|
Map<String, Object> mapPresentedOfferingContext = presentedOfferingContext.toHashMap();
|
|
217
221
|
|
|
218
222
|
CommonKt.purchasePackage(
|
|
219
|
-
getReactApplicationContext().getCurrentActivity(),
|
|
220
|
-
packageIdentifier,
|
|
221
|
-
mapPresentedOfferingContext,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
googleIsPersonalized,
|
|
225
|
-
getOnResult(promise)
|
|
223
|
+
getReactApplicationContext().getCurrentActivity(), // activity
|
|
224
|
+
packageIdentifier, // packageIdentifier
|
|
225
|
+
mapPresentedOfferingContext, // presentedOfferingContext
|
|
226
|
+
upgradeInfo.getOldProductIdentifier(), // googleOldProductId
|
|
227
|
+
null, // googleReplacementModeInt
|
|
228
|
+
googleIsPersonalized, // googleIsPersonalizedPrice
|
|
229
|
+
getOnResult(promise), // onResult
|
|
230
|
+
null, // addOnStoreProducts
|
|
231
|
+
null, // addOnSubscriptionOptions
|
|
232
|
+
null, // addOnPackages
|
|
233
|
+
upgradeInfo.getReplacementMode()); // storeReplacementModeString
|
|
226
234
|
}
|
|
227
235
|
|
|
228
236
|
@ReactMethod
|
|
@@ -233,7 +241,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
233
241
|
@Nullable final ReadableMap googleInfo,
|
|
234
242
|
@Nullable final ReadableMap presentedOfferingContext,
|
|
235
243
|
final Promise promise) {
|
|
236
|
-
|
|
244
|
+
UpgradeInfo parsedUpgradeInfo = getUpgradeInfo(upgradeInfo);
|
|
237
245
|
|
|
238
246
|
Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
|
|
239
247
|
|
|
@@ -243,14 +251,18 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
243
251
|
}
|
|
244
252
|
|
|
245
253
|
CommonKt.purchaseSubscriptionOption(
|
|
246
|
-
getReactApplicationContext().getCurrentActivity(),
|
|
247
|
-
productIdentifer,
|
|
248
|
-
optionIdentifier,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
googleIsPersonalized,
|
|
252
|
-
mapPresentedOfferingContext,
|
|
253
|
-
getOnResult(promise)
|
|
254
|
+
getReactApplicationContext().getCurrentActivity(), // activity
|
|
255
|
+
productIdentifer, // productIdentifier
|
|
256
|
+
optionIdentifier, // optionIdentifier
|
|
257
|
+
parsedUpgradeInfo.getOldProductIdentifier(), // googleOldProductId
|
|
258
|
+
null, // googleReplacementModeInt
|
|
259
|
+
googleIsPersonalized, // googleIsPersonalizedPrice
|
|
260
|
+
mapPresentedOfferingContext, // presentedOfferingContext
|
|
261
|
+
getOnResult(promise), // onResult
|
|
262
|
+
null, // addOnStoreProducts
|
|
263
|
+
null, // addOnSubscriptionOptions
|
|
264
|
+
null, // addOnPackages
|
|
265
|
+
parsedUpgradeInfo.getReplacementMode()); // storeReplacementModeString
|
|
254
266
|
}
|
|
255
267
|
|
|
256
268
|
@ReactMethod
|
|
@@ -656,21 +668,42 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
656
668
|
};
|
|
657
669
|
}
|
|
658
670
|
|
|
659
|
-
private static
|
|
660
|
-
String
|
|
661
|
-
|
|
671
|
+
private static UpgradeInfo getUpgradeInfo(ReadableMap upgradeInfo) {
|
|
672
|
+
String oldProductId = null;
|
|
673
|
+
String storeReplacementMode = null;
|
|
662
674
|
|
|
663
675
|
if (upgradeInfo != null) {
|
|
664
676
|
// GoogleProductChangeInfo in V6 and later
|
|
665
|
-
|
|
666
|
-
|
|
677
|
+
oldProductId = upgradeInfo.hasKey("oldProductIdentifier") ? upgradeInfo.getString("oldProductIdentifier") : null;
|
|
678
|
+
storeReplacementMode = upgradeInfo.hasKey("replacementMode") ? upgradeInfo.getString("replacementMode") : null;
|
|
679
|
+
|
|
680
|
+
if (storeReplacementMode == null) {
|
|
681
|
+
storeReplacementMode = upgradeInfo.hasKey("prorationMode") ? replacementModeFromProrationMode(upgradeInfo.getInt("prorationMode")) : null;
|
|
682
|
+
}
|
|
667
683
|
|
|
668
684
|
// Legacy UpgradeInfo in V5 and earlier
|
|
669
|
-
if (
|
|
670
|
-
|
|
685
|
+
if (oldProductId == null) {
|
|
686
|
+
oldProductId = upgradeInfo.hasKey("oldSKU") ? upgradeInfo.getString("oldSKU") : null;
|
|
671
687
|
}
|
|
672
688
|
}
|
|
673
689
|
|
|
674
|
-
return new
|
|
690
|
+
return new UpgradeInfo(oldProductId, storeReplacementMode);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
private static String replacementModeFromProrationMode(int prorationMode) {
|
|
694
|
+
switch (prorationMode) {
|
|
695
|
+
case 1:
|
|
696
|
+
return "WITH_TIME_PRORATION";
|
|
697
|
+
case 2:
|
|
698
|
+
return "CHARGE_PRORATED_PRICE";
|
|
699
|
+
case 3:
|
|
700
|
+
return "WITHOUT_PRORATION";
|
|
701
|
+
case 5:
|
|
702
|
+
return "CHARGE_FULL_PRICE";
|
|
703
|
+
case 6:
|
|
704
|
+
return "DEFERRED";
|
|
705
|
+
default:
|
|
706
|
+
return null;
|
|
707
|
+
}
|
|
675
708
|
}
|
|
676
709
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.revenuecat.purchases.react;
|
|
2
|
+
|
|
3
|
+
class UpgradeInfo {
|
|
4
|
+
private final String oldProductIdentifier;
|
|
5
|
+
private final String replacementMode;
|
|
6
|
+
|
|
7
|
+
public UpgradeInfo(String oldProductIdentifier, String replacementMode) {
|
|
8
|
+
this.oldProductIdentifier = oldProductIdentifier;
|
|
9
|
+
this.replacementMode = replacementMode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public String getOldProductIdentifier() {
|
|
13
|
+
return oldProductIdentifier;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public String getReplacementMode() {
|
|
17
|
+
return replacementMode;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/purchases.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PURCHASES_ERROR_CODE, UninitializedPurchasesError, UnsupportedPlatformError, CustomerInfo, PurchasesEntitlementInfo, PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferings, PurchasesStoreProduct, UpgradeInfo, PurchasesPromotionalOffer, PurchasesPackage, IntroEligibility, PurchasesStoreProductDiscount, SubscriptionOption, PRODUCT_CATEGORY, GoogleProductChangeInfo, PURCHASE_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, PurchasesConfiguration, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult, IN_APP_MESSAGE_TYPE, ENTITLEMENT_VERIFICATION_MODE, VERIFICATION_RESULT, STOREKIT_VERSION, PurchasesStoreTransaction, PurchasesOffering, PURCHASES_ARE_COMPLETED_BY_TYPE, PurchasesVirtualCurrencies, PurchasesWinBackOffer, WebPurchaseRedemption, WebPurchaseRedemptionResult, Storefront } from "@revenuecat/purchases-typescript-internal";
|
|
1
|
+
import { PURCHASES_ERROR_CODE, UninitializedPurchasesError, UnsupportedPlatformError, CustomerInfo, PurchasesEntitlementInfo, PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferings, PurchasesStoreProduct, UpgradeInfo, PurchasesPromotionalOffer, PurchasesPackage, IntroEligibility, PurchasesStoreProductDiscount, SubscriptionOption, PRODUCT_CATEGORY, GoogleProductChangeInfo, PURCHASE_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, PurchasesConfiguration, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult, IN_APP_MESSAGE_TYPE, ENTITLEMENT_VERIFICATION_MODE, VERIFICATION_RESULT, STOREKIT_VERSION, PurchasesStoreTransaction, PurchasesOffering, PURCHASES_ARE_COMPLETED_BY_TYPE, PurchasesVirtualCurrencies, PurchasesWinBackOffer, WebPurchaseRedemption, WebPurchaseRedemptionResult, Storefront, STORE_REPLACEMENT_MODE, StoreProductChangeInfo } from "@revenuecat/purchases-typescript-internal";
|
|
2
2
|
/**
|
|
3
3
|
* Result of a syncPurchases operation.
|
|
4
4
|
*/
|
|
@@ -52,8 +52,15 @@ export default class Purchases {
|
|
|
52
52
|
* Replace SKU's ProrationMode.
|
|
53
53
|
* @readonly
|
|
54
54
|
* @enum {number}
|
|
55
|
+
* @deprecated, use STORE_REPLACEMENT_MODE
|
|
55
56
|
*/
|
|
56
57
|
static PRORATION_MODE: typeof PRORATION_MODE;
|
|
58
|
+
/**
|
|
59
|
+
* Replacement modes for use when changing products.
|
|
60
|
+
* @readonly
|
|
61
|
+
* @enum {string}
|
|
62
|
+
*/
|
|
63
|
+
static STORE_REPLACEMENT_MODE: typeof STORE_REPLACEMENT_MODE;
|
|
57
64
|
/**
|
|
58
65
|
* Enumeration of all possible Package types.
|
|
59
66
|
* @readonly
|
|
@@ -232,17 +239,17 @@ export default class Purchases {
|
|
|
232
239
|
* Make a purchase
|
|
233
240
|
*
|
|
234
241
|
* @param {PurchasesStoreProduct} product The product you want to purchase
|
|
235
|
-
* @param {GoogleProductChangeInfo}
|
|
236
|
-
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.
|
|
242
|
+
* @param {GoogleProductChangeInfo | StoreProductChangeInfo} productChangeInfo Android only. Optional product change info you
|
|
243
|
+
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode or replacementMode.
|
|
237
244
|
* @param {boolean} googleIsPersonalizedPrice Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.
|
|
238
|
-
* For compliance with EU regulations. User will see "This price has been
|
|
245
|
+
* For compliance with EU regulations. User will see "This price has been customized for you" in the purchase dialog when true.
|
|
239
246
|
* See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.
|
|
240
247
|
* @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing
|
|
241
248
|
* a customer info object and a product identifier. Rejections return an error code,
|
|
242
249
|
* a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will
|
|
243
250
|
* also be rejected if configure has not been called yet.
|
|
244
251
|
*/
|
|
245
|
-
static purchaseStoreProduct(product: PurchasesStoreProduct,
|
|
252
|
+
static purchaseStoreProduct(product: PurchasesStoreProduct, productChangeInfo?: GoogleProductChangeInfo | StoreProductChangeInfo | null, googleIsPersonalizedPrice?: boolean | null): Promise<MakePurchaseResult>;
|
|
246
253
|
/**
|
|
247
254
|
* iOS only. Purchase a product applying a given discount.
|
|
248
255
|
*
|
|
@@ -261,33 +268,33 @@ export default class Purchases {
|
|
|
261
268
|
* Make a purchase
|
|
262
269
|
*
|
|
263
270
|
* @param {PurchasesPackage} aPackage The Package you wish to purchase. You can get the Packages by calling getOfferings
|
|
264
|
-
* @param {UpgradeInfo} upgradeInfo DEPRECATED. Use
|
|
265
|
-
* @param {GoogleProductChangeInfo}
|
|
266
|
-
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.
|
|
271
|
+
* @param {UpgradeInfo} upgradeInfo DEPRECATED. Use productChangeInfo.
|
|
272
|
+
* @param {GoogleProductChangeInfo | StoreProductChangeInfo} productChangeInfo Android only. Optional product change info you
|
|
273
|
+
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode or replacementMode.
|
|
267
274
|
* @param {boolean} googleIsPersonalizedPrice Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.
|
|
268
|
-
* For compliance with EU regulations. User will see "This price has been
|
|
275
|
+
* For compliance with EU regulations. User will see "This price has been customized for you" in the purchase dialog when true.
|
|
269
276
|
* See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.
|
|
270
277
|
* @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing
|
|
271
278
|
* a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the
|
|
272
279
|
* user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure
|
|
273
280
|
* has not been called yet.
|
|
274
281
|
*/
|
|
275
|
-
static purchasePackage(aPackage: PurchasesPackage, upgradeInfo?: UpgradeInfo | null,
|
|
282
|
+
static purchasePackage(aPackage: PurchasesPackage, upgradeInfo?: UpgradeInfo | null, productChangeInfo?: GoogleProductChangeInfo | StoreProductChangeInfo | null, googleIsPersonalizedPrice?: boolean | null): Promise<MakePurchaseResult>;
|
|
276
283
|
/**
|
|
277
284
|
* Google only. Make a purchase of a subscriptionOption
|
|
278
285
|
*
|
|
279
286
|
* @param {SubscriptionOption} subscriptionOption The SubscriptionOption you wish to purchase. You can get the SubscriptionOption from StoreProducts by calling getOfferings
|
|
280
|
-
* @param {GoogleProductChangeInfo}
|
|
281
|
-
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.
|
|
287
|
+
* @param {GoogleProductChangeInfo | StoreProductChangeInfo} productChangeInfo Android only. Optional product change info you
|
|
288
|
+
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode or replacementMode.
|
|
282
289
|
* @param {boolean} googleIsPersonalizedPrice Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.
|
|
283
|
-
* For compliance with EU regulations. User will see "This price has been
|
|
290
|
+
* For compliance with EU regulations. User will see "This price has been customized for you" in the purchase dialog when true.
|
|
284
291
|
* See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.
|
|
285
292
|
* @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing
|
|
286
293
|
* a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the
|
|
287
294
|
* user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure
|
|
288
295
|
* has not been called yet.
|
|
289
296
|
*/
|
|
290
|
-
static purchaseSubscriptionOption(subscriptionOption: SubscriptionOption,
|
|
297
|
+
static purchaseSubscriptionOption(subscriptionOption: SubscriptionOption, productChangeInfo?: GoogleProductChangeInfo | StoreProductChangeInfo | null, googleIsPersonalizedPrice?: boolean): Promise<MakePurchaseResult>;
|
|
291
298
|
/**
|
|
292
299
|
* iOS only. Purchase a package applying a given discount.
|
|
293
300
|
*
|
package/dist/purchases.js
CHANGED
|
@@ -394,24 +394,24 @@ var Purchases = /** @class */ (function () {
|
|
|
394
394
|
* Make a purchase
|
|
395
395
|
*
|
|
396
396
|
* @param {PurchasesStoreProduct} product The product you want to purchase
|
|
397
|
-
* @param {GoogleProductChangeInfo}
|
|
398
|
-
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.
|
|
397
|
+
* @param {GoogleProductChangeInfo | StoreProductChangeInfo} productChangeInfo Android only. Optional product change info you
|
|
398
|
+
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode or replacementMode.
|
|
399
399
|
* @param {boolean} googleIsPersonalizedPrice Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.
|
|
400
|
-
* For compliance with EU regulations. User will see "This price has been
|
|
400
|
+
* For compliance with EU regulations. User will see "This price has been customized for you" in the purchase dialog when true.
|
|
401
401
|
* See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.
|
|
402
402
|
* @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing
|
|
403
403
|
* a customer info object and a product identifier. Rejections return an error code,
|
|
404
404
|
* a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will
|
|
405
405
|
* also be rejected if configure has not been called yet.
|
|
406
406
|
*/
|
|
407
|
-
Purchases.purchaseStoreProduct = function (product,
|
|
407
|
+
Purchases.purchaseStoreProduct = function (product, productChangeInfo, googleIsPersonalizedPrice) {
|
|
408
408
|
return __awaiter(this, void 0, void 0, function () {
|
|
409
409
|
return __generator(this, function (_a) {
|
|
410
410
|
switch (_a.label) {
|
|
411
411
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
412
412
|
case 1:
|
|
413
413
|
_a.sent();
|
|
414
|
-
return [2 /*return*/, RNPurchases.purchaseProduct(product.identifier,
|
|
414
|
+
return [2 /*return*/, RNPurchases.purchaseProduct(product.identifier, productChangeInfo, product.productCategory, null, googleIsPersonalizedPrice == null
|
|
415
415
|
? null
|
|
416
416
|
: { isPersonalizedPrice: googleIsPersonalizedPrice }, product.presentedOfferingContext).catch(function (error) {
|
|
417
417
|
error.userCancelled =
|
|
@@ -458,25 +458,25 @@ var Purchases = /** @class */ (function () {
|
|
|
458
458
|
* Make a purchase
|
|
459
459
|
*
|
|
460
460
|
* @param {PurchasesPackage} aPackage The Package you wish to purchase. You can get the Packages by calling getOfferings
|
|
461
|
-
* @param {UpgradeInfo} upgradeInfo DEPRECATED. Use
|
|
462
|
-
* @param {GoogleProductChangeInfo}
|
|
463
|
-
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.
|
|
461
|
+
* @param {UpgradeInfo} upgradeInfo DEPRECATED. Use productChangeInfo.
|
|
462
|
+
* @param {GoogleProductChangeInfo | StoreProductChangeInfo} productChangeInfo Android only. Optional product change info you
|
|
463
|
+
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode or replacementMode.
|
|
464
464
|
* @param {boolean} googleIsPersonalizedPrice Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.
|
|
465
|
-
* For compliance with EU regulations. User will see "This price has been
|
|
465
|
+
* For compliance with EU regulations. User will see "This price has been customized for you" in the purchase dialog when true.
|
|
466
466
|
* See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.
|
|
467
467
|
* @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing
|
|
468
468
|
* a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the
|
|
469
469
|
* user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure
|
|
470
470
|
* has not been called yet.
|
|
471
471
|
*/
|
|
472
|
-
Purchases.purchasePackage = function (aPackage, upgradeInfo,
|
|
472
|
+
Purchases.purchasePackage = function (aPackage, upgradeInfo, productChangeInfo, googleIsPersonalizedPrice) {
|
|
473
473
|
return __awaiter(this, void 0, void 0, function () {
|
|
474
474
|
return __generator(this, function (_a) {
|
|
475
475
|
switch (_a.label) {
|
|
476
476
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
477
477
|
case 1:
|
|
478
478
|
_a.sent();
|
|
479
|
-
return [2 /*return*/, RNPurchases.purchasePackage(aPackage.identifier, aPackage.presentedOfferingContext,
|
|
479
|
+
return [2 /*return*/, RNPurchases.purchasePackage(aPackage.identifier, aPackage.presentedOfferingContext, productChangeInfo || upgradeInfo, null, googleIsPersonalizedPrice == null
|
|
480
480
|
? null
|
|
481
481
|
: { isPersonalizedPrice: googleIsPersonalizedPrice }).catch(function (error) {
|
|
482
482
|
error.userCancelled =
|
|
@@ -491,17 +491,17 @@ var Purchases = /** @class */ (function () {
|
|
|
491
491
|
* Google only. Make a purchase of a subscriptionOption
|
|
492
492
|
*
|
|
493
493
|
* @param {SubscriptionOption} subscriptionOption The SubscriptionOption you wish to purchase. You can get the SubscriptionOption from StoreProducts by calling getOfferings
|
|
494
|
-
* @param {GoogleProductChangeInfo}
|
|
495
|
-
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.
|
|
494
|
+
* @param {GoogleProductChangeInfo | StoreProductChangeInfo} productChangeInfo Android only. Optional product change info you
|
|
495
|
+
* wish to upgrade from containing the oldProductIdentifier and the optional prorationMode or replacementMode.
|
|
496
496
|
* @param {boolean} googleIsPersonalizedPrice Android and Google only. Optional boolean indicates personalized pricing on products available for purchase in the EU.
|
|
497
|
-
* For compliance with EU regulations. User will see "This price has been
|
|
497
|
+
* For compliance with EU regulations. User will see "This price has been customized for you" in the purchase dialog when true.
|
|
498
498
|
* See https://developer.android.com/google/play/billing/integrate#personalized-price for more info.
|
|
499
499
|
* @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing
|
|
500
500
|
* a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the
|
|
501
501
|
* user cancelled the purchase, and an object with more information. The promise will be also be rejected if configure
|
|
502
502
|
* has not been called yet.
|
|
503
503
|
*/
|
|
504
|
-
Purchases.purchaseSubscriptionOption = function (subscriptionOption,
|
|
504
|
+
Purchases.purchaseSubscriptionOption = function (subscriptionOption, productChangeInfo, googleIsPersonalizedPrice) {
|
|
505
505
|
return __awaiter(this, void 0, void 0, function () {
|
|
506
506
|
return __generator(this, function (_a) {
|
|
507
507
|
switch (_a.label) {
|
|
@@ -511,7 +511,7 @@ var Purchases = /** @class */ (function () {
|
|
|
511
511
|
return [4 /*yield*/, Purchases.throwIfIOSPlatform()];
|
|
512
512
|
case 2:
|
|
513
513
|
_a.sent();
|
|
514
|
-
return [2 /*return*/, RNPurchases.purchaseSubscriptionOption(subscriptionOption.productId, subscriptionOption.id,
|
|
514
|
+
return [2 /*return*/, RNPurchases.purchaseSubscriptionOption(subscriptionOption.productId, subscriptionOption.id, productChangeInfo, null, googleIsPersonalizedPrice == null
|
|
515
515
|
? null
|
|
516
516
|
: { isPersonalizedPrice: googleIsPersonalizedPrice }, subscriptionOption.presentedOfferingContext).catch(function (error) {
|
|
517
517
|
error.userCancelled =
|
|
@@ -2063,8 +2063,15 @@ var Purchases = /** @class */ (function () {
|
|
|
2063
2063
|
* Replace SKU's ProrationMode.
|
|
2064
2064
|
* @readonly
|
|
2065
2065
|
* @enum {number}
|
|
2066
|
+
* @deprecated, use STORE_REPLACEMENT_MODE
|
|
2066
2067
|
*/
|
|
2067
2068
|
Purchases.PRORATION_MODE = purchases_typescript_internal_1.PRORATION_MODE;
|
|
2069
|
+
/**
|
|
2070
|
+
* Replacement modes for use when changing products.
|
|
2071
|
+
* @readonly
|
|
2072
|
+
* @enum {string}
|
|
2073
|
+
*/
|
|
2074
|
+
Purchases.STORE_REPLACEMENT_MODE = purchases_typescript_internal_1.STORE_REPLACEMENT_MODE;
|
|
2068
2075
|
/**
|
|
2069
2076
|
* Enumeration of all possible Package types.
|
|
2070
2077
|
* @readonly
|
package/ios/RNPurchases.m
CHANGED
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.0
|
|
4
|
+
"version": "10.1.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",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@revenuecat/purchases-js-hybrid-mappings": "18.
|
|
119
|
-
"@revenuecat/purchases-typescript-internal": "18.
|
|
118
|
+
"@revenuecat/purchases-js-hybrid-mappings": "18.4.0",
|
|
119
|
+
"@revenuecat/purchases-typescript-internal": "18.4.0"
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
package com.revenuecat.purchases.react;
|
|
2
|
-
|
|
3
|
-
class GoogleUpgradeInfo {
|
|
4
|
-
private final String oldProductIdentifier;
|
|
5
|
-
private final Integer prorationMode;
|
|
6
|
-
|
|
7
|
-
public GoogleUpgradeInfo(String oldProductIdentifier, Integer prorationMode) {
|
|
8
|
-
this.oldProductIdentifier = oldProductIdentifier;
|
|
9
|
-
this.prorationMode = prorationMode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public String getOldProductIdentifier() {
|
|
13
|
-
return oldProductIdentifier;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public Integer getProrationMode() {
|
|
17
|
-
return prorationMode;
|
|
18
|
-
}
|
|
19
|
-
}
|