@revenuecat/purchases-js 0.7.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.
- package/dist/Purchases.es.d.ts +82 -6
- package/dist/Purchases.es.js +1726 -1513
- package/dist/Purchases.umd.js +4 -4
- package/package.json +2 -2
package/dist/Purchases.es.d.ts
CHANGED
|
@@ -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
|
|
@@ -419,6 +430,11 @@ export declare interface PresentedOfferingContext {
|
|
|
419
430
|
* The targeting context used to obtain this object.
|
|
420
431
|
*/
|
|
421
432
|
readonly targetingContext: TargetingContext | null;
|
|
433
|
+
/**
|
|
434
|
+
* If obtained this information from a placement,
|
|
435
|
+
* the identifier of the placement.
|
|
436
|
+
*/
|
|
437
|
+
readonly placementIdentifier: string | null;
|
|
422
438
|
}
|
|
423
439
|
|
|
424
440
|
/**
|
|
@@ -496,13 +512,17 @@ export declare interface Product {
|
|
|
496
512
|
*/
|
|
497
513
|
readonly description: string | null;
|
|
498
514
|
/**
|
|
499
|
-
* Price of the product.
|
|
500
|
-
*
|
|
515
|
+
* Price of the product. This will match the default option's base phase price
|
|
516
|
+
* in subscriptions or the price in non-subscriptions.
|
|
501
517
|
*/
|
|
502
518
|
readonly currentPrice: Price;
|
|
519
|
+
/**
|
|
520
|
+
* The type of product.
|
|
521
|
+
*/
|
|
522
|
+
readonly productType: ProductType;
|
|
503
523
|
/**
|
|
504
524
|
* The period duration for a subscription product. This will match the default
|
|
505
|
-
* option's base phase period duration.
|
|
525
|
+
* option's base phase period duration. Null for non-subscriptions.
|
|
506
526
|
*/
|
|
507
527
|
readonly normalPeriodDuration: string | null;
|
|
508
528
|
/**
|
|
@@ -519,13 +539,14 @@ export declare interface Product {
|
|
|
519
539
|
*/
|
|
520
540
|
readonly defaultPurchaseOption: PurchaseOption;
|
|
521
541
|
/**
|
|
522
|
-
* The default subscription option for this product.
|
|
523
|
-
* 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.
|
|
524
544
|
*/
|
|
525
545
|
readonly defaultSubscriptionOption: SubscriptionOption | null;
|
|
526
546
|
/**
|
|
527
547
|
* A dictionary with all the possible subscription options available for this
|
|
528
548
|
* product. Each key contains the key to be used when executing a purchase.
|
|
549
|
+
* Will be empty for non-subscriptions
|
|
529
550
|
*
|
|
530
551
|
* If retrieved through getOfferings the offers are only the ones the customer is
|
|
531
552
|
* entitled to.
|
|
@@ -533,6 +554,30 @@ export declare interface Product {
|
|
|
533
554
|
readonly subscriptionOptions: {
|
|
534
555
|
[optionId: string]: SubscriptionOption;
|
|
535
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"
|
|
536
581
|
}
|
|
537
582
|
|
|
538
583
|
/**
|
|
@@ -620,6 +665,14 @@ export declare class Purchases {
|
|
|
620
665
|
* in the RevenueCat dashboard.
|
|
621
666
|
*/
|
|
622
667
|
getOfferings(params?: GetOfferingsParams): Promise<Offerings>;
|
|
668
|
+
/**
|
|
669
|
+
* Retrieves a specific offering by a placement identifier.
|
|
670
|
+
* For more info see https://www.revenuecat.com/docs/tools/targeting
|
|
671
|
+
* @param placementIdentifier - The placement identifier to retrieve the offering for.
|
|
672
|
+
* @param params - The parameters object to customise the offerings fetch. Check {@link GetOfferingsParams}
|
|
673
|
+
*/
|
|
674
|
+
getCurrentOfferingForPlacement(placementIdentifier: string, params?: GetOfferingsParams): Promise<Offering | null>;
|
|
675
|
+
private getAllOfferings;
|
|
623
676
|
/**
|
|
624
677
|
* Convenience method to check whether a user is entitled to a specific
|
|
625
678
|
* entitlement. This will use {@link Purchases.getCustomerInfo} under the hood.
|
|
@@ -698,6 +751,10 @@ export declare class Purchases {
|
|
|
698
751
|
* can be useful for debugging and logging.
|
|
699
752
|
*/
|
|
700
753
|
readonly underlyingErrorMessage?: string | null | undefined;
|
|
754
|
+
/**
|
|
755
|
+
* Contains extra information that is available in certain types of errors.
|
|
756
|
+
*/
|
|
757
|
+
readonly extra?: PurchasesErrorExtra | undefined;
|
|
701
758
|
constructor(
|
|
702
759
|
/**
|
|
703
760
|
* Error code for the error. This is useful to appropriately react to
|
|
@@ -712,10 +769,29 @@ export declare class Purchases {
|
|
|
712
769
|
* Underlying error message. This provides more details on the error and
|
|
713
770
|
* can be useful for debugging and logging.
|
|
714
771
|
*/
|
|
715
|
-
underlyingErrorMessage?: string | null | undefined
|
|
772
|
+
underlyingErrorMessage?: string | null | undefined,
|
|
773
|
+
/**
|
|
774
|
+
* Contains extra information that is available in certain types of errors.
|
|
775
|
+
*/
|
|
776
|
+
extra?: PurchasesErrorExtra | undefined);
|
|
716
777
|
toString: () => string;
|
|
717
778
|
}
|
|
718
779
|
|
|
780
|
+
/**
|
|
781
|
+
* Extra information that is available in certain types of errors.
|
|
782
|
+
* @public
|
|
783
|
+
*/
|
|
784
|
+
export declare interface PurchasesErrorExtra {
|
|
785
|
+
/**
|
|
786
|
+
* If this is a request error, the HTTP status code of the response.
|
|
787
|
+
*/
|
|
788
|
+
readonly statusCode?: number;
|
|
789
|
+
/**
|
|
790
|
+
* If this is a RevenueCat backend error, the error code from the servers.
|
|
791
|
+
*/
|
|
792
|
+
readonly backendErrorCode?: number;
|
|
793
|
+
}
|
|
794
|
+
|
|
719
795
|
/**
|
|
720
796
|
* The store where the user originally subscribed.
|
|
721
797
|
* @public
|