@revenuecat/purchases-js 0.0.11 → 0.0.13

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 CHANGED
@@ -55,9 +55,10 @@ By downloading the current Offerings you can easily build a Paywall page using t
55
55
  associated `rcBillingProduct` and price.
56
56
 
57
57
  ```typescript
58
+ const appUserId = "the unique id of the user in your systems";
58
59
  const purchases = new Purchases("your RC_PUBLISHABLE_API_KEY");
59
60
 
60
- purchases.getOfferings().then((offerings) => {
61
+ purchases.getOfferings(appUserId).then((offerings) => {
61
62
  // Get current offering
62
63
  console.log(offerings.current);
63
64
  // Or a dictionary of all offerings
@@ -127,6 +128,17 @@ const App = () => (
127
128
  );
128
129
  ```
129
130
 
131
+ If you need further information about the user's entitlements, you can use the `getCustomerInfo` method:
132
+
133
+ ```ts
134
+ const customerInfo = await purchases.getCustomerInfo(appUserId);
135
+ ```
136
+
137
+ ### Important note
138
+
139
+ Please be aware that the information about the entitlements can be manipulated by malicious actors, so make sure
140
+ you protect your apps against attacks that modify the entitlements by validating access through your servers.
141
+
130
142
  ## Subscribe a User to an entitlement and allow payment with Stripe
131
143
 
132
144
  RCBilling allows you to use your payment gateway for payments.
@@ -136,88 +148,28 @@ In this example we will show Stripe, more will be supported soon!
136
148
 
137
149
  You built your paywall, and your user just clicked on the offer they want to subscribe to.
138
150
 
139
- ### 1. Call the .subscribe method to initialise the process
140
-
141
151
  ```tsx
142
152
  const purchases = new Purchases("your RC_PUBLISHABLE_API_KEY");
143
- // You can retrieve this from the offerings you downloaded, as example:
144
- // offerings.current.packages[0].rcBillingProduct.identifier
145
- const rcBillingProductIndentifier =
146
- "the Product Identifier the user wants to buy";
153
+ // You can retrieve the package from the offerings through `getOfferings`:
154
+ const rcBillingPackage = offerings.current.availablePackages[0];
147
155
  const appUserId =
148
156
  "the unique id of the user that wants to subscribe to your product";
157
+ const entitlementIdToCheck =
158
+ "the entitlementId you set up in RC for your product"; // TODO: remove once this is not needed
149
159
 
150
- purchase.subscribe(appUserId, rcBillingProductIndentifier).then((response) => {
151
- if (response.nextAction === "collect_payment_info") {
152
- // Use the clientSecret to show the StripeElements payment components
153
- showStripeElements({
154
- setupIntentClientSecret: response.data.clientSecret,
155
- });
160
+ purchase.purchasePackage(appUserId, rcBillingPackage).then((response) => {
161
+ const isEntitled =
162
+ entitlementIdToCheck in response.customerInfo.entitlements.active;
163
+ if (isEntitled == true) {
164
+ console.log(`User ${appUserID} is entitled to ${entitlementId}`);
156
165
  } else {
157
- // No need to collect payment info, just wait for the entitlement to be granted
166
+ console.log(
167
+ `User ${appUserID} is not entitled to ${entitlementId}, even after ${numberOfAttempts} attempts`,
168
+ );
158
169
  }
159
170
  });
160
171
  ```
161
172
 
