@revenuecat/purchases-js 0.4.0 → 0.6.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.
@@ -170,6 +170,18 @@ export declare enum ErrorCode {
170
170
  InvalidEmailError = 38
171
171
  }
172
172
 
173
+ /**
174
+ * Parameters for the {@link Purchases.getOfferings}` method.
175
+ * @public
176
+ */
177
+ export declare interface GetOfferingsParams {
178
+ /**
179
+ * The currency code in ISO 4217 to fetch the offerings for.
180
+ * If not specified, the default currency will be used.
181
+ */
182
+ readonly currency?: string;
183
+ }
184
+
173
185
  /**
174
186
  * Parameters used to customise the http requests executed by purchases-js.
175
187
  * @public
@@ -394,6 +406,21 @@ export declare enum PeriodUnit {
394
406
  Day = "day"
395
407
  }
396
408
 
409
+ /**
410
+ * Contains data about the context in which an offering was presented.
411
+ * @public
412
+ */
413
+ export declare interface PresentedOfferingContext {
414
+ /**
415
+ * The identifier of the offering used to obtain this object.
416
+ */
417
+ readonly offeringIdentifier: string;
418
+ /**
419
+ * The targeting context used to obtain this object.
420
+ */
421
+ readonly targetingContext: TargetingContext | null;
422
+ }
423
+
397
424
  /**
398
425
  * Price information for a product.
399
426
  * @public
@@ -475,8 +502,17 @@ export declare interface Product {
475
502
  readonly normalPeriodDuration: string | null;
476
503
  /**
477
504
  * The offering ID used to obtain this product.
505
+ * @deprecated - Use {@link Product.presentedOfferingContext} instead.
478
506
  */
479
507
  readonly presentedOfferingIdentifier: string;
508
+ /**
509
+ * The context from which this product was obtained.
510
+ */
511
+ readonly presentedOfferingContext: PresentedOfferingContext;
512
+ /**
513
+ * The default purchase option for this product.
514
+ */
515
+ readonly defaultPurchaseOption: PurchaseOption;
480
516
  /**
481
517
  * The default subscription option for this product. Null if no subscription
482
518
  * options are available like in the case of consumables and non-consumables.
@@ -503,6 +539,10 @@ export declare interface PurchaseOption {
503
539
  * The unique id for a purchase option
504
540
  */
505
541
  readonly id: string;
542
+ /**
543
+ * The public price id for this subscription option.
544
+ */
545
+ readonly priceId: string;
506
546
  }
507
547
 
508
548
  /**
@@ -566,7 +606,7 @@ export declare class Purchases {
566
606
  * Fetch the configured offerings for this user. You can configure these
567
607
  * in the RevenueCat dashboard.
568
608
  */
569
- getOfferings(): Promise<Offerings>;
609
+ getOfferings(params?: GetOfferingsParams): Promise<Offerings>;
570
610
  /**
571
611
  * Convenience method to check whether a user is entitled to a specific
572
612
  * entitlement. This will use {@link Purchases.getCustomerInfo} under the hood.
@@ -686,6 +726,21 @@ export declare class Purchases {
686
726
  readonly trial: PricingPhase | null;
687
727
  }
688
728
 
729
+ /**
730
+ * Contains information about the targeting context used to obtain an object.
731
+ * @public
732
+ */
733
+ export declare interface TargetingContext {
734
+ /**
735
+ * The rule id from the targeting used to obtain this object.
736
+ */
737
+ readonly ruleId: string;
738
+ /**
739
+ * The revision of the targeting used to obtain this object.
740
+ */
741
+ readonly revision: number;
742
+ }
743
+
689
744
  /**
690
745
  * Error indicating that the SDK was accessed before it was initialized.
691
746
  * @public