@revenuecat/purchases-typescript-internal-esm 18.0.0 → 18.2.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.
@@ -467,6 +467,20 @@ export interface GoogleProductChangeInfo {
467
467
  */
468
468
  readonly prorationMode?: PRORATION_MODE;
469
469
  }
470
+ /**
471
+ * Holds the information used when upgrading from another sku. For use on the Play Store and Galaxy Store on Android only.
472
+ * @public
473
+ */
474
+ export interface StoreProductChangeInfo {
475
+ /**
476
+ * The old product identifier to upgrade from.
477
+ */
478
+ readonly oldProductIdentifier: string;
479
+ /**
480
+ * The [STORE_REPLACEMENT_MODE] to use when upgrading the given oldSKU.
481
+ */
482
+ readonly replacementMode?: STORE_REPLACEMENT_MODE;
483
+ }
470
484
  /**
471
485
  * Holds the introductory price status
472
486
  * @public
@@ -506,7 +520,7 @@ export declare enum PRORATION_MODE {
506
520
  UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,
507
521
  /**
508
522
  * Replacement takes effect immediately, and the remaining time will be
509
- * prorated and credited to the user. This is the current default behavior.
523
+ * prorated and credited to the user.
510
524
  */
511
525
  IMMEDIATE_WITH_TIME_PRORATION = 1,
512
526
  /**
@@ -518,6 +532,8 @@ export declare enum PRORATION_MODE {
518
532
  /**
519
533
  * Replacement takes effect immediately, and the new price will be charged on
520
534
  * next recurrence time. The billing cycle stays the same.
535
+ *
536
+ * This is the current default behavior.
521
537
  */
522
538
  IMMEDIATE_WITHOUT_PRORATION = 3,
523
539
  /**
@@ -532,6 +548,41 @@ export declare enum PRORATION_MODE {
532
548
  */
533
549
  IMMEDIATE_AND_CHARGE_FULL_PRICE = 5
534
550
  }
551
+ /**
552
+ * Enum with possible proration modes in a subscription upgrade or downgrade in the Play Store or Galaxy Store. Used only on Android.
553
+ * @public
554
+ */
555
+ export declare enum STORE_REPLACEMENT_MODE {
556
+ /**
557
+ * Old subscription is cancelled, and new subscription takes effect immediately.
558
+ * User is charged for the full price of the new subscription on the old subscription's expiration date.
559
+ *
560
+ * This is the default behavior for the Galaxy and Play stores.
561
+ */
562
+ WITHOUT_PRORATION = "WITHOUT_PRORATION",
563
+ /**
564
+ * Replacement takes effect immediately, and the remaining time will be
565
+ * prorated and credited to the user. This is the current default behavior.
566
+ */
567
+ WITH_TIME_PRORATION = "WITH_TIME_PRORATION",
568
+ /**
569
+ * Replacement takes effect immediately, and the user is charged full price of new plan and is
570
+ * given a full billing cycle of subscription, plus remaining prorated time from the old plan.
571
+ *
572
+ * This mode is not supported by the Galaxy Store. If it is passed to the Galaxy Store, an error will be thrown.
573
+ */
574
+ CHARGE_FULL_PRICE = "CHARGE_FULL_PRICE",
575
+ /**
576
+ * Replacement takes effect immediately, and the billing cycle remains the
577
+ * same. The price for the remaining period will be charged. This option is
578
+ * only available for subscription upgrade.
579
+ */
580
+ CHARGE_PRORATED_PRICE = "CHARGE_PRORATED_PRICE",
581
+ /**
582
+ * Replacement takes effect when the old plan expires, and the new price will be charged at the same time.
583
+ */
584
+ DEFERRED = "DEFERRED"
585
+ }
535
586
  /**
536
587
  * Contains all details associated with a SubscriptionOption
537
588
  * Used only for Google
package/dist/offerings.js CHANGED
@@ -123,7 +123,7 @@ export var PRORATION_MODE;
123
123
  PRORATION_MODE[PRORATION_MODE["UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY"] = 0] = "UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY";
124
124
  /**
125
125
  * Replacement takes effect immediately, and the remaining time will be
126
- * prorated and credited to the user. This is the current default behavior.
126
+ * prorated and credited to the user.
127
127
  */
128
128
  PRORATION_MODE[PRORATION_MODE["IMMEDIATE_WITH_TIME_PRORATION"] = 1] = "IMMEDIATE_WITH_TIME_PRORATION";
129
129
  /**
@@ -135,6 +135,8 @@ export var PRORATION_MODE;
135
135
  /**
136
136
  * Replacement takes effect immediately, and the new price will be charged on
137
137
  * next recurrence time. The billing cycle stays the same.
138
+ *
139
+ * This is the current default behavior.
138
140
  */
