react-native-purchases 4.6.0 → 5.0.0-beta.2
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 +11 -19
- package/RNPurchases.podspec +2 -2
- package/android/build.gradle +3 -4
- package/android/build.gradle.bck +3 -4
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +18 -42
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java.bck +374 -0
- package/dist/{purchaserInfo.d.ts → customerInfo.d.ts} +4 -5
- package/dist/{purchaserInfo.js → customerInfo.js} +0 -0
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/offerings.d.ts +12 -44
- package/dist/offerings.js +4 -0
- package/dist/purchases.d.ts +55 -114
- package/dist/purchases.js +55 -160
- package/ios/RNPurchases.h +2 -2
- package/ios/RNPurchases.m +41 -74
- package/ios/RNPurchases.m.bck +39 -72
- package/package.json +5 -6
- package/scripts/{build.js → build.js.bck} +0 -0
- package/scripts/docs/index.html +9 -0
- package/scripts/docs/index.html.bck +9 -0
- package/scripts/setupJest.js +253 -243
- package/android/.classpath +0 -6
- package/android/.project +0 -34
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/scripts/download-purchases-common.sh +0 -39
- package/scripts/download-purchases-framework.sh +0 -39
package/dist/errors.d.ts
CHANGED
package/dist/errors.js
CHANGED
|
@@ -41,6 +41,9 @@ var PURCHASES_ERROR_CODE;
|
|
|
41
41
|
PURCHASES_ERROR_CODE["INVALID_SUBSCRIBER_ATTRIBUTES_ERROR"] = "21";
|
|
42
42
|
PURCHASES_ERROR_CODE["LOG_OUT_ANONYMOUS_USER_ERROR"] = "22";
|
|
43
43
|
})(PURCHASES_ERROR_CODE = exports.PURCHASES_ERROR_CODE || (exports.PURCHASES_ERROR_CODE = {}));
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
44
47
|
var UninitializedPurchasesError = /** @class */ (function (_super) {
|
|
45
48
|
__extends(UninitializedPurchasesError, _super);
|
|
46
49
|
function UninitializedPurchasesError() {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,6 +16,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
var purchases_1 = __importDefault(require("./purchases"));
|
|
17
17
|
exports.default = purchases_1.default;
|
|
18
18
|
__exportStar(require("./errors"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./customerInfo"), exports);
|
|
20
20
|
__exportStar(require("./purchases"), exports);
|
|
21
21
|
__exportStar(require("./offerings"), exports);
|
package/dist/offerings.d.ts
CHANGED
|
@@ -48,9 +48,13 @@ export declare enum INTRO_ELIGIBILITY_STATUS {
|
|
|
48
48
|
/**
|
|
49
49
|
* The user is eligible for a free trial or intro pricing for this product.
|
|
50
50
|
*/
|
|
51
|
-
INTRO_ELIGIBILITY_STATUS_ELIGIBLE = 2
|
|
51
|
+
INTRO_ELIGIBILITY_STATUS_ELIGIBLE = 2,
|
|
52
|
+
/**
|
|
53
|
+
* There is no free trial or intro pricing for this product.
|
|
54
|
+
*/
|
|
55
|
+
INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS = 3
|
|
52
56
|
}
|
|
53
|
-
export interface
|
|
57
|
+
export interface PurchasesStoreProduct {
|
|
54
58
|
/**
|
|
55
59
|
* Product Id.
|
|
56
60
|
*/
|
|
@@ -70,47 +74,11 @@ export interface PurchasesProduct {
|
|
|
70
74
|
/**
|
|
71
75
|
* Formatted price of the item, including its currency sign.
|
|
72
76
|
*/
|
|
73
|
-
readonly
|
|
77
|
+
readonly priceString: string;
|
|
74
78
|
/**
|
|
75
79
|
* Currency code for price and original price.
|
|
76
80
|
*/
|
|
77
|
-
readonly
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated, use introPrice instead.
|
|
80
|
-
*
|
|
81
|
-
* Introductory price of a subscription in the local currency.
|
|
82
|
-
*/
|
|
83
|
-
readonly intro_price: number | null;
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated, use introPrice instead.
|
|
86
|
-
*
|
|
87
|
-
* Formatted introductory price of a subscription, including its currency sign, such as €3.99.
|
|
88
|
-
*/
|
|
89
|
-
readonly intro_price_string: string | null;
|
|
90
|
-
/**
|
|
91
|
-
* @deprecated, use introPrice instead.
|
|
92
|
-
*
|
|
93
|
-
* Billing period of the introductory price, specified in ISO 8601 format.
|
|
94
|
-
*/
|
|
95
|
-
readonly intro_price_period: string | null;
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated, use introPrice instead.
|
|
98
|
-
*
|
|
99
|
-
* Number of subscription billing periods for which the user will be given the introductory price, such as 3.
|
|
100
|
-
*/
|
|
101
|
-
readonly intro_price_cycles: number | null;
|
|
102
|
-
/**
|
|
103
|
-
* @deprecated, use introPrice instead.
|
|
104
|
-
*
|
|
105
|
-
* Unit for the billing period of the introductory price, can be DAY, WEEK, MONTH or YEAR.
|
|
106
|
-
*/
|
|
107
|
-
readonly intro_price_period_unit: string | null;
|
|
108
|
-
/**
|
|
109
|
-
* @deprecated, use introPrice instead.
|
|
110
|
-
*
|
|
111
|
-
* Number of units for the billing period of the introductory price.
|
|
112
|
-
*/
|
|
113
|
-
readonly intro_price_period_number_of_units: number | null;
|
|
81
|
+
readonly currencyCode: string;
|
|
114
82
|
/**
|
|
115
83
|
* Introductory price.
|
|
116
84
|
*/
|
|
@@ -118,9 +86,9 @@ export interface PurchasesProduct {
|
|
|
118
86
|
/**
|
|
119
87
|
* Collection of discount offers for a product. Null for Android.
|
|
120
88
|
*/
|
|
121
|
-
readonly discounts:
|
|
89
|
+
readonly discounts: PurchasesStoreProductDiscount[] | null;
|
|
122
90
|
}
|
|
123
|
-
export interface
|
|
91
|
+
export interface PurchasesStoreProductDiscount {
|
|
124
92
|
/**
|
|
125
93
|
* Identifier of the discount.
|
|
126
94
|
*/
|
|
@@ -192,7 +160,7 @@ export interface PurchasesPackage {
|
|
|
192
160
|
/**
|
|
193
161
|
* Product assigned to this package.
|
|
194
162
|
*/
|
|
195
|
-
readonly product:
|
|
163
|
+
readonly product: PurchasesStoreProduct;
|
|
196
164
|
/**
|
|
197
165
|
* Offering this package belongs to.
|
|
198
166
|
*/
|
|
@@ -286,7 +254,7 @@ export interface IntroEligibility {
|
|
|
286
254
|
*/
|
|
287
255
|
readonly description: string;
|
|
288
256
|
}
|
|
289
|
-
export interface
|
|
257
|
+
export interface PurchasesPromotionalOffer {
|
|
290
258
|
readonly identifier: string;
|
|
291
259
|
readonly keyIdentifier: string;
|
|
292
260
|
readonly nonce: string;
|
package/dist/offerings.js
CHANGED
|
@@ -54,6 +54,10 @@ var INTRO_ELIGIBILITY_STATUS;
|
|
|
54
54
|
* The user is eligible for a free trial or intro pricing for this product.
|
|
55
55
|
*/
|
|
56
56
|
INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_ELIGIBLE"] = 2] = "INTRO_ELIGIBILITY_STATUS_ELIGIBLE";
|
|
57
|
+
/**
|
|
58
|
+
* There is no free trial or intro pricing for this product.
|
|
59
|
+
*/
|
|
60
|
+
INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS"] = 3] = "INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS";
|
|
57
61
|
})(INTRO_ELIGIBILITY_STATUS = exports.INTRO_ELIGIBILITY_STATUS || (exports.INTRO_ELIGIBILITY_STATUS = {}));
|
|
58
62
|
var PRORATION_MODE;
|
|
59
63
|
(function (PRORATION_MODE) {
|
package/dist/purchases.d.ts
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import { PURCHASES_ERROR_CODE, UninitializedPurchasesError } from "./errors";
|
|
2
|
-
import {
|
|
3
|
-
import { PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferings,
|
|
2
|
+
import { CustomerInfo } from "./customerInfo";
|
|
3
|
+
import { PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferings, PurchasesStoreProduct, UpgradeInfo, PurchasesPromotionalOffer, PurchasesPackage, IntroEligibility, PurchasesStoreProductDiscount } from "./offerings";
|
|
4
4
|
/**
|
|
5
|
-
* Listener used on updated
|
|
6
|
-
* @callback
|
|
7
|
-
* @param {Object}
|
|
5
|
+
* Listener used on updated customer info
|
|
6
|
+
* @callback CustomerInfoUpdateListener
|
|
7
|
+
* @param {Object} customerInfo Object containing info for the customer
|
|
8
8
|
*/
|
|
9
|
-
export declare type
|
|
9
|
+
export declare type CustomerInfoUpdateListener = (customerInfo: CustomerInfo) => void;
|
|
10
10
|
export declare type ShouldPurchasePromoProductListener = (deferredPurchase: () => Promise<MakePurchaseResult>) => void;
|
|
11
11
|
export declare type MakePurchaseResult = {
|
|
12
12
|
productIdentifier: string;
|
|
13
|
-
|
|
13
|
+
customerInfo: CustomerInfo;
|
|
14
14
|
};
|
|
15
|
-
export declare enum ATTRIBUTION_NETWORK {
|
|
16
|
-
APPLE_SEARCH_ADS = 0,
|
|
17
|
-
ADJUST = 1,
|
|
18
|
-
APPSFLYER = 2,
|
|
19
|
-
BRANCH = 3,
|
|
20
|
-
TENJIN = 4,
|
|
21
|
-
FACEBOOK = 5
|
|
22
|
-
}
|
|
23
15
|
export declare enum PURCHASE_TYPE {
|
|
24
16
|
/**
|
|
25
17
|
* A type of SKU for in-app products.
|
|
@@ -62,29 +54,15 @@ export declare enum BILLING_FEATURE {
|
|
|
62
54
|
*/
|
|
63
55
|
export interface LogInResult {
|
|
64
56
|
/**
|
|
65
|
-
* The
|
|
57
|
+
* The Customer Info for the user.
|
|
66
58
|
*/
|
|
67
|
-
readonly
|
|
59
|
+
readonly customerInfo: CustomerInfo;
|
|
68
60
|
/**
|
|
69
61
|
* True if the call resulted in a new user getting created in the RevenueCat backend.
|
|
70
62
|
*/
|
|
71
63
|
readonly created: boolean;
|
|
72
64
|
}
|
|
73
65
|
export default class Purchases {
|
|
74
|
-
/**
|
|
75
|
-
* Enum for attribution networks
|
|
76
|
-
* @readonly
|
|
77
|
-
* @enum {number}
|
|
78
|
-
*/
|
|
79
|
-
static ATTRIBUTION_NETWORK: typeof ATTRIBUTION_NETWORK;
|
|
80
|
-
/**
|
|
81
|
-
* @deprecated use ATTRIBUTION_NETWORK instead
|
|
82
|
-
*
|
|
83
|
-
* Enum for attribution networks
|
|
84
|
-
* @readonly
|
|
85
|
-
* @enum {number}
|
|
86
|
-
*/
|
|
87
|
-
static ATTRIBUTION_NETWORKS: typeof ATTRIBUTION_NETWORK;
|
|
88
66
|
/**
|
|
89
67
|
* Supported SKU types.
|
|
90
68
|
* @readonly
|
|
@@ -123,17 +101,21 @@ export default class Purchases {
|
|
|
123
101
|
* @enum {string}
|
|
124
102
|
*/
|
|
125
103
|
static PURCHASES_ERROR_CODE: typeof PURCHASES_ERROR_CODE;
|
|
104
|
+
/**
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
126
107
|
static UninitializedPurchasesError: typeof UninitializedPurchasesError;
|
|
127
108
|
/**
|
|
128
109
|
* Sets up Purchases with your API key and an app user id.
|
|
129
110
|
* @param {String} apiKey RevenueCat API Key. Needs to be a String
|
|
130
111
|
* @param {String?} appUserID An optional unique id for identifying the user. Needs to be a string.
|
|
131
|
-
* @param {boolean
|
|
112
|
+
* @param {boolean} [observerMode=false] An optional boolean. Set this to TRUE if you have your own IAP implementation and want to use only RevenueCat's backend. Default is FALSE.
|
|
113
|
+
* @param {boolean} [usesStoreKit2IfAvailable=false] An optional boolean. iOS-only. Set this to TRUE to enable StoreKit2 on compatible devices.
|
|
132
114
|
* @param {String?} userDefaultsSuiteName An optional string. iOS-only, will be ignored for Android.
|
|
133
115
|
* Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults suite, otherwise it will use standardUserDefaults.
|
|
134
116
|
* Default is null, which will make the SDK use standardUserDefaults.
|
|
135
117
|
*/
|
|
136
|
-
static
|
|
118
|
+
static configure(apiKey: string, appUserID?: string | null, observerMode?: boolean, userDefaultsSuiteName?: string, usesStoreKit2IfAvailable?: boolean): void;
|
|
137
119
|
/**
|
|
138
120
|
* @deprecated, configure behavior through the RevenueCat dashboard instead.
|
|
139
121
|
* If an user tries to purchase a product that is active on the current app store account,
|
|
@@ -157,16 +139,16 @@ export default class Purchases {
|
|
|
157
139
|
*/
|
|
158
140
|
static setSimulatesAskToBuyInSandbox(simulatesAskToBuyInSandbox: boolean): Promise<void>;
|
|
159
141
|
/**
|
|
160
|
-
* Sets a function to be called on updated
|
|
161
|
-
* @param {
|
|
142
|
+
* Sets a function to be called on updated customer info
|
|
143
|
+
* @param {CustomerInfoUpdateListener} customerInfoUpdateListener CustomerInfo update listener
|
|
162
144
|
*/
|
|
163
|
-
static
|
|
145
|
+
static addCustomerInfoUpdateListener(customerInfoUpdateListener: CustomerInfoUpdateListener): void;
|
|
164
146
|
/**
|
|
165
|
-
* Removes a given
|
|
166
|
-
* @param {
|
|
147
|
+
* Removes a given CustomerInfoUpdateListener
|
|
148
|
+
* @param {CustomerInfoUpdateListener} listenerToRemove CustomerInfoUpdateListener reference of the listener to remove
|
|
167
149
|
* @returns {boolean} True if listener was removed, false otherwise
|
|
168
150
|
*/
|
|
169
|
-
static
|
|
151
|
+
static removeCustomerInfoUpdateListener(listenerToRemove: CustomerInfoUpdateListener): boolean;
|
|
170
152
|
/**
|
|
171
153
|
* Sets a function to be called on purchases initiated on the Apple App Store. This is only used in iOS.
|
|
172
154
|
* @param {ShouldPurchasePromoProductListener} shouldPurchasePromoProductListener Called when a user initiates a
|
|
@@ -184,18 +166,6 @@ export default class Purchases {
|
|
|
184
166
|
* @returns {boolean} True if listener was removed, false otherwise
|
|
185
167
|
*/
|
|
186
168
|
static removeShouldPurchasePromoProductListener(listenerToRemove: ShouldPurchasePromoProductListener): boolean;
|
|
187
|
-
/**
|
|
188
|
-
* @deprecated, use set<NetworkId> methods instead.
|
|
189
|
-
*
|
|
190
|
-
* Add a dict of attribution information
|
|
191
|
-
* @param {Dict} data Attribution data from AppsFlyer, Adjust, or Branch
|
|
192
|
-
* @param {ATTRIBUTION_NETWORKS} network Which network, see Purchases.ATTRIBUTION_NETWORKS
|
|
193
|
-
* @param {String?} networkUserId An optional unique id for identifying the user. Needs to be a string.
|
|
194
|
-
* @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
|
|
195
|
-
*/
|
|
196
|
-
static addAttributionData(data: {
|
|
197
|
-
[key: string]: any;
|
|
198
|
-
}, network: ATTRIBUTION_NETWORK, networkUserId?: string): Promise<void>;
|
|
199
169
|
/**
|
|
200
170
|
* Gets the map of entitlements -> offerings -> products
|
|
201
171
|
* @returns {Promise<PurchasesOfferings>} Promise of entitlements structure. The promise will be rejected if setup
|
|
@@ -206,12 +176,12 @@ export default class Purchases {
|
|
|
206
176
|
* Fetch the product info
|
|
207
177
|
* @param {String[]} productIdentifiers Array of product identifiers
|
|
208
178
|
* @param {String} type Optional type of products to fetch, can be inapp or subs. Subs by default
|
|
209
|
-
* @returns {Promise<
|
|
179
|
+
* @returns {Promise<PurchasesStoreProduct[]>} A promise containing an array of products. The promise will be rejected
|
|
210
180
|
* if the products are not properly configured in RevenueCat or if there is another error retrieving them.
|
|
211
181
|
* Rejections return an error code, and a userInfo object with more information. The promise will also be rejected
|
|
212
182
|
* if setup has not been called yet.
|
|
213
183
|
*/
|
|
214
|
-
static getProducts(productIdentifiers: string[], type?: PURCHASE_TYPE): Promise<
|
|
184
|
+
static getProducts(productIdentifiers: string[], type?: PURCHASE_TYPE): Promise<PurchasesStoreProduct[]>;
|
|
215
185
|
/**
|
|
216
186
|
* Make a purchase
|
|
217
187
|
*
|
|
@@ -219,8 +189,8 @@ export default class Purchases {
|
|
|
219
189
|
* @param {UpgradeInfo} upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU
|
|
220
190
|
* and the optional prorationMode.
|
|
221
191
|
* @param {String} type Optional type of product, can be inapp or subs. Subs by default
|
|
222
|
-
* @returns {Promise<{ productIdentifier: string,
|
|
223
|
-
* a
|
|
192
|
+
* @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing
|
|
193
|
+
* a customer info object and a product identifier. Rejections return an error code,
|
|
224
194
|
* a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will
|
|
225
195
|
* also be rejected if setup has not been called yet.
|
|
226
196
|
*/
|
|
@@ -228,22 +198,22 @@ export default class Purchases {
|
|
|
228
198
|
/**
|
|
229
199
|
* iOS only. Purchase a product applying a given discount.
|
|
230
200
|
*
|
|
231
|
-
* @param {
|
|
232
|
-
* @param {
|
|
233
|
-
* @returns {Promise<{ productIdentifier: string,
|
|
234
|
-
* a
|
|
201
|
+
* @param {PurchasesStoreProduct} product The product you want to purchase
|
|
202
|
+
* @param {PurchasesPromotionalOffer} discount Discount to apply to this package. Retrieve this discount using getPromotionalOffer.
|
|
203
|
+
* @returns {Promise<{ productIdentifier: string, customerInfo:CustomerInfo }>} A promise of an object containing
|
|
204
|
+
* a customer info object and a product identifier. Rejections return an error code,
|
|
235
205
|
* a boolean indicating if the user cancelled the purchase, and an object with more information. The promise will be
|
|
236
206
|
* rejected if setup has not been called yet.
|
|
237
207
|
*/
|
|
238
|
-
static purchaseDiscountedProduct(product:
|
|
208
|
+
static purchaseDiscountedProduct(product: PurchasesStoreProduct, discount: PurchasesPromotionalOffer): Promise<MakePurchaseResult>;
|
|
239
209
|
/**
|
|
240
210
|
* Make a purchase
|
|
241
211
|
*
|
|
242
212
|
* @param {PurchasesPackage} aPackage The Package you wish to purchase. You can get the Packages by calling getOfferings
|
|
243
213
|
* @param {UpgradeInfo} upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU
|
|
244
214
|
* and the optional prorationMode.
|
|
245
|
-
* @returns {Promise<{ productIdentifier: string,
|
|
246
|
-
* a
|
|
215
|
+
* @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing
|
|
216
|
+
* a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the
|
|
247
217
|
* user cancelled the purchase, and an object with more information. The promise will be also be rejected if setup
|
|
248
218
|
* has not been called yet.
|
|
249
219
|
*/
|
|
@@ -252,19 +222,19 @@ export default class Purchases {
|
|
|
252
222
|
* iOS only. Purchase a package applying a given discount.
|
|
253
223
|
*
|
|
254
224
|
* @param {PurchasesPackage} aPackage The Package you wish to purchase. You can get the Packages by calling getOfferings
|
|
255
|
-
* @param {
|
|
256
|
-
* @returns {Promise<{ productIdentifier: string,
|
|
257
|
-
* a
|
|
225
|
+
* @param {PurchasesPromotionalOffer} discount Discount to apply to this package. Retrieve this discount using getPromotionalOffer.
|
|
226
|
+
* @returns {Promise<{ productIdentifier: string, customerInfo: CustomerInfo }>} A promise of an object containing
|
|
227
|
+
* a customer info object and a product identifier. Rejections return an error code, a boolean indicating if the
|
|
258
228
|
* user cancelled the purchase, and an object with more information. The promise will be also be rejected if setup
|
|
259
229
|
* has not been called yet.
|
|
260
230
|
*/
|
|
261
|
-
static purchaseDiscountedPackage(aPackage: PurchasesPackage, discount:
|
|
231
|
+
static purchaseDiscountedPackage(aPackage: PurchasesPackage, discount: PurchasesPromotionalOffer): Promise<MakePurchaseResult>;
|
|
262
232
|
/**
|
|
263
233
|
* Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases.
|
|
264
|
-
* @returns {Promise<
|
|
234
|
+
* @returns {Promise<CustomerInfo>} A promise of a customer info object. Rejections return an error code, and an
|
|
265
235
|
* userInfo object with more information. The promise will be also be rejected if setup has not been called yet.
|
|
266
236
|
*/
|
|
267
|
-
static restoreTransactions(): Promise<
|
|
237
|
+
static restoreTransactions(): Promise<CustomerInfo>;
|
|
268
238
|
/**
|
|
269
239
|
* Get the appUserID
|
|
270
240
|
* @returns {Promise<string>} The app user id in a promise
|
|
@@ -274,59 +244,30 @@ export default class Purchases {
|
|
|
274
244
|
* This function will logIn the current user with an appUserID. Typically this would be used after a log in
|
|
275
245
|
* to identify a user without calling configure.
|
|
276
246
|
* @param {String} appUserID The appUserID that should be linked to the currently user
|
|
277
|
-
* @returns {Promise<LogInResult>} A promise of an object that contains the
|
|
247
|
+
* @returns {Promise<LogInResult>} A promise of an object that contains the customerInfo after logging in, as well
|
|
278
248
|
* as a boolean indicating whether the user has just been created for the first time in the RevenueCat backend. The
|
|
279
249
|
* promise will be rejected if setup has not been called yet or if there's an issue logging in.
|
|
280
250
|
*/
|
|
281
251
|
static logIn(appUserID: string): Promise<LogInResult>;
|
|
282
252
|
/**
|
|
283
253
|
* Logs out the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache.
|
|
284
|
-
* @returns {Promise<
|
|
254
|
+
* @returns {Promise<CustomerInfo>} A promise of a customer info object. Rejections return an error code,
|
|
285
255
|
* and a userInfo object with more information. The promise will be rejected if setup has not been called yet or if
|
|
286
256
|
* there's an issue logging out.
|
|
287
257
|
*/
|
|
288
|
-
static logOut(): Promise<
|
|
289
|
-
/**
|
|
290
|
-
* @deprecated, use logIn instead.
|
|
291
|
-
* This function will alias two appUserIDs together.
|
|
292
|
-
* @param {String} newAppUserID The new appUserID that should be linked to the currently identified appUserID.
|
|
293
|
-
* Needs to be a string.
|
|
294
|
-
* @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and a
|
|
295
|
-
* userInfo object with more information. The promise will be rejected if setup has not been called yet or if
|
|
296
|
-
* there's an issue creating the alias.
|
|
297
|
-
*/
|
|
298
|
-
static createAlias(newAppUserID: string): Promise<PurchaserInfo>;
|
|
299
|
-
/**
|
|
300
|
-
* @deprecated, use logIn instead.
|
|
301
|
-
* This function will identify the current user with an appUserID. Typically this would be used after a logout to
|
|
302
|
-
* identify a new user without calling configure
|
|
303
|
-
* @param {String} newAppUserID The appUserID that should be linked to the currently user
|
|
304
|
-
* @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and an
|
|
305
|
-
* userInfo object with more information. The promise will be rejected if setup has not been called yet or if
|
|
306
|
-
* there's an issue identifying the user.
|
|
307
|
-
*/
|
|
308
|
-
static identify(newAppUserID: string): Promise<PurchaserInfo>;
|
|
309
|
-
/**
|
|
310
|
-
* @deprecated, use logOut instead.
|
|
311
|
-
* Resets the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the
|
|
312
|
-
* cache.
|
|
313
|
-
* @returns {Promise<PurchaserInfo>} A promise of a purchaser info object. Rejections return an error code, and an
|
|
314
|
-
* userInfo object with more information. The promise will be rejected if setup has not been called yet or if
|
|
315
|
-
* there's an issue resetting the user.
|
|
316
|
-
*/
|
|
317
|
-
static reset(): Promise<PurchaserInfo>;
|
|
258
|
+
static logOut(): Promise<CustomerInfo>;
|
|
318
259
|
/**
|
|
319
260
|
* Enables/Disables debugs logs
|
|
320
261
|
* @param {boolean} enabled Enable or not debug logs
|
|
321
262
|
*/
|
|
322
263
|
static setDebugLogsEnabled(enabled: boolean): Promise<void>;
|
|
323
264
|
/**
|
|
324
|
-
* Gets current
|
|
325
|
-
* @returns {Promise<
|
|
265
|
+
* Gets current customer info
|
|
266
|
+
* @returns {Promise<CustomerInfo>} A promise of a customer info object. Rejections return an error code, and an
|
|
326
267
|
* userInfo object with more information. The promise will be rejected if setup has not been called yet or if
|
|
327
|
-
* there's an issue getting the
|
|
268
|
+
* there's an issue getting the customer information.
|
|
328
269
|
*/
|
|
329
|
-
static
|
|
270
|
+
static getCustomerInfo(): Promise<CustomerInfo>;
|
|
330
271
|
/**
|
|
331
272
|
* This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation
|
|
332
273
|
* for subscriptions anytime a sync is needed, like after a successful purchase.
|
|
@@ -366,28 +307,28 @@ export default class Purchases {
|
|
|
366
307
|
[productId: string]: IntroEligibility;
|
|
367
308
|
}>;
|
|
368
309
|
/**
|
|
369
|
-
* iOS only. Use this function to retrieve the `
|
|
310
|
+
* iOS only. Use this function to retrieve the `PurchasesPromotionalOffer` for a given `PurchasesPackage`.
|
|
370
311
|
*
|
|
371
312
|
* @param product The `PurchasesProduct` the user intends to purchase.
|
|
372
313
|
* @param discount The `PurchasesDiscount` to apply to the product.
|
|
373
|
-
* @returns { Promise<
|
|
314
|
+
* @returns { Promise<PurchasesPromotionalOffer> } Returns when the `PurchasesPaymentDiscount` is returned.
|
|
374
315
|
* Null is returned for Android and incompatible iOS versions. The promise will be rejected if setup has not been
|
|
375
316
|
* called yet or if there's an error getting the payment discount.
|
|
376
317
|
*/
|
|
377
|
-
static
|
|
318
|
+
static getPromotionalOffer(product: PurchasesStoreProduct, discount: PurchasesStoreProductDiscount): Promise<PurchasesPromotionalOffer | undefined>;
|
|
378
319
|
/**
|
|
379
|
-
* Invalidates the cache for
|
|
320
|
+
* Invalidates the cache for customer information.
|
|
380
321
|
*
|
|
381
322
|
* Most apps will not need to use this method; invalidating the cache can leave your app in an invalid state.
|
|
382
|
-
* Refer to https://docs.revenuecat.com/docs/
|
|
323
|
+
* Refer to https://docs.revenuecat.com/docs/customer-info#section-get-user-information for more information on
|
|
383
324
|
* using the cache properly.
|
|
384
325
|
*
|
|
385
|
-
* This is useful for cases where
|
|
326
|
+
* This is useful for cases where customer information might have been updated outside of the app, like if a
|
|
386
327
|
* promotional subscription is granted through the RevenueCat dashboard.
|
|
387
328
|
* @returns {Promise<void>} The promise will be rejected if setup has not been called yet or there's an error
|
|
388
|
-
* invalidating the
|
|
329
|
+
* invalidating the customer info cache.
|
|
389
330
|
*/
|
|
390
|
-
static
|
|
331
|
+
static invalidateCustomerInfoCache(): Promise<void>;
|
|
391
332
|
/** iOS only. Presents a code redemption sheet, useful for redeeming offer codes
|
|
392
333
|
* Refer to https://docs.revenuecat.com/docs/ios-subscription-offers#offer-codes for more information on how
|
|
393
334
|
* to configure and use offer codes
|
|
@@ -565,9 +506,9 @@ export default class Purchases {
|
|
|
565
506
|
* Note: Billing features are only relevant to Google Play Android users.
|
|
566
507
|
* For other stores and platforms, billing features won't be checked.
|
|
567
508
|
*
|
|
568
|
-
* @param
|
|
509
|
+
* @param features An array of feature types to check for support. Feature types must be one of
|
|
569
510
|
* [BILLING_FEATURE]. By default, is an empty list and no specific feature support will be checked.
|
|
570
|
-
* @returns {Promise<
|
|
511
|
+
* @returns {Promise<boolean>} promise with boolean response. True if billing is supported, false otherwise.
|
|
571
512
|
*/
|
|
572
513
|
static canMakePayments(features?: BILLING_FEATURE[]): Promise<boolean>;
|
|
573
514
|
/**
|