@revenuecat/purchases-typescript-internal 5.3.0 → 5.4.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.
@@ -0,0 +1,27 @@
1
+ import { CustomerInfo } from './customerInfo';
2
+ import { LOG_LEVEL } from './enums';
3
+ /**
4
+ * Listener used on updated customer info
5
+ * @callback CustomerInfoUpdateListener
6
+ * @param {Object} customerInfo Object containing info for the customer
7
+ */
8
+ export type CustomerInfoUpdateListener = (customerInfo: CustomerInfo) => void;
9
+ export type ShouldPurchasePromoProductListener = (deferredPurchase: () => Promise<MakePurchaseResult>) => void;
10
+ export type MakePurchaseResult = {
11
+ productIdentifier: string;
12
+ customerInfo: CustomerInfo;
13
+ };
14
+ export type LogHandler = (logLevel: LOG_LEVEL, message: string) => void;
15
+ /**
16
+ * Holds the logIn result
17
+ */
18
+ export interface LogInResult {
19
+ /**
20
+ * The Customer Info for the user.
21
+ */
22
+ readonly customerInfo: CustomerInfo;
23
+ /**
24
+ * True if the call resulted in a new user getting created in the RevenueCat backend.
25
+ */
26
+ readonly created: boolean;
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,158 @@
1
+ /**
2
+ * The EntitlementInfo object gives you access to all of the information about the status of a user entitlement.
3
+ */
4
+ export interface PurchasesEntitlementInfo {
5
+ /**
6
+ * The entitlement identifier configured in the RevenueCat dashboard
7
+ */
8
+ readonly identifier: string;
9
+ /**
10
+ * True if the user has access to this entitlement
11
+ */
12
+ readonly isActive: boolean;
13
+ /**
14
+ * True if the underlying subscription is set to renew at the end of the billing period (expirationDate).
15
+ */
16
+ readonly willRenew: boolean;
17
+ /**
18
+ * The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL.
19
+ */
20
+ readonly periodType: string;
21
+ /**
22
+ * The latest purchase or renewal date for the entitlement.
23
+ */
24
+ readonly latestPurchaseDate: string;
25
+ /**
26
+ * The first date this entitlement was purchased.
27
+ */
28
+ readonly originalPurchaseDate: string;
29
+ /**
30
+ * The expiration date for the entitlement, can be `null` for lifetime access. If the `periodType` is `trial`,
31
+ * this is the trial expiration date.
32
+ */
33
+ readonly expirationDate: string | null;
34
+ /**
35
+ * The store where this entitlement was unlocked from.
36
+ */
37
+ readonly store: "PLAY_STORE" | "APP_STORE" | "STRIPE" | "MAC_APP_STORE" | "PROMOTIONAL" | "AMAZON" | "UNKNOWN_STORE";
38
+ /**
39
+ * The product identifier that unlocked this entitlement
40
+ */
41
+ readonly productIdentifier: string;
42
+ /**
43
+ * False if this entitlement is unlocked via a production purchase
44
+ */
45
+ readonly isSandbox: boolean;
46
+ /**
47
+ * The date an unsubscribe was detected. Can be `null`.
48
+ *
49
+ * @note: Entitlement may still be active even if user has unsubscribed. Check the `isActive` property.
50
+ */
51
+ readonly unsubscribeDetectedAt: string | null;
52
+ /**
53
+ * The date a billing issue was detected. Can be `null` if there is no billing issue or an issue has been resolved
54
+ *
55
+ * @note: Entitlement may still be active even if there is a billing issue. Check the `isActive` property.
56
+ */
57
+ readonly billingIssueDetectedAt: string | null;
58
+ }
59
+ /**
60
+ * Contains all the entitlements associated to the user.
61
+ */
62
+ export interface PurchasesEntitlementInfos {
63
+ /**
64
+ * Map of all EntitlementInfo (`PurchasesEntitlementInfo`) objects (active and inactive) keyed by entitlement identifier.
65
+ */
66
+ readonly all: {
67
+ [key: string]: PurchasesEntitlementInfo;
68
+ };
69
+ /**
70
+ * Map of active EntitlementInfo (`PurchasesEntitlementInfo`) objects keyed by entitlement identifier.
71
+ */
72
+ readonly active: {
73
+ [key: string]: PurchasesEntitlementInfo;
74
+ };
75
+ }
76
+ export interface CustomerInfo {
77
+ /**
78
+ * Entitlements attached to this customer info
79
+ */
80
+ readonly entitlements: PurchasesEntitlementInfos;
81
+ /**
82
+ * Set of active subscription skus
83
+ */
84
+ readonly activeSubscriptions: string[];
85
+ /**
86
+ * Set of purchased skus, active and inactive
87
+ */
88
+ readonly allPurchasedProductIdentifiers: string[];
89
+ /**
90
+ * The latest expiration date of all purchased skus
91
+ */
92
+ readonly latestExpirationDate: string | null;
93
+ /**
94
+ * The date this user was first seen in RevenueCat.
95
+ */
96
+ readonly firstSeen: string;
97
+ /**
98
+ * The original App User Id recorded for this user.
99
+ */
100
+ readonly originalAppUserId: string;
101
+ /**
102
+ * Date when this info was requested
103
+ */
104
+ readonly requestDate: string;
105
+ /**
106
+ * Map of skus to expiration dates
107
+ */
108
+ readonly allExpirationDates: {
109
+ [key: string]: string | null;
110
+ };
111
+ /**
112
+ * Map of skus to purchase dates
113
+ */
114
+ readonly allPurchaseDates: {
115
+ [key: string]: string | null;
116
+ };
117
+ /**
118
+ * Returns the version number for the version of the application when the
119
+ * user bought the app. Use this for grandfathering users when migrating
120
+ * to subscriptions.
121
+ *
122
+ * This corresponds to the value of CFBundleVersion (in iOS) in the
123
+ * Info.plist file when the purchase was originally made. This is always null
124
+ * in Android
125
+ */
126
+ readonly originalApplicationVersion: string | null;
127
+ /**
128
+ * Returns the purchase date for the version of the application when the user bought the app.
129
+ * Use this for grandfathering users when migrating to subscriptions.
130
+ */
131
+ readonly originalPurchaseDate: string | null;
132
+ /**
133
+ * URL to manage the active subscription of the user. If this user has an active iOS
134
+ * subscription, this will point to the App Store, if the user has an active Play Store subscription
135
+ * it will point there. If there are no active subscriptions it will be null.
136
+ * If there are multiple for different platforms, it will point to the device store.
137
+ */
138
+ readonly managementURL: string | null;
139
+ readonly nonSubscriptionTransactions: PurchasesStoreTransaction[];
140
+ }
141
+ /**
142
+ * List of all non subscription transactions. Use this to fetch the history of
143
+ * non-subscription purchases
144
+ */
145
+ export interface PurchasesStoreTransaction {
146
+ /**
147
+ * Id of the transaction.
148
+ */
149
+ transactionIdentifier: string;
150
+ /**
151
+ * Product Id associated with the transaction.
152
+ */
153
+ productIdentifier: string;
154
+ /**
155
+ * Purchase date of the transaction in ISO 8601 format.
156
+ */
157
+ purchaseDate: string;
158
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @deprecated, use PRODUCT_CATEGORY
3
+ */
4
+ export declare enum PURCHASE_TYPE {
5
+ /**
6
+ * A type of SKU for in-app products.
7
+ */
8
+ INAPP = "inapp",
9
+ /**
10
+ * A type of SKU for subscriptions.
11
+ */
12
+ SUBS = "subs"
13
+ }
14
+ /**
15
+ * Enum for billing features.
16
+ * Currently, these are only relevant for Google Play Android users:
17
+ * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType
18
+ */
19
+ export declare enum BILLING_FEATURE {
20
+ /**
21
+ * Purchase/query for subscriptions.
22
+ */
23
+ SUBSCRIPTIONS = 0,
24
+ /**
25
+ * Subscriptions update/replace.
26
+ */
27
+ SUBSCRIPTIONS_UPDATE = 1,
28
+ /**
29
+ * Purchase/query for in-app items on VR.
30
+ */
31
+ IN_APP_ITEMS_ON_VR = 2,
32
+ /**
33
+ * Purchase/query for subscriptions on VR.
34
+ */
35
+ SUBSCRIPTIONS_ON_VR = 3,
36
+ /**
37
+ * Launch a price change confirmation flow.
38
+ */
39
+ PRICE_CHANGE_CONFIRMATION = 4
40
+ }
41
+ export declare enum REFUND_REQUEST_STATUS {
42
+ /**
43
+ * Apple has received the refund request.
44
+ */
45
+ SUCCESS = 0,
46
+ /**
47
+ * User canceled submission of the refund request.
48
+ */
49
+ USER_CANCELLED = 1,
50
+ /**
51
+ * There was an error with the request. See message for more details.
52
+ */
53
+ ERROR = 2
54
+ }
55
+ export declare enum LOG_LEVEL {
56
+ VERBOSE = "VERBOSE",
57
+ DEBUG = "DEBUG",
58
+ INFO = "INFO",
59
+ WARN = "WARN",
60
+ ERROR = "ERROR"
61
+ }
package/dist/enums.js ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LOG_LEVEL = exports.REFUND_REQUEST_STATUS = exports.BILLING_FEATURE = exports.PURCHASE_TYPE = void 0;
4
+ /**
5
+ * @deprecated, use PRODUCT_CATEGORY
6
+ */
7
+ var PURCHASE_TYPE;
8
+ (function (PURCHASE_TYPE) {
9
+ /**
10
+ * A type of SKU for in-app products.
11
+ */
12
+ PURCHASE_TYPE["INAPP"] = "inapp";
13
+ /**
14
+ * A type of SKU for subscriptions.
15
+ */
16
+ PURCHASE_TYPE["SUBS"] = "subs";
17
+ })(PURCHASE_TYPE || (exports.PURCHASE_TYPE = PURCHASE_TYPE = {}));
18
+ /**
19
+ * Enum for billing features.
20
+ * Currently, these are only relevant for Google Play Android users:
21
+ * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType
22
+ */
23
+ var BILLING_FEATURE;
24
+ (function (BILLING_FEATURE) {
25
+ /**
26
+ * Purchase/query for subscriptions.
27
+ */
28
+ BILLING_FEATURE[BILLING_FEATURE["SUBSCRIPTIONS"] = 0] = "SUBSCRIPTIONS";
29
+ /**
30
+ * Subscriptions update/replace.
31
+ */
32
+ BILLING_FEATURE[BILLING_FEATURE["SUBSCRIPTIONS_UPDATE"] = 1] = "SUBSCRIPTIONS_UPDATE";
33
+ /**
34
+ * Purchase/query for in-app items on VR.
35
+ */
36
+ BILLING_FEATURE[BILLING_FEATURE["IN_APP_ITEMS_ON_VR"] = 2] = "IN_APP_ITEMS_ON_VR";
37
+ /**
38
+ * Purchase/query for subscriptions on VR.
39
+ */
40
+ BILLING_FEATURE[BILLING_FEATURE["SUBSCRIPTIONS_ON_VR"] = 3] = "SUBSCRIPTIONS_ON_VR";
41
+ /**
42
+ * Launch a price change confirmation flow.
43
+ */
44
+ BILLING_FEATURE[BILLING_FEATURE["PRICE_CHANGE_CONFIRMATION"] = 4] = "PRICE_CHANGE_CONFIRMATION";
45
+ })(BILLING_FEATURE || (exports.BILLING_FEATURE = BILLING_FEATURE = {}));
46
+ var REFUND_REQUEST_STATUS;
47
+ (function (REFUND_REQUEST_STATUS) {
48
+ /**
49
+ * Apple has received the refund request.
50
+ */
51
+ REFUND_REQUEST_STATUS[REFUND_REQUEST_STATUS["SUCCESS"] = 0] = "SUCCESS";
52
+ /**
53
+ * User canceled submission of the refund request.
54
+ */
55
+ REFUND_REQUEST_STATUS[REFUND_REQUEST_STATUS["USER_CANCELLED"] = 1] = "USER_CANCELLED";
56
+ /**
57
+ * There was an error with the request. See message for more details.
58
+ */
59
+ REFUND_REQUEST_STATUS[REFUND_REQUEST_STATUS["ERROR"] = 2] = "ERROR";
60
+ })(REFUND_REQUEST_STATUS || (exports.REFUND_REQUEST_STATUS = REFUND_REQUEST_STATUS = {}));
61
+ var LOG_LEVEL;
62
+ (function (LOG_LEVEL) {
63
+ LOG_LEVEL["VERBOSE"] = "VERBOSE";
64
+ LOG_LEVEL["DEBUG"] = "DEBUG";
65
+ LOG_LEVEL["INFO"] = "INFO";
66
+ LOG_LEVEL["WARN"] = "WARN";
67
+ LOG_LEVEL["ERROR"] = "ERROR";
68
+ })(LOG_LEVEL || (exports.LOG_LEVEL = LOG_LEVEL = {}));
@@ -0,0 +1,60 @@
1
+ export declare enum PURCHASES_ERROR_CODE {
2
+ UNKNOWN_ERROR = "0",
3
+ PURCHASE_CANCELLED_ERROR = "1",
4
+ STORE_PROBLEM_ERROR = "2",
5
+ PURCHASE_NOT_ALLOWED_ERROR = "3",
6
+ PURCHASE_INVALID_ERROR = "4",
7
+ PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR = "5",
8
+ PRODUCT_ALREADY_PURCHASED_ERROR = "6",
9
+ RECEIPT_ALREADY_IN_USE_ERROR = "7",
10
+ INVALID_RECEIPT_ERROR = "8",
11
+ MISSING_RECEIPT_FILE_ERROR = "9",
12
+ NETWORK_ERROR = "10",
13
+ INVALID_CREDENTIALS_ERROR = "11",
14
+ UNEXPECTED_BACKEND_RESPONSE_ERROR = "12",
15
+ RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR = "13",
16
+ INVALID_APP_USER_ID_ERROR = "14",
17
+ OPERATION_ALREADY_IN_PROGRESS_ERROR = "15",
18
+ UNKNOWN_BACKEND_ERROR = "16",
19
+ INVALID_APPLE_SUBSCRIPTION_KEY_ERROR = "17",
20
+ INELIGIBLE_ERROR = "18",
21
+ INSUFFICIENT_PERMISSIONS_ERROR = "19",
22
+ PAYMENT_PENDING_ERROR = "20",
23
+ INVALID_SUBSCRIBER_ATTRIBUTES_ERROR = "21",
24
+ LOG_OUT_ANONYMOUS_USER_ERROR = "22",
25
+ CONFIGURATION_ERROR = "23",
26
+ UNSUPPORTED_ERROR = "24",
27
+ EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR = "25",
28
+ PRODUCT_DISCOUNT_MISSING_IDENTIFIER_ERROR = "26",
29
+ PRODUCT_DISCOUNT_MISSING_SUBSCRIPTION_GROUP_IDENTIFIER_ERROR = "28",
30
+ CUSTOMER_INFO_ERROR = "29",
31
+ SYSTEM_INFO_ERROR = "30",
32
+ BEGIN_REFUND_REQUEST_ERROR = "31",
33
+ PRODUCT_REQUEST_TIMED_OUT_ERROR = "32",
34
+ API_ENDPOINT_BLOCKED = "33",
35
+ INVALID_PROMOTIONAL_OFFER_ERROR = "34",
36
+ OFFLINE_CONNECTION_ERROR = "35"
37
+ }
38
+ export interface PurchasesError {
39
+ code: PURCHASES_ERROR_CODE;
40
+ message: string;
41
+ readableErrorCode: string;
42
+ userInfo: ErrorInfo;
43
+ underlyingErrorMessage: string;
44
+ userCancelled: boolean | null;
45
+ }
46
+ export interface ErrorInfo {
47
+ readableErrorCode: string;
48
+ }
49
+ /**
50
+ * @internal
51
+ */
52
+ export declare class UninitializedPurchasesError extends Error {
53
+ constructor();
54
+ }
55
+ /**
56
+ * @internal
57
+ */
58
+ export declare class UnsupportedPlatformError extends Error {
59
+ constructor();
60
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.UnsupportedPlatformError = exports.UninitializedPurchasesError = exports.PURCHASES_ERROR_CODE = void 0;
19
+ /* tslint:disable:max-classes-per-file */
20
+ // Error codes indicating the reason for an error.
21
+ var PURCHASES_ERROR_CODE;
22
+ (function (PURCHASES_ERROR_CODE) {
23
+ PURCHASES_ERROR_CODE["UNKNOWN_ERROR"] = "0";
24
+ PURCHASES_ERROR_CODE["PURCHASE_CANCELLED_ERROR"] = "1";
25
+ PURCHASES_ERROR_CODE["STORE_PROBLEM_ERROR"] = "2";
26
+ PURCHASES_ERROR_CODE["PURCHASE_NOT_ALLOWED_ERROR"] = "3";
27
+ PURCHASES_ERROR_CODE["PURCHASE_INVALID_ERROR"] = "4";
28
+ PURCHASES_ERROR_CODE["PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR"] = "5";
29
+ PURCHASES_ERROR_CODE["PRODUCT_ALREADY_PURCHASED_ERROR"] = "6";
30
+ PURCHASES_ERROR_CODE["RECEIPT_ALREADY_IN_USE_ERROR"] = "7";
31
+ PURCHASES_ERROR_CODE["INVALID_RECEIPT_ERROR"] = "8";
32
+ PURCHASES_ERROR_CODE["MISSING_RECEIPT_FILE_ERROR"] = "9";
33
+ PURCHASES_ERROR_CODE["NETWORK_ERROR"] = "10";
34
+ PURCHASES_ERROR_CODE["INVALID_CREDENTIALS_ERROR"] = "11";
35
+ PURCHASES_ERROR_CODE["UNEXPECTED_BACKEND_RESPONSE_ERROR"] = "12";
36
+ PURCHASES_ERROR_CODE["RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR"] = "13";
37
+ PURCHASES_ERROR_CODE["INVALID_APP_USER_ID_ERROR"] = "14";
38
+ PURCHASES_ERROR_CODE["OPERATION_ALREADY_IN_PROGRESS_ERROR"] = "15";
39
+ PURCHASES_ERROR_CODE["UNKNOWN_BACKEND_ERROR"] = "16";
40
+ PURCHASES_ERROR_CODE["INVALID_APPLE_SUBSCRIPTION_KEY_ERROR"] = "17";
41
+ PURCHASES_ERROR_CODE["INELIGIBLE_ERROR"] = "18";
42
+ PURCHASES_ERROR_CODE["INSUFFICIENT_PERMISSIONS_ERROR"] = "19";
43
+ PURCHASES_ERROR_CODE["PAYMENT_PENDING_ERROR"] = "20";
44
+ PURCHASES_ERROR_CODE["INVALID_SUBSCRIBER_ATTRIBUTES_ERROR"] = "21";
45
+ PURCHASES_ERROR_CODE["LOG_OUT_ANONYMOUS_USER_ERROR"] = "22";
46
+ PURCHASES_ERROR_CODE["CONFIGURATION_ERROR"] = "23";
47
+ PURCHASES_ERROR_CODE["UNSUPPORTED_ERROR"] = "24";
48
+ PURCHASES_ERROR_CODE["EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR"] = "25";
49
+ PURCHASES_ERROR_CODE["PRODUCT_DISCOUNT_MISSING_IDENTIFIER_ERROR"] = "26";
50
+ PURCHASES_ERROR_CODE["PRODUCT_DISCOUNT_MISSING_SUBSCRIPTION_GROUP_IDENTIFIER_ERROR"] = "28";
51
+ PURCHASES_ERROR_CODE["CUSTOMER_INFO_ERROR"] = "29";
52
+ PURCHASES_ERROR_CODE["SYSTEM_INFO_ERROR"] = "30";
53
+ PURCHASES_ERROR_CODE["BEGIN_REFUND_REQUEST_ERROR"] = "31";
54
+ PURCHASES_ERROR_CODE["PRODUCT_REQUEST_TIMED_OUT_ERROR"] = "32";
55
+ PURCHASES_ERROR_CODE["API_ENDPOINT_BLOCKED"] = "33";
56
+ PURCHASES_ERROR_CODE["INVALID_PROMOTIONAL_OFFER_ERROR"] = "34";
57
+ PURCHASES_ERROR_CODE["OFFLINE_CONNECTION_ERROR"] = "35";
58
+ })(PURCHASES_ERROR_CODE || (exports.PURCHASES_ERROR_CODE = PURCHASES_ERROR_CODE = {}));
59
+ /**
60
+ * @internal
61
+ */
62
+ var UninitializedPurchasesError = /** @class */ (function (_super) {
63
+ __extends(UninitializedPurchasesError, _super);
64
+ function UninitializedPurchasesError() {
65
+ var _this = _super.call(this, "There is no singleton instance. " +
66
+ "Make sure you configure Purchases before trying to get the default instance. " +
67
+ "More info here: https://errors.rev.cat/configuring-sdk") || this;
68
+ // Set the prototype explicitly.
69
+ Object.setPrototypeOf(_this, UninitializedPurchasesError.prototype);
70
+ return _this;
71
+ }
72
+ return UninitializedPurchasesError;
73
+ }(Error));
74
+ exports.UninitializedPurchasesError = UninitializedPurchasesError;
75
+ /**
76
+ * @internal
77
+ */
78
+ var UnsupportedPlatformError = /** @class */ (function (_super) {
79
+ __extends(UnsupportedPlatformError, _super);
80
+ function UnsupportedPlatformError() {
81
+ var _this = _super.call(this, "This method is not available in the current platform.") || this;
82
+ // Set the prototype explicitly.
83
+ Object.setPrototypeOf(_this, UnsupportedPlatformError.prototype);
84
+ return _this;
85
+ }
86
+ return UnsupportedPlatformError;
87
+ }(Error));
88
+ exports.UnsupportedPlatformError = UnsupportedPlatformError;
@@ -0,0 +1,6 @@
1
+ export * from './errors';
2
+ export * from './customerInfo';
3
+ export * from './offerings';
4
+ export * from './enums';
5
+ export * from './purchasesConfiguration';
6
+ export * from './callbackTypes';
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./errors"), exports);
18
+ __exportStar(require("./customerInfo"), exports);
19
+ __exportStar(require("./offerings"), exports);
20
+ __exportStar(require("./enums"), exports);
21
+ __exportStar(require("./purchasesConfiguration"), exports);
22
+ __exportStar(require("./callbackTypes"), exports);
@@ -0,0 +1,528 @@
1
+ export declare enum PACKAGE_TYPE {
2
+ /**
3
+ * A package that was defined with a custom identifier.
4
+ */
5
+ UNKNOWN = "UNKNOWN",
6
+ /**
7
+ * A package that was defined with a custom identifier.
8
+ */
9
+ CUSTOM = "CUSTOM",
10
+ /**
11
+ * A package configured with the predefined lifetime identifier.
12
+ */
13
+ LIFETIME = "LIFETIME",
14
+ /**
15
+ * A package configured with the predefined annual identifier.
16
+ */
17
+ ANNUAL = "ANNUAL",
18
+ /**
19
+ * A package configured with the predefined six month identifier.
20
+ */
21
+ SIX_MONTH = "SIX_MONTH",
22
+ /**
23
+ * A package configured with the predefined three month identifier.
24
+ */
25
+ THREE_MONTH = "THREE_MONTH",
26
+ /**
27
+ * A package configured with the predefined two month identifier.
28
+ */
29
+ TWO_MONTH = "TWO_MONTH",
30
+ /**
31
+ * A package configured with the predefined monthly identifier.
32
+ */
33
+ MONTHLY = "MONTHLY",
34
+ /**
35
+ * A package configured with the predefined weekly identifier.
36
+ */
37
+ WEEKLY = "WEEKLY"
38
+ }
39
+ export declare enum INTRO_ELIGIBILITY_STATUS {
40
+ /**
41
+ * RevenueCat doesn't have enough information to determine eligibility.
42
+ */
43
+ INTRO_ELIGIBILITY_STATUS_UNKNOWN = 0,
44
+ /**
45
+ * The user is not eligible for a free trial or intro pricing for this product.
46
+ */
47
+ INTRO_ELIGIBILITY_STATUS_INELIGIBLE = 1,
48
+ /**
49
+ * The user is eligible for a free trial or intro pricing for this product.
50
+ */
51
+ INTRO_ELIGIBILITY_STATUS_ELIGIBLE = 2,
52
+ /**
53
+ * There is no free trial or intro pricing for this product.
54
+ */
55
+ INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS = 3
56
+ }
57
+ export interface PurchasesStoreProduct {
58
+ /**
59
+ * Product Id.
60
+ */
61
+ readonly identifier: string;
62
+ /**
63
+ * Description of the product.
64
+ */
65
+ readonly description: string;
66
+ /**
67
+ * Title of the product.
68
+ */
69
+ readonly title: string;
70
+ /**
71
+ * Price of the product in the local currency.
72
+ * Contains the price value of defaultOption for Google Play.
73
+ */
74
+ readonly price: number;
75
+ /**
76
+ * Formatted price of the item, including its currency sign.
77
+ * Contains the formatted price value of defaultOption for Google Play.
78
+ */
79
+ readonly priceString: string;
80
+ /**
81
+ * Currency code for price and original price.
82
+ * Contains the currency code value of defaultOption for Google Play.
83
+ */
84
+ readonly currencyCode: string;
85
+ /**
86
+ * Introductory price.
87
+ */
88
+ readonly introPrice: PurchasesIntroPrice | null;
89
+ /**
90
+ * Collection of discount offers for a product. Null for Android.
91
+ */
92
+ readonly discounts: PurchasesStoreProductDiscount[] | null;
93
+ /**
94
+ * Product category.
95
+ */
96
+ readonly productCategory: PRODUCT_CATEGORY | null;
97
+ /**
98
+ * Subscription period, specified in ISO 8601 format. For example,
99
+ * P1W equates to one week, P1M equates to one month,
100
+ * P3M equates to three months, P6M equates to six months,
101
+ * and P1Y equates to one year.
102
+ * Note: Not available for Amazon.
103
+ */
104
+ readonly subscriptionPeriod: string | null;
105
+ /**
106
+ * Default subscription option for a product. Google Play only.
107
+ */
108
+ readonly defaultOption: SubscriptionOption | null;
109
+ /**
110
+ * Collection of subscription options for a product. Google Play only.
111
+ */
112
+ readonly subscriptionOptions: SubscriptionOption[] | null;
113
+ /**
114
+ * Offering identifier the store product was presented from.
115
+ * Null if not using offerings or if fetched directly from store via getProducts.
116
+ */
117
+ readonly presentedOfferingIdentifier: string | null;
118
+ }
119
+ export declare enum PRODUCT_CATEGORY {
120
+ /**
121
+ * A type of product for non-subscription.
122
+ */
123
+ NON_SUBSCRIPTION = "NON_SUBSCRIPTION",
124
+ /**
125
+ * A type of product for subscriptions.
126
+ */
127
+ SUBSCRIPTION = "SUBSCRIPTION",
128
+ /**
129
+ * A type of product for unknowns.
130
+ */
131
+ UNKNOWN = "UNKNOWN"
132
+ }
133
+ export interface PurchasesStoreProductDiscount {
134
+ /**
135
+ * Identifier of the discount.
136
+ */
137
+ readonly identifier: string;
138
+ /**
139
+ * Price in the local currency.
140
+ */
141
+ readonly price: number;
142
+ /**
143
+ * Formatted price, including its currency sign, such as €3.99.
144
+ */
145
+ readonly priceString: string;
146
+ /**
147
+ * Number of subscription billing periods for which the user will be given the discount, such as 3.
148
+ */
149
+ readonly cycles: number;
150
+ /**
151
+ * Billing period of the discount, specified in ISO 8601 format.
152
+ */
153
+ readonly period: string;
154
+ /**
155
+ * Unit for the billing period of the discount, can be DAY, WEEK, MONTH or YEAR.
156
+ */
157
+ readonly periodUnit: string;
158
+ /**
159
+ * Number of units for the billing period of the discount.
160
+ */
161
+ readonly periodNumberOfUnits: number;
162
+ }
163
+ export interface PurchasesIntroPrice {
164
+ /**
165
+ * Price in the local currency.
166
+ */
167
+ readonly price: number;
168
+ /**
169
+ * Formatted price, including its currency sign, such as €3.99.
170
+ */
171
+ readonly priceString: string;
172
+ /**
173
+ * Number of subscription billing periods for which the user will be given the discount, such as 3.
174
+ */
175
+ readonly cycles: number;
176
+ /**
177
+ * Billing period of the discount, specified in ISO 8601 format.
178
+ */
179
+ readonly period: string;
180
+ /**
181
+ * Unit for the billing period of the discount, can be DAY, WEEK, MONTH or YEAR.
182
+ */
183
+ readonly periodUnit: string;
184
+ /**
185
+ * Number of units for the billing period of the discount.
186
+ */
187
+ readonly periodNumberOfUnits: number;
188
+ }
189
+ /**
190
+ * Contains information about the product available for the user to purchase.
191
+ * For more info see https://docs.revenuecat.com/docs/entitlements
192
+ */
193
+ export interface PurchasesPackage {
194
+ /**
195
+ * Unique identifier for this package. Can be one a predefined package type or a custom one.
196
+ */
197
+ readonly identifier: string;
198
+ /**
199
+ * Package type for the product. Will be one of [PACKAGE_TYPE].
200
+ */
201
+ readonly packageType: PACKAGE_TYPE;
202
+ /**
203
+ * Product assigned to this package.
204
+ */
205
+ readonly product: PurchasesStoreProduct;
206
+ /**
207
+ * Offering this package belongs to.
208
+ */
209
+ readonly offeringIdentifier: string;
210
+ }
211
+ /**
212
+ * An offering is a collection of Packages (`PurchasesPackage`) available for the user to purchase.
213
+ * For more info see https://docs.revenuecat.com/docs/entitlements
214
+ */
215
+ export interface PurchasesOffering {
216
+ /**
217
+ * Unique identifier defined in RevenueCat dashboard.
218
+ */
219
+ readonly identifier: string;
220
+ /**
221
+ * Offering description defined in RevenueCat dashboard.
222
+ */
223
+ readonly serverDescription: string;
224
+ /**
225
+ * Offering metadata defined in RevenueCat dashboard.
226
+ */
227
+ readonly metadata: Map<string, any>;
228
+ /**
229
+ * Array of `Package` objects available for purchase.
230
+ */
231
+ readonly availablePackages: PurchasesPackage[];
232
+ /**
233
+ * Lifetime package type configured in the RevenueCat dashboard, if available.
234
+ */
235
+ readonly lifetime: PurchasesPackage | null;
236
+ /**
237
+ * Annual package type configured in the RevenueCat dashboard, if available.
238
+ */
239
+ readonly annual: PurchasesPackage | null;
240
+ /**
241
+ * Six month package type configured in the RevenueCat dashboard, if available.
242
+ */
243
+ readonly sixMonth: PurchasesPackage | null;
244
+ /**
245
+ * Three month package type configured in the RevenueCat dashboard, if available.
246
+ */
247
+ readonly threeMonth: PurchasesPackage | null;
248
+ /**
249
+ * Two month package type configured in the RevenueCat dashboard, if available.
250
+ */
251
+ readonly twoMonth: PurchasesPackage | null;
252
+ /**
253
+ * Monthly package type configured in the RevenueCat dashboard, if available.
254
+ */
255
+ readonly monthly: PurchasesPackage | null;
256
+ /**
257
+ * Weekly package type configured in the RevenueCat dashboard, if available.
258
+ */
259
+ readonly weekly: PurchasesPackage | null;
260
+ }
261
+ /**
262
+ * Contains all the offerings configured in RevenueCat dashboard.
263
+ * For more info see https://docs.revenuecat.com/docs/entitlements
264
+ */
265
+ export interface PurchasesOfferings {
266
+ /**
267
+ * Map of all Offerings [PurchasesOffering] objects keyed by their identifier.
268
+ */
269
+ readonly all: {
270
+ [key: string]: PurchasesOffering;
271
+ };
272
+ /**
273
+ * Current offering configured in the RevenueCat dashboard.
274
+ */
275
+ readonly current: PurchasesOffering | null;
276
+ }
277
+ /**
278
+ * Holds the information used when upgrading from another sku. For Android use only.
279
+ * @deprecated, use GoogleProductChangeInfo
280
+ */
281
+ export interface UpgradeInfo {
282
+ /**
283
+ * The oldSKU to upgrade from.
284
+ */
285
+ readonly oldSKU: string;
286
+ /**
287
+ * The [PRORATION_MODE] to use when upgrading the given oldSKU.
288
+ */
289
+ readonly prorationMode?: PRORATION_MODE;
290
+ }
291
+ /**
292
+ * Holds the information used when upgrading from another sku. For Android use only.
293
+ */
294
+ export interface GoogleProductChangeInfo {
295
+ /**
296
+ * The old product identifier to upgrade from.
297
+ */
298
+ readonly oldProductIdentifier: string;
299
+ /**
300
+ * The [PRORATION_MODE] to use when upgrading the given oldSKU.
301
+ */
302
+ readonly prorationMode?: PRORATION_MODE;
303
+ }
304
+ /**
305
+ * Holds the introductory price status
306
+ */
307
+ export interface IntroEligibility {
308
+ /**
309
+ * The introductory price eligibility status
310
+ */
311
+ readonly status: INTRO_ELIGIBILITY_STATUS;
312
+ /**
313
+ * Description of the status
314
+ */
315
+ readonly description: string;
316
+ }
317
+ export interface PurchasesPromotionalOffer {
318
+ readonly identifier: string;
319
+ readonly keyIdentifier: string;
320
+ readonly nonce: string;
321
+ readonly signature: string;
322
+ readonly timestamp: number;
323
+ }
324
+ export declare enum PRORATION_MODE {
325
+ UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,
326
+ /**
327
+ * Replacement takes effect immediately, and the remaining time will be
328
+ * prorated and credited to the user. This is the current default behavior.
329
+ */
330
+ IMMEDIATE_WITH_TIME_PRORATION = 1,
331
+ /**
332
+ * Replacement takes effect immediately, and the billing cycle remains the
333
+ * same. The price for the remaining period will be charged. This option is
334
+ * only available for subscription upgrade.
335
+ */
336
+ IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,
337
+ /**
338
+ * Replacement takes effect immediately, and the new price will be charged on
339
+ * next recurrence time. The billing cycle stays the same.
340
+ */
341
+ IMMEDIATE_WITHOUT_PRORATION = 3,
342
+ /**
343
+ * Replacement takes effect when the old plan expires, and the new price will
344
+ * be charged at the same time.
345
+ */
346
+ DEFERRED = 4,
347
+ /**
348
+ * Replacement takes effect immediately, and the user is charged full price
349
+ * of new plan and is given a full billing cycle of subscription,
350
+ * plus remaining prorated time from the old plan.
351
+ */
352
+ IMMEDIATE_AND_CHARGE_FULL_PRICE = 5
353
+ }
354
+ /**
355
+ * Contains all details associated with a SubscriptionOption
356
+ * Used only for Google
357
+ */
358
+ export interface SubscriptionOption {
359
+ /**
360
+ * Identifier of the subscription option
361
+ * If this SubscriptionOption represents a base plan, this will be the basePlanId.
362
+ * If it represents an offer, it will be {basePlanId}:{offerId}
363
+ */
364
+ readonly id: string;
365
+ /**
366
+ * Identifier of the StoreProduct associated with this SubscriptionOption
367
+ * This will be {subId}:{basePlanId}
368
+ */
369
+ readonly storeProductId: string;
370
+ /**
371
+ * Identifer of the subscription associated with this SubscriptionOption
372
+ * This will be {subId}
373
+ */
374
+ readonly productId: string;
375
+ /**
376
+ * Pricing phases defining a user's payment plan for the product over time.
377
+ */
378
+ readonly pricingPhases: PricingPhase[];
379
+ /**
380
+ * Tags defined on the base plan or offer. Empty for Amazon.
381
+ */
382
+ readonly tags: string[];
383
+ /**
384
+ * True if this SubscriptionOption represents a subscription base plan (rather than an offer).
385
+ */
386
+ readonly isBasePlan: boolean;
387
+ /**
388
+ * The subscription period of fullPricePhase (after free and intro trials).
389
+ */
390
+ readonly billingPeriod: Period | null;
391
+ /**
392
+ * True if the subscription is pre-paid.
393
+ */
394
+ readonly isPrepaid: boolean;
395
+ /**
396
+ * The full price PricingPhase of the subscription.
397
+ * Looks for the last price phase of the SubscriptionOption.
398
+ */
399
+ readonly fullPricePhase: PricingPhase | null;
400
+ /**
401
+ * The free trial PricingPhase of the subscription.
402
+ * Looks for the first pricing phase of the SubscriptionOption where amountMicros is 0.
403
+ * There can be a freeTrialPhase and an introductoryPhase in the same SubscriptionOption.
404
+ */
405
+ readonly freePhase: PricingPhase | null;
406
+ /**
407
+ * The intro trial PricingPhase of the subscription.
408
+ * Looks for the first pricing phase of the SubscriptionOption where amountMicros is greater than 0.
409
+ * There can be a freeTrialPhase and an introductoryPhase in the same SubscriptionOption.
410
+ */
411
+ readonly introPhase: PricingPhase | null;
412
+ /**
413
+ * Offering identifier the subscription option was presented from
414
+ */
415
+ readonly presentedOfferingIdentifier: string | null;
416
+ }
417
+ /**
418
+ * Contains all the details associated with a PricingPhase
419
+ */
420
+ export interface PricingPhase {
421
+ /**
422
+ * Billing period for which the PricingPhase applies
423
+ */
424
+ readonly billingPeriod: Period;
425
+ /**
426
+ * Recurrence mode of the PricingPhase
427
+ */
428
+ readonly recurrenceMode: RECURRENCE_MODE | null;
429
+ /**
430
+ * Number of cycles for which the pricing phase applies.
431
+ * Null for infiniteRecurring or finiteRecurring recurrence modes.
432
+ */
433
+ readonly billingCycleCount: number | null;
434
+ /**
435
+ * Price of the PricingPhase
436
+ */
437
+ readonly price: Price;
438
+ /**
439
+ * Indicates how the pricing phase is charged for finiteRecurring pricing phases
440
+ */
441
+ readonly offerPaymentMode: OFFER_PAYMENT_MODE | null;
442
+ }
443
+ /**
444
+ * Recurrence mode for a pricing phase
445
+ */
446
+ export declare enum RECURRENCE_MODE {
447
+ /**
448
+ * Pricing phase repeats infinitely until cancellation
449
+ */
450
+ INFINITE_RECURRING = 1,
451
+ /**
452
+ * Pricing phase repeats for a fixed number of billing periods
453
+ */
454
+ FINITE_RECURRING = 2,
455
+ /**
456
+ * Pricing phase does not repeat
457
+ */
458
+ NON_RECURRING = 3
459
+ }
460
+ /**
461
+ * Payment mode for offer pricing phases. Google Play only.
462
+ */
463
+ export declare enum OFFER_PAYMENT_MODE {
464
+ /**
465
+ * Subscribers don't pay until the specified period ends
466
+ */
467
+ FREE_TRIAL = "FREE_TRIAL",
468
+ /**
469
+ * Subscribers pay up front for a specified period
470
+ */
471
+ SINGLE_PAYMENT = "SINGLE_PAYMENT",
472
+ /**
473
+ * Subscribers pay a discounted amount for a specified number of periods
474
+ */
475
+ DISCOUNTED_RECURRING_PAYMENT = "DISCOUNTED_RECURRING_PAYMENT"
476
+ }
477
+ /**
478
+ * Contains all the details associated with a Price
479
+ */
480
+ export interface Price {
481
+ /**
482
+ * Formatted price of the item, including its currency sign. For example $3.00
483
+ */
484
+ readonly formatted: string;
485
+ /**
486
+ * Price in micro-units, where 1,000,000 micro-units equal one unit of the currency.
487
+ *
488
+ * For example, if price is "€7.99", price_amount_micros is 7,990,000. This value represents
489
+ * the localized, rounded price for a particular currency.
490
+ */
491
+ readonly amountMicros: number;
492
+ /**
493
+ * Returns ISO 4217 currency code for price and original price.
494
+ *
495
+ * For example, if price is specified in British pounds sterling, price_currency_code is "GBP".
496
+ * If currency code cannot be determined, currency symbol is returned.
497
+ */
498
+ readonly currencyCode: string;
499
+ }
500
+ /**
501
+ * Contains all the details associated with a Period
502
+ */
503
+ export interface Period {
504
+ /**
505
+ * The number of period units: day, week, month, year, unknown
506
+ */
507
+ readonly unit: PERIOD_UNIT;
508
+ /**
509
+ * The increment of time that a subscription period is specified in
510
+ */
511
+ readonly value: number;
512
+ /**
513
+ * Specified in ISO 8601 format. For example, P1W equates to one week,
514
+ * P1M equates to one month, P3M equates to three months, P6M equates to six months,
515
+ * and P1Y equates to one year
516
+ */
517
+ readonly iso8601: string;
518
+ }
519
+ /**
520
+ * Time duration unit for Period.
521
+ */
522
+ export declare enum PERIOD_UNIT {
523
+ DAY = "DAY",
524
+ WEEK = "WEEK",
525
+ MONTH = "MONTH",
526
+ YEAR = "YEAR",
527
+ UNKNOWN = "UNKNOWN"
528
+ }
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PERIOD_UNIT = exports.OFFER_PAYMENT_MODE = exports.RECURRENCE_MODE = exports.PRORATION_MODE = exports.PRODUCT_CATEGORY = exports.INTRO_ELIGIBILITY_STATUS = exports.PACKAGE_TYPE = void 0;
4
+ var PACKAGE_TYPE;
5
+ (function (PACKAGE_TYPE) {
6
+ /**
7
+ * A package that was defined with a custom identifier.
8
+ */
9
+ PACKAGE_TYPE["UNKNOWN"] = "UNKNOWN";
10
+ /**
11
+ * A package that was defined with a custom identifier.
12
+ */
13
+ PACKAGE_TYPE["CUSTOM"] = "CUSTOM";
14
+ /**
15
+ * A package configured with the predefined lifetime identifier.
16
+ */
17
+ PACKAGE_TYPE["LIFETIME"] = "LIFETIME";
18
+ /**
19
+ * A package configured with the predefined annual identifier.
20
+ */
21
+ PACKAGE_TYPE["ANNUAL"] = "ANNUAL";
22
+ /**
23
+ * A package configured with the predefined six month identifier.
24
+ */
25
+ PACKAGE_TYPE["SIX_MONTH"] = "SIX_MONTH";
26
+ /**
27
+ * A package configured with the predefined three month identifier.
28
+ */
29
+ PACKAGE_TYPE["THREE_MONTH"] = "THREE_MONTH";
30
+ /**
31
+ * A package configured with the predefined two month identifier.
32
+ */
33
+ PACKAGE_TYPE["TWO_MONTH"] = "TWO_MONTH";
34
+ /**
35
+ * A package configured with the predefined monthly identifier.
36
+ */
37
+ PACKAGE_TYPE["MONTHLY"] = "MONTHLY";
38
+ /**
39
+ * A package configured with the predefined weekly identifier.
40
+ */
41
+ PACKAGE_TYPE["WEEKLY"] = "WEEKLY";
42
+ })(PACKAGE_TYPE || (exports.PACKAGE_TYPE = PACKAGE_TYPE = {}));
43
+ var INTRO_ELIGIBILITY_STATUS;
44
+ (function (INTRO_ELIGIBILITY_STATUS) {
45
+ /**
46
+ * RevenueCat doesn't have enough information to determine eligibility.
47
+ */
48
+ INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_UNKNOWN"] = 0] = "INTRO_ELIGIBILITY_STATUS_UNKNOWN";
49
+ /**
50
+ * The user is not eligible for a free trial or intro pricing for this product.
51
+ */
52
+ INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_INELIGIBLE"] = 1] = "INTRO_ELIGIBILITY_STATUS_INELIGIBLE";
53
+ /**
54
+ * The user is eligible for a free trial or intro pricing for this product.
55
+ */
56
+ INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_ELIGIBLE"] = 2] = "INTRO_ELIGIBILITY_STATUS_ELIGIBLE";
57
+ /**
58
+ * There is no free trial or intro pricing for this product.
59
+ */
60
+ INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS"] = 3] = "INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS";
61
+ })(INTRO_ELIGIBILITY_STATUS || (exports.INTRO_ELIGIBILITY_STATUS = INTRO_ELIGIBILITY_STATUS = {}));
62
+ var PRODUCT_CATEGORY;
63
+ (function (PRODUCT_CATEGORY) {
64
+ /**
65
+ * A type of product for non-subscription.
66
+ */
67
+ PRODUCT_CATEGORY["NON_SUBSCRIPTION"] = "NON_SUBSCRIPTION";
68
+ /**
69
+ * A type of product for subscriptions.
70
+ */
71
+ PRODUCT_CATEGORY["SUBSCRIPTION"] = "SUBSCRIPTION";
72
+ /**
73
+ * A type of product for unknowns.
74
+ */
75
+ PRODUCT_CATEGORY["UNKNOWN"] = "UNKNOWN";
76
+ })(PRODUCT_CATEGORY || (exports.PRODUCT_CATEGORY = PRODUCT_CATEGORY = {}));
77
+ var PRORATION_MODE;
78
+ (function (PRORATION_MODE) {
79
+ PRORATION_MODE[PRORATION_MODE["UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY"] = 0] = "UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY";
80
+ /**
81
+ * Replacement takes effect immediately, and the remaining time will be
82
+ * prorated and credited to the user. This is the current default behavior.
83
+ */
84
+ PRORATION_MODE[PRORATION_MODE["IMMEDIATE_WITH_TIME_PRORATION"] = 1] = "IMMEDIATE_WITH_TIME_PRORATION";
85
+ /**
86
+ * Replacement takes effect immediately, and the billing cycle remains the
87
+ * same. The price for the remaining period will be charged. This option is
88
+ * only available for subscription upgrade.
89
+ */
90
+ PRORATION_MODE[PRORATION_MODE["IMMEDIATE_AND_CHARGE_PRORATED_PRICE"] = 2] = "IMMEDIATE_AND_CHARGE_PRORATED_PRICE";
91
+ /**
92
+ * Replacement takes effect immediately, and the new price will be charged on
93
+ * next recurrence time. The billing cycle stays the same.
94
+ */
95
+ PRORATION_MODE[PRORATION_MODE["IMMEDIATE_WITHOUT_PRORATION"] = 3] = "IMMEDIATE_WITHOUT_PRORATION";
96
+ /**
97
+ * Replacement takes effect when the old plan expires, and the new price will
98
+ * be charged at the same time.
99
+ */
100
+ PRORATION_MODE[PRORATION_MODE["DEFERRED"] = 4] = "DEFERRED";
101
+ /**
102
+ * Replacement takes effect immediately, and the user is charged full price
103
+ * of new plan and is given a full billing cycle of subscription,
104
+ * plus remaining prorated time from the old plan.
105
+ */
106
+ PRORATION_MODE[PRORATION_MODE["IMMEDIATE_AND_CHARGE_FULL_PRICE"] = 5] = "IMMEDIATE_AND_CHARGE_FULL_PRICE";
107
+ })(PRORATION_MODE || (exports.PRORATION_MODE = PRORATION_MODE = {}));
108
+ /**
109
+ * Recurrence mode for a pricing phase
110
+ */
111
+ var RECURRENCE_MODE;
112
+ (function (RECURRENCE_MODE) {
113
+ /**
114
+ * Pricing phase repeats infinitely until cancellation
115
+ */
116
+ RECURRENCE_MODE[RECURRENCE_MODE["INFINITE_RECURRING"] = 1] = "INFINITE_RECURRING";
117
+ /**
118
+ * Pricing phase repeats for a fixed number of billing periods
119
+ */
120
+ RECURRENCE_MODE[RECURRENCE_MODE["FINITE_RECURRING"] = 2] = "FINITE_RECURRING";
121
+ /**
122
+ * Pricing phase does not repeat
123
+ */
124
+ RECURRENCE_MODE[RECURRENCE_MODE["NON_RECURRING"] = 3] = "NON_RECURRING";
125
+ })(RECURRENCE_MODE || (exports.RECURRENCE_MODE = RECURRENCE_MODE = {}));
126
+ /**
127
+ * Payment mode for offer pricing phases. Google Play only.
128
+ */
129
+ var OFFER_PAYMENT_MODE;
130
+ (function (OFFER_PAYMENT_MODE) {
131
+ /**
132
+ * Subscribers don't pay until the specified period ends
133
+ */
134
+ OFFER_PAYMENT_MODE["FREE_TRIAL"] = "FREE_TRIAL";
135
+ /**
136
+ * Subscribers pay up front for a specified period
137
+ */
138
+ OFFER_PAYMENT_MODE["SINGLE_PAYMENT"] = "SINGLE_PAYMENT";
139
+ /**
140
+ * Subscribers pay a discounted amount for a specified number of periods
141
+ */
142
+ OFFER_PAYMENT_MODE["DISCOUNTED_RECURRING_PAYMENT"] = "DISCOUNTED_RECURRING_PAYMENT";
143
+ })(OFFER_PAYMENT_MODE || (exports.OFFER_PAYMENT_MODE = OFFER_PAYMENT_MODE = {}));
144
+ /**
145
+ * Time duration unit for Period.
146
+ */
147
+ var PERIOD_UNIT;
148
+ (function (PERIOD_UNIT) {
149
+ PERIOD_UNIT["DAY"] = "DAY";
150
+ PERIOD_UNIT["WEEK"] = "WEEK";
151
+ PERIOD_UNIT["MONTH"] = "MONTH";
152
+ PERIOD_UNIT["YEAR"] = "YEAR";
153
+ PERIOD_UNIT["UNKNOWN"] = "UNKNOWN";
154
+ })(PERIOD_UNIT || (exports.PERIOD_UNIT = PERIOD_UNIT = {}));
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Holds parameters to initialize the SDK.
3
+ */
4
+ export interface PurchasesConfiguration {
5
+ /**
6
+ * RevenueCat API Key. Needs to be a string
7
+ */
8
+ apiKey: string;
9
+ /**
10
+ * A unique id for identifying the user
11
+ */
12
+ appUserID?: string | null;
13
+ /**
14
+ * An optional boolean. Set this to TRUE if you have your own IAP implementation and
15
+ * want to use only RevenueCat's backend. Default is FALSE. If you are on Android and setting this to ON, you will have
16
+ * to acknowledge the purchases yourself.
17
+ */
18
+ observerMode?: boolean;
19
+ /**
20
+ * An optional string. iOS-only, will be ignored for Android.
21
+ * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults
22
+ * suite, otherwise it will use standardUserDefaults. Default is null, which will make the SDK use standardUserDefaults.
23
+ */
24
+ userDefaultsSuiteName?: string;
25
+ /**
26
+ * iOS-only, will be ignored for Android.
27
+ * Set this to TRUE to enable StoreKit2.
28
+ * Default is FALSE.
29
+ *
30
+ * @deprecated RevenueCat currently uses StoreKit 1 for purchases, as its stability in production scenarios has
31
+ * proven to be more performant than StoreKit 2.
32
+ * We're collecting more data on the best approach, but StoreKit 1 vs StoreKit 2 is an implementation detail
33
+ * that you shouldn't need to care about.
34
+ * We recommend not using this parameter, letting RevenueCat decide for you which StoreKit implementation to use.
35
+ */
36
+ usesStoreKit2IfAvailable?: boolean;
37
+ /**
38
+ * An optional boolean. Android only. Required to configure the plugin to be used in the Amazon Appstore.
39
+ */
40
+ useAmazon?: boolean;
41
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-typescript-internal",
3
3
  "title": "Purchases typescript internal shared code",
4
- "version": "5.3.0",
4
+ "version": "5.4.0",
5
5
  "description": "Typescript code to be used by RevenueCat's hybrid SDKs. Not meant for external usage.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",