react-native-purchases 8.10.0 → 8.11.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 +1 -1
- package/dist/preview/nativeModule.d.ts +82 -0
- package/dist/preview/nativeModule.js +476 -0
- package/dist/purchases.d.ts +1 -0
- package/dist/purchases.js +104 -5
- package/dist/utils/environment.d.ts +15 -0
- package/dist/utils/environment.js +29 -0
- package/ios/RNPurchases.m +1 -1
- package/package.json +2 -2
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 '8.
|
|
32
|
+
versionName '8.11.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:13.
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:13.32.0'
|
|
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 = "8.
|
|
50
|
+
public static final String PLUGIN_VERSION = "8.11.0";
|
|
51
51
|
|
|
52
52
|
private final ReactApplicationContext reactContext;
|
|
53
53
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { CustomerInfo, INTRO_ELIGIBILITY_STATUS, MakePurchaseResult, PurchasesStoreTransaction, WebPurchaseRedemptionResultType, PurchasesStoreProduct, PurchasesOffering, PurchasesOfferings } from '@revenuecat/purchases-typescript-internal';
|
|
2
|
+
/**
|
|
3
|
+
* Preview implementation of the native module for Preview API mode, i.e. for environments where native modules are not available
|
|
4
|
+
* (like Expo Go).
|
|
5
|
+
*/
|
|
6
|
+
export declare const previewNativeModuleRNPurchases: {
|
|
7
|
+
setupPurchases: () => Promise<null>;
|
|
8
|
+
setAllowSharingStoreAccount: () => Promise<null>;
|
|
9
|
+
setSimulatesAskToBuyInSandbox: () => Promise<null>;
|
|
10
|
+
getOfferings: () => Promise<PurchasesOfferings>;
|
|
11
|
+
getCurrentOfferingForPlacement: () => Promise<PurchasesOffering>;
|
|
12
|
+
syncAttributesAndOfferingsIfNeeded: () => Promise<PurchasesOfferings>;
|
|
13
|
+
getProductInfo: () => Promise<PurchasesStoreProduct[]>;
|
|
14
|
+
restorePurchases: () => Promise<CustomerInfo>;
|
|
15
|
+
getAppUserID: () => Promise<string>;
|
|
16
|
+
getStorefront: () => Promise<string>;
|
|
17
|
+
setDebugLogsEnabled: () => Promise<null>;
|
|
18
|
+
setLogLevel: () => Promise<null>;
|
|
19
|
+
setLogHandler: () => Promise<null>;
|
|
20
|
+
getCustomerInfo: () => Promise<CustomerInfo>;
|
|
21
|
+
logIn: () => Promise<{
|
|
22
|
+
customerInfo: CustomerInfo;
|
|
23
|
+
created: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
logOut: () => Promise<CustomerInfo>;
|
|
26
|
+
syncPurchases: () => Promise<void>;
|
|
27
|
+
syncAmazonPurchase: () => Promise<void>;
|
|
28
|
+
syncObserverModeAmazonPurchase: () => Promise<void>;
|
|
29
|
+
recordPurchaseForProductID: () => Promise<PurchasesStoreTransaction>;
|
|
30
|
+
enableAdServicesAttributionTokenCollection: () => Promise<void>;
|
|
31
|
+
purchaseProduct: () => Promise<MakePurchaseResult>;
|
|
32
|
+
purchasePackage: () => Promise<MakePurchaseResult>;
|
|
33
|
+
purchaseSubscriptionOption: () => Promise<void>;
|
|
34
|
+
isAnonymous: () => Promise<boolean>;
|
|
35
|
+
makeDeferredPurchase: () => Promise<null>;
|
|
36
|
+
checkTrialOrIntroductoryPriceEligibility: () => Promise<{
|
|
37
|
+
'preview-product-id': INTRO_ELIGIBILITY_STATUS;
|
|
38
|
+
}>;
|
|
39
|
+
getPromotionalOffer: () => Promise<undefined>;
|
|
40
|
+
eligibleWinBackOffersForProductIdentifier: () => Promise<never[]>;
|
|
41
|
+
purchaseProductWithWinBackOffer: () => Promise<MakePurchaseResult>;
|
|
42
|
+
purchasePackageWithWinBackOffer: () => Promise<MakePurchaseResult>;
|
|
43
|
+
invalidateCustomerInfoCache: () => Promise<void>;
|
|
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>;
|
|
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>;
|
|
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>;
|
|
71
|
+
beginRefundRequestForActiveEntitlement: () => Promise<number>;
|
|
72
|
+
beginRefundRequestForEntitlementId: () => Promise<number>;
|
|
73
|
+
beginRefundRequestForProductId: () => Promise<number>;
|
|
74
|
+
showManageSubscriptions: () => Promise<void>;
|
|
75
|
+
showInAppMessages: () => Promise<void>;
|
|
76
|
+
isWebPurchaseRedemptionURL: () => Promise<null>;
|
|
77
|
+
isConfigured: () => Promise<boolean>;
|
|
78
|
+
redeemWebPurchase: () => Promise<{
|
|
79
|
+
result: WebPurchaseRedemptionResultType;
|
|
80
|
+
customerInfo: CustomerInfo;
|
|
81
|
+
}>;
|
|
82
|
+
};
|
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.previewNativeModuleRNPurchases = void 0;
|
|
40
|
+
var purchases_typescript_internal_1 = require("@revenuecat/purchases-typescript-internal");
|
|
41
|
+
var previewCustomerInfo = {
|
|
42
|
+
activeSubscriptions: [],
|
|
43
|
+
allExpirationDates: {},
|
|
44
|
+
allPurchaseDates: {},
|
|
45
|
+
allPurchasedProductIdentifiers: [],
|
|
46
|
+
entitlements: {
|
|
47
|
+
active: {},
|
|
48
|
+
all: {},
|
|
49
|
+
verification: purchases_typescript_internal_1.VERIFICATION_RESULT.NOT_REQUESTED
|
|
50
|
+
},
|
|
51
|
+
firstSeen: new Date().toISOString(),
|
|
52
|
+
latestExpirationDate: null,
|
|
53
|
+
originalAppUserId: 'preview-user-id',
|
|
54
|
+
originalApplicationVersion: null,
|
|
55
|
+
requestDate: new Date().toISOString(),
|
|
56
|
+
managementURL: null,
|
|
57
|
+
originalPurchaseDate: new Date().toISOString(),
|
|
58
|
+
nonSubscriptionTransactions: [],
|
|
59
|
+
subscriptionsByProductIdentifier: {}
|
|
60
|
+
};
|
|
61
|
+
var previewPurchaseStoreTransaction = {
|
|
62
|
+
transactionIdentifier: 'preview-transaction-id',
|
|
63
|
+
productIdentifier: 'preview-product-id',
|
|
64
|
+
purchaseDate: new Date().toISOString()
|
|
65
|
+
};
|
|
66
|
+
var previewMakePurchaseResult = {
|
|
67
|
+
productIdentifier: 'preview-product-id',
|
|
68
|
+
customerInfo: previewCustomerInfo,
|
|
69
|
+
transaction: previewPurchaseStoreTransaction
|
|
70
|
+
};
|
|
71
|
+
var previewStoreProduct = {
|
|
72
|
+
identifier: 'preview-product-id',
|
|
73
|
+
description: 'Preview product description',
|
|
74
|
+
title: 'Preview Product',
|
|
75
|
+
price: 9.99,
|
|
76
|
+
priceString: '$9.99',
|
|
77
|
+
pricePerWeek: 2.50,
|
|
78
|
+
pricePerMonth: 9.99,
|
|
79
|
+
pricePerYear: 99.99,
|
|
80
|
+
pricePerWeekString: '$2.50',
|
|
81
|
+
pricePerMonthString: '$9.99',
|
|
82
|
+
pricePerYearString: '$99.99',
|
|
83
|
+
currencyCode: 'USD',
|
|
84
|
+
introPrice: null,
|
|
85
|
+
discounts: null,
|
|
86
|
+
subscriptionPeriod: 'P1M',
|
|
87
|
+
productCategory: purchases_typescript_internal_1.PRODUCT_CATEGORY.SUBSCRIPTION,
|
|
88
|
+
productType: purchases_typescript_internal_1.PRODUCT_TYPE.AUTO_RENEWABLE_SUBSCRIPTION,
|
|
89
|
+
defaultOption: null,
|
|
90
|
+
subscriptionOptions: null,
|
|
91
|
+
presentedOfferingIdentifier: 'preview-offering',
|
|
92
|
+
presentedOfferingContext: {
|
|
93
|
+
offeringIdentifier: 'preview-offering',
|
|
94
|
+
placementIdentifier: 'preview-placement',
|
|
95
|
+
targetingContext: null
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var previewPackage = {
|
|
99
|
+
identifier: 'preview-package-id',
|
|
100
|
+
packageType: purchases_typescript_internal_1.PACKAGE_TYPE.MONTHLY,
|
|
101
|
+
product: previewStoreProduct,
|
|
102
|
+
offeringIdentifier: 'preview-offering',
|
|
103
|
+
presentedOfferingContext: {
|
|
104
|
+
offeringIdentifier: 'preview-offering',
|
|
105
|
+
placementIdentifier: 'preview-placement',
|
|
106
|
+
targetingContext: null
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var previewOffering = {
|
|
110
|
+
identifier: 'preview-offering',
|
|
111
|
+
serverDescription: 'Preview offering for testing',
|
|
112
|
+
metadata: {},
|
|
113
|
+
availablePackages: [previewPackage],
|
|
114
|
+
lifetime: null,
|
|
115
|
+
annual: null,
|
|
116
|
+
sixMonth: null,
|
|
117
|
+
threeMonth: null,
|
|
118
|
+
twoMonth: null,
|
|
119
|
+
monthly: previewPackage,
|
|
120
|
+
weekly: null
|
|
121
|
+
};
|
|
122
|
+
var previewOfferings = {
|
|
123
|
+
all: {
|
|
124
|
+
'preview-offering': previewOffering
|
|
125
|
+
},
|
|
126
|
+
current: previewOffering
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Preview implementation of the native module for Preview API mode, i.e. for environments where native modules are not available
|
|
130
|
+
* (like Expo Go).
|
|
131
|
+
*/
|
|
132
|
+
exports.previewNativeModuleRNPurchases = {
|
|
133
|
+
setupPurchases: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
return [2 /*return*/, null];
|
|
136
|
+
});
|
|
137
|
+
}); },
|
|
138
|
+
setAllowSharingStoreAccount: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
return [2 /*return*/, null];
|
|
141
|
+
});
|
|
142
|
+
}); },
|
|
143
|
+
setSimulatesAskToBuyInSandbox: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
144
|
+
return __generator(this, function (_a) {
|
|
145
|
+
return [2 /*return*/, null];
|
|
146
|
+
});
|
|
147
|
+
}); },
|
|
148
|
+
getOfferings: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
149
|
+
return __generator(this, function (_a) {
|
|
150
|
+
return [2 /*return*/, previewOfferings];
|
|
151
|
+
});
|
|
152
|
+
}); },
|
|
153
|
+
getCurrentOfferingForPlacement: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
return __generator(this, function (_a) {
|
|
155
|
+
return [2 /*return*/, previewOffering];
|
|
156
|
+
});
|
|
157
|
+
}); },
|
|
158
|
+
syncAttributesAndOfferingsIfNeeded: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
159
|
+
return __generator(this, function (_a) {
|
|
160
|
+
return [2 /*return*/, previewOfferings];
|
|
161
|
+
});
|
|
162
|
+
}); },
|
|
163
|
+
getProductInfo: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
164
|
+
return __generator(this, function (_a) {
|
|
165
|
+
return [2 /*return*/, [previewStoreProduct]];
|
|
166
|
+
});
|
|
167
|
+
}); },
|
|
168
|
+
restorePurchases: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
169
|
+
return __generator(this, function (_a) {
|
|
170
|
+
return [2 /*return*/, previewCustomerInfo];
|
|
171
|
+
});
|
|
172
|
+
}); },
|
|
173
|
+
getAppUserID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
|
+
return __generator(this, function (_a) {
|
|
175
|
+
return [2 /*return*/, 'preview-user-id'];
|
|
176
|
+
});
|
|
177
|
+
}); },
|
|
178
|
+
getStorefront: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
|
+
return __generator(this, function (_a) {
|
|
180
|
+
return [2 /*return*/, 'preview-storefront'];
|
|
181
|
+
});
|
|
182
|
+
}); },
|
|
183
|
+
setDebugLogsEnabled: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
184
|
+
return __generator(this, function (_a) {
|
|
185
|
+
return [2 /*return*/, null];
|
|
186
|
+
});
|
|
187
|
+
}); },
|
|
188
|
+
setLogLevel: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
189
|
+
return __generator(this, function (_a) {
|
|
190
|
+
return [2 /*return*/, null];
|
|
191
|
+
});
|
|
192
|
+
}); },
|
|
193
|
+
setLogHandler: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
194
|
+
return __generator(this, function (_a) {
|
|
195
|
+
return [2 /*return*/, null];
|
|
196
|
+
});
|
|
197
|
+
}); },
|
|
198
|
+
getCustomerInfo: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
199
|
+
return __generator(this, function (_a) {
|
|
200
|
+
return [2 /*return*/, previewCustomerInfo];
|
|
201
|
+
});
|
|
202
|
+
}); },
|
|
203
|
+
logIn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
204
|
+
return __generator(this, function (_a) {
|
|
205
|
+
return [2 /*return*/, {
|
|
206
|
+
customerInfo: previewCustomerInfo,
|
|
207
|
+
created: false
|
|
208
|
+
}];
|
|
209
|
+
});
|
|
210
|
+
}); },
|
|
211
|
+
logOut: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
212
|
+
return __generator(this, function (_a) {
|
|
213
|
+
return [2 /*return*/, previewCustomerInfo];
|
|
214
|
+
});
|
|
215
|
+
}); },
|
|
216
|
+
syncPurchases: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
217
|
+
return __generator(this, function (_a) {
|
|
218
|
+
return [2 /*return*/];
|
|
219
|
+
});
|
|
220
|
+
}); },
|
|
221
|
+
syncAmazonPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
222
|
+
return __generator(this, function (_a) {
|
|
223
|
+
return [2 /*return*/];
|
|
224
|
+
});
|
|
225
|
+
}); },
|
|
226
|
+
syncObserverModeAmazonPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
227
|
+
return __generator(this, function (_a) {
|
|
228
|
+
return [2 /*return*/];
|
|
229
|
+
});
|
|
230
|
+
}); },
|
|
231
|
+
recordPurchaseForProductID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
232
|
+
return __generator(this, function (_a) {
|
|
233
|
+
return [2 /*return*/, previewPurchaseStoreTransaction];
|
|
234
|
+
});
|
|
235
|
+
}); },
|
|
236
|
+
enableAdServicesAttributionTokenCollection: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
237
|
+
return __generator(this, function (_a) {
|
|
238
|
+
return [2 /*return*/];
|
|
239
|
+
});
|
|
240
|
+
}); },
|
|
241
|
+
purchaseProduct: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
242
|
+
return __generator(this, function (_a) {
|
|
243
|
+
return [2 /*return*/, previewMakePurchaseResult];
|
|
244
|
+
});
|
|
245
|
+
}); },
|
|
246
|
+
purchasePackage: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
247
|
+
return __generator(this, function (_a) {
|
|
248
|
+
return [2 /*return*/, previewMakePurchaseResult];
|
|
249
|
+
});
|
|
250
|
+
}); },
|
|
251
|
+
purchaseSubscriptionOption: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
252
|
+
return __generator(this, function (_a) {
|
|
253
|
+
return [2 /*return*/];
|
|
254
|
+
});
|
|
255
|
+
}); },
|
|
256
|
+
isAnonymous: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
257
|
+
return __generator(this, function (_a) {
|
|
258
|
+
return [2 /*return*/, true];
|
|
259
|
+
});
|
|
260
|
+
}); },
|
|
261
|
+
makeDeferredPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
262
|
+
return __generator(this, function (_a) {
|
|
263
|
+
return [2 /*return*/, null];
|
|
264
|
+
});
|
|
265
|
+
}); },
|
|
266
|
+
checkTrialOrIntroductoryPriceEligibility: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
267
|
+
return __generator(this, function (_a) {
|
|
268
|
+
return [2 /*return*/, ({
|
|
269
|
+
'preview-product-id': purchases_typescript_internal_1.INTRO_ELIGIBILITY_STATUS.INTRO_ELIGIBILITY_STATUS_ELIGIBLE
|
|
270
|
+
})];
|
|
271
|
+
});
|
|
272
|
+
}); },
|
|
273
|
+
getPromotionalOffer: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
274
|
+
return __generator(this, function (_a) {
|
|
275
|
+
return [2 /*return*/, undefined];
|
|
276
|
+
});
|
|
277
|
+
}); },
|
|
278
|
+
eligibleWinBackOffersForProductIdentifier: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
279
|
+
return __generator(this, function (_a) {
|
|
280
|
+
return [2 /*return*/, []];
|
|
281
|
+
});
|
|
282
|
+
}); },
|
|
283
|
+
purchaseProductWithWinBackOffer: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
284
|
+
return __generator(this, function (_a) {
|
|
285
|
+
return [2 /*return*/, previewMakePurchaseResult];
|
|
286
|
+
});
|
|
287
|
+
}); },
|
|
288
|
+
purchasePackageWithWinBackOffer: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
289
|
+
return __generator(this, function (_a) {
|
|
290
|
+
return [2 /*return*/, previewMakePurchaseResult];
|
|
291
|
+
});
|
|
292
|
+
}); },
|
|
293
|
+
invalidateCustomerInfoCache: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
294
|
+
return __generator(this, function (_a) {
|
|
295
|
+
return [2 /*return*/];
|
|
296
|
+
});
|
|
297
|
+
}); },
|
|
298
|
+
presentCodeRedemptionSheet: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
299
|
+
return __generator(this, function (_a) {
|
|
300
|
+
return [2 /*return*/];
|
|
301
|
+
});
|
|
302
|
+
}); },
|
|
303
|
+
setAttributes: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
304
|
+
return __generator(this, function (_a) {
|
|
305
|
+
return [2 /*return*/];
|
|
306
|
+
});
|
|
307
|
+
}); },
|
|
308
|
+
setEmail: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
309
|
+
return __generator(this, function (_a) {
|
|
310
|
+
return [2 /*return*/];
|
|
311
|
+
});
|
|
312
|
+
}); },
|
|
313
|
+
setPhoneNumber: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
314
|
+
return __generator(this, function (_a) {
|
|
315
|
+
return [2 /*return*/];
|
|
316
|
+
});
|
|
317
|
+
}); },
|
|
318
|
+
setDisplayName: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
319
|
+
return __generator(this, function (_a) {
|
|
320
|
+
return [2 /*return*/];
|
|
321
|
+
});
|
|
322
|
+
}); },
|
|
323
|
+
setPushToken: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
324
|
+
return __generator(this, function (_a) {
|
|
325
|
+
return [2 /*return*/];
|
|
326
|
+
});
|
|
327
|
+
}); },
|
|
328
|
+
setProxyURLString: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
329
|
+
return __generator(this, function (_a) {
|
|
330
|
+
return [2 /*return*/];
|
|
331
|
+
});
|
|
332
|
+
}); },
|
|
333
|
+
collectDeviceIdentifiers: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
334
|
+
return __generator(this, function (_a) {
|
|
335
|
+
return [2 /*return*/];
|
|
336
|
+
});
|
|
337
|
+
}); },
|
|
338
|
+
setAdjustID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
339
|
+
return __generator(this, function (_a) {
|
|
340
|
+
return [2 /*return*/];
|
|
341
|
+
});
|
|
342
|
+
}); },
|
|
343
|
+
setAppsflyerID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
344
|
+
return __generator(this, function (_a) {
|
|
345
|
+
return [2 /*return*/];
|
|
346
|
+
});
|
|
347
|
+
}); },
|
|
348
|
+
setFBAnonymousID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
349
|
+
return __generator(this, function (_a) {
|
|
350
|
+
return [2 /*return*/];
|
|
351
|
+
});
|
|
352
|
+
}); },
|
|
353
|
+
setMparticleID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
354
|
+
return __generator(this, function (_a) {
|
|
355
|
+
return [2 /*return*/];
|
|
356
|
+
});
|
|
357
|
+
}); },
|
|
358
|
+
setCleverTapID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
359
|
+
return __generator(this, function (_a) {
|
|
360
|
+
return [2 /*return*/];
|
|
361
|
+
});
|
|
362
|
+
}); },
|
|
363
|
+
setMixpanelDistinctID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
364
|
+
return __generator(this, function (_a) {
|
|
365
|
+
return [2 /*return*/];
|
|
366
|
+
});
|
|
367
|
+
}); },
|
|
368
|
+
setFirebaseAppInstanceID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
369
|
+
return __generator(this, function (_a) {
|
|
370
|
+
return [2 /*return*/];
|
|
371
|
+
});
|
|
372
|
+
}); },
|
|
373
|
+
setTenjinAnalyticsInstallationID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
374
|
+
return __generator(this, function (_a) {
|
|
375
|
+
return [2 /*return*/];
|
|
376
|
+
});
|
|
377
|
+
}); },
|
|
378
|
+
setKochavaDeviceID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
379
|
+
return __generator(this, function (_a) {
|
|
380
|
+
return [2 /*return*/];
|
|
381
|
+
});
|
|
382
|
+
}); },
|
|
383
|
+
setOnesignalID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
384
|
+
return __generator(this, function (_a) {
|
|
385
|
+
return [2 /*return*/];
|
|
386
|
+
});
|
|
387
|
+
}); },
|
|
388
|
+
setAirshipChannelID: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
389
|
+
return __generator(this, function (_a) {
|
|
390
|
+
return [2 /*return*/];
|
|
391
|
+
});
|
|
392
|
+
}); },
|
|
393
|
+
setMediaSource: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
394
|
+
return __generator(this, function (_a) {
|
|
395
|
+
return [2 /*return*/];
|
|
396
|
+
});
|
|
397
|
+
}); },
|
|
398
|
+
setMediaCampaign: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
399
|
+
return __generator(this, function (_a) {
|
|
400
|
+
return [2 /*return*/];
|
|
401
|
+
});
|
|
402
|
+
}); },
|
|
403
|
+
setCampaign: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
404
|
+
return __generator(this, function (_a) {
|
|
405
|
+
return [2 /*return*/];
|
|
406
|
+
});
|
|
407
|
+
}); },
|
|
408
|
+
setAdGroup: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
409
|
+
return __generator(this, function (_a) {
|
|
410
|
+
return [2 /*return*/];
|
|
411
|
+
});
|
|
412
|
+
}); },
|
|
413
|
+
setAd: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
414
|
+
return __generator(this, function (_a) {
|
|
415
|
+
return [2 /*return*/];
|
|
416
|
+
});
|
|
417
|
+
}); },
|
|
418
|
+
setKeyword: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
419
|
+
return __generator(this, function (_a) {
|
|
420
|
+
return [2 /*return*/];
|
|
421
|
+
});
|
|
422
|
+
}); },
|
|
423
|
+
setCreative: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
424
|
+
return __generator(this, function (_a) {
|
|
425
|
+
return [2 /*return*/];
|
|
426
|
+
});
|
|
427
|
+
}); },
|
|
428
|
+
canMakePayments: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
429
|
+
return __generator(this, function (_a) {
|
|
430
|
+
return [2 /*return*/, false];
|
|
431
|
+
});
|
|
432
|
+
}); },
|
|
433
|
+
beginRefundRequestForActiveEntitlement: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
434
|
+
return __generator(this, function (_a) {
|
|
435
|
+
return [2 /*return*/, 0];
|
|
436
|
+
});
|
|
437
|
+
}); },
|
|
438
|
+
beginRefundRequestForEntitlementId: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
439
|
+
return __generator(this, function (_a) {
|
|
440
|
+
return [2 /*return*/, 0];
|
|
441
|
+
});
|
|
442
|
+
}); },
|
|
443
|
+
beginRefundRequestForProductId: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
444
|
+
return __generator(this, function (_a) {
|
|
445
|
+
return [2 /*return*/, 0];
|
|
446
|
+
});
|
|
447
|
+
}); },
|
|
448
|
+
showManageSubscriptions: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
449
|
+
return __generator(this, function (_a) {
|
|
450
|
+
return [2 /*return*/];
|
|
451
|
+
});
|
|
452
|
+
}); },
|
|
453
|
+
showInAppMessages: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
454
|
+
return __generator(this, function (_a) {
|
|
455
|
+
return [2 /*return*/];
|
|
456
|
+
});
|
|
457
|
+
}); },
|
|
458
|
+
isWebPurchaseRedemptionURL: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
459
|
+
return __generator(this, function (_a) {
|
|
460
|
+
return [2 /*return*/, null];
|
|
461
|
+
});
|
|
462
|
+
}); },
|
|
463
|
+
isConfigured: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
464
|
+
return __generator(this, function (_a) {
|
|
465
|
+
return [2 /*return*/, true];
|
|
466
|
+
});
|
|
467
|
+
}); },
|
|
468
|
+
redeemWebPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
469
|
+
return __generator(this, function (_a) {
|
|
470
|
+
return [2 /*return*/, {
|
|
471
|
+
result: purchases_typescript_internal_1.WebPurchaseRedemptionResultType.SUCCESS,
|
|
472
|
+
customerInfo: previewCustomerInfo
|
|
473
|
+
}];
|
|
474
|
+
});
|
|
475
|
+
}); },
|
|
476
|
+
};
|
package/dist/purchases.d.ts
CHANGED
|
@@ -787,6 +787,7 @@ export default class Purchases {
|
|
|
787
787
|
*/
|
|
788
788
|
static isConfigured(): Promise<boolean>;
|
|
789
789
|
private static throwIfNotConfigured;
|
|
790
|
+
private static logWarningIfPreviewAPIMode;
|
|
790
791
|
private static throwIfAndroidPlatform;
|
|
791
792
|
private static throwIfIOSPlatform;
|
|
792
793
|
private static isPurchasesAreCompletedByMyApp;
|
package/dist/purchases.js
CHANGED
|
@@ -39,6 +39,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.STOREKIT_VERSION = exports.LOG_LEVEL = exports.REFUND_REQUEST_STATUS = exports.BILLING_FEATURE = exports.PURCHASES_ARE_COMPLETED_BY_TYPE = exports.PURCHASE_TYPE = void 0;
|
|
40
40
|
var react_native_1 = require("react-native");
|
|
41
41
|
var purchases_typescript_internal_1 = require("@revenuecat/purchases-typescript-internal");
|
|
42
|
+
var environment_1 = require("./utils/environment");
|
|
43
|
+
var nativeModule_1 = require("./preview/nativeModule");
|
|
42
44
|
// This export is kept to keep backwards compatibility to any possible users using this file directly
|
|
43
45
|
var purchases_typescript_internal_2 = require("@revenuecat/purchases-typescript-internal");
|
|
44
46
|
Object.defineProperty(exports, "PURCHASE_TYPE", { enumerable: true, get: function () { return purchases_typescript_internal_2.PURCHASE_TYPE; } });
|
|
@@ -48,21 +50,23 @@ Object.defineProperty(exports, "REFUND_REQUEST_STATUS", { enumerable: true, get:
|
|
|
48
50
|
Object.defineProperty(exports, "LOG_LEVEL", { enumerable: true, get: function () { return purchases_typescript_internal_2.LOG_LEVEL; } });
|
|
49
51
|
Object.defineProperty(exports, "STOREKIT_VERSION", { enumerable: true, get: function () { return purchases_typescript_internal_2.STOREKIT_VERSION; } });
|
|
50
52
|
var react_native_2 = require("react-native");
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
+
// Get the native module or use the preview implementation
|
|
54
|
+
var usingPreviewAPIMode = (0, environment_1.shouldUsePreviewAPIMode)();
|
|
55
|
+
var RNPurchases = usingPreviewAPIMode ? nativeModule_1.previewNativeModuleRNPurchases : react_native_1.NativeModules.RNPurchases;
|
|
56
|
+
var eventEmitter = usingPreviewAPIMode ? null : new react_native_1.NativeEventEmitter(RNPurchases);
|
|
53
57
|
var customerInfoUpdateListeners = [];
|
|
54
58
|
var shouldPurchasePromoProductListeners = [];
|
|
55
59
|
var customLogHandler;
|
|
56
|
-
eventEmitter.addListener("Purchases-CustomerInfoUpdated", function (customerInfo) {
|
|
60
|
+
eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-CustomerInfoUpdated", function (customerInfo) {
|
|
57
61
|
customerInfoUpdateListeners.forEach(function (listener) { return listener(customerInfo); });
|
|
58
62
|
});
|
|
59
|
-
eventEmitter.addListener("Purchases-ShouldPurchasePromoProduct", function (_a) {
|
|
63
|
+
eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-ShouldPurchasePromoProduct", function (_a) {
|
|
60
64
|
var callbackID = _a.callbackID;
|
|
61
65
|
shouldPurchasePromoProductListeners.forEach(function (listener) {
|
|
62
66
|
return listener(function () { return RNPurchases.makeDeferredPurchase(callbackID); });
|
|
63
67
|
});
|
|
64
68
|
});
|
|
65
|
-
eventEmitter.addListener("Purchases-LogHandlerEvent", function (_a) {
|
|
69
|
+
eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener("Purchases-LogHandlerEvent", function (_a) {
|
|
66
70
|
var logLevel = _a.logLevel, message = _a.message;
|
|
67
71
|
var logLevelEnum = purchases_typescript_internal_1.LOG_LEVEL[logLevel];
|
|
68
72
|
customLogHandler(logLevelEnum, message);
|
|
@@ -88,6 +92,31 @@ var Purchases = /** @class */ (function () {
|
|
|
88
92
|
*/
|
|
89
93
|
Purchases.configure = function (_a) {
|
|
90
94
|
var apiKey = _a.apiKey, _b = _a.appUserID, appUserID = _b === void 0 ? null : _b, _c = _a.purchasesAreCompletedBy, purchasesAreCompletedBy = _c === void 0 ? purchases_typescript_internal_1.PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT : _c, userDefaultsSuiteName = _a.userDefaultsSuiteName, _d = _a.storeKitVersion, storeKitVersion = _d === void 0 ? purchases_typescript_internal_1.STOREKIT_VERSION.DEFAULT : _d, _e = _a.useAmazon, useAmazon = _e === void 0 ? false : _e, _f = _a.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _f === void 0 ? true : _f, _g = _a.entitlementVerificationMode, entitlementVerificationMode = _g === void 0 ? purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE.DISABLED : _g, _h = _a.pendingTransactionsForPrepaidPlansEnabled, pendingTransactionsForPrepaidPlansEnabled = _h === void 0 ? false : _h, _j = _a.diagnosticsEnabled, diagnosticsEnabled = _j === void 0 ? false : _j;
|
|
95
|
+
if (!customLogHandler) {
|
|
96
|
+
this.setLogHandler(function (logLevel, message) {
|
|
97
|
+
switch (logLevel) {
|
|
98
|
+
case purchases_typescript_internal_1.LOG_LEVEL.DEBUG:
|
|
99
|
+
// tslint:disable-next-line:no-console
|
|
100
|
+
console.debug("[RevenueCat] ".concat(message));
|
|
101
|
+
break;
|
|
102
|
+
case purchases_typescript_internal_1.LOG_LEVEL.INFO:
|
|
103
|
+
// tslint:disable-next-line:no-console
|
|
104
|
+
console.info("[RevenueCat] ".concat(message));
|
|
105
|
+
break;
|
|
106
|
+
case purchases_typescript_internal_1.LOG_LEVEL.WARN:
|
|
107
|
+
// tslint:disable-next-line:no-console
|
|
108
|
+
console.warn("[RevenueCat] ".concat(message));
|
|
109
|
+
break;
|
|
110
|
+
case purchases_typescript_internal_1.LOG_LEVEL.ERROR:
|
|
111
|
+
// tslint:disable-next-line:no-console
|
|
112
|
+
console.error("[RevenueCat] ".concat(message));
|
|
113
|
+
break;
|
|
114
|
+
default:
|
|
115
|
+
// tslint:disable-next-line:no-console
|
|
116
|
+
console.log("[RevenueCat] ".concat(message));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
91
120
|
if (apiKey === undefined || typeof apiKey !== "string") {
|
|
92
121
|
throw new Error('Invalid API key. It must be called with an Object: configure({apiKey: "key"})');
|
|
93
122
|
}
|
|
@@ -114,6 +143,10 @@ var Purchases = /** @class */ (function () {
|
|
|
114
143
|
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.");
|
|
115
144
|
}
|
|
116
145
|
}
|
|
146
|
+
if (usingPreviewAPIMode) {
|
|
147
|
+
// tslint:disable-next-line:no-console
|
|
148
|
+
console.warn("[RevenueCat] [configure], You successfully installed the RevenueCat SDK. However, it's currently running in Preview API mode because it requires some native modules that are not available in Expo Go. All the APIs are available but have no effect. Please, use a development build to test the real behavior of the RevenueCat SDK.");
|
|
149
|
+
}
|
|
117
150
|
RNPurchases.setupPurchases(apiKey, appUserID, purchasesCompletedByToUse, userDefaultsSuiteName, storeKitVersionToUse, useAmazon, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled);
|
|
118
151
|
};
|
|
119
152
|
/**
|
|
@@ -133,6 +166,7 @@ var Purchases = /** @class */ (function () {
|
|
|
133
166
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
134
167
|
case 1:
|
|
135
168
|
_a.sent();
|
|
169
|
+
Purchases.logWarningIfPreviewAPIMode('setAllowSharingStoreAccount');
|
|
136
170
|
RNPurchases.setAllowSharingStoreAccount(allowSharing);
|
|
137
171
|
return [2 /*return*/];
|
|
138
172
|
}
|
|
@@ -218,6 +252,7 @@ var Purchases = /** @class */ (function () {
|
|
|
218
252
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
219
253
|
case 1:
|
|
220
254
|
_a.sent();
|
|
255
|
+
Purchases.logWarningIfPreviewAPIMode('getOfferings');
|
|
221
256
|
return [2 /*return*/, RNPurchases.getOfferings()];
|
|
222
257
|
}
|
|
223
258
|
});
|
|
@@ -237,6 +272,7 @@ var Purchases = /** @class */ (function () {
|
|
|
237
272
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
238
273
|
case 1:
|
|
239
274
|
_a.sent();
|
|
275
|
+
Purchases.logWarningIfPreviewAPIMode('getCurrentOfferingForPlacement');
|
|
240
276
|
return [2 /*return*/, RNPurchases.getCurrentOfferingForPlacement(placementIdentifier)];
|
|
241
277
|
}
|
|
242
278
|
});
|
|
@@ -256,6 +292,7 @@ var Purchases = /** @class */ (function () {
|
|
|
256
292
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
257
293
|
case 1:
|
|
258
294
|
_a.sent();
|
|
295
|
+
Purchases.logWarningIfPreviewAPIMode('syncAttributesAndOfferingsIfNeeded');
|
|
259
296
|
return [2 /*return*/, RNPurchases.syncAttributesAndOfferingsIfNeeded()];
|
|
260
297
|
}
|
|
261
298
|
});
|
|
@@ -278,6 +315,7 @@ var Purchases = /** @class */ (function () {
|
|
|
278
315
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
279
316
|
case 1:
|
|
280
317
|
_a.sent();
|
|
318
|
+
Purchases.logWarningIfPreviewAPIMode('getProducts');
|
|
281
319
|
return [2 /*return*/, RNPurchases.getProductInfo(productIdentifiers, type)];
|
|
282
320
|
}
|
|
283
321
|
});
|
|
@@ -300,6 +338,7 @@ var Purchases = /** @class */ (function () {
|
|
|
300
338
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
301
339
|
case 1:
|
|
302
340
|
_a.sent();
|
|
341
|
+
Purchases.logWarningIfPreviewAPIMode('purchaseProduct');
|
|
303
342
|
return [2 /*return*/, RNPurchases.purchaseProduct(productIdentifier, upgradeInfo, type, null, null, null).catch(function (error) {
|
|
304
343
|
error.userCancelled =
|
|
305
344
|
error.code === purchases_typescript_internal_1.PURCHASES_ERROR_CODE.PURCHASE_CANCELLED_ERROR;
|
|
@@ -330,6 +369,7 @@ var Purchases = /** @class */ (function () {
|
|
|
330
369
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
331
370
|
case 1:
|
|
332
371
|
_a.sent();
|
|
372
|
+
Purchases.logWarningIfPreviewAPIMode('purchaseStoreProduct');
|
|
333
373
|
return [2 /*return*/, RNPurchases.purchaseProduct(product.identifier, googleProductChangeInfo, product.productCategory, null, googleIsPersonalizedPrice == null
|
|
334
374
|
? null
|
|
335
375
|
: { isPersonalizedPrice: googleIsPersonalizedPrice }, product.presentedOfferingContext).catch(function (error) {
|
|
@@ -361,6 +401,7 @@ var Purchases = /** @class */ (function () {
|
|
|
361
401
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
362
402
|
case 1:
|
|
363
403
|
_a.sent();
|
|
404
|
+
Purchases.logWarningIfPreviewAPIMode('purchaseDiscountedProduct');
|
|
364
405
|
if (typeof discount === "undefined" || discount == null) {
|
|
365
406
|
throw new Error("A discount is required");
|
|
366
407
|
}
|
|
@@ -395,6 +436,7 @@ var Purchases = /** @class */ (function () {
|
|
|
395
436
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
396
437
|
case 1:
|
|
397
438
|
_a.sent();
|
|
439
|
+
Purchases.logWarningIfPreviewAPIMode('purchasePackage');
|
|
398
440
|
return [2 /*return*/, RNPurchases.purchasePackage(aPackage.identifier, aPackage.presentedOfferingContext, googleProductChangeInfo || upgradeInfo, null, googleIsPersonalizedPrice == null
|
|
399
441
|
? null
|
|
400
442
|
: { isPersonalizedPrice: googleIsPersonalizedPrice }).catch(function (error) {
|
|
@@ -427,6 +469,7 @@ var Purchases = /** @class */ (function () {
|
|
|
427
469
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
428
470
|
case 1:
|
|
429
471
|
_a.sent();
|
|
472
|
+
Purchases.logWarningIfPreviewAPIMode('purchaseSubscriptionOption');
|
|
430
473
|
return [4 /*yield*/, Purchases.throwIfIOSPlatform()];
|
|
431
474
|
case 2:
|
|
432
475
|
_a.sent();
|
|
@@ -458,6 +501,7 @@ var Purchases = /** @class */ (function () {
|
|
|
458
501
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
459
502
|
case 1:
|
|
460
503
|
_a.sent();
|
|
504
|
+
Purchases.logWarningIfPreviewAPIMode('purchaseDiscountedPackage');
|
|
461
505
|
if (typeof discount === "undefined" || discount == null) {
|
|
462
506
|
throw new Error("A discount is required");
|
|
463
507
|
}
|
|
@@ -482,6 +526,7 @@ var Purchases = /** @class */ (function () {
|
|
|
482
526
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
483
527
|
case 1:
|
|
484
528
|
_a.sent();
|
|
529
|
+
Purchases.logWarningIfPreviewAPIMode('restorePurchases');
|
|
485
530
|
return [2 /*return*/, RNPurchases.restorePurchases()];
|
|
486
531
|
}
|
|
487
532
|
});
|
|
@@ -498,6 +543,7 @@ var Purchases = /** @class */ (function () {
|
|
|
498
543
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
499
544
|
case 1:
|
|
500
545
|
_a.sent();
|
|
546
|
+
Purchases.logWarningIfPreviewAPIMode('getAppUserID');
|
|
501
547
|
return [2 /*return*/, RNPurchases.getAppUserID()];
|
|
502
548
|
}
|
|
503
549
|
});
|
|
@@ -514,6 +560,7 @@ var Purchases = /** @class */ (function () {
|
|
|
514
560
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
515
561
|
case 1:
|
|
516
562
|
_a.sent();
|
|
563
|
+
Purchases.logWarningIfPreviewAPIMode('getStorefront');
|
|
517
564
|
return [2 /*return*/, RNPurchases.getStorefront()];
|
|
518
565
|
}
|
|
519
566
|
});
|
|
@@ -534,6 +581,7 @@ var Purchases = /** @class */ (function () {
|
|
|
534
581
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
535
582
|
case 1:
|
|
536
583
|
_a.sent();
|
|
584
|
+
Purchases.logWarningIfPreviewAPIMode('logIn');
|
|
537
585
|
// noinspection SuspiciousTypeOfGuard
|
|
538
586
|
if (typeof appUserID !== "string") {
|
|
539
587
|
throw new Error("appUserID needs to be a string");
|
|
@@ -556,6 +604,7 @@ var Purchases = /** @class */ (function () {
|
|
|
556
604
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
557
605
|
case 1:
|
|
558
606
|
_a.sent();
|
|
607
|
+
Purchases.logWarningIfPreviewAPIMode('logOut');
|
|
559
608
|
return [2 /*return*/, RNPurchases.logOut()];
|
|
560
609
|
}
|
|
561
610
|
});
|
|
@@ -611,6 +660,7 @@ var Purchases = /** @class */ (function () {
|
|
|
611
660
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
612
661
|
case 1:
|
|
613
662
|
_a.sent();
|
|
663
|
+
Purchases.logWarningIfPreviewAPIMode('getCustomerInfo');
|
|
614
664
|
return [2 /*return*/, RNPurchases.getCustomerInfo()];
|
|
615
665
|
}
|
|
616
666
|
});
|
|
@@ -631,6 +681,7 @@ var Purchases = /** @class */ (function () {
|
|
|
631
681
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
632
682
|
case 1:
|
|
633
683
|
_a.sent();
|
|
684
|
+
Purchases.logWarningIfPreviewAPIMode('syncPurchases');
|
|
634
685
|
RNPurchases.syncPurchases();
|
|
635
686
|
return [2 /*return*/];
|
|
636
687
|
}
|
|
@@ -661,6 +712,7 @@ var Purchases = /** @class */ (function () {
|
|
|
661
712
|
return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
662
713
|
case 2:
|
|
663
714
|
_a.sent();
|
|
715
|
+
Purchases.logWarningIfPreviewAPIMode('syncAmazonPurchase');
|
|
664
716
|
RNPurchases.syncAmazonPurchase(productID, receiptID, amazonUserID, isoCurrencyCode, price);
|
|
665
717
|
return [2 /*return*/];
|
|
666
718
|
}
|
|
@@ -693,6 +745,7 @@ var Purchases = /** @class */ (function () {
|
|
|
693
745
|
return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
694
746
|
case 2:
|
|
695
747
|
_a.sent();
|
|
748
|
+
Purchases.logWarningIfPreviewAPIMode('syncObserverModeAmazonPurchase');
|
|
696
749
|
RNPurchases.syncObserverModeAmazonPurchase(productID, receiptID, amazonUserID, isoCurrencyCode, price);
|
|
697
750
|
return [2 /*return*/];
|
|
698
751
|
}
|
|
@@ -724,6 +777,7 @@ var Purchases = /** @class */ (function () {
|
|
|
724
777
|
return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
725
778
|
case 2:
|
|
726
779
|
_a.sent();
|
|
780
|
+
Purchases.logWarningIfPreviewAPIMode('recordPurchase');
|
|
727
781
|
return [2 /*return*/, RNPurchases.recordPurchaseForProductID(productID)];
|
|
728
782
|
}
|
|
729
783
|
});
|
|
@@ -742,6 +796,7 @@ var Purchases = /** @class */ (function () {
|
|
|
742
796
|
return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
743
797
|
case 1:
|
|
744
798
|
_a.sent();
|
|
799
|
+
Purchases.logWarningIfPreviewAPIMode('enableAdServicesAttributionTokenCollection');
|
|
745
800
|
RNPurchases.enableAdServicesAttributionTokenCollection();
|
|
746
801
|
_a.label = 2;
|
|
747
802
|
case 2: return [2 /*return*/];
|
|
@@ -760,6 +815,7 @@ var Purchases = /** @class */ (function () {
|
|
|
760
815
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
761
816
|
case 1:
|
|
762
817
|
_a.sent();
|
|
818
|
+
Purchases.logWarningIfPreviewAPIMode('isAnonymous');
|
|
763
819
|
return [2 /*return*/, RNPurchases.isAnonymous()];
|
|
764
820
|
}
|
|
765
821
|
});
|
|
@@ -787,6 +843,7 @@ var Purchases = /** @class */ (function () {
|
|
|
787
843
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
788
844
|
case 1:
|
|
789
845
|
_a.sent();
|
|
846
|
+
Purchases.logWarningIfPreviewAPIMode('checkTrialOrIntroductoryPriceEligibility');
|
|
790
847
|
return [2 /*return*/, RNPurchases.checkTrialOrIntroductoryPriceEligibility(productIdentifiers)];
|
|
791
848
|
}
|
|
792
849
|
});
|
|
@@ -808,6 +865,7 @@ var Purchases = /** @class */ (function () {
|
|
|
808
865
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
809
866
|
case 1:
|
|
810
867
|
_a.sent();
|
|
868
|
+
Purchases.logWarningIfPreviewAPIMode('getPromotionalOffer');
|
|
811
869
|
if (react_native_2.Platform.OS === "android") {
|
|
812
870
|
return [2 /*return*/, Promise.resolve(undefined)];
|
|
813
871
|
}
|
|
@@ -835,6 +893,7 @@ var Purchases = /** @class */ (function () {
|
|
|
835
893
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
836
894
|
case 1:
|
|
837
895
|
_a.sent();
|
|
896
|
+
Purchases.logWarningIfPreviewAPIMode('getEligibleWinBackOffersForProduct');
|
|
838
897
|
if (react_native_2.Platform.OS === "android") {
|
|
839
898
|
return [2 /*return*/, Promise.resolve(undefined)];
|
|
840
899
|
}
|
|
@@ -859,6 +918,7 @@ var Purchases = /** @class */ (function () {
|
|
|
859
918
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
860
919
|
case 1:
|
|
861
920
|
_a.sent();
|
|
921
|
+
Purchases.logWarningIfPreviewAPIMode('getEligibleWinBackOffersForPackage');
|
|
862
922
|
if (react_native_2.Platform.OS === "android") {
|
|
863
923
|
return [2 /*return*/, Promise.resolve(undefined)];
|
|
864
924
|
}
|
|
@@ -886,6 +946,7 @@ var Purchases = /** @class */ (function () {
|
|
|
886
946
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
887
947
|
case 1:
|
|
888
948
|
_a.sent();
|
|
949
|
+
Purchases.logWarningIfPreviewAPIMode('purchaseProductWithWinBackOffer');
|
|
889
950
|
if (typeof winBackOffer === "undefined" || winBackOffer == null) {
|
|
890
951
|
throw new Error("A win-back offer is required");
|
|
891
952
|
}
|
|
@@ -920,6 +981,7 @@ var Purchases = /** @class */ (function () {
|
|
|
920
981
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
921
982
|
case 1:
|
|
922
983
|
_a.sent();
|
|
984
|
+
Purchases.logWarningIfPreviewAPIMode('purchasePackageWithWinBackOffer');
|
|
923
985
|
if (typeof winBackOffer === "undefined" || winBackOffer == null) {
|
|
924
986
|
throw new Error("A win-back offer is required");
|
|
925
987
|
}
|
|
@@ -954,6 +1016,7 @@ var Purchases = /** @class */ (function () {
|
|
|
954
1016
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
955
1017
|
case 1:
|
|
956
1018
|
_a.sent();
|
|
1019
|
+
Purchases.logWarningIfPreviewAPIMode('invalidateCustomerInfoCache');
|
|
957
1020
|
RNPurchases.invalidateCustomerInfoCache();
|
|
958
1021
|
return [2 /*return*/];
|
|
959
1022
|
}
|
|
@@ -975,6 +1038,7 @@ var Purchases = /** @class */ (function () {
|
|
|
975
1038
|
return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
976
1039
|
case 1:
|
|
977
1040
|
_a.sent();
|
|
1041
|
+
Purchases.logWarningIfPreviewAPIMode('presentCodeRedemptionSheet');
|
|
978
1042
|
RNPurchases.presentCodeRedemptionSheet();
|
|
979
1043
|
_a.label = 2;
|
|
980
1044
|
case 2: return [2 /*return*/];
|
|
@@ -1001,6 +1065,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1001
1065
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1002
1066
|
case 1:
|
|
1003
1067
|
_a.sent();
|
|
1068
|
+
Purchases.logWarningIfPreviewAPIMode('setAttributes');
|
|
1004
1069
|
RNPurchases.setAttributes(attributes);
|
|
1005
1070
|
return [2 /*return*/];
|
|
1006
1071
|
}
|
|
@@ -1021,6 +1086,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1021
1086
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1022
1087
|
case 1:
|
|
1023
1088
|
_a.sent();
|
|
1089
|
+
Purchases.logWarningIfPreviewAPIMode('setEmail');
|
|
1024
1090
|
RNPurchases.setEmail(email);
|
|
1025
1091
|
return [2 /*return*/];
|
|
1026
1092
|
}
|
|
@@ -1041,6 +1107,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1041
1107
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1042
1108
|
case 1:
|
|
1043
1109
|
_a.sent();
|
|
1110
|
+
Purchases.logWarningIfPreviewAPIMode('setPhoneNumber');
|
|
1044
1111
|
RNPurchases.setPhoneNumber(phoneNumber);
|
|
1045
1112
|
return [2 /*return*/];
|
|
1046
1113
|
}
|
|
@@ -1061,6 +1128,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1061
1128
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1062
1129
|
case 1:
|
|
1063
1130
|
_a.sent();
|
|
1131
|
+
Purchases.logWarningIfPreviewAPIMode('setDisplayName');
|
|
1064
1132
|
RNPurchases.setDisplayName(displayName);
|
|
1065
1133
|
return [2 /*return*/];
|
|
1066
1134
|
}
|
|
@@ -1081,6 +1149,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1081
1149
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1082
1150
|
case 1:
|
|
1083
1151
|
_a.sent();
|
|
1152
|
+
Purchases.logWarningIfPreviewAPIMode('setPushToken');
|
|
1084
1153
|
RNPurchases.setPushToken(pushToken);
|
|
1085
1154
|
return [2 /*return*/];
|
|
1086
1155
|
}
|
|
@@ -1113,6 +1182,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1113
1182
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1114
1183
|
case 1:
|
|
1115
1184
|
_a.sent();
|
|
1185
|
+
Purchases.logWarningIfPreviewAPIMode('collectDeviceIdentifiers');
|
|
1116
1186
|
RNPurchases.collectDeviceIdentifiers();
|
|
1117
1187
|
return [2 /*return*/];
|
|
1118
1188
|
}
|
|
@@ -1134,6 +1204,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1134
1204
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1135
1205
|
case 1:
|
|
1136
1206
|
_a.sent();
|
|
1207
|
+
Purchases.logWarningIfPreviewAPIMode('setAdjustID');
|
|
1137
1208
|
RNPurchases.setAdjustID(adjustID);
|
|
1138
1209
|
return [2 /*return*/];
|
|
1139
1210
|
}
|
|
@@ -1154,6 +1225,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1154
1225
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1155
1226
|
case 1:
|
|
1156
1227
|
_a.sent();
|
|
1228
|
+
Purchases.logWarningIfPreviewAPIMode('setAppsflyerID');
|
|
1157
1229
|
RNPurchases.setAppsflyerID(appsflyerID);
|
|
1158
1230
|
return [2 /*return*/];
|
|
1159
1231
|
}
|
|
@@ -1175,6 +1247,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1175
1247
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1176
1248
|
case 1:
|
|
1177
1249
|
_a.sent();
|
|
1250
|
+
Purchases.logWarningIfPreviewAPIMode('setFBAnonymousID');
|
|
1178
1251
|
RNPurchases.setFBAnonymousID(fbAnonymousID);
|
|
1179
1252
|
return [2 /*return*/];
|
|
1180
1253
|
}
|
|
@@ -1196,6 +1269,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1196
1269
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1197
1270
|
case 1:
|
|
1198
1271
|
_a.sent();
|
|
1272
|
+
Purchases.logWarningIfPreviewAPIMode('setMparticleID');
|
|
1199
1273
|
RNPurchases.setMparticleID(mparticleID);
|
|
1200
1274
|
return [2 /*return*/];
|
|
1201
1275
|
}
|
|
@@ -1217,6 +1291,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1217
1291
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1218
1292
|
case 1:
|
|
1219
1293
|
_a.sent();
|
|
1294
|
+
Purchases.logWarningIfPreviewAPIMode('setCleverTapID');
|
|
1220
1295
|
RNPurchases.setCleverTapID(cleverTapID);
|
|
1221
1296
|
return [2 /*return*/];
|
|
1222
1297
|
}
|
|
@@ -1238,6 +1313,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1238
1313
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1239
1314
|
case 1:
|
|
1240
1315
|
_a.sent();
|
|
1316
|
+
Purchases.logWarningIfPreviewAPIMode('setMixpanelDistinctID');
|
|
1241
1317
|
RNPurchases.setMixpanelDistinctID(mixpanelDistinctID);
|
|
1242
1318
|
return [2 /*return*/];
|
|
1243
1319
|
}
|
|
@@ -1259,6 +1335,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1259
1335
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1260
1336
|
case 1:
|
|
1261
1337
|
_a.sent();
|
|
1338
|
+
Purchases.logWarningIfPreviewAPIMode('setFirebaseAppInstanceID');
|
|
1262
1339
|
RNPurchases.setFirebaseAppInstanceID(firebaseAppInstanceID);
|
|
1263
1340
|
return [2 /*return*/];
|
|
1264
1341
|
}
|
|
@@ -1280,6 +1357,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1280
1357
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1281
1358
|
case 1:
|
|
1282
1359
|
_a.sent();
|
|
1360
|
+
Purchases.logWarningIfPreviewAPIMode('setTenjinAnalyticsInstallationID');
|
|
1283
1361
|
RNPurchases.setTenjinAnalyticsInstallationID(tenjinAnalyticsInstallationID);
|
|
1284
1362
|
return [2 /*return*/];
|
|
1285
1363
|
}
|
|
@@ -1301,6 +1379,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1301
1379
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1302
1380
|
case 1:
|
|
1303
1381
|
_a.sent();
|
|
1382
|
+
Purchases.logWarningIfPreviewAPIMode('setKochavaDeviceID');
|
|
1304
1383
|
RNPurchases.setKochavaDeviceID(kochavaDeviceID);
|
|
1305
1384
|
return [2 /*return*/];
|
|
1306
1385
|
}
|
|
@@ -1322,6 +1401,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1322
1401
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1323
1402
|
case 1:
|
|
1324
1403
|
_a.sent();
|
|
1404
|
+
Purchases.logWarningIfPreviewAPIMode('setOnesignalID');
|
|
1325
1405
|
RNPurchases.setOnesignalID(onesignalID);
|
|
1326
1406
|
return [2 /*return*/];
|
|
1327
1407
|
}
|
|
@@ -1343,6 +1423,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1343
1423
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1344
1424
|
case 1:
|
|
1345
1425
|
_a.sent();
|
|
1426
|
+
Purchases.logWarningIfPreviewAPIMode('setAirshipChannelID');
|
|
1346
1427
|
RNPurchases.setAirshipChannelID(airshipChannelID);
|
|
1347
1428
|
return [2 /*return*/];
|
|
1348
1429
|
}
|
|
@@ -1363,6 +1444,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1363
1444
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1364
1445
|
case 1:
|
|
1365
1446
|
_a.sent();
|
|
1447
|
+
Purchases.logWarningIfPreviewAPIMode('setMediaSource');
|
|
1366
1448
|
RNPurchases.setMediaSource(mediaSource);
|
|
1367
1449
|
return [2 /*return*/];
|
|
1368
1450
|
}
|
|
@@ -1383,6 +1465,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1383
1465
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1384
1466
|
case 1:
|
|
1385
1467
|
_a.sent();
|
|
1468
|
+
Purchases.logWarningIfPreviewAPIMode('setCampaign');
|
|
1386
1469
|
RNPurchases.setCampaign(campaign);
|
|
1387
1470
|
return [2 /*return*/];
|
|
1388
1471
|
}
|
|
@@ -1403,6 +1486,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1403
1486
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1404
1487
|
case 1:
|
|
1405
1488
|
_a.sent();
|
|
1489
|
+
Purchases.logWarningIfPreviewAPIMode('setAdGroup');
|
|
1406
1490
|
RNPurchases.setAdGroup(adGroup);
|
|
1407
1491
|
return [2 /*return*/];
|
|
1408
1492
|
}
|
|
@@ -1423,6 +1507,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1423
1507
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1424
1508
|
case 1:
|
|
1425
1509
|
_a.sent();
|
|
1510
|
+
Purchases.logWarningIfPreviewAPIMode('setAd');
|
|
1426
1511
|
RNPurchases.setAd(ad);
|
|
1427
1512
|
return [2 /*return*/];
|
|
1428
1513
|
}
|
|
@@ -1443,6 +1528,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1443
1528
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1444
1529
|
case 1:
|
|
1445
1530
|
_a.sent();
|
|
1531
|
+
Purchases.logWarningIfPreviewAPIMode('setKeyword');
|
|
1446
1532
|
RNPurchases.setKeyword(keyword);
|
|
1447
1533
|
return [2 /*return*/];
|
|
1448
1534
|
}
|
|
@@ -1463,6 +1549,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1463
1549
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1464
1550
|
case 1:
|
|
1465
1551
|
_a.sent();
|
|
1552
|
+
Purchases.logWarningIfPreviewAPIMode('setCreative');
|
|
1466
1553
|
RNPurchases.setCreative(creative);
|
|
1467
1554
|
return [2 /*return*/];
|
|
1468
1555
|
}
|
|
@@ -1507,6 +1594,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1507
1594
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1508
1595
|
case 1:
|
|
1509
1596
|
_a.sent();
|
|
1597
|
+
Purchases.logWarningIfPreviewAPIMode('beginRefundRequestForActiveEntitlement');
|
|
1510
1598
|
return [4 /*yield*/, Purchases.throwIfAndroidPlatform()];
|
|
1511
1599
|
case 2:
|
|
1512
1600
|
_a.sent();
|
|
@@ -1540,6 +1628,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1540
1628
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1541
1629
|
case 1:
|
|
1542
1630
|
_a.sent();
|
|
1631
|
+
Purchases.logWarningIfPreviewAPIMode('beginRefundRequestForEntitlement');
|
|
1543
1632
|
return [4 /*yield*/, Purchases.throwIfAndroidPlatform()];
|
|
1544
1633
|
case 2:
|
|
1545
1634
|
_a.sent();
|
|
@@ -1573,6 +1662,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1573
1662
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1574
1663
|
case 1:
|
|
1575
1664
|
_a.sent();
|
|
1665
|
+
Purchases.logWarningIfPreviewAPIMode('beginRefundRequestForProduct');
|
|
1576
1666
|
return [4 /*yield*/, Purchases.throwIfAndroidPlatform()];
|
|
1577
1667
|
case 2:
|
|
1578
1668
|
_a.sent();
|
|
@@ -1597,6 +1687,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1597
1687
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1598
1688
|
case 1:
|
|
1599
1689
|
_a.sent();
|
|
1690
|
+
Purchases.logWarningIfPreviewAPIMode('showManageSubscriptions');
|
|
1600
1691
|
return [4 /*yield*/, Purchases.throwIfAndroidPlatform()];
|
|
1601
1692
|
case 2:
|
|
1602
1693
|
_a.sent();
|
|
@@ -1623,6 +1714,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1623
1714
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1624
1715
|
case 1:
|
|
1625
1716
|
_a.sent();
|
|
1717
|
+
Purchases.logWarningIfPreviewAPIMode('showInAppMessages');
|
|
1626
1718
|
return [2 /*return*/, RNPurchases.showInAppMessages(messageTypes)];
|
|
1627
1719
|
}
|
|
1628
1720
|
});
|
|
@@ -1656,6 +1748,7 @@ var Purchases = /** @class */ (function () {
|
|
|
1656
1748
|
case 0: return [4 /*yield*/, Purchases.throwIfNotConfigured()];
|
|
1657
1749
|
case 1:
|
|
1658
1750
|
_a.sent();
|
|
1751
|
+
Purchases.logWarningIfPreviewAPIMode('redeemWebPurchase');
|
|
1659
1752
|
return [2 /*return*/, RNPurchases.redeemWebPurchase(webPurchaseRedemption.redemptionLink)];
|
|
1660
1753
|
}
|
|
1661
1754
|
});
|
|
@@ -1685,6 +1778,12 @@ var Purchases = /** @class */ (function () {
|
|
|
1685
1778
|
});
|
|
1686
1779
|
});
|
|
1687
1780
|
};
|
|
1781
|
+
Purchases.logWarningIfPreviewAPIMode = function (methodName) {
|
|
1782
|
+
if (usingPreviewAPIMode) {
|
|
1783
|
+
// tslint:disable-next-line:no-console
|
|
1784
|
+
console.warn("[RevenueCat] [".concat(methodName, "] This method is available but has no effect in Preview API mode."));
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1688
1787
|
Purchases.throwIfAndroidPlatform = function () {
|
|
1689
1788
|
return __awaiter(this, void 0, void 0, function () {
|
|
1690
1789
|
return __generator(this, function (_a) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
4
|
+
*
|
|
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.
|
|
7
|
+
*/
|
|
8
|
+
export declare function shouldUsePreviewAPIMode(): boolean;
|
|
9
|
+
declare global {
|
|
10
|
+
var expo: {
|
|
11
|
+
modules?: {
|
|
12
|
+
ExpoGo?: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldUsePreviewAPIMode = void 0;
|
|
4
|
+
var react_native_1 = require("react-native");
|
|
5
|
+
/**
|
|
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.
|
|
8
|
+
*
|
|
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.
|
|
11
|
+
*/
|
|
12
|
+
function shouldUsePreviewAPIMode() {
|
|
13
|
+
var usePreviewAPIMode = isExpoGo();
|
|
14
|
+
if (usePreviewAPIMode) {
|
|
15
|
+
console.log('Expo Go app detected. Using RevenueCat in Preview API Mode.');
|
|
16
|
+
}
|
|
17
|
+
return usePreviewAPIMode;
|
|
18
|
+
}
|
|
19
|
+
exports.shouldUsePreviewAPIMode = shouldUsePreviewAPIMode;
|
|
20
|
+
/**
|
|
21
|
+
* Detects if the app is running in Expo Go
|
|
22
|
+
*/
|
|
23
|
+
function isExpoGo() {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
if (!!react_native_1.NativeModules.RNPurchases) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return !!((_b = (_a = globalThis.expo) === null || _a === void 0 ? void 0 : _a.modules) === null || _b === void 0 ? void 0 : _b.ExpoGo);
|
|
29
|
+
}
|
package/ios/RNPurchases.m
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-purchases",
|
|
3
3
|
"title": "React Native Purchases",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.11.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
|
"types": "dist/index.d.ts",
|
|
@@ -100,6 +100,6 @@
|
|
|
100
100
|
]
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@revenuecat/purchases-typescript-internal": "13.
|
|
103
|
+
"@revenuecat/purchases-typescript-internal": "13.32.0"
|
|
104
104
|
}
|
|
105
105
|
}
|