@payconductor/react 1.0.10 → 1.0.12
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.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +89 -87
- package/dist/index.es.js.map +1 -1
- package/dist/payconductor/hooks/use-tokenize.d.ts +0 -0
- package/dist/payconductor/iframe/types.d.ts +129 -37
- package/dist/payconductor/three-ds/providers/index.d.ts +1 -1
- package/dist/payconductor/tokenizer/index.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/payconductor/tokenizer/{tokenizer.d.ts → handler.d.ts} +0 -0
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var j = Object.defineProperty;
|
|
2
2
|
var $ = (e, n, t) => n in e ? j(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
-
var
|
|
3
|
+
var p = (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 || {}), 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 || {});
|
|
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.Lyra = "Lyra", 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.Chrome = "chrome", e.Safari = "safari", 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.CheckoutSessionCreated = "CheckoutSessionCreated", 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,
|
|
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 = {
|
|
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",
|
|
78
|
+
}, z = "payconductor-skeleton-style", me = `
|
|
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
|
-
},
|
|
136
|
+
}, he);
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
function Ee(e, n, t) {
|
|
@@ -153,17 +153,17 @@ function Se(e, n) {
|
|
|
153
153
|
function be(e, n, t) {
|
|
154
154
|
return D(e, n, P.CONFIG, t);
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function Ce(e, n, t) {
|
|
157
157
|
return D(e, n, P.INIT, t);
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
const
|
|
159
|
+
function pe(e, n, t, a, r, o, d, s, i, l, g, w) {
|
|
160
|
+
const m = e.data, {
|
|
161
161
|
requestId: y,
|
|
162
|
-
type:
|
|
162
|
+
type: h,
|
|
163
163
|
data: E,
|
|
164
|
-
error:
|
|
165
|
-
} =
|
|
166
|
-
if (
|
|
164
|
+
error: C
|
|
165
|
+
} = m;
|
|
166
|
+
if (h === 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, r, o, d, s, i, l, g, w) {
|
|
|
178
178
|
resolve: T,
|
|
179
179
|
reject: x
|
|
180
180
|
} = n.get(y);
|
|
181
|
-
n.delete(y),
|
|
181
|
+
n.delete(y), C ? x(new Error(String(C.message))) : T(E);
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
|
-
if (
|
|
185
|
-
t((
|
|
184
|
+
if (h === P.ERROR) {
|
|
185
|
+
t((C == null ? void 0 : C.message) || "Unknown error"), r == null || r(new Error(String(C == null ? void 0 : C.message)));
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
|
-
if (
|
|
188
|
+
if (h === P.PAYMENT_COMPLETE) {
|
|
189
189
|
E && typeof E == "object" && "status" in E && (o == null || o(E));
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
if (
|
|
192
|
+
if (h === P.PAYMENT_FAILED) {
|
|
193
193
|
E && typeof E == "object" && "status" in E && (d == null || d(E));
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
|
-
if (
|
|
196
|
+
if (h === P.PAYMENT_PENDING) {
|
|
197
197
|
E && typeof E == "object" && "status" in E && (s == null || s(E));
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
|
-
if (
|
|
200
|
+
if (h === P.PAYMENT_METHOD_SELECTED) {
|
|
201
201
|
E && typeof E == "object" && "paymentMethod" in E && (i == null || i(E.paymentMethod));
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
|
-
if (
|
|
205
|
-
if (
|
|
204
|
+
if (h !== P.RESIZE) {
|
|
205
|
+
if (h === v.ThreeDSChallenge) {
|
|
206
206
|
l == null || l();
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
if (
|
|
209
|
+
if (h === v.ThreeDSComplete) {
|
|
210
210
|
g == null || g();
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
|
-
if (
|
|
213
|
+
if (h === 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
|
|
234
|
+
let m = !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
|
-
},
|
|
253
|
+
}, h = {
|
|
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
|
-
},
|
|
269
|
+
}, C = {
|
|
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:
|
|
298
|
+
frame: h,
|
|
299
299
|
config: E,
|
|
300
|
-
api:
|
|
300
|
+
api: C,
|
|
301
301
|
selectedPaymentMethod: s
|
|
302
302
|
}, l("registered"), window.dispatchEvent(
|
|
303
303
|
new CustomEvent("payconductor:registered", {
|
|
@@ -305,13 +305,13 @@ function Ze(e) {
|
|
|
305
305
|
})
|
|
306
306
|
);
|
|
307
307
|
const T = async () => {
|
|
308
|
-
if (!
|
|
308
|
+
if (!m) {
|
|
309
309
|
const u = y();
|
|
310
310
|
if (!u) {
|
|
311
311
|
l("→ CONFIG skipped: iframe not found");
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
|
-
|
|
314
|
+
m = !0, l("→ CONFIG", {
|
|
315
315
|
theme: e.theme,
|
|
316
316
|
locale: e.locale,
|
|
317
317
|
paymentMethods: e.paymentMethods,
|
|
@@ -328,12 +328,12 @@ function Ze(e) {
|
|
|
328
328
|
}
|
|
329
329
|
}, x = (u) => {
|
|
330
330
|
var S;
|
|
331
|
-
(S = u.data) != null && S.type && l("←", u.data.type, u.data.data ?? ""),
|
|
331
|
+
(S = u.data) != null && S.type && l("←", u.data.type, u.data.data ?? ""), pe(
|
|
332
332
|
u,
|
|
333
333
|
w,
|
|
334
334
|
(c) => {
|
|
335
335
|
var f;
|
|
336
|
-
r(c),
|
|
336
|
+
r(c), h.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(() => ""), [r, o] = A(() => !1), [d, s] = A(() => "");
|
|
413
413
|
return F(() => {
|
|
414
414
|
if (typeof document < "u" && !document.getElementById(z)) {
|
|
415
|
-
const
|
|
416
|
-
|
|
415
|
+
const m = document.createElement("style");
|
|
416
|
+
m.id = z, m.textContent = me, document.head.appendChild(m);
|
|
417
417
|
}
|
|
418
|
-
const i = (
|
|
419
|
-
|
|
418
|
+
const i = (m) => {
|
|
419
|
+
m != null && m.frame && (a(m.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
|
i(l);
|
|
425
425
|
else {
|
|
426
|
-
const
|
|
427
|
-
i(y.detail), window.removeEventListener("payconductor:registered",
|
|
426
|
+
const m = (y) => {
|
|
427
|
+
i(y.detail), window.removeEventListener("payconductor:registered", m);
|
|
428
428
|
};
|
|
429
|
-
window.addEventListener("payconductor:registered",
|
|
429
|
+
window.addEventListener("payconductor:registered", m);
|
|
430
430
|
}
|
|
431
431
|
let g = !1;
|
|
432
|
-
const w = (
|
|
433
|
-
var y,
|
|
434
|
-
if (((y =
|
|
432
|
+
const w = (m) => {
|
|
433
|
+
var y, h, E, C;
|
|
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"), ((C = m.data) == null ? void 0 : C.type) === P.READY && e.height && !g) {
|
|
435
435
|
g = !0;
|
|
436
436
|
const T = document.querySelector(
|
|
437
437
|
".payconductor-element iframe"
|
|
@@ -530,7 +530,7 @@ function tt() {
|
|
|
530
530
|
...t
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function L(e) {
|
|
534
534
|
var n;
|
|
535
535
|
if ((n = e == null ? void 0 : e.frame) != null && n.iframe) {
|
|
536
536
|
const t = e.frame.iframe;
|
|
@@ -552,7 +552,7 @@ function nt() {
|
|
|
552
552
|
const e = () => typeof window < "u" ? window.PayConductor : null, n = (t, a) => {
|
|
553
553
|
const r = e();
|
|
554
554
|
if (!r) return;
|
|
555
|
-
const o =
|
|
555
|
+
const o = L(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 =
|
|
564
|
-
return
|
|
563
|
+
const a = L(e()), r = O();
|
|
564
|
+
return Ce(a || void 0, r, t);
|
|
565
565
|
},
|
|
566
566
|
confirmPayment: async (t) => {
|
|
567
567
|
if (!t.orderId)
|
|
@@ -608,7 +608,7 @@ function nt() {
|
|
|
608
608
|
n(P.UPDATE, t);
|
|
609
609
|
},
|
|
610
610
|
submit: async () => {
|
|
611
|
-
const t =
|
|
611
|
+
const t = L(e()), a = O();
|
|
612
612
|
try {
|
|
613
613
|
return await D(t || void 0, a, P.CONFIRM_PAYMENT, {}), {
|
|
614
614
|
paymentMethod: void 0
|
|
@@ -628,8 +628,8 @@ function nt() {
|
|
|
628
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
|
-
|
|
632
|
-
|
|
631
|
+
p(this, "overlay", null);
|
|
632
|
+
p(this, "modalContent", null);
|
|
633
633
|
this.data = n, this.options = t;
|
|
634
634
|
}
|
|
635
635
|
fail(n) {
|
|
@@ -696,9 +696,9 @@ const Te = 5 * 60 * 1e3;
|
|
|
696
696
|
class ve extends R {
|
|
697
697
|
constructor() {
|
|
698
698
|
super(...arguments);
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
699
|
+
p(this, "iframe", null);
|
|
700
|
+
p(this, "messageListener", null);
|
|
701
|
+
p(this, "timeoutId", null);
|
|
702
702
|
}
|
|
703
703
|
async authenticate() {
|
|
704
704
|
const {
|
|
@@ -711,8 +711,8 @@ 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", r.appendChild(this.iframe), this.messageListener = (g) => {
|
|
714
|
-
var w,
|
|
715
|
-
((w = g.data) == null ? void 0 : w.status) === "COMPLETE" && (this.cleanup(), (y = (
|
|
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
716
|
status: b.Success
|
|
717
717
|
}));
|
|
718
718
|
}, window.addEventListener("message", this.messageListener), this.timeoutId = setTimeout(() => {
|
|
@@ -736,9 +736,9 @@ class ve extends R {
|
|
|
736
736
|
this.timeoutId && (clearTimeout(this.timeoutId), this.timeoutId = null), this.messageListener && (window.removeEventListener("message", this.messageListener), this.messageListener = null), this.iframe && (this.iframe.remove(), this.iframe = null), this.closeModal();
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
|
-
const
|
|
739
|
+
const U = /* @__PURE__ */ new Map();
|
|
740
740
|
function k(e) {
|
|
741
|
-
const n =
|
|
741
|
+
const n = U.get(e);
|
|
742
742
|
if (n) return n;
|
|
743
743
|
const t = new Promise((a, r) => {
|
|
744
744
|
if (document.querySelector(`script[src="${e}"]`)) {
|
|
@@ -747,16 +747,16 @@ function k(e) {
|
|
|
747
747
|
}
|
|
748
748
|
const o = document.createElement("script");
|
|
749
749
|
o.src = e, o.async = !0, o.onload = () => a(), o.onerror = () => {
|
|
750
|
-
|
|
750
|
+
U.delete(e), r(new Error(`Failed to load script: ${e}`));
|
|
751
751
|
}, (document.head || document.body).appendChild(o);
|
|
752
752
|
});
|
|
753
|
-
return
|
|
753
|
+
return U.set(e, t), t;
|
|
754
754
|
}
|
|
755
755
|
const Ae = "https://static.payzen.lat/static/js/authenticate-client/V1.0/kr-authenticate.umd", Me = 10 * 60 * 1e3;
|
|
756
756
|
class Ie extends R {
|
|
757
757
|
constructor() {
|
|
758
758
|
super(...arguments);
|
|
759
|
-
|
|
759
|
+
p(this, "timeoutId", null);
|
|
760
760
|
}
|
|
761
761
|
async authenticate() {
|
|
762
762
|
const {
|
|
@@ -800,8 +800,8 @@ function Ne() {
|
|
|
800
800
|
class Re extends R {
|
|
801
801
|
constructor() {
|
|
802
802
|
super(...arguments);
|
|
803
|
-
|
|
804
|
-
|
|
803
|
+
p(this, "timeoutId", null);
|
|
804
|
+
p(this, "methodContainer", null);
|
|
805
805
|
}
|
|
806
806
|
async authenticate() {
|
|
807
807
|
const {
|
|
@@ -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,
|
|
908
|
+
var w, m, 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((
|
|
935
|
-
country:
|
|
936
|
-
area:
|
|
937
|
-
number:
|
|
938
|
-
type:
|
|
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"
|
|
939
939
|
}))) ?? [{
|
|
940
940
|
country: "55",
|
|
941
941
|
area: "11",
|
|
942
942
|
number: "999999999",
|
|
943
943
|
type: "MOBILE"
|
|
944
944
|
}];
|
|
945
|
-
l.some((
|
|
945
|
+
l.some((h) => h.type === "MOBILE") || (l[0].type = "MOBILE");
|
|
946
946
|
try {
|
|
947
|
-
const
|
|
947
|
+
const h = await i.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
|
|
982
|
+
return h.status === "AUTH_FLOW_COMPLETED" || h.status === "AUTH_NOT_SUPPORTED" ? ((y = (m = this.options).onComplete) == null || y.call(m), {
|
|
983
983
|
status: b.Success,
|
|
984
|
-
dsTransactionId:
|
|
985
|
-
}) :
|
|
984
|
+
dsTransactionId: h.id
|
|
985
|
+
}) : h.status === "CHANGE_PAYMENT_METHOD" ? this.fail("PagSeguro requires a different payment method") : {
|
|
986
986
|
status: b.Success,
|
|
987
|
-
dsTransactionId:
|
|
987
|
+
dsTransactionId: h.id
|
|
988
988
|
};
|
|
989
|
-
} catch (
|
|
990
|
-
return this.fail(
|
|
989
|
+
} catch (h) {
|
|
990
|
+
return this.fail(h instanceof Error ? h.message : "PagSeguro 3DS failed");
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
993
|
cleanup() {
|
|
@@ -1005,13 +1005,15 @@ class xe extends R {
|
|
|
1005
1005
|
}[n.toUpperCase()] ?? n;
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
const
|
|
1008
|
+
const Le = {
|
|
1009
|
+
// Agnostic providers
|
|
1010
|
+
[I.Lyra]: Ie,
|
|
1011
|
+
// Acquirer-specific providers
|
|
1009
1012
|
[I.MercadoPago]: ve,
|
|
1010
|
-
PayConductor: Ie,
|
|
1011
1013
|
[I.PagarMe]: Re,
|
|
1012
1014
|
[I.PagSeguro]: xe
|
|
1013
1015
|
};
|
|
1014
|
-
class
|
|
1016
|
+
class Ue extends Error {
|
|
1015
1017
|
constructor(n, t) {
|
|
1016
1018
|
super(n), this.title = t, this.name = "PayConductorThreeDSApiError";
|
|
1017
1019
|
}
|
|
@@ -1038,7 +1040,7 @@ class Oe {
|
|
|
1038
1040
|
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
1041
|
} catch {
|
|
1040
1042
|
}
|
|
1041
|
-
throw new
|
|
1043
|
+
throw new Ue(a, n);
|
|
1042
1044
|
}
|
|
1043
1045
|
get baseUrl() {
|
|
1044
1046
|
return typeof window < "u" && window.location.href.includes("localhost") ? "http://localhost:3000/api/v1/sdk" : "https://payconductor.ai/api/v1/sdk";
|
|
@@ -1053,8 +1055,8 @@ class Oe {
|
|
|
1053
1055
|
const Fe = [I.PagSeguro];
|
|
1054
1056
|
class Ke {
|
|
1055
1057
|
constructor(n) {
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
+
p(this, "data");
|
|
1059
|
+
p(this, "provider", null);
|
|
1058
1060
|
this.data = n;
|
|
1059
1061
|
}
|
|
1060
1062
|
get needsChallenge() {
|
|
@@ -1076,7 +1078,7 @@ class Ke {
|
|
|
1076
1078
|
status: b.Failed,
|
|
1077
1079
|
error: new Error("Missing 3DS acquirer")
|
|
1078
1080
|
};
|
|
1079
|
-
const a =
|
|
1081
|
+
const a = Le[t];
|
|
1080
1082
|
if (!a)
|
|
1081
1083
|
return {
|
|
1082
1084
|
status: b.Failed,
|
|
@@ -1176,7 +1178,7 @@ class He {
|
|
|
1176
1178
|
class Ye extends He {
|
|
1177
1179
|
constructor() {
|
|
1178
1180
|
super(...arguments);
|
|
1179
|
-
|
|
1181
|
+
p(this, "scriptUrl", "https://sdk.mercadopago.com/js/v2");
|
|
1180
1182
|
}
|
|
1181
1183
|
async tokenize() {
|
|
1182
1184
|
if (!("publicKey" in this.input.setting))
|
|
@@ -1207,7 +1209,7 @@ const Ge = {
|
|
|
1207
1209
|
};
|
|
1208
1210
|
class Ve {
|
|
1209
1211
|
constructor(n) {
|
|
1210
|
-
|
|
1212
|
+
p(this, "api");
|
|
1211
1213
|
this.publicKey = n, this.api = new ze(this.publicKey);
|
|
1212
1214
|
}
|
|
1213
1215
|
async tokenizeCard(n) {
|
|
@@ -1265,6 +1267,7 @@ function rt(e) {
|
|
|
1265
1267
|
export {
|
|
1266
1268
|
ue as ALLOWED_ORIGINS,
|
|
1267
1269
|
re as CardBrand,
|
|
1270
|
+
te as ChargeStatusDetail,
|
|
1268
1271
|
ie as CurrencyType,
|
|
1269
1272
|
oe as DeviceType,
|
|
1270
1273
|
G as DocumentType,
|
|
@@ -1286,10 +1289,9 @@ export {
|
|
|
1286
1289
|
Z as PaymentMethod,
|
|
1287
1290
|
Q as PaymentMethodLayout,
|
|
1288
1291
|
ee as PaymentStatus,
|
|
1289
|
-
|
|
1290
|
-
|
|
1292
|
+
he as REQUEST_TIMEOUT,
|
|
1293
|
+
me as SKELETON_CSS,
|
|
1291
1294
|
z as SKELETON_STYLE_ID,
|
|
1292
|
-
te as StatusDetail,
|
|
1293
1295
|
ae as ThreeDSResultStatus,
|
|
1294
1296
|
ne as ThreeDsAuthenticationStatus,
|
|
1295
1297
|
fe as buildIframeUrl,
|