@infuro/cms-core 1.0.12 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin.cjs +1326 -544
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.js +1170 -388
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +1486 -98
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1485 -97
- package/dist/api.js.map +1 -1
- package/dist/auth.cjs +62 -19
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +12 -1
- package/dist/auth.d.ts +12 -1
- package/dist/auth.js +62 -19
- package/dist/auth.js.map +1 -1
- package/dist/{index-JrST6EIC.d.cts → index-BQnqJ7EO.d.cts} +30 -4
- package/dist/{index-C4Yl7js9.d.ts → index-BiagwMjV.d.ts} +30 -4
- package/dist/index.cjs +3305 -936
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +359 -54
- package/dist/index.d.ts +359 -54
- package/dist/index.js +3114 -768
- package/dist/index.js.map +1 -1
- package/dist/migrations/1774600000000-OrderKindParentOrderNumber.ts +36 -0
- package/dist/migrations/1774800000000-OtpChallengesUserPhone.ts +41 -0
- package/dist/migrations/1774900000000-MessageTemplates.ts +39 -0
- package/dist/migrations/1775000000000-ProductUomTypeOrderItemSnapshots.ts +29 -0
- package/package.json +1 -1
package/dist/admin.js
CHANGED
|
@@ -334,7 +334,7 @@ var AdminConfigContext = createContext(defaultValue);
|
|
|
334
334
|
var 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==";
|
|
335
335
|
|
|
336
336
|
// src/lib/cms-version.ts
|
|
337
|
-
var CMS_VERSION = true ? "1.0.
|
|
337
|
+
var CMS_VERSION = true ? "1.0.15" : "0.0.0";
|
|
338
338
|
|
|
339
339
|
// src/components/Admin/Sidebar.tsx
|
|
340
340
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -740,9 +740,7 @@ function useAdminViewSettings() {
|
|
|
740
740
|
}, []);
|
|
741
741
|
}
|
|
742
742
|
function AdminLayoutInner({ children }) {
|
|
743
|
-
const
|
|
744
|
-
const session = sessionState?.data;
|
|
745
|
-
const status = sessionState?.status ?? "loading";
|
|
743
|
+
const { data: session, status } = useSession2();
|
|
746
744
|
const router = useRouter();
|
|
747
745
|
const pathname = usePathname3();
|
|
748
746
|
const [loadingTimeout, setLoadingTimeout] = useState2(false);
|
|
@@ -5998,6 +5996,8 @@ function OrderDetailPage({ orderId }) {
|
|
|
5998
5996
|
const [order, setOrder] = useState23(null);
|
|
5999
5997
|
const [loading, setLoading] = useState23(true);
|
|
6000
5998
|
const [error, setError] = useState23(null);
|
|
5999
|
+
const [erpEnabled, setErpEnabled] = useState23(false);
|
|
6000
|
+
const [reposting, setReposting] = useState23(false);
|
|
6001
6001
|
useEffect21(() => {
|
|
6002
6002
|
async function load() {
|
|
6003
6003
|
try {
|
|
@@ -6021,6 +6021,39 @@ function OrderDetailPage({ orderId }) {
|
|
|
6021
6021
|
}
|
|
6022
6022
|
load();
|
|
6023
6023
|
}, [orderId]);
|
|
6024
|
+
useEffect21(() => {
|
|
6025
|
+
let cancelled = false;
|
|
6026
|
+
(async () => {
|
|
6027
|
+
try {
|
|
6028
|
+
const res = await fetch(`/api/orders/${orderId}/repost-erp`);
|
|
6029
|
+
if (!res.ok) return;
|
|
6030
|
+
const data = await res.json();
|
|
6031
|
+
if (!cancelled) setErpEnabled(data.enabled === true);
|
|
6032
|
+
} catch {
|
|
6033
|
+
}
|
|
6034
|
+
})();
|
|
6035
|
+
return () => {
|
|
6036
|
+
cancelled = true;
|
|
6037
|
+
};
|
|
6038
|
+
}, [orderId]);
|
|
6039
|
+
async function handleRepostToErp() {
|
|
6040
|
+
if (reposting) return;
|
|
6041
|
+
setReposting(true);
|
|
6042
|
+
setError(null);
|
|
6043
|
+
try {
|
|
6044
|
+
const res = await fetch(`/api/orders/${orderId}/repost-erp`, { method: "POST" });
|
|
6045
|
+
if (!res.ok) {
|
|
6046
|
+
const body = await res.json().catch(() => ({}));
|
|
6047
|
+
setError(body.error ?? "Failed to repost to ERP");
|
|
6048
|
+
return;
|
|
6049
|
+
}
|
|
6050
|
+
router.refresh();
|
|
6051
|
+
} catch {
|
|
6052
|
+
setError("Failed to repost to ERP");
|
|
6053
|
+
} finally {
|
|
6054
|
+
setReposting(false);
|
|
6055
|
+
}
|
|
6056
|
+
}
|
|
6024
6057
|
if (loading) {
|
|
6025
6058
|
return /* @__PURE__ */ jsx49("div", { className: "rounded-lg bg-white p-6 shadow-md", children: /* @__PURE__ */ jsx49("div", { className: "flex justify-center py-12", children: /* @__PURE__ */ jsx49("span", { className: "text-gray-500", children: "Loading..." }) }) });
|
|
6026
6059
|
}
|
|
@@ -6043,7 +6076,8 @@ function OrderDetailPage({ orderId }) {
|
|
|
6043
6076
|
{
|
|
6044
6077
|
title: `Order ${order.orderNumber}`,
|
|
6045
6078
|
subtitle: /* @__PURE__ */ jsx49("span", { className: "text-sm text-gray-400", children: formatDateTime(order.createdAt) }),
|
|
6046
|
-
closeHref: "/admin/orders"
|
|
6079
|
+
closeHref: "/admin/orders",
|
|
6080
|
+
menuItems: erpEnabled ? [{ label: reposting ? "Reposting..." : "Repost to ERP", onClick: handleRepostToErp }] : void 0
|
|
6047
6081
|
}
|
|
6048
6082
|
),
|
|
6049
6083
|
/* @__PURE__ */ jsx49(
|
|
@@ -6080,9 +6114,86 @@ function OrderDetailPage({ orderId }) {
|
|
|
6080
6114
|
/* @__PURE__ */ jsxs40("div", { className: "min-w-0", children: [
|
|
6081
6115
|
/* @__PURE__ */ jsx49("dt", { className: "text-gray-500", children: "Total" }),
|
|
6082
6116
|
/* @__PURE__ */ jsx49("dd", { className: "font-medium text-gray-900", children: formatMoney(Number(order.total), currency) })
|
|
6117
|
+
] }),
|
|
6118
|
+
(order.orderKind || order.parentOrderId != null) && /* @__PURE__ */ jsxs40(Fragment7, { children: [
|
|
6119
|
+
/* @__PURE__ */ jsxs40("div", { className: "min-w-0", children: [
|
|
6120
|
+
/* @__PURE__ */ jsx49("dt", { className: "text-gray-500", children: "Kind" }),
|
|
6121
|
+
/* @__PURE__ */ jsx49("dd", { className: "font-medium text-gray-900 capitalize", children: order.orderKind ?? "sale" })
|
|
6122
|
+
] }),
|
|
6123
|
+
order.parentOrderId != null && /* @__PURE__ */ jsxs40("div", { className: "min-w-0", children: [
|
|
6124
|
+
/* @__PURE__ */ jsx49("dt", { className: "text-gray-500", children: "Parent order" }),
|
|
6125
|
+
/* @__PURE__ */ jsx49("dd", { className: "font-medium text-gray-900", children: /* @__PURE__ */ jsxs40(
|
|
6126
|
+
Link10,
|
|
6127
|
+
{
|
|
6128
|
+
href: `/admin/orders/${order.parentOrderId}/view`,
|
|
6129
|
+
className: "text-blue-600 hover:underline",
|
|
6130
|
+
children: [
|
|
6131
|
+
"#",
|
|
6132
|
+
order.parentOrderId
|
|
6133
|
+
]
|
|
6134
|
+
}
|
|
6135
|
+
) })
|
|
6136
|
+
] })
|
|
6083
6137
|
] })
|
|
6084
6138
|
] }) })
|
|
6085
6139
|
] }),
|
|
6140
|
+
(() => {
|
|
6141
|
+
const fulfillment = order.metadata?.fulfillment;
|
|
6142
|
+
if (!fulfillment?.status && !fulfillment?.trackingId && !(fulfillment?.events && fulfillment.events.length))
|
|
6143
|
+
return null;
|
|
6144
|
+
return /* @__PURE__ */ jsxs40("section", { children: [
|
|
6145
|
+
/* @__PURE__ */ jsx49("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Fulfillment" }),
|
|
6146
|
+
/* @__PURE__ */ jsxs40("div", { className: "min-w-0 border border-gray-200 rounded-lg p-4 bg-gray-50/50 text-sm space-y-2", children: [
|
|
6147
|
+
fulfillment.status && /* @__PURE__ */ jsxs40("p", { children: [
|
|
6148
|
+
/* @__PURE__ */ jsx49("span", { className: "text-gray-500", children: "Status: " }),
|
|
6149
|
+
/* @__PURE__ */ jsx49("span", { className: "font-medium text-gray-900", children: fulfillment.status })
|
|
6150
|
+
] }),
|
|
6151
|
+
fulfillment.trackingId && /* @__PURE__ */ jsxs40("p", { children: [
|
|
6152
|
+
/* @__PURE__ */ jsx49("span", { className: "text-gray-500", children: "Tracking: " }),
|
|
6153
|
+
/* @__PURE__ */ jsx49("span", { className: "font-mono text-gray-900", children: fulfillment.trackingId })
|
|
6154
|
+
] }),
|
|
6155
|
+
fulfillment.events && fulfillment.events.length > 0 && /* @__PURE__ */ jsx49("ul", { className: "mt-3 space-y-2 border-t border-gray-200 pt-3", children: fulfillment.events.map((ev, i) => /* @__PURE__ */ jsxs40("li", { className: "text-gray-800", children: [
|
|
6156
|
+
ev.at && /* @__PURE__ */ jsx49("span", { className: "text-gray-500 text-xs block", children: ev.at }),
|
|
6157
|
+
ev.label && /* @__PURE__ */ jsx49("span", { className: "font-medium", children: ev.label }),
|
|
6158
|
+
ev.detail && /* @__PURE__ */ jsx49("span", { className: "text-gray-600 ml-1", children: ev.detail })
|
|
6159
|
+
] }, i)) })
|
|
6160
|
+
] })
|
|
6161
|
+
] });
|
|
6162
|
+
})(),
|
|
6163
|
+
(order.orderKind ?? "sale") === "sale" && /* @__PURE__ */ jsxs40("section", { children: [
|
|
6164
|
+
/* @__PURE__ */ jsx49("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Invoice" }),
|
|
6165
|
+
/* @__PURE__ */ jsxs40("div", { className: "min-w-0 border border-gray-200 rounded-lg p-4 bg-gray-50/50 text-sm", children: [
|
|
6166
|
+
order.metadata?.invoice?.invoiceNumber && /* @__PURE__ */ jsxs40("p", { className: "text-gray-700 mb-2", children: [
|
|
6167
|
+
"#",
|
|
6168
|
+
String((order.metadata?.invoice).invoiceNumber)
|
|
6169
|
+
] }),
|
|
6170
|
+
/* @__PURE__ */ jsx49(
|
|
6171
|
+
"a",
|
|
6172
|
+
{
|
|
6173
|
+
href: `/api/orders/${order.id}/invoice`,
|
|
6174
|
+
target: "_blank",
|
|
6175
|
+
rel: "noopener noreferrer",
|
|
6176
|
+
className: "text-blue-600 font-medium hover:underline",
|
|
6177
|
+
children: "Download invoice PDF"
|
|
6178
|
+
}
|
|
6179
|
+
)
|
|
6180
|
+
] })
|
|
6181
|
+
] }),
|
|
6182
|
+
(order.relatedOrders ?? []).length > 0 && /* @__PURE__ */ jsxs40("section", { children: [
|
|
6183
|
+
/* @__PURE__ */ jsx49("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Returns & replacements" }),
|
|
6184
|
+
/* @__PURE__ */ jsx49("div", { className: "min-w-0 border border-gray-200 rounded-lg overflow-hidden", children: /* @__PURE__ */ jsxs40(Table, { children: [
|
|
6185
|
+
/* @__PURE__ */ jsx49(TableHeader, { children: /* @__PURE__ */ jsxs40(TableRow, { className: "bg-gray-50", children: [
|
|
6186
|
+
/* @__PURE__ */ jsx49(TableHead, { className: "font-medium", children: "Number" }),
|
|
6187
|
+
/* @__PURE__ */ jsx49(TableHead, { className: "font-medium", children: "Kind" }),
|
|
6188
|
+
/* @__PURE__ */ jsx49(TableHead, { className: "font-medium", children: "Status" })
|
|
6189
|
+
] }) }),
|
|
6190
|
+
/* @__PURE__ */ jsx49(TableBody, { children: (order.relatedOrders ?? []).map((r) => /* @__PURE__ */ jsxs40(TableRow, { children: [
|
|
6191
|
+
/* @__PURE__ */ jsx49(TableCell, { children: /* @__PURE__ */ jsx49(Link10, { href: `/admin/orders/${r.id}/view`, className: "text-blue-600 hover:underline font-medium", children: r.orderNumber }) }),
|
|
6192
|
+
/* @__PURE__ */ jsx49(TableCell, { className: "capitalize", children: r.orderKind ?? "\u2014" }),
|
|
6193
|
+
/* @__PURE__ */ jsx49(TableCell, { className: "capitalize", children: r.status ?? "\u2014" })
|
|
6194
|
+
] }, r.id)) })
|
|
6195
|
+
] }) })
|
|
6196
|
+
] }),
|
|
6086
6197
|
/* @__PURE__ */ jsxs40("section", { children: [
|
|
6087
6198
|
/* @__PURE__ */ jsx49("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Line items" }),
|
|
6088
6199
|
/* @__PURE__ */ jsx49("div", { className: "min-w-0 overflow-x-auto border border-gray-200 rounded-lg", children: /* @__PURE__ */ jsxs40(Table, { children: [
|
|
@@ -7805,33 +7916,50 @@ function RightSidebar({ theme, resolver, activeTab, setActiveTab, seoProps }) {
|
|
|
7805
7916
|
] })
|
|
7806
7917
|
] });
|
|
7807
7918
|
}
|
|
7808
|
-
function SaveButton({
|
|
7919
|
+
function SaveButton({
|
|
7920
|
+
pageId,
|
|
7921
|
+
pageData,
|
|
7922
|
+
existingSeoId,
|
|
7923
|
+
onSeoIdChange,
|
|
7924
|
+
onSaved,
|
|
7925
|
+
children,
|
|
7926
|
+
className
|
|
7927
|
+
}) {
|
|
7809
7928
|
const { query } = useEditor();
|
|
7810
7929
|
const [saving, setSaving] = useState28(false);
|
|
7811
7930
|
const handleSave = async () => {
|
|
7812
7931
|
setSaving(true);
|
|
7813
7932
|
try {
|
|
7814
7933
|
const content = JSON.parse(query.serialize());
|
|
7815
|
-
let
|
|
7816
|
-
const hasSeo = pageData.seoTitle || pageData.seoDescription || pageData.seoKeywords;
|
|
7934
|
+
let resolvedSeoId = existingSeoId;
|
|
7935
|
+
const hasSeo = pageData.seoTitle || pageData.seoDescription || pageData.seoKeywords || pageData.seoOgTitle || pageData.seoOgDescription || pageData.seoOgImage;
|
|
7817
7936
|
if (hasSeo) {
|
|
7818
7937
|
const seoPayload = {
|
|
7819
|
-
title: pageData.seoTitle,
|
|
7820
|
-
description: pageData.seoDescription,
|
|
7821
|
-
keywords: pageData.seoKeywords,
|
|
7822
|
-
ogTitle: pageData.seoOgTitle,
|
|
7823
|
-
ogDescription: pageData.seoOgDescription,
|
|
7824
|
-
ogImage: pageData.seoOgImage,
|
|
7938
|
+
title: pageData.seoTitle || null,
|
|
7939
|
+
description: pageData.seoDescription || null,
|
|
7940
|
+
keywords: pageData.seoKeywords || null,
|
|
7941
|
+
ogTitle: pageData.seoOgTitle || null,
|
|
7942
|
+
ogDescription: pageData.seoOgDescription || null,
|
|
7943
|
+
ogImage: pageData.seoOgImage || null,
|
|
7825
7944
|
slug: pageData.slug
|
|
7826
7945
|
};
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7946
|
+
if (existingSeoId) {
|
|
7947
|
+
const seoRes = await fetch(`/api/seos/${existingSeoId}`, {
|
|
7948
|
+
method: "PUT",
|
|
7949
|
+
headers: { "Content-Type": "application/json" },
|
|
7950
|
+
body: JSON.stringify(seoPayload)
|
|
7951
|
+
});
|
|
7952
|
+
if (seoRes.ok) resolvedSeoId = existingSeoId;
|
|
7953
|
+
} else {
|
|
7954
|
+
const seoRes = await fetch("/api/seos", {
|
|
7955
|
+
method: "POST",
|
|
7956
|
+
headers: { "Content-Type": "application/json" },
|
|
7957
|
+
body: JSON.stringify(seoPayload)
|
|
7958
|
+
});
|
|
7959
|
+
if (seoRes.ok) {
|
|
7960
|
+
const seoData = await seoRes.json();
|
|
7961
|
+
resolvedSeoId = seoData.id ?? null;
|
|
7962
|
+
}
|
|
7835
7963
|
}
|
|
7836
7964
|
}
|
|
7837
7965
|
const payload = {
|
|
@@ -7840,7 +7968,7 @@ function SaveButton({ pageId, pageData, onSaved, children, className }) {
|
|
|
7840
7968
|
content,
|
|
7841
7969
|
published: pageData.published
|
|
7842
7970
|
};
|
|
7843
|
-
if (
|
|
7971
|
+
if (resolvedSeoId != null) payload.seoId = resolvedSeoId;
|
|
7844
7972
|
const url = pageId ? `/api/pages/${pageId}` : "/api/pages";
|
|
7845
7973
|
const method = pageId ? "PUT" : "POST";
|
|
7846
7974
|
const res = await fetch(url, {
|
|
@@ -7850,6 +7978,8 @@ function SaveButton({ pageId, pageData, onSaved, children, className }) {
|
|
|
7850
7978
|
});
|
|
7851
7979
|
if (res.ok) {
|
|
7852
7980
|
const saved = await res.json();
|
|
7981
|
+
const nextSeo = saved.seoId != null && saved.seoId !== "" ? Number(saved.seoId) : resolvedSeoId;
|
|
7982
|
+
if (Number.isFinite(nextSeo)) onSeoIdChange(nextSeo);
|
|
7853
7983
|
onSaved(saved.id?.toString() || pageId || "");
|
|
7854
7984
|
}
|
|
7855
7985
|
} finally {
|
|
@@ -7882,9 +8012,11 @@ function PageBuilderPage({ pageId }) {
|
|
|
7882
8012
|
const [seoOgTitle, setSeoOgTitle] = useState28("");
|
|
7883
8013
|
const [seoOgDescription, setSeoOgDescription] = useState28("");
|
|
7884
8014
|
const [seoOgImage, setSeoOgImage] = useState28("");
|
|
8015
|
+
const [pageSeoId, setPageSeoId] = useState28(null);
|
|
7885
8016
|
useEffect26(() => {
|
|
7886
8017
|
if (!pageId) {
|
|
7887
8018
|
setInitialContent(null);
|
|
8019
|
+
setPageSeoId(null);
|
|
7888
8020
|
setLoading(false);
|
|
7889
8021
|
return;
|
|
7890
8022
|
}
|
|
@@ -7893,6 +8025,9 @@ function PageBuilderPage({ pageId }) {
|
|
|
7893
8025
|
setTitle(data.title || "");
|
|
7894
8026
|
setSlug(data.slug || "");
|
|
7895
8027
|
setPublished(data.published || false);
|
|
8028
|
+
setPageSeoId(
|
|
8029
|
+
data.seoId != null && data.seoId !== "" ? Number(data.seoId) : data.seo?.id != null ? Number(data.seo.id) : null
|
|
8030
|
+
);
|
|
7896
8031
|
if (data.content) {
|
|
7897
8032
|
setInitialContent(JSON.stringify(data.content));
|
|
7898
8033
|
}
|
|
@@ -7946,6 +8081,8 @@ function PageBuilderPage({ pageId }) {
|
|
|
7946
8081
|
SaveButton,
|
|
7947
8082
|
{
|
|
7948
8083
|
pageId,
|
|
8084
|
+
existingSeoId: pageSeoId,
|
|
8085
|
+
onSeoIdChange: setPageSeoId,
|
|
7949
8086
|
pageData: { title, slug, published, seoTitle, seoDescription, seoKeywords, seoOgTitle, seoOgDescription, seoOgImage },
|
|
7950
8087
|
onSaved: (id) => {
|
|
7951
8088
|
if (!pageId) router.replace(`/admin/pages/${id}`);
|
|
@@ -8024,7 +8161,7 @@ function PageBuilderPage({ pageId }) {
|
|
|
8024
8161
|
|
|
8025
8162
|
// src/admin/pages/PluginsPage.tsx
|
|
8026
8163
|
import { useContext as useContext5, useState as useState29, useEffect as useEffect27 } from "react";
|
|
8027
|
-
import { HardDrive, Mail, CreditCard as CreditCard2, MessageCircle, Puzzle as Puzzle2, CheckCircle2 as CheckCircle22, XCircle, Save as Save5, X as X18, Plus as Plus8 } from "lucide-react";
|
|
8164
|
+
import { HardDrive, Mail, CreditCard as CreditCard2, MessageCircle, BarChart3 as BarChart32, Building2 as Building22, Puzzle as Puzzle2, CheckCircle2 as CheckCircle22, XCircle, Save as Save5, X as X18, Plus as Plus8, Smartphone } from "lucide-react";
|
|
8028
8165
|
|
|
8029
8166
|
// src/lib/email-recipients.ts
|
|
8030
8167
|
function parseEmailRecipientsFromConfig(raw) {
|
|
@@ -8045,15 +8182,57 @@ function serializeEmailRecipients(emails) {
|
|
|
8045
8182
|
return JSON.stringify(emails);
|
|
8046
8183
|
}
|
|
8047
8184
|
|
|
8185
|
+
// src/components/ui/checkbox.tsx
|
|
8186
|
+
import * as React19 from "react";
|
|
8187
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
8188
|
+
import { Check as Check6 } from "lucide-react";
|
|
8189
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
8190
|
+
var Checkbox = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
8191
|
+
CheckboxPrimitive.Root,
|
|
8192
|
+
{
|
|
8193
|
+
ref,
|
|
8194
|
+
className: cn(
|
|
8195
|
+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
8196
|
+
className
|
|
8197
|
+
),
|
|
8198
|
+
...props,
|
|
8199
|
+
children: /* @__PURE__ */ jsx55(
|
|
8200
|
+
CheckboxPrimitive.Indicator,
|
|
8201
|
+
{
|
|
8202
|
+
className: cn("flex items-center justify-center text-current"),
|
|
8203
|
+
children: /* @__PURE__ */ jsx55(Check6, { className: "h-4 w-4" })
|
|
8204
|
+
}
|
|
8205
|
+
)
|
|
8206
|
+
}
|
|
8207
|
+
));
|
|
8208
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
8209
|
+
|
|
8048
8210
|
// src/admin/pages/PluginsPage.tsx
|
|
8049
8211
|
import { toast as toast4 } from "sonner";
|
|
8050
|
-
import { Fragment as Fragment12, jsx as
|
|
8212
|
+
import { Fragment as Fragment12, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
8213
|
+
function normalizeChatMode(raw) {
|
|
8214
|
+
if (raw === "external" || raw === "llm") return raw;
|
|
8215
|
+
return "whatsapp";
|
|
8216
|
+
}
|
|
8051
8217
|
var ICON_MAP = {
|
|
8052
8218
|
storage: HardDrive,
|
|
8053
8219
|
email: Mail,
|
|
8054
8220
|
payment: CreditCard2,
|
|
8055
|
-
llm: MessageCircle
|
|
8221
|
+
llm: MessageCircle,
|
|
8222
|
+
analytics: BarChart32,
|
|
8223
|
+
erp: Building22,
|
|
8224
|
+
sms: Smartphone
|
|
8056
8225
|
};
|
|
8226
|
+
function normalizeSmsProviderChoice(raw) {
|
|
8227
|
+
const x = (raw || "auto").toLowerCase().trim();
|
|
8228
|
+
if (x === "msg91" || x === "twilio" || x === "webhook" || x === "auto") return x;
|
|
8229
|
+
return "auto";
|
|
8230
|
+
}
|
|
8231
|
+
function normalizeMsg91ApiMode(raw) {
|
|
8232
|
+
const x = (raw || "auto").toLowerCase().trim();
|
|
8233
|
+
if (x === "flow" || x === "sendhttp" || x === "auto") return x;
|
|
8234
|
+
return "auto";
|
|
8235
|
+
}
|
|
8057
8236
|
function splitInputToEmails(input) {
|
|
8058
8237
|
return input.split(/[,;]+/).map((s) => s.trim()).filter(Boolean);
|
|
8059
8238
|
}
|
|
@@ -8107,26 +8286,26 @@ function EmailRecipientTags({
|
|
|
8107
8286
|
setDraft("");
|
|
8108
8287
|
};
|
|
8109
8288
|
return /* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8110
|
-
/* @__PURE__ */
|
|
8289
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: id, className: "text-sm", children: label }),
|
|
8111
8290
|
/* @__PURE__ */ jsxs46(
|
|
8112
8291
|
"div",
|
|
8113
8292
|
{
|
|
8114
8293
|
className: "flex min-h-9 flex-wrap items-center gap-1.5 rounded-md border border-input bg-background px-2 py-1.5 text-sm ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 dark:border-gray-600",
|
|
8115
8294
|
children: [
|
|
8116
8295
|
emails.map((email) => /* @__PURE__ */ jsxs46(Badge, { variant: "secondary", className: "gap-1 pr-0.5 font-normal", children: [
|
|
8117
|
-
/* @__PURE__ */
|
|
8118
|
-
/* @__PURE__ */
|
|
8296
|
+
/* @__PURE__ */ jsx56("span", { className: "max-w-[220px] truncate", children: email }),
|
|
8297
|
+
/* @__PURE__ */ jsx56(
|
|
8119
8298
|
"button",
|
|
8120
8299
|
{
|
|
8121
8300
|
type: "button",
|
|
8122
8301
|
className: "rounded p-0.5 hover:bg-muted",
|
|
8123
8302
|
"aria-label": `Remove ${email}`,
|
|
8124
8303
|
onClick: () => onChange(emails.filter((e) => e !== email)),
|
|
8125
|
-
children: /* @__PURE__ */
|
|
8304
|
+
children: /* @__PURE__ */ jsx56(X18, { className: "h-3 w-3" })
|
|
8126
8305
|
}
|
|
8127
8306
|
)
|
|
8128
8307
|
] }, email)),
|
|
8129
|
-
/* @__PURE__ */
|
|
8308
|
+
/* @__PURE__ */ jsx56(
|
|
8130
8309
|
"input",
|
|
8131
8310
|
{
|
|
8132
8311
|
id,
|
|
@@ -8153,14 +8332,14 @@ function EmailRecipientTags({
|
|
|
8153
8332
|
]
|
|
8154
8333
|
}
|
|
8155
8334
|
),
|
|
8156
|
-
/* @__PURE__ */
|
|
8335
|
+
/* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: hint })
|
|
8157
8336
|
] });
|
|
8158
8337
|
}
|
|
8159
8338
|
function PluginIcon({ descriptor, size = "md" }) {
|
|
8160
8339
|
const Icon2 = descriptor.icon ? ICON_MAP[descriptor.icon] ?? Puzzle2 : Puzzle2;
|
|
8161
8340
|
const sizeClass = size === "sm" ? "h-8 w-8" : "h-11 w-11";
|
|
8162
8341
|
const iconClass = size === "sm" ? "h-4 w-4" : "h-5 w-5";
|
|
8163
|
-
return /* @__PURE__ */
|
|
8342
|
+
return /* @__PURE__ */ jsx56("div", { className: `flex shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ${sizeClass}`, children: /* @__PURE__ */ jsx56(Icon2, { className: iconClass }) });
|
|
8164
8343
|
}
|
|
8165
8344
|
function PluginSettingsPanel({
|
|
8166
8345
|
descriptor,
|
|
@@ -8169,6 +8348,8 @@ function PluginSettingsPanel({
|
|
|
8169
8348
|
const settingsGroup = descriptor.settingsGroup;
|
|
8170
8349
|
const isLlm = settingsGroup === "llm";
|
|
8171
8350
|
const isEmail = settingsGroup === "email";
|
|
8351
|
+
const isErp = settingsGroup === "erp";
|
|
8352
|
+
const isSms = settingsGroup === "sms";
|
|
8172
8353
|
const [enabled, setEnabled] = useState29(true);
|
|
8173
8354
|
const [botName, setBotName] = useState29("");
|
|
8174
8355
|
const [icon, setIcon] = useState29("");
|
|
@@ -8185,18 +8366,59 @@ function PluginSettingsPanel({
|
|
|
8185
8366
|
const [followUsTitle, setFollowUsTitle] = useState29("Follow Us");
|
|
8186
8367
|
const [socialLinkRows, setSocialLinkRows] = useState29([{ ...EMPTY_SOCIAL_ROW }]);
|
|
8187
8368
|
const [footerDisclaimer, setFooterDisclaimer] = useState29("");
|
|
8369
|
+
const [chatMode, setChatMode] = useState29("whatsapp");
|
|
8370
|
+
const [whatsappPhone, setWhatsappPhone] = useState29("");
|
|
8371
|
+
const [externalChatSnippet, setExternalChatSnippet] = useState29("");
|
|
8372
|
+
const [erpPipelineName, setErpPipelineName] = useState29("");
|
|
8373
|
+
const [erpPipelineStageName, setErpPipelineStageName] = useState29("");
|
|
8374
|
+
const [erpFormsCatalog, setErpFormsCatalog] = useState29([]);
|
|
8375
|
+
const [erpOpportunityFormIds, setErpOpportunityFormIds] = useState29([]);
|
|
8376
|
+
const [erpOpportunityIdsKeyPresent, setErpOpportunityIdsKeyPresent] = useState29(false);
|
|
8377
|
+
const [smsProviderChoice, setSmsProviderChoice] = useState29("auto");
|
|
8378
|
+
const [msg91ApiMode, setMsg91ApiMode] = useState29("auto");
|
|
8379
|
+
const [smsTplItems, setSmsTplItems] = useState29([]);
|
|
8188
8380
|
const [loading, setLoading] = useState29(true);
|
|
8189
8381
|
const [saving, setSaving] = useState29(false);
|
|
8190
8382
|
useEffect27(() => {
|
|
8191
|
-
|
|
8383
|
+
setLoading(true);
|
|
8384
|
+
fetch(`/api/settings/${settingsGroup}`).then((r) => r.ok ? r.json() : {}).then(async (data) => {
|
|
8192
8385
|
setEnabled(data.enabled !== "false");
|
|
8193
8386
|
setBotName(data.botName ?? "");
|
|
8194
8387
|
setIcon(data.icon ?? "");
|
|
8195
8388
|
if (isLlm) {
|
|
8389
|
+
setChatMode(normalizeChatMode(data.chatMode));
|
|
8390
|
+
setWhatsappPhone(data.whatsappPhone ?? "");
|
|
8391
|
+
setExternalChatSnippet(data.externalChatSnippet ?? "");
|
|
8196
8392
|
setIconImageUrl(data.iconImageUrl ?? "");
|
|
8197
8393
|
setIconBackgroundColor(data.iconBackgroundColor ?? "#6366f1");
|
|
8198
8394
|
setHeaderColor(data.headerColor ?? "#6366f1");
|
|
8199
8395
|
}
|
|
8396
|
+
if (isErp) {
|
|
8397
|
+
setErpPipelineName(data.pipelineName ?? data.pipelineId ?? "");
|
|
8398
|
+
setErpPipelineStageName(data.pipelineStageName ?? data.pipelineStageId ?? "");
|
|
8399
|
+
const rawOpp = data.opportunityFormIds;
|
|
8400
|
+
const keyPresent = rawOpp !== void 0 && rawOpp !== null && String(rawOpp).trim() !== "";
|
|
8401
|
+
setErpOpportunityIdsKeyPresent(keyPresent);
|
|
8402
|
+
if (keyPresent) {
|
|
8403
|
+
try {
|
|
8404
|
+
const p = JSON.parse(String(rawOpp));
|
|
8405
|
+
const ids = Array.isArray(p) ? p.map((x) => typeof x === "number" ? x : Number(x)).filter((n) => Number.isInteger(n) && n > 0) : [];
|
|
8406
|
+
setErpOpportunityFormIds([...new Set(ids)]);
|
|
8407
|
+
} catch {
|
|
8408
|
+
setErpOpportunityFormIds([]);
|
|
8409
|
+
}
|
|
8410
|
+
} else {
|
|
8411
|
+
setErpOpportunityFormIds([]);
|
|
8412
|
+
}
|
|
8413
|
+
}
|
|
8414
|
+
if (isSms) {
|
|
8415
|
+
setSmsProviderChoice(normalizeSmsProviderChoice(data.smsProvider ?? data.SMS_PROVIDER));
|
|
8416
|
+
setMsg91ApiMode(normalizeMsg91ApiMode(data.msg91ApiMode));
|
|
8417
|
+
const tr = await fetch("/api/message-templates/sms").then(
|
|
8418
|
+
(r) => r.ok ? r.json() : { items: [] }
|
|
8419
|
+
);
|
|
8420
|
+
setSmsTplItems(tr.items ?? []);
|
|
8421
|
+
}
|
|
8200
8422
|
if (isEmail) {
|
|
8201
8423
|
const sales = parseEmailRecipientsFromConfig(data.salesTeamEmails ?? data.salesTeamEmail);
|
|
8202
8424
|
const fulfil = parseEmailRecipientsFromConfig(data.fulfilmentTeamEmails ?? data.fulfilmentTeamEmail);
|
|
@@ -8213,14 +8435,48 @@ function PluginSettingsPanel({
|
|
|
8213
8435
|
setFooterDisclaimer(data.footerDisclaimer ?? "");
|
|
8214
8436
|
}
|
|
8215
8437
|
}).finally(() => setLoading(false));
|
|
8216
|
-
}, [settingsGroup, isLlm, isEmail]);
|
|
8438
|
+
}, [settingsGroup, isLlm, isEmail, isErp, isSms]);
|
|
8439
|
+
useEffect27(() => {
|
|
8440
|
+
if (!isErp || loading) return;
|
|
8441
|
+
fetch("/api/forms?limit=500&sortField=name&sortOrder=asc").then((r) => r.ok ? r.json() : { data: [] }).then((res) => {
|
|
8442
|
+
const rows = (res.data ?? []).map((f) => ({
|
|
8443
|
+
id: typeof f.id === "number" ? f.id : Number(f.id),
|
|
8444
|
+
name: String(f.name ?? "")
|
|
8445
|
+
})).filter((f) => Number.isInteger(f.id) && f.id > 0);
|
|
8446
|
+
setErpFormsCatalog(rows);
|
|
8447
|
+
}).catch(() => setErpFormsCatalog([]));
|
|
8448
|
+
}, [isErp, loading]);
|
|
8217
8449
|
const buildPayload = () => {
|
|
8450
|
+
if (isErp) {
|
|
8451
|
+
const sortedIds = [...new Set(erpOpportunityFormIds.filter((n) => Number.isInteger(n) && n > 0))].sort(
|
|
8452
|
+
(a, b) => a - b
|
|
8453
|
+
);
|
|
8454
|
+
const payload2 = {
|
|
8455
|
+
enabled: { value: enabled ? "true" : "false", type: "public" },
|
|
8456
|
+
pipelineName: { value: erpPipelineName, type: "public" },
|
|
8457
|
+
pipelineStageName: { value: erpPipelineStageName, type: "public" }
|
|
8458
|
+
};
|
|
8459
|
+
if (erpFormsCatalog.length > 0 || erpOpportunityIdsKeyPresent) {
|
|
8460
|
+
payload2.opportunityFormIds = { value: JSON.stringify(sortedIds), type: "public" };
|
|
8461
|
+
}
|
|
8462
|
+
return payload2;
|
|
8463
|
+
}
|
|
8464
|
+
if (isSms) {
|
|
8465
|
+
return {
|
|
8466
|
+
enabled: { value: enabled ? "true" : "false", type: "public" },
|
|
8467
|
+
smsProvider: { value: smsProviderChoice, type: "public" },
|
|
8468
|
+
msg91ApiMode: { value: msg91ApiMode, type: "public" }
|
|
8469
|
+
};
|
|
8470
|
+
}
|
|
8218
8471
|
const payload = {
|
|
8219
8472
|
enabled: { value: enabled ? "true" : "false", type: "public" },
|
|
8220
8473
|
botName: { value: botName, type: "public" },
|
|
8221
8474
|
icon: { value: icon, type: "public" }
|
|
8222
8475
|
};
|
|
8223
8476
|
if (isLlm) {
|
|
8477
|
+
payload.chatMode = { value: chatMode, type: "public" };
|
|
8478
|
+
payload.whatsappPhone = { value: whatsappPhone, type: "public" };
|
|
8479
|
+
payload.externalChatSnippet = { value: externalChatSnippet, type: "public" };
|
|
8224
8480
|
payload.iconImageUrl = { value: iconImageUrl, type: "public" };
|
|
8225
8481
|
payload.iconBackgroundColor = { value: iconBackgroundColor, type: "public" };
|
|
8226
8482
|
payload.headerColor = { value: headerColor, type: "public" };
|
|
@@ -8248,6 +8504,22 @@ function PluginSettingsPanel({
|
|
|
8248
8504
|
body: JSON.stringify(buildPayload())
|
|
8249
8505
|
});
|
|
8250
8506
|
if (!res.ok) throw new Error();
|
|
8507
|
+
if (isSms && smsTplItems.length > 0) {
|
|
8508
|
+
const res2 = await fetch("/api/message-templates/sms", {
|
|
8509
|
+
method: "PUT",
|
|
8510
|
+
headers: { "Content-Type": "application/json" },
|
|
8511
|
+
body: JSON.stringify({
|
|
8512
|
+
items: smsTplItems.map((t) => ({
|
|
8513
|
+
templateKey: t.templateKey,
|
|
8514
|
+
body: t.body,
|
|
8515
|
+
externalTemplateRef: t.externalTemplateRef,
|
|
8516
|
+
otpVarKey: t.otpVarKey,
|
|
8517
|
+
enabled: t.enabled
|
|
8518
|
+
}))
|
|
8519
|
+
})
|
|
8520
|
+
});
|
|
8521
|
+
if (!res2.ok) throw new Error();
|
|
8522
|
+
}
|
|
8251
8523
|
toast4.success("Settings saved");
|
|
8252
8524
|
onSaved?.();
|
|
8253
8525
|
} catch {
|
|
@@ -8256,10 +8528,101 @@ function PluginSettingsPanel({
|
|
|
8256
8528
|
setSaving(false);
|
|
8257
8529
|
}
|
|
8258
8530
|
};
|
|
8259
|
-
if (loading) return /* @__PURE__ */
|
|
8531
|
+
if (loading) return /* @__PURE__ */ jsx56("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Loading..." });
|
|
8532
|
+
if (isErp) {
|
|
8533
|
+
return /* @__PURE__ */ jsxs46("div", { className: "space-y-4", children: [
|
|
8534
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center justify-between gap-2", children: [
|
|
8535
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-enabled`, className: "text-sm", children: "Enabled" }),
|
|
8536
|
+
/* @__PURE__ */ jsx56(Switch, { id: `${settingsGroup}-enabled`, checked: enabled, onCheckedChange: setEnabled })
|
|
8537
|
+
] }),
|
|
8538
|
+
/* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Webhook URL and JWT are set in server environment (see ERP integration guide). Pipeline fields apply to form submissions that are sent as opportunities." }),
|
|
8539
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8540
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-pipelineName`, className: "text-sm", children: "Pipeline name" }),
|
|
8541
|
+
/* @__PURE__ */ jsx56(
|
|
8542
|
+
Input,
|
|
8543
|
+
{
|
|
8544
|
+
id: `${settingsGroup}-pipelineName`,
|
|
8545
|
+
value: erpPipelineName,
|
|
8546
|
+
onChange: (e) => setErpPipelineName(e.target.value),
|
|
8547
|
+
placeholder: "e.g. Sales",
|
|
8548
|
+
className: "h-8 text-sm"
|
|
8549
|
+
}
|
|
8550
|
+
)
|
|
8551
|
+
] }),
|
|
8552
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8553
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-pipelineStageName`, className: "text-sm", children: "Pipeline stage name" }),
|
|
8554
|
+
/* @__PURE__ */ jsx56(
|
|
8555
|
+
Input,
|
|
8556
|
+
{
|
|
8557
|
+
id: `${settingsGroup}-pipelineStageName`,
|
|
8558
|
+
value: erpPipelineStageName,
|
|
8559
|
+
onChange: (e) => setErpPipelineStageName(e.target.value),
|
|
8560
|
+
placeholder: "e.g. New",
|
|
8561
|
+
className: "h-8 text-sm"
|
|
8562
|
+
}
|
|
8563
|
+
)
|
|
8564
|
+
] }),
|
|
8565
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-2", children: [
|
|
8566
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
8567
|
+
/* @__PURE__ */ jsx56(Label3, { className: "text-sm", children: "Forms as CRM opportunity" }),
|
|
8568
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex gap-2 text-xs", children: [
|
|
8569
|
+
/* @__PURE__ */ jsx56(
|
|
8570
|
+
"button",
|
|
8571
|
+
{
|
|
8572
|
+
type: "button",
|
|
8573
|
+
className: "text-primary underline-offset-2 hover:underline",
|
|
8574
|
+
onClick: () => setErpOpportunityFormIds(erpFormsCatalog.map((f) => f.id)),
|
|
8575
|
+
children: "Select all"
|
|
8576
|
+
}
|
|
8577
|
+
),
|
|
8578
|
+
/* @__PURE__ */ jsx56(
|
|
8579
|
+
"button",
|
|
8580
|
+
{
|
|
8581
|
+
type: "button",
|
|
8582
|
+
className: "text-primary underline-offset-2 hover:underline",
|
|
8583
|
+
onClick: () => setErpOpportunityFormIds([]),
|
|
8584
|
+
children: "Clear"
|
|
8585
|
+
}
|
|
8586
|
+
)
|
|
8587
|
+
] })
|
|
8588
|
+
] }),
|
|
8589
|
+
/* @__PURE__ */ jsxs46("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
|
|
8590
|
+
"Every form submission with an email is sent to ERP: unchecked forms use ",
|
|
8591
|
+
/* @__PURE__ */ jsx56("span", { className: "font-medium", children: "lead" }),
|
|
8592
|
+
" (",
|
|
8593
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "lead.created" }),
|
|
8594
|
+
"); checked forms use ",
|
|
8595
|
+
/* @__PURE__ */ jsx56("span", { className: "font-medium", children: "opportunity" }),
|
|
8596
|
+
" (",
|
|
8597
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "form.submitted" }),
|
|
8598
|
+
") with the pipeline and stage above."
|
|
8599
|
+
] }),
|
|
8600
|
+
/* @__PURE__ */ jsx56("div", { className: "max-h-48 space-y-2 overflow-y-auto rounded-md border border-input p-2 dark:border-gray-600", children: erpFormsCatalog.length === 0 ? /* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "No forms found." }) : erpFormsCatalog.map((f) => /* @__PURE__ */ jsxs46("label", { className: "flex cursor-pointer items-center gap-2 text-sm", children: [
|
|
8601
|
+
/* @__PURE__ */ jsx56(
|
|
8602
|
+
Checkbox,
|
|
8603
|
+
{
|
|
8604
|
+
checked: erpOpportunityFormIds.includes(f.id),
|
|
8605
|
+
onCheckedChange: (c) => {
|
|
8606
|
+
const on = c === true;
|
|
8607
|
+
setErpOpportunityFormIds((prev) => {
|
|
8608
|
+
if (on) return prev.includes(f.id) ? prev : [...prev, f.id].sort((a, b) => a - b);
|
|
8609
|
+
return prev.filter((x) => x !== f.id);
|
|
8610
|
+
});
|
|
8611
|
+
}
|
|
8612
|
+
}
|
|
8613
|
+
),
|
|
8614
|
+
/* @__PURE__ */ jsx56("span", { className: "min-w-0 truncate", children: f.name || `Form #${f.id}` })
|
|
8615
|
+
] }, f.id)) })
|
|
8616
|
+
] }),
|
|
8617
|
+
/* @__PURE__ */ jsxs46(Button, { size: "sm", onClick: handleSave, disabled: saving, className: "gap-1", children: [
|
|
8618
|
+
/* @__PURE__ */ jsx56(Save5, { className: "h-3.5 w-3.5" }),
|
|
8619
|
+
"Save"
|
|
8620
|
+
] })
|
|
8621
|
+
] });
|
|
8622
|
+
}
|
|
8260
8623
|
if (isEmail) {
|
|
8261
8624
|
return /* @__PURE__ */ jsxs46("div", { className: "space-y-4", children: [
|
|
8262
|
-
/* @__PURE__ */
|
|
8625
|
+
/* @__PURE__ */ jsx56(
|
|
8263
8626
|
EmailRecipientTags,
|
|
8264
8627
|
{
|
|
8265
8628
|
id: `${settingsGroup}-salesTeamEmails`,
|
|
@@ -8270,7 +8633,7 @@ function PluginSettingsPanel({
|
|
|
8270
8633
|
placeholder: "e.g. sales@example.com"
|
|
8271
8634
|
}
|
|
8272
8635
|
),
|
|
8273
|
-
/* @__PURE__ */
|
|
8636
|
+
/* @__PURE__ */ jsx56(
|
|
8274
8637
|
EmailRecipientTags,
|
|
8275
8638
|
{
|
|
8276
8639
|
id: `${settingsGroup}-fulfilmentTeamEmails`,
|
|
@@ -8281,7 +8644,7 @@ function PluginSettingsPanel({
|
|
|
8281
8644
|
placeholder: "e.g. fulfilment@example.com"
|
|
8282
8645
|
}
|
|
8283
8646
|
),
|
|
8284
|
-
/* @__PURE__ */
|
|
8647
|
+
/* @__PURE__ */ jsx56(
|
|
8285
8648
|
EmailRecipientTags,
|
|
8286
8649
|
{
|
|
8287
8650
|
id: `${settingsGroup}-crmEmails`,
|
|
@@ -8292,34 +8655,34 @@ function PluginSettingsPanel({
|
|
|
8292
8655
|
placeholder: "e.g. crm@example.com"
|
|
8293
8656
|
}
|
|
8294
8657
|
),
|
|
8295
|
-
/* @__PURE__ */
|
|
8658
|
+
/* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Layout below merges with Branding settings; values here override branding when set. Use absolute URLs for logos in email." }),
|
|
8296
8659
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8297
|
-
/* @__PURE__ */
|
|
8298
|
-
/* @__PURE__ */
|
|
8660
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-logoUrl`, className: "text-sm", children: "Logo URL (optional override)" }),
|
|
8661
|
+
/* @__PURE__ */ jsx56(Input, { id: `${settingsGroup}-logoUrl`, value: logoUrl, onChange: (e) => setLogoUrl(e.target.value), placeholder: "https://\u2026", className: "h-8 text-sm" })
|
|
8299
8662
|
] }),
|
|
8300
8663
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8301
|
-
/* @__PURE__ */
|
|
8302
|
-
/* @__PURE__ */
|
|
8664
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-companyName`, className: "text-sm", children: "Company name (optional override)" }),
|
|
8665
|
+
/* @__PURE__ */ jsx56(Input, { id: `${settingsGroup}-companyName`, value: companyName, onChange: (e) => setCompanyName(e.target.value), className: "h-8 text-sm" })
|
|
8303
8666
|
] }),
|
|
8304
8667
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8305
|
-
/* @__PURE__ */
|
|
8306
|
-
/* @__PURE__ */
|
|
8668
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-supportEmail`, className: "text-sm", children: "Support email (footer)" }),
|
|
8669
|
+
/* @__PURE__ */ jsx56(Input, { id: `${settingsGroup}-supportEmail`, value: supportEmail, onChange: (e) => setSupportEmail(e.target.value), type: "email", className: "h-8 text-sm" })
|
|
8307
8670
|
] }),
|
|
8308
8671
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8309
|
-
/* @__PURE__ */
|
|
8310
|
-
/* @__PURE__ */
|
|
8672
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-supportPhone`, className: "text-sm", children: "Support phone (footer)" }),
|
|
8673
|
+
/* @__PURE__ */ jsx56(Input, { id: `${settingsGroup}-supportPhone`, value: supportPhone, onChange: (e) => setSupportPhone(e.target.value), className: "h-8 text-sm" })
|
|
8311
8674
|
] }),
|
|
8312
8675
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8313
|
-
/* @__PURE__ */
|
|
8314
|
-
/* @__PURE__ */
|
|
8676
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-followUsTitle`, className: "text-sm", children: "\u201CFollow us\u201D heading" }),
|
|
8677
|
+
/* @__PURE__ */ jsx56(Input, { id: `${settingsGroup}-followUsTitle`, value: followUsTitle, onChange: (e) => setFollowUsTitle(e.target.value), className: "h-8 text-sm" })
|
|
8315
8678
|
] }),
|
|
8316
8679
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-2", children: [
|
|
8317
|
-
/* @__PURE__ */
|
|
8318
|
-
/* @__PURE__ */
|
|
8680
|
+
/* @__PURE__ */ jsx56(Label3, { className: "text-sm", children: "Social links" }),
|
|
8681
|
+
/* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Add rows: icon image URL (optional), link URL, and emoji/text only if you are not using an image." }),
|
|
8319
8682
|
socialLinkRows.map((row, i) => /* @__PURE__ */ jsxs46("div", { className: "flex flex-wrap items-end gap-2 border-b border-border/60 pb-3 dark:border-gray-600", children: [
|
|
8320
8683
|
/* @__PURE__ */ jsxs46("div", { className: "min-w-[160px] flex-1 space-y-1", children: [
|
|
8321
|
-
/* @__PURE__ */
|
|
8322
|
-
/* @__PURE__ */
|
|
8684
|
+
/* @__PURE__ */ jsx56(Label3, { className: "text-xs text-muted-foreground", children: "Icon image URL" }),
|
|
8685
|
+
/* @__PURE__ */ jsx56(
|
|
8323
8686
|
Input,
|
|
8324
8687
|
{
|
|
8325
8688
|
value: row.iconUrl,
|
|
@@ -8334,8 +8697,8 @@ function PluginSettingsPanel({
|
|
|
8334
8697
|
)
|
|
8335
8698
|
] }),
|
|
8336
8699
|
/* @__PURE__ */ jsxs46("div", { className: "min-w-[160px] flex-1 space-y-1", children: [
|
|
8337
|
-
/* @__PURE__ */
|
|
8338
|
-
/* @__PURE__ */
|
|
8700
|
+
/* @__PURE__ */ jsx56(Label3, { className: "text-xs text-muted-foreground", children: "Link URL" }),
|
|
8701
|
+
/* @__PURE__ */ jsx56(
|
|
8339
8702
|
Input,
|
|
8340
8703
|
{
|
|
8341
8704
|
value: row.url,
|
|
@@ -8350,8 +8713,8 @@ function PluginSettingsPanel({
|
|
|
8350
8713
|
)
|
|
8351
8714
|
] }),
|
|
8352
8715
|
/* @__PURE__ */ jsxs46("div", { className: "w-[120px] space-y-1", children: [
|
|
8353
|
-
/* @__PURE__ */
|
|
8354
|
-
/* @__PURE__ */
|
|
8716
|
+
/* @__PURE__ */ jsx56(Label3, { className: "text-xs text-muted-foreground", children: "Emoji / text" }),
|
|
8717
|
+
/* @__PURE__ */ jsx56(
|
|
8355
8718
|
Input,
|
|
8356
8719
|
{
|
|
8357
8720
|
value: row.iconFallback,
|
|
@@ -8365,7 +8728,7 @@ function PluginSettingsPanel({
|
|
|
8365
8728
|
}
|
|
8366
8729
|
)
|
|
8367
8730
|
] }),
|
|
8368
|
-
/* @__PURE__ */
|
|
8731
|
+
/* @__PURE__ */ jsx56(
|
|
8369
8732
|
Button,
|
|
8370
8733
|
{
|
|
8371
8734
|
type: "button",
|
|
@@ -8378,7 +8741,7 @@ function PluginSettingsPanel({
|
|
|
8378
8741
|
if (socialLinkRows.length <= 1) setSocialLinkRows([{ ...EMPTY_SOCIAL_ROW }]);
|
|
8379
8742
|
else setSocialLinkRows(socialLinkRows.filter((_, j) => j !== i));
|
|
8380
8743
|
},
|
|
8381
|
-
children: /* @__PURE__ */
|
|
8744
|
+
children: /* @__PURE__ */ jsx56(X18, { className: "h-4 w-4" })
|
|
8382
8745
|
}
|
|
8383
8746
|
)
|
|
8384
8747
|
] }, i)),
|
|
@@ -8391,15 +8754,15 @@ function PluginSettingsPanel({
|
|
|
8391
8754
|
className: "mt-1",
|
|
8392
8755
|
onClick: () => setSocialLinkRows([...socialLinkRows, { ...EMPTY_SOCIAL_ROW }]),
|
|
8393
8756
|
children: [
|
|
8394
|
-
/* @__PURE__ */
|
|
8757
|
+
/* @__PURE__ */ jsx56(Plus8, { className: "mr-1 h-4 w-4" }),
|
|
8395
8758
|
"Add link"
|
|
8396
8759
|
]
|
|
8397
8760
|
}
|
|
8398
8761
|
)
|
|
8399
8762
|
] }),
|
|
8400
8763
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8401
|
-
/* @__PURE__ */
|
|
8402
|
-
/* @__PURE__ */
|
|
8764
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-footerDisclaimer`, className: "text-sm", children: "Footer disclaimer" }),
|
|
8765
|
+
/* @__PURE__ */ jsx56(
|
|
8403
8766
|
Textarea,
|
|
8404
8767
|
{
|
|
8405
8768
|
id: `${settingsGroup}-footerDisclaimer`,
|
|
@@ -8410,106 +8773,318 @@ function PluginSettingsPanel({
|
|
|
8410
8773
|
}
|
|
8411
8774
|
)
|
|
8412
8775
|
] }),
|
|
8413
|
-
/* @__PURE__ */
|
|
8776
|
+
/* @__PURE__ */ jsx56(Button, { size: "sm", onClick: handleSave, disabled: saving, children: saving ? "Saving\u2026" : "Save" })
|
|
8414
8777
|
] });
|
|
8415
8778
|
}
|
|
8416
|
-
|
|
8417
|
-
/* @__PURE__ */ jsxs46("div", { className: "
|
|
8418
|
-
/* @__PURE__ */
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
/* @__PURE__ */ jsx55(Label3, { htmlFor: `${settingsGroup}-botName`, className: "text-sm", children: "Name" }),
|
|
8423
|
-
/* @__PURE__ */ jsx55(
|
|
8424
|
-
Input,
|
|
8425
|
-
{
|
|
8426
|
-
id: `${settingsGroup}-botName`,
|
|
8427
|
-
value: botName,
|
|
8428
|
-
onChange: (e) => setBotName(e.target.value),
|
|
8429
|
-
placeholder: "e.g. Support Bot",
|
|
8430
|
-
className: "h-8 text-sm"
|
|
8431
|
-
}
|
|
8432
|
-
)
|
|
8433
|
-
] }),
|
|
8434
|
-
isLlm ? /* @__PURE__ */ jsxs46(Fragment12, { children: [
|
|
8779
|
+
if (isSms) {
|
|
8780
|
+
return /* @__PURE__ */ jsxs46("div", { className: "space-y-4", children: [
|
|
8781
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center justify-between gap-2", children: [
|
|
8782
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-enabled`, className: "text-sm", children: "Enabled" }),
|
|
8783
|
+
/* @__PURE__ */ jsx56(Switch, { id: `${settingsGroup}-enabled`, checked: enabled, onCheckedChange: setEnabled })
|
|
8784
|
+
] }),
|
|
8435
8785
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8436
|
-
/* @__PURE__ */
|
|
8437
|
-
/* @__PURE__ */
|
|
8786
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-smsProvider`, className: "text-sm", children: "Active provider" }),
|
|
8787
|
+
/* @__PURE__ */ jsxs46(
|
|
8788
|
+
Select,
|
|
8789
|
+
{
|
|
8790
|
+
value: smsProviderChoice,
|
|
8791
|
+
onValueChange: (v) => setSmsProviderChoice(v),
|
|
8792
|
+
children: [
|
|
8793
|
+
/* @__PURE__ */ jsx56(SelectTrigger, { id: `${settingsGroup}-smsProvider`, className: "h-9 text-sm", children: /* @__PURE__ */ jsx56(SelectValue, { placeholder: "Select provider" }) }),
|
|
8794
|
+
/* @__PURE__ */ jsxs46(SelectContent, { children: [
|
|
8795
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "auto", children: "Auto (MSG91 \u2192 Twilio \u2192 webhook, first with credentials)" }),
|
|
8796
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "msg91", children: "MSG91 (India)" }),
|
|
8797
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "twilio", children: "Twilio" }),
|
|
8798
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "webhook", children: "HTTP webhook" })
|
|
8799
|
+
] })
|
|
8800
|
+
]
|
|
8801
|
+
}
|
|
8802
|
+
)
|
|
8803
|
+
] }),
|
|
8804
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8805
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-msg91ApiMode`, className: "text-sm", children: "MSG91 API mode" }),
|
|
8806
|
+
/* @__PURE__ */ jsxs46(Select, { value: msg91ApiMode, onValueChange: (v) => setMsg91ApiMode(v), children: [
|
|
8807
|
+
/* @__PURE__ */ jsx56(SelectTrigger, { id: `${settingsGroup}-msg91ApiMode`, className: "h-9 text-sm", children: /* @__PURE__ */ jsx56(SelectValue, {}) }),
|
|
8808
|
+
/* @__PURE__ */ jsxs46(SelectContent, { children: [
|
|
8809
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "auto", children: "Auto (Flow if template ID + auth key; else sendhttp)" }),
|
|
8810
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "flow", children: "Flow API (DLT template_id; recommended for India)" }),
|
|
8811
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "sendhttp", children: "Legacy sendhttp (needs sender ID; not for arbitrary India text)" })
|
|
8812
|
+
] })
|
|
8813
|
+
] })
|
|
8814
|
+
] }),
|
|
8815
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-3 rounded-md border border-gray-200 dark:border-gray-600 p-3", children: [
|
|
8816
|
+
/* @__PURE__ */ jsx56("p", { className: "text-sm font-medium text-gray-900 dark:text-white", children: "SMS templates" }),
|
|
8817
|
+
/* @__PURE__ */ jsxs46("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
|
|
8818
|
+
"Defaults come from code; overrides and DLT / Flow IDs are stored here. Use ",
|
|
8819
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "{{code}}" }),
|
|
8820
|
+
" in the message body for the OTP."
|
|
8821
|
+
] }),
|
|
8822
|
+
smsTplItems.map((t) => /* @__PURE__ */ jsxs46("div", { className: "space-y-2 border-t border-gray-100 pt-3 first:border-t-0 first:pt-0 dark:border-gray-700", children: [
|
|
8823
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
8824
|
+
/* @__PURE__ */ jsxs46("div", { children: [
|
|
8825
|
+
/* @__PURE__ */ jsx56("div", { className: "text-sm font-medium", children: t.name }),
|
|
8826
|
+
/* @__PURE__ */ jsx56("div", { className: "text-[11px] font-mono text-gray-500", children: t.templateKey })
|
|
8827
|
+
] }),
|
|
8828
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-2", children: [
|
|
8829
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-tpl-${t.templateKey}-enabled`, className: "text-xs text-gray-600 dark:text-gray-400", children: "Apply custom body / Flow id" }),
|
|
8830
|
+
/* @__PURE__ */ jsx56(
|
|
8831
|
+
Switch,
|
|
8832
|
+
{
|
|
8833
|
+
id: `${settingsGroup}-tpl-${t.templateKey}-enabled`,
|
|
8834
|
+
checked: t.enabled,
|
|
8835
|
+
onCheckedChange: (v) => setSmsTplItems(
|
|
8836
|
+
(items) => items.map((x) => x.templateKey === t.templateKey ? { ...x, enabled: v } : x)
|
|
8837
|
+
)
|
|
8838
|
+
}
|
|
8839
|
+
)
|
|
8840
|
+
] })
|
|
8841
|
+
] }),
|
|
8842
|
+
/* @__PURE__ */ jsxs46("p", { className: "text-[11px] text-gray-500", children: [
|
|
8843
|
+
"Default: ",
|
|
8844
|
+
t.defaultBody
|
|
8845
|
+
] }),
|
|
8846
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8847
|
+
/* @__PURE__ */ jsx56(Label3, { className: "text-xs", children: "Message body" }),
|
|
8848
|
+
/* @__PURE__ */ jsx56(
|
|
8849
|
+
Textarea,
|
|
8850
|
+
{
|
|
8851
|
+
value: t.body,
|
|
8852
|
+
onChange: (e) => setSmsTplItems(
|
|
8853
|
+
(items) => items.map((x) => x.templateKey === t.templateKey ? { ...x, body: e.target.value } : x)
|
|
8854
|
+
),
|
|
8855
|
+
rows: 2,
|
|
8856
|
+
className: "text-sm"
|
|
8857
|
+
}
|
|
8858
|
+
)
|
|
8859
|
+
] }),
|
|
8860
|
+
/* @__PURE__ */ jsxs46("div", { className: "grid gap-2 sm:grid-cols-2", children: [
|
|
8861
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8862
|
+
/* @__PURE__ */ jsx56(Label3, { className: "text-xs", children: "External template ref (e.g. MSG91 Flow / DLT id)" }),
|
|
8863
|
+
/* @__PURE__ */ jsx56(
|
|
8864
|
+
Input,
|
|
8865
|
+
{
|
|
8866
|
+
value: t.externalTemplateRef,
|
|
8867
|
+
onChange: (e) => setSmsTplItems(
|
|
8868
|
+
(items) => items.map(
|
|
8869
|
+
(x) => x.templateKey === t.templateKey ? { ...x, externalTemplateRef: e.target.value } : x
|
|
8870
|
+
)
|
|
8871
|
+
),
|
|
8872
|
+
placeholder: "From MSG91 after DLT mapping",
|
|
8873
|
+
className: "h-8 text-sm"
|
|
8874
|
+
}
|
|
8875
|
+
)
|
|
8876
|
+
] }),
|
|
8877
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8878
|
+
/* @__PURE__ */ jsx56(Label3, { className: "text-xs", children: "OTP variable key (Flow recipient field)" }),
|
|
8879
|
+
/* @__PURE__ */ jsx56(
|
|
8880
|
+
Input,
|
|
8881
|
+
{
|
|
8882
|
+
value: t.otpVarKey,
|
|
8883
|
+
onChange: (e) => setSmsTplItems(
|
|
8884
|
+
(items) => items.map(
|
|
8885
|
+
(x) => x.templateKey === t.templateKey ? { ...x, otpVarKey: e.target.value } : x
|
|
8886
|
+
)
|
|
8887
|
+
),
|
|
8888
|
+
className: "h-8 text-sm font-mono",
|
|
8889
|
+
placeholder: "var1"
|
|
8890
|
+
}
|
|
8891
|
+
)
|
|
8892
|
+
] })
|
|
8893
|
+
] })
|
|
8894
|
+
] }, t.templateKey))
|
|
8895
|
+
] }),
|
|
8896
|
+
/* @__PURE__ */ jsxs46("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
|
|
8897
|
+
"Server env: ",
|
|
8898
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "MSG91_AUTH_KEY" }),
|
|
8899
|
+
"; optional global fallback ",
|
|
8900
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "MSG91_TEMPLATE_ID" }),
|
|
8901
|
+
",",
|
|
8902
|
+
" ",
|
|
8903
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "MSG91_OTP_VAR_KEY" }),
|
|
8904
|
+
"; sendhttp: ",
|
|
8905
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "MSG91_SENDER_ID" }),
|
|
8906
|
+
",",
|
|
8907
|
+
" ",
|
|
8908
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "MSG91_ROUTE" }),
|
|
8909
|
+
". Or ",
|
|
8910
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "TWILIO_*" }),
|
|
8911
|
+
", ",
|
|
8912
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "SMS_WEBHOOK_URL" }),
|
|
8913
|
+
".",
|
|
8914
|
+
" ",
|
|
8915
|
+
/* @__PURE__ */ jsx56("code", { className: "text-[11px]", children: "SMS_PROVIDER" }),
|
|
8916
|
+
" matches the provider dropdown."
|
|
8917
|
+
] }),
|
|
8918
|
+
/* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "India (TRAI DLT): register content on operators; map the approved template in MSG91 and set the Flow id per template above." }),
|
|
8919
|
+
/* @__PURE__ */ jsxs46(Button, { size: "sm", onClick: handleSave, disabled: saving, className: "gap-1", children: [
|
|
8920
|
+
/* @__PURE__ */ jsx56(Save5, { className: "h-3.5 w-3.5" }),
|
|
8921
|
+
"Save"
|
|
8922
|
+
] })
|
|
8923
|
+
] });
|
|
8924
|
+
}
|
|
8925
|
+
if (isLlm) {
|
|
8926
|
+
return /* @__PURE__ */ jsxs46("div", { className: "space-y-4", children: [
|
|
8927
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center justify-between gap-2", children: [
|
|
8928
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-enabled`, className: "text-sm", children: "Enabled" }),
|
|
8929
|
+
/* @__PURE__ */ jsx56(Switch, { id: `${settingsGroup}-enabled`, checked: enabled, onCheckedChange: setEnabled })
|
|
8930
|
+
] }),
|
|
8931
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8932
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-chatMode`, className: "text-sm", children: "Support channel" }),
|
|
8933
|
+
/* @__PURE__ */ jsxs46(Select, { value: chatMode, onValueChange: (v) => setChatMode(v), children: [
|
|
8934
|
+
/* @__PURE__ */ jsx56(SelectTrigger, { id: `${settingsGroup}-chatMode`, className: "h-9 text-sm", children: /* @__PURE__ */ jsx56(SelectValue, { placeholder: "Select channel" }) }),
|
|
8935
|
+
/* @__PURE__ */ jsxs46(SelectContent, { children: [
|
|
8936
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "whatsapp", children: "WhatsApp" }),
|
|
8937
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "external", children: "External (script)" }),
|
|
8938
|
+
/* @__PURE__ */ jsx56(SelectItem, { value: "llm", children: "Infuro Chat Assistant" })
|
|
8939
|
+
] })
|
|
8940
|
+
] })
|
|
8941
|
+
] }),
|
|
8942
|
+
chatMode === "whatsapp" && /* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8943
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-whatsappPhone`, className: "text-sm", children: "Phone number" }),
|
|
8944
|
+
/* @__PURE__ */ jsx56(
|
|
8438
8945
|
Input,
|
|
8439
8946
|
{
|
|
8440
|
-
id: `${settingsGroup}-
|
|
8441
|
-
value:
|
|
8442
|
-
onChange: (e) =>
|
|
8443
|
-
placeholder: "
|
|
8947
|
+
id: `${settingsGroup}-whatsappPhone`,
|
|
8948
|
+
value: whatsappPhone,
|
|
8949
|
+
onChange: (e) => setWhatsappPhone(e.target.value),
|
|
8950
|
+
placeholder: "e.g. +1 555 123 4567",
|
|
8444
8951
|
className: "h-8 text-sm"
|
|
8445
8952
|
}
|
|
8446
8953
|
),
|
|
8447
|
-
/* @__PURE__ */
|
|
8954
|
+
/* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Include country code. Opens WhatsApp (wa.me) when visitors tap the site button." })
|
|
8448
8955
|
] }),
|
|
8449
|
-
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8450
|
-
/* @__PURE__ */
|
|
8451
|
-
/* @__PURE__ */
|
|
8452
|
-
|
|
8956
|
+
chatMode === "external" && /* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8957
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-externalSnippet`, className: "text-sm", children: "Embed script" }),
|
|
8958
|
+
/* @__PURE__ */ jsx56(
|
|
8959
|
+
Textarea,
|
|
8453
8960
|
{
|
|
8454
|
-
id: `${settingsGroup}-
|
|
8455
|
-
value:
|
|
8456
|
-
onChange: (e) =>
|
|
8457
|
-
|
|
8458
|
-
|
|
8961
|
+
id: `${settingsGroup}-externalSnippet`,
|
|
8962
|
+
value: externalChatSnippet,
|
|
8963
|
+
onChange: (e) => setExternalChatSnippet(e.target.value),
|
|
8964
|
+
rows: 8,
|
|
8965
|
+
placeholder: "Paste third-party widget HTML / script tags\u2026",
|
|
8966
|
+
className: "text-sm font-mono"
|
|
8459
8967
|
}
|
|
8460
|
-
)
|
|
8968
|
+
),
|
|
8969
|
+
/* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Only paste code from sources you trust." })
|
|
8461
8970
|
] }),
|
|
8462
|
-
/* @__PURE__ */ jsxs46(
|
|
8971
|
+
chatMode === "llm" && /* @__PURE__ */ jsxs46(Fragment12, { children: [
|
|
8463
8972
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8464
|
-
/* @__PURE__ */
|
|
8465
|
-
/* @__PURE__ */
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
{
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
),
|
|
8476
|
-
/* @__PURE__ */ jsx55(
|
|
8477
|
-
Input,
|
|
8478
|
-
{
|
|
8479
|
-
value: iconBackgroundColor,
|
|
8480
|
-
onChange: (e) => setIconBackgroundColor(e.target.value),
|
|
8481
|
-
className: "h-8 w-24 text-sm font-mono"
|
|
8482
|
-
}
|
|
8483
|
-
)
|
|
8484
|
-
] })
|
|
8973
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-botName`, className: "text-sm", children: "Name" }),
|
|
8974
|
+
/* @__PURE__ */ jsx56(
|
|
8975
|
+
Input,
|
|
8976
|
+
{
|
|
8977
|
+
id: `${settingsGroup}-botName`,
|
|
8978
|
+
value: botName,
|
|
8979
|
+
onChange: (e) => setBotName(e.target.value),
|
|
8980
|
+
placeholder: "e.g. Support Bot",
|
|
8981
|
+
className: "h-8 text-sm"
|
|
8982
|
+
}
|
|
8983
|
+
)
|
|
8485
8984
|
] }),
|
|
8486
8985
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
8487
|
-
/* @__PURE__ */
|
|
8488
|
-
/* @__PURE__ */
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
{
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
}
|
|
8506
|
-
|
|
8986
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-iconImageUrl`, className: "text-sm", children: "Icon image URL" }),
|
|
8987
|
+
/* @__PURE__ */ jsx56(
|
|
8988
|
+
Input,
|
|
8989
|
+
{
|
|
8990
|
+
id: `${settingsGroup}-iconImageUrl`,
|
|
8991
|
+
value: iconImageUrl,
|
|
8992
|
+
onChange: (e) => setIconImageUrl(e.target.value),
|
|
8993
|
+
placeholder: "https://\u2026 or /images/chat-icon.png",
|
|
8994
|
+
className: "h-8 text-sm"
|
|
8995
|
+
}
|
|
8996
|
+
),
|
|
8997
|
+
/* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "PNG or image URL. Leave empty to use emoji below." })
|
|
8998
|
+
] }),
|
|
8999
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
9000
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-icon`, className: "text-sm", children: "Icon fallback (emoji)" }),
|
|
9001
|
+
/* @__PURE__ */ jsx56(
|
|
9002
|
+
Input,
|
|
9003
|
+
{
|
|
9004
|
+
id: `${settingsGroup}-icon`,
|
|
9005
|
+
value: icon,
|
|
9006
|
+
onChange: (e) => setIcon(e.target.value),
|
|
9007
|
+
placeholder: "e.g. \u{1F4AC}",
|
|
9008
|
+
className: "h-8 text-sm w-20"
|
|
9009
|
+
}
|
|
9010
|
+
)
|
|
9011
|
+
] }),
|
|
9012
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex gap-4", children: [
|
|
9013
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
9014
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-iconBg`, className: "text-sm", children: "Icon background" }),
|
|
9015
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-2", children: [
|
|
9016
|
+
/* @__PURE__ */ jsx56(
|
|
9017
|
+
"input",
|
|
9018
|
+
{
|
|
9019
|
+
type: "color",
|
|
9020
|
+
id: `${settingsGroup}-iconBg`,
|
|
9021
|
+
value: iconBackgroundColor,
|
|
9022
|
+
onChange: (e) => setIconBackgroundColor(e.target.value),
|
|
9023
|
+
className: "h-8 w-10 cursor-pointer rounded border border-gray-300 dark:border-gray-600"
|
|
9024
|
+
}
|
|
9025
|
+
),
|
|
9026
|
+
/* @__PURE__ */ jsx56(
|
|
9027
|
+
Input,
|
|
9028
|
+
{
|
|
9029
|
+
value: iconBackgroundColor,
|
|
9030
|
+
onChange: (e) => setIconBackgroundColor(e.target.value),
|
|
9031
|
+
className: "h-8 w-24 text-sm font-mono"
|
|
9032
|
+
}
|
|
9033
|
+
)
|
|
9034
|
+
] })
|
|
9035
|
+
] }),
|
|
9036
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
9037
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-headerColor`, className: "text-sm", children: "Header color" }),
|
|
9038
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-2", children: [
|
|
9039
|
+
/* @__PURE__ */ jsx56(
|
|
9040
|
+
"input",
|
|
9041
|
+
{
|
|
9042
|
+
type: "color",
|
|
9043
|
+
id: `${settingsGroup}-headerColor`,
|
|
9044
|
+
value: headerColor,
|
|
9045
|
+
onChange: (e) => setHeaderColor(e.target.value),
|
|
9046
|
+
className: "h-8 w-10 cursor-pointer rounded border border-gray-300 dark:border-gray-600"
|
|
9047
|
+
}
|
|
9048
|
+
),
|
|
9049
|
+
/* @__PURE__ */ jsx56(
|
|
9050
|
+
Input,
|
|
9051
|
+
{
|
|
9052
|
+
value: headerColor,
|
|
9053
|
+
onChange: (e) => setHeaderColor(e.target.value),
|
|
9054
|
+
className: "h-8 w-24 text-sm font-mono"
|
|
9055
|
+
}
|
|
9056
|
+
)
|
|
9057
|
+
] })
|
|
8507
9058
|
] })
|
|
8508
9059
|
] })
|
|
9060
|
+
] }),
|
|
9061
|
+
/* @__PURE__ */ jsxs46(Button, { size: "sm", onClick: handleSave, disabled: saving, className: "gap-1", children: [
|
|
9062
|
+
/* @__PURE__ */ jsx56(Save5, { className: "h-3.5 w-3.5" }),
|
|
9063
|
+
"Save"
|
|
8509
9064
|
] })
|
|
8510
|
-
] })
|
|
8511
|
-
|
|
8512
|
-
|
|
9065
|
+
] });
|
|
9066
|
+
}
|
|
9067
|
+
return /* @__PURE__ */ jsxs46("div", { className: "space-y-4", children: [
|
|
9068
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center justify-between gap-2", children: [
|
|
9069
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-enabled`, className: "text-sm", children: "Enabled" }),
|
|
9070
|
+
/* @__PURE__ */ jsx56(Switch, { id: `${settingsGroup}-enabled`, checked: enabled, onCheckedChange: setEnabled })
|
|
9071
|
+
] }),
|
|
9072
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
9073
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-botName`, className: "text-sm", children: "Name" }),
|
|
9074
|
+
/* @__PURE__ */ jsx56(
|
|
9075
|
+
Input,
|
|
9076
|
+
{
|
|
9077
|
+
id: `${settingsGroup}-botName`,
|
|
9078
|
+
value: botName,
|
|
9079
|
+
onChange: (e) => setBotName(e.target.value),
|
|
9080
|
+
placeholder: "e.g. Support Bot",
|
|
9081
|
+
className: "h-8 text-sm"
|
|
9082
|
+
}
|
|
9083
|
+
)
|
|
9084
|
+
] }),
|
|
9085
|
+
/* @__PURE__ */ jsxs46("div", { className: "space-y-1", children: [
|
|
9086
|
+
/* @__PURE__ */ jsx56(Label3, { htmlFor: `${settingsGroup}-icon`, className: "text-sm", children: "Icon (emoji or name)" }),
|
|
9087
|
+
/* @__PURE__ */ jsx56(
|
|
8513
9088
|
Input,
|
|
8514
9089
|
{
|
|
8515
9090
|
id: `${settingsGroup}-icon`,
|
|
@@ -8521,7 +9096,7 @@ function PluginSettingsPanel({
|
|
|
8521
9096
|
)
|
|
8522
9097
|
] }),
|
|
8523
9098
|
/* @__PURE__ */ jsxs46(Button, { size: "sm", onClick: handleSave, disabled: saving, className: "gap-1", children: [
|
|
8524
|
-
/* @__PURE__ */
|
|
9099
|
+
/* @__PURE__ */ jsx56(Save5, { className: "h-3.5 w-3.5" }),
|
|
8525
9100
|
"Save"
|
|
8526
9101
|
] })
|
|
8527
9102
|
] });
|
|
@@ -8539,16 +9114,16 @@ function PluginListItem({
|
|
|
8539
9114
|
onClick: onSelect,
|
|
8540
9115
|
className: `flex w-full items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors ${selected ? "border-gray-300 bg-gray-50 dark:border-gray-600 dark:bg-gray-700/50" : "border-transparent hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,
|
|
8541
9116
|
children: [
|
|
8542
|
-
/* @__PURE__ */
|
|
9117
|
+
/* @__PURE__ */ jsx56(PluginIcon, { descriptor, size: "sm" }),
|
|
8543
9118
|
/* @__PURE__ */ jsxs46("div", { className: "min-w-0 flex-1", children: [
|
|
8544
|
-
/* @__PURE__ */
|
|
9119
|
+
/* @__PURE__ */ jsx56("div", { className: "font-medium text-gray-900 dark:text-white truncate", children: descriptor.label || descriptor.name }),
|
|
8545
9120
|
/* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-2 mt-0.5", children: [
|
|
8546
9121
|
/* @__PURE__ */ jsxs46(
|
|
8547
9122
|
"span",
|
|
8548
9123
|
{
|
|
8549
9124
|
className: `inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-xs font-medium ${enabled ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400"}`,
|
|
8550
9125
|
children: [
|
|
8551
|
-
enabled ? /* @__PURE__ */
|
|
9126
|
+
enabled ? /* @__PURE__ */ jsx56(CheckCircle22, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx56(XCircle, { className: "h-3 w-3" }),
|
|
8552
9127
|
enabled ? "On" : "Off"
|
|
8553
9128
|
]
|
|
8554
9129
|
}
|
|
@@ -8587,14 +9162,14 @@ function PluginsPage() {
|
|
|
8587
9162
|
};
|
|
8588
9163
|
return /* @__PURE__ */ jsxs46("div", { className: "min-w-0 rounded-lg bg-white shadow-md dark:bg-gray-800", children: [
|
|
8589
9164
|
/* @__PURE__ */ jsxs46("div", { className: "bg-gray-800 border-b border-gray-700 px-4 py-2.5 rounded-t-lg dark:bg-gray-900 dark:border-gray-700", children: [
|
|
8590
|
-
/* @__PURE__ */
|
|
8591
|
-
/* @__PURE__ */
|
|
9165
|
+
/* @__PURE__ */ jsx56("h1", { className: "text-base font-semibold text-white", children: "Plugins" }),
|
|
9166
|
+
/* @__PURE__ */ jsx56("p", { className: "text-xs text-gray-300 mt-0.5", children: "Registered plugins and their status" })
|
|
8592
9167
|
] }),
|
|
8593
|
-
/* @__PURE__ */
|
|
8594
|
-
/* @__PURE__ */
|
|
8595
|
-
/* @__PURE__ */
|
|
9168
|
+
/* @__PURE__ */ jsx56("div", { className: "min-w-0 p-6", children: pluginDescriptors.length === 0 ? /* @__PURE__ */ jsxs46("div", { className: "py-12 text-center", children: [
|
|
9169
|
+
/* @__PURE__ */ jsx56(Puzzle2, { className: "mx-auto h-10 w-10 text-gray-400" }),
|
|
9170
|
+
/* @__PURE__ */ jsx56("p", { className: "mt-3 text-sm text-gray-500 dark:text-gray-400", children: "No plugins registered. Add plugin descriptors to your app admin layout." })
|
|
8596
9171
|
] }) : /* @__PURE__ */ jsxs46("div", { className: "flex gap-6", children: [
|
|
8597
|
-
/* @__PURE__ */
|
|
9172
|
+
/* @__PURE__ */ jsx56("div", { className: "w-56 shrink-0 space-y-1", children: pluginDescriptors.map((p) => /* @__PURE__ */ jsx56(
|
|
8598
9173
|
PluginListItem,
|
|
8599
9174
|
{
|
|
8600
9175
|
descriptor: p,
|
|
@@ -8604,15 +9179,15 @@ function PluginsPage() {
|
|
|
8604
9179
|
},
|
|
8605
9180
|
p.name
|
|
8606
9181
|
)) }),
|
|
8607
|
-
/* @__PURE__ */
|
|
8608
|
-
/* @__PURE__ */
|
|
8609
|
-
/* @__PURE__ */
|
|
8610
|
-
] }) : /* @__PURE__ */
|
|
9182
|
+
/* @__PURE__ */ jsx56("div", { className: "min-w-0 flex-1", children: !selectedName ? /* @__PURE__ */ jsxs46("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
|
|
9183
|
+
/* @__PURE__ */ jsx56(Puzzle2, { className: "h-10 w-10 text-gray-300 dark:text-gray-600" }),
|
|
9184
|
+
/* @__PURE__ */ jsx56("p", { className: "mt-3 text-sm text-gray-500 dark:text-gray-400", children: "Select a plugin to view or edit its configuration." })
|
|
9185
|
+
] }) : /* @__PURE__ */ jsx56("div", { className: "rounded-lg border border-gray-200 bg-gray-50/50 p-5 dark:border-gray-700 dark:bg-gray-800/50", children: selectedDescriptor?.settingsGroup ? /* @__PURE__ */ jsxs46(Fragment12, { children: [
|
|
8611
9186
|
/* @__PURE__ */ jsxs46("h2", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-4", children: [
|
|
8612
9187
|
selectedDescriptor.label || selectedDescriptor.name,
|
|
8613
9188
|
" \u2014 Configuration"
|
|
8614
9189
|
] }),
|
|
8615
|
-
/* @__PURE__ */
|
|
9190
|
+
/* @__PURE__ */ jsx56(
|
|
8616
9191
|
PluginSettingsPanel,
|
|
8617
9192
|
{
|
|
8618
9193
|
descriptor: selectedDescriptor,
|
|
@@ -8620,8 +9195,8 @@ function PluginsPage() {
|
|
|
8620
9195
|
}
|
|
8621
9196
|
)
|
|
8622
9197
|
] }) : /* @__PURE__ */ jsxs46("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
|
|
8623
|
-
/* @__PURE__ */
|
|
8624
|
-
/* @__PURE__ */
|
|
9198
|
+
/* @__PURE__ */ jsx56(Puzzle2, { className: "h-10 w-10 text-gray-300 dark:text-gray-600" }),
|
|
9199
|
+
/* @__PURE__ */ jsx56("p", { className: "mt-3 text-sm text-gray-500 dark:text-gray-400", children: "No configuration available for this plugin." })
|
|
8625
9200
|
] }) }) })
|
|
8626
9201
|
] }) })
|
|
8627
9202
|
] });
|
|
@@ -8633,7 +9208,7 @@ import { useRouter as useRouter10 } from "next/navigation";
|
|
|
8633
9208
|
import { AlertCircle as AlertCircle4 } from "lucide-react";
|
|
8634
9209
|
|
|
8635
9210
|
// src/components/Admin/SeoSection.tsx
|
|
8636
|
-
import { jsx as
|
|
9211
|
+
import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
8637
9212
|
function SeoSection({
|
|
8638
9213
|
values,
|
|
8639
9214
|
onChange
|
|
@@ -8641,37 +9216,37 @@ function SeoSection({
|
|
|
8641
9216
|
const inputCls3 = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm h-8";
|
|
8642
9217
|
const textareaCls = "w-full rounded-md border border-gray-300 px-2 py-1.5 text-sm min-h-[60px]";
|
|
8643
9218
|
return /* @__PURE__ */ jsxs47("div", { className: "border-t border-gray-200 pt-2", children: [
|
|
8644
|
-
/* @__PURE__ */
|
|
9219
|
+
/* @__PURE__ */ jsx57("div", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-3", children: "SEO" }),
|
|
8645
9220
|
/* @__PURE__ */ jsxs47("div", { className: "space-y-3", children: [
|
|
8646
9221
|
/* @__PURE__ */ jsxs47("div", { children: [
|
|
8647
|
-
/* @__PURE__ */
|
|
8648
|
-
/* @__PURE__ */
|
|
9222
|
+
/* @__PURE__ */ jsx57("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Meta Title" }),
|
|
9223
|
+
/* @__PURE__ */ jsx57("input", { type: "text", value: values.seoTitle, onChange: (e) => onChange("seoTitle", e.target.value), className: inputCls3 })
|
|
8649
9224
|
] }),
|
|
8650
9225
|
/* @__PURE__ */ jsxs47("div", { children: [
|
|
8651
|
-
/* @__PURE__ */
|
|
8652
|
-
/* @__PURE__ */
|
|
9226
|
+
/* @__PURE__ */ jsx57("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Meta Description" }),
|
|
9227
|
+
/* @__PURE__ */ jsx57("textarea", { value: values.seoDescription, onChange: (e) => onChange("seoDescription", e.target.value), className: textareaCls, rows: 2 })
|
|
8653
9228
|
] }),
|
|
8654
9229
|
/* @__PURE__ */ jsxs47("div", { children: [
|
|
8655
|
-
/* @__PURE__ */
|
|
8656
|
-
/* @__PURE__ */
|
|
9230
|
+
/* @__PURE__ */ jsx57("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Keywords" }),
|
|
9231
|
+
/* @__PURE__ */ jsx57("input", { type: "text", value: values.seoKeywords, onChange: (e) => onChange("seoKeywords", e.target.value), placeholder: "keyword1, keyword2", className: inputCls3 })
|
|
8657
9232
|
] }),
|
|
8658
9233
|
/* @__PURE__ */ jsxs47("div", { children: [
|
|
8659
|
-
/* @__PURE__ */
|
|
8660
|
-
/* @__PURE__ */
|
|
9234
|
+
/* @__PURE__ */ jsx57("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "OG Title" }),
|
|
9235
|
+
/* @__PURE__ */ jsx57("input", { type: "text", value: values.seoOgTitle, onChange: (e) => onChange("seoOgTitle", e.target.value), className: inputCls3 })
|
|
8661
9236
|
] }),
|
|
8662
9237
|
/* @__PURE__ */ jsxs47("div", { children: [
|
|
8663
|
-
/* @__PURE__ */
|
|
8664
|
-
/* @__PURE__ */
|
|
9238
|
+
/* @__PURE__ */ jsx57("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "OG Description" }),
|
|
9239
|
+
/* @__PURE__ */ jsx57("textarea", { value: values.seoOgDescription, onChange: (e) => onChange("seoOgDescription", e.target.value), className: textareaCls, rows: 2 })
|
|
8665
9240
|
] }),
|
|
8666
9241
|
/* @__PURE__ */ jsxs47("div", { children: [
|
|
8667
|
-
/* @__PURE__ */
|
|
8668
|
-
/* @__PURE__ */
|
|
9242
|
+
/* @__PURE__ */ jsx57("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "OG Image" }),
|
|
9243
|
+
/* @__PURE__ */ jsx57("input", { type: "url", value: values.seoOgImage, onChange: (e) => onChange("seoOgImage", e.target.value), placeholder: "https://...", className: inputCls3 })
|
|
8669
9244
|
] })
|
|
8670
9245
|
] })
|
|
8671
9246
|
] });
|
|
8672
9247
|
}
|
|
8673
9248
|
async function saveSeo(seo, slug, existingSeoId) {
|
|
8674
|
-
const hasSeo = seo.seoTitle || seo.seoDescription || seo.seoKeywords;
|
|
9249
|
+
const hasSeo = seo.seoTitle || seo.seoDescription || seo.seoKeywords || seo.seoOgTitle || seo.seoOgDescription || seo.seoOgImage;
|
|
8675
9250
|
if (!hasSeo) return existingSeoId;
|
|
8676
9251
|
const payload = {
|
|
8677
9252
|
title: seo.seoTitle || null,
|
|
@@ -8721,7 +9296,7 @@ async function fetchSeo(seoId) {
|
|
|
8721
9296
|
}
|
|
8722
9297
|
|
|
8723
9298
|
// src/admin/pages/BrandEditPage.tsx
|
|
8724
|
-
import { Fragment as Fragment13, jsx as
|
|
9299
|
+
import { Fragment as Fragment13, jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
8725
9300
|
var isCreate = (id) => id === "create";
|
|
8726
9301
|
function BrandEditPage({ brandId }) {
|
|
8727
9302
|
const router = useRouter10();
|
|
@@ -8807,10 +9382,10 @@ function BrandEditPage({ brandId }) {
|
|
|
8807
9382
|
}
|
|
8808
9383
|
};
|
|
8809
9384
|
if (loading) {
|
|
8810
|
-
return /* @__PURE__ */
|
|
9385
|
+
return /* @__PURE__ */ jsx58("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsx58("span", { className: "text-gray-500", children: "Loading..." }) });
|
|
8811
9386
|
}
|
|
8812
9387
|
return /* @__PURE__ */ jsxs48("div", { className: "rounded-lg bg-white shadow-md", children: [
|
|
8813
|
-
/* @__PURE__ */
|
|
9388
|
+
/* @__PURE__ */ jsx58(
|
|
8814
9389
|
DetailPageHeader,
|
|
8815
9390
|
{
|
|
8816
9391
|
title: create ? "Add Brand" : "Edit Brand",
|
|
@@ -8822,23 +9397,23 @@ function BrandEditPage({ brandId }) {
|
|
|
8822
9397
|
]
|
|
8823
9398
|
}
|
|
8824
9399
|
),
|
|
8825
|
-
errors.length > 0 && /* @__PURE__ */
|
|
8826
|
-
/* @__PURE__ */
|
|
9400
|
+
errors.length > 0 && /* @__PURE__ */ jsx58("div", { className: "bg-red-50 border-l-4 border-red-400 p-4 mx-6 mt-4", children: /* @__PURE__ */ jsxs48("div", { className: "flex", children: [
|
|
9401
|
+
/* @__PURE__ */ jsx58(AlertCircle4, { className: "h-5 w-5 text-red-400 flex-shrink-0" }),
|
|
8827
9402
|
/* @__PURE__ */ jsxs48("div", { className: "ml-3", children: [
|
|
8828
|
-
/* @__PURE__ */
|
|
8829
|
-
/* @__PURE__ */
|
|
9403
|
+
/* @__PURE__ */ jsx58("h3", { className: "text-sm font-medium text-red-800", children: "Please fix the following errors:" }),
|
|
9404
|
+
/* @__PURE__ */ jsx58("ul", { className: "mt-2 text-sm text-red-700 list-disc pl-5 space-y-1", children: errors.map((e, i) => /* @__PURE__ */ jsx58("li", { children: e }, i)) })
|
|
8830
9405
|
] })
|
|
8831
9406
|
] }) }),
|
|
8832
|
-
/* @__PURE__ */
|
|
9407
|
+
/* @__PURE__ */ jsx58(
|
|
8833
9408
|
DetailPageLayout,
|
|
8834
9409
|
{
|
|
8835
9410
|
main: /* @__PURE__ */ jsxs48(Fragment13, { children: [
|
|
8836
9411
|
/* @__PURE__ */ jsxs48("section", { children: [
|
|
8837
|
-
/* @__PURE__ */
|
|
9412
|
+
/* @__PURE__ */ jsx58("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Basic info" }),
|
|
8838
9413
|
/* @__PURE__ */ jsxs48("div", { className: "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50 space-y-4", children: [
|
|
8839
9414
|
/* @__PURE__ */ jsxs48("div", { children: [
|
|
8840
|
-
/* @__PURE__ */
|
|
8841
|
-
/* @__PURE__ */
|
|
9415
|
+
/* @__PURE__ */ jsx58("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Name *" }),
|
|
9416
|
+
/* @__PURE__ */ jsx58(
|
|
8842
9417
|
"input",
|
|
8843
9418
|
{
|
|
8844
9419
|
type: "text",
|
|
@@ -8850,8 +9425,8 @@ function BrandEditPage({ brandId }) {
|
|
|
8850
9425
|
)
|
|
8851
9426
|
] }),
|
|
8852
9427
|
/* @__PURE__ */ jsxs48("div", { children: [
|
|
8853
|
-
/* @__PURE__ */
|
|
8854
|
-
/* @__PURE__ */
|
|
9428
|
+
/* @__PURE__ */ jsx58("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Slug *" }),
|
|
9429
|
+
/* @__PURE__ */ jsx58(
|
|
8855
9430
|
"input",
|
|
8856
9431
|
{
|
|
8857
9432
|
type: "text",
|
|
@@ -8863,8 +9438,8 @@ function BrandEditPage({ brandId }) {
|
|
|
8863
9438
|
)
|
|
8864
9439
|
] }),
|
|
8865
9440
|
/* @__PURE__ */ jsxs48("div", { children: [
|
|
8866
|
-
/* @__PURE__ */
|
|
8867
|
-
/* @__PURE__ */
|
|
9441
|
+
/* @__PURE__ */ jsx58("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Description" }),
|
|
9442
|
+
/* @__PURE__ */ jsx58(
|
|
8868
9443
|
"textarea",
|
|
8869
9444
|
{
|
|
8870
9445
|
value: description,
|
|
@@ -8875,8 +9450,8 @@ function BrandEditPage({ brandId }) {
|
|
|
8875
9450
|
)
|
|
8876
9451
|
] }),
|
|
8877
9452
|
/* @__PURE__ */ jsxs48("div", { children: [
|
|
8878
|
-
/* @__PURE__ */
|
|
8879
|
-
/* @__PURE__ */
|
|
9453
|
+
/* @__PURE__ */ jsx58("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Logo URL" }),
|
|
9454
|
+
/* @__PURE__ */ jsx58(
|
|
8880
9455
|
"input",
|
|
8881
9456
|
{
|
|
8882
9457
|
type: "url",
|
|
@@ -8887,8 +9462,8 @@ function BrandEditPage({ brandId }) {
|
|
|
8887
9462
|
)
|
|
8888
9463
|
] }),
|
|
8889
9464
|
/* @__PURE__ */ jsxs48("div", { children: [
|
|
8890
|
-
/* @__PURE__ */
|
|
8891
|
-
/* @__PURE__ */
|
|
9465
|
+
/* @__PURE__ */ jsx58("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Sort order" }),
|
|
9466
|
+
/* @__PURE__ */ jsx58(
|
|
8892
9467
|
"input",
|
|
8893
9468
|
{
|
|
8894
9469
|
type: "number",
|
|
@@ -8901,14 +9476,14 @@ function BrandEditPage({ brandId }) {
|
|
|
8901
9476
|
] })
|
|
8902
9477
|
] }),
|
|
8903
9478
|
/* @__PURE__ */ jsxs48("section", { children: [
|
|
8904
|
-
/* @__PURE__ */
|
|
8905
|
-
/* @__PURE__ */
|
|
9479
|
+
/* @__PURE__ */ jsx58("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "SEO" }),
|
|
9480
|
+
/* @__PURE__ */ jsx58("div", { className: "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50", children: /* @__PURE__ */ jsx58(SeoSection, { values: seo, onChange: (field, value) => setSeo((s) => ({ ...s, [field]: value })) }) })
|
|
8906
9481
|
] })
|
|
8907
9482
|
] }),
|
|
8908
|
-
sidebar: /* @__PURE__ */
|
|
8909
|
-
/* @__PURE__ */
|
|
8910
|
-
/* @__PURE__ */
|
|
8911
|
-
/* @__PURE__ */
|
|
9483
|
+
sidebar: /* @__PURE__ */ jsx58(Fragment13, { children: /* @__PURE__ */ jsxs48("section", { children: [
|
|
9484
|
+
/* @__PURE__ */ jsx58("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Status" }),
|
|
9485
|
+
/* @__PURE__ */ jsx58("div", { className: "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50", children: /* @__PURE__ */ jsxs48("label", { className: "flex items-center gap-2 cursor-pointer", children: [
|
|
9486
|
+
/* @__PURE__ */ jsx58(
|
|
8912
9487
|
"input",
|
|
8913
9488
|
{
|
|
8914
9489
|
type: "checkbox",
|
|
@@ -8917,7 +9492,7 @@ function BrandEditPage({ brandId }) {
|
|
|
8917
9492
|
className: "h-4 w-4 rounded border-gray-300"
|
|
8918
9493
|
}
|
|
8919
9494
|
),
|
|
8920
|
-
/* @__PURE__ */
|
|
9495
|
+
/* @__PURE__ */ jsx58("span", { className: "text-sm font-medium text-gray-900", children: "Active" })
|
|
8921
9496
|
] }) })
|
|
8922
9497
|
] }) })
|
|
8923
9498
|
}
|
|
@@ -8932,7 +9507,7 @@ import { AlertCircle as AlertCircle5, Plus as Plus9, Trash2 as Trash25, Star } f
|
|
|
8932
9507
|
|
|
8933
9508
|
// src/components/Admin/AttributeFacetNameInput.tsx
|
|
8934
9509
|
import { useState as useState31, useEffect as useEffect29 } from "react";
|
|
8935
|
-
import { jsx as
|
|
9510
|
+
import { jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
8936
9511
|
function slugFromName(name) {
|
|
8937
9512
|
const s = name.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
8938
9513
|
return s || "attribute";
|
|
@@ -9001,7 +9576,7 @@ function AttributeFacetNameInput({
|
|
|
9001
9576
|
};
|
|
9002
9577
|
const exactMatch = list.some((x) => x.name.toLowerCase() === draft.trim().toLowerCase());
|
|
9003
9578
|
return /* @__PURE__ */ jsxs49("div", { className: "relative min-w-0 flex-1", children: [
|
|
9004
|
-
/* @__PURE__ */
|
|
9579
|
+
/* @__PURE__ */ jsx59(
|
|
9005
9580
|
"input",
|
|
9006
9581
|
{
|
|
9007
9582
|
type: "text",
|
|
@@ -9033,7 +9608,7 @@ function AttributeFacetNameInput({
|
|
|
9033
9608
|
}
|
|
9034
9609
|
),
|
|
9035
9610
|
open && (list.length > 0 || draft.trim() && !exactMatch) && /* @__PURE__ */ jsxs49("ul", { className: "absolute z-20 mt-1 w-full rounded-md border border-gray-200 bg-white py-1 shadow-lg max-h-48 overflow-auto", children: [
|
|
9036
|
-
list.map((a) => /* @__PURE__ */
|
|
9611
|
+
list.map((a) => /* @__PURE__ */ jsx59(
|
|
9037
9612
|
"li",
|
|
9038
9613
|
{
|
|
9039
9614
|
onMouseDown: (e) => {
|
|
@@ -9065,7 +9640,7 @@ function AttributeFacetNameInput({
|
|
|
9065
9640
|
}
|
|
9066
9641
|
|
|
9067
9642
|
// src/admin/pages/ProductEditPage.tsx
|
|
9068
|
-
import { Fragment as Fragment14, jsx as
|
|
9643
|
+
import { Fragment as Fragment14, jsx as jsx60, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
9069
9644
|
var isCreate2 = (id) => id === "create";
|
|
9070
9645
|
var sectionCls = "min-w-0 overflow-hidden border border-gray-200 rounded-lg p-4 bg-gray-50/50";
|
|
9071
9646
|
var labelCls = "block text-xs font-medium text-gray-600 mb-1";
|
|
@@ -9108,8 +9683,11 @@ function ProductEditPage({ productId }) {
|
|
|
9108
9683
|
const [brands, setBrands] = useState32([]);
|
|
9109
9684
|
const [categories, setCategories] = useState32([]);
|
|
9110
9685
|
const [name, setName] = useState32("");
|
|
9686
|
+
const [productSlug, setProductSlug] = useState32("");
|
|
9111
9687
|
const [sku, setSku] = useState32("");
|
|
9112
9688
|
const [hsn, setHsn] = useState32("");
|
|
9689
|
+
const [uom, setUom] = useState32("");
|
|
9690
|
+
const [productType, setProductType] = useState32("product");
|
|
9113
9691
|
const [collectionId, setCollectionId] = useState32(null);
|
|
9114
9692
|
const [brandId, setBrandId] = useState32(null);
|
|
9115
9693
|
const [categoryId, setCategoryId] = useState32(null);
|
|
@@ -9123,6 +9701,8 @@ function ProductEditPage({ productId }) {
|
|
|
9123
9701
|
const [specifications, setSpecifications] = useState32([{ key: "", value: "" }]);
|
|
9124
9702
|
const [otherMetadata, setOtherMetadata] = useState32({});
|
|
9125
9703
|
const [facetRows, setFacetRows] = useState32([{ name: "", value: "" }]);
|
|
9704
|
+
const [taxMasterList, setTaxMasterList] = useState32([]);
|
|
9705
|
+
const [taxRows, setTaxRows] = useState32([{ taxId: "", rate: "" }]);
|
|
9126
9706
|
const [seoId, setSeoId] = useState32(null);
|
|
9127
9707
|
const [seo, setSeo] = useState32({
|
|
9128
9708
|
seoTitle: "",
|
|
@@ -9136,11 +9716,12 @@ function ProductEditPage({ productId }) {
|
|
|
9136
9716
|
let cancelled = false;
|
|
9137
9717
|
(async () => {
|
|
9138
9718
|
try {
|
|
9139
|
-
const [colRes, brandRes, catRes, attrRes] = await Promise.all([
|
|
9719
|
+
const [colRes, brandRes, catRes, attrRes, taxesRes] = await Promise.all([
|
|
9140
9720
|
fetch("/api/collections?limit=500"),
|
|
9141
9721
|
fetch("/api/brands?limit=500"),
|
|
9142
9722
|
fetch("/api/product_categories?limit=500"),
|
|
9143
|
-
fetch("/api/attributes?limit=500")
|
|
9723
|
+
fetch("/api/attributes?limit=500"),
|
|
9724
|
+
fetch("/api/taxes?limit=200&sortField=name&sortOrder=asc")
|
|
9144
9725
|
]);
|
|
9145
9726
|
let attrList = [];
|
|
9146
9727
|
if (!cancelled && colRes.ok) {
|
|
@@ -9159,8 +9740,18 @@ function ProductEditPage({ productId }) {
|
|
|
9159
9740
|
const d = await attrRes.json();
|
|
9160
9741
|
if (Array.isArray(d.data)) attrList = d.data;
|
|
9161
9742
|
}
|
|
9743
|
+
if (!cancelled && taxesRes.ok) {
|
|
9744
|
+
const d = await taxesRes.json();
|
|
9745
|
+
const raw = Array.isArray(d.data) ? d.data : [];
|
|
9746
|
+
setTaxMasterList(
|
|
9747
|
+
raw.filter((t) => t.active !== false && t.deleted !== true)
|
|
9748
|
+
);
|
|
9749
|
+
}
|
|
9162
9750
|
if (create) {
|
|
9163
|
-
if (!cancelled)
|
|
9751
|
+
if (!cancelled) {
|
|
9752
|
+
setProductSlug("");
|
|
9753
|
+
setLoading(false);
|
|
9754
|
+
}
|
|
9164
9755
|
return;
|
|
9165
9756
|
}
|
|
9166
9757
|
const res = await fetch(`/api/products/${productId}`);
|
|
@@ -9168,8 +9759,11 @@ function ProductEditPage({ productId }) {
|
|
|
9168
9759
|
const product = await res.json();
|
|
9169
9760
|
if (cancelled) return;
|
|
9170
9761
|
setName(product.name ?? "");
|
|
9762
|
+
setProductSlug(typeof product.slug === "string" ? product.slug : "");
|
|
9171
9763
|
setSku(product.sku ?? "");
|
|
9172
9764
|
setHsn(product.hsn ?? "");
|
|
9765
|
+
setUom(product.uom != null ? String(product.uom) : "");
|
|
9766
|
+
setProductType(product.type === "service" ? "service" : "product");
|
|
9173
9767
|
setCollectionId(product.collectionId ?? null);
|
|
9174
9768
|
setBrandId(product.brandId ?? null);
|
|
9175
9769
|
setCategoryId(product.categoryId ?? null);
|
|
@@ -9200,6 +9794,19 @@ function ProductEditPage({ productId }) {
|
|
|
9200
9794
|
const seoData = await fetchSeo(product.seoId);
|
|
9201
9795
|
if (!cancelled) setSeo(seoData);
|
|
9202
9796
|
}
|
|
9797
|
+
const ptRes = await fetch(`/api/product_taxes?productId=${productId}&limit=100`);
|
|
9798
|
+
if (ptRes.ok && !cancelled) {
|
|
9799
|
+
const ptData = await ptRes.json();
|
|
9800
|
+
const pts = Array.isArray(ptData.data) ? ptData.data : [];
|
|
9801
|
+
if (pts.length > 0) {
|
|
9802
|
+
setTaxRows(
|
|
9803
|
+
pts.map((p) => ({
|
|
9804
|
+
taxId: p.taxId,
|
|
9805
|
+
rate: p.rate != null && p.rate !== "" ? String(p.rate) : ""
|
|
9806
|
+
}))
|
|
9807
|
+
);
|
|
9808
|
+
} else if (!cancelled) setTaxRows([{ taxId: "", rate: "" }]);
|
|
9809
|
+
}
|
|
9203
9810
|
const paRes = await fetch(`/api/product_attributes?productId=${productId}&limit=100`);
|
|
9204
9811
|
if (paRes.ok && !cancelled) {
|
|
9205
9812
|
const paData = await paRes.json();
|
|
@@ -9223,6 +9830,12 @@ function ProductEditPage({ productId }) {
|
|
|
9223
9830
|
cancelled = true;
|
|
9224
9831
|
};
|
|
9225
9832
|
}, [productId, create]);
|
|
9833
|
+
useEffect30(() => {
|
|
9834
|
+
if (!create || !name.trim() || productSlug.trim()) return;
|
|
9835
|
+
setProductSlug(
|
|
9836
|
+
name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "")
|
|
9837
|
+
);
|
|
9838
|
+
}, [create, name, productSlug]);
|
|
9226
9839
|
const handleSave = async () => {
|
|
9227
9840
|
setErrors([]);
|
|
9228
9841
|
if (!name.trim()) {
|
|
@@ -9235,12 +9848,15 @@ function ProductEditPage({ productId }) {
|
|
|
9235
9848
|
}
|
|
9236
9849
|
setSaving(true);
|
|
9237
9850
|
try {
|
|
9238
|
-
const
|
|
9851
|
+
const seoSlug = productSlug.trim() || name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
9852
|
+
const savedSeoId = await saveSeo(seo, seoSlug, seoId);
|
|
9239
9853
|
const metadata = buildProductMetadata(otherMetadata, { description, images, specifications });
|
|
9240
9854
|
const productPayload = {
|
|
9241
9855
|
name: name.trim(),
|
|
9242
9856
|
sku: sku.trim() || null,
|
|
9243
9857
|
hsn: hsn.trim() || null,
|
|
9858
|
+
uom: uom.trim() || null,
|
|
9859
|
+
type: productType,
|
|
9244
9860
|
collectionId: collectionId || null,
|
|
9245
9861
|
brandId: brandId || null,
|
|
9246
9862
|
categoryId: categoryId || null,
|
|
@@ -9263,6 +9879,9 @@ function ProductEditPage({ productId }) {
|
|
|
9263
9879
|
return;
|
|
9264
9880
|
}
|
|
9265
9881
|
const savedProduct = await res.json();
|
|
9882
|
+
if (typeof savedProduct.slug === "string") {
|
|
9883
|
+
setProductSlug(savedProduct.slug);
|
|
9884
|
+
}
|
|
9266
9885
|
const savedId = create ? savedProduct.id : productId;
|
|
9267
9886
|
const slugify = (n) => n.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "attribute";
|
|
9268
9887
|
async function ensureAttributeId(attrName) {
|
|
@@ -9334,6 +9953,55 @@ function ProductEditPage({ productId }) {
|
|
|
9334
9953
|
});
|
|
9335
9954
|
}
|
|
9336
9955
|
}
|
|
9956
|
+
const parseTaxRate = (s) => {
|
|
9957
|
+
const t = s.trim();
|
|
9958
|
+
if (!t) return null;
|
|
9959
|
+
const n = Number(t);
|
|
9960
|
+
return Number.isFinite(n) ? n : null;
|
|
9961
|
+
};
|
|
9962
|
+
const ratesDiffer = (a, b) => {
|
|
9963
|
+
if (a == null && b == null) return false;
|
|
9964
|
+
if (a == null || b == null) return true;
|
|
9965
|
+
return Math.abs(a - b) > 1e-6;
|
|
9966
|
+
};
|
|
9967
|
+
const wantedTax = /* @__PURE__ */ new Map();
|
|
9968
|
+
for (const row of taxRows) {
|
|
9969
|
+
if (row.taxId === "") continue;
|
|
9970
|
+
wantedTax.set(row.taxId, parseTaxRate(row.rate));
|
|
9971
|
+
}
|
|
9972
|
+
const ptListRes = await fetch(`/api/product_taxes?productId=${savedId}&limit=200`);
|
|
9973
|
+
const ptListData = ptListRes.ok ? await ptListRes.json() : { data: [] };
|
|
9974
|
+
const existingPt = Array.isArray(ptListData.data) ? ptListData.data : [];
|
|
9975
|
+
for (const ep of existingPt) {
|
|
9976
|
+
if (!wantedTax.has(ep.taxId)) {
|
|
9977
|
+
await fetch(`/api/product_taxes/${ep.id}`, { method: "DELETE" });
|
|
9978
|
+
}
|
|
9979
|
+
}
|
|
9980
|
+
const survivors = existingPt.filter((ep) => wantedTax.has(ep.taxId));
|
|
9981
|
+
for (const [taxId, rate] of wantedTax) {
|
|
9982
|
+
const ep = survivors.find((e) => e.taxId === taxId);
|
|
9983
|
+
if (!ep) {
|
|
9984
|
+
await fetch("/api/product_taxes", {
|
|
9985
|
+
method: "POST",
|
|
9986
|
+
headers: { "Content-Type": "application/json" },
|
|
9987
|
+
body: JSON.stringify({
|
|
9988
|
+
productId: Number(savedId),
|
|
9989
|
+
taxId,
|
|
9990
|
+
rate
|
|
9991
|
+
})
|
|
9992
|
+
});
|
|
9993
|
+
} else {
|
|
9994
|
+
const existingRate = ep.rate == null || String(ep.rate).trim() === "" ? null : Number(ep.rate);
|
|
9995
|
+
const er = Number.isFinite(existingRate) ? existingRate : null;
|
|
9996
|
+
if (ratesDiffer(er, rate)) {
|
|
9997
|
+
await fetch(`/api/product_taxes/${ep.id}`, {
|
|
9998
|
+
method: "PUT",
|
|
9999
|
+
headers: { "Content-Type": "application/json" },
|
|
10000
|
+
body: JSON.stringify({ rate })
|
|
10001
|
+
});
|
|
10002
|
+
}
|
|
10003
|
+
}
|
|
10004
|
+
}
|
|
9337
10005
|
router.push("/admin/products");
|
|
9338
10006
|
} catch {
|
|
9339
10007
|
setErrors(["Failed to save"]);
|
|
@@ -9351,11 +10019,23 @@ function ProductEditPage({ productId }) {
|
|
|
9351
10019
|
const addFacet = () => setFacetRows((prev) => [...prev, { name: "", value: "" }]);
|
|
9352
10020
|
const removeFacet = (i) => setFacetRows((prev) => prev.length <= 1 ? prev : prev.filter((_, j) => j !== i));
|
|
9353
10021
|
const setFacet = (i, field, value) => setFacetRows((prev) => prev.map((row, j) => j === i ? { ...row, [field]: value } : row));
|
|
10022
|
+
const addTaxRow = () => setTaxRows((prev) => [...prev, { taxId: "", rate: "" }]);
|
|
10023
|
+
const removeTaxRow = (i) => setTaxRows((prev) => prev.length <= 1 ? prev : prev.filter((_, j) => j !== i));
|
|
10024
|
+
const setTaxRow = (i, patch) => setTaxRows((prev) => prev.map((row, j) => j === i ? { ...row, ...patch } : row));
|
|
10025
|
+
const taxesForSelect = (rowIndex) => {
|
|
10026
|
+
const row = taxRows[rowIndex];
|
|
10027
|
+
const selectedElsewhere = new Set(
|
|
10028
|
+
taxRows.map((r, j) => j !== rowIndex && r.taxId !== "" ? r.taxId : null).filter((x) => x != null)
|
|
10029
|
+
);
|
|
10030
|
+
return taxMasterList.filter(
|
|
10031
|
+
(t) => !selectedElsewhere.has(t.id) || row && row.taxId !== "" && t.id === row.taxId
|
|
10032
|
+
);
|
|
10033
|
+
};
|
|
9354
10034
|
if (loading) {
|
|
9355
|
-
return /* @__PURE__ */
|
|
10035
|
+
return /* @__PURE__ */ jsx60("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsx60("span", { className: "text-gray-500", children: "Loading..." }) });
|
|
9356
10036
|
}
|
|
9357
10037
|
return /* @__PURE__ */ jsxs50("div", { className: "rounded-lg bg-white shadow-md", children: [
|
|
9358
|
-
/* @__PURE__ */
|
|
10038
|
+
/* @__PURE__ */ jsx60(
|
|
9359
10039
|
DetailPageHeader,
|
|
9360
10040
|
{
|
|
9361
10041
|
title: create ? "Add Product" : "Edit Product",
|
|
@@ -9367,90 +10047,192 @@ function ProductEditPage({ productId }) {
|
|
|
9367
10047
|
]
|
|
9368
10048
|
}
|
|
9369
10049
|
),
|
|
9370
|
-
errors.length > 0 && /* @__PURE__ */
|
|
9371
|
-
/* @__PURE__ */
|
|
10050
|
+
errors.length > 0 && /* @__PURE__ */ jsx60("div", { className: "bg-red-50 border-l-4 border-red-400 p-4 mx-6 mt-4", children: /* @__PURE__ */ jsxs50("div", { className: "flex", children: [
|
|
10051
|
+
/* @__PURE__ */ jsx60(AlertCircle5, { className: "h-5 w-5 text-red-400 flex-shrink-0" }),
|
|
9372
10052
|
/* @__PURE__ */ jsxs50("div", { className: "ml-3", children: [
|
|
9373
|
-
/* @__PURE__ */
|
|
9374
|
-
/* @__PURE__ */
|
|
10053
|
+
/* @__PURE__ */ jsx60("h3", { className: "text-sm font-medium text-red-800", children: "Please fix the following errors:" }),
|
|
10054
|
+
/* @__PURE__ */ jsx60("ul", { className: "mt-2 text-sm text-red-700 list-disc pl-5 space-y-1", children: errors.map((e, i) => /* @__PURE__ */ jsx60("li", { children: e }, i)) })
|
|
9375
10055
|
] })
|
|
9376
10056
|
] }) }),
|
|
9377
|
-
/* @__PURE__ */
|
|
10057
|
+
/* @__PURE__ */ jsx60(
|
|
9378
10058
|
DetailPageLayout,
|
|
9379
10059
|
{
|
|
9380
10060
|
main: /* @__PURE__ */ jsxs50(Fragment14, { children: [
|
|
9381
10061
|
/* @__PURE__ */ jsxs50("section", { children: [
|
|
9382
|
-
/* @__PURE__ */
|
|
10062
|
+
/* @__PURE__ */ jsx60("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Product details" }),
|
|
9383
10063
|
/* @__PURE__ */ jsxs50("div", { className: `${sectionCls} space-y-4`, children: [
|
|
9384
10064
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9385
|
-
/* @__PURE__ */
|
|
9386
|
-
/* @__PURE__ */
|
|
10065
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Name *" }),
|
|
10066
|
+
/* @__PURE__ */ jsx60("input", { type: "text", value: name, onChange: (e) => setName(e.target.value), className: inputCls, required: true })
|
|
9387
10067
|
] }),
|
|
9388
10068
|
/* @__PURE__ */ jsxs50("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9389
10069
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9390
|
-
/* @__PURE__ */
|
|
9391
|
-
/* @__PURE__ */
|
|
10070
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "SKU" }),
|
|
10071
|
+
/* @__PURE__ */ jsx60("input", { type: "text", value: sku, onChange: (e) => setSku(e.target.value), className: inputCls })
|
|
10072
|
+
] }),
|
|
10073
|
+
/* @__PURE__ */ jsxs50("div", { children: [
|
|
10074
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "HSN" }),
|
|
10075
|
+
/* @__PURE__ */ jsx60("input", { type: "text", value: hsn, onChange: (e) => setHsn(e.target.value), className: inputCls })
|
|
10076
|
+
] })
|
|
10077
|
+
] }),
|
|
10078
|
+
/* @__PURE__ */ jsxs50("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10079
|
+
/* @__PURE__ */ jsxs50("div", { children: [
|
|
10080
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "UOM" }),
|
|
10081
|
+
/* @__PURE__ */ jsx60(
|
|
10082
|
+
"input",
|
|
10083
|
+
{
|
|
10084
|
+
type: "text",
|
|
10085
|
+
value: uom,
|
|
10086
|
+
onChange: (e) => setUom(e.target.value),
|
|
10087
|
+
className: inputCls,
|
|
10088
|
+
placeholder: "e.g. pcs, kg, hrs"
|
|
10089
|
+
}
|
|
10090
|
+
)
|
|
9392
10091
|
] }),
|
|
9393
10092
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9394
|
-
/* @__PURE__ */
|
|
9395
|
-
/* @__PURE__ */
|
|
10093
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Product type" }),
|
|
10094
|
+
/* @__PURE__ */ jsxs50(
|
|
10095
|
+
"select",
|
|
10096
|
+
{
|
|
10097
|
+
value: productType,
|
|
10098
|
+
onChange: (e) => setProductType(e.target.value === "service" ? "service" : "product"),
|
|
10099
|
+
className: inputCls,
|
|
10100
|
+
children: [
|
|
10101
|
+
/* @__PURE__ */ jsx60("option", { value: "product", children: "Product" }),
|
|
10102
|
+
/* @__PURE__ */ jsx60("option", { value: "service", children: "Service" })
|
|
10103
|
+
]
|
|
10104
|
+
}
|
|
10105
|
+
)
|
|
9396
10106
|
] })
|
|
9397
10107
|
] }),
|
|
9398
10108
|
/* @__PURE__ */ jsxs50("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9399
10109
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9400
|
-
/* @__PURE__ */
|
|
10110
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Brand" }),
|
|
9401
10111
|
/* @__PURE__ */ jsxs50("select", { value: brandId ?? "", onChange: (e) => setBrandId(e.target.value ? Number(e.target.value) : null), className: inputCls, children: [
|
|
9402
|
-
/* @__PURE__ */
|
|
9403
|
-
brands.map((b) => /* @__PURE__ */
|
|
10112
|
+
/* @__PURE__ */ jsx60("option", { value: "", children: "None" }),
|
|
10113
|
+
brands.map((b) => /* @__PURE__ */ jsx60("option", { value: b.id, children: b.name }, b.id))
|
|
9404
10114
|
] })
|
|
9405
10115
|
] }),
|
|
9406
10116
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9407
|
-
/* @__PURE__ */
|
|
10117
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Category" }),
|
|
9408
10118
|
/* @__PURE__ */ jsxs50("select", { value: categoryId ?? "", onChange: (e) => setCategoryId(e.target.value ? Number(e.target.value) : null), className: inputCls, children: [
|
|
9409
|
-
/* @__PURE__ */
|
|
9410
|
-
categories.map((c) => /* @__PURE__ */
|
|
10119
|
+
/* @__PURE__ */ jsx60("option", { value: "", children: "None" }),
|
|
10120
|
+
categories.map((c) => /* @__PURE__ */ jsx60("option", { value: c.id, children: c.name }, c.id))
|
|
9411
10121
|
] })
|
|
9412
10122
|
] })
|
|
9413
10123
|
] }),
|
|
9414
10124
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9415
|
-
/* @__PURE__ */
|
|
10125
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Collection" }),
|
|
9416
10126
|
/* @__PURE__ */ jsxs50("select", { value: collectionId ?? "", onChange: (e) => setCollectionId(e.target.value ? Number(e.target.value) : null), className: inputCls, children: [
|
|
9417
|
-
/* @__PURE__ */
|
|
9418
|
-
collections.map((c) => /* @__PURE__ */
|
|
10127
|
+
/* @__PURE__ */ jsx60("option", { value: "", children: "None" }),
|
|
10128
|
+
collections.map((c) => /* @__PURE__ */ jsx60("option", { value: c.id, children: c.name }, c.id))
|
|
9419
10129
|
] })
|
|
9420
10130
|
] }),
|
|
9421
10131
|
/* @__PURE__ */ jsxs50("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9422
10132
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9423
|
-
/* @__PURE__ */
|
|
9424
|
-
/* @__PURE__ */
|
|
10133
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Price *" }),
|
|
10134
|
+
/* @__PURE__ */ jsx60("input", { type: "number", value: price, onChange: (e) => setPrice(e.target.value), className: inputCls, required: true })
|
|
9425
10135
|
] }),
|
|
9426
10136
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9427
|
-
/* @__PURE__ */
|
|
9428
|
-
/* @__PURE__ */
|
|
10137
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Compare at price" }),
|
|
10138
|
+
/* @__PURE__ */ jsx60("input", { type: "number", value: compareAtPrice, onChange: (e) => setCompareAtPrice(e.target.value), className: inputCls })
|
|
9429
10139
|
] })
|
|
9430
10140
|
] }),
|
|
9431
10141
|
/* @__PURE__ */ jsxs50("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9432
10142
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9433
|
-
/* @__PURE__ */
|
|
9434
|
-
/* @__PURE__ */
|
|
10143
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Quantity" }),
|
|
10144
|
+
/* @__PURE__ */ jsx60("input", { type: "number", value: quantity, onChange: (e) => setQuantity(Number(e.target.value) || 0), className: inputCls })
|
|
9435
10145
|
] }),
|
|
9436
10146
|
/* @__PURE__ */ jsxs50("div", { children: [
|
|
9437
|
-
/* @__PURE__ */
|
|
10147
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Status" }),
|
|
9438
10148
|
/* @__PURE__ */ jsxs50("select", { value: status, onChange: (e) => setStatus(e.target.value), className: inputCls, children: [
|
|
9439
|
-
/* @__PURE__ */
|
|
9440
|
-
/* @__PURE__ */
|
|
9441
|
-
/* @__PURE__ */
|
|
9442
|
-
/* @__PURE__ */
|
|
10149
|
+
/* @__PURE__ */ jsx60("option", { value: "draft", children: "Draft" }),
|
|
10150
|
+
/* @__PURE__ */ jsx60("option", { value: "available", children: "Available" }),
|
|
10151
|
+
/* @__PURE__ */ jsx60("option", { value: "reserved", children: "Reserved" }),
|
|
10152
|
+
/* @__PURE__ */ jsx60("option", { value: "sold", children: "Sold" })
|
|
9443
10153
|
] })
|
|
9444
10154
|
] })
|
|
9445
10155
|
] })
|
|
9446
10156
|
] })
|
|
9447
10157
|
] }),
|
|
9448
10158
|
/* @__PURE__ */ jsxs50("section", { children: [
|
|
9449
|
-
/* @__PURE__ */
|
|
9450
|
-
/* @__PURE__ */
|
|
10159
|
+
/* @__PURE__ */ jsx60("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Taxes" }),
|
|
10160
|
+
/* @__PURE__ */ jsx60("p", { className: "text-xs text-gray-500 mb-2", children: "Link taxes for this product. Leave rate empty to use the tax's default rate; set a value to override." }),
|
|
10161
|
+
/* @__PURE__ */ jsxs50("div", { className: `${sectionCls} space-y-2`, children: [
|
|
10162
|
+
taxRows.map((row, i) => {
|
|
10163
|
+
const options = taxesForSelect(i);
|
|
10164
|
+
const master = row.taxId !== "" ? taxMasterList.find((t) => t.id === row.taxId) : void 0;
|
|
10165
|
+
const defaultRateHint = master != null ? `Default: ${String(master.rate)}%` : void 0;
|
|
10166
|
+
return /* @__PURE__ */ jsxs50("div", { className: "flex flex-wrap gap-2 items-end", children: [
|
|
10167
|
+
/* @__PURE__ */ jsxs50("div", { className: "min-w-[160px] flex-1", children: [
|
|
10168
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Tax" }),
|
|
10169
|
+
/* @__PURE__ */ jsxs50(
|
|
10170
|
+
"select",
|
|
10171
|
+
{
|
|
10172
|
+
value: row.taxId === "" ? "" : String(row.taxId),
|
|
10173
|
+
onChange: (e) => {
|
|
10174
|
+
const v = e.target.value;
|
|
10175
|
+
setTaxRow(i, { taxId: v === "" ? "" : Number(v) });
|
|
10176
|
+
},
|
|
10177
|
+
className: inputCls,
|
|
10178
|
+
children: [
|
|
10179
|
+
/* @__PURE__ */ jsx60("option", { value: "", children: "\u2014" }),
|
|
10180
|
+
options.map((t) => /* @__PURE__ */ jsxs50("option", { value: t.id, children: [
|
|
10181
|
+
t.name,
|
|
10182
|
+
" (",
|
|
10183
|
+
String(t.rate),
|
|
10184
|
+
"%)"
|
|
10185
|
+
] }, t.id))
|
|
10186
|
+
]
|
|
10187
|
+
}
|
|
10188
|
+
)
|
|
10189
|
+
] }),
|
|
10190
|
+
/* @__PURE__ */ jsxs50("div", { className: "w-28", children: [
|
|
10191
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Rate %" }),
|
|
10192
|
+
/* @__PURE__ */ jsx60(
|
|
10193
|
+
"input",
|
|
10194
|
+
{
|
|
10195
|
+
type: "text",
|
|
10196
|
+
inputMode: "decimal",
|
|
10197
|
+
value: row.rate,
|
|
10198
|
+
onChange: (e) => setTaxRow(i, { rate: e.target.value }),
|
|
10199
|
+
className: inputCls,
|
|
10200
|
+
placeholder: defaultRateHint ?? "optional",
|
|
10201
|
+
title: defaultRateHint
|
|
10202
|
+
}
|
|
10203
|
+
)
|
|
10204
|
+
] }),
|
|
10205
|
+
/* @__PURE__ */ jsx60(
|
|
10206
|
+
"button",
|
|
10207
|
+
{
|
|
10208
|
+
type: "button",
|
|
10209
|
+
onClick: () => removeTaxRow(i),
|
|
10210
|
+
className: "p-2 text-gray-400 hover:text-red-600 rounded shrink-0 mb-0.5",
|
|
10211
|
+
children: /* @__PURE__ */ jsx60(Trash25, { className: "h-4 w-4" })
|
|
10212
|
+
}
|
|
10213
|
+
)
|
|
10214
|
+
] }, i);
|
|
10215
|
+
}),
|
|
10216
|
+
/* @__PURE__ */ jsxs50(
|
|
10217
|
+
"button",
|
|
10218
|
+
{
|
|
10219
|
+
type: "button",
|
|
10220
|
+
onClick: addTaxRow,
|
|
10221
|
+
className: "inline-flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50",
|
|
10222
|
+
children: [
|
|
10223
|
+
/* @__PURE__ */ jsx60(Plus9, { className: "h-3.5 w-3.5" }),
|
|
10224
|
+
" Add tax"
|
|
10225
|
+
]
|
|
10226
|
+
}
|
|
10227
|
+
)
|
|
10228
|
+
] })
|
|
10229
|
+
] }),
|
|
10230
|
+
/* @__PURE__ */ jsxs50("section", { children: [
|
|
10231
|
+
/* @__PURE__ */ jsx60("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Attributes (facets)" }),
|
|
10232
|
+
/* @__PURE__ */ jsx60("p", { className: "text-xs text-gray-500 mb-2", children: "Search existing attributes or create new ones (like blog categories). Value on the right." }),
|
|
9451
10233
|
/* @__PURE__ */ jsxs50("div", { className: `${sectionCls} space-y-2`, children: [
|
|
9452
10234
|
facetRows.map((row, i) => /* @__PURE__ */ jsxs50("div", { className: "flex gap-2 items-start", children: [
|
|
9453
|
-
/* @__PURE__ */
|
|
10235
|
+
/* @__PURE__ */ jsx60(
|
|
9454
10236
|
AttributeFacetNameInput,
|
|
9455
10237
|
{
|
|
9456
10238
|
value: row.name,
|
|
@@ -9458,7 +10240,7 @@ function ProductEditPage({ productId }) {
|
|
|
9458
10240
|
inputClassName: inputCls
|
|
9459
10241
|
}
|
|
9460
10242
|
),
|
|
9461
|
-
/* @__PURE__ */
|
|
10243
|
+
/* @__PURE__ */ jsx60(
|
|
9462
10244
|
"input",
|
|
9463
10245
|
{
|
|
9464
10246
|
type: "text",
|
|
@@ -9468,21 +10250,21 @@ function ProductEditPage({ productId }) {
|
|
|
9468
10250
|
className: `${inputCls} flex-1 min-w-[120px]`
|
|
9469
10251
|
}
|
|
9470
10252
|
),
|
|
9471
|
-
/* @__PURE__ */
|
|
10253
|
+
/* @__PURE__ */ jsx60("button", { type: "button", onClick: () => removeFacet(i), className: "p-2 text-gray-400 hover:text-red-600 rounded shrink-0 mt-0.5", children: /* @__PURE__ */ jsx60(Trash25, { className: "h-4 w-4" }) })
|
|
9472
10254
|
] }, i)),
|
|
9473
10255
|
/* @__PURE__ */ jsxs50("button", { type: "button", onClick: addFacet, className: "inline-flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50", children: [
|
|
9474
|
-
/* @__PURE__ */
|
|
10256
|
+
/* @__PURE__ */ jsx60(Plus9, { className: "h-3.5 w-3.5" }),
|
|
9475
10257
|
" Add attribute"
|
|
9476
10258
|
] })
|
|
9477
10259
|
] })
|
|
9478
10260
|
] }),
|
|
9479
10261
|
/* @__PURE__ */ jsxs50("section", { children: [
|
|
9480
|
-
/* @__PURE__ */
|
|
10262
|
+
/* @__PURE__ */ jsx60("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Media" }),
|
|
9481
10263
|
/* @__PURE__ */ jsxs50("div", { className: `${sectionCls} space-y-3`, children: [
|
|
9482
10264
|
images.map((row, i) => /* @__PURE__ */ jsxs50("div", { className: "flex flex-wrap items-start gap-2 p-2 bg-white rounded border border-gray-200", children: [
|
|
9483
10265
|
/* @__PURE__ */ jsxs50("div", { className: "flex-1 min-w-[200px]", children: [
|
|
9484
|
-
/* @__PURE__ */
|
|
9485
|
-
/* @__PURE__ */
|
|
10266
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Image URL" }),
|
|
10267
|
+
/* @__PURE__ */ jsx60(
|
|
9486
10268
|
"input",
|
|
9487
10269
|
{
|
|
9488
10270
|
type: "url",
|
|
@@ -9494,8 +10276,8 @@ function ProductEditPage({ productId }) {
|
|
|
9494
10276
|
)
|
|
9495
10277
|
] }),
|
|
9496
10278
|
/* @__PURE__ */ jsxs50("div", { className: "flex-1 min-w-[120px]", children: [
|
|
9497
|
-
/* @__PURE__ */
|
|
9498
|
-
/* @__PURE__ */
|
|
10279
|
+
/* @__PURE__ */ jsx60("label", { className: labelCls, children: "Alt text" }),
|
|
10280
|
+
/* @__PURE__ */ jsx60(
|
|
9499
10281
|
"input",
|
|
9500
10282
|
{
|
|
9501
10283
|
type: "text",
|
|
@@ -9505,27 +10287,27 @@ function ProductEditPage({ productId }) {
|
|
|
9505
10287
|
}
|
|
9506
10288
|
)
|
|
9507
10289
|
] }),
|
|
9508
|
-
/* @__PURE__ */
|
|
10290
|
+
/* @__PURE__ */ jsx60(
|
|
9509
10291
|
"button",
|
|
9510
10292
|
{
|
|
9511
10293
|
type: "button",
|
|
9512
10294
|
onClick: () => setDefaultImage(i),
|
|
9513
10295
|
title: "Set as default",
|
|
9514
10296
|
className: "mt-6 p-2 rounded border border-gray-300 hover:bg-gray-100",
|
|
9515
|
-
children: /* @__PURE__ */
|
|
10297
|
+
children: /* @__PURE__ */ jsx60(Star, { className: `h-4 w-4 ${row.isDefault ? "fill-amber-400 text-amber-500" : "text-gray-400"}` })
|
|
9516
10298
|
}
|
|
9517
10299
|
),
|
|
9518
|
-
/* @__PURE__ */
|
|
10300
|
+
/* @__PURE__ */ jsx60("button", { type: "button", onClick: () => removeImage(i), className: "mt-6 p-2 text-gray-400 hover:text-red-600 rounded", children: /* @__PURE__ */ jsx60(Trash25, { className: "h-4 w-4" }) })
|
|
9519
10301
|
] }, i)),
|
|
9520
10302
|
/* @__PURE__ */ jsxs50("button", { type: "button", onClick: addImage, className: "inline-flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50", children: [
|
|
9521
|
-
/* @__PURE__ */
|
|
10303
|
+
/* @__PURE__ */ jsx60(Plus9, { className: "h-3.5 w-3.5" }),
|
|
9522
10304
|
" Add image"
|
|
9523
10305
|
] })
|
|
9524
10306
|
] })
|
|
9525
10307
|
] }),
|
|
9526
10308
|
/* @__PURE__ */ jsxs50("section", { children: [
|
|
9527
|
-
/* @__PURE__ */
|
|
9528
|
-
/* @__PURE__ */
|
|
10309
|
+
/* @__PURE__ */ jsx60("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Description" }),
|
|
10310
|
+
/* @__PURE__ */ jsx60("div", { className: sectionCls, children: /* @__PURE__ */ jsx60(
|
|
9529
10311
|
"textarea",
|
|
9530
10312
|
{
|
|
9531
10313
|
value: description,
|
|
@@ -9537,10 +10319,10 @@ function ProductEditPage({ productId }) {
|
|
|
9537
10319
|
) })
|
|
9538
10320
|
] }),
|
|
9539
10321
|
/* @__PURE__ */ jsxs50("section", { children: [
|
|
9540
|
-
/* @__PURE__ */
|
|
10322
|
+
/* @__PURE__ */ jsx60("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Specifications" }),
|
|
9541
10323
|
/* @__PURE__ */ jsxs50("div", { className: `${sectionCls} space-y-2`, children: [
|
|
9542
10324
|
specifications.map((row, i) => /* @__PURE__ */ jsxs50("div", { className: "flex gap-2", children: [
|
|
9543
|
-
/* @__PURE__ */
|
|
10325
|
+
/* @__PURE__ */ jsx60(
|
|
9544
10326
|
"input",
|
|
9545
10327
|
{
|
|
9546
10328
|
type: "text",
|
|
@@ -9550,7 +10332,7 @@ function ProductEditPage({ productId }) {
|
|
|
9550
10332
|
className: `${inputCls} flex-1`
|
|
9551
10333
|
}
|
|
9552
10334
|
),
|
|
9553
|
-
/* @__PURE__ */
|
|
10335
|
+
/* @__PURE__ */ jsx60(
|
|
9554
10336
|
"input",
|
|
9555
10337
|
{
|
|
9556
10338
|
type: "text",
|
|
@@ -9560,18 +10342,18 @@ function ProductEditPage({ productId }) {
|
|
|
9560
10342
|
className: `${inputCls} flex-1`
|
|
9561
10343
|
}
|
|
9562
10344
|
),
|
|
9563
|
-
/* @__PURE__ */
|
|
10345
|
+
/* @__PURE__ */ jsx60("button", { type: "button", onClick: () => removeSpec(i), className: "p-2 text-gray-400 hover:text-red-600 rounded shrink-0", children: /* @__PURE__ */ jsx60(Trash25, { className: "h-4 w-4" }) })
|
|
9564
10346
|
] }, i)),
|
|
9565
10347
|
/* @__PURE__ */ jsxs50("button", { type: "button", onClick: addSpec, className: "inline-flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50", children: [
|
|
9566
|
-
/* @__PURE__ */
|
|
10348
|
+
/* @__PURE__ */ jsx60(Plus9, { className: "h-3.5 w-3.5" }),
|
|
9567
10349
|
" Add row"
|
|
9568
10350
|
] })
|
|
9569
10351
|
] })
|
|
9570
10352
|
] })
|
|
9571
10353
|
] }),
|
|
9572
10354
|
sidebar: /* @__PURE__ */ jsxs50("section", { children: [
|
|
9573
|
-
/* @__PURE__ */
|
|
9574
|
-
/* @__PURE__ */
|
|
10355
|
+
/* @__PURE__ */ jsx60("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "SEO" }),
|
|
10356
|
+
/* @__PURE__ */ jsx60("div", { className: sectionCls, children: /* @__PURE__ */ jsx60(SeoSection, { values: seo, onChange: (field, value) => setSeo((s) => ({ ...s, [field]: value })) }) })
|
|
9575
10357
|
] })
|
|
9576
10358
|
}
|
|
9577
10359
|
)
|
|
@@ -9582,7 +10364,7 @@ function ProductEditPage({ productId }) {
|
|
|
9582
10364
|
import { useState as useState33, useEffect as useEffect31 } from "react";
|
|
9583
10365
|
import { useRouter as useRouter12 } from "next/navigation";
|
|
9584
10366
|
import { AlertCircle as AlertCircle6, Plus as Plus10, Trash2 as Trash26, ChevronDown as ChevronDown6, ChevronUp as ChevronUp2 } from "lucide-react";
|
|
9585
|
-
import { Fragment as Fragment15, jsx as
|
|
10367
|
+
import { Fragment as Fragment15, jsx as jsx61, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
9586
10368
|
var isCreate3 = (id) => id === "create";
|
|
9587
10369
|
var emptySlide = () => ({ url: "", type: "image", caption: "" });
|
|
9588
10370
|
var emptyVariant = () => ({ name: "", price: "", extraSpecs: [] });
|
|
@@ -9783,10 +10565,10 @@ function CollectionEditPage({ collectionId }) {
|
|
|
9783
10565
|
(v) => v.map((x, j) => j === variantIdx ? { ...x, extraSpecs: x.extraSpecs.filter((_, s) => s !== specIdx) } : x)
|
|
9784
10566
|
);
|
|
9785
10567
|
if (loading) {
|
|
9786
|
-
return /* @__PURE__ */
|
|
10568
|
+
return /* @__PURE__ */ jsx61("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsx61("span", { className: "text-gray-500", children: "Loading..." }) });
|
|
9787
10569
|
}
|
|
9788
10570
|
return /* @__PURE__ */ jsxs51("div", { className: "rounded-lg bg-white shadow-md", children: [
|
|
9789
|
-
/* @__PURE__ */
|
|
10571
|
+
/* @__PURE__ */ jsx61(
|
|
9790
10572
|
DetailPageHeader,
|
|
9791
10573
|
{
|
|
9792
10574
|
title: create ? "Add Collection" : "Edit Collection",
|
|
@@ -9798,59 +10580,59 @@ function CollectionEditPage({ collectionId }) {
|
|
|
9798
10580
|
]
|
|
9799
10581
|
}
|
|
9800
10582
|
),
|
|
9801
|
-
errors.length > 0 && /* @__PURE__ */
|
|
9802
|
-
/* @__PURE__ */
|
|
10583
|
+
errors.length > 0 && /* @__PURE__ */ jsx61("div", { className: "bg-red-50 border-l-4 border-red-400 p-4 mx-6 mt-4", children: /* @__PURE__ */ jsxs51("div", { className: "flex", children: [
|
|
10584
|
+
/* @__PURE__ */ jsx61(AlertCircle6, { className: "h-5 w-5 text-red-400 flex-shrink-0" }),
|
|
9803
10585
|
/* @__PURE__ */ jsxs51("div", { className: "ml-3", children: [
|
|
9804
|
-
/* @__PURE__ */
|
|
9805
|
-
/* @__PURE__ */
|
|
10586
|
+
/* @__PURE__ */ jsx61("h3", { className: "text-sm font-medium text-red-800", children: "Please fix the following errors:" }),
|
|
10587
|
+
/* @__PURE__ */ jsx61("ul", { className: "mt-2 text-sm text-red-700 list-disc pl-5 space-y-1", children: errors.map((e, i) => /* @__PURE__ */ jsx61("li", { children: e }, i)) })
|
|
9806
10588
|
] })
|
|
9807
10589
|
] }) }),
|
|
9808
|
-
/* @__PURE__ */
|
|
10590
|
+
/* @__PURE__ */ jsx61(
|
|
9809
10591
|
DetailPageLayout,
|
|
9810
10592
|
{
|
|
9811
10593
|
main: /* @__PURE__ */ jsxs51(Fragment15, { children: [
|
|
9812
10594
|
/* @__PURE__ */ jsxs51("section", { children: [
|
|
9813
|
-
/* @__PURE__ */
|
|
10595
|
+
/* @__PURE__ */ jsx61("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Basic info" }),
|
|
9814
10596
|
/* @__PURE__ */ jsxs51("div", { className: `${sectionCls2} space-y-4`, children: [
|
|
9815
10597
|
/* @__PURE__ */ jsxs51("div", { children: [
|
|
9816
|
-
/* @__PURE__ */
|
|
9817
|
-
/* @__PURE__ */
|
|
10598
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "Name *" }),
|
|
10599
|
+
/* @__PURE__ */ jsx61("input", { type: "text", value: name, onChange: (e) => setName(e.target.value), className: inputCls2, required: true })
|
|
9818
10600
|
] }),
|
|
9819
10601
|
/* @__PURE__ */ jsxs51("div", { children: [
|
|
9820
|
-
/* @__PURE__ */
|
|
9821
|
-
/* @__PURE__ */
|
|
10602
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "Slug *" }),
|
|
10603
|
+
/* @__PURE__ */ jsx61("input", { type: "text", value: slug, onChange: (e) => setSlug(e.target.value), className: inputCls2, required: true })
|
|
9822
10604
|
] }),
|
|
9823
10605
|
/* @__PURE__ */ jsxs51("div", { children: [
|
|
9824
|
-
/* @__PURE__ */
|
|
9825
|
-
/* @__PURE__ */
|
|
10606
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "HSN" }),
|
|
10607
|
+
/* @__PURE__ */ jsx61("input", { type: "text", value: hsn, onChange: (e) => setHsn(e.target.value), className: inputCls2 })
|
|
9826
10608
|
] }),
|
|
9827
10609
|
/* @__PURE__ */ jsxs51("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9828
10610
|
/* @__PURE__ */ jsxs51("div", { children: [
|
|
9829
|
-
/* @__PURE__ */
|
|
10611
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "Category" }),
|
|
9830
10612
|
/* @__PURE__ */ jsxs51("select", { value: categoryId ?? "", onChange: (e) => setCategoryId(e.target.value ? Number(e.target.value) : null), className: inputCls2, children: [
|
|
9831
|
-
/* @__PURE__ */
|
|
9832
|
-
categories.map((c) => /* @__PURE__ */
|
|
10613
|
+
/* @__PURE__ */ jsx61("option", { value: "", children: "None" }),
|
|
10614
|
+
categories.map((c) => /* @__PURE__ */ jsx61("option", { value: c.id, children: c.name }, c.id))
|
|
9833
10615
|
] })
|
|
9834
10616
|
] }),
|
|
9835
10617
|
/* @__PURE__ */ jsxs51("div", { children: [
|
|
9836
|
-
/* @__PURE__ */
|
|
10618
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "Brand" }),
|
|
9837
10619
|
/* @__PURE__ */ jsxs51("select", { value: brandId ?? "", onChange: (e) => setBrandId(e.target.value ? Number(e.target.value) : null), className: inputCls2, children: [
|
|
9838
|
-
/* @__PURE__ */
|
|
9839
|
-
brands.map((b) => /* @__PURE__ */
|
|
10620
|
+
/* @__PURE__ */ jsx61("option", { value: "", children: "None" }),
|
|
10621
|
+
brands.map((b) => /* @__PURE__ */ jsx61("option", { value: b.id, children: b.name }, b.id))
|
|
9840
10622
|
] })
|
|
9841
10623
|
] })
|
|
9842
10624
|
] }),
|
|
9843
10625
|
/* @__PURE__ */ jsxs51("div", { children: [
|
|
9844
|
-
/* @__PURE__ */
|
|
9845
|
-
/* @__PURE__ */
|
|
10626
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "Description" }),
|
|
10627
|
+
/* @__PURE__ */ jsx61("textarea", { value: description, onChange: (e) => setDescription(e.target.value), className: `${inputCls2} min-h-[80px]`, rows: 3 })
|
|
9846
10628
|
] }),
|
|
9847
10629
|
/* @__PURE__ */ jsxs51("div", { children: [
|
|
9848
|
-
/* @__PURE__ */
|
|
9849
|
-
/* @__PURE__ */
|
|
10630
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "Cover image URL" }),
|
|
10631
|
+
/* @__PURE__ */ jsx61("input", { type: "url", value: image, onChange: (e) => setImage(e.target.value), className: inputCls2, placeholder: "https://..." })
|
|
9850
10632
|
] }),
|
|
9851
10633
|
/* @__PURE__ */ jsxs51("div", { children: [
|
|
9852
|
-
/* @__PURE__ */
|
|
9853
|
-
/* @__PURE__ */
|
|
10634
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "Sort order" }),
|
|
10635
|
+
/* @__PURE__ */ jsx61("input", { type: "number", value: sortOrder, onChange: (e) => setSortOrder(Number(e.target.value) || 0), className: inputCls2, style: { width: "6rem" } })
|
|
9854
10636
|
] })
|
|
9855
10637
|
] })
|
|
9856
10638
|
] }),
|
|
@@ -9862,73 +10644,73 @@ function CollectionEditPage({ collectionId }) {
|
|
|
9862
10644
|
onClick: () => setAdvancedOpen((o) => !o),
|
|
9863
10645
|
className: "flex items-center gap-2 w-full text-left text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2",
|
|
9864
10646
|
children: [
|
|
9865
|
-
advancedOpen ? /* @__PURE__ */
|
|
10647
|
+
advancedOpen ? /* @__PURE__ */ jsx61(ChevronUp2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx61(ChevronDown6, { className: "h-4 w-4" }),
|
|
9866
10648
|
"Advanced page content"
|
|
9867
10649
|
]
|
|
9868
10650
|
}
|
|
9869
10651
|
),
|
|
9870
10652
|
advancedOpen && /* @__PURE__ */ jsxs51("div", { className: "space-y-4", children: [
|
|
9871
10653
|
/* @__PURE__ */ jsxs51("div", { className: sectionCls2, children: [
|
|
9872
|
-
/* @__PURE__ */
|
|
10654
|
+
/* @__PURE__ */ jsx61("h3", { className: "text-xs font-medium text-gray-700 mb-2", children: "Hero carousel" }),
|
|
9873
10655
|
heroSlides.map((slide, i) => /* @__PURE__ */ jsxs51("div", { className: "flex flex-wrap gap-2 mb-3 p-2 bg-white rounded border", children: [
|
|
9874
|
-
/* @__PURE__ */
|
|
10656
|
+
/* @__PURE__ */ jsx61("input", { type: "url", value: slide.url, onChange: (e) => updateHeroSlide(i, "url", e.target.value), placeholder: "Media URL", className: `${inputCls2} flex-1 min-w-[200px]` }),
|
|
9875
10657
|
/* @__PURE__ */ jsxs51("select", { value: slide.type, onChange: (e) => updateHeroSlide(i, "type", e.target.value), className: `${inputCls2} w-24`, children: [
|
|
9876
|
-
/* @__PURE__ */
|
|
9877
|
-
/* @__PURE__ */
|
|
10658
|
+
/* @__PURE__ */ jsx61("option", { value: "image", children: "Image" }),
|
|
10659
|
+
/* @__PURE__ */ jsx61("option", { value: "video", children: "Video" })
|
|
9878
10660
|
] }),
|
|
9879
|
-
/* @__PURE__ */
|
|
9880
|
-
/* @__PURE__ */
|
|
10661
|
+
/* @__PURE__ */ jsx61("input", { type: "text", value: slide.caption, onChange: (e) => updateHeroSlide(i, "caption", e.target.value), placeholder: "Caption", className: `${inputCls2} flex-1 min-w-[120px]` }),
|
|
10662
|
+
/* @__PURE__ */ jsx61("button", { type: "button", onClick: () => removeHeroSlide(i), className: "p-2 text-gray-400 hover:text-red-600 rounded shrink-0", children: /* @__PURE__ */ jsx61(Trash26, { className: "h-4 w-4" }) })
|
|
9881
10663
|
] }, i)),
|
|
9882
10664
|
/* @__PURE__ */ jsxs51("button", { type: "button", onClick: addHeroSlide, className: "inline-flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50", children: [
|
|
9883
|
-
/* @__PURE__ */
|
|
10665
|
+
/* @__PURE__ */ jsx61(Plus10, { className: "h-3.5 w-3.5" }),
|
|
9884
10666
|
" Add slide"
|
|
9885
10667
|
] })
|
|
9886
10668
|
] }),
|
|
9887
10669
|
/* @__PURE__ */ jsxs51("div", { className: sectionCls2, children: [
|
|
9888
|
-
/* @__PURE__ */
|
|
10670
|
+
/* @__PURE__ */ jsx61("h3", { className: "text-xs font-medium text-gray-700 mb-2", children: "Variants" }),
|
|
9889
10671
|
variants.map((v, i) => /* @__PURE__ */ jsxs51("div", { className: "mb-4 p-3 bg-white rounded border space-y-2", children: [
|
|
9890
10672
|
/* @__PURE__ */ jsxs51("div", { className: "flex gap-2", children: [
|
|
9891
|
-
/* @__PURE__ */
|
|
9892
|
-
/* @__PURE__ */
|
|
9893
|
-
/* @__PURE__ */
|
|
10673
|
+
/* @__PURE__ */ jsx61("input", { type: "text", value: v.name, onChange: (e) => updateVariant(i, "name", e.target.value), placeholder: "Name", className: `${inputCls2} w-40` }),
|
|
10674
|
+
/* @__PURE__ */ jsx61("input", { type: "number", value: v.price, onChange: (e) => updateVariant(i, "price", e.target.value), placeholder: "Price", className: `${inputCls2} w-28` }),
|
|
10675
|
+
/* @__PURE__ */ jsx61("button", { type: "button", onClick: () => removeVariant(i), className: "p-2 text-gray-400 hover:text-red-600 rounded shrink-0", children: /* @__PURE__ */ jsx61(Trash26, { className: "h-4 w-4" }) })
|
|
9894
10676
|
] }),
|
|
9895
10677
|
v.extraSpecs.map((s, si) => /* @__PURE__ */ jsxs51("div", { className: "flex gap-2", children: [
|
|
9896
|
-
/* @__PURE__ */
|
|
9897
|
-
/* @__PURE__ */
|
|
9898
|
-
/* @__PURE__ */
|
|
10678
|
+
/* @__PURE__ */ jsx61("input", { type: "text", value: s.key, onChange: (e) => updateVariantExtraSpec(i, si, "key", e.target.value), placeholder: "Key", className: `${inputCls2} flex-1` }),
|
|
10679
|
+
/* @__PURE__ */ jsx61("input", { type: "text", value: s.value, onChange: (e) => updateVariantExtraSpec(i, si, "value", e.target.value), placeholder: "Value", className: `${inputCls2} flex-1` }),
|
|
10680
|
+
/* @__PURE__ */ jsx61("button", { type: "button", onClick: () => removeVariantExtraSpec(i, si), className: "p-2 text-gray-400 hover:text-red-600 rounded shrink-0", children: /* @__PURE__ */ jsx61(Trash26, { className: "h-4 w-4" }) })
|
|
9899
10681
|
] }, si)),
|
|
9900
10682
|
/* @__PURE__ */ jsxs51("button", { type: "button", onClick: () => addVariantExtraSpec(i), className: "inline-flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-50", children: [
|
|
9901
|
-
/* @__PURE__ */
|
|
10683
|
+
/* @__PURE__ */ jsx61(Plus10, { className: "h-3 w-3" }),
|
|
9902
10684
|
" Add spec"
|
|
9903
10685
|
] })
|
|
9904
10686
|
] }, i)),
|
|
9905
10687
|
/* @__PURE__ */ jsxs51("button", { type: "button", onClick: addVariant, className: "inline-flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50", children: [
|
|
9906
|
-
/* @__PURE__ */
|
|
10688
|
+
/* @__PURE__ */ jsx61(Plus10, { className: "h-3.5 w-3.5" }),
|
|
9907
10689
|
" Add variant"
|
|
9908
10690
|
] })
|
|
9909
10691
|
] }),
|
|
9910
10692
|
/* @__PURE__ */ jsxs51("div", { className: sectionCls2, children: [
|
|
9911
|
-
/* @__PURE__ */
|
|
9912
|
-
/* @__PURE__ */
|
|
10693
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "Experience description" }),
|
|
10694
|
+
/* @__PURE__ */ jsx61("textarea", { value: experienceDescription, onChange: (e) => setExperienceDescription(e.target.value), className: `${inputCls2} min-h-[60px]`, rows: 2, placeholder: "Optional" })
|
|
9913
10695
|
] }),
|
|
9914
10696
|
/* @__PURE__ */ jsxs51("div", { className: sectionCls2, children: [
|
|
9915
|
-
/* @__PURE__ */
|
|
9916
|
-
/* @__PURE__ */
|
|
10697
|
+
/* @__PURE__ */ jsx61("label", { className: labelCls2, children: "Brochure URL" }),
|
|
10698
|
+
/* @__PURE__ */ jsx61("input", { type: "url", value: brochureUrl, onChange: (e) => setBrochureUrl(e.target.value), className: inputCls2, placeholder: "https://..." })
|
|
9917
10699
|
] })
|
|
9918
10700
|
] })
|
|
9919
10701
|
] })
|
|
9920
10702
|
] }),
|
|
9921
10703
|
sidebar: /* @__PURE__ */ jsxs51(Fragment15, { children: [
|
|
9922
10704
|
/* @__PURE__ */ jsxs51("section", { children: [
|
|
9923
|
-
/* @__PURE__ */
|
|
9924
|
-
/* @__PURE__ */
|
|
9925
|
-
/* @__PURE__ */
|
|
9926
|
-
/* @__PURE__ */
|
|
10705
|
+
/* @__PURE__ */ jsx61("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "Status" }),
|
|
10706
|
+
/* @__PURE__ */ jsx61("div", { className: sectionCls2, children: /* @__PURE__ */ jsxs51("label", { className: "flex items-center gap-2 cursor-pointer", children: [
|
|
10707
|
+
/* @__PURE__ */ jsx61("input", { type: "checkbox", checked: active, onChange: (e) => setActive(e.target.checked), className: "h-4 w-4 rounded border-gray-300" }),
|
|
10708
|
+
/* @__PURE__ */ jsx61("span", { className: "text-sm font-medium text-gray-900", children: "Active" })
|
|
9927
10709
|
] }) })
|
|
9928
10710
|
] }),
|
|
9929
10711
|
/* @__PURE__ */ jsxs51("section", { children: [
|
|
9930
|
-
/* @__PURE__ */
|
|
9931
|
-
/* @__PURE__ */
|
|
10712
|
+
/* @__PURE__ */ jsx61("h2", { className: "text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2", children: "SEO" }),
|
|
10713
|
+
/* @__PURE__ */ jsx61("div", { className: sectionCls2, children: /* @__PURE__ */ jsx61(SeoSection, { values: seo, onChange: (field, value) => setSeo((s) => ({ ...s, [field]: value })) }) })
|
|
9932
10714
|
] })
|
|
9933
10715
|
] })
|
|
9934
10716
|
}
|
|
@@ -9948,7 +10730,7 @@ function isSuperAdminGroupName(name) {
|
|
|
9948
10730
|
}
|
|
9949
10731
|
|
|
9950
10732
|
// src/admin/pages/RolesPage.tsx
|
|
9951
|
-
import { jsx as
|
|
10733
|
+
import { jsx as jsx62, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
9952
10734
|
function RoleListItem({
|
|
9953
10735
|
group,
|
|
9954
10736
|
selected,
|
|
@@ -9962,8 +10744,8 @@ function RoleListItem({
|
|
|
9962
10744
|
onClick: onSelect,
|
|
9963
10745
|
className: `flex w-full items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors ${selected ? "border-gray-300 bg-gray-50 dark:border-gray-600 dark:bg-gray-700/50" : "border-transparent hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,
|
|
9964
10746
|
children: [
|
|
9965
|
-
/* @__PURE__ */
|
|
9966
|
-
/* @__PURE__ */
|
|
10747
|
+
/* @__PURE__ */ jsx62(Shield2, { className: "h-5 w-5 shrink-0 text-gray-500" }),
|
|
10748
|
+
/* @__PURE__ */ jsx62("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx62("div", { className: "font-medium text-gray-900 dark:text-white truncate", children: group.name }) })
|
|
9967
10749
|
]
|
|
9968
10750
|
}
|
|
9969
10751
|
);
|
|
@@ -10097,27 +10879,27 @@ function RolesPage() {
|
|
|
10097
10879
|
}
|
|
10098
10880
|
};
|
|
10099
10881
|
if (status === "loading" || loading) {
|
|
10100
|
-
return /* @__PURE__ */
|
|
10882
|
+
return /* @__PURE__ */ jsx62("div", { className: "flex items-center justify-center py-12 text-gray-600", children: "Loading\u2026" });
|
|
10101
10883
|
}
|
|
10102
10884
|
if (!canManage) {
|
|
10103
|
-
return /* @__PURE__ */
|
|
10885
|
+
return /* @__PURE__ */ jsx62("p", { className: "text-gray-600 p-6", children: "You do not have permission to manage roles." });
|
|
10104
10886
|
}
|
|
10105
10887
|
return /* @__PURE__ */ jsxs52("div", { className: "min-w-0 rounded-lg bg-white shadow-md dark:bg-gray-800", children: [
|
|
10106
10888
|
/* @__PURE__ */ jsxs52("div", { className: "rounded-t-lg border-b border-gray-700 bg-gray-800 px-4 py-2.5 dark:border-gray-700 dark:bg-gray-900", children: [
|
|
10107
|
-
/* @__PURE__ */
|
|
10108
|
-
/* @__PURE__ */
|
|
10889
|
+
/* @__PURE__ */ jsx62("h1", { className: "text-base font-semibold text-white", children: "Roles" }),
|
|
10890
|
+
/* @__PURE__ */ jsx62("p", { className: "mt-0.5 text-xs text-gray-300", children: "Only the Administrator group can open this page. All roles use the matrix for entity access (Administrator also has users / roles plumbing without matrix rows)." })
|
|
10109
10891
|
] }),
|
|
10110
10892
|
/* @__PURE__ */ jsxs52("div", { className: "min-w-0 p-6", children: [
|
|
10111
|
-
error ? /* @__PURE__ */
|
|
10112
|
-
/* @__PURE__ */
|
|
10113
|
-
/* @__PURE__ */
|
|
10893
|
+
error ? /* @__PURE__ */ jsx62("div", { className: "py-8 text-center", children: /* @__PURE__ */ jsx62("p", { className: "text-sm text-red-600 dark:text-red-400", children: error }) }) : groups.length === 0 ? /* @__PURE__ */ jsxs52("div", { className: "py-12 text-center", children: [
|
|
10894
|
+
/* @__PURE__ */ jsx62(Shield2, { className: "mx-auto h-10 w-10 text-gray-400" }),
|
|
10895
|
+
/* @__PURE__ */ jsx62("p", { className: "mt-3 text-sm text-gray-500 dark:text-gray-400", children: "No roles yet. Add one below." })
|
|
10114
10896
|
] }) : /* @__PURE__ */ jsxs52("div", { className: "flex gap-6", children: [
|
|
10115
10897
|
/* @__PURE__ */ jsxs52("div", { className: "w-56 shrink-0 space-y-1", children: [
|
|
10116
|
-
groups.map((g) => /* @__PURE__ */
|
|
10898
|
+
groups.map((g) => /* @__PURE__ */ jsx62(RoleListItem, { group: g, selected: selectedId === g.id, onSelect: () => setSelectedId(g.id) }, g.id)),
|
|
10117
10899
|
/* @__PURE__ */ jsxs52("div", { className: "space-y-2 border-t border-gray-200 pt-3 dark:border-gray-700", children: [
|
|
10118
|
-
/* @__PURE__ */
|
|
10900
|
+
/* @__PURE__ */ jsx62(Label3, { className: "text-xs text-gray-500", children: "New role" }),
|
|
10119
10901
|
/* @__PURE__ */ jsxs52("div", { className: "flex gap-2", children: [
|
|
10120
|
-
/* @__PURE__ */
|
|
10902
|
+
/* @__PURE__ */ jsx62(
|
|
10121
10903
|
Input,
|
|
10122
10904
|
{
|
|
10123
10905
|
className: "h-8 text-sm",
|
|
@@ -10127,13 +10909,13 @@ function RolesPage() {
|
|
|
10127
10909
|
onKeyDown: (e) => e.key === "Enter" && createGroup()
|
|
10128
10910
|
}
|
|
10129
10911
|
),
|
|
10130
|
-
/* @__PURE__ */
|
|
10912
|
+
/* @__PURE__ */ jsx62(Button, { type: "button", size: "sm", variant: "outline", className: "shrink-0", onClick: createGroup, children: "Add" })
|
|
10131
10913
|
] })
|
|
10132
10914
|
] })
|
|
10133
10915
|
] }),
|
|
10134
|
-
/* @__PURE__ */
|
|
10135
|
-
/* @__PURE__ */
|
|
10136
|
-
/* @__PURE__ */
|
|
10916
|
+
/* @__PURE__ */ jsx62("div", { className: "min-w-0 flex-1", children: !selectedId ? /* @__PURE__ */ jsxs52("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
|
|
10917
|
+
/* @__PURE__ */ jsx62(Shield2, { className: "h-10 w-10 text-gray-300 dark:text-gray-600" }),
|
|
10918
|
+
/* @__PURE__ */ jsx62("p", { className: "mt-3 text-sm text-gray-500 dark:text-gray-400", children: "Select a role to view or edit permissions." })
|
|
10137
10919
|
] }) : /* @__PURE__ */ jsxs52("div", { className: "rounded-lg border border-gray-200 bg-gray-50/50 p-5 dark:border-gray-700 dark:bg-gray-800/50", children: [
|
|
10138
10920
|
/* @__PURE__ */ jsxs52("div", { className: "mb-4 flex flex-wrap items-center gap-2", children: [
|
|
10139
10921
|
/* @__PURE__ */ jsxs52("h2", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
@@ -10141,28 +10923,28 @@ function RolesPage() {
|
|
|
10141
10923
|
" \u2014 Permissions"
|
|
10142
10924
|
] }),
|
|
10143
10925
|
/* @__PURE__ */ jsxs52(Button, { size: "sm", onClick: saveMatrix, disabled: saving, className: "gap-1", children: [
|
|
10144
|
-
/* @__PURE__ */
|
|
10926
|
+
/* @__PURE__ */ jsx62(Save6, { className: "h-3.5 w-3.5" }),
|
|
10145
10927
|
saving ? "Saving\u2026" : "Save"
|
|
10146
10928
|
] }),
|
|
10147
10929
|
selected && !isSuperAdminGroupName(selected.name) && /* @__PURE__ */ jsxs52(Button, { size: "sm", variant: "outline", className: "gap-1 text-red-600", onClick: deleteGroup, children: [
|
|
10148
|
-
/* @__PURE__ */
|
|
10930
|
+
/* @__PURE__ */ jsx62(Trash27, { className: "h-3.5 w-3.5" }),
|
|
10149
10931
|
"Delete role"
|
|
10150
10932
|
] })
|
|
10151
10933
|
] }),
|
|
10152
|
-
entities.length > 0 && /* @__PURE__ */
|
|
10153
|
-
/* @__PURE__ */
|
|
10154
|
-
/* @__PURE__ */
|
|
10155
|
-
/* @__PURE__ */
|
|
10156
|
-
/* @__PURE__ */
|
|
10157
|
-
/* @__PURE__ */
|
|
10158
|
-
/* @__PURE__ */
|
|
10934
|
+
entities.length > 0 && /* @__PURE__ */ jsx62("div", { className: "overflow-x-auto rounded-md border border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ jsxs52("table", { className: "w-full text-sm", children: [
|
|
10935
|
+
/* @__PURE__ */ jsx62("thead", { children: /* @__PURE__ */ jsxs52("tr", { className: "border-b bg-gray-50 dark:bg-gray-900/50", children: [
|
|
10936
|
+
/* @__PURE__ */ jsx62("th", { className: "p-3 text-left font-medium", children: "Resource" }),
|
|
10937
|
+
/* @__PURE__ */ jsx62("th", { className: "p-2", children: "C" }),
|
|
10938
|
+
/* @__PURE__ */ jsx62("th", { className: "p-2", children: "R" }),
|
|
10939
|
+
/* @__PURE__ */ jsx62("th", { className: "p-2", children: "U" }),
|
|
10940
|
+
/* @__PURE__ */ jsx62("th", { className: "p-2", children: "D" })
|
|
10159
10941
|
] }) }),
|
|
10160
|
-
/* @__PURE__ */
|
|
10942
|
+
/* @__PURE__ */ jsx62("tbody", { children: entities.map((entity) => {
|
|
10161
10943
|
const row = matrix[entity];
|
|
10162
10944
|
if (!row) return null;
|
|
10163
10945
|
return /* @__PURE__ */ jsxs52("tr", { className: "border-b border-gray-100 hover:bg-gray-50/50 dark:border-gray-700 dark:hover:bg-gray-800/30", children: [
|
|
10164
|
-
/* @__PURE__ */
|
|
10165
|
-
["canCreate", "canRead", "canUpdate", "canDelete"].map((k) => /* @__PURE__ */
|
|
10946
|
+
/* @__PURE__ */ jsx62("td", { className: "p-3 font-mono text-xs", children: entity }),
|
|
10947
|
+
["canCreate", "canRead", "canUpdate", "canDelete"].map((k) => /* @__PURE__ */ jsx62("td", { className: "p-2 text-center", children: /* @__PURE__ */ jsx62(
|
|
10166
10948
|
"input",
|
|
10167
10949
|
{
|
|
10168
10950
|
type: "checkbox",
|
|
@@ -10176,8 +10958,8 @@ function RolesPage() {
|
|
|
10176
10958
|
] }) })
|
|
10177
10959
|
] }),
|
|
10178
10960
|
!error && groups.length === 0 && /* @__PURE__ */ jsxs52("div", { className: "mt-6 flex max-w-md gap-2", children: [
|
|
10179
|
-
/* @__PURE__ */
|
|
10180
|
-
/* @__PURE__ */
|
|
10961
|
+
/* @__PURE__ */ jsx62(Input, { placeholder: "New role name", value: newName, onChange: (e) => setNewName(e.target.value), onKeyDown: (e) => e.key === "Enter" && createGroup() }),
|
|
10962
|
+
/* @__PURE__ */ jsx62(Button, { type: "button", onClick: createGroup, children: "Add role" })
|
|
10181
10963
|
] })
|
|
10182
10964
|
] })
|
|
10183
10965
|
] });
|
|
@@ -10339,7 +11121,7 @@ var STORE_CRUD_CONFIGS = {
|
|
|
10339
11121
|
};
|
|
10340
11122
|
|
|
10341
11123
|
// src/admin/pages/AdminPageResolver.tsx
|
|
10342
|
-
import { jsx as
|
|
11124
|
+
import { jsx as jsx63, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
10343
11125
|
var PAGE_MAP = {
|
|
10344
11126
|
dashboard: DashboardPage,
|
|
10345
11127
|
signin: SignInPage_default,
|
|
@@ -10465,11 +11247,11 @@ function BlogEditorWrapper({ blogId }) {
|
|
|
10465
11247
|
}, [blogId]);
|
|
10466
11248
|
if (loading) {
|
|
10467
11249
|
return /* @__PURE__ */ jsxs53("div", { className: "flex items-center justify-center py-8", children: [
|
|
10468
|
-
/* @__PURE__ */
|
|
10469
|
-
/* @__PURE__ */
|
|
11250
|
+
/* @__PURE__ */ jsx63("div", { className: "animate-spin rounded-full h-6 w-6 border-2 border-gray-300 border-t-gray-600" }),
|
|
11251
|
+
/* @__PURE__ */ jsx63("span", { className: "ml-2", children: "Loading..." })
|
|
10470
11252
|
] });
|
|
10471
11253
|
}
|
|
10472
|
-
return /* @__PURE__ */
|
|
11254
|
+
return /* @__PURE__ */ jsx63(BlogEditor, { existingBlog: blog });
|
|
10473
11255
|
}
|
|
10474
11256
|
function AdminPageResolver({ slug }) {
|
|
10475
11257
|
const router = useRouter13();
|
|
@@ -10482,52 +11264,52 @@ function AdminPageResolver({ slug }) {
|
|
|
10482
11264
|
}, [key, router]);
|
|
10483
11265
|
if (key === "layout-settings") {
|
|
10484
11266
|
return /* @__PURE__ */ jsxs53("div", { className: "flex justify-center py-8", children: [
|
|
10485
|
-
/* @__PURE__ */
|
|
10486
|
-
/* @__PURE__ */
|
|
11267
|
+
/* @__PURE__ */ jsx63("div", { className: "animate-spin rounded-full h-6 w-6 border-2 border-gray-300 border-t-gray-600" }),
|
|
11268
|
+
/* @__PURE__ */ jsx63("span", { className: "ml-2", children: "Redirecting..." })
|
|
10487
11269
|
] });
|
|
10488
11270
|
}
|
|
10489
11271
|
const Page = PAGE_MAP[key];
|
|
10490
11272
|
if (Page) {
|
|
10491
|
-
return /* @__PURE__ */
|
|
11273
|
+
return /* @__PURE__ */ jsx63(Page, {});
|
|
10492
11274
|
}
|
|
10493
11275
|
if (key === "form-submissions" && slug && slug.length === 3 && slug[2] === "view") {
|
|
10494
|
-
return /* @__PURE__ */
|
|
11276
|
+
return /* @__PURE__ */ jsx63(SubmissionDetailPage, { submissionId: slug[1] });
|
|
10495
11277
|
}
|
|
10496
11278
|
if (key === "orders" && slug && slug.length === 3 && slug[2] === "view") {
|
|
10497
|
-
return /* @__PURE__ */
|
|
11279
|
+
return /* @__PURE__ */ jsx63(OrderDetailPage, { orderId: slug[1] });
|
|
10498
11280
|
}
|
|
10499
11281
|
if (key === "payments" && slug && slug.length === 3 && slug[2] === "view") {
|
|
10500
|
-
return /* @__PURE__ */
|
|
11282
|
+
return /* @__PURE__ */ jsx63(PaymentDetailPage, { paymentId: slug[1] });
|
|
10501
11283
|
}
|
|
10502
11284
|
if (key === "contacts" && slug && slug.length === 3 && slug[2] === "view") {
|
|
10503
|
-
return /* @__PURE__ */
|
|
11285
|
+
return /* @__PURE__ */ jsx63(ContactDetailPage, { contactId: slug[1] });
|
|
10504
11286
|
}
|
|
10505
11287
|
const crud = { ...CRUD_CONFIGS, ...STORE_CRUD_CONFIGS, ...customCrudConfigs }[key];
|
|
10506
11288
|
if (crud && slug && slug.length >= 2) {
|
|
10507
11289
|
const subPath = slug[1];
|
|
10508
11290
|
const isCreate4 = subPath === "create";
|
|
10509
11291
|
if (key === "blogs") {
|
|
10510
|
-
return /* @__PURE__ */
|
|
11292
|
+
return /* @__PURE__ */ jsx63(BlogEditorWrapper, { blogId: isCreate4 ? void 0 : subPath });
|
|
10511
11293
|
}
|
|
10512
11294
|
if (key === "forms") {
|
|
10513
|
-
return /* @__PURE__ */
|
|
11295
|
+
return /* @__PURE__ */ jsx63(FormBuilder, { formId: isCreate4 ? void 0 : subPath });
|
|
10514
11296
|
}
|
|
10515
11297
|
if (key === "pages") {
|
|
10516
|
-
return /* @__PURE__ */
|
|
11298
|
+
return /* @__PURE__ */ jsx63(PageBuilderPage, { pageId: isCreate4 ? void 0 : subPath });
|
|
10517
11299
|
}
|
|
10518
11300
|
if (key === "brands") {
|
|
10519
|
-
return /* @__PURE__ */
|
|
11301
|
+
return /* @__PURE__ */ jsx63(BrandEditPage, { brandId: subPath });
|
|
10520
11302
|
}
|
|
10521
11303
|
if (key === "products") {
|
|
10522
|
-
return /* @__PURE__ */
|
|
11304
|
+
return /* @__PURE__ */ jsx63(ProductEditPage, { productId: subPath });
|
|
10523
11305
|
}
|
|
10524
11306
|
if (key === "collections") {
|
|
10525
|
-
return /* @__PURE__ */
|
|
11307
|
+
return /* @__PURE__ */ jsx63(CollectionEditPage, { collectionId: subPath });
|
|
10526
11308
|
}
|
|
10527
11309
|
}
|
|
10528
11310
|
if (crud) {
|
|
10529
11311
|
if (key === "media") {
|
|
10530
|
-
return /* @__PURE__ */
|
|
11312
|
+
return /* @__PURE__ */ jsx63(MediaLibraryPage, {});
|
|
10531
11313
|
}
|
|
10532
11314
|
const isContactsWithStore = key === "contacts" && storeEnabled;
|
|
10533
11315
|
const columns = isContactsWithStore ? [
|
|
@@ -10539,7 +11321,7 @@ function AdminPageResolver({ slug }) {
|
|
|
10539
11321
|
() => isContactsWithStore ? { includeSummary: "1" } : void 0,
|
|
10540
11322
|
[isContactsWithStore]
|
|
10541
11323
|
);
|
|
10542
|
-
return /* @__PURE__ */
|
|
11324
|
+
return /* @__PURE__ */ jsx63(
|
|
10543
11325
|
AdminCRUD,
|
|
10544
11326
|
{
|
|
10545
11327
|
title: crud.title,
|
|
@@ -10554,13 +11336,13 @@ function AdminPageResolver({ slug }) {
|
|
|
10554
11336
|
}
|
|
10555
11337
|
);
|
|
10556
11338
|
}
|
|
10557
|
-
return /* @__PURE__ */
|
|
11339
|
+
return /* @__PURE__ */ jsx63("div", { className: "flex items-center justify-center min-h-[50vh]", children: /* @__PURE__ */ jsx63("p", { className: "text-gray-500", children: "Page not found" }) });
|
|
10558
11340
|
}
|
|
10559
11341
|
|
|
10560
11342
|
// src/admin/pages/LayoutSettingsPage.tsx
|
|
10561
11343
|
import { useState as useState36, useEffect as useEffect34, useContext as useContext7 } from "react";
|
|
10562
11344
|
import { Save as Save7 } from "lucide-react";
|
|
10563
|
-
import { jsx as
|
|
11345
|
+
import { jsx as jsx64, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
10564
11346
|
function LayoutSettingsPage() {
|
|
10565
11347
|
const { theme } = useContext7(AdminConfigContext);
|
|
10566
11348
|
const [activeTab, setActiveTab] = useState36("navbar");
|
|
@@ -10616,13 +11398,13 @@ function LayoutSettingsPage() {
|
|
|
10616
11398
|
props: footerLayout.fields
|
|
10617
11399
|
} : null;
|
|
10618
11400
|
if (loading) {
|
|
10619
|
-
return /* @__PURE__ */
|
|
11401
|
+
return /* @__PURE__ */ jsx64("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsx64("div", { className: "animate-spin rounded-full h-6 w-6 border-2 border-gray-300 border-t-gray-600" }) });
|
|
10620
11402
|
}
|
|
10621
11403
|
return /* @__PURE__ */ jsxs54("div", { className: "min-w-0 rounded-lg bg-white shadow-md", children: [
|
|
10622
11404
|
/* @__PURE__ */ jsxs54("div", { className: "bg-gray-800 px-4 py-2.5 rounded-t-lg flex items-center justify-between", children: [
|
|
10623
11405
|
/* @__PURE__ */ jsxs54("div", { children: [
|
|
10624
|
-
/* @__PURE__ */
|
|
10625
|
-
/* @__PURE__ */
|
|
11406
|
+
/* @__PURE__ */ jsx64("h1", { className: "text-xl font-bold text-white", children: "Layout Settings" }),
|
|
11407
|
+
/* @__PURE__ */ jsx64("p", { className: "text-xs text-gray-300 mt-0.5", children: "Configure your site navbar and footer" })
|
|
10626
11408
|
] }),
|
|
10627
11409
|
/* @__PURE__ */ jsxs54(
|
|
10628
11410
|
Button,
|
|
@@ -10631,14 +11413,14 @@ function LayoutSettingsPage() {
|
|
|
10631
11413
|
disabled: saving,
|
|
10632
11414
|
className: "bg-white text-gray-800 hover:bg-gray-100 border-0 text-xs",
|
|
10633
11415
|
children: [
|
|
10634
|
-
/* @__PURE__ */
|
|
11416
|
+
/* @__PURE__ */ jsx64(Save7, { className: "h-4 w-4 mr-2" }),
|
|
10635
11417
|
saving ? "Saving..." : "Save"
|
|
10636
11418
|
]
|
|
10637
11419
|
}
|
|
10638
11420
|
)
|
|
10639
11421
|
] }),
|
|
10640
|
-
/* @__PURE__ */
|
|
10641
|
-
/* @__PURE__ */
|
|
11422
|
+
/* @__PURE__ */ jsx64("div", { className: "border-b", children: /* @__PURE__ */ jsxs54("div", { className: "flex", children: [
|
|
11423
|
+
/* @__PURE__ */ jsx64(
|
|
10642
11424
|
"button",
|
|
10643
11425
|
{
|
|
10644
11426
|
className: `px-4 py-2.5 text-sm font-medium border-b-2 ${activeTab === "navbar" ? "border-gray-800 text-gray-800" : "border-transparent text-gray-500 hover:text-gray-700"}`,
|
|
@@ -10646,7 +11428,7 @@ function LayoutSettingsPage() {
|
|
|
10646
11428
|
children: "Navbar"
|
|
10647
11429
|
}
|
|
10648
11430
|
),
|
|
10649
|
-
/* @__PURE__ */
|
|
11431
|
+
/* @__PURE__ */ jsx64(
|
|
10650
11432
|
"button",
|
|
10651
11433
|
{
|
|
10652
11434
|
className: `px-4 py-2.5 text-sm font-medium border-b-2 ${activeTab === "footer" ? "border-gray-800 text-gray-800" : "border-transparent text-gray-500 hover:text-gray-700"}`,
|
|
@@ -10656,8 +11438,8 @@ function LayoutSettingsPage() {
|
|
|
10656
11438
|
)
|
|
10657
11439
|
] }) }),
|
|
10658
11440
|
/* @__PURE__ */ jsxs54("div", { className: "min-w-0 p-6", children: [
|
|
10659
|
-
activeTab === "navbar" && /* @__PURE__ */
|
|
10660
|
-
activeTab === "footer" && footerMeta && /* @__PURE__ */
|
|
11441
|
+
activeTab === "navbar" && /* @__PURE__ */ jsx64(NavbarEditor, { config: navbarConfig, onChange: setNavbarConfig }),
|
|
11442
|
+
activeTab === "footer" && footerMeta && /* @__PURE__ */ jsx64(
|
|
10661
11443
|
ComponentSettings,
|
|
10662
11444
|
{
|
|
10663
11445
|
meta: footerMeta,
|
|
@@ -10665,7 +11447,7 @@ function LayoutSettingsPage() {
|
|
|
10665
11447
|
onChange: (name, val) => setFooterValues((prev) => ({ ...prev, [name]: val }))
|
|
10666
11448
|
}
|
|
10667
11449
|
),
|
|
10668
|
-
activeTab === "footer" && !footerMeta && /* @__PURE__ */
|
|
11450
|
+
activeTab === "footer" && !footerMeta && /* @__PURE__ */ jsx64("p", { className: "text-sm text-gray-500", children: "No footer configuration defined in the current theme." })
|
|
10669
11451
|
] })
|
|
10670
11452
|
] });
|
|
10671
11453
|
}
|
|
@@ -10686,11 +11468,11 @@ var DEFAULT_ADMIN_NAV = [
|
|
|
10686
11468
|
import { SessionProvider } from "next-auth/react";
|
|
10687
11469
|
import { ThemeProvider } from "next-themes";
|
|
10688
11470
|
import { Toaster as Toaster3 } from "sonner";
|
|
10689
|
-
import { jsx as
|
|
11471
|
+
import { jsx as jsx65, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
10690
11472
|
function CmsProviders({ children }) {
|
|
10691
|
-
return /* @__PURE__ */
|
|
11473
|
+
return /* @__PURE__ */ jsx65(SessionProvider, { children: /* @__PURE__ */ jsxs55(ThemeProvider, { attribute: "class", defaultTheme: "system", enableSystem: true, children: [
|
|
10692
11474
|
children,
|
|
10693
|
-
/* @__PURE__ */
|
|
11475
|
+
/* @__PURE__ */ jsx65(Toaster3, { position: "top-right" })
|
|
10694
11476
|
] }) });
|
|
10695
11477
|
}
|
|
10696
11478
|
export {
|