@suportepos/split-checkout 0.3.3 → 0.3.5
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/README.md +218 -218
- package/dist/README.md +218 -218
- package/dist/index.es.js +277 -327
- package/dist/index.umd.js +7 -7
- package/dist/standalone/suportepos-checkout.js +3 -3
- package/dist/types/CheckoutFlow.d.ts +20 -31
- package/dist/types/CheckoutFlowContent.d.ts +1 -1
- package/dist/types/Header.d.ts +1 -0
- package/dist/types/OrderSummary.d.ts +2 -7
- package/dist/types/SplitCardForm.d.ts +8 -8
- package/dist/types/SplitPixForm.d.ts +8 -8
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/CheckoutFlow.d.ts +20 -31
- package/dist/types/lib/CheckoutFlowContent.d.ts +1 -1
- package/dist/types/lib/OrderSummary.d.ts +2 -7
- package/dist/types/lib/SplitCardForm.d.ts +8 -8
- package/dist/types/lib/SplitPixForm.d.ts +8 -8
- package/dist/types/lib/types.d.ts +9 -0
- package/dist/types/standalone.d.ts +8 -7
- package/dist/types/types.d.ts +9 -0
- package/package.json +46 -46
package/dist/index.es.js
CHANGED
|
@@ -7909,82 +7909,6 @@ process.env.NODE_ENV !== "production" ? Box.propTypes = {
|
|
|
7909
7909
|
*/
|
|
7910
7910
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
7911
7911
|
} : void 0;
|
|
7912
|
-
process.env.NODE_ENV !== "production" ? {
|
|
7913
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
7914
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
7915
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
7916
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
7917
|
-
/**
|
|
7918
|
-
* @ignore
|
|
7919
|
-
*/
|
|
7920
|
-
children: PropTypes.node,
|
|
7921
|
-
/**
|
|
7922
|
-
* @ignore
|
|
7923
|
-
*/
|
|
7924
|
-
value: PropTypes.object.isRequired
|
|
7925
|
-
} : void 0;
|
|
7926
|
-
function useDefaultProps(params) {
|
|
7927
|
-
return useDefaultProps$1(params);
|
|
7928
|
-
}
|
|
7929
|
-
const Container = createContainer({
|
|
7930
|
-
createStyledComponent: styled("div", {
|
|
7931
|
-
name: "MuiContainer",
|
|
7932
|
-
slot: "Root",
|
|
7933
|
-
overridesResolver: (props, styles2) => {
|
|
7934
|
-
const {
|
|
7935
|
-
ownerState
|
|
7936
|
-
} = props;
|
|
7937
|
-
return [styles2.root, styles2[`maxWidth${capitalize(String(ownerState.maxWidth))}`], ownerState.fixed && styles2.fixed, ownerState.disableGutters && styles2.disableGutters];
|
|
7938
|
-
}
|
|
7939
|
-
}),
|
|
7940
|
-
useThemeProps: (inProps) => useDefaultProps({
|
|
7941
|
-
props: inProps,
|
|
7942
|
-
name: "MuiContainer"
|
|
7943
|
-
})
|
|
7944
|
-
});
|
|
7945
|
-
process.env.NODE_ENV !== "production" ? Container.propTypes = {
|
|
7946
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
7947
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
7948
|
-
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
7949
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
7950
|
-
/**
|
|
7951
|
-
* @ignore
|
|
7952
|
-
*/
|
|
7953
|
-
children: PropTypes.node,
|
|
7954
|
-
/**
|
|
7955
|
-
* Override or extend the styles applied to the component.
|
|
7956
|
-
*/
|
|
7957
|
-
classes: PropTypes.object,
|
|
7958
|
-
/**
|
|
7959
|
-
* The component used for the root node.
|
|
7960
|
-
* Either a string to use a HTML element or a component.
|
|
7961
|
-
*/
|
|
7962
|
-
component: PropTypes.elementType,
|
|
7963
|
-
/**
|
|
7964
|
-
* If `true`, the left and right padding is removed.
|
|
7965
|
-
* @default false
|
|
7966
|
-
*/
|
|
7967
|
-
disableGutters: PropTypes.bool,
|
|
7968
|
-
/**
|
|
7969
|
-
* Set the max-width to match the min-width of the current breakpoint.
|
|
7970
|
-
* This is useful if you'd prefer to design for a fixed set of sizes
|
|
7971
|
-
* instead of trying to accommodate a fully fluid viewport.
|
|
7972
|
-
* It's fluid by default.
|
|
7973
|
-
* @default false
|
|
7974
|
-
*/
|
|
7975
|
-
fixed: PropTypes.bool,
|
|
7976
|
-
/**
|
|
7977
|
-
* Determine the max-width of the container.
|
|
7978
|
-
* The container width grows with the size of the screen.
|
|
7979
|
-
* Set to `false` to disable `maxWidth`.
|
|
7980
|
-
* @default 'lg'
|
|
7981
|
-
*/
|
|
7982
|
-
maxWidth: PropTypes.oneOfType([PropTypes.oneOf(["xs", "sm", "md", "lg", "xl", false]), PropTypes.string]),
|
|
7983
|
-
/**
|
|
7984
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
7985
|
-
*/
|
|
7986
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
7987
|
-
} : void 0;
|
|
7988
7912
|
function chainPropTypes(propType1, propType2) {
|
|
7989
7913
|
if (process.env.NODE_ENV === "production") {
|
|
7990
7914
|
return () => null;
|
|
@@ -8026,6 +7950,23 @@ function globalCss(styles2) {
|
|
|
8026
7950
|
function internal_createExtendSxProp() {
|
|
8027
7951
|
return extendSxProp$1;
|
|
8028
7952
|
}
|
|
7953
|
+
process.env.NODE_ENV !== "production" ? {
|
|
7954
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
7955
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
7956
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
7957
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
7958
|
+
/**
|
|
7959
|
+
* @ignore
|
|
7960
|
+
*/
|
|
7961
|
+
children: PropTypes.node,
|
|
7962
|
+
/**
|
|
7963
|
+
* @ignore
|
|
7964
|
+
*/
|
|
7965
|
+
value: PropTypes.object.isRequired
|
|
7966
|
+
} : void 0;
|
|
7967
|
+
function useDefaultProps(params) {
|
|
7968
|
+
return useDefaultProps$1(params);
|
|
7969
|
+
}
|
|
8029
7970
|
function getTypeByValue(value) {
|
|
8030
7971
|
const valueType = typeof value;
|
|
8031
7972
|
switch (valueType) {
|
|
@@ -8375,6 +8316,65 @@ process.env.NODE_ENV !== "production" ? CardContent.propTypes = {
|
|
|
8375
8316
|
*/
|
|
8376
8317
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
8377
8318
|
} : void 0;
|
|
8319
|
+
const Container = createContainer({
|
|
8320
|
+
createStyledComponent: styled("div", {
|
|
8321
|
+
name: "MuiContainer",
|
|
8322
|
+
slot: "Root",
|
|
8323
|
+
overridesResolver: (props, styles2) => {
|
|
8324
|
+
const {
|
|
8325
|
+
ownerState
|
|
8326
|
+
} = props;
|
|
8327
|
+
return [styles2.root, styles2[`maxWidth${capitalize(String(ownerState.maxWidth))}`], ownerState.fixed && styles2.fixed, ownerState.disableGutters && styles2.disableGutters];
|
|
8328
|
+
}
|
|
8329
|
+
}),
|
|
8330
|
+
useThemeProps: (inProps) => useDefaultProps({
|
|
8331
|
+
props: inProps,
|
|
8332
|
+
name: "MuiContainer"
|
|
8333
|
+
})
|
|
8334
|
+
});
|
|
8335
|
+
process.env.NODE_ENV !== "production" ? Container.propTypes = {
|
|
8336
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
8337
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
8338
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
8339
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
8340
|
+
/**
|
|
8341
|
+
* @ignore
|
|
8342
|
+
*/
|
|
8343
|
+
children: PropTypes.node,
|
|
8344
|
+
/**
|
|
8345
|
+
* Override or extend the styles applied to the component.
|
|
8346
|
+
*/
|
|
8347
|
+
classes: PropTypes.object,
|
|
8348
|
+
/**
|
|
8349
|
+
* The component used for the root node.
|
|
8350
|
+
* Either a string to use a HTML element or a component.
|
|
8351
|
+
*/
|
|
8352
|
+
component: PropTypes.elementType,
|
|
8353
|
+
/**
|
|
8354
|
+
* If `true`, the left and right padding is removed.
|
|
8355
|
+
* @default false
|
|
8356
|
+
*/
|
|
8357
|
+
disableGutters: PropTypes.bool,
|
|
8358
|
+
/**
|
|
8359
|
+
* Set the max-width to match the min-width of the current breakpoint.
|
|
8360
|
+
* This is useful if you'd prefer to design for a fixed set of sizes
|
|
8361
|
+
* instead of trying to accommodate a fully fluid viewport.
|
|
8362
|
+
* It's fluid by default.
|
|
8363
|
+
* @default false
|
|
8364
|
+
*/
|
|
8365
|
+
fixed: PropTypes.bool,
|
|
8366
|
+
/**
|
|
8367
|
+
* Determine the max-width of the container.
|
|
8368
|
+
* The container width grows with the size of the screen.
|
|
8369
|
+
* Set to `false` to disable `maxWidth`.
|
|
8370
|
+
* @default 'lg'
|
|
8371
|
+
*/
|
|
8372
|
+
maxWidth: PropTypes.oneOfType([PropTypes.oneOf(["xs", "sm", "md", "lg", "xl", false]), PropTypes.string]),
|
|
8373
|
+
/**
|
|
8374
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
8375
|
+
*/
|
|
8376
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
8377
|
+
} : void 0;
|
|
8378
8378
|
function getDividerUtilityClass(slot) {
|
|
8379
8379
|
return generateUtilityClass("MuiDivider", slot);
|
|
8380
8380
|
}
|
|
@@ -21578,113 +21578,36 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes = {
|
|
|
21578
21578
|
*/
|
|
21579
21579
|
variant: PropTypes.oneOf(["filled", "outlined", "standard"])
|
|
21580
21580
|
} : void 0;
|
|
21581
|
-
const brand = {
|
|
21582
|
-
primary: "#6C4CE7",
|
|
21583
|
-
// roxo da plataforma
|
|
21584
|
-
primaryHover: "#5a3ed4",
|
|
21585
|
-
ink: "#111827",
|
|
21586
|
-
muted: "#6b7280",
|
|
21587
|
-
bg: "#f6f7fb",
|
|
21588
|
-
surface: "#ffffff",
|
|
21589
|
-
border: "#e5e7eb",
|
|
21590
|
-
ring: "rgba(108,76,231,.25)"
|
|
21591
|
-
};
|
|
21592
|
-
const theme = createTheme({
|
|
21593
|
-
palette: {
|
|
21594
|
-
mode: "light",
|
|
21595
|
-
primary: { main: brand.primary },
|
|
21596
|
-
text: { primary: brand.ink, secondary: brand.muted },
|
|
21597
|
-
background: { default: brand.bg, paper: brand.surface }
|
|
21598
|
-
},
|
|
21599
|
-
shape: { borderRadius: 10 },
|
|
21600
|
-
typography: {
|
|
21601
|
-
fontFamily: `"Inter","Segoe UI",Roboto,Ubuntu,Helvetica,Arial,sans-serif`,
|
|
21602
|
-
h6: { fontWeight: 700 },
|
|
21603
|
-
button: { textTransform: "none", fontWeight: 700 }
|
|
21604
|
-
},
|
|
21605
|
-
components: {
|
|
21606
|
-
MuiCard: {
|
|
21607
|
-
styleOverrides: {
|
|
21608
|
-
root: {
|
|
21609
|
-
border: `1px solid ${brand.border}`,
|
|
21610
|
-
boxShadow: "0 10px 30px rgba(2,6,23,.06)"
|
|
21611
|
-
}
|
|
21612
|
-
}
|
|
21613
|
-
},
|
|
21614
|
-
MuiTextField: {
|
|
21615
|
-
defaultProps: { size: "medium" }
|
|
21616
|
-
},
|
|
21617
|
-
MuiOutlinedInput: {
|
|
21618
|
-
styleOverrides: {
|
|
21619
|
-
root: {
|
|
21620
|
-
background: "#fff",
|
|
21621
|
-
"& fieldset": { borderColor: brand.border },
|
|
21622
|
-
"&:hover fieldset": { borderColor: brand.primary },
|
|
21623
|
-
"&.Mui-focused fieldset": { borderColor: brand.primary, boxShadow: `0 0 0 3px ${brand.ring}` }
|
|
21624
|
-
},
|
|
21625
|
-
input: { paddingTop: 14, paddingBottom: 14 }
|
|
21626
|
-
}
|
|
21627
|
-
},
|
|
21628
|
-
MuiButton: {
|
|
21629
|
-
styleOverrides: {
|
|
21630
|
-
root: { borderRadius: 12, paddingBlock: 14 },
|
|
21631
|
-
containedPrimary: { boxShadow: "0 10px 24px rgba(108,76,231,.22)" }
|
|
21632
|
-
}
|
|
21633
|
-
},
|
|
21634
|
-
MuiDivider: {
|
|
21635
|
-
styleOverrides: {
|
|
21636
|
-
root: { borderColor: brand.border }
|
|
21637
|
-
}
|
|
21638
|
-
}
|
|
21639
|
-
}
|
|
21640
|
-
});
|
|
21641
21581
|
const BRL$1 = new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" });
|
|
21642
|
-
function OrderSummary({ amount, merchantName,
|
|
21643
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
21644
|
-
|
|
21645
|
-
|
|
21646
|
-
|
|
21647
|
-
sx: {
|
|
21648
|
-
|
|
21649
|
-
|
|
21650
|
-
|
|
21651
|
-
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
|
|
21655
|
-
|
|
21656
|
-
flexDirection: "column"
|
|
21657
|
-
},
|
|
21658
|
-
children: [
|
|
21659
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { sx: { flexGrow: 1 }, children: [
|
|
21660
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "subtitle2", color: "text.secondary", sx: { mb: 1 }, children: merchantName }),
|
|
21661
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "Enviou uma solicitação de pagamento" }),
|
|
21662
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { sx: { mb: 2 } }),
|
|
21663
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.primary", sx: { mb: 0.5 }, children: "Descrição do produto ou serviço" }),
|
|
21664
|
-
items.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Stack, { spacing: 1.2, sx: { mb: 1 }, children: items.map((p, i) => {
|
|
21665
|
-
const qty = p.quantity ?? 1;
|
|
21666
|
-
const line = p.unitPrice * qty;
|
|
21667
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [
|
|
21668
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", color: "text.secondary", children: [
|
|
21669
|
-
qty > 1 ? `${qty}× ` : "",
|
|
21670
|
-
p.name
|
|
21671
|
-
] }),
|
|
21672
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", children: BRL$1.format(line) })
|
|
21673
|
-
] }, p.id ?? `${p.name}-${i}`);
|
|
21674
|
-
}) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { direction: "row", justifyContent: "space-between", sx: { mb: 1 }, children: [
|
|
21675
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", children: "(1) Pagamento" }),
|
|
21676
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", children: BRL$1.format(amount) })
|
|
21582
|
+
function OrderSummary({ amount, merchantName, items = [] }) {
|
|
21583
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { elevation: 0, sx: { border: "1px solid #e2e8f0" }, children: [
|
|
21584
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { sx: { flexGrow: 1 }, children: [
|
|
21585
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "subtitle2", color: "text.secondary", sx: { mb: 1 }, children: merchantName }),
|
|
21586
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "Enviou uma solicitação de pagamento" }),
|
|
21587
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { sx: { mb: 2 } }),
|
|
21588
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.primary", sx: { mb: 0.5 }, children: "Descrição do produto ou serviço" }),
|
|
21589
|
+
items.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Stack, { spacing: 1.2, sx: { mb: 1 }, children: items.map((p, i) => {
|
|
21590
|
+
const qty = p.quantidade ?? 1;
|
|
21591
|
+
const line = p.preco * qty;
|
|
21592
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [
|
|
21593
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", color: "text.secondary", children: [
|
|
21594
|
+
qty > 1 ? `${qty}× ` : "",
|
|
21595
|
+
p.nome
|
|
21677
21596
|
] }),
|
|
21678
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21679
|
-
|
|
21680
|
-
|
|
21681
|
-
|
|
21682
|
-
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
|
|
21686
|
-
|
|
21687
|
-
|
|
21597
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", children: BRL$1.format(line) })
|
|
21598
|
+
] }, p.id ?? `${p.nome}-${i}`);
|
|
21599
|
+
}) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { direction: "row", justifyContent: "space-between", sx: { mb: 1 }, children: [
|
|
21600
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", children: "(1) Pagamento" }),
|
|
21601
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", children: BRL$1.format(amount) })
|
|
21602
|
+
] }),
|
|
21603
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { sx: { my: 2 } }),
|
|
21604
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
21605
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h5", sx: { fontWeight: 800 }, children: "Valor total" }),
|
|
21606
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h5", sx: { fontWeight: 800 }, children: BRL$1.format(amount) })
|
|
21607
|
+
] })
|
|
21608
|
+
] }),
|
|
21609
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CardActions, { sx: { justifyContent: "center", p: 2 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "caption", color: "text.secondary", children: "Desenvolvido por SuportePOS | Pagamento Seguro" }) })
|
|
21610
|
+
] });
|
|
21688
21611
|
}
|
|
21689
21612
|
function isValidCPF(cpf) {
|
|
21690
21613
|
cpf = cpf.replace(/\D/g, "");
|
|
@@ -21762,20 +21685,20 @@ const UF_LIST = [
|
|
|
21762
21685
|
];
|
|
21763
21686
|
function SplitCheckoutForm({
|
|
21764
21687
|
merchantId,
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21688
|
+
codigoPedido,
|
|
21689
|
+
producao,
|
|
21690
|
+
valor,
|
|
21768
21691
|
splits,
|
|
21769
|
-
|
|
21692
|
+
produtos,
|
|
21770
21693
|
merchantName,
|
|
21771
|
-
|
|
21694
|
+
cliente,
|
|
21772
21695
|
installmentsOptions = [1, 2, 3, 6, 10, 12],
|
|
21773
21696
|
onBack,
|
|
21774
21697
|
onResponse,
|
|
21775
21698
|
uuid
|
|
21776
21699
|
}) {
|
|
21777
|
-
const apiUrl =
|
|
21778
|
-
|
|
21700
|
+
const apiUrl = producao ? "http://localhost:8003" : "http://localhost:8003";
|
|
21701
|
+
useMediaQuery("(max-width:900px)");
|
|
21779
21702
|
const [step, setStep] = useState("card");
|
|
21780
21703
|
const maskCard = (v) => v.replace(/\D/g, "").trim();
|
|
21781
21704
|
const maskExpiry = (v) => v.replace(/\D/g, "").slice(0, 6).replace(/(\d{2})(\d{0,4})/, (m, mm, yyyy) => yyyy ? `${mm}/${yyyy}` : mm);
|
|
@@ -21790,23 +21713,23 @@ function SplitCheckoutForm({
|
|
|
21790
21713
|
const [cvv, setCvv] = useState("");
|
|
21791
21714
|
const [installments, setInstallments] = useState(1);
|
|
21792
21715
|
const [accessToken, setAccessToken] = useState("");
|
|
21793
|
-
const [cep, setCep] = useState(
|
|
21794
|
-
const [address, setAddress] = useState(
|
|
21795
|
-
const [number, setNumber] = useState(
|
|
21796
|
-
const [complement, setComplement] = useState(
|
|
21797
|
-
const [neighborhood, setNeighborhood] = useState(
|
|
21798
|
-
const [city, setCity] = useState(
|
|
21799
|
-
const [uf, setUf] = useState(
|
|
21800
|
-
const [buyerName, setBuyerName] = useState(
|
|
21801
|
-
const [buyerEmail, setBuyerEmail] = useState(
|
|
21802
|
-
const [buyerPhone, setBuyerPhone] = useState(
|
|
21803
|
-
const [docType, setDocType] = useState(
|
|
21804
|
-
const [docNumber, setDocNumber] = useState(
|
|
21716
|
+
const [cep, setCep] = useState(cliente?.cep ? maskCEP(cliente.cep) : "");
|
|
21717
|
+
const [address, setAddress] = useState(cliente?.endereco ?? "");
|
|
21718
|
+
const [number, setNumber] = useState(cliente?.numero ?? "");
|
|
21719
|
+
const [complement, setComplement] = useState(cliente?.complemento ?? "");
|
|
21720
|
+
const [neighborhood, setNeighborhood] = useState(cliente?.bairro ?? "");
|
|
21721
|
+
const [city, setCity] = useState(cliente?.cidade ?? "");
|
|
21722
|
+
const [uf, setUf] = useState(cliente?.estado ?? "");
|
|
21723
|
+
const [buyerName, setBuyerName] = useState(cliente?.nomeComprador ?? "");
|
|
21724
|
+
const [buyerEmail, setBuyerEmail] = useState(cliente?.emailComprador ?? "");
|
|
21725
|
+
const [buyerPhone, setBuyerPhone] = useState(cliente?.telefoneComprador ?? "");
|
|
21726
|
+
const [docType, setDocType] = useState(cliente?.tipoDoc ?? "");
|
|
21727
|
+
const [docNumber, setDocNumber] = useState(cliente?.numeroDoc ?? "");
|
|
21805
21728
|
const [errors, setErrors] = useState({});
|
|
21806
21729
|
const [loading, setLoading] = useState(false);
|
|
21807
21730
|
useEffect(() => {
|
|
21808
21731
|
const script = document.createElement("script");
|
|
21809
|
-
if (
|
|
21732
|
+
if (producao) {
|
|
21810
21733
|
script.src = "https://www.pagador.com.br/post/scripts/silentorderpost-1.0.min.js";
|
|
21811
21734
|
} else {
|
|
21812
21735
|
script.src = "https://transactionsandbox.pagador.com.br/post/Scripts/silentorderpost-1.0.min.js";
|
|
@@ -21815,7 +21738,7 @@ function SplitCheckoutForm({
|
|
|
21815
21738
|
document.body.appendChild(script);
|
|
21816
21739
|
script.onload = async () => {
|
|
21817
21740
|
try {
|
|
21818
|
-
const res = await fetch(`${apiUrl}/api/token-cartao?merchantId=${merchantId}&
|
|
21741
|
+
const res = await fetch(`${apiUrl}/api/token-cartao?merchantId=${merchantId}&producao=${producao}`);
|
|
21819
21742
|
const data = await res.json();
|
|
21820
21743
|
setAccessToken(data?.access_token);
|
|
21821
21744
|
} catch (err) {
|
|
@@ -21899,7 +21822,7 @@ function SplitCheckoutForm({
|
|
|
21899
21822
|
setLoading(true);
|
|
21900
21823
|
const options = {
|
|
21901
21824
|
accessToken,
|
|
21902
|
-
environment:
|
|
21825
|
+
environment: producao ? "production" : "sandbox",
|
|
21903
21826
|
language: "PT",
|
|
21904
21827
|
enableBinQuery: false,
|
|
21905
21828
|
enableVerifyCard: false,
|
|
@@ -21913,15 +21836,15 @@ function SplitCheckoutForm({
|
|
|
21913
21836
|
body: JSON.stringify({
|
|
21914
21837
|
merchantId,
|
|
21915
21838
|
// ou pegue dinamicamente
|
|
21916
|
-
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
installments,
|
|
21920
|
-
buyerName,
|
|
21921
|
-
buyerEmail,
|
|
21922
|
-
buyerPhone,
|
|
21923
|
-
docType,
|
|
21924
|
-
docNumber,
|
|
21839
|
+
codigoPedido,
|
|
21840
|
+
tokenPagamento: response.CardToken ?? response.PaymentToken,
|
|
21841
|
+
valor,
|
|
21842
|
+
parcelas: installments,
|
|
21843
|
+
nomeComprador: buyerName,
|
|
21844
|
+
emailComprador: buyerEmail,
|
|
21845
|
+
telefoneComprador: buyerPhone,
|
|
21846
|
+
tipoDoc: docType,
|
|
21847
|
+
numeroDoc: docNumber,
|
|
21925
21848
|
splits,
|
|
21926
21849
|
cep,
|
|
21927
21850
|
address,
|
|
@@ -21930,7 +21853,7 @@ function SplitCheckoutForm({
|
|
|
21930
21853
|
neighborhood,
|
|
21931
21854
|
city,
|
|
21932
21855
|
state: uf,
|
|
21933
|
-
|
|
21856
|
+
producao,
|
|
21934
21857
|
uuid
|
|
21935
21858
|
})
|
|
21936
21859
|
});
|
|
@@ -21938,25 +21861,25 @@ function SplitCheckoutForm({
|
|
|
21938
21861
|
onResponse?.(result);
|
|
21939
21862
|
} catch (err) {
|
|
21940
21863
|
console.error("Erro chamando backend:", err);
|
|
21941
|
-
onResponse?.({
|
|
21864
|
+
onResponse?.({ successo: false, mensagem: "Erro ao comunicar backend" });
|
|
21942
21865
|
} finally {
|
|
21943
21866
|
setLoading(false);
|
|
21944
21867
|
}
|
|
21945
21868
|
},
|
|
21946
21869
|
onError: (err) => {
|
|
21947
21870
|
console.error("Erro SOP:", err);
|
|
21948
|
-
onResponse?.({
|
|
21871
|
+
onResponse?.({ successo: false, mensagem: "Erro SOP" });
|
|
21949
21872
|
setLoading(false);
|
|
21950
21873
|
},
|
|
21951
21874
|
onInvalid: (fields) => {
|
|
21952
21875
|
console.warn("Campos inválidos:", fields);
|
|
21953
|
-
onResponse?.({
|
|
21876
|
+
onResponse?.({ successo: false, mensagem: "Campos inválidos" });
|
|
21954
21877
|
setLoading(false);
|
|
21955
21878
|
}
|
|
21956
21879
|
};
|
|
21957
21880
|
window.bpSop_silentOrderPost(options);
|
|
21958
21881
|
};
|
|
21959
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21882
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container, { maxWidth: "lg", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, spacing: 3, children: [
|
|
21960
21883
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, md: 7, size: 7, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { elevation: 0, sx: { border: "1px solid #e2e8f0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { children: [
|
|
21961
21884
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Box, { sx: { display: step === "card" ? "block" : "none" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
21962
21885
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h6", sx: { mb: 2 }, children: "Pagamento com cartão de crédito" }),
|
|
@@ -22031,7 +21954,7 @@ function SplitCheckoutForm({
|
|
|
22031
21954
|
children: installmentsOptions.map((n) => /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuItem, { value: n, children: [
|
|
22032
21955
|
n,
|
|
22033
21956
|
"x de R$ ",
|
|
22034
|
-
BRL.format(
|
|
21957
|
+
BRL.format(valor / n)
|
|
22035
21958
|
] }, n))
|
|
22036
21959
|
}
|
|
22037
21960
|
),
|
|
@@ -22227,36 +22150,36 @@ function SplitCheckoutForm({
|
|
|
22227
22150
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, md: 5, size: 5, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22228
22151
|
OrderSummary,
|
|
22229
22152
|
{
|
|
22230
|
-
amount,
|
|
22153
|
+
amount: valor,
|
|
22231
22154
|
merchantName,
|
|
22232
|
-
|
|
22233
|
-
items: summaryItems
|
|
22155
|
+
items: produtos
|
|
22234
22156
|
}
|
|
22235
22157
|
) })
|
|
22236
|
-
] }) })
|
|
22158
|
+
] }) });
|
|
22237
22159
|
}
|
|
22238
22160
|
const ContentCopyIcon = createSvgIcon(/* @__PURE__ */ jsxRuntimeExports.jsx("path", {
|
|
22239
22161
|
d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"
|
|
22240
22162
|
}), "ContentCopy");
|
|
22241
22163
|
function SplitPixForm({
|
|
22242
22164
|
merchantId,
|
|
22243
|
-
|
|
22244
|
-
|
|
22245
|
-
|
|
22165
|
+
codigoPedido,
|
|
22166
|
+
producao,
|
|
22167
|
+
valor,
|
|
22246
22168
|
merchantName = "SUPORTEPOS",
|
|
22247
|
-
|
|
22169
|
+
produtos,
|
|
22248
22170
|
splits,
|
|
22249
|
-
|
|
22171
|
+
cliente,
|
|
22250
22172
|
onBack,
|
|
22251
22173
|
onResponse,
|
|
22252
22174
|
uuid
|
|
22253
22175
|
}) {
|
|
22254
|
-
|
|
22255
|
-
const
|
|
22176
|
+
console.log({ cliente });
|
|
22177
|
+
const apiUrl = producao ? "http://localhost:8003" : "http://localhost:8003";
|
|
22178
|
+
useMediaQuery("(max-width:900px)");
|
|
22256
22179
|
const [copied, setCopied] = useState(false);
|
|
22257
|
-
const [buyerName, setBuyerName] = useState(
|
|
22258
|
-
const [docType, setDocType] = useState(
|
|
22259
|
-
const [docNumber, setDocNumber] = useState(
|
|
22180
|
+
const [buyerName, setBuyerName] = useState(cliente?.nomeComprador ?? "");
|
|
22181
|
+
const [docType, setDocType] = useState(cliente?.tipoDoc ?? "");
|
|
22182
|
+
const [docNumber, setDocNumber] = useState(cliente?.numeroDoc ?? "");
|
|
22260
22183
|
const [errors, setErrors] = useState({});
|
|
22261
22184
|
const [loading, setLoading] = useState(false);
|
|
22262
22185
|
const [pixData, setPixData] = useState(null);
|
|
@@ -22292,18 +22215,18 @@ function SplitPixForm({
|
|
|
22292
22215
|
headers: { "Content-Type": "application/json" },
|
|
22293
22216
|
body: JSON.stringify({
|
|
22294
22217
|
merchantId,
|
|
22295
|
-
|
|
22296
|
-
|
|
22297
|
-
buyerName,
|
|
22298
|
-
docType,
|
|
22299
|
-
docNumber,
|
|
22218
|
+
codigoPedido,
|
|
22219
|
+
valor,
|
|
22220
|
+
nomeComprador: buyerName,
|
|
22221
|
+
tipoDoc: docType,
|
|
22222
|
+
numeroDoc: docNumber,
|
|
22300
22223
|
splits,
|
|
22301
|
-
|
|
22224
|
+
producao,
|
|
22302
22225
|
uuid
|
|
22303
22226
|
})
|
|
22304
22227
|
});
|
|
22305
22228
|
const data = await res.json();
|
|
22306
|
-
if (data.
|
|
22229
|
+
if (data.codigo_copia_cola && data.qr_code) {
|
|
22307
22230
|
setPixData(data);
|
|
22308
22231
|
}
|
|
22309
22232
|
} catch (err) {
|
|
@@ -22321,8 +22244,8 @@ function SplitPixForm({
|
|
|
22321
22244
|
headers: { "Content-Type": "application/json" },
|
|
22322
22245
|
body: JSON.stringify({
|
|
22323
22246
|
merchantId,
|
|
22324
|
-
paymentId: pixData?.
|
|
22325
|
-
|
|
22247
|
+
paymentId: pixData?.payment_id,
|
|
22248
|
+
producao
|
|
22326
22249
|
})
|
|
22327
22250
|
});
|
|
22328
22251
|
const result = await res.json();
|
|
@@ -22336,15 +22259,15 @@ function SplitPixForm({
|
|
|
22336
22259
|
}
|
|
22337
22260
|
};
|
|
22338
22261
|
const copyToClipboard = async () => {
|
|
22339
|
-
if (!pixData?.
|
|
22262
|
+
if (!pixData?.codigo_copia_cola) return;
|
|
22340
22263
|
try {
|
|
22341
|
-
await navigator.clipboard.writeText(pixData.
|
|
22264
|
+
await navigator.clipboard.writeText(pixData.codigo_copia_cola);
|
|
22342
22265
|
setCopied(true);
|
|
22343
22266
|
setTimeout(() => setCopied(false), 1500);
|
|
22344
22267
|
} catch {
|
|
22345
22268
|
}
|
|
22346
22269
|
};
|
|
22347
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22270
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container, { maxWidth: "lg", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, spacing: 3, children: [
|
|
22348
22271
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, md: 7, size: 7, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { elevation: 0, sx: { border: "1px solid #e2e8f0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { children: [
|
|
22349
22272
|
!pixData && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
22350
22273
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h6", sx: { mb: 2 }, children: "Preencha seus dados para gerar o PIX" }),
|
|
@@ -22439,7 +22362,7 @@ function SplitPixForm({
|
|
|
22439
22362
|
"img",
|
|
22440
22363
|
{
|
|
22441
22364
|
alt: "QR Code PIX",
|
|
22442
|
-
src: pixData.
|
|
22365
|
+
src: pixData.qr_code,
|
|
22443
22366
|
style: { width: "100%", height: "100%", objectFit: "contain" }
|
|
22444
22367
|
}
|
|
22445
22368
|
)
|
|
@@ -22463,7 +22386,7 @@ function SplitPixForm({
|
|
|
22463
22386
|
mb: 1.5,
|
|
22464
22387
|
userSelect: "text"
|
|
22465
22388
|
},
|
|
22466
|
-
children: pixData.
|
|
22389
|
+
children: pixData.codigo_copia_cola
|
|
22467
22390
|
}
|
|
22468
22391
|
),
|
|
22469
22392
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -22495,30 +22418,89 @@ function SplitPixForm({
|
|
|
22495
22418
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, md: 5, size: 5, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22496
22419
|
OrderSummary,
|
|
22497
22420
|
{
|
|
22498
|
-
amount,
|
|
22421
|
+
amount: valor,
|
|
22499
22422
|
merchantName,
|
|
22500
|
-
items:
|
|
22501
|
-
sticky: !isSm
|
|
22423
|
+
items: produtos
|
|
22502
22424
|
}
|
|
22503
22425
|
) })
|
|
22504
|
-
] }) })
|
|
22426
|
+
] }) });
|
|
22505
22427
|
}
|
|
22428
|
+
const brand = {
|
|
22429
|
+
primary: "#6C4CE7",
|
|
22430
|
+
// roxo da plataforma
|
|
22431
|
+
primaryHover: "#5a3ed4",
|
|
22432
|
+
ink: "#111827",
|
|
22433
|
+
muted: "#6b7280",
|
|
22434
|
+
bg: "#f6f7fb",
|
|
22435
|
+
surface: "#ffffff",
|
|
22436
|
+
border: "#e5e7eb",
|
|
22437
|
+
ring: "rgba(108,76,231,.25)"
|
|
22438
|
+
};
|
|
22439
|
+
const theme = createTheme({
|
|
22440
|
+
palette: {
|
|
22441
|
+
mode: "light",
|
|
22442
|
+
primary: { main: brand.primary },
|
|
22443
|
+
text: { primary: brand.ink, secondary: brand.muted },
|
|
22444
|
+
background: { default: brand.bg, paper: brand.surface }
|
|
22445
|
+
},
|
|
22446
|
+
shape: { borderRadius: 10 },
|
|
22447
|
+
typography: {
|
|
22448
|
+
fontFamily: `"Inter","Segoe UI",Roboto,Ubuntu,Helvetica,Arial,sans-serif`,
|
|
22449
|
+
h6: { fontWeight: 700 },
|
|
22450
|
+
button: { textTransform: "none", fontWeight: 700 }
|
|
22451
|
+
},
|
|
22452
|
+
components: {
|
|
22453
|
+
MuiCard: {
|
|
22454
|
+
styleOverrides: {
|
|
22455
|
+
root: {
|
|
22456
|
+
border: `1px solid ${brand.border}`,
|
|
22457
|
+
boxShadow: "0 10px 30px rgba(2,6,23,.06)"
|
|
22458
|
+
}
|
|
22459
|
+
}
|
|
22460
|
+
},
|
|
22461
|
+
MuiTextField: {
|
|
22462
|
+
defaultProps: { size: "medium" }
|
|
22463
|
+
},
|
|
22464
|
+
MuiOutlinedInput: {
|
|
22465
|
+
styleOverrides: {
|
|
22466
|
+
root: {
|
|
22467
|
+
background: "#fff",
|
|
22468
|
+
"& fieldset": { borderColor: brand.border },
|
|
22469
|
+
"&:hover fieldset": { borderColor: brand.primary },
|
|
22470
|
+
"&.Mui-focused fieldset": { borderColor: brand.primary, boxShadow: `0 0 0 3px ${brand.ring}` }
|
|
22471
|
+
},
|
|
22472
|
+
input: { paddingTop: 14, paddingBottom: 14 }
|
|
22473
|
+
}
|
|
22474
|
+
},
|
|
22475
|
+
MuiButton: {
|
|
22476
|
+
styleOverrides: {
|
|
22477
|
+
root: { borderRadius: 12, paddingBlock: 14 },
|
|
22478
|
+
containedPrimary: { boxShadow: "0 10px 24px rgba(108,76,231,.22)" }
|
|
22479
|
+
}
|
|
22480
|
+
},
|
|
22481
|
+
MuiDivider: {
|
|
22482
|
+
styleOverrides: {
|
|
22483
|
+
root: { borderColor: brand.border }
|
|
22484
|
+
}
|
|
22485
|
+
}
|
|
22486
|
+
}
|
|
22487
|
+
});
|
|
22506
22488
|
function CheckoutFlowContent({
|
|
22507
22489
|
step,
|
|
22508
22490
|
setStep,
|
|
22509
|
-
|
|
22491
|
+
valor,
|
|
22510
22492
|
merchantName,
|
|
22511
|
-
|
|
22493
|
+
produtos,
|
|
22512
22494
|
splits,
|
|
22513
|
-
|
|
22495
|
+
cliente,
|
|
22514
22496
|
merchantId,
|
|
22515
|
-
|
|
22497
|
+
codigoPedido,
|
|
22516
22498
|
uuid,
|
|
22517
|
-
|
|
22499
|
+
producao,
|
|
22518
22500
|
onResponse,
|
|
22519
22501
|
paymentEnabled
|
|
22520
22502
|
}) {
|
|
22521
|
-
|
|
22503
|
+
useMediaQuery("(max-width:900px)");
|
|
22522
22504
|
const primaryButtons = [];
|
|
22523
22505
|
const listItems = [];
|
|
22524
22506
|
if (paymentEnabled?.creditCard) {
|
|
@@ -22557,13 +22539,13 @@ function CheckoutFlowContent({
|
|
|
22557
22539
|
SplitCheckoutForm,
|
|
22558
22540
|
{
|
|
22559
22541
|
merchantId,
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22542
|
+
codigoPedido,
|
|
22543
|
+
producao,
|
|
22544
|
+
valor,
|
|
22563
22545
|
splits,
|
|
22564
|
-
|
|
22546
|
+
cliente,
|
|
22565
22547
|
merchantName,
|
|
22566
|
-
|
|
22548
|
+
produtos,
|
|
22567
22549
|
onBack: () => setStep("select"),
|
|
22568
22550
|
onResponse,
|
|
22569
22551
|
uuid
|
|
@@ -22575,54 +22557,36 @@ function CheckoutFlowContent({
|
|
|
22575
22557
|
SplitPixForm,
|
|
22576
22558
|
{
|
|
22577
22559
|
merchantId,
|
|
22578
|
-
|
|
22579
|
-
|
|
22580
|
-
|
|
22560
|
+
codigoPedido,
|
|
22561
|
+
producao,
|
|
22562
|
+
valor,
|
|
22581
22563
|
splits,
|
|
22582
|
-
|
|
22564
|
+
cliente,
|
|
22583
22565
|
merchantName,
|
|
22584
|
-
|
|
22566
|
+
produtos,
|
|
22585
22567
|
onBack: () => setStep("select"),
|
|
22586
22568
|
onResponse,
|
|
22587
22569
|
uuid
|
|
22588
22570
|
}
|
|
22589
22571
|
);
|
|
22590
22572
|
}
|
|
22591
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
22592
|
-
Grid,
|
|
22593
|
-
|
|
22594
|
-
|
|
22595
|
-
spacing:
|
|
22596
|
-
|
|
22597
|
-
|
|
22598
|
-
|
|
22599
|
-
|
|
22600
|
-
|
|
22601
|
-
|
|
22602
|
-
|
|
22603
|
-
|
|
22604
|
-
|
|
22605
|
-
|
|
22606
|
-
|
|
22607
|
-
|
|
22608
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h6", sx: { mb: 2 }, children: "Como você quer pagar?" }),
|
|
22609
|
-
noneActive && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { severity: "warning", sx: { mb: 2 }, children: "Nenhum meio de pagamento está disponível no momento." }),
|
|
22610
|
-
primaryButtons.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Stack, { direction: { xs: "column", sm: "row" }, spacing: 2, sx: { mb: 2 }, children: primaryButtons }),
|
|
22611
|
-
primaryButtons.length > 0 && listItems.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { sx: { my: 1 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", children: "ou" }) }),
|
|
22612
|
-
listItems.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(List, { sx: { mt: primaryButtons.length ? 1 : 0 }, children: listItems })
|
|
22613
|
-
] }) }) }),
|
|
22614
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, md: 5, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22615
|
-
OrderSummary,
|
|
22616
|
-
{
|
|
22617
|
-
amount,
|
|
22618
|
-
merchantName,
|
|
22619
|
-
sticky: !isSm,
|
|
22620
|
-
items: products
|
|
22621
|
-
}
|
|
22622
|
-
) })
|
|
22623
|
-
]
|
|
22624
|
-
}
|
|
22625
|
-
);
|
|
22573
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container, { maxWidth: "lg", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, spacing: 3, justifyContent: "center", children: [
|
|
22574
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, md: 7, size: 7, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { elevation: 0, sx: { border: "1px solid #e2e8f0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { children: [
|
|
22575
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h6", sx: { mb: 2 }, children: "Como você quer pagar?" }),
|
|
22576
|
+
noneActive && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { severity: "warning", sx: { mb: 2 }, children: "Nenhum meio de pagamento está disponível no momento." }),
|
|
22577
|
+
primaryButtons.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Stack, { direction: { xs: "column", sm: "row" }, spacing: 2, sx: { mb: 2 }, children: primaryButtons }),
|
|
22578
|
+
primaryButtons.length > 0 && listItems.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { sx: { my: 1 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", children: "ou" }) }),
|
|
22579
|
+
listItems.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(List, { sx: { mt: primaryButtons.length ? 1 : 0 }, children: listItems })
|
|
22580
|
+
] }) }) }),
|
|
22581
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, md: 5, size: 5, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22582
|
+
OrderSummary,
|
|
22583
|
+
{
|
|
22584
|
+
amount: valor,
|
|
22585
|
+
merchantName,
|
|
22586
|
+
items: produtos
|
|
22587
|
+
}
|
|
22588
|
+
) })
|
|
22589
|
+
] }) });
|
|
22626
22590
|
}
|
|
22627
22591
|
const itemStyle = {
|
|
22628
22592
|
border: `1px solid ${brand.border}`,
|
|
@@ -22636,10 +22600,10 @@ const itemStyle = {
|
|
|
22636
22600
|
function CheckoutFlow(props) {
|
|
22637
22601
|
const [step, setStep] = useState("select");
|
|
22638
22602
|
const amountFromItems = useMemo(
|
|
22639
|
-
() => props.
|
|
22640
|
-
[props.
|
|
22603
|
+
() => props.produtos.reduce((sum, p) => sum + p.preco * (p.quantidade ?? 1), 0),
|
|
22604
|
+
[props.produtos]
|
|
22641
22605
|
);
|
|
22642
|
-
const
|
|
22606
|
+
const valor = props.valorTotal ?? amountFromItems;
|
|
22643
22607
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22644
22608
|
Box,
|
|
22645
22609
|
{
|
|
@@ -22652,35 +22616,21 @@ function CheckoutFlow(props) {
|
|
|
22652
22616
|
py: 4
|
|
22653
22617
|
},
|
|
22654
22618
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22655
|
-
|
|
22619
|
+
CheckoutFlowContent,
|
|
22656
22620
|
{
|
|
22657
|
-
|
|
22658
|
-
|
|
22659
|
-
|
|
22660
|
-
|
|
22661
|
-
|
|
22662
|
-
|
|
22663
|
-
|
|
22664
|
-
|
|
22665
|
-
{
|
|
22666
|
-
...props,
|
|
22667
|
-
step,
|
|
22668
|
-
setStep,
|
|
22669
|
-
amount,
|
|
22670
|
-
paymentEnabled: {
|
|
22671
|
-
creditCard: true,
|
|
22672
|
-
pix: true
|
|
22673
|
-
}
|
|
22674
|
-
}
|
|
22675
|
-
)
|
|
22621
|
+
...props,
|
|
22622
|
+
step,
|
|
22623
|
+
setStep,
|
|
22624
|
+
valor,
|
|
22625
|
+
paymentEnabled: {
|
|
22626
|
+
creditCard: true,
|
|
22627
|
+
pix: true
|
|
22628
|
+
}
|
|
22676
22629
|
}
|
|
22677
22630
|
)
|
|
22678
22631
|
}
|
|
22679
22632
|
) });
|
|
22680
22633
|
}
|
|
22681
|
-
({
|
|
22682
|
-
border: `1px solid ${brand.border}`
|
|
22683
|
-
});
|
|
22684
22634
|
export {
|
|
22685
22635
|
CheckoutFlow,
|
|
22686
22636
|
CheckoutFlowContent,
|