@revenuecat/purchases-js 0.15.2 → 0.16.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
@@ -12,11 +12,11 @@ Login @ [app.revenuecat.com](https://app.revenuecat.com)
12
12
 
13
13
  - Connect your Stripe account if you haven't already (More payment gateways are coming soon)
14
14
  - Create a Project (if you haven't already)
15
- - Add a new RCBilling app
15
+ - Add a new Web Billing app
16
16
  - Get the sandbox API key or production API key (depending on the environment)
17
- - Create some products for the RCBilling App
18
- - Create an offering and add packages with RCBilling products
19
- - Create the entitlements you need in your app and link them to the RCBilling products
17
+ - Create some products for the Web Billing App
18
+ - Create an offering and add packages with Web Billing products
19
+ - Create the entitlements you need in your app and link them to the Web Billing products
20
20
 
21
21
  # Installation
22
22
 
@@ -32,7 +32,7 @@ Login @ [app.revenuecat.com](https://app.revenuecat.com)
32
32
 
33
33
  # Usage
34
34
 
35
- See the [RevenueCat docs](https://www.revenuecat.com/docs/web/revenuecat-billing) and the [SDK Reference](https://revenuecat.github.io/purchases-js-docs).
35
+ See the [RevenueCat docs](https://www.revenuecat.com/docs/web/web-billing) and the [SDK Reference](https://revenuecat.github.io/purchases-js-docs).
36
36
 
37
37
  # Development
38
38
 
@@ -110,7 +110,7 @@ npm run lint
110
110
 
111
111
  ## Running E2E tests
112
112
 
113
- Please check the Demo app readme [here](./examples/rcbilling-demo/README.md#e2e-tests)
113
+ Please check the Demo app readme [here](./examples/webbilling-demo/README.md#e2e-tests)
114
114
 
115
115
  ## Update API specs
116
116
 
@@ -27,7 +27,7 @@ export declare interface CustomerInfo {
27
27
  readonly activeSubscriptions: Set<string>;
28
28
  /**
29
29
  * URL to manage the active subscription of the user.
30
- * If this user has an active RC Billing subscription, a link to the management page.
30
+ * If this user has an active Web Billing subscription, a link to the management page.
31
31
  * If this user has an active iOS subscription, this will point to the App Store.
32
32
  * If the user has an active Play Store subscription it will point there.
33
33
  * If there are no active subscriptions it will be null.
@@ -352,8 +352,13 @@ export declare interface Package {
352
352
  readonly identifier: string;
353
353
  /**
354
354
  * The {@link Product} assigned to this package.
355
+ * @deprecated - Use {@link Package.webBillingProduct} instead.
355
356
  */
356
357
  readonly rcBillingProduct: Product;
358
+ /**
359
+ * The {@link Product} assigned to this package.
360
+ */
361
+ readonly webBillingProduct: Product;
357
362
  /**
358
363
  * The type of package.
359
364
  */
@@ -4327,6 +4327,7 @@ const yo = (e) => ({
4327
4327
  return a === null ? null : {
4328
4328
  identifier: r.identifier,
4329
4329
  rcBillingProduct: a,
4330
+ webBillingProduct: a,
4330
4331
  packageType: Pl(r.identifier)
4331
4332
  };
4332
4333
  }, wl = (e, r, t, n) => {
@@ -6356,7 +6357,7 @@ var Vc = /* @__PURE__ */ E("<!> <!>", 1), Hc = /* @__PURE__ */ E("<!> <!> <!> <!
6356
6357
  function Gc(e, r) {
6357
6358
  X(r, !1);
6358
6359
  let t = x(r, "asModal", 8, !0), n = x(r, "customerEmail", 12), a = x(r, "appUserId", 8), o = x(r, "rcPackage", 8), i = x(r, "purchaseOption", 8), s = x(r, "brandingInfo", 8), l = x(r, "onFinished", 8), u = x(r, "onError", 8), c = x(r, "onClose", 8), d = x(r, "purchases", 8), p = x(r, "purchaseOperationHelper", 8), _ = x(r, "selectedLocale", 8, Xe), m = x(r, "defaultLocale", 8, Xe), h = x(r, "customTranslations", 24, () => ({})), P = ye(""), y = ye(null), g = ye(null), v = ye(null);
6359
- const k = o().rcBillingProduct.identifier ?? null, w = o().rcBillingProduct.defaultPurchaseOption, S = i() ? i() : w;
6360
+ const k = o().webBillingProduct.identifier ?? null, w = o().webBillingProduct.defaultPurchaseOption, S = i() ? i() : w;
6360
6361
  let q = ye("present-offer"), V = null;
6361
6362
  const N = [
6362
6363
  "present-offer",
@@ -6368,7 +6369,7 @@ function Gc(e, r) {
6368
6369
  ];
6369
6370
  on(Er, new Ce(h(), _(), m())), Lt(async () => {
6370
6371
  var O;
6371
- if (j(y, o().rcBillingProduct), j(P, Oo((O = s()) == null ? void 0 : O.appearance)), f(q) === "present-offer") {
6372
+ if (j(y, o().webBillingProduct), j(P, Oo((O = s()) == null ? void 0 : O.appearance)), f(q) === "present-offer") {
6372
6373
  n() ? ae() : j(q, "needs-auth-info");
6373
6374
  return;
6374
6375
  }
@@ -6384,7 +6385,7 @@ function Gc(e, r) {
6384
6385
  ne(new le(se.MissingEmailError));
6385
6386
  return;
6386
6387
  }
6387
- p().startPurchase(a(), k, S, n(), o().rcBillingProduct.presentedOfferingContext).then((O) => {
6388
+ p().startPurchase(a(), k, S, n(), o().webBillingProduct.presentedOfferingContext).then((O) => {
6388
6389
  if (O.next_action === "collect_payment_info") {
6389
6390
  j(v, null), j(q, "needs-payment-info"), j(g, O);
6390
6391
  return;
@@ -6799,7 +6800,7 @@ function nd(e) {
6799
6800
  }
6800
6801
  return r;
6801
6802
  }
6802
- const ad = "0.15.2", od = "https://api.revenuecat.com";
6803
+ const ad = "0.16.0", od = "https://api.revenuecat.com";
6803
6804
  var It;
6804
6805
  (function(e) {
6805
6806
  e[e.CONTINUE = 100] = "CONTINUE", e[e.SWITCHING_PROTOCOLS = 101] = "SWITCHING_PROTOCOLS", e[e.PROCESSING = 102] = "PROCESSING", e[e.EARLY_HINTS = 103] = "EARLY_HINTS", e[e.OK = 200] = "OK", e[e.CREATED = 201] = "CREATED", e[e.ACCEPTED = 202] = "ACCEPTED", e[e.NON_AUTHORITATIVE_INFORMATION = 203] = "NON_AUTHORITATIVE_INFORMATION", e[e.NO_CONTENT = 204] = "NO_CONTENT", e[e.RESET_CONTENT = 205] = "RESET_CONTENT", e[e.PARTIAL_CONTENT = 206] = "PARTIAL_CONTENT", e[e.MULTI_STATUS = 207] = "MULTI_STATUS", e[e.MULTIPLE_CHOICES = 300] = "MULTIPLE_CHOICES", e[e.MOVED_PERMANENTLY = 301] = "MOVED_PERMANENTLY", e[e.MOVED_TEMPORARILY = 302] = "MOVED_TEMPORARILY", e[e.SEE_OTHER = 303] = "SEE_OTHER", e[e.NOT_MODIFIED = 304] = "NOT_MODIFIED", e[e.USE_PROXY = 305] = "USE_PROXY", e[e.TEMPORARY_REDIRECT = 307] = "TEMPORARY_REDIRECT", e[e.PERMANENT_REDIRECT = 308] = "PERMANENT_REDIRECT", e[e.BAD_REQUEST = 400] = "BAD_REQUEST", e[e.UNAUTHORIZED = 401] = "UNAUTHORIZED", e[e.PAYMENT_REQUIRED = 402] = "PAYMENT_REQUIRED", e[e.FORBIDDEN = 403] = "FORBIDDEN", e[e.NOT_FOUND = 404] = "NOT_FOUND", e[e.METHOD_NOT_ALLOWED = 405] = "METHOD_NOT_ALLOWED", e[e.NOT_ACCEPTABLE = 406] = "NOT_ACCEPTABLE", e[e.PROXY_AUTHENTICATION_REQUIRED = 407] = "PROXY_AUTHENTICATION_REQUIRED", e[e.REQUEST_TIMEOUT = 408] = "REQUEST_TIMEOUT", e[e.CONFLICT = 409] = "CONFLICT", e[e.GONE = 410] = "GONE", e[e.LENGTH_REQUIRED = 411] = "LENGTH_REQUIRED", e[e.PRECONDITION_FAILED = 412] = "PRECONDITION_FAILED", e[e.REQUEST_TOO_LONG = 413] = "REQUEST_TOO_LONG", e[e.REQUEST_URI_TOO_LONG = 414] = "REQUEST_URI_TOO_LONG", e[e.UNSUPPORTED_MEDIA_TYPE = 415] = "UNSUPPORTED_MEDIA_TYPE", e[e.REQUESTED_RANGE_NOT_SATISFIABLE = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE", e[e.EXPECTATION_FAILED = 417] = "EXPECTATION_FAILED", e[e.IM_A_TEAPOT = 418] = "IM_A_TEAPOT", e[e.INSUFFICIENT_SPACE_ON_RESOURCE = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE", e[e.METHOD_FAILURE = 420] = "METHOD_FAILURE", e[e.MISDIRECTED_REQUEST = 421] = "MISDIRECTED_REQUEST", e[e.UNPROCESSABLE_ENTITY = 422] = "UNPROCESSABLE_ENTITY", e[e.LOCKED = 423] = "LOCKED", e[e.FAILED_DEPENDENCY = 424] = "FAILED_DEPENDENCY", e[e.UPGRADE_REQUIRED = 426] = "UPGRADE_REQUIRED", e[e.PRECONDITION_REQUIRED = 428] = "PRECONDITION_REQUIRED", e[e.TOO_MANY_REQUESTS = 429] = "TOO_MANY_REQUESTS", e[e.REQUEST_HEADER_FIELDS_TOO_LARGE = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE", e[e.UNAVAILABLE_FOR_LEGAL_REASONS = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS", e[e.INTERNAL_SERVER_ERROR = 500] = "INTERNAL_SERVER_ERROR", e[e.NOT_IMPLEMENTED = 501] = "NOT_IMPLEMENTED", e[e.BAD_GATEWAY = 502] = "BAD_GATEWAY", e[e.SERVICE_UNAVAILABLE = 503] = "SERVICE_UNAVAILABLE", e[e.GATEWAY_TIMEOUT = 504] = "GATEWAY_TIMEOUT", e[e.HTTP_VERSION_NOT_SUPPORTED = 505] = "HTTP_VERSION_NOT_SUPPORTED", e[e.INSUFFICIENT_STORAGE = 507] = "INSUFFICIENT_STORAGE", e[e.NETWORK_AUTHENTICATION_REQUIRED = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
@@ -7024,7 +7025,7 @@ function gd(e) {
7024
7025
  if (!/^rcb_[a-zA-Z0-9_.-]+$/.test(e))
7025
7026
  throw new ce(
7026
7027
  he.InvalidCredentialsError,
7027
- "Invalid API key. Use your RevenueCat Billing API key."
7028
+ "Invalid API key. Use your Web Billing API key."
7028
7029
  );
7029
7030
  }
7030
7031
  function yd(e) {
@@ -7070,16 +7071,20 @@ function kd(e, r) {
7070
7071
  }
7071
7072
  return t;
7072
7073
  }
7073
- const zo = (e, r) => ({
7074
- ...e,
7075
- rcBillingProduct: {
7076
- ...e.rcBillingProduct,
7074
+ const zo = (e, r) => {
7075
+ const t = {
7076
+ ...e.webBillingProduct,
7077
7077
  presentedOfferingContext: {
7078
- ...e.rcBillingProduct.presentedOfferingContext,
7078
+ ...e.webBillingProduct.presentedOfferingContext,
7079
7079
  placementIdentifier: r
7080
7080
  }
7081
- }
7082
- }), hr = (e, r) => e == null ? null : zo(e, r), wd = (e, r, t) => {
7081
+ };
7082
+ return {
7083
+ ...e,
7084
+ webBillingProduct: t,
7085
+ rcBillingProduct: t
7086
+ };
7087
+ }, hr = (e, r) => e == null ? null : zo(e, r), wd = (e, r, t) => {
7083
7088
  const n = e.offering_ids_by_placement ?? null;
7084
7089
  if (n == null)
7085
7090
  return null;
@@ -8764,7 +8769,7 @@ function T_(e, r) {
8764
8769
  }
8765
8770
  const A_ = 1000001;
8766
8771
  function F_(e) {
8767
- return e.rcBillingProduct.defaultPurchaseOption;
8772
+ return e.webBillingProduct.defaultPurchaseOption;
8768
8773
  }
8769
8774
  function qa(e, r, t, n = !1) {
8770
8775
  return t.translate(C.PaywallVariablesPricePerPeriod, {
@@ -8868,7 +8873,7 @@ function Ta({
8868
8873
  );
8869
8874
  }
8870
8875
  function M_(e, r) {
8871
- const t = e.availablePackages, n = t.reduce((a, o) => a.rcBillingProduct.currentPrice.amountMicros > o.rcBillingProduct.currentPrice.amountMicros ? a : o);
8876
+ const t = e.availablePackages, n = t.reduce((a, o) => a.webBillingProduct.currentPrice.amountMicros > o.webBillingProduct.currentPrice.amountMicros ? a : o);
8872
8877
  return t.reduce(
8873
8878
  (a, o) => (a[o.identifier] = C_(
8874
8879
  o,
@@ -8879,7 +8884,7 @@ function M_(e, r) {
8879
8884
  );
8880
8885
  }
8881
8886
  function C_(e, r, t) {
8882
- const n = e.rcBillingProduct, a = t.formatPrice(
8887
+ const n = e.webBillingProduct, a = t.formatPrice(
8883
8888
  n.currentPrice.amountMicros,
8884
8889
  n.currentPrice.currency
8885
8890
  ), o = F_(e), i = n.productType, s = {
@@ -8948,7 +8953,7 @@ function C_(e, r, t) {
8948
8953
  noWhitespace: !0,
8949
8954
  short: !0
8950
8955
  }) : void 0;
8951
- const u = n.currentPrice.amountMicros, c = r.rcBillingProduct.currentPrice.amountMicros, d = ((c - u) * 100 / c).toFixed(0);
8956
+ const u = n.currentPrice.amountMicros, c = r.webBillingProduct.currentPrice.amountMicros, d = ((c - u) * 100 / c).toFixed(0);
8952
8957
  s.sub_relative_discount = u === c ? "" : t.translate(
8953
8958
  C.PaywallVariablesSubRelativeDiscount,
8954
8959
  {
@@ -9051,7 +9056,7 @@ const ke = class ke {
9051
9056
  return this._brandingInfo !== null;
9052
9057
  }
9053
9058
  /**
9054
- * Renders an RC Paywall and allows the user to purchase from it using RCBilling.
9059
+ * Renders an RC Paywall and allows the user to purchase from it using Web Billing.
9055
9060
  * @experimental
9056
9061
  * @internal
9057
9062
  * @param paywallParams - The parameters object to customise the paywall render. Check {@link RenderPaywallParams}