@getsupertab/supertab-js 3.20.6 → 3.21.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
@@ -22,17 +22,17 @@ const supertab = new Supertab({
22
22
  clientId: "client.xyz",
23
23
  });
24
24
 
25
- const { show } = supertab.createPaygate({
25
+ const { show } = supertab.createPaywall({
26
26
  experienceId: "experience.xyz",
27
27
  });
28
28
 
29
- const paygateResult = await show();
30
- console.log(paygateResult);
29
+ const paywallResult = await show();
30
+ console.log(paywallResult);
31
31
  ```
32
32
 
33
33
  This example creates a new Supertab.js instance using the `new Supertab()` constructor.
34
- Then, the `createPaygate` method is used to create a new paygate.
35
- The `show` function renders the paygate. Finally, once the user has completed or cancelled the purchase,
34
+ Then, the `createPaywall` method is used to create a new paywall.
35
+ The `show` function renders the paywall. Finally, once the user has completed or cancelled the purchase,
36
36
  we print the result data to the browser console.
37
37
 
38
38
  We've put a placeholder client ID and experience ID in this example.
@@ -1,4 +1,4 @@
1
- import { c as R, g as z } from "./supertab-BrPk-nCo.js";
1
+ import { c as R, g as z } from "./supertab-BpwqQ2BB.js";
2
2
  function $(w, d) {
3
3
  for (var b = 0; b < d.length; b++) {
4
4
  const y = d[b];
@@ -1,4 +1,4 @@
1
- import { r as mu, T as gu, P as _u, a as Su, V as yu } from "./supertab-BrPk-nCo.js";
1
+ import { r as mu, T as gu, P as _u, a as Su, V as yu } from "./supertab-BpwqQ2BB.js";
2
2
  const b = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__, q = globalThis, at = "9.40.0";
3
3
  function ht() {
4
4
  return lr(q), q;
@@ -4855,7 +4855,7 @@ const bA = sr({
4855
4855
  VITE_STATIC_REDIRECT_URI: void 0,
4856
4856
  VITE_GTM_CONTAINER_ID: "GTM-NG9GT7FM",
4857
4857
  VITE_SENTRY_DSN: "https://d08f3f301f364ceba6345c393c538faf@o23455.ingest.us.sentry.io/4507736861573120",
4858
- VITE_BASE_URL: "https://js.supertab.co/v3.20.6/",
4858
+ VITE_BASE_URL: "https://js.supertab.co/v3.21.0/",
4859
4859
  VITE_DEMO_CLIENT_ID: void 0,
4860
4860
  VITE_API_BASE_URL: void 0,
4861
4861
  VITE_SSO_BASE_URL: void 0,
@@ -4864,7 +4864,7 @@ const bA = sr({
4864
4864
  VITE_CHECKOUT_URL: void 0,
4865
4865
  TAPPER_ENV: "prod",
4866
4866
  PACKAGE_NAME: "@getsupertab/supertab-js",
4867
- PACKAGE_VERSION: "3.20.6",
4867
+ PACKAGE_VERSION: "3.21.0",
4868
4868
  MONETIZATION_PROVIDER_SCRIPT_URL: void 0
4869
4869
  }), I3 = US === "ctl" || US === "sbx" || US === "stg" ? !0 : US === "prod" && typeof window < "u" && window.location ? new URLSearchParams(window.location.search).has("supertab-enable-logging") : !1, Yt = {
4870
4870
  log: (...o) => {
@@ -5564,7 +5564,7 @@ const rr = /* @__PURE__ */ F_(M), g4 = /* @__PURE__ */ FP({
5564
5564
  default: rr
5565
5565
  }, [M]), IS = async (o) => {
5566
5566
  if (wA) {
5567
- const { captureException: a } = await import("./sentry-D_ec_r5z.js");
5567
+ const { captureException: a } = await import("./sentry-DDv5DYrF.js");
5568
5568
  a(o);
5569
5569
  }
5570
5570
  }, qC = "tabjs";
@@ -64753,7 +64753,7 @@ typeof ActiveXObject == "function" && (typeof global < "u" && global.ActiveXObje
64753
64753
  typeof r0 != "function" && (r0 = void 0);
64754
64754
  if (!r0 && !mk && !z4)
64755
64755
  try {
64756
- import("./browser-ponyfill-Bd1SQoXo.js").then((o) => o.b).then(function(o) {
64756
+ import("./browser-ponyfill-CQNXPqHa.js").then((o) => o.b).then(function(o) {
64757
64757
  r0 = o.default;
64758
64758
  }).catch(function() {
64759
64759
  });
@@ -65655,7 +65655,7 @@ class Tq extends gq {
65655
65655
  supertabConfig: this.supertabConfig
65656
65656
  }), this.api = new yM(this.apiConfig), this.auth = new bM(this.apiConfig), this.checkout = new wM(this.apiConfig);
65657
65657
  }
65658
- async createPaygate({
65658
+ async createPaywall({
65659
65659
  merchantName: s,
65660
65660
  merchantLogoUrl: f,
65661
65661
  language: d,
@@ -65668,7 +65668,7 @@ class Tq extends gq {
65668
65668
  const Te = document.body.style.overflow === "hidden";
65669
65669
  if (W) {
65670
65670
  C === null && !Te && (C = document.body.style.overflow || "", document.body.style.overflow = "hidden", Yt.log(
65671
- "Supertab: Preventing page scrolling while paygate is visible"
65671
+ "Supertab: Preventing page scrolling while paywall is visible"
65672
65672
  ));
65673
65673
  return;
65674
65674
  }
@@ -65682,10 +65682,10 @@ class Tq extends gq {
65682
65682
  onError: (W) => {
65683
65683
  throw IS(W), W;
65684
65684
  },
65685
- errorPrefix: "PaygateError"
65685
+ errorPrefix: "PaywallError"
65686
65686
  }), { containerElement: O, shadowRoot: T, appElement: P } = this.createPaygateContainer(), D = await this.setupStyles(
65687
65687
  T,
65688
- "supertab-paygate"
65688
+ "supertab-paywall"
65689
65689
  );
65690
65690
  let A = null;
65691
65691
  const { purchaseWidgetActor: F } = await _.initialize(), H = (W, ae) => async ({ offeringId: Te }) => {
@@ -65742,7 +65742,7 @@ class Tq extends gq {
65742
65742
  const { priorEntitlement: Te } = F.getSnapshot().context;
65743
65743
  if (Te) {
65744
65744
  Yt.warn(
65745
- "Not showing Paygate because user has an entitlement"
65745
+ "Not showing Paywall because user has an entitlement"
65746
65746
  ), W(
65747
65747
  yy(
65748
65748
  F.getSnapshot().context
@@ -65779,9 +65779,27 @@ class Tq extends gq {
65779
65779
  initialState: ue
65780
65780
  };
65781
65781
  } catch (C) {
65782
- throw Yt.error("PaygateError: Failed to create Paygate:", C), C;
65782
+ throw Yt.error("PaywallError: Failed to create Paywall:", C), C;
65783
65783
  }
65784
65784
  }
65785
+ /**
65786
+ * @deprecated Use createPaywall instead.
65787
+ */
65788
+ async createPaygate({
65789
+ merchantName: s,
65790
+ merchantLogoUrl: f,
65791
+ language: d,
65792
+ experienceId: g,
65793
+ purchaseMetadata: v
65794
+ } = {}) {
65795
+ return this.createPaywall({
65796
+ merchantName: s,
65797
+ merchantLogoUrl: f,
65798
+ language: d,
65799
+ experienceId: g,
65800
+ purchaseMetadata: v
65801
+ });
65802
+ }
65785
65803
  async createPurchaseButton({
65786
65804
  containerElement: s,
65787
65805
  label: f,
@@ -65867,7 +65885,7 @@ class Tq extends gq {
65867
65885
  }
65868
65886
  createPaygateContainer() {
65869
65887
  const s = document.createElement("div");
65870
- s.setAttribute("data-testid", "supertab-paygate-container");
65888
+ s.setAttribute("data-testid", "supertab-paywall-container");
65871
65889
  const f = s.attachShadow({ mode: "open" }), d = document.createElement("div");
65872
65890
  return f.appendChild(d), document.body.appendChild(s), { containerElement: s, shadowRoot: f, appElement: d };
65873
65891
  }
@@ -379,7 +379,12 @@ declare interface Offering {
379
379
  isPayNow: boolean;
380
380
  }
381
381
 
382
- declare interface PaygateExperienceResult {
382
+ /**
383
+ * @deprecated Use PaywallExperienceResult instead.
384
+ */
385
+ declare type PaygateExperienceResult = PaywallExperienceResult;
386
+
387
+ declare interface PaywallExperienceResult {
383
388
  show: () => Promise<ExperienceStateSummary>;
384
389
  logIn: () => Promise<ExperienceStateSummary>;
385
390
  destroy: () => void;
@@ -430,6 +435,16 @@ export declare class Supertab extends SupertabClient {
430
435
  auth: AuthClient;
431
436
  checkout: CheckoutClient;
432
437
  constructor(supertabConfig: SupertabConfig);
438
+ createPaywall({ merchantName, merchantLogoUrl, language, experienceId, purchaseMetadata, }?: {
439
+ merchantName?: string;
440
+ merchantLogoUrl?: string;
441
+ language?: string;
442
+ experienceId?: string;
443
+ purchaseMetadata?: Metadata;
444
+ }): Promise<PaywallExperienceResult>;
445
+ /**
446
+ * @deprecated Use createPaywall instead.
447
+ */
433
448
  createPaygate({ merchantName, merchantLogoUrl, language, experienceId, purchaseMetadata, }?: {
434
449
  merchantName?: string;
435
450
  merchantLogoUrl?: string;
@@ -1,4 +1,4 @@
1
- import { S as e } from "./supertab-BrPk-nCo.js";
1
+ import { S as e } from "./supertab-BpwqQ2BB.js";
2
2
  export {
3
3
  e as Supertab
4
4
  };
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "engines": {
23
23
  "node": ">=22.13.1"
24
24
  },
25
- "version": "3.20.6",
25
+ "version": "3.21.0",
26
26
  "type": "module",
27
27
  "scripts": {
28
28
  "dev": "vite --config .vite/vite.dev.config.ts",