@payconductor/react 1.0.5 → 1.0.6

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.Shield = "Shield", e.Hopy = "Hopy", 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 || {}), 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 || {});
8
8
  const Je = {
9
9
  primaryColor: "#0066ff",
10
10
  secondaryColor: "#5a6b7c",
@@ -52,7 +52,7 @@ const Je = {
52
52
  buttonBorderRadius: "8px",
53
53
  transitionDuration: "0.2s",
54
54
  transitionTimingFunction: "ease"
55
- }, ce = typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") && !window.location.search.includes("production"), le = ce ? Y : H, ue = [Y, H], B = X, he = J, P = {
55
+ }, ce = typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") && !window.location.search.includes("production"), le = ce ? Y : H, ue = [Y, H], B = X, me = J, P = {
56
56
  INIT: M.Init,
57
57
  CONFIG: M.Config,
58
58
  UPDATE: M.Update,
@@ -75,7 +75,7 @@ const Je = {
75
75
  PAYMENT_DECLINED: "PaymentDeclined",
76
76
  VALIDATION_ERROR: "ValidationError",
77
77
  TIMEOUT: "Timeout"
78
- }, z = "payconductor-skeleton-style", me = `
78
+ }, z = "payconductor-skeleton-style", he = `
79
79
  @keyframes payconductor-shimmer {
80
80
  0% { background-position: -200% 0; }
81
81
  100% { background-position: 200% 0; }
@@ -133,7 +133,7 @@ function D(e, n, t, a) {
133
133
  requestId: d
134
134
  }, "*"), setTimeout(() => {
135
135
  n != null && n.has(d) && (n.delete(d), o(new Error("Request timeout")));
136
- }, he);
136
+ }, me);
137
137
  });
138
138
  }
