react-native-purchases 10.2.3 → 10.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 +2 -2
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +47 -11
- package/dist/browser/nativeModule.d.ts +3 -1
- package/dist/browser/nativeModule.js +13 -1
- package/dist/purchases.d.ts +47 -5
- package/dist/purchases.js +56 -11
- package/ios/RNPurchases.m +9 -2
- package/package.json +6 -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 '10.
|
|
32
|
+
versionName '10.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:18.
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.15.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 = "10.
|
|
54
|
+
public static final String PLUGIN_VERSION = "10.4.0";
|
|
55
55
|
|
|
56
56
|
private final ReactApplicationContext reactContext;
|
|
57
57
|
|
|
@@ -89,6 +89,8 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
89
89
|
public void setupPurchases(String apiKey, @Nullable String appUserID,
|
|
90
90
|
@Nullable String purchasesAreCompletedBy, @Nullable String userDefaultsSuiteName,
|
|
91
91
|
@Nullable String storeKitVersion, boolean useAmazon,
|
|
92
|
+
@Nullable String storeString,
|
|
93
|
+
@Nullable String galaxyBillingMode,
|
|
92
94
|
boolean shouldShowInAppMessagesAutomatically,
|
|
93
95
|
@Nullable String entitlementVerificationMode,
|
|
94
96
|
boolean pendingTransactionsForPrepaidPlansEnabled,
|
|
@@ -97,7 +99,9 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
97
99
|
@Nullable String preferredUILocaleOverride) {
|
|
98
100
|
PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION);
|
|
99
101
|
Store store = Store.PLAY_STORE;
|
|
100
|
-
if (
|
|
102
|
+
if ("GALAXY".equals(storeString)) {
|
|
103
|
+
store = Store.GALAXY;
|
|
104
|
+
} else if (useAmazon) {
|
|
101
105
|
store = Store.AMAZON;
|
|
102
106
|
}
|
|
103
107
|
CommonKt.configure(
|
|
@@ -113,7 +117,8 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
113
117
|
pendingTransactionsForPrepaidPlansEnabled,
|
|
114
118
|
diagnosticsEnabled,
|
|
115
119
|
automaticDeviceIdentifierCollectionEnabled,
|
|
116
|
-
preferredUILocaleOverride
|
|
120
|
+
preferredUILocaleOverride,
|
|
121
|
+
galaxyBillingMode
|
|
117
122
|
);
|
|
118
123
|
Purchases.getSharedInstance().setUpdatedCustomerInfoListener(this);
|
|
119
124
|
}
|
|
@@ -140,13 +145,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
140
145
|
|
|
141
146
|
@ReactMethod
|
|
142
147
|
public void setAppstackAttributionParams(ReadableMap data, final Promise promise) {
|
|
143
|
-
|
|
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));
|
|
148
|
+
CommonKt.setAppstackAttributionParams(mapWithoutNullValues(data), getOnResult(promise));
|
|
150
149
|
}
|
|
151
150
|
|
|
152
151
|
@ReactMethod
|
|
@@ -546,6 +545,11 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
546
545
|
SubscriberAttributesKt.setCreative(creative);
|
|
547
546
|
}
|
|
548
547
|
|
|
548
|
+
@ReactMethod
|
|
549
|
+
public void setAppsFlyerConversionData(ReadableMap data) {
|
|
550
|
+
SubscriberAttributesKt.setAppsFlyerConversionData(data == null ? null : data.toHashMap());
|
|
551
|
+
}
|
|
552
|
+
|
|
549
553
|
@ReactMethod
|
|
550
554
|
public void canMakePayments(ReadableArray features, final Promise promise) {
|
|
551
555
|
ArrayList<Integer> featureList = new ArrayList<>();
|
|
@@ -623,7 +627,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
623
627
|
|
|
624
628
|
@ReactMethod
|
|
625
629
|
public void trackCustomPaywallImpression(ReadableMap data) {
|
|
626
|
-
CommonKt.trackCustomPaywallImpression(data
|
|
630
|
+
CommonKt.trackCustomPaywallImpression(mapWithoutNullValues(data));
|
|
627
631
|
}
|
|
628
632
|
|
|
629
633
|
@ReactMethod
|
|
@@ -731,4 +735,36 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
731
735
|
return null;
|
|
732
736
|
}
|
|
733
737
|
}
|
|
738
|
+
|
|
739
|
+
private static HashMap<String, Object> mapWithoutNullValues(ReadableMap data) {
|
|
740
|
+
return mapWithoutNullValues(data.toHashMap());
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
private static HashMap<String, Object> mapWithoutNullValues(Map<?, ?> data) {
|
|
744
|
+
HashMap<String, Object> dataMap = new HashMap<>();
|
|
745
|
+
for (Map.Entry<?, ?> entry : data.entrySet()) {
|
|
746
|
+
Object value = valueWithoutNullValues(entry.getValue());
|
|
747
|
+
if (entry.getKey() instanceof String && value != null) {
|
|
748
|
+
dataMap.put((String) entry.getKey(), value);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return dataMap;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
private static Object valueWithoutNullValues(@Nullable Object value) {
|
|
755
|
+
if (value instanceof Map) {
|
|
756
|
+
return mapWithoutNullValues((Map<?, ?>) value);
|
|
757
|
+
}
|
|
758
|
+
if (value instanceof List) {
|
|
759
|
+
ArrayList<Object> filteredList = new ArrayList<>();
|
|
760
|
+
for (Object item : (List<?>) value) {
|
|
761
|
+
Object filteredItem = valueWithoutNullValues(item);
|
|
762
|
+
if (filteredItem != null) {
|
|
763
|
+
filteredList.add(filteredItem);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
return filteredList;
|
|
767
|
+
}
|
|
768
|
+
return value;
|
|
769
|
+
}
|
|
734
770
|
}
|
|
@@ -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, _automaticDeviceIdentifierCollectionEnabled: boolean, _preferredUILocaleOverride: string | null) => void;
|
|
6
|
+
setupPurchases: (apiKey: string, appUserID: string | null, _purchasesAreCompletedBy: string | null, _userDefaultsSuiteName: string | null, _storeKitVersion: string | null, _useAmazon: boolean, _store: string | null, _galaxyBillingMode: string | null, _shouldShowInAppMessagesAutomatically: boolean, _entitlementVerificationMode: string | null, _pendingTransactionsForPrepaidPlansEnabled: boolean, _diagnosticsEnabled: boolean, _automaticDeviceIdentifierCollectionEnabled: boolean, _preferredUILocaleOverride: string | null) => 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>;
|
|
@@ -17,6 +17,7 @@ export declare const browserNativeModuleRNPurchases: {
|
|
|
17
17
|
setDebugLogsEnabled: (_enabled: boolean) => Promise<void>;
|
|
18
18
|
setLogLevel: (level: string) => Promise<void>;
|
|
19
19
|
setLogHandler: (handler: (level: string, message: string) => void) => Promise<void>;
|
|
20
|
+
trackCustomPaywallImpression: (_data: any) => Promise<void>;
|
|
20
21
|
getCustomerInfo: () => Promise<import("@revenuecat/purchases-typescript-internal").CustomerInfo>;
|
|
21
22
|
logIn: (appUserID: string) => Promise<{
|
|
22
23
|
customerInfo: import("@revenuecat/purchases-typescript-internal").CustomerInfo;
|
|
@@ -70,6 +71,7 @@ export declare const browserNativeModuleRNPurchases: {
|
|
|
70
71
|
setAd: (_ad: string) => Promise<void>;
|
|
71
72
|
setKeyword: (_keyword: string) => Promise<void>;
|
|
72
73
|
setCreative: (_creative: string) => Promise<void>;
|
|
74
|
+
setAppsFlyerConversionData: (_data: Record<string, any> | null) => Promise<void>;
|
|
73
75
|
overridePreferredLocale: (_locale: string | null) => Promise<void>;
|
|
74
76
|
canMakePayments: (_features: any[]) => Promise<boolean>;
|
|
75
77
|
beginRefundRequestForActiveEntitlement: () => Promise<void>;
|
|
@@ -48,7 +48,7 @@ var packageVersion = '9.1.0';
|
|
|
48
48
|
* Browser implementation of the native module. This will be used in the browser and Expo Go.
|
|
49
49
|
*/
|
|
50
50
|
exports.browserNativeModuleRNPurchases = {
|
|
51
|
-
setupPurchases: function (apiKey, appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled, _automaticDeviceIdentifierCollectionEnabled, _preferredUILocaleOverride) {
|
|
51
|
+
setupPurchases: function (apiKey, appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _store, _galaxyBillingMode, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled, _automaticDeviceIdentifierCollectionEnabled, _preferredUILocaleOverride) {
|
|
52
52
|
try {
|
|
53
53
|
// Make sure that when running in Expo Go or Rork sandbox a web-compatible API key is used, because the underlying purchases-js error message isn't super clear when a non-compatible API key type is used in this case
|
|
54
54
|
var webPlatformCompatibleApiKeyPrefixList = ['test_', 'rcb_'];
|
|
@@ -175,6 +175,12 @@ exports.browserNativeModuleRNPurchases = {
|
|
|
175
175
|
return [2 /*return*/];
|
|
176
176
|
});
|
|
177
177
|
}); },
|
|
178
|
+
trackCustomPaywallImpression: function (_data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
|
+
return __generator(this, function (_a) {
|
|
180
|
+
(0, utils_1.methodNotSupportedOnWeb)('trackCustomPaywallImpression');
|
|
181
|
+
return [2 /*return*/];
|
|
182
|
+
});
|
|
183
|
+
}); },
|
|
178
184
|
getCustomerInfo: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
185
|
var customerInfo;
|
|
180
186
|
return __generator(this, function (_a) {
|
|
@@ -505,6 +511,12 @@ exports.browserNativeModuleRNPurchases = {
|
|
|
505
511
|
return [2 /*return*/];
|
|
506
512
|
});
|
|
507
513
|
}); },
|
|
514
|
+
setAppsFlyerConversionData: function (_data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
515
|
+
return __generator(this, function (_a) {
|
|
516
|
+
(0, utils_1.methodNotSupportedOnWeb)('setAppsFlyerConversionData');
|
|
517
|
+
return [2 /*return*/];
|
|
518
|
+
});
|
|
519
|
+
}); },
|
|
508
520
|
overridePreferredLocale: function (_locale) { return __awaiter(void 0, void 0, void 0, function () {
|
|
509
521
|
return __generator(this, function (_a) {
|
|
510
522
|
(0, utils_1.methodNotSupportedOnWeb)('overridePreferredLocale');
|
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, STORE_REPLACEMENT_MODE, StoreProductChangeInfo } 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 as BasePurchasesConfiguration, 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
|
*/
|
|
@@ -8,15 +8,36 @@ export interface SyncPurchasesResult {
|
|
|
8
8
|
*/
|
|
9
9
|
customerInfo: CustomerInfo;
|
|
10
10
|
}
|
|
11
|
-
export { PURCHASE_TYPE, PurchasesAreCompletedBy, PurchasesAreCompletedByMyApp, PURCHASES_ARE_COMPLETED_BY_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, STOREKIT_VERSION,
|
|
11
|
+
export { PURCHASE_TYPE, PurchasesAreCompletedBy, PurchasesAreCompletedByMyApp, PURCHASES_ARE_COMPLETED_BY_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, STOREKIT_VERSION, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult, WebPurchaseRedemption, WebPurchaseRedemptionResult, WebPurchaseRedemptionResultType, } from "@revenuecat/purchases-typescript-internal";
|
|
12
|
+
export interface ConfigurationsByStore {
|
|
13
|
+
PLAY_STORE: {};
|
|
14
|
+
}
|
|
15
|
+
interface BaseConfiguration extends BasePurchasesConfiguration {
|
|
16
|
+
}
|
|
17
|
+
export type PurchasesConfiguration = {
|
|
18
|
+
[S in keyof ConfigurationsByStore]: BaseConfiguration & ConfigurationsByStore[S] & (S extends "PLAY_STORE" ? {
|
|
19
|
+
store?: S;
|
|
20
|
+
} : {
|
|
21
|
+
store: S;
|
|
22
|
+
});
|
|
23
|
+
}[keyof ConfigurationsByStore];
|
|
12
24
|
/**
|
|
13
25
|
* Options for tracking a custom paywall impression.
|
|
14
26
|
*/
|
|
15
27
|
export interface TrackCustomPaywallImpressionOptions {
|
|
16
28
|
paywallId?: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* The offering associated with the custom paywall.
|
|
31
|
+
*
|
|
32
|
+
* Prefer passing the offering object when available so RevenueCat can track placement
|
|
33
|
+
* and targeting context for placement-resolved offerings.
|
|
34
|
+
*/
|
|
35
|
+
offering?: PurchasesOffering | null;
|
|
17
36
|
/**
|
|
18
37
|
* An optional identifier for the offering associated with the custom paywall.
|
|
19
38
|
* If not provided, the SDK will use the current offering identifier from the cache.
|
|
39
|
+
*
|
|
40
|
+
* @deprecated Prefer passing `offering` when available.
|
|
20
41
|
*/
|
|
21
42
|
offeringId?: string | null;
|
|
22
43
|
}
|
|
@@ -219,7 +240,7 @@ export default class Purchases {
|
|
|
219
240
|
*
|
|
220
241
|
* @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
|
|
221
242
|
*/
|
|
222
|
-
static configure(
|
|
243
|
+
static configure(configuration: PurchasesConfiguration): void;
|
|
223
244
|
/**
|
|
224
245
|
* @deprecated, configure behavior through the RevenueCat dashboard (app.revenuecat.com) instead.
|
|
225
246
|
* If an user tries to purchase a product that is active on the current app store account,
|
|
@@ -827,6 +848,25 @@ export default class Purchases {
|
|
|
827
848
|
* setting the creative subscriber attribute.
|
|
828
849
|
*/
|
|
829
850
|
static setCreative(creative: string | null): Promise<void>;
|
|
851
|
+
/**
|
|
852
|
+
* Sets conversion data from AppsFlyer's onInstallConversionData callback. This extracts the
|
|
853
|
+
* relevant attribution fields from the AppsFlyer conversion data and sets the corresponding
|
|
854
|
+
* RevenueCat subscriber attributes ($mediaSource, $campaign, $adGroup, $ad, $keyword, $creative).
|
|
855
|
+
* Note that this method will never unset any attributes.
|
|
856
|
+
*
|
|
857
|
+
* Pass the object received in AppsFlyer's onInstallConversionData listener directly; the nested
|
|
858
|
+
* `data` field holds the conversion data that is forwarded to RevenueCat. The data is only
|
|
859
|
+
* forwarded when `status` is `"success"`; otherwise it is ignored.
|
|
860
|
+
*
|
|
861
|
+
* @param conversionData The object from AppsFlyer's onInstallConversionData callback.
|
|
862
|
+
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet.
|
|
863
|
+
*/
|
|
864
|
+
static setAppsFlyerConversionData(conversionData: {
|
|
865
|
+
status: string;
|
|
866
|
+
data: {
|
|
867
|
+
[key: string]: any;
|
|
868
|
+
};
|
|
869
|
+
}): Promise<void>;
|
|
830
870
|
/**
|
|
831
871
|
* Overrides the preferred UI locale used by RevenueCat UI components.
|
|
832
872
|
* Pass null to clear the override and use the device's locale.
|
|
@@ -961,8 +1001,10 @@ export default class Purchases {
|
|
|
961
1001
|
*
|
|
962
1002
|
* @param params - Optional parameters for the impression event.
|
|
963
1003
|
* @param params.paywallId - Optional identifier for the custom paywall being shown.
|
|
964
|
-
* @param params.
|
|
965
|
-
*
|
|
1004
|
+
* @param params.offering - Optional offering associated with the custom paywall.
|
|
1005
|
+
* @param params.offeringId - Deprecated. Prefer passing `offering` when available.
|
|
1006
|
+
* Optional identifier for the offering associated with the custom paywall. If not provided,
|
|
1007
|
+
* the SDK will use the current offering identifier from the cache.
|
|
966
1008
|
*/
|
|
967
1009
|
static trackCustomPaywallImpression(params?: TrackCustomPaywallImpressionOptions): Promise<void>;
|
|
968
1010
|
private static throwIfAndroidPlatform;
|
package/dist/purchases.js
CHANGED
|
@@ -171,8 +171,9 @@ var Purchases = /** @class */ (function () {
|
|
|
171
171
|
*
|
|
172
172
|
* @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
|
|
173
173
|
*/
|
|
174
|
-
Purchases.configure = function (
|
|
175
|
-
var apiKey =
|
|
174
|
+
Purchases.configure = function (configuration) {
|
|
175
|
+
var apiKey = configuration.apiKey, _a = configuration.appUserID, appUserID = _a === void 0 ? null : _a, _b = configuration.purchasesAreCompletedBy, purchasesAreCompletedBy = _b === void 0 ? purchases_typescript_internal_1.PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT : _b, userDefaultsSuiteName = configuration.userDefaultsSuiteName, _c = configuration.storeKitVersion, storeKitVersion = _c === void 0 ? purchases_typescript_internal_1.STOREKIT_VERSION.DEFAULT : _c, _d = configuration.useAmazon, useAmazon = _d === void 0 ? false : _d, _e = configuration.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _e === void 0 ? true : _e, _f = configuration.entitlementVerificationMode, entitlementVerificationMode = _f === void 0 ? purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE.DISABLED : _f, _g = configuration.pendingTransactionsForPrepaidPlansEnabled, pendingTransactionsForPrepaidPlansEnabled = _g === void 0 ? false : _g, _h = configuration.diagnosticsEnabled, diagnosticsEnabled = _h === void 0 ? false : _h, _j = configuration.automaticDeviceIdentifierCollectionEnabled, automaticDeviceIdentifierCollectionEnabled = _j === void 0 ? true : _j, preferredUILocaleOverride = configuration.preferredUILocaleOverride;
|
|
176
|
+
var _k = configuration, store = _k.store, galaxyBillingMode = _k.galaxyBillingMode;
|
|
176
177
|
throwIfNativeModuleNotAvailable();
|
|
177
178
|
if (!customLogHandler) {
|
|
178
179
|
this.setLogHandler(function (logLevel, message) {
|
|
@@ -225,7 +226,7 @@ var Purchases = /** @class */ (function () {
|
|
|
225
226
|
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.");
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
|
-
RNPurchases.setupPurchases(apiKey, appUserID, purchasesCompletedByToUse, userDefaultsSuiteName, storeKitVersionToUse, useAmazon, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled, automaticDeviceIdentifierCollectionEnabled, preferredUILocaleOverride);
|
|
229
|
+
RNPurchases.setupPurchases(apiKey, appUserID, purchasesCompletedByToUse, userDefaultsSuiteName, storeKitVersionToUse, useAmazon, store, galaxyBillingMode, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled, automaticDeviceIdentifierCollectionEnabled, preferredUILocaleOverride);
|
|
229
230
|
};
|
|
230
231
|
/**
|
|
231
232
|
* @deprecated, configure behavior through the RevenueCat dashboard (app.revenuecat.com) instead.
|
|
@@ -1710,6 +1711,39 @@ var Purchases = /** @class */ (function () {
|
|
|
1710
1711
|
});
|
|
1711
1712
|
});
|
|
1712
1713
|
};
|
|
1714
|
+
/**
|
|
1715
|
+
* Sets conversion data from AppsFlyer's onInstallConversionData callback. This extracts the
|
|
1716
|
+
* relevant attribution fields from the AppsFlyer conversion data and sets the corresponding
|
|
1717
|
+
* RevenueCat subscriber attributes ($mediaSource, $campaign, $adGroup, $ad, $keyword, $creative).
|
|
1718
|
+
* Note that this method will never unset any attributes.
|
|
1719
|
+
*
|
|
1720
|
+
* Pass the object received in AppsFlyer's onInstallConversionData listener directly; the nested
|
|
1721
|
+
* `data` field holds the conversion data that is forwarded to RevenueCat. The data is only
|
|
1722
|
+
* forwarded when `status` is `"success"`; otherwise it is ignored.
|
|
1723
|
+
*
|
|
1724
|
+
* @param conversionData The object from AppsFlyer's onInstallConversionData callback.
|
|
1725
|
+
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet.
|
|
1726
|
+
*/
|
|
1727
|
+
Purchases.setAppsFlyerConversionData = function (conversionData) {
|
|
1728
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1729
|
+
var _a;
|
|
1730
|
+
return __generator(this, function (_b) {
|
|
1731
|
+
switch (_b.label) {
|
|
1732
|
+
case 0: return [4 /*yield*/, throwIfNotConfigured()];
|
|
1733
|
+
case 1:
|
|
1734
|
+
_b.sent();
|
|
1735
|
+
if ((conversionData === null || conversionData === void 0 ? void 0 : conversionData.status) !== 'success') {
|
|
1736
|
+
// tslint:disable-next-line:no-console
|
|
1737
|
+
console.warn("[RevenueCat] Ignoring AppsFlyer conversion data with status \"".concat(conversionData === null || conversionData === void 0 ? void 0 : conversionData.status, "\". ") +
|
|
1738
|
+
"Conversion data is only forwarded when status is \"success\".");
|
|
1739
|
+
return [2 /*return*/];
|
|
1740
|
+
}
|
|
1741
|
+
RNPurchases.setAppsFlyerConversionData((_a = conversionData.data) !== null && _a !== void 0 ? _a : null);
|
|
1742
|
+
return [2 /*return*/];
|
|
1743
|
+
}
|
|
1744
|
+
});
|
|
1745
|
+
});
|
|
1746
|
+
};
|
|
1713
1747
|
/**
|
|
1714
1748
|
* Overrides the preferred UI locale used by RevenueCat UI components.
|
|
1715
1749
|
* Pass null to clear the override and use the device's locale.
|
|
@@ -2030,17 +2064,28 @@ var Purchases = /** @class */ (function () {
|
|
|
2030
2064
|
*
|
|
2031
2065
|
* @param params - Optional parameters for the impression event.
|
|
2032
2066
|
* @param params.paywallId - Optional identifier for the custom paywall being shown.
|
|
2033
|
-
* @param params.
|
|
2034
|
-
*
|
|
2067
|
+
* @param params.offering - Optional offering associated with the custom paywall.
|
|
2068
|
+
* @param params.offeringId - Deprecated. Prefer passing `offering` when available.
|
|
2069
|
+
* Optional identifier for the offering associated with the custom paywall. If not provided,
|
|
2070
|
+
* the SDK will use the current offering identifier from the cache.
|
|
2035
2071
|
*/
|
|
2036
2072
|
Purchases.trackCustomPaywallImpression = function (params) {
|
|
2037
2073
|
return __awaiter(this, void 0, void 0, function () {
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2074
|
+
var options, presentedOfferingContext, offeringId;
|
|
2075
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2076
|
+
return __generator(this, function (_g) {
|
|
2077
|
+
switch (_g.label) {
|
|
2078
|
+
case 0: return [4 /*yield*/, throwIfNotConfigured()];
|
|
2079
|
+
case 1:
|
|
2080
|
+
_g.sent();
|
|
2081
|
+
options = params !== null && params !== void 0 ? params : {};
|
|
2082
|
+
presentedOfferingContext = (_c = (_b = (_a = options.offering) === null || _a === void 0 ? void 0 : _a.availablePackages) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.presentedOfferingContext;
|
|
2083
|
+
offeringId = (_e = (_d = options.offering) === null || _d === void 0 ? void 0 : _d.identifier) !== null && _e !== void 0 ? _e : options.offeringId;
|
|
2084
|
+
RNPurchases.trackCustomPaywallImpression({
|
|
2085
|
+
paywallId: (_f = options.paywallId) !== null && _f !== void 0 ? _f : null,
|
|
2086
|
+
offeringId: offeringId !== null && offeringId !== void 0 ? offeringId : null,
|
|
2087
|
+
presentedOfferingContext: presentedOfferingContext !== null && presentedOfferingContext !== void 0 ? presentedOfferingContext : null,
|
|
2088
|
+
});
|
|
2044
2089
|
return [2 /*return*/];
|
|
2045
2090
|
}
|
|
2046
2091
|
});
|
package/ios/RNPurchases.m
CHANGED
|
@@ -82,6 +82,8 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
|
|
|
82
82
|
userDefaultsSuiteName:(nullable NSString *)userDefaultsSuiteName
|
|
83
83
|
storeKitVersion:(nullable NSString *)storeKitVersion
|
|
84
84
|
useAmazon:(BOOL)useAmazon
|
|
85
|
+
store:(nullable NSString *)store
|
|
86
|
+
galaxyBillingMode:(nullable NSString *)galaxyBillingMode
|
|
85
87
|
shouldShowInAppMessagesAutomatically:(BOOL)shouldShowInAppMessagesAutomatically
|
|
86
88
|
entitlementVerificationMode:(nullable NSString *)entitlementVerificationMode
|
|
87
89
|
pendingTransactionsForPrepaidPlansEnabled:(BOOL)pendingTransactionsForPrepaidPlansEnabled
|
|
@@ -473,6 +475,10 @@ RCT_EXPORT_METHOD(setCreative:(NSString *)creative) {
|
|
|
473
475
|
[RCCommonFunctionality setCreative:creative.mappingNSNullToNil];
|
|
474
476
|
}
|
|
475
477
|
|
|
478
|
+
RCT_EXPORT_METHOD(setAppsFlyerConversionData:(NSDictionary *)data) {
|
|
479
|
+
[RCCommonFunctionality setAppsFlyerConversionData:data.mappingNSNullToNil];
|
|
480
|
+
}
|
|
481
|
+
|
|
476
482
|
RCT_EXPORT_METHOD(overridePreferredLocale:(nullable NSString *)locale) {
|
|
477
483
|
[RCCommonFunctionality overridePreferredLocale:locale.mappingNSNullToNil];
|
|
478
484
|
}
|
|
@@ -650,7 +656,8 @@ RCT_EXPORT_METHOD(recordPurchaseForProductID:(nonnull NSString *)productID
|
|
|
650
656
|
|
|
651
657
|
RCT_EXPORT_METHOD(trackCustomPaywallImpression:(NSDictionary *)data) {
|
|
652
658
|
if (@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)) {
|
|
653
|
-
|
|
659
|
+
NSDictionary *eventData = data.mappingNSNullToNil ?: @{};
|
|
660
|
+
[RCCommonFunctionality trackCustomPaywallImpression:eventData];
|
|
654
661
|
} else {
|
|
655
662
|
NSLog(@"[Purchases] Warning: tried to call trackCustomPaywallImpression, but it's only available on iOS 15.0 or greater.");
|
|
656
663
|
}
|
|
@@ -758,7 +765,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
|
|
|
758
765
|
}
|
|
759
766
|
|
|
760
767
|
- (NSString *)platformFlavorVersion {
|
|
761
|
-
return @"10.
|
|
768
|
+
return @"10.4.0";
|
|
762
769
|
}
|
|
763
770
|
|
|
764
771
|
@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": "10.
|
|
4
|
+
"version": "10.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",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"!**/*.iml",
|
|
29
29
|
"!**/.DS_Store",
|
|
30
30
|
"!**/.gitignore",
|
|
31
|
+
"!react-native-purchases-store-galaxy",
|
|
31
32
|
"!react-native-purchases-ui",
|
|
32
33
|
"!scripts/docs/index.html",
|
|
33
34
|
"!scripts/setupJest.js"
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
},
|
|
47
48
|
"workspaces": [
|
|
48
49
|
"examples/purchaseTesterTypescript",
|
|
50
|
+
"react-native-purchases-store-galaxy",
|
|
49
51
|
"react-native-purchases-ui",
|
|
50
52
|
"e2e-tests/MaestroTestApp"
|
|
51
53
|
],
|
|
@@ -103,6 +105,7 @@
|
|
|
103
105
|
"preset": "react-native",
|
|
104
106
|
"modulePathIgnorePatterns": [
|
|
105
107
|
"<rootDir>/examples/purchaseTesterTypescript/",
|
|
108
|
+
"<rootDir>/react-native-purchases-store-galaxy/",
|
|
106
109
|
"<rootDir>/react-native-purchases-ui/",
|
|
107
110
|
"<rootDir>/dir/"
|
|
108
111
|
],
|
|
@@ -115,7 +118,7 @@
|
|
|
115
118
|
]
|
|
116
119
|
},
|
|
117
120
|
"dependencies": {
|
|
118
|
-
"@revenuecat/purchases-js-hybrid-mappings": "18.
|
|
119
|
-
"@revenuecat/purchases-typescript-internal": "18.
|
|
121
|
+
"@revenuecat/purchases-js-hybrid-mappings": "18.15.1",
|
|
122
|
+
"@revenuecat/purchases-typescript-internal": "18.15.1"
|
|
120
123
|
}
|
|
121
124
|
}
|