@revenuecat/purchases-typescript-internal-esm 11.1.1 → 12.0.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/enums.d.ts CHANGED
@@ -101,15 +101,15 @@ export declare enum ENTITLEMENT_VERIFICATION_MODE {
101
101
  */
102
102
  DISABLED = "DISABLED",
103
103
  /**
104
- * Enable entitlement verification.
105
- *
106
- * If verification fails, this will be indicated with [VerificationResult.FAILED] in
107
- * the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail
108
- * (i.e. Entitlements will still be granted).
109
- *
110
- * This can be useful if you want to handle verification failures to display an error/warning to the user
111
- * or to track this situation but still grant access.
112
- */
104
+ * Enable entitlement verification.
105
+ *
106
+ * If verification fails, this will be indicated with [VerificationResult.FAILED] in
107
+ * the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail
108
+ * (i.e. Entitlements will still be granted).
109
+ *
110
+ * This can be useful if you want to handle verification failures to display an error/warning to the user
111
+ * or to track this situation but still grant access.
112
+ */
113
113
  INFORMATIONAL = "INFORMATIONAL"
114
114
  }
115
115
  /**
@@ -172,3 +172,42 @@ export declare enum PAYWALL_RESULT {
172
172
  */
173
173
  RESTORED = "RESTORED"
174
174
  }
175
+ /**
176
+ * Defines which version of StoreKit may be used
177
+ * @public
178
+ */
179
+ export declare enum STOREKIT_VERSION {
180
+ /**
181
+ * Always use StoreKit 1.
182
+ */
183
+ STOREKIT_1 = "STOREKIT_1",
184
+ /**
185
+ * Always use StoreKit 2 (StoreKit 1 will be used if StoreKit 2 is not available in the current device.)
186
+ * - Warning: Make sure you have an In-App Purchase Key configured in your app.
187
+ * Please see https://rev.cat/in-app-purchase-key-configuration for more info.
188
+ */
189
+ STOREKIT_2 = "STOREKIT_2",
190
+ /**
191
+ * Let RevenueCat use the most appropiate version of StoreKit
192
+ */
193
+ DEFAULT = "DEFAULT"
194
+ }
195
+ /**
196
+ * Modes for completing the purchase process.
197
+ * @public
198
+ */
199
+ export declare enum PURCHASES_ARE_COMPLETED_BY {
200
+ /**
201
+ * RevenueCat will **not** automatically acknowledge any purchases. You will have to do so manually.
202
+ *
203
+ * **Note:** failing to acknowledge a purchase within 3 days will lead to Google Play automatically issuing a
204
+ * refund to the user.
205
+ *
206
+ * For more info, see [revenuecat.com](https://docs.revenuecat.com/docs/observer-mode#option-2-client-side).
207
+ */
208
+ MY_APP = "MY_APP",
209
+ /**
210
+ * RevenueCat will automatically acknowledge verified purchases. No action is required by you.
211
+ */
212
+ REVENUECAT = "REVENUECAT"
213
+ }
package/dist/enums.js CHANGED
@@ -108,15 +108,15 @@ export var ENTITLEMENT_VERIFICATION_MODE;
108
108
  */
109
109
  ENTITLEMENT_VERIFICATION_MODE["DISABLED"] = "DISABLED";
110
110
  /**
111
- * Enable entitlement verification.
112
- *
113
- * If verification fails, this will be indicated with [VerificationResult.FAILED] in
114
- * the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail
115
- * (i.e. Entitlements will still be granted).
116
- *
117
- * This can be useful if you want to handle verification failures to display an error/warning to the user
118
- * or to track this situation but still grant access.
119
- */
111
+ * Enable entitlement verification.
112
+ *
113
+ * If verification fails, this will be indicated with [VerificationResult.FAILED] in
114
+ * the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail
115
+ * (i.e. Entitlements will still be granted).
116
+ *
117
+ * This can be useful if you want to handle verification failures to display an error/warning to the user
118
+ * or to track this situation but still grant access.
119
+ */
120
120
  ENTITLEMENT_VERIFICATION_MODE["INFORMATIONAL"] = "INFORMATIONAL";
121
121
  // Add ENFORCED mode once we're ready to ship it.
122
122
  // ENFORCED = "ENFORCED"
@@ -183,3 +183,44 @@ export var PAYWALL_RESULT;
183
183
  */
184
184
  PAYWALL_RESULT["RESTORED"] = "RESTORED";
185
185
  })(PAYWALL_RESULT || (PAYWALL_RESULT = {}));
