@fayz-ai/pos 0.24.3 → 0.24.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/dist/index.js
CHANGED
|
@@ -4939,7 +4939,7 @@ function lateness(p, now) {
|
|
|
4939
4939
|
return Math.floor((now - new Date(p.dueAt).getTime()) / 6e4);
|
|
4940
4940
|
}
|
|
4941
4941
|
var GHOST_MS = 300;
|
|
4942
|
-
function DeliveryBoard({ orders, activeId, onSelect, now, channelsConnected, historyOpen, onToggleHistory }) {
|
|
4942
|
+
function DeliveryBoard({ orders, activeId, onSelect, now, channelsConnected, historyOpen, onToggleHistory, loading }) {
|
|
4943
4943
|
const seen = useRef({});
|
|
4944
4944
|
const [ghosts, setGhosts] = useState([]);
|
|
4945
4945
|
useEffect(() => {
|
|
@@ -4959,7 +4959,7 @@ function DeliveryBoard({ orders, activeId, onSelect, now, channelsConnected, his
|
|
|
4959
4959
|
return () => window.clearTimeout(t);
|
|
4960
4960
|
}, [orders]);
|
|
4961
4961
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4962
|
-
orders.length === 0 && channelsConnected === false && /* @__PURE__ */ jsx(
|
|
4962
|
+
!loading && orders.length === 0 && channelsConnected === false && /* @__PURE__ */ jsx(
|
|
4963
4963
|
EmptyState,
|
|
4964
4964
|
{
|
|
4965
4965
|
title: "Nenhum canal de delivery conectado",
|
|
@@ -4967,84 +4967,94 @@ function DeliveryBoard({ orders, activeId, onSelect, now, channelsConnected, his
|
|
|
4967
4967
|
Icon: Bike
|
|
4968
4968
|
}
|
|
4969
4969
|
),
|
|
4970
|
-
/* @__PURE__ */
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
historyOpen ? "Ocultar hist\xF3rico" : "Hist\xF3rico do dia"
|
|
4975
|
-
] }),
|
|
4976
|
-
/* @__PURE__ */ jsx("p", { className: "pos-board__note", children: DELIVERED_LINGER_NOTE })
|
|
4977
|
-
] }),
|
|
4978
|
-
/* @__PURE__ */ jsx("div", { className: "pos-board", children: DELIVERY_COLUMNS.map(({ name, states, tone }) => {
|
|
4979
|
-
const Icon = ICONE[name] ?? Clock;
|
|
4980
|
-
const column = orders.filter((o) => stillOnBoard(o, now)).filter((o) => states.includes(deliveryStatus(o.dispatch)));
|
|
4981
|
-
return /* @__PURE__ */ jsxs(
|
|
4982
|
-
"section",
|
|
4970
|
+
/* @__PURE__ */ jsx("div", { className: "pos-board__bar", children: /* @__PURE__ */ jsx("p", { className: "pos-board__note", children: DELIVERED_LINGER_NOTE }) }),
|
|
4971
|
+
/* @__PURE__ */ jsxs("div", { className: "pos-board", children: [
|
|
4972
|
+
onToggleHistory && /* @__PURE__ */ jsx(
|
|
4973
|
+
PosButton,
|
|
4983
4974
|
{
|
|
4984
|
-
className: "pos-
|
|
4985
|
-
"aria-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
4975
|
+
className: "pos-icon-btn pos-board__history",
|
|
4976
|
+
"aria-pressed": !!historyOpen,
|
|
4977
|
+
onClick: onToggleHistory,
|
|
4978
|
+
"aria-label": historyOpen ? "Fechar o hist\xF3rico do dia" : "Abrir o hist\xF3rico do dia",
|
|
4979
|
+
title: historyOpen ? "Fechar o hist\xF3rico do dia" : "Hist\xF3rico do dia",
|
|
4980
|
+
children: /* @__PURE__ */ jsx(History, { size: 22 })
|
|
4981
|
+
}
|
|
4982
|
+
),
|
|
4983
|
+
DELIVERY_COLUMNS.map(({ name, states, tone }) => {
|
|
4984
|
+
const Icon = ICONE[name] ?? Clock;
|
|
4985
|
+
const column = orders.filter((o) => stillOnBoard(o, now)).filter((o) => states.includes(deliveryStatus(o.dispatch)));
|
|
4986
|
+
return /* @__PURE__ */ jsxs(
|
|
4987
|
+
"section",
|
|
4988
|
+
{
|
|
4989
|
+
className: "pos-col",
|
|
4990
|
+
"aria-label": name,
|
|
4991
|
+
style: { ["--pos-col-edge"]: `var(--pos-deliv-${tone})` },
|
|
4992
|
+
children: [
|
|
4993
|
+
/* @__PURE__ */ jsxs("header", { className: "pos-col__head", children: [
|
|
4994
|
+
/* @__PURE__ */ jsx(Icon, { size: 15, strokeWidth: 2.2, "aria-hidden": true }),
|
|
4995
|
+
/* @__PURE__ */ jsx("span", { className: "pos-col__t", children: name }),
|
|
4996
|
+
/* @__PURE__ */ jsx("span", { className: "pos-col__n pos-num", children: loading && column.length === 0 ? "" : column.length })
|
|
4997
|
+
] }),
|
|
4998
|
+
/* @__PURE__ */ jsxs("div", { className: "pos-col__body", children: [
|
|
4999
|
+
column.map((o) => {
|
|
5000
|
+
const late = lateness(o, now);
|
|
5001
|
+
const isLate = late != null && late > 0;
|
|
5002
|
+
const awaiting = name === "Pedidos" && !isLate;
|
|
5003
|
+
return /* @__PURE__ */ jsxs(
|
|
5004
|
+
PosButton,
|
|
5005
|
+
{
|
|
5006
|
+
className: "pos-card",
|
|
5007
|
+
"data-late": isLate,
|
|
5008
|
+
"data-await": awaiting,
|
|
5009
|
+
"aria-current": o.id === activeId,
|
|
5010
|
+
style: o.channelTone && !isLate && !awaiting ? { ["--pos-edge"]: `var(--pos-tone-${o.channelTone})` } : void 0,
|
|
5011
|
+
onClick: () => {
|
|
5012
|
+
haptic("tap");
|
|
5013
|
+
onSelect(o);
|
|
5014
|
+
},
|
|
5015
|
+
children: [
|
|
5016
|
+
/* @__PURE__ */ jsxs("span", { className: "pos-card__top", children: [
|
|
5017
|
+
/* @__PURE__ */ jsxs("span", { className: "pos-card__id pos-num", children: [
|
|
5018
|
+
"#",
|
|
5019
|
+
o.label.replace(/\D/g, "") || o.label
|
|
5020
|
+
] }),
|
|
5021
|
+
o.channel && /* @__PURE__ */ jsx("span", { className: "pos-card__ch", children: o.channel })
|
|
5015
5022
|
] }),
|
|
5016
|
-
o.
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
] })
|
|
5029
|
-
o.
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
)
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5023
|
+
o.customerName && /* @__PURE__ */ jsx("span", { className: "pos-card__who", children: o.customerName }),
|
|
5024
|
+
o.address && /* @__PURE__ */ jsx("span", { className: "pos-card__addr", children: o.address }),
|
|
5025
|
+
/* @__PURE__ */ jsxs("span", { className: "pos-card__foot", children: [
|
|
5026
|
+
/* @__PURE__ */ jsx("span", { className: isLate ? "pos-card__late" : "pos-card__due", children: isLate ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5027
|
+
/* @__PURE__ */ jsx(AlertTriangle, { size: 12, strokeWidth: 2.4, "aria-hidden": true }),
|
|
5028
|
+
late,
|
|
5029
|
+
"min atrasado"
|
|
5030
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5031
|
+
/* @__PURE__ */ jsx(Clock, { size: 12, strokeWidth: 2.2, "aria-hidden": true }),
|
|
5032
|
+
dueLabel(o, now)
|
|
5033
|
+
] }) }),
|
|
5034
|
+
o.totalCents != null && /* @__PURE__ */ jsx("span", { className: "pos-card__v pos-num", children: formatCents(o.totalCents) })
|
|
5035
|
+
] }),
|
|
5036
|
+
o.courierName && /* @__PURE__ */ jsxs("span", { className: "pos-card__courier", children: [
|
|
5037
|
+
/* @__PURE__ */ jsx(Bike, { size: 12, strokeWidth: 2.2, "aria-hidden": true }),
|
|
5038
|
+
o.courierName
|
|
5039
|
+
] })
|
|
5040
|
+
]
|
|
5041
|
+
},
|
|
5042
|
+
o.id
|
|
5043
|
+
);
|
|
5044
|
+
}),
|
|
5045
|
+
ghosts.filter((g) => deliveryColumnOf(g.from)?.name === name).map((g) => /* @__PURE__ */ jsx("span", { className: "pos-card pos-card--ghost", "aria-hidden": true }, `ghost-${g.id}`)),
|
|
5046
|
+
loading && column.length === 0 ? [0, 1].map((i) => /* @__PURE__ */ jsxs("span", { className: "pos-card pos-skel", "aria-hidden": true, style: { display: "grid", gap: 8 }, children: [
|
|
5047
|
+
/* @__PURE__ */ jsx("span", { className: "pos-skel__b", style: { width: "40%", height: 14 } }),
|
|
5048
|
+
/* @__PURE__ */ jsx("span", { className: "pos-skel__b", style: { width: `${70 - i * 15}%`, height: 12 } }),
|
|
5049
|
+
/* @__PURE__ */ jsx("span", { className: "pos-skel__b", style: { width: "30%", height: 12 } })
|
|
5050
|
+
] }, `skel-${i}`)) : column.length === 0 && ghosts.every((g) => deliveryColumnOf(g.from)?.name !== name) && /* @__PURE__ */ jsx("p", { className: "pos-col__empty", children: "Nenhum" })
|
|
5051
|
+
] })
|
|
5052
|
+
]
|
|
5053
|
+
},
|
|
5054
|
+
name
|
|
5055
|
+
);
|
|
5056
|
+
})
|
|
5057
|
+
] })
|
|
5048
5058
|
] });
|
|
5049
5059
|
}
|
|
5050
5060
|
function dueLabel(p, now) {
|
|
@@ -8789,6 +8799,7 @@ function PosScreen({
|
|
|
8789
8799
|
activeId: activePositionId,
|
|
8790
8800
|
onSelect: selectPosition,
|
|
8791
8801
|
now,
|
|
8802
|
+
loading,
|
|
8792
8803
|
historyOpen: deliveryHistory && !activePosition,
|
|
8793
8804
|
onToggleHistory: activePosition ? void 0 : () => setDeliveryHistory((v) => !v)
|
|
8794
8805
|
}
|