@fayz-ai/pos 0.24.2 → 0.24.4

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
@@ -4967,88 +4967,98 @@ function DeliveryBoard({ orders, activeId, onSelect, now, channelsConnected, his
4967
4967
  Icon: Bike
4968
4968
  }
4969
4969
  ),
4970
- /* @__PURE__ */ jsxs("div", { className: "pos-board__bar", children: [
4971
- onToggleHistory && /* @__PURE__ */ jsxs(PosButton, { className: "pos-pill", "aria-pressed": !!historyOpen, onClick: onToggleHistory, children: [
4972
- /* @__PURE__ */ jsx(History, { size: 14 }),
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-col",
4985
- "aria-label": name,
4986
- style: { ["--pos-col-edge"]: `var(--pos-deliv-${tone})` },
4987
- children: [
4988
- /* @__PURE__ */ jsxs("header", { className: "pos-col__head", children: [
4989
- /* @__PURE__ */ jsx(Icon, { size: 15, strokeWidth: 2.2, "aria-hidden": true }),
4990
- /* @__PURE__ */ jsx("span", { className: "pos-col__t", children: name }),
4991
- /* @__PURE__ */ jsx("span", { className: "pos-col__n pos-num", children: column.length })
4992
- ] }),
4993
- /* @__PURE__ */ jsxs("div", { className: "pos-col__body", children: [
4994
- column.map((o) => {
4995
- const late = lateness(o, now);
4996
- const isLate = late != null && late > 0;
4997
- const awaiting = name === "Pedidos" && !isLate;
4998
- return /* @__PURE__ */ jsxs(
4999
- PosButton,
5000
- {
5001
- className: "pos-card",
5002
- "data-late": isLate,
5003
- "data-await": awaiting,
5004
- "aria-current": o.id === activeId,
5005
- style: o.channelTone && !isLate && !awaiting ? { ["--pos-edge"]: `var(--pos-tone-${o.channelTone})` } : void 0,
5006
- onClick: () => {
5007
- haptic("tap");
5008
- onSelect(o);
5009
- },
5010
- children: [
5011
- /* @__PURE__ */ jsxs("span", { className: "pos-card__top", children: [
5012
- /* @__PURE__ */ jsxs("span", { className: "pos-card__id pos-num", children: [
5013
- "#",
5014
- o.label.replace(/\D/g, "") || o.label
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: 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.channel && /* @__PURE__ */ jsx("span", { className: "pos-card__ch", children: o.channel })
5017
- ] }),
5018
- /* @__PURE__ */ jsx("span", { className: "pos-card__who", children: o.customerName ?? "\u2014" }),
5019
- o.address && /* @__PURE__ */ jsx("span", { className: "pos-card__addr", children: o.address }),
5020
- /* @__PURE__ */ jsxs("span", { className: "pos-card__foot", children: [
5021
- /* @__PURE__ */ jsx("span", { className: isLate ? "pos-card__late" : "pos-card__due", children: isLate ? /* @__PURE__ */ jsxs(Fragment, { children: [
5022
- /* @__PURE__ */ jsx(AlertTriangle, { size: 12, strokeWidth: 2.4, "aria-hidden": true }),
5023
- late,
5024
- "min atrasado"
5025
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5026
- /* @__PURE__ */ jsx(Clock, { size: 12, strokeWidth: 2.2, "aria-hidden": true }),
5027
- dueLabel(o, now)
5028
- ] }) }),
5029
- o.totalCents != null && /* @__PURE__ */ jsx("span", { className: "pos-card__v pos-num", children: formatCents(o.totalCents) })
5030
- ] }),
5031
- o.courierName && /* @__PURE__ */ jsxs("span", { className: "pos-card__courier", children: [
5032
- /* @__PURE__ */ jsx(Bike, { size: 12, strokeWidth: 2.2, "aria-hidden": true }),
5033
- o.courierName
5034
- ] })
5035
- ]
5036
- },
5037
- o.id
5038
- );
5039
- }),
5040
- 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}`)),
5041
- column.length === 0 && ghosts.every((g) => deliveryColumnOf(g.from)?.name !== name) && /* @__PURE__ */ jsx("p", { className: "pos-col__empty", children: "Nenhum" })
5042
- ] })
5043
- ]
5044
- },
5045
- name
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
+ column.length === 0 && ghosts.every((g) => deliveryColumnOf(g.from)?.name !== name) && /* @__PURE__ */ jsx("p", { className: "pos-col__empty", children: "Nenhum" })
5047
+ ] })
5048
+ ]
5049
+ },
5050
+ name
5051
+ );
5052
+ })
5053
+ ] })
5048
5054
  ] });
5049
5055
  }
5050
5056
  function dueLabel(p, now) {
5051
- if (!p.dueAt) return "\u2014";
5057
+ if (!p.dueAt) {
5058
+ if (!p.openedAt) return "sem hor\xE1rio";
5059
+ const age = Math.max(0, Math.floor((now - new Date(p.openedAt).getTime()) / 6e4));
5060
+ return age < 1 ? "agora" : `h\xE1 ${age}min`;
5061
+ }
5052
5062
  const minutes = Math.ceil((new Date(p.dueAt).getTime() - now) / 6e4);
5053
5063
  return minutes <= 0 ? "agora" : `em ${minutes}min`;
5054
5064
  }