react-native-purchases 9.11.2 → 9.13.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 +17 -1
- package/dist/browser/nativeModule.d.ts +1 -0
- package/dist/browser/nativeModule.js +6 -0
- package/dist/purchases.d.ts +26 -0
- package/dist/purchases.js +43 -0
- package/ios/RNPurchases.m +17 -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.13.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.51.1'
|
|
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 = "9.
|
|
54
|
+
public static final String PLUGIN_VERSION = "9.13.0";
|
|
55
55
|
|
|
56
56
|
private final ReactApplicationContext reactContext;
|
|
57
57
|
|
|
@@ -138,6 +138,17 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
138
138
|
CommonKt.syncAttributesAndOfferingsIfNeeded(getOnResult(promise));
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
@ReactMethod
|
|
142
|
+
public void setAppstackAttributionParams(ReadableMap data, final Promise promise) {
|
|
143
|
+
HashMap<String, Object> dataMap = new HashMap<>();
|
|
144
|
+
for (Map.Entry<String, Object> entry : data.toHashMap().entrySet()) {
|
|
145
|
+
if (entry.getValue() != null) {
|
|
146
|
+
dataMap.put(entry.getKey(), entry.getValue());
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
CommonKt.setAppstackAttributionParams(dataMap, getOnResult(promise));
|
|
150
|
+
}
|
|
151
|
+
|
|
141
152
|
@ReactMethod
|
|
142
153
|
public void getProductInfo(ReadableArray productIDs, String type, final Promise promise) {
|
|
143
154
|
ArrayList<String> productIDList = new ArrayList<>();
|
|
@@ -598,6 +609,11 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
598
609
|
CommonKt.redeemWebPurchase(urlString, getOnResult(promise));
|
|
599
610
|
}
|
|
600
611
|
|
|
612
|
+
@ReactMethod
|
|
613
|
+
public void trackCustomPaywallImpression(ReadableMap data) {
|
|
614
|
+
CommonKt.trackCustomPaywallImpression(data.toHashMap());
|
|
615
|
+
}
|
|
616
|
+
|
|
601
617
|
// endregion
|
|
602
618
|
|
|
603
619
|
//================================================================================
|
|
@@ -9,6 +9,7 @@ export declare const browserNativeModuleRNPurchases: {
|
|
|
9
9
|
getOfferings: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesOfferings>;
|
|
10
10
|
getCurrentOfferingForPlacement: (placementIdentifier: string) => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesOffering | null>;
|
|
11
11
|
syncAttributesAndOfferingsIfNeeded: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesOfferings>;
|
|
12
|
+
setAppstackAttributionParams: (_data: Record<string, any>) => Promise<void>;
|
|
12
13
|
getProductInfo: (_productIdentifiers: string[], _type: string) => Promise<void>;
|
|
13
14
|
restorePurchases: () => Promise<import("@revenuecat/purchases-typescript-internal").CustomerInfo>;
|
|
14
15
|
getAppUserID: () => Promise<string>;
|
|
@@ -120,6 +120,12 @@ exports.browserNativeModuleRNPurchases = {
|
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
}); },
|
|
123
|
+
setAppstackAttributionParams: function (_data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
return __generator(this, function (_a) {
|
|
125
|
+
(0, utils_1.methodNotSupportedOnWeb)('setAppstackAttributionParams');
|
|
126
|
+
return [2 /*return*/];
|
|
127
|
+
});
|
|
128
|
+
}); },
|
|
123
129
|
getProductInfo: function (_productIdentifiers, _type) { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
130
|
return __generator(this, function (_a) {
|
|
125
131
|
(0, utils_1.methodNotSupportedOnWeb)('getProductInfo');
|
package/dist/purchases.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ export interface SyncPurchasesResult {
|
|
|
9
9
|
customerInfo: CustomerInfo;
|
|
10
10
|
}
|
|
11
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";
|
|
12
|
+
/**
|
|
13
|
+
* Options for tracking a custom paywall impression.
|
|
14
|
+
*/
|
|
15
|
+
export interface TrackCustomPaywallImpressionOptions {
|
|
16
|
+
paywallId?: string | null;
|
|
17
|
+
}
|
|
12
18
|
export default class Purchases {
|
|
13
19
|
/**
|
|
14
20
|
* Supported SKU types.
|
|
@@ -186,6 +192,17 @@ export default class Purchases {
|
|
|
186
192
|
* has not been called yet.
|
|
187
193
|
*/
|
|
188
194
|
static syncAttributesAndOfferingsIfNeeded(): Promise<PurchasesOfferings>;
|
|
195
|
+
/**
|
|
196
|
+
* Sets attribution data from Appstack's attribution params, then syncs subscriber attributes and fetches
|
|
197
|
+
* fresh offerings so that Appstack-based targeting is applied before the promise resolves.
|
|
198
|
+
*
|
|
199
|
+
* Pass the object received from the Appstack Attribution SDK's `getAttributionParams()` directly.
|
|
200
|
+
* The SDK extracts relevant attribution info and sets the appropriate subscriber attributes.
|
|
201
|
+
*
|
|
202
|
+
* @param {object} data The attribution params from the Appstack Attribution SDK.
|
|
203
|
+
* @returns {Promise<PurchasesOfferings>} Promise of offerings targeted with Appstack data.
|
|
204
|
+
*/
|
|
205
|
+
static setAppstackAttributionParams(data: Record<string, any>): Promise<PurchasesOfferings>;
|
|
189
206
|
/**
|
|
190
207
|
* Fetch the product info
|
|
191
208
|
* @param {String[]} productIdentifiers Array of product identifiers
|
|
@@ -836,6 +853,15 @@ export default class Purchases {
|
|
|
836
853
|
* @returns {Promise<Boolean>} promise with boolean response
|
|
837
854
|
*/
|
|
838
855
|
static isConfigured(): Promise<boolean>;
|
|
856
|
+
/**
|
|
857
|
+
* Tracks an impression of a custom (non-RevenueCat) paywall.
|
|
858
|
+
* Call this method when your custom paywall is displayed to a user.
|
|
859
|
+
* This enables RevenueCat to track paywall impressions for analytics.
|
|
860
|
+
*
|
|
861
|
+
* @param params - Optional parameters for the impression event.
|
|
862
|
+
* @param params.paywallId - Optional identifier for the custom paywall being shown.
|
|
863
|
+
*/
|
|
864
|
+
static trackCustomPaywallImpression(params?: TrackCustomPaywallImpressionOptions): Promise<void>;
|
|
839
865
|
private static throwIfNotConfigured;
|
|
840
866
|
private static throwIfAndroidPlatform;
|
|
841
867
|
private static throwIfIOSPlatform;
|
package/dist/purchases.js
CHANGED
|
@@ -320,6 +320,28 @@ var Purchases = /** @class */ (function () {
|
|
|
320
320
|
});
|
|
321
321
|
});
|
|
322
322
|
};
|
|
323
|
+
/**
|
|
324
|
+
* Sets attribution data from Appstack's attribution params, then syncs subscriber attributes and fetches
|
|
325
|
+
* fresh offerings so that Appstack-based targeting is applied before the promise resolves.
|
|
326
|
+
*
|
|
327
|
+
* Pass the object received from the Appstack Attribution SDK's `getAttributionParams()` directly.
|
|
328
|
+
* The SDK extracts relevant attribution info and sets the appropriate subscriber attributes.
|
|
329
|
+
*
|
|
330
|
+
* @param {object} data The attribution params from the Appstack Attribution SDK.
|
|
331
|
+
* @returns {Promise<PurchasesOfferings>} Promise of offerings targeted with Appstack data.
|
|
332
|
+
*/
|
|
333
|
+
Purchases.setAppstackAttributionParams = function (data) {
|
|
334
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
335
|
+
return __generator(this, function (_a) {
|
|
336
|
+
switch (_a.label) {
|
|
337
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
338
|
+
case 1:
|
|
339
|
+
_a.sent();
|
|
340
|
+
return [2 /*return*/, RNPurchases.setAppstackAttributionParams(data)];
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
};
|
|
323
345
|
/**
|
|
324
346
|
* Fetch the product info
|
|
325
347
|
* @param {String[]} productIdentifiers Array of product identifiers
|
|
@@ -1935,6 +1957,27 @@ var Purchases = /** @class */ (function () {
|
|
|
1935
1957
|
}
|
|
1936
1958
|
return RNPurchases.isConfigured();
|
|
1937
1959
|
};
|
|
1960
|
+
/**
|
|
1961
|
+
* Tracks an impression of a custom (non-RevenueCat) paywall.
|
|
1962
|
+
* Call this method when your custom paywall is displayed to a user.
|
|
1963
|
+
* This enables RevenueCat to track paywall impressions for analytics.
|
|
1964
|
+
*
|
|
1965
|
+
* @param params - Optional parameters for the impression event.
|
|
1966
|
+
* @param params.paywallId - Optional identifier for the custom paywall being shown.
|
|
1967
|
+
*/
|
|
1968
|
+
Purchases.trackCustomPaywallImpression = function (params) {
|
|
1969
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1970
|
+
return __generator(this, function (_a) {
|
|
1971
|
+
switch (_a.label) {
|
|
1972
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1973
|
+
case 1:
|
|
1974
|
+
_a.sent();
|
|
1975
|
+
RNPurchases.trackCustomPaywallImpression(params !== null && params !== void 0 ? params : {});
|
|
1976
|
+
return [2 /*return*/];
|
|
1977
|
+
}
|
|
1978
|
+
});
|
|
1979
|
+
});
|
|
1980
|
+
};
|
|
1938
1981
|
Purchases.throwIfNotConfigured = function () {
|
|
1939
1982
|
return __awaiter(this, void 0, void 0, function () {
|
|
1940
1983
|
var isConfigured;
|
package/ios/RNPurchases.m
CHANGED
|
@@ -104,6 +104,14 @@ RCT_REMAP_METHOD(syncAttributesAndOfferingsIfNeeded,
|
|
|
104
104
|
reject:reject]];
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
RCT_REMAP_METHOD(setAppstackAttributionParams,
|
|
108
|
+
setAppstackAttributionParamsWithData:(NSDictionary *)data
|
|
109
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
110
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
111
|
+
[RCCommonFunctionality setAppstackAttributionParams:data completionBlock:[self getResponseCompletionBlockWithResolve:resolve
|
|
112
|
+
reject:reject]];
|
|
113
|
+
}
|
|
114
|
+
|
|
107
115
|
RCT_EXPORT_METHOD(getCurrentOfferingForPlacement:(NSString *)placementIdentifier
|
|
108
116
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
109
117
|
reject:(RCTPromiseRejectBlock)reject) {
|
|
@@ -619,6 +627,14 @@ RCT_EXPORT_METHOD(recordPurchaseForProductID:(nonnull NSString *)productID
|
|
|
619
627
|
}
|
|
620
628
|
}
|
|
621
629
|
|
|
630
|
+
RCT_EXPORT_METHOD(trackCustomPaywallImpression:(NSDictionary *)data) {
|
|
631
|
+
if (@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)) {
|
|
632
|
+
[RCCommonFunctionality trackCustomPaywallImpression:data];
|
|
633
|
+
} else {
|
|
634
|
+
NSLog(@"[Purchases] Warning: tried to call trackCustomPaywallImpression, but it's only available on iOS 15.0 or greater.");
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
622
638
|
#pragma mark -
|
|
623
639
|
#pragma mark Delegate Methods
|
|
624
640
|
- (void)purchases:(RCPurchases *)purchases receivedUpdatedCustomerInfo:(RCCustomerInfo *)customerInfo {
|
|
@@ -681,7 +697,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
|
|
|
681
697
|
}
|
|
682
698
|
|
|
683
699
|
- (NSString *)platformFlavorVersion {
|
|
684
|
-
return @"9.
|
|
700
|
+
return @"9.13.0";
|
|
685
701
|
}
|
|
686
702
|
|
|
687
703
|
@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.13.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.51.1",
|
|
118
|
+
"@revenuecat/purchases-typescript-internal": "17.51.1"
|
|
119
119
|
}
|
|
120
120
|
}
|