react-native-purchases 9.6.14 → 9.7.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 +6 -1
- package/dist/browser/nativeModule.d.ts +1 -0
- package/dist/browser/nativeModule.js +6 -0
- package/dist/purchases.d.ts +19 -0
- package/dist/purchases.js +25 -0
- package/ios/RNPurchases.m +8 -1
- package/package.json +3 -3
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 '9.
|
|
32
|
+
versionName '9.7.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:17.
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:17.27.1'
|
|
125
125
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
126
126
|
}
|
|
@@ -47,7 +47,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
47
47
|
private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
|
|
48
48
|
private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
|
|
49
49
|
public static final String PLATFORM_NAME = "react-native";
|
|
50
|
-
public static final String PLUGIN_VERSION = "9.
|
|
50
|
+
public static final String PLUGIN_VERSION = "9.7.0";
|
|
51
51
|
|
|
52
52
|
private final ReactApplicationContext reactContext;
|
|
53
53
|
|
|
@@ -300,6 +300,11 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
300
300
|
CommonKt.syncPurchases();
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
@ReactMethod
|
|
304
|
+
public void syncPurchasesForResult(final Promise promise) {
|
|
305
|
+
CommonKt.syncPurchases(getOnResult(promise));
|
|
306
|
+
}
|
|
307
|
+
|
|
303
308
|
@ReactMethod
|
|
304
309
|
public void isAnonymous(final Promise promise) {
|
|
305
310
|
promise.resolve(CommonKt.isAnonymous());
|
|
@@ -23,6 +23,7 @@ export declare const browserNativeModuleRNPurchases: {
|
|
|
23
23
|
}>;
|
|
24
24
|
logOut: () => Promise<import("@revenuecat/purchases-typescript-internal").CustomerInfo>;
|
|
25
25
|
syncPurchases: () => Promise<void>;
|
|
26
|
+
syncPurchasesForResult: () => Promise<void>;
|
|
26
27
|
syncAmazonPurchase: (_productID: string, _receiptID: string, _amazonUserID: string, _isoCurrencyCode: string | null, _price: number | null) => Promise<void>;
|
|
27
28
|
syncObserverModeAmazonPurchase: (_productID: string, _receiptID: string, _amazonUserID: string, _isoCurrencyCode: string | null, _price: number | null) => Promise<void>;
|
|
28
29
|
recordPurchaseForProductID: (_productID: string) => Promise<void>;
|
|
@@ -214,6 +214,12 @@ exports.browserNativeModuleRNPurchases = {
|
|
|
214
214
|
return [2 /*return*/];
|
|
215
215
|
});
|
|
216
216
|
}); },
|
|
217
|
+
syncPurchasesForResult: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
218
|
+
return __generator(this, function (_a) {
|
|
219
|
+
(0, utils_1.methodNotSupportedOnWeb)('syncPurchasesForResult');
|
|
220
|
+
return [2 /*return*/];
|
|
221
|
+
});
|
|
222
|
+
}); },
|
|
217
223
|
syncAmazonPurchase: function (_productID, _receiptID, _amazonUserID, _isoCurrencyCode, _price) { return __awaiter(void 0, void 0, void 0, function () {
|
|
218
224
|
return __generator(this, function (_a) {
|
|
219
225
|
(0, utils_1.methodNotSupportedOnWeb)('syncAmazonPurchase');
|
package/dist/purchases.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
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";
|
|
2
|
+
/**
|
|
3
|
+
* Result of a syncPurchases operation.
|
|
4
|
+
*/
|
|
5
|
+
export interface SyncPurchasesResult {
|
|
6
|
+
/**
|
|
7
|
+
* The updated customer info after syncing purchases.
|
|
8
|
+
*/
|
|
9
|
+
customerInfo: CustomerInfo;
|
|
10
|
+
}
|
|
2
11
|
export { PURCHASE_TYPE, PurchasesAreCompletedBy, PurchasesAreCompletedByMyApp, PURCHASES_ARE_COMPLETED_BY_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, STOREKIT_VERSION, PurchasesConfiguration, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult, WebPurchaseRedemption, WebPurchaseRedemptionResult, WebPurchaseRedemptionResultType, } from "@revenuecat/purchases-typescript-internal";
|
|
3
12
|
export default class Purchases {
|
|
4
13
|
/**
|
|
@@ -337,11 +346,21 @@ export default class Purchases {
|
|
|
337
346
|
* This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation
|
|
338
347
|
* for subscriptions anytime a sync is needed, like after a successful purchase.
|
|
339
348
|
*
|
|
349
|
+
* @deprecated Use {@link syncPurchasesForResult} instead, which returns the updated CustomerInfo.
|
|
340
350
|
* @warning This function should only be called if you're not calling purchaseProduct/purchaseStoreProduct/purchasePackage/purchaseSubscriptionOption.
|
|
341
351
|
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
|
|
342
352
|
* syncing purchases.
|
|
343
353
|
*/
|
|
344
354
|
static syncPurchases(): Promise<void>;
|
|
355
|
+
/**
|
|
356
|
+
* This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation
|
|
357
|
+
* for subscriptions anytime a sync is needed, like after a successful purchase.
|
|
358
|
+
*
|
|
359
|
+
* @warning This function should only be called if you're not calling purchaseProduct/purchaseStoreProduct/purchasePackage/purchaseSubscriptionOption.
|
|
360
|
+
* @returns {Promise<SyncPurchasesResult>} A promise containing the sync result with customer info. The promise will
|
|
361
|
+
* be rejected if configure has not been called yet or if there's an error syncing purchases.
|
|
362
|
+
*/
|
|
363
|
+
static syncPurchasesForResult(): Promise<SyncPurchasesResult>;
|
|
345
364
|
/**
|
|
346
365
|
* This method will send a purchase to the RevenueCat backend. This function should only be called if you are
|
|
347
366
|
* in Amazon observer mode or performing a client side migration of your current users to RevenueCat.
|
package/dist/purchases.js
CHANGED
|
@@ -657,6 +657,7 @@ var Purchases = /** @class */ (function () {
|
|
|
657
657
|
* This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation
|
|
658
658
|
* for subscriptions anytime a sync is needed, like after a successful purchase.
|
|
659
659
|
*
|
|
660
|
+
* @deprecated Use {@link syncPurchasesForResult} instead, which returns the updated CustomerInfo.
|
|
660
661
|
* @warning This function should only be called if you're not calling purchaseProduct/purchaseStoreProduct/purchasePackage/purchaseSubscriptionOption.
|
|
661
662
|
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
|
|
662
663
|
* syncing purchases.
|
|
@@ -674,6 +675,30 @@ var Purchases = /** @class */ (function () {
|
|
|
674
675
|
});
|
|
675
676
|
});
|
|
676
677
|
};
|
|
678
|
+
/**
|
|
679
|
+
* This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation
|
|
680
|
+
* for subscriptions anytime a sync is needed, like after a successful purchase.
|
|
681
|
+
*
|
|
682
|
+
* @warning This function should only be called if you're not calling purchaseProduct/purchaseStoreProduct/purchasePackage/purchaseSubscriptionOption.
|
|
683
|
+
* @returns {Promise<SyncPurchasesResult>} A promise containing the sync result with customer info. The promise will
|
|
684
|
+
* be rejected if configure has not been called yet or if there's an error syncing purchases.
|
|
685
|
+
*/
|
|
686
|
+
Purchases.syncPurchasesForResult = function () {
|
|
687
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
688
|
+
var customerInfo;
|
|
689
|
+
return __generator(this, function (_a) {
|
|
690
|
+
switch (_a.label) {
|
|
691
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
692
|
+
case 1:
|
|
693
|
+
_a.sent();
|
|
694
|
+
return [4 /*yield*/, RNPurchases.syncPurchasesForResult()];
|
|
695
|
+
case 2:
|
|
696
|
+
customerInfo = _a.sent();
|
|
697
|
+
return [2 /*return*/, { customerInfo: customerInfo }];
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
});
|
|
701
|
+
};
|
|
677
702
|
/**
|
|
678
703
|
* This method will send a purchase to the RevenueCat backend. This function should only be called if you are
|
|
679
704
|
* in Amazon observer mode or performing a client side migration of your current users to RevenueCat.
|
package/ios/RNPurchases.m
CHANGED
|
@@ -161,6 +161,13 @@ RCT_EXPORT_METHOD(syncPurchases) {
|
|
|
161
161
|
[RCCommonFunctionality syncPurchasesWithCompletionBlock:nil];
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
RCT_REMAP_METHOD(syncPurchasesForResult,
|
|
165
|
+
syncPurchasesForResultWithResolve:(RCTPromiseResolveBlock)resolve
|
|
166
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
167
|
+
[RCCommonFunctionality syncPurchasesWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve
|
|
168
|
+
reject:reject]];
|
|
169
|
+
}
|
|
170
|
+
|
|
164
171
|
RCT_REMAP_METHOD(getAppUserID,
|
|
165
172
|
getAppUserIDWithResolve:(RCTPromiseResolveBlock)resolve
|
|
166
173
|
reject:(RCTPromiseRejectBlock)reject) {
|
|
@@ -665,7 +672,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
|
|
|
665
672
|
}
|
|
666
673
|
|
|
667
674
|
- (NSString *)platformFlavorVersion {
|
|
668
|
-
return @"9.
|
|
675
|
+
return @"9.7.0";
|
|
669
676
|
}
|
|
670
677
|
|
|
671
678
|
@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": "9.
|
|
4
|
+
"version": "9.7.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",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
]
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@revenuecat/purchases-js-hybrid-mappings": "17.
|
|
118
|
-
"@revenuecat/purchases-typescript-internal": "17.
|
|
117
|
+
"@revenuecat/purchases-js-hybrid-mappings": "17.27.1",
|
|
118
|
+
"@revenuecat/purchases-typescript-internal": "17.27.1"
|
|
119
119
|
}
|
|
120
120
|
}
|