@revenuecat/purchases-js 0.16.0 → 0.18.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
@@ -102,7 +102,7 @@ npm run test
102
102
  ## Running linters
103
103
 
104
104
  ```bash
105
- npm run test:typeCheck
105
+ npm run test:typecheck
106
106
  npm run svelte-check
107
107
  npm run prettier
108
108
  npm run lint
@@ -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
  /**
@@ -666,6 +691,10 @@ export declare interface PurchaseResult {
666
691
  * The redemption information after the purchase if available.
667
692
  */
668
693
  readonly redemptionInfo: RedemptionInfo | null;
694
+ /**
695
+ * The operation session id of the purchase.
696
+ */
697
+ readonly operationSessionId: string;
669
698
  }
670
699
 
671
700
  /**
@@ -699,17 +728,17 @@ export declare class Purchases {
699
728
  * @param apiKey - RevenueCat API Key. Can be obtained from the RevenueCat dashboard.
700
729
  * @param appUserId - Your unique id for identifying the user.
701
730
  * @param httpConfig - Advanced http configuration to customise the SDK usage {@link HttpConfig}.
731
+ * @param flags - Advanced functionality configuration {@link FlagsConfig}.
702
732
  * @throws {@link PurchasesError} if the API key or user id are invalid.
703
733
  */
704
- static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig): Purchases;
734
+ static configure(apiKey: string, appUserId: string, httpConfig?: HttpConfig, flags?: FlagsConfig): Purchases;
705
735
  /**
706
736
  * Loads and caches some optional data in the Purchases SDK.
707
- * Currently only fetching branding information. You can call this method
708
- * after configuring the SDK to speed up the first call to
709
- * {@link Purchases.purchase}.
737
+ * Currently only fetching branding information.
738
+ * You can call this method after configuring the SDK to speed
739
+ * up the first call to {@link Purchases.purchase}.
710
740
  */
711
741
  preload(): Promise<void>;
712
- private hasLoadedResources;
713
742
  /**
714
743
  * Fetch the configured offerings for this user. You can configure these
715
744
  * in the RevenueCat dashboard.