@revenuecat/purchases-js 1.66.0 → 1.67.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/README.md CHANGED
@@ -47,6 +47,16 @@ pnpm install
47
47
  pnpm run build:dev
48
48
  ```
49
49
 
50
+ For automatic rebuilds of the web entry point during development, run:
51
+
52
+ ```bash
53
+ pnpm run build:dev-watch
54
+ ```
55
+
56
+ `build:dev-watch` is web-only. It preserves the Vega artifacts produced by
57
+ `build:dev`, but does not rebuild them; rerun `pnpm run build:dev` after
58
+ changing code used by the Vega entry point.
59
+
50
60
  To avoid publishing the package you can use pnpm's link feature:
51
61
 
52
62
  1. In the purchases-js directory, register the package:
@@ -155,7 +165,7 @@ Please check the Demo app readme [here](./examples/webbilling-demo/README.md#e2e
155
165
  pnpm run extract-api
156
166
  ```
157
167
 
158
- This will update the files in `api-report` with the latest public API.
168
+ This will update the files in `api-report` and `vega/api-report` with the latest public API for both packages.
159
169
  If it has uncommitted changes, CI tests will fail. Run this command and commit the changes if
160
170
  they are expected.
161
171
 
@@ -51,6 +51,8 @@ declare enum BackendErrorCode {
51
51
  BackendGatewaySetupErrorInvalidTaxOriginAddressDuringCheckout = 8174
52
52
  }
53
53
 
54
+ /* Excluded from this release type: BillingWrapper */
55
+
54
56
  /**
55
57
  * @public
56
58
  * `BrandingAppearance` defines the appearance settings
@@ -179,6 +181,15 @@ export { CustomVariableValue }
179
181
 
180
182
  /* Excluded from this release type: DiscountPhase */
181
183
 
184
+ declare interface DiscountResponse extends PriceResponse {
185
+ name: string | null;
186
+ duration_mode: "one_time" | "time_window" | "forever";
187
+ time_window: string | null;
188
+ discount_type: "percentage" | "fixed_amount";
189
+ percentage?: number | null;
190
+ fixed_amount_micros?: number | null;
191
+ }
192
+
182
193
  declare type EmptyString = "";
183
194
 
184
195
  /**
@@ -640,6 +651,10 @@ export declare interface NonSubscriptionOption extends PurchaseOption {
640
651
  /* Excluded from this release type: discount */
641
652
  }
642
653
 
654
+ declare interface NonSubscriptionOptionResponse extends PurchaseOptionResponse {
655
+ base_price: PriceResponse;
656
+ }
657
+
643
658
  /**
644
659
  * Information that represents a non-subscription purchase made by a user.
645
660
  * @public
@@ -1251,6 +1266,11 @@ export declare interface Price {
1251
1266
  readonly formattedPrice: string;
1252
1267
  }
1253
1268
 
1269
+ declare interface PriceResponse {
1270
+ amount_micros: number;
1271
+ currency: string;
1272
+ }
1273
+
1254
1274
  /**
1255
1275
  * Represents the price and duration information for a phase of the purchase option.
1256
1276
  * @public
@@ -1291,6 +1311,12 @@ export declare interface PricingPhase {
1291
1311
  readonly pricePerYear: Price | null;
1292
1312
  }
1293
1313
 
1314
+ declare interface PricingPhaseResponse {
1315
+ period_duration: string | null;
1316
+ price: PriceResponse | null;
1317
+ cycle_count: number;
1318
+ }
1319
+
1294
1320
  /**
1295
1321
  * Represents product's listing details.
1296
1322
  * @public
@@ -1391,6 +1417,21 @@ export declare interface Product {
1391
1417
 
1392
1418
  /* Excluded from this release type: ProductChangeResult */
1393
1419
 