186
+ /**
187
+ * Defines which version of StoreKit may be used
188
+ * @public
189
+ */
190
+ export var STOREKIT_VERSION;
191
+ (function (STOREKIT_VERSION) {
192
+ /**
193
+ * Always use StoreKit 1.
194
+ */
195
+ STOREKIT_VERSION["STOREKIT_1"] = "STOREKIT_1";
196
+ /**
197
+ * Always use StoreKit 2 (StoreKit 1 will be used if StoreKit 2 is not available in the current device.)
198
+ * - Warning: Make sure you have an In-App Purchase Key configured in your app.
199
+ * Please see https://rev.cat/in-app-purchase-key-configuration for more info.
200
+ */
201
+ STOREKIT_VERSION["STOREKIT_2"] = "STOREKIT_2";
202
+ /**
203
+ * Let RevenueCat use the most appropiate version of StoreKit
204
+ */
205
+ STOREKIT_VERSION["DEFAULT"] = "DEFAULT";
206
+ })(STOREKIT_VERSION || (STOREKIT_VERSION = {}));
207
+ /**
208
+ * Modes for completing the purchase process.
209
+ * @public
210
+ */
211
+ export var PURCHASES_ARE_COMPLETED_BY;
212
+ (function (PURCHASES_ARE_COMPLETED_BY) {
213
+ /**
214
+ * RevenueCat will **not** automatically acknowledge any purchases. You will have to do so manually.
215
+ *
216
+ * **Note:** failing to acknowledge a purchase within 3 days will lead to Google Play automatically issuing a
217
+ * refund to the user.
218
+ *
219
+ * For more info, see [revenuecat.com](https://docs.revenuecat.com/docs/observer-mode#option-2-client-side).
220
+ */
221
+ PURCHASES_ARE_COMPLETED_BY["MY_APP"] = "MY_APP";
222
+ /**
223
+ * RevenueCat will automatically acknowledge verified purchases. No action is required by you.
224
+ */
225
+ PURCHASES_ARE_COMPLETED_BY["REVENUECAT"] = "REVENUECAT";
226
+ })(PURCHASES_ARE_COMPLETED_BY || (PURCHASES_ARE_COMPLETED_BY = {}));
@@ -89,6 +89,51 @@ export interface PurchasesStoreProduct {
89
89
  * Contains the formatted price value of defaultOption for Google Play.
90
90
  */
91
91
  readonly priceString: string;
92
+ /**
93
+ * Null for INAPP products. The price of the PurchasesStoreProduct in a weekly recurrence.
94
+ * This means that, for example, if the period is monthly, the price will be
95
+ * divided by 4. Note that this value may be an approximation. For Google subscriptions,
96
+ * this value will use the basePlan to calculate the value.
97
+ */
98
+ readonly pricePerWeek: number;
99
+ /**
100
+ * Null for INAPP products. The price of the PurchasesStoreProduct in a monthly recurrence.
101
+ * This means that, for example, if the period is annual, the price will be
102
+ * divided by 12. Note that this value may be an approximation. For Google subscriptions,
103
+ * this value will use the basePlan to calculate the value.
104
+ */
105
+ readonly pricePerMonth: number;
106
+ /**
107
+ * Null for INAPP products. The price of the PurchasesStoreProduct in a yearly recurrence.
108
+ * This means that, for example, if the period is monthly, the price will be multiplied by
109
+ * 12. Note that this value may be an approximation. For Google subscriptions, this value
110
+ * will use the basePlan to calculate the value.
111
+ */
112
+ readonly pricePerYear: number;
113
+ /**
114
+ * Null for INAPP products. The price of the PurchasesStoreProduct formatted for the current
115
+ * locale in a weekly recurrence. This means that, for example, if the period is monthly,
116
+ * the price will be divided by 4. It uses a currency formatter to format the price in the
117
+ * given locale. Note that this value may be an approximation. For Google subscriptions,
118
+ * this value will use the basePlan to calculate the value.
119
+ */
120
+ readonly pricePerWeekString: string;
121
+ /**
122
+ * Null for INAPP products. The price of the PurchasesStoreProduct formatted for the current
123
+ * locale in a monthly recurrence. This means that, for example, if the period is annual,
124
+ * the price will be divided by 12. It uses a currency formatter to format the price in the
125
+ * given locale. Note that this value may be an approximation. For Google subscriptions,
126
+ * this value will use the basePlan to calculate the value.
127
+ */
128
+ readonly pricePerMonthString: string;
129
+ /**
130
+ * Null for INAPP products. The price of the PurchasesStoreProduct formatted for the current
131
+ * locale in a yearly recurrence. This means that, for example, if the period is monthly,
132
+ * the price will be multiplied by 12. It uses a currency formatter to format the price in the
133
+ * given locale. Note that this value may be an approximation. For Google subscriptions,
134
+ * this value will use the basePlan to calculate the value.
135
+ */
136
+ readonly pricePerYearString: string;
92
137
  /**
93
138
  * Currency code for price and original price.
94
139
  * Contains the currency code value of defaultOption for Google Play.
@@ -465,7 +510,7 @@ export declare enum PRORATION_MODE {
465
510
  * Replacement takes effect when the old plan expires, and the new price will
466
511
  * be charged at the same time.
467
512
  */
468
- DEFERRED = 4,
513
+ DEFERRED = 6,
469
514
  /**
470
515
  * Replacement takes effect immediately, and the user is charged full price
471
516
  * of new plan and is given a full billing cycle of subscription,
@@ -542,6 +587,26 @@ export interface SubscriptionOption {
542
587
  * Null if not using offerings or if fetched directly from store via getProducts.
543
588
  */
544
589
  readonly presentedOfferingContext: PresentedOfferingContext | null;
590
+ /**
591
+ * For installment subscriptions, the details of the installment plan the customer commits to.
592
+ * Null for non-installment subscriptions.
593
+ * Installment plans are only available for Google Play subscriptions.
594
+ */
595
+ readonly installmentsInfo: InstallmentsInfo | null;
596
+ }
597
+ /**
598
+ * Type containing information of installment subscriptions. Currently only supported in Google Play.
599
+ * @public
600
+ */
601
+ export interface InstallmentsInfo {
602
+ /**
603
+ * Number of payments the customer commits to in order to purchase the subscription.
604
+ */
605
+ readonly commitmentPaymentsCount: number;
606
+ /**
607
+ * After the commitment payments are complete, the number of payments the user commits to upon a renewal.
608
+ */
609
+ readonly renewalCommitmentPaymentsCount: number;
545
610
  }
