restaurant-kit 0.1.0
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/LICENSE +21 -0
- package/README.md +488 -0
- package/dist/RestaurantSiteRoutes.js +23 -0
- package/dist/admin/AdminActionMenu.js +29 -0
- package/dist/admin/AdminAuthPanel.js +53 -0
- package/dist/admin/AdminBackupsDialog.js +54 -0
- package/dist/admin/AdminDraftProvider.js +10 -0
- package/dist/admin/AdminGroupsPanel.js +68 -0
- package/dist/admin/AdminItemDrawer.js +264 -0
- package/dist/admin/AdminMenuCard.js +63 -0
- package/dist/admin/AdminMenuEditor.module.css.js +209 -0
- package/dist/admin/AdminMenuGroupTabs.js +43 -0
- package/dist/admin/AdminMenuIconPicker.js +39 -0
- package/dist/admin/AdminRoutes.js +13 -0
- package/dist/admin/AdminSectionEditor.js +104 -0
- package/dist/admin/AdminTestimonialsPanel.js +214 -0
- package/dist/admin/AdminTestimonialsPanel.module.css.js +29 -0
- package/dist/admin/adminDraftContext.js +5 -0
- package/dist/admin/adminEditorUtils.js +47 -0
- package/dist/admin/adminMenuCommands.js +83 -0
- package/dist/admin/useAdminDraft.js +14 -0
- package/dist/admin/useAdminMenuDraft.js +226 -0
- package/dist/cart/CartDrawer.js +87 -0
- package/dist/cart/CartDrawer.module.css.js +47 -0
- package/dist/cart/CartProvider.js +31 -0
- package/dist/cart/cartContext.js +5 -0
- package/dist/cart/cartOrder.js +34 -0
- package/dist/cart/cartReducer.js +57 -0
- package/dist/cart/useCart.js +10 -0
- package/dist/components/Brand.js +16 -0
- package/dist/components/Brand.module.css.js +15 -0
- package/dist/components/Footer.js +19 -0
- package/dist/components/Footer.module.css.js +11 -0
- package/dist/components/Header.js +34 -0
- package/dist/components/Header.module.css.js +19 -0
- package/dist/components/Hero.js +23 -0
- package/dist/components/Hero.module.css.js +15 -0
- package/dist/components/InstagramIcon.js +27 -0
- package/dist/components/LocationsSection.js +34 -0
- package/dist/components/LocationsSection.module.css.js +17 -0
- package/dist/components/Marquee.js +10 -0
- package/dist/components/Marquee.module.css.js +9 -0
- package/dist/components/OrderIcon.js +11 -0
- package/dist/components/RatingSection.js +32 -0
- package/dist/components/RatingSection.module.css.js +19 -0
- package/dist/components/TestimonialsSection.js +73 -0
- package/dist/components/TestimonialsSection.module.css.js +37 -0
- package/dist/components/WhatsAppIcon.js +13 -0
- package/dist/config/RestaurantKitProvider.js +26 -0
- package/dist/config/siteConfigContext.js +23 -0
- package/dist/config/useOrdering.js +12 -0
- package/dist/index.js +92 -0
- package/dist/menu/localMenuApi.js +43 -0
- package/dist/menu/menuApi.js +121 -0
- package/dist/menu/menuDraftStorage.js +35 -0
- package/dist/menu/menuIcons.js +24 -0
- package/dist/menu/menuMutations.js +99 -0
- package/dist/menu/menuOrdering.js +94 -0
- package/dist/menu/menuSchema.js +4 -0
- package/dist/menu/priceFormat.js +39 -0
- package/dist/menu/useMenuData.js +38 -0
- package/dist/menu/validateMenu.js +63 -0
- package/dist/menu-browser/MenuBrowser.js +54 -0
- package/dist/menu-browser/MenuBrowser.module.css.js +153 -0
- package/dist/menu-browser/MenuCard.js +106 -0
- package/dist/menu-browser/MenuCartDrawer.js +18 -0
- package/dist/menu-browser/MenuCategoryBlock.js +45 -0
- package/dist/menu-browser/MenuItemSheet.js +132 -0
- package/dist/menu-browser/MenuLightbox.js +33 -0
- package/dist/menu-browser/MenuRow.js +43 -0
- package/dist/menu-browser/MenuSection.js +10 -0
- package/dist/menu-browser/menuItemDisplay.js +19 -0
- package/dist/menu-browser/useMediaQuery.js +19 -0
- package/dist/menu-browser/useMenuBrowserState.js +82 -0
- package/dist/menu-browser/useParkedSheet.js +32 -0
- package/dist/pages/AdminMenuEditor.js +291 -0
- package/dist/pages/AdminPreview.js +43 -0
- package/dist/pages/AdminPreview.module.css.js +9 -0
- package/dist/pages/MenuSite.js +40 -0
- package/dist/restaurant-kit.css +1 -0
- package/dist/testimonials/downscaleImage.js +14 -0
- package/dist/testimonials/testimonialMutations.js +52 -0
- package/dist/types/RestaurantSiteRoutes.d.ts +11 -0
- package/dist/types/admin/AdminActionMenu.d.ts +20 -0
- package/dist/types/admin/AdminAuthPanel.d.ts +13 -0
- package/dist/types/admin/AdminBackupsDialog.d.ts +9 -0
- package/dist/types/admin/AdminDraftProvider.d.ts +12 -0
- package/dist/types/admin/AdminGroupsPanel.d.ts +14 -0
- package/dist/types/admin/AdminItemDrawer.d.ts +16 -0
- package/dist/types/admin/AdminMenuCard.d.ts +10 -0
- package/dist/types/admin/AdminMenuGroupTabs.d.ts +11 -0
- package/dist/types/admin/AdminMenuIconPicker.d.ts +8 -0
- package/dist/types/admin/AdminRoutes.d.ts +5 -0
- package/dist/types/admin/AdminSectionEditor.d.ts +20 -0
- package/dist/types/admin/AdminTestimonialsPanel.d.ts +7 -0
- package/dist/types/admin/adminDraftContext.d.ts +2 -0
- package/dist/types/admin/adminEditorUtils.d.ts +22 -0
- package/dist/types/admin/adminMenuCommands.d.ts +73 -0
- package/dist/types/admin/useAdminDraft.d.ts +5 -0
- package/dist/types/admin/useAdminMenuDraft.d.ts +41 -0
- package/dist/types/cart/CartDrawer.d.ts +7 -0
- package/dist/types/cart/CartProvider.d.ts +4 -0
- package/dist/types/cart/cartContext.d.ts +2 -0
- package/dist/types/cart/cartOrder.d.ts +9 -0
- package/dist/types/cart/cartReducer.d.ts +36 -0
- package/dist/types/cart/cartTypes.d.ts +37 -0
- package/dist/types/cart/useCart.d.ts +1 -0
- package/dist/types/components/Brand.d.ts +5 -0
- package/dist/types/components/Footer.d.ts +1 -0
- package/dist/types/components/Header.d.ts +1 -0
- package/dist/types/components/Hero.d.ts +1 -0
- package/dist/types/components/InstagramIcon.d.ts +6 -0
- package/dist/types/components/LocationsSection.d.ts +1 -0
- package/dist/types/components/Marquee.d.ts +1 -0
- package/dist/types/components/OrderIcon.d.ts +4 -0
- package/dist/types/components/RatingSection.d.ts +1 -0
- package/dist/types/components/TestimonialsSection.d.ts +2 -0
- package/dist/types/components/WhatsAppIcon.d.ts +5 -0
- package/dist/types/config/RestaurantKitProvider.d.ts +24 -0
- package/dist/types/config/siteConfigContext.d.ts +28 -0
- package/dist/types/config/siteTypes.d.ts +50 -0
- package/dist/types/config/useOrdering.d.ts +16 -0
- package/dist/types/index.d.ts +38 -0
- package/dist/types/menu/localMenuApi.d.ts +9 -0
- package/dist/types/menu/menuApi.d.ts +68 -0
- package/dist/types/menu/menuDraftStorage.d.ts +5 -0
- package/dist/types/menu/menuIcons.d.ts +7 -0
- package/dist/types/menu/menuMutations.d.ts +13 -0
- package/dist/types/menu/menuOrdering.d.ts +38 -0
- package/dist/types/menu/menuSchema.d.ts +68 -0
- package/dist/types/menu/priceFormat.d.ts +8 -0
- package/dist/types/menu/useMenuData.d.ts +12 -0
- package/dist/types/menu/validateMenu.d.ts +16 -0
- package/dist/types/menu-browser/MenuBrowser.d.ts +6 -0
- package/dist/types/menu-browser/MenuCard.d.ts +7 -0
- package/dist/types/menu-browser/MenuCartDrawer.d.ts +5 -0
- package/dist/types/menu-browser/MenuCategoryBlock.d.ts +11 -0
- package/dist/types/menu-browser/MenuItemSheet.d.ts +10 -0
- package/dist/types/menu-browser/MenuLightbox.d.ts +9 -0
- package/dist/types/menu-browser/MenuRow.d.ts +7 -0
- package/dist/types/menu-browser/MenuSection.d.ts +1 -0
- package/dist/types/menu-browser/menuItemDisplay.d.ts +5 -0
- package/dist/types/menu-browser/useMediaQuery.d.ts +1 -0
- package/dist/types/menu-browser/useMenuBrowserState.d.ts +17 -0
- package/dist/types/menu-browser/useParkedSheet.d.ts +13 -0
- package/dist/types/pages/AdminMenuEditor.d.ts +1 -0
- package/dist/types/pages/AdminPreview.d.ts +1 -0
- package/dist/types/pages/MenuSite.d.ts +6 -0
- package/dist/types/testimonials/downscaleImage.d.ts +6 -0
- package/dist/types/testimonials/testimonialMutations.d.ts +9 -0
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/worker/auth.d.ts +97 -0
- package/dist/types/worker/http.d.ts +17 -0
- package/dist/types/worker/index.d.ts +16 -0
- package/dist/types/worker/menuStorage.d.ts +94 -0
- package/dist/utils.js +6 -0
- package/dist/worker/auth.js +183 -0
- package/dist/worker/http.js +65 -0
- package/dist/worker/menuStorage.js +95 -0
- package/dist/worker.js +131 -0
- package/package.json +105 -0
- package/scripts/bootstrap-site.mjs +125 -0
- package/scripts/hash-admin-password.mjs +11 -0
- package/scripts/lib/password.mjs +72 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "@radix-ui/react-popover";
|
|
3
|
+
import { ChevronDown as u } from "lucide-react";
|
|
4
|
+
import { menuIcons as s, menuIconOptions as d } from "../menu/menuIcons.js";
|
|
5
|
+
import { cx as P } from "../utils.js";
|
|
6
|
+
import r from "./AdminMenuEditor.module.css.js";
|
|
7
|
+
function I({ label: a, value: n, onChange: l }) {
|
|
8
|
+
const m = s[n], h = d.find((i) => i.id === n)?.label ?? n;
|
|
9
|
+
return /* @__PURE__ */ c(o.Root, { children: [
|
|
10
|
+
/* @__PURE__ */ e(o.Trigger, { asChild: !0, children: /* @__PURE__ */ c("button", { className: r.iconPickerTrigger, type: "button", "aria-label": a, children: [
|
|
11
|
+
/* @__PURE__ */ e(m, { "aria-hidden": "true" }),
|
|
12
|
+
/* @__PURE__ */ e("span", { children: h }),
|
|
13
|
+
/* @__PURE__ */ e(u, { "aria-hidden": "true" })
|
|
14
|
+
] }) }),
|
|
15
|
+
/* @__PURE__ */ e(o.Portal, { children: /* @__PURE__ */ c(o.Content, { className: r.iconPickerPanel, align: "start", sideOffset: 8, collisionPadding: 12, children: [
|
|
16
|
+
/* @__PURE__ */ e("p", { className: r.iconPickerTitle, children: "Choose icon" }),
|
|
17
|
+
/* @__PURE__ */ e("div", { className: r.iconPickerGrid, children: d.map((i) => {
|
|
18
|
+
const p = s[i.id], t = i.id === n;
|
|
19
|
+
return /* @__PURE__ */ c(
|
|
20
|
+
"button",
|
|
21
|
+
{
|
|
22
|
+
className: P(r.iconPickerOption, t && r.selectedIconPickerOption),
|
|
23
|
+
type: "button",
|
|
24
|
+
"aria-pressed": t,
|
|
25
|
+
onClick: () => l(i.id),
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ e(p, { "aria-hidden": "true" }),
|
|
28
|
+
/* @__PURE__ */ e("span", { children: i.label })
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
i.id
|
|
32
|
+
);
|
|
33
|
+
}) })
|
|
34
|
+
] }) })
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
I as AdminMenuIconPicker
|
|
39
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Outlet as o } from "react-router-dom";
|
|
3
|
+
import { AdminMenuEditor as p } from "../pages/AdminMenuEditor.js";
|
|
4
|
+
import { AdminPreview as x } from "../pages/AdminPreview.js";
|
|
5
|
+
import { AdminDraftProvider as t } from "./AdminDraftProvider.js";
|
|
6
|
+
function n() {
|
|
7
|
+
return /* @__PURE__ */ r(t, { children: /* @__PURE__ */ r(o, {}) });
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
n as AdminLayout,
|
|
11
|
+
p as AdminMenuEditor,
|
|
12
|
+
x as AdminPreview
|
|
13
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsxs as e, jsx as i, Fragment as k } from "react/jsx-runtime";
|
|
2
|
+
import { EyeOff as u, Check as h, Plus as x, ArrowUp as D, ArrowDown as E, GripVertical as H, Eye as I, ArrowRightLeft as C, Trash2 as g } from "lucide-react";
|
|
3
|
+
import { cx as j } from "../utils.js";
|
|
4
|
+
import { AdminActionMenu as B, AdminActionItem as r, AdminActionSeparator as m, AdminActionSubMenu as F } from "./AdminActionMenu.js";
|
|
5
|
+
import { AdminMenuCard as G } from "./AdminMenuCard.js";
|
|
6
|
+
import l from "./AdminMenuEditor.module.css.js";
|
|
7
|
+
function z({
|
|
8
|
+
category: d,
|
|
9
|
+
groupLabel: b,
|
|
10
|
+
groups: p,
|
|
11
|
+
isFirstSection: A,
|
|
12
|
+
isLastSection: f,
|
|
13
|
+
isReordering: t,
|
|
14
|
+
items: o,
|
|
15
|
+
uploadingItemIds: v,
|
|
16
|
+
onAddItem: S,
|
|
17
|
+
onDeleteSection: w,
|
|
18
|
+
onEditItemDetails: M,
|
|
19
|
+
onFocusSection: N,
|
|
20
|
+
onMoveSection: c,
|
|
21
|
+
onToggleReorderItems: s,
|
|
22
|
+
onUpdateCategory: a
|
|
23
|
+
}) {
|
|
24
|
+
return /* @__PURE__ */ e("section", { className: l.categoryBlock, children: [
|
|
25
|
+
/* @__PURE__ */ e("div", { className: l.categoryHeading, children: [
|
|
26
|
+
/* @__PURE__ */ e("div", { children: [
|
|
27
|
+
/* @__PURE__ */ i("p", { children: b }),
|
|
28
|
+
/* @__PURE__ */ i(
|
|
29
|
+
"input",
|
|
30
|
+
{
|
|
31
|
+
"aria-label": `${d.title} section title`,
|
|
32
|
+
value: d.title,
|
|
33
|
+
onChange: (n) => a({ title: n.target.value }),
|
|
34
|
+
onFocus: N
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
d.isVisible ? null : /* @__PURE__ */ e("span", { className: l.sectionHiddenTag, children: [
|
|
38
|
+
/* @__PURE__ */ i(u, { "aria-hidden": "true" }),
|
|
39
|
+
"Hidden from public menu"
|
|
40
|
+
] })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ e("div", { className: l.categoryTools, children: [
|
|
43
|
+
t ? /* @__PURE__ */ e("button", { className: l.activeModeButton, type: "button", onClick: s, children: [
|
|
44
|
+
/* @__PURE__ */ i(h, { "aria-hidden": "true" }),
|
|
45
|
+
"Done reordering"
|
|
46
|
+
] }) : /* @__PURE__ */ e("button", { type: "button", onClick: S, children: [
|
|
47
|
+
/* @__PURE__ */ i(x, { "aria-hidden": "true" }),
|
|
48
|
+
"Add item"
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ e(B, { label: `${d.title} section actions`, children: [
|
|
51
|
+
/* @__PURE__ */ e(r, { disabled: A, onSelect: () => c(-1), children: [
|
|
52
|
+
/* @__PURE__ */ i(D, { "aria-hidden": "true" }),
|
|
53
|
+
"Move section up"
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ e(r, { disabled: f, onSelect: () => c(1), children: [
|
|
56
|
+
/* @__PURE__ */ i(E, { "aria-hidden": "true" }),
|
|
57
|
+
"Move section down"
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ e(r, { disabled: o.length < 2, onSelect: s, children: [
|
|
60
|
+
/* @__PURE__ */ i(H, { "aria-hidden": "true" }),
|
|
61
|
+
"Reorder items"
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ i(m, {}),
|
|
64
|
+
/* @__PURE__ */ e(r, { onSelect: () => a({ isVisible: !d.isVisible }), children: [
|
|
65
|
+
d.isVisible ? /* @__PURE__ */ i(u, { "aria-hidden": "true" }) : /* @__PURE__ */ i(I, { "aria-hidden": "true" }),
|
|
66
|
+
d.isVisible ? "Hide from public menu" : "Show on public menu"
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ i(
|
|
69
|
+
F,
|
|
70
|
+
{
|
|
71
|
+
label: /* @__PURE__ */ e(k, { children: [
|
|
72
|
+
/* @__PURE__ */ i(C, { "aria-hidden": "true" }),
|
|
73
|
+
"Move to group"
|
|
74
|
+
] }),
|
|
75
|
+
children: p.filter((n) => n.id !== "all").map((n) => /* @__PURE__ */ e(r, { disabled: n.id === d.groupId, onSelect: () => a({ groupId: n.id }), children: [
|
|
76
|
+
n.label,
|
|
77
|
+
n.id === d.groupId ? /* @__PURE__ */ i(h, { "aria-hidden": "true" }) : null
|
|
78
|
+
] }, n.id))
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ i(m, {}),
|
|
82
|
+
/* @__PURE__ */ e(r, { isDanger: !0, onSelect: w, children: [
|
|
83
|
+
/* @__PURE__ */ i(g, { "aria-hidden": "true" }),
|
|
84
|
+
"Delete section"
|
|
85
|
+
] })
|
|
86
|
+
] })
|
|
87
|
+
] })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ i("div", { className: j(l.grid, t && l.reorderingGrid), children: o.map((n, V) => /* @__PURE__ */ i(
|
|
90
|
+
G,
|
|
91
|
+
{
|
|
92
|
+
index: V,
|
|
93
|
+
isReordering: t,
|
|
94
|
+
item: n,
|
|
95
|
+
isUploadingImage: v.has(n.id),
|
|
96
|
+
onEdit: () => M(n.id)
|
|
97
|
+
},
|
|
98
|
+
n.id
|
|
99
|
+
)) })
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
z as AdminSectionEditor
|
|
104
|
+
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { jsxs as r, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Plus as $, ImagePlus as v, EyeOff as R, ArrowUp as E, ArrowDown as G, Pencil as P, Trash2 as y, Star as S } from "lucide-react";
|
|
3
|
+
import { useState as f } from "react";
|
|
4
|
+
import { toast as u } from "sonner";
|
|
5
|
+
import { useMenuApi as U } from "../config/siteConfigContext.js";
|
|
6
|
+
import { downscaleImage as D } from "../testimonials/downscaleImage.js";
|
|
7
|
+
import { sortedTestimonials as F, clampRating as p, moveTestimonial as C, createTestimonialDraft as K, addTestimonial as V, updateTestimonial as L, deleteTestimonial as M } from "../testimonials/testimonialMutations.js";
|
|
8
|
+
import { getApiErrorMessage as O } from "./adminEditorUtils.js";
|
|
9
|
+
import i from "./AdminMenuEditor.module.css.js";
|
|
10
|
+
import l from "./AdminTestimonialsPanel.module.css.js";
|
|
11
|
+
import { imageSrc as k } from "../menu-browser/menuItemDisplay.js";
|
|
12
|
+
const j = [1, 2, 3, 4, 5];
|
|
13
|
+
function ae({ menu: I, applyMenuMutation: c }) {
|
|
14
|
+
const w = U(), m = F(I), [x, h] = f(""), [n, b] = f(""), t = m.find((e) => e.id === x) ?? null, s = (e, o) => c((d) => L(d, e, o)), N = () => {
|
|
15
|
+
const e = K();
|
|
16
|
+
c((o) => V(o, e)), h(e.id);
|
|
17
|
+
}, g = (e) => {
|
|
18
|
+
e && w.deleteMenuImage(e).catch(() => {
|
|
19
|
+
});
|
|
20
|
+
}, T = (e) => {
|
|
21
|
+
window.confirm(`Delete the review from "${e.author || "this customer"}"?`) && (c((o) => M(o, e.id)), g(e.imageKey), h(""), u.success("Review deleted"));
|
|
22
|
+
}, A = async (e, o) => {
|
|
23
|
+
if (!o.type.startsWith("image/")) {
|
|
24
|
+
u.error("Choose an image file");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
b(e.id);
|
|
28
|
+
try {
|
|
29
|
+
const d = await w.uploadMenuImage(await D(o));
|
|
30
|
+
s(e.id, { image: d.url, imageKey: d.key }), g(e.imageKey), u.success("Photo uploaded");
|
|
31
|
+
} catch (d) {
|
|
32
|
+
u.error("Could not upload photo", { description: O(d) });
|
|
33
|
+
} finally {
|
|
34
|
+
b("");
|
|
35
|
+
}
|
|
36
|
+
}, B = (e) => {
|
|
37
|
+
s(e.id, { image: void 0, imageKey: void 0 }), g(e.imageKey);
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ r("section", { className: i.menuEditor, "aria-label": "Customer reviews", children: [
|
|
40
|
+
/* @__PURE__ */ r("div", { className: i.catalog, children: [
|
|
41
|
+
/* @__PURE__ */ r("div", { className: i.catalogActions, children: [
|
|
42
|
+
/* @__PURE__ */ r("div", { children: [
|
|
43
|
+
/* @__PURE__ */ a("p", { className: "micro-label", children: "Testimonials section" }),
|
|
44
|
+
/* @__PURE__ */ a("h2", { children: "Customer reviews" })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ a("div", { className: i.catalogButtons, children: /* @__PURE__ */ r("button", { className: i.primaryButton, type: "button", onClick: N, children: [
|
|
47
|
+
/* @__PURE__ */ a($, { "aria-hidden": "true" }),
|
|
48
|
+
"Add review"
|
|
49
|
+
] }) })
|
|
50
|
+
] }),
|
|
51
|
+
/* @__PURE__ */ a("p", { className: l.hint, children: "Copy reviews from your Google Maps page — the text, the customer's name, and the photo they posted. The section appears on the site once at least one review is visible, and disappears again when there are none. Changes go live when you publish." }),
|
|
52
|
+
m.length ? /* @__PURE__ */ a("ol", { className: l.list, children: m.map((e, o) => /* @__PURE__ */ r("li", { className: `${l.row} ${e.isVisible ? "" : l.hiddenRow}`, children: [
|
|
53
|
+
/* @__PURE__ */ a("div", { className: l.thumb, children: e.image ? /* @__PURE__ */ a("img", { src: k(e.image), alt: "" }) : /* @__PURE__ */ a(v, { "aria-hidden": "true" }) }),
|
|
54
|
+
/* @__PURE__ */ r("div", { className: l.rowText, children: [
|
|
55
|
+
/* @__PURE__ */ r("strong", { children: [
|
|
56
|
+
e.author || "Unnamed customer",
|
|
57
|
+
/* @__PURE__ */ a("span", { className: l.rowStars, "aria-label": `${p(e.rating)} stars`, children: "★".repeat(p(e.rating)) }),
|
|
58
|
+
e.isVisible ? null : /* @__PURE__ */ r("span", { className: l.hiddenBadge, children: [
|
|
59
|
+
/* @__PURE__ */ a(R, { "aria-hidden": "true" }),
|
|
60
|
+
"Hidden"
|
|
61
|
+
] })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ a("p", { children: e.text || "No review text yet — customers will not see this one." })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ r("div", { className: l.rowActions, children: [
|
|
66
|
+
/* @__PURE__ */ a(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
className: i.iconButton,
|
|
70
|
+
type: "button",
|
|
71
|
+
onClick: () => c((d) => C(d, e.id, -1)),
|
|
72
|
+
disabled: o === 0,
|
|
73
|
+
"aria-label": "Move review up",
|
|
74
|
+
children: /* @__PURE__ */ a(E, { "aria-hidden": "true" })
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ a(
|
|
78
|
+
"button",
|
|
79
|
+
{
|
|
80
|
+
className: i.iconButton,
|
|
81
|
+
type: "button",
|
|
82
|
+
onClick: () => c((d) => C(d, e.id, 1)),
|
|
83
|
+
disabled: o === m.length - 1,
|
|
84
|
+
"aria-label": "Move review down",
|
|
85
|
+
children: /* @__PURE__ */ a(G, { "aria-hidden": "true" })
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ r("button", { className: i.secondaryButton, type: "button", onClick: () => h(e.id), children: [
|
|
89
|
+
/* @__PURE__ */ a(P, { "aria-hidden": "true" }),
|
|
90
|
+
"Edit"
|
|
91
|
+
] })
|
|
92
|
+
] })
|
|
93
|
+
] }, e.id)) }) : /* @__PURE__ */ r("div", { className: i.emptyState, children: [
|
|
94
|
+
/* @__PURE__ */ a("h2", { children: "No reviews yet." }),
|
|
95
|
+
/* @__PURE__ */ a("button", { className: i.primaryButton, type: "button", onClick: N, children: "Add your first review" })
|
|
96
|
+
] })
|
|
97
|
+
] }),
|
|
98
|
+
t ? /* @__PURE__ */ r("aside", { className: i.editorDrawer, "aria-label": "Edit customer review", children: [
|
|
99
|
+
/* @__PURE__ */ r("div", { className: i.drawerHeader, children: [
|
|
100
|
+
/* @__PURE__ */ r("div", { children: [
|
|
101
|
+
/* @__PURE__ */ a("p", { className: "micro-label", children: "Edit review" }),
|
|
102
|
+
/* @__PURE__ */ a("h2", { children: t.author || "New review" })
|
|
103
|
+
] }),
|
|
104
|
+
/* @__PURE__ */ a("button", { className: i.iconButton, type: "button", onClick: () => h(""), "aria-label": "Close review editor", children: "x" })
|
|
105
|
+
] }),
|
|
106
|
+
/* @__PURE__ */ r("div", { className: i.drawerFields, children: [
|
|
107
|
+
/* @__PURE__ */ r("div", { className: i.drawerImageBlock, children: [
|
|
108
|
+
t.image ? /* @__PURE__ */ r("figure", { className: i.drawerMedia, children: [
|
|
109
|
+
/* @__PURE__ */ a("img", { src: k(t.image), alt: "" }),
|
|
110
|
+
/* @__PURE__ */ r("figcaption", { className: i.drawerImageOverlay, "aria-label": "Photo actions", children: [
|
|
111
|
+
/* @__PURE__ */ r("label", { className: i.drawerImageTool, htmlFor: "review-photo-upload", "aria-disabled": n === t.id, children: [
|
|
112
|
+
/* @__PURE__ */ a(v, { "aria-hidden": "true" }),
|
|
113
|
+
n === t.id ? "Uploading" : "Replace"
|
|
114
|
+
] }),
|
|
115
|
+
/* @__PURE__ */ r(
|
|
116
|
+
"button",
|
|
117
|
+
{
|
|
118
|
+
className: `${i.drawerImageTool} ${i.dangerImageTool}`,
|
|
119
|
+
type: "button",
|
|
120
|
+
onClick: () => B(t),
|
|
121
|
+
disabled: n === t.id,
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ a(y, { "aria-hidden": "true" }),
|
|
124
|
+
"Remove"
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] })
|
|
129
|
+
] }) : /* @__PURE__ */ r("label", { className: i.drawerMediaEmpty, htmlFor: "review-photo-upload", "aria-disabled": n === t.id, children: [
|
|
130
|
+
/* @__PURE__ */ a(v, { "aria-hidden": "true" }),
|
|
131
|
+
n === t.id ? "Uploading photo" : "Add the customer's photo (optional)"
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ a(
|
|
134
|
+
"input",
|
|
135
|
+
{
|
|
136
|
+
className: i.fileInput,
|
|
137
|
+
id: "review-photo-upload",
|
|
138
|
+
type: "file",
|
|
139
|
+
accept: "image/*",
|
|
140
|
+
disabled: n === t.id,
|
|
141
|
+
onChange: (e) => {
|
|
142
|
+
const o = e.target.files?.[0];
|
|
143
|
+
e.target.value = "", o && A(t, o);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ r("div", { className: i.fieldGroup, children: [
|
|
149
|
+
/* @__PURE__ */ a("label", { htmlFor: "review-author", children: "Customer name" }),
|
|
150
|
+
/* @__PURE__ */ a("input", { id: "review-author", value: t.author, onChange: (e) => s(t.id, { author: e.target.value }), placeholder: "e.g. Rami K." }),
|
|
151
|
+
/* @__PURE__ */ a("small", { children: "As shown on Google, or shortened if you prefer." })
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ r("div", { className: i.fieldGroup, children: [
|
|
154
|
+
/* @__PURE__ */ a("label", { id: "review-rating-label", children: "Rating" }),
|
|
155
|
+
/* @__PURE__ */ a("div", { className: l.ratingPicker, role: "radiogroup", "aria-labelledby": "review-rating-label", children: j.map((e) => /* @__PURE__ */ a(
|
|
156
|
+
"button",
|
|
157
|
+
{
|
|
158
|
+
className: e <= p(t.rating) ? l.filledStar : "",
|
|
159
|
+
type: "button",
|
|
160
|
+
role: "radio",
|
|
161
|
+
"aria-checked": e === p(t.rating),
|
|
162
|
+
"aria-label": `${e} ${e === 1 ? "star" : "stars"}`,
|
|
163
|
+
onClick: () => s(t.id, { rating: e }),
|
|
164
|
+
children: /* @__PURE__ */ a(S, { "aria-hidden": "true" })
|
|
165
|
+
},
|
|
166
|
+
e
|
|
167
|
+
)) })
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ r("div", { className: i.fieldGroup, children: [
|
|
170
|
+
/* @__PURE__ */ a("label", { htmlFor: "review-text", children: "Review" }),
|
|
171
|
+
/* @__PURE__ */ a(
|
|
172
|
+
"textarea",
|
|
173
|
+
{
|
|
174
|
+
id: "review-text",
|
|
175
|
+
className: `${i.drawerTextarea} ${l.reviewTextarea}`,
|
|
176
|
+
value: t.text,
|
|
177
|
+
onChange: (e) => s(t.id, { text: e.target.value }),
|
|
178
|
+
placeholder: "Paste the customer's words exactly as they wrote them."
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
/* @__PURE__ */ a("small", { children: "Long reviews are trimmed to about eight lines on the card." })
|
|
182
|
+
] }),
|
|
183
|
+
/* @__PURE__ */ r("div", { className: i.fieldGroup, children: [
|
|
184
|
+
/* @__PURE__ */ a("label", { htmlFor: "review-source", children: "Link to the review" }),
|
|
185
|
+
/* @__PURE__ */ a(
|
|
186
|
+
"input",
|
|
187
|
+
{
|
|
188
|
+
id: "review-source",
|
|
189
|
+
inputMode: "url",
|
|
190
|
+
value: t.sourceUrl ?? "",
|
|
191
|
+
onChange: (e) => s(t.id, { sourceUrl: e.target.value.trim() || void 0 }),
|
|
192
|
+
placeholder: "https://maps.app.goo.gl/…"
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
/* @__PURE__ */ a("small", { children: "Optional. In Google Maps: open the review → Share → copy link. Adds “Read on Google”." })
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ r("label", { className: i.checkboxLabel, children: [
|
|
198
|
+
/* @__PURE__ */ a("input", { type: "checkbox", checked: t.isVisible, onChange: (e) => s(t.id, { isVisible: e.target.checked }) }),
|
|
199
|
+
"Visible on the site"
|
|
200
|
+
] })
|
|
201
|
+
] }),
|
|
202
|
+
/* @__PURE__ */ r("div", { className: i.drawerActions, children: [
|
|
203
|
+
/* @__PURE__ */ r("button", { className: i.secondaryButton, type: "button", onClick: () => T(t), children: [
|
|
204
|
+
/* @__PURE__ */ a(y, { "aria-hidden": "true" }),
|
|
205
|
+
"Delete review"
|
|
206
|
+
] }),
|
|
207
|
+
/* @__PURE__ */ a("button", { className: i.primaryButton, type: "button", onClick: () => h(""), children: "Done" })
|
|
208
|
+
] })
|
|
209
|
+
] }) : null
|
|
210
|
+
] });
|
|
211
|
+
}
|
|
212
|
+
export {
|
|
213
|
+
ae as AdminTestimonialsPanel
|
|
214
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const t = "_hint_tkrfw_1", r = "_list_tkrfw_9", _ = "_row_tkrfw_17", e = "_hiddenRow_tkrfw_28", o = "_thumb_tkrfw_32", w = "_rowText_tkrfw_54", n = "_rowStars_tkrfw_75", i = "_hiddenBadge_tkrfw_81", s = "_rowActions_tkrfw_98", a = "_ratingPicker_tkrfw_109", c = "_filledStar_tkrfw_135", d = "_reviewTextarea_tkrfw_143", f = {
|
|
2
|
+
hint: t,
|
|
3
|
+
list: r,
|
|
4
|
+
row: _,
|
|
5
|
+
hiddenRow: e,
|
|
6
|
+
thumb: o,
|
|
7
|
+
rowText: w,
|
|
8
|
+
rowStars: n,
|
|
9
|
+
hiddenBadge: i,
|
|
10
|
+
rowActions: s,
|
|
11
|
+
ratingPicker: a,
|
|
12
|
+
filledStar: c,
|
|
13
|
+
reviewTextarea: d
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
f as default,
|
|
17
|
+
c as filledStar,
|
|
18
|
+
i as hiddenBadge,
|
|
19
|
+
e as hiddenRow,
|
|
20
|
+
t as hint,
|
|
21
|
+
r as list,
|
|
22
|
+
a as ratingPicker,
|
|
23
|
+
d as reviewTextarea,
|
|
24
|
+
_ as row,
|
|
25
|
+
s as rowActions,
|
|
26
|
+
n as rowStars,
|
|
27
|
+
w as rowText,
|
|
28
|
+
o as thumb
|
|
29
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { MenuApiError as r } from "../menu/menuApi.js";
|
|
2
|
+
function u(e) {
|
|
3
|
+
return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/&/g, "and").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "untitled";
|
|
4
|
+
}
|
|
5
|
+
let i = 0;
|
|
6
|
+
function o() {
|
|
7
|
+
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (i += 1, `${Date.now().toString(36)}-${i.toString(36)}`);
|
|
8
|
+
}
|
|
9
|
+
function s(e, t) {
|
|
10
|
+
return `${e}-${u(t)}-${o()}`;
|
|
11
|
+
}
|
|
12
|
+
function d(e) {
|
|
13
|
+
return {
|
|
14
|
+
id: s("item", "new-item"),
|
|
15
|
+
categoryId: e,
|
|
16
|
+
title: "New menu item",
|
|
17
|
+
description: "",
|
|
18
|
+
image: "",
|
|
19
|
+
order: 999,
|
|
20
|
+
isVisible: !0,
|
|
21
|
+
pricingMode: "single",
|
|
22
|
+
price: "",
|
|
23
|
+
sizes: []
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function a(e) {
|
|
27
|
+
return e instanceof r || e instanceof Error ? e.message : "Unexpected menu API error.";
|
|
28
|
+
}
|
|
29
|
+
function f(e) {
|
|
30
|
+
if (e instanceof r && (e.status === 401 || e.status === 403)) return !0;
|
|
31
|
+
const t = a(e).toLowerCase();
|
|
32
|
+
return t.includes("cloudflare access") || t.includes("sign in") || t.includes("sign-in") || t.includes("not authorized") || t.includes("expected a json response") || t.includes("could not reach the menu api");
|
|
33
|
+
}
|
|
34
|
+
function l(e) {
|
|
35
|
+
const t = e?.data;
|
|
36
|
+
if (t?.kind) return t;
|
|
37
|
+
const n = String(e?.id ?? "");
|
|
38
|
+
return n.startsWith("group:") ? { kind: "group", id: n.replace("group:", "") } : n.startsWith("item:") ? { kind: "item", id: n.replace("item:", ""), categoryId: "" } : null;
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
d as emptyItem,
|
|
42
|
+
a as getApiErrorMessage,
|
|
43
|
+
f as isLikelyAuthError,
|
|
44
|
+
u as slugify,
|
|
45
|
+
l as sortableDataFromEntity,
|
|
46
|
+
s as uniqueId
|
|
47
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { deleteMenuSize as i, updateMenuSize as s, addMenuSize as o, deleteMenuItem as p, updateMenuItem as d, addMenuItem as a, deleteMenuCategory as n, updateMenuCategory as g, addMenuCategory as I, deleteMenuGroup as c, updateMenuGroup as l, addMenuGroup as f } from "../menu/menuMutations.js";
|
|
2
|
+
import { moveItemBefore as M, moveSection as y, setGroupOrder as z, moveGroup as h } from "../menu/menuOrdering.js";
|
|
3
|
+
import { uniqueId as u } from "./adminEditorUtils.js";
|
|
4
|
+
function w(t) {
|
|
5
|
+
return {
|
|
6
|
+
id: u("group", "new-menu-group"),
|
|
7
|
+
label: "New group",
|
|
8
|
+
icon: "plate",
|
|
9
|
+
order: t.groups.length,
|
|
10
|
+
isVisible: !0
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function j(t, e) {
|
|
14
|
+
return {
|
|
15
|
+
id: u("category", "new-category"),
|
|
16
|
+
groupId: e,
|
|
17
|
+
title: "New section",
|
|
18
|
+
order: t.categories.length,
|
|
19
|
+
isVisible: !0
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function D(t) {
|
|
23
|
+
return {
|
|
24
|
+
id: u("size", "size"),
|
|
25
|
+
label: "Size",
|
|
26
|
+
price: "",
|
|
27
|
+
order: t.sizes.length
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function G(t, e) {
|
|
31
|
+
if (e.type === "delete-group") {
|
|
32
|
+
if (e.groupId === "all") return "pinned-group";
|
|
33
|
+
if (t.categories.some((r) => r.groupId === e.groupId)) return "group-has-sections";
|
|
34
|
+
}
|
|
35
|
+
return e.type === "delete-section" && t.items.some((r) => r.categoryId === e.categoryId) ? "section-has-items" : null;
|
|
36
|
+
}
|
|
37
|
+
function x(t, e) {
|
|
38
|
+
const r = G(t, e);
|
|
39
|
+
return r ? { status: "rejected", reason: r } : { status: "applied", menu: v(t, e) };
|
|
40
|
+
}
|
|
41
|
+
function v(t, e) {
|
|
42
|
+
switch (e.type) {
|
|
43
|
+
case "add-group":
|
|
44
|
+
return f(t, e.group);
|
|
45
|
+
case "update-group":
|
|
46
|
+
return l(t, e.groupId, e.patch);
|
|
47
|
+
case "delete-group":
|
|
48
|
+
return c(t, e.groupId);
|
|
49
|
+
case "move-group":
|
|
50
|
+
return h(t, e.groupId, e.direction);
|
|
51
|
+
case "reorder-groups":
|
|
52
|
+
return z(t, e.orderedGroupIds);
|
|
53
|
+
case "add-section":
|
|
54
|
+
return I(t, e.category);
|
|
55
|
+
case "update-section":
|
|
56
|
+
return g(t, e.categoryId, e.patch);
|
|
57
|
+
case "delete-section":
|
|
58
|
+
return n(t, e.categoryId);
|
|
59
|
+
case "move-section":
|
|
60
|
+
return y(t, e.categoryId, e.direction);
|
|
61
|
+
case "add-item":
|
|
62
|
+
return a(t, e.item);
|
|
63
|
+
case "update-item":
|
|
64
|
+
return d(t, e.itemId, e.patch);
|
|
65
|
+
case "delete-item":
|
|
66
|
+
return p(t, e.itemId);
|
|
67
|
+
case "move-item-before":
|
|
68
|
+
return M(t, e.sourceItemId, e.targetItemId);
|
|
69
|
+
case "add-size":
|
|
70
|
+
return o(t, e.itemId, e.size);
|
|
71
|
+
case "update-size":
|
|
72
|
+
return s(t, e.itemId, e.sizeId, e.patch);
|
|
73
|
+
case "delete-size":
|
|
74
|
+
return i(t, e.itemId, e.sizeId);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
x as applyAdminMenuCommand,
|
|
79
|
+
j as createMenuCategoryDraft,
|
|
80
|
+
w as createMenuGroupDraft,
|
|
81
|
+
D as createMenuSizeDraft,
|
|
82
|
+
G as getAdminMenuCommandRejection
|
|
83
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useContext as n } from "react";
|
|
2
|
+
import { AdminDraftContext as o } from "./adminDraftContext.js";
|
|
3
|
+
import { useAdminMenuDraft as f } from "./useAdminMenuDraft.js";
|
|
4
|
+
function a() {
|
|
5
|
+
return n(o);
|
|
6
|
+
}
|
|
7
|
+
function d(t = {}) {
|
|
8
|
+
const r = a(), e = f({ ...t, enabled: r ? !1 : t.enabled ?? !0 });
|
|
9
|
+
return r ?? e;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
d as useAdminDraft,
|
|
13
|
+
a as useAdminDraftContext
|
|
14
|
+
};
|