139
141
  PRORATION_MODE[PRORATION_MODE["IMMEDIATE_WITHOUT_PRORATION"] = 3] = "IMMEDIATE_WITHOUT_PRORATION";
140
142
  /**
@@ -149,6 +151,42 @@ export var PRORATION_MODE;
149
151
  */
150
152
  PRORATION_MODE[PRORATION_MODE["IMMEDIATE_AND_CHARGE_FULL_PRICE"] = 5] = "IMMEDIATE_AND_CHARGE_FULL_PRICE";
151
153
  })(PRORATION_MODE || (PRORATION_MODE = {}));
154
+ /**
155
+ * Enum with possible proration modes in a subscription upgrade or downgrade in the Play Store or Galaxy Store. Used only on Android.
156
+ * @public
157
+ */
158
+ export var STORE_REPLACEMENT_MODE;
159
+ (function (STORE_REPLACEMENT_MODE) {
160
+ /**
161
+ * Old subscription is cancelled, and new subscription takes effect immediately.
162
+ * User is charged for the full price of the new subscription on the old subscription's expiration date.
163
+ *
164
+ * This is the default behavior for the Galaxy and Play stores.
165
+ */
166
+ STORE_REPLACEMENT_MODE["WITHOUT_PRORATION"] = "WITHOUT_PRORATION";
167
+ /**
168
+ * Replacement takes effect immediately, and the remaining time will be
169
+ * prorated and credited to the user. This is the current default behavior.
170
+ */
171
+ STORE_REPLACEMENT_MODE["WITH_TIME_PRORATION"] = "WITH_TIME_PRORATION";
172
+ /**
173
+ * Replacement takes effect immediately, and the user is charged full price of new plan and is
174
+ * given a full billing cycle of subscription, plus remaining prorated time from the old plan.
175
+ *
176
+ * This mode is not supported by the Galaxy Store. If it is passed to the Galaxy Store, an error will be thrown.
177
+ */
178
+ STORE_REPLACEMENT_MODE["CHARGE_FULL_PRICE"] = "CHARGE_FULL_PRICE";
179
+ /**
180
+ * Replacement takes effect immediately, and the billing cycle remains the
181
+ * same. The price for the remaining period will be charged. This option is
182
+ * only available for subscription upgrade.
183
+ */
184
+ STORE_REPLACEMENT_MODE["CHARGE_PRORATED_PRICE"] = "CHARGE_PRORATED_PRICE";
185
+ /**
186
+ * Replacement takes effect when the old plan expires, and the new price will be charged at the same time.
187
+ */
188
+ STORE_REPLACEMENT_MODE["DEFERRED"] = "DEFERRED";
189
+ })(STORE_REPLACEMENT_MODE || (STORE_REPLACEMENT_MODE = {}));
152
190
  /**
153
191
  * Recurrence mode for a pricing phase
154
192
  * @public
@@ -1,4 +1,4 @@
1
- import { GoogleProductChangeInfo, PurchasesPackage, PurchasesPromotionalOffer, PurchasesStoreProduct, PurchasesWinBackOffer, SubscriptionOption } from "./offerings";
1
+ import { GoogleProductChangeInfo, PurchasesPackage, PurchasesPromotionalOffer, PurchasesStoreProduct, PurchasesWinBackOffer, StoreProductChangeInfo, SubscriptionOption } from "./offerings";
2
2
  /**
3
3
  * Holds parameters to initialize a purchase in our SDK.
4
4
  * @public
@@ -11,8 +11,17 @@ export interface PurchaseParams {
11
11
  /**
12
12
  * Google Play only. Optional {@link GoogleProductChangeInfo} you
13
13
  * wish to upgrade from containing the oldProductIdentifier and the optional prorationMode.
14
+ *
15
+ * If both googleProductChangeInfo and productChangeInfo are provided, then productChangeInfo is used and googleProductChangeInfo is ignored.
14
16
  */
15
17
  googleProductChangeInfo?: GoogleProductChangeInfo | null;
18
+ /**
19
+ * Google Play and Galaxy Store only. Optional {@link StoreProductChangeInfo} that allows you
20
+ * to make a product change with the oldProductIdentifier and the optional replacementMode.
21
+ *
22
+ * If both googleProductChangeInfo and productChangeInfo are provided, then productChangeInfo is used and googleProductChangeInfo is ignored.
23
+ */
24
+ productChangeInfo?: StoreProductChangeInfo | null;
16
25
  /**
17
26
  * Google Play only. Optional boolean that indicates personalized pricing on products available for purchase in the EU.
18
27
  * For compliance with EU regulations. User will see "This price has been customized for you" in the purchase dialog when true.
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": "18.0.0",
4
+ "version": "18.2.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",