react-native-purchases 8.11.10 → 9.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/README.md +2 -1
- package/RNPurchases.podspec +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +24 -1
- package/dist/preview/nativeModule.d.ts +54 -51
- package/dist/preview/nativeModule.js +87 -59
- package/dist/purchases.d.ts +28 -1
- package/dist/purchases.js +68 -0
- package/dist/utils/environment.d.ts +2 -2
- package/dist/utils/environment.js +17 -5
- package/ios/RNPurchases.m +19 -1
- package/package.json +16 -5
package/README.md
CHANGED
|
@@ -44,7 +44,8 @@ Or view our React Native sample app:
|
|
|
44
44
|
|
|
45
45
|
## Requirements
|
|
46
46
|
|
|
47
|
-
The minimum React Native version this SDK requires is `0.
|
|
47
|
+
The minimum React Native version this SDK requires is `0.73.0`.
|
|
48
|
+
In Android, minimum Kotlin version is `1.8.0`.
|
|
48
49
|
|
|
49
50
|
## SDK Reference
|
|
50
51
|
Our full SDK reference [can be found here](https://revenuecat.github.io/react-native-purchases-docs/).
|
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 '
|
|
32
|
+
versionName '9.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:
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:16.0.2'
|
|
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 = "
|
|
50
|
+
public static final String PLUGIN_VERSION = "9.1.0";
|
|
51
51
|
|
|
52
52
|
private final ReactApplicationContext reactContext;
|
|
53
53
|
|
|
@@ -338,6 +338,29 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
338
338
|
promise.resolve(Purchases.isConfigured());
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
//================================================================================
|
|
342
|
+
// Virtual Currencies
|
|
343
|
+
//================================================================================
|
|
344
|
+
@ReactMethod
|
|
345
|
+
public void getVirtualCurrencies(final Promise promise) {
|
|
346
|
+
CommonKt.getVirtualCurrencies(getOnResult(promise));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
@ReactMethod
|
|
350
|
+
public void invalidateVirtualCurrenciesCache() {
|
|
351
|
+
CommonKt.invalidateVirtualCurrenciesCache();
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
@ReactMethod
|
|
355
|
+
public void getCachedVirtualCurrencies(final Promise promise) {
|
|
356
|
+
Map<String, ?> cachedVirtualCurrencies = CommonKt.getCachedVirtualCurrencies();
|
|
357
|
+
if (cachedVirtualCurrencies == null) {
|
|
358
|
+
promise.resolve(null);
|
|
359
|
+
} else {
|
|
360
|
+
promise.resolve(convertMapToWriteableMap(cachedVirtualCurrencies));
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
341
364
|
//================================================================================
|
|
342
365
|
// Subscriber Attributes
|
|
343
366
|
//================================================================================
|
|
@@ -1,82 +1,85 @@
|
|
|
1
|
-
import { CustomerInfo,
|
|
1
|
+
import { CustomerInfo, MakePurchaseResult, PurchasesStoreTransaction, WebPurchaseRedemptionResultType, PurchasesStoreProduct, PurchasesOffering, PurchasesOfferings, PurchasesVirtualCurrencies } from '@revenuecat/purchases-typescript-internal';
|
|
2
2
|
/**
|
|
3
3
|
* Preview implementation of the native module for Preview API mode, i.e. for environments where native modules are not available
|
|
4
4
|
* (like Expo Go).
|
|
5
5
|
*/
|
|
6
6
|
export declare const previewNativeModuleRNPurchases: {
|
|
7
|
-
setupPurchases: () => Promise<null>;
|
|
8
|
-
setAllowSharingStoreAccount: () => Promise<
|
|
9
|
-
setSimulatesAskToBuyInSandbox: () => Promise<
|
|
7
|
+
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<null>;
|
|
8
|
+
setAllowSharingStoreAccount: (_allowSharing: boolean) => Promise<void>;
|
|
9
|
+
setSimulatesAskToBuyInSandbox: (_simulatesAskToBuyInSandbox: boolean) => Promise<void>;
|
|
10
10
|
getOfferings: () => Promise<PurchasesOfferings>;
|
|
11
|
-
getCurrentOfferingForPlacement: () => Promise<PurchasesOffering>;
|
|
11
|
+
getCurrentOfferingForPlacement: (_placementIdentifier: string) => Promise<PurchasesOffering>;
|
|
12
12
|
syncAttributesAndOfferingsIfNeeded: () => Promise<PurchasesOfferings>;
|
|
13
|
-
getProductInfo: () => Promise<PurchasesStoreProduct[]>;
|
|
13
|
+
getProductInfo: (_productIdentifiers: string[], _type: string) => Promise<PurchasesStoreProduct[]>;
|
|
14
14
|
restorePurchases: () => Promise<CustomerInfo>;
|
|
15
15
|
getAppUserID: () => Promise<string>;
|
|
16
16
|
getStorefront: () => Promise<string>;
|
|
17
|
-
setDebugLogsEnabled: () => Promise<
|
|
18
|
-
setLogLevel: () => Promise<
|
|
17
|
+
setDebugLogsEnabled: (_enabled: boolean) => Promise<void>;
|
|
18
|
+
setLogLevel: (_level: string) => Promise<void>;
|
|
19
19
|
setLogHandler: () => Promise<null>;
|
|
20
20
|
getCustomerInfo: () => Promise<CustomerInfo>;
|
|
21
|
-
logIn: () => Promise<{
|
|
21
|
+
logIn: (_appUserID: string) => Promise<{
|
|
22
22
|
customerInfo: CustomerInfo;
|
|
23
23
|
created: boolean;
|
|
24
24
|
}>;
|
|
25
25
|
logOut: () => Promise<CustomerInfo>;
|
|
26
26
|
syncPurchases: () => Promise<void>;
|
|
27
|
-
syncAmazonPurchase: () => Promise<void>;
|
|
28
|
-
syncObserverModeAmazonPurchase: () => Promise<void>;
|
|
29
|
-
recordPurchaseForProductID: () => Promise<PurchasesStoreTransaction>;
|
|
27
|
+
syncAmazonPurchase: (_productID: string, _receiptID: string, _amazonUserID: string, _isoCurrencyCode: string | null, _price: number | null) => Promise<void>;
|
|
28
|
+
syncObserverModeAmazonPurchase: (_productID: string, _receiptID: string, _amazonUserID: string, _isoCurrencyCode: string | null, _price: number | null) => Promise<void>;
|
|
29
|
+
recordPurchaseForProductID: (_productID: string) => Promise<PurchasesStoreTransaction>;
|
|
30
30
|
enableAdServicesAttributionTokenCollection: () => Promise<void>;
|
|
31
|
-
purchaseProduct: () => Promise<MakePurchaseResult>;
|
|
32
|
-
purchasePackage: () => Promise<MakePurchaseResult>;
|
|
33
|
-
purchaseSubscriptionOption: () => Promise<
|
|
31
|
+
purchaseProduct: (_productIdentifier: string, _googleProductChangeInfo: any, _type: string, _discountTimestamp: string | null, _googleInfo: any, _presentedOfferingContext: any) => Promise<MakePurchaseResult>;
|
|
32
|
+
purchasePackage: (_packageIdentifier: string, _presentedOfferingContext: any, _googleProductChangeInfo: any, _discountTimestamp: string | null, _googleInfo: any) => Promise<MakePurchaseResult>;
|
|
33
|
+
purchaseSubscriptionOption: (_productIdentifier: string, _optionIdentifier: string, _upgradeInfo: any, _discountTimestamp: string | null, _googleInfo: any, _presentedOfferingContext: any) => Promise<MakePurchaseResult>;
|
|
34
34
|
isAnonymous: () => Promise<boolean>;
|
|
35
|
-
makeDeferredPurchase: () => Promise<
|
|
36
|
-
checkTrialOrIntroductoryPriceEligibility: () => Promise<{
|
|
37
|
-
|
|
35
|
+
makeDeferredPurchase: (_callbackID: number) => Promise<void>;
|
|
36
|
+
checkTrialOrIntroductoryPriceEligibility: (productIDs: string[]) => Promise<{
|
|
37
|
+
[productId: string]: any;
|
|
38
38
|
}>;
|
|
39
|
-
getPromotionalOffer: () => Promise<undefined>;
|
|
40
|
-
eligibleWinBackOffersForProductIdentifier: () => Promise<never[]>;
|
|
41
|
-
purchaseProductWithWinBackOffer: () => Promise<MakePurchaseResult>;
|
|
42
|
-
purchasePackageWithWinBackOffer: () => Promise<MakePurchaseResult>;
|
|
39
|
+
getPromotionalOffer: (_productIdentifier: string, _discount: any) => Promise<undefined>;
|
|
40
|
+
eligibleWinBackOffersForProductIdentifier: (_productID: string) => Promise<never[]>;
|
|
41
|
+
purchaseProductWithWinBackOffer: (_productID: string, _winBackOfferID: string) => Promise<MakePurchaseResult>;
|
|
42
|
+
purchasePackageWithWinBackOffer: (_packageID: string, _winBackOfferID: string) => Promise<MakePurchaseResult>;
|
|
43
43
|
invalidateCustomerInfoCache: () => Promise<void>;
|
|
44
44
|
presentCodeRedemptionSheet: () => Promise<void>;
|
|
45
|
-
setAttributes: () => Promise<void>;
|
|
46
|
-
setEmail: () => Promise<void>;
|
|
47
|
-
setPhoneNumber: () => Promise<void>;
|
|
48
|
-
setDisplayName: () => Promise<void>;
|
|
49
|
-
setPushToken: () => Promise<void>;
|
|
50
|
-
setProxyURLString: () => Promise<void>;
|
|
45
|
+
setAttributes: (_attributes: any) => Promise<void>;
|
|
46
|
+
setEmail: (_email: string) => Promise<void>;
|
|
47
|
+
setPhoneNumber: (_phoneNumber: string) => Promise<void>;
|
|
48
|
+
setDisplayName: (_displayName: string) => Promise<void>;
|
|
49
|
+
setPushToken: (_pushToken: string) => Promise<void>;
|
|
50
|
+
setProxyURLString: (_proxyURLString: string) => Promise<void>;
|
|
51
51
|
collectDeviceIdentifiers: () => Promise<void>;
|
|
52
|
-
setAdjustID: () => Promise<void>;
|
|
53
|
-
setAppsflyerID: () => Promise<void>;
|
|
54
|
-
setFBAnonymousID: () => Promise<void>;
|
|
55
|
-
setMparticleID: () => Promise<void>;
|
|
56
|
-
setCleverTapID: () => Promise<void>;
|
|
57
|
-
setMixpanelDistinctID: () => Promise<void>;
|
|
58
|
-
setFirebaseAppInstanceID: () => Promise<void>;
|
|
59
|
-
setTenjinAnalyticsInstallationID: () => Promise<void>;
|
|
60
|
-
setKochavaDeviceID: () => Promise<void>;
|
|
61
|
-
setOnesignalID: () => Promise<void>;
|
|
62
|
-
setAirshipChannelID: () => Promise<void>;
|
|
63
|
-
setMediaSource: () => Promise<void>;
|
|
52
|
+
setAdjustID: (_adjustID: string) => Promise<void>;
|
|
53
|
+
setAppsflyerID: (_appsflyerID: string) => Promise<void>;
|
|
54
|
+
setFBAnonymousID: (_fbAnonymousID: string) => Promise<void>;
|
|
55
|
+
setMparticleID: (_mparticleID: string) => Promise<void>;
|
|
56
|
+
setCleverTapID: (_cleverTapID: string) => Promise<void>;
|
|
57
|
+
setMixpanelDistinctID: (_mixpanelDistinctID: string) => Promise<void>;
|
|
58
|
+
setFirebaseAppInstanceID: (_firebaseAppInstanceID: string) => Promise<void>;
|
|
59
|
+
setTenjinAnalyticsInstallationID: (_tenjinAnalyticsInstallationID: string) => Promise<void>;
|
|
60
|
+
setKochavaDeviceID: (_kochavaDeviceID: string) => Promise<void>;
|
|
61
|
+
setOnesignalID: (_onesignalID: string) => Promise<void>;
|
|
62
|
+
setAirshipChannelID: (_airshipChannelID: string) => Promise<void>;
|
|
63
|
+
setMediaSource: (_mediaSource: string) => Promise<void>;
|
|
64
64
|
setMediaCampaign: () => Promise<void>;
|
|
65
|
-
setCampaign: () => Promise<void>;
|
|
66
|
-
setAdGroup: () => Promise<void>;
|
|
67
|
-
setAd: () => Promise<void>;
|
|
68
|
-
setKeyword: () => Promise<void>;
|
|
69
|
-
setCreative: () => Promise<void>;
|
|
70
|
-
canMakePayments: () => Promise<boolean>;
|
|
65
|
+
setCampaign: (_campaign: string) => Promise<void>;
|
|
66
|
+
setAdGroup: (_adGroup: string) => Promise<void>;
|
|
67
|
+
setAd: (_ad: string) => Promise<void>;
|
|
68
|
+
setKeyword: (_keyword: string) => Promise<void>;
|
|
69
|
+
setCreative: (_creative: string) => Promise<void>;
|
|
70
|
+
canMakePayments: (_features: any[]) => Promise<boolean>;
|
|
71
71
|
beginRefundRequestForActiveEntitlement: () => Promise<number>;
|
|
72
|
-
beginRefundRequestForEntitlementId: () => Promise<number>;
|
|
73
|
-
beginRefundRequestForProductId: () => Promise<number>;
|
|
72
|
+
beginRefundRequestForEntitlementId: (_entitlementIdentifier: string) => Promise<number>;
|
|
73
|
+
beginRefundRequestForProductId: (_productIdentifier: string) => Promise<number>;
|
|
74
74
|
showManageSubscriptions: () => Promise<void>;
|
|
75
|
-
showInAppMessages: () => Promise<void>;
|
|
76
|
-
isWebPurchaseRedemptionURL: () => Promise<
|
|
75
|
+
showInAppMessages: (_messageTypes: any[]) => Promise<void>;
|
|
76
|
+
isWebPurchaseRedemptionURL: (_urlString: string) => Promise<boolean>;
|
|
77
77
|
isConfigured: () => Promise<boolean>;
|
|
78
|
-
redeemWebPurchase: () => Promise<{
|
|
78
|
+
redeemWebPurchase: (_urlString: string) => Promise<{
|
|
79
79
|
result: WebPurchaseRedemptionResultType;
|
|
80
80
|
customerInfo: CustomerInfo;
|
|
81
81
|
}>;
|
|
82
|
+
getVirtualCurrencies: () => Promise<PurchasesVirtualCurrencies>;
|
|
83
|
+
invalidateVirtualCurrenciesCache: () => Promise<void>;
|
|
84
|
+
getCachedVirtualCurrencies: () => Promise<PurchasesVirtualCurrencies>;
|
|
82
85
|
};
|
|
@@ -125,24 +125,28 @@ var previewOfferings = {
|
|
|
125
125
|
},
|
|
126
126
|
current: previewOffering
|
|
127
127
|
};
|
|
128
|
+
var previewVirtualCurrencies = {
|
|
129
|
+
all: {}
|
|
130
|
+
};
|
|
128
131
|
/**
|
|
129
132
|
* Preview implementation of the native module for Preview API mode, i.e. for environments where native modules are not available
|
|
130
133
|
* (like Expo Go).
|
|
131
134
|
*/
|
|
132
135
|
exports.previewNativeModuleRNPurchases = {
|
|
133
|
-
setupPurchases: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
136
|
+
setupPurchases: function (apiKey, _appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled) { return __awaiter(void 0, void 0, void 0, function () {
|
|
134
137
|
return __generator(this, function (_a) {
|
|
138
|
+
console.log('[RevenueCat] Preview mode: setupPurchases called with apiKey:', apiKey);
|
|
135
139
|
return [2 /*return*/, null];
|
|
136
140
|
});
|
|
137
141
|
}); },
|
|
138
|
-
setAllowSharingStoreAccount: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
142
|
+
setAllowSharingStoreAccount: function (_allowSharing) { return __awaiter(void 0, void 0, void 0, function () {
|
|
139
143
|
return __generator(this, function (_a) {
|
|
140
|
-
return [2 /*return
|
|
144
|
+
return [2 /*return*/];
|
|
141
145
|
});
|
|
142
146
|
}); },
|
|
143
|
-
setSimulatesAskToBuyInSandbox: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
|
+
setSimulatesAskToBuyInSandbox: function (_simulatesAskToBuyInSandbox) { return __awaiter(void 0, void 0, void 0, function () {
|
|
144
148
|
return __generator(this, function (_a) {
|
|
145
|
-
return [2 /*return
|
|
149
|
+
return [2 /*return*/];
|
|
146
150
|
});
|
|
147
151
|
}); },
|
|
148
152
|
getOfferings: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -150,7 +154,7 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
150
154
|
return [2 /*return*/, previewOfferings];
|
|
151
155
|
});
|
|
152
156
|
}); },
|
|
153
|
-
getCurrentOfferingForPlacement: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
+
getCurrentOfferingForPlacement: function (_placementIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
158
|
return __generator(this, function (_a) {
|
|
155
159
|
return [2 /*return*/, previewOffering];
|
|
156
160
|
});
|
|
@@ -160,8 +164,9 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
160
164
|
return [2 /*return*/, previewOfferings];
|
|
161
165
|
});
|
|
162
166
|
}); },
|
|
163
|
-
getProductInfo: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
167
|
+
getProductInfo: function (_productIdentifiers, _type) { return __awaiter(void 0, void 0, void 0, function () {
|
|
164
168
|
return __generator(this, function (_a) {
|
|
169
|
+
// In preview mode, return the preview product for any requested product identifiers
|
|
165
170
|
return [2 /*return*/, [previewStoreProduct]];
|
|
166
171
|
});
|
|
167
172
|
}); },
|
|
@@ -180,14 +185,14 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
180
185
|
return [2 /*return*/, 'preview-storefront'];
|
|
181
186
|
});
|
|
182
187
|
}); },
|
|
183
|
-
setDebugLogsEnabled: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
188
|
+
setDebugLogsEnabled: function (_enabled) { return __awaiter(void 0, void 0, void 0, function () {
|
|
184
189
|
return __generator(this, function (_a) {
|
|
185
|
-
return [2 /*return
|
|
190
|
+
return [2 /*return*/];
|
|
186
191
|
});
|
|
187
192
|
}); },
|
|
188
|
-
setLogLevel: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
193
|
+
setLogLevel: function (_level) { return __awaiter(void 0, void 0, void 0, function () {
|
|
189
194
|
return __generator(this, function (_a) {
|
|
190
|
-
return [2 /*return
|
|
195
|
+
return [2 /*return*/];
|
|
191
196
|
});
|
|
192
197
|
}); },
|
|
193
198
|
setLogHandler: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -200,7 +205,7 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
200
205
|
return [2 /*return*/, previewCustomerInfo];
|
|
201
206
|
});
|
|
202
207
|
}); },
|
|
203
|
-
logIn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
208
|
+
logIn: function (_appUserID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
204
209
|
return __generator(this, function (_a) {
|
|
205
210
|
return [2 /*return*/, {
|
|
206
211
|
customerInfo: previewCustomerInfo,
|
|
@@ -218,17 +223,17 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
218
223
|
return [2 /*return*/];
|
|
219
224
|
});
|
|
220
225
|
}); },
|
|
221
|
-
syncAmazonPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
226
|
+
syncAmazonPurchase: function (_productID, _receiptID, _amazonUserID, _isoCurrencyCode, _price) { return __awaiter(void 0, void 0, void 0, function () {
|
|
222
227
|
return __generator(this, function (_a) {
|
|
223
228
|
return [2 /*return*/];
|
|
224
229
|
});
|
|
225
230
|
}); },
|
|
226
|
-
syncObserverModeAmazonPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
231
|
+
syncObserverModeAmazonPurchase: function (_productID, _receiptID, _amazonUserID, _isoCurrencyCode, _price) { return __awaiter(void 0, void 0, void 0, function () {
|
|
227
232
|
return __generator(this, function (_a) {
|
|
228
233
|
return [2 /*return*/];
|
|
229
234
|
});
|
|
230
235
|
}); },
|
|
231
|
-
recordPurchaseForProductID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
236
|
+
recordPurchaseForProductID: function (_productID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
232
237
|
return __generator(this, function (_a) {
|
|
233
238
|
return [2 /*return*/, previewPurchaseStoreTransaction];
|
|
234
239
|
});
|
|
@@ -238,19 +243,22 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
238
243
|
return [2 /*return*/];
|
|
239
244
|
});
|
|
240
245
|
}); },
|
|
241
|
-
purchaseProduct: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
246
|
+
purchaseProduct: function (_productIdentifier, _googleProductChangeInfo, _type, _discountTimestamp, _googleInfo, _presentedOfferingContext) { return __awaiter(void 0, void 0, void 0, function () {
|
|
242
247
|
return __generator(this, function (_a) {
|
|
248
|
+
// In preview mode, return a successful purchase result
|
|
243
249
|
return [2 /*return*/, previewMakePurchaseResult];
|
|
244
250
|
});
|
|
245
251
|
}); },
|
|
246
|
-
purchasePackage: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
252
|
+
purchasePackage: function (_packageIdentifier, _presentedOfferingContext, _googleProductChangeInfo, _discountTimestamp, _googleInfo) { return __awaiter(void 0, void 0, void 0, function () {
|
|
247
253
|
return __generator(this, function (_a) {
|
|
254
|
+
// In preview mode, return a successful purchase result
|
|
248
255
|
return [2 /*return*/, previewMakePurchaseResult];
|
|
249
256
|
});
|
|
250
257
|
}); },
|
|
251
|
-
purchaseSubscriptionOption: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
258
|
+
purchaseSubscriptionOption: function (_productIdentifier, _optionIdentifier, _upgradeInfo, _discountTimestamp, _googleInfo, _presentedOfferingContext) { return __awaiter(void 0, void 0, void 0, function () {
|
|
252
259
|
return __generator(this, function (_a) {
|
|
253
|
-
return
|
|
260
|
+
// In preview mode, return a successful purchase result
|
|
261
|
+
return [2 /*return*/, previewMakePurchaseResult];
|
|
254
262
|
});
|
|
255
263
|
}); },
|
|
256
264
|
isAnonymous: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -258,34 +266,37 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
258
266
|
return [2 /*return*/, true];
|
|
259
267
|
});
|
|
260
268
|
}); },
|
|
261
|
-
makeDeferredPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
+
makeDeferredPurchase: function (_callbackID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
262
270
|
return __generator(this, function (_a) {
|
|
263
|
-
return [2 /*return
|
|
271
|
+
return [2 /*return*/];
|
|
264
272
|
});
|
|
265
273
|
}); },
|
|
266
|
-
checkTrialOrIntroductoryPriceEligibility: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
274
|
+
checkTrialOrIntroductoryPriceEligibility: function (productIDs) { return __awaiter(void 0, void 0, void 0, function () {
|
|
275
|
+
var result;
|
|
267
276
|
return __generator(this, function (_a) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
277
|
+
result = {};
|
|
278
|
+
productIDs.forEach(function (productId) {
|
|
279
|
+
result[productId] = purchases_typescript_internal_1.INTRO_ELIGIBILITY_STATUS.INTRO_ELIGIBILITY_STATUS_ELIGIBLE;
|
|
280
|
+
});
|
|
281
|
+
return [2 /*return*/, result];
|
|
271
282
|
});
|
|
272
283
|
}); },
|
|
273
|
-
getPromotionalOffer: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
284
|
+
getPromotionalOffer: function (_productIdentifier, _discount) { return __awaiter(void 0, void 0, void 0, function () {
|
|
274
285
|
return __generator(this, function (_a) {
|
|
275
286
|
return [2 /*return*/, undefined];
|
|
276
287
|
});
|
|
277
288
|
}); },
|
|
278
|
-
eligibleWinBackOffersForProductIdentifier: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
289
|
+
eligibleWinBackOffersForProductIdentifier: function (_productID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
279
290
|
return __generator(this, function (_a) {
|
|
280
291
|
return [2 /*return*/, []];
|
|
281
292
|
});
|
|
282
293
|
}); },
|
|
283
|
-
purchaseProductWithWinBackOffer: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
294
|
+
purchaseProductWithWinBackOffer: function (_productID, _winBackOfferID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
284
295
|
return __generator(this, function (_a) {
|
|
285
296
|
return [2 /*return*/, previewMakePurchaseResult];
|
|
286
297
|
});
|
|
287
298
|
}); },
|
|
288
|
-
purchasePackageWithWinBackOffer: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
299
|
+
purchasePackageWithWinBackOffer: function (_packageID, _winBackOfferID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
289
300
|
return __generator(this, function (_a) {
|
|
290
301
|
return [2 /*return*/, previewMakePurchaseResult];
|
|
291
302
|
});
|
|
@@ -300,32 +311,32 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
300
311
|
return [2 /*return*/];
|
|
301
312
|
});
|
|
302
313
|
}); },
|
|
303
|
-
setAttributes: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
314
|
+
setAttributes: function (_attributes) { return __awaiter(void 0, void 0, void 0, function () {
|
|
304
315
|
return __generator(this, function (_a) {
|
|
305
316
|
return [2 /*return*/];
|
|
306
317
|
});
|
|
307
318
|
}); },
|
|
308
|
-
setEmail: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
319
|
+
setEmail: function (_email) { return __awaiter(void 0, void 0, void 0, function () {
|
|
309
320
|
return __generator(this, function (_a) {
|
|
310
321
|
return [2 /*return*/];
|
|
311
322
|
});
|
|
312
323
|
}); },
|
|
313
|
-
setPhoneNumber: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
324
|
+
setPhoneNumber: function (_phoneNumber) { return __awaiter(void 0, void 0, void 0, function () {
|
|
314
325
|
return __generator(this, function (_a) {
|
|
315
326
|
return [2 /*return*/];
|
|
316
327
|
});
|
|
317
328
|
}); },
|
|
318
|
-
setDisplayName: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
329
|
+
setDisplayName: function (_displayName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
319
330
|
return __generator(this, function (_a) {
|
|
320
331
|
return [2 /*return*/];
|
|
321
332
|
});
|
|
322
333
|
}); },
|
|
323
|
-
setPushToken: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
334
|
+
setPushToken: function (_pushToken) { return __awaiter(void 0, void 0, void 0, function () {
|
|
324
335
|
return __generator(this, function (_a) {
|
|
325
336
|
return [2 /*return*/];
|
|
326
337
|
});
|
|
327
338
|
}); },
|
|
328
|
-
setProxyURLString: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
339
|
+
setProxyURLString: function (_proxyURLString) { return __awaiter(void 0, void 0, void 0, function () {
|
|
329
340
|
return __generator(this, function (_a) {
|
|
330
341
|
return [2 /*return*/];
|
|
331
342
|
});
|
|
@@ -335,62 +346,62 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
335
346
|
return [2 /*return*/];
|
|
336
347
|
});
|
|
337
348
|
}); },
|
|
338
|
-
setAdjustID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
349
|
+
setAdjustID: function (_adjustID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
339
350
|
return __generator(this, function (_a) {
|
|
340
351
|
return [2 /*return*/];
|
|
341
352
|
});
|
|
342
353
|
}); },
|
|
343
|
-
setAppsflyerID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
354
|
+
setAppsflyerID: function (_appsflyerID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
344
355
|
return __generator(this, function (_a) {
|
|
345
356
|
return [2 /*return*/];
|
|
346
357
|
});
|
|
347
358
|
}); },
|
|
348
|
-
setFBAnonymousID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
359
|
+
setFBAnonymousID: function (_fbAnonymousID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
349
360
|
return __generator(this, function (_a) {
|
|
350
361
|
return [2 /*return*/];
|
|
351
362
|
});
|
|
352
363
|
}); },
|
|
353
|
-
setMparticleID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
364
|
+
setMparticleID: function (_mparticleID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
354
365
|
return __generator(this, function (_a) {
|
|
355
366
|
return [2 /*return*/];
|
|
356
367
|
});
|
|
357
368
|
}); },
|
|
358
|
-
setCleverTapID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
369
|
+
setCleverTapID: function (_cleverTapID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
359
370
|
return __generator(this, function (_a) {
|
|
360
371
|
return [2 /*return*/];
|
|
361
372
|
});
|
|
362
373
|
}); },
|
|
363
|
-
setMixpanelDistinctID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
374
|
+
setMixpanelDistinctID: function (_mixpanelDistinctID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
364
375
|
return __generator(this, function (_a) {
|
|
365
376
|
return [2 /*return*/];
|
|
366
377
|
});
|
|
367
378
|
}); },
|
|
368
|
-
setFirebaseAppInstanceID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
379
|
+
setFirebaseAppInstanceID: function (_firebaseAppInstanceID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
369
380
|
return __generator(this, function (_a) {
|
|
370
381
|
return [2 /*return*/];
|
|
371
382
|
});
|
|
372
383
|
}); },
|
|
373
|
-
setTenjinAnalyticsInstallationID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
384
|
+
setTenjinAnalyticsInstallationID: function (_tenjinAnalyticsInstallationID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
374
385
|
return __generator(this, function (_a) {
|
|
375
386
|
return [2 /*return*/];
|
|
376
387
|
});
|
|
377
388
|
}); },
|
|
378
|
-
setKochavaDeviceID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
389
|
+
setKochavaDeviceID: function (_kochavaDeviceID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
379
390
|
return __generator(this, function (_a) {
|
|
380
391
|
return [2 /*return*/];
|
|
381
392
|
});
|
|
382
393
|
}); },
|
|
383
|
-
setOnesignalID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
394
|
+
setOnesignalID: function (_onesignalID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
384
395
|
return __generator(this, function (_a) {
|
|
385
396
|
return [2 /*return*/];
|
|
386
397
|
});
|
|
387
398
|
}); },
|
|
388
|
-
setAirshipChannelID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
399
|
+
setAirshipChannelID: function (_airshipChannelID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
389
400
|
return __generator(this, function (_a) {
|
|
390
401
|
return [2 /*return*/];
|
|
391
402
|
});
|
|
392
403
|
}); },
|
|
393
|
-
setMediaSource: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
404
|
+
setMediaSource: function (_mediaSource) { return __awaiter(void 0, void 0, void 0, function () {
|
|
394
405
|
return __generator(this, function (_a) {
|
|
395
406
|
return [2 /*return*/];
|
|
396
407
|
});
|
|
@@ -400,33 +411,34 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
400
411
|
return [2 /*return*/];
|
|
401
412
|
});
|
|
402
413
|
}); },
|
|
403
|
-
setCampaign: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
414
|
+
setCampaign: function (_campaign) { return __awaiter(void 0, void 0, void 0, function () {
|
|
404
415
|
return __generator(this, function (_a) {
|
|
405
416
|
return [2 /*return*/];
|
|
406
417
|
});
|
|
407
418
|
}); },
|
|
408
|
-
setAdGroup: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
419
|
+
setAdGroup: function (_adGroup) { return __awaiter(void 0, void 0, void 0, function () {
|
|
409
420
|
return __generator(this, function (_a) {
|
|
410
421
|
return [2 /*return*/];
|
|
411
422
|
});
|
|
412
423
|
}); },
|
|
413
|
-
setAd: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
424
|
+
setAd: function (_ad) { return __awaiter(void 0, void 0, void 0, function () {
|
|
414
425
|
return __generator(this, function (_a) {
|
|
415
426
|
return [2 /*return*/];
|
|
416
427
|
});
|
|
417
428
|
}); },
|
|
418
|
-
setKeyword: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
429
|
+
setKeyword: function (_keyword) { return __awaiter(void 0, void 0, void 0, function () {
|
|
419
430
|
return __generator(this, function (_a) {
|
|
420
431
|
return [2 /*return*/];
|
|
421
432
|
});
|
|
422
433
|
}); },
|
|
423
|
-
setCreative: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
434
|
+
setCreative: function (_creative) { return __awaiter(void 0, void 0, void 0, function () {
|
|
424
435
|
return __generator(this, function (_a) {
|
|
425
436
|
return [2 /*return*/];
|
|
426
437
|
});
|
|
427
438
|
}); },
|
|
428
|
-
canMakePayments: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
439
|
+
canMakePayments: function (_features) { return __awaiter(void 0, void 0, void 0, function () {
|
|
429
440
|
return __generator(this, function (_a) {
|
|
441
|
+
// In preview mode, return false (no payments can be made)
|
|
430
442
|
return [2 /*return*/, false];
|
|
431
443
|
});
|
|
432
444
|
}); },
|
|
@@ -435,12 +447,12 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
435
447
|
return [2 /*return*/, 0];
|
|
436
448
|
});
|
|
437
449
|
}); },
|
|
438
|
-
beginRefundRequestForEntitlementId: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
450
|
+
beginRefundRequestForEntitlementId: function (_entitlementIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
|
|
439
451
|
return __generator(this, function (_a) {
|
|
440
452
|
return [2 /*return*/, 0];
|
|
441
453
|
});
|
|
442
454
|
}); },
|
|
443
|
-
beginRefundRequestForProductId: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
455
|
+
beginRefundRequestForProductId: function (_productIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
|
|
444
456
|
return __generator(this, function (_a) {
|
|
445
457
|
return [2 /*return*/, 0];
|
|
446
458
|
});
|
|
@@ -450,14 +462,15 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
450
462
|
return [2 /*return*/];
|
|
451
463
|
});
|
|
452
464
|
}); },
|
|
453
|
-
showInAppMessages: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
465
|
+
showInAppMessages: function (_messageTypes) { return __awaiter(void 0, void 0, void 0, function () {
|
|
454
466
|
return __generator(this, function (_a) {
|
|
455
467
|
return [2 /*return*/];
|
|
456
468
|
});
|
|
457
469
|
}); },
|
|
458
|
-
isWebPurchaseRedemptionURL: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
470
|
+
isWebPurchaseRedemptionURL: function (_urlString) { return __awaiter(void 0, void 0, void 0, function () {
|
|
459
471
|
return __generator(this, function (_a) {
|
|
460
|
-
|
|
472
|
+
// In preview mode, we'll return false for any URL
|
|
473
|
+
return [2 /*return*/, false];
|
|
461
474
|
});
|
|
462
475
|
}); },
|
|
463
476
|
isConfigured: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -465,7 +478,7 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
465
478
|
return [2 /*return*/, true];
|
|
466
479
|
});
|
|
467
480
|
}); },
|
|
468
|
-
redeemWebPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
481
|
+
redeemWebPurchase: function (_urlString) { return __awaiter(void 0, void 0, void 0, function () {
|
|
469
482
|
return __generator(this, function (_a) {
|
|
470
483
|
return [2 /*return*/, {
|
|
471
484
|
result: purchases_typescript_internal_1.WebPurchaseRedemptionResultType.SUCCESS,
|
|
@@ -473,4 +486,19 @@ exports.previewNativeModuleRNPurchases = {
|
|
|
473
486
|
}];
|
|
474
487
|
});
|
|
475
488
|
}); },
|
|
489
|
+
getVirtualCurrencies: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
490
|
+
return __generator(this, function (_a) {
|
|
491
|
+
return [2 /*return*/, previewVirtualCurrencies];
|
|
492
|
+
});
|
|
493
|
+
}); },
|
|
494
|
+
invalidateVirtualCurrenciesCache: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
495
|
+
return __generator(this, function (_a) {
|
|
496
|
+
return [2 /*return*/];
|
|
497
|
+
});
|
|
498
|
+
}); },
|
|
499
|
+
getCachedVirtualCurrencies: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
500
|
+
return __generator(this, function (_a) {
|
|
501
|
+
return [2 /*return*/, previewVirtualCurrencies];
|
|
502
|
+
});
|
|
503
|
+
}); }
|
|
476
504
|
};
|
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, 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 } from "@revenuecat/purchases-typescript-internal";
|
|
2
2
|
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, } from "@revenuecat/purchases-typescript-internal";
|
|
3
3
|
export default class Purchases {
|
|
4
4
|
/**
|
|
@@ -780,6 +780,33 @@ export default class Purchases {
|
|
|
780
780
|
* WebPurchaseRedemption parameter is passed or Purchases is not configured.
|
|
781
781
|
*/
|
|
782
782
|
static redeemWebPurchase(webPurchaseRedemption: WebPurchaseRedemption): Promise<WebPurchaseRedemptionResult>;
|
|
783
|
+
/**
|
|
784
|
+
* Fetches the virtual currencies for the current subscriber.
|
|
785
|
+
*
|
|
786
|
+
* @returns {Promise<PurchasesVirtualCurrencies>} A PurchasesVirtualCurrencies object containing the subscriber's virtual currencies.
|
|
787
|
+
* The promise will be rejected if configure has not been called yet or if an error occurs.
|
|
788
|
+
*/
|
|
789
|
+
static getVirtualCurrencies(): Promise<PurchasesVirtualCurrencies>;
|
|
790
|
+
/**
|
|
791
|
+
* Invalidates the cache for virtual currencies.
|
|
792
|
+
*
|
|
793
|
+
* This is useful for cases where a virtual currency's balance might have been updated
|
|
794
|
+
* outside of the app, like if you decreased a user's balance from the user spending a virtual currency,
|
|
795
|
+
* or if you increased the balance from your backend using the server APIs.
|
|
796
|
+
*
|
|
797
|
+
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet or there's an error
|
|
798
|
+
* invalidating the virtual currencies cache.
|
|
799
|
+
*/
|
|
800
|
+
static invalidateVirtualCurrenciesCache(): Promise<void>;
|
|
801
|
+
/**
|
|
802
|
+
* The currently cached [PurchasesVirtualCurrencies] if one is available.
|
|
803
|
+
* This value will remain null until virtual currencies have been fetched at
|
|
804
|
+
* least once with [Purchases.getVirtualCurrencies] or an equivalent function.
|
|
805
|
+
*
|
|
806
|
+
* @returns {Promise<PurchasesVirtualCurrencies | null>} The currently cached virtual currencies for the current subscriber.
|
|
807
|
+
* The promise will be rejected if configure has not been called yet or there's an error.
|
|
808
|
+
*/
|
|
809
|
+
static getCachedVirtualCurrencies(): Promise<PurchasesVirtualCurrencies | null>;
|
|
783
810
|
/**
|
|
784
811
|
* Check if configure has finished and Purchases has been configured.
|
|
785
812
|
*
|
package/dist/purchases.js
CHANGED
|
@@ -1754,6 +1754,74 @@ var Purchases = /** @class */ (function () {
|
|
|
1754
1754
|
});
|
|
1755
1755
|
});
|
|
1756
1756
|
};
|
|
1757
|
+
/**
|
|
1758
|
+
* Fetches the virtual currencies for the current subscriber.
|
|
1759
|
+
*
|
|
1760
|
+
* @returns {Promise<PurchasesVirtualCurrencies>} A PurchasesVirtualCurrencies object containing the subscriber's virtual currencies.
|
|
1761
|
+
* The promise will be rejected if configure has not been called yet or if an error occurs.
|
|
1762
|
+
*/
|
|
1763
|
+
Purchases.getVirtualCurrencies = function () {
|
|
1764
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1765
|
+
return __generator(this, function (_a) {
|
|
1766
|
+
switch (_a.label) {
|
|
1767
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1768
|
+
case 1:
|
|
1769
|
+
_a.sent();
|
|
1770
|
+
Purchases.logWarningIfPreviewAPIMode('getVirtualCurrencies');
|
|
1771
|
+
return [2 /*return*/, RNPurchases.getVirtualCurrencies()];
|
|
1772
|
+
}
|
|
1773
|
+
});
|
|
1774
|
+
});
|
|
1775
|
+
};
|
|
1776
|
+
/**
|
|
1777
|
+
* Invalidates the cache for virtual currencies.
|
|
1778
|
+
*
|
|
1779
|
+
* This is useful for cases where a virtual currency's balance might have been updated
|
|
1780
|
+
* outside of the app, like if you decreased a user's balance from the user spending a virtual currency,
|
|
1781
|
+
* or if you increased the balance from your backend using the server APIs.
|
|
1782
|
+
*
|
|
1783
|
+
* @returns {Promise<void>} The promise will be rejected if configure has not been called yet or there's an error
|
|
1784
|
+
* invalidating the virtual currencies cache.
|
|
1785
|
+
*/
|
|
1786
|
+
Purchases.invalidateVirtualCurrenciesCache = function () {
|
|
1787
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1788
|
+
return __generator(this, function (_a) {
|
|
1789
|
+
switch (_a.label) {
|
|
1790
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1791
|
+
case 1:
|
|
1792
|
+
_a.sent();
|
|
1793
|
+
Purchases.logWarningIfPreviewAPIMode('invalidateVirtualCurrenciesCache');
|
|
1794
|
+
RNPurchases.invalidateVirtualCurrenciesCache();
|
|
1795
|
+
return [2 /*return*/];
|
|
1796
|
+
}
|
|
1797
|
+
});
|
|
1798
|
+
});
|
|
1799
|
+
};
|
|
1800
|
+
/**
|
|
1801
|
+
* The currently cached [PurchasesVirtualCurrencies] if one is available.
|
|
1802
|
+
* This value will remain null until virtual currencies have been fetched at
|
|
1803
|
+
* least once with [Purchases.getVirtualCurrencies] or an equivalent function.
|
|
1804
|
+
*
|
|
1805
|
+
* @returns {Promise<PurchasesVirtualCurrencies | null>} The currently cached virtual currencies for the current subscriber.
|
|
1806
|
+
* The promise will be rejected if configure has not been called yet or there's an error.
|
|
1807
|
+
*/
|
|
1808
|
+
Purchases.getCachedVirtualCurrencies = function () {
|
|
1809
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1810
|
+
var result;
|
|
1811
|
+
return __generator(this, function (_a) {
|
|
1812
|
+
switch (_a.label) {
|
|
1813
|
+
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1814
|
+
case 1:
|
|
1815
|
+
_a.sent();
|
|
1816
|
+
Purchases.logWarningIfPreviewAPIMode('getCachedVirtualCurrencies');
|
|
1817
|
+
return [4 /*yield*/, RNPurchases.getCachedVirtualCurrencies()];
|
|
1818
|
+
case 2:
|
|
1819
|
+
result = _a.sent();
|
|
1820
|
+
return [2 /*return*/, result !== null && result !== void 0 ? result : null];
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
});
|
|
1824
|
+
};
|
|
1757
1825
|
/**
|
|
1758
1826
|
* Check if configure has finished and Purchases has been configured.
|
|
1759
1827
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Detects if the app is running in an environment where native modules are not available
|
|
3
|
-
* (like Expo Go) or if the required native modules are missing.
|
|
3
|
+
* (like Expo Go or Web) or if the required native modules are missing.
|
|
4
4
|
*
|
|
5
5
|
* @returns {boolean} True if the app is running in an environment where native modules are not available
|
|
6
|
-
* (like Expo Go) or if the required native modules are missing.
|
|
6
|
+
* (like Expo Go or Web) or if the required native modules are missing.
|
|
7
7
|
*/
|
|
8
8
|
export declare function shouldUsePreviewAPIMode(): boolean;
|
|
9
9
|
declare global {
|
|
@@ -4,17 +4,23 @@ exports.shouldUsePreviewAPIMode = void 0;
|
|
|
4
4
|
var react_native_1 = require("react-native");
|
|
5
5
|
/**
|
|
6
6
|
* Detects if the app is running in an environment where native modules are not available
|
|
7
|
-
* (like Expo Go) or if the required native modules are missing.
|
|
7
|
+
* (like Expo Go or Web) or if the required native modules are missing.
|
|
8
8
|
*
|
|
9
9
|
* @returns {boolean} True if the app is running in an environment where native modules are not available
|
|
10
|
-
* (like Expo Go) or if the required native modules are missing.
|
|
10
|
+
* (like Expo Go or Web) or if the required native modules are missing.
|
|
11
11
|
*/
|
|
12
12
|
function shouldUsePreviewAPIMode() {
|
|
13
|
-
|
|
14
|
-
if (usePreviewAPIMode) {
|
|
13
|
+
if (isExpoGo()) {
|
|
15
14
|
console.log('Expo Go app detected. Using RevenueCat in Preview API Mode.');
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
else if (isWebPlatform()) {
|
|
18
|
+
console.log('Web platform detected. Using RevenueCat in Preview API Mode.');
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return false;
|
|
16
23
|
}
|
|
17
|
-
return usePreviewAPIMode;
|
|
18
24
|
}
|
|
19
25
|
exports.shouldUsePreviewAPIMode = shouldUsePreviewAPIMode;
|
|
20
26
|
/**
|
|
@@ -27,3 +33,9 @@ function isExpoGo() {
|
|
|
27
33
|
}
|
|
28
34
|
return !!((_b = (_a = globalThis.expo) === null || _a === void 0 ? void 0 : _a.modules) === null || _b === void 0 ? void 0 : _b.ExpoGo);
|
|
29
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Detects if the app is running on web platform
|
|
38
|
+
*/
|
|
39
|
+
function isWebPlatform() {
|
|
40
|
+
return react_native_1.Platform.OS === 'web';
|
|
41
|
+
}
|
package/ios/RNPurchases.m
CHANGED
|
@@ -562,6 +562,24 @@ RCT_EXPORT_METHOD(redeemWebPurchase:(NSString *)urlString
|
|
|
562
562
|
reject:reject]];
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
+
# pragma mark Virtual Currencies
|
|
566
|
+
RCT_EXPORT_METHOD(getVirtualCurrencies:
|
|
567
|
+
(RCTPromiseResolveBlock)resolve
|
|
568
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
569
|
+
[RCCommonFunctionality getVirtualCurrenciesWithCompletion:[self getResponseCompletionBlockWithResolve:resolve
|
|
570
|
+
reject:reject]];
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
RCT_EXPORT_METHOD(invalidateVirtualCurrenciesCache) {
|
|
574
|
+
[RCCommonFunctionality invalidateVirtualCurrenciesCache];
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
RCT_EXPORT_METHOD(getCachedVirtualCurrencies:
|
|
578
|
+
(RCTPromiseResolveBlock)resolve
|
|
579
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
580
|
+
resolve([RCCommonFunctionality getCachedVirtualCurrencies]);
|
|
581
|
+
}
|
|
582
|
+
|
|
565
583
|
#pragma mark -
|
|
566
584
|
#pragma mark PurchasesAreCompletedBy Helper Functions
|
|
567
585
|
RCT_EXPORT_METHOD(recordPurchaseForProductID:(nonnull NSString *)productID
|
|
@@ -639,7 +657,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
|
|
|
639
657
|
}
|
|
640
658
|
|
|
641
659
|
- (NSString *)platformFlavorVersion {
|
|
642
|
-
return @"
|
|
660
|
+
return @"9.1.0";
|
|
643
661
|
}
|
|
644
662
|
|
|
645
663
|
@end
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-purchases",
|
|
3
3
|
"title": "React Native Purchases",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.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
|
+
"module": "dist/index.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
8
9
|
"source": "src/index",
|
|
10
|
+
"browser": "dist/index.js",
|
|
11
|
+
"react-native": "dist/index.js",
|
|
9
12
|
"files": [
|
|
10
13
|
"dist",
|
|
11
14
|
"android",
|
|
@@ -38,7 +41,8 @@
|
|
|
38
41
|
"prepare": "tsc",
|
|
39
42
|
"example": "yarn workspace purchasetester",
|
|
40
43
|
"ui": "yarn workspace react-native-purchases-ui",
|
|
41
|
-
"bootstrap": "yarn && yarn example pods"
|
|
44
|
+
"bootstrap": "yarn && yarn prepare-expo && yarn example pods",
|
|
45
|
+
"prepare-expo": "yarn build && yarn ui prepare && yarn pack && yarn ui pack && touch examples/purchaseTesterExpo/yarn.lock"
|
|
42
46
|
},
|
|
43
47
|
"workspaces": [
|
|
44
48
|
"examples/purchaseTesterTypescript",
|
|
@@ -64,12 +68,19 @@
|
|
|
64
68
|
"readmeFilename": "README.md",
|
|
65
69
|
"peerDependencies": {
|
|
66
70
|
"react": ">= 16.6.3",
|
|
67
|
-
"react-native": "
|
|
71
|
+
"react-native": ">= 0.73.0",
|
|
72
|
+
"react-native-web": "*"
|
|
73
|
+
},
|
|
74
|
+
"peerDependenciesMeta": {
|
|
75
|
+
"react-native-web": {
|
|
76
|
+
"optional": true
|
|
77
|
+
}
|
|
68
78
|
},
|
|
69
79
|
"devDependencies": {
|
|
70
80
|
"@types/jest": "^29.5.12",
|
|
71
81
|
"@types/react": "^18.2.44",
|
|
72
82
|
"@types/react-dom": "~18.2.0",
|
|
83
|
+
"babel-plugin-react-native-web": "^0.20.0",
|
|
73
84
|
"jest": "^29.7.0",
|
|
74
85
|
"jest-react-native": "^18.0.0",
|
|
75
86
|
"pod-install": "^0.1.0",
|
|
@@ -83,7 +94,7 @@
|
|
|
83
94
|
"typescript": "^5.2.2"
|
|
84
95
|
},
|
|
85
96
|
"resolutions": {
|
|
86
|
-
"@types/react": "
|
|
97
|
+
"@types/react": "18.2.44",
|
|
87
98
|
"@types/react-native": "0.73.5",
|
|
88
99
|
"@types/react-dom": "18.2.0"
|
|
89
100
|
},
|
|
@@ -100,6 +111,6 @@
|
|
|
100
111
|
]
|
|
101
112
|
},
|
|
102
113
|
"dependencies": {
|
|
103
|
-
"@revenuecat/purchases-typescript-internal": "
|
|
114
|
+
"@revenuecat/purchases-typescript-internal": "16.0.2"
|
|
104
115
|
}
|
|
105
116
|
}
|