546
611
  /**
547
612
  * Contains all the details associated with a PricingPhase
package/dist/offerings.js CHANGED
@@ -141,7 +141,7 @@ export var PRORATION_MODE;
141
141
  * Replacement takes effect when the old plan expires, and the new price will
142
142
  * be charged at the same time.
143
143
  */
144
- PRORATION_MODE[PRORATION_MODE["DEFERRED"] = 4] = "DEFERRED";
144
+ PRORATION_MODE[PRORATION_MODE["DEFERRED"] = 6] = "DEFERRED";
145
145
  /**
146
146
  * Replacement takes effect immediately, and the user is charged full price
147
147
  * of new plan and is given a full billing cycle of subscription,
@@ -1,4 +1,4 @@
1
- import { ENTITLEMENT_VERIFICATION_MODE } from "./enums";
1
+ import { ENTITLEMENT_VERIFICATION_MODE, STOREKIT_VERSION, PURCHASES_ARE_COMPLETED_BY } from "./enums";
2
2
  /**
3
3
  * Holds parameters to initialize the SDK.
4
4
  * @public
@@ -16,8 +16,15 @@ export interface PurchasesConfiguration {
16
16
  * An optional boolean. Set this to TRUE if you have your own IAP implementation and
17
17
  * want to use only RevenueCat's backend. Default is FALSE. If you are on Android and setting this to ON, you will have
18
18
  * to acknowledge the purchases yourself.
19
+ * @deprecated Use purchasesAreCompletedBy instead.
19
20
  */
20
21
  observerMode?: boolean;
22
+ /**
23
+ * Set this to MY_APP if you have your own IAP implementation and
24
+ * want to use only RevenueCat's backend. Default is REVENUECAT. If you are on Android and setting this to MY_APP, you will have
25
+ * to acknowledge the purchases yourself.
26
+ */
27
+ purchasesAreCompletedBy?: PURCHASES_ARE_COMPLETED_BY;
21
28
  /**
22
29
  * An optional string. iOS-only, will be ignored for Android.
23
30
  * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults
@@ -26,16 +33,17 @@ export interface PurchasesConfiguration {
26
33
  userDefaultsSuiteName?: string;
27
34
  /**
28
35
  * iOS-only, will be ignored for Android.
29
- * Set this to TRUE to enable StoreKit2.
30
- * Default is FALSE.
31
36
  *
32
- * @deprecated RevenueCat currently uses StoreKit 1 for purchases, as its stability in production scenarios has
33
- * proven to be more performant than StoreKit 2.
34
- * We're collecting more data on the best approach, but StoreKit 1 vs StoreKit 2 is an implementation detail
35
- * that you shouldn't need to care about.
36
- * We recommend not using this parameter, letting RevenueCat decide for you which StoreKit implementation to use.
37
+ * By selecting the DEFAULT value, RevenueCat will automatically select the most appropriate StoreKit version
38
+ * for the app's runtime environment.
39
+ *
40
+ * - Warning: Make sure you have an In-App Purchase Key configured in your app.
41
+ * Please see https://rev.cat/in-app-purchase-key-configuration for more info.
42
+ *
43
+ * - Note: StoreKit 2 is only available on iOS 16+. StoreKit 1 will be used for previous iOS versions
44
+ * regardless of this setting.
37
45
  */
38
- usesStoreKit2IfAvailable?: boolean;
46
+ storeKitVersion?: STOREKIT_VERSION;
39
47
  /**
40
48
  * An optional boolean. Android only. Required to configure the plugin to be used in the Amazon Appstore.
41
49
  */
@@ -52,4 +60,10 @@ export interface PurchasesConfiguration {
52
60
  * See https://rev.cat/trusted-entitlements for more info.
53
61
  */
54
62
  entitlementVerificationMode?: ENTITLEMENT_VERIFICATION_MODE;
63
+ /**
64
+ * Enable this setting if you want to allow pending purchases for prepaid subscriptions (only supported
65
+ * in Google Play). Note that entitlements are not granted until payment is done.
66
+ * Disabled by default.
67
+ */
68
+ pendingTransactionsForPrepaidPlansEnabled?: boolean;
55
69
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-typescript-internal-esm",
3
3
  "title": "Purchases typescript internal shared code",
4
- "version": "11.1.1",
4
+ "version": "12.0.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",