@suportepos/split-checkout 0.5.8 → 0.5.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
|
@@ -22303,6 +22303,39 @@ function SplitPixForm({
|
|
|
22303
22303
|
setLoading(false);
|
|
22304
22304
|
}
|
|
22305
22305
|
};
|
|
22306
|
+
useEffect(() => {
|
|
22307
|
+
if (!pixData?.payment_id) return;
|
|
22308
|
+
let interval;
|
|
22309
|
+
let timeout2;
|
|
22310
|
+
const checkPix = async () => {
|
|
22311
|
+
try {
|
|
22312
|
+
const res = await fetch(urlApi + "/api/pix/consultar", {
|
|
22313
|
+
method: "POST",
|
|
22314
|
+
headers: { "Content-Type": "application/json" },
|
|
22315
|
+
body: JSON.stringify({
|
|
22316
|
+
merchantId,
|
|
22317
|
+
paymentId: pixData.payment_id,
|
|
22318
|
+
producao
|
|
22319
|
+
})
|
|
22320
|
+
});
|
|
22321
|
+
const result = await res.json();
|
|
22322
|
+
if (result?.sucesso) {
|
|
22323
|
+
if (result?.pago) {
|
|
22324
|
+
clearInterval(interval);
|
|
22325
|
+
clearTimeout(timeout2);
|
|
22326
|
+
onResponse?.(result);
|
|
22327
|
+
}
|
|
22328
|
+
}
|
|
22329
|
+
} catch (err) {
|
|
22330
|
+
console.error("Erro ao consultar PIX:", err);
|
|
22331
|
+
}
|
|
22332
|
+
};
|
|
22333
|
+
interval = setInterval(checkPix, 5e3);
|
|
22334
|
+
return () => {
|
|
22335
|
+
clearInterval(interval);
|
|
22336
|
+
clearTimeout(timeout2);
|
|
22337
|
+
};
|
|
22338
|
+
}, [pixData?.payment_id]);
|
|
22306
22339
|
const copyToClipboard = async () => {
|
|
22307
22340
|
if (!pixData?.codigo_copia_cola) return;
|
|
22308
22341
|
try {
|