@fayz-ai/plugin-menu 0.10.7 → 0.10.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/{MenuPage-SO7EDR6R.js → MenuPage-GC6ATJTT.js} +100 -104
- package/dist/MenuPage-GC6ATJTT.js.map +1 -0
- package/dist/chunk-FVDAVCK4.js +14 -0
- package/dist/chunk-FVDAVCK4.js.map +1 -0
- package/dist/components/DraftSectionCard.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-surface.d.ts +12 -0
- package/dist/lib/agent-surface.d.ts.map +1 -1
- package/dist/locales/en.d.ts.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/store.d.ts +18 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/views/MenuManagerView.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/MenuPage-SO7EDR6R.js.map +0 -1
- package/dist/chunk-C6W53TML.js +0 -65
- package/dist/chunk-C6W53TML.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { normalizeName, countExtracted } from './chunk-FVDAVCK4.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { registerTranslations, createSafeDataProvider, tl, getSupabaseClientOptional, getActiveTenantId } from '@fayz-ai/core';
|
|
4
4
|
import { createStore } from 'zustand/vanilla';
|
|
@@ -2205,6 +2205,50 @@ function createMenuStore(rawProvider) {
|
|
|
2205
2205
|
const sections = draft.sections.filter((section) => section.key !== sectionKey);
|
|
2206
2206
|
set({ draft: sections.length > 0 ? { ...draft, sections } : null });
|
|
2207
2207
|
},
|
|
2208
|
+
stageDraft(input) {
|
|
2209
|
+
const existing = get().sections;
|
|
2210
|
+
const { placements, menuItems } = get();
|
|
2211
|
+
const itemNames = (sectionId) => new Set(
|
|
2212
|
+
placements.filter((p) => p.sectionId === sectionId).map((p) => normalizeName(menuItems.find((i) => i.id === p.itemId)?.name ?? "")).filter(Boolean)
|
|
2213
|
+
);
|
|
2214
|
+
let key = 0;
|
|
2215
|
+
let duplicatesDropped = 0;
|
|
2216
|
+
const seenSections = /* @__PURE__ */ new Set();
|
|
2217
|
+
const sections = [];
|
|
2218
|
+
for (const section of input) {
|
|
2219
|
+
const sectionKey = normalizeName(section.name);
|
|
2220
|
+
if (!sectionKey || seenSections.has(sectionKey)) continue;
|
|
2221
|
+
seenSections.add(sectionKey);
|
|
2222
|
+
const target = existing.find((s) => normalizeName(s.name) === sectionKey);
|
|
2223
|
+
const already = target ? itemNames(target.id) : /* @__PURE__ */ new Set();
|
|
2224
|
+
const seenItems = /* @__PURE__ */ new Set();
|
|
2225
|
+
const items = [];
|
|
2226
|
+
for (const item of section.items ?? []) {
|
|
2227
|
+
const itemKey = normalizeName(item.name);
|
|
2228
|
+
if (!itemKey) continue;
|
|
2229
|
+
if (already.has(itemKey) || seenItems.has(itemKey)) {
|
|
2230
|
+
duplicatesDropped++;
|
|
2231
|
+
continue;
|
|
2232
|
+
}
|
|
2233
|
+
seenItems.add(itemKey);
|
|
2234
|
+
items.push({
|
|
2235
|
+
key: `di-${++key}`,
|
|
2236
|
+
name: item.name,
|
|
2237
|
+
price: Number(item.price) || 0,
|
|
2238
|
+
description: item.description
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
if (items.length === 0) continue;
|
|
2242
|
+
sections.push({ key: `ds-${++key}`, name: section.name, targetSectionId: target?.id, items });
|
|
2243
|
+
}
|
|
2244
|
+
const draft = sections.length > 0 ? { source: "chat", sections } : null;
|
|
2245
|
+
set({ draft });
|
|
2246
|
+
return {
|
|
2247
|
+
sections: sections.length,
|
|
2248
|
+
items: sections.reduce((sum, s) => sum + s.items.length, 0),
|
|
2249
|
+
duplicatesDropped
|
|
2250
|
+
};
|
|
2251
|
+
},
|
|
2208
2252
|
discardDraft() {
|
|
2209
2253
|
set({ draft: null });
|
|
2210
2254
|
},
|
|
@@ -2247,6 +2291,7 @@ function createMenuStore(rawProvider) {
|
|
|
2247
2291
|
}
|
|
2248
2292
|
}
|
|
2249
2293
|
await get().fetchMenus();
|
|
2294
|
+
await get().fetchMenuItems(get().menuItemQuery ?? {});
|
|
2250
2295
|
void get().fetchSummary();
|
|
2251
2296
|
return result;
|
|
2252
2297
|
}
|
|
@@ -2436,6 +2481,7 @@ var en = {
|
|
|
2436
2481
|
"menu.import.actionDesc": "Send photos of the printed menu and the assistant fills it in for you.",
|
|
2437
2482
|
"menu.import.uploadCta": "Upload a photo of the menu",
|
|
2438
2483
|
"menu.import.uploadHint": "One photo per page, straight on, no glare. Several at once is fine.",
|
|
2484
|
+
"menu.import.photoSentPrompt": "Here is a photo of my menu. Please read it and register it for me.",
|
|
2439
2485
|
"menu.import.askPrompt": "I want to add my menu from photos.",
|
|
2440
2486
|
"menu.import.askHint": "Describe the menu, or ask to start from photos\u2026",
|
|
2441
2487
|
"menu.import.askPersona": "Menu setup",
|
|
@@ -2445,6 +2491,7 @@ var en = {
|
|
|
2445
2491
|
"menu.import.askSuggestion.1": "Create a weekday lunch menu",
|
|
2446
2492
|
"menu.import.askSuggestion.2": "Add a desserts section",
|
|
2447
2493
|
"menu.import.createSection": "Create new section",
|
|
2494
|
+
"menu.import.destination": "Goes into",
|
|
2448
2495
|
"menu.import.intoSection": "Add into: {{name}}",
|
|
2449
2496
|
"menu.import.willAppend": "goes into {{name}}",
|
|
2450
2497
|
"menu.import.dropItem": "Drop item",
|
|
@@ -2578,6 +2625,7 @@ var ptBR = {
|
|
|
2578
2625
|
"menu.import.actionDesc": "Mande fotos do card\xE1pio impresso e o assistente cadastra por voc\xEA.",
|
|
2579
2626
|
"menu.import.uploadCta": "Subir foto do card\xE1pio",
|
|
2580
2627
|
"menu.import.uploadHint": "Uma foto por p\xE1gina, de frente e sem reflexo. Pode mandar v\xE1rias.",
|
|
2628
|
+
"menu.import.photoSentPrompt": "Aqui est\xE1 a foto do meu card\xE1pio. L\xEA e cadastra pra mim, por favor.",
|
|
2581
2629
|
"menu.import.askPrompt": "Quero cadastrar meu card\xE1pio a partir de fotos.",
|
|
2582
2630
|
"menu.import.askHint": "Descreva o card\xE1pio, ou pe\xE7a para come\xE7ar pelas fotos\u2026",
|
|
2583
2631
|
"menu.import.askPersona": "Cadastro de card\xE1pio",
|
|
@@ -2587,6 +2635,7 @@ var ptBR = {
|
|
|
2587
2635
|
"menu.import.askSuggestion.1": "Cria um card\xE1pio executivo de segunda a sexta",
|
|
2588
2636
|
"menu.import.askSuggestion.2": "Adiciona uma se\xE7\xE3o de sobremesas",
|
|
2589
2637
|
"menu.import.createSection": "Criar se\xE7\xE3o nova",
|
|
2638
|
+
"menu.import.destination": "Onde entra",
|
|
2590
2639
|
"menu.import.intoSection": "Somar em: {{name}}",
|
|
2591
2640
|
"menu.import.willAppend": "entra em {{name}}",
|
|
2592
2641
|
"menu.import.dropItem": "Descartar item",
|
|
@@ -2948,7 +2997,7 @@ function createFayzMenuProvider(options = {}) {
|
|
|
2948
2997
|
}
|
|
2949
2998
|
|
|
2950
2999
|
// src/index.ts
|
|
2951
|
-
var MenuPage = React.lazy(() => import('./MenuPage-
|
|
3000
|
+
var MenuPage = React.lazy(() => import('./MenuPage-GC6ATJTT.js').then((m) => ({ default: m.MenuPage })));
|
|
2952
3001
|
var DEFAULT_LABELS = {
|
|
2953
3002
|
pageTitle: "Menu",
|
|
2954
3003
|
menuManager: "Menu Manager",
|
|
@@ -3097,6 +3146,6 @@ function createMenuPlugin(options) {
|
|
|
3097
3146
|
};
|
|
3098
3147
|
}
|
|
3099
3148
|
|
|
3100
|
-
export { createFayzMenuProvider, createMenuPlugin };
|
|
3149
|
+
export { createFayzMenuProvider, createMenuPlugin, createSupabaseMenuProvider };
|
|
3101
3150
|
//# sourceMappingURL=index.js.map
|
|
3102
3151
|
//# sourceMappingURL=index.js.map
|