139
139
  function Ee(e, n, t) {
@@ -150,20 +150,20 @@ function Pe(e, n, t) {
150
150
  function Se(e, n) {
151
151
  return D(e, n, P.RESET);
152
152
  }
153
- function pe(e, n, t) {
153
+ function be(e, n, t) {
154
154
  return D(e, n, P.CONFIG, t);
155
155
  }
156
- function be(e, n, t) {
156
+ function pe(e, n, t) {
157
157
  return D(e, n, P.INIT, t);
158
158
  }
159
159
  function Ce(e, n, t, a, i, o, d, s, r, l, g, w) {
160
- const m = e.data, {
160
+ const h = e.data, {
161
161
  requestId: y,
162
- type: h,
162
+ type: m,
163
163
  data: E,
164
- error: b
165
- } = m;
166
- if (h === P.READY) {
164
+ error: p
165
+ } = h;
166
+ if (m === P.READY) {
167
167
  if (a == null || a(), y && (n != null && n.has(y))) {
168
168
  const {
169
169
  resolve: T
@@ -178,39 +178,39 @@ function Ce(e, n, t, a, i, o, d, s, r, l, g, w) {
178
178
  resolve: T,
179
179
  reject: x
180
180
  } = n.get(y);
181
- n.delete(y), b ? x(new Error(String(b.message))) : T(E);
181
+ n.delete(y), p ? x(new Error(String(p.message))) : T(E);
182
182
  return;
183
183
  }
184
- if (h === P.ERROR) {
185
- t((b == null ? void 0 : b.message) || "Unknown error"), i == null || i(new Error(String(b == null ? void 0 : b.message)));
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)));
186
186
  return;
187
187
  }
188
- if (h === P.PAYMENT_COMPLETE) {
188
+ if (m === P.PAYMENT_COMPLETE) {
189
189
  E && typeof E == "object" && "status" in E && (o == null || o(E));
190
190
  return;
191
191
  }
192
- if (h === P.PAYMENT_FAILED) {
192
+ if (m === P.PAYMENT_FAILED) {
193
193
  E && typeof E == "object" && "status" in E && (d == null || d(E));
194
194
  return;
195
195
  }
196
- if (h === P.PAYMENT_PENDING) {
196
+ if (m === P.PAYMENT_PENDING) {
197
197
  E && typeof E == "object" && "status" in E && (s == null || s(E));
198
198
  return;
199
199
  }
200
- if (h === P.PAYMENT_METHOD_SELECTED) {
200
+ if (m === P.PAYMENT_METHOD_SELECTED) {
201
201
  E && typeof E == "object" && "paymentMethod" in E && (r == null || r(E.paymentMethod));
202
202
  return;
203
203
  }
204
- if (h !== P.RESIZE) {
205
- if (h === v.ThreeDSChallenge) {
204
+ if (m !== P.RESIZE) {
205
+ if (m === v.ThreeDSChallenge) {
206
206
  l == null || l();
207
207
  return;
208
208
  }
209
- if (h === v.ThreeDSComplete) {
209
+ if (m === v.ThreeDSComplete) {
210
210
  g == null || g();
211
211
  return;
212
212
  }
213
- if (h === v.ThreeDSFailed) {
213
+ if (m === v.ThreeDSFailed) {
214
214
  w == null || w();
215
215
  return;
216
216
  }
@@ -231,7 +231,7 @@ function Ze(e) {
231
231
  });
232
232
  d(g), t(!0);
233
233
  const w = O();
234
- let m = !1;
234
+ let h = !1;
235
235
  l("init", e.publicKey), l("iframeUrl", g);
236
236
  const y = () => {
237
237
  var S, c;
@@ -250,7 +250,7 @@ function Ze(e) {
250
250
  return document.querySelector(
251
251
  ".payconductor-element iframe"
252
252
  ) ?? void 0;
253
- }, h = {
253
+ }, m = {
254
254
  get iframe() {
255
255
  return document.querySelector(
256
256
  ".payconductor-element iframe"
@@ -266,7 +266,7 @@ function Ze(e) {
266
266
  locale: e.locale,
267
267
  paymentMethods: e.paymentMethods,
268
268
  defaultPaymentMethod: e.defaultPaymentMethod
269
- }, b = {
269
+ }, p = {
270
270
  confirmPayment: (u) => {
271
271
  var c;
272
272
  l("→ CONFIRM_PAYMENT", {
@@ -295,9 +295,9 @@ function Ze(e) {
295
295
  getSelectedPaymentMethod: () => s
296
296
  };
297
297
  window.PayConductor = {
298
- frame: h,
298
+ frame: m,
299
299
  config: E,
300
- api: b,
300
+ api: p,
301
301
  selectedPaymentMethod: s
302
302
  }, l("registered"), window.dispatchEvent(
303
303
  new CustomEvent("payconductor:registered", {
@@ -305,19 +305,19 @@ function Ze(e) {
305
305
  })
306
306
  );
307
307
  const T = async () => {
308
- if (!m) {
308
+ if (!h) {
309
309
  const u = y();
310
310
  if (!u) {
311
311
  l("→ CONFIG skipped: iframe not found");
312
312
  return;
313
313
  }
314
- m = !0, l("→ CONFIG", {
314
+ h = !0, l("→ CONFIG", {
315
315
  theme: e.theme,
316
316
  locale: e.locale,
317
317
  paymentMethods: e.paymentMethods,
318
318
  defaultPaymentMethod: e.defaultPaymentMethod,
319
319
  showPaymentButtons: e.showPaymentButtons
320
- }), pe(u, w, {
320
+ }), be(u, w, {
321
321
  theme: e.theme,
322
322
  locale: e.locale,
323
323
  paymentMethods: e.paymentMethods,
@@ -333,7 +333,7 @@ function Ze(e) {
333
333
  w,
334
334
  (c) => {
335
335
  var f;
336
- i(c), h.error = c, (f = window.PayConductor) != null && f.frame && (window.PayConductor.frame.error = c);
336
+ i(c), m.error = c, (f = window.PayConductor) != null && f.frame && (window.PayConductor.frame.error = c);
337
337
  },
338
338
  () => {
339
339
  var c;
@@ -412,26 +412,26 @@ function Qe(e) {
412
412
  const n = W(null), [t, a] = A(() => ""), [i, o] = A(() => !1), [d, s] = A(() => "");
413
413
  return F(() => {
414
414
  if (typeof document < "u" && !document.getElementById(z)) {
415
- const m = document.createElement("style");
416
- m.id = z, m.textContent = me, document.head.appendChild(m);
415
+ const h = document.createElement("style");
416
+ h.id = z, h.textContent = he, document.head.appendChild(h);
417
417
  }
418
- const r = (m) => {
419
- m != null && m.frame && (a(m.frame.iframeUrl || ""), o(!0), console.log("init", {
418
+ const r = (h) => {
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
424
  r(l);
425
425
  else {
426
- const m = (y) => {
427
- r(y.detail), window.removeEventListener("payconductor:registered", m);
426
+ const h = (y) => {
427
+ r(y.detail), window.removeEventListener("payconductor:registered", h);
428
428
  };
429
- window.addEventListener("payconductor:registered", m);
429
+ window.addEventListener("payconductor:registered", h);
430
430
  }
431
431
  let g = !1;
432
- const w = (m) => {
433
- var y, h, E, b;
434
- if (((y = m.data) == null ? void 0 : y.type) === P.RESIZE && ((E = (h = m.data) == null ? void 0 : h.data) != null && E.height) && s(m.data.data.height + "px"), ((b = m.data) == null ? void 0 : b.type) === P.READY && e.height && !g) {
432
+ const w = (h) => {
433
+ var y, m, E, p;
434
+ if (((y = h.data) == null ? void 0 : y.type) === P.RESIZE && ((E = (m = h.data) == null ? void 0 : m.data) != null && E.height) && s(h.data.data.height + "px"), ((p = h.data) == null ? void 0 : p.type) === P.READY && e.height && !g) {
435
435
  g = !0;
436
436
  const T = document.querySelector(
437
437
  ".payconductor-element iframe"
@@ -561,7 +561,7 @@ function nt() {
561
561
  return {
562
562
  init: async (t) => {
563
563
  const a = U(e()), i = O();
564
- return be(a || void 0, i, t);
564
+ return pe(a || void 0, i, t);
565
565
  },
566
566
  confirmPayment: async (t) => {
567
567
  if (!t.orderId)
@@ -625,7 +625,7 @@ function nt() {
625
625
  }
626
626
  };
627
627
  }
628
- var p = /* @__PURE__ */ ((e) => (e.Success = "Success", e.Failed = "Failed", e.Timeout = "Timeout", e))(p || {});
628
+ var b = /* @__PURE__ */ ((e) => (e.Success = "Success", e.Failed = "Failed", e.Timeout = "Timeout", e))(b || {});
629
629
  class R {
630
630
  constructor(n, t) {
631
631
  C(this, "overlay", null);
@@ -711,14 +711,14 @@ class ve extends R {
711
711
  return new Promise((o) => {
712
712
  var l;
713
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) => {
714
- var w, m, y;
715
- ((w = g.data) == null ? void 0 : w.status) === "COMPLETE" && (this.cleanup(), (y = (m = this.options).onComplete) == null || y.call(m), o({
716
- status: p.Success
714
+ var w, h, y;
715
+ ((w = g.data) == null ? void 0 : w.status) === "COMPLETE" && (this.cleanup(), (y = (h = this.options).onComplete) == null || y.call(h), o({
716
+ status: b.Success
717
717
  }));
718
718
  }, window.addEventListener("message", this.messageListener), this.timeoutId = setTimeout(() => {
719
719
  var g, w;
720
720
  this.cleanup(), (w = (g = this.options).onTimeout) == null || w.call(g), o({
721
- status: p.Timeout
721
+ status: b.Timeout
722
722
  });
723
723
  }, this.options.timeoutMs ?? Te);
724
724
  const d = (l = this.iframe.contentWindow) == null ? void 0 : l.document;
@@ -775,12 +775,12 @@ class Ie extends R {
775
775
  this.timeoutId = setTimeout(() => {
776
776
  var s, r;
777
777
  this.cleanup(), (r = (s = this.options).onTimeout) == null || r.call(s), o({
778
- status: p.Timeout
778
+ status: b.Timeout
779
779
  });
780
780
  }, this.options.timeoutMs ?? Me), new i(a).authenticate(t, () => {
781
781
  var s, r;
782
782
  this.cleanup(), (r = (s = this.options).onComplete) == null || r.call(s), o({
783
- status: p.Success
783
+ status: b.Success
784
784
  });
785
785
  });
786
786
  }) : this.fail("KrAuthenticate not available");
@@ -823,7 +823,7 @@ class Re extends R {
823
823
  this.timeoutId = setTimeout(() => {
824
824
  var r, l;
825
825
  this.cleanup(), (l = (r = this.options).onTimeout) == null || l.call(r), s({
826
- status: p.Timeout
826
+ status: b.Timeout
827
827
  });
828
828
  }, this.options.timeoutMs ?? _e), o.init({
829
829
  token: t,
@@ -843,7 +843,7 @@ class Re extends R {
843
843
  return;
844
844
  }
845
845
  l.trans_status === "Y" || l.trans_status === "A" ? ((w = (g = this.options).onComplete) == null || w.call(g), s({
846
- status: p.Success,
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
849
  }).catch((r) => {
@@ -905,7 +905,7 @@ class Re extends R {
905
905
  const ke = "https://assets.pagseguro.com.br/checkout-sdk-js/rc/dist/browser/pagseguro.min";
906
906
  class xe extends R {
907
907
  async authenticate() {
908
- var w, m, y;
908
+ var w, h, y;
909
909
  const {
910
910
  authToken: n,
911
911
  card: t,
@@ -931,20 +931,20 @@ class xe extends R {
931
931
  session: n,
932
932
  env: s
933
933
  });
934
- const l = ((w = a.phones) == null ? void 0 : w.map((h) => ({
935
- country: h.countryCode,
936
- area: h.areaCode,
937
- number: h.number,
938
- type: h.type ?? "MOBILE"
934
+ const l = ((w = a.phones) == null ? void 0 : w.map((m) => ({
935
+ country: m.countryCode,
936
+ area: m.areaCode,
937
+ number: m.number,
938
+ type: m.type ?? "MOBILE"
939
939
  }))) ?? [{
940
940
  country: "55",
941
941
  area: "11",
942
942
  number: "999999999",
943
943
  type: "MOBILE"
944
944
  }];
945
- l.some((h) => h.type === "MOBILE") || (l[0].type = "MOBILE");
945
+ l.some((m) => m.type === "MOBILE") || (l[0].type = "MOBILE");
946
946
  try {
947
- const h = await r.authenticate3DS({
947
+ const m = await r.authenticate3DS({
948
948
  data: {
949
949
  customer: {
950
950
  name: a.name,
@@ -979,15 +979,15 @@ class xe extends R {
979
979
  dataOnly: !1
980
980
  }
981
981
  });
982
- return h.status === "AUTH_FLOW_COMPLETED" || h.status === "AUTH_NOT_SUPPORTED" ? ((y = (m = this.options).onComplete) == null || y.call(m), {
983
- status: p.Success,
984
- dsTransactionId: h.id
985
- }) : h.status === "CHANGE_PAYMENT_METHOD" ? this.fail("PagSeguro requires a different payment method") : {
986
- status: p.Success,
987
- dsTransactionId: h.id
982
+ return m.status === "AUTH_FLOW_COMPLETED" || m.status === "AUTH_NOT_SUPPORTED" ? ((y = (h = this.options).onComplete) == null || y.call(h), {
983
+ status: b.Success,
984
+ dsTransactionId: m.id
985
+ }) : m.status === "CHANGE_PAYMENT_METHOD" ? this.fail("PagSeguro requires a different payment method") : {
986
+ status: b.Success,
987
+ dsTransactionId: m.id
988
988
  };
989
- } catch (h) {
990
- return this.fail(h instanceof Error ? h.message : "PagSeguro 3DS failed");
989
+ } catch (m) {
990
+ return this.fail(m instanceof Error ? m.message : "PagSeguro 3DS failed");
991
991
  }
992
992
  }
993
993
  cleanup() {
@@ -1066,20 +1066,20 @@ class Ke {
1066
1066
  async authenticate(n) {
1067
1067
  if (!this.needsChallenge)
1068
1068
  return {
1069
- status: p.Success
1069
+ status: b.Success
1070
1070
  };
1071
1071
  const {
1072
1072
  acquirer: t
1073
1073
  } = this.data;
1074
1074
  if (!t)
1075
1075
  return {
1076
- status: p.Failed,
1076
+ status: b.Failed,
1077
1077
  error: new Error("Missing 3DS acquirer")
1078
1078
  };
1079
1079
  const a = Ue[t];
1080
1080
  if (!a)
1081
1081
  return {
1082
- status: p.Failed,
1082
+ status: b.Failed,
1083
1083
  error: new Error(`Unsupported 3DS provider: ${t}`)
1084
1084
  };
1085
1085
  const i = {
@@ -1088,7 +1088,7 @@ class Ke {
1088
1088
  };
1089
1089
  this.provider = new a(this.data, i);
1090
1090
  const o = await this.provider.authenticate();
1091
- return o.status === p.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;
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
  }
1093
1093
  destroy() {
1094
1094
  this.provider && (this.provider.cleanup(), this.provider = null);
@@ -1101,7 +1101,7 @@ function at(e) {
1101
1101
  var s;
1102
1102
  if (!(i.status === "NeedChallenge" || i.statusDetail === "ThreeDsAwaitingChallenge"))
1103
1103
  return {
1104
- status: p.Success
1104
+ status: b.Success
1105
1105
  };
1106
1106
  (s = e == null ? void 0 : e.onChallenge) == null || s.call(e), n = new Ke(i);
1107
1107
  const d = await n.authenticate({
@@ -1286,8 +1286,8 @@ export {
1286
1286
  Z as PaymentMethod,
1287
1287
  Q as PaymentMethodLayout,
1288
1288
  ee as PaymentStatus,
1289
- he as REQUEST_TIMEOUT,
1290
- me as SKELETON_CSS,
1289
+ me as REQUEST_TIMEOUT,
1290
+ he as SKELETON_CSS,
1291
1291
  z as SKELETON_STYLE_ID,
1292
1292
  te as StatusDetail,
1293
1293
  ae as ThreeDSResultStatus,