@infuro/cms-core 1.0.44 → 1.0.46
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/README.md +19 -2
- package/dist/admin.cjs +1413 -620
- package/dist/admin.d.cts +8 -2
- package/dist/admin.d.ts +8 -2
- package/dist/admin.js +1414 -621
- package/dist/api.cjs +40 -37
- package/dist/api.d.cts +3 -1
- package/dist/api.d.ts +3 -1
- package/dist/api.js +8 -5
- package/dist/auth.cjs +23 -23
- package/dist/auth.d.cts +1 -0
- package/dist/auth.d.ts +1 -0
- package/dist/auth.js +2 -2
- package/dist/chunk-2KUCQVAQ.js +936 -0
- package/dist/chunk-3K5AIEIZ.js +256 -0
- package/dist/{chunk-I6NH72MO.js → chunk-57O3HZPG.js} +9 -1
- package/dist/chunk-7PMHZRF3.cjs +872 -0
- package/dist/chunk-BXYZDMTZ.cjs +953 -0
- package/dist/chunk-CQHXW4TR.js +107 -0
- package/dist/{chunk-NNQBWDCI.js → chunk-CRYKVJTO.js} +55 -959
- package/dist/chunk-DBPSJYLZ.js +47 -0
- package/dist/{chunk-TAHX46EI.cjs → chunk-FBKDMRQL.cjs} +9 -1
- package/dist/chunk-GUSHM5HN.js +862 -0
- package/dist/chunk-HY3AXLOI.cjs +265 -0
- package/dist/chunk-L3525VXI.js +243 -0
- package/dist/{chunk-ZMRQ72F6.cjs → chunk-NBY4NVTY.cjs} +3 -3
- package/dist/chunk-OY2YTBMP.cjs +50 -0
- package/dist/{chunk-BLR6H5GL.js → chunk-SF2XKMCI.js} +3 -3
- package/dist/{chunk-22FFHLTO.cjs → chunk-TCSGFAWB.cjs} +56 -970
- package/dist/{chunk-P2IWWBJV.cjs → chunk-UDVLFVEC.cjs} +1314 -601
- package/dist/{chunk-SQGBHYJF.js → chunk-UKC3HYXI.js} +1245 -548
- package/dist/chunk-V25RDUOU.cjs +248 -0
- package/dist/chunk-XMRMZ6NQ.cjs +109 -0
- package/dist/cli.cjs +9 -4
- package/dist/cli.js +9 -4
- package/dist/{email-queue-TPZWLTIV.cjs → email-queue-6NJY6HNM.cjs} +7 -5
- package/dist/email-queue-OI2HSCGE.js +4 -0
- package/dist/erp-order-invoice-3GXDE443.js +3 -0
- package/dist/erp-order-invoice-EYYNR526.cjs +24 -0
- package/dist/index.cjs +426 -359
- package/dist/index.d.cts +308 -20
- package/dist/index.d.ts +308 -20
- package/dist/index.js +31 -110
- package/dist/migrations/1781800000000-CustomerPhoneNullable.ts +53 -0
- package/dist/migrations/1781810000000-OrderItemsVariantId.ts +44 -0
- package/dist/migrations/1781900000000-UserInviteStatusToken.ts +46 -0
- package/dist/migrations/1782000000000-ComboSlug.ts +58 -0
- package/dist/migrations/1782100000000-DiscountDeviceType.ts +20 -0
- package/dist/order-inventory-2MYRKEPC.cjs +39 -0
- package/dist/order-inventory-76V4XIGW.js +2 -0
- package/dist/order-notification-dispatcher-SBQAMM5V.cjs +21 -0
- package/dist/{order-notification-dispatcher-XWIJYDGA.js → order-notification-dispatcher-ZJZB2HUN.js} +5 -2
- package/dist/retire-soft-deleted-unique-5VXBA5XX.cjs +15 -0
- package/dist/retire-soft-deleted-unique-NXQIH4BC.js +2 -0
- package/dist/send-order-placed-emails-B5ZVJT7T.cjs +15 -0
- package/dist/send-order-placed-emails-WPI37KRZ.js +6 -0
- package/package.json +5 -4
- package/src/admin/admin.css +27 -24
- package/dist/chunk-5ELSW2UP.js +0 -150
- package/dist/chunk-PNOKNSG2.cjs +0 -222
- package/dist/chunk-WEMDMVHQ.js +0 -216
- package/dist/chunk-XW5ATPRW.cjs +0 -155
- package/dist/email-queue-CGZBVVAS.js +0 -2
- package/dist/erp-order-invoice-3YISSOWW.js +0 -3
- package/dist/erp-order-invoice-ZR5F2KTA.cjs +0 -12
- package/dist/order-notification-dispatcher-RU7BTGGX.cjs +0 -18
package/dist/admin.js
CHANGED
|
@@ -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, 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,
|
|
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, Mail, Check, Save, 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, 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';
|
|
@@ -226,111 +226,6 @@ var init_infuro_favicon = __esm({
|
|
|
226
226
|
INFURO_FAVICON_BASE64 = "data:image/x-icon;base64,AAABAAMAEBAAAAEAIABoBAAANgAAACAgAAABACAAKBEAAJ4EAAAwMAAAAQAgAGgmAADGFQAAKAAAABAAAAAgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8V////bv///7D////R////0f///7D///9u////FQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wL///9s0qun7q9qYv/DkYv/6tfV///+/v///////////////+7///9r////AgAAAAAAAAAAAAAAAP///wL///+Q/////sqcl/+WOzH/ljsx/5c9M//AiYP/+/j4/////////////////v///5D///8CAAAAAAAAAAD///9s/////v/////Oo5//lz00/5Y7Mf+WOzH/ljsx/7Z3cP/9+/v////////////////+////bAAAAAD///8V////7v///////////v39//Tq6f/QqKP/m0U8/5Y7Mf+WOzH/z6ah/////////////////////+7///8V////bv///////////////////////////////+XOy/+ZQTf/ljsx/59MQ//69fX/////////////////////bv///7D/////////////////////////////////////wYyG/5Y7Mf+WOzH/4MTC/////////////////////7D////R//////////////////7+//79/f/+/f3//v39/+DGw/+WOzH/ljsx/82inf/////////////////////R////0f///////////////9Svq/+mWVH/pllR/6ZZUf+iUUj/ljsx/5Y7Mf/KnJf/////////////////////0f///7D////////////////KnJf/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/062p/////////////////////7D///9u////////////////0amk/6FQSP+hUEj/oVBI/6JRSP+mWVH/plpS/+7g3v////////////////////9u////Ff///+7///////////7+/v/9/Pz/9u7t/8SSjP/Dj4r/9ezr//79/f/////////////////////u////FQAAAAD///9s/////v///////////////8OPif+WOzH/ljsx/7+Jgv/////////////////////+////bAAAAAAAAAAA////Av///5D////+//////////+9hH7/ljsx/5Y7Mf+8g3z////////////////+////kP///wIAAAAAAAAAAAAAAAD///8C////bP///+7/////8OTi/7R0bP+zcmr/8OLh///////////u////bP///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8V////bv///7D////R////0f///7D///9u////FQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAACAAAABAAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8C////Hf///0n///95////mf///67///+u////mf///3n///9J////Hf///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8I////Tf///7D////p/////v////////////////////////////////////7////p////sP///03///8IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8C////Pfjz8r7HlpH7wY2H/86lof/iysf/9e3s///+/v//////////////////////////////////////////+////77///89////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////Cf///37////z9Ovq/6BORf+WOzH/ljsx/5Y8Mv+hUEf/v4iC/+rY1v/+/f3///////////////////////////////////////////H///99////CQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wr///+d/////P/////06+r/oE5F/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/m0Q7/8WTjf/38PD///////////////////////////////////////////z///+d////CgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8J////nf////3///////////Tr6v+gTkX/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/61mX//w4+L///////////////////////////////////////////3///+d////CQAAAAAAAAAAAAAAAAAAAAAAAAAA////Av///37////8////////////////9Ovq/6BORf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/6daUv/v4uD///////////////////////////////////////////z///9+////AgAAAAAAAAAAAAAAAAAAAAD///89////8//////////////////////48fD/rGRc/5pCOf+YPjT/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/6xkXf/37+////////////////////////////////////////////P///89AAAAAAAAAAAAAAAA////CP///77////////////////////////////////7+Pf/8eXj/+DGw/++hn//m0U8/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/8GLhf/9/Pz//////////////////////////////////////////77///8IAAAAAAAAAAD///9N////+/////////////////////////////////////////////////7+/v/p1tP/rGRd/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/mkI4/+XPzf//////////////////////////////////////////+////00AAAAA////Av///7D////////////////////////////////////////////////////////////////06+r/r2pi/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/tndw//38+///////////////////////////////////////////sP///wL///8d////6f/////////////////////////////////////////////////////////////////////x5eP/olJJ/5Y7Mf+WOzH/ljsx/5Y7Mf+aQjn/7dza///////////////////////////////////////////p////Hf///0n////+///////////////////////////////////////////////////////////////////////////Ur6v/ljwy/5Y7Mf+WOzH/ljsx/5Y7Mf/Oo5////////////////////////////////////////////7///9J////ef////////////////////////////////////////////////////////////////////////////////fw7/+jVEv/ljsx/5Y7Mf+WOzH/ljsx/7Nxav///////////////////////////////////////////////3n///+Z/////////////////////////////////////////////////////////////////////////////////////7yCfP+WOzH/ljsx/5Y7Mf+WOzH/pllQ//r29f//////////////////////////////////////////mf///67///////////////////////////////////////////79/f/9/Pz//fz8//38/P/9/Pz//fz8//38/P/9/Pz/yZuW/5Y7Mf+WOzH/ljsx/5Y7Mf+gT0b/9evr//////////////////////////////////////////+u////rv/////////////////////////////////////69vb/wo2I/7Z3cf+2d3H/tndx/7Z3cf+2d3H/tndx/7Z3cf+lV0//ljsx/5Y7Mf+WOzH/ljsx/6BORf/06+r//////////////////////////////////////////67///+Z//////////////////////////////////////Tr6v+gTkX/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/oE5F//Tr6v//////////////////////////////////////////mf///3n/////////////////////////////////////9Ovq/6BORf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+lVk7/+fPz//////////////////////////////////////////95////Sf////7////////////////////////////////06+r/oE5F/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/7FuZ////v7//////////////////////////////////////v///0n///8d////6f////////////////////////////////Tr6v+gTkX/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/zKCb///////////////////////////////////////////p////Hf///wL///+w////////////////////////////////+PLx/7d4cf+tZl//rWZf/61mX/+tZl//rWZf/61mX/+tZl//rmdg/7Z3cP+2d3H/tndx/7h7df/w4uH//////////////////////////////////////////7D///8CAAAAAP///03////7/////////////////////////////////Pv6//z6+f/8+vn//Pr5//z6+f/z6un/48zJ/+LKx//y5+b//fz8//38/P/9/Pz//fz8///////////////////////////////////////////7////TQAAAAAAAAAA////CP///77/////////////////////////////////////////////////////4MXC/6VXTv+WPDL/ljwy/6JRSP/aubb///7+/////////////////////////////////////////////////////77///8IAAAAAAAAAAAAAAAA////Pf////P///////////////////////////////////////////Xs6/+jU0r/ljsx/5Y7Mf+WOzH/ljsx/59MQv/w5OL////////////////////////////////////////////////z////PQAAAAAAAAAAAAAAAAAAAAD///8C////fv////z/////////////////////////////////////3sK//5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/9m5tf///////////////////////////////////////////P///37///8CAAAAAAAAAAAAAAAAAAAAAAAAAAD///8J////nf////3////////////////////////////////ZuLX/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/17Sw//////////////////////////////////////3///+d////CQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8K////nf////z//////////////////////////+zc2v+aQzn/ljsx/5Y7Mf+WOzH/ljsx/5pDOf/r2tj////////////////////////////////8////nf///woAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8J////fv////P//////////////////////v39/8eYkv+YPjT/ljsx/5Y7Mf+YPjT/xpSP//79/f//////////////////////////8////37///8JAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8C////Pf///77////7/////////////////fv6/+DEwf/Ekoz/wY2H/97Bvv/8+vr/////////////////////+////77///89////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////CP///03///+w////6f////7////////////////////////////////////+////6f///7D///9N////CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wL///8d////Sf///3n///+Z////rv///67///+Z////ef///0n///8d////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAADAAAABgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8E////DP///xr///80////Rv///1n///9q////gP///4D///9q////Wf///0b///80////Gv///wz///8EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////CP///y7///9g////lP///7v////V////6P////r////8/////P////z////8////+v///+j////V////u////5T///9g////Lv///wgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wf///81////k////8/////v////+v////////////////////////////////////////////////////////////////////r////v////z////5P///81////BwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8G////Kv37+3zt3Nrd27y5/Nm6t//fxMH/59LQ//Dk4v/48vH//fv6//////////////////////////////////////////////////////////////////////z////d////fP///yr///8GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///xH///9g////wvz5+ffNop3+m0U8/5c+NP+cRz7/pFVN/65oYP+8gnv/0qun/+jU0v/59fT//v7+///////////////////////////////////////////////////////////+////9////8L///9f////EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////GP///4n////m/////fv4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+XPTT/m0Q6/6ZaUf/BjIX/6NXT//z5+f////////////////////////////////////////////////////////////////3////k////if///xgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wH///8i////pP////f///////////v4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+XPjT/oVFI/8yhnP/x5OP//vz8////////////////////////////////////////////////////////////////9////6T///8i////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///yL///+d////8/////////////////v4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5tEOv+3eHL/48rH//37+/////////////////////////////////////////////////////////////////P///+d////IgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////GP///6T////z//////////////////////v4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+YPjT/qFxT/9y+uv/9+vr////////////////////////////////////////////////////////////////z////pP///xgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8R////if////f///////////////////////////v4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsy/6NUS//Yt7P//Pn4////////////////////////////////////////////////////////////////9////4n///8RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wb///9g////5v////////////////////////////////v4+P/KnZj/mUI4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5c8Mv+pXlb/38PA//38/P///////////////////////////////////////////////////////////////+b///9g////BgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///yr////C/////f////////////////////////////////38+//dwLz/qF1V/51JP/+bRDv/mD40/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+XPTP/qWBY/+vZ2P///v7///////////////////////////////////////////////////////////3////C////KgAAAAAAAAAAAAAAAAAAAAAAAAAA////B////3z////3///////////////////////////////////////////9+/r/9/Dv/+zc2f/dwLz/x5iT/7BrY/+eS0H/lz0z/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/lzwy/7d6c//06un////////////////////////////////////////////////////////////////3////fP///wcAAAAAAAAAAAAAAAAAAAAA////Nf///93////+//////////////////////////////////////////////////////7+/v/+/v7//fz8//Hm5f/XtLH/s3Fq/5lCOP+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/51JP//Sq6b//Pn5///////////////////////////////////////////////////////////+////3f///zUAAAAAAAAAAAAAAAD///8I////k/////z////////////////////////////////////////////////////////////////////////////////9+/v/8eTj/8aVkP+dRz7/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5c8Mv+vamL/7uDf/////////////////////////////////////////////////////////////////P///5P///8IAAAAAAAAAAD///8u////z/////////////////////////////////////////////////////////////////////////////////////////////////fx8P/ImZP/nUg//5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+ZQTj/0qyo//38/P///////////////////////////////////////////////////////////////8////8uAAAAAP///wT///9g////7//////////////////////////////////////////////////////////////////////////////////////////////////////07Or/xJGL/5hAN/+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/rGRd//Tq6P///////////////////////////////////////////////////////////////+////9g////BP///wz///+U////+v////////////////////////////////////////////////////////////////////////////////////////////////////////7/8+jm/7Nya/+WPDP/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/mkQ7/9m3s////v7///////////////////////////////////////////////////////////r///+U////DP///xr///+7/////////////////////////////////////////////////////////////////////////////////////////////////////////////////v7+/+HHxP+hUEf/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljwy/7yBe//69/f///////////////////////////////////////////////////////////////+7////Gv///zT////V//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////bu7f+7gHr/mD40/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/6xkXP/u4N/////////////////////////////////////////////////////////////////V////NP///0b////o//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////38/P/XtK//nEY9/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/6BNRP/iycb////////////////////////////////////////////////////////////////o////Rv///1n////6///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////o1NL/pVhQ/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5xGPP/Yt7L//v39///////////////////////////////////////////////////////////6////Wf///2r////8///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////06un/sW1m/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5pDOf/PpKD//Pr5///////////////////////////////////////////////////////////8////av///4D////8/////////////////////////////////////////////////////////////v7//fv7//37+v/9+/r//fv6//37+v/9+/r//fv6//37+v/9+/r//fv6//37+v/06un/snBp/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5lBOP/KnJj/+/j4///////////////////////////////////////////////////////////8////gP///4D////8//////////////////////////////////////////////////////79/f/s3Nr/z6ej/8uemv/Lnpr/y56a/8uemv/Lnpr/y56a/8uemv/Lnpr/y56a/8uemv/GlI//o1VM/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5lBOP/KnJf/+/j4///////////////////////////////////////////////////////////8////gP///2r////8//////////////////////////////////////////////////////z5+f/Nop3/m0Q7/5Y8Mv+WPDL/ljwy/5Y8Mv+WPDL/ljwy/5Y8Mv+WPDL/ljwy/5Y8Mv+WPDL/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5lBOP/KnJf/+/j4///////////////////////////////////////////////////////////8////av///1n////6//////////////////////////////////////////////////////v4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5lCOP/KnZj/+/j4///////////////////////////////////////////////////////////6////Wf///0b////o//////////////////////////////////////////////////////v4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5pDOv/Qp6P//Pr6///////////////////////////////////////////////////////////o////Rv///zT////V//////////////////////////////////////////////////////v4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/51IP//bvbr//v7+///////////////////////////////////////////////////////////V////NP///xr///+7//////////////////////////////////////////////////////v4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/6RVTf/n0c////////////////////////////////////////////////////////////////+7////Gv///wz///+U////+v////////////////////////////////////////////////v4+P/KnJf/mUE4/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/7FuZ//z6ej///////////////////////////////////////////////////////////r///+U////DP///wT///9g////7/////////////////////////////////////////////////z4+P/LnZj/mkI5/5Y8Mv+WPDL/ljwy/5Y8Mv+WPDL/ljwy/5Y8Mv+WPDL/ljwy/5Y8Mv+WPDL/ljwy/5Y8Mv+WPDL/ljwy/5Y8Mv+WPDL/mUE3/8mblf/9+/r//////////////////////////////////////////////////////////+////9g////BAAAAAD///8u////z/////////////////////////////////////////////////38/P/iycb/v4iC/7yCfP+8gnz/vIJ8/7yCfP+8gnz/vIJ8/7yCfP+8gnz/vIJ8/7yCfP+8gnz/voR+/8qcl//Lnpr/y56a/8uemv/Lnpr/zqOf//Hl5P///v7//////////////////////////////////////////////////////////8////8uAAAAAAAAAAD///8I////k/////z////////////////////////////////////////////////9/Pz/+vf2//r39v/69/b/+vf2//r39v/69/b/+vf2//j08//07Ov/7+Df/+7f3v/z6+n/+PPy//z6+v/9+/r//fv6//37+v/9+/r//fv7///+/v///////////////////////////////////////////////////////////P///5P///8IAAAAAAAAAAAAAAAA////Nf///93////+/////////////////////////////////////////////////////////////////////////////v7/9u7t/9i3s/++hn//sW1m/7BsZf+7gnv/066q//Ln5v/+/v7////////////////////////////////////////////////////////////////////////////////+////3f///zUAAAAAAAAAAAAAAAAAAAAA////B////3z////3///////////////////////////////////////////////////////////////////////////17Ov/wo6I/55KQf+XPjT/ljsx/5Y7Mf+XPTP/nEY9/7uBe//x5eP////////////////////////////////////////////////////////////////////////////////3////fP///wcAAAAAAAAAAAAAAAAAAAAAAAAAAP///yr////C/////f////////////////////////////////////////////////////////////////37+//UsKz/nUg//5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5tEO//No57/+/j4//////////////////////////////////////////////////////////////////////3////C////KgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wb///9g////5v////////////////////////////////////////////////////////////////bv7/+5fHb/lz0z/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y8Mv+ycGj/8ujm/////////////////////////////////////////////////////////////////////+b///9g////BgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8R////if////f//////////////////////////////////////////////////////////+3e3P+qYlr/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+oXVT/6tnX////////////////////////////////////////////////////////////////9////4n///8RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////GP///6T////z/////////////////////////////////////////////////////+vZ1/+oXVT/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+nWlL/6dbU///////////////////////////////////////////////////////////z////pP///xgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///yL///+d////8/////////////////////////////////////////////////Hm5f+wa2T/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5Y7Mf+uaGD/8OPh//////////////////////////////////////////////////////P///+d////IgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wH///8i////pP////f///////////////////////////////////////////r19P/CjYf/mD81/5Y7Mf+WOzH/ljsx/5Y7Mf+WOzH/ljsx/5g/Nf/BjIb/+fTz////////////////////////////////////////////////9////6T///8i////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////GP///4n////m/////f////////////////////////////////7+/v/m0M7/qmFZ/5c9M/+WOzH/ljsx/5Y7Mf+WOzH/lz0z/6leV//lz8z//v7+//////////////////////////////////////3////m////if///xgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///xH///9g////wv////f////+///////////////////////////8+vr/4snG/7d4cf+iUUj/mUA3/5c+NP+gTkT/tXVu/+DFw//8+fn////////////////////////////////+////9////8L///9g////EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8G////Kv///3z////d/////P///////////////////////////v38//Tr6v/kzcv/2726/9m6t//jysf/8uno//78/P////////////////////////////////z////d////fP///yr///8GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wf///81////k////8/////v////+v////////////////////////////////////////////////////////////////////r////v////z////5P///81////BwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////CP///y7///9g////lP///7v////V////6P////r////8/////P////z////8////+v///+j////V////u////5T///9g////Lv///wgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8E////DP///xr///80////Rv///1n///9q////gP///4D///9q////Wf///0b///80////Gv///wz///8EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
|
-
function AdminHeader() {
|
|
230
|
-
const { data: session } = useSession();
|
|
231
|
-
const sessionUser = session?.user;
|
|
232
|
-
const roleLabel = sessionUser?.groupName?.trim() || (sessionUser?.isRBACAdmin ? "Administrator" : "Admin user");
|
|
233
|
-
const isMobile = useIsMobile();
|
|
234
|
-
const configuredLogo = process.env.NEXT_PUBLIC_ADMIN_LOGO_URL || DEFAULT_ADMIN_LOGO;
|
|
235
|
-
const [logoSrc, setLogoSrc] = useState(configuredLogo);
|
|
236
|
-
const [logoFailed, setLogoFailed] = useState(false);
|
|
237
|
-
const isDataLogo = useMemo(() => logoSrc.startsWith("data:"), [
|
|
238
|
-
logoSrc
|
|
239
|
-
]);
|
|
240
|
-
const handleLogout = /* @__PURE__ */ __name(() => {
|
|
241
|
-
void adminSignOut();
|
|
242
|
-
}, "handleLogout");
|
|
243
|
-
return /* @__PURE__ */ React.createElement("header", {
|
|
244
|
-
className: "bg-white border-b border-gray-200 px-4 py-2"
|
|
245
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
246
|
-
className: "flex items-center justify-between"
|
|
247
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
248
|
-
className: "flex items-center max-h-9 shrink-0"
|
|
249
|
-
}, !logoFailed ? /* @__PURE__ */ React.createElement(Image, {
|
|
250
|
-
src: logoSrc,
|
|
251
|
-
alt: "Admin",
|
|
252
|
-
width: 120,
|
|
253
|
-
height: 34,
|
|
254
|
-
className: "max-h-9 w-auto object-contain object-left",
|
|
255
|
-
unoptimized: isDataLogo,
|
|
256
|
-
onError: /* @__PURE__ */ __name(() => {
|
|
257
|
-
if (logoSrc !== DEFAULT_ADMIN_LOGO) {
|
|
258
|
-
setLogoSrc(DEFAULT_ADMIN_LOGO);
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
setLogoFailed(true);
|
|
262
|
-
}, "onError")
|
|
263
|
-
}) : /* @__PURE__ */ React.createElement("div", {
|
|
264
|
-
className: "flex items-center gap-2"
|
|
265
|
-
}, /* @__PURE__ */ React.createElement(Image, {
|
|
266
|
-
src: INFURO_FAVICON_BASE64,
|
|
267
|
-
alt: "Infuro",
|
|
268
|
-
width: 18,
|
|
269
|
-
height: 18,
|
|
270
|
-
unoptimized: true
|
|
271
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
272
|
-
className: "text-sm font-semibold text-gray-800"
|
|
273
|
-
}, "Infuro"))), /* @__PURE__ */ React.createElement("div", {
|
|
274
|
-
className: "flex items-center space-x-3"
|
|
275
|
-
}, /* @__PURE__ */ React.createElement(DropdownMenu, null, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, {
|
|
276
|
-
asChild: true
|
|
277
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
278
|
-
variant: "ghost",
|
|
279
|
-
className: isMobile ? "p-1.5 hover:bg-gray-100 rounded-md transition-colors text-gray-700" : "flex items-center space-x-2 px-2 py-1.5 hover:bg-gray-100 rounded-md transition-colors text-gray-700"
|
|
280
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
281
|
-
className: "h-7 w-7 rounded-full bg-gray-700 flex items-center justify-center overflow-hidden relative"
|
|
282
|
-
}, session?.user?.image ? /* @__PURE__ */ React.createElement(Image, {
|
|
283
|
-
src: session.user.image,
|
|
284
|
-
alt: session?.user?.name || "User",
|
|
285
|
-
fill: true,
|
|
286
|
-
className: "object-cover"
|
|
287
|
-
}) : /* @__PURE__ */ React.createElement("span", {
|
|
288
|
-
className: "text-xs font-medium text-gray-100"
|
|
289
|
-
}, session?.user?.name?.charAt(0).toUpperCase() || session?.user?.email?.charAt(0).toUpperCase() || "A")), !isMobile && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
290
|
-
className: "flex flex-col items-start"
|
|
291
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
292
|
-
className: "text-[13px] font-medium text-gray-900"
|
|
293
|
-
}, session?.user?.name || session?.user?.email || "Admin"), /* @__PURE__ */ React.createElement("span", {
|
|
294
|
-
className: "text-[11px] text-gray-500"
|
|
295
|
-
}, roleLabel)), /* @__PURE__ */ React.createElement(ChevronDown, {
|
|
296
|
-
className: "h-3.5 w-3.5 text-gray-400"
|
|
297
|
-
})))), /* @__PURE__ */ React.createElement(DropdownMenuContent, {
|
|
298
|
-
align: "end",
|
|
299
|
-
className: "w-56"
|
|
300
|
-
}, /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
301
|
-
asChild: true
|
|
302
|
-
}, /* @__PURE__ */ React.createElement(Link2, {
|
|
303
|
-
href: "/admin/profile",
|
|
304
|
-
className: "flex items-center text-gray-600"
|
|
305
|
-
}, /* @__PURE__ */ React.createElement(User, {
|
|
306
|
-
className: "mr-2 h-4 w-4"
|
|
307
|
-
}), "Profile")), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
308
|
-
asChild: true
|
|
309
|
-
}, /* @__PURE__ */ React.createElement(Link2, {
|
|
310
|
-
href: "/admin/settings",
|
|
311
|
-
className: "flex items-center text-gray-600"
|
|
312
|
-
}, /* @__PURE__ */ React.createElement(Settings, {
|
|
313
|
-
className: "mr-2 h-4 w-4"
|
|
314
|
-
}), "Settings")), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
315
|
-
onClick: handleLogout,
|
|
316
|
-
className: "text-red-600"
|
|
317
|
-
}, /* @__PURE__ */ React.createElement(LogOut, {
|
|
318
|
-
className: "mr-2 h-4 w-4"
|
|
319
|
-
}), "Sign Out"))))));
|
|
320
|
-
}
|
|
321
|
-
var DEFAULT_ADMIN_LOGO;
|
|
322
|
-
var init_Header = __esm({
|
|
323
|
-
"src/components/Admin/Header.tsx"() {
|
|
324
|
-
"use client";
|
|
325
|
-
init_client_sign_out();
|
|
326
|
-
init_button();
|
|
327
|
-
init_dropdown_menu();
|
|
328
|
-
init_use_mobile();
|
|
329
|
-
init_infuro_favicon();
|
|
330
|
-
DEFAULT_ADMIN_LOGO = "/images/logo/logo.png";
|
|
331
|
-
__name(AdminHeader, "AdminHeader");
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
229
|
|
|
335
230
|
// src/auth/permission-entities.ts
|
|
336
231
|
function isSuperAdminGroupName(name) {
|
|
@@ -438,6 +333,113 @@ var init_vendor_scope = __esm({
|
|
|
438
333
|
__name(canOnboardVendors, "canOnboardVendors");
|
|
439
334
|
}
|
|
440
335
|
});
|
|
336
|
+
function AdminHeader() {
|
|
337
|
+
const { data: session } = useSession();
|
|
338
|
+
const sessionUser = session?.user;
|
|
339
|
+
const roleLabel = sessionUser?.groupName?.trim() || (sessionUser?.isRBACAdmin ? "Administrator" : "Admin user");
|
|
340
|
+
const isVendor = isVendorPortalUser(sessionUser);
|
|
341
|
+
const isMobile = useIsMobile();
|
|
342
|
+
const configuredLogo = process.env.NEXT_PUBLIC_ADMIN_LOGO_URL || DEFAULT_ADMIN_LOGO;
|
|
343
|
+
const [logoSrc, setLogoSrc] = useState(configuredLogo);
|
|
344
|
+
const [logoFailed, setLogoFailed] = useState(false);
|
|
345
|
+
const isDataLogo = useMemo(() => logoSrc.startsWith("data:"), [
|
|
346
|
+
logoSrc
|
|
347
|
+
]);
|
|
348
|
+
const handleLogout = /* @__PURE__ */ __name(() => {
|
|
349
|
+
void adminSignOut();
|
|
350
|
+
}, "handleLogout");
|
|
351
|
+
return /* @__PURE__ */ React.createElement("header", {
|
|
352
|
+
className: "bg-white border-b border-gray-200 px-4 py-2"
|
|
353
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
354
|
+
className: "flex items-center justify-between"
|
|
355
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
356
|
+
className: "flex items-center max-h-9 shrink-0"
|
|
357
|
+
}, !logoFailed ? /* @__PURE__ */ React.createElement(Image, {
|
|
358
|
+
src: logoSrc,
|
|
359
|
+
alt: "Admin",
|
|
360
|
+
width: 120,
|
|
361
|
+
height: 34,
|
|
362
|
+
className: "max-h-9 w-auto object-contain object-left",
|
|
363
|
+
unoptimized: isDataLogo,
|
|
364
|
+
onError: /* @__PURE__ */ __name(() => {
|
|
365
|
+
if (logoSrc !== DEFAULT_ADMIN_LOGO) {
|
|
366
|
+
setLogoSrc(DEFAULT_ADMIN_LOGO);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
setLogoFailed(true);
|
|
370
|
+
}, "onError")
|
|
371
|
+
}) : /* @__PURE__ */ React.createElement("div", {
|
|
372
|
+
className: "flex items-center gap-2"
|
|
373
|
+
}, /* @__PURE__ */ React.createElement(Image, {
|
|
374
|
+
src: INFURO_FAVICON_BASE64,
|
|
375
|
+
alt: "Infuro",
|
|
376
|
+
width: 18,
|
|
377
|
+
height: 18,
|
|
378
|
+
unoptimized: true
|
|
379
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
380
|
+
className: "text-sm font-semibold text-gray-800"
|
|
381
|
+
}, "Infuro"))), /* @__PURE__ */ React.createElement("div", {
|
|
382
|
+
className: "flex items-center space-x-3"
|
|
383
|
+
}, /* @__PURE__ */ React.createElement(DropdownMenu, null, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, {
|
|
384
|
+
asChild: true
|
|
385
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
386
|
+
variant: "ghost",
|
|
387
|
+
className: isMobile ? "p-1.5 hover:bg-gray-100 rounded-md transition-colors text-gray-700" : "flex items-center space-x-2 px-2 py-1.5 hover:bg-gray-100 rounded-md transition-colors text-gray-700"
|
|
388
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
389
|
+
className: "h-7 w-7 rounded-full bg-gray-700 flex items-center justify-center overflow-hidden relative"
|
|
390
|
+
}, session?.user?.image ? /* @__PURE__ */ React.createElement(Image, {
|
|
391
|
+
src: session.user.image,
|
|
392
|
+
alt: session?.user?.name || "User",
|
|
393
|
+
fill: true,
|
|
394
|
+
className: "object-cover"
|
|
395
|
+
}) : /* @__PURE__ */ React.createElement("span", {
|
|
396
|
+
className: "text-xs font-medium text-gray-100"
|
|
397
|
+
}, session?.user?.name?.charAt(0).toUpperCase() || session?.user?.email?.charAt(0).toUpperCase() || "A")), !isMobile && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
398
|
+
className: "flex flex-col items-start"
|
|
399
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
400
|
+
className: "text-[13px] font-medium text-gray-900"
|
|
401
|
+
}, session?.user?.name || session?.user?.email || "Admin"), /* @__PURE__ */ React.createElement("span", {
|
|
402
|
+
className: "text-[11px] text-gray-500"
|
|
403
|
+
}, roleLabel)), /* @__PURE__ */ React.createElement(ChevronDown, {
|
|
404
|
+
className: "h-3.5 w-3.5 text-gray-400"
|
|
405
|
+
})))), /* @__PURE__ */ React.createElement(DropdownMenuContent, {
|
|
406
|
+
align: "end",
|
|
407
|
+
className: "w-56"
|
|
408
|
+
}, !isVendor && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
409
|
+
asChild: true
|
|
410
|
+
}, /* @__PURE__ */ React.createElement(Link2, {
|
|
411
|
+
href: "/admin/profile",
|
|
412
|
+
className: "flex items-center text-gray-600"
|
|
413
|
+
}, /* @__PURE__ */ React.createElement(User, {
|
|
414
|
+
className: "mr-2 h-4 w-4"
|
|
415
|
+
}), "Profile")), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
416
|
+
asChild: true
|
|
417
|
+
}, /* @__PURE__ */ React.createElement(Link2, {
|
|
418
|
+
href: "/admin/settings",
|
|
419
|
+
className: "flex items-center text-gray-600"
|
|
420
|
+
}, /* @__PURE__ */ React.createElement(Settings, {
|
|
421
|
+
className: "mr-2 h-4 w-4"
|
|
422
|
+
}), "Settings"))), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
423
|
+
onClick: handleLogout,
|
|
424
|
+
className: "text-red-600"
|
|
425
|
+
}, /* @__PURE__ */ React.createElement(LogOut, {
|
|
426
|
+
className: "mr-2 h-4 w-4"
|
|
427
|
+
}), "Sign Out"))))));
|
|
428
|
+
}
|
|
429
|
+
var DEFAULT_ADMIN_LOGO;
|
|
430
|
+
var init_Header = __esm({
|
|
431
|
+
"src/components/Admin/Header.tsx"() {
|
|
432
|
+
"use client";
|
|
433
|
+
init_client_sign_out();
|
|
434
|
+
init_button();
|
|
435
|
+
init_dropdown_menu();
|
|
436
|
+
init_use_mobile();
|
|
437
|
+
init_infuro_favicon();
|
|
438
|
+
init_vendor_scope();
|
|
439
|
+
DEFAULT_ADMIN_LOGO = "/images/logo/logo.png";
|
|
440
|
+
__name(AdminHeader, "AdminHeader");
|
|
441
|
+
}
|
|
442
|
+
});
|
|
441
443
|
var defaultValue, AdminConfigContext;
|
|
442
444
|
var init_admin_config_context = __esm({
|
|
443
445
|
"src/admin/admin-config-context.tsx"() {
|
|
@@ -457,7 +459,7 @@ var init_admin_config_context = __esm({
|
|
|
457
459
|
var CMS_VERSION;
|
|
458
460
|
var init_cms_version = __esm({
|
|
459
461
|
"src/lib/cms-version.ts"() {
|
|
460
|
-
CMS_VERSION = "1.0.
|
|
462
|
+
CMS_VERSION = "1.0.46" ;
|
|
461
463
|
}
|
|
462
464
|
});
|
|
463
465
|
function useCatalogCategories(enabled = true) {
|
|
@@ -589,7 +591,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
589
591
|
const iconActive = "text-gray-700";
|
|
590
592
|
const iconInactive = "text-gray-400";
|
|
591
593
|
const linkCls = "flex items-center px-2.5 py-[7px] text-[13px] font-medium rounded-md transition-colors";
|
|
592
|
-
const
|
|
594
|
+
const sectionCls7 = "mb-5";
|
|
593
595
|
const headingCls = "text-[11px] font-semibold text-gray-400 uppercase tracking-wider px-2.5 mb-1.5";
|
|
594
596
|
const asideCls = isDrawer ? "w-full h-full min-h-0 bg-white flex flex-col overflow-hidden" : "w-52 h-full min-h-0 bg-white border-r border-gray-200 flex-shrink-0 flex flex-col overflow-hidden";
|
|
595
597
|
return /* @__PURE__ */ React.createElement("aside", {
|
|
@@ -599,7 +601,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
599
601
|
}, /* @__PURE__ */ React.createElement("nav", {
|
|
600
602
|
className: "admin-scroll flex-1 min-h-0 px-3 py-4 pb-4 overflow-y-auto overscroll-contain"
|
|
601
603
|
}, showPlatformNav && /* @__PURE__ */ React.createElement("div", {
|
|
602
|
-
className:
|
|
604
|
+
className: sectionCls7
|
|
603
605
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
604
606
|
className: headingCls
|
|
605
607
|
}, "Main"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -611,7 +613,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
611
613
|
className: `h-4 w-4 mr-2 ${isActive("/admin/dashboard") ? iconActive : iconInactive}`
|
|
612
614
|
}), "Dashboard")))), showPlatformNav && customNavSections.length > 0 && customNavSections.map((section) => /* @__PURE__ */ React.createElement("div", {
|
|
613
615
|
key: section.title,
|
|
614
|
-
className:
|
|
616
|
+
className: sectionCls7
|
|
615
617
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
616
618
|
className: headingCls
|
|
617
619
|
}, section.title), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -627,7 +629,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
627
629
|
className: `h-4 w-4 mr-2 ${isActive(item.href) ? iconActive : iconInactive}`
|
|
628
630
|
}), item.label));
|
|
629
631
|
})))), showPlatformNav && customNavSections.length === 0 && customNavItems.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
630
|
-
className:
|
|
632
|
+
className: sectionCls7
|
|
631
633
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
632
634
|
className: headingCls
|
|
633
635
|
}, "Custom"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -643,7 +645,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
643
645
|
className: `h-4 w-4 mr-2 ${isActive(item.href) ? iconActive : iconInactive}`
|
|
644
646
|
}), item.label));
|
|
645
647
|
}))), vendorPortal && /* @__PURE__ */ React.createElement("div", {
|
|
646
|
-
className:
|
|
648
|
+
className: sectionCls7
|
|
647
649
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
648
650
|
className: headingCls
|
|
649
651
|
}, "Main"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -655,7 +657,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
655
657
|
className: `h-4 w-4 mr-2 ${isActive("/admin/dashboard") ? iconActive : iconInactive}`
|
|
656
658
|
}), "Dashboard")))), vendorPortal && customNavSections.length > 0 && customNavSections.map((section) => /* @__PURE__ */ React.createElement("div", {
|
|
657
659
|
key: section.title,
|
|
658
|
-
className:
|
|
660
|
+
className: sectionCls7
|
|
659
661
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
660
662
|
className: headingCls
|
|
661
663
|
}, section.title), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -671,7 +673,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
671
673
|
className: `h-4 w-4 mr-2 ${isActive(item.href) ? iconActive : iconInactive}`
|
|
672
674
|
}), item.label));
|
|
673
675
|
})))), showStoreNav && /* @__PURE__ */ React.createElement("div", {
|
|
674
|
-
className:
|
|
676
|
+
className: sectionCls7
|
|
675
677
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
676
678
|
className: headingCls
|
|
677
679
|
}, "Store"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -737,7 +739,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
737
739
|
}, /* @__PURE__ */ React.createElement(Users, {
|
|
738
740
|
className: `h-4 w-4 mr-2 ${isActive("/admin/vendor_customers") ? iconActive : iconInactive}`
|
|
739
741
|
}), "Customers")))), !vendorPortal && /* @__PURE__ */ React.createElement("div", {
|
|
740
|
-
className:
|
|
742
|
+
className: sectionCls7
|
|
741
743
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
742
744
|
className: headingCls
|
|
743
745
|
}, "Management"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -773,7 +775,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
773
775
|
}, /* @__PURE__ */ React.createElement(Image$1, {
|
|
774
776
|
className: `h-4 w-4 mr-2 ${isActive("/admin/media") ? iconActive : iconInactive}`
|
|
775
777
|
}), "Media")))), vendorPortal && /* @__PURE__ */ React.createElement("div", {
|
|
776
|
-
className:
|
|
778
|
+
className: sectionCls7
|
|
777
779
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
778
780
|
className: headingCls
|
|
779
781
|
}, "Settings"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -794,7 +796,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
794
796
|
}, /* @__PURE__ */ React.createElement(FileText, {
|
|
795
797
|
className: `h-4 w-4 mr-2 ${isActive("/admin/policy") ? iconActive : iconInactive}`
|
|
796
798
|
}), "Policy")))), !vendorPortal && /* @__PURE__ */ React.createElement("div", {
|
|
797
|
-
className:
|
|
799
|
+
className: sectionCls7
|
|
798
800
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
799
801
|
className: headingCls
|
|
800
802
|
}, "System"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -1059,8 +1061,10 @@ var init_admin_theme = __esm({
|
|
|
1059
1061
|
"src/admin/admin-theme.ts"() {
|
|
1060
1062
|
ADMIN_THEME_CSS = `
|
|
1061
1063
|
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap");
|
|
1064
|
+
html{color-scheme:light}
|
|
1062
1065
|
:root{--background:0 0% 100%;--foreground:0 0% 9%;--card:0 0% 100%;--card-foreground:0 0% 9%;--popover:0 0% 100%;--popover-foreground:0 0% 9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--chart-1:0 0% 40%;--chart-2:0 0% 55%;--chart-3:0 0% 70%;--chart-4:0 0% 45%;--chart-5:0 0% 60%;--radius:0.375rem;--sidebar-background:0 0% 100%;--sidebar-foreground:0 0% 9%;--sidebar-primary:0 0% 9%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:0 0% 96.1%;--sidebar-accent-foreground:0 0% 9%;--sidebar-border:0 0% 89.8%;--sidebar-ring:0 0% 9%}
|
|
1063
|
-
|
|
1066
|
+
/* Dark mode disabled: keep light tokens even if a host app adds .dark on <html> */
|
|
1067
|
+
.dark{--background:0 0% 100%;--foreground:0 0% 9%;--card:0 0% 100%;--card-foreground:0 0% 9%;--popover:0 0% 100%;--popover-foreground:0 0% 9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--sidebar-background:0 0% 100%;--sidebar-foreground:0 0% 9%;--sidebar-primary:0 0% 9%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:0 0% 96.1%;--sidebar-accent-foreground:0 0% 9%;--sidebar-border:0 0% 89.8%;--sidebar-ring:0 0% 9%}
|
|
1064
1068
|
*,*::before,*::after{border-color:hsl(var(--border))}
|
|
1065
1069
|
body{font-family:"Inter",ui-sans-serif,system-ui,sans-serif;font-size:14px}
|
|
1066
1070
|
.admin-app{font-size:13.5px}
|
|
@@ -1175,6 +1179,39 @@ var init_auth_debug = __esm({
|
|
|
1175
1179
|
__name(summarizeSessionUserForLog, "summarizeSessionUserForLog");
|
|
1176
1180
|
}
|
|
1177
1181
|
});
|
|
1182
|
+
function useForceAdminLightMode() {
|
|
1183
|
+
useEffect(() => {
|
|
1184
|
+
const root = document.documentElement;
|
|
1185
|
+
const hadDark = root.classList.contains("dark");
|
|
1186
|
+
const prevColorScheme = root.style.colorScheme;
|
|
1187
|
+
const applyLight = /* @__PURE__ */ __name(() => {
|
|
1188
|
+
root.classList.remove("dark");
|
|
1189
|
+
root.style.colorScheme = "light";
|
|
1190
|
+
}, "applyLight");
|
|
1191
|
+
applyLight();
|
|
1192
|
+
const observer = new MutationObserver(() => {
|
|
1193
|
+
if (root.classList.contains("dark")) applyLight();
|
|
1194
|
+
});
|
|
1195
|
+
observer.observe(root, {
|
|
1196
|
+
attributes: true,
|
|
1197
|
+
attributeFilter: [
|
|
1198
|
+
"class"
|
|
1199
|
+
]
|
|
1200
|
+
});
|
|
1201
|
+
return () => {
|
|
1202
|
+
observer.disconnect();
|
|
1203
|
+
root.style.colorScheme = prevColorScheme;
|
|
1204
|
+
if (hadDark) root.classList.add("dark");
|
|
1205
|
+
else root.classList.remove("dark");
|
|
1206
|
+
};
|
|
1207
|
+
}, []);
|
|
1208
|
+
}
|
|
1209
|
+
var init_force_light_mode = __esm({
|
|
1210
|
+
"src/admin/force-light-mode.ts"() {
|
|
1211
|
+
"use client";
|
|
1212
|
+
__name(useForceAdminLightMode, "useForceAdminLightMode");
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1178
1215
|
function useAdminViewSettings() {
|
|
1179
1216
|
useEffect(() => {
|
|
1180
1217
|
fetch("/api/settings/admin_view").then((r) => r.ok ? r.json() : null).then((data) => {
|
|
@@ -1196,6 +1233,7 @@ function AdminLayoutInner({ children }) {
|
|
|
1196
1233
|
const isMobile = useIsMobile();
|
|
1197
1234
|
const vendorBlockRedirectRef = useRef(false);
|
|
1198
1235
|
useAdminViewSettings();
|
|
1236
|
+
useForceAdminLightMode();
|
|
1199
1237
|
const isPublicPath = PUBLIC_ADMIN_PATHS.includes(pathname);
|
|
1200
1238
|
const isVendorOnlySession = session?.user?.isVendorPortal === true && session?.user?.isRBACAdmin !== true;
|
|
1201
1239
|
useEffect(() => {
|
|
@@ -1484,6 +1522,7 @@ var init_AdminLayout = __esm({
|
|
|
1484
1522
|
init_admin_config_context();
|
|
1485
1523
|
init_builtin_plugin_descriptors();
|
|
1486
1524
|
init_auth_debug();
|
|
1525
|
+
init_force_light_mode();
|
|
1487
1526
|
PUBLIC_ADMIN_PATHS = [
|
|
1488
1527
|
"/admin/signin",
|
|
1489
1528
|
"/admin/forgot-password",
|
|
@@ -1734,6 +1773,225 @@ var init_file_upload = __esm({
|
|
|
1734
1773
|
__name(FileUpload, "FileUpload");
|
|
1735
1774
|
}
|
|
1736
1775
|
});
|
|
1776
|
+
|
|
1777
|
+
// src/lib/media-url.ts
|
|
1778
|
+
function isVideoUploadMime(mime) {
|
|
1779
|
+
const t = String(mime ?? "").trim().toLowerCase();
|
|
1780
|
+
return VIDEO_UPLOAD_MIME_TYPES.includes(t);
|
|
1781
|
+
}
|
|
1782
|
+
function isVideoMediaUrl(url) {
|
|
1783
|
+
if (!url || typeof url !== "string") return false;
|
|
1784
|
+
const trimmed = url.trim();
|
|
1785
|
+
if (!trimmed) return false;
|
|
1786
|
+
try {
|
|
1787
|
+
if (/^https?:\/\//i.test(trimmed)) {
|
|
1788
|
+
return VIDEO_EXT_RE.test(new URL(trimmed).pathname);
|
|
1789
|
+
}
|
|
1790
|
+
} catch {
|
|
1791
|
+
}
|
|
1792
|
+
const path = trimmed.split("?")[0]?.split("#")[0] ?? trimmed;
|
|
1793
|
+
return VIDEO_EXT_RE.test(path);
|
|
1794
|
+
}
|
|
1795
|
+
var VIDEO_EXT_RE, IMAGE_UPLOAD_MIME_TYPES, VIDEO_UPLOAD_MIME_TYPES, MEDIA_UPLOAD_MIME_TYPES, VIDEO_UPLOAD_MAX_BYTES;
|
|
1796
|
+
var init_media_url = __esm({
|
|
1797
|
+
"src/lib/media-url.ts"() {
|
|
1798
|
+
VIDEO_EXT_RE = /\.(mp4|webm|mov)(?:$|[?#])/i;
|
|
1799
|
+
IMAGE_UPLOAD_MIME_TYPES = [
|
|
1800
|
+
"image/jpeg",
|
|
1801
|
+
"image/png",
|
|
1802
|
+
"image/gif",
|
|
1803
|
+
"image/webp"
|
|
1804
|
+
];
|
|
1805
|
+
VIDEO_UPLOAD_MIME_TYPES = [
|
|
1806
|
+
"video/mp4",
|
|
1807
|
+
"video/webm",
|
|
1808
|
+
"video/quicktime"
|
|
1809
|
+
];
|
|
1810
|
+
MEDIA_UPLOAD_MIME_TYPES = [
|
|
1811
|
+
...IMAGE_UPLOAD_MIME_TYPES,
|
|
1812
|
+
...VIDEO_UPLOAD_MIME_TYPES
|
|
1813
|
+
];
|
|
1814
|
+
VIDEO_UPLOAD_MAX_BYTES = 100 * 1024 * 1024;
|
|
1815
|
+
__name(isVideoUploadMime, "isVideoUploadMime");
|
|
1816
|
+
__name(isVideoMediaUrl, "isVideoMediaUrl");
|
|
1817
|
+
}
|
|
1818
|
+
});
|
|
1819
|
+
function ImageOrUrlField({ label, value, onChange, placeholder = "https://\u2026", inputClassName = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm", labelClassName = "block text-xs font-medium text-gray-600 mb-1", previewVariant = "banner", maxSizeMb = 10 }) {
|
|
1820
|
+
const fileInputRef = useRef(null);
|
|
1821
|
+
const [isUploading, setIsUploading] = useState(false);
|
|
1822
|
+
const [error, setError] = useState(null);
|
|
1823
|
+
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
1824
|
+
const previewCls = previewVariant === "logo" ? "h-20 w-20 rounded-md border border-gray-200 bg-white object-contain cursor-pointer" : "max-h-32 w-full rounded-md border border-gray-200 bg-gray-50 object-cover cursor-pointer";
|
|
1825
|
+
const closeLightbox = useCallback(() => setLightboxOpen(false), []);
|
|
1826
|
+
useEffect(() => {
|
|
1827
|
+
if (!lightboxOpen) return;
|
|
1828
|
+
const onKeyDown = /* @__PURE__ */ __name((e) => {
|
|
1829
|
+
if (e.key === "Escape") closeLightbox();
|
|
1830
|
+
}, "onKeyDown");
|
|
1831
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1832
|
+
const prevOverflow = document.body.style.overflow;
|
|
1833
|
+
document.body.style.overflow = "hidden";
|
|
1834
|
+
return () => {
|
|
1835
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
1836
|
+
document.body.style.overflow = prevOverflow;
|
|
1837
|
+
};
|
|
1838
|
+
}, [
|
|
1839
|
+
lightboxOpen,
|
|
1840
|
+
closeLightbox
|
|
1841
|
+
]);
|
|
1842
|
+
const handleUpload = useCallback(async (file) => {
|
|
1843
|
+
setError(null);
|
|
1844
|
+
if (!MEDIA_UPLOAD_MIME_TYPES.includes(file.type)) {
|
|
1845
|
+
setError("Unsupported type. Use JPG, PNG, GIF, WEBP, or video MP4 / WebM / MOV");
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1848
|
+
const isVideo2 = isVideoUploadMime(file.type);
|
|
1849
|
+
const limit = isVideo2 ? VIDEO_UPLOAD_MAX_BYTES : maxSizeMb * 1024 * 1024;
|
|
1850
|
+
if (file.size > limit) {
|
|
1851
|
+
setError(isVideo2 ? `Video must be under ${VIDEO_UPLOAD_MAX_BYTES / (1024 * 1024)}MB` : `File must be under ${Math.round(limit / (1024 * 1024))}MB`);
|
|
1852
|
+
return;
|
|
1853
|
+
}
|
|
1854
|
+
setIsUploading(true);
|
|
1855
|
+
try {
|
|
1856
|
+
const formData = new FormData();
|
|
1857
|
+
formData.append("file", file);
|
|
1858
|
+
const response = await fetch("/api/upload", {
|
|
1859
|
+
method: "POST",
|
|
1860
|
+
body: formData
|
|
1861
|
+
});
|
|
1862
|
+
const data = await response.json();
|
|
1863
|
+
if (!response.ok) {
|
|
1864
|
+
throw new Error(data.error || data.details || "Upload failed");
|
|
1865
|
+
}
|
|
1866
|
+
onChange(data.filePath ?? "");
|
|
1867
|
+
} catch (err) {
|
|
1868
|
+
setError(err instanceof Error ? err.message : "Upload failed");
|
|
1869
|
+
} finally {
|
|
1870
|
+
setIsUploading(false);
|
|
1871
|
+
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
1872
|
+
}
|
|
1873
|
+
}, [
|
|
1874
|
+
maxSizeMb,
|
|
1875
|
+
onChange
|
|
1876
|
+
]);
|
|
1877
|
+
const onFileChange = useCallback((e) => {
|
|
1878
|
+
const file = e.target.files?.[0];
|
|
1879
|
+
if (file) void handleUpload(file);
|
|
1880
|
+
}, [
|
|
1881
|
+
handleUpload
|
|
1882
|
+
]);
|
|
1883
|
+
const trimmed = value.trim();
|
|
1884
|
+
const isVideo = isVideoMediaUrl(trimmed);
|
|
1885
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1886
|
+
className: "space-y-2"
|
|
1887
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
1888
|
+
className: labelClassName
|
|
1889
|
+
}, label), trimmed ? /* @__PURE__ */ React.createElement("div", {
|
|
1890
|
+
className: "flex items-start gap-3"
|
|
1891
|
+
}, isVideo ? (
|
|
1892
|
+
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
1893
|
+
/* @__PURE__ */ React.createElement("video", {
|
|
1894
|
+
src: trimmed,
|
|
1895
|
+
className: previewCls,
|
|
1896
|
+
muted: true,
|
|
1897
|
+
playsInline: true,
|
|
1898
|
+
preload: "metadata",
|
|
1899
|
+
onClick: /* @__PURE__ */ __name(() => setLightboxOpen(true), "onClick"),
|
|
1900
|
+
title: "Click to enlarge"
|
|
1901
|
+
})
|
|
1902
|
+
) : (
|
|
1903
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
1904
|
+
/* @__PURE__ */ React.createElement("img", {
|
|
1905
|
+
src: trimmed,
|
|
1906
|
+
alt: label,
|
|
1907
|
+
className: previewCls,
|
|
1908
|
+
role: "button",
|
|
1909
|
+
tabIndex: 0,
|
|
1910
|
+
title: "Click to enlarge",
|
|
1911
|
+
onClick: /* @__PURE__ */ __name(() => setLightboxOpen(true), "onClick"),
|
|
1912
|
+
onKeyDown: /* @__PURE__ */ __name((e) => {
|
|
1913
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1914
|
+
e.preventDefault();
|
|
1915
|
+
setLightboxOpen(true);
|
|
1916
|
+
}
|
|
1917
|
+
}, "onKeyDown"),
|
|
1918
|
+
onError: /* @__PURE__ */ __name((e) => {
|
|
1919
|
+
e.currentTarget.style.display = "none";
|
|
1920
|
+
}, "onError")
|
|
1921
|
+
})
|
|
1922
|
+
), /* @__PURE__ */ React.createElement("button", {
|
|
1923
|
+
type: "button",
|
|
1924
|
+
onClick: /* @__PURE__ */ __name(() => onChange(""), "onClick"),
|
|
1925
|
+
className: "inline-flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-600 hover:bg-gray-50"
|
|
1926
|
+
}, /* @__PURE__ */ React.createElement(X, {
|
|
1927
|
+
className: "h-3 w-3"
|
|
1928
|
+
}), "Clear")) : null, /* @__PURE__ */ React.createElement("div", {
|
|
1929
|
+
className: "flex flex-wrap gap-2"
|
|
1930
|
+
}, /* @__PURE__ */ React.createElement("input", {
|
|
1931
|
+
type: "text",
|
|
1932
|
+
inputMode: "url",
|
|
1933
|
+
autoComplete: "off",
|
|
1934
|
+
value,
|
|
1935
|
+
onChange: /* @__PURE__ */ __name((e) => {
|
|
1936
|
+
setError(null);
|
|
1937
|
+
onChange(e.target.value);
|
|
1938
|
+
}, "onChange"),
|
|
1939
|
+
placeholder,
|
|
1940
|
+
className: `${inputClassName} min-w-0 flex-1`
|
|
1941
|
+
}), /* @__PURE__ */ React.createElement("input", {
|
|
1942
|
+
ref: fileInputRef,
|
|
1943
|
+
type: "file",
|
|
1944
|
+
accept: ACCEPT,
|
|
1945
|
+
onChange: onFileChange,
|
|
1946
|
+
className: "hidden",
|
|
1947
|
+
disabled: isUploading
|
|
1948
|
+
}), /* @__PURE__ */ React.createElement("button", {
|
|
1949
|
+
type: "button",
|
|
1950
|
+
onClick: /* @__PURE__ */ __name(() => fileInputRef.current?.click(), "onClick"),
|
|
1951
|
+
disabled: isUploading,
|
|
1952
|
+
className: "inline-flex shrink-0 items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50"
|
|
1953
|
+
}, /* @__PURE__ */ React.createElement(Upload, {
|
|
1954
|
+
className: "h-3.5 w-3.5"
|
|
1955
|
+
}), isUploading ? "Uploading\u2026" : "Upload")), error ? /* @__PURE__ */ React.createElement("p", {
|
|
1956
|
+
className: "flex items-center gap-1.5 text-xs text-red-600"
|
|
1957
|
+
}, /* @__PURE__ */ React.createElement(AlertCircle, {
|
|
1958
|
+
className: "h-3.5 w-3.5 shrink-0"
|
|
1959
|
+
}), error) : /* @__PURE__ */ React.createElement("p", {
|
|
1960
|
+
className: "text-xs text-gray-500"
|
|
1961
|
+
}, "Paste a URL or upload an image (PNG, JPG, GIF, WEBP up to ", maxSizeMb, "MB) or video (MP4, WebM, MOV up to", " ", VIDEO_UPLOAD_MAX_BYTES / (1024 * 1024), "MB)"), lightboxOpen && trimmed ? /* @__PURE__ */ React.createElement("div", {
|
|
1962
|
+
className: "fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-4",
|
|
1963
|
+
role: "dialog",
|
|
1964
|
+
"aria-modal": "true",
|
|
1965
|
+
"aria-label": `${label} preview`,
|
|
1966
|
+
onClick: closeLightbox
|
|
1967
|
+
}, isVideo ? (
|
|
1968
|
+
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
1969
|
+
/* @__PURE__ */ React.createElement("video", {
|
|
1970
|
+
src: trimmed,
|
|
1971
|
+
controls: true,
|
|
1972
|
+
autoPlay: true,
|
|
1973
|
+
className: "max-h-[90vh] max-w-[90vw] rounded-md shadow-lg",
|
|
1974
|
+
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick")
|
|
1975
|
+
})
|
|
1976
|
+
) : (
|
|
1977
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
1978
|
+
/* @__PURE__ */ React.createElement("img", {
|
|
1979
|
+
src: trimmed,
|
|
1980
|
+
alt: label,
|
|
1981
|
+
className: "max-h-[90vh] max-w-[90vw] rounded-md object-contain shadow-lg",
|
|
1982
|
+
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick")
|
|
1983
|
+
})
|
|
1984
|
+
)) : null);
|
|
1985
|
+
}
|
|
1986
|
+
var ACCEPT;
|
|
1987
|
+
var init_ImageOrUrlField = __esm({
|
|
1988
|
+
"src/components/Admin/ImageOrUrlField.tsx"() {
|
|
1989
|
+
"use client";
|
|
1990
|
+
init_media_url();
|
|
1991
|
+
ACCEPT = MEDIA_UPLOAD_MIME_TYPES.join(",");
|
|
1992
|
+
__name(ImageOrUrlField, "ImageOrUrlField");
|
|
1993
|
+
}
|
|
1994
|
+
});
|
|
1737
1995
|
function RelationAutocomplete({ apiEndpoint, value, onChange, labelField = "name", valueField = "id", placeholder = "Select\u2026", disabled = false, queryParams }) {
|
|
1738
1996
|
const [open, setOpen] = useState(false);
|
|
1739
1997
|
const [search, setSearch] = useState("");
|
|
@@ -2104,9 +2362,6 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2104
2362
|
currency: currency || "INR"
|
|
2105
2363
|
});
|
|
2106
2364
|
const [errors, setErrors] = useState({});
|
|
2107
|
-
const [password, setPassword] = useState("");
|
|
2108
|
-
const [confirmPassword, setConfirmPassword] = useState("");
|
|
2109
|
-
const isCustomerCreate = resource === "vendor_customers" && !existingData;
|
|
2110
2365
|
useEffect(() => {
|
|
2111
2366
|
fetch("/api/settings/store").then((res) => res.json()).then((data) => {
|
|
2112
2367
|
setFormData((prev) => ({
|
|
@@ -2234,8 +2489,6 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2234
2489
|
});
|
|
2235
2490
|
setFormData(merged);
|
|
2236
2491
|
} else {
|
|
2237
|
-
setPassword("");
|
|
2238
|
-
setConfirmPassword("");
|
|
2239
2492
|
setFormData(columns.filter((col) => !col.hideInForm).reduce((acc, col) => {
|
|
2240
2493
|
const path = col.field || col.key;
|
|
2241
2494
|
if (!path) return acc;
|
|
@@ -2296,18 +2549,6 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2296
2549
|
}
|
|
2297
2550
|
}
|
|
2298
2551
|
});
|
|
2299
|
-
if (isCustomerCreate) {
|
|
2300
|
-
if (!password) {
|
|
2301
|
-
newErrors["_password"] = "Password is required";
|
|
2302
|
-
} else if (password.length < 6) {
|
|
2303
|
-
newErrors["_password"] = "Password must be at least 6 characters";
|
|
2304
|
-
}
|
|
2305
|
-
if (!confirmPassword) {
|
|
2306
|
-
newErrors["_confirmPassword"] = "Please confirm your password";
|
|
2307
|
-
} else if (password && confirmPassword !== password) {
|
|
2308
|
-
newErrors["_confirmPassword"] = "Passwords do not match";
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
2552
|
setErrors(newErrors);
|
|
2312
2553
|
return Object.keys(newErrors).length === 0;
|
|
2313
2554
|
}, "validateForm");
|
|
@@ -2325,9 +2566,6 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2325
2566
|
if (!existingData) {
|
|
2326
2567
|
delete payload.id;
|
|
2327
2568
|
}
|
|
2328
|
-
if (isCustomerCreate) {
|
|
2329
|
-
payload._password = password;
|
|
2330
|
-
}
|
|
2331
2569
|
try {
|
|
2332
2570
|
const res = await fetch(url, {
|
|
2333
2571
|
method,
|
|
@@ -2342,12 +2580,7 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2342
2580
|
return;
|
|
2343
2581
|
}
|
|
2344
2582
|
const result = await res.json();
|
|
2345
|
-
|
|
2346
|
-
toast.success(`User invite created! Invite link: ${result.inviteLink}
|
|
2347
|
-
|
|
2348
|
-
Note: ${result.note}`);
|
|
2349
|
-
}
|
|
2350
|
-
onSaveSuccess?.();
|
|
2583
|
+
onSaveSuccess?.(result);
|
|
2351
2584
|
onClose();
|
|
2352
2585
|
} catch (error) {
|
|
2353
2586
|
console.error("Error saving data:", error);
|
|
@@ -2357,6 +2590,7 @@ Note: ${result.note}`);
|
|
|
2357
2590
|
const visibleColumns = columns.filter((col) => {
|
|
2358
2591
|
if (col.hideInForm) return false;
|
|
2359
2592
|
if (!existingData && col.hideInCreate) return false;
|
|
2593
|
+
if (existingData && col.hideInEdit) return false;
|
|
2360
2594
|
return true;
|
|
2361
2595
|
});
|
|
2362
2596
|
const isFieldDisabled = /* @__PURE__ */ __name((path) => {
|
|
@@ -2393,7 +2627,7 @@ Note: ${result.note}`);
|
|
|
2393
2627
|
const selectValue = optionSet && rawStr !== "" && optionSet.has(rawStr) ? rawStr : void 0;
|
|
2394
2628
|
return /* @__PURE__ */ React26__default.createElement(React26__default.Fragment, {
|
|
2395
2629
|
key: path
|
|
2396
|
-
}, /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
2630
|
+
}, /* @__PURE__ */ React26__default.createElement("div", null, col.type !== "image" && /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
2397
2631
|
className: "block text-sm font-medium mb-1"
|
|
2398
2632
|
}, col.displayName, [
|
|
2399
2633
|
"subtotal",
|
|
@@ -2520,6 +2754,16 @@ Note: ${result.note}`);
|
|
|
2520
2754
|
disabled
|
|
2521
2755
|
}) : col.type === "file" ? /* @__PURE__ */ React26__default.createElement(FileUpload, {
|
|
2522
2756
|
onUploadSuccess: /* @__PURE__ */ __name((url) => handleFileUpload(path, url), "onUploadSuccess")
|
|
2757
|
+
}) : col.type === "image" ? /* @__PURE__ */ React26__default.createElement(ImageOrUrlField, {
|
|
2758
|
+
label: col.displayName,
|
|
2759
|
+
value: typeof formData[path] === "string" ? formData[path] : "",
|
|
2760
|
+
onChange: /* @__PURE__ */ __name((url) => setFormData((prev) => ({
|
|
2761
|
+
...prev,
|
|
2762
|
+
[path]: url
|
|
2763
|
+
})), "onChange"),
|
|
2764
|
+
placeholder: col.placeholder ?? "Image URL or upload",
|
|
2765
|
+
previewVariant: "logo",
|
|
2766
|
+
labelClassName: "block text-sm font-medium mb-1"
|
|
2523
2767
|
}) : /* @__PURE__ */ React26__default.createElement(Input, {
|
|
2524
2768
|
type: col.type || "text",
|
|
2525
2769
|
placeholder: [
|
|
@@ -2543,25 +2787,7 @@ Note: ${result.note}`);
|
|
|
2543
2787
|
"contact.name": e.target.value
|
|
2544
2788
|
})), "onChange")
|
|
2545
2789
|
})));
|
|
2546
|
-
}),
|
|
2547
|
-
className: "block text-sm font-medium mb-1"
|
|
2548
|
-
}, "Password"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
2549
|
-
type: "password",
|
|
2550
|
-
value: password,
|
|
2551
|
-
onChange: /* @__PURE__ */ __name((e) => setPassword(e.target.value), "onChange"),
|
|
2552
|
-
placeholder: "Min. 6 characters"
|
|
2553
|
-
}), errors["_password"] && /* @__PURE__ */ React26__default.createElement("p", {
|
|
2554
|
-
className: "text-red-500 text-sm mt-1"
|
|
2555
|
-
}, errors["_password"])), /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
2556
|
-
className: "block text-sm font-medium mb-1"
|
|
2557
|
-
}, "Confirm Password"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
2558
|
-
type: "password",
|
|
2559
|
-
value: confirmPassword,
|
|
2560
|
-
onChange: /* @__PURE__ */ __name((e) => setConfirmPassword(e.target.value), "onChange"),
|
|
2561
|
-
placeholder: "Re-enter password"
|
|
2562
|
-
}), errors["_confirmPassword"] && /* @__PURE__ */ React26__default.createElement("p", {
|
|
2563
|
-
className: "text-red-500 text-sm mt-1"
|
|
2564
|
-
}, errors["_confirmPassword"])))), /* @__PURE__ */ React26__default.createElement("div", {
|
|
2790
|
+
})), /* @__PURE__ */ React26__default.createElement("div", {
|
|
2565
2791
|
className: "flex gap-2 p-4 border-t border-gray-200 shrink-0 bg-white"
|
|
2566
2792
|
}, /* @__PURE__ */ React26__default.createElement(Button, {
|
|
2567
2793
|
type: "submit",
|
|
@@ -2583,6 +2809,7 @@ var init_CreateEditForm = __esm({
|
|
|
2583
2809
|
init_switch();
|
|
2584
2810
|
init_label();
|
|
2585
2811
|
init_file_upload();
|
|
2812
|
+
init_ImageOrUrlField();
|
|
2586
2813
|
init_RelationAutocomplete();
|
|
2587
2814
|
init_RelationMultiSelect();
|
|
2588
2815
|
init_use_mobile();
|
|
@@ -3745,13 +3972,13 @@ function CrudSearchFilterBar({ apiEndpoint, listFilters, relationLabelMaps, sear
|
|
|
3745
3972
|
}
|
|
3746
3973
|
const raw = (committedFilterValues[f.param] ?? "").trim();
|
|
3747
3974
|
if (!raw) return null;
|
|
3748
|
-
const
|
|
3975
|
+
const display2 = f.type === "select" ? labelForSelectValue(f, raw, relationLabelMaps) || raw : f.type === "multiSelect" ? labelsForMultiSelectValue(f, raw, relationLabelMaps) || raw : raw;
|
|
3749
3976
|
return /* @__PURE__ */ React.createElement("span", {
|
|
3750
3977
|
key: f.param,
|
|
3751
3978
|
className: "inline-flex max-w-full items-center gap-1 rounded-full border border-gray-200 bg-white px-3 py-1.5 text-xs font-medium text-gray-800 shadow-sm transition-opacity duration-200"
|
|
3752
3979
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
3753
3980
|
className: "truncate"
|
|
3754
|
-
}, f.label, ": ",
|
|
3981
|
+
}, f.label, ": ", display2), /* @__PURE__ */ React.createElement("button", {
|
|
3755
3982
|
type: "button",
|
|
3756
3983
|
className: "ml-0.5 shrink-0 rounded-full p-0.5 text-gray-500 hover:bg-gray-100 hover:text-gray-900",
|
|
3757
3984
|
"aria-label": `Remove ${f.label}`,
|
|
@@ -3934,11 +4161,7 @@ function formatArrayListCell(value, col) {
|
|
|
3934
4161
|
return items.join(", ");
|
|
3935
4162
|
}
|
|
3936
4163
|
function formatCellValue(value, col) {
|
|
3937
|
-
if (col.type === "boolean") return value ?
|
|
3938
|
-
className: "h-4 w-4 text-green-600"
|
|
3939
|
-
}) : /* @__PURE__ */ React.createElement(X, {
|
|
3940
|
-
className: "h-4 w-4 text-red-600"
|
|
3941
|
-
});
|
|
4164
|
+
if (col.type === "boolean") return value ? "Yes" : "No";
|
|
3942
4165
|
if (col.type === "date") return formatDate(value);
|
|
3943
4166
|
if (col.type === "datetime") return formatDateTime(value);
|
|
3944
4167
|
if (col.type === "multiSelect" || Array.isArray(value) || typeof value === "string" && value.trim().startsWith("[")) {
|
|
@@ -4119,6 +4342,9 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
4119
4342
|
const [bulkDialogOpen, setBulkDialogOpen] = useState(false);
|
|
4120
4343
|
const [isRefetching, setIsRefetching] = useState(false);
|
|
4121
4344
|
const [roleOptions, setRoleOptions] = useState([]);
|
|
4345
|
+
const [inviteDialog, setInviteDialog] = useState(null);
|
|
4346
|
+
const [sendingInviteEmail, setSendingInviteEmail] = useState(false);
|
|
4347
|
+
const [linkCopied, setLinkCopied] = useState(false);
|
|
4122
4348
|
const hasLoadedRef = useRef(false);
|
|
4123
4349
|
const isMobile = useIsMobile();
|
|
4124
4350
|
const showGroupColumn = !!manageUserGroups && roleOptions.length > 0;
|
|
@@ -4577,22 +4803,77 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
4577
4803
|
method: "POST",
|
|
4578
4804
|
headers: {
|
|
4579
4805
|
"Content-Type": "application/json"
|
|
4580
|
-
}
|
|
4806
|
+
},
|
|
4807
|
+
body: JSON.stringify({
|
|
4808
|
+
sendEmail: true,
|
|
4809
|
+
rotate: true
|
|
4810
|
+
})
|
|
4581
4811
|
});
|
|
4582
4812
|
if (!res.ok) {
|
|
4583
4813
|
const error2 = await res.json();
|
|
4584
|
-
throw new Error(error2.error || "Failed to
|
|
4814
|
+
throw new Error(error2.error || "Failed to resend invite");
|
|
4585
4815
|
}
|
|
4586
4816
|
const result = await res.json();
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
toast.success(`New invite link generated.${note}`);
|
|
4590
|
-
}
|
|
4817
|
+
toast.success(result.message || "Invite resent. Previous invite link is no longer valid.");
|
|
4818
|
+
setRefreshKey((k) => k + 1);
|
|
4591
4819
|
} catch (error2) {
|
|
4592
4820
|
console.error("Error regenerating invite:", error2);
|
|
4593
|
-
toast.error(error2 instanceof Error ? error2.message : "Failed to
|
|
4821
|
+
toast.error(error2 instanceof Error ? error2.message : "Failed to resend invite");
|
|
4594
4822
|
}
|
|
4595
4823
|
}, "handleRegenerateInvite");
|
|
4824
|
+
const copyInviteLink = /* @__PURE__ */ __name(async () => {
|
|
4825
|
+
const inviteLink = inviteDialog?.inviteLink;
|
|
4826
|
+
if (!inviteLink) {
|
|
4827
|
+
toast.error("Invite link is not available");
|
|
4828
|
+
return;
|
|
4829
|
+
}
|
|
4830
|
+
try {
|
|
4831
|
+
await navigator.clipboard.writeText(inviteLink);
|
|
4832
|
+
setLinkCopied(true);
|
|
4833
|
+
toast.success("Invite link copied");
|
|
4834
|
+
window.setTimeout(() => setLinkCopied(false), 2e3);
|
|
4835
|
+
} catch {
|
|
4836
|
+
toast.error("Could not copy invite link");
|
|
4837
|
+
}
|
|
4838
|
+
}, "copyInviteLink");
|
|
4839
|
+
const sendInviteEmailFromDialog = /* @__PURE__ */ __name(async () => {
|
|
4840
|
+
if (!inviteDialog) return;
|
|
4841
|
+
setSendingInviteEmail(true);
|
|
4842
|
+
try {
|
|
4843
|
+
const res = await fetch(`/api/users/${inviteDialog.userId}/regenerate-invite`, {
|
|
4844
|
+
method: "POST",
|
|
4845
|
+
headers: {
|
|
4846
|
+
"Content-Type": "application/json"
|
|
4847
|
+
},
|
|
4848
|
+
body: JSON.stringify({
|
|
4849
|
+
sendEmail: true,
|
|
4850
|
+
rotate: false
|
|
4851
|
+
})
|
|
4852
|
+
});
|
|
4853
|
+
const data2 = await res.json();
|
|
4854
|
+
if (!res.ok) {
|
|
4855
|
+
toast.error(data2.error || data2.message || "Failed to send invite email");
|
|
4856
|
+
return;
|
|
4857
|
+
}
|
|
4858
|
+
const nextLink = typeof data2.inviteLink === "string" ? data2.inviteLink.trim() : "";
|
|
4859
|
+
if (nextLink) {
|
|
4860
|
+
setInviteDialog((prev) => prev ? {
|
|
4861
|
+
...prev,
|
|
4862
|
+
inviteLink: nextLink
|
|
4863
|
+
} : prev);
|
|
4864
|
+
}
|
|
4865
|
+
toast.success(data2.emailSent ? "Invite email sent" : data2.message || "Invite email queued");
|
|
4866
|
+
} catch {
|
|
4867
|
+
toast.error("Failed to send invite email");
|
|
4868
|
+
} finally {
|
|
4869
|
+
setSendingInviteEmail(false);
|
|
4870
|
+
}
|
|
4871
|
+
}, "sendInviteEmailFromDialog");
|
|
4872
|
+
const closeInviteDialog = /* @__PURE__ */ __name(() => {
|
|
4873
|
+
setInviteDialog(null);
|
|
4874
|
+
setLinkCopied(false);
|
|
4875
|
+
setRefreshKey((k) => k + 1);
|
|
4876
|
+
}, "closeInviteDialog");
|
|
4596
4877
|
const addEditPage = addEditPageUrl && addEditPageUrl.length > 0;
|
|
4597
4878
|
const createQueryString = useMemo(() => {
|
|
4598
4879
|
if (!createQueryParams || Object.keys(createQueryParams).length === 0) return "";
|
|
@@ -4870,11 +5151,11 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
4870
5151
|
onClick: /* @__PURE__ */ __name(() => handleDuplicateClick(item), "onClick")
|
|
4871
5152
|
}, /* @__PURE__ */ React.createElement(Copy, {
|
|
4872
5153
|
className: "h-4 w-4 mr-2"
|
|
4873
|
-
}), "Duplicate")), resourceName === "users" && /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
5154
|
+
}), "Duplicate")), resourceName === "users" && String(item.inviteStatus ?? "") === "pending" && /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
4874
5155
|
onClick: /* @__PURE__ */ __name(() => handleRegenerateInvite(Number(item.id)), "onClick")
|
|
4875
5156
|
}, /* @__PURE__ */ React.createElement(RefreshCw, {
|
|
4876
5157
|
className: "h-4 w-4 mr-2"
|
|
4877
|
-
}), "
|
|
5158
|
+
}), "Resend invite"), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
4878
5159
|
onClick: /* @__PURE__ */ __name(() => handleDeleteClick(item), "onClick"),
|
|
4879
5160
|
className: "text-red-600 focus:text-red-600"
|
|
4880
5161
|
}, /* @__PURE__ */ React.createElement(Trash2, {
|
|
@@ -4978,17 +5259,17 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
4978
5259
|
className: "h-3.5 w-3.5"
|
|
4979
5260
|
}), /* @__PURE__ */ React.createElement("span", {
|
|
4980
5261
|
className: "sr-only"
|
|
4981
|
-
}, "Duplicate")), resourceName === "users" && /* @__PURE__ */ React.createElement(Button, {
|
|
5262
|
+
}, "Duplicate")), resourceName === "users" && String(item.inviteStatus ?? "") === "pending" && /* @__PURE__ */ React.createElement(Button, {
|
|
4982
5263
|
variant: "outline",
|
|
4983
5264
|
size: "icon",
|
|
4984
5265
|
className: "h-7 w-7",
|
|
4985
5266
|
onClick: /* @__PURE__ */ __name(() => handleRegenerateInvite(Number(item.id)), "onClick"),
|
|
4986
|
-
title: "
|
|
5267
|
+
title: "Resend invite"
|
|
4987
5268
|
}, /* @__PURE__ */ React.createElement(RefreshCw, {
|
|
4988
5269
|
className: "h-3.5 w-3.5"
|
|
4989
5270
|
}), /* @__PURE__ */ React.createElement("span", {
|
|
4990
5271
|
className: "sr-only"
|
|
4991
|
-
}, "
|
|
5272
|
+
}, "Resend invite")), /* @__PURE__ */ React.createElement(Button, {
|
|
4992
5273
|
variant: "outline",
|
|
4993
5274
|
size: "icon",
|
|
4994
5275
|
className: "h-7 w-7 border-red-300 text-red-600 hover:text-red-700",
|
|
@@ -5037,12 +5318,55 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
5037
5318
|
setIsFormOpen(false);
|
|
5038
5319
|
setRefreshKey((k) => k + 1);
|
|
5039
5320
|
}, "onClose"),
|
|
5321
|
+
onSaveSuccess: /* @__PURE__ */ __name((result) => {
|
|
5322
|
+
if (resourceName === "users" && result && typeof result.inviteLink === "string" && result.inviteLink.trim() && !editingItem) {
|
|
5323
|
+
const userId = Number(result.user?.id ?? result.id);
|
|
5324
|
+
const inviteLink = result.inviteLink.trim();
|
|
5325
|
+
if (Number.isFinite(userId) && userId > 0) {
|
|
5326
|
+
setLinkCopied(false);
|
|
5327
|
+
setInviteDialog({
|
|
5328
|
+
userId,
|
|
5329
|
+
inviteLink
|
|
5330
|
+
});
|
|
5331
|
+
toast.success(typeof result.message === "string" ? result.message : "User created successfully");
|
|
5332
|
+
return;
|
|
5333
|
+
}
|
|
5334
|
+
}
|
|
5335
|
+
setRefreshKey((k) => k + 1);
|
|
5336
|
+
}, "onSaveSuccess"),
|
|
5040
5337
|
apiEndpoint,
|
|
5041
5338
|
columns,
|
|
5042
5339
|
existingData: editingItem,
|
|
5043
5340
|
duplicateSeed,
|
|
5044
5341
|
resource: resourceName
|
|
5045
5342
|
}), /* @__PURE__ */ React.createElement(Dialog, {
|
|
5343
|
+
open: inviteDialog != null,
|
|
5344
|
+
onOpenChange: /* @__PURE__ */ __name((open) => {
|
|
5345
|
+
if (!open) closeInviteDialog();
|
|
5346
|
+
}, "onOpenChange")
|
|
5347
|
+
}, /* @__PURE__ */ React.createElement(DialogContent, {
|
|
5348
|
+
className: "max-w-md"
|
|
5349
|
+
}, /* @__PURE__ */ React.createElement(DialogHeader, null, /* @__PURE__ */ React.createElement(DialogTitle, null, "User created"), /* @__PURE__ */ React.createElement(DialogDescription, null, "Send an invite email, or copy the invite link to share another way. The link is not shown here.")), /* @__PURE__ */ React.createElement("div", {
|
|
5350
|
+
className: "flex flex-col gap-2 py-2"
|
|
5351
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
5352
|
+
type: "button",
|
|
5353
|
+
disabled: sendingInviteEmail,
|
|
5354
|
+
onClick: /* @__PURE__ */ __name(() => void sendInviteEmailFromDialog(), "onClick")
|
|
5355
|
+
}, /* @__PURE__ */ React.createElement(Mail, {
|
|
5356
|
+
className: "h-4 w-4 mr-2"
|
|
5357
|
+
}), sendingInviteEmail ? "Sending\u2026" : "Send email"), /* @__PURE__ */ React.createElement(Button, {
|
|
5358
|
+
type: "button",
|
|
5359
|
+
variant: "outline",
|
|
5360
|
+
onClick: /* @__PURE__ */ __name(() => void copyInviteLink(), "onClick")
|
|
5361
|
+
}, linkCopied ? /* @__PURE__ */ React.createElement(Check, {
|
|
5362
|
+
className: "h-4 w-4 mr-2"
|
|
5363
|
+
}) : /* @__PURE__ */ React.createElement(Copy, {
|
|
5364
|
+
className: "h-4 w-4 mr-2"
|
|
5365
|
+
}), linkCopied ? "Copied" : "Copy invite link")), /* @__PURE__ */ React.createElement(DialogFooter, null, /* @__PURE__ */ React.createElement(Button, {
|
|
5366
|
+
type: "button",
|
|
5367
|
+
variant: "secondary",
|
|
5368
|
+
onClick: closeInviteDialog
|
|
5369
|
+
}, "Done")))), /* @__PURE__ */ React.createElement(Dialog, {
|
|
5046
5370
|
open: deleteDialogOpen,
|
|
5047
5371
|
onOpenChange: /* @__PURE__ */ __name((open) => {
|
|
5048
5372
|
console.debug("[CRUD][delete] dialog onOpenChange", {
|
|
@@ -7768,155 +8092,6 @@ var init_ComponentSettings = __esm({
|
|
|
7768
8092
|
__name(ComponentSettings, "ComponentSettings");
|
|
7769
8093
|
}
|
|
7770
8094
|
});
|
|
7771
|
-
function ImageOrUrlField({ label, value, onChange, placeholder = "https://\u2026", inputClassName = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm", labelClassName = "block text-xs font-medium text-gray-600 mb-1", previewVariant = "banner", maxSizeMb = 10 }) {
|
|
7772
|
-
const fileInputRef = useRef(null);
|
|
7773
|
-
const [isUploading, setIsUploading] = useState(false);
|
|
7774
|
-
const [error, setError] = useState(null);
|
|
7775
|
-
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
7776
|
-
const previewCls = previewVariant === "logo" ? "h-20 w-20 rounded-md border border-gray-200 bg-white object-contain cursor-pointer" : "max-h-32 w-full rounded-md border border-gray-200 bg-gray-50 object-cover cursor-pointer";
|
|
7777
|
-
const closeLightbox = useCallback(() => setLightboxOpen(false), []);
|
|
7778
|
-
useEffect(() => {
|
|
7779
|
-
if (!lightboxOpen) return;
|
|
7780
|
-
const onKeyDown = /* @__PURE__ */ __name((e) => {
|
|
7781
|
-
if (e.key === "Escape") closeLightbox();
|
|
7782
|
-
}, "onKeyDown");
|
|
7783
|
-
window.addEventListener("keydown", onKeyDown);
|
|
7784
|
-
const prevOverflow = document.body.style.overflow;
|
|
7785
|
-
document.body.style.overflow = "hidden";
|
|
7786
|
-
return () => {
|
|
7787
|
-
window.removeEventListener("keydown", onKeyDown);
|
|
7788
|
-
document.body.style.overflow = prevOverflow;
|
|
7789
|
-
};
|
|
7790
|
-
}, [
|
|
7791
|
-
lightboxOpen,
|
|
7792
|
-
closeLightbox
|
|
7793
|
-
]);
|
|
7794
|
-
const handleUpload = useCallback(async (file) => {
|
|
7795
|
-
setError(null);
|
|
7796
|
-
if (!ACCEPTED_TYPES.includes(file.type)) {
|
|
7797
|
-
setError(`Unsupported file type. Use: ${ACCEPTED_TYPES.map((t) => t.replace("image/", "")).join(", ")}`);
|
|
7798
|
-
return;
|
|
7799
|
-
}
|
|
7800
|
-
if (file.size > maxSizeMb * 1024 * 1024) {
|
|
7801
|
-
setError(`File must be under ${maxSizeMb}MB`);
|
|
7802
|
-
return;
|
|
7803
|
-
}
|
|
7804
|
-
setIsUploading(true);
|
|
7805
|
-
try {
|
|
7806
|
-
const formData = new FormData();
|
|
7807
|
-
formData.append("file", file);
|
|
7808
|
-
const response = await fetch("/api/upload", {
|
|
7809
|
-
method: "POST",
|
|
7810
|
-
body: formData
|
|
7811
|
-
});
|
|
7812
|
-
const data = await response.json();
|
|
7813
|
-
if (!response.ok) {
|
|
7814
|
-
throw new Error(data.error || data.details || "Upload failed");
|
|
7815
|
-
}
|
|
7816
|
-
onChange(data.filePath ?? "");
|
|
7817
|
-
} catch (err) {
|
|
7818
|
-
setError(err instanceof Error ? err.message : "Upload failed");
|
|
7819
|
-
} finally {
|
|
7820
|
-
setIsUploading(false);
|
|
7821
|
-
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
7822
|
-
}
|
|
7823
|
-
}, [
|
|
7824
|
-
maxSizeMb,
|
|
7825
|
-
onChange
|
|
7826
|
-
]);
|
|
7827
|
-
const onFileChange = useCallback((e) => {
|
|
7828
|
-
const file = e.target.files?.[0];
|
|
7829
|
-
if (file) void handleUpload(file);
|
|
7830
|
-
}, [
|
|
7831
|
-
handleUpload
|
|
7832
|
-
]);
|
|
7833
|
-
const trimmed = value.trim();
|
|
7834
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
7835
|
-
className: "space-y-2"
|
|
7836
|
-
}, /* @__PURE__ */ React.createElement("label", {
|
|
7837
|
-
className: labelClassName
|
|
7838
|
-
}, label), trimmed ? /* @__PURE__ */ React.createElement("div", {
|
|
7839
|
-
className: "flex items-start gap-3"
|
|
7840
|
-
}, /* @__PURE__ */ React.createElement("img", {
|
|
7841
|
-
src: trimmed,
|
|
7842
|
-
alt: label,
|
|
7843
|
-
className: previewCls,
|
|
7844
|
-
role: "button",
|
|
7845
|
-
tabIndex: 0,
|
|
7846
|
-
title: "Click to enlarge",
|
|
7847
|
-
onClick: /* @__PURE__ */ __name(() => setLightboxOpen(true), "onClick"),
|
|
7848
|
-
onKeyDown: /* @__PURE__ */ __name((e) => {
|
|
7849
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
7850
|
-
e.preventDefault();
|
|
7851
|
-
setLightboxOpen(true);
|
|
7852
|
-
}
|
|
7853
|
-
}, "onKeyDown"),
|
|
7854
|
-
onError: /* @__PURE__ */ __name((e) => {
|
|
7855
|
-
e.currentTarget.style.display = "none";
|
|
7856
|
-
}, "onError")
|
|
7857
|
-
}), /* @__PURE__ */ React.createElement("button", {
|
|
7858
|
-
type: "button",
|
|
7859
|
-
onClick: /* @__PURE__ */ __name(() => onChange(""), "onClick"),
|
|
7860
|
-
className: "inline-flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-600 hover:bg-gray-50"
|
|
7861
|
-
}, /* @__PURE__ */ React.createElement(X, {
|
|
7862
|
-
className: "h-3 w-3"
|
|
7863
|
-
}), "Clear")) : null, /* @__PURE__ */ React.createElement("div", {
|
|
7864
|
-
className: "flex flex-wrap gap-2"
|
|
7865
|
-
}, /* @__PURE__ */ React.createElement("input", {
|
|
7866
|
-
type: "url",
|
|
7867
|
-
value,
|
|
7868
|
-
onChange: /* @__PURE__ */ __name((e) => {
|
|
7869
|
-
setError(null);
|
|
7870
|
-
onChange(e.target.value);
|
|
7871
|
-
}, "onChange"),
|
|
7872
|
-
placeholder,
|
|
7873
|
-
className: `${inputClassName} min-w-0 flex-1`
|
|
7874
|
-
}), /* @__PURE__ */ React.createElement("input", {
|
|
7875
|
-
ref: fileInputRef,
|
|
7876
|
-
type: "file",
|
|
7877
|
-
accept: ACCEPTED_TYPES.join(","),
|
|
7878
|
-
onChange: onFileChange,
|
|
7879
|
-
className: "hidden",
|
|
7880
|
-
disabled: isUploading
|
|
7881
|
-
}), /* @__PURE__ */ React.createElement("button", {
|
|
7882
|
-
type: "button",
|
|
7883
|
-
onClick: /* @__PURE__ */ __name(() => fileInputRef.current?.click(), "onClick"),
|
|
7884
|
-
disabled: isUploading,
|
|
7885
|
-
className: "inline-flex shrink-0 items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50"
|
|
7886
|
-
}, /* @__PURE__ */ React.createElement(Upload, {
|
|
7887
|
-
className: "h-3.5 w-3.5"
|
|
7888
|
-
}), isUploading ? "Uploading\u2026" : "Upload")), error ? /* @__PURE__ */ React.createElement("p", {
|
|
7889
|
-
className: "flex items-center gap-1.5 text-xs text-red-600"
|
|
7890
|
-
}, /* @__PURE__ */ React.createElement(AlertCircle, {
|
|
7891
|
-
className: "h-3.5 w-3.5 shrink-0"
|
|
7892
|
-
}), error) : /* @__PURE__ */ React.createElement("p", {
|
|
7893
|
-
className: "text-xs text-gray-500"
|
|
7894
|
-
}, "Paste a URL or upload an image (PNG, JPG, GIF, WEBP up to ", maxSizeMb, "MB)"), lightboxOpen && trimmed ? /* @__PURE__ */ React.createElement("div", {
|
|
7895
|
-
className: "fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-4",
|
|
7896
|
-
role: "dialog",
|
|
7897
|
-
"aria-modal": "true",
|
|
7898
|
-
"aria-label": `${label} preview`,
|
|
7899
|
-
onClick: closeLightbox
|
|
7900
|
-
}, /* @__PURE__ */ React.createElement("img", {
|
|
7901
|
-
src: trimmed,
|
|
7902
|
-
alt: label,
|
|
7903
|
-
className: "max-h-[90vh] max-w-[90vw] rounded-md object-contain shadow-lg",
|
|
7904
|
-
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick")
|
|
7905
|
-
})) : null);
|
|
7906
|
-
}
|
|
7907
|
-
var ACCEPTED_TYPES;
|
|
7908
|
-
var init_ImageOrUrlField = __esm({
|
|
7909
|
-
"src/components/Admin/ImageOrUrlField.tsx"() {
|
|
7910
|
-
"use client";
|
|
7911
|
-
ACCEPTED_TYPES = [
|
|
7912
|
-
"image/jpeg",
|
|
7913
|
-
"image/png",
|
|
7914
|
-
"image/gif",
|
|
7915
|
-
"image/webp"
|
|
7916
|
-
];
|
|
7917
|
-
__name(ImageOrUrlField, "ImageOrUrlField");
|
|
7918
|
-
}
|
|
7919
|
-
});
|
|
7920
8095
|
function generateId() {
|
|
7921
8096
|
return `nav_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
|
|
7922
8097
|
}
|
|
@@ -8916,7 +9091,7 @@ var init_AuthFooter = __esm({
|
|
|
8916
9091
|
});
|
|
8917
9092
|
function AuthPageLayout({ children }) {
|
|
8918
9093
|
return /* @__PURE__ */ React.createElement("div", {
|
|
8919
|
-
className: "min-h-screen flex flex-col bg-gray-50
|
|
9094
|
+
className: "min-h-screen flex flex-col bg-gray-50"
|
|
8920
9095
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
8921
9096
|
className: "flex-1 flex items-center justify-center px-4 py-6"
|
|
8922
9097
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -8957,6 +9132,7 @@ var init_SignInPage = __esm({
|
|
|
8957
9132
|
const [email, setEmail] = useState("");
|
|
8958
9133
|
const [password, setPassword] = useState("");
|
|
8959
9134
|
const [error, setError] = useState("");
|
|
9135
|
+
const [success, setSuccess] = useState("");
|
|
8960
9136
|
const [loading, setLoading] = useState(false);
|
|
8961
9137
|
const { status } = useSession();
|
|
8962
9138
|
const searchParams = useSearchParams();
|
|
@@ -8964,6 +9140,9 @@ var init_SignInPage = __esm({
|
|
|
8964
9140
|
if (searchParams.get("error")) {
|
|
8965
9141
|
setError("Invalid email or password");
|
|
8966
9142
|
}
|
|
9143
|
+
if (searchParams.get("activated") === "1") {
|
|
9144
|
+
setSuccess("Account activated. Sign in with your new password.");
|
|
9145
|
+
}
|
|
8967
9146
|
}, [
|
|
8968
9147
|
searchParams
|
|
8969
9148
|
]);
|
|
@@ -9024,41 +9203,45 @@ var init_SignInPage = __esm({
|
|
|
9024
9203
|
}
|
|
9025
9204
|
}, "handleSubmit");
|
|
9026
9205
|
return /* @__PURE__ */ React.createElement(AuthPageLayout, null, /* @__PURE__ */ React.createElement("div", {
|
|
9027
|
-
className: "w-full shadow-md rounded-lg bg-white
|
|
9206
|
+
className: "w-full shadow-md rounded-lg bg-white px-4 py-6 sm:px-6 sm:py-8"
|
|
9028
9207
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
9029
|
-
className: "mb-1 text-center text-xl font-bold text-black
|
|
9208
|
+
className: "mb-1 text-center text-xl font-bold text-black sm:text-2xl"
|
|
9030
9209
|
}, "Sign in"), /* @__PURE__ */ React.createElement("p", {
|
|
9031
9210
|
className: "mb-6 text-center text-sm text-body-color"
|
|
9032
|
-
}, "Enter your credentials"),
|
|
9033
|
-
className: "mb-4 rounded-md bg-
|
|
9211
|
+
}, "Enter your credentials"), success && /* @__PURE__ */ React.createElement("div", {
|
|
9212
|
+
className: "mb-4 rounded-md bg-green-50 p-3 text-sm text-green-700"
|
|
9213
|
+
}, success), error && /* @__PURE__ */ React.createElement("div", {
|
|
9214
|
+
className: "mb-4 rounded-md bg-red-50 p-3 text-sm text-red-600"
|
|
9034
9215
|
}, error), /* @__PURE__ */ React.createElement("form", {
|
|
9035
9216
|
onSubmit: handleSubmit
|
|
9036
9217
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
9037
9218
|
className: "mb-4"
|
|
9038
9219
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
9039
9220
|
htmlFor: "email",
|
|
9040
|
-
className: "mb-1.5 block text-sm text-
|
|
9221
|
+
className: "mb-1.5 block text-sm text-gray-900"
|
|
9041
9222
|
}, "Email"), /* @__PURE__ */ React.createElement("input", {
|
|
9042
9223
|
type: "email",
|
|
9043
9224
|
name: "email",
|
|
9225
|
+
id: "email",
|
|
9044
9226
|
value: email,
|
|
9045
9227
|
onChange: /* @__PURE__ */ __name((e) => setEmail(e.target.value), "onChange"),
|
|
9046
9228
|
placeholder: "Enter email",
|
|
9047
9229
|
required: true,
|
|
9048
|
-
className: "border border-gray-300 w-full rounded bg-gray-50 px-3 py-2 text-sm text-gray-900 outline-none focus:border-gray-500 focus:ring-1 focus:ring-gray-500
|
|
9230
|
+
className: "border border-gray-300 w-full rounded bg-gray-50 px-3 py-2 text-sm text-gray-900 outline-none focus:border-gray-500 focus:ring-1 focus:ring-gray-500"
|
|
9049
9231
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
9050
9232
|
className: "mb-4"
|
|
9051
9233
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
9052
9234
|
htmlFor: "password",
|
|
9053
|
-
className: "mb-1.5 block text-sm text-
|
|
9235
|
+
className: "mb-1.5 block text-sm text-gray-900"
|
|
9054
9236
|
}, "Password"), /* @__PURE__ */ React.createElement("input", {
|
|
9055
9237
|
type: "password",
|
|
9056
9238
|
name: "password",
|
|
9239
|
+
id: "password",
|
|
9057
9240
|
value: password,
|
|
9058
9241
|
onChange: /* @__PURE__ */ __name((e) => setPassword(e.target.value), "onChange"),
|
|
9059
9242
|
placeholder: "Enter password",
|
|
9060
9243
|
required: true,
|
|
9061
|
-
className: "border border-gray-300 w-full rounded bg-gray-50 px-3 py-2 text-sm text-gray-900 outline-none focus:border-gray-500 focus:ring-1 focus:ring-gray-500
|
|
9244
|
+
className: "border border-gray-300 w-full rounded bg-gray-50 px-3 py-2 text-sm text-gray-900 outline-none focus:border-gray-500 focus:ring-1 focus:ring-gray-500"
|
|
9062
9245
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
9063
9246
|
className: "mb-4 flex items-center justify-between"
|
|
9064
9247
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
@@ -9072,7 +9255,7 @@ var init_SignInPage = __esm({
|
|
|
9072
9255
|
}, "Forgot password?")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("button", {
|
|
9073
9256
|
type: "submit",
|
|
9074
9257
|
disabled: loading,
|
|
9075
|
-
className: "w-full rounded bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-800 disabled:opacity-50 disabled:cursor-not-allowed
|
|
9258
|
+
className: "w-full rounded bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-800 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
9076
9259
|
}, loading ? "Signing in..." : "Sign in")))));
|
|
9077
9260
|
}, "SigninPage");
|
|
9078
9261
|
SignInPage_default = SigninPage;
|
|
@@ -9116,11 +9299,11 @@ function ForgotPasswordPage() {
|
|
|
9116
9299
|
}
|
|
9117
9300
|
}, "handleSubmit");
|
|
9118
9301
|
return /* @__PURE__ */ React.createElement(AuthPageLayout, null, /* @__PURE__ */ React.createElement("div", {
|
|
9119
|
-
className: "w-full space-y-4 p-5 sm:p-6 bg-white
|
|
9302
|
+
className: "w-full space-y-4 p-5 sm:p-6 bg-white rounded-lg shadow-md"
|
|
9120
9303
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
9121
9304
|
className: "text-center"
|
|
9122
9305
|
}, /* @__PURE__ */ React.createElement("h2", {
|
|
9123
|
-
className: "text-xl font-bold text-gray-900
|
|
9306
|
+
className: "text-xl font-bold text-gray-900"
|
|
9124
9307
|
}, "Forgot password"), /* @__PURE__ */ React.createElement("p", {
|
|
9125
9308
|
className: "mt-1 text-sm text-body-color"
|
|
9126
9309
|
}, "Enter your email for a reset link.")), /* @__PURE__ */ React.createElement("form", {
|
|
@@ -9138,7 +9321,7 @@ function ForgotPasswordPage() {
|
|
|
9138
9321
|
placeholder: "you@example.com",
|
|
9139
9322
|
className: "mt-1 h-9 text-sm"
|
|
9140
9323
|
})), message && /* @__PURE__ */ React.createElement("div", {
|
|
9141
|
-
className: `p-2.5 rounded-md text-sm ${message.includes("receive") ? "bg-green-50
|
|
9324
|
+
className: `p-2.5 rounded-md text-sm ${message.includes("receive") ? "bg-green-50 text-green-700" : "bg-red-50 text-red-700"}`
|
|
9142
9325
|
}, message), /* @__PURE__ */ React.createElement(Button, {
|
|
9143
9326
|
type: "submit",
|
|
9144
9327
|
disabled: loading,
|
|
@@ -9221,9 +9404,9 @@ function ResetPasswordPageContent() {
|
|
|
9221
9404
|
}, "handleSubmit");
|
|
9222
9405
|
if (!token) {
|
|
9223
9406
|
return /* @__PURE__ */ React.createElement(AuthPageLayout, null, /* @__PURE__ */ React.createElement("div", {
|
|
9224
|
-
className: "w-full space-y-4 p-5 sm:p-6 bg-white
|
|
9407
|
+
className: "w-full space-y-4 p-5 sm:p-6 bg-white rounded-lg shadow-md text-center"
|
|
9225
9408
|
}, /* @__PURE__ */ React.createElement("h2", {
|
|
9226
|
-
className: "text-xl font-bold text-gray-900
|
|
9409
|
+
className: "text-xl font-bold text-gray-900"
|
|
9227
9410
|
}, "Invalid reset link"), /* @__PURE__ */ React.createElement("p", {
|
|
9228
9411
|
className: "text-sm text-body-color"
|
|
9229
9412
|
}, message), /* @__PURE__ */ React.createElement(Link2, {
|
|
@@ -9232,11 +9415,11 @@ function ResetPasswordPageContent() {
|
|
|
9232
9415
|
}, "Request a new link")));
|
|
9233
9416
|
}
|
|
9234
9417
|
return /* @__PURE__ */ React.createElement(AuthPageLayout, null, /* @__PURE__ */ React.createElement("div", {
|
|
9235
|
-
className: "w-full space-y-4 p-5 sm:p-6 bg-white
|
|
9418
|
+
className: "w-full space-y-4 p-5 sm:p-6 bg-white rounded-lg shadow-md"
|
|
9236
9419
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
9237
9420
|
className: "text-center"
|
|
9238
9421
|
}, /* @__PURE__ */ React.createElement("h2", {
|
|
9239
|
-
className: "text-xl font-bold text-gray-900
|
|
9422
|
+
className: "text-xl font-bold text-gray-900"
|
|
9240
9423
|
}, "Set new password"), /* @__PURE__ */ React.createElement("p", {
|
|
9241
9424
|
className: "mt-1 text-sm text-body-color"
|
|
9242
9425
|
}, "Enter your new password.")), /* @__PURE__ */ React.createElement("form", {
|
|
@@ -9271,7 +9454,7 @@ function ResetPasswordPageContent() {
|
|
|
9271
9454
|
}), "onChange"),
|
|
9272
9455
|
className: "mt-1 h-9 text-sm"
|
|
9273
9456
|
})), message && /* @__PURE__ */ React.createElement("div", {
|
|
9274
|
-
className: `p-2.5 rounded-md text-sm ${message.includes("successfully") || message.includes("now sign in") ? "bg-green-50
|
|
9457
|
+
className: `p-2.5 rounded-md text-sm ${message.includes("successfully") || message.includes("now sign in") ? "bg-green-50 text-green-700" : "bg-red-50 text-red-700"}`
|
|
9275
9458
|
}, message), /* @__PURE__ */ React.createElement(Button, {
|
|
9276
9459
|
type: "submit",
|
|
9277
9460
|
disabled: loading,
|
|
@@ -9286,7 +9469,7 @@ function ResetPasswordPageContent() {
|
|
|
9286
9469
|
function ResetPasswordPage() {
|
|
9287
9470
|
return /* @__PURE__ */ React.createElement(Suspense, {
|
|
9288
9471
|
fallback: /* @__PURE__ */ React.createElement("div", {
|
|
9289
|
-
className: "min-h-screen flex items-center justify-center bg-gray-50
|
|
9472
|
+
className: "min-h-screen flex items-center justify-center bg-gray-50"
|
|
9290
9473
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
9291
9474
|
className: "max-w-[400px] w-full p-6 text-center"
|
|
9292
9475
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -9314,6 +9497,7 @@ __export(InvitePage_exports, {
|
|
|
9314
9497
|
default: () => InvitePage
|
|
9315
9498
|
});
|
|
9316
9499
|
function InvitePageContent() {
|
|
9500
|
+
const router = useRouter();
|
|
9317
9501
|
const searchParams = useSearchParams();
|
|
9318
9502
|
const token = searchParams.get("token");
|
|
9319
9503
|
const [formData, setFormData] = useState({
|
|
@@ -9340,8 +9524,13 @@ function InvitePageContent() {
|
|
|
9340
9524
|
setInviteValid(true);
|
|
9341
9525
|
setMessage("");
|
|
9342
9526
|
} else {
|
|
9527
|
+
const err = typeof result.error === "string" ? result.error : "";
|
|
9528
|
+
if (/already (active|accepted)/i.test(err)) {
|
|
9529
|
+
router.replace("/admin/signin?activated=1");
|
|
9530
|
+
return;
|
|
9531
|
+
}
|
|
9343
9532
|
setInviteValid(false);
|
|
9344
|
-
setMessage(
|
|
9533
|
+
setMessage(err || "This invitation is no longer valid.");
|
|
9345
9534
|
}
|
|
9346
9535
|
} catch {
|
|
9347
9536
|
if (!cancelled) {
|
|
@@ -9383,11 +9572,8 @@ function InvitePageContent() {
|
|
|
9383
9572
|
});
|
|
9384
9573
|
const result = await res.json();
|
|
9385
9574
|
if (res.ok) {
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
password: "",
|
|
9389
|
-
confirmPassword: ""
|
|
9390
|
-
});
|
|
9575
|
+
router.replace("/admin/signin?activated=1");
|
|
9576
|
+
return;
|
|
9391
9577
|
} else {
|
|
9392
9578
|
setMessage(result.error || "Failed to activate account");
|
|
9393
9579
|
}
|
|
@@ -9453,7 +9639,7 @@ function InvitePageContent() {
|
|
|
9453
9639
|
}), "onChange"),
|
|
9454
9640
|
className: "mt-1 h-9 text-sm"
|
|
9455
9641
|
})), message && /* @__PURE__ */ React26__default.createElement("div", {
|
|
9456
|
-
className:
|
|
9642
|
+
className: "p-2.5 rounded-md text-sm bg-red-50 text-red-700"
|
|
9457
9643
|
}, message), /* @__PURE__ */ React26__default.createElement(Button, {
|
|
9458
9644
|
type: "submit",
|
|
9459
9645
|
disabled: loading,
|
|
@@ -11219,6 +11405,15 @@ function renderListPrice(value, item) {
|
|
|
11219
11405
|
function renderListThumbnail(url) {
|
|
11220
11406
|
const trimmed = url.trim();
|
|
11221
11407
|
if (!trimmed) return "\u2014";
|
|
11408
|
+
if (isVideoMediaUrl(trimmed)) {
|
|
11409
|
+
return createElement("video", {
|
|
11410
|
+
src: trimmed,
|
|
11411
|
+
muted: true,
|
|
11412
|
+
playsInline: true,
|
|
11413
|
+
preload: "metadata",
|
|
11414
|
+
className: "h-10 w-10 rounded border border-gray-200 bg-black object-cover"
|
|
11415
|
+
});
|
|
11416
|
+
}
|
|
11222
11417
|
return createElement("img", {
|
|
11223
11418
|
src: trimmed,
|
|
11224
11419
|
alt: "",
|
|
@@ -11239,6 +11434,7 @@ function productListImageUrl(item) {
|
|
|
11239
11434
|
var STORE_CRUD_CONFIGS;
|
|
11240
11435
|
var init_store_crud_configs = __esm({
|
|
11241
11436
|
"src/admin/store-crud-configs.ts"() {
|
|
11437
|
+
init_media_url();
|
|
11242
11438
|
__name(renderListPrice, "renderListPrice");
|
|
11243
11439
|
__name(renderListThumbnail, "renderListThumbnail");
|
|
11244
11440
|
__name(productListImageUrl, "productListImageUrl");
|
|
@@ -11451,6 +11647,10 @@ var init_store_crud_configs = __esm({
|
|
|
11451
11647
|
field: "name",
|
|
11452
11648
|
displayName: "Name"
|
|
11453
11649
|
},
|
|
11650
|
+
{
|
|
11651
|
+
field: "slug",
|
|
11652
|
+
displayName: "Slug"
|
|
11653
|
+
},
|
|
11454
11654
|
{
|
|
11455
11655
|
field: "eventId",
|
|
11456
11656
|
displayName: "Event",
|
|
@@ -11941,9 +12141,17 @@ var init_store_crud_configs = __esm({
|
|
|
11941
12141
|
addEditPageUrl: "/admin/brands"
|
|
11942
12142
|
},
|
|
11943
12143
|
product_categories: {
|
|
11944
|
-
title: "
|
|
12144
|
+
title: "Categories",
|
|
11945
12145
|
apiEndpoint: "/api/product_categories",
|
|
11946
12146
|
columns: [
|
|
12147
|
+
{
|
|
12148
|
+
field: "image",
|
|
12149
|
+
displayName: "Image",
|
|
12150
|
+
type: "image",
|
|
12151
|
+
listFilter: false,
|
|
12152
|
+
placeholder: "Image URL or upload",
|
|
12153
|
+
render: /* @__PURE__ */ __name((value) => renderListThumbnail(typeof value === "string" ? value : ""), "render")
|
|
12154
|
+
},
|
|
11947
12155
|
{
|
|
11948
12156
|
field: "name",
|
|
11949
12157
|
displayName: "Name"
|
|
@@ -12550,6 +12758,134 @@ var SettingsPage_exports = {};
|
|
|
12550
12758
|
__export(SettingsPage_exports, {
|
|
12551
12759
|
default: () => SettingsPage
|
|
12552
12760
|
});
|
|
12761
|
+
function InvoiceTemplatePreview({ id }) {
|
|
12762
|
+
if (id === "modern") {
|
|
12763
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
12764
|
+
className: "h-28 rounded-md border border-slate-200 bg-white overflow-hidden shadow-sm"
|
|
12765
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12766
|
+
className: "h-7 bg-teal-700 px-2 flex flex-col justify-center"
|
|
12767
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12768
|
+
className: "h-1.5 w-14 rounded bg-white/90"
|
|
12769
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12770
|
+
className: "h-1 w-10 rounded bg-white/50 mt-1"
|
|
12771
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12772
|
+
className: "p-2 space-y-1.5"
|
|
12773
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12774
|
+
className: "flex gap-2"
|
|
12775
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12776
|
+
className: "flex-1 space-y-1"
|
|
12777
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12778
|
+
className: "h-1 w-8 bg-teal-600/70 rounded"
|
|
12779
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12780
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12781
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12782
|
+
className: "h-1 w-4/5 bg-slate-200 rounded"
|
|
12783
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12784
|
+
className: "flex-1 space-y-1"
|
|
12785
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12786
|
+
className: "h-1 w-8 bg-teal-600/70 rounded"
|
|
12787
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12788
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12789
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
12790
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12791
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12792
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12793
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12794
|
+
className: "ml-auto h-1.5 w-12 bg-teal-700/80 rounded"
|
|
12795
|
+
})));
|
|
12796
|
+
}
|
|
12797
|
+
if (id === "compact") {
|
|
12798
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
12799
|
+
className: "h-28 rounded-md border border-slate-300 bg-white overflow-hidden shadow-sm p-1.5 space-y-1"
|
|
12800
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12801
|
+
className: "h-4 bg-slate-100 rounded flex items-center px-1"
|
|
12802
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12803
|
+
className: "h-1 w-10 bg-slate-700 rounded"
|
|
12804
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12805
|
+
className: "grid grid-cols-4 gap-0.5"
|
|
12806
|
+
}, Array.from({
|
|
12807
|
+
length: 8
|
|
12808
|
+
}).map((_, i) => /* @__PURE__ */ React.createElement("div", {
|
|
12809
|
+
key: i,
|
|
12810
|
+
className: "h-1 bg-slate-200 rounded"
|
|
12811
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
12812
|
+
className: "space-y-0.5"
|
|
12813
|
+
}, Array.from({
|
|
12814
|
+
length: 5
|
|
12815
|
+
}).map((_, i) => /* @__PURE__ */ React.createElement("div", {
|
|
12816
|
+
key: i,
|
|
12817
|
+
className: "flex gap-0.5"
|
|
12818
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12819
|
+
className: "h-1 flex-[3] bg-slate-200 rounded"
|
|
12820
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12821
|
+
className: "h-1 flex-1 bg-slate-300 rounded"
|
|
12822
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12823
|
+
className: "h-1 flex-1 bg-slate-300 rounded"
|
|
12824
|
+
})))), /* @__PURE__ */ React.createElement("div", {
|
|
12825
|
+
className: "ml-auto h-1 w-10 bg-slate-800 rounded"
|
|
12826
|
+
}));
|
|
12827
|
+
}
|
|
12828
|
+
if (id === "bold") {
|
|
12829
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
12830
|
+
className: "h-28 rounded-md border border-red-200 bg-white overflow-hidden shadow-sm"
|
|
12831
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12832
|
+
className: "h-9 bg-red-800 px-2 flex flex-col justify-center gap-1"
|
|
12833
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12834
|
+
className: "h-2 w-16 rounded bg-white"
|
|
12835
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12836
|
+
className: "h-1 w-12 rounded bg-white/60"
|
|
12837
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12838
|
+
className: "p-2 space-y-1.5"
|
|
12839
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12840
|
+
className: "h-1 w-20 bg-slate-300 rounded"
|
|
12841
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12842
|
+
className: "border border-red-100 rounded p-1 space-y-0.5 bg-red-50/40"
|
|
12843
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12844
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12845
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12846
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12847
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12848
|
+
className: "h-1.5 w-14 ml-auto bg-red-800 rounded"
|
|
12849
|
+
}))));
|
|
12850
|
+
}
|
|
12851
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
12852
|
+
className: "h-28 rounded-md border border-slate-200 bg-white overflow-hidden shadow-sm p-2 space-y-1.5"
|
|
12853
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12854
|
+
className: "h-5 rounded bg-slate-100 px-1.5 flex items-center justify-between"
|
|
12855
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12856
|
+
className: "h-1.5 w-12 bg-slate-700 rounded"
|
|
12857
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12858
|
+
className: "h-1 w-8 bg-slate-400 rounded"
|
|
12859
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12860
|
+
className: "flex gap-2"
|
|
12861
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12862
|
+
className: "flex-1 space-y-0.5"
|
|
12863
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12864
|
+
className: "h-1 w-6 bg-slate-600 rounded"
|
|
12865
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12866
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12867
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12868
|
+
className: "h-1 w-3/4 bg-slate-200 rounded"
|
|
12869
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12870
|
+
className: "flex-1 space-y-0.5"
|
|
12871
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12872
|
+
className: "h-1 w-6 bg-slate-600 rounded"
|
|
12873
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12874
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12875
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
12876
|
+
className: "border-t border-slate-200 pt-1 space-y-0.5"
|
|
12877
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12878
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12879
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12880
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12881
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12882
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12883
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12884
|
+
className: "flex justify-end"
|
|
12885
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12886
|
+
className: "h-1.5 w-10 bg-slate-700 rounded"
|
|
12887
|
+
})));
|
|
12888
|
+
}
|
|
12553
12889
|
function hexToHsl(hex) {
|
|
12554
12890
|
const r = parseInt(hex.slice(1, 3), 16) / 255;
|
|
12555
12891
|
const g = parseInt(hex.slice(3, 5), 16) / 255;
|
|
@@ -12600,6 +12936,25 @@ function SettingsPage() {
|
|
|
12600
12936
|
const [requireEventApproval, setRequireEventApproval] = useState(false);
|
|
12601
12937
|
const [storeSettingsLoading, setStoreSettingsLoading] = useState(true);
|
|
12602
12938
|
const [currency, setCurrency] = useState(DEFAULT_CURRENCY);
|
|
12939
|
+
const [invoiceTemplate, setInvoiceTemplate] = useState("classic");
|
|
12940
|
+
const [companyLogo, setCompanyLogo] = useState("");
|
|
12941
|
+
const [companyName, setCompanyName] = useState("");
|
|
12942
|
+
const [companyEmail, setCompanyEmail] = useState("");
|
|
12943
|
+
const [companyPhone, setCompanyPhone] = useState("");
|
|
12944
|
+
const [companyAddress, setCompanyAddress] = useState("");
|
|
12945
|
+
const handleStoreLogoChange = /* @__PURE__ */ __name((newLogo) => {
|
|
12946
|
+
setCompanyLogo(newLogo);
|
|
12947
|
+
setNavbarConfig((prev) => ({
|
|
12948
|
+
...prev,
|
|
12949
|
+
logo: newLogo
|
|
12950
|
+
}));
|
|
12951
|
+
}, "handleStoreLogoChange");
|
|
12952
|
+
const handleNavbarConfigChange = /* @__PURE__ */ __name((newConfig) => {
|
|
12953
|
+
setNavbarConfig(newConfig);
|
|
12954
|
+
if (newConfig.logo !== companyLogo) {
|
|
12955
|
+
setCompanyLogo(newConfig.logo || "");
|
|
12956
|
+
}
|
|
12957
|
+
}, "handleNavbarConfigChange");
|
|
12603
12958
|
const [currencies, setCurrencies] = useState([]);
|
|
12604
12959
|
const [currenciesLoading, setCurrenciesLoading] = useState(true);
|
|
12605
12960
|
const [showAddCurrency, setShowAddCurrency] = useState(false);
|
|
@@ -12644,7 +12999,11 @@ function SettingsPage() {
|
|
|
12644
12999
|
setActiveThemeId((data.activeThemeId || "").trim());
|
|
12645
13000
|
if (data.navbar) {
|
|
12646
13001
|
try {
|
|
12647
|
-
|
|
13002
|
+
const parsed = JSON.parse(data.navbar);
|
|
13003
|
+
setNavbarConfig(parsed);
|
|
13004
|
+
if (parsed.logo) {
|
|
13005
|
+
setCompanyLogo((prev) => prev || parsed.logo);
|
|
13006
|
+
}
|
|
12648
13007
|
} catch {
|
|
12649
13008
|
}
|
|
12650
13009
|
}
|
|
@@ -12654,6 +13013,19 @@ function SettingsPage() {
|
|
|
12654
13013
|
fetch("/api/settings/store").then((r) => r.ok ? r.json() : {}).then((data) => {
|
|
12655
13014
|
setStoreEnabled(data.enabled === "true");
|
|
12656
13015
|
setCurrency(data.currency || DEFAULT_CURRENCY);
|
|
13016
|
+
setInvoiceTemplate(data.invoiceTemplate || "classic");
|
|
13017
|
+
const logo = data.invoiceLogoUrl || data.companyLogo || data.logo || "";
|
|
13018
|
+
setCompanyLogo((prev) => logo || prev);
|
|
13019
|
+
setCompanyName(data.companyName || data.invoiceCompanyName || data.name || "");
|
|
13020
|
+
setCompanyEmail(data.companyEmail || data.invoiceEmail || data.email || "");
|
|
13021
|
+
setCompanyPhone(data.companyPhone || data.invoicePhone || data.phone || "");
|
|
13022
|
+
setCompanyAddress(data.companyAddress || data.invoiceAddress || data.address || "");
|
|
13023
|
+
if (logo) {
|
|
13024
|
+
setNavbarConfig((prev) => ({
|
|
13025
|
+
...prev,
|
|
13026
|
+
logo: prev.logo || logo
|
|
13027
|
+
}));
|
|
13028
|
+
}
|
|
12657
13029
|
}).finally(() => setStoreSettingsLoading(false));
|
|
12658
13030
|
fetch("/api/settings/multi_vendor").then((r) => r.ok ? r.json() : {}).then((data) => {
|
|
12659
13031
|
setMultiVendorEnabled(data.enabled !== "false");
|
|
@@ -12758,6 +13130,27 @@ function SettingsPage() {
|
|
|
12758
13130
|
}
|
|
12759
13131
|
})
|
|
12760
13132
|
});
|
|
13133
|
+
await fetch("/api/settings/store", {
|
|
13134
|
+
method: "PUT",
|
|
13135
|
+
headers: {
|
|
13136
|
+
"Content-Type": "application/json"
|
|
13137
|
+
},
|
|
13138
|
+
body: JSON.stringify({
|
|
13139
|
+
invoiceLogoUrl: {
|
|
13140
|
+
value: navbarConfig.logo || "",
|
|
13141
|
+
type: "public"
|
|
13142
|
+
},
|
|
13143
|
+
companyLogo: {
|
|
13144
|
+
value: navbarConfig.logo || "",
|
|
13145
|
+
type: "public"
|
|
13146
|
+
},
|
|
13147
|
+
logo: {
|
|
13148
|
+
value: navbarConfig.logo || "",
|
|
13149
|
+
type: "public"
|
|
13150
|
+
}
|
|
13151
|
+
})
|
|
13152
|
+
}).catch(() => {
|
|
13153
|
+
});
|
|
12761
13154
|
toast.success("Navbar saved");
|
|
12762
13155
|
} catch {
|
|
12763
13156
|
toast.error("Failed to save");
|
|
@@ -12781,9 +13174,58 @@ function SettingsPage() {
|
|
|
12781
13174
|
currency: {
|
|
12782
13175
|
value: currency,
|
|
12783
13176
|
type: "public"
|
|
13177
|
+
},
|
|
13178
|
+
invoiceTemplate: {
|
|
13179
|
+
value: invoiceTemplate || "classic",
|
|
13180
|
+
type: "public"
|
|
13181
|
+
},
|
|
13182
|
+
invoiceLogoUrl: {
|
|
13183
|
+
value: companyLogo,
|
|
13184
|
+
type: "public"
|
|
13185
|
+
},
|
|
13186
|
+
companyLogo: {
|
|
13187
|
+
value: companyLogo,
|
|
13188
|
+
type: "public"
|
|
13189
|
+
},
|
|
13190
|
+
logo: {
|
|
13191
|
+
value: companyLogo,
|
|
13192
|
+
type: "public"
|
|
13193
|
+
},
|
|
13194
|
+
companyName: {
|
|
13195
|
+
value: companyName,
|
|
13196
|
+
type: "public"
|
|
13197
|
+
},
|
|
13198
|
+
companyEmail: {
|
|
13199
|
+
value: companyEmail,
|
|
13200
|
+
type: "public"
|
|
13201
|
+
},
|
|
13202
|
+
companyPhone: {
|
|
13203
|
+
value: companyPhone,
|
|
13204
|
+
type: "public"
|
|
13205
|
+
},
|
|
13206
|
+
companyAddress: {
|
|
13207
|
+
value: companyAddress,
|
|
13208
|
+
type: "public"
|
|
12784
13209
|
}
|
|
12785
13210
|
})
|
|
12786
13211
|
});
|
|
13212
|
+
const updatedNav = {
|
|
13213
|
+
...navbarConfig,
|
|
13214
|
+
logo: companyLogo
|
|
13215
|
+
};
|
|
13216
|
+
await fetch("/api/settings/theme", {
|
|
13217
|
+
method: "PUT",
|
|
13218
|
+
headers: {
|
|
13219
|
+
"Content-Type": "application/json"
|
|
13220
|
+
},
|
|
13221
|
+
body: JSON.stringify({
|
|
13222
|
+
navbar: {
|
|
13223
|
+
value: JSON.stringify(updatedNav),
|
|
13224
|
+
type: "public"
|
|
13225
|
+
}
|
|
13226
|
+
})
|
|
13227
|
+
}).catch(() => {
|
|
13228
|
+
});
|
|
12787
13229
|
await fetch("/api/settings/multi_vendor", {
|
|
12788
13230
|
method: "PUT",
|
|
12789
13231
|
headers: {
|
|
@@ -13066,7 +13508,7 @@ function SettingsPage() {
|
|
|
13066
13508
|
className: "text-sm text-gray-500 mb-4"
|
|
13067
13509
|
}, "Set logo and menu items."), /* @__PURE__ */ React.createElement(NavbarEditor, {
|
|
13068
13510
|
config: navbarConfig,
|
|
13069
|
-
onChange:
|
|
13511
|
+
onChange: handleNavbarConfigChange
|
|
13070
13512
|
})), /* @__PURE__ */ React.createElement(Button, {
|
|
13071
13513
|
onClick: handleSaveNavbar,
|
|
13072
13514
|
disabled: saving
|
|
@@ -13152,7 +13594,80 @@ function SettingsPage() {
|
|
|
13152
13594
|
className: "text-sm font-medium text-gray-700"
|
|
13153
13595
|
}, "Require event approval"), /* @__PURE__ */ React.createElement("p", {
|
|
13154
13596
|
className: "text-xs text-gray-500 mt-0.5"
|
|
13155
|
-
}, "When on, new vendor events start as pending. Admins approve or reject; approval activates the event (live)."))) : null), /* @__PURE__ */ React.createElement("div",
|
|
13597
|
+
}, "When on, new vendor events start as pending. Admins approve or reject; approval activates the event (live)."))) : null), /* @__PURE__ */ React.createElement("div", {
|
|
13598
|
+
className: "space-y-4 p-4 bg-gray-50 rounded-lg border border-gray-200"
|
|
13599
|
+
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h3", {
|
|
13600
|
+
className: "text-base font-semibold text-gray-900"
|
|
13601
|
+
}, "Invoice Header & Store Details"), /* @__PURE__ */ React.createElement("p", {
|
|
13602
|
+
className: "text-xs text-gray-500 mt-0.5"
|
|
13603
|
+
}, "Configure company logo, name, email, phone, and address displayed on generated invoice headers.")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(ImageOrUrlField, {
|
|
13604
|
+
label: "Company Logo",
|
|
13605
|
+
value: companyLogo,
|
|
13606
|
+
onChange: handleStoreLogoChange,
|
|
13607
|
+
previewVariant: "logo",
|
|
13608
|
+
placeholder: "Logo image URL or upload image"
|
|
13609
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
13610
|
+
className: "grid grid-cols-1 sm:grid-cols-2 gap-4"
|
|
13611
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
13612
|
+
className: "space-y-1.5"
|
|
13613
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
13614
|
+
className: "text-xs font-medium text-gray-700"
|
|
13615
|
+
}, "Company Name"), /* @__PURE__ */ React.createElement(Input, {
|
|
13616
|
+
value: companyName,
|
|
13617
|
+
onChange: /* @__PURE__ */ __name((e) => setCompanyName(e.target.value), "onChange"),
|
|
13618
|
+
placeholder: "e.g. Acme Corp",
|
|
13619
|
+
className: "h-9 text-sm bg-white"
|
|
13620
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
13621
|
+
className: "space-y-1.5"
|
|
13622
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
13623
|
+
className: "text-xs font-medium text-gray-700"
|
|
13624
|
+
}, "Company Email"), /* @__PURE__ */ React.createElement(Input, {
|
|
13625
|
+
type: "email",
|
|
13626
|
+
value: companyEmail,
|
|
13627
|
+
onChange: /* @__PURE__ */ __name((e) => setCompanyEmail(e.target.value), "onChange"),
|
|
13628
|
+
placeholder: "e.g. support@acme.com",
|
|
13629
|
+
className: "h-9 text-sm bg-white"
|
|
13630
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
13631
|
+
className: "space-y-1.5"
|
|
13632
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
13633
|
+
className: "text-xs font-medium text-gray-700"
|
|
13634
|
+
}, "Company Phone"), /* @__PURE__ */ React.createElement(Input, {
|
|
13635
|
+
type: "tel",
|
|
13636
|
+
value: companyPhone,
|
|
13637
|
+
onChange: /* @__PURE__ */ __name((e) => setCompanyPhone(e.target.value), "onChange"),
|
|
13638
|
+
placeholder: "e.g. +1 555-0199",
|
|
13639
|
+
className: "h-9 text-sm bg-white"
|
|
13640
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
13641
|
+
className: "space-y-1.5 sm:col-span-2"
|
|
13642
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
13643
|
+
className: "text-xs font-medium text-gray-700"
|
|
13644
|
+
}, "Company Address"), /* @__PURE__ */ React.createElement(Textarea, {
|
|
13645
|
+
value: companyAddress,
|
|
13646
|
+
onChange: /* @__PURE__ */ __name((e) => setCompanyAddress(e.target.value), "onChange"),
|
|
13647
|
+
placeholder: "e.g. 123 Business Rd, Suite 100\nNew York, NY 10001",
|
|
13648
|
+
rows: 3,
|
|
13649
|
+
className: "text-sm bg-white"
|
|
13650
|
+
})))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
13651
|
+
className: "block text-sm font-semibold text-gray-700 mb-1"
|
|
13652
|
+
}, "Invoice PDF template"), /* @__PURE__ */ React.createElement("p", {
|
|
13653
|
+
className: "text-xs text-gray-500 mb-3"
|
|
13654
|
+
}, "Used when generating invoices in the app (and as fallback when ERP invoice is unavailable). Company logo, name, email, phone, and address set above are shown in the invoice header."), /* @__PURE__ */ React.createElement("div", {
|
|
13655
|
+
className: "grid gap-3 sm:grid-cols-2"
|
|
13656
|
+
}, INVOICE_TEMPLATE_CARDS.map((opt) => {
|
|
13657
|
+
const selected = invoiceTemplate === opt.id;
|
|
13658
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
13659
|
+
key: opt.id,
|
|
13660
|
+
type: "button",
|
|
13661
|
+
onClick: /* @__PURE__ */ __name(() => setInvoiceTemplate(opt.id), "onClick"),
|
|
13662
|
+
className: `text-left rounded-lg border p-3 transition ${selected ? "border-blue-500 bg-blue-50 ring-1 ring-blue-500" : "border-gray-200 bg-white hover:border-gray-300"}`
|
|
13663
|
+
}, /* @__PURE__ */ React.createElement(InvoiceTemplatePreview, {
|
|
13664
|
+
id: opt.id
|
|
13665
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
13666
|
+
className: "text-sm font-semibold text-gray-800 mt-2"
|
|
13667
|
+
}, opt.label), /* @__PURE__ */ React.createElement("div", {
|
|
13668
|
+
className: "text-xs text-gray-500 mt-0.5"
|
|
13669
|
+
}, opt.description));
|
|
13670
|
+
}))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", {
|
|
13156
13671
|
className: "flex items-center justify-between mb-1"
|
|
13157
13672
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
13158
13673
|
className: "block text-sm font-semibold text-gray-700"
|
|
@@ -13340,7 +13855,7 @@ function SettingsPage() {
|
|
|
13340
13855
|
className: "h-4 w-4 mr-2"
|
|
13341
13856
|
}), saving ? "Saving..." : "Save")));
|
|
13342
13857
|
}
|
|
13343
|
-
var DEFAULT_CURRENCY, DEFAULTS;
|
|
13858
|
+
var DEFAULT_CURRENCY, DEFAULTS, INVOICE_TEMPLATE_CARDS;
|
|
13344
13859
|
var init_SettingsPage = __esm({
|
|
13345
13860
|
"src/admin/pages/SettingsPage.tsx"() {
|
|
13346
13861
|
"use client";
|
|
@@ -13349,6 +13864,8 @@ var init_SettingsPage = __esm({
|
|
|
13349
13864
|
init_switch();
|
|
13350
13865
|
init_label();
|
|
13351
13866
|
init_admin_config_context();
|
|
13867
|
+
init_textarea();
|
|
13868
|
+
init_ImageOrUrlField();
|
|
13352
13869
|
init_NavbarEditor();
|
|
13353
13870
|
DEFAULT_CURRENCY = "INR";
|
|
13354
13871
|
DEFAULTS = {
|
|
@@ -13356,6 +13873,29 @@ var init_SettingsPage = __esm({
|
|
|
13356
13873
|
secondaryColor: "#6366f1",
|
|
13357
13874
|
compactView: "false"
|
|
13358
13875
|
};
|
|
13876
|
+
INVOICE_TEMPLATE_CARDS = [
|
|
13877
|
+
{
|
|
13878
|
+
id: "classic",
|
|
13879
|
+
label: "Classic",
|
|
13880
|
+
description: "Traditional invoice with lined items and totals footer."
|
|
13881
|
+
},
|
|
13882
|
+
{
|
|
13883
|
+
id: "modern",
|
|
13884
|
+
label: "Modern",
|
|
13885
|
+
description: "Clean layout with accent header and open spacing."
|
|
13886
|
+
},
|
|
13887
|
+
{
|
|
13888
|
+
id: "compact",
|
|
13889
|
+
label: "Compact",
|
|
13890
|
+
description: "Dense layout suited to longer item lists."
|
|
13891
|
+
},
|
|
13892
|
+
{
|
|
13893
|
+
id: "bold",
|
|
13894
|
+
label: "Bold",
|
|
13895
|
+
description: "Strong header band and clear payment summary."
|
|
13896
|
+
}
|
|
13897
|
+
];
|
|
13898
|
+
__name(InvoiceTemplatePreview, "InvoiceTemplatePreview");
|
|
13359
13899
|
__name(hexToHsl, "hexToHsl");
|
|
13360
13900
|
__name(genId, "genId");
|
|
13361
13901
|
__name(SettingsPage, "SettingsPage");
|
|
@@ -20050,26 +20590,6 @@ var init_VendorRolesPage = __esm({
|
|
|
20050
20590
|
__name(VendorRolesPage, "VendorRolesPage");
|
|
20051
20591
|
}
|
|
20052
20592
|
});
|
|
20053
|
-
function DetailPageLayout({ main, sidebar }) {
|
|
20054
|
-
if (sidebar == null) {
|
|
20055
|
-
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
20056
|
-
className: "min-w-0 w-full p-4 sm:p-6 space-y-6"
|
|
20057
|
-
}, main);
|
|
20058
|
-
}
|
|
20059
|
-
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
20060
|
-
className: "min-w-0 w-full p-4 sm:p-6 grid grid-cols-1 xl:grid-cols-3 gap-4 sm:gap-6"
|
|
20061
|
-
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
20062
|
-
className: "min-w-0 w-full xl:col-span-2 space-y-6"
|
|
20063
|
-
}, main), /* @__PURE__ */ React26__default.createElement("div", {
|
|
20064
|
-
className: "min-w-0 w-full xl:col-span-1 space-y-6"
|
|
20065
|
-
}, sidebar));
|
|
20066
|
-
}
|
|
20067
|
-
var init_DetailPageLayout = __esm({
|
|
20068
|
-
"src/components/Admin/DetailPageLayout.tsx"() {
|
|
20069
|
-
"use client";
|
|
20070
|
-
__name(DetailPageLayout, "DetailPageLayout");
|
|
20071
|
-
}
|
|
20072
|
-
});
|
|
20073
20593
|
|
|
20074
20594
|
// src/lib/vendor-profile.ts
|
|
20075
20595
|
function validateIndiaTaxIds(gstin, pan) {
|
|
@@ -20151,25 +20671,45 @@ function labelForRegistrationStatus(value) {
|
|
|
20151
20671
|
if (!value) return "\u2014";
|
|
20152
20672
|
return VENDOR_REGISTRATION_STATUSES.find((s) => s.value === value)?.label ?? value;
|
|
20153
20673
|
}
|
|
20154
|
-
function
|
|
20674
|
+
function display(value) {
|
|
20675
|
+
const s = value?.trim();
|
|
20676
|
+
return s ? s : "\u2014";
|
|
20677
|
+
}
|
|
20678
|
+
function ReadOnlyInput({ id, label, value, className }) {
|
|
20155
20679
|
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
20156
|
-
className
|
|
20157
|
-
}, /* @__PURE__ */ React26__default.createElement(
|
|
20158
|
-
|
|
20159
|
-
}, label), /* @__PURE__ */ React26__default.createElement(
|
|
20160
|
-
|
|
20161
|
-
|
|
20680
|
+
className
|
|
20681
|
+
}, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
20682
|
+
htmlFor: id
|
|
20683
|
+
}, label), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
20684
|
+
id,
|
|
20685
|
+
value,
|
|
20686
|
+
readOnly: true,
|
|
20687
|
+
disabled: true,
|
|
20688
|
+
className: "mt-1.5 bg-gray-50"
|
|
20689
|
+
}));
|
|
20162
20690
|
}
|
|
20163
20691
|
function VendorPortalProfilePage() {
|
|
20164
20692
|
const router = useRouter();
|
|
20693
|
+
const searchParams = useSearchParams();
|
|
20694
|
+
const tabParam = searchParams.get("tab");
|
|
20165
20695
|
const { data: session, status } = useSession();
|
|
20166
20696
|
const sessionUser = session?.user;
|
|
20697
|
+
const [tab, setTab] = useState(tabParam === "password" ? "password" : "profile");
|
|
20167
20698
|
const [loading, setLoading] = useState(true);
|
|
20168
20699
|
const [error, setError] = useState(null);
|
|
20169
20700
|
const [vendor, setVendor] = useState(null);
|
|
20170
20701
|
const [owner, setOwner] = useState(null);
|
|
20171
|
-
const
|
|
20702
|
+
const [currentPassword, setCurrentPassword] = useState("");
|
|
20703
|
+
const [newPassword, setNewPassword] = useState("");
|
|
20704
|
+
const [confirmPassword, setConfirmPassword] = useState("");
|
|
20705
|
+
const [savingPassword, setSavingPassword] = useState(false);
|
|
20172
20706
|
const sessionUserId = sessionUser?.id != null ? Number(sessionUser.id) : null;
|
|
20707
|
+
useEffect(() => {
|
|
20708
|
+
if (tabParam === "password") setTab("password");
|
|
20709
|
+
else if (tabParam === "profile") setTab("profile");
|
|
20710
|
+
}, [
|
|
20711
|
+
tabParam
|
|
20712
|
+
]);
|
|
20173
20713
|
useEffect(() => {
|
|
20174
20714
|
if (status === "unauthenticated") {
|
|
20175
20715
|
router.replace("/admin/signin");
|
|
@@ -20180,16 +20720,15 @@ function VendorPortalProfilePage() {
|
|
|
20180
20720
|
router.replace("/admin/access-denied");
|
|
20181
20721
|
return;
|
|
20182
20722
|
}
|
|
20183
|
-
if (vendorId == null) {
|
|
20184
|
-
setError("No vendor is linked to your account.");
|
|
20185
|
-
setLoading(false);
|
|
20186
|
-
return;
|
|
20187
|
-
}
|
|
20188
20723
|
let cancelled = false;
|
|
20189
20724
|
(async () => {
|
|
20725
|
+
setLoading(true);
|
|
20190
20726
|
try {
|
|
20191
|
-
const res = await fetch(
|
|
20192
|
-
if (!res.ok)
|
|
20727
|
+
const res = await fetch("/api/admin/vendor/profile");
|
|
20728
|
+
if (!res.ok) {
|
|
20729
|
+
const errBody = await res.json().catch(() => ({}));
|
|
20730
|
+
throw new Error(errBody.error || "Failed to load vendor profile");
|
|
20731
|
+
}
|
|
20193
20732
|
const data = await res.json();
|
|
20194
20733
|
if (cancelled) return;
|
|
20195
20734
|
setVendor(data);
|
|
@@ -20230,9 +20769,13 @@ function VendorPortalProfilePage() {
|
|
|
20230
20769
|
email: data.email ?? null,
|
|
20231
20770
|
phone: data.phone ?? null
|
|
20232
20771
|
});
|
|
20772
|
+
setError(null);
|
|
20773
|
+
}
|
|
20774
|
+
} catch (e) {
|
|
20775
|
+
if (!cancelled) {
|
|
20776
|
+
setVendor(null);
|
|
20777
|
+
setError(e instanceof Error ? e.message : "Failed to load vendor profile.");
|
|
20233
20778
|
}
|
|
20234
|
-
} catch {
|
|
20235
|
-
if (!cancelled) setError("Failed to load vendor profile.");
|
|
20236
20779
|
} finally {
|
|
20237
20780
|
if (!cancelled) setLoading(false);
|
|
20238
20781
|
}
|
|
@@ -20244,158 +20787,293 @@ function VendorPortalProfilePage() {
|
|
|
20244
20787
|
status,
|
|
20245
20788
|
sessionUser,
|
|
20246
20789
|
router,
|
|
20247
|
-
|
|
20790
|
+
sessionUserId,
|
|
20791
|
+
session?.user?.name,
|
|
20792
|
+
session?.user?.email
|
|
20248
20793
|
]);
|
|
20249
|
-
|
|
20794
|
+
const handleChangePassword = /* @__PURE__ */ __name(async (e) => {
|
|
20795
|
+
e.preventDefault();
|
|
20796
|
+
if (newPassword !== confirmPassword) {
|
|
20797
|
+
toast.error("New password and confirmation do not match");
|
|
20798
|
+
return;
|
|
20799
|
+
}
|
|
20800
|
+
if (newPassword.length < 6) {
|
|
20801
|
+
toast.error("New password must be at least 6 characters");
|
|
20802
|
+
return;
|
|
20803
|
+
}
|
|
20804
|
+
setSavingPassword(true);
|
|
20805
|
+
try {
|
|
20806
|
+
const res = await fetch("/api/users/reset-password", {
|
|
20807
|
+
method: "POST",
|
|
20808
|
+
headers: {
|
|
20809
|
+
"Content-Type": "application/json"
|
|
20810
|
+
},
|
|
20811
|
+
body: JSON.stringify({
|
|
20812
|
+
currentPassword,
|
|
20813
|
+
newPassword
|
|
20814
|
+
})
|
|
20815
|
+
});
|
|
20816
|
+
const data = await res.json().catch(() => ({}));
|
|
20817
|
+
if (!res.ok) {
|
|
20818
|
+
toast.error(data.error || "Could not update password");
|
|
20819
|
+
return;
|
|
20820
|
+
}
|
|
20821
|
+
toast.success("Password updated");
|
|
20822
|
+
setCurrentPassword("");
|
|
20823
|
+
setNewPassword("");
|
|
20824
|
+
setConfirmPassword("");
|
|
20825
|
+
} catch {
|
|
20826
|
+
toast.error("Network error");
|
|
20827
|
+
} finally {
|
|
20828
|
+
setSavingPassword(false);
|
|
20829
|
+
}
|
|
20830
|
+
}, "handleChangePassword");
|
|
20831
|
+
const tabs = [
|
|
20832
|
+
{
|
|
20833
|
+
id: "profile",
|
|
20834
|
+
label: "Profile"
|
|
20835
|
+
},
|
|
20836
|
+
{
|
|
20837
|
+
id: "password",
|
|
20838
|
+
label: "Password"
|
|
20839
|
+
}
|
|
20840
|
+
];
|
|
20841
|
+
if (status === "unauthenticated") {
|
|
20842
|
+
return null;
|
|
20843
|
+
}
|
|
20844
|
+
if (status === "loading" || status === "authenticated" && loading) {
|
|
20250
20845
|
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
20251
|
-
className: "flex justify-center py-
|
|
20252
|
-
}, "
|
|
20846
|
+
className: "flex justify-center py-8"
|
|
20847
|
+
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
20848
|
+
className: "h-6 w-6 animate-spin rounded-full border-2 border-gray-300 border-t-gray-600"
|
|
20849
|
+
}), /* @__PURE__ */ React26__default.createElement("span", {
|
|
20850
|
+
className: "ml-2 text-gray-600"
|
|
20851
|
+
}, "Loading..."));
|
|
20253
20852
|
}
|
|
20254
20853
|
if (error || !vendor) {
|
|
20255
20854
|
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
20256
|
-
className: "
|
|
20855
|
+
className: "min-w-0 rounded-lg bg-white shadow-md"
|
|
20856
|
+
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
20857
|
+
className: "rounded-t-lg border-b border-gray-700 bg-gray-800 px-4 py-2.5"
|
|
20858
|
+
}, /* @__PURE__ */ React26__default.createElement("h1", {
|
|
20859
|
+
className: "text-base font-semibold text-white"
|
|
20860
|
+
}, "Profile"), /* @__PURE__ */ React26__default.createElement("p", {
|
|
20861
|
+
className: "mt-0.5 text-xs text-gray-300"
|
|
20862
|
+
}, "Your vendor details, and password")), /* @__PURE__ */ React26__default.createElement("div", {
|
|
20863
|
+
className: "p-6"
|
|
20257
20864
|
}, /* @__PURE__ */ React26__default.createElement("p", {
|
|
20258
20865
|
className: "text-sm text-red-600"
|
|
20259
|
-
}, error ?? "Vendor profile not available."));
|
|
20866
|
+
}, error ?? "Vendor profile not available.")));
|
|
20260
20867
|
}
|
|
20261
20868
|
const ownerDesignation = readOwnerDesignation(vendor.metadata);
|
|
20262
|
-
return /* @__PURE__ */ React26__default.createElement(
|
|
20263
|
-
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
|
|
20267
|
-
|
|
20268
|
-
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
|
|
20283
|
-
|
|
20284
|
-
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
|
|
20301
|
-
|
|
20302
|
-
|
|
20303
|
-
|
|
20304
|
-
|
|
20305
|
-
|
|
20306
|
-
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
|
|
20333
|
-
|
|
20334
|
-
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
|
|
20351
|
-
|
|
20352
|
-
|
|
20353
|
-
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20869
|
+
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
20870
|
+
className: "min-w-0 rounded-lg bg-white shadow-md"
|
|
20871
|
+
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
20872
|
+
className: "rounded-t-lg border-b border-gray-700 bg-gray-800 px-4 py-2.5"
|
|
20873
|
+
}, /* @__PURE__ */ React26__default.createElement("h1", {
|
|
20874
|
+
className: "text-base font-semibold text-white"
|
|
20875
|
+
}, "Profile"), /* @__PURE__ */ React26__default.createElement("p", {
|
|
20876
|
+
className: "mt-0.5 text-xs text-gray-300"
|
|
20877
|
+
}, "Your vendor details, and password")), /* @__PURE__ */ React26__default.createElement("div", {
|
|
20878
|
+
className: "flex border-b"
|
|
20879
|
+
}, tabs.map((t) => /* @__PURE__ */ React26__default.createElement("button", {
|
|
20880
|
+
key: t.id,
|
|
20881
|
+
type: "button",
|
|
20882
|
+
className: `border-b-2 px-4 py-2.5 text-sm font-medium ${tab === t.id ? "border-gray-800 bg-white text-gray-800" : "border-transparent text-gray-500 hover:text-gray-700"}`,
|
|
20883
|
+
onClick: /* @__PURE__ */ __name(() => setTab(t.id), "onClick")
|
|
20884
|
+
}, t.label))), /* @__PURE__ */ React26__default.createElement("div", {
|
|
20885
|
+
className: "min-w-0 p-6"
|
|
20886
|
+
}, tab === "profile" && /* @__PURE__ */ React26__default.createElement("div", {
|
|
20887
|
+
className: "space-y-8"
|
|
20888
|
+
}, /* @__PURE__ */ React26__default.createElement("section", {
|
|
20889
|
+
className: "space-y-4"
|
|
20890
|
+
}, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
20891
|
+
className: "text-sm font-semibold text-gray-900"
|
|
20892
|
+
}, "Store"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
20893
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
20894
|
+
}, /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20895
|
+
id: "v-name",
|
|
20896
|
+
label: "Store name",
|
|
20897
|
+
value: display(vendor.name)
|
|
20898
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20899
|
+
id: "v-legal",
|
|
20900
|
+
label: "Legal name",
|
|
20901
|
+
value: display(vendor.legalName)
|
|
20902
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20903
|
+
id: "v-slug",
|
|
20904
|
+
label: "Slug",
|
|
20905
|
+
value: display(vendor.slug)
|
|
20906
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20907
|
+
id: "v-biz",
|
|
20908
|
+
label: "Business type",
|
|
20909
|
+
value: labelForBusinessType(vendor.businessType)
|
|
20910
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20911
|
+
id: "v-reg",
|
|
20912
|
+
label: "Registration status",
|
|
20913
|
+
value: labelForRegistrationStatus(vendor.registrationStatus)
|
|
20914
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20915
|
+
id: "v-active",
|
|
20916
|
+
label: "Active",
|
|
20917
|
+
value: vendor.active ? "Yes" : "No"
|
|
20918
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20919
|
+
id: "v-invite",
|
|
20920
|
+
label: "Invite status",
|
|
20921
|
+
value: display(vendor.inviteStatus)
|
|
20922
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20923
|
+
id: "v-created",
|
|
20924
|
+
label: "Created",
|
|
20925
|
+
value: vendor.createdAt ? new Date(vendor.createdAt).toLocaleString() : "\u2014"
|
|
20926
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20927
|
+
id: "v-desc",
|
|
20928
|
+
label: "Description",
|
|
20929
|
+
value: display(vendor.description),
|
|
20930
|
+
className: "md:col-span-2"
|
|
20931
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20932
|
+
id: "v-web",
|
|
20933
|
+
label: "Website",
|
|
20934
|
+
value: display(vendor.website),
|
|
20935
|
+
className: "md:col-span-2"
|
|
20936
|
+
}))), /* @__PURE__ */ React26__default.createElement("section", {
|
|
20937
|
+
className: "space-y-4"
|
|
20938
|
+
}, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
20939
|
+
className: "text-sm font-semibold text-gray-900"
|
|
20940
|
+
}, "Contact"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
20941
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
20942
|
+
}, /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20943
|
+
id: "v-email",
|
|
20944
|
+
label: "Email",
|
|
20945
|
+
value: display(vendor.email)
|
|
20946
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20947
|
+
id: "v-phone",
|
|
20948
|
+
label: "Phone",
|
|
20949
|
+
value: display(vendor.phone)
|
|
20950
|
+
}))), /* @__PURE__ */ React26__default.createElement("section", {
|
|
20951
|
+
className: "space-y-4"
|
|
20952
|
+
}, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
20953
|
+
className: "text-sm font-semibold text-gray-900"
|
|
20954
|
+
}, "Address"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
20955
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
20956
|
+
}, /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20957
|
+
id: "v-a1",
|
|
20958
|
+
label: "Address line 1",
|
|
20959
|
+
value: display(vendor.addressLine1)
|
|
20960
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20961
|
+
id: "v-a2",
|
|
20962
|
+
label: "Address line 2",
|
|
20963
|
+
value: display(vendor.addressLine2)
|
|
20964
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20965
|
+
id: "v-city",
|
|
20966
|
+
label: "City",
|
|
20967
|
+
value: display(vendor.city)
|
|
20968
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20969
|
+
id: "v-state",
|
|
20970
|
+
label: "State",
|
|
20971
|
+
value: display(vendor.state)
|
|
20972
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20973
|
+
id: "v-country",
|
|
20974
|
+
label: "Country",
|
|
20975
|
+
value: display(vendor.country)
|
|
20976
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20977
|
+
id: "v-postal",
|
|
20978
|
+
label: "Postal code",
|
|
20979
|
+
value: display(vendor.postalCode)
|
|
20980
|
+
}))), /* @__PURE__ */ React26__default.createElement("section", {
|
|
20981
|
+
className: "space-y-4"
|
|
20982
|
+
}, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
20983
|
+
className: "text-sm font-semibold text-gray-900"
|
|
20984
|
+
}, "Tax & compliance"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
20985
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
20986
|
+
}, /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20987
|
+
id: "v-gstin",
|
|
20988
|
+
label: "GSTIN",
|
|
20989
|
+
value: display(vendor.gstin)
|
|
20990
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
20991
|
+
id: "v-pan",
|
|
20992
|
+
label: "PAN",
|
|
20993
|
+
value: display(vendor.pan)
|
|
20994
|
+
}))), /* @__PURE__ */ React26__default.createElement("section", {
|
|
20995
|
+
className: "space-y-4"
|
|
20996
|
+
}, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
20997
|
+
className: "text-sm font-semibold text-gray-900"
|
|
20998
|
+
}, "Owner"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
20999
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
21000
|
+
}, /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
21001
|
+
id: "o-name",
|
|
21002
|
+
label: "Name",
|
|
21003
|
+
value: display(owner?.name)
|
|
21004
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
21005
|
+
id: "o-email",
|
|
21006
|
+
label: "Email",
|
|
21007
|
+
value: display(owner?.email)
|
|
21008
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
21009
|
+
id: "o-phone",
|
|
21010
|
+
label: "Phone",
|
|
21011
|
+
value: display(owner?.phone)
|
|
21012
|
+
}), /* @__PURE__ */ React26__default.createElement(ReadOnlyInput, {
|
|
21013
|
+
id: "o-desig",
|
|
21014
|
+
label: "Designation",
|
|
21015
|
+
value: display(ownerDesignation || void 0)
|
|
21016
|
+
})), vendor.logo ? /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(Label3, null, "Logo"), /* @__PURE__ */ React26__default.createElement("img", {
|
|
21017
|
+
src: vendor.logo,
|
|
21018
|
+
alt: "Vendor logo",
|
|
21019
|
+
className: "mt-1.5 max-h-24 rounded border border-gray-200 bg-white object-contain"
|
|
21020
|
+
})) : null)), tab === "password" && /* @__PURE__ */ React26__default.createElement("div", {
|
|
21021
|
+
className: "space-y-6"
|
|
21022
|
+
}, /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
21023
|
+
className: "mb-2 text-lg font-semibold text-gray-900"
|
|
21024
|
+
}, "Change password"), /* @__PURE__ */ React26__default.createElement("form", {
|
|
21025
|
+
onSubmit: handleChangePassword,
|
|
21026
|
+
className: "max-w-md space-y-4"
|
|
21027
|
+
}, /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
21028
|
+
htmlFor: "current-password",
|
|
21029
|
+
className: "text-sm text-gray-700"
|
|
21030
|
+
}, "Current password"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
21031
|
+
id: "current-password",
|
|
21032
|
+
type: "password",
|
|
21033
|
+
value: currentPassword,
|
|
21034
|
+
onChange: /* @__PURE__ */ __name((e) => setCurrentPassword(e.target.value), "onChange"),
|
|
21035
|
+
className: "mt-1.5",
|
|
21036
|
+
autoComplete: "current-password"
|
|
21037
|
+
})), /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
21038
|
+
htmlFor: "new-password",
|
|
21039
|
+
className: "text-sm text-gray-700"
|
|
21040
|
+
}, "New password"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
21041
|
+
id: "new-password",
|
|
21042
|
+
type: "password",
|
|
21043
|
+
value: newPassword,
|
|
21044
|
+
onChange: /* @__PURE__ */ __name((e) => setNewPassword(e.target.value), "onChange"),
|
|
21045
|
+
className: "mt-1.5",
|
|
21046
|
+
autoComplete: "new-password"
|
|
21047
|
+
})), /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(Label3, {
|
|
21048
|
+
htmlFor: "confirm-password",
|
|
21049
|
+
className: "text-sm text-gray-700"
|
|
21050
|
+
}, "Confirm new password"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
21051
|
+
id: "confirm-password",
|
|
21052
|
+
type: "password",
|
|
21053
|
+
value: confirmPassword,
|
|
21054
|
+
onChange: /* @__PURE__ */ __name((e) => setConfirmPassword(e.target.value), "onChange"),
|
|
21055
|
+
className: "mt-1.5",
|
|
21056
|
+
autoComplete: "new-password"
|
|
21057
|
+
})), /* @__PURE__ */ React26__default.createElement(Button, {
|
|
21058
|
+
type: "submit",
|
|
21059
|
+
variant: "secondary",
|
|
21060
|
+
disabled: savingPassword
|
|
21061
|
+
}, /* @__PURE__ */ React26__default.createElement(KeyRound, {
|
|
21062
|
+
className: "mr-2 h-4 w-4"
|
|
21063
|
+
}), savingPassword ? "Updating..." : "Update password"))))));
|
|
20387
21064
|
}
|
|
20388
|
-
var sectionCls;
|
|
20389
21065
|
var init_VendorPortalProfilePage = __esm({
|
|
20390
21066
|
"src/admin/pages/VendorPortalProfilePage.tsx"() {
|
|
20391
21067
|
"use client";
|
|
20392
21068
|
init_vendor_scope();
|
|
20393
|
-
|
|
21069
|
+
init_button();
|
|
21070
|
+
init_input();
|
|
21071
|
+
init_label();
|
|
20394
21072
|
init_vendor_profile();
|
|
20395
|
-
sectionCls = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50 space-y-3";
|
|
20396
21073
|
__name(labelForBusinessType, "labelForBusinessType");
|
|
20397
21074
|
__name(labelForRegistrationStatus, "labelForRegistrationStatus");
|
|
20398
|
-
__name(
|
|
21075
|
+
__name(display, "display");
|
|
21076
|
+
__name(ReadOnlyInput, "ReadOnlyInput");
|
|
20399
21077
|
__name(VendorPortalProfilePage, "VendorPortalProfilePage");
|
|
20400
21078
|
}
|
|
20401
21079
|
});
|
|
@@ -20632,6 +21310,26 @@ var init_SubmissionDetailPage = __esm({
|
|
|
20632
21310
|
__name(SubmissionDetailPage, "SubmissionDetailPage");
|
|
20633
21311
|
}
|
|
20634
21312
|
});
|
|
21313
|
+
function DetailPageLayout({ main, sidebar }) {
|
|
21314
|
+
if (sidebar == null) {
|
|
21315
|
+
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
21316
|
+
className: "min-w-0 w-full p-4 sm:p-6 space-y-6"
|
|
21317
|
+
}, main);
|
|
21318
|
+
}
|
|
21319
|
+
return /* @__PURE__ */ React26__default.createElement("div", {
|
|
21320
|
+
className: "min-w-0 w-full p-4 sm:p-6 grid grid-cols-1 xl:grid-cols-3 gap-4 sm:gap-6"
|
|
21321
|
+
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
21322
|
+
className: "min-w-0 w-full xl:col-span-2 space-y-6"
|
|
21323
|
+
}, main), /* @__PURE__ */ React26__default.createElement("div", {
|
|
21324
|
+
className: "min-w-0 w-full xl:col-span-1 space-y-6"
|
|
21325
|
+
}, sidebar));
|
|
21326
|
+
}
|
|
21327
|
+
var init_DetailPageLayout = __esm({
|
|
21328
|
+
"src/components/Admin/DetailPageLayout.tsx"() {
|
|
21329
|
+
"use client";
|
|
21330
|
+
__name(DetailPageLayout, "DetailPageLayout");
|
|
21331
|
+
}
|
|
21332
|
+
});
|
|
20635
21333
|
|
|
20636
21334
|
// src/admin/pages/OrderDetailPage.tsx
|
|
20637
21335
|
var OrderDetailPage_exports = {};
|
|
@@ -22578,20 +23276,7 @@ function OrderPlacementPage({ editOrderId }) {
|
|
|
22578
23276
|
} catch {
|
|
22579
23277
|
}
|
|
22580
23278
|
}
|
|
22581
|
-
|
|
22582
|
-
if (placeForSomeoneElse) {
|
|
22583
|
-
if (contactEmail) {
|
|
22584
|
-
try {
|
|
22585
|
-
const res2 = await fetch(`/api/contacts?search=${encodeURIComponent(contactEmail)}&limit=5`);
|
|
22586
|
-
if (res2.ok) {
|
|
22587
|
-
const data = await res2.json();
|
|
22588
|
-
const match = data.data?.find((c) => c.email?.toLowerCase() === contactEmail.toLowerCase());
|
|
22589
|
-
if (match) orderContactId = match.id;
|
|
22590
|
-
}
|
|
22591
|
-
} catch {
|
|
22592
|
-
}
|
|
22593
|
-
}
|
|
22594
|
-
}
|
|
23279
|
+
const orderContactId = resolvedContactId;
|
|
22595
23280
|
const payload = {
|
|
22596
23281
|
status,
|
|
22597
23282
|
currency,
|
|
@@ -22613,6 +23298,9 @@ function OrderPlacementPage({ editOrderId }) {
|
|
|
22613
23298
|
};
|
|
22614
23299
|
if (orderContactId != null) payload.contactId = orderContactId;
|
|
22615
23300
|
if (!placeForSomeoneElse && contactId != null) payload.customerId = contactId;
|
|
23301
|
+
if (placeForSomeoneElse && selectedCustomerId != null) {
|
|
23302
|
+
payload.accountCustomerId = selectedCustomerId;
|
|
23303
|
+
}
|
|
22616
23304
|
if (coupons.length > 0) payload.discountId = coupons[0].discountId;
|
|
22617
23305
|
const url = editOrderId ? `/api/orders/${editOrderId}` : "/api/orders";
|
|
22618
23306
|
const method = editOrderId ? "PUT" : "POST";
|
|
@@ -27118,7 +27806,7 @@ function ProductVariantsSection({ hasVariants, onHasVariantsChange, variantOptio
|
|
|
27118
27806
|
}), "This product has variants")), !hasVariants ? /* @__PURE__ */ React.createElement("p", {
|
|
27119
27807
|
className: "text-xs text-gray-500"
|
|
27120
27808
|
}, "Enable variants for products with options like size, color, or material.") : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
27121
|
-
className:
|
|
27809
|
+
className: sectionCls
|
|
27122
27810
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
27123
27811
|
className: "mb-3"
|
|
27124
27812
|
}, /* @__PURE__ */ React.createElement("p", {
|
|
@@ -27188,7 +27876,7 @@ function ProductVariantsSection({ hasVariants, onHasVariantsChange, variantOptio
|
|
|
27188
27876
|
disabled: !parsedOptions.length,
|
|
27189
27877
|
className: "inline-flex items-center gap-1 rounded border border-gray-800 bg-gray-900 px-3 py-1.5 text-xs font-medium text-white hover:bg-gray-800 disabled:opacity-50"
|
|
27190
27878
|
}, "Generate variants")))), /* @__PURE__ */ React.createElement("div", {
|
|
27191
|
-
className:
|
|
27879
|
+
className: sectionCls
|
|
27192
27880
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
27193
27881
|
className: "mb-3 flex flex-wrap items-center justify-between gap-2"
|
|
27194
27882
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("p", {
|
|
@@ -27340,7 +28028,7 @@ function ProductVariantsSection({ hasVariants, onHasVariantsChange, variantOptio
|
|
|
27340
28028
|
className: "h-4 w-4"
|
|
27341
28029
|
})))))))))));
|
|
27342
28030
|
}
|
|
27343
|
-
var labelCls2, inputCls2,
|
|
28031
|
+
var labelCls2, inputCls2, sectionCls;
|
|
27344
28032
|
var init_ProductVariantsSection = __esm({
|
|
27345
28033
|
"src/admin/pages/ProductVariantsSection.tsx"() {
|
|
27346
28034
|
"use client";
|
|
@@ -27348,7 +28036,7 @@ var init_ProductVariantsSection = __esm({
|
|
|
27348
28036
|
init_ImageOrUrlField();
|
|
27349
28037
|
labelCls2 = "block text-xs font-medium text-gray-600 mb-1";
|
|
27350
28038
|
inputCls2 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm";
|
|
27351
|
-
|
|
28039
|
+
sectionCls = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
27352
28040
|
__name(emptyVariantOptionRow, "emptyVariantOptionRow");
|
|
27353
28041
|
__name(emptyVariantFormRow, "emptyVariantFormRow");
|
|
27354
28042
|
__name(variantOptionsFromForm, "variantOptionsFromForm");
|
|
@@ -28520,7 +29208,7 @@ function ProductEditPage({ productId }) {
|
|
|
28520
29208
|
}, "Step 1 \u2014 Product")), /* @__PURE__ */ React.createElement("h2", {
|
|
28521
29209
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
28522
29210
|
}, "Product details"), /* @__PURE__ */ React.createElement("div", {
|
|
28523
|
-
className: `${
|
|
29211
|
+
className: `${sectionCls2} space-y-4`
|
|
28524
29212
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
28525
29213
|
className: labelCls3
|
|
28526
29214
|
}, "Name *"), /* @__PURE__ */ React.createElement("input", {
|
|
@@ -28746,7 +29434,7 @@ function ProductEditPage({ productId }) {
|
|
|
28746
29434
|
}, "Taxes & Policy"), /* @__PURE__ */ React.createElement("p", {
|
|
28747
29435
|
className: "text-xs text-gray-500 mb-2"
|
|
28748
29436
|
}, "Link taxes for this product. Leave rate empty to use the tax's default rate; set a value to override. Select a refund policy to apply to all taxes."), /* @__PURE__ */ React.createElement("div", {
|
|
28749
|
-
className: `${
|
|
29437
|
+
className: `${sectionCls2} space-y-4`
|
|
28750
29438
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
28751
29439
|
className: labelCls3
|
|
28752
29440
|
}, "Refund / Return Policy"), /* @__PURE__ */ React.createElement("select", {
|
|
@@ -28824,7 +29512,7 @@ function ProductEditPage({ productId }) {
|
|
|
28824
29512
|
}, "Attributes (facets)"), /* @__PURE__ */ React.createElement("p", {
|
|
28825
29513
|
className: "text-xs text-gray-500 mb-2"
|
|
28826
29514
|
}, "Search existing attributes or create new ones (like blog categories). Value on the right."), /* @__PURE__ */ React.createElement("div", {
|
|
28827
|
-
className: `${
|
|
29515
|
+
className: `${sectionCls2} space-y-2`
|
|
28828
29516
|
}, facetRows.map((row, i) => /* @__PURE__ */ React.createElement("div", {
|
|
28829
29517
|
key: i,
|
|
28830
29518
|
className: "flex gap-2 items-start"
|
|
@@ -28853,7 +29541,7 @@ function ProductEditPage({ productId }) {
|
|
|
28853
29541
|
}), " Add attribute"))), /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
28854
29542
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
28855
29543
|
}, "Media"), /* @__PURE__ */ React.createElement("div", {
|
|
28856
|
-
className: `${
|
|
29544
|
+
className: `${sectionCls2} space-y-3`
|
|
28857
29545
|
}, images.map((row, i) => /* @__PURE__ */ React.createElement("div", {
|
|
28858
29546
|
key: i,
|
|
28859
29547
|
className: "flex flex-wrap items-start gap-2 p-2 bg-white rounded border border-gray-200"
|
|
@@ -28895,7 +29583,7 @@ function ProductEditPage({ productId }) {
|
|
|
28895
29583
|
}), " Add image"))), /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
28896
29584
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
28897
29585
|
}, "Specifications"), /* @__PURE__ */ React.createElement("div", {
|
|
28898
|
-
className: `${
|
|
29586
|
+
className: `${sectionCls2} space-y-2`
|
|
28899
29587
|
}, specifications.map((row, i) => /* @__PURE__ */ React.createElement("div", {
|
|
28900
29588
|
key: i,
|
|
28901
29589
|
className: "flex gap-2"
|
|
@@ -28926,7 +29614,7 @@ function ProductEditPage({ productId }) {
|
|
|
28926
29614
|
}), " Add row"))), /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
28927
29615
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
28928
29616
|
}, "SEO"), /* @__PURE__ */ React.createElement("div", {
|
|
28929
|
-
className:
|
|
29617
|
+
className: sectionCls2
|
|
28930
29618
|
}, /* @__PURE__ */ React.createElement(SeoSection, {
|
|
28931
29619
|
values: seo,
|
|
28932
29620
|
onChange: /* @__PURE__ */ __name((field, value) => setSeo((s) => ({
|
|
@@ -28936,7 +29624,7 @@ function ProductEditPage({ productId }) {
|
|
|
28936
29624
|
}))))
|
|
28937
29625
|
}));
|
|
28938
29626
|
}
|
|
28939
|
-
var isCreate2,
|
|
29627
|
+
var isCreate2, sectionCls2, labelCls3, inputCls3, DEFAULT_PRICING_CONFIG;
|
|
28940
29628
|
var init_ProductEditPage = __esm({
|
|
28941
29629
|
"src/admin/pages/ProductEditPage.tsx"() {
|
|
28942
29630
|
"use client";
|
|
@@ -28960,7 +29648,7 @@ var init_ProductEditPage = __esm({
|
|
|
28960
29648
|
init_product_variants();
|
|
28961
29649
|
__name(parseCategoryIdFromReturnUrl, "parseCategoryIdFromReturnUrl");
|
|
28962
29650
|
isCreate2 = /* @__PURE__ */ __name((id) => id === "create", "isCreate");
|
|
28963
|
-
|
|
29651
|
+
sectionCls2 = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
28964
29652
|
labelCls3 = "block text-xs font-medium text-gray-600 mb-1";
|
|
28965
29653
|
inputCls3 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm";
|
|
28966
29654
|
__name(buildProductMetadata, "buildProductMetadata");
|
|
@@ -29385,7 +30073,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29385
30073
|
main: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
29386
30074
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
29387
30075
|
}, "Basic info"), /* @__PURE__ */ React.createElement("div", {
|
|
29388
|
-
className: `${
|
|
30076
|
+
className: `${sectionCls3} space-y-4`
|
|
29389
30077
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
29390
30078
|
className: labelCls4
|
|
29391
30079
|
}, "Name *"), /* @__PURE__ */ React.createElement("input", {
|
|
@@ -29471,7 +30159,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29471
30159
|
}), "Advanced page content"), advancedOpen && /* @__PURE__ */ React.createElement("div", {
|
|
29472
30160
|
className: "space-y-4"
|
|
29473
30161
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
29474
|
-
className:
|
|
30162
|
+
className: sectionCls3
|
|
29475
30163
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
29476
30164
|
className: "text-xs font-medium text-gray-700 mb-2"
|
|
29477
30165
|
}, "Hero carousel"), heroSlides.map((slide, i) => /* @__PURE__ */ React.createElement("div", {
|
|
@@ -29517,7 +30205,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29517
30205
|
}, /* @__PURE__ */ React.createElement(Plus, {
|
|
29518
30206
|
className: "h-3.5 w-3.5"
|
|
29519
30207
|
}), " Add slide")), /* @__PURE__ */ React.createElement("div", {
|
|
29520
|
-
className:
|
|
30208
|
+
className: sectionCls3
|
|
29521
30209
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
29522
30210
|
className: "text-xs font-medium text-gray-700 mb-2"
|
|
29523
30211
|
}, "Variants"), variants.map((v, i) => /* @__PURE__ */ React.createElement("div", {
|
|
@@ -29577,7 +30265,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29577
30265
|
}, /* @__PURE__ */ React.createElement(Plus, {
|
|
29578
30266
|
className: "h-3.5 w-3.5"
|
|
29579
30267
|
}), " Add variant")), /* @__PURE__ */ React.createElement("div", {
|
|
29580
|
-
className:
|
|
30268
|
+
className: sectionCls3
|
|
29581
30269
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
29582
30270
|
className: labelCls4
|
|
29583
30271
|
}, "Experience description"), /* @__PURE__ */ React.createElement("textarea", {
|
|
@@ -29587,7 +30275,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29587
30275
|
rows: 2,
|
|
29588
30276
|
placeholder: "Optional"
|
|
29589
30277
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
29590
|
-
className:
|
|
30278
|
+
className: sectionCls3
|
|
29591
30279
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
29592
30280
|
className: labelCls4
|
|
29593
30281
|
}, "Brochure URL"), /* @__PURE__ */ React.createElement("input", {
|
|
@@ -29600,7 +30288,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29600
30288
|
sidebar: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
29601
30289
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
29602
30290
|
}, "Status"), /* @__PURE__ */ React.createElement("div", {
|
|
29603
|
-
className:
|
|
30291
|
+
className: sectionCls3
|
|
29604
30292
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
29605
30293
|
className: "flex items-center gap-2 cursor-pointer"
|
|
29606
30294
|
}, /* @__PURE__ */ React.createElement("input", {
|
|
@@ -29613,7 +30301,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29613
30301
|
}, "Active")))), /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
29614
30302
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
29615
30303
|
}, "SEO"), /* @__PURE__ */ React.createElement("div", {
|
|
29616
|
-
className:
|
|
30304
|
+
className: sectionCls3
|
|
29617
30305
|
}, /* @__PURE__ */ React.createElement(SeoSection, {
|
|
29618
30306
|
values: seo,
|
|
29619
30307
|
onChange: /* @__PURE__ */ __name((field, value) => setSeo((s) => ({
|
|
@@ -29623,7 +30311,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29623
30311
|
}))))
|
|
29624
30312
|
}));
|
|
29625
30313
|
}
|
|
29626
|
-
var isCreate3, emptySlide, emptyVariant,
|
|
30314
|
+
var isCreate3, emptySlide, emptyVariant, sectionCls3, labelCls4, inputCls4;
|
|
29627
30315
|
var init_CollectionEditPage = __esm({
|
|
29628
30316
|
"src/admin/pages/CollectionEditPage.tsx"() {
|
|
29629
30317
|
"use client";
|
|
@@ -29646,7 +30334,7 @@ var init_CollectionEditPage = __esm({
|
|
|
29646
30334
|
price: "",
|
|
29647
30335
|
extraSpecs: []
|
|
29648
30336
|
}), "emptyVariant");
|
|
29649
|
-
|
|
30337
|
+
sectionCls3 = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
29650
30338
|
labelCls4 = "block text-xs font-medium text-gray-600 mb-1";
|
|
29651
30339
|
inputCls4 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm";
|
|
29652
30340
|
__name(CollectionEditPage, "CollectionEditPage");
|
|
@@ -31128,7 +31816,7 @@ function EventEditPage({ eventId }) {
|
|
|
31128
31816
|
onClick: /* @__PURE__ */ __name(() => setActiveTab("settings"), "onClick")
|
|
31129
31817
|
}, "Settings"))), /* @__PURE__ */ React.createElement(DetailPageLayout, {
|
|
31130
31818
|
main: activeTab === "basic" ? /* @__PURE__ */ React.createElement("section", {
|
|
31131
|
-
className:
|
|
31819
|
+
className: sectionCls4
|
|
31132
31820
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
31133
31821
|
className: "grid gap-3 sm:grid-cols-2"
|
|
31134
31822
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -31261,7 +31949,7 @@ function EventEditPage({ eventId }) {
|
|
|
31261
31949
|
}, "Online"), /* @__PURE__ */ React.createElement("option", {
|
|
31262
31950
|
value: "hybrid"
|
|
31263
31951
|
}, "Hybrid"))))) : activeTab === "venue" ? /* @__PURE__ */ React.createElement("section", {
|
|
31264
|
-
className:
|
|
31952
|
+
className: sectionCls4
|
|
31265
31953
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
31266
31954
|
className: "grid gap-3 sm:grid-cols-2"
|
|
31267
31955
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -31301,7 +31989,7 @@ function EventEditPage({ eventId }) {
|
|
|
31301
31989
|
onChange: /* @__PURE__ */ __name((e) => setCountry(e.target.value), "onChange"),
|
|
31302
31990
|
className: inputCls6
|
|
31303
31991
|
})))) : activeTab === "datetime" ? /* @__PURE__ */ React.createElement("section", {
|
|
31304
|
-
className:
|
|
31992
|
+
className: sectionCls4
|
|
31305
31993
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
31306
31994
|
className: "grid gap-3 sm:grid-cols-2"
|
|
31307
31995
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -31339,7 +32027,7 @@ function EventEditPage({ eventId }) {
|
|
|
31339
32027
|
onChange: /* @__PURE__ */ __name((e) => setRegistrationClosesAt(e.target.value), "onChange"),
|
|
31340
32028
|
className: inputCls6
|
|
31341
32029
|
})))) : /* @__PURE__ */ React.createElement("section", {
|
|
31342
|
-
className:
|
|
32030
|
+
className: sectionCls4
|
|
31343
32031
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
31344
32032
|
className: "space-y-6"
|
|
31345
32033
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", {
|
|
@@ -31434,7 +32122,7 @@ function EventEditPage({ eventId }) {
|
|
|
31434
32122
|
returnUrl: eventEditUrl
|
|
31435
32123
|
})) : null);
|
|
31436
32124
|
}
|
|
31437
|
-
var ADDITIONAL_VENUE_MAX_CHARS, DEFAULT_EVENT_TIMEZONE, DEFAULT_EVENT_CURRENCY, EVENT_SOCIAL_KEYS, isCreate4,
|
|
32125
|
+
var ADDITIONAL_VENUE_MAX_CHARS, DEFAULT_EVENT_TIMEZONE, DEFAULT_EVENT_CURRENCY, EVENT_SOCIAL_KEYS, isCreate4, sectionCls4, labelCls6, inputCls6, ENTITY_TYPE_OPTIONS;
|
|
31438
32126
|
var init_EventEditPage = __esm({
|
|
31439
32127
|
"src/admin/pages/EventEditPage.tsx"() {
|
|
31440
32128
|
"use client";
|
|
@@ -31459,7 +32147,7 @@ var init_EventEditPage = __esm({
|
|
|
31459
32147
|
DEFAULT_EVENT_CURRENCY = "INR";
|
|
31460
32148
|
EVENT_SOCIAL_KEYS = EVENT_SOCIAL_FIELDS.map((f) => f.key);
|
|
31461
32149
|
isCreate4 = /* @__PURE__ */ __name((id) => id === "create", "isCreate");
|
|
31462
|
-
|
|
32150
|
+
sectionCls4 = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
31463
32151
|
labelCls6 = "block text-xs font-medium text-gray-600 mb-1";
|
|
31464
32152
|
inputCls6 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm";
|
|
31465
32153
|
__name(RequiredLabel, "RequiredLabel");
|
|
@@ -31533,6 +32221,7 @@ function ComboEditPage({ comboId }) {
|
|
|
31533
32221
|
const [saving, setSaving] = useState(false);
|
|
31534
32222
|
const [errors, setErrors] = useState([]);
|
|
31535
32223
|
const [name, setName] = useState("");
|
|
32224
|
+
const [slug, setSlug] = useState("");
|
|
31536
32225
|
const [desc, setDesc] = useState("");
|
|
31537
32226
|
const [eventId, setEventId] = useState("");
|
|
31538
32227
|
const [priceStr, setPriceStr] = useState("");
|
|
@@ -31672,6 +32361,7 @@ function ComboEditPage({ comboId }) {
|
|
|
31672
32361
|
const data = await res.json();
|
|
31673
32362
|
if (cancelled) return;
|
|
31674
32363
|
setName(data.name ?? "");
|
|
32364
|
+
setSlug(typeof data.slug === "string" ? data.slug : "");
|
|
31675
32365
|
setDesc(data.desc ?? "");
|
|
31676
32366
|
setEventId(data.eventId != null ? String(data.eventId) : "");
|
|
31677
32367
|
if (data.eventId != null) {
|
|
@@ -31712,6 +32402,7 @@ function ComboEditPage({ comboId }) {
|
|
|
31712
32402
|
if (create && duplicateSourceId) {
|
|
31713
32403
|
const rawName = (data.name ?? "").trim() || "Combo";
|
|
31714
32404
|
setName(rawName.toLowerCase().startsWith("copy of ") ? `${rawName} (copy)` : `Copy of ${rawName}`);
|
|
32405
|
+
setSlug("");
|
|
31715
32406
|
}
|
|
31716
32407
|
} catch {
|
|
31717
32408
|
if (!cancelled) setErrors([
|
|
@@ -31797,15 +32488,15 @@ function ComboEditPage({ comboId }) {
|
|
|
31797
32488
|
]);
|
|
31798
32489
|
return;
|
|
31799
32490
|
}
|
|
31800
|
-
if (addonItems.length
|
|
32491
|
+
if (addonItems.length < minSelectableItems) {
|
|
31801
32492
|
setErrors([
|
|
31802
|
-
`Please add at least ${minSelectableItems} add-on item(s). Currently ${addonItems.length} selected.`
|
|
32493
|
+
`Please add at least ${minSelectableItems} add-on item(s) so customers can meet the minimum. Currently ${addonItems.length} selected.`
|
|
31803
32494
|
]);
|
|
31804
32495
|
return;
|
|
31805
32496
|
}
|
|
31806
|
-
if (addonItems.length
|
|
32497
|
+
if (maxSelectableItems > addonItems.length) {
|
|
31807
32498
|
setErrors([
|
|
31808
|
-
`
|
|
32499
|
+
`Max add-on items (${maxSelectableItems}) cannot be greater than the number of add-on items selected (${addonItems.length}).`
|
|
31809
32500
|
]);
|
|
31810
32501
|
return;
|
|
31811
32502
|
}
|
|
@@ -31825,6 +32516,7 @@ function ComboEditPage({ comboId }) {
|
|
|
31825
32516
|
const resolvedEventId = trimmedEventId && /^\d+$/.test(trimmedEventId) ? Number(trimmedEventId) : null;
|
|
31826
32517
|
const payload = {
|
|
31827
32518
|
name: trimmedName,
|
|
32519
|
+
slug: slug.trim() || void 0,
|
|
31828
32520
|
desc: desc || null,
|
|
31829
32521
|
eventId: resolvedEventId,
|
|
31830
32522
|
price,
|
|
@@ -31916,6 +32608,14 @@ function ComboEditPage({ comboId }) {
|
|
|
31916
32608
|
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm"
|
|
31917
32609
|
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
31918
32610
|
className: "block text-xs font-medium text-gray-600 mb-1"
|
|
32611
|
+
}, "Slug"), /* @__PURE__ */ React.createElement("input", {
|
|
32612
|
+
type: "text",
|
|
32613
|
+
value: slug,
|
|
32614
|
+
onChange: /* @__PURE__ */ __name((e) => setSlug(e.target.value), "onChange"),
|
|
32615
|
+
placeholder: "Auto generate from name",
|
|
32616
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm"
|
|
32617
|
+
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
32618
|
+
className: "block text-xs font-medium text-gray-600 mb-1"
|
|
31919
32619
|
}, "Description"), /* @__PURE__ */ React.createElement("textarea", {
|
|
31920
32620
|
value: desc,
|
|
31921
32621
|
onChange: /* @__PURE__ */ __name((e) => setDesc(e.target.value), "onChange"),
|
|
@@ -32029,7 +32729,7 @@ function ComboEditPage({ comboId }) {
|
|
|
32029
32729
|
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm"
|
|
32030
32730
|
}))), /* @__PURE__ */ React.createElement("p", {
|
|
32031
32731
|
className: "text-xs text-gray-400 mt-1"
|
|
32032
|
-
}, "Customers
|
|
32732
|
+
}, "List all available add-ons above. Customers choose between ", minSelectableItems, " and", " ", maxSelectableItems, " of those items (max cannot exceed the add-on list size)."))), /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
32033
32733
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32034
32734
|
}, "Availability"), /* @__PURE__ */ React.createElement("div", {
|
|
32035
32735
|
className: "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50 space-y-4"
|
|
@@ -32163,6 +32863,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32163
32863
|
const [ownerEmail, setOwnerEmail] = useState("");
|
|
32164
32864
|
const [ownerPhone, setOwnerPhone] = useState("");
|
|
32165
32865
|
const [ownerDesignation, setOwnerDesignation] = useState("");
|
|
32866
|
+
const [ownerUserId, setOwnerUserId] = useState(null);
|
|
32166
32867
|
const [termsAccepted, setTermsAccepted] = useState(false);
|
|
32167
32868
|
const [reinviting, setReinviting] = useState(false);
|
|
32168
32869
|
const [inviteDialog, setInviteDialog] = useState(null);
|
|
@@ -32222,6 +32923,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32222
32923
|
setOwnerDesignation(readOwnerDesignation(data.metadata));
|
|
32223
32924
|
const userId = data.userId;
|
|
32224
32925
|
if (userId != null && Number.isFinite(Number(userId))) {
|
|
32926
|
+
setOwnerUserId(Number(userId));
|
|
32225
32927
|
const userRes = await fetch(`/api/users/${userId}`);
|
|
32226
32928
|
if (userRes.ok) {
|
|
32227
32929
|
const user = await userRes.json();
|
|
@@ -32231,6 +32933,8 @@ function VendorEditPage({ vendorId }) {
|
|
|
32231
32933
|
setOwnerPhone(user.phone ?? "");
|
|
32232
32934
|
}
|
|
32233
32935
|
}
|
|
32936
|
+
} else if (!cancelled) {
|
|
32937
|
+
setOwnerUserId(null);
|
|
32234
32938
|
}
|
|
32235
32939
|
} catch {
|
|
32236
32940
|
if (!cancelled) setErrors([
|
|
@@ -32445,6 +33149,13 @@ function VendorEditPage({ vendorId }) {
|
|
|
32445
33149
|
setSaving(false);
|
|
32446
33150
|
return;
|
|
32447
33151
|
}
|
|
33152
|
+
if (!ownerName.trim() || !ownerEmail.trim()) {
|
|
33153
|
+
setErrors([
|
|
33154
|
+
"Owner name and owner email are required"
|
|
33155
|
+
]);
|
|
33156
|
+
setSaving(false);
|
|
33157
|
+
return;
|
|
33158
|
+
}
|
|
32448
33159
|
const taxError = validateIndiaTaxIds(gstin.trim().toUpperCase() || null, pan.trim().toUpperCase() || null);
|
|
32449
33160
|
if (taxError) {
|
|
32450
33161
|
setErrors([
|
|
@@ -32480,6 +33191,26 @@ function VendorEditPage({ vendorId }) {
|
|
|
32480
33191
|
]);
|
|
32481
33192
|
return;
|
|
32482
33193
|
}
|
|
33194
|
+
if (ownerUserId != null) {
|
|
33195
|
+
const userRes = await fetch(`/api/users/${ownerUserId}`, {
|
|
33196
|
+
method: "PUT",
|
|
33197
|
+
headers: {
|
|
33198
|
+
"Content-Type": "application/json"
|
|
33199
|
+
},
|
|
33200
|
+
body: JSON.stringify({
|
|
33201
|
+
name: ownerName.trim(),
|
|
33202
|
+
email: ownerEmail.trim(),
|
|
33203
|
+
phone: ownerPhone.trim() || null
|
|
33204
|
+
})
|
|
33205
|
+
});
|
|
33206
|
+
if (!userRes.ok) {
|
|
33207
|
+
const data = await userRes.json().catch(() => ({}));
|
|
33208
|
+
setErrors([
|
|
33209
|
+
data.error || "Vendor saved, but updating owner details failed"
|
|
33210
|
+
]);
|
|
33211
|
+
return;
|
|
33212
|
+
}
|
|
33213
|
+
}
|
|
32483
33214
|
toast.success("Vendor saved");
|
|
32484
33215
|
router.push(listReturnUrl);
|
|
32485
33216
|
} catch {
|
|
@@ -32501,7 +33232,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32501
33232
|
className: "rounded-lg bg-white shadow-md min-h-[420px]"
|
|
32502
33233
|
}, /* @__PURE__ */ React26__default.createElement(DetailPageHeader, {
|
|
32503
33234
|
title: create ? "Add vendor" : "Edit vendor",
|
|
32504
|
-
subtitle: create ? "Register a vendor store and create the owner invite" : "Update store and registration details",
|
|
33235
|
+
subtitle: create ? "Register a vendor store and create the owner invite" : "Update store, owner, and registration details",
|
|
32505
33236
|
closeHref: listReturnUrl,
|
|
32506
33237
|
menuItems: create ? [
|
|
32507
33238
|
{
|
|
@@ -32527,7 +33258,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32527
33258
|
main: /* @__PURE__ */ React26__default.createElement(React26__default.Fragment, null, /* @__PURE__ */ React26__default.createElement("section", null, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
32528
33259
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32529
33260
|
}, "Business"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
32530
|
-
className:
|
|
33261
|
+
className: sectionCls5
|
|
32531
33262
|
}, /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(FieldLabel, {
|
|
32532
33263
|
htmlFor: "vendorName",
|
|
32533
33264
|
required: true
|
|
@@ -32592,7 +33323,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32592
33323
|
})))), /* @__PURE__ */ React26__default.createElement("section", null, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
32593
33324
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32594
33325
|
}, "Contact"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
32595
|
-
className:
|
|
33326
|
+
className: sectionCls5
|
|
32596
33327
|
}, /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(FieldLabel, {
|
|
32597
33328
|
htmlFor: "vendorEmail"
|
|
32598
33329
|
}, "Store email"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
@@ -32611,7 +33342,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32611
33342
|
})))), /* @__PURE__ */ React26__default.createElement("section", null, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
32612
33343
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32613
33344
|
}, "Address"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
32614
|
-
className:
|
|
33345
|
+
className: sectionCls5
|
|
32615
33346
|
}, /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(FieldLabel, {
|
|
32616
33347
|
htmlFor: "addressLine1"
|
|
32617
33348
|
}, "Address line 1"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
@@ -32662,7 +33393,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32662
33393
|
}))))), /* @__PURE__ */ React26__default.createElement("section", null, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
32663
33394
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32664
33395
|
}, "Tax (India)"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
32665
|
-
className:
|
|
33396
|
+
className: sectionCls5
|
|
32666
33397
|
}, /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(FieldLabel, {
|
|
32667
33398
|
htmlFor: "gstin"
|
|
32668
33399
|
}, "GSTIN"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
@@ -32682,36 +33413,33 @@ function VendorEditPage({ vendorId }) {
|
|
|
32682
33413
|
})))), /* @__PURE__ */ React26__default.createElement("section", null, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
32683
33414
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32684
33415
|
}, "Owner"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
32685
|
-
className:
|
|
33416
|
+
className: sectionCls5
|
|
32686
33417
|
}, /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(FieldLabel, {
|
|
32687
33418
|
htmlFor: "ownerName",
|
|
32688
|
-
required:
|
|
33419
|
+
required: true
|
|
32689
33420
|
}, "Name"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
32690
33421
|
id: "ownerName",
|
|
32691
|
-
required:
|
|
32692
|
-
readOnly: !create,
|
|
33422
|
+
required: true,
|
|
32693
33423
|
value: ownerName,
|
|
32694
33424
|
onChange: /* @__PURE__ */ __name((e) => setOwnerName(e.target.value), "onChange"),
|
|
32695
|
-
className: `mt-1 ${fieldClass}
|
|
33425
|
+
className: `mt-1 ${fieldClass}`
|
|
32696
33426
|
})), /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(FieldLabel, {
|
|
32697
33427
|
htmlFor: "ownerEmail",
|
|
32698
|
-
required:
|
|
33428
|
+
required: true
|
|
32699
33429
|
}, "Email"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
32700
33430
|
id: "ownerEmail",
|
|
32701
33431
|
type: "email",
|
|
32702
|
-
required:
|
|
32703
|
-
readOnly: !create,
|
|
33432
|
+
required: true,
|
|
32704
33433
|
value: ownerEmail,
|
|
32705
33434
|
onChange: /* @__PURE__ */ __name((e) => setOwnerEmail(e.target.value), "onChange"),
|
|
32706
|
-
className: `mt-1 ${fieldClass}
|
|
33435
|
+
className: `mt-1 ${fieldClass}`
|
|
32707
33436
|
})), /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(FieldLabel, {
|
|
32708
33437
|
htmlFor: "ownerPhone"
|
|
32709
33438
|
}, "Phone"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
32710
33439
|
id: "ownerPhone",
|
|
32711
33440
|
value: ownerPhone,
|
|
32712
33441
|
onChange: /* @__PURE__ */ __name((e) => setOwnerPhone(e.target.value), "onChange"),
|
|
32713
|
-
|
|
32714
|
-
className: `mt-1 ${fieldClass} ${!create ? "bg-gray-100" : ""}`
|
|
33442
|
+
className: `mt-1 ${fieldClass}`
|
|
32715
33443
|
})), /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(FieldLabel, {
|
|
32716
33444
|
htmlFor: "ownerDesignation"
|
|
32717
33445
|
}, "Designation"), /* @__PURE__ */ React26__default.createElement(Input, {
|
|
@@ -32720,10 +33448,10 @@ function VendorEditPage({ vendorId }) {
|
|
|
32720
33448
|
onChange: /* @__PURE__ */ __name((e) => setOwnerDesignation(e.target.value), "onChange"),
|
|
32721
33449
|
placeholder: "e.g. Director, Proprietor",
|
|
32722
33450
|
className: `mt-1 ${fieldClass}`
|
|
32723
|
-
})), !create && /* @__PURE__ */ React26__default.createElement("p", {
|
|
32724
|
-
className: "text-xs text-
|
|
32725
|
-
}, "
|
|
32726
|
-
className:
|
|
33451
|
+
})), !create && !ownerUserId && /* @__PURE__ */ React26__default.createElement("p", {
|
|
33452
|
+
className: "text-xs text-amber-700"
|
|
33453
|
+
}, "No owner user is linked to this vendor, so owner name/email/phone cannot be saved yet."))), create && /* @__PURE__ */ React26__default.createElement("section", null, /* @__PURE__ */ React26__default.createElement("div", {
|
|
33454
|
+
className: sectionCls5
|
|
32727
33455
|
}, /* @__PURE__ */ React26__default.createElement("div", {
|
|
32728
33456
|
className: "flex items-start gap-2"
|
|
32729
33457
|
}, /* @__PURE__ */ React26__default.createElement(Checkbox, {
|
|
@@ -32737,7 +33465,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32737
33465
|
sidebar: /* @__PURE__ */ React26__default.createElement(React26__default.Fragment, null, !create && /* @__PURE__ */ React26__default.createElement("section", null, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
32738
33466
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32739
33467
|
}, "Status"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
32740
|
-
className:
|
|
33468
|
+
className: sectionCls5
|
|
32741
33469
|
}, /* @__PURE__ */ React26__default.createElement("div", null, /* @__PURE__ */ React26__default.createElement(FieldLabel, {
|
|
32742
33470
|
htmlFor: "registrationStatus"
|
|
32743
33471
|
}, "Registration status"), /* @__PURE__ */ React26__default.createElement("select", {
|
|
@@ -32772,7 +33500,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32772
33500
|
})))), create ? /* @__PURE__ */ React26__default.createElement("section", null, /* @__PURE__ */ React26__default.createElement("h2", {
|
|
32773
33501
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32774
33502
|
}, "Owner access"), /* @__PURE__ */ React26__default.createElement("div", {
|
|
32775
|
-
className:
|
|
33503
|
+
className: sectionCls5
|
|
32776
33504
|
}, /* @__PURE__ */ React26__default.createElement("p", {
|
|
32777
33505
|
className: "text-sm text-gray-600"
|
|
32778
33506
|
}, "Creates the vendor and an invite for the owner. After create, you can send the invite email or copy the invite link."), /* @__PURE__ */ React26__default.createElement(Button, {
|
|
@@ -32810,7 +33538,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32810
33538
|
onClick: closeInviteDialog
|
|
32811
33539
|
}, "Done")))));
|
|
32812
33540
|
}
|
|
32813
|
-
var isCreate6, fieldClass, selectClass,
|
|
33541
|
+
var isCreate6, fieldClass, selectClass, sectionCls5;
|
|
32814
33542
|
var init_VendorEditPage = __esm({
|
|
32815
33543
|
"src/admin/pages/VendorEditPage.tsx"() {
|
|
32816
33544
|
"use client";
|
|
@@ -32832,7 +33560,7 @@ var init_VendorEditPage = __esm({
|
|
|
32832
33560
|
isCreate6 = /* @__PURE__ */ __name((id) => id === "create", "isCreate");
|
|
32833
33561
|
fieldClass = "w-full rounded-md border border-gray-300 px-3 py-2 text-sm";
|
|
32834
33562
|
selectClass = `${fieldClass} bg-white`;
|
|
32835
|
-
|
|
33563
|
+
sectionCls5 = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50 space-y-4";
|
|
32836
33564
|
__name(ErrorsBanner, "ErrorsBanner");
|
|
32837
33565
|
__name(FieldLabel, "FieldLabel");
|
|
32838
33566
|
__name(VendorEditPage, "VendorEditPage");
|
|
@@ -33131,11 +33859,6 @@ function CollectionsWorkspacePage() {
|
|
|
33131
33859
|
showVendorColumn,
|
|
33132
33860
|
vendorOptions
|
|
33133
33861
|
]);
|
|
33134
|
-
const listParams = useMemo(() => isCatalog ? {
|
|
33135
|
-
isCatalog: "true"
|
|
33136
|
-
} : void 0, [
|
|
33137
|
-
isCatalog
|
|
33138
|
-
]);
|
|
33139
33862
|
const createQueryParams = useMemo(() => isCatalog ? {
|
|
33140
33863
|
isCatalog: "true"
|
|
33141
33864
|
} : void 0, [
|
|
@@ -33151,7 +33874,6 @@ function CollectionsWorkspacePage() {
|
|
|
33151
33874
|
createQueryParams,
|
|
33152
33875
|
defaultSortField: "sortOrder",
|
|
33153
33876
|
defaultSortOrder: "asc",
|
|
33154
|
-
extraListParams: listParams,
|
|
33155
33877
|
filters: collectionFilters
|
|
33156
33878
|
});
|
|
33157
33879
|
}
|
|
@@ -33506,6 +34228,7 @@ var init_DiscountDetailsPage = __esm({
|
|
|
33506
34228
|
category: "Category",
|
|
33507
34229
|
cart: "Cart",
|
|
33508
34230
|
paymentMethod: "Payment method",
|
|
34231
|
+
deviceType: "Device type",
|
|
33509
34232
|
order: "Order",
|
|
33510
34233
|
quantity: "Quantity",
|
|
33511
34234
|
time: "Time",
|
|
@@ -33597,6 +34320,15 @@ function conditionToRule(c) {
|
|
|
33597
34320
|
v: c.paymentMethod ?? ""
|
|
33598
34321
|
}
|
|
33599
34322
|
};
|
|
34323
|
+
case "deviceType":
|
|
34324
|
+
return {
|
|
34325
|
+
...base,
|
|
34326
|
+
type: "deviceType",
|
|
34327
|
+
comparisonOperator: "eq",
|
|
34328
|
+
value: {
|
|
34329
|
+
v: c.deviceType ?? ""
|
|
34330
|
+
}
|
|
34331
|
+
};
|
|
33600
34332
|
case "category":
|
|
33601
34333
|
return {
|
|
33602
34334
|
...base,
|
|
@@ -33769,6 +34501,12 @@ function ruleTreeToFriendly(rules) {
|
|
|
33769
34501
|
kind: "paymentMethod",
|
|
33770
34502
|
paymentMethod: v
|
|
33771
34503
|
};
|
|
34504
|
+
case "deviceType":
|
|
34505
|
+
return {
|
|
34506
|
+
id: rule._clientId ?? uid(),
|
|
34507
|
+
kind: "deviceType",
|
|
34508
|
+
deviceType: v
|
|
34509
|
+
};
|
|
33772
34510
|
case "category":
|
|
33773
34511
|
return {
|
|
33774
34512
|
id: rule._clientId ?? uid(),
|
|
@@ -34331,6 +35069,9 @@ function ConditionCard({ condition, onChange, onRemove, eventsOn }) {
|
|
|
34331
35069
|
paymentMethod: /* @__PURE__ */ React.createElement(DollarSign, {
|
|
34332
35070
|
className: "h-3.5 w-3.5 text-indigo-500"
|
|
34333
35071
|
}),
|
|
35072
|
+
deviceType: /* @__PURE__ */ React.createElement(DollarSign, {
|
|
35073
|
+
className: "h-3.5 w-3.5 text-cyan-500"
|
|
35074
|
+
}),
|
|
34334
35075
|
category: /* @__PURE__ */ React.createElement(Package, {
|
|
34335
35076
|
className: "h-3.5 w-3.5 text-teal-500"
|
|
34336
35077
|
}),
|
|
@@ -34373,6 +35114,8 @@ function ConditionCard({ condition, onChange, onRemove, eventsOn }) {
|
|
|
34373
35114
|
}, "User type"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
34374
35115
|
value: "paymentMethod"
|
|
34375
35116
|
}, "Payment method"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
35117
|
+
value: "deviceType"
|
|
35118
|
+
}, "Device type"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
34376
35119
|
value: "category"
|
|
34377
35120
|
}, "Category"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
34378
35121
|
value: "customers"
|
|
@@ -34526,7 +35269,21 @@ function ConditionCard({ condition, onChange, onRemove, eventsOn }) {
|
|
|
34526
35269
|
value: "cod"
|
|
34527
35270
|
}, "Cash on Delivery"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
34528
35271
|
value: "wallet"
|
|
34529
|
-
}, "Wallet"))), condition.kind === "
|
|
35272
|
+
}, "Wallet"))), condition.kind === "deviceType" && /* @__PURE__ */ React.createElement(Select, {
|
|
35273
|
+
value: condition.deviceType ?? "",
|
|
35274
|
+
onValueChange: /* @__PURE__ */ __name((v) => onChange({
|
|
35275
|
+
...condition,
|
|
35276
|
+
deviceType: v
|
|
35277
|
+
}), "onValueChange")
|
|
35278
|
+
}, /* @__PURE__ */ React.createElement(SelectTrigger, {
|
|
35279
|
+
className: "h-8 text-xs"
|
|
35280
|
+
}, /* @__PURE__ */ React.createElement(SelectValue, {
|
|
35281
|
+
placeholder: "Select device type\u2026"
|
|
35282
|
+
})), /* @__PURE__ */ React.createElement(SelectContent, null, /* @__PURE__ */ React.createElement(SelectItem, {
|
|
35283
|
+
value: "web"
|
|
35284
|
+
}, "Web"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
35285
|
+
value: "mobile"
|
|
35286
|
+
}, "Mobile"))), condition.kind === "category" && /* @__PURE__ */ React.createElement(CategoryPicker, {
|
|
34530
35287
|
value: condition.categoryId,
|
|
34531
35288
|
label: condition.categoryName,
|
|
34532
35289
|
onChange: /* @__PURE__ */ __name((id, name) => onChange({
|
|
@@ -37751,6 +38508,11 @@ var init_AdminPageResolver = __esm({
|
|
|
37751
38508
|
field: "email",
|
|
37752
38509
|
displayName: "Email"
|
|
37753
38510
|
},
|
|
38511
|
+
{
|
|
38512
|
+
field: "inviteStatus",
|
|
38513
|
+
displayName: "Invite status",
|
|
38514
|
+
hideInForm: true
|
|
38515
|
+
},
|
|
37754
38516
|
{
|
|
37755
38517
|
field: "blocked",
|
|
37756
38518
|
displayName: "Blocked",
|
|
@@ -37956,6 +38718,29 @@ function LayoutSettingsPage() {
|
|
|
37956
38718
|
footer: JSON.stringify(footerValues)
|
|
37957
38719
|
})
|
|
37958
38720
|
});
|
|
38721
|
+
if (navbarConfig.logo) {
|
|
38722
|
+
await fetch("/api/settings/store", {
|
|
38723
|
+
method: "PUT",
|
|
38724
|
+
headers: {
|
|
38725
|
+
"Content-Type": "application/json"
|
|
38726
|
+
},
|
|
38727
|
+
body: JSON.stringify({
|
|
38728
|
+
invoiceLogoUrl: {
|
|
38729
|
+
value: navbarConfig.logo,
|
|
38730
|
+
type: "public"
|
|
38731
|
+
},
|
|
38732
|
+
companyLogo: {
|
|
38733
|
+
value: navbarConfig.logo,
|
|
38734
|
+
type: "public"
|
|
38735
|
+
},
|
|
38736
|
+
logo: {
|
|
38737
|
+
value: navbarConfig.logo,
|
|
38738
|
+
type: "public"
|
|
38739
|
+
}
|
|
38740
|
+
})
|
|
38741
|
+
}).catch(() => {
|
|
38742
|
+
});
|
|
38743
|
+
}
|
|
37959
38744
|
} finally {
|
|
37960
38745
|
setSaving(false);
|
|
37961
38746
|
}
|
|
@@ -38143,7 +38928,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38143
38928
|
onClick: /* @__PURE__ */ __name(() => setActiveTab("settings"), "onClick")
|
|
38144
38929
|
}, "Settings"))), /* @__PURE__ */ React.createElement(DetailPageLayout, {
|
|
38145
38930
|
main: activeTab === "basic" ? /* @__PURE__ */ React.createElement("section", {
|
|
38146
|
-
className:
|
|
38931
|
+
className: sectionCls6
|
|
38147
38932
|
}, /* @__PURE__ */ React.createElement("dl", {
|
|
38148
38933
|
className: "grid gap-4 sm:grid-cols-2"
|
|
38149
38934
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
@@ -38200,7 +38985,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38200
38985
|
}, "Mode"), /* @__PURE__ */ React.createElement("dd", {
|
|
38201
38986
|
className: valueCls
|
|
38202
38987
|
}, formatMode(event.entityMode))))) : activeTab === "venue" ? /* @__PURE__ */ React.createElement("section", {
|
|
38203
|
-
className:
|
|
38988
|
+
className: sectionCls6
|
|
38204
38989
|
}, /* @__PURE__ */ React.createElement("dl", {
|
|
38205
38990
|
className: "grid gap-4 sm:grid-cols-2"
|
|
38206
38991
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -38224,7 +39009,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38224
39009
|
}, "Country"), /* @__PURE__ */ React.createElement("dd", {
|
|
38225
39010
|
className: valueCls
|
|
38226
39011
|
}, displayValue(event.country ?? (event.cityCountry?.includes(",") ? event.cityCountry.split(",").slice(1).join(",").trim() : null)))))) : activeTab === "datetime" ? /* @__PURE__ */ React.createElement("section", {
|
|
38227
|
-
className:
|
|
39012
|
+
className: sectionCls6
|
|
38228
39013
|
}, /* @__PURE__ */ React.createElement("dl", {
|
|
38229
39014
|
className: "grid gap-4 sm:grid-cols-2"
|
|
38230
39015
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
@@ -38256,7 +39041,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38256
39041
|
}, event.registrationClosesAt ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, regClosesFormatted.dateLine), regClosesFormatted.timeLine ? /* @__PURE__ */ React.createElement("div", {
|
|
38257
39042
|
className: "text-gray-600"
|
|
38258
39043
|
}, regClosesFormatted.timeLine) : null) : "\u2014")))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("section", {
|
|
38259
|
-
className:
|
|
39044
|
+
className: sectionCls6
|
|
38260
39045
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
38261
39046
|
className: "space-y-6"
|
|
38262
39047
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", {
|
|
@@ -38317,7 +39102,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38317
39102
|
}))
|
|
38318
39103
|
}));
|
|
38319
39104
|
}
|
|
38320
|
-
var
|
|
39105
|
+
var sectionCls6, labelCls7, valueCls;
|
|
38321
39106
|
var init_EventDetailPage = __esm({
|
|
38322
39107
|
"src/admin/pages/EventDetailPage.tsx"() {
|
|
38323
39108
|
"use client";
|
|
@@ -38329,7 +39114,7 @@ var init_EventDetailPage = __esm({
|
|
|
38329
39114
|
init_DetailPageLayout();
|
|
38330
39115
|
init_DetailPageHeader();
|
|
38331
39116
|
init_EventProductsSection();
|
|
38332
|
-
|
|
39117
|
+
sectionCls6 = "border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
38333
39118
|
labelCls7 = "text-xs font-medium text-gray-500";
|
|
38334
39119
|
valueCls = "text-sm text-gray-900 mt-0.5";
|
|
38335
39120
|
__name(displayValue, "displayValue");
|
|
@@ -38382,18 +39167,26 @@ var init_config = __esm({
|
|
|
38382
39167
|
];
|
|
38383
39168
|
}
|
|
38384
39169
|
});
|
|
39170
|
+
function ForceAdminLightMode() {
|
|
39171
|
+
useForceAdminLightMode();
|
|
39172
|
+
return null;
|
|
39173
|
+
}
|
|
38385
39174
|
function CmsProviders({ children }) {
|
|
38386
39175
|
return /* @__PURE__ */ React.createElement(ThemeProvider, {
|
|
38387
39176
|
attribute: "class",
|
|
38388
|
-
defaultTheme: "
|
|
38389
|
-
|
|
38390
|
-
|
|
39177
|
+
defaultTheme: "light",
|
|
39178
|
+
forcedTheme: "light",
|
|
39179
|
+
enableSystem: false,
|
|
39180
|
+
enableColorScheme: true
|
|
39181
|
+
}, /* @__PURE__ */ React.createElement(ForceAdminLightMode, null), children, /* @__PURE__ */ React.createElement(Toaster, {
|
|
38391
39182
|
position: "top-right"
|
|
38392
39183
|
}));
|
|
38393
39184
|
}
|
|
38394
39185
|
var init_CmsProviders = __esm({
|
|
38395
39186
|
"src/admin/CmsProviders.tsx"() {
|
|
38396
39187
|
"use client";
|
|
39188
|
+
init_force_light_mode();
|
|
39189
|
+
__name(ForceAdminLightMode, "ForceAdminLightMode");
|
|
38397
39190
|
__name(CmsProviders, "CmsProviders");
|
|
38398
39191
|
}
|
|
38399
39192
|
});
|