@revenuecat/purchases-js 1.0.6 → 1.1.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 +172 -0
- package/dist/Purchases.es.js +2953 -2763
- package/dist/Purchases.umd.js +38 -38
- package/package.json +2 -2
package/dist/Purchases.es.d.ts
CHANGED
|
@@ -67,6 +67,16 @@ export declare interface CustomerInfo {
|
|
|
67
67
|
* The original App User Id recorded for this user.
|
|
68
68
|
*/
|
|
69
69
|
readonly originalAppUserId: string;
|
|
70
|
+
/**
|
|
71
|
+
* The list of non-subscription transactions made by the user.
|
|
72
|
+
*/
|
|
73
|
+
readonly nonSubscriptionTransactions: NonSubscriptionTransaction[];
|
|
74
|
+
/**
|
|
75
|
+
* Dictionary of all subscription product identifiers and their subscription info.
|
|
76
|
+
*/
|
|
77
|
+
readonly subscriptionsByProductIdentifier: {
|
|
78
|
+
[productId: string]: SubscriptionInfo;
|
|
79
|
+
};
|
|
70
80
|
}
|
|
71
81
|
|
|
72
82
|
/**
|
|
@@ -111,6 +121,10 @@ export declare interface EntitlementInfo {
|
|
|
111
121
|
* The product identifier that unlocked this entitlement.
|
|
112
122
|
*/
|
|
113
123
|
readonly productIdentifier: string;
|
|
124
|
+
/**
|
|
125
|
+
* The base plan identifier that unlocked this entitlement (For Google Play subs only).
|
|
126
|
+
*/
|
|
127
|
+
readonly productPlanIdentifier: string | null;
|
|
114
128
|
/**
|
|
115
129
|
* The date an unsubscribe was detected. Can be `null`.
|
|
116
130
|
* Note: Entitlement may still be active even if user has unsubscribed.
|
|
@@ -132,6 +146,13 @@ export declare interface EntitlementInfo {
|
|
|
132
146
|
* The last period type this entitlement was in.
|
|
133
147
|
*/
|
|
134
148
|
readonly periodType: PeriodType;
|
|
149
|
+
/**
|
|
150
|
+
* Use this property to determine whether a purchase was made by the
|
|
151
|
+
* current user or shared to them by a family member. This can be useful
|
|
152
|
+
* for onboarding users who have had an entitlement shared with them,
|
|
153
|
+
* but might not be entirely aware of the benefits they now have.
|
|
154
|
+
*/
|
|
155
|
+
readonly ownershipType: OwnershipType | null;
|
|
135
156
|
}
|
|
136
157
|
|
|
137
158
|
/**
|
|
@@ -282,6 +303,33 @@ export declare interface NonSubscriptionOption extends PurchaseOption {
|
|
|
282
303
|
readonly basePrice: Price;
|
|
283
304
|
}
|
|
284
305
|
|
|
306
|
+
/**
|
|
307
|
+
* Information that represents a non-subscription purchase made by a user.
|
|
308
|
+
* @public
|
|
309
|
+
*/
|
|
310
|
+
export declare interface NonSubscriptionTransaction {
|
|
311
|
+
/**
|
|
312
|
+
* The unique identifier for the transaction created by RevenueCat.
|
|
313
|
+
*/
|
|
314
|
+
readonly transactionIdentifier: string;
|
|
315
|
+
/**
|
|
316
|
+
* The product identifier.
|
|
317
|
+
*/
|
|
318
|
+
readonly productIdentifier: string;
|
|
319
|
+
/**
|
|
320
|
+
* The date that the store charged the user’s account.
|
|
321
|
+
*/
|
|
322
|
+
readonly purchaseDate: Date;
|
|
323
|
+
/**
|
|
324
|
+
* The unique identifier for the transaction created by the Store.
|
|
325
|
+
*/
|
|
326
|
+
readonly storeTransactionId: string | null;
|
|
327
|
+
/**
|
|
328
|
+
* The {@link Store} where the transaction was made.
|
|
329
|
+
*/
|
|
330
|
+
readonly store: Store;
|
|
331
|
+
}
|
|
332
|
+
|
|
285
333
|
/**
|
|
286
334
|
* An offering is a collection of {@link Package} available for the user to purchase.
|
|
287
335
|
* For more info see https://docs.revenuecat.com/docs/entitlements
|
|
@@ -374,6 +422,13 @@ export declare interface Offerings {
|
|
|
374
422
|
readonly current: Offering | null;
|
|
375
423
|
}
|
|
376
424
|
|
|
425
|
+
/**
|
|
426
|
+
* The types used to describe whether a transaction was purchased by the user,
|
|
427
|
+
* or is available to them through Family Sharing.
|
|
428
|
+
* @public
|
|
429
|
+
*/
|
|
430
|
+
export declare type OwnershipType = "PURCHASED" | "FAMILY_SHARED" | "UNKNOWN";
|
|
431
|
+
|
|
377
432
|
/**
|
|
378
433
|
* Contains information about the product available for the user to purchase.
|
|
379
434
|
* For more info see https://docs.revenuecat.com/docs/entitlements
|
|
@@ -478,6 +533,23 @@ export declare enum PeriodUnit {
|
|
|
478
533
|
Day = "day"
|
|
479
534
|
}
|
|
480
535
|
|
|
536
|
+
/**
|
|
537
|
+
* PlatformInfo is an interface that represents the information about the platform.
|
|
538
|
+
* Used by RevenueCat Hybrid SDKs to provide information about the platform.
|
|
539
|
+
* @public
|
|
540
|
+
* @experimental
|
|
541
|
+
*/
|
|
542
|
+
export declare interface PlatformInfo {
|
|
543
|
+
/**
|
|
544
|
+
* The flavor of the SDK.
|
|
545
|
+
*/
|
|
546
|
+
readonly flavor: string;
|
|
547
|
+
/**
|
|
548
|
+
* The version of the hybrid SDK.
|
|
549
|
+
*/
|
|
550
|
+
readonly version: string;
|
|
551
|
+
}
|
|
552
|
+
|
|
481
553
|
/**
|
|
482
554
|
* Contains data about the context in which an offering was presented.
|
|
483
555
|
* @public
|
|
@@ -548,6 +620,21 @@ export declare interface PricingPhase {
|
|
|
548
620
|
* I.e. 2 subscription cycles, 0 if not applicable.
|
|
549
621
|
*/
|
|
550
622
|
readonly cycleCount: number;
|
|
623
|
+
/**
|
|
624
|
+
* The approximated price converted to weekly rate, based on the period information.
|
|
625
|
+
* Null in case of trials.
|
|
626
|
+
*/
|
|
627
|
+
readonly pricePerWeek: Price | null;
|
|
628
|
+
/**
|
|
629
|
+
* The approximated price converted to monthly rate, based on the period information.
|
|
630
|
+
* Null in case of trials.
|
|
631
|
+
*/
|
|
632
|
+
readonly pricePerMonth: Price | null;
|
|
633
|
+
/**
|
|
634
|
+
* The approximated price converted to yearly rate, based on the period information.
|
|
635
|
+
* Null in case of trials.
|
|
636
|
+
*/
|
|
637
|
+
readonly pricePerYear: Price | null;
|
|
551
638
|
}
|
|
552
639
|
|
|
553
640
|
/**
|
|
@@ -734,6 +821,11 @@ export declare class Purchases {
|
|
|
734
821
|
* @param logLevel - LogLevel to set.
|
|
735
822
|
*/
|
|
736
823
|
static setLogLevel(logLevel: LogLevel): void;
|
|
824
|
+
/**
|
|
825
|
+
* Meant to be used by RevenueCat hybrids SDKS only.
|
|
826
|
+
* @experimental
|
|
827
|
+
* */
|
|
828
|
+
static setPlatformInfo(platformInfo: PlatformInfo): void;
|
|
737
829
|
/**
|
|
738
830
|
* Get the singleton instance of Purchases. It's preferred to use the instance
|
|
739
831
|
* obtained from the {@link Purchases.configure} method when possible.
|
|
@@ -918,6 +1010,86 @@ export declare class Purchases {
|
|
|
918
1010
|
*/
|
|
919
1011
|
export declare type Store = "app_store" | "mac_app_store" | "play_store" | "amazon" | "stripe" | "rc_billing" | "promotional" | "unknown";
|
|
920
1012
|
|
|
1013
|
+
/**
|
|
1014
|
+
* Subscription purchases of the Customer.
|
|
1015
|
+
* @public
|
|
1016
|
+
*/
|
|
1017
|
+
export declare interface SubscriptionInfo {
|
|
1018
|
+
/**
|
|
1019
|
+
* The product identifier.
|
|
1020
|
+
*/
|
|
1021
|
+
readonly productIdentifier: string;
|
|
1022
|
+
/**
|
|
1023
|
+
* Date when the last subscription period started.
|
|
1024
|
+
*/
|
|
1025
|
+
readonly purchaseDate: Date;
|
|
1026
|
+
/**
|
|
1027
|
+
* Date when this subscription first started. This property does not update with renewals.
|
|
1028
|
+
* This property also does not update for product changes within a subscription group or
|
|
1029
|
+
* re-subscriptions by lapsed subscribers.
|
|
1030
|
+
*/
|
|
1031
|
+
readonly originalPurchaseDate: Date | null;
|
|
1032
|
+
/**
|
|
1033
|
+
* Date when the subscription expires/expired
|
|
1034
|
+
*/
|
|
1035
|
+
readonly expiresDate: Date | null;
|
|
1036
|
+
/**
|
|
1037
|
+
* Store where the subscription was purchased.
|
|
1038
|
+
*/
|
|
1039
|
+
readonly store: Store;
|
|
1040
|
+
/**
|
|
1041
|
+
* Date when RevenueCat detected that auto-renewal was turned off for this subscription.
|
|
1042
|
+
* Note the subscription may still be active, check the {@link SubscriptionInfo.expiresDate} attribute.
|
|
1043
|
+
*/
|
|
1044
|
+
readonly unsubscribeDetectedAt: Date | null;
|
|
1045
|
+
/**
|
|
1046
|
+
* Whether or not the purchase was made in sandbox mode.
|
|
1047
|
+
*/
|
|
1048
|
+
readonly isSandbox: boolean;
|
|
1049
|
+
/**
|
|
1050
|
+
* Date when RevenueCat detected any billing issues with this subscription.
|
|
1051
|
+
* If and when the billing issue gets resolved, this field is set to null.
|
|
1052
|
+
* Note the subscription may still be active, check the {@link SubscriptionInfo.expiresDate} attribute.
|
|
1053
|
+
*/
|
|
1054
|
+
readonly billingIssuesDetectedAt: Date | null;
|
|
1055
|
+
/**
|
|
1056
|
+
* Date when any grace period for this subscription expires/expired.
|
|
1057
|
+
* null if the customer has never been in a grace period.
|
|
1058
|
+
*/
|
|
1059
|
+
readonly gracePeriodExpiresDate: Date | null;
|
|
1060
|
+
/**
|
|
1061
|
+
* How the Customer received access to this subscription:
|
|
1062
|
+
* - "PURCHASED": The customer bought the subscription.
|
|
1063
|
+
* - "FAMILY_SHARED": The customer has access to the product via their family.
|
|
1064
|
+
*/
|
|
1065
|
+
readonly ownershipType: OwnershipType;
|
|
1066
|
+
/**
|
|
1067
|
+
* Type of the current subscription period:
|
|
1068
|
+
* - "normal": The product is in a normal period (default)
|
|
1069
|
+
* - "trial": The product is in a free trial period
|
|
1070
|
+
* - "intro": The product is in an introductory pricing period
|
|
1071
|
+
* - "prepaid": The product is in a prepaid pricing period
|
|
1072
|
+
*/
|
|
1073
|
+
readonly periodType: PeriodType;
|
|
1074
|
+
/**
|
|
1075
|
+
* Date when RevenueCat detected a refund of this subscription.
|
|
1076
|
+
*/
|
|
1077
|
+
readonly refundedAt: Date | null;
|
|
1078
|
+
/**
|
|
1079
|
+
* The transaction id in the store of the subscription.
|
|
1080
|
+
*/
|
|
1081
|
+
readonly storeTransactionId: string | null;
|
|
1082
|
+
/**
|
|
1083
|
+
* Whether the subscription is currently active
|
|
1084
|
+
* (at the time this object was obtained).
|
|
1085
|
+
*/
|
|
1086
|
+
readonly isActive: boolean;
|
|
1087
|
+
/**
|
|
1088
|
+
* Whether the subscription will renew at the next billing period.
|
|
1089
|
+
*/
|
|
1090
|
+
readonly willRenew: boolean;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
921
1093
|
/**
|
|
922
1094
|
* Represents a possible option to purchase a subscription product.
|
|
923
1095
|
* @public
|