react-native-purchases 9.3.0 → 9.4.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 +3 -3
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +12 -3
- package/dist/browser/nativeModule.d.ts +2 -1
- package/dist/browser/nativeModule.js +7 -1
- package/dist/purchases.d.ts +11 -1
- package/dist/purchases.js +24 -2
- package/ios/RNPurchases.m +11 -3
- package/package.json +3 -3
package/RNPurchases.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ buildscript {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
dependencies {
|
|
9
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
9
|
+
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
10
10
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -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.4.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.5.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.4.0";
|
|
51
51
|
|
|
52
52
|
private final ReactApplicationContext reactContext;
|
|
53
53
|
|
|
@@ -88,7 +88,9 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
88
88
|
boolean shouldShowInAppMessagesAutomatically,
|
|
89
89
|
@Nullable String entitlementVerificationMode,
|
|
90
90
|
boolean pendingTransactionsForPrepaidPlansEnabled,
|
|
91
|
-
boolean diagnosticsEnabled
|
|
91
|
+
boolean diagnosticsEnabled,
|
|
92
|
+
boolean automaticDeviceIdentifierCollectionEnabled,
|
|
93
|
+
@Nullable String preferredUILocaleOverride) {
|
|
92
94
|
PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION);
|
|
93
95
|
Store store = Store.PLAY_STORE;
|
|
94
96
|
if (useAmazon) {
|
|
@@ -105,7 +107,9 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
105
107
|
shouldShowInAppMessagesAutomatically,
|
|
106
108
|
entitlementVerificationMode,
|
|
107
109
|
pendingTransactionsForPrepaidPlansEnabled,
|
|
108
|
-
diagnosticsEnabled
|
|
110
|
+
diagnosticsEnabled,
|
|
111
|
+
automaticDeviceIdentifierCollectionEnabled,
|
|
112
|
+
preferredUILocaleOverride
|
|
109
113
|
);
|
|
110
114
|
Purchases.getSharedInstance().setUpdatedCustomerInfoListener(this);
|
|
111
115
|
}
|
|
@@ -338,6 +342,11 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
338
342
|
promise.resolve(Purchases.isConfigured());
|
|
339
343
|
}
|
|
340
344
|
|
|
345
|
+
@ReactMethod
|
|
346
|
+
public void overridePreferredLocale(@Nullable String locale) {
|
|
347
|
+
CommonKt.overridePreferredLocale(locale);
|
|
348
|
+
}
|
|
349
|
+
|
|
341
350
|
//================================================================================
|
|
342
351
|
// Virtual Currencies
|
|
343
352
|
//================================================================================
|
|
@@ -3,7 +3,7 @@ import { MakePurchaseResult } from '@revenuecat/purchases-typescript-internal';
|
|
|
3
3
|
* Browser implementation of the native module. This will be used in the browser and Expo Go.
|
|
4
4
|
*/
|
|
5
5
|
export declare const browserNativeModuleRNPurchases: {
|
|
6
|
-
setupPurchases: (apiKey: string, appUserID: string | null, _purchasesAreCompletedBy: string | null, _userDefaultsSuiteName: string | null, _storeKitVersion: string | null, _useAmazon: boolean, _shouldShowInAppMessagesAutomatically: boolean, _entitlementVerificationMode: string | null, _pendingTransactionsForPrepaidPlansEnabled: boolean, _diagnosticsEnabled: boolean) => Promise<void>;
|
|
6
|
+
setupPurchases: (apiKey: string, appUserID: string | null, _purchasesAreCompletedBy: string | null, _userDefaultsSuiteName: string | null, _storeKitVersion: string | null, _useAmazon: boolean, _shouldShowInAppMessagesAutomatically: boolean, _entitlementVerificationMode: string | null, _pendingTransactionsForPrepaidPlansEnabled: boolean, _diagnosticsEnabled: boolean, _automaticDeviceIdentifierCollectionEnabled: boolean, _preferredUILocaleOverride: string | null) => Promise<void>;
|
|
7
7
|
setAllowSharingStoreAccount: (_allowSharing: boolean) => Promise<void>;
|
|
8
8
|
setSimulatesAskToBuyInSandbox: (_simulatesAskToBuyInSandbox: boolean) => Promise<void>;
|
|
9
9
|
getOfferings: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesOfferings>;
|
|
@@ -68,6 +68,7 @@ export declare const browserNativeModuleRNPurchases: {
|
|
|
68
68
|
setAd: (_ad: string) => Promise<void>;
|
|
69
69
|
setKeyword: (_keyword: string) => Promise<void>;
|
|
70
70
|
setCreative: (_creative: string) => Promise<void>;
|
|
71
|
+
overridePreferredLocale: (_locale: string | null) => Promise<void>;
|
|
71
72
|
canMakePayments: (_features: any[]) => Promise<boolean>;
|
|
72
73
|
beginRefundRequestForActiveEntitlement: () => Promise<void>;
|
|
73
74
|
beginRefundRequestForEntitlementId: (_entitlementIdentifier: string) => Promise<void>;
|
|
@@ -47,7 +47,7 @@ var packageVersion = '9.1.0';
|
|
|
47
47
|
* Browser implementation of the native module. This will be used in the browser and Expo Go.
|
|
48
48
|
*/
|
|
49
49
|
exports.browserNativeModuleRNPurchases = {
|
|
50
|
-
setupPurchases: function (apiKey, appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
setupPurchases: function (apiKey, appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled, _automaticDeviceIdentifierCollectionEnabled, _preferredUILocaleOverride) { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
51
|
return __generator(this, function (_a) {
|
|
52
52
|
try {
|
|
53
53
|
purchases_js_hybrid_mappings_1.PurchasesCommon.configure({
|
|
@@ -488,6 +488,12 @@ exports.browserNativeModuleRNPurchases = {
|
|
|
488
488
|
return [2 /*return*/];
|
|
489
489
|
});
|
|
490
490
|
}); },
|
|
491
|
+
overridePreferredLocale: function (_locale) { return __awaiter(void 0, void 0, void 0, function () {
|
|
492
|
+
return __generator(this, function (_a) {
|
|
493
|
+
(0, utils_1.methodNotSupportedOnWeb)('overridePreferredLocale');
|
|
494
|
+
return [2 /*return*/];
|
|
495
|
+
});
|
|
496
|
+
}); },
|
|
491
497
|
canMakePayments: function (_features) { return __awaiter(void 0, void 0, void 0, function () {
|
|
492
498
|
return __generator(this, function (_a) {
|
|
493
499
|
return [2 /*return*/, true];
|
package/dist/purchases.d.ts
CHANGED
|
@@ -109,10 +109,12 @@ export default class Purchases {
|
|
|
109
109
|
* Default is null, which will make the SDK use standardUserDefaults.
|
|
110
110
|
* @param {boolean} [pendingTransactionsForPrepaidPlansEnabled=false] An optional boolean. Android-only. Set this to true to enable pending transactions for prepaid subscriptions in Google Play.
|
|
111
111
|
* @param {boolean} [diagnosticsEnabled=false] An optional boolean. Set this to true to enable SDK diagnostics.
|
|
112
|
+
* @param {boolean} [automaticDeviceIdentifierCollectionEnabled=true] An optional boolean. Set this to true to allow the collection of identifiers when setting the identifier for an attribution network.
|
|
113
|
+
* @param {String?} [preferredUILocaleOverride] An optional string. Set this to the preferred UI locale to use for RevenueCat UI components.
|
|
112
114
|
*
|
|
113
115
|
* @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
|
|
114
116
|
*/
|
|
115
|
-
static configure({ apiKey, appUserID, purchasesAreCompletedBy, userDefaultsSuiteName, storeKitVersion, useAmazon, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled, }: PurchasesConfiguration): void;
|
|
117
|
+
static configure({ apiKey, appUserID, purchasesAreCompletedBy, userDefaultsSuiteName, storeKitVersion, useAmazon, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled, automaticDeviceIdentifierCollectionEnabled, preferredUILocaleOverride, }: PurchasesConfiguration): void;
|
|
116
118
|
/**
|
|
117
119
|
* @deprecated, configure behavior through the RevenueCat dashboard (app.revenuecat.com) instead.
|
|
118
120
|
* If an user tries to purchase a product that is active on the current app store account,
|
|
@@ -699,6 +701,14 @@ export default class Purchases {
|
|
|
699
701
|
* setting the creative subscriber attribute.
|
|
700
702
|
*/
|
|
701
703
|
static setCreative(creative: string | null): Promise<void>;
|
|
704
|
+
/**
|
|
705
|
+
* Overrides the preferred UI locale used by RevenueCat UI components.
|
|
706
|
+
* Pass null to clear the override and use the device's locale.
|
|
707
|
+
*
|
|
708
|
+
* @param locale A BCP 47 locale identifier (e.g., "en-US") or null to clear.
|
|
709
|
+
* @returns {Promise<void>}
|
|
710
|
+
*/
|
|
711
|
+
static overridePreferredLocale(locale: string | null): Promise<void>;
|
|
702
712
|
/**
|
|
703
713
|
* Check if billing is supported for the current user (meaning IN-APP purchases are supported)
|
|
704
714
|
* and optionally, whether a list of specified feature types are supported.
|
package/dist/purchases.js
CHANGED
|
@@ -87,11 +87,13 @@ var Purchases = /** @class */ (function () {
|
|
|
87
87
|
* Default is null, which will make the SDK use standardUserDefaults.
|
|
88
88
|
* @param {boolean} [pendingTransactionsForPrepaidPlansEnabled=false] An optional boolean. Android-only. Set this to true to enable pending transactions for prepaid subscriptions in Google Play.
|
|
89
89
|
* @param {boolean} [diagnosticsEnabled=false] An optional boolean. Set this to true to enable SDK diagnostics.
|
|
90
|
+
* @param {boolean} [automaticDeviceIdentifierCollectionEnabled=true] An optional boolean. Set this to true to allow the collection of identifiers when setting the identifier for an attribution network.
|
|
91
|
+
* @param {String?} [preferredUILocaleOverride] An optional string. Set this to the preferred UI locale to use for RevenueCat UI components.
|
|
90
92
|
*
|
|
91
93
|
* @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
|
|
92
94
|
*/
|
|
93
95
|
Purchases.configure = function (_a) {
|
|
94
|
-
var apiKey = _a.apiKey, _b = _a.appUserID, appUserID = _b === void 0 ? null : _b, _c = _a.purchasesAreCompletedBy, purchasesAreCompletedBy = _c === void 0 ? purchases_typescript_internal_1.PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT : _c, userDefaultsSuiteName = _a.userDefaultsSuiteName, _d = _a.storeKitVersion, storeKitVersion = _d === void 0 ? purchases_typescript_internal_1.STOREKIT_VERSION.DEFAULT : _d, _e = _a.useAmazon, useAmazon = _e === void 0 ? false : _e, _f = _a.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _f === void 0 ? true : _f, _g = _a.entitlementVerificationMode, entitlementVerificationMode = _g === void 0 ? purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE.DISABLED : _g, _h = _a.pendingTransactionsForPrepaidPlansEnabled, pendingTransactionsForPrepaidPlansEnabled = _h === void 0 ? false : _h, _j = _a.diagnosticsEnabled, diagnosticsEnabled = _j === void 0 ? false : _j;
|
|
96
|
+
var apiKey = _a.apiKey, _b = _a.appUserID, appUserID = _b === void 0 ? null : _b, _c = _a.purchasesAreCompletedBy, purchasesAreCompletedBy = _c === void 0 ? purchases_typescript_internal_1.PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT : _c, userDefaultsSuiteName = _a.userDefaultsSuiteName, _d = _a.storeKitVersion, storeKitVersion = _d === void 0 ? purchases_typescript_internal_1.STOREKIT_VERSION.DEFAULT : _d, _e = _a.useAmazon, useAmazon = _e === void 0 ? false : _e, _f = _a.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _f === void 0 ? true : _f, _g = _a.entitlementVerificationMode, entitlementVerificationMode = _g === void 0 ? purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE.DISABLED : _g, _h = _a.pendingTransactionsForPrepaidPlansEnabled, pendingTransactionsForPrepaidPlansEnabled = _h === void 0 ? false : _h, _j = _a.diagnosticsEnabled, diagnosticsEnabled = _j === void 0 ? false : _j, _k = _a.automaticDeviceIdentifierCollectionEnabled, automaticDeviceIdentifierCollectionEnabled = _k === void 0 ? true : _k, preferredUILocaleOverride = _a.preferredUILocaleOverride;
|
|
95
97
|
if (!customLogHandler) {
|
|
96
98
|
this.setLogHandler(function (logLevel, message) {
|
|
97
99
|
switch (logLevel) {
|
|
@@ -143,7 +145,7 @@ var Purchases = /** @class */ (function () {
|
|
|
143
145
|
console.warn("Warning: You should provide the specific StoreKit version you're using in your implementation when configuring PURCHASES_ARE_COMPLETED_BY_TYPE.MY_APP, and not rely on the DEFAULT.");
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
|
-
RNPurchases.setupPurchases(apiKey, appUserID, purchasesCompletedByToUse, userDefaultsSuiteName, storeKitVersionToUse, useAmazon, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled);
|
|
148
|
+
RNPurchases.setupPurchases(apiKey, appUserID, purchasesCompletedByToUse, userDefaultsSuiteName, storeKitVersionToUse, useAmazon, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled, automaticDeviceIdentifierCollectionEnabled, preferredUILocaleOverride);
|
|
147
149
|
};
|
|
148
150
|
/**
|
|
149
151
|
* @deprecated, configure behavior through the RevenueCat dashboard (app.revenuecat.com) instead.
|
|
@@ -1498,6 +1500,26 @@ var Purchases = /** @class */ (function () {
|
|
|
1498
1500
|
});
|
|
1499
1501
|
});
|
|
1500
1502
|
};
|
|
1503
|
+
/**
|
|
1504
|
+
* Overrides the preferred UI locale used by RevenueCat UI components.
|
|
1505
|
+
* Pass null to clear the override and use the device's locale.
|
|
1506
|
+
*
|
|
1507
|
+
* @param locale A BCP 47 locale identifier (e.g., "en-US") or null to clear.
|
|
1508
|
+
* @returns {Promise<void>}
|
|
1509
|
+
*/
|
|
1510
|
+
Purchases.overridePreferredLocale = function (locale) {
|
|
1511
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1512
|
+
return __generator(this, function (_a) {
|
|
1513
|
+
switch (_a.label) {
|
|
1514
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1515
|
+
case 1:
|
|
1516
|
+
_a.sent();
|
|
1517
|
+
RNPurchases.overridePreferredLocale(locale);
|
|
1518
|
+
return [2 /*return*/];
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1521
|
+
});
|
|
1522
|
+
};
|
|
1501
1523
|
/**
|
|
1502
1524
|
* Check if billing is supported for the current user (meaning IN-APP purchases are supported)
|
|
1503
1525
|
* and optionally, whether a list of specified feature types are supported.
|
package/ios/RNPurchases.m
CHANGED
|
@@ -61,7 +61,9 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
|
|
|
61
61
|
shouldShowInAppMessagesAutomatically:(BOOL)shouldShowInAppMessagesAutomatically
|
|
62
62
|
entitlementVerificationMode:(nullable NSString *)entitlementVerificationMode
|
|
63
63
|
pendingTransactionsForPrepaidPlansEnabled:(BOOL)pendingTransactionsForPrepaidPlansEnabled
|
|
64
|
-
diagnosticsEnabled:(BOOL)diagnosticsEnabled
|
|
64
|
+
diagnosticsEnabled:(BOOL)diagnosticsEnabled
|
|
65
|
+
automaticDeviceIdentifierCollectionEnabled:(BOOL)automaticDeviceIdentifierCollectionEnabled
|
|
66
|
+
preferredUILocaleOverride:(nullable NSString *)preferredUILocaleOverride) {
|
|
65
67
|
RCPurchases *purchases = [RCPurchases configureWithAPIKey:apiKey.mappingNSNullToNil
|
|
66
68
|
appUserID:appUserID.mappingNSNullToNil
|
|
67
69
|
purchasesAreCompletedBy:purchasesAreCompletedBy.mappingNSNullToNil
|
|
@@ -72,7 +74,9 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
|
|
|
72
74
|
dangerousSettings:nil
|
|
73
75
|
shouldShowInAppMessagesAutomatically:shouldShowInAppMessagesAutomatically
|
|
74
76
|
verificationMode:entitlementVerificationMode.mappingNSNullToNil
|
|
75
|
-
diagnosticsEnabled:diagnosticsEnabled
|
|
77
|
+
diagnosticsEnabled:diagnosticsEnabled
|
|
78
|
+
automaticDeviceIdentifierCollectionEnabled:automaticDeviceIdentifierCollectionEnabled
|
|
79
|
+
preferredLocale:preferredUILocaleOverride.mappingNSNullToNil];
|
|
76
80
|
purchases.delegate = self;
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -430,6 +434,10 @@ RCT_EXPORT_METHOD(setCreative:(NSString *)creative) {
|
|
|
430
434
|
[RCCommonFunctionality setCreative:creative.mappingNSNullToNil];
|
|
431
435
|
}
|
|
432
436
|
|
|
437
|
+
RCT_EXPORT_METHOD(overridePreferredLocale:(nullable NSString *)locale) {
|
|
438
|
+
[RCCommonFunctionality overridePreferredLocale:locale.mappingNSNullToNil];
|
|
439
|
+
}
|
|
440
|
+
|
|
433
441
|
RCT_REMAP_METHOD(canMakePayments,
|
|
434
442
|
canMakePaymentsWithFeatures:(NSArray<NSNumber *> *)features
|
|
435
443
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
@@ -657,7 +665,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
|
|
|
657
665
|
}
|
|
658
666
|
|
|
659
667
|
- (NSString *)platformFlavorVersion {
|
|
660
|
-
return @"9.
|
|
668
|
+
return @"9.4.0";
|
|
661
669
|
}
|
|
662
670
|
|
|
663
671
|
@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.4.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.5.1",
|
|
118
|
+
"@revenuecat/purchases-typescript-internal": "17.5.1"
|
|
119
119
|
}
|
|
120
120
|
}
|