@payconductor/react 1.0.8 → 1.0.9

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/dist/index.es.js CHANGED
@@ -4,7 +4,7 @@ var C = (e, n, t) => $(e, typeof n != "symbol" ? n + "" : n, t);
4
4
  import { jsx as N, jsxs as q } from "react/jsx-runtime";
5
5
  import { useState as A, useEffect as F, useRef as W } from "react";
6
6
  const H = "https://iframe.payconductor.ai/v1", Y = "http://localhost:5175/v1", J = 3e5, X = "600px";
7
- var Z = /* @__PURE__ */ ((e) => (e.Pix = "Pix", e.CreditCard = "CreditCard", e.DebitCard = "DebitCard", e.BankSlip = "BankSlip", e.Crypto = "Crypto", e.ApplePay = "ApplePay", e.NuPay = "NuPay", e.PicPay = "PicPay", e.AmazonPay = "AmazonPay", e.SepaDebit = "SepaDebit", e.GooglePay = "GooglePay", e))(Z || {}), Q = /* @__PURE__ */ ((e) => (e.Grid = "grid", e.Vertical = "vertical", e.Horizontal = "horizontal", e))(Q || {}), ee = /* @__PURE__ */ ((e) => (e.Succeeded = "succeeded", e.Pending = "pending", e.Failed = "failed", e))(ee || {}), te = /* @__PURE__ */ ((e) => (e.ThreeDsAwaitingChallenge = "ThreeDsAwaitingChallenge", e))(te || {}), ne = /* @__PURE__ */ ((e) => (e.Authenticated = "Authenticated", e.NotAuthenticated = "NotAuthenticated", e.NeedChallenge = "NeedChallenge", e))(ne || {}), ae = /* @__PURE__ */ ((e) => (e.Pending = "Pending", e.Authenticated = "Authenticated", e.Failed = "Failed", e.NotEnrolled = "NotEnrolled", e))(ae || {}), G = /* @__PURE__ */ ((e) => (e.Cpf = "Cpf", e.Cnpj = "Cnpj", e))(G || {}), I = /* @__PURE__ */ ((e) => (e.Asaas = "Asaas", e.Sandbox = "Sandbox", e.SandboxSplit = "SandboxSplit", e.MercadoPago = "MercadoPago", e.NuPay = "NuPay", e.PicPay = "PicPay", e.Woovi = "Woovi", e.EfiBank = "EfiBank", e.BrasPag = "BrasPag", e.PagarMe = "PagarMe", e.BancoDoBrasil = "BancoDoBrasil", e.PagSeguro = "PagSeguro", e.Ebanx = "Ebanx", e.OnlyUp = "OnlyUp", e.Barte = "Barte", e.BarteSplit = "BarteSplit", e.PagSmileA55 = "PagSmileA55", e.Avantti = "Avantti", e.MonsterGateway = "MonsterGateway", e.SAC = "SAC", e))(I || {}), ie = /* @__PURE__ */ ((e) => (e.Visa = "Visa", e.Mastercard = "Mastercard", e.AmericanExpress = "AmericanExpress", e.DinersClub = "DinersClub", e.Discover = "Discover", e.JCB = "JCB", e.UnionPay = "UnionPay", e.Maestro = "Maestro", e.Mir = "Mir", e.Elo = "Elo", e.Hiper = "Hiper", e.Hipercard = "Hipercard", e.Verve = "Verve", e.Unknown = "Unknown", e))(ie || {}), _ = /* @__PURE__ */ ((e) => (e.Production = "Production", e.Sandbox = "Sandbox", e))(_ || {}), re = /* @__PURE__ */ ((e) => (e.USD = "USD", e.EUR = "EUR", e.BRL = "BRL", e.ARS = "ARS", e.CAD = "CAD", e.COP = "COP", e.GBP = "GBP", e.JPY = "JPY", e.MXN = "MXN", e.MZN = "MZN", e.CNY = "CNY", e.SAR = "SAR", e.ETH = "ETH", e.BNB = "BNB", e.BTC = "BTC", e.USDT = "USDT", e.USDC = "USDC", e.DOGE = "DOGE", e.SOL = "SOL", e))(re || {}), oe = /* @__PURE__ */ ((e) => (e.Android = "android", e.IOS = "ios", e.Web = "web", e))(oe || {}), se = /* @__PURE__ */ ((e) => (e.Padding = "padding", e.Radius = "radius", e.Color = "color", e.Background = "background", e.Shadow = "shadow", e))(se || {}), M = /* @__PURE__ */ ((e) => (e.Init = "Init", e.Config = "Config", e.Update = "Update", e.ConfirmPayment = "ConfirmPayment", e.Validate = "Validate", e.Reset = "Reset", e))(M || {}), v = /* @__PURE__ */ ((e) => (e.Ready = "Ready", e.Error = "Error", e.PaymentComplete = "PaymentComplete", e.PaymentFailed = "PaymentFailed", e.PaymentPending = "PaymentPending", e.ValidationError = "ValidationError", e.PaymentMethodSelected = "PaymentMethodSelected", e.Resize = "Resize", e.ThreeDSChallenge = "ThreeDSChallenge", e.ThreeDSComplete = "ThreeDSComplete", e.ThreeDSFailed = "ThreeDSFailed", e))(v || {}), de = /* @__PURE__ */ ((e) => (e.InvalidClient = "InvalidClient", e.InvalidToken = "InvalidToken", e.NetworkError = "NetworkError", e.IframeNotReady = "IframeNotReady", e.PaymentDeclined = "PaymentDeclined", e.ValidationError = "ValidationError", e.Timeout = "Timeout", e))(de || {});
7
+ var Z = /* @__PURE__ */ ((e) => (e.Pix = "Pix", e.CreditCard = "CreditCard", e.DebitCard = "DebitCard", e.BankSlip = "BankSlip", e.Crypto = "Crypto", e.ApplePay = "ApplePay", e.NuPay = "NuPay", e.PicPay = "PicPay", e.AmazonPay = "AmazonPay", e.SepaDebit = "SepaDebit", e.GooglePay = "GooglePay", e))(Z || {}), Q = /* @__PURE__ */ ((e) => (e.Grid = "grid", e.Vertical = "vertical", e.Horizontal = "horizontal", e))(Q || {}), ee = /* @__PURE__ */ ((e) => (e.Succeeded = "succeeded", e.Pending = "pending", e.Failed = "failed", e))(ee || {}), te = /* @__PURE__ */ ((e) => (e.ThreeDsAwaitingChallenge = "ThreeDsAwaitingChallenge", e))(te || {}), ne = /* @__PURE__ */ ((e) => (e.Authenticated = "Authenticated", e.NotAuthenticated = "NotAuthenticated", e.NeedChallenge = "NeedChallenge", e))(ne || {}), ae = /* @__PURE__ */ ((e) => (e.Pending = "Pending", e.Authenticated = "Authenticated", e.Failed = "Failed", e.NotEnrolled = "NotEnrolled", e))(ae || {}), G = /* @__PURE__ */ ((e) => (e.Cpf = "Cpf", e.Cnpj = "Cnpj", e))(G || {}), I = /* @__PURE__ */ ((e) => (e.Asaas = "Asaas", e.Sandbox = "Sandbox", e.SandboxSplit = "SandboxSplit", e.MercadoPago = "MercadoPago", e.NuPay = "NuPay", e.PicPay = "PicPay", e.Woovi = "Woovi", e.EfiBank = "EfiBank", e.BrasPag = "BrasPag", e.PagarMe = "PagarMe", e.BancoDoBrasil = "BancoDoBrasil", e.PagSeguro = "PagSeguro", e.Ebanx = "Ebanx", e.OnlyUp = "OnlyUp", e.Barte = "Barte", e.BarteSplit = "BarteSplit", e.PagSmileA55 = "PagSmileA55", e.Avantti = "Avantti", e.MonsterGateway = "MonsterGateway", e.SAC = "SAC", e))(I || {}), re = /* @__PURE__ */ ((e) => (e.Visa = "Visa", e.Mastercard = "Mastercard", e.AmericanExpress = "AmericanExpress", e.DinersClub = "DinersClub", e.Discover = "Discover", e.JCB = "JCB", e.UnionPay = "UnionPay", e.Maestro = "Maestro", e.Mir = "Mir", e.Elo = "Elo", e.Hiper = "Hiper", e.Hipercard = "Hipercard", e.Verve = "Verve", e.Unknown = "Unknown", e))(re || {}), _ = /* @__PURE__ */ ((e) => (e.Production = "Production", e.Sandbox = "Sandbox", e))(_ || {}), ie = /* @__PURE__ */ ((e) => (e.USD = "USD", e.EUR = "EUR", e.BRL = "BRL", e.ARS = "ARS", e.CAD = "CAD", e.COP = "COP", e.GBP = "GBP", e.JPY = "JPY", e.MXN = "MXN", e.MZN = "MZN", e.CNY = "CNY", e.SAR = "SAR", e.ETH = "ETH", e.BNB = "BNB", e.BTC = "BTC", e.USDT = "USDT", e.USDC = "USDC", e.DOGE = "DOGE", e.SOL = "SOL", e))(ie || {}), oe = /* @__PURE__ */ ((e) => (e.Android = "android", e.IOS = "ios", e.Web = "web", e))(oe || {}), se = /* @__PURE__ */ ((e) => (e.Padding = "padding", e.Radius = "radius", e.Color = "color", e.Background = "background", e.Shadow = "shadow", e))(se || {}), M = /* @__PURE__ */ ((e) => (e.Init = "Init", e.Config = "Config", e.Update = "Update", e.ConfirmPayment = "ConfirmPayment", e.Validate = "Validate", e.Reset = "Reset", e))(M || {}), v = /* @__PURE__ */ ((e) => (e.Ready = "Ready", e.Error = "Error", e.PaymentComplete = "PaymentComplete", e.PaymentFailed = "PaymentFailed", e.PaymentPending = "PaymentPending", e.ValidationError = "ValidationError", e.PaymentMethodSelected = "PaymentMethodSelected", e.Resize = "Resize", e.ThreeDSChallenge = "ThreeDSChallenge", e.ThreeDSComplete = "ThreeDSComplete", e.ThreeDSFailed = "ThreeDSFailed", e))(v || {}), de = /* @__PURE__ */ ((e) => (e.InvalidClient = "InvalidClient", e.InvalidToken = "InvalidToken", e.NetworkError = "NetworkError", e.IframeNotReady = "IframeNotReady", e.PaymentDeclined = "PaymentDeclined", e.ValidationError = "ValidationError", e.Timeout = "Timeout", e))(de || {});
8
8
  const Je = {
9
9
  primaryColor: "#0066ff",
10
10
  secondaryColor: "#5a6b7c",
@@ -110,7 +110,7 @@ function O() {
110
110
  return /* @__PURE__ */ new Map();
111
111
  }
112
112
  function D(e, n, t, a) {
113
- return new Promise((i, o) => {
113
+ return new Promise((r, o) => {
114
114
  if (!e || !("contentWindow" in e)) {
115
115
  o(new Error("Iframe not defined"));
116
116
  return;
@@ -125,7 +125,7 @@ function D(e, n, t, a) {
125
125
  }
126
126
  const d = ye();
127
127
  n.set(d, {
128
- resolve: i,
128
+ resolve: r,
129
129
  reject: o
130
130
  }), e.contentWindow.postMessage({
131
131
  type: t,
@@ -156,7 +156,7 @@ function be(e, n, t) {
156
156
  function pe(e, n, t) {
157
157
  return D(e, n, P.INIT, t);
158
158
  }
159
- function Ce(e, n, t, a, i, o, d, s, r, l, g, w) {
159
+ function Ce(e, n, t, a, r, o, d, s, i, l, g, w) {
160
160
  const h = e.data, {
161
161
  requestId: y,
162
162
  type: m,
@@ -182,7 +182,7 @@ function Ce(e, n, t, a, i, o, d, s, r, l, g, w) {
182
182
  return;
183
183
  }
184
184
  if (m === P.ERROR) {
185
- t((p == null ? void 0 : p.message) || "Unknown error"), i == null || i(new Error(String(p == null ? void 0 : p.message)));
185
+ t((p == null ? void 0 : p.message) || "Unknown error"), r == null || r(new Error(String(p == null ? void 0 : p.message)));
186
186
  return;
187
187
  }
188
188
  if (m === P.PAYMENT_COMPLETE) {
@@ -198,7 +198,7 @@ function Ce(e, n, t, a, i, o, d, s, r, l, g, w) {
198
198
  return;
199
199
  }
200
200
  if (m === P.PAYMENT_METHOD_SELECTED) {
201
- E && typeof E == "object" && "paymentMethod" in E && (r == null || r(E.paymentMethod));
201
+ E && typeof E == "object" && "paymentMethod" in E && (i == null || i(E.paymentMethod));
202
202
  return;
203
203
  }
204
204
  if (m !== P.RESIZE) {
@@ -220,9 +220,9 @@ function Ce(e, n, t, a, i, o, d, s, r, l, g, w) {
220
220
  function Ze(e) {
221
221
  const [n, t] = A(
222
222
  () => !1
223
- ), [a, i] = A(() => null), [o, d] = A(
223
+ ), [a, r] = A(() => null), [o, d] = A(
224
224
  () => ""
225
- ), [s, r] = A(() => null);
225
+ ), [s, i] = A(() => null);
226
226
  return F(() => {
227
227
  const l = (...u) => {
228
228
  e.debug && console.log("[PayConductor]", ...u);
@@ -333,7 +333,7 @@ function Ze(e) {
333
333
  w,
334
334
  (c) => {
335
335
  var f;
336
- i(c), m.error = c, (f = window.PayConductor) != null && f.frame && (window.PayConductor.frame.error = c);
336
+ r(c), m.error = c, (f = window.PayConductor) != null && f.frame && (window.PayConductor.frame.error = c);
337
337
  },
338
338
  () => {
339
339
  var c;
@@ -357,7 +357,7 @@ function Ze(e) {
357
357
  },
358
358
  (c) => {
359
359
  var f;
360
- r(c), window.PayConductor && (window.PayConductor.selectedPaymentMethod = c), (f = e.onPaymentMethodSelected) == null || f.call(e, c);
360
+ i(c), window.PayConductor && (window.PayConductor.selectedPaymentMethod = c), (f = e.onPaymentMethodSelected) == null || f.call(e, c);
361
361
  },
362
362
  () => {
363
363
  var c;
@@ -409,22 +409,22 @@ function Ze(e) {
409
409
  );
410
410
  }
411
411
  function Qe(e) {
412
- const n = W(null), [t, a] = A(() => ""), [i, o] = A(() => !1), [d, s] = A(() => "");
412
+ const n = W(null), [t, a] = A(() => ""), [r, o] = A(() => !1), [d, s] = A(() => "");
413
413
  return F(() => {
414
414
  if (typeof document < "u" && !document.getElementById(z)) {
415
415
  const h = document.createElement("style");
416
416
  h.id = z, h.textContent = he, document.head.appendChild(h);
417
417
  }
418
- const r = (h) => {
418
+ const i = (h) => {
419
419
  h != null && h.frame && (a(h.frame.iframeUrl || ""), o(!0), console.log("init", {
420
420
  PayConductor: window.PayConductor
421
421
  }));
422
422
  }, l = typeof window < "u" ? window.PayConductor : null;
423
423
  if (l)
424
- r(l);
424
+ i(l);
425
425
  else {
426
426
  const h = (y) => {
427
- r(y.detail), window.removeEventListener("payconductor:registered", h);
427
+ i(y.detail), window.removeEventListener("payconductor:registered", h);
428
428
  };
429
429
  window.addEventListener("payconductor:registered", h);
430
430
  }
@@ -457,7 +457,7 @@ function Qe(e) {
457
457
  width: "100%"
458
458
  },
459
459
  children: [
460
- i ? null : /* @__PURE__ */ N(
460
+ r ? null : /* @__PURE__ */ N(
461
461
  "div",
462
462
  {
463
463
  className: "payconductor-skeleton",
@@ -466,7 +466,7 @@ function Qe(e) {
466
466
  }
467
467
  }
468
468
  ),
469
- i && t ? /* @__PURE__ */ N(
469
+ r && t ? /* @__PURE__ */ N(
470
470
  "iframe",
471
471
  {
472
472
  allow: "payment",
@@ -489,15 +489,15 @@ function et(e) {
489
489
  return F(() => {
490
490
  const a = () => {
491
491
  t(!0);
492
- }, i = () => {
492
+ }, r = () => {
493
493
  t(!1);
494
494
  };
495
- return window.addEventListener("payconductor:3ds:show", a), window.addEventListener("payconductor:3ds:hide", i), typeof window < "u" && (window.PayConductor3DS = {
495
+ return window.addEventListener("payconductor:3ds:show", a), window.addEventListener("payconductor:3ds:hide", r), typeof window < "u" && (window.PayConductor3DS = {
496
496
  container: () => document.getElementById("payconductor-3ds-container"),
497
497
  show: a,
498
- hide: i
498
+ hide: r
499
499
  }, window.dispatchEvent(new CustomEvent("payconductor:3ds:registered"))), () => {
500
- window.removeEventListener("payconductor:3ds:show", a), window.removeEventListener("payconductor:3ds:hide", i), window.PayConductor3DS = null;
500
+ window.removeEventListener("payconductor:3ds:show", a), window.removeEventListener("payconductor:3ds:hide", r), window.PayConductor3DS = null;
501
501
  };
502
502
  }, []), /* @__PURE__ */ N(
503
503
  "div",
@@ -550,9 +550,9 @@ function U(e) {
550
550
  }
551
551
  function nt() {
552
552
  const e = () => typeof window < "u" ? window.PayConductor : null, n = (t, a) => {
553
- const i = e();
554
- if (!i) return;
555
- const o = U(i);
553
+ const r = e();
554
+ if (!r) return;
555
+ const o = U(r);
556
556
  o != null && o.contentWindow && o.contentWindow.postMessage({
557
557
  type: t,
558
558
  data: a
@@ -560,8 +560,8 @@ function nt() {
560
560
  };
561
561
  return {
562
562
  init: async (t) => {
563
- const a = U(e()), i = O();
564
- return pe(a || void 0, i, t);
563
+ const a = U(e()), r = O();
564
+ return pe(a || void 0, r, t);
565
565
  },
566
566
  confirmPayment: async (t) => {
567
567
  if (!t.orderId)
@@ -583,8 +583,8 @@ function nt() {
583
583
  return ((t = e()) == null ? void 0 : t.selectedPaymentMethod) ?? null;
584
584
  },
585
585
  updateConfig: (t) => {
586
- var i;
587
- const a = (i = e()) == null ? void 0 : i.config;
586
+ var r;
587
+ const a = (r = e()) == null ? void 0 : r.config;
588
588
  n(P.CONFIG, {
589
589
  publicKey: a == null ? void 0 : a.publicKey,
590
590
  orderId: a == null ? void 0 : a.orderId,
@@ -594,8 +594,8 @@ function nt() {
594
594
  });
595
595
  },
596
596
  updateOrderId: (t) => {
597
- var i;
598
- const a = (i = e()) == null ? void 0 : i.config;
597
+ var r;
598
+ const a = (r = e()) == null ? void 0 : r.config;
599
599
  n(P.CONFIG, {
600
600
  publicKey: a == null ? void 0 : a.publicKey,
601
601
  orderId: t,
@@ -613,10 +613,10 @@ function nt() {
613
613
  return await D(t || void 0, a, P.CONFIRM_PAYMENT, {}), {
614
614
  paymentMethod: void 0
615
615
  };
616
- } catch (i) {
616
+ } catch (r) {
617
617
  return {
618
618
  error: {
619
- message: i instanceof Error ? i.message : "Payment failed",
619
+ message: r instanceof Error ? r.message : "Payment failed",
620
620
  code: "payment_error",
621
621
  type: "payment_error"
622
622
  }
@@ -633,9 +633,9 @@ class R {
633
633
  this.data = n, this.options = t;
634
634
  }
635
635
  fail(n) {
636
- var a, i;
636
+ var a, r;
637
637
  const t = new Error(n);
638
- return (i = (a = this.options).onError) == null || i.call(a, t), {
638
+ return (r = (a = this.options).onError) == null || r.call(a, t), {
639
639
  status: "Failed",
640
640
  error: t
641
641
  };
@@ -707,10 +707,10 @@ class ve extends R {
707
707
  } = this.data;
708
708
  if (!t || !a)
709
709
  return this.fail("Missing threeDsUrl or creq");
710
- const i = this.resolveContainer();
710
+ const r = this.resolveContainer();
711
711
  return new Promise((o) => {
712
712
  var l;
713
- this.iframe = document.createElement("iframe"), this.iframe.name = "payconductor-3ds-challenge", this.iframe.id = "payconductor-3ds-challenge", i.appendChild(this.iframe), this.messageListener = (g) => {
713
+ this.iframe = document.createElement("iframe"), this.iframe.name = "payconductor-3ds-challenge", this.iframe.id = "payconductor-3ds-challenge", r.appendChild(this.iframe), this.messageListener = (g) => {
714
714
  var w, h, y;
715
715
  ((w = g.data) == null ? void 0 : w.status) === "COMPLETE" && (this.cleanup(), (y = (h = this.options).onComplete) == null || y.call(h), o({
716
716
  status: b.Success
@@ -728,8 +728,8 @@ class ve extends R {
728
728
  }
729
729
  const s = d.createElement("form");
730
730
  s.name = "threeDsChallengeForm", s.setAttribute("target", "payconductor-3ds-challenge"), s.setAttribute("method", "post"), s.setAttribute("action", t);
731
- const r = d.createElement("input");
732
- r.setAttribute("type", "hidden"), r.setAttribute("name", "creq"), r.setAttribute("value", a), s.appendChild(r), this.iframe.appendChild(s), s.submit();
731
+ const i = d.createElement("input");
732
+ i.setAttribute("type", "hidden"), i.setAttribute("name", "creq"), i.setAttribute("value", a), s.appendChild(i), this.iframe.appendChild(s), s.submit();
733
733
  });
734
734
  }
735
735
  cleanup() {
@@ -740,14 +740,14 @@ const L = /* @__PURE__ */ new Map();
740
740
  function k(e) {
741
741
  const n = L.get(e);
742
742
  if (n) return n;
743
- const t = new Promise((a, i) => {
743
+ const t = new Promise((a, r) => {
744
744
  if (document.querySelector(`script[src="${e}"]`)) {
745
745
  a();
746
746
  return;
747
747
  }
748
748
  const o = document.createElement("script");
749
749
  o.src = e, o.async = !0, o.onload = () => a(), o.onerror = () => {
750
- L.delete(e), i(new Error(`Failed to load script: ${e}`));
750
+ L.delete(e), r(new Error(`Failed to load script: ${e}`));
751
751
  }, (document.head || document.body).appendChild(o);
752
752
  });
753
753
  return L.set(e, t), t;
@@ -770,16 +770,16 @@ class Ie extends R {
770
770
  } catch {
771
771
  return this.fail("Failed to load 3DS SDK");
772
772
  }
773
- const i = window.KrAuthenticate;
774
- return i ? new Promise((o) => {
773
+ const r = window.KrAuthenticate;
774
+ return r ? new Promise((o) => {
775
775
  this.timeoutId = setTimeout(() => {
776
- var s, r;
777
- this.cleanup(), (r = (s = this.options).onTimeout) == null || r.call(s), o({
776
+ var s, i;
777
+ this.cleanup(), (i = (s = this.options).onTimeout) == null || i.call(s), o({
778
778
  status: b.Timeout
779
779
  });
780
- }, this.options.timeoutMs ?? Me), new i(a).authenticate(t, () => {
781
- var s, r;
782
- this.cleanup(), (r = (s = this.options).onComplete) == null || r.call(s), o({
780
+ }, this.options.timeoutMs ?? Me), new r(a).authenticate(t, () => {
781
+ var s, i;
782
+ this.cleanup(), (i = (s = this.options).onComplete) == null || i.call(s), o({
783
783
  status: b.Success
784
784
  });
785
785
  });
@@ -810,9 +810,9 @@ class Re extends R {
810
810
  } = this.data;
811
811
  if (!t) return this.fail("Missing authToken for PagarMe 3DS");
812
812
  if (!a) return this.fail("Missing card data for PagarMe 3DS");
813
- const i = this.data.environment ?? _.Production;
813
+ const r = this.data.environment ?? _.Production;
814
814
  try {
815
- await k(De[i]);
815
+ await k(De[r]);
816
816
  } catch {
817
817
  return this.fail("Failed to load Stone 3DS SDK");
818
818
  }
@@ -821,8 +821,8 @@ class Re extends R {
821
821
  const d = this.resolveContainer();
822
822
  return this.methodContainer = document.createElement("div"), this.methodContainer.style.display = "none", document.body.appendChild(this.methodContainer), new Promise((s) => {
823
823
  this.timeoutId = setTimeout(() => {
824
- var r, l;
825
- this.cleanup(), (l = (r = this.options).onTimeout) == null || l.call(r), s({
824
+ var i, l;
825
+ this.cleanup(), (l = (i = this.options).onTimeout) == null || l.call(i), s({
826
826
  status: b.Timeout
827
827
  });
828
828
  }, this.options.timeoutMs ?? _e), o.init({
@@ -831,13 +831,13 @@ class Re extends R {
831
831
  challenge_container_element: d,
832
832
  use_default_challenge_iframe_style: !0,
833
833
  challenge_window_size: Ne()
834
- }, this.buildOrderData()).then((r) => {
834
+ }, this.buildOrderData()).then((i) => {
835
835
  var g, w;
836
- if (this.cleanup(), !(r != null && r.length)) {
836
+ if (this.cleanup(), !(i != null && i.length)) {
837
837
  s(this.fail("PagarMe 3DS returned no response"));
838
838
  return;
839
839
  }
840
- const l = r[0];
840
+ const l = i[0];
841
841
  if (l.challenge_canceled) {
842
842
  s(this.fail("3DS challenge canceled by user"));
843
843
  return;
@@ -846,8 +846,8 @@ class Re extends R {
846
846
  status: b.Success,
847
847
  dsTransactionId: l.tds_server_trans_id
848
848
  })) : s(this.fail(`3DS failed with status: ${l.trans_status}`));
849
- }).catch((r) => {
850
- this.cleanup(), s(this.fail(r instanceof Error ? r.message : "PagarMe 3DS failed"));
849
+ }).catch((i) => {
850
+ this.cleanup(), s(this.fail(i instanceof Error ? i.message : "PagarMe 3DS failed"));
851
851
  });
852
852
  });
853
853
  }
@@ -859,7 +859,7 @@ class Re extends R {
859
859
  const {
860
860
  card: t,
861
861
  customer: a,
862
- amount: i,
862
+ amount: r,
863
863
  billingAddress: o
864
864
  } = this.data;
865
865
  return {
@@ -881,7 +881,7 @@ class Re extends R {
881
881
  } : void 0
882
882
  }
883
883
  },
884
- amount: i
884
+ amount: r
885
885
  }],
886
886
  ...a ? {
887
887
  customer: {
@@ -910,14 +910,14 @@ class xe extends R {
910
910
  authToken: n,
911
911
  card: t,
912
912
  customer: a,
913
- amount: i,
913
+ amount: r,
914
914
  currency: o,
915
915
  billingAddress: d
916
916
  } = this.data;
917
917
  if (!n) return this.fail("Missing authToken (session) for PagSeguro 3DS");
918
918
  if (!t) return this.fail("Missing card data for PagSeguro 3DS");
919
919
  if (!a) return this.fail("Missing customer data for PagSeguro 3DS");
920
- if (!i) return this.fail("Missing amount for PagSeguro 3DS");
920
+ if (!r) return this.fail("Missing amount for PagSeguro 3DS");
921
921
  if (!d) return this.fail("Missing billingAddress for PagSeguro 3DS");
922
922
  const s = this.data.environment === _.Sandbox ? "SANDBOX" : "PROD";
923
923
  try {
@@ -925,9 +925,9 @@ class xe extends R {
925
925
  } catch {
926
926
  return this.fail("Failed to load PagSeguro SDK");
927
927
  }
928
- const r = window.PagSeguro;
929
- if (!r) return this.fail("PagSeguro SDK not available");
930
- r.setUp({
928
+ const i = window.PagSeguro;
929
+ if (!i) return this.fail("PagSeguro SDK not available");
930
+ i.setUp({
931
931
  session: n,
932
932
  env: s
933
933
  });
@@ -944,7 +944,7 @@ class xe extends R {
944
944
  }];
945
945
  l.some((m) => m.type === "MOBILE") || (l[0].type = "MOBILE");
946
946
  try {
947
- const m = await r.authenticate3DS({
947
+ const m = await i.authenticate3DS({
948
948
  data: {
949
949
  customer: {
950
950
  name: a.name,
@@ -964,7 +964,7 @@ class xe extends R {
964
964
  }
965
965
  },
966
966
  amount: {
967
- value: i,
967
+ value: r,
968
968
  currency: o ?? "BRL"
969
969
  },
970
970
  billingAddress: {
@@ -1031,11 +1031,11 @@ class Oe {
1031
1031
  a.ok || await this.parseResponseError("Failed to complete native 3DS challenge", a);
1032
1032
  }
1033
1033
  async parseResponseError(n, t) {
1034
- var i, o, d, s;
1034
+ var r, o, d, s;
1035
1035
  let a = "";
1036
1036
  try {
1037
- const r = await t.json();
1038
- r != null && r.message ? a = r.message : (i = r == null ? void 0 : r.error) != null && i.message ? a = r.error : (d = (o = r == null ? void 0 : r.error) == null ? void 0 : o.value) != null && d.message ? a = r.error.value.message : (s = r == null ? void 0 : r.value) != null && s.message ? a = r.value.message : a = JSON.stringify(r);
1037
+ const i = await t.json();
1038
+ i != null && i.message ? a = i.message : (r = i == null ? void 0 : i.error) != null && r.message ? a = i.error : (d = (o = i == null ? void 0 : i.error) == null ? void 0 : o.value) != null && d.message ? a = i.error.value.message : (s = i == null ? void 0 : i.value) != null && s.message ? a = i.value.message : a = JSON.stringify(i);
1039
1039
  } catch {
1040
1040
  }
1041
1041
  throw new Le(a, n);
@@ -1082,11 +1082,11 @@ class Ke {
1082
1082
  status: b.Failed,
1083
1083
  error: new Error(`Unsupported 3DS provider: ${t}`)
1084
1084
  };
1085
- const i = {
1085
+ const r = {
1086
1086
  ...n,
1087
1087
  threeDSecure: this.data
1088
1088
  };
1089
- this.provider = new a(this.data, i);
1089
+ this.provider = new a(this.data, r);
1090
1090
  const o = await this.provider.authenticate();
1091
1091
  return o.status === b.Success && o.dsTransactionId && Fe.includes(t) && this.data.orderId && this.data.publicKey && await new Oe(this.data.publicKey).completeManualChallenge(this.data.orderId, o.dsTransactionId), o;
1092
1092
  }
@@ -1097,13 +1097,13 @@ class Ke {
1097
1097
  function at(e) {
1098
1098
  let n = null;
1099
1099
  return {
1100
- handleChallenge: async (i) => {
1100
+ handleChallenge: async (r) => {
1101
1101
  var s;
1102
- if (!(i.status === "NeedChallenge" || i.statusDetail === "ThreeDsAwaitingChallenge"))
1102
+ if (!(r.status === "NeedChallenge" || r.statusDetail === "ThreeDsAwaitingChallenge"))
1103
1103
  return {
1104
1104
  status: b.Success
1105
1105
  };
1106
- (s = e == null ? void 0 : e.onChallenge) == null || s.call(e), n = new Ke(i);
1106
+ (s = e == null ? void 0 : e.onChallenge) == null || s.call(e), n = new Ke(r);
1107
1107
  const d = await n.authenticate({
1108
1108
  onComplete: e == null ? void 0 : e.onComplete,
1109
1109
  onError: e == null ? void 0 : e.onError,
@@ -1118,7 +1118,7 @@ function at(e) {
1118
1118
  }
1119
1119
  class Be extends Error {
1120
1120
  constructor(n, t) {
1121
- super(n), this.title = t, this.name = "PayConductorTokenizeApiError";
1121
+ super(n), this.title = t, this.name = "PayConductorTokenizerApiError";
1122
1122
  }
1123
1123
  }
1124
1124
  class ze {
@@ -1141,19 +1141,19 @@ class ze {
1141
1141
  return t.ok || await this.parseResponseError("Failed to generate token", t), await t.json();
1142
1142
  }
1143
1143
  async saveTokens(n, t, a) {
1144
- const i = await fetch(`${this.baseUrl}/card-tokenization/save-tokens/${t}/${a}`, {
1144
+ const r = await fetch(`${this.baseUrl}/card-tokenization/save-tokens/${t}/${a}`, {
1145
1145
  method: "POST",
1146
1146
  headers: this.headers,
1147
1147
  body: JSON.stringify(n)
1148
1148
  });
1149
- i.ok || await this.parseResponseError("Failed to save tokens", i);
1149
+ r.ok || await this.parseResponseError("Failed to save tokens", r);
1150
1150
  }
1151
1151
  async parseResponseError(n, t) {
1152
- var i, o, d, s;
1152
+ var r, o, d, s;
1153
1153
  let a = "";
1154
1154
  try {
1155
- const r = await t.json();
1156
- r != null && r.message ? a = r.message : (i = r == null ? void 0 : r.error) != null && i.message ? a = r.error : (d = (o = r == null ? void 0 : r.error) == null ? void 0 : o.value) != null && d.message ? a = r.error.value.message : (s = r == null ? void 0 : r.value) != null && s.message ? a = r.value.message : a = JSON.stringify(r);
1155
+ const i = await t.json();
1156
+ i != null && i.message ? a = i.message : (r = i == null ? void 0 : i.error) != null && r.message ? a = i.error : (d = (o = i == null ? void 0 : i.error) == null ? void 0 : o.value) != null && d.message ? a = i.error.value.message : (s = i == null ? void 0 : i.value) != null && s.message ? a = i.value.message : a = JSON.stringify(i);
1157
1157
  } catch {
1158
1158
  }
1159
1159
  throw new Be(a, n);
@@ -1186,14 +1186,14 @@ class Ye extends He {
1186
1186
  const t = window.MercadoPago;
1187
1187
  if (!t) throw new Error("MercadoPago SDK not available");
1188
1188
  const a = new t(this.input.setting.publicKey), {
1189
- expiration: i,
1189
+ expiration: r,
1190
1190
  cvv: o,
1191
1191
  number: d,
1192
1192
  holderName: s
1193
1193
  } = this.input.card;
1194
1194
  return (await a.createCardToken({
1195
- cardExpirationMonth: String(i.month),
1196
- cardExpirationYear: String(i.year),
1195
+ cardExpirationMonth: String(r.month),
1196
+ cardExpirationYear: String(r.year),
1197
1197
  cardholderName: s,
1198
1198
  cardNumber: d,
1199
1199
  securityCode: o,
@@ -1220,11 +1220,11 @@ class Ve {
1220
1220
  customer: n.customer,
1221
1221
  saveCard: !1
1222
1222
  }), {
1223
- settings: i
1224
- } = await this.api.getSettings(), d = (await Promise.all(i.map(async (s) => {
1225
- const r = Ge[s.key];
1226
- if (!r) return null;
1227
- const l = new r({
1223
+ settings: r
1224
+ } = await this.api.getSettings(), d = (await Promise.all(r.map(async (s) => {
1225
+ const i = Ge[s.key];
1226
+ if (!i) return null;
1227
+ const l = new i({
1228
1228
  ...n,
1229
1229
  setting: s.settings
1230
1230
  });
@@ -1240,21 +1240,21 @@ class Ve {
1240
1240
  const {
1241
1241
  number: t,
1242
1242
  cvv: a,
1243
- expiration: i,
1243
+ expiration: r,
1244
1244
  holderName: o
1245
1245
  } = n.card;
1246
- if (!t || !a || !(i != null && i.month) || !(i != null && i.year) || !o)
1246
+ if (!t || !a || !(r != null && r.month) || !(r != null && r.year) || !o)
1247
1247
  throw new Error("Invalid card data");
1248
1248
  }
1249
1249
  }
1250
- function it(e) {
1250
+ function rt(e) {
1251
1251
  const n = new Ve(e.publicKey);
1252
1252
  return {
1253
1253
  tokenizeCard: async (a) => {
1254
- var i, o;
1254
+ var r, o;
1255
1255
  try {
1256
1256
  const d = await n.tokenizeCard(a);
1257
- return (i = e.onSuccess) == null || i.call(e, d), d;
1257
+ return (r = e.onSuccess) == null || r.call(e, d), d;
1258
1258
  } catch (d) {
1259
1259
  const s = d instanceof Error ? d : new Error("Tokenization failed");
1260
1260
  return (o = e.onError) == null || o.call(e, s), null;
@@ -1264,8 +1264,8 @@ function it(e) {
1264
1264
  }
1265
1265
  export {
1266
1266
  ue as ALLOWED_ORIGINS,
1267
- ie as CardBrand,
1268
- re as CurrencyType,
1267
+ re as CardBrand,
1268
+ ie as CurrencyType,
1269
1269
  oe as DeviceType,
1270
1270
  G as DocumentType,
1271
1271
  Xe as ERROR_CODES,
@@ -1282,7 +1282,7 @@ export {
1282
1282
  Ke as PayConductor3DSSDK,
1283
1283
  Qe as PayConductorCheckoutElement,
1284
1284
  et as PayConductorThreeDSElement,
1285
- Ve as PayConductorTokenizeSDK,
1285
+ Ve as PayConductorTokenizerSDK,
1286
1286
  Z as PaymentMethod,
1287
1287
  Q as PaymentMethodLayout,
1288
1288
  ee as PaymentStatus,
@@ -1301,6 +1301,6 @@ export {
1301
1301
  tt as usePayConductor,
1302
1302
  nt as usePayconductorElement,
1303
1303
  at as useThreeDS,
1304
- it as useTokenize
1304
+ rt as useTokenizer
1305
1305
  };
1306
1306
  //# sourceMappingURL=index.es.js.map