162
- ### 2. [If nextAction === 'collect_payment_info'] Show the Stripe Elements to collect payment
163
-
164
- ```tsx
165
- // Set up stripe as shown in their docs
166
- const stripePromise = loadStripe(
167
- import.meta.env.VITE_RC_STRIPE_PK_KEY as string,
168
- { stripeAccount: import.meta.env.VITE_RC_STRIPE_ACCOUNT_ID as string },
169
- );
170
-
171
- // Use the clientSecret obtained in the step 1. Call the .subscribe method to initialise the process
172
- const PaymentForm = ({ clientSecret }) => {
173
- const handleSubmit = async (e: SyntheticEvent) => {
174
- e.preventDefault();
175
- stripe
176
- .confirmSetup({
177
- elements,
178
- clientSecret,
179
- confirmParams: {
180
- return_url: `${window.location.origin}/success`,
181
- },
182
- redirect: "if_required",
183
- })
184
- .then((response) => {
185
- // All is done you can now wait for the entitlement to be granted.
186
- });
187
- };
188
-
189
- return (
190
- <form id="payment-form" onSubmit={handleSubmit}>
191
- <PaymentElement id="payment-element" options={paymentElementOptions} />
192
- </form>
193
- );
194
- };
195
- ```
196
-
197
- ### 3. Wait for the entitlement to be granted
198
-
199
- You can use the `.waitForEntitlement` method.
200
-
201
- ```tsx
202
- const appUserId = "the unique id of the user in your systems";
203
- const entitlementId = "the entitlementId you set up in RC";
204
-
205
- const purchases = new Purchases("your RC_PUBLISHABLE_API_KEY");
206
- const numberOfAttempts = 10;
207
-
208
- purchases
209
- .waitForEntitlement(appUserId, entitlementId, numberOfAttempts)
210
- .then((isEntitled) => {
211
- if (isEntitled == true) {
212
- console.log(`User ${appUserID} is entitled to ${entitlementId}`);
213
- } else {
214
- console.log(
215
- `User ${appUserID} is not entitled to ${entitlementId}, even after ${numberOfAttempts} attempts`,
216
- );
217
- }
218
- });
219
- ```
220
-
221
173
  # Development
222
174
 
223
175
  ## Install the library in a local project
@@ -241,9 +193,38 @@ npm i /path/to/rcbilling-js
241
193
  ## Running tests
242
194
 
243
195
  ```bash
244
- npm test
196
+ npm run test
197
+ ```
198
+
199
+ ## Running linters
200
+
201
+ ```bash
202
+ npm run test:typeCheck
203
+ npm run svelte-check
204
+ npm run prettier
205
+ npm run lint
245
206
  ```
246
207
 
208
+ ## Update API specs
209
+
210
+ ```bash
211
+ npm run extract-api
212
+ ```
213
+
214
+ This will update the files in `api-report` with the latest public API.
215
+ If it has uncommited changes, CI tests will fail. Run this command and commit the changes if
216
+ they are expected.
217
+
218
+ ## Update reference docs
219
+
220
+ ```bash
221
+ npm run generate-docs
222
+ ```
223
+
224
+ This will update the reference docs in the `docs` folder with the latest public API docs.
225
+ If it has uncommited changes, CI tests will fail. Run this command and commit the changes if
226
+ they are expected.
227
+
247
228
  # Publishing a new version
248
229
 
249
230
  - Update the version in `package.json`
