@getsupertab/supertab-js 3.6.1 → 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-BV7L6JlG.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.1/",
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.1",
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-CJra19F1.js");
5499
+ const { captureException: i } = await import("./sentry-Dg1blqxr.js");
5500
5500
  i(o);
5501
5501
  }
5502
5502
  };
@@ -29467,15 +29467,21 @@ const Jj = J2(({ input: o, sendBack: i }) => {
29467
29467
  }), Zj = J2(({ input: o, sendBack: i }) => {
29468
29468
  console.log("🏃 [MakingPurchase] Actor started", { input: o }), (async () => {
29469
29469
  var N;
29470
- 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;
29471
29480
  if (!f.id)
29472
29481
  throw new Error("Offering ID is missing");
29473
29482
  if (!y)
29474
29483
  throw new Error("Site is missing in context");
29475
- const v = {
29476
- title: document.title,
29477
- url: document.URL
29478
- }, C = await s.api.purchase({
29484
+ const C = await s.api.purchase({
29479
29485
  offeringId: f.id,
29480
29486
  currencyCode: (N = p == null ? void 0 : p.currency) == null ? void 0 : N.code,
29481
29487
  metadata: v
@@ -29550,7 +29556,8 @@ const Jj = J2(({ input: o, sendBack: i }) => {
29550
29556
  merchantLogoUrl: o.merchantLogoUrl,
29551
29557
  tab: null,
29552
29558
  offering: null,
29553
- selectedOfferingId: o.selectedOfferingId
29559
+ selectedOfferingId: o.selectedOfferingId,
29560
+ purchaseMetadata: o.purchaseMetadata
29554
29561
  }),
29555
29562
  states: {
29556
29563
  Loading: {
@@ -29641,7 +29648,8 @@ const Jj = J2(({ input: o, sendBack: i }) => {
29641
29648
  supertabClient: o.supertabClient,
29642
29649
  offering: o.offering,
29643
29650
  tab: o.tab,
29644
- site: o.site
29651
+ site: o.site,
29652
+ purchaseMetadata: o.purchaseMetadata
29645
29653
  };
29646
29654
  },
29647
29655
  onError: {
@@ -30353,8 +30361,9 @@ const Jj = J2(({ input: o, sendBack: i }) => {
30353
30361
  retryCounter: 0,
30354
30362
  paymentResult: !1,
30355
30363
  // Reset payment result when starting a new purchase
30356
- errorMessage: void 0
30364
+ errorMessage: void 0,
30357
30365
  // Clear any previous error message
30366
+ purchaseMetadata: o.purchaseMetadata
30358
30367
  }))
30359
30368
  ],
30360
30369
  target: "PreparingPurchase",
@@ -30477,7 +30486,8 @@ const Jj = J2(({ input: o, sendBack: i }) => {
30477
30486
  merchantName: o.merchantName,
30478
30487
  merchantLogoUrl: o.merchantLogoUrl,
30479
30488
  selectedOfferingId: o.selectedOfferingId,
30480
- tab: o.tab
30489
+ tab: o.tab,
30490
+ purchaseMetadata: o.purchaseMetadata
30481
30491
  }),
30482
30492
  onError: [
30483
30493
  {
@@ -63420,7 +63430,7 @@ typeof ActiveXObject == "function" && (typeof global < "u" && global.ActiveXObje
63420
63430
  typeof Z1 != "function" && (Z1 = void 0);
63421
63431
  if (!Z1 && !nS && !E5)
63422
63432
  try {
63423
- import("./browser-ponyfill-Dv9Y3m1D.js").then((o) => o.b).then(function(o) {
63433
+ import("./browser-ponyfill-sGts8M8y.js").then((o) => o.b).then(function(o) {
63424
63434
  Z1 = o.default;
63425
63435
  }).catch(function() {
63426
63436
  });
@@ -63765,32 +63775,39 @@ class cG {
63765
63775
  this.purchaseWidgetActor.send({ type: "logIn" });
63766
63776
  });
63767
63777
  }
63768
- async startPurchase({ offeringId: i } = {}) {
63769
- return new Promise((s) => {
63770
- const { unsubscribe: f } = this.purchaseWidgetActor.subscribe((p) => {
63771
- if (p.matches("Ready")) {
63772
- 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();
63773
63786
  const {
63774
- priorEntitlement: y,
63775
- purchasedOffering: v,
63776
- tab: C,
63777
- purchase: S,
63778
- authStatus: k,
63779
- paymentResult: O,
63780
- errorMessage: T
63781
- } = p.context;
63782
- (S == null ? void 0 : S.status) === Ux.COMPLETED && Su({ event: "state_purchase_completed" }), s({
63783
- priorEntitlement: y,
63784
- purchase: S,
63785
- purchasedOffering: v,
63786
- tab: C,
63787
- paymentResult: O,
63788
- authStatus: k,
63789
- 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
63790
63803
  });
63791
63804
  }
63792
63805
  });
63793
- this.purchaseWidgetActor.send({ type: "startPurchase", offeringId: i });
63806
+ this.purchaseWidgetActor.send({
63807
+ type: "startPurchase",
63808
+ offeringId: i,
63809
+ purchaseMetadata: s
63810
+ });
63794
63811
  });
63795
63812
  }
63796
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-BV7L6JlG.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-BV7L6JlG.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.1",
25
+ "version": "3.7.0",
26
26
  "type": "module",
27
27
  "scripts": {
28
28
  "dev": "vite --config .vite/vite.dev.config.ts",