@revenuecat/purchases-js 0.7.0 → 0.8.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.
@@ -419,6 +419,11 @@ export declare interface PresentedOfferingContext {
419
419
  * The targeting context used to obtain this object.
420
420
  */
421
421
  readonly targetingContext: TargetingContext | null;
422
+ /**
423
+ * If obtained this information from a placement,
424
+ * the identifier of the placement.
425
+ */
426
+ readonly placementIdentifier: string | null;
422
427
  }
423
428
 
424
429
  /**
@@ -620,6 +625,14 @@ export declare class Purchases {
620
625
  * in the RevenueCat dashboard.
621
626
  */
622
627
  getOfferings(params?: GetOfferingsParams): Promise<Offerings>;
628
+ /**
629
+ * Retrieves a specific offering by a placement identifier.
630
+ * For more info see https://www.revenuecat.com/docs/tools/targeting
631
+ * @param placementIdentifier - The placement identifier to retrieve the offering for.
632
+ * @param params - The parameters object to customise the offerings fetch. Check {@link GetOfferingsParams}
633
+ */
634
+ getCurrentOfferingForPlacement(placementIdentifier: string, params?: GetOfferingsParams): Promise<Offering | null>;
635
+ private getAllOfferings;
623
636
  /**
624
637
  * Convenience method to check whether a user is entitled to a specific
625
638
  * entitlement. This will use {@link Purchases.getCustomerInfo} under the hood.
@@ -698,6 +711,10 @@ export declare class Purchases {
698
711
  * can be useful for debugging and logging.
699
712
  */
700
713
  readonly underlyingErrorMessage?: string | null | undefined;
714
+ /**
715
+ * Contains extra information that is available in certain types of errors.
716
+ */
717
+ readonly extra?: PurchasesErrorExtra | undefined;
701
718
  constructor(
702
719
  /**
703
720
  * Error code for the error. This is useful to appropriately react to
@@ -712,10 +729,28 @@ export declare class Purchases {
712
729
  * Underlying error message. This provides more details on the error and
713
730
  * can be useful for debugging and logging.
714
731
  */
715
- underlyingErrorMessage?: string | null | undefined);
732
+ underlyingErrorMessage?: string | null | undefined,
733
+ /**
734
+ * Contains extra information that is available in certain types of errors.
735
+ */
736
+ extra?: PurchasesErrorExtra | undefined);
716
737
  toString: () => string;
717
738
  }
718
739
 
740
+ /**
741
+ * Extra information that is available in certain types of errors.
742
+ */
743
+ export declare interface PurchasesErrorExtra {
744
+ /**
745
+ * If this is a request error, the HTTP status code of the response.
746
+ */
747
+ readonly statusCode?: number;
748
+ /**
749
+ * If this is a RevenueCat backend error, the error code from the servers.
750
+ */
751
+ readonly backendErrorCode?: number;
752
+ }
753
+
719
754
  /**
720
755
  * The store where the user originally subscribed.
721
756
  * @public