@infuro/cms-core 1.0.35 → 1.0.36
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/admin.cjs +861 -626
- package/dist/admin.d.cts +6 -0
- package/dist/admin.d.ts +6 -0
- package/dist/admin.js +863 -628
- package/dist/api.cjs +40 -39
- package/dist/api.js +8 -7
- package/dist/auth.cjs +51 -51
- package/dist/auth.d.cts +3 -3
- package/dist/auth.d.ts +3 -3
- package/dist/auth.js +3 -3
- package/dist/{chunk-BGJAV67S.cjs → chunk-2AEVFOQP.cjs} +7923 -7197
- package/dist/chunk-COBORIJH.cjs +2373 -0
- package/dist/{chunk-EQPITOP6.js → chunk-FG6I64HP.js} +70 -9
- package/dist/chunk-HCIRL37O.js +21 -0
- package/dist/chunk-HT5DI3XW.cjs +82 -0
- package/dist/{chunk-2XE4X74C.js → chunk-JS2W7XZ4.js} +7510 -6800
- package/dist/{chunk-EF2JBPDM.js → chunk-KFFB6EMZ.js} +9 -0
- package/dist/{chunk-3KPNTQBV.cjs → chunk-KPKFNLQQ.cjs} +50 -22
- package/dist/{chunk-6KPQWRFW.js → chunk-LI2IXVAY.js} +1 -1
- package/dist/{chunk-N44BJZ4C.cjs → chunk-SPQFNIYJ.cjs} +9 -0
- package/dist/chunk-UCKN4BBY.cjs +24 -0
- package/dist/{chunk-4TRPKBKO.js → chunk-UF3BYUXY.js} +50 -23
- package/dist/chunk-VMY2S32H.js +2342 -0
- package/dist/{chunk-TIAEXJLI.cjs → chunk-WO2DW4AU.cjs} +7 -7
- package/dist/chunk-X47PBV4I.js +79 -0
- package/dist/{chunk-CNTSLED2.cjs → chunk-X6H5VBQ2.cjs} +75 -14
- package/dist/cli.cjs +4 -2
- package/dist/cli.js +4 -2
- package/dist/emit-order-notification-trigger-D2N3KFHL.cjs +16 -0
- package/dist/emit-order-notification-trigger-IVLWKKJL.js +3 -0
- package/dist/{event-order-defaults-DUGDVGJI.cjs → event-order-defaults-EMWBIGL3.cjs} +9 -9
- package/dist/{event-order-defaults-6E543227.js → event-order-defaults-SDRNAZHC.js} +1 -1
- package/dist/index.cjs +805 -1059
- package/dist/index.d.cts +827 -728
- package/dist/index.d.ts +827 -728
- package/dist/index.js +385 -724
- package/dist/migrations/1781220000000-AddWhatsappTriggerBindings.ts +23 -0
- package/dist/migrations/1781230000000-AddOrderNotificationTriggers.ts +46 -0
- package/dist/migrations/1781240000000-DropEventOrderNotificationColumns.ts +29 -0
- package/dist/migrations/1781250000000-RemoveOrderRefundedTrigger.ts +36 -0
- package/dist/{rbac-debug-db-D7ME7QUY.cjs → rbac-debug-db-HWP65A4O.cjs} +2 -2
- package/dist/{rbac-debug-db-MTCTVNNM.js → rbac-debug-db-QJH3AD34.js} +1 -1
- package/dist/whatsapp-trigger-dispatcher-ONHXI7UY.cjs +19 -0
- package/dist/whatsapp-trigger-dispatcher-PWFI4FKP.js +6 -0
- package/package.json +1 -1
- package/dist/chunk-46GKADYE.cjs +0 -84
- package/dist/chunk-7YIBMQDR.cjs +0 -86
- package/dist/chunk-J7XHLOLO.js +0 -830
- package/dist/chunk-JBRR5UYL.js +0 -87
- package/dist/chunk-JHF4YYRC.cjs +0 -188
- package/dist/chunk-PAMVINEX.cjs +0 -577
- package/dist/chunk-QM733NUK.js +0 -186
- package/dist/chunk-R73BKDRO.cjs +0 -90
- package/dist/chunk-TFUOHI37.cjs +0 -839
- package/dist/chunk-XDSNZUW7.js +0 -564
- package/dist/chunk-ZQ4X6OAU.js +0 -82
- package/dist/chunk-ZSVCP6N3.js +0 -83
- package/dist/email-FKR4FXFI.js +0 -5
- package/dist/email-KVKVPNCL.cjs +0 -58
- package/dist/event-order-notifications-5GSAOYVS.cjs +0 -27
- package/dist/event-order-notifications-IIIF23D5.js +0 -10
- package/dist/layout-36UFTHC5.cjs +0 -11
- package/dist/layout-AOBN26XG.js +0 -2
- package/dist/whatsapp-queue-3DXA4MXU.js +0 -2
- package/dist/whatsapp-queue-KG65MXD5.cjs +0 -15
package/dist/admin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useSession,
|
|
2
|
+
import { useSession, signOut, signIn } from 'next-auth/react';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
import * as React26 from 'react';
|
|
@@ -10,7 +10,7 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
10
10
|
import { cva } from 'class-variance-authority';
|
|
11
11
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
12
12
|
import * as LucideIcons from 'lucide-react';
|
|
13
|
-
import { ChevronDown, User, Settings, LogOut, LayoutDashboard,
|
|
13
|
+
import { ChevronDown, User, Settings, LogOut, LayoutDashboard, Store, FolderTree, Layers, Building2, CalendarDays, ShoppingBag, Package, Receipt, BadgePercent, ShoppingCart, CreditCard, Users, Inbox, File, LinkIcon, ClipboardList, MessageSquare, Image as Image$1, FileText, Shield, Puzzle, X, Plus, MoreVertical, Upload, Download, Edit, Copy, RefreshCw, Trash2, Save, Check, Search, AlertCircle, MapPin, BarChart3, TrendingUp, UserCheck, Activity, Globe, Eye, MousePointer, ArrowLeftRight, RotateCcw, KeyRound, Loader2, CalendarClock, Rss, ArrowLeft, Pencil, FolderPlus, LayoutGrid, List, Move, Archive, Edit2, ExternalLink, Power, Star, ChevronUp, Zap, Filter, CheckCircle2, ImageIcon, GripVertical, ChevronRight, ArrowRight, ArrowUpRight, IndianRupee, XCircle, Clock, Play, MessageCircle, Mail, Bot, FileUp, Tag, Box, SlidersHorizontal, Calculator, Link2 as Link2$1, Unlink, Gift, MoreHorizontal, Bell, QrCode, Car, Circle, Settings2, DollarSign, Hash, ChevronLeft, Share2, Smartphone, HardDrive, Folder, Film } from 'lucide-react';
|
|
14
14
|
import Image from 'next/image';
|
|
15
15
|
import Link2 from 'next/link';
|
|
16
16
|
import { usePathname, useSearchParams, useRouter } from 'next/navigation';
|
|
@@ -456,7 +456,7 @@ var init_admin_config_context = __esm({
|
|
|
456
456
|
var CMS_VERSION;
|
|
457
457
|
var init_cms_version = __esm({
|
|
458
458
|
"src/lib/cms-version.ts"() {
|
|
459
|
-
CMS_VERSION = "1.0.
|
|
459
|
+
CMS_VERSION = "1.0.36" ;
|
|
460
460
|
}
|
|
461
461
|
});
|
|
462
462
|
function useCatalogCategories(enabled = true) {
|
|
@@ -566,25 +566,20 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
566
566
|
const sessionUser = session?.user;
|
|
567
567
|
const showVendorOnboard = canOnboardVendors(sessionUser);
|
|
568
568
|
const vendorPortal = isVendorPortalUser(sessionUser);
|
|
569
|
-
const { customNavItems, customNavSections = [], storeEnabled } = useContext(AdminConfigContext);
|
|
569
|
+
const { customNavItems, customNavSections = [], storeEnabled, multiVendorEnabled, eventsEnabled } = useContext(AdminConfigContext);
|
|
570
570
|
const showStoreNav = storeEnabled || vendorPortal;
|
|
571
571
|
const showPlatformNav = !vendorPortal;
|
|
572
572
|
const isDrawer = variant === "drawer";
|
|
573
573
|
const { categories: catalogCategories } = useCatalogCategories(showStoreNav);
|
|
574
|
-
|
|
574
|
+
searchParams.get("categoryId")?.trim() ?? "";
|
|
575
575
|
const hasCustomEventsNav = customNavItems.some((item) => item.href === "/admin/events" || item.href.startsWith("/admin/events/")) || customNavSections.some((section) => section.items.some((item) => item.href === "/admin/events" || item.href.startsWith("/admin/events/")));
|
|
576
|
-
|
|
576
|
+
catalogCategories.filter((category) => category.slug !== "events");
|
|
577
577
|
const isActive = /* @__PURE__ */ __name((path) => {
|
|
578
578
|
if (path === "/admin/dashboard") {
|
|
579
579
|
return pathname === path || vendorPortal && pathname === "/admin/analytics";
|
|
580
580
|
}
|
|
581
581
|
return pathname.startsWith(path);
|
|
582
582
|
}, "isActive");
|
|
583
|
-
const isVendorCategoryActive = /* @__PURE__ */ __name((categoryId) => {
|
|
584
|
-
if (!pathname.startsWith("/admin/products")) return false;
|
|
585
|
-
if (!activeCategoryId) return false;
|
|
586
|
-
return activeCategoryId === String(categoryId);
|
|
587
|
-
}, "isVendorCategoryActive");
|
|
588
583
|
const linkActive = "bg-gray-200 text-gray-900";
|
|
589
584
|
const linkInactive = "text-gray-600 hover:bg-gray-100 hover:text-gray-900";
|
|
590
585
|
const iconActive = "text-gray-700";
|
|
@@ -671,30 +666,13 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
671
666
|
}, /* @__PURE__ */ React.createElement(Icon2, {
|
|
672
667
|
className: `h-4 w-4 mr-2 ${isActive(item.href) ? iconActive : iconInactive}`
|
|
673
668
|
}), item.label));
|
|
674
|
-
})))),
|
|
675
|
-
className: sectionCls8
|
|
676
|
-
}, /* @__PURE__ */ React.createElement("h3", {
|
|
677
|
-
className: headingCls
|
|
678
|
-
}, "Categories"), /* @__PURE__ */ React.createElement("ul", {
|
|
679
|
-
className: "space-y-0.5"
|
|
680
|
-
}, vendorCatalogCategories.map((category) => {
|
|
681
|
-
const href = vendorCategoryWorkspaceUrl(category.id);
|
|
682
|
-
const active = isVendorCategoryActive(category.id);
|
|
683
|
-
return /* @__PURE__ */ React.createElement("li", {
|
|
684
|
-
key: category.id
|
|
685
|
-
}, /* @__PURE__ */ React.createElement(Link2, {
|
|
686
|
-
href,
|
|
687
|
-
className: `${linkCls} ${active ? linkActive : linkInactive}`
|
|
688
|
-
}, /* @__PURE__ */ React.createElement(FolderTree, {
|
|
689
|
-
className: `h-4 w-4 mr-2 ${active ? iconActive : iconInactive}`
|
|
690
|
-
}), category.name));
|
|
691
|
-
}))), showStoreNav && /* @__PURE__ */ React.createElement("div", {
|
|
669
|
+
})))), showStoreNav && /* @__PURE__ */ React.createElement("div", {
|
|
692
670
|
className: sectionCls8
|
|
693
671
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
694
672
|
className: headingCls
|
|
695
673
|
}, "Store"), /* @__PURE__ */ React.createElement("ul", {
|
|
696
674
|
className: "space-y-0.5"
|
|
697
|
-
}, showVendorOnboard && /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement(Link2, {
|
|
675
|
+
}, showVendorOnboard && multiVendorEnabled !== false && /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement(Link2, {
|
|
698
676
|
href: "/admin/vendors",
|
|
699
677
|
className: `${linkCls} ${isActive("/admin/vendors") ? linkActive : linkInactive}`
|
|
700
678
|
}, /* @__PURE__ */ React.createElement(Store, {
|
|
@@ -714,12 +692,12 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
714
692
|
className: `${linkCls} ${isActive("/admin/brands") ? linkActive : linkInactive}`
|
|
715
693
|
}, /* @__PURE__ */ React.createElement(Building2, {
|
|
716
694
|
className: `h-4 w-4 mr-2 ${isActive("/admin/brands") ? iconActive : iconInactive}`
|
|
717
|
-
}), "Brands")), !hasCustomEventsNav ? /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement(Link2, {
|
|
695
|
+
}), "Brands")), !hasCustomEventsNav && eventsEnabled !== false ? /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement(Link2, {
|
|
718
696
|
href: "/admin/events",
|
|
719
697
|
className: `${linkCls} ${isActive("/admin/events") ? linkActive : linkInactive}`
|
|
720
698
|
}, /* @__PURE__ */ React.createElement(CalendarDays, {
|
|
721
699
|
className: `h-4 w-4 mr-2 ${isActive("/admin/events") ? iconActive : iconInactive}`
|
|
722
|
-
}), "Events")) : null,
|
|
700
|
+
}), "Events")) : null, /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement(Link2, {
|
|
723
701
|
href: "/admin/products",
|
|
724
702
|
className: `${linkCls} ${isActive("/admin/products") ? linkActive : linkInactive}`
|
|
725
703
|
}, /* @__PURE__ */ React.createElement(ShoppingBag, {
|
|
@@ -1147,7 +1125,7 @@ var init_builtin_plugin_descriptors = __esm({
|
|
|
1147
1125
|
},
|
|
1148
1126
|
{
|
|
1149
1127
|
name: "event_notifications",
|
|
1150
|
-
label: "
|
|
1128
|
+
label: "Notifications",
|
|
1151
1129
|
version: "1.0.0",
|
|
1152
1130
|
description: "Order confirmation templates with QR code and order details for events.",
|
|
1153
1131
|
enabled: true,
|
|
@@ -1162,9 +1140,7 @@ var init_builtin_plugin_descriptors = __esm({
|
|
|
1162
1140
|
function isAuthDebugClientEnabled() {
|
|
1163
1141
|
if (typeof window === "undefined") return false;
|
|
1164
1142
|
const v = process.env.NEXT_PUBLIC_CMS_AUTH_DEBUG?.trim().toLowerCase();
|
|
1165
|
-
|
|
1166
|
-
if (v === "0" || v === "false" || v === "no") return false;
|
|
1167
|
-
return process.env.NODE_ENV === "development";
|
|
1143
|
+
return v === "1" || v === "true" || v === "yes";
|
|
1168
1144
|
}
|
|
1169
1145
|
function logAuthClient(message, data) {
|
|
1170
1146
|
if (!isAuthDebugClientEnabled()) return;
|
|
@@ -1208,13 +1184,16 @@ function useAdminViewSettings() {
|
|
|
1208
1184
|
}
|
|
1209
1185
|
function AdminLayoutInner({ children }) {
|
|
1210
1186
|
const { data: session, status } = useSession();
|
|
1187
|
+
const { multiVendorEnabled } = useContext(AdminConfigContext);
|
|
1211
1188
|
const router = useRouter();
|
|
1212
1189
|
const pathname = usePathname();
|
|
1213
1190
|
const [loadingTimeout, setLoadingTimeout] = useState(false);
|
|
1214
1191
|
const [moreSheetOpen, setMoreSheetOpen] = useState(false);
|
|
1215
1192
|
const isMobile = useIsMobile();
|
|
1193
|
+
const vendorBlockRedirectRef = useRef(false);
|
|
1216
1194
|
useAdminViewSettings();
|
|
1217
1195
|
const isPublicPath = PUBLIC_ADMIN_PATHS.includes(pathname);
|
|
1196
|
+
const isVendorOnlySession = session?.user?.isVendorPortal === true && session?.user?.isRBACAdmin !== true;
|
|
1218
1197
|
useEffect(() => {
|
|
1219
1198
|
if (isMobile) setMoreSheetOpen(false);
|
|
1220
1199
|
}, [
|
|
@@ -1241,6 +1220,7 @@ function AdminLayoutInner({ children }) {
|
|
|
1241
1220
|
return () => clearTimeout(timeout);
|
|
1242
1221
|
}
|
|
1243
1222
|
if (status === "unauthenticated") {
|
|
1223
|
+
if (vendorBlockRedirectRef.current) return;
|
|
1244
1224
|
logAuthClient("AdminLayout redirect \u2192 /admin/signin (unauthenticated)", {
|
|
1245
1225
|
pathname
|
|
1246
1226
|
});
|
|
@@ -1254,6 +1234,29 @@ function AdminLayoutInner({ children }) {
|
|
|
1254
1234
|
pathname,
|
|
1255
1235
|
isPublicPath
|
|
1256
1236
|
]);
|
|
1237
|
+
useEffect(() => {
|
|
1238
|
+
if (isPublicPath) return;
|
|
1239
|
+
if (status !== "authenticated" || !session) return;
|
|
1240
|
+
if (!multiVendorEnabled && isVendorOnlySession) {
|
|
1241
|
+
vendorBlockRedirectRef.current = true;
|
|
1242
|
+
logAuthClient("AdminLayout: vendor session blocked (multi-vendor disabled)", {
|
|
1243
|
+
pathname
|
|
1244
|
+
});
|
|
1245
|
+
signOut({
|
|
1246
|
+
redirect: false
|
|
1247
|
+
}).then(() => {
|
|
1248
|
+
router.replace("/admin/signin?error=CredentialsSignin");
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
}, [
|
|
1252
|
+
status,
|
|
1253
|
+
session,
|
|
1254
|
+
multiVendorEnabled,
|
|
1255
|
+
isVendorOnlySession,
|
|
1256
|
+
router,
|
|
1257
|
+
pathname,
|
|
1258
|
+
isPublicPath
|
|
1259
|
+
]);
|
|
1257
1260
|
if (isPublicPath) {
|
|
1258
1261
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AdminStyle, null), children);
|
|
1259
1262
|
}
|
|
@@ -1278,6 +1281,9 @@ function AdminLayoutInner({ children }) {
|
|
|
1278
1281
|
if (!session) {
|
|
1279
1282
|
return null;
|
|
1280
1283
|
}
|
|
1284
|
+
if (!multiVendorEnabled && isVendorOnlySession) {
|
|
1285
|
+
return null;
|
|
1286
|
+
}
|
|
1281
1287
|
const isOrderProductEmbed = pathname?.includes("/admin/orders/product-frame") === true;
|
|
1282
1288
|
if (isOrderProductEmbed) {
|
|
1283
1289
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AdminStyle, null), /* @__PURE__ */ React.createElement("div", {
|
|
@@ -1349,9 +1355,48 @@ function useStoreEnabled() {
|
|
|
1349
1355
|
currency
|
|
1350
1356
|
};
|
|
1351
1357
|
}
|
|
1358
|
+
function parseBooleanSetting(value) {
|
|
1359
|
+
if (typeof value === "boolean") return value;
|
|
1360
|
+
if (typeof value === "number") return value !== 0;
|
|
1361
|
+
if (typeof value === "string") {
|
|
1362
|
+
const normalized = value.trim().toLowerCase();
|
|
1363
|
+
if (normalized === "true" || normalized === "1" || normalized === "yes" || normalized === "on") return true;
|
|
1364
|
+
if (normalized === "false" || normalized === "0" || normalized === "no" || normalized === "off") return false;
|
|
1365
|
+
}
|
|
1366
|
+
if (value && typeof value === "object") {
|
|
1367
|
+
const record = value;
|
|
1368
|
+
const nested = parseBooleanSetting(record.value ?? record.enabled ?? record.isEnabled ?? record.active ?? record.state);
|
|
1369
|
+
if (nested != null) return nested;
|
|
1370
|
+
}
|
|
1371
|
+
return null;
|
|
1372
|
+
}
|
|
1373
|
+
function useMultiVendorEnabled() {
|
|
1374
|
+
const [multiVendorEnabled, setMultiVendorEnabled] = useState(true);
|
|
1375
|
+
useEffect(() => {
|
|
1376
|
+
fetch("/api/settings/multi_vendor").then((r) => r.ok ? r.json() : {}).then((data) => {
|
|
1377
|
+
const parsed = parseBooleanSetting(data?.enabled ?? data?.value ?? data?.isEnabled ?? data?.active ?? data?.state);
|
|
1378
|
+
setMultiVendorEnabled(parsed ?? true);
|
|
1379
|
+
}).catch(() => {
|
|
1380
|
+
});
|
|
1381
|
+
}, []);
|
|
1382
|
+
return multiVendorEnabled;
|
|
1383
|
+
}
|
|
1384
|
+
function useEventsEnabled() {
|
|
1385
|
+
const [eventsEnabled, setEventsEnabled] = useState(true);
|
|
1386
|
+
useEffect(() => {
|
|
1387
|
+
fetch("/api/settings/events").then((r) => r.ok ? r.json() : {}).then((data) => {
|
|
1388
|
+
const parsed = parseBooleanSetting(data?.enabled ?? data?.value ?? data?.isEnabled ?? data?.active ?? data?.state);
|
|
1389
|
+
setEventsEnabled(parsed ?? true);
|
|
1390
|
+
}).catch(() => {
|
|
1391
|
+
});
|
|
1392
|
+
}, []);
|
|
1393
|
+
return eventsEnabled;
|
|
1394
|
+
}
|
|
1352
1395
|
function AdminLayout({ children, customNavItems = [], customNavSections = [], customCrudConfigs = {}, categoryRelatedProductLabels = {}, renderOrderDetailFooter, theme, themeRegistry, pluginDescriptors = [] }) {
|
|
1353
1396
|
const resolvedTheme = useResolvedTheme(theme, themeRegistry);
|
|
1354
1397
|
const { storeEnabled, currency } = useStoreEnabled();
|
|
1398
|
+
const multiVendorEnabled = useMultiVendorEnabled();
|
|
1399
|
+
const eventsEnabled = useEventsEnabled();
|
|
1355
1400
|
const mergedPluginDescriptors = useMemo(() => {
|
|
1356
1401
|
const seen = new Set(pluginDescriptors.map((p) => p.name));
|
|
1357
1402
|
const extra = BUILTIN_PLUGIN_DESCRIPTORS.filter((p) => !seen.has(p.name));
|
|
@@ -1372,7 +1417,9 @@ function AdminLayout({ children, customNavItems = [], customNavSections = [], cu
|
|
|
1372
1417
|
themeRegistry,
|
|
1373
1418
|
pluginDescriptors: mergedPluginDescriptors,
|
|
1374
1419
|
storeEnabled,
|
|
1375
|
-
currency
|
|
1420
|
+
currency,
|
|
1421
|
+
multiVendorEnabled,
|
|
1422
|
+
eventsEnabled
|
|
1376
1423
|
}), [
|
|
1377
1424
|
customNavItems,
|
|
1378
1425
|
customNavSections,
|
|
@@ -1383,7 +1430,9 @@ function AdminLayout({ children, customNavItems = [], customNavSections = [], cu
|
|
|
1383
1430
|
themeRegistry,
|
|
1384
1431
|
mergedPluginDescriptors,
|
|
1385
1432
|
storeEnabled,
|
|
1386
|
-
currency
|
|
1433
|
+
currency,
|
|
1434
|
+
multiVendorEnabled,
|
|
1435
|
+
eventsEnabled
|
|
1387
1436
|
]);
|
|
1388
1437
|
return /* @__PURE__ */ React.createElement(AdminConfigContext.Provider, {
|
|
1389
1438
|
value: configValue
|
|
@@ -1418,6 +1467,9 @@ var init_AdminLayout = __esm({
|
|
|
1418
1467
|
__name(AdminLayoutInner, "AdminLayoutInner");
|
|
1419
1468
|
__name(useResolvedTheme, "useResolvedTheme");
|
|
1420
1469
|
__name(useStoreEnabled, "useStoreEnabled");
|
|
1470
|
+
__name(parseBooleanSetting, "parseBooleanSetting");
|
|
1471
|
+
__name(useMultiVendorEnabled, "useMultiVendorEnabled");
|
|
1472
|
+
__name(useEventsEnabled, "useEventsEnabled");
|
|
1421
1473
|
__name(AdminLayout, "AdminLayout");
|
|
1422
1474
|
}
|
|
1423
1475
|
});
|
|
@@ -8695,6 +8747,14 @@ var init_SignInPage = __esm({
|
|
|
8695
8747
|
const [error, setError] = useState("");
|
|
8696
8748
|
const [loading, setLoading] = useState(false);
|
|
8697
8749
|
const { status } = useSession();
|
|
8750
|
+
const searchParams = useSearchParams();
|
|
8751
|
+
useEffect(() => {
|
|
8752
|
+
if (searchParams.get("error")) {
|
|
8753
|
+
setError("Invalid email or password");
|
|
8754
|
+
}
|
|
8755
|
+
}, [
|
|
8756
|
+
searchParams
|
|
8757
|
+
]);
|
|
8698
8758
|
useEffect(() => {
|
|
8699
8759
|
logAuthClient("SignInPage session status", {
|
|
8700
8760
|
status
|
|
@@ -11043,8 +11103,17 @@ var init_store_crud_configs = __esm({
|
|
|
11043
11103
|
},
|
|
11044
11104
|
{
|
|
11045
11105
|
param: "eventId",
|
|
11046
|
-
label: "Event
|
|
11047
|
-
type: "
|
|
11106
|
+
label: "Event",
|
|
11107
|
+
type: "select",
|
|
11108
|
+
options: [
|
|
11109
|
+
{
|
|
11110
|
+
value: "",
|
|
11111
|
+
label: "All"
|
|
11112
|
+
}
|
|
11113
|
+
],
|
|
11114
|
+
relationApi: "/api/events",
|
|
11115
|
+
relationLabelField: "name",
|
|
11116
|
+
relationValueField: "id"
|
|
11048
11117
|
}
|
|
11049
11118
|
],
|
|
11050
11119
|
columns: [
|
|
@@ -12127,6 +12196,8 @@ function SettingsPage() {
|
|
|
12127
12196
|
});
|
|
12128
12197
|
const [themeSettingsLoading, setThemeSettingsLoading] = useState(true);
|
|
12129
12198
|
const [storeEnabled, setStoreEnabled] = useState(false);
|
|
12199
|
+
const [multiVendorEnabled, setMultiVendorEnabled] = useState(true);
|
|
12200
|
+
const [eventsEnabled, setEventsEnabled] = useState(true);
|
|
12130
12201
|
const [storeSettingsLoading, setStoreSettingsLoading] = useState(true);
|
|
12131
12202
|
const [currency, setCurrency] = useState(DEFAULT_CURRENCY);
|
|
12132
12203
|
const [currencies, setCurrencies] = useState([]);
|
|
@@ -12184,6 +12255,14 @@ function SettingsPage() {
|
|
|
12184
12255
|
setStoreEnabled(data.enabled === "true");
|
|
12185
12256
|
setCurrency(data.currency || DEFAULT_CURRENCY);
|
|
12186
12257
|
}).finally(() => setStoreSettingsLoading(false));
|
|
12258
|
+
fetch("/api/settings/multi_vendor").then((r) => r.ok ? r.json() : {}).then((data) => {
|
|
12259
|
+
setMultiVendorEnabled(data.enabled !== "false");
|
|
12260
|
+
}).catch(() => {
|
|
12261
|
+
});
|
|
12262
|
+
fetch("/api/settings/events").then((r) => r.ok ? r.json() : {}).then((data) => {
|
|
12263
|
+
setEventsEnabled(data.enabled !== "false");
|
|
12264
|
+
}).catch(() => {
|
|
12265
|
+
});
|
|
12187
12266
|
fetch("/api/currencies/exchange-rates").then((r) => r.ok ? r.json() : []).then((data) => {
|
|
12188
12267
|
if (data.length > 0) {
|
|
12189
12268
|
setExchangeRates(data.map((entry) => ({
|
|
@@ -12300,6 +12379,30 @@ function SettingsPage() {
|
|
|
12300
12379
|
}
|
|
12301
12380
|
})
|
|
12302
12381
|
});
|
|
12382
|
+
await fetch("/api/settings/multi_vendor", {
|
|
12383
|
+
method: "PUT",
|
|
12384
|
+
headers: {
|
|
12385
|
+
"Content-Type": "application/json"
|
|
12386
|
+
},
|
|
12387
|
+
body: JSON.stringify({
|
|
12388
|
+
enabled: {
|
|
12389
|
+
value: multiVendorEnabled ? "true" : "false",
|
|
12390
|
+
type: "public"
|
|
12391
|
+
}
|
|
12392
|
+
})
|
|
12393
|
+
});
|
|
12394
|
+
await fetch("/api/settings/events", {
|
|
12395
|
+
method: "PUT",
|
|
12396
|
+
headers: {
|
|
12397
|
+
"Content-Type": "application/json"
|
|
12398
|
+
},
|
|
12399
|
+
body: JSON.stringify({
|
|
12400
|
+
enabled: {
|
|
12401
|
+
value: eventsEnabled ? "true" : "false",
|
|
12402
|
+
type: "public"
|
|
12403
|
+
}
|
|
12404
|
+
})
|
|
12405
|
+
});
|
|
12303
12406
|
toast.success("Store settings saved");
|
|
12304
12407
|
window.location.reload();
|
|
12305
12408
|
} catch {
|
|
@@ -12559,7 +12662,25 @@ function SettingsPage() {
|
|
|
12559
12662
|
className: "text-sm font-medium text-gray-700"
|
|
12560
12663
|
}, "Enable Store"), /* @__PURE__ */ React.createElement("p", {
|
|
12561
12664
|
className: "text-xs text-gray-500"
|
|
12562
|
-
}, "Shows Store section in sidebar with Products, Orders, Payments, etc.")))),
|
|
12665
|
+
}, "Shows Store section in sidebar with Products, Orders, Payments, etc.")))), storeEnabled && /* @__PURE__ */ React.createElement("div", {
|
|
12666
|
+
className: "mt-4 flex items-center gap-3 p-4 bg-gray-50 rounded-lg border border-gray-200"
|
|
12667
|
+
}, /* @__PURE__ */ React.createElement(Switch, {
|
|
12668
|
+
checked: multiVendorEnabled,
|
|
12669
|
+
onCheckedChange: setMultiVendorEnabled
|
|
12670
|
+
}), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label3, {
|
|
12671
|
+
className: "text-sm font-medium text-gray-700"
|
|
12672
|
+
}, "Multi Vendor Support"), /* @__PURE__ */ React.createElement("p", {
|
|
12673
|
+
className: "text-xs text-gray-500"
|
|
12674
|
+
}, "Enable vendor portals, vendor logins, and vendor-scoped store data. Disabling this blocks vendor-only accounts from signing in."))), storeEnabled && /* @__PURE__ */ React.createElement("div", {
|
|
12675
|
+
className: "mt-4 flex items-center gap-3 p-4 bg-gray-50 rounded-lg border border-gray-200"
|
|
12676
|
+
}, /* @__PURE__ */ React.createElement(Switch, {
|
|
12677
|
+
checked: eventsEnabled,
|
|
12678
|
+
onCheckedChange: setEventsEnabled
|
|
12679
|
+
}), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label3, {
|
|
12680
|
+
className: "text-sm font-medium text-gray-700"
|
|
12681
|
+
}, "Events"), /* @__PURE__ */ React.createElement("p", {
|
|
12682
|
+
className: "text-xs text-gray-500"
|
|
12683
|
+
}, "Enable event management. Disabling this hides the Events tab and blocks all event-related APIs."))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", {
|
|
12563
12684
|
className: "flex items-center justify-between mb-1"
|
|
12564
12685
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
12565
12686
|
className: "block text-sm font-semibold text-gray-700"
|
|
@@ -14346,6 +14467,417 @@ var init_EventOrderGlobalTemplates = __esm({
|
|
|
14346
14467
|
__name(saveEventOrderTemplateRows, "saveEventOrderTemplateRows");
|
|
14347
14468
|
}
|
|
14348
14469
|
});
|
|
14470
|
+
function varCount(t) {
|
|
14471
|
+
const explicit = t.providerMeta?.variableCount;
|
|
14472
|
+
if (typeof explicit === "number") return explicit;
|
|
14473
|
+
const matches = t.body.match(/\{\{\d+\}\}/g);
|
|
14474
|
+
return matches ? new Set(matches).size : 0;
|
|
14475
|
+
}
|
|
14476
|
+
function bodyExample(t) {
|
|
14477
|
+
const body = t.providerMeta?.components?.find((c) => c.type === "BODY");
|
|
14478
|
+
return body?.example?.body_text?.[0] ?? [];
|
|
14479
|
+
}
|
|
14480
|
+
function guessFromContext(context) {
|
|
14481
|
+
const c = context.toLowerCase();
|
|
14482
|
+
for (const { pattern, var: v } of CONTEXT_HINTS) {
|
|
14483
|
+
if (pattern.test(c)) return v;
|
|
14484
|
+
}
|
|
14485
|
+
return "";
|
|
14486
|
+
}
|
|
14487
|
+
function guessFromExampleShape(example) {
|
|
14488
|
+
const v = example.trim();
|
|
14489
|
+
if (!v) return "";
|
|
14490
|
+
if (/^\+?\d{10,15}$/.test(v)) return "customerPhone";
|
|
14491
|
+
if (/^[A-Z]{3}$/.test(v)) return "currency";
|
|
14492
|
+
if (/^[A-Za-z]{1,4}-?\d{2,}$/.test(v) || /^#?\d{3,}$/.test(v)) return "orderNumber";
|
|
14493
|
+
if (/^\d+(\.\d{1,2})?$/.test(v)) return "total";
|
|
14494
|
+
if (/^[A-Za-z]+(\s[A-Za-z]+)?$/.test(v) && v.length <= 30) return "customerName";
|
|
14495
|
+
return "";
|
|
14496
|
+
}
|
|
14497
|
+
function guessKnownVar(context, example, used) {
|
|
14498
|
+
const candidates = [
|
|
14499
|
+
guessFromContext(context),
|
|
14500
|
+
guessFromExampleShape(example)
|
|
14501
|
+
].filter((v) => Boolean(v));
|
|
14502
|
+
for (const c of candidates) {
|
|
14503
|
+
if (!used.has(c)) return c;
|
|
14504
|
+
}
|
|
14505
|
+
return "";
|
|
14506
|
+
}
|
|
14507
|
+
function contextBeforePlaceholder(bodyText, n) {
|
|
14508
|
+
const marker = `{{${n}}}`;
|
|
14509
|
+
const idx = bodyText.indexOf(marker);
|
|
14510
|
+
if (idx === -1) return "";
|
|
14511
|
+
return bodyText.slice(Math.max(0, idx - 25), idx);
|
|
14512
|
+
}
|
|
14513
|
+
async function jsonFetch(url, init) {
|
|
14514
|
+
const res = await fetch(url, {
|
|
14515
|
+
credentials: "include",
|
|
14516
|
+
...init
|
|
14517
|
+
});
|
|
14518
|
+
const data = await res.json().catch(() => ({}));
|
|
14519
|
+
if (!res.ok) {
|
|
14520
|
+
throw new Error(data?.error || `Request failed (${res.status})`);
|
|
14521
|
+
}
|
|
14522
|
+
return data;
|
|
14523
|
+
}
|
|
14524
|
+
function WhatsAppTriggerBindings() {
|
|
14525
|
+
const [triggers, setTriggers] = useState([]);
|
|
14526
|
+
const [bindings, setBindings] = useState([]);
|
|
14527
|
+
const [templates, setTemplates] = useState([]);
|
|
14528
|
+
const [loading, setLoading] = useState(true);
|
|
14529
|
+
const [syncing, setSyncing] = useState(false);
|
|
14530
|
+
const [editingTemplateId, setEditingTemplateId] = useState(null);
|
|
14531
|
+
const templatesById = useMemo(() => {
|
|
14532
|
+
const m = /* @__PURE__ */ new Map();
|
|
14533
|
+
for (const t of templates) m.set(t.id, t);
|
|
14534
|
+
return m;
|
|
14535
|
+
}, [
|
|
14536
|
+
templates
|
|
14537
|
+
]);
|
|
14538
|
+
const load = useCallback(async () => {
|
|
14539
|
+
setLoading(true);
|
|
14540
|
+
try {
|
|
14541
|
+
const [triggersRes, bindingsRes, templatesRes] = await Promise.all([
|
|
14542
|
+
jsonFetch("/api/order_notification_triggers?limit=100&sortField=sortOrder&sortOrder=asc"),
|
|
14543
|
+
jsonFetch("/api/whatsapp_trigger_bindings?limit=100"),
|
|
14544
|
+
jsonFetch("/api/message-templates/whatsapp")
|
|
14545
|
+
]);
|
|
14546
|
+
setTriggers((triggersRes.data ?? []).filter((t) => t.enabled));
|
|
14547
|
+
setBindings(bindingsRes.data ?? []);
|
|
14548
|
+
setTemplates(templatesRes.items ?? []);
|
|
14549
|
+
} catch (e) {
|
|
14550
|
+
toast.error(e instanceof Error ? e.message : "Failed to load WhatsApp trigger bindings");
|
|
14551
|
+
} finally {
|
|
14552
|
+
setLoading(false);
|
|
14553
|
+
}
|
|
14554
|
+
}, []);
|
|
14555
|
+
useEffect(() => {
|
|
14556
|
+
void load();
|
|
14557
|
+
}, [
|
|
14558
|
+
load
|
|
14559
|
+
]);
|
|
14560
|
+
const handleSync = /* @__PURE__ */ __name(async () => {
|
|
14561
|
+
setSyncing(true);
|
|
14562
|
+
try {
|
|
14563
|
+
await jsonFetch("/api/message-templates/whatsapp/sync", {
|
|
14564
|
+
method: "POST"
|
|
14565
|
+
});
|
|
14566
|
+
await load();
|
|
14567
|
+
toast.success("Synced templates from Meta");
|
|
14568
|
+
} catch (e) {
|
|
14569
|
+
toast.error(e instanceof Error ? e.message : "Sync failed");
|
|
14570
|
+
} finally {
|
|
14571
|
+
setSyncing(false);
|
|
14572
|
+
}
|
|
14573
|
+
}, "handleSync");
|
|
14574
|
+
const handleRebind = /* @__PURE__ */ __name(async (triggerKey, messageTemplateId) => {
|
|
14575
|
+
const existing = bindings.find((b) => b.triggerKey === triggerKey);
|
|
14576
|
+
try {
|
|
14577
|
+
if (existing) {
|
|
14578
|
+
const updated = await jsonFetch(`/api/whatsapp_trigger_bindings/${existing.id}`, {
|
|
14579
|
+
method: "PUT",
|
|
14580
|
+
headers: {
|
|
14581
|
+
"Content-Type": "application/json"
|
|
14582
|
+
},
|
|
14583
|
+
body: JSON.stringify({
|
|
14584
|
+
messageTemplateId
|
|
14585
|
+
})
|
|
14586
|
+
});
|
|
14587
|
+
setBindings((prev) => prev.map((b) => b.id === updated.id ? updated : b));
|
|
14588
|
+
} else {
|
|
14589
|
+
const created = await jsonFetch("/api/whatsapp_trigger_bindings", {
|
|
14590
|
+
method: "POST",
|
|
14591
|
+
headers: {
|
|
14592
|
+
"Content-Type": "application/json"
|
|
14593
|
+
},
|
|
14594
|
+
body: JSON.stringify({
|
|
14595
|
+
triggerKey,
|
|
14596
|
+
messageTemplateId,
|
|
14597
|
+
enabled: true
|
|
14598
|
+
})
|
|
14599
|
+
});
|
|
14600
|
+
setBindings((prev) => [
|
|
14601
|
+
...prev,
|
|
14602
|
+
created
|
|
14603
|
+
]);
|
|
14604
|
+
}
|
|
14605
|
+
toast.success(`"${triggerKey}" bound to "${templatesById.get(messageTemplateId)?.name ?? messageTemplateId}"`);
|
|
14606
|
+
} catch (e) {
|
|
14607
|
+
toast.error(e instanceof Error ? e.message : "Failed to update binding");
|
|
14608
|
+
}
|
|
14609
|
+
}, "handleRebind");
|
|
14610
|
+
const handleSaveParamOrder = /* @__PURE__ */ __name(async (templateId, paramOrder) => {
|
|
14611
|
+
try {
|
|
14612
|
+
const res = await jsonFetch(`/api/message-templates/whatsapp/${templateId}`, {
|
|
14613
|
+
method: "PATCH",
|
|
14614
|
+
headers: {
|
|
14615
|
+
"Content-Type": "application/json"
|
|
14616
|
+
},
|
|
14617
|
+
body: JSON.stringify({
|
|
14618
|
+
paramOrder
|
|
14619
|
+
})
|
|
14620
|
+
});
|
|
14621
|
+
setTemplates((prev) => prev.map((t) => t.id === res.item.id ? res.item : t));
|
|
14622
|
+
toast.success("Param order saved");
|
|
14623
|
+
setEditingTemplateId(null);
|
|
14624
|
+
} catch (e) {
|
|
14625
|
+
toast.error(e instanceof Error ? e.message : "Failed to save param order");
|
|
14626
|
+
}
|
|
14627
|
+
}, "handleSaveParamOrder");
|
|
14628
|
+
if (loading) {
|
|
14629
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
14630
|
+
className: "flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400"
|
|
14631
|
+
}, /* @__PURE__ */ React.createElement(Loader2, {
|
|
14632
|
+
className: "h-4 w-4 animate-spin"
|
|
14633
|
+
}), "Loading trigger bindings\u2026");
|
|
14634
|
+
}
|
|
14635
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
14636
|
+
className: "space-y-3 rounded-md border border-gray-200 dark:border-gray-600 p-3"
|
|
14637
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
14638
|
+
className: "flex items-start justify-between gap-2"
|
|
14639
|
+
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("p", {
|
|
14640
|
+
className: "text-sm font-medium text-gray-900 dark:text-white"
|
|
14641
|
+
}, "Order trigger templates"), /* @__PURE__ */ React.createElement("p", {
|
|
14642
|
+
className: "text-xs text-gray-500 dark:text-gray-400 mt-1"
|
|
14643
|
+
}, "When an order is placed or cancelled, the matching template is sent on WhatsApp. Sync templates from Meta, then pick one for each trigger below.")), /* @__PURE__ */ React.createElement(Button, {
|
|
14644
|
+
type: "button",
|
|
14645
|
+
variant: "outline",
|
|
14646
|
+
size: "sm",
|
|
14647
|
+
className: "gap-1.5 h-8 shrink-0",
|
|
14648
|
+
disabled: syncing,
|
|
14649
|
+
onClick: /* @__PURE__ */ __name(() => void handleSync(), "onClick")
|
|
14650
|
+
}, syncing ? /* @__PURE__ */ React.createElement(Loader2, {
|
|
14651
|
+
className: "h-3.5 w-3.5 animate-spin"
|
|
14652
|
+
}) : /* @__PURE__ */ React.createElement(RefreshCw, {
|
|
14653
|
+
className: "h-3.5 w-3.5"
|
|
14654
|
+
}), "Sync from Meta")), /* @__PURE__ */ React.createElement("div", {
|
|
14655
|
+
className: "space-y-3"
|
|
14656
|
+
}, triggers.length === 0 ? /* @__PURE__ */ React.createElement("p", {
|
|
14657
|
+
className: "text-xs text-amber-600 dark:text-amber-400"
|
|
14658
|
+
}, "No order triggers found. Run database migrations to seed default triggers.") : null, triggers.map(({ triggerKey, label, description }) => {
|
|
14659
|
+
const binding = bindings.find((b) => b.triggerKey === triggerKey) ?? null;
|
|
14660
|
+
const template = binding?.messageTemplateId != null ? templatesById.get(binding.messageTemplateId) : void 0;
|
|
14661
|
+
const paramOrder = template?.providerMeta?.paramOrder ?? [];
|
|
14662
|
+
const missingParamOrder = template && varCount(template) > 0 && paramOrder.length === 0;
|
|
14663
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
14664
|
+
key: triggerKey,
|
|
14665
|
+
className: "space-y-2 border-t border-gray-100 pt-3 first:border-t-0 first:pt-0 dark:border-gray-700"
|
|
14666
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
14667
|
+
className: "flex items-center gap-2"
|
|
14668
|
+
}, /* @__PURE__ */ React.createElement(MessageCircle, {
|
|
14669
|
+
className: "h-3.5 w-3.5 text-gray-400 shrink-0"
|
|
14670
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
14671
|
+
className: "text-sm font-medium text-gray-900 dark:text-gray-100"
|
|
14672
|
+
}, label), /* @__PURE__ */ React.createElement("span", {
|
|
14673
|
+
className: "text-[11px] font-mono text-gray-400"
|
|
14674
|
+
}, triggerKey)), description ? /* @__PURE__ */ React.createElement("p", {
|
|
14675
|
+
className: "text-[11px] text-gray-500 dark:text-gray-400"
|
|
14676
|
+
}, description) : null, /* @__PURE__ */ React.createElement("div", {
|
|
14677
|
+
className: "flex flex-wrap items-center gap-2"
|
|
14678
|
+
}, /* @__PURE__ */ React.createElement(Select, {
|
|
14679
|
+
value: binding?.messageTemplateId != null ? String(binding.messageTemplateId) : void 0,
|
|
14680
|
+
onValueChange: /* @__PURE__ */ __name((v) => void handleRebind(triggerKey, Number(v)), "onValueChange")
|
|
14681
|
+
}, /* @__PURE__ */ React.createElement(SelectTrigger, {
|
|
14682
|
+
className: "h-8 text-sm w-64"
|
|
14683
|
+
}, /* @__PURE__ */ React.createElement(SelectValue, {
|
|
14684
|
+
placeholder: "Select a template\u2026"
|
|
14685
|
+
})), /* @__PURE__ */ React.createElement(SelectContent, null, templates.map((t) => /* @__PURE__ */ React.createElement(SelectItem, {
|
|
14686
|
+
key: t.id,
|
|
14687
|
+
value: String(t.id)
|
|
14688
|
+
}, t.name, t.providerMeta?.status ? ` (${t.providerMeta.status})` : "")))), template ? /* @__PURE__ */ React.createElement(Button, {
|
|
14689
|
+
type: "button",
|
|
14690
|
+
variant: "ghost",
|
|
14691
|
+
size: "sm",
|
|
14692
|
+
className: "h-8 gap-1 text-xs",
|
|
14693
|
+
onClick: /* @__PURE__ */ __name(() => setEditingTemplateId(template.id), "onClick")
|
|
14694
|
+
}, /* @__PURE__ */ React.createElement(Settings2, {
|
|
14695
|
+
className: "h-3.5 w-3.5"
|
|
14696
|
+
}), paramOrder.length > 0 ? `Params: ${paramOrder.join(" \u2192 ")}` : "Set param order") : null), missingParamOrder ? /* @__PURE__ */ React.createElement("p", {
|
|
14697
|
+
className: "text-xs text-amber-600 dark:text-amber-400"
|
|
14698
|
+
}, "\u26A0 No param order set \u2014 variables may send in the wrong slots.") : null, template?.providerMeta?.language ? /* @__PURE__ */ React.createElement("p", {
|
|
14699
|
+
className: "text-[11px] text-gray-400"
|
|
14700
|
+
}, "Language: ", template.providerMeta.language) : null);
|
|
14701
|
+
})), editingTemplateId !== null && templatesById.get(editingTemplateId) && /* @__PURE__ */ React.createElement(ParamOrderEditor, {
|
|
14702
|
+
template: templatesById.get(editingTemplateId),
|
|
14703
|
+
onCancel: /* @__PURE__ */ __name(() => setEditingTemplateId(null), "onCancel"),
|
|
14704
|
+
onSave: /* @__PURE__ */ __name((order) => void handleSaveParamOrder(editingTemplateId, order), "onSave")
|
|
14705
|
+
}));
|
|
14706
|
+
}
|
|
14707
|
+
function ParamOrderEditor({ template, onCancel, onSave }) {
|
|
14708
|
+
const count = Math.max(varCount(template), template.providerMeta?.paramOrder?.length ?? 0);
|
|
14709
|
+
const example = bodyExample(template);
|
|
14710
|
+
const existing = template.providerMeta?.paramOrder ?? [];
|
|
14711
|
+
const bodyText = template.providerMeta?.components?.find((c) => c.type === "BODY")?.text ?? template.body;
|
|
14712
|
+
const initialGuesses = useMemo(() => {
|
|
14713
|
+
const base = Array.from({
|
|
14714
|
+
length: count
|
|
14715
|
+
}, (_, i) => existing[i] ?? "");
|
|
14716
|
+
const used = new Set(base.filter(Boolean));
|
|
14717
|
+
const auto = /* @__PURE__ */ new Set();
|
|
14718
|
+
const withGuesses = base.map((v, i) => {
|
|
14719
|
+
if (v) return v;
|
|
14720
|
+
const context = contextBeforePlaceholder(bodyText, i + 1);
|
|
14721
|
+
const guess = guessKnownVar(context, example[i] ?? "", used);
|
|
14722
|
+
if (guess) {
|
|
14723
|
+
used.add(guess);
|
|
14724
|
+
auto.add(i);
|
|
14725
|
+
return guess;
|
|
14726
|
+
}
|
|
14727
|
+
return v;
|
|
14728
|
+
});
|
|
14729
|
+
return {
|
|
14730
|
+
values: withGuesses,
|
|
14731
|
+
autoFilled: auto
|
|
14732
|
+
};
|
|
14733
|
+
}, []);
|
|
14734
|
+
const [values, setValues] = useState(initialGuesses.values);
|
|
14735
|
+
const [autoFilled, setAutoFilled] = useState(initialGuesses.autoFilled);
|
|
14736
|
+
const [customIndex, setCustomIndex] = useState(null);
|
|
14737
|
+
function setValue(i, v) {
|
|
14738
|
+
setValues((prev) => {
|
|
14739
|
+
const next = [
|
|
14740
|
+
...prev
|
|
14741
|
+
];
|
|
14742
|
+
next[i] = v;
|
|
14743
|
+
return next;
|
|
14744
|
+
});
|
|
14745
|
+
setAutoFilled((prev) => {
|
|
14746
|
+
if (!prev.has(i)) return prev;
|
|
14747
|
+
const next = new Set(prev);
|
|
14748
|
+
next.delete(i);
|
|
14749
|
+
return next;
|
|
14750
|
+
});
|
|
14751
|
+
}
|
|
14752
|
+
__name(setValue, "setValue");
|
|
14753
|
+
const allFilled = values.length > 0 && values.every((v) => v.trim() !== "");
|
|
14754
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
14755
|
+
className: "fixed inset-0 bg-black/30 flex items-center justify-center z-50 p-4"
|
|
14756
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
14757
|
+
className: "bg-white dark:bg-gray-900 rounded-lg shadow-xl w-full max-w-lg p-5 space-y-4 border border-gray-200 dark:border-gray-700"
|
|
14758
|
+
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", {
|
|
14759
|
+
className: "font-semibold text-gray-900 dark:text-gray-100"
|
|
14760
|
+
}, template.name), /* @__PURE__ */ React.createElement("p", {
|
|
14761
|
+
className: "text-xs text-gray-500 dark:text-gray-400 mt-1 font-mono break-words"
|
|
14762
|
+
}, bodyText)), count === 0 ? /* @__PURE__ */ React.createElement("p", {
|
|
14763
|
+
className: "text-sm text-gray-500 dark:text-gray-400"
|
|
14764
|
+
}, "This template has no positional variables \u2014 nothing to configure.") : /* @__PURE__ */ React.createElement("div", {
|
|
14765
|
+
className: "space-y-2"
|
|
14766
|
+
}, autoFilled.size > 0 ? /* @__PURE__ */ React.createElement("p", {
|
|
14767
|
+
className: "text-xs text-gray-500 dark:text-gray-400"
|
|
14768
|
+
}, "We pre-filled variables we're fairly confident about, based on this template's wording and Meta's example values. Review and adjust anything that looks wrong before saving.") : null, Array.from({
|
|
14769
|
+
length: count
|
|
14770
|
+
}).map((_, i) => /* @__PURE__ */ React.createElement("div", {
|
|
14771
|
+
key: i,
|
|
14772
|
+
className: "flex items-center gap-2"
|
|
14773
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
14774
|
+
className: "text-xs font-mono text-gray-400 w-10"
|
|
14775
|
+
}, `{{${i + 1}}}`), customIndex === i ? /* @__PURE__ */ React.createElement("input", {
|
|
14776
|
+
autoFocus: true,
|
|
14777
|
+
value: values[i],
|
|
14778
|
+
onChange: /* @__PURE__ */ __name((e) => setValue(i, e.target.value), "onChange"),
|
|
14779
|
+
onBlur: /* @__PURE__ */ __name(() => setCustomIndex(null), "onBlur"),
|
|
14780
|
+
placeholder: "custom variable name",
|
|
14781
|
+
className: "flex-1 h-8 border border-gray-300 dark:border-gray-600 rounded-md px-2 text-sm font-mono bg-transparent"
|
|
14782
|
+
}) : /* @__PURE__ */ React.createElement(Select, {
|
|
14783
|
+
value: KNOWN_VARS.includes(values[i]) ? values[i] : values[i] ? "__custom__" : void 0,
|
|
14784
|
+
onValueChange: /* @__PURE__ */ __name((v) => {
|
|
14785
|
+
if (v === "__custom__") {
|
|
14786
|
+
setValue(i, "");
|
|
14787
|
+
setCustomIndex(i);
|
|
14788
|
+
} else {
|
|
14789
|
+
setValue(i, v);
|
|
14790
|
+
}
|
|
14791
|
+
}, "onValueChange")
|
|
14792
|
+
}, /* @__PURE__ */ React.createElement(SelectTrigger, {
|
|
14793
|
+
className: "flex-1 h-8 text-sm"
|
|
14794
|
+
}, /* @__PURE__ */ React.createElement(SelectValue, {
|
|
14795
|
+
placeholder: "Select variable\u2026"
|
|
14796
|
+
})), /* @__PURE__ */ React.createElement(SelectContent, null, KNOWN_VARS.map((v) => /* @__PURE__ */ React.createElement(SelectItem, {
|
|
14797
|
+
key: v,
|
|
14798
|
+
value: v
|
|
14799
|
+
}, v)), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
14800
|
+
value: "__custom__"
|
|
14801
|
+
}, "Custom\u2026"))), autoFilled.has(i) ? /* @__PURE__ */ React.createElement("span", {
|
|
14802
|
+
className: "text-[10px] font-medium text-emerald-600 dark:text-emerald-400 shrink-0"
|
|
14803
|
+
}, "auto") : null, example[i] ? /* @__PURE__ */ React.createElement("span", {
|
|
14804
|
+
className: "text-xs text-gray-400 w-24 truncate shrink-0",
|
|
14805
|
+
title: example[i]
|
|
14806
|
+
}, "e.g. ", example[i]) : null))), /* @__PURE__ */ React.createElement("div", {
|
|
14807
|
+
className: "flex justify-end gap-2 pt-2"
|
|
14808
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
14809
|
+
type: "button",
|
|
14810
|
+
variant: "outline",
|
|
14811
|
+
size: "sm",
|
|
14812
|
+
onClick: onCancel
|
|
14813
|
+
}, "Cancel"), /* @__PURE__ */ React.createElement(Button, {
|
|
14814
|
+
type: "button",
|
|
14815
|
+
size: "sm",
|
|
14816
|
+
disabled: count > 0 && !allFilled,
|
|
14817
|
+
onClick: /* @__PURE__ */ __name(() => onSave(values), "onClick")
|
|
14818
|
+
}, "Save"))));
|
|
14819
|
+
}
|
|
14820
|
+
var KNOWN_VARS, CONTEXT_HINTS;
|
|
14821
|
+
var init_whatsappTriggerBindingsPage = __esm({
|
|
14822
|
+
"src/admin/pages/whatsappTriggerBindingsPage.tsx"() {
|
|
14823
|
+
"use client";
|
|
14824
|
+
init_button();
|
|
14825
|
+
init_select();
|
|
14826
|
+
__name(varCount, "varCount");
|
|
14827
|
+
__name(bodyExample, "bodyExample");
|
|
14828
|
+
KNOWN_VARS = [
|
|
14829
|
+
"orderId",
|
|
14830
|
+
"orderNumber",
|
|
14831
|
+
"customerName",
|
|
14832
|
+
"customerPhone",
|
|
14833
|
+
"total",
|
|
14834
|
+
"currency",
|
|
14835
|
+
"vendorId",
|
|
14836
|
+
"refundAmount"
|
|
14837
|
+
];
|
|
14838
|
+
CONTEXT_HINTS = [
|
|
14839
|
+
{
|
|
14840
|
+
pattern: /refund/,
|
|
14841
|
+
var: "refundAmount"
|
|
14842
|
+
},
|
|
14843
|
+
{
|
|
14844
|
+
pattern: /(order\s*(no\.?|number|#|id))/,
|
|
14845
|
+
var: "orderNumber"
|
|
14846
|
+
},
|
|
14847
|
+
{
|
|
14848
|
+
pattern: /\border\b/,
|
|
14849
|
+
var: "orderNumber"
|
|
14850
|
+
},
|
|
14851
|
+
{
|
|
14852
|
+
pattern: /(phone|mobile|contact\s*number)/,
|
|
14853
|
+
var: "customerPhone"
|
|
14854
|
+
},
|
|
14855
|
+
{
|
|
14856
|
+
pattern: /(vendor|seller|store)/,
|
|
14857
|
+
var: "vendorId"
|
|
14858
|
+
},
|
|
14859
|
+
{
|
|
14860
|
+
pattern: /currency/,
|
|
14861
|
+
var: "currency"
|
|
14862
|
+
},
|
|
14863
|
+
{
|
|
14864
|
+
pattern: /(total|amount|price|pay(?:ment)?)/,
|
|
14865
|
+
var: "total"
|
|
14866
|
+
},
|
|
14867
|
+
{
|
|
14868
|
+
pattern: /(hi|hello|dear|name|customer)/,
|
|
14869
|
+
var: "customerName"
|
|
14870
|
+
}
|
|
14871
|
+
];
|
|
14872
|
+
__name(guessFromContext, "guessFromContext");
|
|
14873
|
+
__name(guessFromExampleShape, "guessFromExampleShape");
|
|
14874
|
+
__name(guessKnownVar, "guessKnownVar");
|
|
14875
|
+
__name(contextBeforePlaceholder, "contextBeforePlaceholder");
|
|
14876
|
+
__name(jsonFetch, "jsonFetch");
|
|
14877
|
+
__name(WhatsAppTriggerBindings, "WhatsAppTriggerBindings");
|
|
14878
|
+
__name(ParamOrderEditor, "ParamOrderEditor");
|
|
14879
|
+
}
|
|
14880
|
+
});
|
|
14349
14881
|
function EventNotificationsPluginSettings({ settingsGroup, enabled, onEnabledChange, onSaveSettings, saving }) {
|
|
14350
14882
|
const [tab, setTab] = useState("email");
|
|
14351
14883
|
const [templateItems, setTemplateItems] = useState([]);
|
|
@@ -14389,19 +14921,20 @@ function EventNotificationsPluginSettings({ settingsGroup, enabled, onEnabledCha
|
|
|
14389
14921
|
className: "space-y-2 text-sm text-gray-700 dark:text-gray-300"
|
|
14390
14922
|
}, /* @__PURE__ */ React.createElement("p", {
|
|
14391
14923
|
className: "font-medium text-gray-900 dark:text-white"
|
|
14392
|
-
}, "
|
|
14924
|
+
}, "Order notifications"), /* @__PURE__ */ React.createElement("ol", {
|
|
14393
14925
|
className: "list-decimal pl-4 space-y-1 text-xs leading-relaxed"
|
|
14394
|
-
}, /* @__PURE__ */ React.createElement("li", null, "
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14926
|
+
}, /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("strong", null, "Email"), " tab: configure the order confirmation email template."), /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("strong", null, "WhatsApp"), " tab: sync Meta templates, then link each trigger from the database list to a template."), /* @__PURE__ */ React.createElement("li", null, "Triggers are stored in ", /* @__PURE__ */ React.createElement("code", {
|
|
14927
|
+
className: "text-[11px]"
|
|
14928
|
+
}, "order_notification_triggers"), " (migration seeds defaults). Bindings live in", " ", /* @__PURE__ */ React.createElement("code", {
|
|
14929
|
+
className: "text-[11px]"
|
|
14930
|
+
}, "whatsapp_trigger_bindings"), ".")), /* @__PURE__ */ React.createElement("p", {
|
|
14398
14931
|
className: "text-xs text-gray-500 dark:text-gray-400"
|
|
14399
14932
|
}, "Requires ", /* @__PURE__ */ React.createElement("strong", null, "Email"), " plugin (SMTP) for email and ", /* @__PURE__ */ React.createElement("strong", null, "WhatsApp"), " plugin (Meta credentials) for WhatsApp delivery.")))), /* @__PURE__ */ React.createElement("div", {
|
|
14400
14933
|
className: "flex items-center justify-between gap-2"
|
|
14401
14934
|
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
14402
14935
|
htmlFor: `${settingsGroup}-enabled`,
|
|
14403
14936
|
className: "text-sm"
|
|
14404
|
-
}, "
|
|
14937
|
+
}, "Order notifications enabled"), /* @__PURE__ */ React.createElement(Switch, {
|
|
14405
14938
|
id: `${settingsGroup}-enabled`,
|
|
14406
14939
|
checked: enabled,
|
|
14407
14940
|
onCheckedChange: onEnabledChange
|
|
@@ -14421,7 +14954,7 @@ function EventNotificationsPluginSettings({ settingsGroup, enabled, onEnabledCha
|
|
|
14421
14954
|
className: `inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium border-b-2 ${tab === "whatsapp" ? "border-gray-800 text-gray-800 dark:border-gray-200 dark:text-gray-100" : "border-transparent text-gray-500 hover:text-gray-700"}`
|
|
14422
14955
|
}, /* @__PURE__ */ React.createElement(MessageCircle, {
|
|
14423
14956
|
className: "h-4 w-4"
|
|
14424
|
-
}), "WhatsApp template"))), loadingTemplates ? /* @__PURE__ */ React.createElement("p", {
|
|
14957
|
+
}), "WhatsApp template"))), tab === "whatsapp" ? /* @__PURE__ */ React.createElement(WhatsAppTriggerBindings, null) : loadingTemplates ? /* @__PURE__ */ React.createElement("p", {
|
|
14425
14958
|
className: "text-sm text-gray-500"
|
|
14426
14959
|
}, "Loading templates\u2026") : /* @__PURE__ */ React.createElement(EventOrderGlobalTemplates, {
|
|
14427
14960
|
items: templateItems,
|
|
@@ -14444,6 +14977,7 @@ var init_EventNotificationsPluginSettings = __esm({
|
|
|
14444
14977
|
init_label();
|
|
14445
14978
|
init_switch();
|
|
14446
14979
|
init_EventOrderGlobalTemplates();
|
|
14980
|
+
init_whatsappTriggerBindingsPage();
|
|
14447
14981
|
__name(EventNotificationsPluginSettings, "EventNotificationsPluginSettings");
|
|
14448
14982
|
}
|
|
14449
14983
|
});
|
|
@@ -14823,6 +15357,7 @@ function PluginSettingsPanel({ descriptor, onSaved }) {
|
|
|
14823
15357
|
const isWhatsapp = settingsGroup === "whatsapp";
|
|
14824
15358
|
const isEventNotifications = settingsGroup === "event_notifications";
|
|
14825
15359
|
const isSocialMedia = settingsGroup === "social_media";
|
|
15360
|
+
const isMultiVendor = settingsGroup === "multi_vendor";
|
|
14826
15361
|
const [enabled, setEnabled] = useState(true);
|
|
14827
15362
|
const [botName, setBotName] = useState("");
|
|
14828
15363
|
const [icon, setIcon] = useState("");
|
|
@@ -14903,6 +15438,7 @@ function PluginSettingsPanel({ descriptor, onSaved }) {
|
|
|
14903
15438
|
const [smsTplItems, setSmsTplItems] = useState([]);
|
|
14904
15439
|
const [whatsappAccessToken, setWhatsappAccessToken] = useState("");
|
|
14905
15440
|
const [whatsappPhoneNumberId, setWhatsappPhoneNumberId] = useState("");
|
|
15441
|
+
const [whatsappWabaId, setWhatsappWabaId] = useState("");
|
|
14906
15442
|
const [whatsappHasSavedToken, setWhatsappHasSavedToken] = useState(false);
|
|
14907
15443
|
const [loading, setLoading] = useState(true);
|
|
14908
15444
|
const [saving, setSaving] = useState(false);
|
|
@@ -15169,6 +15705,7 @@ function PluginSettingsPanel({ descriptor, onSaved }) {
|
|
|
15169
15705
|
setWhatsappAccessToken(savedToken);
|
|
15170
15706
|
setWhatsappHasSavedToken(Boolean(savedToken));
|
|
15171
15707
|
setWhatsappPhoneNumberId(String(data.phoneNumberId ?? data.WHATSAPP_PHONE_NUMBER_ID ?? "").trim());
|
|
15708
|
+
setWhatsappWabaId(String(data.wabaId ?? data.WHATSAPP_WABA_ID ?? "").trim());
|
|
15172
15709
|
}
|
|
15173
15710
|
if (isSocialMedia) {
|
|
15174
15711
|
const savedLiToken = String(data.linkedin_access_token ?? "").trim();
|
|
@@ -15206,7 +15743,8 @@ function PluginSettingsPanel({ descriptor, onSaved }) {
|
|
|
15206
15743
|
isSms,
|
|
15207
15744
|
isWhatsapp,
|
|
15208
15745
|
isEventNotifications,
|
|
15209
|
-
isSocialMedia
|
|
15746
|
+
isSocialMedia,
|
|
15747
|
+
isMultiVendor
|
|
15210
15748
|
]);
|
|
15211
15749
|
useEffect(() => {
|
|
15212
15750
|
if (!isSocialMedia || loading || linkedInOrgsPrefetchedRef.current) return;
|
|
@@ -15621,6 +16159,10 @@ function PluginSettingsPanel({ descriptor, onSaved }) {
|
|
|
15621
16159
|
phoneNumberId: {
|
|
15622
16160
|
value: whatsappPhoneNumberId.trim(),
|
|
15623
16161
|
type: "public"
|
|
16162
|
+
},
|
|
16163
|
+
wabaId: {
|
|
16164
|
+
value: whatsappWabaId.trim(),
|
|
16165
|
+
type: "public"
|
|
15624
16166
|
}
|
|
15625
16167
|
};
|
|
15626
16168
|
if (whatsappAccessToken.trim()) {
|
|
@@ -15632,6 +16174,14 @@ function PluginSettingsPanel({ descriptor, onSaved }) {
|
|
|
15632
16174
|
}
|
|
15633
16175
|
return payload2;
|
|
15634
16176
|
}
|
|
16177
|
+
if (isMultiVendor) {
|
|
16178
|
+
return {
|
|
16179
|
+
enabled: {
|
|
16180
|
+
value: enabled ? "true" : "false",
|
|
16181
|
+
type: "public"
|
|
16182
|
+
}
|
|
16183
|
+
};
|
|
16184
|
+
}
|
|
15635
16185
|
if (isEventNotifications) {
|
|
15636
16186
|
return {
|
|
15637
16187
|
enabled: {
|
|
@@ -16220,6 +16770,27 @@ function PluginSettingsPanel({ descriptor, onSaved }) {
|
|
|
16220
16770
|
className: "h-3.5 w-3.5"
|
|
16221
16771
|
}), "Save"));
|
|
16222
16772
|
}
|
|
16773
|
+
if (isMultiVendor) {
|
|
16774
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
16775
|
+
className: "space-y-4"
|
|
16776
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
16777
|
+
className: "flex items-center justify-between gap-2"
|
|
16778
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
16779
|
+
htmlFor: `${settingsGroup}-enabled`,
|
|
16780
|
+
className: "text-sm"
|
|
16781
|
+
}, "Enabled"), /* @__PURE__ */ React.createElement(Switch, {
|
|
16782
|
+
id: `${settingsGroup}-enabled`,
|
|
16783
|
+
checked: enabled,
|
|
16784
|
+
onCheckedChange: setEnabled
|
|
16785
|
+
})), /* @__PURE__ */ React.createElement(Button, {
|
|
16786
|
+
size: "sm",
|
|
16787
|
+
onClick: handleSave,
|
|
16788
|
+
disabled: saving,
|
|
16789
|
+
className: "gap-1"
|
|
16790
|
+
}, /* @__PURE__ */ React.createElement(Save, {
|
|
16791
|
+
className: "h-3.5 w-3.5"
|
|
16792
|
+
}), "Save"));
|
|
16793
|
+
}
|
|
16223
16794
|
if (isEventNotifications) {
|
|
16224
16795
|
return /* @__PURE__ */ React.createElement(EventNotificationsPluginSettings, {
|
|
16225
16796
|
settingsGroup,
|
|
@@ -16448,6 +17019,19 @@ function PluginSettingsPanel({ descriptor, onSaved }) {
|
|
|
16448
17019
|
className: "h-9 text-sm"
|
|
16449
17020
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
16450
17021
|
className: "space-y-1"
|
|
17022
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
17023
|
+
htmlFor: `${settingsGroup}-wabaId`,
|
|
17024
|
+
className: "text-sm"
|
|
17025
|
+
}, "WhatsApp Business Account (WABA) ID"), /* @__PURE__ */ React.createElement(Input, {
|
|
17026
|
+
id: `${settingsGroup}-wabaId`,
|
|
17027
|
+
value: whatsappWabaId,
|
|
17028
|
+
onChange: /* @__PURE__ */ __name((e) => setWhatsappWabaId(e.target.value), "onChange"),
|
|
17029
|
+
placeholder: "From Meta Business Manager \u2192 WhatsApp Accounts",
|
|
17030
|
+
className: "h-9 text-sm"
|
|
17031
|
+
}), /* @__PURE__ */ React.createElement("p", {
|
|
17032
|
+
className: "text-xs text-gray-500 dark:text-gray-400"
|
|
17033
|
+
}, "Used to list/sync approved templates for this account \u2014 distinct from the phone number ID above.")), /* @__PURE__ */ React.createElement("div", {
|
|
17034
|
+
className: "space-y-1"
|
|
16451
17035
|
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
16452
17036
|
htmlFor: `${settingsGroup}-accessToken`,
|
|
16453
17037
|
className: "text-sm"
|
|
@@ -16458,9 +17042,7 @@ function PluginSettingsPanel({ descriptor, onSaved }) {
|
|
|
16458
17042
|
onChange: /* @__PURE__ */ __name((e) => setWhatsappAccessToken(e.target.value), "onChange"),
|
|
16459
17043
|
placeholder: "Permanent or system user token",
|
|
16460
17044
|
className: "h-9 text-sm"
|
|
16461
|
-
})), /* @__PURE__ */ React.createElement(
|
|
16462
|
-
className: "text-xs text-gray-500 dark:text-gray-400"
|
|
16463
|
-
}, "Message templates for events are configured under Plugins \u2192 Event notifications."), /* @__PURE__ */ React.createElement(Button, {
|
|
17045
|
+
})), /* @__PURE__ */ React.createElement(Button, {
|
|
16464
17046
|
size: "sm",
|
|
16465
17047
|
onClick: handleSave,
|
|
16466
17048
|
disabled: saving
|
|
@@ -24138,7 +24720,7 @@ function LayoutPanelContent() {
|
|
|
24138
24720
|
flexFill: props.flexFill ?? false
|
|
24139
24721
|
};
|
|
24140
24722
|
const fieldCls = "flex items-center gap-2 min-h-[28px]";
|
|
24141
|
-
const
|
|
24723
|
+
const labelCls8 = "text-[11px] text-gray-500 font-medium w-14 shrink-0";
|
|
24142
24724
|
const inputCls9 = "h-7 text-xs flex-1 min-w-0 rounded border border-input bg-background px-2";
|
|
24143
24725
|
const selectCls = "h-7 w-full text-xs rounded border border-input bg-background px-2";
|
|
24144
24726
|
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
@@ -24152,7 +24734,7 @@ function LayoutPanelContent() {
|
|
|
24152
24734
|
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
24153
24735
|
className: fieldCls
|
|
24154
24736
|
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
24155
|
-
className:
|
|
24737
|
+
className: labelCls8
|
|
24156
24738
|
}, "W"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
24157
24739
|
value: layoutProps.width,
|
|
24158
24740
|
onChange: /* @__PURE__ */ __name((e) => setLayoutProp("width", e.target.value), "onChange"),
|
|
@@ -24161,7 +24743,7 @@ function LayoutPanelContent() {
|
|
|
24161
24743
|
})), /* @__PURE__ */ React26__default.createElement("div", {
|
|
24162
24744
|
className: fieldCls
|
|
24163
24745
|
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
24164
|
-
className:
|
|
24746
|
+
className: labelCls8
|
|
24165
24747
|
}, "H"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
24166
24748
|
value: layoutProps.height,
|
|
24167
24749
|
onChange: /* @__PURE__ */ __name((e) => setLayoutProp("height", e.target.value), "onChange"),
|
|
@@ -24176,7 +24758,7 @@ function LayoutPanelContent() {
|
|
|
24176
24758
|
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
24177
24759
|
className: fieldCls
|
|
24178
24760
|
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
24179
|
-
className:
|
|
24761
|
+
className: labelCls8
|
|
24180
24762
|
}, "Margin"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
24181
24763
|
value: layoutProps.margin,
|
|
24182
24764
|
onChange: /* @__PURE__ */ __name((e) => setLayoutProp("margin", e.target.value), "onChange"),
|
|
@@ -24185,7 +24767,7 @@ function LayoutPanelContent() {
|
|
|
24185
24767
|
})), /* @__PURE__ */ React26__default.createElement("div", {
|
|
24186
24768
|
className: fieldCls
|
|
24187
24769
|
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
24188
|
-
className:
|
|
24770
|
+
className: labelCls8
|
|
24189
24771
|
}, "Padding"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
24190
24772
|
value: layoutProps.padding,
|
|
24191
24773
|
onChange: /* @__PURE__ */ __name((e) => setLayoutProp("padding", e.target.value), "onChange"),
|
|
@@ -24200,7 +24782,7 @@ function LayoutPanelContent() {
|
|
|
24200
24782
|
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
24201
24783
|
className: fieldCls
|
|
24202
24784
|
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
24203
|
-
className:
|
|
24785
|
+
className: labelCls8
|
|
24204
24786
|
}, "Radius"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
24205
24787
|
value: layoutProps.borderRadius,
|
|
24206
24788
|
onChange: /* @__PURE__ */ __name((e) => setLayoutProp("borderRadius", e.target.value), "onChange"),
|
|
@@ -24209,7 +24791,7 @@ function LayoutPanelContent() {
|
|
|
24209
24791
|
})), /* @__PURE__ */ React26__default.createElement("div", {
|
|
24210
24792
|
className: fieldCls
|
|
24211
24793
|
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
24212
|
-
className:
|
|
24794
|
+
className: labelCls8
|
|
24213
24795
|
}, "Shadow"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
24214
24796
|
value: layoutProps.boxShadow,
|
|
24215
24797
|
onChange: /* @__PURE__ */ __name((e) => setLayoutProp("boxShadow", e.target.value), "onChange"),
|
|
@@ -24224,7 +24806,7 @@ function LayoutPanelContent() {
|
|
|
24224
24806
|
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
24225
24807
|
className: fieldCls
|
|
24226
24808
|
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
24227
|
-
className:
|
|
24809
|
+
className: labelCls8
|
|
24228
24810
|
}, "Direction"), /* @__PURE__ */ React26__default.createElement("select", {
|
|
24229
24811
|
value: layoutProps.flexDirection,
|
|
24230
24812
|
onChange: /* @__PURE__ */ __name((e) => setLayoutProp("flexDirection", e.target.value), "onChange"),
|
|
@@ -24240,7 +24822,7 @@ function LayoutPanelContent() {
|
|
|
24240
24822
|
}, "Column reverse"))), /* @__PURE__ */ React26__default.createElement("div", {
|
|
24241
24823
|
className: fieldCls
|
|
24242
24824
|
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
24243
|
-
className:
|
|
24825
|
+
className: labelCls8
|
|
24244
24826
|
}, "Align"), /* @__PURE__ */ React26__default.createElement("select", {
|
|
24245
24827
|
value: layoutProps.alignItems,
|
|
24246
24828
|
onChange: /* @__PURE__ */ __name((e) => setLayoutProp("alignItems", e.target.value), "onChange"),
|
|
@@ -24256,7 +24838,7 @@ function LayoutPanelContent() {
|
|
|
24256
24838
|
}, "Stretch"))), /* @__PURE__ */ React26__default.createElement("div", {
|
|
24257
24839
|
className: fieldCls
|
|
24258
24840
|
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
24259
|
-
className:
|
|
24841
|
+
className: labelCls8
|
|
24260
24842
|
}, "Justify"), /* @__PURE__ */ React26__default.createElement("select", {
|
|
24261
24843
|
value: layoutProps.justifyContent,
|
|
24262
24844
|
onChange: /* @__PURE__ */ __name((e) => setLayoutProp("justifyContent", e.target.value), "onChange"),
|
|
@@ -28825,428 +29407,6 @@ var init_EventProductsSection = __esm({
|
|
|
28825
29407
|
__name(EventProductsSection, "EventProductsSection");
|
|
28826
29408
|
}
|
|
28827
29409
|
});
|
|
28828
|
-
function VariableChip({ name, onCopy }) {
|
|
28829
|
-
return /* @__PURE__ */ React.createElement("button", {
|
|
28830
|
-
type: "button",
|
|
28831
|
-
onClick: onCopy,
|
|
28832
|
-
className: "inline-flex items-center rounded-md border border-gray-200 bg-white px-2 py-0.5 font-mono text-[11px] text-gray-700 hover:border-gray-300 hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700",
|
|
28833
|
-
title: "Click to copy"
|
|
28834
|
-
}, `{{${name}}}`);
|
|
28835
|
-
}
|
|
28836
|
-
function ChannelToggle({ label, icon: Icon2, checked, onChange }) {
|
|
28837
|
-
return /* @__PURE__ */ React.createElement("button", {
|
|
28838
|
-
type: "button",
|
|
28839
|
-
role: "checkbox",
|
|
28840
|
-
"aria-checked": checked,
|
|
28841
|
-
onClick: onChange,
|
|
28842
|
-
className: `inline-flex items-center gap-2 rounded-lg border px-3 py-2 text-sm font-medium transition-colors ${checked ? "border-gray-800 bg-gray-900 text-white dark:border-gray-300 dark:bg-gray-100 dark:text-gray-900" : "border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`
|
|
28843
|
-
}, /* @__PURE__ */ React.createElement(Icon2, {
|
|
28844
|
-
className: "h-4 w-4 shrink-0"
|
|
28845
|
-
}), label);
|
|
28846
|
-
}
|
|
28847
|
-
function EventNotificationSettings({ eventId }) {
|
|
28848
|
-
const [loading, setLoading] = useState(true);
|
|
28849
|
-
const [saving, setSaving] = useState(false);
|
|
28850
|
-
const [settings, setSettings] = useState(null);
|
|
28851
|
-
const [testEmail, setTestEmail] = useState("");
|
|
28852
|
-
const [testPhone, setTestPhone] = useState("");
|
|
28853
|
-
const [testing, setTesting] = useState(null);
|
|
28854
|
-
const [varsOpen, setVarsOpen] = useState(false);
|
|
28855
|
-
const load = useCallback(async () => {
|
|
28856
|
-
setLoading(true);
|
|
28857
|
-
try {
|
|
28858
|
-
const res = await fetch(`/api/events/${eventId}/notifications`);
|
|
28859
|
-
if (!res.ok) throw new Error("Failed to load");
|
|
28860
|
-
const data = await res.json();
|
|
28861
|
-
setSettings(data);
|
|
28862
|
-
} catch {
|
|
28863
|
-
toast.error("Could not load notification settings");
|
|
28864
|
-
} finally {
|
|
28865
|
-
setLoading(false);
|
|
28866
|
-
}
|
|
28867
|
-
}, [
|
|
28868
|
-
eventId
|
|
28869
|
-
]);
|
|
28870
|
-
useEffect(() => {
|
|
28871
|
-
void load();
|
|
28872
|
-
}, [
|
|
28873
|
-
load
|
|
28874
|
-
]);
|
|
28875
|
-
const toggleChannel = /* @__PURE__ */ __name((ch) => {
|
|
28876
|
-
if (!settings) return;
|
|
28877
|
-
const has = settings.channels.includes(ch);
|
|
28878
|
-
setSettings({
|
|
28879
|
-
...settings,
|
|
28880
|
-
channels: has ? settings.channels.filter((c) => c !== ch) : [
|
|
28881
|
-
...settings.channels,
|
|
28882
|
-
ch
|
|
28883
|
-
]
|
|
28884
|
-
});
|
|
28885
|
-
}, "toggleChannel");
|
|
28886
|
-
const updateTemplate = /* @__PURE__ */ __name((ch, patch) => {
|
|
28887
|
-
if (!settings) return;
|
|
28888
|
-
setSettings({
|
|
28889
|
-
...settings,
|
|
28890
|
-
templates: {
|
|
28891
|
-
...settings.templates,
|
|
28892
|
-
[ch]: {
|
|
28893
|
-
...settings.templates[ch],
|
|
28894
|
-
...patch
|
|
28895
|
-
}
|
|
28896
|
-
}
|
|
28897
|
-
});
|
|
28898
|
-
}, "updateTemplate");
|
|
28899
|
-
const resetTemplate = /* @__PURE__ */ __name((ch) => {
|
|
28900
|
-
if (!settings) return;
|
|
28901
|
-
const def = settings.globalDefaults.find((d) => d.channel === ch);
|
|
28902
|
-
if (!def) return;
|
|
28903
|
-
setSettings({
|
|
28904
|
-
...settings,
|
|
28905
|
-
templates: {
|
|
28906
|
-
...settings.templates,
|
|
28907
|
-
[ch]: {
|
|
28908
|
-
subject: def.subject ?? "",
|
|
28909
|
-
body: def.body,
|
|
28910
|
-
externalTemplateRef: def.externalTemplateRef ?? ""
|
|
28911
|
-
}
|
|
28912
|
-
}
|
|
28913
|
-
});
|
|
28914
|
-
toast.success(`${ch === "email" ? "Email" : "WhatsApp"} template reset to default`);
|
|
28915
|
-
}, "resetTemplate");
|
|
28916
|
-
const copyVariable = /* @__PURE__ */ __name(async (name) => {
|
|
28917
|
-
try {
|
|
28918
|
-
await navigator.clipboard.writeText(`{{${name}}}`);
|
|
28919
|
-
toast.success(`Copied {{${name}}}`);
|
|
28920
|
-
} catch {
|
|
28921
|
-
toast.error("Could not copy");
|
|
28922
|
-
}
|
|
28923
|
-
}, "copyVariable");
|
|
28924
|
-
const handleSave = /* @__PURE__ */ __name(async () => {
|
|
28925
|
-
if (!settings) return;
|
|
28926
|
-
setSaving(true);
|
|
28927
|
-
try {
|
|
28928
|
-
const res = await fetch(`/api/events/${eventId}/notifications`, {
|
|
28929
|
-
method: "PUT",
|
|
28930
|
-
headers: {
|
|
28931
|
-
"Content-Type": "application/json"
|
|
28932
|
-
},
|
|
28933
|
-
body: JSON.stringify({
|
|
28934
|
-
enabled: settings.enabled,
|
|
28935
|
-
channels: settings.channels,
|
|
28936
|
-
templates: settings.templates
|
|
28937
|
-
})
|
|
28938
|
-
});
|
|
28939
|
-
if (!res.ok) throw new Error();
|
|
28940
|
-
toast.success("Notification settings saved");
|
|
28941
|
-
await load();
|
|
28942
|
-
} catch {
|
|
28943
|
-
toast.error("Failed to save notification settings");
|
|
28944
|
-
} finally {
|
|
28945
|
-
setSaving(false);
|
|
28946
|
-
}
|
|
28947
|
-
}, "handleSave");
|
|
28948
|
-
const sendTest = /* @__PURE__ */ __name(async (channel) => {
|
|
28949
|
-
setTesting(channel);
|
|
28950
|
-
try {
|
|
28951
|
-
const res = await fetch(`/api/events/${eventId}/notifications/test`, {
|
|
28952
|
-
method: "POST",
|
|
28953
|
-
headers: {
|
|
28954
|
-
"Content-Type": "application/json"
|
|
28955
|
-
},
|
|
28956
|
-
body: JSON.stringify({
|
|
28957
|
-
channel,
|
|
28958
|
-
email: testEmail.trim() || void 0,
|
|
28959
|
-
phone: testPhone.trim() || void 0
|
|
28960
|
-
})
|
|
28961
|
-
});
|
|
28962
|
-
const data = await res.json().catch(() => ({}));
|
|
28963
|
-
if (!res.ok) {
|
|
28964
|
-
toast.error(data.error ?? "Test failed");
|
|
28965
|
-
return;
|
|
28966
|
-
}
|
|
28967
|
-
toast.success(data.message ?? "Test notification queued");
|
|
28968
|
-
} catch {
|
|
28969
|
-
toast.error("Test failed");
|
|
28970
|
-
} finally {
|
|
28971
|
-
setTesting(null);
|
|
28972
|
-
}
|
|
28973
|
-
}, "sendTest");
|
|
28974
|
-
if (loading) {
|
|
28975
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
28976
|
-
className: `${panelCls} flex items-center gap-2 text-sm text-gray-500`
|
|
28977
|
-
}, /* @__PURE__ */ React.createElement(Loader2, {
|
|
28978
|
-
className: "h-4 w-4 animate-spin"
|
|
28979
|
-
}), "Loading notification settings\u2026");
|
|
28980
|
-
}
|
|
28981
|
-
if (!settings) return null;
|
|
28982
|
-
const emailTpl = settings.templates.email ?? {};
|
|
28983
|
-
const waTpl = settings.templates.whatsapp ?? {};
|
|
28984
|
-
const emailDefault = settings.globalDefaults.find((d) => d.channel === "email");
|
|
28985
|
-
const waDefault = settings.globalDefaults.find((d) => d.channel === "whatsapp");
|
|
28986
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
28987
|
-
className: "space-y-5"
|
|
28988
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
28989
|
-
className: panelCls
|
|
28990
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
28991
|
-
className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between"
|
|
28992
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
28993
|
-
className: "space-y-1 min-w-0"
|
|
28994
|
-
}, /* @__PURE__ */ React.createElement("label", {
|
|
28995
|
-
className: "flex items-start gap-3 cursor-pointer group"
|
|
28996
|
-
}, /* @__PURE__ */ React.createElement("input", {
|
|
28997
|
-
type: "checkbox",
|
|
28998
|
-
checked: settings.enabled,
|
|
28999
|
-
onChange: /* @__PURE__ */ __name((e) => setSettings({
|
|
29000
|
-
...settings,
|
|
29001
|
-
enabled: e.target.checked
|
|
29002
|
-
}), "onChange"),
|
|
29003
|
-
className: "mt-0.5 h-4 w-4 rounded border-gray-300"
|
|
29004
|
-
}), /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", {
|
|
29005
|
-
className: "block text-sm font-medium text-gray-900 dark:text-gray-100"
|
|
29006
|
-
}, "Send notifications when an order is placed"), /* @__PURE__ */ React.createElement("span", {
|
|
29007
|
-
className: hintCls
|
|
29008
|
-
}, "Uses global templates from Plugins \u2192 Event notifications. Requires Email and/or WhatsApp plugins for delivery."))))), settings.enabled ? /* @__PURE__ */ React.createElement("div", {
|
|
29009
|
-
className: "mt-5 pt-5 border-t border-gray-100 dark:border-gray-700"
|
|
29010
|
-
}, /* @__PURE__ */ React.createElement("p", {
|
|
29011
|
-
className: labelCls5
|
|
29012
|
-
}, "Channels"), /* @__PURE__ */ React.createElement("div", {
|
|
29013
|
-
className: "flex flex-wrap gap-2"
|
|
29014
|
-
}, /* @__PURE__ */ React.createElement(ChannelToggle, {
|
|
29015
|
-
label: "Email",
|
|
29016
|
-
icon: Mail,
|
|
29017
|
-
checked: settings.channels.includes("email"),
|
|
29018
|
-
onChange: /* @__PURE__ */ __name(() => toggleChannel("email"), "onChange")
|
|
29019
|
-
}), /* @__PURE__ */ React.createElement(ChannelToggle, {
|
|
29020
|
-
label: "WhatsApp",
|
|
29021
|
-
icon: MessageCircle,
|
|
29022
|
-
checked: settings.channels.includes("whatsapp"),
|
|
29023
|
-
onChange: /* @__PURE__ */ __name(() => toggleChannel("whatsapp"), "onChange")
|
|
29024
|
-
})), settings.channels.length === 0 ? /* @__PURE__ */ React.createElement("p", {
|
|
29025
|
-
className: "mt-2 text-xs text-amber-700 dark:text-amber-400"
|
|
29026
|
-
}, "Select at least one channel to send notifications.") : null) : null), settings.enabled && settings.channels.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
29027
|
-
className: panelCls
|
|
29028
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
29029
|
-
type: "button",
|
|
29030
|
-
onClick: /* @__PURE__ */ __name(() => setVarsOpen((o) => !o), "onClick"),
|
|
29031
|
-
className: "flex w-full items-center justify-between gap-2 text-left"
|
|
29032
|
-
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("p", {
|
|
29033
|
-
className: "text-sm font-medium text-gray-900 dark:text-gray-100"
|
|
29034
|
-
}, "Template variables"), /* @__PURE__ */ React.createElement("p", {
|
|
29035
|
-
className: hintCls
|
|
29036
|
-
}, "Click a variable to copy it into your template.")), varsOpen ? /* @__PURE__ */ React.createElement(ChevronUp, {
|
|
29037
|
-
className: "h-4 w-4 shrink-0 text-gray-400"
|
|
29038
|
-
}) : /* @__PURE__ */ React.createElement(ChevronDown, {
|
|
29039
|
-
className: "h-4 w-4 shrink-0 text-gray-400"
|
|
29040
|
-
})), varsOpen ? /* @__PURE__ */ React.createElement("div", {
|
|
29041
|
-
className: "mt-3 flex flex-wrap gap-1.5"
|
|
29042
|
-
}, settings.templateVariables.map((v) => /* @__PURE__ */ React.createElement(VariableChip, {
|
|
29043
|
-
key: v,
|
|
29044
|
-
name: v,
|
|
29045
|
-
onCopy: /* @__PURE__ */ __name(() => copyVariable(v), "onCopy")
|
|
29046
|
-
}))) : null), settings.channels.includes("email") ? /* @__PURE__ */ React.createElement("div", {
|
|
29047
|
-
className: panelCls
|
|
29048
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
29049
|
-
className: "flex flex-wrap items-center justify-between gap-3 mb-4"
|
|
29050
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
29051
|
-
className: "flex items-center gap-2"
|
|
29052
|
-
}, /* @__PURE__ */ React.createElement(Mail, {
|
|
29053
|
-
className: "h-4 w-4 text-gray-500"
|
|
29054
|
-
}), /* @__PURE__ */ React.createElement("h3", {
|
|
29055
|
-
className: "text-sm font-semibold text-gray-900 dark:text-gray-100"
|
|
29056
|
-
}, "Email template")), /* @__PURE__ */ React.createElement(Button, {
|
|
29057
|
-
type: "button",
|
|
29058
|
-
variant: "outline",
|
|
29059
|
-
size: "sm",
|
|
29060
|
-
onClick: /* @__PURE__ */ __name(() => resetTemplate("email"), "onClick"),
|
|
29061
|
-
className: "gap-1.5 h-8"
|
|
29062
|
-
}, /* @__PURE__ */ React.createElement(RotateCcw, {
|
|
29063
|
-
className: "h-3.5 w-3.5"
|
|
29064
|
-
}), "Reset to default")), /* @__PURE__ */ React.createElement("div", {
|
|
29065
|
-
className: subPanelCls
|
|
29066
|
-
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label3, {
|
|
29067
|
-
className: labelCls5
|
|
29068
|
-
}, "Subject"), /* @__PURE__ */ React.createElement(Input, {
|
|
29069
|
-
value: emailTpl.subject ?? "",
|
|
29070
|
-
onChange: /* @__PURE__ */ __name((e) => updateTemplate("email", {
|
|
29071
|
-
subject: e.target.value
|
|
29072
|
-
}), "onChange"),
|
|
29073
|
-
className: "h-9 text-sm",
|
|
29074
|
-
placeholder: emailDefault?.subject ?? "Order confirmation for {{eventName}}"
|
|
29075
|
-
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label3, {
|
|
29076
|
-
className: labelCls5
|
|
29077
|
-
}, "Body"), /* @__PURE__ */ React.createElement("p", {
|
|
29078
|
-
className: `${hintCls} mb-2`
|
|
29079
|
-
}, "HTML is supported. Use variables from the list above."), /* @__PURE__ */ React.createElement(Textarea, {
|
|
29080
|
-
value: emailTpl.body ?? "",
|
|
29081
|
-
onChange: /* @__PURE__ */ __name((e) => updateTemplate("email", {
|
|
29082
|
-
body: e.target.value
|
|
29083
|
-
}), "onChange"),
|
|
29084
|
-
rows: 8,
|
|
29085
|
-
className: "text-sm font-mono min-h-[180px] resize-y",
|
|
29086
|
-
placeholder: emailDefault?.body ?? ""
|
|
29087
|
-
})))) : null, settings.channels.includes("whatsapp") ? /* @__PURE__ */ React.createElement("div", {
|
|
29088
|
-
className: panelCls
|
|
29089
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
29090
|
-
className: "flex flex-wrap items-center justify-between gap-3 mb-4"
|
|
29091
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
29092
|
-
className: "flex items-center gap-2"
|
|
29093
|
-
}, /* @__PURE__ */ React.createElement(MessageCircle, {
|
|
29094
|
-
className: "h-4 w-4 text-gray-500"
|
|
29095
|
-
}), /* @__PURE__ */ React.createElement("h3", {
|
|
29096
|
-
className: "text-sm font-semibold text-gray-900 dark:text-gray-100"
|
|
29097
|
-
}, "WhatsApp template")), /* @__PURE__ */ React.createElement(Button, {
|
|
29098
|
-
type: "button",
|
|
29099
|
-
variant: "outline",
|
|
29100
|
-
size: "sm",
|
|
29101
|
-
onClick: /* @__PURE__ */ __name(() => resetTemplate("whatsapp"), "onClick"),
|
|
29102
|
-
className: "gap-1.5 h-8"
|
|
29103
|
-
}, /* @__PURE__ */ React.createElement(RotateCcw, {
|
|
29104
|
-
className: "h-3.5 w-3.5"
|
|
29105
|
-
}), "Reset to default")), /* @__PURE__ */ React.createElement("div", {
|
|
29106
|
-
className: subPanelCls
|
|
29107
|
-
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label3, {
|
|
29108
|
-
className: labelCls5
|
|
29109
|
-
}, "Meta approved template name"), /* @__PURE__ */ React.createElement(Input, {
|
|
29110
|
-
value: waTpl.externalTemplateRef ?? "",
|
|
29111
|
-
onChange: /* @__PURE__ */ __name((e) => updateTemplate("whatsapp", {
|
|
29112
|
-
externalTemplateRef: e.target.value
|
|
29113
|
-
}), "onChange"),
|
|
29114
|
-
placeholder: waDefault?.externalTemplateRef ?? "event_order_placed",
|
|
29115
|
-
className: "h-9 text-sm"
|
|
29116
|
-
}), /* @__PURE__ */ React.createElement("p", {
|
|
29117
|
-
className: `${hintCls} mt-1.5`
|
|
29118
|
-
}, "Must match a template approved in your Meta Business account.")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label3, {
|
|
29119
|
-
className: labelCls5
|
|
29120
|
-
}, "Body (reference)"), /* @__PURE__ */ React.createElement("p", {
|
|
29121
|
-
className: `${hintCls} mb-2`
|
|
29122
|
-
}, "Used as fallback documentation; WhatsApp sends via the Meta template above."), /* @__PURE__ */ React.createElement(Textarea, {
|
|
29123
|
-
value: waTpl.body ?? "",
|
|
29124
|
-
onChange: /* @__PURE__ */ __name((e) => updateTemplate("whatsapp", {
|
|
29125
|
-
body: e.target.value
|
|
29126
|
-
}), "onChange"),
|
|
29127
|
-
rows: 4,
|
|
29128
|
-
className: "text-sm min-h-[100px] resize-y",
|
|
29129
|
-
placeholder: waDefault?.body ?? ""
|
|
29130
|
-
})))) : null, /* @__PURE__ */ React.createElement("div", {
|
|
29131
|
-
className: panelCls
|
|
29132
|
-
}, /* @__PURE__ */ React.createElement("p", {
|
|
29133
|
-
className: "text-sm font-semibold text-gray-900 dark:text-gray-100 mb-1"
|
|
29134
|
-
}, "Send test"), /* @__PURE__ */ React.createElement("p", {
|
|
29135
|
-
className: `${hintCls} mb-4`
|
|
29136
|
-
}, "Queue a test notification with sample order data. Uses the templates above (save first if you changed them)."), /* @__PURE__ */ React.createElement("div", {
|
|
29137
|
-
className: "grid gap-4 sm:grid-cols-2"
|
|
29138
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
29139
|
-
className: subPanelCls
|
|
29140
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
29141
|
-
className: "flex items-center gap-2 mb-3"
|
|
29142
|
-
}, /* @__PURE__ */ React.createElement(Mail, {
|
|
29143
|
-
className: "h-4 w-4 text-gray-500"
|
|
29144
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
29145
|
-
className: "text-sm font-medium text-gray-900 dark:text-gray-100"
|
|
29146
|
-
}, "Test email")), /* @__PURE__ */ React.createElement(Label3, {
|
|
29147
|
-
className: labelCls5
|
|
29148
|
-
}, "Recipient"), /* @__PURE__ */ React.createElement(Input, {
|
|
29149
|
-
value: testEmail,
|
|
29150
|
-
onChange: /* @__PURE__ */ __name((e) => setTestEmail(e.target.value), "onChange"),
|
|
29151
|
-
type: "email",
|
|
29152
|
-
className: "h-9 text-sm mb-3",
|
|
29153
|
-
placeholder: "you@example.com"
|
|
29154
|
-
}), /* @__PURE__ */ React.createElement(Button, {
|
|
29155
|
-
type: "button",
|
|
29156
|
-
variant: "outline",
|
|
29157
|
-
size: "sm",
|
|
29158
|
-
disabled: testing !== null || !settings.channels.includes("email"),
|
|
29159
|
-
onClick: /* @__PURE__ */ __name(() => sendTest("email"), "onClick"),
|
|
29160
|
-
className: "gap-1.5 w-full sm:w-auto"
|
|
29161
|
-
}, testing === "email" ? /* @__PURE__ */ React.createElement(Loader2, {
|
|
29162
|
-
className: "h-3.5 w-3.5 animate-spin"
|
|
29163
|
-
}) : /* @__PURE__ */ React.createElement(Send, {
|
|
29164
|
-
className: "h-3.5 w-3.5"
|
|
29165
|
-
}), "Send test email")), /* @__PURE__ */ React.createElement("div", {
|
|
29166
|
-
className: subPanelCls
|
|
29167
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
29168
|
-
className: "flex items-center gap-2 mb-3"
|
|
29169
|
-
}, /* @__PURE__ */ React.createElement(MessageCircle, {
|
|
29170
|
-
className: "h-4 w-4 text-gray-500"
|
|
29171
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
29172
|
-
className: "text-sm font-medium text-gray-900 dark:text-gray-100"
|
|
29173
|
-
}, "Test WhatsApp")), /* @__PURE__ */ React.createElement(Label3, {
|
|
29174
|
-
className: labelCls5
|
|
29175
|
-
}, "Phone number"), /* @__PURE__ */ React.createElement(Input, {
|
|
29176
|
-
value: testPhone,
|
|
29177
|
-
onChange: /* @__PURE__ */ __name((e) => setTestPhone(e.target.value), "onChange"),
|
|
29178
|
-
className: "h-9 text-sm mb-3",
|
|
29179
|
-
placeholder: "+91 98765 43210"
|
|
29180
|
-
}), /* @__PURE__ */ React.createElement(Button, {
|
|
29181
|
-
type: "button",
|
|
29182
|
-
variant: "outline",
|
|
29183
|
-
size: "sm",
|
|
29184
|
-
disabled: testing !== null || !settings.channels.includes("whatsapp"),
|
|
29185
|
-
onClick: /* @__PURE__ */ __name(() => sendTest("whatsapp"), "onClick"),
|
|
29186
|
-
className: "gap-1.5 w-full sm:w-auto"
|
|
29187
|
-
}, testing === "whatsapp" ? /* @__PURE__ */ React.createElement(Loader2, {
|
|
29188
|
-
className: "h-3.5 w-3.5 animate-spin"
|
|
29189
|
-
}) : /* @__PURE__ */ React.createElement(Send, {
|
|
29190
|
-
className: "h-3.5 w-3.5"
|
|
29191
|
-
}), "Send test WhatsApp"))))) : null, /* @__PURE__ */ React.createElement("div", {
|
|
29192
|
-
className: "flex justify-end pt-1"
|
|
29193
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
29194
|
-
type: "button",
|
|
29195
|
-
onClick: handleSave,
|
|
29196
|
-
disabled: saving,
|
|
29197
|
-
className: "min-w-[160px]"
|
|
29198
|
-
}, saving ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Loader2, {
|
|
29199
|
-
className: "h-4 w-4 animate-spin mr-2"
|
|
29200
|
-
}), "Saving\u2026") : "Save settings")));
|
|
29201
|
-
}
|
|
29202
|
-
function EventNotificationSummary({ eventId }) {
|
|
29203
|
-
const [summary, setSummary] = useState(null);
|
|
29204
|
-
useEffect(() => {
|
|
29205
|
-
let cancelled = false;
|
|
29206
|
-
fetch(`/api/events/${eventId}/notifications`).then((r) => r.ok ? r.json() : null).then((data) => {
|
|
29207
|
-
if (!cancelled && data) {
|
|
29208
|
-
setSummary({
|
|
29209
|
-
enabled: Boolean(data.enabled),
|
|
29210
|
-
channels: data.channels ?? []
|
|
29211
|
-
});
|
|
29212
|
-
}
|
|
29213
|
-
}).catch(() => void 0);
|
|
29214
|
-
return () => {
|
|
29215
|
-
cancelled = true;
|
|
29216
|
-
};
|
|
29217
|
-
}, [
|
|
29218
|
-
eventId
|
|
29219
|
-
]);
|
|
29220
|
-
if (!summary?.enabled) {
|
|
29221
|
-
return /* @__PURE__ */ React.createElement("p", {
|
|
29222
|
-
className: "text-sm text-gray-500"
|
|
29223
|
-
}, "Order notifications: disabled");
|
|
29224
|
-
}
|
|
29225
|
-
const ch = summary.channels.length ? summary.channels.join(", ") : "none";
|
|
29226
|
-
return /* @__PURE__ */ React.createElement("p", {
|
|
29227
|
-
className: "text-sm text-gray-700 dark:text-gray-300"
|
|
29228
|
-
}, "Order notifications: ", /* @__PURE__ */ React.createElement("span", {
|
|
29229
|
-
className: "font-medium text-green-700 dark:text-green-400"
|
|
29230
|
-
}, "enabled"), " (", ch, ")");
|
|
29231
|
-
}
|
|
29232
|
-
var panelCls, subPanelCls, labelCls5, hintCls;
|
|
29233
|
-
var init_EventNotificationSettings = __esm({
|
|
29234
|
-
"src/admin/components/EventNotificationSettings.tsx"() {
|
|
29235
|
-
"use client";
|
|
29236
|
-
init_button();
|
|
29237
|
-
init_input();
|
|
29238
|
-
init_label();
|
|
29239
|
-
init_textarea();
|
|
29240
|
-
panelCls = "rounded-lg border border-gray-200 bg-white p-4 sm:p-5 dark:border-gray-600 dark:bg-gray-900/30";
|
|
29241
|
-
subPanelCls = "rounded-md border border-gray-100 bg-gray-50/80 p-4 space-y-4 dark:border-gray-700 dark:bg-gray-800/40";
|
|
29242
|
-
labelCls5 = "block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1.5";
|
|
29243
|
-
hintCls = "text-xs text-gray-500 dark:text-gray-400 leading-relaxed";
|
|
29244
|
-
__name(VariableChip, "VariableChip");
|
|
29245
|
-
__name(ChannelToggle, "ChannelToggle");
|
|
29246
|
-
__name(EventNotificationSettings, "EventNotificationSettings");
|
|
29247
|
-
__name(EventNotificationSummary, "EventNotificationSummary");
|
|
29248
|
-
}
|
|
29249
|
-
});
|
|
29250
29410
|
|
|
29251
29411
|
// src/lib/social-media-links.ts
|
|
29252
29412
|
function isValidHttpUrl(value) {
|
|
@@ -29347,7 +29507,7 @@ function SocialMediaLinksForm({ fields, values, onChange }) {
|
|
|
29347
29507
|
return /* @__PURE__ */ React.createElement("div", {
|
|
29348
29508
|
key: field.key
|
|
29349
29509
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
29350
|
-
className:
|
|
29510
|
+
className: labelCls5
|
|
29351
29511
|
}, field.label), /* @__PURE__ */ React.createElement("div", {
|
|
29352
29512
|
className: "relative"
|
|
29353
29513
|
}, Icon2 ? /* @__PURE__ */ React.createElement(Icon2, {
|
|
@@ -29506,14 +29666,14 @@ function MultiCurrencyPriceFields({ defaultCurrency, currencies, defaultPrice, a
|
|
|
29506
29666
|
}));
|
|
29507
29667
|
}))) : null);
|
|
29508
29668
|
}
|
|
29509
|
-
var inputCls5,
|
|
29669
|
+
var inputCls5, labelCls5, ICONS;
|
|
29510
29670
|
var init_EventManagementFields = __esm({
|
|
29511
29671
|
"src/components/Admin/EventManagementFields.tsx"() {
|
|
29512
29672
|
"use client";
|
|
29513
29673
|
init_social_brand_icons();
|
|
29514
29674
|
init_social_media_links();
|
|
29515
29675
|
inputCls5 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm pl-9";
|
|
29516
|
-
|
|
29676
|
+
labelCls5 = "block text-xs font-medium text-gray-600 mb-1";
|
|
29517
29677
|
ICONS = {
|
|
29518
29678
|
facebook: FacebookBrandIcon,
|
|
29519
29679
|
instagram: InstagramBrandIcon,
|
|
@@ -29889,7 +30049,7 @@ __export(EventEditPage_exports, {
|
|
|
29889
30049
|
});
|
|
29890
30050
|
function RequiredLabel({ children }) {
|
|
29891
30051
|
return /* @__PURE__ */ React.createElement("label", {
|
|
29892
|
-
className:
|
|
30052
|
+
className: labelCls6
|
|
29893
30053
|
}, children, " ", /* @__PURE__ */ React.createElement("span", {
|
|
29894
30054
|
className: "text-red-600"
|
|
29895
30055
|
}, "*"));
|
|
@@ -30334,21 +30494,21 @@ function EventEditPage({ eventId }) {
|
|
|
30334
30494
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
30335
30495
|
className: "sm:col-span-2"
|
|
30336
30496
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
30337
|
-
className:
|
|
30497
|
+
className: labelCls6
|
|
30338
30498
|
}, "Name"), /* @__PURE__ */ React.createElement("input", {
|
|
30339
30499
|
type: "text",
|
|
30340
30500
|
value: name,
|
|
30341
30501
|
onChange: /* @__PURE__ */ __name((e) => setName(e.target.value), "onChange"),
|
|
30342
30502
|
className: inputCls6
|
|
30343
30503
|
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30344
|
-
className:
|
|
30504
|
+
className: labelCls6
|
|
30345
30505
|
}, "Slug"), /* @__PURE__ */ React.createElement("input", {
|
|
30346
30506
|
type: "text",
|
|
30347
30507
|
value: slug,
|
|
30348
30508
|
onChange: /* @__PURE__ */ __name((e) => setSlug(e.target.value), "onChange"),
|
|
30349
30509
|
className: inputCls6
|
|
30350
30510
|
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30351
|
-
className:
|
|
30511
|
+
className: labelCls6
|
|
30352
30512
|
}, "Sort order"), /* @__PURE__ */ React.createElement("input", {
|
|
30353
30513
|
type: "number",
|
|
30354
30514
|
value: sortOrder,
|
|
@@ -30357,7 +30517,7 @@ function EventEditPage({ eventId }) {
|
|
|
30357
30517
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
30358
30518
|
className: "sm:col-span-2"
|
|
30359
30519
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
30360
|
-
className:
|
|
30520
|
+
className: labelCls6
|
|
30361
30521
|
}, "Description"), /* @__PURE__ */ React.createElement("div", {
|
|
30362
30522
|
className: "rounded-md border border-gray-300 bg-white overflow-hidden"
|
|
30363
30523
|
}, /* @__PURE__ */ React.createElement(JoditRichText, {
|
|
@@ -30368,7 +30528,7 @@ function EventEditPage({ eventId }) {
|
|
|
30368
30528
|
}))), /* @__PURE__ */ React.createElement("div", {
|
|
30369
30529
|
className: "sm:col-span-2"
|
|
30370
30530
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
30371
|
-
className:
|
|
30531
|
+
className: labelCls6
|
|
30372
30532
|
}, "Entity types"), /* @__PURE__ */ React.createElement("div", {
|
|
30373
30533
|
className: "flex flex-wrap gap-2"
|
|
30374
30534
|
}, ENTITY_TYPE_OPTIONS.map((type) => /* @__PURE__ */ React.createElement("label", {
|
|
@@ -30384,7 +30544,7 @@ function EventEditPage({ eventId }) {
|
|
|
30384
30544
|
}, type)))), /* @__PURE__ */ React.createElement("div", {
|
|
30385
30545
|
className: "mt-3 space-y-2"
|
|
30386
30546
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
30387
|
-
className:
|
|
30547
|
+
className: labelCls6
|
|
30388
30548
|
}, "Custom entity type"), /* @__PURE__ */ React.createElement("div", {
|
|
30389
30549
|
className: "flex flex-wrap gap-2"
|
|
30390
30550
|
}, /* @__PURE__ */ React.createElement("input", {
|
|
@@ -30424,7 +30584,7 @@ function EventEditPage({ eventId }) {
|
|
|
30424
30584
|
onChange: setBannerImageUrl,
|
|
30425
30585
|
previewVariant: "banner",
|
|
30426
30586
|
inputClassName: inputCls6,
|
|
30427
|
-
labelClassName:
|
|
30587
|
+
labelClassName: labelCls6
|
|
30428
30588
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
30429
30589
|
className: "sm:col-span-2"
|
|
30430
30590
|
}, /* @__PURE__ */ React.createElement(ImageOrUrlField, {
|
|
@@ -30433,9 +30593,9 @@ function EventEditPage({ eventId }) {
|
|
|
30433
30593
|
onChange: setLogoUrl,
|
|
30434
30594
|
previewVariant: "logo",
|
|
30435
30595
|
inputClassName: inputCls6,
|
|
30436
|
-
labelClassName:
|
|
30596
|
+
labelClassName: labelCls6
|
|
30437
30597
|
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30438
|
-
className:
|
|
30598
|
+
className: labelCls6
|
|
30439
30599
|
}, "Pricing type"), /* @__PURE__ */ React.createElement("select", {
|
|
30440
30600
|
value: pricingType,
|
|
30441
30601
|
onChange: /* @__PURE__ */ __name((e) => setPricingType(e.target.value), "onChange"),
|
|
@@ -30447,7 +30607,7 @@ function EventEditPage({ eventId }) {
|
|
|
30447
30607
|
}, "Free"), /* @__PURE__ */ React.createElement("option", {
|
|
30448
30608
|
value: "paid"
|
|
30449
30609
|
}, "Paid"))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30450
|
-
className:
|
|
30610
|
+
className: labelCls6
|
|
30451
30611
|
}, "Mode"), /* @__PURE__ */ React.createElement("select", {
|
|
30452
30612
|
value: entityMode,
|
|
30453
30613
|
onChange: /* @__PURE__ */ __name((e) => setEntityMode(e.target.value), "onChange"),
|
|
@@ -30467,7 +30627,7 @@ function EventEditPage({ eventId }) {
|
|
|
30467
30627
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
30468
30628
|
className: "sm:col-span-2"
|
|
30469
30629
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
30470
|
-
className:
|
|
30630
|
+
className: labelCls6
|
|
30471
30631
|
}, "Venue"), /* @__PURE__ */ React.createElement("input", {
|
|
30472
30632
|
type: "text",
|
|
30473
30633
|
value: venue,
|
|
@@ -30476,7 +30636,7 @@ function EventEditPage({ eventId }) {
|
|
|
30476
30636
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
30477
30637
|
className: "sm:col-span-2"
|
|
30478
30638
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
30479
|
-
className:
|
|
30639
|
+
className: labelCls6
|
|
30480
30640
|
}, "Additional venue details"), /* @__PURE__ */ React.createElement("textarea", {
|
|
30481
30641
|
value: additionalVenueDetails,
|
|
30482
30642
|
onChange: /* @__PURE__ */ __name((e) => setAdditionalVenueDetails(e.target.value.slice(0, ADDITIONAL_VENUE_MAX_CHARS)), "onChange"),
|
|
@@ -30487,14 +30647,14 @@ function EventEditPage({ eventId }) {
|
|
|
30487
30647
|
}), /* @__PURE__ */ React.createElement("p", {
|
|
30488
30648
|
className: "mt-1 text-xs text-gray-500 text-right"
|
|
30489
30649
|
}, additionalVenueDetails.length, " / ", ADDITIONAL_VENUE_MAX_CHARS, " characters")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30490
|
-
className:
|
|
30650
|
+
className: labelCls6
|
|
30491
30651
|
}, "City"), /* @__PURE__ */ React.createElement("input", {
|
|
30492
30652
|
type: "text",
|
|
30493
30653
|
value: city,
|
|
30494
30654
|
onChange: /* @__PURE__ */ __name((e) => setCity(e.target.value), "onChange"),
|
|
30495
30655
|
className: inputCls6
|
|
30496
30656
|
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30497
|
-
className:
|
|
30657
|
+
className: labelCls6
|
|
30498
30658
|
}, "Country"), /* @__PURE__ */ React.createElement("input", {
|
|
30499
30659
|
type: "text",
|
|
30500
30660
|
value: country,
|
|
@@ -30525,14 +30685,14 @@ function EventEditPage({ eventId }) {
|
|
|
30525
30685
|
className: inputCls6,
|
|
30526
30686
|
required: true
|
|
30527
30687
|
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30528
|
-
className:
|
|
30688
|
+
className: labelCls6
|
|
30529
30689
|
}, "Registration opens"), /* @__PURE__ */ React.createElement("input", {
|
|
30530
30690
|
type: "datetime-local",
|
|
30531
30691
|
value: registrationOpensAt,
|
|
30532
30692
|
onChange: /* @__PURE__ */ __name((e) => setRegistrationOpensAt(e.target.value), "onChange"),
|
|
30533
30693
|
className: inputCls6
|
|
30534
30694
|
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30535
|
-
className:
|
|
30695
|
+
className: labelCls6
|
|
30536
30696
|
}, "Registration closes"), /* @__PURE__ */ React.createElement("input", {
|
|
30537
30697
|
type: "datetime-local",
|
|
30538
30698
|
value: registrationClosesAt,
|
|
@@ -30553,20 +30713,20 @@ function EventEditPage({ eventId }) {
|
|
|
30553
30713
|
onDefaultChange: setDefaultCurrency,
|
|
30554
30714
|
onSupportedChange: setSupportedCurrencies,
|
|
30555
30715
|
inputCls: inputCls6,
|
|
30556
|
-
labelCls:
|
|
30716
|
+
labelCls: labelCls6
|
|
30557
30717
|
}) : /* @__PURE__ */ React.createElement("p", {
|
|
30558
30718
|
className: "text-sm text-gray-500"
|
|
30559
30719
|
}, "No active currencies configured. Add currencies in Store settings first."), /* @__PURE__ */ React.createElement("div", {
|
|
30560
30720
|
className: "grid gap-3 sm:grid-cols-2"
|
|
30561
30721
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30562
|
-
className:
|
|
30722
|
+
className: labelCls6
|
|
30563
30723
|
}, "Official website URL"), /* @__PURE__ */ React.createElement("input", {
|
|
30564
30724
|
type: "url",
|
|
30565
30725
|
value: officialWebsiteUrl,
|
|
30566
30726
|
onChange: /* @__PURE__ */ __name((e) => setOfficialWebsiteUrl(e.target.value), "onChange"),
|
|
30567
30727
|
className: inputCls6
|
|
30568
30728
|
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30569
|
-
className:
|
|
30729
|
+
className: labelCls6
|
|
30570
30730
|
}, "Support contact"), /* @__PURE__ */ React.createElement("input", {
|
|
30571
30731
|
type: "text",
|
|
30572
30732
|
value: supportContact,
|
|
@@ -30575,7 +30735,7 @@ function EventEditPage({ eventId }) {
|
|
|
30575
30735
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
30576
30736
|
className: "sm:col-span-2"
|
|
30577
30737
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
30578
|
-
className:
|
|
30738
|
+
className: labelCls6
|
|
30579
30739
|
}, "Contact form"), /* @__PURE__ */ React.createElement("select", {
|
|
30580
30740
|
value: contactFormId ?? "",
|
|
30581
30741
|
onChange: /* @__PURE__ */ __name((e) => setContactFormId(e.target.value ? Number(e.target.value) : null), "onChange"),
|
|
@@ -30590,7 +30750,7 @@ function EventEditPage({ eventId }) {
|
|
|
30590
30750
|
}, "Attendee registration form used during checkout for this event.")), /* @__PURE__ */ React.createElement("div", {
|
|
30591
30751
|
className: "sm:col-span-2 grid gap-4 sm:grid-cols-2 sm:items-end"
|
|
30592
30752
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
30593
|
-
className:
|
|
30753
|
+
className: labelCls6
|
|
30594
30754
|
}, "Max group purchase quantity"), /* @__PURE__ */ React.createElement("input", {
|
|
30595
30755
|
type: "number",
|
|
30596
30756
|
value: maxGroupPurchaseQuantity,
|
|
@@ -30626,13 +30786,7 @@ function EventEditPage({ eventId }) {
|
|
|
30626
30786
|
...prev,
|
|
30627
30787
|
[key]: value
|
|
30628
30788
|
})), "onChange")
|
|
30629
|
-
}))
|
|
30630
|
-
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-3"
|
|
30631
|
-
}, "Order notifications"), eventRecordId ? /* @__PURE__ */ React.createElement(EventNotificationSettings, {
|
|
30632
|
-
eventId: eventRecordId
|
|
30633
|
-
}) : /* @__PURE__ */ React.createElement("p", {
|
|
30634
|
-
className: "text-sm text-gray-500"
|
|
30635
|
-
}, "Save the event first to configure order notification channels and templates."))))
|
|
30789
|
+
}))))
|
|
30636
30790
|
}), showEventProducts ? /* @__PURE__ */ React.createElement("div", {
|
|
30637
30791
|
className: "border-t border-gray-200 px-4 py-4 sm:px-6"
|
|
30638
30792
|
}, /* @__PURE__ */ React.createElement(EventProductsSection, {
|
|
@@ -30640,7 +30794,7 @@ function EventEditPage({ eventId }) {
|
|
|
30640
30794
|
returnUrl: eventEditUrl
|
|
30641
30795
|
})) : null);
|
|
30642
30796
|
}
|
|
30643
|
-
var ADDITIONAL_VENUE_MAX_CHARS, DEFAULT_EVENT_TIMEZONE, DEFAULT_EVENT_CURRENCY, EVENT_SOCIAL_KEYS, isCreate4, sectionCls5,
|
|
30797
|
+
var ADDITIONAL_VENUE_MAX_CHARS, DEFAULT_EVENT_TIMEZONE, DEFAULT_EVENT_CURRENCY, EVENT_SOCIAL_KEYS, isCreate4, sectionCls5, labelCls6, inputCls6, ENTITY_TYPE_OPTIONS;
|
|
30644
30798
|
var init_EventEditPage = __esm({
|
|
30645
30799
|
"src/admin/pages/EventEditPage.tsx"() {
|
|
30646
30800
|
"use client";
|
|
@@ -30650,7 +30804,6 @@ var init_EventEditPage = __esm({
|
|
|
30650
30804
|
init_ImageOrUrlField();
|
|
30651
30805
|
init_JoditRichText();
|
|
30652
30806
|
init_EventProductsSection();
|
|
30653
|
-
init_EventNotificationSettings();
|
|
30654
30807
|
init_EventManagementFields();
|
|
30655
30808
|
init_event_named_lists();
|
|
30656
30809
|
init_social_media_links();
|
|
@@ -30663,7 +30816,7 @@ var init_EventEditPage = __esm({
|
|
|
30663
30816
|
EVENT_SOCIAL_KEYS = EVENT_SOCIAL_FIELDS.map((f) => f.key);
|
|
30664
30817
|
isCreate4 = /* @__PURE__ */ __name((id) => id === "create", "isCreate");
|
|
30665
30818
|
sectionCls5 = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
30666
|
-
|
|
30819
|
+
labelCls6 = "block text-xs font-medium text-gray-600 mb-1";
|
|
30667
30820
|
inputCls6 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm";
|
|
30668
30821
|
__name(RequiredLabel, "RequiredLabel");
|
|
30669
30822
|
ENTITY_TYPE_OPTIONS = [
|
|
@@ -32058,35 +32211,48 @@ var VendorCategoryWorkspacePage_exports = {};
|
|
|
32058
32211
|
__export(VendorCategoryWorkspacePage_exports, {
|
|
32059
32212
|
default: () => VendorCategoryWorkspacePage
|
|
32060
32213
|
});
|
|
32061
|
-
function buildAdminProductColumns(base) {
|
|
32214
|
+
function buildAdminProductColumns(base, multiVendorEnabled, eventsEnabled) {
|
|
32215
|
+
const extraColumns = [
|
|
32216
|
+
...multiVendorEnabled ? [
|
|
32217
|
+
VENDOR_EXTRA_COLUMN
|
|
32218
|
+
] : [],
|
|
32219
|
+
...eventsEnabled ? [
|
|
32220
|
+
EVENT_EXTRA_COLUMN
|
|
32221
|
+
] : []
|
|
32222
|
+
];
|
|
32062
32223
|
const cols = base.filter((c) => c.field && !CATEGORY_PRODUCT_HIDDEN_FIELDS.has(c.field));
|
|
32063
32224
|
const nameIdx = cols.findIndex((c) => c.field === "name");
|
|
32064
32225
|
if (nameIdx < 0) return [
|
|
32065
|
-
...
|
|
32226
|
+
...extraColumns,
|
|
32066
32227
|
...cols
|
|
32067
32228
|
];
|
|
32068
32229
|
return [
|
|
32069
32230
|
...cols.slice(0, nameIdx + 1),
|
|
32070
|
-
...
|
|
32231
|
+
...extraColumns,
|
|
32071
32232
|
...cols.slice(nameIdx + 1)
|
|
32072
32233
|
];
|
|
32073
32234
|
}
|
|
32074
|
-
function
|
|
32235
|
+
function buildAllProductColumns(base, multiVendorEnabled, eventsEnabled) {
|
|
32236
|
+
const extraColumns = [
|
|
32237
|
+
...multiVendorEnabled ? [
|
|
32238
|
+
VENDOR_EXTRA_COLUMN
|
|
32239
|
+
] : [],
|
|
32240
|
+
...eventsEnabled ? [
|
|
32241
|
+
EVENT_EXTRA_COLUMN
|
|
32242
|
+
] : []
|
|
32243
|
+
];
|
|
32075
32244
|
const cols = base.filter((c) => Boolean(c.field));
|
|
32076
32245
|
const nameIdx = cols.findIndex((c) => c.field === "name");
|
|
32077
32246
|
if (nameIdx < 0) return [
|
|
32078
|
-
...
|
|
32247
|
+
...extraColumns,
|
|
32079
32248
|
...cols
|
|
32080
32249
|
];
|
|
32081
32250
|
return [
|
|
32082
32251
|
...cols.slice(0, nameIdx + 1),
|
|
32083
|
-
...
|
|
32252
|
+
...extraColumns,
|
|
32084
32253
|
...cols.slice(nameIdx + 1)
|
|
32085
32254
|
];
|
|
32086
32255
|
}
|
|
32087
|
-
function buildVendorProductColumns(base) {
|
|
32088
|
-
return base.filter((c) => c.field !== "categoryId" && c.field !== "vendorId");
|
|
32089
|
-
}
|
|
32090
32256
|
function withCollectionRelationApi(columns, categoryId, vendorPortal) {
|
|
32091
32257
|
const relationApi = collectionsRelationApi({
|
|
32092
32258
|
vendorPortal,
|
|
@@ -32098,47 +32264,34 @@ function withCollectionRelationApi(columns, categoryId, vendorPortal) {
|
|
|
32098
32264
|
} : col);
|
|
32099
32265
|
}
|
|
32100
32266
|
function VendorCategoryWorkspacePage() {
|
|
32101
|
-
const router = useRouter();
|
|
32102
32267
|
const searchParams = useSearchParams();
|
|
32103
32268
|
const { data: session } = useSession();
|
|
32104
32269
|
const vendorPortal = isVendorPortalUser(session?.user);
|
|
32270
|
+
const { multiVendorEnabled, eventsEnabled } = useContext(AdminConfigContext);
|
|
32105
32271
|
const { categories, loading, error } = useCatalogCategories();
|
|
32106
32272
|
const categoryIdParam = searchParams.get("categoryId")?.trim() ?? "";
|
|
32107
32273
|
const activeCategoryId = useMemo(() => {
|
|
32108
32274
|
if (categoryIdParam && categories.some((c) => String(c.id) === categoryIdParam)) {
|
|
32109
32275
|
return categoryIdParam;
|
|
32110
32276
|
}
|
|
32111
|
-
if (vendorPortal) {
|
|
32112
|
-
const first = categories[0];
|
|
32113
|
-
return first ? String(first.id) : "";
|
|
32114
|
-
}
|
|
32115
32277
|
return "";
|
|
32116
32278
|
}, [
|
|
32117
32279
|
categoryIdParam,
|
|
32118
|
-
categories
|
|
32119
|
-
vendorPortal
|
|
32120
|
-
]);
|
|
32121
|
-
useEffect(() => {
|
|
32122
|
-
if (!vendorPortal) return;
|
|
32123
|
-
if (!activeCategoryId || activeCategoryId === categoryIdParam) return;
|
|
32124
|
-
router.replace(vendorCategoryWorkspaceUrl(activeCategoryId));
|
|
32125
|
-
}, [
|
|
32126
|
-
activeCategoryId,
|
|
32127
|
-
categoryIdParam,
|
|
32128
|
-
router,
|
|
32129
|
-
vendorPortal
|
|
32280
|
+
categories
|
|
32130
32281
|
]);
|
|
32131
32282
|
const activeCategory = categories.find((c) => String(c.id) === activeCategoryId);
|
|
32132
|
-
const showAllProducts = !
|
|
32133
|
-
const workspaceFrom = activeCategoryId ?
|
|
32283
|
+
const showAllProducts = !activeCategoryId;
|
|
32284
|
+
const workspaceFrom = activeCategoryId ? `/admin/products?categoryId=${activeCategoryId}` : "/admin/products";
|
|
32134
32285
|
const itemLabel = activeCategory ? categorySingularName(activeCategory.name) : "Product";
|
|
32135
32286
|
const productColumns2 = useMemo(() => {
|
|
32136
|
-
const base =
|
|
32287
|
+
const base = showAllProducts ? buildAllProductColumns(STORE_CRUD_CONFIGS.products.columns, multiVendorEnabled !== false, eventsEnabled !== false) : buildAdminProductColumns(STORE_CRUD_CONFIGS.products.columns, multiVendorEnabled !== false, eventsEnabled !== false);
|
|
32137
32288
|
return withCollectionRelationApi(base, activeCategoryId, vendorPortal);
|
|
32138
32289
|
}, [
|
|
32139
32290
|
vendorPortal,
|
|
32140
32291
|
activeCategoryId,
|
|
32141
|
-
showAllProducts
|
|
32292
|
+
showAllProducts,
|
|
32293
|
+
multiVendorEnabled,
|
|
32294
|
+
eventsEnabled
|
|
32142
32295
|
]);
|
|
32143
32296
|
const productFilterColumns2 = useMemo(() => productColumns2, [
|
|
32144
32297
|
productColumns2
|
|
@@ -32155,20 +32308,8 @@ function VendorCategoryWorkspacePage() {
|
|
|
32155
32308
|
className: "text-red-600 text-sm"
|
|
32156
32309
|
}, error));
|
|
32157
32310
|
}
|
|
32158
|
-
|
|
32159
|
-
|
|
32160
|
-
className: "rounded-lg bg-white p-6 shadow-md"
|
|
32161
|
-
}, /* @__PURE__ */ React26__default.createElement("h1", {
|
|
32162
|
-
className: "text-lg font-semibold text-gray-900"
|
|
32163
|
-
}, "Store"), /* @__PURE__ */ React26__default.createElement("p", {
|
|
32164
|
-
className: "mt-2 text-sm text-gray-600"
|
|
32165
|
-
}, "No catalog categories are available yet. Ask your platform administrator to add store categories."));
|
|
32166
|
-
}
|
|
32167
|
-
if (!showAllProducts && (!activeCategoryId || !activeCategory)) {
|
|
32168
|
-
return null;
|
|
32169
|
-
}
|
|
32170
|
-
const listTitle = showAllProducts ? "Products" : activeCategory.name;
|
|
32171
|
-
const listKey = showAllProducts ? "products-all-admin" : `products-${activeCategoryId}-${vendorPortal ? "vendor" : "admin"}`;
|
|
32311
|
+
const listTitle = showAllProducts ? "Products" : activeCategory?.name ?? "Products";
|
|
32312
|
+
const listKey = showAllProducts ? "products-all" : `products-${activeCategoryId}`;
|
|
32172
32313
|
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
32173
32314
|
className: "rounded-lg bg-white shadow-md min-h-[420px]"
|
|
32174
32315
|
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
@@ -32192,12 +32333,10 @@ function VendorCategoryWorkspacePage() {
|
|
|
32192
32333
|
...activeCategoryId ? {
|
|
32193
32334
|
categoryId: activeCategoryId
|
|
32194
32335
|
} : {},
|
|
32195
|
-
|
|
32196
|
-
includeEventNames: "1"
|
|
32197
|
-
} : {}
|
|
32336
|
+
includeEventNames: "1"
|
|
32198
32337
|
},
|
|
32199
32338
|
emptyState: {
|
|
32200
|
-
title: showAllProducts ? "No products found" : `No ${activeCategory
|
|
32339
|
+
title: showAllProducts ? "No products found" : `No ${(activeCategory?.name ?? "product").toLowerCase()} found`,
|
|
32201
32340
|
description: showAllProducts ? "Add a product to get started." : `Add a ${itemLabel.toLowerCase()} and select a collection for it.`,
|
|
32202
32341
|
action: /* @__PURE__ */ React26__default.createElement(Link2, {
|
|
32203
32342
|
href: activeCategoryId ? vendorProductCreateUrl(activeCategoryId, {
|
|
@@ -32208,34 +32347,32 @@ function VendorCategoryWorkspacePage() {
|
|
|
32208
32347
|
}
|
|
32209
32348
|
}))));
|
|
32210
32349
|
}
|
|
32211
|
-
var CATEGORY_PRODUCT_HIDDEN_FIELDS,
|
|
32350
|
+
var CATEGORY_PRODUCT_HIDDEN_FIELDS, VENDOR_EXTRA_COLUMN, EVENT_EXTRA_COLUMN;
|
|
32212
32351
|
var init_VendorCategoryWorkspacePage = __esm({
|
|
32213
32352
|
"src/admin/pages/VendorCategoryWorkspacePage.tsx"() {
|
|
32214
32353
|
"use client";
|
|
32215
32354
|
init_vendor_scope();
|
|
32216
32355
|
init_CRUD();
|
|
32217
32356
|
init_store_crud_configs();
|
|
32357
|
+
init_admin_config_context();
|
|
32218
32358
|
init_use_catalog_categories();
|
|
32219
32359
|
init_category_item_label();
|
|
32220
32360
|
CATEGORY_PRODUCT_HIDDEN_FIELDS = /* @__PURE__ */ new Set([
|
|
32221
32361
|
"categoryId"
|
|
32222
32362
|
]);
|
|
32223
|
-
|
|
32224
|
-
|
|
32225
|
-
|
|
32226
|
-
|
|
32227
|
-
|
|
32228
|
-
|
|
32229
|
-
|
|
32230
|
-
|
|
32231
|
-
|
|
32232
|
-
|
|
32233
|
-
|
|
32234
|
-
}
|
|
32235
|
-
];
|
|
32363
|
+
VENDOR_EXTRA_COLUMN = {
|
|
32364
|
+
field: "vendorId",
|
|
32365
|
+
displayName: "Vendor",
|
|
32366
|
+
relationApi: "/api/vendors",
|
|
32367
|
+
relationLabelField: "name",
|
|
32368
|
+
relationValueField: "id"
|
|
32369
|
+
};
|
|
32370
|
+
EVENT_EXTRA_COLUMN = {
|
|
32371
|
+
field: "eventName",
|
|
32372
|
+
displayName: "Event"
|
|
32373
|
+
};
|
|
32236
32374
|
__name(buildAdminProductColumns, "buildAdminProductColumns");
|
|
32237
|
-
__name(
|
|
32238
|
-
__name(buildVendorProductColumns, "buildVendorProductColumns");
|
|
32375
|
+
__name(buildAllProductColumns, "buildAllProductColumns");
|
|
32239
32376
|
__name(withCollectionRelationApi, "withCollectionRelationApi");
|
|
32240
32377
|
__name(VendorCategoryWorkspacePage, "VendorCategoryWorkspacePage");
|
|
32241
32378
|
}
|
|
@@ -32250,7 +32387,52 @@ function CollectionsWorkspacePage() {
|
|
|
32250
32387
|
const { data: session } = useSession();
|
|
32251
32388
|
const vendorPortal = isVendorPortalUser(session?.user);
|
|
32252
32389
|
const isCatalog = !vendorPortal;
|
|
32253
|
-
const
|
|
32390
|
+
const { multiVendorEnabled } = useContext(AdminConfigContext);
|
|
32391
|
+
const [vendorOptions, setVendorOptions] = useState([]);
|
|
32392
|
+
useEffect(() => {
|
|
32393
|
+
if (vendorPortal || multiVendorEnabled === false) return;
|
|
32394
|
+
fetch("/api/vendors?limit=500").then((r) => r.ok ? r.json() : null).then((data) => {
|
|
32395
|
+
if (!data?.data?.length) return;
|
|
32396
|
+
setVendorOptions(data.data.map((v) => ({
|
|
32397
|
+
value: String(v.id),
|
|
32398
|
+
label: v.name
|
|
32399
|
+
})));
|
|
32400
|
+
}).catch(() => {
|
|
32401
|
+
});
|
|
32402
|
+
}, [
|
|
32403
|
+
vendorPortal,
|
|
32404
|
+
multiVendorEnabled
|
|
32405
|
+
]);
|
|
32406
|
+
const showVendorColumn = multiVendorEnabled !== false && !vendorPortal;
|
|
32407
|
+
const collectionColumns = useMemo(() => {
|
|
32408
|
+
const base = STORE_CRUD_CONFIGS.collections.columns.filter((c) => c.field !== "vendorId");
|
|
32409
|
+
return showVendorColumn ? [
|
|
32410
|
+
VENDOR_COLUMN,
|
|
32411
|
+
...base
|
|
32412
|
+
] : base;
|
|
32413
|
+
}, [
|
|
32414
|
+
showVendorColumn
|
|
32415
|
+
]);
|
|
32416
|
+
const collectionFilters = useMemo(() => {
|
|
32417
|
+
if (!showVendorColumn || vendorOptions.length <= 1) return void 0;
|
|
32418
|
+
return [
|
|
32419
|
+
{
|
|
32420
|
+
param: "vendorId",
|
|
32421
|
+
label: "Vendor",
|
|
32422
|
+
type: "select",
|
|
32423
|
+
options: [
|
|
32424
|
+
{
|
|
32425
|
+
value: "",
|
|
32426
|
+
label: "All vendors"
|
|
32427
|
+
},
|
|
32428
|
+
...vendorOptions
|
|
32429
|
+
]
|
|
32430
|
+
}
|
|
32431
|
+
];
|
|
32432
|
+
}, [
|
|
32433
|
+
showVendorColumn,
|
|
32434
|
+
vendorOptions
|
|
32435
|
+
]);
|
|
32254
32436
|
const listParams = useMemo(() => isCatalog ? {
|
|
32255
32437
|
isCatalog: "true"
|
|
32256
32438
|
} : void 0, [
|
|
@@ -32266,20 +32448,32 @@ function CollectionsWorkspacePage() {
|
|
|
32266
32448
|
title: "Collections",
|
|
32267
32449
|
apiEndpoint: "/api/collections",
|
|
32268
32450
|
columns: collectionColumns,
|
|
32269
|
-
filterColumns:
|
|
32451
|
+
filterColumns: collectionColumns,
|
|
32270
32452
|
addEditPageUrl: "/admin/collections",
|
|
32271
32453
|
createQueryParams,
|
|
32272
32454
|
defaultSortField: "sortOrder",
|
|
32273
32455
|
defaultSortOrder: "asc",
|
|
32274
|
-
extraListParams: listParams
|
|
32456
|
+
extraListParams: listParams,
|
|
32457
|
+
filters: collectionFilters
|
|
32275
32458
|
});
|
|
32276
32459
|
}
|
|
32460
|
+
var VENDOR_COLUMN;
|
|
32277
32461
|
var init_CollectionsWorkspacePage = __esm({
|
|
32278
32462
|
"src/admin/pages/CollectionsWorkspacePage.tsx"() {
|
|
32279
32463
|
"use client";
|
|
32280
32464
|
init_vendor_scope();
|
|
32281
32465
|
init_CRUD();
|
|
32282
32466
|
init_store_crud_configs();
|
|
32467
|
+
init_admin_config_context();
|
|
32468
|
+
VENDOR_COLUMN = {
|
|
32469
|
+
field: "vendorId",
|
|
32470
|
+
displayName: "Vendor",
|
|
32471
|
+
hideInCreate: true,
|
|
32472
|
+
hideInEdit: true,
|
|
32473
|
+
relationApi: "/api/vendors",
|
|
32474
|
+
relationLabelField: "name",
|
|
32475
|
+
relationValueField: "id"
|
|
32476
|
+
};
|
|
32283
32477
|
__name(CollectionsWorkspacePage, "CollectionsWorkspacePage");
|
|
32284
32478
|
}
|
|
32285
32479
|
});
|
|
@@ -36191,7 +36385,7 @@ function AdminPageResolver({ slug }) {
|
|
|
36191
36385
|
const searchParams = useSearchParams();
|
|
36192
36386
|
const { data: session } = useSession();
|
|
36193
36387
|
const vendorPortal = isVendorPortalUser(session?.user);
|
|
36194
|
-
const { customCrudConfigs, storeEnabled } = useContext(AdminConfigContext);
|
|
36388
|
+
const { customCrudConfigs, storeEnabled, multiVendorEnabled, eventsEnabled } = useContext(AdminConfigContext);
|
|
36195
36389
|
const key = slug?.[0] || "dashboard";
|
|
36196
36390
|
const [vendorOptions, setVendorOptions] = useState([]);
|
|
36197
36391
|
useEffect(() => {
|
|
@@ -36217,17 +36411,21 @@ function AdminPageResolver({ slug }) {
|
|
|
36217
36411
|
if (!config) return void 0;
|
|
36218
36412
|
let columns = config.columns;
|
|
36219
36413
|
let filters = config.filters ?? [];
|
|
36220
|
-
if (vendorPortal) {
|
|
36414
|
+
if (vendorPortal || multiVendorEnabled === false) {
|
|
36221
36415
|
columns = columns.filter((column) => column.field !== "vendorId");
|
|
36222
36416
|
filters = filters.filter((filter) => filter.param !== "vendorId");
|
|
36223
36417
|
}
|
|
36224
|
-
if (
|
|
36418
|
+
if (eventsEnabled === false) {
|
|
36419
|
+
columns = columns.filter((column) => column.field !== "eventId" && column.field !== "eventName");
|
|
36420
|
+
filters = filters.filter((filter) => filter.param !== "eventId");
|
|
36421
|
+
}
|
|
36422
|
+
if (multiVendorEnabled !== false && !vendorPortal && STORE_VENDOR_RESOURCES.has(key) && key !== "event_products" && !columns.some((c) => c.field === "vendorId")) {
|
|
36225
36423
|
columns = [
|
|
36226
|
-
|
|
36424
|
+
VENDOR_COLUMN2,
|
|
36227
36425
|
...columns
|
|
36228
36426
|
];
|
|
36229
36427
|
}
|
|
36230
|
-
if (!vendorPortal && STORE_VENDOR_RESOURCES.has(key) && key !== "
|
|
36428
|
+
if (multiVendorEnabled !== false && !vendorPortal && STORE_VENDOR_RESOURCES.has(key) && key !== "event_products" && vendorOptions.length > 1 && !filters.some((f) => f.param === "vendorId")) {
|
|
36231
36429
|
filters = [
|
|
36232
36430
|
{
|
|
36233
36431
|
param: "vendorId",
|
|
@@ -36256,7 +36454,9 @@ function AdminPageResolver({ slug }) {
|
|
|
36256
36454
|
key,
|
|
36257
36455
|
customCrudConfigs,
|
|
36258
36456
|
vendorOptions,
|
|
36259
|
-
vendorPortal
|
|
36457
|
+
vendorPortal,
|
|
36458
|
+
multiVendorEnabled,
|
|
36459
|
+
eventsEnabled
|
|
36260
36460
|
]);
|
|
36261
36461
|
const isContactsWithStore = key === "contacts" && storeEnabled;
|
|
36262
36462
|
const extraListParams = useMemo(() => isContactsWithStore ? {
|
|
@@ -36284,6 +36484,20 @@ function AdminPageResolver({ slug }) {
|
|
|
36284
36484
|
crud,
|
|
36285
36485
|
isContactsWithStore
|
|
36286
36486
|
]);
|
|
36487
|
+
const isVendorRelated = useMemo(() => {
|
|
36488
|
+
return key === "vendors" || key === "vendor-team" || key === "vendor-roles" || key === "vendor-profile" || key === "store" || key === "analytics" || key === "vendor_users" || key === "vendor_role_permissions";
|
|
36489
|
+
}, [
|
|
36490
|
+
key
|
|
36491
|
+
]);
|
|
36492
|
+
useEffect(() => {
|
|
36493
|
+
if (multiVendorEnabled === false && isVendorRelated) {
|
|
36494
|
+
router.replace("/admin/access-denied");
|
|
36495
|
+
}
|
|
36496
|
+
}, [
|
|
36497
|
+
multiVendorEnabled,
|
|
36498
|
+
isVendorRelated,
|
|
36499
|
+
router
|
|
36500
|
+
]);
|
|
36287
36501
|
useEffect(() => {
|
|
36288
36502
|
if (key === "layout-settings") {
|
|
36289
36503
|
router.replace("/admin/settings?tab=navbar");
|
|
@@ -36301,6 +36515,34 @@ function AdminPageResolver({ slug }) {
|
|
|
36301
36515
|
router,
|
|
36302
36516
|
vendorPortal
|
|
36303
36517
|
]);
|
|
36518
|
+
const isEventsRelated = key === "events";
|
|
36519
|
+
useEffect(() => {
|
|
36520
|
+
if (eventsEnabled === false && isEventsRelated) {
|
|
36521
|
+
router.replace("/admin/access-denied");
|
|
36522
|
+
}
|
|
36523
|
+
}, [
|
|
36524
|
+
eventsEnabled,
|
|
36525
|
+
isEventsRelated,
|
|
36526
|
+
router
|
|
36527
|
+
]);
|
|
36528
|
+
if (multiVendorEnabled === false && isVendorRelated) {
|
|
36529
|
+
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
36530
|
+
className: "flex justify-center py-8"
|
|
36531
|
+
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
36532
|
+
className: "animate-spin rounded-full h-6 w-6 border-2 border-gray-300 border-t-gray-600"
|
|
36533
|
+
}), /* @__PURE__ */ React26__default.createElement("span", {
|
|
36534
|
+
className: "ml-2"
|
|
36535
|
+
}, "Redirecting\u2026"));
|
|
36536
|
+
}
|
|
36537
|
+
if (eventsEnabled === false && isEventsRelated) {
|
|
36538
|
+
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
36539
|
+
className: "flex justify-center py-8"
|
|
36540
|
+
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
36541
|
+
className: "animate-spin rounded-full h-6 w-6 border-2 border-gray-300 border-t-gray-600"
|
|
36542
|
+
}), /* @__PURE__ */ React26__default.createElement("span", {
|
|
36543
|
+
className: "ml-2"
|
|
36544
|
+
}, "Redirecting\u2026"));
|
|
36545
|
+
}
|
|
36304
36546
|
if (key === "layout-settings") {
|
|
36305
36547
|
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
36306
36548
|
className: "flex justify-center py-8"
|
|
@@ -36597,7 +36839,7 @@ function AdminPageResolver({ slug }) {
|
|
|
36597
36839
|
className: "text-gray-500"
|
|
36598
36840
|
}, "Page not found"));
|
|
36599
36841
|
}
|
|
36600
|
-
var VendorAnalyticsPage2, DashboardPage2, SignInPage, ForgotPasswordPage2, ResetPasswordPage2, InvitePage2, SettingsPage2, AdminProfilePage2, PluginsPage2, RolesPage2, BlogGeneratorPage2, SchedulesPage2, VendorTeamPage2, VendorRolesPage2, VendorPortalProfilePage2, SubmissionDetailPage2, OrderDetailPage2, OrderPlacementPage2, OrderProductFramePage2, PaymentDetailPage2, MediaLibraryPage2, PageBuilderPage2, BrandEditPage2, ProductEditPage2, CollectionEditPage2, EventEditPage2, ComboEditPage2, VendorEditPage2, VendorsListPage2, VendorStorePage2, VendorCategoryWorkspacePage2, CollectionsWorkspacePage2, DiscountDetailPage2, DiscountEditPage2, ContactDetailPage2, BlogEditorPage, FormBuilder2, PolicyPage2, PAGE_MAP, CRUD_CONFIGS,
|
|
36842
|
+
var VendorAnalyticsPage2, DashboardPage2, SignInPage, ForgotPasswordPage2, ResetPasswordPage2, InvitePage2, SettingsPage2, AdminProfilePage2, PluginsPage2, RolesPage2, BlogGeneratorPage2, SchedulesPage2, VendorTeamPage2, VendorRolesPage2, VendorPortalProfilePage2, SubmissionDetailPage2, OrderDetailPage2, OrderPlacementPage2, OrderProductFramePage2, PaymentDetailPage2, MediaLibraryPage2, PageBuilderPage2, BrandEditPage2, ProductEditPage2, CollectionEditPage2, EventEditPage2, ComboEditPage2, VendorEditPage2, VendorsListPage2, VendorStorePage2, VendorCategoryWorkspacePage2, CollectionsWorkspacePage2, DiscountDetailPage2, DiscountEditPage2, ContactDetailPage2, BlogEditorPage, FormBuilder2, PolicyPage2, PAGE_MAP, CRUD_CONFIGS, VENDOR_COLUMN2, STORE_VENDOR_RESOURCES;
|
|
36601
36843
|
var init_AdminPageResolver = __esm({
|
|
36602
36844
|
"src/admin/pages/AdminPageResolver.tsx"() {
|
|
36603
36845
|
"use client";
|
|
@@ -36930,7 +37172,7 @@ var init_AdminPageResolver = __esm({
|
|
|
36930
37172
|
}
|
|
36931
37173
|
};
|
|
36932
37174
|
__name(BlogEditorWrapper, "BlogEditorWrapper");
|
|
36933
|
-
|
|
37175
|
+
VENDOR_COLUMN2 = {
|
|
36934
37176
|
field: "vendorId",
|
|
36935
37177
|
displayName: "Vendor",
|
|
36936
37178
|
hideInCreate: true,
|
|
@@ -37176,21 +37418,21 @@ function EventDetailPage({ eventId }) {
|
|
|
37176
37418
|
}, /* @__PURE__ */ React.createElement("dl", {
|
|
37177
37419
|
className: "grid gap-4 sm:grid-cols-2"
|
|
37178
37420
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37179
|
-
className:
|
|
37421
|
+
className: labelCls7
|
|
37180
37422
|
}, "Name"), /* @__PURE__ */ React.createElement("dd", {
|
|
37181
37423
|
className: valueCls
|
|
37182
37424
|
}, displayValue(event.name))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37183
|
-
className:
|
|
37425
|
+
className: labelCls7
|
|
37184
37426
|
}, "Slug"), /* @__PURE__ */ React.createElement("dd", {
|
|
37185
37427
|
className: valueCls
|
|
37186
37428
|
}, displayValue(event.slug))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37187
|
-
className:
|
|
37429
|
+
className: labelCls7
|
|
37188
37430
|
}, "Sort order"), /* @__PURE__ */ React.createElement("dd", {
|
|
37189
37431
|
className: valueCls
|
|
37190
37432
|
}, event.sortOrder)), /* @__PURE__ */ React.createElement("div", {
|
|
37191
37433
|
className: "sm:col-span-2"
|
|
37192
37434
|
}, /* @__PURE__ */ React.createElement("dt", {
|
|
37193
|
-
className:
|
|
37435
|
+
className: labelCls7
|
|
37194
37436
|
}, "Description"), /* @__PURE__ */ React.createElement("dd", {
|
|
37195
37437
|
className: `${valueCls} prose prose-sm max-w-none`,
|
|
37196
37438
|
dangerouslySetInnerHTML: {
|
|
@@ -37199,11 +37441,11 @@ function EventDetailPage({ eventId }) {
|
|
|
37199
37441
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
37200
37442
|
className: "sm:col-span-2"
|
|
37201
37443
|
}, /* @__PURE__ */ React.createElement("dt", {
|
|
37202
|
-
className:
|
|
37444
|
+
className: labelCls7
|
|
37203
37445
|
}, "Entity types"), /* @__PURE__ */ React.createElement("dd", {
|
|
37204
37446
|
className: valueCls
|
|
37205
37447
|
}, event.entityTypes?.length ? event.entityTypes.map(formatEventEntityTypeLabel).join(", ") : "\u2014")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37206
|
-
className:
|
|
37448
|
+
className: labelCls7
|
|
37207
37449
|
}, "Banner image"), /* @__PURE__ */ React.createElement("dd", {
|
|
37208
37450
|
className: valueCls
|
|
37209
37451
|
}, event.bannerImageUrl ? /* @__PURE__ */ React.createElement("a", {
|
|
@@ -37212,7 +37454,7 @@ function EventDetailPage({ eventId }) {
|
|
|
37212
37454
|
rel: "noreferrer",
|
|
37213
37455
|
className: "text-blue-600 hover:underline break-all"
|
|
37214
37456
|
}, event.bannerImageUrl) : "\u2014")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37215
|
-
className:
|
|
37457
|
+
className: labelCls7
|
|
37216
37458
|
}, "Logo"), /* @__PURE__ */ React.createElement("dd", {
|
|
37217
37459
|
className: valueCls
|
|
37218
37460
|
}, event.logoUrl ? /* @__PURE__ */ React.createElement("a", {
|
|
@@ -37221,11 +37463,11 @@ function EventDetailPage({ eventId }) {
|
|
|
37221
37463
|
rel: "noreferrer",
|
|
37222
37464
|
className: "text-blue-600 hover:underline break-all"
|
|
37223
37465
|
}, event.logoUrl) : "\u2014")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37224
|
-
className:
|
|
37466
|
+
className: labelCls7
|
|
37225
37467
|
}, "Pricing type"), /* @__PURE__ */ React.createElement("dd", {
|
|
37226
37468
|
className: valueCls
|
|
37227
37469
|
}, event.pricingType ? event.pricingType.charAt(0).toUpperCase() + event.pricingType.slice(1) : "\u2014")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37228
|
-
className:
|
|
37470
|
+
className: labelCls7
|
|
37229
37471
|
}, "Mode"), /* @__PURE__ */ React.createElement("dd", {
|
|
37230
37472
|
className: valueCls
|
|
37231
37473
|
}, formatMode(event.entityMode))))) : activeTab === "venue" ? /* @__PURE__ */ React.createElement("section", {
|
|
@@ -37235,21 +37477,21 @@ function EventDetailPage({ eventId }) {
|
|
|
37235
37477
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
37236
37478
|
className: "sm:col-span-2"
|
|
37237
37479
|
}, /* @__PURE__ */ React.createElement("dt", {
|
|
37238
|
-
className:
|
|
37480
|
+
className: labelCls7
|
|
37239
37481
|
}, "Venue"), /* @__PURE__ */ React.createElement("dd", {
|
|
37240
37482
|
className: valueCls
|
|
37241
37483
|
}, displayValue(event.venue))), event.additionalVenueDetails ? /* @__PURE__ */ React.createElement("div", {
|
|
37242
37484
|
className: "sm:col-span-2"
|
|
37243
37485
|
}, /* @__PURE__ */ React.createElement("dt", {
|
|
37244
|
-
className:
|
|
37486
|
+
className: labelCls7
|
|
37245
37487
|
}, "Additional venue details"), /* @__PURE__ */ React.createElement("dd", {
|
|
37246
37488
|
className: `${valueCls} whitespace-pre-wrap`
|
|
37247
37489
|
}, event.additionalVenueDetails)) : null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37248
|
-
className:
|
|
37490
|
+
className: labelCls7
|
|
37249
37491
|
}, "City"), /* @__PURE__ */ React.createElement("dd", {
|
|
37250
37492
|
className: valueCls
|
|
37251
37493
|
}, displayValue(event.city ?? event.cityCountry?.split(",")[0]?.trim()))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37252
|
-
className:
|
|
37494
|
+
className: labelCls7
|
|
37253
37495
|
}, "Country"), /* @__PURE__ */ React.createElement("dd", {
|
|
37254
37496
|
className: valueCls
|
|
37255
37497
|
}, displayValue(event.country ?? (event.cityCountry?.includes(",") ? event.cityCountry.split(",").slice(1).join(",").trim() : null)))))) : activeTab === "datetime" ? /* @__PURE__ */ React.createElement("section", {
|
|
@@ -37257,29 +37499,29 @@ function EventDetailPage({ eventId }) {
|
|
|
37257
37499
|
}, /* @__PURE__ */ React.createElement("dl", {
|
|
37258
37500
|
className: "grid gap-4 sm:grid-cols-2"
|
|
37259
37501
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37260
|
-
className:
|
|
37502
|
+
className: labelCls7
|
|
37261
37503
|
}, "Timezone"), /* @__PURE__ */ React.createElement("dd", {
|
|
37262
37504
|
className: valueCls
|
|
37263
37505
|
}, displayValue(event.timezone))), /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37264
|
-
className:
|
|
37506
|
+
className: labelCls7
|
|
37265
37507
|
}, "Event start"), /* @__PURE__ */ React.createElement("dd", {
|
|
37266
37508
|
className: valueCls
|
|
37267
37509
|
}, event.startDate ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, startFormatted.dateLine), startFormatted.timeLine ? /* @__PURE__ */ React.createElement("div", {
|
|
37268
37510
|
className: "text-gray-600"
|
|
37269
37511
|
}, startFormatted.timeLine) : null) : "\u2014")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37270
|
-
className:
|
|
37512
|
+
className: labelCls7
|
|
37271
37513
|
}, "Event end"), /* @__PURE__ */ React.createElement("dd", {
|
|
37272
37514
|
className: valueCls
|
|
37273
37515
|
}, event.endDate ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, endFormatted.dateLine), endFormatted.timeLine ? /* @__PURE__ */ React.createElement("div", {
|
|
37274
37516
|
className: "text-gray-600"
|
|
37275
37517
|
}, endFormatted.timeLine) : null) : "\u2014")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37276
|
-
className:
|
|
37518
|
+
className: labelCls7
|
|
37277
37519
|
}, "Registration opens"), /* @__PURE__ */ React.createElement("dd", {
|
|
37278
37520
|
className: valueCls
|
|
37279
37521
|
}, event.registrationOpensAt ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, regOpensFormatted.dateLine), regOpensFormatted.timeLine ? /* @__PURE__ */ React.createElement("div", {
|
|
37280
37522
|
className: "text-gray-600"
|
|
37281
37523
|
}, regOpensFormatted.timeLine) : null) : "\u2014")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37282
|
-
className:
|
|
37524
|
+
className: labelCls7
|
|
37283
37525
|
}, "Registration closes"), /* @__PURE__ */ React.createElement("dd", {
|
|
37284
37526
|
className: valueCls
|
|
37285
37527
|
}, event.registrationClosesAt ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, regClosesFormatted.dateLine), regClosesFormatted.timeLine ? /* @__PURE__ */ React.createElement("div", {
|
|
@@ -37293,15 +37535,15 @@ function EventDetailPage({ eventId }) {
|
|
|
37293
37535
|
}, "Checkout & website"), /* @__PURE__ */ React.createElement("dl", {
|
|
37294
37536
|
className: "grid gap-4 sm:grid-cols-2"
|
|
37295
37537
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37296
|
-
className:
|
|
37538
|
+
className: labelCls7
|
|
37297
37539
|
}, "Default currency"), /* @__PURE__ */ React.createElement("dd", {
|
|
37298
37540
|
className: valueCls
|
|
37299
37541
|
}, displayValue(event.defaultCurrency))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37300
|
-
className:
|
|
37542
|
+
className: labelCls7
|
|
37301
37543
|
}, "Supported currencies"), /* @__PURE__ */ React.createElement("dd", {
|
|
37302
37544
|
className: valueCls
|
|
37303
37545
|
}, event.supportedCurrencies?.length ? event.supportedCurrencies.join(", ") : "\u2014")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37304
|
-
className:
|
|
37546
|
+
className: labelCls7
|
|
37305
37547
|
}, "Website"), /* @__PURE__ */ React.createElement("dd", {
|
|
37306
37548
|
className: valueCls
|
|
37307
37549
|
}, event.officialWebsiteUrl ? /* @__PURE__ */ React.createElement("a", {
|
|
@@ -37310,13 +37552,13 @@ function EventDetailPage({ eventId }) {
|
|
|
37310
37552
|
rel: "noreferrer",
|
|
37311
37553
|
className: "text-blue-600 hover:underline break-all"
|
|
37312
37554
|
}, event.officialWebsiteUrl) : "\u2014")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37313
|
-
className:
|
|
37555
|
+
className: labelCls7
|
|
37314
37556
|
}, "Support contact"), /* @__PURE__ */ React.createElement("dd", {
|
|
37315
37557
|
className: valueCls
|
|
37316
37558
|
}, displayValue(event.supportContact))), /* @__PURE__ */ React.createElement("div", {
|
|
37317
37559
|
className: "sm:col-span-2"
|
|
37318
37560
|
}, /* @__PURE__ */ React.createElement("dt", {
|
|
37319
|
-
className:
|
|
37561
|
+
className: labelCls7
|
|
37320
37562
|
}, "Contact form"), /* @__PURE__ */ React.createElement("dd", {
|
|
37321
37563
|
className: valueCls
|
|
37322
37564
|
}, event.contactFormId != null ? /* @__PURE__ */ React.createElement(Link2, {
|
|
@@ -37325,7 +37567,7 @@ function EventDetailPage({ eventId }) {
|
|
|
37325
37567
|
}, contactFormLabel ?? `Form #${event.contactFormId}`) : "\u2014")), /* @__PURE__ */ React.createElement("div", {
|
|
37326
37568
|
className: "sm:col-span-2 grid gap-4 sm:grid-cols-2 sm:items-end"
|
|
37327
37569
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
37328
|
-
className:
|
|
37570
|
+
className: labelCls7
|
|
37329
37571
|
}, "Max group quantity"), /* @__PURE__ */ React.createElement("dd", {
|
|
37330
37572
|
className: valueCls
|
|
37331
37573
|
}, event.maxGroupPurchaseQuantity != null ? event.maxGroupPurchaseQuantity : "\u2014")), /* @__PURE__ */ React.createElement("div", {
|
|
@@ -37334,13 +37576,7 @@ function EventDetailPage({ eventId }) {
|
|
|
37334
37576
|
className: valueCls
|
|
37335
37577
|
}, event.allowGroupOrders ? "Group orders allowed" : "Group orders disabled"), /* @__PURE__ */ React.createElement("dd", {
|
|
37336
37578
|
className: valueCls
|
|
37337
|
-
}, event.sendIndividualTicketPDFToAttendees ? "Individual ticket PDFs sent to attendees" : "Individual ticket PDFs not sent"))), /* @__PURE__ */ React.createElement("div", {
|
|
37338
|
-
className: "sm:col-span-2"
|
|
37339
|
-
}, /* @__PURE__ */ React.createElement("dd", {
|
|
37340
|
-
className: valueCls
|
|
37341
|
-
}, /* @__PURE__ */ React.createElement(EventNotificationSummary, {
|
|
37342
|
-
eventId: String(event.id)
|
|
37343
|
-
}))))), event.socialMediaLinks && Object.keys(event.socialMediaLinks).length > 0 ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", {
|
|
37579
|
+
}, event.sendIndividualTicketPDFToAttendees ? "Individual ticket PDFs sent to attendees" : "Individual ticket PDFs not sent"))))), event.socialMediaLinks && Object.keys(event.socialMediaLinks).length > 0 ? /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", {
|
|
37344
37580
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-3"
|
|
37345
37581
|
}, "Social media"), /* @__PURE__ */ React.createElement(SocialMediaLinksDisplay, {
|
|
37346
37582
|
links: event.socialMediaLinks,
|
|
@@ -37352,7 +37588,7 @@ function EventDetailPage({ eventId }) {
|
|
|
37352
37588
|
}))
|
|
37353
37589
|
}));
|
|
37354
37590
|
}
|
|
37355
|
-
var sectionCls7,
|
|
37591
|
+
var sectionCls7, labelCls7, valueCls;
|
|
37356
37592
|
var init_EventDetailPage = __esm({
|
|
37357
37593
|
"src/admin/pages/EventDetailPage.tsx"() {
|
|
37358
37594
|
"use client";
|
|
@@ -37364,9 +37600,8 @@ var init_EventDetailPage = __esm({
|
|
|
37364
37600
|
init_DetailPageLayout();
|
|
37365
37601
|
init_DetailPageHeader();
|
|
37366
37602
|
init_EventProductsSection();
|
|
37367
|
-
init_EventNotificationSettings();
|
|
37368
37603
|
sectionCls7 = "border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
37369
|
-
|
|
37604
|
+
labelCls7 = "text-xs font-medium text-gray-500";
|
|
37370
37605
|
valueCls = "text-sm text-gray-900 mt-0.5";
|
|
37371
37606
|
__name(displayValue, "displayValue");
|
|
37372
37607
|
__name(formatMode, "formatMode");
|