@revenuecat/purchases-js 0.8.0 → 0.9.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.
@@ -230,6 +230,17 @@ export declare enum LogLevel {
230
230
  Verbose = 5
231
231
  }
232
232
 
233
+ /**
234
+ * Represents a possible option to purchase a non-subscription product.
235
+ * @public
236
+ */
237
+ export declare interface NonSubscriptionOption extends PurchaseOption {
238
+ /**
239
+ * The base price for the product.
240
+ */
241
+ readonly basePrice: Price;
242
+ }
243
+
233
244
  /**
234
245
  * An offering is a collection of {@link Package} available for the user to purchase.
235
246
  * For more info see https://docs.revenuecat.com/docs/entitlements
@@ -501,13 +512,17 @@ export declare interface Product {
501
512
  */
502
513
  readonly description: string | null;
503
514
  /**
504
- * Price of the product. In the case of subscriptions, this will match the
505
- * default option's base phase price.
515
+ * Price of the product. This will match the default option's base phase price
516
+ * in subscriptions or the price in non-subscriptions.
506
517
  */
507
518
  readonly currentPrice: Price;
519
+ /**
520
+ * The type of product.
521
+ */
522
+ readonly productType: ProductType;
508
523
  /**
509
524
  * The period duration for a subscription product. This will match the default
510
- * option's base phase period duration.
525
+ * option's base phase period duration. Null for non-subscriptions.
511
526
  */
512
527
  readonly normalPeriodDuration: string | null;
513
528
  /**
@@ -524,13 +539,14 @@ export declare interface Product {
524
539
  */
525
540
  readonly defaultPurchaseOption: PurchaseOption;
526
541
  /**
527
- * The default subscription option for this product. Null if no subscription
528
- * options are available like in the case of consumables and non-consumables.
542
+ * The default subscription option for this product.
543
+ * Null if no subscription options are available like in the case of consumables and non-consumables.
529
544
  */
530
545
  readonly defaultSubscriptionOption: SubscriptionOption | null;
531
546
  /**
532
547
  * A dictionary with all the possible subscription options available for this
533
548
  * product. Each key contains the key to be used when executing a purchase.
549
+ * Will be empty for non-subscriptions
534
550
  *
535
551
  * If retrieved through getOfferings the offers are only the ones the customer is
536
552
  * entitled to.
@@ -538,6 +554,30 @@ export declare interface Product {
538
554
  readonly subscriptionOptions: {
539
555
  [optionId: string]: SubscriptionOption;
540
556
  };
557
+ /**
558
+ * The default non-subscription option for this product.
559
+ * Null in the case of subscriptions.
560
+ */
561
+ readonly defaultNonSubscriptionOption: NonSubscriptionOption | null;
562
+ }
563
+
564
+ /**
565
+ * Possible product types
566
+ * @public
567
+ */
568
+ export declare enum ProductType {
569
+ /**
570
+ * A product that is an auto-renewing subscription.
571
+ */
572
+ Subscription = "subscription",
573
+ /**
574
+ * A product that does not renew and can be consumed to be purchased again.
575
+ */
576
+ Consumable = "consumable",
577
+ /**
578
+ * A product that does not renew and can only be purchased once.
579
+ */
580
+ NonConsumable = "non_consumable"
541
581
  }
542
582
 
543
583
  /**
@@ -739,6 +779,7 @@ export declare class Purchases {
739
779
 
740
780
  /**
741
781
  * Extra information that is available in certain types of errors.
782
+ * @public
742
783
  */
743
784
  export declare interface PurchasesErrorExtra {
744
785
  /**