@revenuecat/purchases-js 0.16.0 → 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.
@@ -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
@@ -606,6 +618,13 @@ export declare enum ProductType {
606
618
  NonConsumable = "non_consumable"
607
619
  }
608
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
+
609
628
  /**
610
629
  * Represents a possible option to purchase a product.
611
630
  * @public
@@ -651,6 +670,12 @@ export declare interface PurchaseParams {
651
670
  * Defaults to english.
652
671
  */
653
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;
654
679
  }
655
680
 
656
681
  /**
@@ -699,9 +724,10 @@ export declare class Purchases {
699
724
  * @param apiKey - RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
700
725
  * @param appUserId - Your unique id for identifying the user.
701
726
  * @param httpConfig - Advanced http configuration to customise the SDK usage {@link HttpConfig}.
727
+ * @param flags - Advanced functionality configuration {@link FlagsConfig}.
702
728
  * @throws {@link PurchasesError} if the API key or user id are invalid.
703
729
  */
704
- static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig): Purchases;
730
+ static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig, flags?: FlagsConfig): Purchases;
705
731
  /**
706
732
  * Loads and caches some optional data in the Purchases SDK.
707
733
  * Currently only fetching branding information. You can call this method