@revenuecat/purchases-js 0.15.2 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,11 +12,11 @@ Login @ [app.revenuecat.com](https://app.revenuecat.com)
12
12
 
13
13
  - Connect your Stripe account if you haven't already (More payment gateways are coming soon)
14
14
  - Create a Project (if you haven't already)
15
- - Add a new RCBilling app
15
+ - Add a new Web Billing app
16
16
  - Get the sandbox API key or production API key (depending on the environment)
17
- - Create some products for the RCBilling App
18
- - Create an offering and add packages with RCBilling products
19
- - Create the entitlements you need in your app and link them to the RCBilling products
17
+ - Create some products for the Web Billing App
18
+ - Create an offering and add packages with Web Billing products
19
+ - Create the entitlements you need in your app and link them to the Web Billing products
20
20
 
21
21
  # Installation
22
22
 
@@ -32,7 +32,7 @@ Login @ [app.revenuecat.com](https://app.revenuecat.com)
32
32
 
33
33
  # Usage
34
34
 
35
- See the [RevenueCat docs](https://www.revenuecat.com/docs/web/revenuecat-billing) and the [SDK Reference](https://revenuecat.github.io/purchases-js-docs).
35
+ See the [RevenueCat docs](https://www.revenuecat.com/docs/web/web-billing) and the [SDK Reference](https://revenuecat.github.io/purchases-js-docs).
36
36
 
37
37
  # Development
38
38
 
@@ -110,7 +110,7 @@ npm run lint
110
110
 
111
111
  ## Running E2E tests
112
112
 
113
- Please check the Demo app readme [here](./examples/rcbilling-demo/README.md#e2e-tests)
113
+ Please check the Demo app readme [here](./examples/webbilling-demo/README.md#e2e-tests)
114
114
 
115
115
  ## Update API specs
116
116
 
@@ -27,7 +27,7 @@ export declare interface CustomerInfo {
27
27
  readonly activeSubscriptions: Set<string>;
28
28
  /**
29
29
  * URL to manage the active subscription of the user.
30
- * If this user has an active RC Billing subscription, a link to the management page.
30
+ * If this user has an active Web Billing subscription, a link to the management page.
31
31
  * If this user has an active iOS subscription, this will point to the App Store.
32
32
  * If the user has an active Play Store subscription it will point there.
33
33
  * If there are no active subscriptions it will be null.
@@ -172,6 +172,18 @@ export declare enum ErrorCode {
172
172
  InvalidEmailError = 38
173
173
  }
174
174
 
175
+ /**
176
+ * Flags used to enable or disable certain features in the sdk.
177
+ * @public
178
+ */
179
+ export declare interface FlagsConfig {
180
+ /**
181
+ * If set to true, the SDK will automatically collect UTM parameters and store them as at the time of purchase.
182
+ * @defaultValue true
183
+ */
184
+ autoCollectUTMAsMetadata?: boolean;
185
+ }
186
+
175
187
  /**
176
188
  * Parameters for the {@link Purchases.getOfferings} method.
177
189
  * @public
@@ -352,8 +364,13 @@ export declare interface Package {
352
364
  readonly identifier: string;
353
365
  /**
354
366
  * The {@link Product} assigned to this package.
367
+ * @deprecated - Use {@link Package.webBillingProduct} instead.
355
368
  */
356
369
  readonly rcBillingProduct: Product;
370
+ /**
371
+ * The {@link Product} assigned to this package.
372
+ */
373
+ readonly webBillingProduct: Product;
357
374
  /**
358
375
  * The type of package.
359
376
  */
@@ -601,6 +618,13 @@ export declare enum ProductType {
601
618
  NonConsumable = "non_consumable"
602
619
  }
603
620
 
621
+ /**
622
+ * Metadata that can be passed to the backend when making a purchase.
623
+ * They will propagate to the payment gateway (i.e. Stripe) and to RevenueCat.
624
+ * @public
625
+ */
626
+ export declare type PurchaseMetadata = Record<string, string | null>;
627
+
604
628
  /**
605
629
  * Represents a possible option to purchase a product.
606
630
  * @public
@@ -646,6 +670,12 @@ export declare interface PurchaseParams {
646
670
  * Defaults to english.
647
671
  */
648
672
  defaultLocale?: string;
673
+ /**
674
+ * The purchase metadata to be passed to the backend.
675
+ * Any information provided here will be propagated to the payment gateway and
676
+ * to the RC transaction as metadata.
677
+ */
678
+ metadata?: PurchaseMetadata;
649
679
  }
650
680
 
651
681
  /**
@@ -694,9 +724,10 @@ export declare class Purchases {
694
724
  * @param apiKey - RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
695
725
  * @param appUserId - Your unique id for identifying the user.
696
726
  * @param httpConfig - Advanced http configuration to customise the SDK usage {@link HttpConfig}.
727
+ * @param flags - Advanced functionality configuration {@link FlagsConfig}.
697
728
  * @throws {@link PurchasesError} if the API key or user id are invalid.
698
729
  */
699
- static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig): Purchases;
730
+ static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig, flags?: FlagsConfig): Purchases;
700
731
  /**
701
732
  * Loads and caches some optional data in the Purchases SDK.
702
733
  * Currently only fetching branding information. You can call this method