@fayz-ai/plugin-menu 0.10.6 → 0.10.8
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/{MenuPage-ZFBHFDZI.js → MenuPage-SO7EDR6R.js} +98 -65
- package/dist/MenuPage-SO7EDR6R.js.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/locales/en.d.ts.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/views/MenuManagerView.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/MenuPage-ZFBHFDZI.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { normalizeExtraction, normalizeName } from './chunk-C6W53TML.js';
|
|
2
|
-
import { createPluginContext, useAgentSurface, askAI, RightRailPage, formatCurrency, requestChatUpload } from '@fayz-ai/admin';
|
|
2
|
+
import { createPluginContext, PageActions, useAgentSurface, askAI, RightRailPage, formatCurrency, requestChatUpload } from '@fayz-ai/admin';
|
|
3
3
|
import { useState, useMemo, useEffect } from 'react';
|
|
4
|
-
import { Sparkles,
|
|
4
|
+
import { Plus, Sparkles, Search, UtensilsCrossed, MoreVertical, Pencil, Copy, Power, Eye, Trash2, GripVertical, ChevronRight, ChevronDown, Loader2, MoreHorizontal, X, ImageOff, Star, XCircle } from 'lucide-react';
|
|
5
5
|
import { useSensors, useSensor, PointerSensor, DndContext, closestCenter, DragOverlay } from '@dnd-kit/core';
|
|
6
6
|
import { SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
|
|
7
7
|
import { useTranslation, getSupabaseClientOptional } from '@fayz-ai/core';
|
|
8
|
-
import { PageHeaderActions, Button,
|
|
8
|
+
import { PageHeaderActions, PageTabs, Button, toast, ConfirmDialog, Dropdown, DropdownTrigger, Hint, DropdownContent, DropdownItem, DropdownSeparator, DraftCommitBar, SheetBody, Input, Switch, SheetFooter, ImageDrop, CurrencyInput, SegmentedControl, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, TimePicker } from '@fayz-ai/ui';
|
|
9
9
|
import { CSS } from '@dnd-kit/utilities';
|
|
10
10
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
11
|
|
|
@@ -1549,24 +1549,79 @@ function MenuManagerView() {
|
|
|
1549
1549
|
setConfirm(null);
|
|
1550
1550
|
};
|
|
1551
1551
|
const scheduleLabel = activeMenu ? describeAvailability(activeMenu.availability, currency.locale, t("menu.schedule.always")) : "";
|
|
1552
|
-
|
|
1553
|
-
/* @__PURE__ */ jsx(
|
|
1554
|
-
|
|
1555
|
-
|
|
1552
|
+
const menuActions = (menu) => /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
1553
|
+
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Hint, { label: t("menu.manager.menuActions"), children: /* @__PURE__ */ jsx(
|
|
1554
|
+
Button,
|
|
1555
|
+
{
|
|
1556
|
+
variant: "ghost",
|
|
1557
|
+
size: "icon",
|
|
1558
|
+
className: "-mr-1 h-5 w-5 rounded-full text-muted-foreground hover:text-foreground focus-visible:ring-1 focus-visible:ring-offset-0",
|
|
1559
|
+
"aria-label": `${t("menu.manager.menuActions")} \u2014 ${menu.name}`,
|
|
1560
|
+
children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3.5 w-3.5" })
|
|
1561
|
+
}
|
|
1562
|
+
) }) }),
|
|
1563
|
+
/* @__PURE__ */ jsxs(DropdownContent, { align: "start", children: [
|
|
1564
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onClick: () => setMenuEditor({ open: true, editing: true }), children: [
|
|
1565
|
+
/* @__PURE__ */ jsx(Pencil, { className: "mr-2 h-3.5 w-3.5" }),
|
|
1556
1566
|
" ",
|
|
1557
|
-
t("menu.
|
|
1567
|
+
t("menu.manager.editMenu")
|
|
1558
1568
|
] }),
|
|
1559
|
-
/* @__PURE__ */ jsxs(
|
|
1560
|
-
/* @__PURE__ */ jsx(
|
|
1569
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onClick: () => void duplicateMenu(menu.id, `${menu.name} (c\xF3pia)`), children: [
|
|
1570
|
+
/* @__PURE__ */ jsx(Copy, { className: "mr-2 h-3.5 w-3.5" }),
|
|
1561
1571
|
" ",
|
|
1562
|
-
t("menu.
|
|
1572
|
+
t("menu.manager.duplicateMenu")
|
|
1563
1573
|
] }),
|
|
1564
|
-
|
|
1565
|
-
/* @__PURE__ */ jsx(
|
|
1574
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onClick: () => void updateMenu(menu.id, { isActive: !menu.isActive }), children: [
|
|
1575
|
+
/* @__PURE__ */ jsx(Power, { className: "mr-2 h-3.5 w-3.5" }),
|
|
1576
|
+
menu.isActive ? t("menu.manager.deactivateMenu") : t("menu.manager.activateMenu")
|
|
1577
|
+
] }),
|
|
1578
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onClick: () => setPreviewOpen(true), children: [
|
|
1579
|
+
/* @__PURE__ */ jsx(Eye, { className: "mr-2 h-3.5 w-3.5" }),
|
|
1566
1580
|
" ",
|
|
1567
|
-
t("menu.
|
|
1568
|
-
] })
|
|
1569
|
-
|
|
1581
|
+
t("menu.preview.action")
|
|
1582
|
+
] }),
|
|
1583
|
+
/* @__PURE__ */ jsx(DropdownSeparator, {}),
|
|
1584
|
+
/* @__PURE__ */ jsxs(
|
|
1585
|
+
DropdownItem,
|
|
1586
|
+
{
|
|
1587
|
+
className: "text-destructive focus:text-destructive",
|
|
1588
|
+
onClick: () => setConfirm({ kind: "menu", id: menu.id, name: menu.name }),
|
|
1589
|
+
children: [
|
|
1590
|
+
/* @__PURE__ */ jsx(Trash2, { className: "mr-2 h-3.5 w-3.5" }),
|
|
1591
|
+
" ",
|
|
1592
|
+
t("menu.manager.deleteMenu")
|
|
1593
|
+
]
|
|
1594
|
+
}
|
|
1595
|
+
)
|
|
1596
|
+
] })
|
|
1597
|
+
] });
|
|
1598
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
1599
|
+
/* @__PURE__ */ jsx(PageHeaderActions, { children: /* @__PURE__ */ jsx(
|
|
1600
|
+
PageActions,
|
|
1601
|
+
{
|
|
1602
|
+
actions: [
|
|
1603
|
+
...multiMenu ? [{
|
|
1604
|
+
id: "new-menu",
|
|
1605
|
+
label: t("menu.manager.newMenu"),
|
|
1606
|
+
icon: Plus,
|
|
1607
|
+
intent: "primary",
|
|
1608
|
+
creates: true,
|
|
1609
|
+
onSelect: () => setMenuEditor({ open: true })
|
|
1610
|
+
}] : [],
|
|
1611
|
+
...extractor ? [{
|
|
1612
|
+
id: "ai-import",
|
|
1613
|
+
label: t("menu.import.action"),
|
|
1614
|
+
description: t("menu.import.actionDesc"),
|
|
1615
|
+
icon: Sparkles,
|
|
1616
|
+
// Sem vários cardápios não há botão de criar para se esconder
|
|
1617
|
+
// atrás: aqui ELA é a maneira de cadastrar.
|
|
1618
|
+
intent: multiMenu ? "secondary" : "primary",
|
|
1619
|
+
creates: true,
|
|
1620
|
+
onSelect: () => startAiImport()
|
|
1621
|
+
}] : []
|
|
1622
|
+
]
|
|
1623
|
+
}
|
|
1624
|
+
) }),
|
|
1570
1625
|
multiMenu && /* @__PURE__ */ jsx(
|
|
1571
1626
|
PageTabs,
|
|
1572
1627
|
{
|
|
@@ -1574,56 +1629,34 @@ function MenuManagerView() {
|
|
|
1574
1629
|
"aria-label": t("menu.manager.newMenu"),
|
|
1575
1630
|
value: activeMenuId ?? menus[0]?.id ?? "",
|
|
1576
1631
|
onChange: (id) => void openMenu(id),
|
|
1577
|
-
tabs: menus.map((menu) =>
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1632
|
+
tabs: menus.map((menu) => {
|
|
1633
|
+
const isOpen = menu.id === (activeMenuId ?? menus[0]?.id);
|
|
1634
|
+
return {
|
|
1635
|
+
value: menu.id,
|
|
1636
|
+
label: menu.name,
|
|
1637
|
+
count: menu.itemCount ?? 0,
|
|
1638
|
+
// A bolinha continua marcando os cardápios que NÃO estão abertos
|
|
1639
|
+
// — é ali que ela responde uma pergunta ("qual está servindo
|
|
1640
|
+
// agora?"). No aberto, o lugar é do menu de ações dele.
|
|
1641
|
+
badge: isOpen ? void 0 : /* @__PURE__ */ jsx(
|
|
1642
|
+
"span",
|
|
1643
|
+
{
|
|
1644
|
+
"aria-hidden": true,
|
|
1645
|
+
className: `ml-0.5 h-1.5 w-1.5 rounded-full ${menu.isActive && isServingAt(menu.availability) ? "bg-success" : "bg-muted-foreground/30"}`
|
|
1646
|
+
}
|
|
1647
|
+
),
|
|
1648
|
+
// Cardápio desligado: a aba inteira enfraquece. A etiqueta
|
|
1649
|
+
// "desativado" abaixo dizia isso em texto, longe do nome do
|
|
1650
|
+
// cardápio a que se referia.
|
|
1651
|
+
dim: !menu.isActive,
|
|
1652
|
+
trailing: isOpen ? menuActions(menu) : void 0
|
|
1653
|
+
};
|
|
1654
|
+
})
|
|
1589
1655
|
}
|
|
1590
1656
|
),
|
|
1591
|
-
activeMenu && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1657
|
+
activeMenu && !isAlwaysAvailable(activeMenu.availability) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1592
1658
|
/* @__PURE__ */ jsx("span", { children: scheduleLabel }),
|
|
1593
|
-
|
|
1594
|
-
!activeMenu.isActive && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium", children: t("menu.manager.menuOff") }),
|
|
1595
|
-
multiMenu && /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
1596
|
-
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx("button", { className: "rounded px-1.5 py-0.5 text-[11px] underline-offset-2 hover:underline", children: t("menu.manager.menuActions") }) }),
|
|
1597
|
-
/* @__PURE__ */ jsxs(DropdownContent, { align: "start", children: [
|
|
1598
|
-
/* @__PURE__ */ jsxs(DropdownItem, { onClick: () => setMenuEditor({ open: true, editing: true }), children: [
|
|
1599
|
-
/* @__PURE__ */ jsx(Pencil, { className: "mr-2 h-3.5 w-3.5" }),
|
|
1600
|
-
" ",
|
|
1601
|
-
t("menu.manager.editMenu")
|
|
1602
|
-
] }),
|
|
1603
|
-
/* @__PURE__ */ jsxs(DropdownItem, { onClick: () => void duplicateMenu(activeMenu.id, `${activeMenu.name} (c\xF3pia)`), children: [
|
|
1604
|
-
/* @__PURE__ */ jsx(Copy, { className: "mr-2 h-3.5 w-3.5" }),
|
|
1605
|
-
" ",
|
|
1606
|
-
t("menu.manager.duplicateMenu")
|
|
1607
|
-
] }),
|
|
1608
|
-
/* @__PURE__ */ jsxs(DropdownItem, { onClick: () => void updateMenu(activeMenu.id, { isActive: !activeMenu.isActive }), children: [
|
|
1609
|
-
/* @__PURE__ */ jsx(Eye, { className: "mr-2 h-3.5 w-3.5" }),
|
|
1610
|
-
activeMenu.isActive ? t("menu.manager.deactivateMenu") : t("menu.manager.activateMenu")
|
|
1611
|
-
] }),
|
|
1612
|
-
/* @__PURE__ */ jsx(DropdownSeparator, {}),
|
|
1613
|
-
/* @__PURE__ */ jsxs(
|
|
1614
|
-
DropdownItem,
|
|
1615
|
-
{
|
|
1616
|
-
className: "text-destructive focus:text-destructive",
|
|
1617
|
-
onClick: () => setConfirm({ kind: "menu", id: activeMenu.id, name: activeMenu.name }),
|
|
1618
|
-
children: [
|
|
1619
|
-
/* @__PURE__ */ jsx(Trash2, { className: "mr-2 h-3.5 w-3.5" }),
|
|
1620
|
-
" ",
|
|
1621
|
-
t("menu.manager.deleteMenu")
|
|
1622
|
-
]
|
|
1623
|
-
}
|
|
1624
|
-
)
|
|
1625
|
-
] })
|
|
1626
|
-
] })
|
|
1659
|
+
/* @__PURE__ */ jsx("span", { className: `rounded-full px-2 py-0.5 text-[10px] font-medium ${isServingAt(activeMenu.availability) ? "bg-success-soft text-success-soft-foreground" : "bg-muted"}`, children: isServingAt(activeMenu.availability) ? t("menu.manager.servingNow") : t("menu.manager.notServing") })
|
|
1627
1660
|
] }),
|
|
1628
1661
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1629
1662
|
/* @__PURE__ */ jsxs("div", { className: "relative min-w-[12rem] flex-1", children: [
|
|
@@ -1786,5 +1819,5 @@ function MenuPage({ config, provider, store, registries }) {
|
|
|
1786
1819
|
}
|
|
1787
1820
|
|
|
1788
1821
|
export { MenuPage };
|
|
1789
|
-
//# sourceMappingURL=MenuPage-
|
|
1790
|
-
//# sourceMappingURL=MenuPage-
|
|
1822
|
+
//# sourceMappingURL=MenuPage-SO7EDR6R.js.map
|
|
1823
|
+
//# sourceMappingURL=MenuPage-SO7EDR6R.js.map
|