@@ -1,93 +1,459 @@
1
- export declare type CustomerInfo = CustomerInfo_2;
2
-
3
- declare interface CustomerInfo_2 {
4
- entitlements: EntitlementInfos;
5
- managementURL: string | null;
6
- requestDate: Date;
7
- firstSeenDate: Date;
8
- originalPurchaseDate: Date | null;
1
+ /**
2
+ * Type containing all information regarding the customer.
3
+ * @public
4
+ */
5
+ export declare interface CustomerInfo {
6
+ /**
7
+ * Entitlements attached to this customer info.
8
+ */
9
+ readonly entitlements: EntitlementInfos;
10
+ /**
11
+ * Map of productIds to expiration dates.
12
+ */
13
+ readonly allExpirationDatesByProduct: {
14
+ [productIdentifier: string]: Date | null;
15
+ };
16
+ /**
17
+ * Map of productIds to purchase dates.
18
+ */
19
+ readonly allPurchaseDatesByProduct: {
20
+ [productIdentifier: string]: Date;
21
+ };
22
+ /**
23
+ * Set of active subscription product identifiers.
24
+ */
25
+ readonly activeSubscriptions: Set<string>;
26
+ /**
27
+ * URL to manage the active subscription of the user.
28
+ * If this user has an active RC Billing subscription, a link to the management page.
29
+ * If this user has an active iOS subscription, this will point to the App Store.
30
+ * If the user has an active Play Store subscription it will point there.
31
+ * If there are no active subscriptions it will be null.
32
+ */
33
+ readonly managementURL: string | null;
34
+ /**
35
+ * Date when this info was requested.
36
+ */
37
+ readonly requestDate: Date;
38
+ /**
39
+ * The date this user was first seen in RevenueCat.
40
+ */
41
+ readonly firstSeenDate: Date;
42
+ /**
43
+ * The purchase date for the version of the application when the user bought the app.
44
+ * Use this for grandfathering users when migrating to subscriptions. This can be null.
45
+ */
46
+ readonly originalPurchaseDate: Date | null;
47
+ /**
48
+ * The original App User Id recorded for this user.
49
+ */
50
+ readonly originalAppUserId: string;
9
51
  }
10
52
 
53
+ /**
54
+ * This object gives you access to all the information about the status
55
+ * of a user's entitlements.
56
+ * @public
57
+ */
11
58
  export declare interface EntitlementInfo {
12
- identifier: string;
13
- isActive: boolean;
14
- originalPurchaseDate: Date;
15
- expirationDate: Date;
16
- productIdentifier: string;
59
+ /**
60
+ * The entitlement identifier configured in the RevenueCat dashboard.
61
+ */
62
+ readonly identifier: string;
63
+ /**
64
+ * True if the user has access to the entitlement.
65
+ */
66
+ readonly isActive: boolean;
67
+ /**
68
+ * True if the underlying subscription is set to renew at the end of the
69
+ * billing period (expirationDate). Will always be True if entitlement is
70
+ * for lifetime access.
71
+ */
72
+ readonly willRenew: boolean;
73
+ /**
74
+ * The store where this entitlement was unlocked from.
75
+ */
76
+ readonly store: Store;
77
+ /**
78
+ * The first date this entitlement was purchased.
79
+ */
80
+ readonly originalPurchaseDate: Date;
81
+ /**
82
+ * The expiration date for the entitlement, can be `null` for lifetime
83
+ * access. If the {@link EntitlementInfo.periodType} is `trial`, this is the trial
84
+ * expiration date.
85
+ */
86
+ readonly expirationDate: Date | null;
87
+ /**
88
+ * The product identifier that unlocked this entitlement.
89
+ */
90
+ readonly productIdentifier: string;
91
+ /**
92
+ * The date an unsubscribe was detected. Can be `null`.
93
+ * Note: Entitlement may still be active even if user has unsubscribed.
94
+ * Check the {@link EntitlementInfo.isActive} property.
95
+ */
96
+ readonly unsubscribeDetectedAt: Date | null;
97
+ /**
98
+ * The date a billing issue was detected. Can be `null` if there is
99
+ * no billing issue or an issue has been resolved. Note: Entitlement may
100
+ * still be active even if there is a billing issue.
101
+ * Check the `isActive` property.
102
+ */
103
+ readonly billingIssueDetectedAt: Date | null;
104
+ /**
105
+ * False if this entitlement is unlocked via a production purchase.
106
+ */
107
+ readonly isSandbox: boolean;
108
+ /**
109
+ * The last period type this entitlement was in.
110
+ */
111
+ readonly periodType: PeriodType;
17
112
  }
18
113
 
114
+ /**
115
+ * Contains all the entitlements associated to the user.
116
+ * @public
117
+ */
19
118
  export declare interface EntitlementInfos {
20
- all: {
119
+ /**
120
+ * Map of all {@link EntitlementInfo} objects (active and inactive) keyed by
121
+ * entitlement identifier.
122
+ */
123
+ readonly all: {
21
124
  [entitlementId: string]: EntitlementInfo;
22
125
  };
23
- active: {
126
+ /**
127
+ * Dictionary of active {@link EntitlementInfo} keyed by entitlement identifier.
128
+ */
129
+ readonly active: {
24
130
  [entitlementId: string]: EntitlementInfo;
25
131
  };
26
132
  }
27
133
 
28
- export declare type Offering = Offering_2;
29
-
30
- declare interface Offering_2 {
31
- id: string;
32
- identifier: string;
33
- displayName: string;
34
- packages: Package_2[];
134
+ /**
135
+ * Error codes for the Purchases SDK.
136
+ * @public
137
+ */
138
+ export declare enum ErrorCode {
139
+ UnknownError = 0,
140
+ UserCancelledError = 1,
141
+ StoreProblemError = 2,
142
+ PurchaseNotAllowedError = 3,
143
+ PurchaseInvalidError = 4,
144
+ ProductNotAvailableForPurchaseError = 5,
145
+ ProductAlreadyPurchasedError = 6,
146
+ ReceiptAlreadyInUseError = 7,
147
+ InvalidReceiptError = 8,
148
+ MissingReceiptFileError = 9,
149
+ NetworkError = 10,
150
+ InvalidCredentialsError = 11,
151
+ UnexpectedBackendResponseError = 12,
152
+ InvalidAppUserIdError = 14,
153
+ OperationAlreadyInProgressError = 15,
154
+ UnknownBackendError = 16,
155
+ InvalidAppleSubscriptionKeyError = 17,
156
+ IneligibleError = 18,
157
+ InsufficientPermissionsError = 19,
158
+ PaymentPendingError = 20,
159
+ InvalidSubscriberAttributesError = 21,
160
+ LogOutWithAnonymousUserError = 22,
161
+ ConfigurationError = 23,
162
+ UnsupportedError = 24,
163
+ EmptySubscriberAttributesError = 25,
164
+ CustomerInfoError = 28,
165
+ SignatureVerificationError = 36
35
166
  }
36
167
 
37
- export declare type Offerings = Offerings_2;
38
-
39
- declare interface Offerings_2 {
40
- all: {
41
- [offeringId: string]: Offering_2;
168
+ /**
169
+ * An offering is a collection of {@link Package} available for the user to purchase.
170
+ * For more info see https://docs.revenuecat.com/docs/entitlements
171
+ * @public
172
+ */
173
+ export declare interface Offering {
174
+ /**
175
+ * Unique identifier defined in RevenueCat dashboard.
176
+ */
177
+ readonly identifier: string;
178
+ /**
179
+ * Offering description defined in RevenueCat dashboard.
180
+ */
181
+ readonly serverDescription: string;
182
+ /**
183
+ * Offering metadata defined in RevenueCat dashboard.
184
+ */
185
+ readonly metadata: {
186
+ [key: string]: unknown;
187
+ } | null;
188
+ /**
189
+ * A map of all the packages available for purchase keyed by package ID.
190
+ */
191
+ readonly packagesById: {
192
+ [key: string]: Package;
42
193
  };
43
- current: Offering_2 | null;
194
+ /**
195
+ * A list of all the packages available for purchase.
196
+ */
197
+ readonly availablePackages: Package[];
198
+ /**
199
+ * Lifetime package type configured in the RevenueCat dashboard, if available.
200
+ */
201
+ readonly lifetimePackage: Package | null;
202
+ /**
203
+ * Annual package type configured in the RevenueCat dashboard, if available.
204
+ */
205
+ readonly annualPackage: Package | null;
206
+ /**
207
+ * Six month package type configured in the RevenueCat dashboard, if available.
208
+ */
209
+ readonly sixMonthPackage: Package | null;
210
+ /**
211
+ * Three month package type configured in the RevenueCat dashboard, if available.
212
+ */
213
+ readonly threeMonthPackage: Package | null;
214
+ /**
215
+ * Two month package type configured in the RevenueCat dashboard, if available.
216
+ */
217
+ readonly twoMonthPackage: Package | null;
218
+ /**
219
+ * Monthly package type configured in the RevenueCat dashboard, if available.
220
+ */
221
+ readonly monthlyPackage: Package | null;
222
+ /**
223
+ * Weekly package type configured in the RevenueCat dashboard, if available.
224
+ */
225
+ readonly weeklyPackage: Package | null;
44
226
  }
45
227
 
46
- export declare type Package = Package_2;
47
-
48
- declare interface Package_2 {
49
- id: string;
50
- identifier: string;
51
- rcBillingProduct: Product;
228
+ /**
229
+ * This class contains all the offerings configured in RevenueCat dashboard.
230
+ * For more info see https://docs.revenuecat.com/docs/entitlements
231
+ * @public
232
+ */
233
+ export declare interface Offerings {
234
+ /**
235
+ * Dictionary of all {@link Offering} objects keyed by their identifier.
236
+ */
237
+ readonly all: {
238
+ [offeringId: string]: Offering;
239
+ };
240
+ /**
241
+ * Current offering configured in the RevenueCat dashboard.
242
+ */
243
+ readonly current: Offering | null;
52
244
  }
53
245
 
54
- declare type PaymentProvider = "stripe";
246
+ /**
247
+ * Contains information about the product available for the user to purchase.
248
+ * For more info see https://docs.revenuecat.com/docs/entitlements
249
+ * @public
250
+ */
251
+ export declare interface Package {
252
+ /**
253
+ * Unique identifier for this package. Can be one a predefined package type or a custom one.
254
+ */
255
+ readonly identifier: string;
256
+ /**
257
+ * The {@link Product} assigned to this package.
258
+ */
259
+ readonly rcBillingProduct: Product;
260
+ /**
261
+ * The type of package.
262
+ */
263
+ readonly packageType: PackageType;
264
+ }
55
265
 
56
- declare type PaymentProviderConfigModels = {
57
- stripe?: {
58
- publishableKey: string;
59
- accountId: string;
60
- };
61
- };
266
+ /**
267
+ * Enumeration of all possible Package types.
268
+ * @public
269
+ */
270
+ export declare enum PackageType {
271
+ /**
272
+ * A package that was defined with an unrecognized RC identifier.
273
+ */
274
+ Unknown = "unknown",
275
+ /**
276
+ * A package that was defined with a custom identifier.
277
+ */
278
+ Custom = "custom",
279
+ /**
280
+ * A package configured with the predefined lifetime identifier.
281
+ */
282
+ Lifetime = "$rc_lifetime",
283
+ /**
284
+ * A package configured with the predefined annual identifier.
285
+ */
286
+ Annual = "$rc_annual",
287
+ /**
288
+ * A package configured with the predefined six month identifier.
289
+ */
290
+ SixMonth = "$rc_six_month",
291
+ /**
292
+ * A package configured with the predefined three month identifier.
293
+ */
294
+ ThreeMonth = "$rc_three_month",
295
+ /**
296
+ * A package configured with the predefined two month identifier.
297
+ */
298
+ TwoMonth = "$rc_two_month",
299
+ /**
300
+ * A package configured with the predefined monthly identifier.
301
+ */
302
+ Monthly = "$rc_monthly",
303
+ /**
304
+ * A package configured with the predefined weekly identifier.
305
+ */
306
+ Weekly = "$rc_weekly"
307
+ }
62
308
 
63
- declare type PaymentProviderSettings = Record<PaymentProvider, PaymentProviderConfigModels[PaymentProvider]>;
309
+ /**
310
+ * Supported period types for an entitlement.
311
+ * - "normal" If the entitlement is not under an introductory or trial period.
312
+ * - "intro" If the entitlement is under an introductory period.
313
+ * - "trial" If the entitlement is under a trial period.
314
+ * @public
315
+ */
316
+ export declare type PeriodType = "normal" | "intro" | "trial";
64
317
 
65
- declare interface Price {
66
- amount: number;
67
- currency: string;
318
+ /**
319
+ * Price information for a product.
320
+ * @public
321
+ */
322
+ export declare interface Price {
323
+ /**
324
+ * Price in full units of the currency.
325
+ */
326
+ readonly amount: number;
327
+ /**
328
+ * Returns ISO 4217 currency code for price.
329
+ * For example, if price is specified in British pounds sterling,
330
+ * currency is "GBP".
331
+ * If currency code cannot be determined, currency symbol is returned.
332
+ */
333
+ readonly currency: string;
68
334
  }
69
335
 
70
- declare interface Product {
71
- id: string;
72
- displayName: string;
73
- identifier: string;
74
- currentPrice: Price | null;
75
- normalPeriodDuration: string | null;
336
+ /**
337
+ * Represents product's listing details.
338
+ * @public
339
+ */
340
+ export declare interface Product {
341
+ /**
342
+ * The product ID.
343
+ */
344
+ readonly identifier: string;
345
+ /**
346
+ * Name of the product.
347
+ */
348
+ readonly displayName: string;
349
+ /**
350
+ * Price of the product.
351
+ */
352
+ readonly currentPrice: Price;
353
+ /**
354
+ * The period duration for a subscription product.
355
+ */
356
+ readonly normalPeriodDuration: string | null;
357
+ /**
358
+ * The offering ID used to obtain this product.
359
+ */
360
+ readonly presentedOfferingIdentifier: string;
76
361
  }
77
362
 
363
+ /**
364
+ * Entry point for Purchases SDK. It should be instantiated as soon as your
365
+ * app is started. Only one instance of Purchases should be instantiated
366
+ * at a time!
367
+ * @public
368
+ */
78
369
  export declare class Purchases {
79
- constructor(apiKey: string, paymentProviderSettings: PaymentProviderSettings);
80
- private toOfferings;
370
+ /**
371
+ * Constructor for Purchases.
372
+ * @param apiKey - RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
373
+ */
374
+ constructor(apiKey: string);
375
+ /**
376
+ * Fetch the configured offerings for this user. You can configure these
377
+ * in the RevenueCat dashboard.
378
+ * @param appUserId - Your app's user id in your system.
379
+ */
81
380
  getOfferings(appUserId: string): Promise<Offerings>;
82
- isEntitledTo(appUserId: string, entitlementIdentifier: string): Promise<boolean>;
83
- purchasePackage(appUserId: string, rcPackage: Package, entitlementId: string, // TODO: Remove this parameter once we don't have to poll for entitlements
84
- { customerEmail, htmlTarget, }?: {
85
- customerEmail?: string;
86
- htmlTarget?: HTMLElement;
87
- }): Promise<boolean>;
88
- getCustomerInfo(appUserId: string): Promise<CustomerInfo>;
89
- private logMissingProductIds;
90
- isSandbox(): boolean;
91
- }
381
+ /**
382
+ * Convenience method to check whether a user is entitled to a specific
383
+ * entitlement. This will use {@link Purchases.getCustomerInfo} under the hood.
384
+ * @param appUserId - Your app's user id in your system.
385
+ * @param entitlementIdentifier - The entitlement identifier you want to check.
386
+ * @returns Whether the user is entitled to the specified entitlement
387
+ * @throws {@link PurchasesError} if there is an error while fetching the customer info.
388
+ * @see {@link Purchases.getCustomerInfo}
389
+ */
390
+ isEntitledTo(appUserId: string, entitlementIdentifier: string): Promise<boolean>;
391
+ /**
392
+ * Method to perform a purchase for a given package. You can obtain the
393
+ * package from {@link Purchases.getOfferings}. This method will present the purchase
394
+ * form on your site, using the given HTML element as the mount point, if
395
+ * provided, or as a modal if not.
396
+ * @param appUserId - Your app's user id in your system.
397
+ * @param rcPackage - The package you want to purchase. Obtained from {@link Purchases.getOfferings}.
398
+ * @param customerEmail - The email of the user. If null, RevenueCat will ask the customer for their email.
399
+ * @param htmlTarget - The HTML element where the billing view should be added. If null, a new div will be created at the root of the page and appended to the body.
400
+ * @returns The customer info after the purchase is completed successfuly.
401
+ * @throws {@link PurchasesError} if there is an error while performing the purchase. If the {@link PurchasesError.errorCode} is {@link ErrorCode.UserCancelledError}, the user cancelled the purchase.
402
+ */
403
+ purchasePackage(appUserId: string, rcPackage: Package, customerEmail?: string, htmlTarget?: HTMLElement): Promise<{
404
+ customerInfo: CustomerInfo;
405
+ }>;
406
+ /**
407
+ * Gets latest available {@link CustomerInfo}.
408
+ * @param appUserId - Your app's user id in your system.
409
+ * @returns The latest {@link CustomerInfo}.
410
+ * @throws {@link PurchasesError} if there is an error while fetching the customer info.
411
+ */
412
+ getCustomerInfo(appUserId: string): Promise<CustomerInfo>;
413
+ /**
414
+ * @returns Whether the SDK is using a sandbox API Key.
415
+ */
416
+ isSandbox(): boolean;
417
+ }
418
+
419
+ /**
420
+ * Error class for Purchases SDK. You should handle these errors and react
421
+ * accordingly in your app.
422
+ * @public
423
+ */
424
+ export declare class PurchasesError extends Error {
425
+ /**
426
+ * Error code for the error. This is useful to appropriately react to
427
+ * different error situations.
428
+ */
429
+ readonly errorCode: ErrorCode;
430
+ /**
431
+ * Underlying error message. This provides more details on the error and
432
+ * can be useful for debugging and logging.
433
+ */
434
+ readonly underlyingErrorMessage?: string | null | undefined;
435
+ constructor(
436
+ /**
437
+ * Error code for the error. This is useful to appropriately react to
438
+ * different error situations.
439
+ */
440
+ errorCode: ErrorCode,
441
+ /**
442
+ * Message for the error. This is useful for debugging and logging.
443
+ */
444
+ message?: string,
445
+ /**
446
+ * Underlying error message. This provides more details on the error and
447
+ * can be useful for debugging and logging.
448
+ */
449
+ underlyingErrorMessage?: string | null | undefined);
450
+ toString: () => string;
451
+ }
452
+
453
+ /**
454
+ * The store where the user originally subscribed.
455
+ * @public
456
+ */
457
+ export declare type Store = "app_store" | "mac_app_store" | "play_store" | "amazon" | "stripe" | "rc_billing" | "promotional" | "unknown";
92
458
 
93
- export { }
459
+ export { }