@getsupertab/supertab-js 3.6.0 → 3.7.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.
@@ -1,4 +1,4 @@
1
- import { c as R } from "./sdk-BfgNasCt.js";
1
+ import { c as R } from "./sdk-hiMQ9cBY.js";
2
2
  function V(w, d) {
3
3
  for (var b = 0; b < d.length; b++) {
4
4
  const y = d[b];
@@ -4854,10 +4854,10 @@ const DN = Hr({
4854
4854
  VITE_STATIC_REDIRECT_URI: void 0,
4855
4855
  VITE_GTM_CONTAINER_ID: "GTM-NG9GT7FM",
4856
4856
  VITE_SENTRY_DSN: "https://d08f3f301f364ceba6345c393c538faf@o23455.ingest.us.sentry.io/4507736861573120",
4857
- VITE_BASE_URL: "https://js.supertab.co/v3.6.0/",
4857
+ VITE_BASE_URL: "https://js.supertab.co/v3.7.0/",
4858
4858
  TAPPER_ENV: "prod",
4859
4859
  PACKAGE_NAME: "@getsupertab/supertab-js",
4860
- PACKAGE_VERSION: "3.6.0",
4860
+ PACKAGE_VERSION: "3.7.0",
4861
4861
  MONETIZATION_PROVIDER_SCRIPT_URL: void 0
4862
4862
  });
4863
4863
  function QI(o, i = {}) {
@@ -5496,7 +5496,7 @@ const xr = /* @__PURE__ */ p6(j), N9 = /* @__PURE__ */ XL({
5496
5496
  default: xr
5497
5497
  }, [j]), z1 = async (o) => {
5498
5498
  if (LN) {
5499
- const { captureException: i } = await import("./sentry-x1V_uTsb.js");
5499
+ const { captureException: i } = await import("./sentry-Dg1blqxr.js");
5500
5500
  i(o);
5501
5501
  }
5502
5502
  };
@@ -29455,9 +29455,8 @@ const Jj = J2(({ input: o, sendBack: i }) => {
29455
29455
  } = o;
29456
29456
  console.log("Loading actor started with site in context:", { contextSite: y });
29457
29457
  const C = (await s.api.retrieveCustomer()).tab, S = y || await s.api.retrieveSite();
29458
- if (Su({ event: "state_tab_loaded" }), console.log("Loaded", { tab: C, site: S }), !p)
29459
- throw new Error("Experience is not provided");
29460
- const k = m6(S, p.id), O = await JI({
29458
+ Su({ event: "state_tab_loaded" }), console.log("Loaded", { tab: C, site: S });
29459
+ const k = f ? S.offerings : p ? m6(S, p.id) : S.offerings, O = await JI({
29461
29460
  offerings: k,
29462
29461
  selectedOfferingId: f
29463
29462
  });
@@ -29468,15 +29467,21 @@ const Jj = J2(({ input: o, sendBack: i }) => {
29468
29467
  }), Zj = J2(({ input: o, sendBack: i }) => {
29469
29468
  console.log("🏃 [MakingPurchase] Actor started", { input: o }), (async () => {
29470
29469
  var N;
29471
- const { supertabClient: s, offering: f, tab: p, site: y } = o;
29470
+ const {
29471
+ supertabClient: s,
29472
+ offering: f,
29473
+ tab: p,
29474
+ site: y,
29475
+ purchaseMetadata: v = {
29476
+ title: document.title,
29477
+ url: document.location.href
29478
+ }
29479
+ } = o;
29472
29480
  if (!f.id)
29473
29481
  throw new Error("Offering ID is missing");
29474
29482
  if (!y)
29475
29483
  throw new Error("Site is missing in context");
29476
- const v = {
29477
- title: document.title,
29478
- url: document.URL
29479
- }, C = await s.api.purchase({
29484
+ const C = await s.api.purchase({
29480
29485
  offeringId: f.id,
29481
29486
  currencyCode: (N = p == null ? void 0 : p.currency) == null ? void 0 : N.code,
29482
29487
  metadata: v
@@ -29551,7 +29556,8 @@ const Jj = J2(({ input: o, sendBack: i }) => {
29551
29556
  merchantLogoUrl: o.merchantLogoUrl,
29552
29557
  tab: null,
29553
29558
  offering: null,
29554
- selectedOfferingId: o.selectedOfferingId
29559
+ selectedOfferingId: o.selectedOfferingId,
29560
+ purchaseMetadata: o.purchaseMetadata
29555
29561
  }),
29556
29562
  states: {
29557
29563
  Loading: {
@@ -29642,7 +29648,8 @@ const Jj = J2(({ input: o, sendBack: i }) => {
29642
29648
  supertabClient: o.supertabClient,
29643
29649
  offering: o.offering,
29644
29650
  tab: o.tab,
29645
- site: o.site
29651
+ site: o.site,
29652
+ purchaseMetadata: o.purchaseMetadata
29646
29653
  };
29647
29654
  },
29648
29655
  onError: {
@@ -30354,8 +30361,9 @@ const Jj = J2(({ input: o, sendBack: i }) => {
30354
30361
  retryCounter: 0,
30355
30362
  paymentResult: !1,
30356
30363
  // Reset payment result when starting a new purchase
30357
- errorMessage: void 0
30364
+ errorMessage: void 0,
30358
30365
  // Clear any previous error message
30366
+ purchaseMetadata: o.purchaseMetadata
30359
30367
  }))
30360
30368
  ],
30361
30369
  target: "PreparingPurchase",
@@ -30478,7 +30486,8 @@ const Jj = J2(({ input: o, sendBack: i }) => {
30478
30486
  merchantName: o.merchantName,
30479
30487
  merchantLogoUrl: o.merchantLogoUrl,
30480
30488
  selectedOfferingId: o.selectedOfferingId,
30481
- tab: o.tab
30489
+ tab: o.tab,
30490
+ purchaseMetadata: o.purchaseMetadata
30482
30491
  }),
30483
30492
  onError: [
30484
30493
  {
@@ -63421,7 +63430,7 @@ typeof ActiveXObject == "function" && (typeof global < "u" && global.ActiveXObje
63421
63430
  typeof Z1 != "function" && (Z1 = void 0);
63422
63431
  if (!Z1 && !nS && !E5)
63423
63432
  try {
63424
- import("./browser-ponyfill-DBYK0yUF.js").then((o) => o.b).then(function(o) {
63433
+ import("./browser-ponyfill-sGts8M8y.js").then((o) => o.b).then(function(o) {
63425
63434
  Z1 = o.default;
63426
63435
  }).catch(function() {
63427
63436
  });
@@ -63766,32 +63775,39 @@ class cG {
63766
63775
  this.purchaseWidgetActor.send({ type: "logIn" });
63767
63776
  });
63768
63777
  }
63769
- async startPurchase({ offeringId: i } = {}) {
63770
- return new Promise((s) => {
63771
- const { unsubscribe: f } = this.purchaseWidgetActor.subscribe((p) => {
63772
- if (p.matches("Ready")) {
63773
- f();
63778
+ async startPurchase({
63779
+ offeringId: i,
63780
+ purchaseMetadata: s
63781
+ } = {}) {
63782
+ return new Promise((f) => {
63783
+ const { unsubscribe: p } = this.purchaseWidgetActor.subscribe((y) => {
63784
+ if (y.matches("Ready")) {
63785
+ p();
63774
63786
  const {
63775
- priorEntitlement: y,
63776
- purchasedOffering: v,
63777
- tab: C,
63778
- purchase: S,
63779
- authStatus: k,
63780
- paymentResult: O,
63781
- errorMessage: T
63782
- } = p.context;
63783
- (S == null ? void 0 : S.status) === Ux.COMPLETED && Su({ event: "state_purchase_completed" }), s({
63784
- priorEntitlement: y,
63785
- purchase: S,
63786
- purchasedOffering: v,
63787
- tab: C,
63788
- paymentResult: O,
63789
- authStatus: k,
63790
- errorMessage: T
63787
+ priorEntitlement: v,
63788
+ purchasedOffering: C,
63789
+ tab: S,
63790
+ purchase: k,
63791
+ authStatus: O,
63792
+ paymentResult: T,
63793
+ errorMessage: L
63794
+ } = y.context;
63795
+ (k == null ? void 0 : k.status) === Ux.COMPLETED && Su({ event: "state_purchase_completed" }), f({
63796
+ priorEntitlement: v,
63797
+ purchase: k,
63798
+ purchasedOffering: C,
63799
+ tab: S,
63800
+ paymentResult: T,
63801
+ authStatus: O,
63802
+ errorMessage: L
63791
63803
  });
63792
63804
  }
63793
63805
  });
63794
- this.purchaseWidgetActor.send({ type: "startPurchase", offeringId: i });
63806
+ this.purchaseWidgetActor.send({
63807
+ type: "startPurchase",
63808
+ offeringId: i,
63809
+ purchaseMetadata: s
63810
+ });
63795
63811
  });
63796
63812
  }
63797
63813
  async render() {
@@ -288,9 +288,7 @@ declare enum AuthStatus {
288
288
  }
289
289
 
290
290
  declare type BaseForPurchaseOfferingRequestClientFacing = Omit<PurchaseOfferingRequest, "metadata"> & {
291
- metadata?: {
292
- [key: string]: string | number | boolean | null;
293
- };
291
+ metadata?: Metadata;
294
292
  purchaseIntentId: string;
295
293
  };
296
294
 
@@ -354,6 +352,10 @@ declare type HTTPHeaders = {
354
352
  [key: string]: string;
355
353
  };
356
354
 
355
+ declare interface Metadata {
356
+ [key: string]: string | number | boolean | null;
357
+ }
358
+
357
359
  declare interface Offering {
358
360
  id: string;
359
361
  description: string;
@@ -382,16 +384,14 @@ declare interface Purchase {
382
384
  description: string;
383
385
  price: Price;
384
386
  status: PurchaseStatus;
385
- metadata: unknown;
387
+ metadata: Metadata;
386
388
  entitlementStatus: EntitlementStatus | null;
387
389
  }
388
390
 
389
391
  declare type PurchaseOfferingRequest = {
390
392
  offeringId: string;
391
393
  currencyCode: string;
392
- metadata: {
393
- [key: string]: string | number | boolean | null;
394
- };
394
+ metadata: Metadata;
395
395
  };
396
396
 
397
397
  declare type PurchaseOfferingRequestClientFacing = RequireAtLeastOne<BaseForPurchaseOfferingRequestClientFacing, "offeringId" | "purchaseIntentId">;
@@ -1,4 +1,4 @@
1
- import { S as e } from "./sdk-BfgNasCt.js";
1
+ import { S as e } from "./sdk-hiMQ9cBY.js";
2
2
  export {
3
3
  e as Supertab
4
4
  };
@@ -1,4 +1,4 @@
1
- import { r as nu, T as ru, P as su, a as iu, V as ou } from "./sdk-BfgNasCt.js";
1
+ import { r as nu, T as ru, P as su, a as iu, V as ou } from "./sdk-hiMQ9cBY.js";
2
2
  const w = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__, st = "9.22.0", $ = globalThis;
3
3
  function ft() {
4
4
  return nr($), $;
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "engines": {
23
23
  "node": ">=22.13.1"
24
24
  },
25
- "version": "3.6.0",
25
+ "version": "3.7.0",
26
26
  "type": "module",
27
27
  "scripts": {
28
28
  "dev": "vite --config .vite/vite.dev.config.ts",