@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.cjs
CHANGED
|
@@ -261,111 +261,6 @@ var init_infuro_favicon = __esm({
|
|
|
261
261
|
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==";
|
|
262
262
|
}
|
|
263
263
|
});
|
|
264
|
-
function AdminHeader() {
|
|
265
|
-
const { data: session } = react.useSession();
|
|
266
|
-
const sessionUser = session?.user;
|
|
267
|
-
const roleLabel = sessionUser?.groupName?.trim() || (sessionUser?.isRBACAdmin ? "Administrator" : "Admin user");
|
|
268
|
-
const isMobile = useIsMobile();
|
|
269
|
-
const configuredLogo = process.env.NEXT_PUBLIC_ADMIN_LOGO_URL || DEFAULT_ADMIN_LOGO;
|
|
270
|
-
const [logoSrc, setLogoSrc] = React26.useState(configuredLogo);
|
|
271
|
-
const [logoFailed, setLogoFailed] = React26.useState(false);
|
|
272
|
-
const isDataLogo = React26.useMemo(() => logoSrc.startsWith("data:"), [
|
|
273
|
-
logoSrc
|
|
274
|
-
]);
|
|
275
|
-
const handleLogout = /* @__PURE__ */ __name(() => {
|
|
276
|
-
void adminSignOut();
|
|
277
|
-
}, "handleLogout");
|
|
278
|
-
return /* @__PURE__ */ React.createElement("header", {
|
|
279
|
-
className: "bg-white border-b border-gray-200 px-4 py-2"
|
|
280
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
281
|
-
className: "flex items-center justify-between"
|
|
282
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
283
|
-
className: "flex items-center max-h-9 shrink-0"
|
|
284
|
-
}, !logoFailed ? /* @__PURE__ */ React.createElement(Image__default.default, {
|
|
285
|
-
src: logoSrc,
|
|
286
|
-
alt: "Admin",
|
|
287
|
-
width: 120,
|
|
288
|
-
height: 34,
|
|
289
|
-
className: "max-h-9 w-auto object-contain object-left",
|
|
290
|
-
unoptimized: isDataLogo,
|
|
291
|
-
onError: /* @__PURE__ */ __name(() => {
|
|
292
|
-
if (logoSrc !== DEFAULT_ADMIN_LOGO) {
|
|
293
|
-
setLogoSrc(DEFAULT_ADMIN_LOGO);
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
setLogoFailed(true);
|
|
297
|
-
}, "onError")
|
|
298
|
-
}) : /* @__PURE__ */ React.createElement("div", {
|
|
299
|
-
className: "flex items-center gap-2"
|
|
300
|
-
}, /* @__PURE__ */ React.createElement(Image__default.default, {
|
|
301
|
-
src: INFURO_FAVICON_BASE64,
|
|
302
|
-
alt: "Infuro",
|
|
303
|
-
width: 18,
|
|
304
|
-
height: 18,
|
|
305
|
-
unoptimized: true
|
|
306
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
307
|
-
className: "text-sm font-semibold text-gray-800"
|
|
308
|
-
}, "Infuro"))), /* @__PURE__ */ React.createElement("div", {
|
|
309
|
-
className: "flex items-center space-x-3"
|
|
310
|
-
}, /* @__PURE__ */ React.createElement(DropdownMenu, null, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, {
|
|
311
|
-
asChild: true
|
|
312
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
313
|
-
variant: "ghost",
|
|
314
|
-
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"
|
|
315
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
316
|
-
className: "h-7 w-7 rounded-full bg-gray-700 flex items-center justify-center overflow-hidden relative"
|
|
317
|
-
}, session?.user?.image ? /* @__PURE__ */ React.createElement(Image__default.default, {
|
|
318
|
-
src: session.user.image,
|
|
319
|
-
alt: session?.user?.name || "User",
|
|
320
|
-
fill: true,
|
|
321
|
-
className: "object-cover"
|
|
322
|
-
}) : /* @__PURE__ */ React.createElement("span", {
|
|
323
|
-
className: "text-xs font-medium text-gray-100"
|
|
324
|
-
}, session?.user?.name?.charAt(0).toUpperCase() || session?.user?.email?.charAt(0).toUpperCase() || "A")), !isMobile && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
325
|
-
className: "flex flex-col items-start"
|
|
326
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
327
|
-
className: "text-[13px] font-medium text-gray-900"
|
|
328
|
-
}, session?.user?.name || session?.user?.email || "Admin"), /* @__PURE__ */ React.createElement("span", {
|
|
329
|
-
className: "text-[11px] text-gray-500"
|
|
330
|
-
}, roleLabel)), /* @__PURE__ */ React.createElement(LucideIcons.ChevronDown, {
|
|
331
|
-
className: "h-3.5 w-3.5 text-gray-400"
|
|
332
|
-
})))), /* @__PURE__ */ React.createElement(DropdownMenuContent, {
|
|
333
|
-
align: "end",
|
|
334
|
-
className: "w-56"
|
|
335
|
-
}, /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
336
|
-
asChild: true
|
|
337
|
-
}, /* @__PURE__ */ React.createElement(Link2__default.default, {
|
|
338
|
-
href: "/admin/profile",
|
|
339
|
-
className: "flex items-center text-gray-600"
|
|
340
|
-
}, /* @__PURE__ */ React.createElement(LucideIcons.User, {
|
|
341
|
-
className: "mr-2 h-4 w-4"
|
|
342
|
-
}), "Profile")), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
343
|
-
asChild: true
|
|
344
|
-
}, /* @__PURE__ */ React.createElement(Link2__default.default, {
|
|
345
|
-
href: "/admin/settings",
|
|
346
|
-
className: "flex items-center text-gray-600"
|
|
347
|
-
}, /* @__PURE__ */ React.createElement(LucideIcons.Settings, {
|
|
348
|
-
className: "mr-2 h-4 w-4"
|
|
349
|
-
}), "Settings")), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
350
|
-
onClick: handleLogout,
|
|
351
|
-
className: "text-red-600"
|
|
352
|
-
}, /* @__PURE__ */ React.createElement(LucideIcons.LogOut, {
|
|
353
|
-
className: "mr-2 h-4 w-4"
|
|
354
|
-
}), "Sign Out"))))));
|
|
355
|
-
}
|
|
356
|
-
var DEFAULT_ADMIN_LOGO;
|
|
357
|
-
var init_Header = __esm({
|
|
358
|
-
"src/components/Admin/Header.tsx"() {
|
|
359
|
-
"use client";
|
|
360
|
-
init_client_sign_out();
|
|
361
|
-
init_button();
|
|
362
|
-
init_dropdown_menu();
|
|
363
|
-
init_use_mobile();
|
|
364
|
-
init_infuro_favicon();
|
|
365
|
-
DEFAULT_ADMIN_LOGO = "/images/logo/logo.png";
|
|
366
|
-
__name(AdminHeader, "AdminHeader");
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
264
|
|
|
370
265
|
// src/auth/permission-entities.ts
|
|
371
266
|
function isSuperAdminGroupName(name) {
|
|
@@ -473,6 +368,113 @@ var init_vendor_scope = __esm({
|
|
|
473
368
|
__name(canOnboardVendors, "canOnboardVendors");
|
|
474
369
|
}
|
|
475
370
|
});
|
|
371
|
+
function AdminHeader() {
|
|
372
|
+
const { data: session } = react.useSession();
|
|
373
|
+
const sessionUser = session?.user;
|
|
374
|
+
const roleLabel = sessionUser?.groupName?.trim() || (sessionUser?.isRBACAdmin ? "Administrator" : "Admin user");
|
|
375
|
+
const isVendor = isVendorPortalUser(sessionUser);
|
|
376
|
+
const isMobile = useIsMobile();
|
|
377
|
+
const configuredLogo = process.env.NEXT_PUBLIC_ADMIN_LOGO_URL || DEFAULT_ADMIN_LOGO;
|
|
378
|
+
const [logoSrc, setLogoSrc] = React26.useState(configuredLogo);
|
|
379
|
+
const [logoFailed, setLogoFailed] = React26.useState(false);
|
|
380
|
+
const isDataLogo = React26.useMemo(() => logoSrc.startsWith("data:"), [
|
|
381
|
+
logoSrc
|
|
382
|
+
]);
|
|
383
|
+
const handleLogout = /* @__PURE__ */ __name(() => {
|
|
384
|
+
void adminSignOut();
|
|
385
|
+
}, "handleLogout");
|
|
386
|
+
return /* @__PURE__ */ React.createElement("header", {
|
|
387
|
+
className: "bg-white border-b border-gray-200 px-4 py-2"
|
|
388
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
389
|
+
className: "flex items-center justify-between"
|
|
390
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
391
|
+
className: "flex items-center max-h-9 shrink-0"
|
|
392
|
+
}, !logoFailed ? /* @__PURE__ */ React.createElement(Image__default.default, {
|
|
393
|
+
src: logoSrc,
|
|
394
|
+
alt: "Admin",
|
|
395
|
+
width: 120,
|
|
396
|
+
height: 34,
|
|
397
|
+
className: "max-h-9 w-auto object-contain object-left",
|
|
398
|
+
unoptimized: isDataLogo,
|
|
399
|
+
onError: /* @__PURE__ */ __name(() => {
|
|
400
|
+
if (logoSrc !== DEFAULT_ADMIN_LOGO) {
|
|
401
|
+
setLogoSrc(DEFAULT_ADMIN_LOGO);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
setLogoFailed(true);
|
|
405
|
+
}, "onError")
|
|
406
|
+
}) : /* @__PURE__ */ React.createElement("div", {
|
|
407
|
+
className: "flex items-center gap-2"
|
|
408
|
+
}, /* @__PURE__ */ React.createElement(Image__default.default, {
|
|
409
|
+
src: INFURO_FAVICON_BASE64,
|
|
410
|
+
alt: "Infuro",
|
|
411
|
+
width: 18,
|
|
412
|
+
height: 18,
|
|
413
|
+
unoptimized: true
|
|
414
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
415
|
+
className: "text-sm font-semibold text-gray-800"
|
|
416
|
+
}, "Infuro"))), /* @__PURE__ */ React.createElement("div", {
|
|
417
|
+
className: "flex items-center space-x-3"
|
|
418
|
+
}, /* @__PURE__ */ React.createElement(DropdownMenu, null, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, {
|
|
419
|
+
asChild: true
|
|
420
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
421
|
+
variant: "ghost",
|
|
422
|
+
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"
|
|
423
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
424
|
+
className: "h-7 w-7 rounded-full bg-gray-700 flex items-center justify-center overflow-hidden relative"
|
|
425
|
+
}, session?.user?.image ? /* @__PURE__ */ React.createElement(Image__default.default, {
|
|
426
|
+
src: session.user.image,
|
|
427
|
+
alt: session?.user?.name || "User",
|
|
428
|
+
fill: true,
|
|
429
|
+
className: "object-cover"
|
|
430
|
+
}) : /* @__PURE__ */ React.createElement("span", {
|
|
431
|
+
className: "text-xs font-medium text-gray-100"
|
|
432
|
+
}, session?.user?.name?.charAt(0).toUpperCase() || session?.user?.email?.charAt(0).toUpperCase() || "A")), !isMobile && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
433
|
+
className: "flex flex-col items-start"
|
|
434
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
435
|
+
className: "text-[13px] font-medium text-gray-900"
|
|
436
|
+
}, session?.user?.name || session?.user?.email || "Admin"), /* @__PURE__ */ React.createElement("span", {
|
|
437
|
+
className: "text-[11px] text-gray-500"
|
|
438
|
+
}, roleLabel)), /* @__PURE__ */ React.createElement(LucideIcons.ChevronDown, {
|
|
439
|
+
className: "h-3.5 w-3.5 text-gray-400"
|
|
440
|
+
})))), /* @__PURE__ */ React.createElement(DropdownMenuContent, {
|
|
441
|
+
align: "end",
|
|
442
|
+
className: "w-56"
|
|
443
|
+
}, !isVendor && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
444
|
+
asChild: true
|
|
445
|
+
}, /* @__PURE__ */ React.createElement(Link2__default.default, {
|
|
446
|
+
href: "/admin/profile",
|
|
447
|
+
className: "flex items-center text-gray-600"
|
|
448
|
+
}, /* @__PURE__ */ React.createElement(LucideIcons.User, {
|
|
449
|
+
className: "mr-2 h-4 w-4"
|
|
450
|
+
}), "Profile")), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
451
|
+
asChild: true
|
|
452
|
+
}, /* @__PURE__ */ React.createElement(Link2__default.default, {
|
|
453
|
+
href: "/admin/settings",
|
|
454
|
+
className: "flex items-center text-gray-600"
|
|
455
|
+
}, /* @__PURE__ */ React.createElement(LucideIcons.Settings, {
|
|
456
|
+
className: "mr-2 h-4 w-4"
|
|
457
|
+
}), "Settings"))), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
458
|
+
onClick: handleLogout,
|
|
459
|
+
className: "text-red-600"
|
|
460
|
+
}, /* @__PURE__ */ React.createElement(LucideIcons.LogOut, {
|
|
461
|
+
className: "mr-2 h-4 w-4"
|
|
462
|
+
}), "Sign Out"))))));
|
|
463
|
+
}
|
|
464
|
+
var DEFAULT_ADMIN_LOGO;
|
|
465
|
+
var init_Header = __esm({
|
|
466
|
+
"src/components/Admin/Header.tsx"() {
|
|
467
|
+
"use client";
|
|
468
|
+
init_client_sign_out();
|
|
469
|
+
init_button();
|
|
470
|
+
init_dropdown_menu();
|
|
471
|
+
init_use_mobile();
|
|
472
|
+
init_infuro_favicon();
|
|
473
|
+
init_vendor_scope();
|
|
474
|
+
DEFAULT_ADMIN_LOGO = "/images/logo/logo.png";
|
|
475
|
+
__name(AdminHeader, "AdminHeader");
|
|
476
|
+
}
|
|
477
|
+
});
|
|
476
478
|
var defaultValue; exports.AdminConfigContext = void 0;
|
|
477
479
|
var init_admin_config_context = __esm({
|
|
478
480
|
"src/admin/admin-config-context.tsx"() {
|
|
@@ -492,7 +494,7 @@ var init_admin_config_context = __esm({
|
|
|
492
494
|
var CMS_VERSION;
|
|
493
495
|
var init_cms_version = __esm({
|
|
494
496
|
"src/lib/cms-version.ts"() {
|
|
495
|
-
CMS_VERSION = "1.0.
|
|
497
|
+
CMS_VERSION = "1.0.46" ;
|
|
496
498
|
}
|
|
497
499
|
});
|
|
498
500
|
function useCatalogCategories(enabled = true) {
|
|
@@ -624,7 +626,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
624
626
|
const iconActive = "text-gray-700";
|
|
625
627
|
const iconInactive = "text-gray-400";
|
|
626
628
|
const linkCls = "flex items-center px-2.5 py-[7px] text-[13px] font-medium rounded-md transition-colors";
|
|
627
|
-
const
|
|
629
|
+
const sectionCls7 = "mb-5";
|
|
628
630
|
const headingCls = "text-[11px] font-semibold text-gray-400 uppercase tracking-wider px-2.5 mb-1.5";
|
|
629
631
|
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";
|
|
630
632
|
return /* @__PURE__ */ React.createElement("aside", {
|
|
@@ -634,7 +636,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
634
636
|
}, /* @__PURE__ */ React.createElement("nav", {
|
|
635
637
|
className: "admin-scroll flex-1 min-h-0 px-3 py-4 pb-4 overflow-y-auto overscroll-contain"
|
|
636
638
|
}, showPlatformNav && /* @__PURE__ */ React.createElement("div", {
|
|
637
|
-
className:
|
|
639
|
+
className: sectionCls7
|
|
638
640
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
639
641
|
className: headingCls
|
|
640
642
|
}, "Main"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -646,7 +648,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
646
648
|
className: `h-4 w-4 mr-2 ${isActive("/admin/dashboard") ? iconActive : iconInactive}`
|
|
647
649
|
}), "Dashboard")))), showPlatformNav && customNavSections.length > 0 && customNavSections.map((section) => /* @__PURE__ */ React.createElement("div", {
|
|
648
650
|
key: section.title,
|
|
649
|
-
className:
|
|
651
|
+
className: sectionCls7
|
|
650
652
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
651
653
|
className: headingCls
|
|
652
654
|
}, section.title), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -662,7 +664,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
662
664
|
className: `h-4 w-4 mr-2 ${isActive(item.href) ? iconActive : iconInactive}`
|
|
663
665
|
}), item.label));
|
|
664
666
|
})))), showPlatformNav && customNavSections.length === 0 && customNavItems.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
665
|
-
className:
|
|
667
|
+
className: sectionCls7
|
|
666
668
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
667
669
|
className: headingCls
|
|
668
670
|
}, "Custom"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -678,7 +680,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
678
680
|
className: `h-4 w-4 mr-2 ${isActive(item.href) ? iconActive : iconInactive}`
|
|
679
681
|
}), item.label));
|
|
680
682
|
}))), vendorPortal && /* @__PURE__ */ React.createElement("div", {
|
|
681
|
-
className:
|
|
683
|
+
className: sectionCls7
|
|
682
684
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
683
685
|
className: headingCls
|
|
684
686
|
}, "Main"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -690,7 +692,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
690
692
|
className: `h-4 w-4 mr-2 ${isActive("/admin/dashboard") ? iconActive : iconInactive}`
|
|
691
693
|
}), "Dashboard")))), vendorPortal && customNavSections.length > 0 && customNavSections.map((section) => /* @__PURE__ */ React.createElement("div", {
|
|
692
694
|
key: section.title,
|
|
693
|
-
className:
|
|
695
|
+
className: sectionCls7
|
|
694
696
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
695
697
|
className: headingCls
|
|
696
698
|
}, section.title), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -706,7 +708,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
706
708
|
className: `h-4 w-4 mr-2 ${isActive(item.href) ? iconActive : iconInactive}`
|
|
707
709
|
}), item.label));
|
|
708
710
|
})))), showStoreNav && /* @__PURE__ */ React.createElement("div", {
|
|
709
|
-
className:
|
|
711
|
+
className: sectionCls7
|
|
710
712
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
711
713
|
className: headingCls
|
|
712
714
|
}, "Store"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -772,7 +774,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
772
774
|
}, /* @__PURE__ */ React.createElement(LucideIcons.Users, {
|
|
773
775
|
className: `h-4 w-4 mr-2 ${isActive("/admin/vendor_customers") ? iconActive : iconInactive}`
|
|
774
776
|
}), "Customers")))), !vendorPortal && /* @__PURE__ */ React.createElement("div", {
|
|
775
|
-
className:
|
|
777
|
+
className: sectionCls7
|
|
776
778
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
777
779
|
className: headingCls
|
|
778
780
|
}, "Management"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -808,7 +810,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
808
810
|
}, /* @__PURE__ */ React.createElement(LucideIcons.Image, {
|
|
809
811
|
className: `h-4 w-4 mr-2 ${isActive("/admin/media") ? iconActive : iconInactive}`
|
|
810
812
|
}), "Media")))), vendorPortal && /* @__PURE__ */ React.createElement("div", {
|
|
811
|
-
className:
|
|
813
|
+
className: sectionCls7
|
|
812
814
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
813
815
|
className: headingCls
|
|
814
816
|
}, "Settings"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -829,7 +831,7 @@ function AdminSidebar({ variant = "sidebar" }) {
|
|
|
829
831
|
}, /* @__PURE__ */ React.createElement(LucideIcons.FileText, {
|
|
830
832
|
className: `h-4 w-4 mr-2 ${isActive("/admin/policy") ? iconActive : iconInactive}`
|
|
831
833
|
}), "Policy")))), !vendorPortal && /* @__PURE__ */ React.createElement("div", {
|
|
832
|
-
className:
|
|
834
|
+
className: sectionCls7
|
|
833
835
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
834
836
|
className: headingCls
|
|
835
837
|
}, "System"), /* @__PURE__ */ React.createElement("ul", {
|
|
@@ -1094,8 +1096,10 @@ var init_admin_theme = __esm({
|
|
|
1094
1096
|
"src/admin/admin-theme.ts"() {
|
|
1095
1097
|
ADMIN_THEME_CSS = `
|
|
1096
1098
|
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap");
|
|
1099
|
+
html{color-scheme:light}
|
|
1097
1100
|
: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%}
|
|
1098
|
-
|
|
1101
|
+
/* Dark mode disabled: keep light tokens even if a host app adds .dark on <html> */
|
|
1102
|
+
.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%}
|
|
1099
1103
|
*,*::before,*::after{border-color:hsl(var(--border))}
|
|
1100
1104
|
body{font-family:"Inter",ui-sans-serif,system-ui,sans-serif;font-size:14px}
|
|
1101
1105
|
.admin-app{font-size:13.5px}
|
|
@@ -1210,6 +1214,39 @@ var init_auth_debug = __esm({
|
|
|
1210
1214
|
__name(summarizeSessionUserForLog, "summarizeSessionUserForLog");
|
|
1211
1215
|
}
|
|
1212
1216
|
});
|
|
1217
|
+
function useForceAdminLightMode() {
|
|
1218
|
+
React26.useEffect(() => {
|
|
1219
|
+
const root = document.documentElement;
|
|
1220
|
+
const hadDark = root.classList.contains("dark");
|
|
1221
|
+
const prevColorScheme = root.style.colorScheme;
|
|
1222
|
+
const applyLight = /* @__PURE__ */ __name(() => {
|
|
1223
|
+
root.classList.remove("dark");
|
|
1224
|
+
root.style.colorScheme = "light";
|
|
1225
|
+
}, "applyLight");
|
|
1226
|
+
applyLight();
|
|
1227
|
+
const observer = new MutationObserver(() => {
|
|
1228
|
+
if (root.classList.contains("dark")) applyLight();
|
|
1229
|
+
});
|
|
1230
|
+
observer.observe(root, {
|
|
1231
|
+
attributes: true,
|
|
1232
|
+
attributeFilter: [
|
|
1233
|
+
"class"
|
|
1234
|
+
]
|
|
1235
|
+
});
|
|
1236
|
+
return () => {
|
|
1237
|
+
observer.disconnect();
|
|
1238
|
+
root.style.colorScheme = prevColorScheme;
|
|
1239
|
+
if (hadDark) root.classList.add("dark");
|
|
1240
|
+
else root.classList.remove("dark");
|
|
1241
|
+
};
|
|
1242
|
+
}, []);
|
|
1243
|
+
}
|
|
1244
|
+
var init_force_light_mode = __esm({
|
|
1245
|
+
"src/admin/force-light-mode.ts"() {
|
|
1246
|
+
"use client";
|
|
1247
|
+
__name(useForceAdminLightMode, "useForceAdminLightMode");
|
|
1248
|
+
}
|
|
1249
|
+
});
|
|
1213
1250
|
function useAdminViewSettings() {
|
|
1214
1251
|
React26.useEffect(() => {
|
|
1215
1252
|
fetch("/api/settings/admin_view").then((r) => r.ok ? r.json() : null).then((data) => {
|
|
@@ -1231,6 +1268,7 @@ function AdminLayoutInner({ children }) {
|
|
|
1231
1268
|
const isMobile = useIsMobile();
|
|
1232
1269
|
const vendorBlockRedirectRef = React26.useRef(false);
|
|
1233
1270
|
useAdminViewSettings();
|
|
1271
|
+
useForceAdminLightMode();
|
|
1234
1272
|
const isPublicPath = PUBLIC_ADMIN_PATHS.includes(pathname);
|
|
1235
1273
|
const isVendorOnlySession = session?.user?.isVendorPortal === true && session?.user?.isRBACAdmin !== true;
|
|
1236
1274
|
React26.useEffect(() => {
|
|
@@ -1519,6 +1557,7 @@ var init_AdminLayout = __esm({
|
|
|
1519
1557
|
init_admin_config_context();
|
|
1520
1558
|
init_builtin_plugin_descriptors();
|
|
1521
1559
|
init_auth_debug();
|
|
1560
|
+
init_force_light_mode();
|
|
1522
1561
|
PUBLIC_ADMIN_PATHS = [
|
|
1523
1562
|
"/admin/signin",
|
|
1524
1563
|
"/admin/forgot-password",
|
|
@@ -1769,6 +1808,225 @@ var init_file_upload = __esm({
|
|
|
1769
1808
|
__name(FileUpload, "FileUpload");
|
|
1770
1809
|
}
|
|
1771
1810
|
});
|
|
1811
|
+
|
|
1812
|
+
// src/lib/media-url.ts
|
|
1813
|
+
function isVideoUploadMime(mime) {
|
|
1814
|
+
const t = String(mime ?? "").trim().toLowerCase();
|
|
1815
|
+
return VIDEO_UPLOAD_MIME_TYPES.includes(t);
|
|
1816
|
+
}
|
|
1817
|
+
function isVideoMediaUrl(url) {
|
|
1818
|
+
if (!url || typeof url !== "string") return false;
|
|
1819
|
+
const trimmed = url.trim();
|
|
1820
|
+
if (!trimmed) return false;
|
|
1821
|
+
try {
|
|
1822
|
+
if (/^https?:\/\//i.test(trimmed)) {
|
|
1823
|
+
return VIDEO_EXT_RE.test(new URL(trimmed).pathname);
|
|
1824
|
+
}
|
|
1825
|
+
} catch {
|
|
1826
|
+
}
|
|
1827
|
+
const path = trimmed.split("?")[0]?.split("#")[0] ?? trimmed;
|
|
1828
|
+
return VIDEO_EXT_RE.test(path);
|
|
1829
|
+
}
|
|
1830
|
+
var VIDEO_EXT_RE, IMAGE_UPLOAD_MIME_TYPES, VIDEO_UPLOAD_MIME_TYPES, MEDIA_UPLOAD_MIME_TYPES, VIDEO_UPLOAD_MAX_BYTES;
|
|
1831
|
+
var init_media_url = __esm({
|
|
1832
|
+
"src/lib/media-url.ts"() {
|
|
1833
|
+
VIDEO_EXT_RE = /\.(mp4|webm|mov)(?:$|[?#])/i;
|
|
1834
|
+
IMAGE_UPLOAD_MIME_TYPES = [
|
|
1835
|
+
"image/jpeg",
|
|
1836
|
+
"image/png",
|
|
1837
|
+
"image/gif",
|
|
1838
|
+
"image/webp"
|
|
1839
|
+
];
|
|
1840
|
+
VIDEO_UPLOAD_MIME_TYPES = [
|
|
1841
|
+
"video/mp4",
|
|
1842
|
+
"video/webm",
|
|
1843
|
+
"video/quicktime"
|
|
1844
|
+
];
|
|
1845
|
+
MEDIA_UPLOAD_MIME_TYPES = [
|
|
1846
|
+
...IMAGE_UPLOAD_MIME_TYPES,
|
|
1847
|
+
...VIDEO_UPLOAD_MIME_TYPES
|
|
1848
|
+
];
|
|
1849
|
+
VIDEO_UPLOAD_MAX_BYTES = 100 * 1024 * 1024;
|
|
1850
|
+
__name(isVideoUploadMime, "isVideoUploadMime");
|
|
1851
|
+
__name(isVideoMediaUrl, "isVideoMediaUrl");
|
|
1852
|
+
}
|
|
1853
|
+
});
|
|
1854
|
+
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 }) {
|
|
1855
|
+
const fileInputRef = React26.useRef(null);
|
|
1856
|
+
const [isUploading, setIsUploading] = React26.useState(false);
|
|
1857
|
+
const [error, setError] = React26.useState(null);
|
|
1858
|
+
const [lightboxOpen, setLightboxOpen] = React26.useState(false);
|
|
1859
|
+
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";
|
|
1860
|
+
const closeLightbox = React26.useCallback(() => setLightboxOpen(false), []);
|
|
1861
|
+
React26.useEffect(() => {
|
|
1862
|
+
if (!lightboxOpen) return;
|
|
1863
|
+
const onKeyDown = /* @__PURE__ */ __name((e) => {
|
|
1864
|
+
if (e.key === "Escape") closeLightbox();
|
|
1865
|
+
}, "onKeyDown");
|
|
1866
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1867
|
+
const prevOverflow = document.body.style.overflow;
|
|
1868
|
+
document.body.style.overflow = "hidden";
|
|
1869
|
+
return () => {
|
|
1870
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
1871
|
+
document.body.style.overflow = prevOverflow;
|
|
1872
|
+
};
|
|
1873
|
+
}, [
|
|
1874
|
+
lightboxOpen,
|
|
1875
|
+
closeLightbox
|
|
1876
|
+
]);
|
|
1877
|
+
const handleUpload = React26.useCallback(async (file) => {
|
|
1878
|
+
setError(null);
|
|
1879
|
+
if (!MEDIA_UPLOAD_MIME_TYPES.includes(file.type)) {
|
|
1880
|
+
setError("Unsupported type. Use JPG, PNG, GIF, WEBP, or video MP4 / WebM / MOV");
|
|
1881
|
+
return;
|
|
1882
|
+
}
|
|
1883
|
+
const isVideo2 = isVideoUploadMime(file.type);
|
|
1884
|
+
const limit = isVideo2 ? VIDEO_UPLOAD_MAX_BYTES : maxSizeMb * 1024 * 1024;
|
|
1885
|
+
if (file.size > limit) {
|
|
1886
|
+
setError(isVideo2 ? `Video must be under ${VIDEO_UPLOAD_MAX_BYTES / (1024 * 1024)}MB` : `File must be under ${Math.round(limit / (1024 * 1024))}MB`);
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
setIsUploading(true);
|
|
1890
|
+
try {
|
|
1891
|
+
const formData = new FormData();
|
|
1892
|
+
formData.append("file", file);
|
|
1893
|
+
const response = await fetch("/api/upload", {
|
|
1894
|
+
method: "POST",
|
|
1895
|
+
body: formData
|
|
1896
|
+
});
|
|
1897
|
+
const data = await response.json();
|
|
1898
|
+
if (!response.ok) {
|
|
1899
|
+
throw new Error(data.error || data.details || "Upload failed");
|
|
1900
|
+
}
|
|
1901
|
+
onChange(data.filePath ?? "");
|
|
1902
|
+
} catch (err) {
|
|
1903
|
+
setError(err instanceof Error ? err.message : "Upload failed");
|
|
1904
|
+
} finally {
|
|
1905
|
+
setIsUploading(false);
|
|
1906
|
+
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
1907
|
+
}
|
|
1908
|
+
}, [
|
|
1909
|
+
maxSizeMb,
|
|
1910
|
+
onChange
|
|
1911
|
+
]);
|
|
1912
|
+
const onFileChange = React26.useCallback((e) => {
|
|
1913
|
+
const file = e.target.files?.[0];
|
|
1914
|
+
if (file) void handleUpload(file);
|
|
1915
|
+
}, [
|
|
1916
|
+
handleUpload
|
|
1917
|
+
]);
|
|
1918
|
+
const trimmed = value.trim();
|
|
1919
|
+
const isVideo = isVideoMediaUrl(trimmed);
|
|
1920
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1921
|
+
className: "space-y-2"
|
|
1922
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
1923
|
+
className: labelClassName
|
|
1924
|
+
}, label), trimmed ? /* @__PURE__ */ React.createElement("div", {
|
|
1925
|
+
className: "flex items-start gap-3"
|
|
1926
|
+
}, isVideo ? (
|
|
1927
|
+
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
1928
|
+
/* @__PURE__ */ React.createElement("video", {
|
|
1929
|
+
src: trimmed,
|
|
1930
|
+
className: previewCls,
|
|
1931
|
+
muted: true,
|
|
1932
|
+
playsInline: true,
|
|
1933
|
+
preload: "metadata",
|
|
1934
|
+
onClick: /* @__PURE__ */ __name(() => setLightboxOpen(true), "onClick"),
|
|
1935
|
+
title: "Click to enlarge"
|
|
1936
|
+
})
|
|
1937
|
+
) : (
|
|
1938
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
1939
|
+
/* @__PURE__ */ React.createElement("img", {
|
|
1940
|
+
src: trimmed,
|
|
1941
|
+
alt: label,
|
|
1942
|
+
className: previewCls,
|
|
1943
|
+
role: "button",
|
|
1944
|
+
tabIndex: 0,
|
|
1945
|
+
title: "Click to enlarge",
|
|
1946
|
+
onClick: /* @__PURE__ */ __name(() => setLightboxOpen(true), "onClick"),
|
|
1947
|
+
onKeyDown: /* @__PURE__ */ __name((e) => {
|
|
1948
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1949
|
+
e.preventDefault();
|
|
1950
|
+
setLightboxOpen(true);
|
|
1951
|
+
}
|
|
1952
|
+
}, "onKeyDown"),
|
|
1953
|
+
onError: /* @__PURE__ */ __name((e) => {
|
|
1954
|
+
e.currentTarget.style.display = "none";
|
|
1955
|
+
}, "onError")
|
|
1956
|
+
})
|
|
1957
|
+
), /* @__PURE__ */ React.createElement("button", {
|
|
1958
|
+
type: "button",
|
|
1959
|
+
onClick: /* @__PURE__ */ __name(() => onChange(""), "onClick"),
|
|
1960
|
+
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"
|
|
1961
|
+
}, /* @__PURE__ */ React.createElement(LucideIcons.X, {
|
|
1962
|
+
className: "h-3 w-3"
|
|
1963
|
+
}), "Clear")) : null, /* @__PURE__ */ React.createElement("div", {
|
|
1964
|
+
className: "flex flex-wrap gap-2"
|
|
1965
|
+
}, /* @__PURE__ */ React.createElement("input", {
|
|
1966
|
+
type: "text",
|
|
1967
|
+
inputMode: "url",
|
|
1968
|
+
autoComplete: "off",
|
|
1969
|
+
value,
|
|
1970
|
+
onChange: /* @__PURE__ */ __name((e) => {
|
|
1971
|
+
setError(null);
|
|
1972
|
+
onChange(e.target.value);
|
|
1973
|
+
}, "onChange"),
|
|
1974
|
+
placeholder,
|
|
1975
|
+
className: `${inputClassName} min-w-0 flex-1`
|
|
1976
|
+
}), /* @__PURE__ */ React.createElement("input", {
|
|
1977
|
+
ref: fileInputRef,
|
|
1978
|
+
type: "file",
|
|
1979
|
+
accept: ACCEPT,
|
|
1980
|
+
onChange: onFileChange,
|
|
1981
|
+
className: "hidden",
|
|
1982
|
+
disabled: isUploading
|
|
1983
|
+
}), /* @__PURE__ */ React.createElement("button", {
|
|
1984
|
+
type: "button",
|
|
1985
|
+
onClick: /* @__PURE__ */ __name(() => fileInputRef.current?.click(), "onClick"),
|
|
1986
|
+
disabled: isUploading,
|
|
1987
|
+
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"
|
|
1988
|
+
}, /* @__PURE__ */ React.createElement(LucideIcons.Upload, {
|
|
1989
|
+
className: "h-3.5 w-3.5"
|
|
1990
|
+
}), isUploading ? "Uploading\u2026" : "Upload")), error ? /* @__PURE__ */ React.createElement("p", {
|
|
1991
|
+
className: "flex items-center gap-1.5 text-xs text-red-600"
|
|
1992
|
+
}, /* @__PURE__ */ React.createElement(LucideIcons.AlertCircle, {
|
|
1993
|
+
className: "h-3.5 w-3.5 shrink-0"
|
|
1994
|
+
}), error) : /* @__PURE__ */ React.createElement("p", {
|
|
1995
|
+
className: "text-xs text-gray-500"
|
|
1996
|
+
}, "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", {
|
|
1997
|
+
className: "fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-4",
|
|
1998
|
+
role: "dialog",
|
|
1999
|
+
"aria-modal": "true",
|
|
2000
|
+
"aria-label": `${label} preview`,
|
|
2001
|
+
onClick: closeLightbox
|
|
2002
|
+
}, isVideo ? (
|
|
2003
|
+
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
2004
|
+
/* @__PURE__ */ React.createElement("video", {
|
|
2005
|
+
src: trimmed,
|
|
2006
|
+
controls: true,
|
|
2007
|
+
autoPlay: true,
|
|
2008
|
+
className: "max-h-[90vh] max-w-[90vw] rounded-md shadow-lg",
|
|
2009
|
+
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick")
|
|
2010
|
+
})
|
|
2011
|
+
) : (
|
|
2012
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
2013
|
+
/* @__PURE__ */ React.createElement("img", {
|
|
2014
|
+
src: trimmed,
|
|
2015
|
+
alt: label,
|
|
2016
|
+
className: "max-h-[90vh] max-w-[90vw] rounded-md object-contain shadow-lg",
|
|
2017
|
+
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick")
|
|
2018
|
+
})
|
|
2019
|
+
)) : null);
|
|
2020
|
+
}
|
|
2021
|
+
var ACCEPT;
|
|
2022
|
+
var init_ImageOrUrlField = __esm({
|
|
2023
|
+
"src/components/Admin/ImageOrUrlField.tsx"() {
|
|
2024
|
+
"use client";
|
|
2025
|
+
init_media_url();
|
|
2026
|
+
ACCEPT = MEDIA_UPLOAD_MIME_TYPES.join(",");
|
|
2027
|
+
__name(ImageOrUrlField, "ImageOrUrlField");
|
|
2028
|
+
}
|
|
2029
|
+
});
|
|
1772
2030
|
function RelationAutocomplete({ apiEndpoint, value, onChange, labelField = "name", valueField = "id", placeholder = "Select\u2026", disabled = false, queryParams }) {
|
|
1773
2031
|
const [open, setOpen] = React26.useState(false);
|
|
1774
2032
|
const [search, setSearch] = React26.useState("");
|
|
@@ -2139,9 +2397,6 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2139
2397
|
currency: currency || "INR"
|
|
2140
2398
|
});
|
|
2141
2399
|
const [errors, setErrors] = React26.useState({});
|
|
2142
|
-
const [password, setPassword] = React26.useState("");
|
|
2143
|
-
const [confirmPassword, setConfirmPassword] = React26.useState("");
|
|
2144
|
-
const isCustomerCreate = resource === "vendor_customers" && !existingData;
|
|
2145
2400
|
React26.useEffect(() => {
|
|
2146
2401
|
fetch("/api/settings/store").then((res) => res.json()).then((data) => {
|
|
2147
2402
|
setFormData((prev) => ({
|
|
@@ -2269,8 +2524,6 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2269
2524
|
});
|
|
2270
2525
|
setFormData(merged);
|
|
2271
2526
|
} else {
|
|
2272
|
-
setPassword("");
|
|
2273
|
-
setConfirmPassword("");
|
|
2274
2527
|
setFormData(columns.filter((col) => !col.hideInForm).reduce((acc, col) => {
|
|
2275
2528
|
const path = col.field || col.key;
|
|
2276
2529
|
if (!path) return acc;
|
|
@@ -2331,18 +2584,6 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2331
2584
|
}
|
|
2332
2585
|
}
|
|
2333
2586
|
});
|
|
2334
|
-
if (isCustomerCreate) {
|
|
2335
|
-
if (!password) {
|
|
2336
|
-
newErrors["_password"] = "Password is required";
|
|
2337
|
-
} else if (password.length < 6) {
|
|
2338
|
-
newErrors["_password"] = "Password must be at least 6 characters";
|
|
2339
|
-
}
|
|
2340
|
-
if (!confirmPassword) {
|
|
2341
|
-
newErrors["_confirmPassword"] = "Please confirm your password";
|
|
2342
|
-
} else if (password && confirmPassword !== password) {
|
|
2343
|
-
newErrors["_confirmPassword"] = "Passwords do not match";
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
2587
|
setErrors(newErrors);
|
|
2347
2588
|
return Object.keys(newErrors).length === 0;
|
|
2348
2589
|
}, "validateForm");
|
|
@@ -2360,9 +2601,6 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2360
2601
|
if (!existingData) {
|
|
2361
2602
|
delete payload.id;
|
|
2362
2603
|
}
|
|
2363
|
-
if (isCustomerCreate) {
|
|
2364
|
-
payload._password = password;
|
|
2365
|
-
}
|
|
2366
2604
|
try {
|
|
2367
2605
|
const res = await fetch(url, {
|
|
2368
2606
|
method,
|
|
@@ -2377,12 +2615,7 @@ function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns,
|
|
|
2377
2615
|
return;
|
|
2378
2616
|
}
|
|
2379
2617
|
const result = await res.json();
|
|
2380
|
-
|
|
2381
|
-
sonner.toast.success(`User invite created! Invite link: ${result.inviteLink}
|
|
2382
|
-
|
|
2383
|
-
Note: ${result.note}`);
|
|
2384
|
-
}
|
|
2385
|
-
onSaveSuccess?.();
|
|
2618
|
+
onSaveSuccess?.(result);
|
|
2386
2619
|
onClose();
|
|
2387
2620
|
} catch (error) {
|
|
2388
2621
|
console.error("Error saving data:", error);
|
|
@@ -2392,6 +2625,7 @@ Note: ${result.note}`);
|
|
|
2392
2625
|
const visibleColumns = columns.filter((col) => {
|
|
2393
2626
|
if (col.hideInForm) return false;
|
|
2394
2627
|
if (!existingData && col.hideInCreate) return false;
|
|
2628
|
+
if (existingData && col.hideInEdit) return false;
|
|
2395
2629
|
return true;
|
|
2396
2630
|
});
|
|
2397
2631
|
const isFieldDisabled = /* @__PURE__ */ __name((path) => {
|
|
@@ -2428,7 +2662,7 @@ Note: ${result.note}`);
|
|
|
2428
2662
|
const selectValue = optionSet && rawStr !== "" && optionSet.has(rawStr) ? rawStr : void 0;
|
|
2429
2663
|
return /* @__PURE__ */ React26__namespace.default.createElement(React26__namespace.default.Fragment, {
|
|
2430
2664
|
key: path
|
|
2431
|
-
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(Label3, {
|
|
2665
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, col.type !== "image" && /* @__PURE__ */ React26__namespace.default.createElement(Label3, {
|
|
2432
2666
|
className: "block text-sm font-medium mb-1"
|
|
2433
2667
|
}, col.displayName, [
|
|
2434
2668
|
"subtotal",
|
|
@@ -2555,6 +2789,16 @@ Note: ${result.note}`);
|
|
|
2555
2789
|
disabled
|
|
2556
2790
|
}) : col.type === "file" ? /* @__PURE__ */ React26__namespace.default.createElement(FileUpload, {
|
|
2557
2791
|
onUploadSuccess: /* @__PURE__ */ __name((url) => handleFileUpload(path, url), "onUploadSuccess")
|
|
2792
|
+
}) : col.type === "image" ? /* @__PURE__ */ React26__namespace.default.createElement(ImageOrUrlField, {
|
|
2793
|
+
label: col.displayName,
|
|
2794
|
+
value: typeof formData[path] === "string" ? formData[path] : "",
|
|
2795
|
+
onChange: /* @__PURE__ */ __name((url) => setFormData((prev) => ({
|
|
2796
|
+
...prev,
|
|
2797
|
+
[path]: url
|
|
2798
|
+
})), "onChange"),
|
|
2799
|
+
placeholder: col.placeholder ?? "Image URL or upload",
|
|
2800
|
+
previewVariant: "logo",
|
|
2801
|
+
labelClassName: "block text-sm font-medium mb-1"
|
|
2558
2802
|
}) : /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
2559
2803
|
type: col.type || "text",
|
|
2560
2804
|
placeholder: [
|
|
@@ -2578,25 +2822,7 @@ Note: ${result.note}`);
|
|
|
2578
2822
|
"contact.name": e.target.value
|
|
2579
2823
|
})), "onChange")
|
|
2580
2824
|
})));
|
|
2581
|
-
}),
|
|
2582
|
-
className: "block text-sm font-medium mb-1"
|
|
2583
|
-
}, "Password"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
2584
|
-
type: "password",
|
|
2585
|
-
value: password,
|
|
2586
|
-
onChange: /* @__PURE__ */ __name((e) => setPassword(e.target.value), "onChange"),
|
|
2587
|
-
placeholder: "Min. 6 characters"
|
|
2588
|
-
}), errors["_password"] && /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
2589
|
-
className: "text-red-500 text-sm mt-1"
|
|
2590
|
-
}, errors["_password"])), /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(Label3, {
|
|
2591
|
-
className: "block text-sm font-medium mb-1"
|
|
2592
|
-
}, "Confirm Password"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
2593
|
-
type: "password",
|
|
2594
|
-
value: confirmPassword,
|
|
2595
|
-
onChange: /* @__PURE__ */ __name((e) => setConfirmPassword(e.target.value), "onChange"),
|
|
2596
|
-
placeholder: "Re-enter password"
|
|
2597
|
-
}), errors["_confirmPassword"] && /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
2598
|
-
className: "text-red-500 text-sm mt-1"
|
|
2599
|
-
}, errors["_confirmPassword"])))), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
2825
|
+
})), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
2600
2826
|
className: "flex gap-2 p-4 border-t border-gray-200 shrink-0 bg-white"
|
|
2601
2827
|
}, /* @__PURE__ */ React26__namespace.default.createElement(Button, {
|
|
2602
2828
|
type: "submit",
|
|
@@ -2618,6 +2844,7 @@ var init_CreateEditForm = __esm({
|
|
|
2618
2844
|
init_switch();
|
|
2619
2845
|
init_label();
|
|
2620
2846
|
init_file_upload();
|
|
2847
|
+
init_ImageOrUrlField();
|
|
2621
2848
|
init_RelationAutocomplete();
|
|
2622
2849
|
init_RelationMultiSelect();
|
|
2623
2850
|
init_use_mobile();
|
|
@@ -3780,13 +4007,13 @@ function CrudSearchFilterBar({ apiEndpoint, listFilters, relationLabelMaps, sear
|
|
|
3780
4007
|
}
|
|
3781
4008
|
const raw = (committedFilterValues[f.param] ?? "").trim();
|
|
3782
4009
|
if (!raw) return null;
|
|
3783
|
-
const
|
|
4010
|
+
const display2 = f.type === "select" ? labelForSelectValue(f, raw, relationLabelMaps) || raw : f.type === "multiSelect" ? labelsForMultiSelectValue(f, raw, relationLabelMaps) || raw : raw;
|
|
3784
4011
|
return /* @__PURE__ */ React.createElement("span", {
|
|
3785
4012
|
key: f.param,
|
|
3786
4013
|
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"
|
|
3787
4014
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
3788
4015
|
className: "truncate"
|
|
3789
|
-
}, f.label, ": ",
|
|
4016
|
+
}, f.label, ": ", display2), /* @__PURE__ */ React.createElement("button", {
|
|
3790
4017
|
type: "button",
|
|
3791
4018
|
className: "ml-0.5 shrink-0 rounded-full p-0.5 text-gray-500 hover:bg-gray-100 hover:text-gray-900",
|
|
3792
4019
|
"aria-label": `Remove ${f.label}`,
|
|
@@ -3969,11 +4196,7 @@ function formatArrayListCell(value, col) {
|
|
|
3969
4196
|
return items.join(", ");
|
|
3970
4197
|
}
|
|
3971
4198
|
function formatCellValue(value, col) {
|
|
3972
|
-
if (col.type === "boolean") return value ?
|
|
3973
|
-
className: "h-4 w-4 text-green-600"
|
|
3974
|
-
}) : /* @__PURE__ */ React.createElement(LucideIcons.X, {
|
|
3975
|
-
className: "h-4 w-4 text-red-600"
|
|
3976
|
-
});
|
|
4199
|
+
if (col.type === "boolean") return value ? "Yes" : "No";
|
|
3977
4200
|
if (col.type === "date") return formatDate(value);
|
|
3978
4201
|
if (col.type === "datetime") return formatDateTime(value);
|
|
3979
4202
|
if (col.type === "multiSelect" || Array.isArray(value) || typeof value === "string" && value.trim().startsWith("[")) {
|
|
@@ -4154,6 +4377,9 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
4154
4377
|
const [bulkDialogOpen, setBulkDialogOpen] = React26.useState(false);
|
|
4155
4378
|
const [isRefetching, setIsRefetching] = React26.useState(false);
|
|
4156
4379
|
const [roleOptions, setRoleOptions] = React26.useState([]);
|
|
4380
|
+
const [inviteDialog, setInviteDialog] = React26.useState(null);
|
|
4381
|
+
const [sendingInviteEmail, setSendingInviteEmail] = React26.useState(false);
|
|
4382
|
+
const [linkCopied, setLinkCopied] = React26.useState(false);
|
|
4157
4383
|
const hasLoadedRef = React26.useRef(false);
|
|
4158
4384
|
const isMobile = useIsMobile();
|
|
4159
4385
|
const showGroupColumn = !!manageUserGroups && roleOptions.length > 0;
|
|
@@ -4612,22 +4838,77 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
4612
4838
|
method: "POST",
|
|
4613
4839
|
headers: {
|
|
4614
4840
|
"Content-Type": "application/json"
|
|
4615
|
-
}
|
|
4841
|
+
},
|
|
4842
|
+
body: JSON.stringify({
|
|
4843
|
+
sendEmail: true,
|
|
4844
|
+
rotate: true
|
|
4845
|
+
})
|
|
4616
4846
|
});
|
|
4617
4847
|
if (!res.ok) {
|
|
4618
4848
|
const error2 = await res.json();
|
|
4619
|
-
throw new Error(error2.error || "Failed to
|
|
4849
|
+
throw new Error(error2.error || "Failed to resend invite");
|
|
4620
4850
|
}
|
|
4621
4851
|
const result = await res.json();
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
sonner.toast.success(`New invite link generated.${note}`);
|
|
4625
|
-
}
|
|
4852
|
+
sonner.toast.success(result.message || "Invite resent. Previous invite link is no longer valid.");
|
|
4853
|
+
setRefreshKey((k) => k + 1);
|
|
4626
4854
|
} catch (error2) {
|
|
4627
4855
|
console.error("Error regenerating invite:", error2);
|
|
4628
|
-
sonner.toast.error(error2 instanceof Error ? error2.message : "Failed to
|
|
4856
|
+
sonner.toast.error(error2 instanceof Error ? error2.message : "Failed to resend invite");
|
|
4629
4857
|
}
|
|
4630
4858
|
}, "handleRegenerateInvite");
|
|
4859
|
+
const copyInviteLink = /* @__PURE__ */ __name(async () => {
|
|
4860
|
+
const inviteLink = inviteDialog?.inviteLink;
|
|
4861
|
+
if (!inviteLink) {
|
|
4862
|
+
sonner.toast.error("Invite link is not available");
|
|
4863
|
+
return;
|
|
4864
|
+
}
|
|
4865
|
+
try {
|
|
4866
|
+
await navigator.clipboard.writeText(inviteLink);
|
|
4867
|
+
setLinkCopied(true);
|
|
4868
|
+
sonner.toast.success("Invite link copied");
|
|
4869
|
+
window.setTimeout(() => setLinkCopied(false), 2e3);
|
|
4870
|
+
} catch {
|
|
4871
|
+
sonner.toast.error("Could not copy invite link");
|
|
4872
|
+
}
|
|
4873
|
+
}, "copyInviteLink");
|
|
4874
|
+
const sendInviteEmailFromDialog = /* @__PURE__ */ __name(async () => {
|
|
4875
|
+
if (!inviteDialog) return;
|
|
4876
|
+
setSendingInviteEmail(true);
|
|
4877
|
+
try {
|
|
4878
|
+
const res = await fetch(`/api/users/${inviteDialog.userId}/regenerate-invite`, {
|
|
4879
|
+
method: "POST",
|
|
4880
|
+
headers: {
|
|
4881
|
+
"Content-Type": "application/json"
|
|
4882
|
+
},
|
|
4883
|
+
body: JSON.stringify({
|
|
4884
|
+
sendEmail: true,
|
|
4885
|
+
rotate: false
|
|
4886
|
+
})
|
|
4887
|
+
});
|
|
4888
|
+
const data2 = await res.json();
|
|
4889
|
+
if (!res.ok) {
|
|
4890
|
+
sonner.toast.error(data2.error || data2.message || "Failed to send invite email");
|
|
4891
|
+
return;
|
|
4892
|
+
}
|
|
4893
|
+
const nextLink = typeof data2.inviteLink === "string" ? data2.inviteLink.trim() : "";
|
|
4894
|
+
if (nextLink) {
|
|
4895
|
+
setInviteDialog((prev) => prev ? {
|
|
4896
|
+
...prev,
|
|
4897
|
+
inviteLink: nextLink
|
|
4898
|
+
} : prev);
|
|
4899
|
+
}
|
|
4900
|
+
sonner.toast.success(data2.emailSent ? "Invite email sent" : data2.message || "Invite email queued");
|
|
4901
|
+
} catch {
|
|
4902
|
+
sonner.toast.error("Failed to send invite email");
|
|
4903
|
+
} finally {
|
|
4904
|
+
setSendingInviteEmail(false);
|
|
4905
|
+
}
|
|
4906
|
+
}, "sendInviteEmailFromDialog");
|
|
4907
|
+
const closeInviteDialog = /* @__PURE__ */ __name(() => {
|
|
4908
|
+
setInviteDialog(null);
|
|
4909
|
+
setLinkCopied(false);
|
|
4910
|
+
setRefreshKey((k) => k + 1);
|
|
4911
|
+
}, "closeInviteDialog");
|
|
4631
4912
|
const addEditPage = addEditPageUrl && addEditPageUrl.length > 0;
|
|
4632
4913
|
const createQueryString = React26.useMemo(() => {
|
|
4633
4914
|
if (!createQueryParams || Object.keys(createQueryParams).length === 0) return "";
|
|
@@ -4905,11 +5186,11 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
4905
5186
|
onClick: /* @__PURE__ */ __name(() => handleDuplicateClick(item), "onClick")
|
|
4906
5187
|
}, /* @__PURE__ */ React.createElement(LucideIcons.Copy, {
|
|
4907
5188
|
className: "h-4 w-4 mr-2"
|
|
4908
|
-
}), "Duplicate")), resourceName === "users" && /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
5189
|
+
}), "Duplicate")), resourceName === "users" && String(item.inviteStatus ?? "") === "pending" && /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
4909
5190
|
onClick: /* @__PURE__ */ __name(() => handleRegenerateInvite(Number(item.id)), "onClick")
|
|
4910
5191
|
}, /* @__PURE__ */ React.createElement(LucideIcons.RefreshCw, {
|
|
4911
5192
|
className: "h-4 w-4 mr-2"
|
|
4912
|
-
}), "
|
|
5193
|
+
}), "Resend invite"), /* @__PURE__ */ React.createElement(DropdownMenuItem, {
|
|
4913
5194
|
onClick: /* @__PURE__ */ __name(() => handleDeleteClick(item), "onClick"),
|
|
4914
5195
|
className: "text-red-600 focus:text-red-600"
|
|
4915
5196
|
}, /* @__PURE__ */ React.createElement(LucideIcons.Trash2, {
|
|
@@ -5013,17 +5294,17 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
5013
5294
|
className: "h-3.5 w-3.5"
|
|
5014
5295
|
}), /* @__PURE__ */ React.createElement("span", {
|
|
5015
5296
|
className: "sr-only"
|
|
5016
|
-
}, "Duplicate")), resourceName === "users" && /* @__PURE__ */ React.createElement(Button, {
|
|
5297
|
+
}, "Duplicate")), resourceName === "users" && String(item.inviteStatus ?? "") === "pending" && /* @__PURE__ */ React.createElement(Button, {
|
|
5017
5298
|
variant: "outline",
|
|
5018
5299
|
size: "icon",
|
|
5019
5300
|
className: "h-7 w-7",
|
|
5020
5301
|
onClick: /* @__PURE__ */ __name(() => handleRegenerateInvite(Number(item.id)), "onClick"),
|
|
5021
|
-
title: "
|
|
5302
|
+
title: "Resend invite"
|
|
5022
5303
|
}, /* @__PURE__ */ React.createElement(LucideIcons.RefreshCw, {
|
|
5023
5304
|
className: "h-3.5 w-3.5"
|
|
5024
5305
|
}), /* @__PURE__ */ React.createElement("span", {
|
|
5025
5306
|
className: "sr-only"
|
|
5026
|
-
}, "
|
|
5307
|
+
}, "Resend invite")), /* @__PURE__ */ React.createElement(Button, {
|
|
5027
5308
|
variant: "outline",
|
|
5028
5309
|
size: "icon",
|
|
5029
5310
|
className: "h-7 w-7 border-red-300 text-red-600 hover:text-red-700",
|
|
@@ -5072,12 +5353,55 @@ function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPage
|
|
|
5072
5353
|
setIsFormOpen(false);
|
|
5073
5354
|
setRefreshKey((k) => k + 1);
|
|
5074
5355
|
}, "onClose"),
|
|
5356
|
+
onSaveSuccess: /* @__PURE__ */ __name((result) => {
|
|
5357
|
+
if (resourceName === "users" && result && typeof result.inviteLink === "string" && result.inviteLink.trim() && !editingItem) {
|
|
5358
|
+
const userId = Number(result.user?.id ?? result.id);
|
|
5359
|
+
const inviteLink = result.inviteLink.trim();
|
|
5360
|
+
if (Number.isFinite(userId) && userId > 0) {
|
|
5361
|
+
setLinkCopied(false);
|
|
5362
|
+
setInviteDialog({
|
|
5363
|
+
userId,
|
|
5364
|
+
inviteLink
|
|
5365
|
+
});
|
|
5366
|
+
sonner.toast.success(typeof result.message === "string" ? result.message : "User created successfully");
|
|
5367
|
+
return;
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
setRefreshKey((k) => k + 1);
|
|
5371
|
+
}, "onSaveSuccess"),
|
|
5075
5372
|
apiEndpoint,
|
|
5076
5373
|
columns,
|
|
5077
5374
|
existingData: editingItem,
|
|
5078
5375
|
duplicateSeed,
|
|
5079
5376
|
resource: resourceName
|
|
5080
5377
|
}), /* @__PURE__ */ React.createElement(Dialog, {
|
|
5378
|
+
open: inviteDialog != null,
|
|
5379
|
+
onOpenChange: /* @__PURE__ */ __name((open) => {
|
|
5380
|
+
if (!open) closeInviteDialog();
|
|
5381
|
+
}, "onOpenChange")
|
|
5382
|
+
}, /* @__PURE__ */ React.createElement(DialogContent, {
|
|
5383
|
+
className: "max-w-md"
|
|
5384
|
+
}, /* @__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", {
|
|
5385
|
+
className: "flex flex-col gap-2 py-2"
|
|
5386
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
5387
|
+
type: "button",
|
|
5388
|
+
disabled: sendingInviteEmail,
|
|
5389
|
+
onClick: /* @__PURE__ */ __name(() => void sendInviteEmailFromDialog(), "onClick")
|
|
5390
|
+
}, /* @__PURE__ */ React.createElement(LucideIcons.Mail, {
|
|
5391
|
+
className: "h-4 w-4 mr-2"
|
|
5392
|
+
}), sendingInviteEmail ? "Sending\u2026" : "Send email"), /* @__PURE__ */ React.createElement(Button, {
|
|
5393
|
+
type: "button",
|
|
5394
|
+
variant: "outline",
|
|
5395
|
+
onClick: /* @__PURE__ */ __name(() => void copyInviteLink(), "onClick")
|
|
5396
|
+
}, linkCopied ? /* @__PURE__ */ React.createElement(LucideIcons.Check, {
|
|
5397
|
+
className: "h-4 w-4 mr-2"
|
|
5398
|
+
}) : /* @__PURE__ */ React.createElement(LucideIcons.Copy, {
|
|
5399
|
+
className: "h-4 w-4 mr-2"
|
|
5400
|
+
}), linkCopied ? "Copied" : "Copy invite link")), /* @__PURE__ */ React.createElement(DialogFooter, null, /* @__PURE__ */ React.createElement(Button, {
|
|
5401
|
+
type: "button",
|
|
5402
|
+
variant: "secondary",
|
|
5403
|
+
onClick: closeInviteDialog
|
|
5404
|
+
}, "Done")))), /* @__PURE__ */ React.createElement(Dialog, {
|
|
5081
5405
|
open: deleteDialogOpen,
|
|
5082
5406
|
onOpenChange: /* @__PURE__ */ __name((open) => {
|
|
5083
5407
|
console.debug("[CRUD][delete] dialog onOpenChange", {
|
|
@@ -7803,155 +8127,6 @@ var init_ComponentSettings = __esm({
|
|
|
7803
8127
|
__name(ComponentSettings, "ComponentSettings");
|
|
7804
8128
|
}
|
|
7805
8129
|
});
|
|
7806
|
-
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 }) {
|
|
7807
|
-
const fileInputRef = React26.useRef(null);
|
|
7808
|
-
const [isUploading, setIsUploading] = React26.useState(false);
|
|
7809
|
-
const [error, setError] = React26.useState(null);
|
|
7810
|
-
const [lightboxOpen, setLightboxOpen] = React26.useState(false);
|
|
7811
|
-
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";
|
|
7812
|
-
const closeLightbox = React26.useCallback(() => setLightboxOpen(false), []);
|
|
7813
|
-
React26.useEffect(() => {
|
|
7814
|
-
if (!lightboxOpen) return;
|
|
7815
|
-
const onKeyDown = /* @__PURE__ */ __name((e) => {
|
|
7816
|
-
if (e.key === "Escape") closeLightbox();
|
|
7817
|
-
}, "onKeyDown");
|
|
7818
|
-
window.addEventListener("keydown", onKeyDown);
|
|
7819
|
-
const prevOverflow = document.body.style.overflow;
|
|
7820
|
-
document.body.style.overflow = "hidden";
|
|
7821
|
-
return () => {
|
|
7822
|
-
window.removeEventListener("keydown", onKeyDown);
|
|
7823
|
-
document.body.style.overflow = prevOverflow;
|
|
7824
|
-
};
|
|
7825
|
-
}, [
|
|
7826
|
-
lightboxOpen,
|
|
7827
|
-
closeLightbox
|
|
7828
|
-
]);
|
|
7829
|
-
const handleUpload = React26.useCallback(async (file) => {
|
|
7830
|
-
setError(null);
|
|
7831
|
-
if (!ACCEPTED_TYPES.includes(file.type)) {
|
|
7832
|
-
setError(`Unsupported file type. Use: ${ACCEPTED_TYPES.map((t) => t.replace("image/", "")).join(", ")}`);
|
|
7833
|
-
return;
|
|
7834
|
-
}
|
|
7835
|
-
if (file.size > maxSizeMb * 1024 * 1024) {
|
|
7836
|
-
setError(`File must be under ${maxSizeMb}MB`);
|
|
7837
|
-
return;
|
|
7838
|
-
}
|
|
7839
|
-
setIsUploading(true);
|
|
7840
|
-
try {
|
|
7841
|
-
const formData = new FormData();
|
|
7842
|
-
formData.append("file", file);
|
|
7843
|
-
const response = await fetch("/api/upload", {
|
|
7844
|
-
method: "POST",
|
|
7845
|
-
body: formData
|
|
7846
|
-
});
|
|
7847
|
-
const data = await response.json();
|
|
7848
|
-
if (!response.ok) {
|
|
7849
|
-
throw new Error(data.error || data.details || "Upload failed");
|
|
7850
|
-
}
|
|
7851
|
-
onChange(data.filePath ?? "");
|
|
7852
|
-
} catch (err) {
|
|
7853
|
-
setError(err instanceof Error ? err.message : "Upload failed");
|
|
7854
|
-
} finally {
|
|
7855
|
-
setIsUploading(false);
|
|
7856
|
-
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
7857
|
-
}
|
|
7858
|
-
}, [
|
|
7859
|
-
maxSizeMb,
|
|
7860
|
-
onChange
|
|
7861
|
-
]);
|
|
7862
|
-
const onFileChange = React26.useCallback((e) => {
|
|
7863
|
-
const file = e.target.files?.[0];
|
|
7864
|
-
if (file) void handleUpload(file);
|
|
7865
|
-
}, [
|
|
7866
|
-
handleUpload
|
|
7867
|
-
]);
|
|
7868
|
-
const trimmed = value.trim();
|
|
7869
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
7870
|
-
className: "space-y-2"
|
|
7871
|
-
}, /* @__PURE__ */ React.createElement("label", {
|
|
7872
|
-
className: labelClassName
|
|
7873
|
-
}, label), trimmed ? /* @__PURE__ */ React.createElement("div", {
|
|
7874
|
-
className: "flex items-start gap-3"
|
|
7875
|
-
}, /* @__PURE__ */ React.createElement("img", {
|
|
7876
|
-
src: trimmed,
|
|
7877
|
-
alt: label,
|
|
7878
|
-
className: previewCls,
|
|
7879
|
-
role: "button",
|
|
7880
|
-
tabIndex: 0,
|
|
7881
|
-
title: "Click to enlarge",
|
|
7882
|
-
onClick: /* @__PURE__ */ __name(() => setLightboxOpen(true), "onClick"),
|
|
7883
|
-
onKeyDown: /* @__PURE__ */ __name((e) => {
|
|
7884
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
7885
|
-
e.preventDefault();
|
|
7886
|
-
setLightboxOpen(true);
|
|
7887
|
-
}
|
|
7888
|
-
}, "onKeyDown"),
|
|
7889
|
-
onError: /* @__PURE__ */ __name((e) => {
|
|
7890
|
-
e.currentTarget.style.display = "none";
|
|
7891
|
-
}, "onError")
|
|
7892
|
-
}), /* @__PURE__ */ React.createElement("button", {
|
|
7893
|
-
type: "button",
|
|
7894
|
-
onClick: /* @__PURE__ */ __name(() => onChange(""), "onClick"),
|
|
7895
|
-
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"
|
|
7896
|
-
}, /* @__PURE__ */ React.createElement(LucideIcons.X, {
|
|
7897
|
-
className: "h-3 w-3"
|
|
7898
|
-
}), "Clear")) : null, /* @__PURE__ */ React.createElement("div", {
|
|
7899
|
-
className: "flex flex-wrap gap-2"
|
|
7900
|
-
}, /* @__PURE__ */ React.createElement("input", {
|
|
7901
|
-
type: "url",
|
|
7902
|
-
value,
|
|
7903
|
-
onChange: /* @__PURE__ */ __name((e) => {
|
|
7904
|
-
setError(null);
|
|
7905
|
-
onChange(e.target.value);
|
|
7906
|
-
}, "onChange"),
|
|
7907
|
-
placeholder,
|
|
7908
|
-
className: `${inputClassName} min-w-0 flex-1`
|
|
7909
|
-
}), /* @__PURE__ */ React.createElement("input", {
|
|
7910
|
-
ref: fileInputRef,
|
|
7911
|
-
type: "file",
|
|
7912
|
-
accept: ACCEPTED_TYPES.join(","),
|
|
7913
|
-
onChange: onFileChange,
|
|
7914
|
-
className: "hidden",
|
|
7915
|
-
disabled: isUploading
|
|
7916
|
-
}), /* @__PURE__ */ React.createElement("button", {
|
|
7917
|
-
type: "button",
|
|
7918
|
-
onClick: /* @__PURE__ */ __name(() => fileInputRef.current?.click(), "onClick"),
|
|
7919
|
-
disabled: isUploading,
|
|
7920
|
-
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"
|
|
7921
|
-
}, /* @__PURE__ */ React.createElement(LucideIcons.Upload, {
|
|
7922
|
-
className: "h-3.5 w-3.5"
|
|
7923
|
-
}), isUploading ? "Uploading\u2026" : "Upload")), error ? /* @__PURE__ */ React.createElement("p", {
|
|
7924
|
-
className: "flex items-center gap-1.5 text-xs text-red-600"
|
|
7925
|
-
}, /* @__PURE__ */ React.createElement(LucideIcons.AlertCircle, {
|
|
7926
|
-
className: "h-3.5 w-3.5 shrink-0"
|
|
7927
|
-
}), error) : /* @__PURE__ */ React.createElement("p", {
|
|
7928
|
-
className: "text-xs text-gray-500"
|
|
7929
|
-
}, "Paste a URL or upload an image (PNG, JPG, GIF, WEBP up to ", maxSizeMb, "MB)"), lightboxOpen && trimmed ? /* @__PURE__ */ React.createElement("div", {
|
|
7930
|
-
className: "fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-4",
|
|
7931
|
-
role: "dialog",
|
|
7932
|
-
"aria-modal": "true",
|
|
7933
|
-
"aria-label": `${label} preview`,
|
|
7934
|
-
onClick: closeLightbox
|
|
7935
|
-
}, /* @__PURE__ */ React.createElement("img", {
|
|
7936
|
-
src: trimmed,
|
|
7937
|
-
alt: label,
|
|
7938
|
-
className: "max-h-[90vh] max-w-[90vw] rounded-md object-contain shadow-lg",
|
|
7939
|
-
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick")
|
|
7940
|
-
})) : null);
|
|
7941
|
-
}
|
|
7942
|
-
var ACCEPTED_TYPES;
|
|
7943
|
-
var init_ImageOrUrlField = __esm({
|
|
7944
|
-
"src/components/Admin/ImageOrUrlField.tsx"() {
|
|
7945
|
-
"use client";
|
|
7946
|
-
ACCEPTED_TYPES = [
|
|
7947
|
-
"image/jpeg",
|
|
7948
|
-
"image/png",
|
|
7949
|
-
"image/gif",
|
|
7950
|
-
"image/webp"
|
|
7951
|
-
];
|
|
7952
|
-
__name(ImageOrUrlField, "ImageOrUrlField");
|
|
7953
|
-
}
|
|
7954
|
-
});
|
|
7955
8130
|
function generateId() {
|
|
7956
8131
|
return `nav_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
|
|
7957
8132
|
}
|
|
@@ -8951,7 +9126,7 @@ var init_AuthFooter = __esm({
|
|
|
8951
9126
|
});
|
|
8952
9127
|
function AuthPageLayout({ children }) {
|
|
8953
9128
|
return /* @__PURE__ */ React.createElement("div", {
|
|
8954
|
-
className: "min-h-screen flex flex-col bg-gray-50
|
|
9129
|
+
className: "min-h-screen flex flex-col bg-gray-50"
|
|
8955
9130
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
8956
9131
|
className: "flex-1 flex items-center justify-center px-4 py-6"
|
|
8957
9132
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -8992,6 +9167,7 @@ var init_SignInPage = __esm({
|
|
|
8992
9167
|
const [email, setEmail] = React26.useState("");
|
|
8993
9168
|
const [password, setPassword] = React26.useState("");
|
|
8994
9169
|
const [error, setError] = React26.useState("");
|
|
9170
|
+
const [success, setSuccess] = React26.useState("");
|
|
8995
9171
|
const [loading, setLoading] = React26.useState(false);
|
|
8996
9172
|
const { status } = react.useSession();
|
|
8997
9173
|
const searchParams = navigation.useSearchParams();
|
|
@@ -8999,6 +9175,9 @@ var init_SignInPage = __esm({
|
|
|
8999
9175
|
if (searchParams.get("error")) {
|
|
9000
9176
|
setError("Invalid email or password");
|
|
9001
9177
|
}
|
|
9178
|
+
if (searchParams.get("activated") === "1") {
|
|
9179
|
+
setSuccess("Account activated. Sign in with your new password.");
|
|
9180
|
+
}
|
|
9002
9181
|
}, [
|
|
9003
9182
|
searchParams
|
|
9004
9183
|
]);
|
|
@@ -9059,41 +9238,45 @@ var init_SignInPage = __esm({
|
|
|
9059
9238
|
}
|
|
9060
9239
|
}, "handleSubmit");
|
|
9061
9240
|
return /* @__PURE__ */ React.createElement(AuthPageLayout, null, /* @__PURE__ */ React.createElement("div", {
|
|
9062
|
-
className: "w-full shadow-md rounded-lg bg-white
|
|
9241
|
+
className: "w-full shadow-md rounded-lg bg-white px-4 py-6 sm:px-6 sm:py-8"
|
|
9063
9242
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
9064
|
-
className: "mb-1 text-center text-xl font-bold text-black
|
|
9243
|
+
className: "mb-1 text-center text-xl font-bold text-black sm:text-2xl"
|
|
9065
9244
|
}, "Sign in"), /* @__PURE__ */ React.createElement("p", {
|
|
9066
9245
|
className: "mb-6 text-center text-sm text-body-color"
|
|
9067
|
-
}, "Enter your credentials"),
|
|
9068
|
-
className: "mb-4 rounded-md bg-
|
|
9246
|
+
}, "Enter your credentials"), success && /* @__PURE__ */ React.createElement("div", {
|
|
9247
|
+
className: "mb-4 rounded-md bg-green-50 p-3 text-sm text-green-700"
|
|
9248
|
+
}, success), error && /* @__PURE__ */ React.createElement("div", {
|
|
9249
|
+
className: "mb-4 rounded-md bg-red-50 p-3 text-sm text-red-600"
|
|
9069
9250
|
}, error), /* @__PURE__ */ React.createElement("form", {
|
|
9070
9251
|
onSubmit: handleSubmit
|
|
9071
9252
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
9072
9253
|
className: "mb-4"
|
|
9073
9254
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
9074
9255
|
htmlFor: "email",
|
|
9075
|
-
className: "mb-1.5 block text-sm text-
|
|
9256
|
+
className: "mb-1.5 block text-sm text-gray-900"
|
|
9076
9257
|
}, "Email"), /* @__PURE__ */ React.createElement("input", {
|
|
9077
9258
|
type: "email",
|
|
9078
9259
|
name: "email",
|
|
9260
|
+
id: "email",
|
|
9079
9261
|
value: email,
|
|
9080
9262
|
onChange: /* @__PURE__ */ __name((e) => setEmail(e.target.value), "onChange"),
|
|
9081
9263
|
placeholder: "Enter email",
|
|
9082
9264
|
required: true,
|
|
9083
|
-
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
|
|
9265
|
+
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"
|
|
9084
9266
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
9085
9267
|
className: "mb-4"
|
|
9086
9268
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
9087
9269
|
htmlFor: "password",
|
|
9088
|
-
className: "mb-1.5 block text-sm text-
|
|
9270
|
+
className: "mb-1.5 block text-sm text-gray-900"
|
|
9089
9271
|
}, "Password"), /* @__PURE__ */ React.createElement("input", {
|
|
9090
9272
|
type: "password",
|
|
9091
9273
|
name: "password",
|
|
9274
|
+
id: "password",
|
|
9092
9275
|
value: password,
|
|
9093
9276
|
onChange: /* @__PURE__ */ __name((e) => setPassword(e.target.value), "onChange"),
|
|
9094
9277
|
placeholder: "Enter password",
|
|
9095
9278
|
required: true,
|
|
9096
|
-
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
|
|
9279
|
+
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"
|
|
9097
9280
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
9098
9281
|
className: "mb-4 flex items-center justify-between"
|
|
9099
9282
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
@@ -9107,7 +9290,7 @@ var init_SignInPage = __esm({
|
|
|
9107
9290
|
}, "Forgot password?")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("button", {
|
|
9108
9291
|
type: "submit",
|
|
9109
9292
|
disabled: loading,
|
|
9110
|
-
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
|
|
9293
|
+
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"
|
|
9111
9294
|
}, loading ? "Signing in..." : "Sign in")))));
|
|
9112
9295
|
}, "SigninPage");
|
|
9113
9296
|
exports.AdminSignInPage = SigninPage;
|
|
@@ -9151,11 +9334,11 @@ function ForgotPasswordPage() {
|
|
|
9151
9334
|
}
|
|
9152
9335
|
}, "handleSubmit");
|
|
9153
9336
|
return /* @__PURE__ */ React.createElement(AuthPageLayout, null, /* @__PURE__ */ React.createElement("div", {
|
|
9154
|
-
className: "w-full space-y-4 p-5 sm:p-6 bg-white
|
|
9337
|
+
className: "w-full space-y-4 p-5 sm:p-6 bg-white rounded-lg shadow-md"
|
|
9155
9338
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
9156
9339
|
className: "text-center"
|
|
9157
9340
|
}, /* @__PURE__ */ React.createElement("h2", {
|
|
9158
|
-
className: "text-xl font-bold text-gray-900
|
|
9341
|
+
className: "text-xl font-bold text-gray-900"
|
|
9159
9342
|
}, "Forgot password"), /* @__PURE__ */ React.createElement("p", {
|
|
9160
9343
|
className: "mt-1 text-sm text-body-color"
|
|
9161
9344
|
}, "Enter your email for a reset link.")), /* @__PURE__ */ React.createElement("form", {
|
|
@@ -9173,7 +9356,7 @@ function ForgotPasswordPage() {
|
|
|
9173
9356
|
placeholder: "you@example.com",
|
|
9174
9357
|
className: "mt-1 h-9 text-sm"
|
|
9175
9358
|
})), message && /* @__PURE__ */ React.createElement("div", {
|
|
9176
|
-
className: `p-2.5 rounded-md text-sm ${message.includes("receive") ? "bg-green-50
|
|
9359
|
+
className: `p-2.5 rounded-md text-sm ${message.includes("receive") ? "bg-green-50 text-green-700" : "bg-red-50 text-red-700"}`
|
|
9177
9360
|
}, message), /* @__PURE__ */ React.createElement(Button, {
|
|
9178
9361
|
type: "submit",
|
|
9179
9362
|
disabled: loading,
|
|
@@ -9256,9 +9439,9 @@ function ResetPasswordPageContent() {
|
|
|
9256
9439
|
}, "handleSubmit");
|
|
9257
9440
|
if (!token) {
|
|
9258
9441
|
return /* @__PURE__ */ React.createElement(AuthPageLayout, null, /* @__PURE__ */ React.createElement("div", {
|
|
9259
|
-
className: "w-full space-y-4 p-5 sm:p-6 bg-white
|
|
9442
|
+
className: "w-full space-y-4 p-5 sm:p-6 bg-white rounded-lg shadow-md text-center"
|
|
9260
9443
|
}, /* @__PURE__ */ React.createElement("h2", {
|
|
9261
|
-
className: "text-xl font-bold text-gray-900
|
|
9444
|
+
className: "text-xl font-bold text-gray-900"
|
|
9262
9445
|
}, "Invalid reset link"), /* @__PURE__ */ React.createElement("p", {
|
|
9263
9446
|
className: "text-sm text-body-color"
|
|
9264
9447
|
}, message), /* @__PURE__ */ React.createElement(Link2__default.default, {
|
|
@@ -9267,11 +9450,11 @@ function ResetPasswordPageContent() {
|
|
|
9267
9450
|
}, "Request a new link")));
|
|
9268
9451
|
}
|
|
9269
9452
|
return /* @__PURE__ */ React.createElement(AuthPageLayout, null, /* @__PURE__ */ React.createElement("div", {
|
|
9270
|
-
className: "w-full space-y-4 p-5 sm:p-6 bg-white
|
|
9453
|
+
className: "w-full space-y-4 p-5 sm:p-6 bg-white rounded-lg shadow-md"
|
|
9271
9454
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
9272
9455
|
className: "text-center"
|
|
9273
9456
|
}, /* @__PURE__ */ React.createElement("h2", {
|
|
9274
|
-
className: "text-xl font-bold text-gray-900
|
|
9457
|
+
className: "text-xl font-bold text-gray-900"
|
|
9275
9458
|
}, "Set new password"), /* @__PURE__ */ React.createElement("p", {
|
|
9276
9459
|
className: "mt-1 text-sm text-body-color"
|
|
9277
9460
|
}, "Enter your new password.")), /* @__PURE__ */ React.createElement("form", {
|
|
@@ -9306,7 +9489,7 @@ function ResetPasswordPageContent() {
|
|
|
9306
9489
|
}), "onChange"),
|
|
9307
9490
|
className: "mt-1 h-9 text-sm"
|
|
9308
9491
|
})), message && /* @__PURE__ */ React.createElement("div", {
|
|
9309
|
-
className: `p-2.5 rounded-md text-sm ${message.includes("successfully") || message.includes("now sign in") ? "bg-green-50
|
|
9492
|
+
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"}`
|
|
9310
9493
|
}, message), /* @__PURE__ */ React.createElement(Button, {
|
|
9311
9494
|
type: "submit",
|
|
9312
9495
|
disabled: loading,
|
|
@@ -9321,7 +9504,7 @@ function ResetPasswordPageContent() {
|
|
|
9321
9504
|
function ResetPasswordPage() {
|
|
9322
9505
|
return /* @__PURE__ */ React.createElement(React26.Suspense, {
|
|
9323
9506
|
fallback: /* @__PURE__ */ React.createElement("div", {
|
|
9324
|
-
className: "min-h-screen flex items-center justify-center bg-gray-50
|
|
9507
|
+
className: "min-h-screen flex items-center justify-center bg-gray-50"
|
|
9325
9508
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
9326
9509
|
className: "max-w-[400px] w-full p-6 text-center"
|
|
9327
9510
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -9349,6 +9532,7 @@ __export(InvitePage_exports, {
|
|
|
9349
9532
|
default: () => InvitePage
|
|
9350
9533
|
});
|
|
9351
9534
|
function InvitePageContent() {
|
|
9535
|
+
const router = navigation.useRouter();
|
|
9352
9536
|
const searchParams = navigation.useSearchParams();
|
|
9353
9537
|
const token = searchParams.get("token");
|
|
9354
9538
|
const [formData, setFormData] = React26.useState({
|
|
@@ -9375,8 +9559,13 @@ function InvitePageContent() {
|
|
|
9375
9559
|
setInviteValid(true);
|
|
9376
9560
|
setMessage("");
|
|
9377
9561
|
} else {
|
|
9562
|
+
const err = typeof result.error === "string" ? result.error : "";
|
|
9563
|
+
if (/already (active|accepted)/i.test(err)) {
|
|
9564
|
+
router.replace("/admin/signin?activated=1");
|
|
9565
|
+
return;
|
|
9566
|
+
}
|
|
9378
9567
|
setInviteValid(false);
|
|
9379
|
-
setMessage(
|
|
9568
|
+
setMessage(err || "This invitation is no longer valid.");
|
|
9380
9569
|
}
|
|
9381
9570
|
} catch {
|
|
9382
9571
|
if (!cancelled) {
|
|
@@ -9418,11 +9607,8 @@ function InvitePageContent() {
|
|
|
9418
9607
|
});
|
|
9419
9608
|
const result = await res.json();
|
|
9420
9609
|
if (res.ok) {
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
password: "",
|
|
9424
|
-
confirmPassword: ""
|
|
9425
|
-
});
|
|
9610
|
+
router.replace("/admin/signin?activated=1");
|
|
9611
|
+
return;
|
|
9426
9612
|
} else {
|
|
9427
9613
|
setMessage(result.error || "Failed to activate account");
|
|
9428
9614
|
}
|
|
@@ -9488,7 +9674,7 @@ function InvitePageContent() {
|
|
|
9488
9674
|
}), "onChange"),
|
|
9489
9675
|
className: "mt-1 h-9 text-sm"
|
|
9490
9676
|
})), message && /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
9491
|
-
className:
|
|
9677
|
+
className: "p-2.5 rounded-md text-sm bg-red-50 text-red-700"
|
|
9492
9678
|
}, message), /* @__PURE__ */ React26__namespace.default.createElement(Button, {
|
|
9493
9679
|
type: "submit",
|
|
9494
9680
|
disabled: loading,
|
|
@@ -11254,6 +11440,15 @@ function renderListPrice(value, item) {
|
|
|
11254
11440
|
function renderListThumbnail(url) {
|
|
11255
11441
|
const trimmed = url.trim();
|
|
11256
11442
|
if (!trimmed) return "\u2014";
|
|
11443
|
+
if (isVideoMediaUrl(trimmed)) {
|
|
11444
|
+
return React26.createElement("video", {
|
|
11445
|
+
src: trimmed,
|
|
11446
|
+
muted: true,
|
|
11447
|
+
playsInline: true,
|
|
11448
|
+
preload: "metadata",
|
|
11449
|
+
className: "h-10 w-10 rounded border border-gray-200 bg-black object-cover"
|
|
11450
|
+
});
|
|
11451
|
+
}
|
|
11257
11452
|
return React26.createElement("img", {
|
|
11258
11453
|
src: trimmed,
|
|
11259
11454
|
alt: "",
|
|
@@ -11274,6 +11469,7 @@ function productListImageUrl(item) {
|
|
|
11274
11469
|
exports.STORE_CRUD_CONFIGS = void 0;
|
|
11275
11470
|
var init_store_crud_configs = __esm({
|
|
11276
11471
|
"src/admin/store-crud-configs.ts"() {
|
|
11472
|
+
init_media_url();
|
|
11277
11473
|
__name(renderListPrice, "renderListPrice");
|
|
11278
11474
|
__name(renderListThumbnail, "renderListThumbnail");
|
|
11279
11475
|
__name(productListImageUrl, "productListImageUrl");
|
|
@@ -11486,6 +11682,10 @@ var init_store_crud_configs = __esm({
|
|
|
11486
11682
|
field: "name",
|
|
11487
11683
|
displayName: "Name"
|
|
11488
11684
|
},
|
|
11685
|
+
{
|
|
11686
|
+
field: "slug",
|
|
11687
|
+
displayName: "Slug"
|
|
11688
|
+
},
|
|
11489
11689
|
{
|
|
11490
11690
|
field: "eventId",
|
|
11491
11691
|
displayName: "Event",
|
|
@@ -11976,9 +12176,17 @@ var init_store_crud_configs = __esm({
|
|
|
11976
12176
|
addEditPageUrl: "/admin/brands"
|
|
11977
12177
|
},
|
|
11978
12178
|
product_categories: {
|
|
11979
|
-
title: "
|
|
12179
|
+
title: "Categories",
|
|
11980
12180
|
apiEndpoint: "/api/product_categories",
|
|
11981
12181
|
columns: [
|
|
12182
|
+
{
|
|
12183
|
+
field: "image",
|
|
12184
|
+
displayName: "Image",
|
|
12185
|
+
type: "image",
|
|
12186
|
+
listFilter: false,
|
|
12187
|
+
placeholder: "Image URL or upload",
|
|
12188
|
+
render: /* @__PURE__ */ __name((value) => renderListThumbnail(typeof value === "string" ? value : ""), "render")
|
|
12189
|
+
},
|
|
11982
12190
|
{
|
|
11983
12191
|
field: "name",
|
|
11984
12192
|
displayName: "Name"
|
|
@@ -12585,6 +12793,134 @@ var SettingsPage_exports = {};
|
|
|
12585
12793
|
__export(SettingsPage_exports, {
|
|
12586
12794
|
default: () => SettingsPage
|
|
12587
12795
|
});
|
|
12796
|
+
function InvoiceTemplatePreview({ id }) {
|
|
12797
|
+
if (id === "modern") {
|
|
12798
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
12799
|
+
className: "h-28 rounded-md border border-slate-200 bg-white overflow-hidden shadow-sm"
|
|
12800
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12801
|
+
className: "h-7 bg-teal-700 px-2 flex flex-col justify-center"
|
|
12802
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12803
|
+
className: "h-1.5 w-14 rounded bg-white/90"
|
|
12804
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12805
|
+
className: "h-1 w-10 rounded bg-white/50 mt-1"
|
|
12806
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12807
|
+
className: "p-2 space-y-1.5"
|
|
12808
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12809
|
+
className: "flex gap-2"
|
|
12810
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12811
|
+
className: "flex-1 space-y-1"
|
|
12812
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12813
|
+
className: "h-1 w-8 bg-teal-600/70 rounded"
|
|
12814
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12815
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12816
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12817
|
+
className: "h-1 w-4/5 bg-slate-200 rounded"
|
|
12818
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12819
|
+
className: "flex-1 space-y-1"
|
|
12820
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12821
|
+
className: "h-1 w-8 bg-teal-600/70 rounded"
|
|
12822
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12823
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12824
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
12825
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12826
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12827
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12828
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12829
|
+
className: "ml-auto h-1.5 w-12 bg-teal-700/80 rounded"
|
|
12830
|
+
})));
|
|
12831
|
+
}
|
|
12832
|
+
if (id === "compact") {
|
|
12833
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
12834
|
+
className: "h-28 rounded-md border border-slate-300 bg-white overflow-hidden shadow-sm p-1.5 space-y-1"
|
|
12835
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12836
|
+
className: "h-4 bg-slate-100 rounded flex items-center px-1"
|
|
12837
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12838
|
+
className: "h-1 w-10 bg-slate-700 rounded"
|
|
12839
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12840
|
+
className: "grid grid-cols-4 gap-0.5"
|
|
12841
|
+
}, Array.from({
|
|
12842
|
+
length: 8
|
|
12843
|
+
}).map((_, i) => /* @__PURE__ */ React.createElement("div", {
|
|
12844
|
+
key: i,
|
|
12845
|
+
className: "h-1 bg-slate-200 rounded"
|
|
12846
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
12847
|
+
className: "space-y-0.5"
|
|
12848
|
+
}, Array.from({
|
|
12849
|
+
length: 5
|
|
12850
|
+
}).map((_, i) => /* @__PURE__ */ React.createElement("div", {
|
|
12851
|
+
key: i,
|
|
12852
|
+
className: "flex gap-0.5"
|
|
12853
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12854
|
+
className: "h-1 flex-[3] bg-slate-200 rounded"
|
|
12855
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12856
|
+
className: "h-1 flex-1 bg-slate-300 rounded"
|
|
12857
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12858
|
+
className: "h-1 flex-1 bg-slate-300 rounded"
|
|
12859
|
+
})))), /* @__PURE__ */ React.createElement("div", {
|
|
12860
|
+
className: "ml-auto h-1 w-10 bg-slate-800 rounded"
|
|
12861
|
+
}));
|
|
12862
|
+
}
|
|
12863
|
+
if (id === "bold") {
|
|
12864
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
12865
|
+
className: "h-28 rounded-md border border-red-200 bg-white overflow-hidden shadow-sm"
|
|
12866
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12867
|
+
className: "h-9 bg-red-800 px-2 flex flex-col justify-center gap-1"
|
|
12868
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12869
|
+
className: "h-2 w-16 rounded bg-white"
|
|
12870
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12871
|
+
className: "h-1 w-12 rounded bg-white/60"
|
|
12872
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12873
|
+
className: "p-2 space-y-1.5"
|
|
12874
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12875
|
+
className: "h-1 w-20 bg-slate-300 rounded"
|
|
12876
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12877
|
+
className: "border border-red-100 rounded p-1 space-y-0.5 bg-red-50/40"
|
|
12878
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12879
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12880
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12881
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12882
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12883
|
+
className: "h-1.5 w-14 ml-auto bg-red-800 rounded"
|
|
12884
|
+
}))));
|
|
12885
|
+
}
|
|
12886
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
12887
|
+
className: "h-28 rounded-md border border-slate-200 bg-white overflow-hidden shadow-sm p-2 space-y-1.5"
|
|
12888
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12889
|
+
className: "h-5 rounded bg-slate-100 px-1.5 flex items-center justify-between"
|
|
12890
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12891
|
+
className: "h-1.5 w-12 bg-slate-700 rounded"
|
|
12892
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12893
|
+
className: "h-1 w-8 bg-slate-400 rounded"
|
|
12894
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12895
|
+
className: "flex gap-2"
|
|
12896
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12897
|
+
className: "flex-1 space-y-0.5"
|
|
12898
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12899
|
+
className: "h-1 w-6 bg-slate-600 rounded"
|
|
12900
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12901
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12902
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12903
|
+
className: "h-1 w-3/4 bg-slate-200 rounded"
|
|
12904
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12905
|
+
className: "flex-1 space-y-0.5"
|
|
12906
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12907
|
+
className: "h-1 w-6 bg-slate-600 rounded"
|
|
12908
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12909
|
+
className: "h-1 w-full bg-slate-200 rounded"
|
|
12910
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
12911
|
+
className: "border-t border-slate-200 pt-1 space-y-0.5"
|
|
12912
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12913
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12914
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12915
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12916
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
12917
|
+
className: "h-1 w-full bg-slate-100 rounded"
|
|
12918
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
12919
|
+
className: "flex justify-end"
|
|
12920
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
12921
|
+
className: "h-1.5 w-10 bg-slate-700 rounded"
|
|
12922
|
+
})));
|
|
12923
|
+
}
|
|
12588
12924
|
function hexToHsl(hex) {
|
|
12589
12925
|
const r = parseInt(hex.slice(1, 3), 16) / 255;
|
|
12590
12926
|
const g = parseInt(hex.slice(3, 5), 16) / 255;
|
|
@@ -12635,6 +12971,25 @@ function SettingsPage() {
|
|
|
12635
12971
|
const [requireEventApproval, setRequireEventApproval] = React26.useState(false);
|
|
12636
12972
|
const [storeSettingsLoading, setStoreSettingsLoading] = React26.useState(true);
|
|
12637
12973
|
const [currency, setCurrency] = React26.useState(DEFAULT_CURRENCY);
|
|
12974
|
+
const [invoiceTemplate, setInvoiceTemplate] = React26.useState("classic");
|
|
12975
|
+
const [companyLogo, setCompanyLogo] = React26.useState("");
|
|
12976
|
+
const [companyName, setCompanyName] = React26.useState("");
|
|
12977
|
+
const [companyEmail, setCompanyEmail] = React26.useState("");
|
|
12978
|
+
const [companyPhone, setCompanyPhone] = React26.useState("");
|
|
12979
|
+
const [companyAddress, setCompanyAddress] = React26.useState("");
|
|
12980
|
+
const handleStoreLogoChange = /* @__PURE__ */ __name((newLogo) => {
|
|
12981
|
+
setCompanyLogo(newLogo);
|
|
12982
|
+
setNavbarConfig((prev) => ({
|
|
12983
|
+
...prev,
|
|
12984
|
+
logo: newLogo
|
|
12985
|
+
}));
|
|
12986
|
+
}, "handleStoreLogoChange");
|
|
12987
|
+
const handleNavbarConfigChange = /* @__PURE__ */ __name((newConfig) => {
|
|
12988
|
+
setNavbarConfig(newConfig);
|
|
12989
|
+
if (newConfig.logo !== companyLogo) {
|
|
12990
|
+
setCompanyLogo(newConfig.logo || "");
|
|
12991
|
+
}
|
|
12992
|
+
}, "handleNavbarConfigChange");
|
|
12638
12993
|
const [currencies, setCurrencies] = React26.useState([]);
|
|
12639
12994
|
const [currenciesLoading, setCurrenciesLoading] = React26.useState(true);
|
|
12640
12995
|
const [showAddCurrency, setShowAddCurrency] = React26.useState(false);
|
|
@@ -12679,7 +13034,11 @@ function SettingsPage() {
|
|
|
12679
13034
|
setActiveThemeId((data.activeThemeId || "").trim());
|
|
12680
13035
|
if (data.navbar) {
|
|
12681
13036
|
try {
|
|
12682
|
-
|
|
13037
|
+
const parsed = JSON.parse(data.navbar);
|
|
13038
|
+
setNavbarConfig(parsed);
|
|
13039
|
+
if (parsed.logo) {
|
|
13040
|
+
setCompanyLogo((prev) => prev || parsed.logo);
|
|
13041
|
+
}
|
|
12683
13042
|
} catch {
|
|
12684
13043
|
}
|
|
12685
13044
|
}
|
|
@@ -12689,6 +13048,19 @@ function SettingsPage() {
|
|
|
12689
13048
|
fetch("/api/settings/store").then((r) => r.ok ? r.json() : {}).then((data) => {
|
|
12690
13049
|
setStoreEnabled(data.enabled === "true");
|
|
12691
13050
|
setCurrency(data.currency || DEFAULT_CURRENCY);
|
|
13051
|
+
setInvoiceTemplate(data.invoiceTemplate || "classic");
|
|
13052
|
+
const logo = data.invoiceLogoUrl || data.companyLogo || data.logo || "";
|
|
13053
|
+
setCompanyLogo((prev) => logo || prev);
|
|
13054
|
+
setCompanyName(data.companyName || data.invoiceCompanyName || data.name || "");
|
|
13055
|
+
setCompanyEmail(data.companyEmail || data.invoiceEmail || data.email || "");
|
|
13056
|
+
setCompanyPhone(data.companyPhone || data.invoicePhone || data.phone || "");
|
|
13057
|
+
setCompanyAddress(data.companyAddress || data.invoiceAddress || data.address || "");
|
|
13058
|
+
if (logo) {
|
|
13059
|
+
setNavbarConfig((prev) => ({
|
|
13060
|
+
...prev,
|
|
13061
|
+
logo: prev.logo || logo
|
|
13062
|
+
}));
|
|
13063
|
+
}
|
|
12692
13064
|
}).finally(() => setStoreSettingsLoading(false));
|
|
12693
13065
|
fetch("/api/settings/multi_vendor").then((r) => r.ok ? r.json() : {}).then((data) => {
|
|
12694
13066
|
setMultiVendorEnabled(data.enabled !== "false");
|
|
@@ -12793,6 +13165,27 @@ function SettingsPage() {
|
|
|
12793
13165
|
}
|
|
12794
13166
|
})
|
|
12795
13167
|
});
|
|
13168
|
+
await fetch("/api/settings/store", {
|
|
13169
|
+
method: "PUT",
|
|
13170
|
+
headers: {
|
|
13171
|
+
"Content-Type": "application/json"
|
|
13172
|
+
},
|
|
13173
|
+
body: JSON.stringify({
|
|
13174
|
+
invoiceLogoUrl: {
|
|
13175
|
+
value: navbarConfig.logo || "",
|
|
13176
|
+
type: "public"
|
|
13177
|
+
},
|
|
13178
|
+
companyLogo: {
|
|
13179
|
+
value: navbarConfig.logo || "",
|
|
13180
|
+
type: "public"
|
|
13181
|
+
},
|
|
13182
|
+
logo: {
|
|
13183
|
+
value: navbarConfig.logo || "",
|
|
13184
|
+
type: "public"
|
|
13185
|
+
}
|
|
13186
|
+
})
|
|
13187
|
+
}).catch(() => {
|
|
13188
|
+
});
|
|
12796
13189
|
sonner.toast.success("Navbar saved");
|
|
12797
13190
|
} catch {
|
|
12798
13191
|
sonner.toast.error("Failed to save");
|
|
@@ -12816,9 +13209,58 @@ function SettingsPage() {
|
|
|
12816
13209
|
currency: {
|
|
12817
13210
|
value: currency,
|
|
12818
13211
|
type: "public"
|
|
13212
|
+
},
|
|
13213
|
+
invoiceTemplate: {
|
|
13214
|
+
value: invoiceTemplate || "classic",
|
|
13215
|
+
type: "public"
|
|
13216
|
+
},
|
|
13217
|
+
invoiceLogoUrl: {
|
|
13218
|
+
value: companyLogo,
|
|
13219
|
+
type: "public"
|
|
13220
|
+
},
|
|
13221
|
+
companyLogo: {
|
|
13222
|
+
value: companyLogo,
|
|
13223
|
+
type: "public"
|
|
13224
|
+
},
|
|
13225
|
+
logo: {
|
|
13226
|
+
value: companyLogo,
|
|
13227
|
+
type: "public"
|
|
13228
|
+
},
|
|
13229
|
+
companyName: {
|
|
13230
|
+
value: companyName,
|
|
13231
|
+
type: "public"
|
|
13232
|
+
},
|
|
13233
|
+
companyEmail: {
|
|
13234
|
+
value: companyEmail,
|
|
13235
|
+
type: "public"
|
|
13236
|
+
},
|
|
13237
|
+
companyPhone: {
|
|
13238
|
+
value: companyPhone,
|
|
13239
|
+
type: "public"
|
|
13240
|
+
},
|
|
13241
|
+
companyAddress: {
|
|
13242
|
+
value: companyAddress,
|
|
13243
|
+
type: "public"
|
|
12819
13244
|
}
|
|
12820
13245
|
})
|
|
12821
13246
|
});
|
|
13247
|
+
const updatedNav = {
|
|
13248
|
+
...navbarConfig,
|
|
13249
|
+
logo: companyLogo
|
|
13250
|
+
};
|
|
13251
|
+
await fetch("/api/settings/theme", {
|
|
13252
|
+
method: "PUT",
|
|
13253
|
+
headers: {
|
|
13254
|
+
"Content-Type": "application/json"
|
|
13255
|
+
},
|
|
13256
|
+
body: JSON.stringify({
|
|
13257
|
+
navbar: {
|
|
13258
|
+
value: JSON.stringify(updatedNav),
|
|
13259
|
+
type: "public"
|
|
13260
|
+
}
|
|
13261
|
+
})
|
|
13262
|
+
}).catch(() => {
|
|
13263
|
+
});
|
|
12822
13264
|
await fetch("/api/settings/multi_vendor", {
|
|
12823
13265
|
method: "PUT",
|
|
12824
13266
|
headers: {
|
|
@@ -13101,7 +13543,7 @@ function SettingsPage() {
|
|
|
13101
13543
|
className: "text-sm text-gray-500 mb-4"
|
|
13102
13544
|
}, "Set logo and menu items."), /* @__PURE__ */ React.createElement(NavbarEditor, {
|
|
13103
13545
|
config: navbarConfig,
|
|
13104
|
-
onChange:
|
|
13546
|
+
onChange: handleNavbarConfigChange
|
|
13105
13547
|
})), /* @__PURE__ */ React.createElement(Button, {
|
|
13106
13548
|
onClick: handleSaveNavbar,
|
|
13107
13549
|
disabled: saving
|
|
@@ -13187,7 +13629,80 @@ function SettingsPage() {
|
|
|
13187
13629
|
className: "text-sm font-medium text-gray-700"
|
|
13188
13630
|
}, "Require event approval"), /* @__PURE__ */ React.createElement("p", {
|
|
13189
13631
|
className: "text-xs text-gray-500 mt-0.5"
|
|
13190
|
-
}, "When on, new vendor events start as pending. Admins approve or reject; approval activates the event (live)."))) : null), /* @__PURE__ */ React.createElement("div",
|
|
13632
|
+
}, "When on, new vendor events start as pending. Admins approve or reject; approval activates the event (live)."))) : null), /* @__PURE__ */ React.createElement("div", {
|
|
13633
|
+
className: "space-y-4 p-4 bg-gray-50 rounded-lg border border-gray-200"
|
|
13634
|
+
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h3", {
|
|
13635
|
+
className: "text-base font-semibold text-gray-900"
|
|
13636
|
+
}, "Invoice Header & Store Details"), /* @__PURE__ */ React.createElement("p", {
|
|
13637
|
+
className: "text-xs text-gray-500 mt-0.5"
|
|
13638
|
+
}, "Configure company logo, name, email, phone, and address displayed on generated invoice headers.")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(ImageOrUrlField, {
|
|
13639
|
+
label: "Company Logo",
|
|
13640
|
+
value: companyLogo,
|
|
13641
|
+
onChange: handleStoreLogoChange,
|
|
13642
|
+
previewVariant: "logo",
|
|
13643
|
+
placeholder: "Logo image URL or upload image"
|
|
13644
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
13645
|
+
className: "grid grid-cols-1 sm:grid-cols-2 gap-4"
|
|
13646
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
13647
|
+
className: "space-y-1.5"
|
|
13648
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
13649
|
+
className: "text-xs font-medium text-gray-700"
|
|
13650
|
+
}, "Company Name"), /* @__PURE__ */ React.createElement(Input, {
|
|
13651
|
+
value: companyName,
|
|
13652
|
+
onChange: /* @__PURE__ */ __name((e) => setCompanyName(e.target.value), "onChange"),
|
|
13653
|
+
placeholder: "e.g. Acme Corp",
|
|
13654
|
+
className: "h-9 text-sm bg-white"
|
|
13655
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
13656
|
+
className: "space-y-1.5"
|
|
13657
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
13658
|
+
className: "text-xs font-medium text-gray-700"
|
|
13659
|
+
}, "Company Email"), /* @__PURE__ */ React.createElement(Input, {
|
|
13660
|
+
type: "email",
|
|
13661
|
+
value: companyEmail,
|
|
13662
|
+
onChange: /* @__PURE__ */ __name((e) => setCompanyEmail(e.target.value), "onChange"),
|
|
13663
|
+
placeholder: "e.g. support@acme.com",
|
|
13664
|
+
className: "h-9 text-sm bg-white"
|
|
13665
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
13666
|
+
className: "space-y-1.5"
|
|
13667
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
13668
|
+
className: "text-xs font-medium text-gray-700"
|
|
13669
|
+
}, "Company Phone"), /* @__PURE__ */ React.createElement(Input, {
|
|
13670
|
+
type: "tel",
|
|
13671
|
+
value: companyPhone,
|
|
13672
|
+
onChange: /* @__PURE__ */ __name((e) => setCompanyPhone(e.target.value), "onChange"),
|
|
13673
|
+
placeholder: "e.g. +1 555-0199",
|
|
13674
|
+
className: "h-9 text-sm bg-white"
|
|
13675
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
13676
|
+
className: "space-y-1.5 sm:col-span-2"
|
|
13677
|
+
}, /* @__PURE__ */ React.createElement(Label3, {
|
|
13678
|
+
className: "text-xs font-medium text-gray-700"
|
|
13679
|
+
}, "Company Address"), /* @__PURE__ */ React.createElement(Textarea, {
|
|
13680
|
+
value: companyAddress,
|
|
13681
|
+
onChange: /* @__PURE__ */ __name((e) => setCompanyAddress(e.target.value), "onChange"),
|
|
13682
|
+
placeholder: "e.g. 123 Business Rd, Suite 100\nNew York, NY 10001",
|
|
13683
|
+
rows: 3,
|
|
13684
|
+
className: "text-sm bg-white"
|
|
13685
|
+
})))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
13686
|
+
className: "block text-sm font-semibold text-gray-700 mb-1"
|
|
13687
|
+
}, "Invoice PDF template"), /* @__PURE__ */ React.createElement("p", {
|
|
13688
|
+
className: "text-xs text-gray-500 mb-3"
|
|
13689
|
+
}, "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", {
|
|
13690
|
+
className: "grid gap-3 sm:grid-cols-2"
|
|
13691
|
+
}, INVOICE_TEMPLATE_CARDS.map((opt) => {
|
|
13692
|
+
const selected = invoiceTemplate === opt.id;
|
|
13693
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
13694
|
+
key: opt.id,
|
|
13695
|
+
type: "button",
|
|
13696
|
+
onClick: /* @__PURE__ */ __name(() => setInvoiceTemplate(opt.id), "onClick"),
|
|
13697
|
+
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"}`
|
|
13698
|
+
}, /* @__PURE__ */ React.createElement(InvoiceTemplatePreview, {
|
|
13699
|
+
id: opt.id
|
|
13700
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
13701
|
+
className: "text-sm font-semibold text-gray-800 mt-2"
|
|
13702
|
+
}, opt.label), /* @__PURE__ */ React.createElement("div", {
|
|
13703
|
+
className: "text-xs text-gray-500 mt-0.5"
|
|
13704
|
+
}, opt.description));
|
|
13705
|
+
}))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", {
|
|
13191
13706
|
className: "flex items-center justify-between mb-1"
|
|
13192
13707
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
13193
13708
|
className: "block text-sm font-semibold text-gray-700"
|
|
@@ -13375,7 +13890,7 @@ function SettingsPage() {
|
|
|
13375
13890
|
className: "h-4 w-4 mr-2"
|
|
13376
13891
|
}), saving ? "Saving..." : "Save")));
|
|
13377
13892
|
}
|
|
13378
|
-
var DEFAULT_CURRENCY, DEFAULTS;
|
|
13893
|
+
var DEFAULT_CURRENCY, DEFAULTS, INVOICE_TEMPLATE_CARDS;
|
|
13379
13894
|
var init_SettingsPage = __esm({
|
|
13380
13895
|
"src/admin/pages/SettingsPage.tsx"() {
|
|
13381
13896
|
"use client";
|
|
@@ -13384,6 +13899,8 @@ var init_SettingsPage = __esm({
|
|
|
13384
13899
|
init_switch();
|
|
13385
13900
|
init_label();
|
|
13386
13901
|
init_admin_config_context();
|
|
13902
|
+
init_textarea();
|
|
13903
|
+
init_ImageOrUrlField();
|
|
13387
13904
|
init_NavbarEditor();
|
|
13388
13905
|
DEFAULT_CURRENCY = "INR";
|
|
13389
13906
|
DEFAULTS = {
|
|
@@ -13391,6 +13908,29 @@ var init_SettingsPage = __esm({
|
|
|
13391
13908
|
secondaryColor: "#6366f1",
|
|
13392
13909
|
compactView: "false"
|
|
13393
13910
|
};
|
|
13911
|
+
INVOICE_TEMPLATE_CARDS = [
|
|
13912
|
+
{
|
|
13913
|
+
id: "classic",
|
|
13914
|
+
label: "Classic",
|
|
13915
|
+
description: "Traditional invoice with lined items and totals footer."
|
|
13916
|
+
},
|
|
13917
|
+
{
|
|
13918
|
+
id: "modern",
|
|
13919
|
+
label: "Modern",
|
|
13920
|
+
description: "Clean layout with accent header and open spacing."
|
|
13921
|
+
},
|
|
13922
|
+
{
|
|
13923
|
+
id: "compact",
|
|
13924
|
+
label: "Compact",
|
|
13925
|
+
description: "Dense layout suited to longer item lists."
|
|
13926
|
+
},
|
|
13927
|
+
{
|
|
13928
|
+
id: "bold",
|
|
13929
|
+
label: "Bold",
|
|
13930
|
+
description: "Strong header band and clear payment summary."
|
|
13931
|
+
}
|
|
13932
|
+
];
|
|
13933
|
+
__name(InvoiceTemplatePreview, "InvoiceTemplatePreview");
|
|
13394
13934
|
__name(hexToHsl, "hexToHsl");
|
|
13395
13935
|
__name(genId, "genId");
|
|
13396
13936
|
__name(SettingsPage, "SettingsPage");
|
|
@@ -20085,26 +20625,6 @@ var init_VendorRolesPage = __esm({
|
|
|
20085
20625
|
__name(VendorRolesPage, "VendorRolesPage");
|
|
20086
20626
|
}
|
|
20087
20627
|
});
|
|
20088
|
-
function DetailPageLayout({ main, sidebar }) {
|
|
20089
|
-
if (sidebar == null) {
|
|
20090
|
-
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20091
|
-
className: "min-w-0 w-full p-4 sm:p-6 space-y-6"
|
|
20092
|
-
}, main);
|
|
20093
|
-
}
|
|
20094
|
-
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20095
|
-
className: "min-w-0 w-full p-4 sm:p-6 grid grid-cols-1 xl:grid-cols-3 gap-4 sm:gap-6"
|
|
20096
|
-
}, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20097
|
-
className: "min-w-0 w-full xl:col-span-2 space-y-6"
|
|
20098
|
-
}, main), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20099
|
-
className: "min-w-0 w-full xl:col-span-1 space-y-6"
|
|
20100
|
-
}, sidebar));
|
|
20101
|
-
}
|
|
20102
|
-
var init_DetailPageLayout = __esm({
|
|
20103
|
-
"src/components/Admin/DetailPageLayout.tsx"() {
|
|
20104
|
-
"use client";
|
|
20105
|
-
__name(DetailPageLayout, "DetailPageLayout");
|
|
20106
|
-
}
|
|
20107
|
-
});
|
|
20108
20628
|
|
|
20109
20629
|
// src/lib/vendor-profile.ts
|
|
20110
20630
|
function validateIndiaTaxIds(gstin, pan) {
|
|
@@ -20186,25 +20706,45 @@ function labelForRegistrationStatus(value) {
|
|
|
20186
20706
|
if (!value) return "\u2014";
|
|
20187
20707
|
return VENDOR_REGISTRATION_STATUSES.find((s) => s.value === value)?.label ?? value;
|
|
20188
20708
|
}
|
|
20189
|
-
function
|
|
20709
|
+
function display(value) {
|
|
20710
|
+
const s = value?.trim();
|
|
20711
|
+
return s ? s : "\u2014";
|
|
20712
|
+
}
|
|
20713
|
+
function ReadOnlyInput({ id, label, value, className }) {
|
|
20190
20714
|
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20191
|
-
className
|
|
20192
|
-
}, /* @__PURE__ */ React26__namespace.default.createElement(
|
|
20193
|
-
|
|
20194
|
-
}, label), /* @__PURE__ */ React26__namespace.default.createElement(
|
|
20195
|
-
|
|
20196
|
-
|
|
20715
|
+
className
|
|
20716
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(Label3, {
|
|
20717
|
+
htmlFor: id
|
|
20718
|
+
}, label), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
20719
|
+
id,
|
|
20720
|
+
value,
|
|
20721
|
+
readOnly: true,
|
|
20722
|
+
disabled: true,
|
|
20723
|
+
className: "mt-1.5 bg-gray-50"
|
|
20724
|
+
}));
|
|
20197
20725
|
}
|
|
20198
20726
|
function VendorPortalProfilePage() {
|
|
20199
20727
|
const router = navigation.useRouter();
|
|
20728
|
+
const searchParams = navigation.useSearchParams();
|
|
20729
|
+
const tabParam = searchParams.get("tab");
|
|
20200
20730
|
const { data: session, status } = react.useSession();
|
|
20201
20731
|
const sessionUser = session?.user;
|
|
20732
|
+
const [tab, setTab] = React26.useState(tabParam === "password" ? "password" : "profile");
|
|
20202
20733
|
const [loading, setLoading] = React26.useState(true);
|
|
20203
20734
|
const [error, setError] = React26.useState(null);
|
|
20204
20735
|
const [vendor, setVendor] = React26.useState(null);
|
|
20205
20736
|
const [owner, setOwner] = React26.useState(null);
|
|
20206
|
-
const
|
|
20737
|
+
const [currentPassword, setCurrentPassword] = React26.useState("");
|
|
20738
|
+
const [newPassword, setNewPassword] = React26.useState("");
|
|
20739
|
+
const [confirmPassword, setConfirmPassword] = React26.useState("");
|
|
20740
|
+
const [savingPassword, setSavingPassword] = React26.useState(false);
|
|
20207
20741
|
const sessionUserId = sessionUser?.id != null ? Number(sessionUser.id) : null;
|
|
20742
|
+
React26.useEffect(() => {
|
|
20743
|
+
if (tabParam === "password") setTab("password");
|
|
20744
|
+
else if (tabParam === "profile") setTab("profile");
|
|
20745
|
+
}, [
|
|
20746
|
+
tabParam
|
|
20747
|
+
]);
|
|
20208
20748
|
React26.useEffect(() => {
|
|
20209
20749
|
if (status === "unauthenticated") {
|
|
20210
20750
|
router.replace("/admin/signin");
|
|
@@ -20215,16 +20755,15 @@ function VendorPortalProfilePage() {
|
|
|
20215
20755
|
router.replace("/admin/access-denied");
|
|
20216
20756
|
return;
|
|
20217
20757
|
}
|
|
20218
|
-
if (vendorId == null) {
|
|
20219
|
-
setError("No vendor is linked to your account.");
|
|
20220
|
-
setLoading(false);
|
|
20221
|
-
return;
|
|
20222
|
-
}
|
|
20223
20758
|
let cancelled = false;
|
|
20224
20759
|
(async () => {
|
|
20760
|
+
setLoading(true);
|
|
20225
20761
|
try {
|
|
20226
|
-
const res = await fetch(
|
|
20227
|
-
if (!res.ok)
|
|
20762
|
+
const res = await fetch("/api/admin/vendor/profile");
|
|
20763
|
+
if (!res.ok) {
|
|
20764
|
+
const errBody = await res.json().catch(() => ({}));
|
|
20765
|
+
throw new Error(errBody.error || "Failed to load vendor profile");
|
|
20766
|
+
}
|
|
20228
20767
|
const data = await res.json();
|
|
20229
20768
|
if (cancelled) return;
|
|
20230
20769
|
setVendor(data);
|
|
@@ -20265,9 +20804,13 @@ function VendorPortalProfilePage() {
|
|
|
20265
20804
|
email: data.email ?? null,
|
|
20266
20805
|
phone: data.phone ?? null
|
|
20267
20806
|
});
|
|
20807
|
+
setError(null);
|
|
20808
|
+
}
|
|
20809
|
+
} catch (e) {
|
|
20810
|
+
if (!cancelled) {
|
|
20811
|
+
setVendor(null);
|
|
20812
|
+
setError(e instanceof Error ? e.message : "Failed to load vendor profile.");
|
|
20268
20813
|
}
|
|
20269
|
-
} catch {
|
|
20270
|
-
if (!cancelled) setError("Failed to load vendor profile.");
|
|
20271
20814
|
} finally {
|
|
20272
20815
|
if (!cancelled) setLoading(false);
|
|
20273
20816
|
}
|
|
@@ -20279,158 +20822,293 @@ function VendorPortalProfilePage() {
|
|
|
20279
20822
|
status,
|
|
20280
20823
|
sessionUser,
|
|
20281
20824
|
router,
|
|
20282
|
-
|
|
20825
|
+
sessionUserId,
|
|
20826
|
+
session?.user?.name,
|
|
20827
|
+
session?.user?.email
|
|
20283
20828
|
]);
|
|
20284
|
-
|
|
20829
|
+
const handleChangePassword = /* @__PURE__ */ __name(async (e) => {
|
|
20830
|
+
e.preventDefault();
|
|
20831
|
+
if (newPassword !== confirmPassword) {
|
|
20832
|
+
sonner.toast.error("New password and confirmation do not match");
|
|
20833
|
+
return;
|
|
20834
|
+
}
|
|
20835
|
+
if (newPassword.length < 6) {
|
|
20836
|
+
sonner.toast.error("New password must be at least 6 characters");
|
|
20837
|
+
return;
|
|
20838
|
+
}
|
|
20839
|
+
setSavingPassword(true);
|
|
20840
|
+
try {
|
|
20841
|
+
const res = await fetch("/api/users/reset-password", {
|
|
20842
|
+
method: "POST",
|
|
20843
|
+
headers: {
|
|
20844
|
+
"Content-Type": "application/json"
|
|
20845
|
+
},
|
|
20846
|
+
body: JSON.stringify({
|
|
20847
|
+
currentPassword,
|
|
20848
|
+
newPassword
|
|
20849
|
+
})
|
|
20850
|
+
});
|
|
20851
|
+
const data = await res.json().catch(() => ({}));
|
|
20852
|
+
if (!res.ok) {
|
|
20853
|
+
sonner.toast.error(data.error || "Could not update password");
|
|
20854
|
+
return;
|
|
20855
|
+
}
|
|
20856
|
+
sonner.toast.success("Password updated");
|
|
20857
|
+
setCurrentPassword("");
|
|
20858
|
+
setNewPassword("");
|
|
20859
|
+
setConfirmPassword("");
|
|
20860
|
+
} catch {
|
|
20861
|
+
sonner.toast.error("Network error");
|
|
20862
|
+
} finally {
|
|
20863
|
+
setSavingPassword(false);
|
|
20864
|
+
}
|
|
20865
|
+
}, "handleChangePassword");
|
|
20866
|
+
const tabs = [
|
|
20867
|
+
{
|
|
20868
|
+
id: "profile",
|
|
20869
|
+
label: "Profile"
|
|
20870
|
+
},
|
|
20871
|
+
{
|
|
20872
|
+
id: "password",
|
|
20873
|
+
label: "Password"
|
|
20874
|
+
}
|
|
20875
|
+
];
|
|
20876
|
+
if (status === "unauthenticated") {
|
|
20877
|
+
return null;
|
|
20878
|
+
}
|
|
20879
|
+
if (status === "loading" || status === "authenticated" && loading) {
|
|
20285
20880
|
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20286
|
-
className: "flex justify-center py-
|
|
20287
|
-
}, "
|
|
20881
|
+
className: "flex justify-center py-8"
|
|
20882
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20883
|
+
className: "h-6 w-6 animate-spin rounded-full border-2 border-gray-300 border-t-gray-600"
|
|
20884
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement("span", {
|
|
20885
|
+
className: "ml-2 text-gray-600"
|
|
20886
|
+
}, "Loading..."));
|
|
20288
20887
|
}
|
|
20289
20888
|
if (error || !vendor) {
|
|
20290
20889
|
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20291
|
-
className: "
|
|
20890
|
+
className: "min-w-0 rounded-lg bg-white shadow-md"
|
|
20891
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20892
|
+
className: "rounded-t-lg border-b border-gray-700 bg-gray-800 px-4 py-2.5"
|
|
20893
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("h1", {
|
|
20894
|
+
className: "text-base font-semibold text-white"
|
|
20895
|
+
}, "Profile"), /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
20896
|
+
className: "mt-0.5 text-xs text-gray-300"
|
|
20897
|
+
}, "Your vendor details, and password")), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20898
|
+
className: "p-6"
|
|
20292
20899
|
}, /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
20293
20900
|
className: "text-sm text-red-600"
|
|
20294
|
-
}, error ?? "Vendor profile not available."));
|
|
20901
|
+
}, error ?? "Vendor profile not available.")));
|
|
20295
20902
|
}
|
|
20296
20903
|
const ownerDesignation = readOwnerDesignation(vendor.metadata);
|
|
20297
|
-
return /* @__PURE__ */ React26__namespace.default.createElement(
|
|
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
|
-
|
|
20387
|
-
|
|
20388
|
-
|
|
20389
|
-
|
|
20390
|
-
|
|
20391
|
-
|
|
20392
|
-
|
|
20393
|
-
|
|
20394
|
-
|
|
20395
|
-
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
20403
|
-
|
|
20404
|
-
|
|
20405
|
-
|
|
20406
|
-
|
|
20407
|
-
|
|
20408
|
-
|
|
20409
|
-
|
|
20410
|
-
|
|
20411
|
-
|
|
20412
|
-
|
|
20413
|
-
|
|
20414
|
-
|
|
20415
|
-
|
|
20416
|
-
|
|
20417
|
-
|
|
20418
|
-
|
|
20419
|
-
|
|
20420
|
-
|
|
20421
|
-
|
|
20904
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20905
|
+
className: "min-w-0 rounded-lg bg-white shadow-md"
|
|
20906
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20907
|
+
className: "rounded-t-lg border-b border-gray-700 bg-gray-800 px-4 py-2.5"
|
|
20908
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("h1", {
|
|
20909
|
+
className: "text-base font-semibold text-white"
|
|
20910
|
+
}, "Profile"), /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
20911
|
+
className: "mt-0.5 text-xs text-gray-300"
|
|
20912
|
+
}, "Your vendor details, and password")), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20913
|
+
className: "flex border-b"
|
|
20914
|
+
}, tabs.map((t) => /* @__PURE__ */ React26__namespace.default.createElement("button", {
|
|
20915
|
+
key: t.id,
|
|
20916
|
+
type: "button",
|
|
20917
|
+
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"}`,
|
|
20918
|
+
onClick: /* @__PURE__ */ __name(() => setTab(t.id), "onClick")
|
|
20919
|
+
}, t.label))), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20920
|
+
className: "min-w-0 p-6"
|
|
20921
|
+
}, tab === "profile" && /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20922
|
+
className: "space-y-8"
|
|
20923
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("section", {
|
|
20924
|
+
className: "space-y-4"
|
|
20925
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
20926
|
+
className: "text-sm font-semibold text-gray-900"
|
|
20927
|
+
}, "Store"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20928
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
20929
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20930
|
+
id: "v-name",
|
|
20931
|
+
label: "Store name",
|
|
20932
|
+
value: display(vendor.name)
|
|
20933
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20934
|
+
id: "v-legal",
|
|
20935
|
+
label: "Legal name",
|
|
20936
|
+
value: display(vendor.legalName)
|
|
20937
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20938
|
+
id: "v-slug",
|
|
20939
|
+
label: "Slug",
|
|
20940
|
+
value: display(vendor.slug)
|
|
20941
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20942
|
+
id: "v-biz",
|
|
20943
|
+
label: "Business type",
|
|
20944
|
+
value: labelForBusinessType(vendor.businessType)
|
|
20945
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20946
|
+
id: "v-reg",
|
|
20947
|
+
label: "Registration status",
|
|
20948
|
+
value: labelForRegistrationStatus(vendor.registrationStatus)
|
|
20949
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20950
|
+
id: "v-active",
|
|
20951
|
+
label: "Active",
|
|
20952
|
+
value: vendor.active ? "Yes" : "No"
|
|
20953
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20954
|
+
id: "v-invite",
|
|
20955
|
+
label: "Invite status",
|
|
20956
|
+
value: display(vendor.inviteStatus)
|
|
20957
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20958
|
+
id: "v-created",
|
|
20959
|
+
label: "Created",
|
|
20960
|
+
value: vendor.createdAt ? new Date(vendor.createdAt).toLocaleString() : "\u2014"
|
|
20961
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20962
|
+
id: "v-desc",
|
|
20963
|
+
label: "Description",
|
|
20964
|
+
value: display(vendor.description),
|
|
20965
|
+
className: "md:col-span-2"
|
|
20966
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20967
|
+
id: "v-web",
|
|
20968
|
+
label: "Website",
|
|
20969
|
+
value: display(vendor.website),
|
|
20970
|
+
className: "md:col-span-2"
|
|
20971
|
+
}))), /* @__PURE__ */ React26__namespace.default.createElement("section", {
|
|
20972
|
+
className: "space-y-4"
|
|
20973
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
20974
|
+
className: "text-sm font-semibold text-gray-900"
|
|
20975
|
+
}, "Contact"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20976
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
20977
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20978
|
+
id: "v-email",
|
|
20979
|
+
label: "Email",
|
|
20980
|
+
value: display(vendor.email)
|
|
20981
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20982
|
+
id: "v-phone",
|
|
20983
|
+
label: "Phone",
|
|
20984
|
+
value: display(vendor.phone)
|
|
20985
|
+
}))), /* @__PURE__ */ React26__namespace.default.createElement("section", {
|
|
20986
|
+
className: "space-y-4"
|
|
20987
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
20988
|
+
className: "text-sm font-semibold text-gray-900"
|
|
20989
|
+
}, "Address"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
20990
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
20991
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20992
|
+
id: "v-a1",
|
|
20993
|
+
label: "Address line 1",
|
|
20994
|
+
value: display(vendor.addressLine1)
|
|
20995
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
20996
|
+
id: "v-a2",
|
|
20997
|
+
label: "Address line 2",
|
|
20998
|
+
value: display(vendor.addressLine2)
|
|
20999
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21000
|
+
id: "v-city",
|
|
21001
|
+
label: "City",
|
|
21002
|
+
value: display(vendor.city)
|
|
21003
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21004
|
+
id: "v-state",
|
|
21005
|
+
label: "State",
|
|
21006
|
+
value: display(vendor.state)
|
|
21007
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21008
|
+
id: "v-country",
|
|
21009
|
+
label: "Country",
|
|
21010
|
+
value: display(vendor.country)
|
|
21011
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21012
|
+
id: "v-postal",
|
|
21013
|
+
label: "Postal code",
|
|
21014
|
+
value: display(vendor.postalCode)
|
|
21015
|
+
}))), /* @__PURE__ */ React26__namespace.default.createElement("section", {
|
|
21016
|
+
className: "space-y-4"
|
|
21017
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
21018
|
+
className: "text-sm font-semibold text-gray-900"
|
|
21019
|
+
}, "Tax & compliance"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
21020
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
21021
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21022
|
+
id: "v-gstin",
|
|
21023
|
+
label: "GSTIN",
|
|
21024
|
+
value: display(vendor.gstin)
|
|
21025
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21026
|
+
id: "v-pan",
|
|
21027
|
+
label: "PAN",
|
|
21028
|
+
value: display(vendor.pan)
|
|
21029
|
+
}))), /* @__PURE__ */ React26__namespace.default.createElement("section", {
|
|
21030
|
+
className: "space-y-4"
|
|
21031
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
21032
|
+
className: "text-sm font-semibold text-gray-900"
|
|
21033
|
+
}, "Owner"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
21034
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4 w-full"
|
|
21035
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21036
|
+
id: "o-name",
|
|
21037
|
+
label: "Name",
|
|
21038
|
+
value: display(owner?.name)
|
|
21039
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21040
|
+
id: "o-email",
|
|
21041
|
+
label: "Email",
|
|
21042
|
+
value: display(owner?.email)
|
|
21043
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21044
|
+
id: "o-phone",
|
|
21045
|
+
label: "Phone",
|
|
21046
|
+
value: display(owner?.phone)
|
|
21047
|
+
}), /* @__PURE__ */ React26__namespace.default.createElement(ReadOnlyInput, {
|
|
21048
|
+
id: "o-desig",
|
|
21049
|
+
label: "Designation",
|
|
21050
|
+
value: display(ownerDesignation || void 0)
|
|
21051
|
+
})), vendor.logo ? /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(Label3, null, "Logo"), /* @__PURE__ */ React26__namespace.default.createElement("img", {
|
|
21052
|
+
src: vendor.logo,
|
|
21053
|
+
alt: "Vendor logo",
|
|
21054
|
+
className: "mt-1.5 max-h-24 rounded border border-gray-200 bg-white object-contain"
|
|
21055
|
+
})) : null)), tab === "password" && /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
21056
|
+
className: "space-y-6"
|
|
21057
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
21058
|
+
className: "mb-2 text-lg font-semibold text-gray-900"
|
|
21059
|
+
}, "Change password"), /* @__PURE__ */ React26__namespace.default.createElement("form", {
|
|
21060
|
+
onSubmit: handleChangePassword,
|
|
21061
|
+
className: "max-w-md space-y-4"
|
|
21062
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(Label3, {
|
|
21063
|
+
htmlFor: "current-password",
|
|
21064
|
+
className: "text-sm text-gray-700"
|
|
21065
|
+
}, "Current password"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
21066
|
+
id: "current-password",
|
|
21067
|
+
type: "password",
|
|
21068
|
+
value: currentPassword,
|
|
21069
|
+
onChange: /* @__PURE__ */ __name((e) => setCurrentPassword(e.target.value), "onChange"),
|
|
21070
|
+
className: "mt-1.5",
|
|
21071
|
+
autoComplete: "current-password"
|
|
21072
|
+
})), /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(Label3, {
|
|
21073
|
+
htmlFor: "new-password",
|
|
21074
|
+
className: "text-sm text-gray-700"
|
|
21075
|
+
}, "New password"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
21076
|
+
id: "new-password",
|
|
21077
|
+
type: "password",
|
|
21078
|
+
value: newPassword,
|
|
21079
|
+
onChange: /* @__PURE__ */ __name((e) => setNewPassword(e.target.value), "onChange"),
|
|
21080
|
+
className: "mt-1.5",
|
|
21081
|
+
autoComplete: "new-password"
|
|
21082
|
+
})), /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(Label3, {
|
|
21083
|
+
htmlFor: "confirm-password",
|
|
21084
|
+
className: "text-sm text-gray-700"
|
|
21085
|
+
}, "Confirm new password"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
21086
|
+
id: "confirm-password",
|
|
21087
|
+
type: "password",
|
|
21088
|
+
value: confirmPassword,
|
|
21089
|
+
onChange: /* @__PURE__ */ __name((e) => setConfirmPassword(e.target.value), "onChange"),
|
|
21090
|
+
className: "mt-1.5",
|
|
21091
|
+
autoComplete: "new-password"
|
|
21092
|
+
})), /* @__PURE__ */ React26__namespace.default.createElement(Button, {
|
|
21093
|
+
type: "submit",
|
|
21094
|
+
variant: "secondary",
|
|
21095
|
+
disabled: savingPassword
|
|
21096
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement(LucideIcons.KeyRound, {
|
|
21097
|
+
className: "mr-2 h-4 w-4"
|
|
21098
|
+
}), savingPassword ? "Updating..." : "Update password"))))));
|
|
20422
21099
|
}
|
|
20423
|
-
var sectionCls;
|
|
20424
21100
|
var init_VendorPortalProfilePage = __esm({
|
|
20425
21101
|
"src/admin/pages/VendorPortalProfilePage.tsx"() {
|
|
20426
21102
|
"use client";
|
|
20427
21103
|
init_vendor_scope();
|
|
20428
|
-
|
|
21104
|
+
init_button();
|
|
21105
|
+
init_input();
|
|
21106
|
+
init_label();
|
|
20429
21107
|
init_vendor_profile();
|
|
20430
|
-
sectionCls = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50 space-y-3";
|
|
20431
21108
|
__name(labelForBusinessType, "labelForBusinessType");
|
|
20432
21109
|
__name(labelForRegistrationStatus, "labelForRegistrationStatus");
|
|
20433
|
-
__name(
|
|
21110
|
+
__name(display, "display");
|
|
21111
|
+
__name(ReadOnlyInput, "ReadOnlyInput");
|
|
20434
21112
|
__name(VendorPortalProfilePage, "VendorPortalProfilePage");
|
|
20435
21113
|
}
|
|
20436
21114
|
});
|
|
@@ -20667,6 +21345,26 @@ var init_SubmissionDetailPage = __esm({
|
|
|
20667
21345
|
__name(SubmissionDetailPage, "SubmissionDetailPage");
|
|
20668
21346
|
}
|
|
20669
21347
|
});
|
|
21348
|
+
function DetailPageLayout({ main, sidebar }) {
|
|
21349
|
+
if (sidebar == null) {
|
|
21350
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
21351
|
+
className: "min-w-0 w-full p-4 sm:p-6 space-y-6"
|
|
21352
|
+
}, main);
|
|
21353
|
+
}
|
|
21354
|
+
return /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
21355
|
+
className: "min-w-0 w-full p-4 sm:p-6 grid grid-cols-1 xl:grid-cols-3 gap-4 sm:gap-6"
|
|
21356
|
+
}, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
21357
|
+
className: "min-w-0 w-full xl:col-span-2 space-y-6"
|
|
21358
|
+
}, main), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
21359
|
+
className: "min-w-0 w-full xl:col-span-1 space-y-6"
|
|
21360
|
+
}, sidebar));
|
|
21361
|
+
}
|
|
21362
|
+
var init_DetailPageLayout = __esm({
|
|
21363
|
+
"src/components/Admin/DetailPageLayout.tsx"() {
|
|
21364
|
+
"use client";
|
|
21365
|
+
__name(DetailPageLayout, "DetailPageLayout");
|
|
21366
|
+
}
|
|
21367
|
+
});
|
|
20670
21368
|
|
|
20671
21369
|
// src/admin/pages/OrderDetailPage.tsx
|
|
20672
21370
|
var OrderDetailPage_exports = {};
|
|
@@ -22613,20 +23311,7 @@ function OrderPlacementPage({ editOrderId }) {
|
|
|
22613
23311
|
} catch {
|
|
22614
23312
|
}
|
|
22615
23313
|
}
|
|
22616
|
-
|
|
22617
|
-
if (placeForSomeoneElse) {
|
|
22618
|
-
if (contactEmail) {
|
|
22619
|
-
try {
|
|
22620
|
-
const res2 = await fetch(`/api/contacts?search=${encodeURIComponent(contactEmail)}&limit=5`);
|
|
22621
|
-
if (res2.ok) {
|
|
22622
|
-
const data = await res2.json();
|
|
22623
|
-
const match = data.data?.find((c) => c.email?.toLowerCase() === contactEmail.toLowerCase());
|
|
22624
|
-
if (match) orderContactId = match.id;
|
|
22625
|
-
}
|
|
22626
|
-
} catch {
|
|
22627
|
-
}
|
|
22628
|
-
}
|
|
22629
|
-
}
|
|
23314
|
+
const orderContactId = resolvedContactId;
|
|
22630
23315
|
const payload = {
|
|
22631
23316
|
status,
|
|
22632
23317
|
currency,
|
|
@@ -22648,6 +23333,9 @@ function OrderPlacementPage({ editOrderId }) {
|
|
|
22648
23333
|
};
|
|
22649
23334
|
if (orderContactId != null) payload.contactId = orderContactId;
|
|
22650
23335
|
if (!placeForSomeoneElse && contactId != null) payload.customerId = contactId;
|
|
23336
|
+
if (placeForSomeoneElse && selectedCustomerId != null) {
|
|
23337
|
+
payload.accountCustomerId = selectedCustomerId;
|
|
23338
|
+
}
|
|
22651
23339
|
if (coupons.length > 0) payload.discountId = coupons[0].discountId;
|
|
22652
23340
|
const url = editOrderId ? `/api/orders/${editOrderId}` : "/api/orders";
|
|
22653
23341
|
const method = editOrderId ? "PUT" : "POST";
|
|
@@ -27153,7 +27841,7 @@ function ProductVariantsSection({ hasVariants, onHasVariantsChange, variantOptio
|
|
|
27153
27841
|
}), "This product has variants")), !hasVariants ? /* @__PURE__ */ React.createElement("p", {
|
|
27154
27842
|
className: "text-xs text-gray-500"
|
|
27155
27843
|
}, "Enable variants for products with options like size, color, or material.") : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
27156
|
-
className:
|
|
27844
|
+
className: sectionCls
|
|
27157
27845
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
27158
27846
|
className: "mb-3"
|
|
27159
27847
|
}, /* @__PURE__ */ React.createElement("p", {
|
|
@@ -27223,7 +27911,7 @@ function ProductVariantsSection({ hasVariants, onHasVariantsChange, variantOptio
|
|
|
27223
27911
|
disabled: !parsedOptions.length,
|
|
27224
27912
|
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"
|
|
27225
27913
|
}, "Generate variants")))), /* @__PURE__ */ React.createElement("div", {
|
|
27226
|
-
className:
|
|
27914
|
+
className: sectionCls
|
|
27227
27915
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
27228
27916
|
className: "mb-3 flex flex-wrap items-center justify-between gap-2"
|
|
27229
27917
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("p", {
|
|
@@ -27375,7 +28063,7 @@ function ProductVariantsSection({ hasVariants, onHasVariantsChange, variantOptio
|
|
|
27375
28063
|
className: "h-4 w-4"
|
|
27376
28064
|
})))))))))));
|
|
27377
28065
|
}
|
|
27378
|
-
var labelCls2, inputCls2,
|
|
28066
|
+
var labelCls2, inputCls2, sectionCls;
|
|
27379
28067
|
var init_ProductVariantsSection = __esm({
|
|
27380
28068
|
"src/admin/pages/ProductVariantsSection.tsx"() {
|
|
27381
28069
|
"use client";
|
|
@@ -27383,7 +28071,7 @@ var init_ProductVariantsSection = __esm({
|
|
|
27383
28071
|
init_ImageOrUrlField();
|
|
27384
28072
|
labelCls2 = "block text-xs font-medium text-gray-600 mb-1";
|
|
27385
28073
|
inputCls2 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm";
|
|
27386
|
-
|
|
28074
|
+
sectionCls = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
27387
28075
|
__name(emptyVariantOptionRow, "emptyVariantOptionRow");
|
|
27388
28076
|
__name(emptyVariantFormRow, "emptyVariantFormRow");
|
|
27389
28077
|
__name(variantOptionsFromForm, "variantOptionsFromForm");
|
|
@@ -28555,7 +29243,7 @@ function ProductEditPage({ productId }) {
|
|
|
28555
29243
|
}, "Step 1 \u2014 Product")), /* @__PURE__ */ React.createElement("h2", {
|
|
28556
29244
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
28557
29245
|
}, "Product details"), /* @__PURE__ */ React.createElement("div", {
|
|
28558
|
-
className: `${
|
|
29246
|
+
className: `${sectionCls2} space-y-4`
|
|
28559
29247
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
28560
29248
|
className: labelCls3
|
|
28561
29249
|
}, "Name *"), /* @__PURE__ */ React.createElement("input", {
|
|
@@ -28781,7 +29469,7 @@ function ProductEditPage({ productId }) {
|
|
|
28781
29469
|
}, "Taxes & Policy"), /* @__PURE__ */ React.createElement("p", {
|
|
28782
29470
|
className: "text-xs text-gray-500 mb-2"
|
|
28783
29471
|
}, "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", {
|
|
28784
|
-
className: `${
|
|
29472
|
+
className: `${sectionCls2} space-y-4`
|
|
28785
29473
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
28786
29474
|
className: labelCls3
|
|
28787
29475
|
}, "Refund / Return Policy"), /* @__PURE__ */ React.createElement("select", {
|
|
@@ -28859,7 +29547,7 @@ function ProductEditPage({ productId }) {
|
|
|
28859
29547
|
}, "Attributes (facets)"), /* @__PURE__ */ React.createElement("p", {
|
|
28860
29548
|
className: "text-xs text-gray-500 mb-2"
|
|
28861
29549
|
}, "Search existing attributes or create new ones (like blog categories). Value on the right."), /* @__PURE__ */ React.createElement("div", {
|
|
28862
|
-
className: `${
|
|
29550
|
+
className: `${sectionCls2} space-y-2`
|
|
28863
29551
|
}, facetRows.map((row, i) => /* @__PURE__ */ React.createElement("div", {
|
|
28864
29552
|
key: i,
|
|
28865
29553
|
className: "flex gap-2 items-start"
|
|
@@ -28888,7 +29576,7 @@ function ProductEditPage({ productId }) {
|
|
|
28888
29576
|
}), " Add attribute"))), /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
28889
29577
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
28890
29578
|
}, "Media"), /* @__PURE__ */ React.createElement("div", {
|
|
28891
|
-
className: `${
|
|
29579
|
+
className: `${sectionCls2} space-y-3`
|
|
28892
29580
|
}, images.map((row, i) => /* @__PURE__ */ React.createElement("div", {
|
|
28893
29581
|
key: i,
|
|
28894
29582
|
className: "flex flex-wrap items-start gap-2 p-2 bg-white rounded border border-gray-200"
|
|
@@ -28930,7 +29618,7 @@ function ProductEditPage({ productId }) {
|
|
|
28930
29618
|
}), " Add image"))), /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
28931
29619
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
28932
29620
|
}, "Specifications"), /* @__PURE__ */ React.createElement("div", {
|
|
28933
|
-
className: `${
|
|
29621
|
+
className: `${sectionCls2} space-y-2`
|
|
28934
29622
|
}, specifications.map((row, i) => /* @__PURE__ */ React.createElement("div", {
|
|
28935
29623
|
key: i,
|
|
28936
29624
|
className: "flex gap-2"
|
|
@@ -28961,7 +29649,7 @@ function ProductEditPage({ productId }) {
|
|
|
28961
29649
|
}), " Add row"))), /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
28962
29650
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
28963
29651
|
}, "SEO"), /* @__PURE__ */ React.createElement("div", {
|
|
28964
|
-
className:
|
|
29652
|
+
className: sectionCls2
|
|
28965
29653
|
}, /* @__PURE__ */ React.createElement(SeoSection, {
|
|
28966
29654
|
values: seo,
|
|
28967
29655
|
onChange: /* @__PURE__ */ __name((field, value) => setSeo((s) => ({
|
|
@@ -28971,7 +29659,7 @@ function ProductEditPage({ productId }) {
|
|
|
28971
29659
|
}))))
|
|
28972
29660
|
}));
|
|
28973
29661
|
}
|
|
28974
|
-
var isCreate2,
|
|
29662
|
+
var isCreate2, sectionCls2, labelCls3, inputCls3, DEFAULT_PRICING_CONFIG;
|
|
28975
29663
|
var init_ProductEditPage = __esm({
|
|
28976
29664
|
"src/admin/pages/ProductEditPage.tsx"() {
|
|
28977
29665
|
"use client";
|
|
@@ -28995,7 +29683,7 @@ var init_ProductEditPage = __esm({
|
|
|
28995
29683
|
init_product_variants();
|
|
28996
29684
|
__name(parseCategoryIdFromReturnUrl, "parseCategoryIdFromReturnUrl");
|
|
28997
29685
|
isCreate2 = /* @__PURE__ */ __name((id) => id === "create", "isCreate");
|
|
28998
|
-
|
|
29686
|
+
sectionCls2 = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
28999
29687
|
labelCls3 = "block text-xs font-medium text-gray-600 mb-1";
|
|
29000
29688
|
inputCls3 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm";
|
|
29001
29689
|
__name(buildProductMetadata, "buildProductMetadata");
|
|
@@ -29420,7 +30108,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29420
30108
|
main: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
29421
30109
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
29422
30110
|
}, "Basic info"), /* @__PURE__ */ React.createElement("div", {
|
|
29423
|
-
className: `${
|
|
30111
|
+
className: `${sectionCls3} space-y-4`
|
|
29424
30112
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
29425
30113
|
className: labelCls4
|
|
29426
30114
|
}, "Name *"), /* @__PURE__ */ React.createElement("input", {
|
|
@@ -29506,7 +30194,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29506
30194
|
}), "Advanced page content"), advancedOpen && /* @__PURE__ */ React.createElement("div", {
|
|
29507
30195
|
className: "space-y-4"
|
|
29508
30196
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
29509
|
-
className:
|
|
30197
|
+
className: sectionCls3
|
|
29510
30198
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
29511
30199
|
className: "text-xs font-medium text-gray-700 mb-2"
|
|
29512
30200
|
}, "Hero carousel"), heroSlides.map((slide, i) => /* @__PURE__ */ React.createElement("div", {
|
|
@@ -29552,7 +30240,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29552
30240
|
}, /* @__PURE__ */ React.createElement(LucideIcons.Plus, {
|
|
29553
30241
|
className: "h-3.5 w-3.5"
|
|
29554
30242
|
}), " Add slide")), /* @__PURE__ */ React.createElement("div", {
|
|
29555
|
-
className:
|
|
30243
|
+
className: sectionCls3
|
|
29556
30244
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
29557
30245
|
className: "text-xs font-medium text-gray-700 mb-2"
|
|
29558
30246
|
}, "Variants"), variants.map((v, i) => /* @__PURE__ */ React.createElement("div", {
|
|
@@ -29612,7 +30300,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29612
30300
|
}, /* @__PURE__ */ React.createElement(LucideIcons.Plus, {
|
|
29613
30301
|
className: "h-3.5 w-3.5"
|
|
29614
30302
|
}), " Add variant")), /* @__PURE__ */ React.createElement("div", {
|
|
29615
|
-
className:
|
|
30303
|
+
className: sectionCls3
|
|
29616
30304
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
29617
30305
|
className: labelCls4
|
|
29618
30306
|
}, "Experience description"), /* @__PURE__ */ React.createElement("textarea", {
|
|
@@ -29622,7 +30310,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29622
30310
|
rows: 2,
|
|
29623
30311
|
placeholder: "Optional"
|
|
29624
30312
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
29625
|
-
className:
|
|
30313
|
+
className: sectionCls3
|
|
29626
30314
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
29627
30315
|
className: labelCls4
|
|
29628
30316
|
}, "Brochure URL"), /* @__PURE__ */ React.createElement("input", {
|
|
@@ -29635,7 +30323,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29635
30323
|
sidebar: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
29636
30324
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
29637
30325
|
}, "Status"), /* @__PURE__ */ React.createElement("div", {
|
|
29638
|
-
className:
|
|
30326
|
+
className: sectionCls3
|
|
29639
30327
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
29640
30328
|
className: "flex items-center gap-2 cursor-pointer"
|
|
29641
30329
|
}, /* @__PURE__ */ React.createElement("input", {
|
|
@@ -29648,7 +30336,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29648
30336
|
}, "Active")))), /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h2", {
|
|
29649
30337
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
29650
30338
|
}, "SEO"), /* @__PURE__ */ React.createElement("div", {
|
|
29651
|
-
className:
|
|
30339
|
+
className: sectionCls3
|
|
29652
30340
|
}, /* @__PURE__ */ React.createElement(SeoSection, {
|
|
29653
30341
|
values: seo,
|
|
29654
30342
|
onChange: /* @__PURE__ */ __name((field, value) => setSeo((s) => ({
|
|
@@ -29658,7 +30346,7 @@ function CollectionEditPage({ collectionId }) {
|
|
|
29658
30346
|
}))))
|
|
29659
30347
|
}));
|
|
29660
30348
|
}
|
|
29661
|
-
var isCreate3, emptySlide, emptyVariant,
|
|
30349
|
+
var isCreate3, emptySlide, emptyVariant, sectionCls3, labelCls4, inputCls4;
|
|
29662
30350
|
var init_CollectionEditPage = __esm({
|
|
29663
30351
|
"src/admin/pages/CollectionEditPage.tsx"() {
|
|
29664
30352
|
"use client";
|
|
@@ -29681,7 +30369,7 @@ var init_CollectionEditPage = __esm({
|
|
|
29681
30369
|
price: "",
|
|
29682
30370
|
extraSpecs: []
|
|
29683
30371
|
}), "emptyVariant");
|
|
29684
|
-
|
|
30372
|
+
sectionCls3 = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
29685
30373
|
labelCls4 = "block text-xs font-medium text-gray-600 mb-1";
|
|
29686
30374
|
inputCls4 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm";
|
|
29687
30375
|
__name(CollectionEditPage, "CollectionEditPage");
|
|
@@ -31163,7 +31851,7 @@ function EventEditPage({ eventId }) {
|
|
|
31163
31851
|
onClick: /* @__PURE__ */ __name(() => setActiveTab("settings"), "onClick")
|
|
31164
31852
|
}, "Settings"))), /* @__PURE__ */ React.createElement(DetailPageLayout, {
|
|
31165
31853
|
main: activeTab === "basic" ? /* @__PURE__ */ React.createElement("section", {
|
|
31166
|
-
className:
|
|
31854
|
+
className: sectionCls4
|
|
31167
31855
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
31168
31856
|
className: "grid gap-3 sm:grid-cols-2"
|
|
31169
31857
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -31296,7 +31984,7 @@ function EventEditPage({ eventId }) {
|
|
|
31296
31984
|
}, "Online"), /* @__PURE__ */ React.createElement("option", {
|
|
31297
31985
|
value: "hybrid"
|
|
31298
31986
|
}, "Hybrid"))))) : activeTab === "venue" ? /* @__PURE__ */ React.createElement("section", {
|
|
31299
|
-
className:
|
|
31987
|
+
className: sectionCls4
|
|
31300
31988
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
31301
31989
|
className: "grid gap-3 sm:grid-cols-2"
|
|
31302
31990
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -31336,7 +32024,7 @@ function EventEditPage({ eventId }) {
|
|
|
31336
32024
|
onChange: /* @__PURE__ */ __name((e) => setCountry(e.target.value), "onChange"),
|
|
31337
32025
|
className: inputCls6
|
|
31338
32026
|
})))) : activeTab === "datetime" ? /* @__PURE__ */ React.createElement("section", {
|
|
31339
|
-
className:
|
|
32027
|
+
className: sectionCls4
|
|
31340
32028
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
31341
32029
|
className: "grid gap-3 sm:grid-cols-2"
|
|
31342
32030
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -31374,7 +32062,7 @@ function EventEditPage({ eventId }) {
|
|
|
31374
32062
|
onChange: /* @__PURE__ */ __name((e) => setRegistrationClosesAt(e.target.value), "onChange"),
|
|
31375
32063
|
className: inputCls6
|
|
31376
32064
|
})))) : /* @__PURE__ */ React.createElement("section", {
|
|
31377
|
-
className:
|
|
32065
|
+
className: sectionCls4
|
|
31378
32066
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
31379
32067
|
className: "space-y-6"
|
|
31380
32068
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", {
|
|
@@ -31469,7 +32157,7 @@ function EventEditPage({ eventId }) {
|
|
|
31469
32157
|
returnUrl: eventEditUrl
|
|
31470
32158
|
})) : null);
|
|
31471
32159
|
}
|
|
31472
|
-
var ADDITIONAL_VENUE_MAX_CHARS, DEFAULT_EVENT_TIMEZONE, DEFAULT_EVENT_CURRENCY, EVENT_SOCIAL_KEYS, isCreate4,
|
|
32160
|
+
var ADDITIONAL_VENUE_MAX_CHARS, DEFAULT_EVENT_TIMEZONE, DEFAULT_EVENT_CURRENCY, EVENT_SOCIAL_KEYS, isCreate4, sectionCls4, labelCls6, inputCls6, ENTITY_TYPE_OPTIONS;
|
|
31473
32161
|
var init_EventEditPage = __esm({
|
|
31474
32162
|
"src/admin/pages/EventEditPage.tsx"() {
|
|
31475
32163
|
"use client";
|
|
@@ -31494,7 +32182,7 @@ var init_EventEditPage = __esm({
|
|
|
31494
32182
|
DEFAULT_EVENT_CURRENCY = "INR";
|
|
31495
32183
|
EVENT_SOCIAL_KEYS = EVENT_SOCIAL_FIELDS.map((f) => f.key);
|
|
31496
32184
|
isCreate4 = /* @__PURE__ */ __name((id) => id === "create", "isCreate");
|
|
31497
|
-
|
|
32185
|
+
sectionCls4 = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
31498
32186
|
labelCls6 = "block text-xs font-medium text-gray-600 mb-1";
|
|
31499
32187
|
inputCls6 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm";
|
|
31500
32188
|
__name(RequiredLabel, "RequiredLabel");
|
|
@@ -31568,6 +32256,7 @@ function ComboEditPage({ comboId }) {
|
|
|
31568
32256
|
const [saving, setSaving] = React26.useState(false);
|
|
31569
32257
|
const [errors, setErrors] = React26.useState([]);
|
|
31570
32258
|
const [name, setName] = React26.useState("");
|
|
32259
|
+
const [slug, setSlug] = React26.useState("");
|
|
31571
32260
|
const [desc, setDesc] = React26.useState("");
|
|
31572
32261
|
const [eventId, setEventId] = React26.useState("");
|
|
31573
32262
|
const [priceStr, setPriceStr] = React26.useState("");
|
|
@@ -31707,6 +32396,7 @@ function ComboEditPage({ comboId }) {
|
|
|
31707
32396
|
const data = await res.json();
|
|
31708
32397
|
if (cancelled) return;
|
|
31709
32398
|
setName(data.name ?? "");
|
|
32399
|
+
setSlug(typeof data.slug === "string" ? data.slug : "");
|
|
31710
32400
|
setDesc(data.desc ?? "");
|
|
31711
32401
|
setEventId(data.eventId != null ? String(data.eventId) : "");
|
|
31712
32402
|
if (data.eventId != null) {
|
|
@@ -31747,6 +32437,7 @@ function ComboEditPage({ comboId }) {
|
|
|
31747
32437
|
if (create && duplicateSourceId) {
|
|
31748
32438
|
const rawName = (data.name ?? "").trim() || "Combo";
|
|
31749
32439
|
setName(rawName.toLowerCase().startsWith("copy of ") ? `${rawName} (copy)` : `Copy of ${rawName}`);
|
|
32440
|
+
setSlug("");
|
|
31750
32441
|
}
|
|
31751
32442
|
} catch {
|
|
31752
32443
|
if (!cancelled) setErrors([
|
|
@@ -31832,15 +32523,15 @@ function ComboEditPage({ comboId }) {
|
|
|
31832
32523
|
]);
|
|
31833
32524
|
return;
|
|
31834
32525
|
}
|
|
31835
|
-
if (addonItems.length
|
|
32526
|
+
if (addonItems.length < minSelectableItems) {
|
|
31836
32527
|
setErrors([
|
|
31837
|
-
`Please add at least ${minSelectableItems} add-on item(s). Currently ${addonItems.length} selected.`
|
|
32528
|
+
`Please add at least ${minSelectableItems} add-on item(s) so customers can meet the minimum. Currently ${addonItems.length} selected.`
|
|
31838
32529
|
]);
|
|
31839
32530
|
return;
|
|
31840
32531
|
}
|
|
31841
|
-
if (addonItems.length
|
|
32532
|
+
if (maxSelectableItems > addonItems.length) {
|
|
31842
32533
|
setErrors([
|
|
31843
|
-
`
|
|
32534
|
+
`Max add-on items (${maxSelectableItems}) cannot be greater than the number of add-on items selected (${addonItems.length}).`
|
|
31844
32535
|
]);
|
|
31845
32536
|
return;
|
|
31846
32537
|
}
|
|
@@ -31860,6 +32551,7 @@ function ComboEditPage({ comboId }) {
|
|
|
31860
32551
|
const resolvedEventId = trimmedEventId && /^\d+$/.test(trimmedEventId) ? Number(trimmedEventId) : null;
|
|
31861
32552
|
const payload = {
|
|
31862
32553
|
name: trimmedName,
|
|
32554
|
+
slug: slug.trim() || void 0,
|
|
31863
32555
|
desc: desc || null,
|
|
31864
32556
|
eventId: resolvedEventId,
|
|
31865
32557
|
price,
|
|
@@ -31951,6 +32643,14 @@ function ComboEditPage({ comboId }) {
|
|
|
31951
32643
|
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm"
|
|
31952
32644
|
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
31953
32645
|
className: "block text-xs font-medium text-gray-600 mb-1"
|
|
32646
|
+
}, "Slug"), /* @__PURE__ */ React.createElement("input", {
|
|
32647
|
+
type: "text",
|
|
32648
|
+
value: slug,
|
|
32649
|
+
onChange: /* @__PURE__ */ __name((e) => setSlug(e.target.value), "onChange"),
|
|
32650
|
+
placeholder: "Auto generate from name",
|
|
32651
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm"
|
|
32652
|
+
})), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", {
|
|
32653
|
+
className: "block text-xs font-medium text-gray-600 mb-1"
|
|
31954
32654
|
}, "Description"), /* @__PURE__ */ React.createElement("textarea", {
|
|
31955
32655
|
value: desc,
|
|
31956
32656
|
onChange: /* @__PURE__ */ __name((e) => setDesc(e.target.value), "onChange"),
|
|
@@ -32064,7 +32764,7 @@ function ComboEditPage({ comboId }) {
|
|
|
32064
32764
|
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm"
|
|
32065
32765
|
}))), /* @__PURE__ */ React.createElement("p", {
|
|
32066
32766
|
className: "text-xs text-gray-400 mt-1"
|
|
32067
|
-
}, "Customers
|
|
32767
|
+
}, "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", {
|
|
32068
32768
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32069
32769
|
}, "Availability"), /* @__PURE__ */ React.createElement("div", {
|
|
32070
32770
|
className: "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50 space-y-4"
|
|
@@ -32198,6 +32898,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32198
32898
|
const [ownerEmail, setOwnerEmail] = React26.useState("");
|
|
32199
32899
|
const [ownerPhone, setOwnerPhone] = React26.useState("");
|
|
32200
32900
|
const [ownerDesignation, setOwnerDesignation] = React26.useState("");
|
|
32901
|
+
const [ownerUserId, setOwnerUserId] = React26.useState(null);
|
|
32201
32902
|
const [termsAccepted, setTermsAccepted] = React26.useState(false);
|
|
32202
32903
|
const [reinviting, setReinviting] = React26.useState(false);
|
|
32203
32904
|
const [inviteDialog, setInviteDialog] = React26.useState(null);
|
|
@@ -32257,6 +32958,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32257
32958
|
setOwnerDesignation(readOwnerDesignation(data.metadata));
|
|
32258
32959
|
const userId = data.userId;
|
|
32259
32960
|
if (userId != null && Number.isFinite(Number(userId))) {
|
|
32961
|
+
setOwnerUserId(Number(userId));
|
|
32260
32962
|
const userRes = await fetch(`/api/users/${userId}`);
|
|
32261
32963
|
if (userRes.ok) {
|
|
32262
32964
|
const user = await userRes.json();
|
|
@@ -32266,6 +32968,8 @@ function VendorEditPage({ vendorId }) {
|
|
|
32266
32968
|
setOwnerPhone(user.phone ?? "");
|
|
32267
32969
|
}
|
|
32268
32970
|
}
|
|
32971
|
+
} else if (!cancelled) {
|
|
32972
|
+
setOwnerUserId(null);
|
|
32269
32973
|
}
|
|
32270
32974
|
} catch {
|
|
32271
32975
|
if (!cancelled) setErrors([
|
|
@@ -32480,6 +33184,13 @@ function VendorEditPage({ vendorId }) {
|
|
|
32480
33184
|
setSaving(false);
|
|
32481
33185
|
return;
|
|
32482
33186
|
}
|
|
33187
|
+
if (!ownerName.trim() || !ownerEmail.trim()) {
|
|
33188
|
+
setErrors([
|
|
33189
|
+
"Owner name and owner email are required"
|
|
33190
|
+
]);
|
|
33191
|
+
setSaving(false);
|
|
33192
|
+
return;
|
|
33193
|
+
}
|
|
32483
33194
|
const taxError = validateIndiaTaxIds(gstin.trim().toUpperCase() || null, pan.trim().toUpperCase() || null);
|
|
32484
33195
|
if (taxError) {
|
|
32485
33196
|
setErrors([
|
|
@@ -32515,6 +33226,26 @@ function VendorEditPage({ vendorId }) {
|
|
|
32515
33226
|
]);
|
|
32516
33227
|
return;
|
|
32517
33228
|
}
|
|
33229
|
+
if (ownerUserId != null) {
|
|
33230
|
+
const userRes = await fetch(`/api/users/${ownerUserId}`, {
|
|
33231
|
+
method: "PUT",
|
|
33232
|
+
headers: {
|
|
33233
|
+
"Content-Type": "application/json"
|
|
33234
|
+
},
|
|
33235
|
+
body: JSON.stringify({
|
|
33236
|
+
name: ownerName.trim(),
|
|
33237
|
+
email: ownerEmail.trim(),
|
|
33238
|
+
phone: ownerPhone.trim() || null
|
|
33239
|
+
})
|
|
33240
|
+
});
|
|
33241
|
+
if (!userRes.ok) {
|
|
33242
|
+
const data = await userRes.json().catch(() => ({}));
|
|
33243
|
+
setErrors([
|
|
33244
|
+
data.error || "Vendor saved, but updating owner details failed"
|
|
33245
|
+
]);
|
|
33246
|
+
return;
|
|
33247
|
+
}
|
|
33248
|
+
}
|
|
32518
33249
|
sonner.toast.success("Vendor saved");
|
|
32519
33250
|
router.push(listReturnUrl);
|
|
32520
33251
|
} catch {
|
|
@@ -32536,7 +33267,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32536
33267
|
className: "rounded-lg bg-white shadow-md min-h-[420px]"
|
|
32537
33268
|
}, /* @__PURE__ */ React26__namespace.default.createElement(DetailPageHeader, {
|
|
32538
33269
|
title: create ? "Add vendor" : "Edit vendor",
|
|
32539
|
-
subtitle: create ? "Register a vendor store and create the owner invite" : "Update store and registration details",
|
|
33270
|
+
subtitle: create ? "Register a vendor store and create the owner invite" : "Update store, owner, and registration details",
|
|
32540
33271
|
closeHref: listReturnUrl,
|
|
32541
33272
|
menuItems: create ? [
|
|
32542
33273
|
{
|
|
@@ -32562,7 +33293,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32562
33293
|
main: /* @__PURE__ */ React26__namespace.default.createElement(React26__namespace.default.Fragment, null, /* @__PURE__ */ React26__namespace.default.createElement("section", null, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
32563
33294
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32564
33295
|
}, "Business"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
32565
|
-
className:
|
|
33296
|
+
className: sectionCls5
|
|
32566
33297
|
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(FieldLabel, {
|
|
32567
33298
|
htmlFor: "vendorName",
|
|
32568
33299
|
required: true
|
|
@@ -32627,7 +33358,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32627
33358
|
})))), /* @__PURE__ */ React26__namespace.default.createElement("section", null, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
32628
33359
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32629
33360
|
}, "Contact"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
32630
|
-
className:
|
|
33361
|
+
className: sectionCls5
|
|
32631
33362
|
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(FieldLabel, {
|
|
32632
33363
|
htmlFor: "vendorEmail"
|
|
32633
33364
|
}, "Store email"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
@@ -32646,7 +33377,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32646
33377
|
})))), /* @__PURE__ */ React26__namespace.default.createElement("section", null, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
32647
33378
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32648
33379
|
}, "Address"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
32649
|
-
className:
|
|
33380
|
+
className: sectionCls5
|
|
32650
33381
|
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(FieldLabel, {
|
|
32651
33382
|
htmlFor: "addressLine1"
|
|
32652
33383
|
}, "Address line 1"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
@@ -32697,7 +33428,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32697
33428
|
}))))), /* @__PURE__ */ React26__namespace.default.createElement("section", null, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
32698
33429
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32699
33430
|
}, "Tax (India)"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
32700
|
-
className:
|
|
33431
|
+
className: sectionCls5
|
|
32701
33432
|
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(FieldLabel, {
|
|
32702
33433
|
htmlFor: "gstin"
|
|
32703
33434
|
}, "GSTIN"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
@@ -32717,36 +33448,33 @@ function VendorEditPage({ vendorId }) {
|
|
|
32717
33448
|
})))), /* @__PURE__ */ React26__namespace.default.createElement("section", null, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
32718
33449
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32719
33450
|
}, "Owner"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
32720
|
-
className:
|
|
33451
|
+
className: sectionCls5
|
|
32721
33452
|
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(FieldLabel, {
|
|
32722
33453
|
htmlFor: "ownerName",
|
|
32723
|
-
required:
|
|
33454
|
+
required: true
|
|
32724
33455
|
}, "Name"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
32725
33456
|
id: "ownerName",
|
|
32726
|
-
required:
|
|
32727
|
-
readOnly: !create,
|
|
33457
|
+
required: true,
|
|
32728
33458
|
value: ownerName,
|
|
32729
33459
|
onChange: /* @__PURE__ */ __name((e) => setOwnerName(e.target.value), "onChange"),
|
|
32730
|
-
className: `mt-1 ${fieldClass}
|
|
33460
|
+
className: `mt-1 ${fieldClass}`
|
|
32731
33461
|
})), /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(FieldLabel, {
|
|
32732
33462
|
htmlFor: "ownerEmail",
|
|
32733
|
-
required:
|
|
33463
|
+
required: true
|
|
32734
33464
|
}, "Email"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
32735
33465
|
id: "ownerEmail",
|
|
32736
33466
|
type: "email",
|
|
32737
|
-
required:
|
|
32738
|
-
readOnly: !create,
|
|
33467
|
+
required: true,
|
|
32739
33468
|
value: ownerEmail,
|
|
32740
33469
|
onChange: /* @__PURE__ */ __name((e) => setOwnerEmail(e.target.value), "onChange"),
|
|
32741
|
-
className: `mt-1 ${fieldClass}
|
|
33470
|
+
className: `mt-1 ${fieldClass}`
|
|
32742
33471
|
})), /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(FieldLabel, {
|
|
32743
33472
|
htmlFor: "ownerPhone"
|
|
32744
33473
|
}, "Phone"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
32745
33474
|
id: "ownerPhone",
|
|
32746
33475
|
value: ownerPhone,
|
|
32747
33476
|
onChange: /* @__PURE__ */ __name((e) => setOwnerPhone(e.target.value), "onChange"),
|
|
32748
|
-
|
|
32749
|
-
className: `mt-1 ${fieldClass} ${!create ? "bg-gray-100" : ""}`
|
|
33477
|
+
className: `mt-1 ${fieldClass}`
|
|
32750
33478
|
})), /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(FieldLabel, {
|
|
32751
33479
|
htmlFor: "ownerDesignation"
|
|
32752
33480
|
}, "Designation"), /* @__PURE__ */ React26__namespace.default.createElement(Input, {
|
|
@@ -32755,10 +33483,10 @@ function VendorEditPage({ vendorId }) {
|
|
|
32755
33483
|
onChange: /* @__PURE__ */ __name((e) => setOwnerDesignation(e.target.value), "onChange"),
|
|
32756
33484
|
placeholder: "e.g. Director, Proprietor",
|
|
32757
33485
|
className: `mt-1 ${fieldClass}`
|
|
32758
|
-
})), !create && /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
32759
|
-
className: "text-xs text-
|
|
32760
|
-
}, "
|
|
32761
|
-
className:
|
|
33486
|
+
})), !create && !ownerUserId && /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
33487
|
+
className: "text-xs text-amber-700"
|
|
33488
|
+
}, "No owner user is linked to this vendor, so owner name/email/phone cannot be saved yet."))), create && /* @__PURE__ */ React26__namespace.default.createElement("section", null, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
33489
|
+
className: sectionCls5
|
|
32762
33490
|
}, /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
32763
33491
|
className: "flex items-start gap-2"
|
|
32764
33492
|
}, /* @__PURE__ */ React26__namespace.default.createElement(Checkbox, {
|
|
@@ -32772,7 +33500,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32772
33500
|
sidebar: /* @__PURE__ */ React26__namespace.default.createElement(React26__namespace.default.Fragment, null, !create && /* @__PURE__ */ React26__namespace.default.createElement("section", null, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
32773
33501
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32774
33502
|
}, "Status"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
32775
|
-
className:
|
|
33503
|
+
className: sectionCls5
|
|
32776
33504
|
}, /* @__PURE__ */ React26__namespace.default.createElement("div", null, /* @__PURE__ */ React26__namespace.default.createElement(FieldLabel, {
|
|
32777
33505
|
htmlFor: "registrationStatus"
|
|
32778
33506
|
}, "Registration status"), /* @__PURE__ */ React26__namespace.default.createElement("select", {
|
|
@@ -32807,7 +33535,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32807
33535
|
})))), create ? /* @__PURE__ */ React26__namespace.default.createElement("section", null, /* @__PURE__ */ React26__namespace.default.createElement("h2", {
|
|
32808
33536
|
className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"
|
|
32809
33537
|
}, "Owner access"), /* @__PURE__ */ React26__namespace.default.createElement("div", {
|
|
32810
|
-
className:
|
|
33538
|
+
className: sectionCls5
|
|
32811
33539
|
}, /* @__PURE__ */ React26__namespace.default.createElement("p", {
|
|
32812
33540
|
className: "text-sm text-gray-600"
|
|
32813
33541
|
}, "Creates the vendor and an invite for the owner. After create, you can send the invite email or copy the invite link."), /* @__PURE__ */ React26__namespace.default.createElement(Button, {
|
|
@@ -32845,7 +33573,7 @@ function VendorEditPage({ vendorId }) {
|
|
|
32845
33573
|
onClick: closeInviteDialog
|
|
32846
33574
|
}, "Done")))));
|
|
32847
33575
|
}
|
|
32848
|
-
var isCreate6, fieldClass, selectClass,
|
|
33576
|
+
var isCreate6, fieldClass, selectClass, sectionCls5;
|
|
32849
33577
|
var init_VendorEditPage = __esm({
|
|
32850
33578
|
"src/admin/pages/VendorEditPage.tsx"() {
|
|
32851
33579
|
"use client";
|
|
@@ -32867,7 +33595,7 @@ var init_VendorEditPage = __esm({
|
|
|
32867
33595
|
isCreate6 = /* @__PURE__ */ __name((id) => id === "create", "isCreate");
|
|
32868
33596
|
fieldClass = "w-full rounded-md border border-gray-300 px-3 py-2 text-sm";
|
|
32869
33597
|
selectClass = `${fieldClass} bg-white`;
|
|
32870
|
-
|
|
33598
|
+
sectionCls5 = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50 space-y-4";
|
|
32871
33599
|
__name(ErrorsBanner, "ErrorsBanner");
|
|
32872
33600
|
__name(FieldLabel, "FieldLabel");
|
|
32873
33601
|
__name(VendorEditPage, "VendorEditPage");
|
|
@@ -33166,11 +33894,6 @@ function CollectionsWorkspacePage() {
|
|
|
33166
33894
|
showVendorColumn,
|
|
33167
33895
|
vendorOptions
|
|
33168
33896
|
]);
|
|
33169
|
-
const listParams = React26.useMemo(() => isCatalog ? {
|
|
33170
|
-
isCatalog: "true"
|
|
33171
|
-
} : void 0, [
|
|
33172
|
-
isCatalog
|
|
33173
|
-
]);
|
|
33174
33897
|
const createQueryParams = React26.useMemo(() => isCatalog ? {
|
|
33175
33898
|
isCatalog: "true"
|
|
33176
33899
|
} : void 0, [
|
|
@@ -33186,7 +33909,6 @@ function CollectionsWorkspacePage() {
|
|
|
33186
33909
|
createQueryParams,
|
|
33187
33910
|
defaultSortField: "sortOrder",
|
|
33188
33911
|
defaultSortOrder: "asc",
|
|
33189
|
-
extraListParams: listParams,
|
|
33190
33912
|
filters: collectionFilters
|
|
33191
33913
|
});
|
|
33192
33914
|
}
|
|
@@ -33541,6 +34263,7 @@ var init_DiscountDetailsPage = __esm({
|
|
|
33541
34263
|
category: "Category",
|
|
33542
34264
|
cart: "Cart",
|
|
33543
34265
|
paymentMethod: "Payment method",
|
|
34266
|
+
deviceType: "Device type",
|
|
33544
34267
|
order: "Order",
|
|
33545
34268
|
quantity: "Quantity",
|
|
33546
34269
|
time: "Time",
|
|
@@ -33632,6 +34355,15 @@ function conditionToRule(c) {
|
|
|
33632
34355
|
v: c.paymentMethod ?? ""
|
|
33633
34356
|
}
|
|
33634
34357
|
};
|
|
34358
|
+
case "deviceType":
|
|
34359
|
+
return {
|
|
34360
|
+
...base,
|
|
34361
|
+
type: "deviceType",
|
|
34362
|
+
comparisonOperator: "eq",
|
|
34363
|
+
value: {
|
|
34364
|
+
v: c.deviceType ?? ""
|
|
34365
|
+
}
|
|
34366
|
+
};
|
|
33635
34367
|
case "category":
|
|
33636
34368
|
return {
|
|
33637
34369
|
...base,
|
|
@@ -33804,6 +34536,12 @@ function ruleTreeToFriendly(rules) {
|
|
|
33804
34536
|
kind: "paymentMethod",
|
|
33805
34537
|
paymentMethod: v
|
|
33806
34538
|
};
|
|
34539
|
+
case "deviceType":
|
|
34540
|
+
return {
|
|
34541
|
+
id: rule._clientId ?? uid(),
|
|
34542
|
+
kind: "deviceType",
|
|
34543
|
+
deviceType: v
|
|
34544
|
+
};
|
|
33807
34545
|
case "category":
|
|
33808
34546
|
return {
|
|
33809
34547
|
id: rule._clientId ?? uid(),
|
|
@@ -34366,6 +35104,9 @@ function ConditionCard({ condition, onChange, onRemove, eventsOn }) {
|
|
|
34366
35104
|
paymentMethod: /* @__PURE__ */ React.createElement(LucideIcons.DollarSign, {
|
|
34367
35105
|
className: "h-3.5 w-3.5 text-indigo-500"
|
|
34368
35106
|
}),
|
|
35107
|
+
deviceType: /* @__PURE__ */ React.createElement(LucideIcons.DollarSign, {
|
|
35108
|
+
className: "h-3.5 w-3.5 text-cyan-500"
|
|
35109
|
+
}),
|
|
34369
35110
|
category: /* @__PURE__ */ React.createElement(LucideIcons.Package, {
|
|
34370
35111
|
className: "h-3.5 w-3.5 text-teal-500"
|
|
34371
35112
|
}),
|
|
@@ -34408,6 +35149,8 @@ function ConditionCard({ condition, onChange, onRemove, eventsOn }) {
|
|
|
34408
35149
|
}, "User type"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
34409
35150
|
value: "paymentMethod"
|
|
34410
35151
|
}, "Payment method"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
35152
|
+
value: "deviceType"
|
|
35153
|
+
}, "Device type"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
34411
35154
|
value: "category"
|
|
34412
35155
|
}, "Category"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
34413
35156
|
value: "customers"
|
|
@@ -34561,7 +35304,21 @@ function ConditionCard({ condition, onChange, onRemove, eventsOn }) {
|
|
|
34561
35304
|
value: "cod"
|
|
34562
35305
|
}, "Cash on Delivery"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
34563
35306
|
value: "wallet"
|
|
34564
|
-
}, "Wallet"))), condition.kind === "
|
|
35307
|
+
}, "Wallet"))), condition.kind === "deviceType" && /* @__PURE__ */ React.createElement(Select, {
|
|
35308
|
+
value: condition.deviceType ?? "",
|
|
35309
|
+
onValueChange: /* @__PURE__ */ __name((v) => onChange({
|
|
35310
|
+
...condition,
|
|
35311
|
+
deviceType: v
|
|
35312
|
+
}), "onValueChange")
|
|
35313
|
+
}, /* @__PURE__ */ React.createElement(SelectTrigger, {
|
|
35314
|
+
className: "h-8 text-xs"
|
|
35315
|
+
}, /* @__PURE__ */ React.createElement(SelectValue, {
|
|
35316
|
+
placeholder: "Select device type\u2026"
|
|
35317
|
+
})), /* @__PURE__ */ React.createElement(SelectContent, null, /* @__PURE__ */ React.createElement(SelectItem, {
|
|
35318
|
+
value: "web"
|
|
35319
|
+
}, "Web"), /* @__PURE__ */ React.createElement(SelectItem, {
|
|
35320
|
+
value: "mobile"
|
|
35321
|
+
}, "Mobile"))), condition.kind === "category" && /* @__PURE__ */ React.createElement(CategoryPicker, {
|
|
34565
35322
|
value: condition.categoryId,
|
|
34566
35323
|
label: condition.categoryName,
|
|
34567
35324
|
onChange: /* @__PURE__ */ __name((id, name) => onChange({
|
|
@@ -37786,6 +38543,11 @@ var init_AdminPageResolver = __esm({
|
|
|
37786
38543
|
field: "email",
|
|
37787
38544
|
displayName: "Email"
|
|
37788
38545
|
},
|
|
38546
|
+
{
|
|
38547
|
+
field: "inviteStatus",
|
|
38548
|
+
displayName: "Invite status",
|
|
38549
|
+
hideInForm: true
|
|
38550
|
+
},
|
|
37789
38551
|
{
|
|
37790
38552
|
field: "blocked",
|
|
37791
38553
|
displayName: "Blocked",
|
|
@@ -37991,6 +38753,29 @@ function LayoutSettingsPage() {
|
|
|
37991
38753
|
footer: JSON.stringify(footerValues)
|
|
37992
38754
|
})
|
|
37993
38755
|
});
|
|
38756
|
+
if (navbarConfig.logo) {
|
|
38757
|
+
await fetch("/api/settings/store", {
|
|
38758
|
+
method: "PUT",
|
|
38759
|
+
headers: {
|
|
38760
|
+
"Content-Type": "application/json"
|
|
38761
|
+
},
|
|
38762
|
+
body: JSON.stringify({
|
|
38763
|
+
invoiceLogoUrl: {
|
|
38764
|
+
value: navbarConfig.logo,
|
|
38765
|
+
type: "public"
|
|
38766
|
+
},
|
|
38767
|
+
companyLogo: {
|
|
38768
|
+
value: navbarConfig.logo,
|
|
38769
|
+
type: "public"
|
|
38770
|
+
},
|
|
38771
|
+
logo: {
|
|
38772
|
+
value: navbarConfig.logo,
|
|
38773
|
+
type: "public"
|
|
38774
|
+
}
|
|
38775
|
+
})
|
|
38776
|
+
}).catch(() => {
|
|
38777
|
+
});
|
|
38778
|
+
}
|
|
37994
38779
|
} finally {
|
|
37995
38780
|
setSaving(false);
|
|
37996
38781
|
}
|
|
@@ -38178,7 +38963,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38178
38963
|
onClick: /* @__PURE__ */ __name(() => setActiveTab("settings"), "onClick")
|
|
38179
38964
|
}, "Settings"))), /* @__PURE__ */ React.createElement(DetailPageLayout, {
|
|
38180
38965
|
main: activeTab === "basic" ? /* @__PURE__ */ React.createElement("section", {
|
|
38181
|
-
className:
|
|
38966
|
+
className: sectionCls6
|
|
38182
38967
|
}, /* @__PURE__ */ React.createElement("dl", {
|
|
38183
38968
|
className: "grid gap-4 sm:grid-cols-2"
|
|
38184
38969
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
@@ -38235,7 +39020,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38235
39020
|
}, "Mode"), /* @__PURE__ */ React.createElement("dd", {
|
|
38236
39021
|
className: valueCls
|
|
38237
39022
|
}, formatMode(event.entityMode))))) : activeTab === "venue" ? /* @__PURE__ */ React.createElement("section", {
|
|
38238
|
-
className:
|
|
39023
|
+
className: sectionCls6
|
|
38239
39024
|
}, /* @__PURE__ */ React.createElement("dl", {
|
|
38240
39025
|
className: "grid gap-4 sm:grid-cols-2"
|
|
38241
39026
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -38259,7 +39044,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38259
39044
|
}, "Country"), /* @__PURE__ */ React.createElement("dd", {
|
|
38260
39045
|
className: valueCls
|
|
38261
39046
|
}, displayValue(event.country ?? (event.cityCountry?.includes(",") ? event.cityCountry.split(",").slice(1).join(",").trim() : null)))))) : activeTab === "datetime" ? /* @__PURE__ */ React.createElement("section", {
|
|
38262
|
-
className:
|
|
39047
|
+
className: sectionCls6
|
|
38263
39048
|
}, /* @__PURE__ */ React.createElement("dl", {
|
|
38264
39049
|
className: "grid gap-4 sm:grid-cols-2"
|
|
38265
39050
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("dt", {
|
|
@@ -38291,7 +39076,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38291
39076
|
}, event.registrationClosesAt ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, regClosesFormatted.dateLine), regClosesFormatted.timeLine ? /* @__PURE__ */ React.createElement("div", {
|
|
38292
39077
|
className: "text-gray-600"
|
|
38293
39078
|
}, regClosesFormatted.timeLine) : null) : "\u2014")))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("section", {
|
|
38294
|
-
className:
|
|
39079
|
+
className: sectionCls6
|
|
38295
39080
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
38296
39081
|
className: "space-y-6"
|
|
38297
39082
|
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", {
|
|
@@ -38352,7 +39137,7 @@ function EventDetailPage({ eventId }) {
|
|
|
38352
39137
|
}))
|
|
38353
39138
|
}));
|
|
38354
39139
|
}
|
|
38355
|
-
var
|
|
39140
|
+
var sectionCls6, labelCls7, valueCls;
|
|
38356
39141
|
var init_EventDetailPage = __esm({
|
|
38357
39142
|
"src/admin/pages/EventDetailPage.tsx"() {
|
|
38358
39143
|
"use client";
|
|
@@ -38364,7 +39149,7 @@ var init_EventDetailPage = __esm({
|
|
|
38364
39149
|
init_DetailPageLayout();
|
|
38365
39150
|
init_DetailPageHeader();
|
|
38366
39151
|
init_EventProductsSection();
|
|
38367
|
-
|
|
39152
|
+
sectionCls6 = "border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
38368
39153
|
labelCls7 = "text-xs font-medium text-gray-500";
|
|
38369
39154
|
valueCls = "text-sm text-gray-900 mt-0.5";
|
|
38370
39155
|
__name(displayValue, "displayValue");
|
|
@@ -38417,18 +39202,26 @@ var init_config = __esm({
|
|
|
38417
39202
|
];
|
|
38418
39203
|
}
|
|
38419
39204
|
});
|
|
39205
|
+
function ForceAdminLightMode() {
|
|
39206
|
+
useForceAdminLightMode();
|
|
39207
|
+
return null;
|
|
39208
|
+
}
|
|
38420
39209
|
function CmsProviders({ children }) {
|
|
38421
39210
|
return /* @__PURE__ */ React.createElement(nextThemes.ThemeProvider, {
|
|
38422
39211
|
attribute: "class",
|
|
38423
|
-
defaultTheme: "
|
|
38424
|
-
|
|
38425
|
-
|
|
39212
|
+
defaultTheme: "light",
|
|
39213
|
+
forcedTheme: "light",
|
|
39214
|
+
enableSystem: false,
|
|
39215
|
+
enableColorScheme: true
|
|
39216
|
+
}, /* @__PURE__ */ React.createElement(ForceAdminLightMode, null), children, /* @__PURE__ */ React.createElement(sonner.Toaster, {
|
|
38426
39217
|
position: "top-right"
|
|
38427
39218
|
}));
|
|
38428
39219
|
}
|
|
38429
39220
|
var init_CmsProviders = __esm({
|
|
38430
39221
|
"src/admin/CmsProviders.tsx"() {
|
|
38431
39222
|
"use client";
|
|
39223
|
+
init_force_light_mode();
|
|
39224
|
+
__name(ForceAdminLightMode, "ForceAdminLightMode");
|
|
38432
39225
|
__name(CmsProviders, "CmsProviders");
|
|
38433
39226
|
}
|
|
38434
39227
|
});
|