@revenuecat/purchases-js 0.11.2 → 0.12.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.
@@ -308,6 +308,7 @@ export declare interface Offering {
308
308
 
309
309
  /**
310
310
  * Keywords for identifying specific offerings in the {@link Purchases.getOfferings} method.
311
+ * @public
311
312
  */
312
313
  export declare enum OfferingKeyword {
313
314
  /**
@@ -635,6 +636,21 @@ export declare interface PurchaseParams {
635
636
  customerEmail?: string;
636
637
  }
637
638
 
639
+ /**
640
+ * Represents the result of a purchase operation.
641
+ * @public
642
+ */
643
+ export declare interface PurchaseResult {
644
+ /**
645
+ * The customer information after the purchase.
646
+ */
647
+ readonly customerInfo: CustomerInfo;
648
+ /**
649
+ * The redemption information after the purchase if available.
650
+ */
651
+ readonly redemptionInfo: RedemptionInfo | null;
652
+ }
653
+
638
654
  /**
639
655
  * Entry point for Purchases SDK. It should be instantiated as soon as your
640
656
  * app is started. Only one instance of Purchases should be instantiated
@@ -712,21 +728,17 @@ export declare class Purchases {
712
728
  * @returns a Promise for the customer info after the purchase is completed successfully.
713
729
  * @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.
714
730
  */
715
- purchasePackage(rcPackage: Package, customerEmail?: string, htmlTarget?: HTMLElement): Promise<{
716
- customerInfo: CustomerInfo;
717
- }>;
731
+ purchasePackage(rcPackage: Package, customerEmail?: string, htmlTarget?: HTMLElement): Promise<PurchaseResult>;
718
732
  /**
719
733
  * Method to perform a purchase for a given package. You can obtain the
720
734
  * package from {@link Purchases.getOfferings}. This method will present the purchase
721
735
  * form on your site, using the given HTML element as the mount point, if
722
736
  * provided, or as a modal if not.
723
737
  * @param params - The parameters object to customise the purchase flow. Check {@link PurchaseParams}
724
- * @returns a Promise for the customer info after the purchase is completed successfully.
738
+ * @returns a Promise for the customer and redemption info after the purchase is completed successfully.
725
739
  * @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.
726
740
  */
727
- purchase(params: PurchaseParams): Promise<{
728
- customerInfo: CustomerInfo;
729
- }>;
741
+ purchase(params: PurchaseParams): Promise<PurchaseResult>;
730
742
  /**
731
743
  * Gets latest available {@link CustomerInfo}.
732
744
  * @returns The latest {@link CustomerInfo}.
@@ -810,6 +822,18 @@ export declare class Purchases {
810
822
  readonly backendErrorCode?: number;
811
823
  }
812
824
 
825
+ /**
826
+ * This object gives you access to the purchase redemption data when
827
+ * the purchase can be redeemed to a mobile user, like in the case of anonymous users.
828
+ * @public
829
+ */
830
+ export declare interface RedemptionInfo {
831
+ /**
832
+ * The redeem url.
833
+ */
834
+ readonly redeemUrl: string | null;
835
+ }
836
+
813
837
  /**
814
838
  * The store where the user originally subscribed.
815
839
  * @public