@suportepos/split-checkout 0.2.7 → 0.2.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 +51 -20
- package/dist/index.umd.js +4 -4
- package/dist/standalone/suportepos-checkout.js +1 -1
- package/dist/types/CheckoutFlow.d.ts +2 -1
- package/dist/types/SplitCardForm.d.ts +2 -1
- package/dist/types/SplitPixForm.d.ts +2 -1
- package/dist/types/lib/CheckoutFlow.d.ts +2 -1
- package/dist/types/lib/SplitCardForm.d.ts +2 -1
- package/dist/types/lib/SplitPixForm.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -21780,9 +21780,10 @@ function SplitCheckoutForm({
|
|
|
21780
21780
|
customer,
|
|
21781
21781
|
installmentsOptions = [1, 2, 3, 6, 10, 12],
|
|
21782
21782
|
onBack,
|
|
21783
|
-
onResponse
|
|
21783
|
+
onResponse,
|
|
21784
|
+
uuid
|
|
21784
21785
|
}) {
|
|
21785
|
-
const apiUrl = production ? "https://api-conciliapos.suportepos.com.br" : "https://api-conciliapos-stag.suportepos.com.br";
|
|
21786
|
+
const apiUrl = production ? "https://api-conciliapos-stag.suportepos.com.br" : "https://api-conciliapos-stag.suportepos.com.br";
|
|
21786
21787
|
const isSm = useMediaQuery("(max-width:900px)");
|
|
21787
21788
|
const [step, setStep] = useState("card");
|
|
21788
21789
|
const maskCard = (v) => v.replace(/\D/g, "").trim();
|
|
@@ -21815,7 +21816,7 @@ function SplitCheckoutForm({
|
|
|
21815
21816
|
useEffect(() => {
|
|
21816
21817
|
const script = document.createElement("script");
|
|
21817
21818
|
if (production) {
|
|
21818
|
-
script.src = "https://
|
|
21819
|
+
script.src = "https://www.pagador.com.br/post/scripts/silentorderpost-1.0.min.js";
|
|
21819
21820
|
} else {
|
|
21820
21821
|
script.src = "https://transactionsandbox.pagador.com.br/post/Scripts/silentorderpost-1.0.min.js";
|
|
21821
21822
|
}
|
|
@@ -21823,9 +21824,9 @@ function SplitCheckoutForm({
|
|
|
21823
21824
|
document.body.appendChild(script);
|
|
21824
21825
|
script.onload = async () => {
|
|
21825
21826
|
try {
|
|
21826
|
-
const res = await fetch(`${apiUrl}/api/token-cartao?
|
|
21827
|
+
const res = await fetch(`${apiUrl}/api/token-cartao?merchantId=${merchantId}&production=${production}`);
|
|
21827
21828
|
const data = await res.json();
|
|
21828
|
-
setAccessToken(data?.
|
|
21829
|
+
setAccessToken(data?.access_token);
|
|
21829
21830
|
} catch (err) {
|
|
21830
21831
|
console.error("Erro ao buscar accessToken:", err);
|
|
21831
21832
|
}
|
|
@@ -21888,7 +21889,7 @@ function SplitCheckoutForm({
|
|
|
21888
21889
|
const rawCep = masked.replace(/\D/g, "");
|
|
21889
21890
|
if (rawCep.length === 8) {
|
|
21890
21891
|
try {
|
|
21891
|
-
const res = await fetch(`${apiUrl}/api/cep/${rawCep}?
|
|
21892
|
+
const res = await fetch(`${apiUrl}/api/cep/${rawCep}?merchantId=${merchantId}`);
|
|
21892
21893
|
const data = await res.json();
|
|
21893
21894
|
if (!data.error) {
|
|
21894
21895
|
setAddress(data.street || "");
|
|
@@ -21907,7 +21908,7 @@ function SplitCheckoutForm({
|
|
|
21907
21908
|
setLoading(true);
|
|
21908
21909
|
const options = {
|
|
21909
21910
|
accessToken,
|
|
21910
|
-
environment: "sandbox",
|
|
21911
|
+
environment: production ? "production" : "sandbox",
|
|
21911
21912
|
language: "PT",
|
|
21912
21913
|
enableBinQuery: false,
|
|
21913
21914
|
enableVerifyCard: false,
|
|
@@ -21919,9 +21920,9 @@ function SplitCheckoutForm({
|
|
|
21919
21920
|
method: "POST",
|
|
21920
21921
|
headers: { "Content-Type": "application/json" },
|
|
21921
21922
|
body: JSON.stringify({
|
|
21922
|
-
|
|
21923
|
+
merchantId,
|
|
21923
21924
|
// ou pegue dinamicamente
|
|
21924
|
-
|
|
21925
|
+
orderId,
|
|
21925
21926
|
paymentToken: response.CardToken ?? response.PaymentToken,
|
|
21926
21927
|
amount,
|
|
21927
21928
|
installments,
|
|
@@ -21937,7 +21938,9 @@ function SplitCheckoutForm({
|
|
|
21937
21938
|
complement,
|
|
21938
21939
|
neighborhood,
|
|
21939
21940
|
city,
|
|
21940
|
-
state: uf
|
|
21941
|
+
state: uf,
|
|
21942
|
+
production,
|
|
21943
|
+
uuid
|
|
21941
21944
|
})
|
|
21942
21945
|
});
|
|
21943
21946
|
const result = await res.json();
|
|
@@ -22254,9 +22257,10 @@ function SplitPixForm({
|
|
|
22254
22257
|
splits,
|
|
22255
22258
|
customer,
|
|
22256
22259
|
onBack,
|
|
22257
|
-
onResponse
|
|
22260
|
+
onResponse,
|
|
22261
|
+
uuid
|
|
22258
22262
|
}) {
|
|
22259
|
-
const apiUrl = production ? "https://api-conciliapos.suportepos.com.br" : "https://api-conciliapos-stag.suportepos.com.br";
|
|
22263
|
+
const apiUrl = production ? "https://api-conciliapos-stag.suportepos.com.br" : "https://api-conciliapos-stag.suportepos.com.br";
|
|
22260
22264
|
const isSm = useMediaQuery("(max-width:900px)");
|
|
22261
22265
|
const [copied, setCopied] = useState(false);
|
|
22262
22266
|
const [buyerName, setBuyerName] = useState(customer?.buyerName ?? "");
|
|
@@ -22296,13 +22300,15 @@ function SplitPixForm({
|
|
|
22296
22300
|
method: "POST",
|
|
22297
22301
|
headers: { "Content-Type": "application/json" },
|
|
22298
22302
|
body: JSON.stringify({
|
|
22299
|
-
|
|
22300
|
-
|
|
22303
|
+
merchantId,
|
|
22304
|
+
orderId,
|
|
22301
22305
|
amount,
|
|
22302
22306
|
buyerName,
|
|
22303
22307
|
docType,
|
|
22304
22308
|
docNumber,
|
|
22305
|
-
splits
|
|
22309
|
+
splits,
|
|
22310
|
+
production,
|
|
22311
|
+
uuid
|
|
22306
22312
|
})
|
|
22307
22313
|
});
|
|
22308
22314
|
const data = await res.json();
|
|
@@ -22315,6 +22321,29 @@ function SplitPixForm({
|
|
|
22315
22321
|
setLoading(false);
|
|
22316
22322
|
}
|
|
22317
22323
|
};
|
|
22324
|
+
const handleCheckPix = async () => {
|
|
22325
|
+
if (!validate()) return;
|
|
22326
|
+
setLoading(true);
|
|
22327
|
+
try {
|
|
22328
|
+
const res = await fetch(apiUrl + "/api/pix/consultar", {
|
|
22329
|
+
method: "POST",
|
|
22330
|
+
headers: { "Content-Type": "application/json" },
|
|
22331
|
+
body: JSON.stringify({
|
|
22332
|
+
merchantId,
|
|
22333
|
+
paymentId: pixData?.paymentId,
|
|
22334
|
+
production
|
|
22335
|
+
})
|
|
22336
|
+
});
|
|
22337
|
+
const result = await res.json();
|
|
22338
|
+
if (result?.success) {
|
|
22339
|
+
onResponse?.(result);
|
|
22340
|
+
}
|
|
22341
|
+
} catch (err) {
|
|
22342
|
+
console.error("Erro ao gerar PIX:", err);
|
|
22343
|
+
} finally {
|
|
22344
|
+
setLoading(false);
|
|
22345
|
+
}
|
|
22346
|
+
};
|
|
22318
22347
|
const copyToClipboard = async () => {
|
|
22319
22348
|
if (!pixData?.copyPasteCode) return;
|
|
22320
22349
|
try {
|
|
@@ -22463,8 +22492,7 @@ function SplitPixForm({
|
|
|
22463
22492
|
Button,
|
|
22464
22493
|
{
|
|
22465
22494
|
variant: "contained",
|
|
22466
|
-
onClick:
|
|
22467
|
-
},
|
|
22495
|
+
onClick: handleCheckPix,
|
|
22468
22496
|
fullWidth: true,
|
|
22469
22497
|
sx: { py: 1.4 },
|
|
22470
22498
|
children: "Já paguei"
|
|
@@ -22493,7 +22521,8 @@ function CheckoutFlow({
|
|
|
22493
22521
|
merchantName = "SUPORTEPOS",
|
|
22494
22522
|
amountOverride,
|
|
22495
22523
|
splits,
|
|
22496
|
-
onResponse
|
|
22524
|
+
onResponse,
|
|
22525
|
+
uuid
|
|
22497
22526
|
}) {
|
|
22498
22527
|
const [step, setStep] = useState("select");
|
|
22499
22528
|
const isSm = useMediaQuery("(max-width:900px)");
|
|
@@ -22640,7 +22669,8 @@ function CheckoutFlow({
|
|
|
22640
22669
|
merchantName,
|
|
22641
22670
|
summaryItems: products,
|
|
22642
22671
|
onBack: () => setStep("select"),
|
|
22643
|
-
onResponse
|
|
22672
|
+
onResponse,
|
|
22673
|
+
uuid
|
|
22644
22674
|
}
|
|
22645
22675
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22646
22676
|
SplitPixForm,
|
|
@@ -22654,7 +22684,8 @@ function CheckoutFlow({
|
|
|
22654
22684
|
merchantName,
|
|
22655
22685
|
summaryItems: products,
|
|
22656
22686
|
onBack: () => setStep("select"),
|
|
22657
|
-
onResponse
|
|
22687
|
+
onResponse,
|
|
22688
|
+
uuid
|
|
22658
22689
|
}
|
|
22659
22690
|
) }) }) });
|
|
22660
22691
|
}
|