@suportepos/split-checkout 0.5.8 → 0.6.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.
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 {
@@ -22481,18 +22514,19 @@ function CheckoutFlowContent({
22481
22514
  merchantId,
22482
22515
  codigoPedido,
22483
22516
  uuid,
22484
- producao,
22517
+ producao = true,
22485
22518
  onResponse,
22486
22519
  paymentEnabled,
22487
22520
  resumo,
22488
22521
  parcelas,
22489
- pagamento
22522
+ pagamento,
22523
+ url
22490
22524
  }) {
22491
22525
  useMediaQuery("(max-width:900px)");
22492
22526
  useTheme();
22493
22527
  const primaryButtons = [];
22494
22528
  const listItems = [];
22495
- const apiUrl = producao ? "https://api-conciliapos.suportepos.com.br" : "https://api-conciliapos-stag.suportepos.com.br";
22529
+ const apiUrl = url ?? (producao ? "https://api-conciliapos.suportepos.com.br" : "https://api-conciliapos-stag.suportepos.com.br");
22496
22530
  if (paymentEnabled?.creditCard) {
22497
22531
  listItems.push(
22498
22532
  /* @__PURE__ */ jsxRuntimeExports.jsxs(ListItemButton, { onClick: () => setStep("card"), sx: {