1420
+ declare interface ProductResponse {
1421
+ identifier: string;
1422
+ product_type: string;
1423
+ title: string;
1424
+ description: string | null;
1425
+ default_purchase_option_id: string | null;
1426
+ purchase_options: {
1427
+ [key: string]: NonSubscriptionOptionResponse | SubscriptionOptionResponse;
1428
+ };
1429
+ }
1430
+
1431
+ declare interface ProductsResponse {
1432
+ product_details: ProductResponse[];
1433
+ }
1434
+
1394
1435
  /**
1395
1436
  * Possible product types
1396
1437
  * @public
@@ -1478,6 +1519,12 @@ export declare interface PurchaseOption {
1478
1519
  readonly priceId: string;
1479
1520
  }
1480
1521
 
1522
+ declare interface PurchaseOptionResponse {
1523
+ id: string;
1524
+ price_id: string;
1525
+ discount: DiscountResponse | null;
1526
+ }
1527
+
1481
1528
  /**
1482
1529
  * Parameters used to customise the purchase flow when invoking the `.purchase` method.
1483
1530
  * @public
@@ -1586,6 +1633,8 @@ export declare interface PurchaseResult {
1586
1633
  readonly redemptionInfo: RedemptionInfo | null;
1587
1634
  /**
1588
1635
  * The operation session id of the purchase.
1636
+ *
1637
+ * For Amazon Store purchases, this will contain the Amazon Store's receipt ID from the purchase.
1589
1638
  */
1590
1639
  readonly operationSessionId: string;
1591
1640
  /**
@@ -1621,6 +1670,7 @@ export declare class Purchases {
1621
1670
  /* Excluded from this release type: eventsTracker */
1622
1671
  /* Excluded from this release type: _platformInfo */
1623
1672
  /* Excluded from this release type: inMemoryCache */
1673
+ /* Excluded from this release type: billingWrapper */
1624
1674
  /* Excluded from this release type: offeringsRequests */
1625
1675
  /* Excluded from this release type: cachedCurrentOffering */
1626
1676
  /* Excluded from this release type: customWebCheckoutEnabled */
@@ -1693,6 +1743,9 @@ export declare class Purchases {
1693
1743
  /* Excluded from this release type: __constructor */
1694
1744
  /**
1695
1745
  * Renders an RC Paywall and allows the user to purchase from it using Web Billing.
1746
+ *
1747
+ * Unsupported for Amazon apps.
1748
+ *
1696
1749
  * @param paywallParams - The parameters object to customise the paywall render. Check {@link PresentPaywallParams}
1697
1750
  * @returns Promise<PurchaseResult>
1698
1751
  */
@@ -1767,6 +1820,9 @@ export declare class Purchases {
1767
1820
  * Renders an Express Purchase button for the supported wallets (Apple Pay/Google Pay).
1768
1821
  * When clicked it uses the wallet UI to execute the purchase instead of
1769
1822
  * the checkout flow that would be shown with `.purchase`.
1823
+ *
1824
+ * Unsupported for Amazon apps.
1825
+ *
1770
1826
  * @param params - The parameters object to customise the purchase flow. Check {@link PresentExpressPurchaseButtonParams}
1771
1827
  * @returns Promise<PurchaseResult>
1772
1828
  */
@@ -1908,6 +1964,7 @@ export declare class Purchases {
1908
1964
  static generateRevenueCatAnonymousAppUserId(): string;
1909
1965
  /* Excluded from this release type: _trackEvent */
1910
1966
  /* Excluded from this release type: _flushAllEvents */
1967
+ /* Excluded from this release type: unwrappedBillingWrapper */
1911
1968
  }
1912
1969
 
1913
1970
  /**
@@ -2248,6 +2305,14 @@ export declare class Purchases {
2248
2305
  SingularDeviceId = "$singularDeviceId"
2249
2306
  }
2250
2307
 
2308
+ /**
2309
+ * The result of restoring purchases.
2310
+ * @public
2311
+ */
2312
+ declare interface RestorePurchasesResult {
2313
+ customerInfo: CustomerInfo;
2314
+ }
2315
+
2251
2316
  declare type SDKEventContextSource = "sdk" | "wpl" | string;
2252
2317
 
2253
2318
  /**
@@ -2407,6 +2472,20 @@ export declare class Purchases {
2407
2472
  /* Excluded from this release type: discount */
2408
2473
  }
2409
2474
 
2475
+ declare interface SubscriptionOptionResponse extends PurchaseOptionResponse {
2476
+ base: PricingPhaseResponse | null;
2477
+ trial: PricingPhaseResponse | null;
2478
+ intro_price: PricingPhaseResponse | null;
2479
+ }
2480
+
2481
+ /**
2482
+ * The result of syncing purchases.
2483
+ * @public
2484
+ */
2485
+ declare interface SyncPurchasesResult {
2486
+ customerInfo: CustomerInfo;
2487
+ }
2488
+
2410
2489
  /**
2411
2490
  * Contains information about the targeting context used to obtain an object.
2412
2491
  * @public