@mercurjs/admin 2.0.0-canary.24

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.
Files changed (358) hide show
  1. package/dist/add-campaign-promotions-JDC36EOE.js +265 -0
  2. package/dist/adjust-inventory-2YLC4O4I.js +262 -0
  3. package/dist/api-key-management-create-KERROZ6Z.js +282 -0
  4. package/dist/api-key-management-detail-PXY2ZH4V.js +481 -0
  5. package/dist/api-key-management-edit-7IPPTW37.js +106 -0
  6. package/dist/api-key-management-list-QQHOCVV4.js +350 -0
  7. package/dist/api-key-management-sales-channels-AO6SRCAW.js +201 -0
  8. package/dist/campaign-budget-edit-C5PCVES3.js +147 -0
  9. package/dist/campaign-configuration-ONC2CL7Q.js +154 -0
  10. package/dist/campaign-create-J2PN77A6.js +29 -0
  11. package/dist/campaign-detail-2XJ7PXOQ.js +666 -0
  12. package/dist/campaign-edit-MU4TVOEC.js +206 -0
  13. package/dist/campaign-list-BWYHTJL2.js +187 -0
  14. package/dist/categories-metadata-UC3N6YSC.js +83 -0
  15. package/dist/category-create-DRJZI3EM.js +427 -0
  16. package/dist/category-detail-DEGYVUXB.js +544 -0
  17. package/dist/category-edit-PTYOK7VV.js +220 -0
  18. package/dist/category-list-T4GPTLOA.js +286 -0
  19. package/dist/category-organize-MLBY54BT.js +110 -0
  20. package/dist/category-products-W7U2VZTZ.js +281 -0
  21. package/dist/chunk-25LYVP3C.js +37 -0
  22. package/dist/chunk-26OOAKQ6.js +18 -0
  23. package/dist/chunk-2I3BDP2Z.js +61 -0
  24. package/dist/chunk-2KCF3ZIB.js +32 -0
  25. package/dist/chunk-2MKZ4HD4.js +175 -0
  26. package/dist/chunk-2PZGY332.js +88 -0
  27. package/dist/chunk-2QKPRGNK.js +107 -0
  28. package/dist/chunk-2Y3WMGN6.js +39 -0
  29. package/dist/chunk-2ZFELO2L.js +13 -0
  30. package/dist/chunk-33XUAKRP.js +6 -0
  31. package/dist/chunk-362QMJZM.js +77 -0
  32. package/dist/chunk-3CKTAFTR.js +143 -0
  33. package/dist/chunk-3EF54XFY.js +64 -0
  34. package/dist/chunk-3KOTDGC2.js +18 -0
  35. package/dist/chunk-3LDJURK5.js +296 -0
  36. package/dist/chunk-3QSRE5LS.js +161 -0
  37. package/dist/chunk-3XPXUIK3.js +34 -0
  38. package/dist/chunk-4F5GP7J7.js +45 -0
  39. package/dist/chunk-4GPAS5GW.js +36 -0
  40. package/dist/chunk-54EPH67T.js +34 -0
  41. package/dist/chunk-54RTJBYO.js +153 -0
  42. package/dist/chunk-54TMLQH3.js +9 -0
  43. package/dist/chunk-5LZ2G4ZX.js +422 -0
  44. package/dist/chunk-5S6J5PG5.js +182 -0
  45. package/dist/chunk-6IJMSVC6.js +16 -0
  46. package/dist/chunk-6KI3GDYH.js +46 -0
  47. package/dist/chunk-7AV5EJJ5.js +29 -0
  48. package/dist/chunk-7RPRNVBS.js +45 -0
  49. package/dist/chunk-7SVLKK6Q.js +31 -0
  50. package/dist/chunk-AW77UWCZ.js +363 -0
  51. package/dist/chunk-AWZFIP25.js +117 -0
  52. package/dist/chunk-AYVH6Q5O.js +31 -0
  53. package/dist/chunk-BDGZ4EQO.js +86 -0
  54. package/dist/chunk-BMNW3AEU.js +373 -0
  55. package/dist/chunk-BRUOBAPY.js +234 -0
  56. package/dist/chunk-BYZIWSBB.js +185 -0
  57. package/dist/chunk-C6SUTRP2.js +13 -0
  58. package/dist/chunk-CBRSGM3X.js +342 -0
  59. package/dist/chunk-CI5Z6FGV.js +87 -0
  60. package/dist/chunk-CMHI2RPL.js +20 -0
  61. package/dist/chunk-CP5IL4P6.js +98 -0
  62. package/dist/chunk-D3KDXELJ.js +110 -0
  63. package/dist/chunk-D6IERBVW.js +43 -0
  64. package/dist/chunk-DB6ANJBO.js +35 -0
  65. package/dist/chunk-DLKKSPFE.js +50 -0
  66. package/dist/chunk-DV73MHTN.js +457 -0
  67. package/dist/chunk-DXZOR4AG.js +69 -0
  68. package/dist/chunk-DY3XQPHC.js +31 -0
  69. package/dist/chunk-EOZUAYQL.js +6 -0
  70. package/dist/chunk-ERTSYQAI.js +121 -0
  71. package/dist/chunk-EZIB4NST.js +94 -0
  72. package/dist/chunk-FGZCSG7T.js +232 -0
  73. package/dist/chunk-FI474ADU.js +0 -0
  74. package/dist/chunk-FLCYR7E5.js +467 -0
  75. package/dist/chunk-FMFVTERD.js +0 -0
  76. package/dist/chunk-FODCCP6C.js +76 -0
  77. package/dist/chunk-FQERBIVS.js +0 -0
  78. package/dist/chunk-FWPGOIFA.js +22 -0
  79. package/dist/chunk-G5OVX555.js +26 -0
  80. package/dist/chunk-GUIDZSDY.js +41 -0
  81. package/dist/chunk-H22XDSXD.js +47 -0
  82. package/dist/chunk-HC25LNX7.js +45 -0
  83. package/dist/chunk-HINXQTCW.js +97 -0
  84. package/dist/chunk-HYUGYB23.js +161 -0
  85. package/dist/chunk-I43SCBL3.js +106 -0
  86. package/dist/chunk-IGTRIAUC.js +84 -0
  87. package/dist/chunk-INNFZYX2.js +183 -0
  88. package/dist/chunk-IQPN4PZJ.js +749 -0
  89. package/dist/chunk-IZ5RG5XI.js +72 -0
  90. package/dist/chunk-JDGE23BZ.js +332 -0
  91. package/dist/chunk-JHIMVLB2.js +42 -0
  92. package/dist/chunk-JISYRXUS.js +389 -0
  93. package/dist/chunk-JJVGCTKT.js +243 -0
  94. package/dist/chunk-JQV7CXEC.js +37 -0
  95. package/dist/chunk-JRTZWK77.js +1764 -0
  96. package/dist/chunk-KAZ5BYTQ.js +132 -0
  97. package/dist/chunk-KBYZLKI4.js +1093 -0
  98. package/dist/chunk-KTKL7M34.js +90 -0
  99. package/dist/chunk-KUWNYCGL.js +4113 -0
  100. package/dist/chunk-KW56S7WF.js +67 -0
  101. package/dist/chunk-LAVHRER2.js +17 -0
  102. package/dist/chunk-LCZXAT4Q.js +58 -0
  103. package/dist/chunk-LFKTHNWI.js +83 -0
  104. package/dist/chunk-LGJWR5LX.js +164 -0
  105. package/dist/chunk-LLWK3OR6.js +169 -0
  106. package/dist/chunk-LQSLDDPT.js +67 -0
  107. package/dist/chunk-LR4ACD6E.js +86676 -0
  108. package/dist/chunk-LTBX54CI.js +11 -0
  109. package/dist/chunk-LXP7K6HL.js +817 -0
  110. package/dist/chunk-LXSBG6LK.js +18 -0
  111. package/dist/chunk-LZALOVO3.js +372 -0
  112. package/dist/chunk-M6SOYQJ6.js +39 -0
  113. package/dist/chunk-MAEP2UCK.js +110 -0
  114. package/dist/chunk-MG4GKUJW.js +31 -0
  115. package/dist/chunk-MWOKFNRO.js +446 -0
  116. package/dist/chunk-N2TQXB44.js +1280 -0
  117. package/dist/chunk-N5IUYCUZ.js +31 -0
  118. package/dist/chunk-NBMM2TZK.js +33 -0
  119. package/dist/chunk-NCMUZ6BQ.js +0 -0
  120. package/dist/chunk-NCYTM57J.js +160 -0
  121. package/dist/chunk-NIRWGTM3.js +1104 -0
  122. package/dist/chunk-NS5CHWOH.js +80 -0
  123. package/dist/chunk-NWQRHWE5.js +9461 -0
  124. package/dist/chunk-NXDFDEKP.js +0 -0
  125. package/dist/chunk-NZJGUN67.js +266 -0
  126. package/dist/chunk-NZN7PFPB.js +169 -0
  127. package/dist/chunk-O5HZRJPB.js +55 -0
  128. package/dist/chunk-O5VKW5FL.js +41 -0
  129. package/dist/chunk-O67KME6D.js +110 -0
  130. package/dist/chunk-ODBDAABQ.js +88 -0
  131. package/dist/chunk-OGYWOPHZ.js +96 -0
  132. package/dist/chunk-ORW4HNX5.js +357 -0
  133. package/dist/chunk-P3IZB24Y.js +109 -0
  134. package/dist/chunk-PHOCVOZ5.js +9 -0
  135. package/dist/chunk-PVZBDWLK.js +41 -0
  136. package/dist/chunk-PX675AEP.js +129 -0
  137. package/dist/chunk-PXYDR7WQ.js +48 -0
  138. package/dist/chunk-QDPLZDMX.js +17 -0
  139. package/dist/chunk-QG6PLWNH.js +106 -0
  140. package/dist/chunk-QSGR43JM.js +30 -0
  141. package/dist/chunk-RK5N3XIX.js +56 -0
  142. package/dist/chunk-RLMLYJDI.js +38 -0
  143. package/dist/chunk-RMXYSYK4.js +50 -0
  144. package/dist/chunk-RPIJY6TT.js +637 -0
  145. package/dist/chunk-RSBZREKG.js +144 -0
  146. package/dist/chunk-RXM4B6HR.js +8 -0
  147. package/dist/chunk-S2WEYEQR.js +14 -0
  148. package/dist/chunk-S4SVK5DE.js +39 -0
  149. package/dist/chunk-S6LPCNXQ.js +29 -0
  150. package/dist/chunk-SMQT3ZNO.js +8 -0
  151. package/dist/chunk-T435NFHC.js +490 -0
  152. package/dist/chunk-THHRRYRS.js +16 -0
  153. package/dist/chunk-TKGWSUEI.js +0 -0
  154. package/dist/chunk-TLE6YHGH.js +26 -0
  155. package/dist/chunk-TN4TIT7O.js +116 -0
  156. package/dist/chunk-TUJIAA5O.js +101 -0
  157. package/dist/chunk-U2EI2ZLM.js +32 -0
  158. package/dist/chunk-U2L77ZDR.js +17 -0
  159. package/dist/chunk-U2UCL2VG.js +369 -0
  160. package/dist/chunk-U2ZFCAPX.js +34 -0
  161. package/dist/chunk-U5MJIHLY.js +87 -0
  162. package/dist/chunk-U62GYN4A.js +227 -0
  163. package/dist/chunk-UM7ZR3VU.js +14 -0
  164. package/dist/chunk-UQITHKTH.js +342 -0
  165. package/dist/chunk-UZJ2NQSN.js +257 -0
  166. package/dist/chunk-UZWFZMOX.js +40 -0
  167. package/dist/chunk-V74Y5NIV.js +49 -0
  168. package/dist/chunk-VBMMWVB5.js +49 -0
  169. package/dist/chunk-VKOE5J66.js +31 -0
  170. package/dist/chunk-VOHEQ7B5.js +31 -0
  171. package/dist/chunk-VVTSF42Z.js +52 -0
  172. package/dist/chunk-VW56KWO2.js +9 -0
  173. package/dist/chunk-VWGKHDZ6.js +528 -0
  174. package/dist/chunk-W6Y3PPU5.js +73 -0
  175. package/dist/chunk-WCEMRNW4.js +6 -0
  176. package/dist/chunk-WDZFLCSQ.js +77 -0
  177. package/dist/chunk-WIYFXWRI.js +30 -0
  178. package/dist/chunk-WMA3WTCM.js +117 -0
  179. package/dist/chunk-WWANSDFM.js +175 -0
  180. package/dist/chunk-XBMLI2YI.js +85 -0
  181. package/dist/chunk-XBVIP2BA.js +609 -0
  182. package/dist/chunk-XCMR2HTV.js +102 -0
  183. package/dist/chunk-XFR5JLNF.js +44 -0
  184. package/dist/chunk-XL52SYWY.js +23 -0
  185. package/dist/chunk-XQNVC4Q7.js +212 -0
  186. package/dist/chunk-XSX255FK.js +12 -0
  187. package/dist/chunk-Y2M536WR.js +67 -0
  188. package/dist/chunk-Y456KVIN.js +116 -0
  189. package/dist/chunk-Y7QKP6QU.js +35 -0
  190. package/dist/chunk-YBZWO4ZV.js +57 -0
  191. package/dist/chunk-YGQUBTKR.js +81 -0
  192. package/dist/chunk-YGSM5PVN.js +170 -0
  193. package/dist/chunk-YVCBMOJG.js +50 -0
  194. package/dist/chunk-YWWUOGJA.js +62 -0
  195. package/dist/chunk-YXFG3M2D.js +792 -0
  196. package/dist/chunk-ZAUMHCIL.js +42 -0
  197. package/dist/chunk-ZDJWCSZ4.js +85 -0
  198. package/dist/chunk-ZQZHFMD7.js +19 -0
  199. package/dist/chunk-ZYNBKBY3.js +14 -0
  200. package/dist/collection-add-products-IUDEIUM5.js +284 -0
  201. package/dist/collection-create-AQ3GUG3G.js +133 -0
  202. package/dist/collection-detail-SDFALX6M.js +444 -0
  203. package/dist/collection-edit-AAHL2WFH.js +121 -0
  204. package/dist/collection-list-JGKC5EVM.js +228 -0
  205. package/dist/collection-metadata-YQWA2JTU.js +80 -0
  206. package/dist/customer-create-5VT2TB6S.js +183 -0
  207. package/dist/customer-create-address-ICEFEFD2.js +299 -0
  208. package/dist/customer-detail-CDELSJ77.js +695 -0
  209. package/dist/customer-edit-DZAD53JC.js +192 -0
  210. package/dist/customer-list-EIQP23FQ.js +152 -0
  211. package/dist/customer-metadata-ATAORBRN.js +81 -0
  212. package/dist/customers-add-customer-group-542PUCCT.js +308 -0
  213. package/dist/edit-inventory-item-P2HVULPA.js +152 -0
  214. package/dist/edit-inventory-item-attributes-V2HK3WTQ.js +323 -0
  215. package/dist/edit-reservation-LX2Z6KVD.js +246 -0
  216. package/dist/edit-rules-Q5UNWAUD.js +316 -0
  217. package/dist/home-I3OILW5Z.js +16 -0
  218. package/dist/index.css +6 -0
  219. package/dist/index.d.ts +41 -0
  220. package/dist/index.js +4824 -0
  221. package/dist/inventory-create-FT7GL4RK.js +616 -0
  222. package/dist/inventory-detail-LNZ5QC67.js +771 -0
  223. package/dist/inventory-list-UXY7PU3N.js +432 -0
  224. package/dist/inventory-metadata-OYETRH5X.js +83 -0
  225. package/dist/inventory-stock-3MBERL3K.js +288 -0
  226. package/dist/invite-HJ7BRO6H.js +372 -0
  227. package/dist/location-create-ZVVQT2KP.js +238 -0
  228. package/dist/location-detail-A5SHPUQN.js +823 -0
  229. package/dist/location-edit-QSRHHDQ2.js +253 -0
  230. package/dist/location-fulfillment-providers-4HMT5L7L.js +289 -0
  231. package/dist/location-list-TC5FEN5R.js +346 -0
  232. package/dist/location-sales-channels-STDHWQSC.js +215 -0
  233. package/dist/location-service-zone-create-63LUYCJI.js +173 -0
  234. package/dist/location-service-zone-edit-UNXI5BQV.js +134 -0
  235. package/dist/location-service-zone-manage-areas-UMD6CZDZ.js +154 -0
  236. package/dist/location-service-zone-shipping-option-create-5L73SAGE.js +807 -0
  237. package/dist/location-service-zone-shipping-option-edit-2FEWQD6Y.js +362 -0
  238. package/dist/location-service-zone-shipping-option-pricing-QSB56QZD.js +362 -0
  239. package/dist/login-V4HZQTCQ.js +254 -0
  240. package/dist/manage-locations-NVHONEZE.js +249 -0
  241. package/dist/no-match-JLVLPCRH.js +33 -0
  242. package/dist/order-allocate-items-F7CXZQGX.js +558 -0
  243. package/dist/order-create-claim-GDVWGZJA.js +2203 -0
  244. package/dist/order-create-edit-6YYKYT66.js +936 -0
  245. package/dist/order-create-exchange-NLDIMGBG.js +2190 -0
  246. package/dist/order-create-fulfillment-EIYGSKXP.js +621 -0
  247. package/dist/order-create-refund-BBXEZNWA.js +403 -0
  248. package/dist/order-create-return-6TA5J3AW.js +1292 -0
  249. package/dist/order-create-shipment-T4C6UE2K.js +208 -0
  250. package/dist/order-detail-Y4EG3P5F.js +3846 -0
  251. package/dist/order-edit-billing-address-NNIFUC5C.js +400 -0
  252. package/dist/order-edit-email-VXOX62P6.js +171 -0
  253. package/dist/order-edit-shipping-address-WDKCQRRG.js +397 -0
  254. package/dist/order-list-XDOAXZXN.js +231 -0
  255. package/dist/order-metadata-S6N3GDOA.js +82 -0
  256. package/dist/order-receive-return-5VWUPWZJ.js +549 -0
  257. package/dist/order-request-transfer-VFSY5IFF.js +571 -0
  258. package/dist/price-list-configuration-GH67LL2N.js +356 -0
  259. package/dist/price-list-create-INX5HG7G.js +973 -0
  260. package/dist/price-list-detail-5LGPE67O.js +540 -0
  261. package/dist/price-list-edit-HRWPEIZI.js +227 -0
  262. package/dist/price-list-list-IXZVTXU5.js +228 -0
  263. package/dist/price-list-prices-add-QHE3TUTV.js +614 -0
  264. package/dist/price-list-prices-edit-TMVJ7S7J.js +326 -0
  265. package/dist/product-attributes-P7WFH4I2.js +358 -0
  266. package/dist/product-create-YC6MCJ2M.js +2305 -0
  267. package/dist/product-create-option-BNF2KKJM.js +144 -0
  268. package/dist/product-create-variant-SIJX7AE3.js +837 -0
  269. package/dist/product-detail-2GJ3PGHW.js +1638 -0
  270. package/dist/product-edit-YOGTWZ4I.js +397 -0
  271. package/dist/product-edit-option-4MUSMFS7.js +152 -0
  272. package/dist/product-export-5L4HNM3W.js +127 -0
  273. package/dist/product-import-Y54VG4AC.js +261 -0
  274. package/dist/product-list-EV2TS3Y4.js +313 -0
  275. package/dist/product-media-ZSMGHCNP.js +879 -0
  276. package/dist/product-metadata-572YVJH3.js +80 -0
  277. package/dist/product-organization-LVKRBJOQ.js +312 -0
  278. package/dist/product-prices-K5YM2TL6.js +266 -0
  279. package/dist/product-sales-channels-J3OH4NWX.js +157 -0
  280. package/dist/product-shipping-profile-NOOFEUBZ.js +146 -0
  281. package/dist/product-stock-J4LTIX64.js +540 -0
  282. package/dist/product-tag-create-5JJPPELP.js +122 -0
  283. package/dist/product-tag-detail-CGLCH3BJ.js +281 -0
  284. package/dist/product-tag-edit-OR7KSC7I.js +134 -0
  285. package/dist/product-tag-list-DY7GJUJQ.js +259 -0
  286. package/dist/product-tag-metadata-BFGPRMME.js +80 -0
  287. package/dist/product-type-create-FPVSGIKL.js +101 -0
  288. package/dist/product-type-detail-JYW2DAM4.js +242 -0
  289. package/dist/product-type-edit-FBT4Z4ZJ.js +113 -0
  290. package/dist/product-type-list-FK237DSQ.js +175 -0
  291. package/dist/product-type-metadata-SFJR5OQN.js +80 -0
  292. package/dist/product-variant-detail-6KPB3HL7.js +485 -0
  293. package/dist/product-variant-edit-QFHGNDW7.js +538 -0
  294. package/dist/product-variant-manage-inventory-items-ZEX2IW53.js +340 -0
  295. package/dist/product-variant-metadata-F45CSWU6.js +86 -0
  296. package/dist/profile-detail-LLXUNQOT.js +89 -0
  297. package/dist/profile-edit-UDYMDQLT.js +176 -0
  298. package/dist/promotion-add-campaign-U6X2FNWZ.js +43 -0
  299. package/dist/promotion-create-QB7E277L.js +1258 -0
  300. package/dist/promotion-detail-7D6D6PQ7.js +486 -0
  301. package/dist/promotion-edit-details-HYQJAZDF.js +512 -0
  302. package/dist/promotion-list-HTJ5GIWG.js +206 -0
  303. package/dist/refund-reason-create-LZCL6QJI.js +192 -0
  304. package/dist/refund-reason-edit-QNGFKZMN.js +192 -0
  305. package/dist/refund-reason-list-ZEKWYQ45.js +233 -0
  306. package/dist/region-add-countries-CWJ62VPK.js +226 -0
  307. package/dist/region-create-Z3JQFIKN.js +507 -0
  308. package/dist/region-detail-46R3HACJ.js +508 -0
  309. package/dist/region-edit-W5IVVP7Z.js +380 -0
  310. package/dist/region-list-DCU6NQFA.js +205 -0
  311. package/dist/region-metadata-VG5DLCOK.js +83 -0
  312. package/dist/reservation-create-VG5FSV3F.js +309 -0
  313. package/dist/reservation-detail-36BA3V2F.js +221 -0
  314. package/dist/reservation-list-R5UBPNI4.js +298 -0
  315. package/dist/reservation-metadata-KR4HOHTH.js +83 -0
  316. package/dist/reset-password-VZPICVMM.js +458 -0
  317. package/dist/return-reason-create-KTKI6NJE.js +165 -0
  318. package/dist/return-reason-edit-5KU7WKJF.js +168 -0
  319. package/dist/return-reason-list-HBSKNIMW.js +240 -0
  320. package/dist/sales-channel-add-products-6TUDLE4D.js +274 -0
  321. package/dist/sales-channel-create-2BTWSYIK.js +154 -0
  322. package/dist/sales-channel-detail-IQIQDN3L.js +437 -0
  323. package/dist/sales-channel-edit-YBNPALFT.js +163 -0
  324. package/dist/sales-channel-list-5KNN734B.js +193 -0
  325. package/dist/sales-channel-metadata-SVW6FYSV.js +88 -0
  326. package/dist/seller-details-HBVN4GGD.js +77 -0
  327. package/dist/seller-edit-OXDARXYJ.js +387 -0
  328. package/dist/seller-list-HG2VXA6V.js +192 -0
  329. package/dist/settings-D43GVDOO.js +19 -0
  330. package/dist/shipping-option-type-create-7KYU5NNF.js +195 -0
  331. package/dist/shipping-option-type-detail-4CNTT3MO.js +169 -0
  332. package/dist/shipping-option-type-edit-AN6IPVI6.js +191 -0
  333. package/dist/shipping-option-type-list-36ZS2QZO.js +266 -0
  334. package/dist/shipping-profile-create-3OWHNAOB.js +123 -0
  335. package/dist/shipping-profile-detail-WW7IVUVV.js +157 -0
  336. package/dist/shipping-profile-metadata-AD3DSZLR.js +84 -0
  337. package/dist/shipping-profiles-list-WOGGP7IT.js +241 -0
  338. package/dist/store-add-currencies-PIGEOZ4G.js +304 -0
  339. package/dist/store-detail-MFHPXBIN.js +525 -0
  340. package/dist/store-edit-WBF6EL5N.js +246 -0
  341. package/dist/store-metadata-LSK7UVSC.js +85 -0
  342. package/dist/tax-region-create-XTX4YWRA.js +300 -0
  343. package/dist/tax-region-detail-XUYJHBHI.js +320 -0
  344. package/dist/tax-region-edit-AC64YA64.js +162 -0
  345. package/dist/tax-region-list-XRAYDYK3.js +91 -0
  346. package/dist/tax-region-metadata-YDQX3Y4X.js +83 -0
  347. package/dist/tax-region-province-create-GDL65SQF.js +315 -0
  348. package/dist/tax-region-province-detail-QMPIKT7K.js +215 -0
  349. package/dist/tax-region-tax-override-create-X2QWOHSU.js +679 -0
  350. package/dist/tax-region-tax-override-edit-VZJ6EPSU.js +788 -0
  351. package/dist/tax-region-tax-rate-create-VC2WDVJJ.js +193 -0
  352. package/dist/tax-region-tax-rate-edit-SDW36H6I.js +192 -0
  353. package/dist/user-detail-IEIX24PZ.js +163 -0
  354. package/dist/user-edit-CJ7TNY3H.js +115 -0
  355. package/dist/user-invite-OTBYWV4L.js +389 -0
  356. package/dist/user-list-BJXFPTJ7.js +341 -0
  357. package/dist/user-metadata-ZLC6T6XH.js +83 -0
  358. package/package.json +87 -0
package/dist/index.js ADDED
@@ -0,0 +1,4824 @@
1
+ import {
2
+ TaxRegionDetailBreadcrumb,
3
+ taxRegionLoader
4
+ } from "./chunk-D6IERBVW.js";
5
+ import {
6
+ isClientError
7
+ } from "./chunk-C6SUTRP2.js";
8
+ import {
9
+ InfiniteList
10
+ } from "./chunk-WMA3WTCM.js";
11
+ import "./chunk-FMFVTERD.js";
12
+ import {
13
+ ProgressBar
14
+ } from "./chunk-QSGR43JM.js";
15
+ import {
16
+ Thumbnail
17
+ } from "./chunk-WIYFXWRI.js";
18
+ import {
19
+ I18n
20
+ } from "./chunk-LR4ACD6E.js";
21
+ import "./chunk-TKGWSUEI.js";
22
+ import {
23
+ KeyboundForm
24
+ } from "./chunk-U2ZFCAPX.js";
25
+ import {
26
+ FilePreview
27
+ } from "./chunk-RSBZREKG.js";
28
+ import {
29
+ RouteFocusModal
30
+ } from "./chunk-MWOKFNRO.js";
31
+ import "./chunk-3QSRE5LS.js";
32
+ import "./chunk-JRTZWK77.js";
33
+ import {
34
+ Skeleton
35
+ } from "./chunk-INNFZYX2.js";
36
+ import "./chunk-BDGZ4EQO.js";
37
+ import {
38
+ ConditionalTooltip
39
+ } from "./chunk-LAVHRER2.js";
40
+ import {
41
+ useDocumentDirection
42
+ } from "./chunk-Y7QKP6QU.js";
43
+ import {
44
+ notificationQueryKeys,
45
+ useNotifications,
46
+ useProductTags
47
+ } from "./chunk-ORW4HNX5.js";
48
+ import {
49
+ useLogout
50
+ } from "./chunk-ODBDAABQ.js";
51
+ import "./chunk-YGQUBTKR.js";
52
+ import "./chunk-362QMJZM.js";
53
+ import {
54
+ useProductTypes
55
+ } from "./chunk-FODCCP6C.js";
56
+ import "./chunk-AWZFIP25.js";
57
+ import "./chunk-2QKPRGNK.js";
58
+ import "./chunk-XBMLI2YI.js";
59
+ import "./chunk-XL52SYWY.js";
60
+ import "./chunk-NS5CHWOH.js";
61
+ import {
62
+ useMe
63
+ } from "./chunk-WDZFLCSQ.js";
64
+ import "./chunk-VVTSF42Z.js";
65
+ import {
66
+ usePriceLists
67
+ } from "./chunk-D3KDXELJ.js";
68
+ import {
69
+ useCustomers
70
+ } from "./chunk-2MKZ4HD4.js";
71
+ import {
72
+ useCollections
73
+ } from "./chunk-OGYWOPHZ.js";
74
+ import {
75
+ useCampaigns,
76
+ usePromotions
77
+ } from "./chunk-U62GYN4A.js";
78
+ import "./chunk-KTKL7M34.js";
79
+ import {
80
+ useOrders
81
+ } from "./chunk-JJVGCTKT.js";
82
+ import "./chunk-I43SCBL3.js";
83
+ import {
84
+ useStockLocations
85
+ } from "./chunk-LLWK3OR6.js";
86
+ import "./chunk-HYUGYB23.js";
87
+ import {
88
+ useProductCategories
89
+ } from "./chunk-XCMR2HTV.js";
90
+ import "./chunk-CI5Z6FGV.js";
91
+ import {
92
+ useStore
93
+ } from "./chunk-LCZXAT4Q.js";
94
+ import "./chunk-S6LPCNXQ.js";
95
+ import {
96
+ useInventoryItems,
97
+ useProducts
98
+ } from "./chunk-T435NFHC.js";
99
+ import {
100
+ queryClient
101
+ } from "./chunk-2KCF3ZIB.js";
102
+ import {
103
+ sdk
104
+ } from "./chunk-ZYNBKBY3.js";
105
+ import "./chunk-NBMM2TZK.js";
106
+
107
+ // src/app.tsx
108
+ import { customRoutes } from "virtual:mercur/routes";
109
+ import { HelmetProvider } from "react-helmet-async";
110
+ import { QueryClientProvider } from "@tanstack/react-query";
111
+
112
+ // src/providers/theme-provider/theme-provider.tsx
113
+ import { useEffect, useState } from "react";
114
+
115
+ // src/providers/theme-provider/theme-context.tsx
116
+ import { createContext } from "react";
117
+ var ThemeContext = createContext(null);
118
+
119
+ // src/providers/theme-provider/theme-provider.tsx
120
+ import { jsx } from "react/jsx-runtime";
121
+ var THEME_KEY = "medusa_admin_theme";
122
+ function getDefaultValue() {
123
+ const persisted = localStorage?.getItem(THEME_KEY);
124
+ if (persisted) {
125
+ return persisted;
126
+ }
127
+ return "system";
128
+ }
129
+ function getThemeValue(selected) {
130
+ if (selected === "system") {
131
+ if (window !== void 0) {
132
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
133
+ }
134
+ return "light";
135
+ }
136
+ return selected;
137
+ }
138
+ var ThemeProvider = ({ children }) => {
139
+ const [state, setState] = useState(getDefaultValue());
140
+ const [value, setValue] = useState(getThemeValue(state));
141
+ const setTheme = (theme) => {
142
+ localStorage.setItem(THEME_KEY, theme);
143
+ const themeValue = getThemeValue(theme);
144
+ setState(theme);
145
+ setValue(themeValue);
146
+ };
147
+ useEffect(() => {
148
+ const html = document.querySelector("html");
149
+ if (html) {
150
+ const css = document.createElement("style");
151
+ css.appendChild(
152
+ document.createTextNode(
153
+ `* {
154
+ -webkit-transition: none !important;
155
+ -moz-transition: none !important;
156
+ -o-transition: none !important;
157
+ -ms-transition: none !important;
158
+ transition: none !important;
159
+ }`
160
+ )
161
+ );
162
+ document.head.appendChild(css);
163
+ html.classList.remove(value === "light" ? "dark" : "light");
164
+ html.classList.add(value);
165
+ html.style.colorScheme = value;
166
+ window.getComputedStyle(css).opacity;
167
+ document.head.removeChild(css);
168
+ }
169
+ }, [value]);
170
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: { theme: state, setTheme }, children });
171
+ };
172
+
173
+ // src/providers/theme-provider/use-theme.tsx
174
+ import { useContext } from "react";
175
+ var useTheme = () => {
176
+ const context = useContext(ThemeContext);
177
+ if (!context) {
178
+ throw new Error("useTheme must be used within a ThemeProvider");
179
+ }
180
+ return context;
181
+ };
182
+
183
+ // src/providers/sidebar-provider/sidebar-provider.tsx
184
+ import { useEffect as useEffect2, useState as useState2 } from "react";
185
+ import { useLocation } from "react-router-dom";
186
+
187
+ // src/providers/sidebar-provider/sidebar-context.tsx
188
+ import { createContext as createContext2 } from "react";
189
+ var SidebarContext = createContext2(null);
190
+
191
+ // src/providers/sidebar-provider/sidebar-provider.tsx
192
+ import { jsx as jsx2 } from "react/jsx-runtime";
193
+ var SidebarProvider = ({ children }) => {
194
+ const [desktop, setDesktop] = useState2(true);
195
+ const [mobile, setMobile] = useState2(false);
196
+ const { pathname } = useLocation();
197
+ const toggle = (view) => {
198
+ if (view === "desktop") {
199
+ setDesktop(!desktop);
200
+ } else {
201
+ setMobile(!mobile);
202
+ }
203
+ };
204
+ useEffect2(() => {
205
+ setMobile(false);
206
+ }, [pathname]);
207
+ return /* @__PURE__ */ jsx2(SidebarContext.Provider, { value: { desktop, mobile, toggle }, children });
208
+ };
209
+
210
+ // src/providers/sidebar-provider/use-sidebar.tsx
211
+ import { useContext as useContext2 } from "react";
212
+ var useSidebar = () => {
213
+ const context = useContext2(SidebarContext);
214
+ if (!context) {
215
+ throw new Error("useSidebar must be used within a SidebarProvider");
216
+ }
217
+ return context;
218
+ };
219
+
220
+ // src/providers/keybind-provider/hooks.tsx
221
+ import { default as debounceFn } from "lodash.debounce";
222
+ import { useCallback, useContext as useContext3, useEffect as useEffect3, useState as useState3 } from "react";
223
+ import { useTranslation } from "react-i18next";
224
+ import { useNavigate } from "react-router-dom";
225
+
226
+ // src/providers/keybind-provider/keybind-context.tsx
227
+ import { createContext as createContext3 } from "react";
228
+ var KeybindContext = createContext3(null);
229
+
230
+ // src/providers/keybind-provider/utils.ts
231
+ var findFirstPlatformMatch = (keys) => {
232
+ const match = Object.entries(keys).filter(
233
+ ([, value]) => value.length > 0
234
+ )[0] ?? [];
235
+ return match.length ? {
236
+ platform: match[0],
237
+ keys: match[1]
238
+ } : null;
239
+ };
240
+ var getShortcutKeys = (shortcut) => {
241
+ const platform = "Mac";
242
+ const keys = shortcut.keys[platform];
243
+ if (!keys) {
244
+ const defaultPlatform = findFirstPlatformMatch(shortcut.keys);
245
+ console.warn(
246
+ `No keys found for platform "${platform}" in "${shortcut.label}" ${defaultPlatform ? `using keys for platform "${defaultPlatform.platform}"` : ""}`
247
+ );
248
+ return defaultPlatform ? defaultPlatform.keys : [];
249
+ }
250
+ return keys;
251
+ };
252
+ var keysMatch = (keys1, keys2) => {
253
+ return keys1.length === keys2.length && keys1.every(
254
+ (key, index) => key.toLowerCase() === keys2[index].toLowerCase()
255
+ );
256
+ };
257
+ var findShortcutIndex = (shortcuts, keys) => {
258
+ if (!keys.length) {
259
+ return -1;
260
+ }
261
+ let index = 0;
262
+ for (const shortcut of shortcuts) {
263
+ const shortcutKeys = getShortcutKeys(shortcut);
264
+ if (keysMatch(shortcutKeys, keys)) {
265
+ return index;
266
+ }
267
+ index++;
268
+ }
269
+ return -1;
270
+ };
271
+ var findShortcut = (shortcuts, keys) => {
272
+ const shortcutIndex = findShortcutIndex(shortcuts, keys);
273
+ return shortcutIndex > -1 ? shortcuts[shortcutIndex] : null;
274
+ };
275
+ var getShortcutWithDefaultValues = (shortcut, platform = "Mac") => {
276
+ const platforms = ["Mac", "Windows", "Linux"];
277
+ const defaultKeys = Object.values(shortcut.keys)[0] ?? shortcut.keys[platform];
278
+ const keys = platforms.reduce((acc, curr) => {
279
+ return {
280
+ ...acc,
281
+ [curr]: shortcut.keys[curr] ?? defaultKeys
282
+ };
283
+ }, {});
284
+ return {
285
+ ...shortcut,
286
+ keys,
287
+ _defaultKeys: shortcut.keys
288
+ };
289
+ };
290
+
291
+ // src/providers/keybind-provider/hooks.tsx
292
+ var useShortcuts = ({
293
+ shortcuts = [],
294
+ debounce
295
+ }) => {
296
+ const [keys, setKeys] = useState3([]);
297
+ const navigate = useNavigate();
298
+ const removeKeys = useCallback(
299
+ debounceFn(() => setKeys([]), debounce),
300
+ []
301
+ );
302
+ const invokeShortcut = useCallback(
303
+ debounceFn((shortcut) => {
304
+ if (shortcut && shortcut.callback) {
305
+ shortcut.callback();
306
+ setKeys([]);
307
+ return;
308
+ }
309
+ if (shortcut && shortcut.to) {
310
+ navigate(shortcut.to);
311
+ setKeys([]);
312
+ return;
313
+ }
314
+ }, debounce / 2),
315
+ []
316
+ );
317
+ useEffect3(() => {
318
+ if (keys.length > 0 && shortcuts.length > 0) {
319
+ const shortcut = findShortcut(shortcuts, keys);
320
+ invokeShortcut(shortcut);
321
+ }
322
+ return () => invokeShortcut.cancel();
323
+ }, [keys, shortcuts, invokeShortcut]);
324
+ useEffect3(() => {
325
+ const listener = (event) => {
326
+ const target = event.target;
327
+ if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.contentEditable === "true") {
328
+ removeKeys();
329
+ return;
330
+ }
331
+ setKeys((oldKeys) => [...oldKeys, event.key]);
332
+ removeKeys();
333
+ };
334
+ window.addEventListener("keydown", listener);
335
+ return () => {
336
+ window.removeEventListener("keydown", listener);
337
+ };
338
+ }, [removeKeys]);
339
+ };
340
+ var useGlobalShortcuts = () => {
341
+ const { t: t2 } = useTranslation();
342
+ const navigate = useNavigate();
343
+ const { mutateAsync } = useLogout();
344
+ const handleLogout = async () => {
345
+ await mutateAsync(void 0, {
346
+ onSuccess: () => {
347
+ queryClient.clear();
348
+ navigate("/login");
349
+ }
350
+ });
351
+ };
352
+ const globalShortcuts = [
353
+ // Pages
354
+ {
355
+ keys: {
356
+ Mac: ["G", "O"]
357
+ },
358
+ label: t2("app.keyboardShortcuts.navigation.goToOrders"),
359
+ type: "pageShortcut",
360
+ to: "/orders"
361
+ },
362
+ {
363
+ keys: {
364
+ Mac: ["G", "P"]
365
+ },
366
+ label: t2("app.keyboardShortcuts.navigation.goToProducts"),
367
+ type: "pageShortcut",
368
+ to: "/products"
369
+ },
370
+ {
371
+ keys: {
372
+ Mac: ["G", "C"]
373
+ },
374
+ label: t2("app.keyboardShortcuts.navigation.goToCollections"),
375
+ type: "pageShortcut",
376
+ to: "/collections"
377
+ },
378
+ {
379
+ keys: {
380
+ Mac: ["G", "A"]
381
+ },
382
+ label: t2("app.keyboardShortcuts.navigation.goToCategories"),
383
+ type: "pageShortcut",
384
+ to: "/categories"
385
+ },
386
+ {
387
+ keys: {
388
+ Mac: ["G", "U"]
389
+ },
390
+ label: t2("app.keyboardShortcuts.navigation.goToCustomers"),
391
+ type: "pageShortcut",
392
+ to: "/customers"
393
+ },
394
+ {
395
+ keys: {
396
+ Mac: ["G", "I"]
397
+ },
398
+ label: t2("app.keyboardShortcuts.navigation.goToInventory"),
399
+ type: "pageShortcut",
400
+ to: "/inventory"
401
+ },
402
+ {
403
+ keys: {
404
+ Mac: ["G", "L"]
405
+ },
406
+ label: t2("app.keyboardShortcuts.navigation.goToPriceLists"),
407
+ type: "pageShortcut",
408
+ to: "/price-lists"
409
+ },
410
+ {
411
+ keys: {
412
+ Mac: ["G", "M"]
413
+ },
414
+ label: t2("app.keyboardShortcuts.navigation.goToPromotions"),
415
+ type: "pageShortcut",
416
+ to: "/promotions"
417
+ },
418
+ {
419
+ keys: {
420
+ Mac: ["G", "K"]
421
+ },
422
+ label: t2("app.keyboardShortcuts.navigation.goToCampaigns"),
423
+ type: "pageShortcut",
424
+ to: "/campaigns"
425
+ },
426
+ // Settings
427
+ {
428
+ keys: {
429
+ Mac: ["G", ","]
430
+ },
431
+ label: t2("app.keyboardShortcuts.settings.goToSettings"),
432
+ type: "settingShortcut",
433
+ to: "/settings"
434
+ },
435
+ {
436
+ keys: {
437
+ Mac: ["G", ",", "S"]
438
+ },
439
+ label: t2("app.keyboardShortcuts.settings.goToSeller"),
440
+ type: "settingShortcut",
441
+ to: "/settings/seller"
442
+ },
443
+ {
444
+ keys: {
445
+ Mac: ["G", ",", "P"]
446
+ },
447
+ label: t2("app.keyboardShortcuts.settings.goToProductTypes"),
448
+ type: "settingShortcut",
449
+ to: "/settings/product-types"
450
+ },
451
+ {
452
+ keys: {
453
+ Mac: ["G", ",", "L"]
454
+ },
455
+ label: t2("app.keyboardShortcuts.settings.goToLocations"),
456
+ type: "settingShortcut",
457
+ to: "/settings/locations"
458
+ },
459
+ // Commands
460
+ {
461
+ keys: {
462
+ Mac: ["B", "Y", "E"]
463
+ },
464
+ label: t2("actions.logout"),
465
+ type: "commandShortcut",
466
+ callback: () => handleLogout()
467
+ }
468
+ ];
469
+ return globalShortcuts;
470
+ };
471
+
472
+ // src/providers/keybind-provider/keybind-provider.tsx
473
+ import { useCallback as useCallback2, useMemo, useState as useState4 } from "react";
474
+ import { jsx as jsx3 } from "react/jsx-runtime";
475
+ var KeybindProvider = ({
476
+ shortcuts,
477
+ debounce = 500,
478
+ children
479
+ }) => {
480
+ const [storeShortcuts, setStoreCommands] = useState4(
481
+ shortcuts.map((shr) => getShortcutWithDefaultValues(shr))
482
+ );
483
+ const registerShortcut = useCallback2(
484
+ (shortcut) => {
485
+ setStoreCommands((prevShortcuts) => {
486
+ const idx = findShortcutIndex(shortcuts, getShortcutKeys(shortcut));
487
+ const newShortcuts = [...prevShortcuts];
488
+ if (idx > -1) {
489
+ newShortcuts[idx] = getShortcutWithDefaultValues(shortcut);
490
+ return prevShortcuts;
491
+ }
492
+ return [...prevShortcuts, getShortcutWithDefaultValues(shortcut)];
493
+ });
494
+ },
495
+ [shortcuts]
496
+ );
497
+ const getKeysByPlatform = useCallback2((command) => {
498
+ return findFirstPlatformMatch(command.keys);
499
+ }, []);
500
+ useShortcuts({ shortcuts: storeShortcuts, debounce });
501
+ const commandsContext = useMemo(
502
+ () => ({
503
+ shortcuts: storeShortcuts,
504
+ registerShortcut,
505
+ getKeysByPlatform
506
+ }),
507
+ [storeShortcuts, registerShortcut, getKeysByPlatform]
508
+ );
509
+ return /* @__PURE__ */ jsx3(KeybindContext.Provider, { value: commandsContext, children });
510
+ };
511
+
512
+ // src/providers/search-provider/search-provider.tsx
513
+ import { useEffect as useEffect6, useState as useState7 } from "react";
514
+
515
+ // src/components/search/search.tsx
516
+ import {
517
+ Badge,
518
+ Button,
519
+ clx,
520
+ DropdownMenu,
521
+ IconButton,
522
+ Kbd,
523
+ Text
524
+ } from "@medusajs/ui";
525
+ import { Command } from "cmdk";
526
+ import { Dialog as RadixDialog } from "radix-ui";
527
+ import {
528
+ Children,
529
+ forwardRef,
530
+ Fragment,
531
+ useCallback as useCallback4,
532
+ useEffect as useEffect5,
533
+ useImperativeHandle,
534
+ useMemo as useMemo3,
535
+ useRef,
536
+ useState as useState6
537
+ } from "react";
538
+ import { useTranslation as useTranslation3 } from "react-i18next";
539
+ import { useLocation as useLocation2, useNavigate as useNavigate2 } from "react-router-dom";
540
+ import {
541
+ ArrowUturnLeft,
542
+ MagnifyingGlass,
543
+ Plus,
544
+ Spinner,
545
+ TriangleDownMini
546
+ } from "@medusajs/icons";
547
+ import { matchSorter } from "match-sorter";
548
+
549
+ // src/components/search/constants.ts
550
+ var SEARCH_AREAS = [
551
+ "all",
552
+ "order",
553
+ "product",
554
+ "collection",
555
+ "category",
556
+ "inventory",
557
+ "customer",
558
+ "promotion",
559
+ "campaign",
560
+ "priceList",
561
+ "productType",
562
+ "productTag",
563
+ "location",
564
+ "command",
565
+ "navigation"
566
+ ];
567
+ var DEFAULT_SEARCH_LIMIT = 3;
568
+ var SEARCH_LIMIT_INCREMENT = 20;
569
+
570
+ // src/components/search/use-search-results.tsx
571
+ import { keepPreviousData } from "@tanstack/react-query";
572
+ import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useState as useState5 } from "react";
573
+ import { useTranslation as useTranslation2 } from "react-i18next";
574
+ var useSearchResults = ({
575
+ q,
576
+ limit,
577
+ area = "all"
578
+ }) => {
579
+ const staticResults = useStaticSearchResults(area);
580
+ const { dynamicResults, isFetching } = useDynamicSearchResults(area, limit, q);
581
+ return {
582
+ staticResults,
583
+ dynamicResults,
584
+ isFetching
585
+ };
586
+ };
587
+ var useStaticSearchResults = (currentArea) => {
588
+ const globalCommands = useGlobalShortcuts();
589
+ const results = useMemo2(() => {
590
+ const groups = /* @__PURE__ */ new Map();
591
+ globalCommands.forEach((command) => {
592
+ const group = groups.get(command.type) || [];
593
+ group.push(command);
594
+ groups.set(command.type, group);
595
+ });
596
+ let filteredGroups;
597
+ switch (currentArea) {
598
+ case "all":
599
+ filteredGroups = Array.from(groups);
600
+ break;
601
+ case "navigation":
602
+ filteredGroups = Array.from(groups).filter(
603
+ ([type]) => type === "pageShortcut" || type === "settingShortcut"
604
+ );
605
+ break;
606
+ case "command":
607
+ filteredGroups = Array.from(groups).filter(
608
+ ([type]) => type === "commandShortcut"
609
+ );
610
+ break;
611
+ default:
612
+ filteredGroups = [];
613
+ }
614
+ return filteredGroups.map(([title, items]) => ({
615
+ title,
616
+ items
617
+ }));
618
+ }, [globalCommands, currentArea]);
619
+ return results;
620
+ };
621
+ var useDynamicSearchResults = (currentArea, limit, q) => {
622
+ const { t: t2 } = useTranslation2();
623
+ const debouncedSearch = useDebouncedSearch(q, 300);
624
+ const orderResponse = useOrders(
625
+ {
626
+ q: debouncedSearch?.replace(/^#/, ""),
627
+ // Since we display the ID with a # prefix, it's natural for the user to include it in the search. This will however cause no results to be returned, so we remove the # prefix from the search query.
628
+ limit,
629
+ fields: "id,display_id,email"
630
+ },
631
+ {
632
+ enabled: isAreaEnabled(currentArea, "order"),
633
+ placeholderData: keepPreviousData
634
+ }
635
+ );
636
+ const productResponse = useProducts(
637
+ {
638
+ q: debouncedSearch,
639
+ limit,
640
+ // TODO: Remove exclusion once we avoid including unnecessary relations by default in the query config
641
+ fields: "id,title,thumbnail,-type,-collection,-options,-tags,-images,-variants,-sales_channels"
642
+ },
643
+ {
644
+ enabled: isAreaEnabled(currentArea, "product"),
645
+ placeholderData: keepPreviousData
646
+ }
647
+ );
648
+ const categoryResponse = useProductCategories(
649
+ {
650
+ // TODO: Remove the OR condition once the list endpoint does not throw when q equals an empty string
651
+ q: debouncedSearch || void 0,
652
+ limit,
653
+ fields: "id,name"
654
+ },
655
+ {
656
+ enabled: isAreaEnabled(currentArea, "category"),
657
+ placeholderData: keepPreviousData
658
+ }
659
+ );
660
+ const collectionResponse = useCollections(
661
+ {
662
+ q: debouncedSearch,
663
+ limit,
664
+ fields: "id,title"
665
+ },
666
+ {
667
+ enabled: isAreaEnabled(currentArea, "collection"),
668
+ placeholderData: keepPreviousData
669
+ }
670
+ );
671
+ const customerResponse = useCustomers(
672
+ {
673
+ q: debouncedSearch,
674
+ limit,
675
+ fields: "id,email,first_name,last_name"
676
+ },
677
+ {
678
+ enabled: isAreaEnabled(currentArea, "customer"),
679
+ placeholderData: keepPreviousData
680
+ }
681
+ );
682
+ const inventoryResponse = useInventoryItems(
683
+ {
684
+ q: debouncedSearch,
685
+ limit,
686
+ fields: "id,title,sku"
687
+ },
688
+ {
689
+ enabled: isAreaEnabled(currentArea, "inventory"),
690
+ placeholderData: keepPreviousData
691
+ }
692
+ );
693
+ const promotionResponse = usePromotions(
694
+ {
695
+ q: debouncedSearch,
696
+ limit,
697
+ fields: "id,code,status"
698
+ },
699
+ {
700
+ enabled: isAreaEnabled(currentArea, "promotion"),
701
+ placeholderData: keepPreviousData
702
+ }
703
+ );
704
+ const campaignResponse = useCampaigns(
705
+ {
706
+ q: debouncedSearch,
707
+ limit,
708
+ fields: "id,name"
709
+ },
710
+ {
711
+ enabled: isAreaEnabled(currentArea, "campaign"),
712
+ placeholderData: keepPreviousData
713
+ }
714
+ );
715
+ const priceListResponse = usePriceLists(
716
+ {
717
+ q: debouncedSearch,
718
+ limit,
719
+ fields: "id,title"
720
+ },
721
+ {
722
+ enabled: isAreaEnabled(currentArea, "priceList"),
723
+ placeholderData: keepPreviousData
724
+ }
725
+ );
726
+ const productTypeResponse = useProductTypes(
727
+ {
728
+ q: debouncedSearch,
729
+ limit,
730
+ fields: "id,value"
731
+ },
732
+ {
733
+ enabled: isAreaEnabled(currentArea, "productType"),
734
+ placeholderData: keepPreviousData
735
+ }
736
+ );
737
+ const productTagResponse = useProductTags(
738
+ {
739
+ q: debouncedSearch,
740
+ limit,
741
+ fields: "id,value"
742
+ },
743
+ {
744
+ enabled: isAreaEnabled(currentArea, "productTag"),
745
+ placeholderData: keepPreviousData
746
+ }
747
+ );
748
+ const locationResponse = useStockLocations(
749
+ {
750
+ q: debouncedSearch,
751
+ limit,
752
+ fields: "id,name"
753
+ },
754
+ {
755
+ enabled: isAreaEnabled(currentArea, "location"),
756
+ placeholderData: keepPreviousData
757
+ }
758
+ );
759
+ const responseMap = useMemo2(
760
+ () => ({
761
+ order: orderResponse,
762
+ product: productResponse,
763
+ collection: collectionResponse,
764
+ category: categoryResponse,
765
+ inventory: inventoryResponse,
766
+ customer: customerResponse,
767
+ promotion: promotionResponse,
768
+ campaign: campaignResponse,
769
+ priceList: priceListResponse,
770
+ productType: productTypeResponse,
771
+ productTag: productTagResponse,
772
+ location: locationResponse
773
+ }),
774
+ [
775
+ orderResponse,
776
+ productResponse,
777
+ inventoryResponse,
778
+ categoryResponse,
779
+ collectionResponse,
780
+ customerResponse,
781
+ promotionResponse,
782
+ campaignResponse,
783
+ priceListResponse,
784
+ productTypeResponse,
785
+ productTagResponse,
786
+ locationResponse
787
+ ]
788
+ );
789
+ const results = useMemo2(() => {
790
+ const groups = Object.entries(responseMap).map(([key, response]) => {
791
+ const area = key;
792
+ if (isAreaEnabled(currentArea, area) || currentArea === "all") {
793
+ return transformDynamicSearchResults(area, limit, t2, response);
794
+ }
795
+ return null;
796
+ }).filter(Boolean);
797
+ return groups;
798
+ }, [responseMap, currentArea, limit, t2]);
799
+ const isAreaFetching = useCallback3(
800
+ (area) => {
801
+ if (area === "all") {
802
+ return Object.values(responseMap).some(
803
+ (response) => response.isFetching
804
+ );
805
+ }
806
+ return isAreaEnabled(currentArea, area) && responseMap[area]?.isFetching;
807
+ },
808
+ [currentArea, responseMap]
809
+ );
810
+ const isFetching = useMemo2(() => {
811
+ return isAreaFetching(currentArea);
812
+ }, [currentArea, isAreaFetching]);
813
+ const dynamicResults = q ? results.filter(
814
+ (group) => !!group && group.items.length > 0
815
+ ) : [];
816
+ return {
817
+ dynamicResults,
818
+ isFetching
819
+ };
820
+ };
821
+ var useDebouncedSearch = (value, delay) => {
822
+ const [debouncedValue, setDebouncedValue] = useState5(value);
823
+ useEffect4(() => {
824
+ const handler = setTimeout(() => {
825
+ setDebouncedValue(value);
826
+ }, delay);
827
+ return () => {
828
+ clearTimeout(handler);
829
+ };
830
+ }, [value, delay]);
831
+ return debouncedValue;
832
+ };
833
+ function isAreaEnabled(area, currentArea) {
834
+ if (area === "all") {
835
+ return true;
836
+ }
837
+ if (area === currentArea) {
838
+ return true;
839
+ }
840
+ return false;
841
+ }
842
+ var transformMap = {
843
+ order: {
844
+ dataKey: "orders",
845
+ transform: (order) => ({
846
+ id: order.id,
847
+ title: `#${order.display_id}`,
848
+ subtitle: order.email ?? void 0,
849
+ to: `/orders/${order.id}`,
850
+ value: `order:${order.id}`
851
+ })
852
+ },
853
+ product: {
854
+ dataKey: "products",
855
+ transform: (product) => ({
856
+ id: product.id,
857
+ title: product.title,
858
+ to: `/products/${product.id}`,
859
+ thumbnail: product.thumbnail ?? void 0,
860
+ value: `product:${product.id}`
861
+ })
862
+ },
863
+ category: {
864
+ dataKey: "product_categories",
865
+ transform: (category) => ({
866
+ id: category.id,
867
+ title: category.name,
868
+ to: `/categories/${category.id}`,
869
+ value: `category:${category.id}`
870
+ })
871
+ },
872
+ inventory: {
873
+ dataKey: "inventory_items",
874
+ transform: (inventory) => ({
875
+ id: inventory.id,
876
+ title: inventory.title ?? "",
877
+ subtitle: inventory.sku ?? void 0,
878
+ to: `/inventory/${inventory.id}`,
879
+ value: `inventory:${inventory.id}`
880
+ })
881
+ },
882
+ customer: {
883
+ dataKey: "customers",
884
+ transform: (customer) => {
885
+ const name = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
886
+ return {
887
+ id: customer.id,
888
+ title: name || customer.email,
889
+ subtitle: name ? customer.email : void 0,
890
+ to: `/customers/${customer.id}`,
891
+ value: `customer:${customer.id}`
892
+ };
893
+ }
894
+ },
895
+ collection: {
896
+ dataKey: "collections",
897
+ transform: (collection) => ({
898
+ id: collection.id,
899
+ title: collection.title,
900
+ to: `/collections/${collection.id}`,
901
+ value: `collection:${collection.id}`
902
+ })
903
+ },
904
+ promotion: {
905
+ dataKey: "promotions",
906
+ transform: (promotion) => ({
907
+ id: promotion.id,
908
+ title: promotion.code,
909
+ to: `/promotions/${promotion.id}`,
910
+ value: `promotion:${promotion.id}`
911
+ })
912
+ },
913
+ campaign: {
914
+ dataKey: "campaigns",
915
+ transform: (campaign) => ({
916
+ id: campaign.id,
917
+ title: campaign.name,
918
+ to: `/campaigns/${campaign.id}`,
919
+ value: `campaign:${campaign.id}`
920
+ })
921
+ },
922
+ priceList: {
923
+ dataKey: "price_lists",
924
+ transform: (priceList) => ({
925
+ id: priceList.id,
926
+ title: priceList.title,
927
+ to: `/price-lists/${priceList.id}`,
928
+ value: `priceList:${priceList.id}`
929
+ })
930
+ },
931
+ productType: {
932
+ dataKey: "product_types",
933
+ transform: (productType) => ({
934
+ id: productType.id,
935
+ title: productType.value,
936
+ to: `/product-types/${productType.id}`,
937
+ value: `productType:${productType.id}`
938
+ })
939
+ },
940
+ productTag: {
941
+ dataKey: "product_tags",
942
+ transform: (productTag) => ({
943
+ id: productTag.id,
944
+ title: productTag.value,
945
+ to: `/product-tags/${productTag.id}`,
946
+ value: `productTag:${productTag.id}`
947
+ })
948
+ },
949
+ location: {
950
+ dataKey: "stock_locations",
951
+ transform: (location) => ({
952
+ id: location.id,
953
+ title: location.name,
954
+ to: `/locations/${location.id}`,
955
+ value: `location:${location.id}`
956
+ })
957
+ }
958
+ };
959
+ function transformDynamicSearchResults(type, limit, t2, response) {
960
+ if (!response || !transformMap[type]) {
961
+ return void 0;
962
+ }
963
+ const { dataKey, transform } = transformMap[type];
964
+ const data = response[dataKey];
965
+ if (!data || !Array.isArray(data)) {
966
+ return void 0;
967
+ }
968
+ return {
969
+ title: t2(`app.search.groups.${type}`),
970
+ area: type,
971
+ hasMore: response.count > limit,
972
+ count: response.count,
973
+ items: data.map(transform)
974
+ };
975
+ }
976
+
977
+ // src/components/search/search.tsx
978
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
979
+ var Search = () => {
980
+ const [area, setArea] = useState6("all");
981
+ const [search, setSearch] = useState6("");
982
+ const [limit, setLimit] = useState6(DEFAULT_SEARCH_LIMIT);
983
+ const { open, onOpenChange } = useSearch();
984
+ const location = useLocation2();
985
+ const { t: t2 } = useTranslation3();
986
+ const navigate = useNavigate2();
987
+ const inputRef = useRef(null);
988
+ const listRef = useRef(null);
989
+ const { staticResults, dynamicResults, isFetching } = useSearchResults({
990
+ area,
991
+ limit,
992
+ q: search
993
+ });
994
+ const handleReset = useCallback4(() => {
995
+ setArea("all");
996
+ setSearch("");
997
+ setLimit(DEFAULT_SEARCH_LIMIT);
998
+ }, [setLimit]);
999
+ const handleBack = () => {
1000
+ handleReset();
1001
+ inputRef.current?.focus();
1002
+ };
1003
+ const handleOpenChange = useCallback4(
1004
+ (open2) => {
1005
+ if (!open2) {
1006
+ handleReset();
1007
+ }
1008
+ onOpenChange(open2);
1009
+ },
1010
+ [onOpenChange, handleReset]
1011
+ );
1012
+ useEffect5(() => {
1013
+ handleOpenChange(false);
1014
+ }, [location.pathname, handleOpenChange]);
1015
+ const handleSelect = (item) => {
1016
+ handleOpenChange(false);
1017
+ if (item.to) {
1018
+ navigate(item.to);
1019
+ return;
1020
+ }
1021
+ if (item.callback) {
1022
+ item.callback();
1023
+ return;
1024
+ }
1025
+ };
1026
+ const handleShowMore = (area2) => {
1027
+ if (area2 === "all") {
1028
+ setLimit(DEFAULT_SEARCH_LIMIT);
1029
+ } else {
1030
+ setLimit(SEARCH_LIMIT_INCREMENT);
1031
+ }
1032
+ setArea(area2);
1033
+ inputRef.current?.focus();
1034
+ };
1035
+ const handleLoadMore = () => {
1036
+ setLimit((l) => l + SEARCH_LIMIT_INCREMENT);
1037
+ };
1038
+ const filteredStaticResults = useMemo3(() => {
1039
+ const filteredResults = [];
1040
+ staticResults.forEach((group) => {
1041
+ const filteredItems = matchSorter(group.items, search, {
1042
+ keys: ["label"]
1043
+ });
1044
+ if (filteredItems.length === 0) {
1045
+ return;
1046
+ }
1047
+ filteredResults.push({
1048
+ ...group,
1049
+ items: filteredItems
1050
+ });
1051
+ });
1052
+ return filteredResults;
1053
+ }, [staticResults, search]);
1054
+ const handleSearch = (q) => {
1055
+ setSearch(q);
1056
+ listRef.current?.scrollTo({ top: 0 });
1057
+ };
1058
+ const showLoading = useMemo3(() => {
1059
+ return isFetching && !dynamicResults.length && !filteredStaticResults.length;
1060
+ }, [isFetching, dynamicResults, filteredStaticResults]);
1061
+ return /* @__PURE__ */ jsxs(CommandDialog, { open, onOpenChange: handleOpenChange, children: [
1062
+ /* @__PURE__ */ jsx4(
1063
+ CommandInput,
1064
+ {
1065
+ isFetching,
1066
+ ref: inputRef,
1067
+ area,
1068
+ setArea,
1069
+ value: search,
1070
+ onValueChange: handleSearch,
1071
+ onBack: area !== "all" ? handleBack : void 0,
1072
+ placeholder: t2("app.search.placeholder")
1073
+ }
1074
+ ),
1075
+ /* @__PURE__ */ jsxs(CommandList, { ref: listRef, children: [
1076
+ showLoading && /* @__PURE__ */ jsx4(CommandLoading, {}),
1077
+ dynamicResults.map((group) => {
1078
+ return /* @__PURE__ */ jsxs(CommandGroup, { heading: group.title, children: [
1079
+ group.items.map((item) => {
1080
+ return /* @__PURE__ */ jsx4(
1081
+ CommandItem,
1082
+ {
1083
+ onSelect: () => handleSelect(item),
1084
+ value: item.value,
1085
+ className: "flex items-center justify-between",
1086
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
1087
+ item.thumbnail && /* @__PURE__ */ jsx4(
1088
+ Thumbnail,
1089
+ {
1090
+ alt: item.title,
1091
+ src: item.thumbnail,
1092
+ size: "small"
1093
+ }
1094
+ ),
1095
+ /* @__PURE__ */ jsx4("span", { children: item.title }),
1096
+ item.subtitle && /* @__PURE__ */ jsx4("span", { className: "text-ui-fg-muted", children: item.subtitle })
1097
+ ] })
1098
+ },
1099
+ item.id
1100
+ );
1101
+ }),
1102
+ group.hasMore && area === "all" && /* @__PURE__ */ jsx4(
1103
+ CommandItem,
1104
+ {
1105
+ onSelect: () => handleShowMore(group.area),
1106
+ hidden: true,
1107
+ value: `${group.title}:show:more`,
1108
+ children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-muted flex items-center gap-x-3", children: [
1109
+ /* @__PURE__ */ jsx4(Plus, {}),
1110
+ /* @__PURE__ */ jsx4(Text, { size: "small", leading: "compact", weight: "plus", children: t2("app.search.showMore") })
1111
+ ] })
1112
+ }
1113
+ ),
1114
+ group.hasMore && area === group.area && /* @__PURE__ */ jsx4(
1115
+ CommandItem,
1116
+ {
1117
+ onSelect: handleLoadMore,
1118
+ hidden: true,
1119
+ value: `${group.title}:load:more`,
1120
+ children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-muted flex items-center gap-x-3", children: [
1121
+ /* @__PURE__ */ jsx4(Plus, {}),
1122
+ /* @__PURE__ */ jsx4(Text, { size: "small", leading: "compact", weight: "plus", children: t2("app.search.loadMore", {
1123
+ count: Math.min(
1124
+ SEARCH_LIMIT_INCREMENT,
1125
+ group.count - limit
1126
+ )
1127
+ }) })
1128
+ ] })
1129
+ }
1130
+ )
1131
+ ] }, group.title);
1132
+ }),
1133
+ filteredStaticResults.map((group) => {
1134
+ return /* @__PURE__ */ jsx4(
1135
+ CommandGroup,
1136
+ {
1137
+ heading: t2(`app.keyboardShortcuts.${group.title}`),
1138
+ children: group.items.map((item) => {
1139
+ return /* @__PURE__ */ jsxs(
1140
+ CommandItem,
1141
+ {
1142
+ onSelect: () => handleSelect(item),
1143
+ className: "flex items-center justify-between",
1144
+ children: [
1145
+ /* @__PURE__ */ jsx4("span", { children: item.label }),
1146
+ /* @__PURE__ */ jsx4("div", { className: "flex items-center gap-x-1.5", children: item.keys.Mac?.map((key, index) => {
1147
+ return /* @__PURE__ */ jsxs(
1148
+ "div",
1149
+ {
1150
+ className: "flex items-center gap-x-1",
1151
+ children: [
1152
+ /* @__PURE__ */ jsx4(Kbd, { children: key }),
1153
+ index < (item.keys.Mac?.length || 0) - 1 && /* @__PURE__ */ jsx4("span", { className: "txt-compact-xsmall text-ui-fg-subtle", children: t2("app.keyboardShortcuts.then") })
1154
+ ]
1155
+ },
1156
+ index
1157
+ );
1158
+ }) })
1159
+ ]
1160
+ },
1161
+ item.label
1162
+ );
1163
+ })
1164
+ },
1165
+ group.title
1166
+ );
1167
+ }),
1168
+ !showLoading && /* @__PURE__ */ jsx4(CommandEmpty, { q: search })
1169
+ ] })
1170
+ ] });
1171
+ };
1172
+ var CommandPalette = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
1173
+ Command,
1174
+ {
1175
+ shouldFilter: false,
1176
+ ref,
1177
+ className: clx(
1178
+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
1179
+ className
1180
+ ),
1181
+ ...props
1182
+ }
1183
+ ));
1184
+ CommandPalette.displayName = Command.displayName;
1185
+ var CommandDialog = ({ children, ...props }) => {
1186
+ const { t: t2 } = useTranslation3();
1187
+ const preserveHeight = useMemo3(() => {
1188
+ return props.isLoading && Children.count(children) === 0;
1189
+ }, [props.isLoading, children]);
1190
+ return /* @__PURE__ */ jsx4(RadixDialog.Root, { ...props, children: /* @__PURE__ */ jsxs(RadixDialog.Portal, { children: [
1191
+ /* @__PURE__ */ jsx4(RadixDialog.Overlay, { className: "bg-ui-bg-overlay fixed inset-0" }),
1192
+ /* @__PURE__ */ jsxs(
1193
+ RadixDialog.Content,
1194
+ {
1195
+ className: clx(
1196
+ "bg-ui-bg-base shadow-elevation-modal fixed left-[50%] top-[50%] flex max-h-[calc(100%-16px)] w-[calc(100%-16px)] min-w-0 max-w-2xl translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden rounded-xl p-0",
1197
+ {
1198
+ "h-[300px]": preserveHeight
1199
+ // Prevents the dialog from collapsing when loading async results and before the no results message is displayed
1200
+ }
1201
+ ),
1202
+ children: [
1203
+ /* @__PURE__ */ jsx4(RadixDialog.Title, { className: "sr-only", children: t2("app.search.title") }),
1204
+ /* @__PURE__ */ jsx4(RadixDialog.Description, { className: "sr-only", children: t2("app.search.description") }),
1205
+ /* @__PURE__ */ jsx4(CommandPalette, { className: "[&_[cmdk-group-heading]]:text-muted-foreground flex h-full flex-col overflow-hidden [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0", children }),
1206
+ /* @__PURE__ */ jsx4("div", { className: "bg-ui-bg-field text-ui-fg-subtle flex items-center justify-end border-t px-4 py-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
1207
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
1208
+ /* @__PURE__ */ jsx4(Text, { size: "xsmall", leading: "compact", children: t2("app.search.navigation") }),
1209
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
1210
+ /* @__PURE__ */ jsx4(Kbd, { className: "bg-ui-bg-field-component", children: "\u2193" }),
1211
+ /* @__PURE__ */ jsx4(Kbd, { className: "bg-ui-bg-field-component", children: "\u2191" })
1212
+ ] })
1213
+ ] }),
1214
+ /* @__PURE__ */ jsx4("div", { className: "bg-ui-border-strong h-3 w-px" }),
1215
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
1216
+ /* @__PURE__ */ jsx4(Text, { size: "xsmall", leading: "compact", children: t2("app.search.openResult") }),
1217
+ /* @__PURE__ */ jsx4(Kbd, { className: "bg-ui-bg-field-component", children: "\u21B5" })
1218
+ ] })
1219
+ ] }) })
1220
+ ]
1221
+ }
1222
+ )
1223
+ ] }) });
1224
+ };
1225
+ var CommandInput = forwardRef(
1226
+ ({
1227
+ className,
1228
+ value,
1229
+ onValueChange,
1230
+ area,
1231
+ setArea,
1232
+ isFetching,
1233
+ onBack,
1234
+ ...props
1235
+ }, ref) => {
1236
+ const { t: t2 } = useTranslation3();
1237
+ const innerRef = useRef(null);
1238
+ const direction = useDocumentDirection();
1239
+ useImperativeHandle(
1240
+ ref,
1241
+ () => innerRef.current
1242
+ );
1243
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col border-b", children: [
1244
+ /* @__PURE__ */ jsx4("div", { className: "px-4 pt-4", children: /* @__PURE__ */ jsxs(DropdownMenu, { dir: direction, children: [
1245
+ /* @__PURE__ */ jsx4(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
1246
+ Badge,
1247
+ {
1248
+ size: "2xsmall",
1249
+ className: "hover:bg-ui-bg-base-pressed transition-fg cursor-pointer",
1250
+ children: [
1251
+ t2(`app.search.groups.${area}`),
1252
+ /* @__PURE__ */ jsx4(TriangleDownMini, { className: "text-ui-fg-muted" })
1253
+ ]
1254
+ }
1255
+ ) }),
1256
+ /* @__PURE__ */ jsx4(
1257
+ DropdownMenu.Content,
1258
+ {
1259
+ align: "start",
1260
+ className: "h-full max-h-[360px] overflow-auto",
1261
+ onCloseAutoFocus: (e) => {
1262
+ e.preventDefault();
1263
+ innerRef.current?.focus();
1264
+ },
1265
+ children: /* @__PURE__ */ jsx4(
1266
+ DropdownMenu.RadioGroup,
1267
+ {
1268
+ value: area,
1269
+ onValueChange: (v) => setArea(v),
1270
+ children: SEARCH_AREAS.map((area2) => /* @__PURE__ */ jsxs(Fragment, { children: [
1271
+ area2 === "command" && /* @__PURE__ */ jsx4(DropdownMenu.Separator, {}),
1272
+ /* @__PURE__ */ jsx4(DropdownMenu.RadioItem, { value: area2, children: t2(`app.search.groups.${area2}`) }),
1273
+ area2 === "all" && /* @__PURE__ */ jsx4(DropdownMenu.Separator, {})
1274
+ ] }, area2))
1275
+ }
1276
+ )
1277
+ }
1278
+ )
1279
+ ] }) }),
1280
+ /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-x-2 px-4 py-3", children: [
1281
+ onBack && /* @__PURE__ */ jsx4(
1282
+ IconButton,
1283
+ {
1284
+ type: "button",
1285
+ size: "small",
1286
+ variant: "transparent",
1287
+ onClick: onBack,
1288
+ children: /* @__PURE__ */ jsx4(ArrowUturnLeft, { className: "text-ui-fg-muted" })
1289
+ }
1290
+ ),
1291
+ /* @__PURE__ */ jsx4(
1292
+ Command.Input,
1293
+ {
1294
+ ref: innerRef,
1295
+ value,
1296
+ onValueChange,
1297
+ className: clx(
1298
+ "placeholder:text-ui-fg-muted flex !h-6 w-full rounded-md bg-transparent text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
1299
+ className
1300
+ ),
1301
+ ...props
1302
+ }
1303
+ ),
1304
+ /* @__PURE__ */ jsxs("div", { className: "absolute end-4 top-1/2 flex -translate-y-1/2 items-center justify-end gap-x-2", children: [
1305
+ isFetching && /* @__PURE__ */ jsx4(Spinner, { className: "text-ui-fg-muted animate-spin" }),
1306
+ value && /* @__PURE__ */ jsx4(
1307
+ Button,
1308
+ {
1309
+ variant: "transparent",
1310
+ size: "small",
1311
+ className: "text-ui-fg-muted hover:text-ui-fg-subtle",
1312
+ type: "button",
1313
+ onClick: () => {
1314
+ onValueChange?.("");
1315
+ innerRef.current?.focus();
1316
+ },
1317
+ children: t2("actions.clear")
1318
+ }
1319
+ )
1320
+ ] })
1321
+ ] })
1322
+ ] });
1323
+ }
1324
+ );
1325
+ CommandInput.displayName = Command.Input.displayName;
1326
+ var CommandList = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
1327
+ Command.List,
1328
+ {
1329
+ ref,
1330
+ className: clx(
1331
+ "max-h-[300px] flex-1 overflow-y-auto overflow-x-hidden px-2 pb-4",
1332
+ className
1333
+ ),
1334
+ ...props
1335
+ }
1336
+ ));
1337
+ CommandList.displayName = Command.List.displayName;
1338
+ var CommandEmpty = forwardRef((props, ref) => {
1339
+ const { t: t2 } = useTranslation3();
1340
+ return /* @__PURE__ */ jsx4(Command.Empty, { ref, className: "py-6 text-center text-sm", ...props, children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex min-h-[236px] flex-col items-center justify-center gap-y-3", children: [
1341
+ /* @__PURE__ */ jsx4(MagnifyingGlass, { className: "text-ui-fg-subtle" }),
1342
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-y-1", children: [
1343
+ /* @__PURE__ */ jsx4(Text, { size: "small", weight: "plus", leading: "compact", children: props.q ? t2("app.search.noResultsTitle") : t2("app.search.emptySearchTitle") }),
1344
+ /* @__PURE__ */ jsx4(Text, { size: "small", className: "text-ui-fg-muted", children: props.q ? t2("app.search.noResultsMessage") : t2("app.search.emptySearchMessage") })
1345
+ ] })
1346
+ ] }) });
1347
+ });
1348
+ CommandEmpty.displayName = Command.Empty.displayName;
1349
+ var CommandLoading = forwardRef((props, ref) => {
1350
+ return /* @__PURE__ */ jsxs(
1351
+ Command.Loading,
1352
+ {
1353
+ ref,
1354
+ ...props,
1355
+ className: "bg-ui-bg-base flex flex-col",
1356
+ children: [
1357
+ /* @__PURE__ */ jsx4("div", { className: "w-full px-2 pb-1 pt-3", children: /* @__PURE__ */ jsx4(Skeleton, { className: "h-5 w-10" }) }),
1358
+ Array.from({ length: 7 }).map((_, index) => /* @__PURE__ */ jsx4("div", { className: "w-full p-2", children: /* @__PURE__ */ jsx4(Skeleton, { className: "h-5 w-full" }) }, index))
1359
+ ]
1360
+ }
1361
+ );
1362
+ });
1363
+ CommandLoading.displayName = Command.Loading.displayName;
1364
+ var CommandGroup = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
1365
+ Command.Group,
1366
+ {
1367
+ ref,
1368
+ className: clx(
1369
+ "text-ui-fg-base [&_[cmdk-group-heading]]:text-ui-fg-muted [&_[cmdk-group-heading]]:txt-compact-xsmall-plus overflow-hidden [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-item]]:py-2",
1370
+ className
1371
+ ),
1372
+ ...props
1373
+ }
1374
+ ));
1375
+ CommandGroup.displayName = Command.Group.displayName;
1376
+ var CommandSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
1377
+ Command.Separator,
1378
+ {
1379
+ ref,
1380
+ className: clx("bg-border -mx-1 h-px", className),
1381
+ ...props
1382
+ }
1383
+ ));
1384
+ CommandSeparator.displayName = Command.Separator.displayName;
1385
+ var CommandItem = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
1386
+ Command.Item,
1387
+ {
1388
+ ref,
1389
+ className: clx(
1390
+ "aria-selected:bg-ui-bg-base-hover focus-visible:bg-ui-bg-base-hover txt-compact-small [&>svg]:text-ui-fg-subtle relative flex cursor-pointer select-none items-center gap-x-3 rounded-md p-2 outline-none data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
1391
+ className
1392
+ ),
1393
+ ...props
1394
+ }
1395
+ ));
1396
+ CommandItem.displayName = Command.Item.displayName;
1397
+
1398
+ // src/providers/search-provider/search-context.tsx
1399
+ import { createContext as createContext4 } from "react";
1400
+ var SearchContext = createContext4(null);
1401
+
1402
+ // src/providers/search-provider/search-provider.tsx
1403
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
1404
+ var SearchProvider = ({ children }) => {
1405
+ const [open, setOpen] = useState7(false);
1406
+ const { mobile, toggle } = useSidebar();
1407
+ const toggleSearch = () => {
1408
+ const update = !open;
1409
+ if (update && mobile) {
1410
+ toggle("mobile");
1411
+ }
1412
+ setOpen(update);
1413
+ };
1414
+ useEffect6(() => {
1415
+ const onKeyDown = (e) => {
1416
+ if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
1417
+ setOpen((prev) => !prev);
1418
+ }
1419
+ };
1420
+ document.addEventListener("keydown", onKeyDown);
1421
+ return () => {
1422
+ document.removeEventListener("keydown", onKeyDown);
1423
+ };
1424
+ }, []);
1425
+ return /* @__PURE__ */ jsxs2(
1426
+ SearchContext.Provider,
1427
+ {
1428
+ value: {
1429
+ open,
1430
+ onOpenChange: setOpen,
1431
+ toggleSearch
1432
+ },
1433
+ children: [
1434
+ children,
1435
+ /* @__PURE__ */ jsx5(Search, {})
1436
+ ]
1437
+ }
1438
+ );
1439
+ };
1440
+
1441
+ // src/providers/search-provider/use-search.tsx
1442
+ import { useContext as useContext4 } from "react";
1443
+ var useSearch = () => {
1444
+ const context = useContext4(SearchContext);
1445
+ if (!context) {
1446
+ throw new Error("useSearch must be used within a SearchProvider");
1447
+ }
1448
+ return context;
1449
+ };
1450
+
1451
+ // src/app.tsx
1452
+ import { I18nProvider, Toaster, TooltipProvider } from "@medusajs/ui";
1453
+ import { createBrowserRouter, RouterProvider } from "react-router-dom";
1454
+
1455
+ // src/get-route-map.tsx
1456
+ import { t } from "i18next";
1457
+ import { Outlet as Outlet4 } from "react-router-dom";
1458
+
1459
+ // src/components/authentication/protected-route/protected-route.tsx
1460
+ import { Spinner as Spinner2 } from "@medusajs/icons";
1461
+ import { Navigate, Outlet, useLocation as useLocation3 } from "react-router-dom";
1462
+ import { jsx as jsx6 } from "react/jsx-runtime";
1463
+ var ProtectedRoute = () => {
1464
+ const { user, isLoading } = useMe();
1465
+ const location = useLocation3();
1466
+ if (isLoading) {
1467
+ return /* @__PURE__ */ jsx6("div", { className: "flex min-h-screen items-center justify-center", children: /* @__PURE__ */ jsx6(Spinner2, { className: "text-ui-fg-interactive animate-spin" }) });
1468
+ }
1469
+ if (!user) {
1470
+ return /* @__PURE__ */ jsx6(Navigate, { to: "/login", state: { from: location }, replace: true });
1471
+ }
1472
+ return /* @__PURE__ */ jsx6(SidebarProvider, { children: /* @__PURE__ */ jsx6(SearchProvider, { children: /* @__PURE__ */ jsx6(Outlet, {}) }) });
1473
+ };
1474
+
1475
+ // src/components/layout/main-layout/main-layout.tsx
1476
+ import {
1477
+ BuildingStorefront,
1478
+ Buildings,
1479
+ CogSixTooth,
1480
+ CurrencyDollar,
1481
+ EllipsisHorizontal as EllipsisHorizontal2,
1482
+ MagnifyingGlass as MagnifyingGlass2,
1483
+ OpenRectArrowOut as OpenRectArrowOut2,
1484
+ ReceiptPercent,
1485
+ Shopping,
1486
+ ShoppingCart,
1487
+ Tag,
1488
+ Users
1489
+ } from "@medusajs/icons";
1490
+ import { Avatar as Avatar2, Divider, DropdownMenu as DropdownMenu3, Text as Text5, clx as clx6 } from "@medusajs/ui";
1491
+ import { useTranslation as useTranslation8 } from "react-i18next";
1492
+ import { Link as Link3, useLocation as useLocation6, useNavigate as useNavigate4 } from "react-router-dom";
1493
+
1494
+ // src/components/layout/nav-item/nav-item.tsx
1495
+ import {
1496
+ useCallback as useCallback5,
1497
+ useEffect as useEffect7,
1498
+ useState as useState8
1499
+ } from "react";
1500
+ import { Kbd as Kbd2, Text as Text2, clx as clx2 } from "@medusajs/ui";
1501
+ import { Collapsible as RadixCollapsible } from "radix-ui";
1502
+ import { useTranslation as useTranslation4 } from "react-i18next";
1503
+ import { NavLink, useLocation as useLocation4 } from "react-router-dom";
1504
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
1505
+ var BASE_NAV_LINK_CLASSES = "text-ui-fg-subtle transition-fg hover:bg-ui-bg-subtle-hover flex items-center gap-x-2 rounded-md py-0.5 pl-0.5 pr-2 outline-none [&>svg]:text-ui-fg-subtle focus-visible:shadow-borders-focus";
1506
+ var ACTIVE_NAV_LINK_CLASSES = "bg-ui-bg-base shadow-elevation-card-rest text-ui-fg-base hover:bg-ui-bg-base";
1507
+ var NESTED_NAV_LINK_CLASSES = "pl-[34px] pr-2 py-1 w-full text-ui-fg-muted";
1508
+ var SETTING_NAV_LINK_CLASSES = "pl-2 py-1";
1509
+ var getIsOpen = (to, items, pathname) => {
1510
+ return [to, ...items?.map((i) => i.to) ?? []].some(
1511
+ (p) => pathname.startsWith(p)
1512
+ );
1513
+ };
1514
+ var NavItemTooltip = ({
1515
+ to,
1516
+ children
1517
+ }) => {
1518
+ const { t: t2 } = useTranslation4();
1519
+ const globalShortcuts = useGlobalShortcuts();
1520
+ const shortcut = globalShortcuts.find((s) => s.to === to);
1521
+ return /* @__PURE__ */ jsx7(
1522
+ ConditionalTooltip,
1523
+ {
1524
+ showTooltip: !!shortcut,
1525
+ maxWidth: 9999,
1526
+ content: /* @__PURE__ */ jsxs3("div", { className: "txt-compact-xsmall flex h-5 items-center justify-between gap-x-2 whitespace-nowrap", children: [
1527
+ /* @__PURE__ */ jsx7("span", { children: shortcut?.label }),
1528
+ /* @__PURE__ */ jsx7("div", { className: "flex items-center gap-x-1", children: shortcut?.keys.Mac?.map((key, index) => /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-1", children: [
1529
+ /* @__PURE__ */ jsx7(Kbd2, { children: key }, key),
1530
+ index < (shortcut.keys.Mac?.length || 0) - 1 && /* @__PURE__ */ jsx7("span", { className: "txt-compact-xsmall text-ui-fg-muted", children: t2("app.keyboardShortcuts.then") })
1531
+ ] }, index)) })
1532
+ ] }),
1533
+ side: "right",
1534
+ delayDuration: 1500,
1535
+ children: /* @__PURE__ */ jsx7("div", { className: "w-full", children })
1536
+ }
1537
+ );
1538
+ };
1539
+ var NavItem = ({
1540
+ icon,
1541
+ label,
1542
+ to,
1543
+ items,
1544
+ type = "core",
1545
+ from
1546
+ }) => {
1547
+ const { pathname } = useLocation4();
1548
+ const [open, setOpen] = useState8(getIsOpen(to, items, pathname));
1549
+ useEffect7(() => {
1550
+ setOpen(getIsOpen(to, items, pathname));
1551
+ }, [pathname, to, items]);
1552
+ const navLinkClassNames = useCallback5(
1553
+ ({
1554
+ to: to2,
1555
+ isActive,
1556
+ isNested = false,
1557
+ isSetting: isSetting2 = false
1558
+ }) => {
1559
+ if (["core", "setting"].includes(type)) {
1560
+ isActive = pathname.startsWith(to2);
1561
+ }
1562
+ return clx2(BASE_NAV_LINK_CLASSES, {
1563
+ [NESTED_NAV_LINK_CLASSES]: isNested,
1564
+ [ACTIVE_NAV_LINK_CLASSES]: isActive,
1565
+ [SETTING_NAV_LINK_CLASSES]: isSetting2
1566
+ });
1567
+ },
1568
+ [type, pathname]
1569
+ );
1570
+ const isSetting = type === "setting";
1571
+ return /* @__PURE__ */ jsxs3(
1572
+ "div",
1573
+ {
1574
+ className: "px-3",
1575
+ "data-testid": `sidebar-nav-item-${to.replace(/\//g, "-").replace(/^-/, "")}`,
1576
+ children: [
1577
+ /* @__PURE__ */ jsx7(NavItemTooltip, { to, children: /* @__PURE__ */ jsxs3(
1578
+ NavLink,
1579
+ {
1580
+ to,
1581
+ end: items?.some((i) => i.to === pathname),
1582
+ state: from ? {
1583
+ from
1584
+ } : void 0,
1585
+ className: ({ isActive }) => {
1586
+ return clx2(navLinkClassNames({ isActive, isSetting, to }), {
1587
+ "max-lg:hidden": !!items?.length
1588
+ });
1589
+ },
1590
+ "data-testid": `sidebar-nav-link-${to.replace(/\//g, "-").replace(/^-/, "")}`,
1591
+ children: [
1592
+ type !== "setting" && /* @__PURE__ */ jsx7("div", { className: "flex size-6 items-center justify-center", children: /* @__PURE__ */ jsx7(Icon, { icon, type }) }),
1593
+ /* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: label })
1594
+ ]
1595
+ }
1596
+ ) }),
1597
+ items && items.length > 0 && /* @__PURE__ */ jsxs3(RadixCollapsible.Root, { open, onOpenChange: setOpen, children: [
1598
+ /* @__PURE__ */ jsxs3(
1599
+ RadixCollapsible.Trigger,
1600
+ {
1601
+ className: clx2(
1602
+ "flex w-full items-center gap-x-2 rounded-md py-0.5 pl-0.5 pr-2 text-ui-fg-subtle outline-none transition-fg hover:bg-ui-bg-subtle-hover hover:text-ui-fg-base lg:hidden",
1603
+ { "pl-2": isSetting }
1604
+ ),
1605
+ children: [
1606
+ /* @__PURE__ */ jsx7("div", { className: "flex size-6 items-center justify-center", children: /* @__PURE__ */ jsx7(Icon, { icon, type }) }),
1607
+ /* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: label })
1608
+ ]
1609
+ }
1610
+ ),
1611
+ /* @__PURE__ */ jsx7(RadixCollapsible.Content, { children: /* @__PURE__ */ jsx7(
1612
+ "div",
1613
+ {
1614
+ className: "flex flex-col gap-y-0.5 pb-2 pt-0.5",
1615
+ "data-testid": `sidebar-nav-nested-items-${to.replace(/\//g, "-").replace(/^-/, "")}`,
1616
+ children: /* @__PURE__ */ jsxs3("ul", { className: "flex flex-col gap-y-0.5", children: [
1617
+ /* @__PURE__ */ jsx7("li", { className: "flex w-full items-center gap-x-1 lg:hidden", children: /* @__PURE__ */ jsx7(NavItemTooltip, { to, children: /* @__PURE__ */ jsx7(
1618
+ NavLink,
1619
+ {
1620
+ to,
1621
+ end: true,
1622
+ className: ({ isActive }) => {
1623
+ return clx2(
1624
+ navLinkClassNames({
1625
+ to,
1626
+ isActive,
1627
+ isSetting,
1628
+ isNested: true
1629
+ })
1630
+ );
1631
+ },
1632
+ "data-testid": `sidebar-nav-link-nested-${to.replace(/\//g, "-").replace(/^-/, "")}`,
1633
+ children: /* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: label })
1634
+ }
1635
+ ) }) }),
1636
+ items.map((item) => {
1637
+ return /* @__PURE__ */ jsx7("li", { className: "flex h-7 items-center", children: /* @__PURE__ */ jsx7(NavItemTooltip, { to: item.to, children: /* @__PURE__ */ jsx7(
1638
+ NavLink,
1639
+ {
1640
+ to: item.to,
1641
+ end: true,
1642
+ className: ({ isActive }) => {
1643
+ return clx2(
1644
+ navLinkClassNames({
1645
+ to: item.to,
1646
+ isActive,
1647
+ isSetting,
1648
+ isNested: true
1649
+ })
1650
+ );
1651
+ },
1652
+ "data-testid": `sidebar-nav-link-nested-${item.to.replace(/\//g, "-").replace(/^-/, "")}`,
1653
+ children: /* @__PURE__ */ jsx7(Text2, { size: "small", weight: "plus", leading: "compact", children: item.label })
1654
+ }
1655
+ ) }) }, item.to);
1656
+ })
1657
+ ] })
1658
+ }
1659
+ ) })
1660
+ ] })
1661
+ ]
1662
+ }
1663
+ );
1664
+ };
1665
+ var Icon = ({ icon, type }) => {
1666
+ if (!icon) {
1667
+ return null;
1668
+ }
1669
+ return type === "extension" ? /* @__PURE__ */ jsx7("div", { className: "flex h-5 w-5 items-center justify-center rounded-[4px] bg-ui-bg-base shadow-borders-base", children: /* @__PURE__ */ jsx7("div", { className: "h-[15px] w-[15px] overflow-hidden rounded-sm", children: icon }) }) : icon;
1670
+ };
1671
+
1672
+ // src/components/layout/shell/shell.tsx
1673
+ import { SidebarLeft, TriangleRightMini, XMark } from "@medusajs/icons";
1674
+ import { IconButton as IconButton3, clx as clx4 } from "@medusajs/ui";
1675
+ import { AnimatePresence } from "motion/react";
1676
+ import { Dialog as RadixDialog2 } from "radix-ui";
1677
+ import { useEffect as useEffect9, useState as useState10 } from "react";
1678
+ import { useTranslation as useTranslation6 } from "react-i18next";
1679
+ import {
1680
+ Link,
1681
+ Outlet as Outlet2,
1682
+ useMatches,
1683
+ useNavigation
1684
+ } from "react-router-dom";
1685
+
1686
+ // src/components/layout/notifications/notifications.tsx
1687
+ import {
1688
+ BellAlert,
1689
+ BellAlertDone,
1690
+ InformationCircleSolid
1691
+ } from "@medusajs/icons";
1692
+ import { clx as clx3, Drawer, Heading, IconButton as IconButton2, Text as Text3 } from "@medusajs/ui";
1693
+ import { formatDistance } from "date-fns";
1694
+ import { useEffect as useEffect8, useState as useState9 } from "react";
1695
+ import { useTranslation as useTranslation5 } from "react-i18next";
1696
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1697
+ var LAST_READ_NOTIFICATION_KEY = "notificationsLastReadAt";
1698
+ var Notifications = () => {
1699
+ const { t: t2 } = useTranslation5();
1700
+ const [open, setOpen] = useState9(false);
1701
+ const [hasUnread, setHasUnread] = useUnreadNotifications();
1702
+ const [lastReadAt, setLastReadAt] = useState9(
1703
+ localStorage.getItem(LAST_READ_NOTIFICATION_KEY)
1704
+ );
1705
+ useEffect8(() => {
1706
+ const onKeyDown = (e) => {
1707
+ if (e.key === "n" && (e.metaKey || e.ctrlKey)) {
1708
+ setOpen((prev) => !prev);
1709
+ }
1710
+ };
1711
+ document.addEventListener("keydown", onKeyDown);
1712
+ return () => {
1713
+ document.removeEventListener("keydown", onKeyDown);
1714
+ };
1715
+ }, []);
1716
+ const handleOnOpen = (shouldOpen) => {
1717
+ if (shouldOpen) {
1718
+ setHasUnread(false);
1719
+ setOpen(true);
1720
+ localStorage.setItem(
1721
+ LAST_READ_NOTIFICATION_KEY,
1722
+ (/* @__PURE__ */ new Date()).toISOString()
1723
+ );
1724
+ } else {
1725
+ setOpen(false);
1726
+ setLastReadAt(localStorage.getItem(LAST_READ_NOTIFICATION_KEY));
1727
+ }
1728
+ };
1729
+ return /* @__PURE__ */ jsxs4(
1730
+ Drawer,
1731
+ {
1732
+ open,
1733
+ onOpenChange: handleOnOpen,
1734
+ "data-testid": "notifications-drawer",
1735
+ children: [
1736
+ /* @__PURE__ */ jsx8(Drawer.Trigger, { asChild: true, children: /* @__PURE__ */ jsx8(
1737
+ IconButton2,
1738
+ {
1739
+ variant: "transparent",
1740
+ size: "small",
1741
+ className: "text-ui-fg-muted hover:text-ui-fg-subtle",
1742
+ "data-testid": "notifications-trigger-button",
1743
+ children: hasUnread ? /* @__PURE__ */ jsx8(BellAlertDone, { "data-testid": "notifications-icon-unread" }) : /* @__PURE__ */ jsx8(BellAlert, { "data-testid": "notifications-icon" })
1744
+ }
1745
+ ) }),
1746
+ /* @__PURE__ */ jsxs4(Drawer.Content, { "data-testid": "notifications-content", children: [
1747
+ /* @__PURE__ */ jsxs4(Drawer.Header, { "data-testid": "notifications-header", children: [
1748
+ /* @__PURE__ */ jsx8(Drawer.Title, { asChild: true, children: /* @__PURE__ */ jsx8(Heading, { "data-testid": "notifications-title", children: t2("notifications.domain") }) }),
1749
+ /* @__PURE__ */ jsx8(
1750
+ Drawer.Description,
1751
+ {
1752
+ className: "sr-only",
1753
+ "data-testid": "notifications-description",
1754
+ children: t2("notifications.accessibility.description")
1755
+ }
1756
+ )
1757
+ ] }),
1758
+ /* @__PURE__ */ jsx8(
1759
+ Drawer.Body,
1760
+ {
1761
+ className: "overflow-y-auto px-0",
1762
+ "data-testid": "notifications-body",
1763
+ children: /* @__PURE__ */ jsx8("div", { "data-testid": "notifications-list", children: /* @__PURE__ */ jsx8(
1764
+ InfiniteList,
1765
+ {
1766
+ responseKey: "notifications",
1767
+ queryKey: notificationQueryKeys.all,
1768
+ queryFn: (params) => sdk.admin.notifications.query({
1769
+ ...params
1770
+ }),
1771
+ queryOptions: { enabled: open },
1772
+ renderEmpty: () => /* @__PURE__ */ jsx8(NotificationsEmptyState, { t: t2 }),
1773
+ renderItem: (notification) => {
1774
+ return /* @__PURE__ */ jsx8(
1775
+ Notification,
1776
+ {
1777
+ notification,
1778
+ unread: Date.parse(notification.created_at) > (lastReadAt ? Date.parse(lastReadAt) : 0)
1779
+ },
1780
+ notification.id
1781
+ );
1782
+ }
1783
+ }
1784
+ ) })
1785
+ }
1786
+ )
1787
+ ] })
1788
+ ]
1789
+ }
1790
+ );
1791
+ };
1792
+ var Notification = ({
1793
+ notification,
1794
+ unread
1795
+ }) => {
1796
+ const data = notification.data;
1797
+ if (!data?.title) {
1798
+ return null;
1799
+ }
1800
+ return /* @__PURE__ */ jsx8(Fragment2, { children: /* @__PURE__ */ jsxs4(
1801
+ "div",
1802
+ {
1803
+ className: "relative flex items-start justify-center gap-3 border-b p-6",
1804
+ "data-testid": `notification-${notification.id}`,
1805
+ children: [
1806
+ /* @__PURE__ */ jsx8(
1807
+ "div",
1808
+ {
1809
+ className: "text-ui-fg-muted flex size-5 items-center justify-center",
1810
+ "data-testid": `notification-${notification.id}-icon`,
1811
+ children: /* @__PURE__ */ jsx8(InformationCircleSolid, {})
1812
+ }
1813
+ ),
1814
+ /* @__PURE__ */ jsxs4(
1815
+ "div",
1816
+ {
1817
+ className: "flex w-full flex-col gap-y-3",
1818
+ "data-testid": `notification-${notification.id}-content`,
1819
+ children: [
1820
+ /* @__PURE__ */ jsxs4(
1821
+ "div",
1822
+ {
1823
+ className: "flex flex-col",
1824
+ "data-testid": `notification-${notification.id}-header`,
1825
+ children: [
1826
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
1827
+ /* @__PURE__ */ jsx8(
1828
+ Text3,
1829
+ {
1830
+ size: "small",
1831
+ leading: "compact",
1832
+ weight: "plus",
1833
+ "data-testid": `notification-${notification.id}-title`,
1834
+ children: data.title
1835
+ }
1836
+ ),
1837
+ /* @__PURE__ */ jsxs4(
1838
+ "div",
1839
+ {
1840
+ className: "align-center flex items-center justify-center gap-2",
1841
+ "data-testid": `notification-${notification.id}-meta`,
1842
+ children: [
1843
+ /* @__PURE__ */ jsx8(
1844
+ Text3,
1845
+ {
1846
+ as: "span",
1847
+ className: clx3("text-ui-fg-subtle", {
1848
+ "text-ui-fg-base": unread
1849
+ }),
1850
+ size: "small",
1851
+ leading: "compact",
1852
+ weight: "plus",
1853
+ "data-testid": `notification-${notification.id}-time`,
1854
+ children: formatDistance(notification.created_at, /* @__PURE__ */ new Date(), {
1855
+ addSuffix: true
1856
+ })
1857
+ }
1858
+ ),
1859
+ unread && /* @__PURE__ */ jsx8(
1860
+ "div",
1861
+ {
1862
+ className: "bg-ui-bg-interactive h-2 w-2 rounded",
1863
+ role: "status",
1864
+ "data-testid": `notification-${notification.id}-unread-indicator`
1865
+ }
1866
+ )
1867
+ ]
1868
+ }
1869
+ )
1870
+ ] }),
1871
+ !!data.description && /* @__PURE__ */ jsx8(
1872
+ Text3,
1873
+ {
1874
+ className: "text-ui-fg-subtle whitespace-pre-line",
1875
+ size: "small",
1876
+ "data-testid": `notification-${notification.id}-description`,
1877
+ children: data.description
1878
+ }
1879
+ )
1880
+ ]
1881
+ }
1882
+ ),
1883
+ !!data?.file?.url && /* @__PURE__ */ jsx8(
1884
+ FilePreview,
1885
+ {
1886
+ filename: data.file.filename ?? "",
1887
+ url: data.file.url,
1888
+ hideThumbnail: true,
1889
+ "data-testid": `notification-${notification.id}-file`
1890
+ }
1891
+ )
1892
+ ]
1893
+ }
1894
+ )
1895
+ ]
1896
+ }
1897
+ ) });
1898
+ };
1899
+ var NotificationsEmptyState = ({ t: t2 }) => {
1900
+ return /* @__PURE__ */ jsxs4(
1901
+ "div",
1902
+ {
1903
+ className: "flex h-full flex-col items-center justify-center",
1904
+ "data-testid": "notifications-empty-state",
1905
+ children: [
1906
+ /* @__PURE__ */ jsx8(BellAlertDone, { "data-testid": "notifications-empty-icon" }),
1907
+ /* @__PURE__ */ jsx8(
1908
+ Text3,
1909
+ {
1910
+ size: "small",
1911
+ leading: "compact",
1912
+ weight: "plus",
1913
+ className: "mt-3",
1914
+ "data-testid": "notifications-empty-title",
1915
+ children: t2("notifications.emptyState.title")
1916
+ }
1917
+ ),
1918
+ /* @__PURE__ */ jsx8(
1919
+ Text3,
1920
+ {
1921
+ size: "small",
1922
+ className: "text-ui-fg-muted mt-1 max-w-[294px] text-center",
1923
+ "data-testid": "notifications-empty-description",
1924
+ children: t2("notifications.emptyState.description")
1925
+ }
1926
+ )
1927
+ ]
1928
+ }
1929
+ );
1930
+ };
1931
+ var useUnreadNotifications = () => {
1932
+ const [hasUnread, setHasUnread] = useState9(false);
1933
+ const { notifications } = useNotifications(
1934
+ { limit: 1, offset: 0, fields: "created_at" },
1935
+ { refetchInterval: 6e4 }
1936
+ );
1937
+ const lastNotification = notifications?.[0];
1938
+ useEffect8(() => {
1939
+ if (!lastNotification) {
1940
+ return;
1941
+ }
1942
+ const lastNotificationAsTimestamp = Date.parse(lastNotification.created_at);
1943
+ const lastReadDatetime = localStorage.getItem(LAST_READ_NOTIFICATION_KEY);
1944
+ const lastReadAsTimestamp = lastReadDatetime ? Date.parse(lastReadDatetime) : 0;
1945
+ if (lastNotificationAsTimestamp > lastReadAsTimestamp) {
1946
+ setHasUnread(true);
1947
+ }
1948
+ }, [lastNotification]);
1949
+ return [hasUnread, setHasUnread];
1950
+ };
1951
+
1952
+ // src/components/layout/shell/shell.tsx
1953
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1954
+ var Shell = ({ children }) => {
1955
+ const globalShortcuts = useGlobalShortcuts();
1956
+ const navigation = useNavigation();
1957
+ const loading = navigation.state === "loading";
1958
+ return /* @__PURE__ */ jsx9(KeybindProvider, { shortcuts: globalShortcuts, children: /* @__PURE__ */ jsxs5("div", { className: "relative flex h-screen flex-col items-start overflow-hidden lg:flex-row", children: [
1959
+ /* @__PURE__ */ jsx9(NavigationBar, { loading }),
1960
+ /* @__PURE__ */ jsxs5("div", { children: [
1961
+ /* @__PURE__ */ jsx9(MobileSidebarContainer, { children }),
1962
+ /* @__PURE__ */ jsx9(DesktopSidebarContainer, { children })
1963
+ ] }),
1964
+ /* @__PURE__ */ jsxs5("div", { className: "flex h-screen w-full flex-col overflow-auto", children: [
1965
+ /* @__PURE__ */ jsx9(Topbar, {}),
1966
+ /* @__PURE__ */ jsx9(
1967
+ "main",
1968
+ {
1969
+ className: clx4(
1970
+ "flex h-full w-full flex-col items-center overflow-y-auto transition-opacity delay-200 duration-200",
1971
+ {
1972
+ "opacity-25": loading
1973
+ }
1974
+ ),
1975
+ children: /* @__PURE__ */ jsx9(Gutter, { children: /* @__PURE__ */ jsx9(Outlet2, {}) })
1976
+ }
1977
+ )
1978
+ ] })
1979
+ ] }) });
1980
+ };
1981
+ var NavigationBar = ({ loading }) => {
1982
+ const [showBar, setShowBar] = useState10(false);
1983
+ useEffect9(() => {
1984
+ let timeout;
1985
+ if (loading) {
1986
+ timeout = setTimeout(() => {
1987
+ setShowBar(true);
1988
+ }, 200);
1989
+ } else {
1990
+ setShowBar(false);
1991
+ }
1992
+ return () => {
1993
+ clearTimeout(timeout);
1994
+ };
1995
+ }, [loading]);
1996
+ return /* @__PURE__ */ jsx9("div", { className: "fixed inset-x-0 top-0 z-50 h-1", children: /* @__PURE__ */ jsx9(AnimatePresence, { children: showBar ? /* @__PURE__ */ jsx9(ProgressBar, {}) : null }) });
1997
+ };
1998
+ var Gutter = ({ children }) => {
1999
+ return /* @__PURE__ */ jsx9("div", { className: "flex w-full max-w-[1600px] flex-col gap-y-2 p-3", children });
2000
+ };
2001
+ var Breadcrumbs = () => {
2002
+ const matches = useMatches();
2003
+ const crumbs = matches.filter((match) => match.handle?.breadcrumb).map((match) => {
2004
+ const handle = match.handle;
2005
+ let label = void 0;
2006
+ try {
2007
+ label = handle.breadcrumb?.(match);
2008
+ } catch (error) {
2009
+ }
2010
+ if (!label) {
2011
+ return null;
2012
+ }
2013
+ return {
2014
+ label,
2015
+ path: match.pathname
2016
+ };
2017
+ }).filter(Boolean);
2018
+ return /* @__PURE__ */ jsx9(
2019
+ "ol",
2020
+ {
2021
+ className: clx4(
2022
+ "text-ui-fg-muted txt-compact-small-plus flex select-none items-center"
2023
+ ),
2024
+ children: crumbs.map((crumb, index) => {
2025
+ const isLast = index === crumbs.length - 1;
2026
+ const isSingle = crumbs.length === 1;
2027
+ return /* @__PURE__ */ jsxs5("li", { className: clx4("flex items-center"), children: [
2028
+ !isLast ? /* @__PURE__ */ jsx9(
2029
+ Link,
2030
+ {
2031
+ className: "transition-fg hover:text-ui-fg-subtle",
2032
+ to: crumb.path,
2033
+ children: crumb.label
2034
+ }
2035
+ ) : /* @__PURE__ */ jsxs5("div", { children: [
2036
+ !isSingle && /* @__PURE__ */ jsx9("span", { className: "block lg:hidden", children: "..." }),
2037
+ /* @__PURE__ */ jsx9(
2038
+ "span",
2039
+ {
2040
+ className: clx4({
2041
+ "hidden lg:block": !isSingle
2042
+ }),
2043
+ children: crumb.label
2044
+ },
2045
+ index
2046
+ )
2047
+ ] }),
2048
+ !isLast && /* @__PURE__ */ jsx9("span", { className: "mx-2", children: /* @__PURE__ */ jsx9(TriangleRightMini, { className: "rtl:rotate-180" }) })
2049
+ ] }, index);
2050
+ })
2051
+ }
2052
+ );
2053
+ };
2054
+ var ToggleSidebar = () => {
2055
+ const { toggle } = useSidebar();
2056
+ return /* @__PURE__ */ jsxs5("div", { children: [
2057
+ /* @__PURE__ */ jsx9(
2058
+ IconButton3,
2059
+ {
2060
+ className: "hidden lg:flex",
2061
+ variant: "transparent",
2062
+ onClick: () => toggle("desktop"),
2063
+ size: "small",
2064
+ children: /* @__PURE__ */ jsx9(SidebarLeft, { className: "text-ui-fg-muted rtl:rotate-180" })
2065
+ }
2066
+ ),
2067
+ /* @__PURE__ */ jsx9(
2068
+ IconButton3,
2069
+ {
2070
+ className: "hidden max-lg:flex",
2071
+ variant: "transparent",
2072
+ onClick: () => toggle("mobile"),
2073
+ size: "small",
2074
+ children: /* @__PURE__ */ jsx9(SidebarLeft, { className: "text-ui-fg-muted rtl:rotate-180" })
2075
+ }
2076
+ )
2077
+ ] });
2078
+ };
2079
+ var Topbar = () => {
2080
+ return /* @__PURE__ */ jsxs5("div", { className: "grid w-full grid-cols-2 border-b p-3", children: [
2081
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-x-1.5", children: [
2082
+ /* @__PURE__ */ jsx9(ToggleSidebar, {}),
2083
+ /* @__PURE__ */ jsx9(Breadcrumbs, {})
2084
+ ] }),
2085
+ /* @__PURE__ */ jsx9("div", { className: "flex items-center justify-end gap-x-3", children: /* @__PURE__ */ jsx9(Notifications, {}) })
2086
+ ] });
2087
+ };
2088
+ var DesktopSidebarContainer = ({ children }) => {
2089
+ const { desktop } = useSidebar();
2090
+ return /* @__PURE__ */ jsx9(
2091
+ "div",
2092
+ {
2093
+ className: clx4("hidden h-screen w-[220px] border-e", {
2094
+ "lg:flex": desktop
2095
+ }),
2096
+ children
2097
+ }
2098
+ );
2099
+ };
2100
+ var MobileSidebarContainer = ({ children }) => {
2101
+ const { t: t2 } = useTranslation6();
2102
+ const { mobile, toggle } = useSidebar();
2103
+ return /* @__PURE__ */ jsx9(RadixDialog2.Root, { open: mobile, onOpenChange: () => toggle("mobile"), children: /* @__PURE__ */ jsxs5(RadixDialog2.Portal, { children: [
2104
+ /* @__PURE__ */ jsx9(
2105
+ RadixDialog2.Overlay,
2106
+ {
2107
+ className: clx4(
2108
+ "bg-ui-bg-overlay fixed inset-0",
2109
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
2110
+ )
2111
+ }
2112
+ ),
2113
+ /* @__PURE__ */ jsxs5(
2114
+ RadixDialog2.Content,
2115
+ {
2116
+ className: clx4(
2117
+ "bg-ui-bg-subtle shadow-elevation-modal fixed inset-y-2 start-2 flex w-full max-w-[304px] flex-col overflow-hidden rounded-lg border-r",
2118
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-start-1/2 data-[state=open]:slide-in-from-start-1/2 duration-200"
2119
+ ),
2120
+ children: [
2121
+ /* @__PURE__ */ jsxs5("div", { className: "p-3", children: [
2122
+ /* @__PURE__ */ jsx9(RadixDialog2.Close, { asChild: true, children: /* @__PURE__ */ jsx9(
2123
+ IconButton3,
2124
+ {
2125
+ size: "small",
2126
+ variant: "transparent",
2127
+ className: "text-ui-fg-subtle",
2128
+ children: /* @__PURE__ */ jsx9(XMark, {})
2129
+ }
2130
+ ) }),
2131
+ /* @__PURE__ */ jsx9(RadixDialog2.Title, { className: "sr-only", children: t2("app.nav.accessibility.title") }),
2132
+ /* @__PURE__ */ jsx9(RadixDialog2.Description, { className: "sr-only", children: t2("app.nav.accessibility.description") })
2133
+ ] }),
2134
+ children
2135
+ ]
2136
+ }
2137
+ )
2138
+ ] }) });
2139
+ };
2140
+
2141
+ // src/components/layout/user-menu/user-menu.tsx
2142
+ import {
2143
+ BookOpen,
2144
+ CircleHalfSolid,
2145
+ EllipsisHorizontal,
2146
+ Keyboard,
2147
+ OpenRectArrowOut,
2148
+ TimelineVertical,
2149
+ User as UserIcon,
2150
+ XMark as XMark2
2151
+ } from "@medusajs/icons";
2152
+ import {
2153
+ Avatar,
2154
+ DropdownMenu as DropdownMenu2,
2155
+ Heading as Heading2,
2156
+ IconButton as IconButton4,
2157
+ Input,
2158
+ Kbd as Kbd3,
2159
+ Text as Text4,
2160
+ clx as clx5
2161
+ } from "@medusajs/ui";
2162
+ import { Dialog as RadixDialog3 } from "radix-ui";
2163
+ import { useTranslation as useTranslation7 } from "react-i18next";
2164
+ import { useState as useState11 } from "react";
2165
+ import { Link as Link2, useLocation as useLocation5, useNavigate as useNavigate3 } from "react-router-dom";
2166
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
2167
+ var UserMenu = () => {
2168
+ const { t: t2 } = useTranslation7();
2169
+ const location = useLocation5();
2170
+ const direction = useDocumentDirection();
2171
+ const [openMenu, setOpenMenu] = useState11(false);
2172
+ const [openModal, setOpenModal] = useState11(false);
2173
+ const toggleModal = () => {
2174
+ setOpenMenu(false);
2175
+ setOpenModal(!openModal);
2176
+ };
2177
+ return /* @__PURE__ */ jsxs6("div", { "data-testid": "sidebar-user-menu", children: [
2178
+ /* @__PURE__ */ jsxs6(DropdownMenu2, { dir: direction, open: openMenu, onOpenChange: setOpenMenu, "data-testid": "sidebar-user-menu-dropdown", children: [
2179
+ /* @__PURE__ */ jsx10(UserBadge, {}),
2180
+ /* @__PURE__ */ jsxs6(DropdownMenu2.Content, { className: "min-w-[var(--radix-dropdown-menu-trigger-width)] max-w-[var(--radix-dropdown-menu-trigger-width)]", "data-testid": "sidebar-user-menu-content", children: [
2181
+ /* @__PURE__ */ jsx10(UserItem, {}),
2182
+ /* @__PURE__ */ jsx10(DropdownMenu2.Separator, { "data-testid": "sidebar-user-menu-separator-1" }),
2183
+ /* @__PURE__ */ jsx10(DropdownMenu2.Item, { asChild: true, "data-testid": "sidebar-user-menu-profile-settings", children: /* @__PURE__ */ jsxs6(Link2, { to: "/settings/profile", state: { from: location.pathname }, children: [
2184
+ /* @__PURE__ */ jsx10(UserIcon, { className: "text-ui-fg-subtle me-2" }),
2185
+ t2("app.menus.user.profileSettings")
2186
+ ] }) }),
2187
+ /* @__PURE__ */ jsx10(DropdownMenu2.Separator, { "data-testid": "sidebar-user-menu-separator-2" }),
2188
+ /* @__PURE__ */ jsx10(DropdownMenu2.Item, { asChild: true, "data-testid": "sidebar-user-menu-documentation", children: /* @__PURE__ */ jsxs6(Link2, { to: "https://docs.medusajs.com", target: "_blank", children: [
2189
+ /* @__PURE__ */ jsx10(BookOpen, { className: "text-ui-fg-subtle me-2" }),
2190
+ t2("app.menus.user.documentation")
2191
+ ] }) }),
2192
+ /* @__PURE__ */ jsx10(DropdownMenu2.Item, { asChild: true, "data-testid": "sidebar-user-menu-changelog", children: /* @__PURE__ */ jsxs6(Link2, { to: "https://medusajs.com/changelog/", target: "_blank", children: [
2193
+ /* @__PURE__ */ jsx10(TimelineVertical, { className: "text-ui-fg-subtle me-2" }),
2194
+ t2("app.menus.user.changelog")
2195
+ ] }) }),
2196
+ /* @__PURE__ */ jsx10(DropdownMenu2.Separator, { "data-testid": "sidebar-user-menu-separator-3" }),
2197
+ /* @__PURE__ */ jsxs6(DropdownMenu2.Item, { onClick: toggleModal, "data-testid": "sidebar-user-menu-shortcuts", children: [
2198
+ /* @__PURE__ */ jsx10(Keyboard, { className: "text-ui-fg-subtle me-2" }),
2199
+ t2("app.menus.user.shortcuts")
2200
+ ] }),
2201
+ /* @__PURE__ */ jsx10(ThemeToggle, {}),
2202
+ /* @__PURE__ */ jsx10(DropdownMenu2.Separator, { "data-testid": "sidebar-user-menu-separator-4" }),
2203
+ /* @__PURE__ */ jsx10(Logout, {})
2204
+ ] })
2205
+ ] }),
2206
+ /* @__PURE__ */ jsx10(GlobalKeybindsModal, { open: openModal, onOpenChange: setOpenModal })
2207
+ ] });
2208
+ };
2209
+ var UserBadge = () => {
2210
+ const { user, isPending, isError, error } = useMe();
2211
+ const name = [user?.first_name, user?.last_name].filter(Boolean).join(" ");
2212
+ const displayName = name || user?.email;
2213
+ const fallback = displayName ? displayName[0].toUpperCase() : null;
2214
+ if (isPending) {
2215
+ return /* @__PURE__ */ jsxs6("button", { className: "shadow-borders-base flex max-w-[192px] select-none items-center gap-x-2 overflow-hidden text-ellipsis whitespace-nowrap rounded-full py-1 ps-1 pe-2.5", children: [
2216
+ /* @__PURE__ */ jsx10(Skeleton, { className: "h-5 w-5 rounded-full" }),
2217
+ /* @__PURE__ */ jsx10(Skeleton, { className: "h-[9px] w-[70px]" })
2218
+ ] });
2219
+ }
2220
+ if (isError) {
2221
+ throw error;
2222
+ }
2223
+ return /* @__PURE__ */ jsx10("div", { className: "p-3", "data-testid": "sidebar-user-menu-badge", children: /* @__PURE__ */ jsxs6(
2224
+ DropdownMenu2.Trigger,
2225
+ {
2226
+ disabled: !user,
2227
+ className: clx5(
2228
+ "bg-ui-bg-subtle grid w-full cursor-pointer grid-cols-[24px_1fr_15px] items-center gap-2 rounded-md py-1 ps-0.5 pe-2 outline-none",
2229
+ "hover:bg-ui-bg-subtle-hover",
2230
+ "data-[state=open]:bg-ui-bg-subtle-hover",
2231
+ "focus-visible:shadow-borders-focus"
2232
+ ),
2233
+ "data-testid": "sidebar-user-menu-trigger",
2234
+ children: [
2235
+ /* @__PURE__ */ jsx10("div", { className: "flex size-6 items-center justify-center", "data-testid": "sidebar-user-menu-avatar-container", children: fallback ? /* @__PURE__ */ jsx10(Avatar, { size: "xsmall", fallback, "data-testid": "sidebar-user-menu-avatar" }) : /* @__PURE__ */ jsx10(Skeleton, { className: "h-6 w-6 rounded-full" }) }),
2236
+ /* @__PURE__ */ jsx10("div", { className: "flex items-center overflow-hidden", "data-testid": "sidebar-user-menu-name-container", children: displayName ? /* @__PURE__ */ jsx10(
2237
+ Text4,
2238
+ {
2239
+ size: "xsmall",
2240
+ weight: "plus",
2241
+ leading: "compact",
2242
+ className: "truncate",
2243
+ "data-testid": "sidebar-user-menu-name",
2244
+ children: displayName
2245
+ }
2246
+ ) : /* @__PURE__ */ jsx10(Skeleton, { className: "h-[9px] w-[70px]" }) }),
2247
+ /* @__PURE__ */ jsx10(EllipsisHorizontal, { className: "text-ui-fg-muted" })
2248
+ ]
2249
+ }
2250
+ ) });
2251
+ };
2252
+ var ThemeToggle = () => {
2253
+ const { t: t2 } = useTranslation7();
2254
+ const { theme, setTheme } = useTheme();
2255
+ return /* @__PURE__ */ jsxs6(DropdownMenu2.SubMenu, { "data-testid": "sidebar-user-menu-theme-toggle", children: [
2256
+ /* @__PURE__ */ jsxs6(DropdownMenu2.SubMenuTrigger, { dir: "ltr", className: "rounded-md rtl:rotate-180", "data-testid": "sidebar-user-menu-theme-trigger", children: [
2257
+ /* @__PURE__ */ jsx10(CircleHalfSolid, { className: "text-ui-fg-subtle me-2" }),
2258
+ /* @__PURE__ */ jsx10("span", { className: "rtl:rotate-180", children: t2("app.menus.user.theme.label") })
2259
+ ] }),
2260
+ /* @__PURE__ */ jsx10(DropdownMenu2.SubMenuContent, { "data-testid": "sidebar-user-menu-theme-content", children: /* @__PURE__ */ jsxs6(DropdownMenu2.RadioGroup, { value: theme, "data-testid": "sidebar-user-menu-theme-radio-group", children: [
2261
+ /* @__PURE__ */ jsx10(
2262
+ DropdownMenu2.RadioItem,
2263
+ {
2264
+ value: "system",
2265
+ onClick: (e) => {
2266
+ e.preventDefault();
2267
+ setTheme("system");
2268
+ },
2269
+ "data-testid": "sidebar-user-menu-theme-system",
2270
+ children: t2("app.menus.user.theme.system")
2271
+ }
2272
+ ),
2273
+ /* @__PURE__ */ jsx10(
2274
+ DropdownMenu2.RadioItem,
2275
+ {
2276
+ value: "light",
2277
+ onClick: (e) => {
2278
+ e.preventDefault();
2279
+ setTheme("light");
2280
+ },
2281
+ "data-testid": "sidebar-user-menu-theme-light",
2282
+ children: t2("app.menus.user.theme.light")
2283
+ }
2284
+ ),
2285
+ /* @__PURE__ */ jsx10(
2286
+ DropdownMenu2.RadioItem,
2287
+ {
2288
+ value: "dark",
2289
+ onClick: (e) => {
2290
+ e.preventDefault();
2291
+ setTheme("dark");
2292
+ },
2293
+ "data-testid": "sidebar-user-menu-theme-dark",
2294
+ children: t2("app.menus.user.theme.dark")
2295
+ }
2296
+ )
2297
+ ] }) })
2298
+ ] });
2299
+ };
2300
+ var Logout = () => {
2301
+ const { t: t2 } = useTranslation7();
2302
+ const navigate = useNavigate3();
2303
+ const { mutateAsync: logoutMutation } = useLogout();
2304
+ const handleLogout = async () => {
2305
+ await logoutMutation(void 0, {
2306
+ onSuccess: () => {
2307
+ queryClient.clear();
2308
+ navigate("/login");
2309
+ }
2310
+ });
2311
+ };
2312
+ return /* @__PURE__ */ jsx10(DropdownMenu2.Item, { onClick: handleLogout, "data-testid": "sidebar-user-menu-logout", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-x-2", children: [
2313
+ /* @__PURE__ */ jsx10(OpenRectArrowOut, { className: "text-ui-fg-subtle" }),
2314
+ /* @__PURE__ */ jsx10("span", { children: t2("app.menus.actions.logout") })
2315
+ ] }) });
2316
+ };
2317
+ var GlobalKeybindsModal = (props) => {
2318
+ const { t: t2 } = useTranslation7();
2319
+ const globalShortcuts = useGlobalShortcuts();
2320
+ const [searchValue, onSearchValueChange] = useState11("");
2321
+ const searchResults = searchValue ? globalShortcuts.filter((shortcut) => {
2322
+ return shortcut.label.toLowerCase().includes(searchValue?.toLowerCase());
2323
+ }) : globalShortcuts;
2324
+ return /* @__PURE__ */ jsx10(RadixDialog3.Root, { ...props, "data-testid": "shortcuts-modal", children: /* @__PURE__ */ jsxs6(RadixDialog3.Portal, { children: [
2325
+ /* @__PURE__ */ jsx10(RadixDialog3.Overlay, { className: "bg-ui-bg-overlay fixed inset-0", "data-testid": "shortcuts-modal-overlay" }),
2326
+ /* @__PURE__ */ jsxs6(RadixDialog3.Content, { className: "bg-ui-bg-subtle shadow-elevation-modal fixed left-[50%] top-[50%] flex h-full max-h-[612px] w-full max-w-[560px] translate-x-[-50%] translate-y-[-50%] flex-col divide-y overflow-hidden rounded-lg", "data-testid": "shortcuts-modal-content", children: [
2327
+ /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-y-3 px-6 py-4", "data-testid": "shortcuts-modal-header", children: [
2328
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", "data-testid": "shortcuts-modal-header-top", children: [
2329
+ /* @__PURE__ */ jsxs6("div", { "data-testid": "shortcuts-modal-title-container", children: [
2330
+ /* @__PURE__ */ jsx10(RadixDialog3.Title, { asChild: true, children: /* @__PURE__ */ jsx10(Heading2, { "data-testid": "shortcuts-modal-title", children: t2("app.menus.user.shortcuts") }) }),
2331
+ /* @__PURE__ */ jsx10(RadixDialog3.Description, { className: "sr-only", "data-testid": "shortcuts-modal-description" })
2332
+ ] }),
2333
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-x-2", "data-testid": "shortcuts-modal-close-container", children: [
2334
+ /* @__PURE__ */ jsx10(Kbd3, { "data-testid": "shortcuts-modal-close-hint", children: "esc" }),
2335
+ /* @__PURE__ */ jsx10(RadixDialog3.Close, { asChild: true, children: /* @__PURE__ */ jsx10(IconButton4, { variant: "transparent", size: "small", "data-testid": "shortcuts-modal-close-button", children: /* @__PURE__ */ jsx10(XMark2, {}) }) })
2336
+ ] })
2337
+ ] }),
2338
+ /* @__PURE__ */ jsx10("div", { "data-testid": "shortcuts-modal-search-container", children: /* @__PURE__ */ jsx10(
2339
+ Input,
2340
+ {
2341
+ type: "search",
2342
+ value: searchValue,
2343
+ onChange: (e) => onSearchValueChange(e.target.value),
2344
+ "data-testid": "shortcuts-modal-search"
2345
+ }
2346
+ ) })
2347
+ ] }),
2348
+ /* @__PURE__ */ jsx10("div", { className: "flex flex-col divide-y overflow-y-auto", "data-testid": "shortcuts-modal-list", children: searchResults.map((shortcut, index) => {
2349
+ return /* @__PURE__ */ jsxs6(
2350
+ "div",
2351
+ {
2352
+ className: "text-ui-fg-subtle flex items-center justify-between px-6 py-3",
2353
+ "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}`,
2354
+ children: [
2355
+ /* @__PURE__ */ jsx10(Text4, { size: "small", "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-label`, children: shortcut.label }),
2356
+ /* @__PURE__ */ jsx10("div", { className: "flex items-center gap-x-1", "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-keys`, children: shortcut.keys.Mac?.map((key, index2) => {
2357
+ return /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-x-1", "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-key-${index2}`, children: [
2358
+ /* @__PURE__ */ jsx10(Kbd3, { "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-kbd-${index2}`, children: key }),
2359
+ index2 < (shortcut.keys.Mac?.length || 0) - 1 && /* @__PURE__ */ jsx10("span", { className: "txt-compact-xsmall text-ui-fg-subtle", "data-testid": `shortcut-item-${shortcut.label.toLowerCase().replace(/\s/g, "-")}-separator-${index2}`, children: t2("app.keyboardShortcuts.then") })
2360
+ ] }, index2);
2361
+ }) })
2362
+ ]
2363
+ },
2364
+ index
2365
+ );
2366
+ }) })
2367
+ ] })
2368
+ ] }) });
2369
+ };
2370
+ var UserItem = () => {
2371
+ const { user, isPending, isError, error } = useMe();
2372
+ const loaded = !isPending && !!user;
2373
+ if (!loaded) {
2374
+ return /* @__PURE__ */ jsx10("div", {});
2375
+ }
2376
+ const name = [user.first_name, user.last_name].filter(Boolean).join(" ");
2377
+ const email = user.email;
2378
+ const fallback = name ? name[0].toUpperCase() : email[0].toUpperCase();
2379
+ const avatar = user.avatar_url;
2380
+ if (isError) {
2381
+ throw error;
2382
+ }
2383
+ return /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-x-3 overflow-hidden px-2 py-1", "data-testid": "sidebar-user-menu-item", children: [
2384
+ /* @__PURE__ */ jsx10(
2385
+ Avatar,
2386
+ {
2387
+ size: "small",
2388
+ variant: "rounded",
2389
+ src: avatar || void 0,
2390
+ fallback,
2391
+ "data-testid": "sidebar-user-menu-item-avatar"
2392
+ }
2393
+ ),
2394
+ /* @__PURE__ */ jsxs6("div", { className: "block w-full min-w-0 max-w-[187px] overflow-hidden whitespace-nowrap", "data-testid": "sidebar-user-menu-item-details", children: [
2395
+ /* @__PURE__ */ jsx10(
2396
+ Text4,
2397
+ {
2398
+ size: "small",
2399
+ weight: "plus",
2400
+ leading: "compact",
2401
+ className: "overflow-hidden text-ellipsis whitespace-nowrap",
2402
+ "data-testid": "sidebar-user-menu-item-name",
2403
+ children: name || email
2404
+ }
2405
+ ),
2406
+ !!name && /* @__PURE__ */ jsx10(
2407
+ Text4,
2408
+ {
2409
+ size: "xsmall",
2410
+ leading: "compact",
2411
+ className: "text-ui-fg-subtle overflow-hidden text-ellipsis whitespace-nowrap",
2412
+ "data-testid": "sidebar-user-menu-item-email",
2413
+ children: email
2414
+ }
2415
+ )
2416
+ ] })
2417
+ ] });
2418
+ };
2419
+
2420
+ // src/components/layout/main-layout/main-layout.tsx
2421
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
2422
+ var MainLayout = () => {
2423
+ return /* @__PURE__ */ jsx11(Shell, { children: /* @__PURE__ */ jsx11(MainSidebar, {}) });
2424
+ };
2425
+ var MainSidebar = () => {
2426
+ return /* @__PURE__ */ jsx11(
2427
+ "aside",
2428
+ {
2429
+ className: "flex flex-1 flex-col justify-between overflow-y-auto",
2430
+ "data-testid": "sidebar",
2431
+ children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-1 flex-col", children: [
2432
+ /* @__PURE__ */ jsxs7(
2433
+ "div",
2434
+ {
2435
+ className: "sticky top-0 bg-ui-bg-subtle",
2436
+ "data-testid": "sidebar-header-section",
2437
+ children: [
2438
+ /* @__PURE__ */ jsx11(Header, {}),
2439
+ /* @__PURE__ */ jsx11("div", { className: "px-3", children: /* @__PURE__ */ jsx11(Divider, { variant: "dashed" }) })
2440
+ ]
2441
+ }
2442
+ ),
2443
+ /* @__PURE__ */ jsxs7("div", { className: "flex flex-1 flex-col justify-between", children: [
2444
+ /* @__PURE__ */ jsx11("div", { className: "flex flex-1 flex-col", children: /* @__PURE__ */ jsx11(CoreRouteSection, {}) }),
2445
+ /* @__PURE__ */ jsx11(UtilitySection, {})
2446
+ ] }),
2447
+ /* @__PURE__ */ jsx11(
2448
+ "div",
2449
+ {
2450
+ className: "sticky bottom-0 bg-ui-bg-subtle",
2451
+ "data-testid": "sidebar-user-section",
2452
+ children: /* @__PURE__ */ jsx11(UserSection, {})
2453
+ }
2454
+ )
2455
+ ] })
2456
+ }
2457
+ );
2458
+ };
2459
+ var Logout2 = () => {
2460
+ const { t: t2 } = useTranslation8();
2461
+ const navigate = useNavigate4();
2462
+ const { mutateAsync: logoutMutation } = useLogout();
2463
+ const handleLogout = async () => {
2464
+ await logoutMutation(void 0, {
2465
+ onSuccess: () => {
2466
+ queryClient.clear();
2467
+ navigate("/login");
2468
+ }
2469
+ });
2470
+ };
2471
+ return /* @__PURE__ */ jsx11(
2472
+ DropdownMenu3.Item,
2473
+ {
2474
+ onClick: handleLogout,
2475
+ "data-testid": "sidebar-header-dropdown-logout",
2476
+ children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-x-2", children: [
2477
+ /* @__PURE__ */ jsx11(OpenRectArrowOut2, { className: "text-ui-fg-subtle" }),
2478
+ /* @__PURE__ */ jsx11("span", { children: t2("app.menus.actions.logout") })
2479
+ ] })
2480
+ }
2481
+ );
2482
+ };
2483
+ var Header = () => {
2484
+ const { t: t2 } = useTranslation8();
2485
+ const { store, isPending, isError, error } = useStore();
2486
+ const direction = useDocumentDirection();
2487
+ const name = store?.name;
2488
+ const fallback = store?.name?.slice(0, 1).toUpperCase();
2489
+ const isLoaded = !isPending && !!store && !!name && !!fallback;
2490
+ if (isError) {
2491
+ throw error;
2492
+ }
2493
+ return /* @__PURE__ */ jsx11("div", { className: "w-full p-3", "data-testid": "sidebar-header-dropdown", children: /* @__PURE__ */ jsxs7(DropdownMenu3, { dir: direction, "data-testid": "sidebar-header-dropdown-menu", children: [
2494
+ /* @__PURE__ */ jsxs7(
2495
+ DropdownMenu3.Trigger,
2496
+ {
2497
+ disabled: !isLoaded,
2498
+ className: clx6(
2499
+ "grid w-full grid-cols-[24px_1fr_15px] items-center gap-x-3 rounded-md bg-ui-bg-subtle p-0.5 pe-2 outline-none transition-fg",
2500
+ "hover:bg-ui-bg-subtle-hover",
2501
+ "data-[state=open]:bg-ui-bg-subtle-hover",
2502
+ "focus-visible:shadow-borders-focus"
2503
+ ),
2504
+ "data-testid": "sidebar-header-dropdown-trigger",
2505
+ children: [
2506
+ fallback ? /* @__PURE__ */ jsx11(
2507
+ Avatar2,
2508
+ {
2509
+ variant: "squared",
2510
+ size: "xsmall",
2511
+ fallback,
2512
+ "data-testid": "sidebar-header-dropdown-avatar"
2513
+ }
2514
+ ) : /* @__PURE__ */ jsx11(Skeleton, { className: "h-6 w-6 rounded-md" }),
2515
+ /* @__PURE__ */ jsx11(
2516
+ "div",
2517
+ {
2518
+ className: "block overflow-hidden text-start",
2519
+ "data-testid": "sidebar-header-dropdown-store-name",
2520
+ children: name ? /* @__PURE__ */ jsx11(
2521
+ Text5,
2522
+ {
2523
+ size: "small",
2524
+ weight: "plus",
2525
+ leading: "compact",
2526
+ className: "truncate",
2527
+ children: store.name
2528
+ }
2529
+ ) : /* @__PURE__ */ jsx11(Skeleton, { className: "h-[9px] w-[120px]" })
2530
+ }
2531
+ ),
2532
+ /* @__PURE__ */ jsx11(EllipsisHorizontal2, { className: "text-ui-fg-muted" })
2533
+ ]
2534
+ }
2535
+ ),
2536
+ isLoaded && /* @__PURE__ */ jsxs7(
2537
+ DropdownMenu3.Content,
2538
+ {
2539
+ className: "w-[var(--radix-dropdown-menu-trigger-width)] min-w-0",
2540
+ "data-testid": "sidebar-header-dropdown-content",
2541
+ children: [
2542
+ /* @__PURE__ */ jsxs7(
2543
+ "div",
2544
+ {
2545
+ className: "flex items-center gap-x-3 px-2 py-1",
2546
+ "data-testid": "sidebar-header-dropdown-user-info",
2547
+ children: [
2548
+ /* @__PURE__ */ jsx11(
2549
+ Avatar2,
2550
+ {
2551
+ variant: "squared",
2552
+ size: "small",
2553
+ fallback,
2554
+ "data-testid": "sidebar-header-dropdown-user-avatar"
2555
+ }
2556
+ ),
2557
+ /* @__PURE__ */ jsxs7(
2558
+ "div",
2559
+ {
2560
+ className: "flex flex-col overflow-hidden",
2561
+ "data-testid": "sidebar-header-dropdown-user-details",
2562
+ children: [
2563
+ /* @__PURE__ */ jsx11(
2564
+ Text5,
2565
+ {
2566
+ size: "small",
2567
+ weight: "plus",
2568
+ leading: "compact",
2569
+ className: "truncate",
2570
+ "data-testid": "sidebar-header-dropdown-user-name",
2571
+ children: name
2572
+ }
2573
+ ),
2574
+ /* @__PURE__ */ jsx11(
2575
+ Text5,
2576
+ {
2577
+ size: "xsmall",
2578
+ leading: "compact",
2579
+ className: "text-ui-fg-subtle",
2580
+ "data-testid": "sidebar-header-dropdown-store-label",
2581
+ children: t2("app.nav.main.store")
2582
+ }
2583
+ )
2584
+ ]
2585
+ }
2586
+ )
2587
+ ]
2588
+ }
2589
+ ),
2590
+ /* @__PURE__ */ jsx11(DropdownMenu3.Separator, { "data-testid": "sidebar-header-dropdown-separator-1" }),
2591
+ /* @__PURE__ */ jsx11(
2592
+ DropdownMenu3.Item,
2593
+ {
2594
+ className: "gap-x-2",
2595
+ asChild: true,
2596
+ "data-testid": "sidebar-header-dropdown-store-settings",
2597
+ children: /* @__PURE__ */ jsxs7(Link3, { to: "/settings/store", children: [
2598
+ /* @__PURE__ */ jsx11(BuildingStorefront, { className: "text-ui-fg-subtle" }),
2599
+ t2("app.nav.main.storeSettings")
2600
+ ] })
2601
+ }
2602
+ ),
2603
+ /* @__PURE__ */ jsx11(DropdownMenu3.Separator, { "data-testid": "sidebar-header-dropdown-separator-2" }),
2604
+ /* @__PURE__ */ jsx11(Logout2, {})
2605
+ ]
2606
+ }
2607
+ )
2608
+ ] }) });
2609
+ };
2610
+ var useCoreRoutes = () => {
2611
+ const { t: t2 } = useTranslation8();
2612
+ return [
2613
+ {
2614
+ icon: /* @__PURE__ */ jsx11(ShoppingCart, {}),
2615
+ label: t2("orders.domain"),
2616
+ to: "/orders",
2617
+ items: [
2618
+ // TODO: Enable when domin is introduced
2619
+ // {
2620
+ // label: t("draftOrders.domain"),
2621
+ // to: "/draft-orders",
2622
+ // },
2623
+ ]
2624
+ },
2625
+ {
2626
+ icon: /* @__PURE__ */ jsx11(Tag, {}),
2627
+ label: t2("products.domain"),
2628
+ to: "/products",
2629
+ items: [
2630
+ {
2631
+ label: t2("collections.domain"),
2632
+ to: "/collections"
2633
+ },
2634
+ {
2635
+ label: t2("categories.domain"),
2636
+ to: "/categories"
2637
+ }
2638
+ // TODO: Enable when domin is introduced
2639
+ // {
2640
+ // label: t("giftCards.domain"),
2641
+ // to: "/gift-cards",
2642
+ // },
2643
+ ]
2644
+ },
2645
+ {
2646
+ icon: /* @__PURE__ */ jsx11(Buildings, {}),
2647
+ label: t2("inventory.domain"),
2648
+ to: "/inventory",
2649
+ items: [
2650
+ {
2651
+ label: t2("reservations.domain"),
2652
+ to: "/reservations"
2653
+ }
2654
+ ]
2655
+ },
2656
+ {
2657
+ icon: /* @__PURE__ */ jsx11(Users, {}),
2658
+ label: t2("customers.domain"),
2659
+ to: "/customers",
2660
+ items: [
2661
+ {
2662
+ label: t2("customerGroups.domain"),
2663
+ to: "/customer-groups"
2664
+ }
2665
+ ]
2666
+ },
2667
+ {
2668
+ icon: /* @__PURE__ */ jsx11(Shopping, {}),
2669
+ label: t2("sellers.domain"),
2670
+ to: "/sellers"
2671
+ },
2672
+ {
2673
+ icon: /* @__PURE__ */ jsx11(ReceiptPercent, {}),
2674
+ label: t2("promotions.domain"),
2675
+ to: "/promotions",
2676
+ items: [
2677
+ {
2678
+ label: t2("campaigns.domain"),
2679
+ to: "/campaigns"
2680
+ }
2681
+ ]
2682
+ },
2683
+ {
2684
+ icon: /* @__PURE__ */ jsx11(CurrencyDollar, {}),
2685
+ label: t2("priceLists.domain"),
2686
+ to: "/price-lists"
2687
+ }
2688
+ ];
2689
+ };
2690
+ var Searchbar = () => {
2691
+ const { t: t2 } = useTranslation8();
2692
+ const { toggleSearch } = useSearch();
2693
+ return /* @__PURE__ */ jsx11("div", { className: "px-3", "data-testid": "sidebar-search", children: /* @__PURE__ */ jsxs7(
2694
+ "button",
2695
+ {
2696
+ onClick: toggleSearch,
2697
+ className: clx6(
2698
+ "flex w-full items-center gap-x-2.5 rounded-md bg-ui-bg-subtle px-2 py-1 text-ui-fg-subtle outline-none",
2699
+ "hover:bg-ui-bg-subtle-hover",
2700
+ "focus-visible:shadow-borders-focus"
2701
+ ),
2702
+ "data-testid": "sidebar-search-button",
2703
+ children: [
2704
+ /* @__PURE__ */ jsx11(MagnifyingGlass2, {}),
2705
+ /* @__PURE__ */ jsx11("div", { className: "flex-1 text-start", children: /* @__PURE__ */ jsx11(Text5, { size: "small", leading: "compact", weight: "plus", children: t2("app.search.label") }) }),
2706
+ /* @__PURE__ */ jsx11(Text5, { size: "small", leading: "compact", className: "text-ui-fg-muted", children: "\u2318K" })
2707
+ ]
2708
+ }
2709
+ ) });
2710
+ };
2711
+ var CoreRouteSection = () => {
2712
+ const coreRoutes = useCoreRoutes();
2713
+ return /* @__PURE__ */ jsxs7(
2714
+ "nav",
2715
+ {
2716
+ className: "flex flex-col gap-y-1 py-3",
2717
+ "data-testid": "sidebar-core-routes",
2718
+ children: [
2719
+ /* @__PURE__ */ jsx11(Searchbar, {}),
2720
+ coreRoutes.map((route) => {
2721
+ return /* @__PURE__ */ jsx11(NavItem, { ...route }, route.to);
2722
+ })
2723
+ ]
2724
+ }
2725
+ );
2726
+ };
2727
+ var UtilitySection = () => {
2728
+ const location = useLocation6();
2729
+ const { t: t2 } = useTranslation8();
2730
+ return /* @__PURE__ */ jsx11("div", { className: "flex flex-col gap-y-0.5 py-3", children: /* @__PURE__ */ jsx11(
2731
+ NavItem,
2732
+ {
2733
+ label: t2("app.nav.settings.header"),
2734
+ to: "/settings",
2735
+ from: location.pathname,
2736
+ icon: /* @__PURE__ */ jsx11(CogSixTooth, {})
2737
+ }
2738
+ ) });
2739
+ };
2740
+ var UserSection = () => {
2741
+ return /* @__PURE__ */ jsxs7("div", { children: [
2742
+ /* @__PURE__ */ jsx11("div", { className: "px-3", children: /* @__PURE__ */ jsx11(Divider, { variant: "dashed" }) }),
2743
+ /* @__PURE__ */ jsx11(UserMenu, {})
2744
+ ] });
2745
+ };
2746
+
2747
+ // src/components/layout/public-layout/public-layout.tsx
2748
+ import { Outlet as Outlet3 } from "react-router-dom";
2749
+ import { jsx as jsx12 } from "react/jsx-runtime";
2750
+ var PublicLayout = () => {
2751
+ return /* @__PURE__ */ jsx12(Outlet3, {});
2752
+ };
2753
+
2754
+ // src/components/layout/settings-layout/settings-layout.tsx
2755
+ import { useEffect as useEffect10, useMemo as useMemo4, useState as useState12 } from "react";
2756
+ import { ArrowUturnLeft as ArrowUturnLeft2, MinusMini } from "@medusajs/icons";
2757
+ import { Divider as Divider2, IconButton as IconButton5, Text as Text6, clx as clx7 } from "@medusajs/ui";
2758
+ import { Collapsible as RadixCollapsible2 } from "radix-ui";
2759
+ import { useTranslation as useTranslation9 } from "react-i18next";
2760
+ import { Link as Link4, useLocation as useLocation7 } from "react-router-dom";
2761
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
2762
+ var SettingsLayout = () => {
2763
+ return /* @__PURE__ */ jsx13(Shell, { children: /* @__PURE__ */ jsx13(SettingsSidebar, {}) });
2764
+ };
2765
+ var useSettingRoutes = () => {
2766
+ const { t: t2 } = useTranslation9();
2767
+ return useMemo4(
2768
+ () => [
2769
+ {
2770
+ label: t2("store.domain"),
2771
+ to: "/settings/store"
2772
+ },
2773
+ {
2774
+ label: t2("users.domain"),
2775
+ to: "/settings/users"
2776
+ },
2777
+ {
2778
+ label: t2("regions.domain"),
2779
+ to: "/settings/regions"
2780
+ },
2781
+ {
2782
+ label: t2("taxRegions.domain"),
2783
+ to: "/settings/tax-regions"
2784
+ },
2785
+ {
2786
+ label: t2("returnReasons.domain"),
2787
+ to: "/settings/return-reasons"
2788
+ },
2789
+ {
2790
+ label: t2("refundReasons.domain"),
2791
+ to: "/settings/refund-reasons"
2792
+ },
2793
+ {
2794
+ label: t2("salesChannels.domain"),
2795
+ to: "/settings/sales-channels"
2796
+ },
2797
+ {
2798
+ label: t2("productTypes.domain"),
2799
+ to: "/settings/product-types"
2800
+ },
2801
+ {
2802
+ label: t2("productTags.domain"),
2803
+ to: "/settings/product-tags"
2804
+ },
2805
+ {
2806
+ label: t2("attributes.domain"),
2807
+ to: "/settings/attributes"
2808
+ },
2809
+ {
2810
+ label: t2("configuration.domain"),
2811
+ to: "/settings/configuration"
2812
+ },
2813
+ {
2814
+ label: t2("stockLocations.domain"),
2815
+ to: "/settings/locations"
2816
+ },
2817
+ {
2818
+ label: t2("commissionLines.domain"),
2819
+ to: "/settings/commission-lines"
2820
+ },
2821
+ {
2822
+ label: t2("commission.domain"),
2823
+ to: "/settings/commission/"
2824
+ }
2825
+ ],
2826
+ [t2]
2827
+ );
2828
+ };
2829
+ var useDeveloperRoutes = () => {
2830
+ const { t: t2 } = useTranslation9();
2831
+ return useMemo4(
2832
+ () => [
2833
+ {
2834
+ label: t2("algolia.domain"),
2835
+ to: "/settings/algolia"
2836
+ },
2837
+ {
2838
+ label: t2("apiKeyManagement.domain.publishable"),
2839
+ to: "/settings/publishable-api-keys"
2840
+ },
2841
+ {
2842
+ label: t2("apiKeyManagement.domain.secret"),
2843
+ to: "/settings/secret-api-keys"
2844
+ },
2845
+ {
2846
+ label: t2("workflowExecutions.domain"),
2847
+ to: "/settings/workflows"
2848
+ }
2849
+ ],
2850
+ [t2]
2851
+ );
2852
+ };
2853
+ var useMyAccountRoutes = () => {
2854
+ const { t: t2 } = useTranslation9();
2855
+ return useMemo4(
2856
+ () => [
2857
+ {
2858
+ label: t2("profile.domain"),
2859
+ to: "/settings/profile"
2860
+ }
2861
+ ],
2862
+ [t2]
2863
+ );
2864
+ };
2865
+ var getSafeFromValue = (from) => {
2866
+ if (from.startsWith("/settings")) {
2867
+ return "/orders";
2868
+ }
2869
+ return from;
2870
+ };
2871
+ var SettingsSidebar = () => {
2872
+ const routes = useSettingRoutes();
2873
+ const developerRoutes = useDeveloperRoutes();
2874
+ const myAccountRoutes = useMyAccountRoutes();
2875
+ const { t: t2 } = useTranslation9();
2876
+ return /* @__PURE__ */ jsxs8("aside", { className: "relative flex flex-1 flex-col justify-between overflow-y-auto", children: [
2877
+ /* @__PURE__ */ jsxs8("div", { className: "sticky top-0 bg-ui-bg-subtle", children: [
2878
+ /* @__PURE__ */ jsx13(Header2, {}),
2879
+ /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center px-3", children: /* @__PURE__ */ jsx13(Divider2, { variant: "dashed" }) })
2880
+ ] }),
2881
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-1 flex-col", children: [
2882
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-1 flex-col overflow-y-auto", children: [
2883
+ /* @__PURE__ */ jsx13(
2884
+ RadixCollapsibleSection,
2885
+ {
2886
+ label: t2("app.nav.settings.general"),
2887
+ items: routes
2888
+ }
2889
+ ),
2890
+ /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center px-3", children: /* @__PURE__ */ jsx13(Divider2, { variant: "dashed" }) }),
2891
+ /* @__PURE__ */ jsx13(
2892
+ RadixCollapsibleSection,
2893
+ {
2894
+ label: t2("app.nav.settings.developer"),
2895
+ items: developerRoutes
2896
+ }
2897
+ ),
2898
+ /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center px-3", children: /* @__PURE__ */ jsx13(Divider2, { variant: "dashed" }) }),
2899
+ /* @__PURE__ */ jsx13(
2900
+ RadixCollapsibleSection,
2901
+ {
2902
+ label: t2("app.nav.settings.myAccount"),
2903
+ items: myAccountRoutes
2904
+ }
2905
+ )
2906
+ ] }),
2907
+ /* @__PURE__ */ jsx13("div", { className: "sticky bottom-0 bg-ui-bg-subtle", children: /* @__PURE__ */ jsx13(UserSection2, {}) })
2908
+ ] })
2909
+ ] });
2910
+ };
2911
+ var Header2 = () => {
2912
+ const [from, setFrom] = useState12("/orders");
2913
+ const { t: t2 } = useTranslation9();
2914
+ const location = useLocation7();
2915
+ useEffect10(() => {
2916
+ if (location.state?.from) {
2917
+ setFrom(getSafeFromValue(location.state.from));
2918
+ }
2919
+ }, [location]);
2920
+ return /* @__PURE__ */ jsx13("div", { className: "bg-ui-bg-subtle p-3", children: /* @__PURE__ */ jsx13(
2921
+ Link4,
2922
+ {
2923
+ to: from,
2924
+ replace: true,
2925
+ className: clx7(
2926
+ "flex items-center rounded-md bg-ui-bg-subtle outline-none transition-fg",
2927
+ "hover:bg-ui-bg-subtle-hover",
2928
+ "focus-visible:shadow-borders-focus"
2929
+ ),
2930
+ children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-x-2.5 px-2 py-1", children: [
2931
+ /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx13(ArrowUturnLeft2, { className: "text-ui-fg-subtle" }) }),
2932
+ /* @__PURE__ */ jsx13(Text6, { leading: "compact", weight: "plus", size: "small", children: t2("app.nav.settings.header") })
2933
+ ] })
2934
+ }
2935
+ ) });
2936
+ };
2937
+ var RadixCollapsibleSection = ({
2938
+ label,
2939
+ items
2940
+ }) => {
2941
+ return /* @__PURE__ */ jsxs8(RadixCollapsible2.Root, { defaultOpen: true, className: "py-3", children: [
2942
+ /* @__PURE__ */ jsx13("div", { className: "px-3", children: /* @__PURE__ */ jsxs8("div", { className: "flex h-7 items-center justify-between px-2 text-ui-fg-muted", children: [
2943
+ /* @__PURE__ */ jsx13(Text6, { size: "small", leading: "compact", children: label }),
2944
+ /* @__PURE__ */ jsx13(RadixCollapsible2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx13(IconButton5, { size: "2xsmall", variant: "transparent", className: "static", children: /* @__PURE__ */ jsx13(MinusMini, { className: "text-ui-fg-muted" }) }) })
2945
+ ] }) }),
2946
+ /* @__PURE__ */ jsx13(RadixCollapsible2.Content, { children: /* @__PURE__ */ jsx13("div", { className: "pt-0.5", children: /* @__PURE__ */ jsx13("nav", { className: "flex flex-col gap-y-0.5", children: items.map((setting) => /* @__PURE__ */ jsx13(NavItem, { type: "setting", ...setting }, setting.to)) }) }) })
2947
+ ] });
2948
+ };
2949
+ var UserSection2 = () => {
2950
+ return /* @__PURE__ */ jsxs8("div", { children: [
2951
+ /* @__PURE__ */ jsx13("div", { className: "px-3", children: /* @__PURE__ */ jsx13(Divider2, { variant: "dashed" }) }),
2952
+ /* @__PURE__ */ jsx13(UserMenu, {})
2953
+ ] });
2954
+ };
2955
+
2956
+ // src/components/utilities/error-boundary/error-boundary.tsx
2957
+ import { ExclamationCircle } from "@medusajs/icons";
2958
+ import { Text as Text7 } from "@medusajs/ui";
2959
+ import { useTranslation as useTranslation10 } from "react-i18next";
2960
+ import { Navigate as Navigate2, useLocation as useLocation8, useRouteError } from "react-router-dom";
2961
+ import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
2962
+ var ErrorBoundary = () => {
2963
+ const error = useRouteError();
2964
+ const location = useLocation8();
2965
+ const { t: t2 } = useTranslation10();
2966
+ let code = null;
2967
+ if (isClientError(error)) {
2968
+ if (error.status === 401) {
2969
+ return /* @__PURE__ */ jsx14(Navigate2, { to: "/login", state: { from: location }, replace: true });
2970
+ }
2971
+ code = error.status ?? null;
2972
+ }
2973
+ if (process.env.NODE_ENV === "development") {
2974
+ console.error(error);
2975
+ }
2976
+ let title;
2977
+ let message;
2978
+ switch (code) {
2979
+ case 400:
2980
+ title = t2("errorBoundary.badRequestTitle");
2981
+ message = t2("errorBoundary.badRequestMessage");
2982
+ break;
2983
+ case 404:
2984
+ title = t2("errorBoundary.notFoundTitle");
2985
+ message = t2("errorBoundary.notFoundMessage");
2986
+ break;
2987
+ case 500:
2988
+ title = t2("errorBoundary.internalServerErrorTitle");
2989
+ message = t2("errorBoundary.internalServerErrorMessage");
2990
+ break;
2991
+ default:
2992
+ title = t2("errorBoundary.defaultTitle");
2993
+ message = t2("errorBoundary.defaultMessage");
2994
+ break;
2995
+ }
2996
+ return /* @__PURE__ */ jsx14("div", { className: "flex size-full min-h-[calc(100vh-57px-24px)] items-center justify-center", children: /* @__PURE__ */ jsx14("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsxs9("div", { className: "text-ui-fg-subtle flex flex-col items-center gap-y-3", children: [
2997
+ /* @__PURE__ */ jsx14(ExclamationCircle, {}),
2998
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-col items-center justify-center gap-y-1", children: [
2999
+ /* @__PURE__ */ jsx14(Text7, { size: "small", leading: "compact", weight: "plus", children: title }),
3000
+ /* @__PURE__ */ jsx14(
3001
+ Text7,
3002
+ {
3003
+ size: "small",
3004
+ className: "text-ui-fg-muted text-balance text-center",
3005
+ children: message
3006
+ }
3007
+ )
3008
+ ] })
3009
+ ] }) }) });
3010
+ };
3011
+
3012
+ // src/get-route-map.tsx
3013
+ import { jsx as jsx15 } from "react/jsx-runtime";
3014
+ function mergeRoutes(baseRoutes, customRoutes2) {
3015
+ const result = baseRoutes.map((route) => ({ ...route }));
3016
+ for (const customRoute of customRoutes2) {
3017
+ const customPath = customRoute.path?.replace(/^\/+/, "");
3018
+ const existingIndex = result.findIndex(
3019
+ (r) => r.path != null && r.path.replace(/^\/+/, "") === customPath
3020
+ );
3021
+ if (existingIndex !== -1) {
3022
+ const { children: customChildren, ...customRest } = customRoute;
3023
+ result[existingIndex] = {
3024
+ ...result[existingIndex],
3025
+ ...customRest,
3026
+ path: result[existingIndex].path,
3027
+ children: customChildren ? mergeRoutes(result[existingIndex].children ?? [], customChildren) : result[existingIndex].children
3028
+ };
3029
+ } else {
3030
+ result.push(customRoute);
3031
+ }
3032
+ }
3033
+ return result;
3034
+ }
3035
+ function getRouteMap({
3036
+ settingsRoutes: customSettingsRoutes,
3037
+ mainRoutes: customMainRoutes,
3038
+ publicRoutes: customPublicRoutes = []
3039
+ }) {
3040
+ return [
3041
+ {
3042
+ element: /* @__PURE__ */ jsx15(ProtectedRoute, {}),
3043
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3044
+ children: [
3045
+ {
3046
+ element: /* @__PURE__ */ jsx15(MainLayout, {}),
3047
+ children: mergeRoutes(
3048
+ [
3049
+ {
3050
+ path: "/",
3051
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3052
+ lazy: () => import("./home-I3OILW5Z.js")
3053
+ },
3054
+ {
3055
+ path: "/products",
3056
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3057
+ handle: {
3058
+ breadcrumb: () => t("products.domain")
3059
+ },
3060
+ children: [
3061
+ {
3062
+ path: "",
3063
+ lazy: () => import("./product-list-EV2TS3Y4.js"),
3064
+ children: [
3065
+ {
3066
+ path: "create",
3067
+ lazy: () => import("./product-create-YC6MCJ2M.js")
3068
+ },
3069
+ {
3070
+ path: "import",
3071
+ lazy: () => import("./product-import-Y54VG4AC.js")
3072
+ },
3073
+ {
3074
+ path: "export",
3075
+ lazy: () => import("./product-export-5L4HNM3W.js")
3076
+ }
3077
+ ]
3078
+ },
3079
+ {
3080
+ path: ":id",
3081
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3082
+ lazy: async () => {
3083
+ const { Breadcrumb, loader } = await import("./product-detail-2GJ3PGHW.js");
3084
+ return {
3085
+ Component: Outlet4,
3086
+ loader,
3087
+ handle: {
3088
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3089
+ }
3090
+ };
3091
+ },
3092
+ children: [
3093
+ {
3094
+ path: "",
3095
+ lazy: () => import("./product-detail-2GJ3PGHW.js"),
3096
+ children: [
3097
+ {
3098
+ path: "edit",
3099
+ lazy: () => import("./product-edit-YOGTWZ4I.js")
3100
+ },
3101
+ {
3102
+ path: "edit-variant",
3103
+ lazy: () => import("./product-variant-edit-QFHGNDW7.js")
3104
+ },
3105
+ {
3106
+ path: "sales-channels",
3107
+ lazy: () => import("./product-sales-channels-J3OH4NWX.js")
3108
+ },
3109
+ {
3110
+ path: "attributes",
3111
+ lazy: () => import("./product-attributes-P7WFH4I2.js")
3112
+ },
3113
+ {
3114
+ path: "organization",
3115
+ lazy: () => import("./product-organization-LVKRBJOQ.js")
3116
+ },
3117
+ {
3118
+ path: "shipping-profile",
3119
+ lazy: () => import("./product-shipping-profile-NOOFEUBZ.js")
3120
+ },
3121
+ {
3122
+ path: "media",
3123
+ lazy: () => import("./product-media-ZSMGHCNP.js")
3124
+ },
3125
+ {
3126
+ path: "prices",
3127
+ lazy: () => import("./product-prices-K5YM2TL6.js")
3128
+ },
3129
+ {
3130
+ path: "options/create",
3131
+ lazy: () => import("./product-create-option-BNF2KKJM.js")
3132
+ },
3133
+ {
3134
+ path: "options/:option_id/edit",
3135
+ lazy: () => import("./product-edit-option-4MUSMFS7.js")
3136
+ },
3137
+ {
3138
+ path: "variants/create",
3139
+ lazy: () => import("./product-create-variant-SIJX7AE3.js")
3140
+ },
3141
+ {
3142
+ path: "stock",
3143
+ lazy: () => import("./product-stock-J4LTIX64.js")
3144
+ },
3145
+ {
3146
+ path: "metadata/edit",
3147
+ lazy: () => import("./product-metadata-572YVJH3.js")
3148
+ }
3149
+ ]
3150
+ },
3151
+ {
3152
+ path: "variants/:variant_id",
3153
+ lazy: async () => {
3154
+ const { Component, Breadcrumb, loader } = await import("./product-variant-detail-6KPB3HL7.js");
3155
+ return {
3156
+ Component,
3157
+ loader,
3158
+ handle: {
3159
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3160
+ }
3161
+ };
3162
+ },
3163
+ children: [
3164
+ {
3165
+ path: "edit",
3166
+ lazy: () => import("./product-variant-edit-QFHGNDW7.js")
3167
+ },
3168
+ {
3169
+ path: "prices",
3170
+ lazy: () => import("./product-prices-K5YM2TL6.js")
3171
+ },
3172
+ {
3173
+ path: "manage-items",
3174
+ lazy: () => import("./product-variant-manage-inventory-items-ZEX2IW53.js")
3175
+ },
3176
+ {
3177
+ path: "metadata/edit",
3178
+ lazy: () => import("./product-variant-metadata-F45CSWU6.js")
3179
+ }
3180
+ ]
3181
+ }
3182
+ ]
3183
+ }
3184
+ ]
3185
+ },
3186
+ {
3187
+ path: "/categories",
3188
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3189
+ handle: {
3190
+ breadcrumb: () => t("categories.domain")
3191
+ },
3192
+ children: [
3193
+ {
3194
+ path: "",
3195
+ lazy: () => import("./category-list-T4GPTLOA.js"),
3196
+ children: [
3197
+ {
3198
+ path: "create",
3199
+ lazy: () => import("./category-create-DRJZI3EM.js")
3200
+ },
3201
+ {
3202
+ path: "organize",
3203
+ lazy: () => import("./category-organize-MLBY54BT.js")
3204
+ }
3205
+ ]
3206
+ },
3207
+ {
3208
+ path: ":id",
3209
+ lazy: async () => {
3210
+ const { Component, Breadcrumb, loader } = await import("./category-detail-DEGYVUXB.js");
3211
+ return {
3212
+ Component,
3213
+ loader,
3214
+ handle: {
3215
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3216
+ }
3217
+ };
3218
+ },
3219
+ children: [
3220
+ {
3221
+ path: "edit",
3222
+ lazy: () => import("./category-edit-PTYOK7VV.js")
3223
+ },
3224
+ {
3225
+ path: "products",
3226
+ lazy: () => import("./category-products-W7U2VZTZ.js")
3227
+ },
3228
+ {
3229
+ path: "organize",
3230
+ lazy: () => import("./category-organize-MLBY54BT.js")
3231
+ },
3232
+ {
3233
+ path: "metadata/edit",
3234
+ lazy: () => import("./categories-metadata-UC3N6YSC.js")
3235
+ }
3236
+ ]
3237
+ }
3238
+ ]
3239
+ },
3240
+ {
3241
+ path: "/orders",
3242
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3243
+ handle: {
3244
+ breadcrumb: () => t("orders.domain")
3245
+ },
3246
+ children: [
3247
+ {
3248
+ path: "",
3249
+ lazy: () => import("./order-list-XDOAXZXN.js")
3250
+ },
3251
+ {
3252
+ path: ":id",
3253
+ lazy: async () => {
3254
+ const { Component, Breadcrumb, loader } = await import("./order-detail-Y4EG3P5F.js");
3255
+ return {
3256
+ Component,
3257
+ loader,
3258
+ handle: {
3259
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3260
+ }
3261
+ };
3262
+ },
3263
+ children: [
3264
+ {
3265
+ path: "fulfillment",
3266
+ lazy: () => import("./order-create-fulfillment-EIYGSKXP.js")
3267
+ },
3268
+ {
3269
+ path: "returns/:return_id/receive",
3270
+ lazy: () => import("./order-receive-return-5VWUPWZJ.js")
3271
+ },
3272
+ {
3273
+ path: "allocate-items",
3274
+ lazy: () => import("./order-allocate-items-F7CXZQGX.js")
3275
+ },
3276
+ {
3277
+ path: ":f_id/create-shipment",
3278
+ lazy: () => import("./order-create-shipment-T4C6UE2K.js")
3279
+ },
3280
+ {
3281
+ path: "returns",
3282
+ lazy: () => import("./order-create-return-6TA5J3AW.js")
3283
+ },
3284
+ {
3285
+ path: "claims",
3286
+ lazy: () => import("./order-create-claim-GDVWGZJA.js")
3287
+ },
3288
+ {
3289
+ path: "exchanges",
3290
+ lazy: () => import("./order-create-exchange-NLDIMGBG.js")
3291
+ },
3292
+ {
3293
+ path: "edits",
3294
+ lazy: () => import("./order-create-edit-6YYKYT66.js")
3295
+ },
3296
+ {
3297
+ path: "refund",
3298
+ lazy: () => import("./order-create-refund-BBXEZNWA.js")
3299
+ },
3300
+ {
3301
+ path: "transfer",
3302
+ lazy: () => import("./order-request-transfer-VFSY5IFF.js")
3303
+ },
3304
+ {
3305
+ path: "email",
3306
+ lazy: () => import("./order-edit-email-VXOX62P6.js")
3307
+ },
3308
+ {
3309
+ path: "shipping-address",
3310
+ lazy: () => import("./order-edit-shipping-address-WDKCQRRG.js")
3311
+ },
3312
+ {
3313
+ path: "billing-address",
3314
+ lazy: () => import("./order-edit-billing-address-NNIFUC5C.js")
3315
+ },
3316
+ {
3317
+ path: "metadata/edit",
3318
+ lazy: () => import("./order-metadata-S6N3GDOA.js")
3319
+ }
3320
+ ]
3321
+ }
3322
+ ]
3323
+ },
3324
+ {
3325
+ path: "/promotions",
3326
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3327
+ handle: {
3328
+ breadcrumb: () => t("promotions.domain")
3329
+ },
3330
+ children: [
3331
+ {
3332
+ path: "",
3333
+ lazy: () => import("./promotion-list-HTJ5GIWG.js")
3334
+ },
3335
+ {
3336
+ path: "create",
3337
+ lazy: () => import("./promotion-create-QB7E277L.js")
3338
+ },
3339
+ {
3340
+ path: ":id",
3341
+ lazy: async () => {
3342
+ const { Component, Breadcrumb, loader } = await import("./promotion-detail-7D6D6PQ7.js");
3343
+ return {
3344
+ Component,
3345
+ loader,
3346
+ handle: {
3347
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3348
+ }
3349
+ };
3350
+ },
3351
+ children: [
3352
+ {
3353
+ path: "edit",
3354
+ lazy: () => import("./promotion-edit-details-HYQJAZDF.js")
3355
+ },
3356
+ {
3357
+ path: "add-to-campaign",
3358
+ lazy: () => import("./promotion-add-campaign-U6X2FNWZ.js")
3359
+ },
3360
+ {
3361
+ path: ":ruleType/edit",
3362
+ lazy: () => import("./edit-rules-Q5UNWAUD.js")
3363
+ }
3364
+ ]
3365
+ }
3366
+ ]
3367
+ },
3368
+ {
3369
+ path: "/campaigns",
3370
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3371
+ handle: {
3372
+ breadcrumb: () => t("campaigns.domain")
3373
+ },
3374
+ children: [
3375
+ {
3376
+ path: "",
3377
+ lazy: () => import("./campaign-list-BWYHTJL2.js"),
3378
+ children: []
3379
+ },
3380
+ {
3381
+ path: "create",
3382
+ lazy: () => import("./campaign-create-J2PN77A6.js")
3383
+ },
3384
+ {
3385
+ path: ":id",
3386
+ lazy: async () => {
3387
+ const { Component, Breadcrumb, loader } = await import("./campaign-detail-2XJ7PXOQ.js");
3388
+ return {
3389
+ Component,
3390
+ loader,
3391
+ handle: {
3392
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3393
+ }
3394
+ };
3395
+ },
3396
+ children: [
3397
+ {
3398
+ path: "edit",
3399
+ lazy: () => import("./campaign-edit-MU4TVOEC.js")
3400
+ },
3401
+ {
3402
+ path: "configuration",
3403
+ lazy: () => import("./campaign-configuration-ONC2CL7Q.js")
3404
+ },
3405
+ {
3406
+ path: "edit-budget",
3407
+ lazy: () => import("./campaign-budget-edit-C5PCVES3.js")
3408
+ },
3409
+ {
3410
+ path: "add-promotions",
3411
+ lazy: () => import("./add-campaign-promotions-JDC36EOE.js")
3412
+ }
3413
+ ]
3414
+ }
3415
+ ]
3416
+ },
3417
+ {
3418
+ path: "/collections",
3419
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3420
+ handle: {
3421
+ breadcrumb: () => t("collections.domain")
3422
+ },
3423
+ children: [
3424
+ {
3425
+ path: "",
3426
+ lazy: () => import("./collection-list-JGKC5EVM.js"),
3427
+ children: [
3428
+ {
3429
+ path: "create",
3430
+ lazy: () => import("./collection-create-AQ3GUG3G.js")
3431
+ }
3432
+ ]
3433
+ },
3434
+ {
3435
+ path: ":id",
3436
+ lazy: async () => {
3437
+ const { Component, Breadcrumb, loader } = await import("./collection-detail-SDFALX6M.js");
3438
+ return {
3439
+ Component,
3440
+ loader,
3441
+ handle: {
3442
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3443
+ }
3444
+ };
3445
+ },
3446
+ children: [
3447
+ {
3448
+ path: "edit",
3449
+ lazy: () => import("./collection-edit-AAHL2WFH.js")
3450
+ },
3451
+ {
3452
+ path: "products",
3453
+ lazy: () => import("./collection-add-products-IUDEIUM5.js")
3454
+ },
3455
+ {
3456
+ path: "metadata/edit",
3457
+ lazy: () => import("./collection-metadata-YQWA2JTU.js")
3458
+ }
3459
+ ]
3460
+ }
3461
+ ]
3462
+ },
3463
+ {
3464
+ path: "/price-lists",
3465
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3466
+ handle: {
3467
+ breadcrumb: () => t("priceLists.domain")
3468
+ },
3469
+ children: [
3470
+ {
3471
+ path: "",
3472
+ lazy: () => import("./price-list-list-IXZVTXU5.js"),
3473
+ children: [
3474
+ {
3475
+ path: "create",
3476
+ lazy: () => import("./price-list-create-INX5HG7G.js")
3477
+ }
3478
+ ]
3479
+ },
3480
+ {
3481
+ path: ":id",
3482
+ lazy: async () => {
3483
+ const { Component, Breadcrumb, loader } = await import("./price-list-detail-5LGPE67O.js");
3484
+ return {
3485
+ Component,
3486
+ loader,
3487
+ handle: {
3488
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3489
+ }
3490
+ };
3491
+ },
3492
+ children: [
3493
+ {
3494
+ path: "edit",
3495
+ lazy: () => import("./price-list-edit-HRWPEIZI.js")
3496
+ },
3497
+ {
3498
+ path: "configuration",
3499
+ lazy: () => import("./price-list-configuration-GH67LL2N.js")
3500
+ },
3501
+ {
3502
+ path: "products/add",
3503
+ lazy: () => import("./price-list-prices-add-QHE3TUTV.js")
3504
+ },
3505
+ {
3506
+ path: "products/edit",
3507
+ lazy: () => import("./price-list-prices-edit-TMVJ7S7J.js")
3508
+ }
3509
+ ]
3510
+ }
3511
+ ]
3512
+ },
3513
+ {
3514
+ path: "/customers",
3515
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3516
+ handle: {
3517
+ breadcrumb: () => t("customers.domain")
3518
+ },
3519
+ children: [
3520
+ {
3521
+ path: "",
3522
+ lazy: () => import("./customer-list-EIQP23FQ.js"),
3523
+ children: [
3524
+ {
3525
+ path: "create",
3526
+ lazy: () => import("./customer-create-5VT2TB6S.js")
3527
+ }
3528
+ ]
3529
+ },
3530
+ {
3531
+ path: ":id",
3532
+ lazy: async () => {
3533
+ const { Component, Breadcrumb, loader } = await import("./customer-detail-CDELSJ77.js");
3534
+ return {
3535
+ Component,
3536
+ loader,
3537
+ handle: {
3538
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3539
+ }
3540
+ };
3541
+ },
3542
+ children: [
3543
+ {
3544
+ path: "edit",
3545
+ lazy: () => import("./customer-edit-DZAD53JC.js")
3546
+ },
3547
+ {
3548
+ path: "create-address",
3549
+ lazy: () => import("./customer-create-address-ICEFEFD2.js")
3550
+ },
3551
+ {
3552
+ path: "add-customer-groups",
3553
+ lazy: () => import("./customers-add-customer-group-542PUCCT.js")
3554
+ },
3555
+ {
3556
+ path: ":order_id/transfer",
3557
+ lazy: () => import("./order-request-transfer-VFSY5IFF.js")
3558
+ },
3559
+ {
3560
+ path: "metadata/edit",
3561
+ lazy: () => import("./customer-metadata-ATAORBRN.js")
3562
+ }
3563
+ ]
3564
+ }
3565
+ ]
3566
+ },
3567
+ {
3568
+ path: "/sellers",
3569
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3570
+ handle: {
3571
+ breadcrumb: () => t("sellers.domain")
3572
+ },
3573
+ children: [
3574
+ {
3575
+ path: "",
3576
+ lazy: () => import("./seller-list-HG2VXA6V.js")
3577
+ },
3578
+ {
3579
+ path: ":id",
3580
+ lazy: () => import("./seller-details-HBVN4GGD.js")
3581
+ },
3582
+ {
3583
+ path: ":id/edit",
3584
+ lazy: () => import("./seller-edit-OXDARXYJ.js")
3585
+ }
3586
+ ]
3587
+ },
3588
+ {
3589
+ path: "/reservations",
3590
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3591
+ handle: {
3592
+ breadcrumb: () => t("reservations.domain")
3593
+ },
3594
+ children: [
3595
+ {
3596
+ path: "",
3597
+ lazy: () => import("./reservation-list-R5UBPNI4.js"),
3598
+ children: [
3599
+ {
3600
+ path: "create",
3601
+ lazy: () => import("./reservation-create-VG5FSV3F.js")
3602
+ }
3603
+ ]
3604
+ },
3605
+ {
3606
+ path: ":id",
3607
+ lazy: async () => {
3608
+ const { Component, Breadcrumb, loader } = await import("./reservation-detail-36BA3V2F.js");
3609
+ return {
3610
+ Component,
3611
+ loader,
3612
+ handle: {
3613
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3614
+ }
3615
+ };
3616
+ },
3617
+ children: [
3618
+ {
3619
+ path: "edit",
3620
+ lazy: () => import("./edit-reservation-LX2Z6KVD.js")
3621
+ },
3622
+ {
3623
+ path: "metadata/edit",
3624
+ lazy: () => import("./reservation-metadata-KR4HOHTH.js")
3625
+ }
3626
+ ]
3627
+ }
3628
+ ]
3629
+ },
3630
+ {
3631
+ path: "/inventory",
3632
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3633
+ handle: {
3634
+ breadcrumb: () => t("inventory.domain")
3635
+ },
3636
+ children: [
3637
+ {
3638
+ path: "",
3639
+ lazy: () => import("./inventory-list-UXY7PU3N.js"),
3640
+ children: [
3641
+ {
3642
+ path: "create",
3643
+ lazy: () => import("./inventory-create-FT7GL4RK.js")
3644
+ },
3645
+ {
3646
+ path: "stock",
3647
+ lazy: () => import("./inventory-stock-3MBERL3K.js")
3648
+ }
3649
+ ]
3650
+ },
3651
+ {
3652
+ path: ":id",
3653
+ lazy: async () => {
3654
+ const { Component, Breadcrumb, loader } = await import("./inventory-detail-LNZ5QC67.js");
3655
+ return {
3656
+ Component,
3657
+ loader,
3658
+ handle: {
3659
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3660
+ }
3661
+ };
3662
+ },
3663
+ children: [
3664
+ {
3665
+ path: "edit",
3666
+ lazy: () => import("./edit-inventory-item-P2HVULPA.js")
3667
+ },
3668
+ {
3669
+ path: "attributes",
3670
+ lazy: () => import("./edit-inventory-item-attributes-V2HK3WTQ.js")
3671
+ },
3672
+ {
3673
+ path: "metadata/edit",
3674
+ lazy: () => import("./inventory-metadata-OYETRH5X.js")
3675
+ },
3676
+ {
3677
+ path: "locations",
3678
+ lazy: () => import("./manage-locations-NVHONEZE.js")
3679
+ },
3680
+ {
3681
+ path: "locations/:location_id",
3682
+ lazy: () => import("./adjust-inventory-2YLC4O4I.js")
3683
+ }
3684
+ ]
3685
+ }
3686
+ ]
3687
+ }
3688
+ ],
3689
+ customMainRoutes
3690
+ )
3691
+ }
3692
+ ]
3693
+ },
3694
+ {
3695
+ element: /* @__PURE__ */ jsx15(ProtectedRoute, {}),
3696
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3697
+ children: [
3698
+ {
3699
+ path: "/settings",
3700
+ handle: {
3701
+ breadcrumb: () => t("app.nav.settings.header")
3702
+ },
3703
+ element: /* @__PURE__ */ jsx15(SettingsLayout, {}),
3704
+ children: mergeRoutes(
3705
+ [
3706
+ {
3707
+ index: true,
3708
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3709
+ lazy: () => import("./settings-D43GVDOO.js")
3710
+ },
3711
+ {
3712
+ path: "profile",
3713
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3714
+ lazy: () => import("./profile-detail-LLXUNQOT.js"),
3715
+ handle: {
3716
+ breadcrumb: () => t("profile.domain")
3717
+ },
3718
+ children: [
3719
+ {
3720
+ path: "edit",
3721
+ lazy: () => import("./profile-edit-UDYMDQLT.js")
3722
+ }
3723
+ ]
3724
+ },
3725
+ {
3726
+ path: "regions",
3727
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3728
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
3729
+ handle: {
3730
+ breadcrumb: () => t("regions.domain")
3731
+ },
3732
+ children: [
3733
+ {
3734
+ path: "",
3735
+ lazy: () => import("./region-list-DCU6NQFA.js"),
3736
+ children: [
3737
+ {
3738
+ path: "create",
3739
+ lazy: () => import("./region-create-Z3JQFIKN.js")
3740
+ }
3741
+ ]
3742
+ },
3743
+ {
3744
+ path: ":id",
3745
+ lazy: async () => {
3746
+ const { Component, Breadcrumb, loader } = await import("./region-detail-46R3HACJ.js");
3747
+ return {
3748
+ Component,
3749
+ loader,
3750
+ handle: {
3751
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3752
+ }
3753
+ };
3754
+ },
3755
+ children: [
3756
+ {
3757
+ path: "edit",
3758
+ lazy: () => import("./region-edit-W5IVVP7Z.js")
3759
+ },
3760
+ {
3761
+ path: "countries/add",
3762
+ lazy: () => import("./region-add-countries-CWJ62VPK.js")
3763
+ },
3764
+ {
3765
+ path: "metadata/edit",
3766
+ lazy: () => import("./region-metadata-VG5DLCOK.js")
3767
+ }
3768
+ ]
3769
+ }
3770
+ ]
3771
+ },
3772
+ {
3773
+ path: "store",
3774
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3775
+ lazy: () => import("./store-detail-MFHPXBIN.js"),
3776
+ handle: {
3777
+ breadcrumb: () => t("store.domain")
3778
+ },
3779
+ children: [
3780
+ {
3781
+ path: "edit",
3782
+ lazy: () => import("./store-edit-WBF6EL5N.js")
3783
+ },
3784
+ {
3785
+ path: "currencies",
3786
+ lazy: () => import("./store-add-currencies-PIGEOZ4G.js")
3787
+ },
3788
+ {
3789
+ path: "metadata/edit",
3790
+ lazy: () => import("./store-metadata-LSK7UVSC.js")
3791
+ }
3792
+ ]
3793
+ },
3794
+ {
3795
+ path: "users",
3796
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3797
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
3798
+ handle: {
3799
+ breadcrumb: () => t("users.domain")
3800
+ },
3801
+ children: [
3802
+ {
3803
+ path: "",
3804
+ lazy: () => import("./user-list-BJXFPTJ7.js"),
3805
+ children: [
3806
+ {
3807
+ path: "invite",
3808
+ lazy: () => import("./user-invite-OTBYWV4L.js")
3809
+ }
3810
+ ]
3811
+ },
3812
+ {
3813
+ path: ":id",
3814
+ lazy: async () => {
3815
+ const { Component, Breadcrumb, loader } = await import("./user-detail-IEIX24PZ.js");
3816
+ return {
3817
+ Component,
3818
+ loader,
3819
+ handle: {
3820
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3821
+ }
3822
+ };
3823
+ },
3824
+ children: [
3825
+ {
3826
+ path: "edit",
3827
+ lazy: () => import("./user-edit-CJ7TNY3H.js")
3828
+ },
3829
+ {
3830
+ path: "metadata/edit",
3831
+ lazy: () => import("./user-metadata-ZLC6T6XH.js")
3832
+ }
3833
+ ]
3834
+ }
3835
+ ]
3836
+ },
3837
+ {
3838
+ path: "sales-channels",
3839
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3840
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
3841
+ handle: {
3842
+ breadcrumb: () => t("salesChannels.domain")
3843
+ },
3844
+ children: [
3845
+ {
3846
+ path: "",
3847
+ lazy: () => import("./sales-channel-list-5KNN734B.js"),
3848
+ children: [
3849
+ {
3850
+ path: "create",
3851
+ lazy: () => import("./sales-channel-create-2BTWSYIK.js")
3852
+ }
3853
+ ]
3854
+ },
3855
+ {
3856
+ path: ":id",
3857
+ lazy: async () => {
3858
+ const { Component, Breadcrumb, loader } = await import("./sales-channel-detail-IQIQDN3L.js");
3859
+ return {
3860
+ Component,
3861
+ loader,
3862
+ handle: {
3863
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3864
+ }
3865
+ };
3866
+ },
3867
+ children: [
3868
+ {
3869
+ path: "edit",
3870
+ lazy: () => import("./sales-channel-edit-YBNPALFT.js")
3871
+ },
3872
+ {
3873
+ path: "add-products",
3874
+ lazy: () => import("./sales-channel-add-products-6TUDLE4D.js")
3875
+ },
3876
+ {
3877
+ path: "metadata/edit",
3878
+ lazy: () => import("./sales-channel-metadata-SVW6FYSV.js")
3879
+ }
3880
+ ]
3881
+ }
3882
+ ]
3883
+ },
3884
+ {
3885
+ path: "locations",
3886
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3887
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
3888
+ handle: {
3889
+ breadcrumb: () => t("locations.domain")
3890
+ },
3891
+ children: [
3892
+ {
3893
+ path: "",
3894
+ lazy: () => import("./location-list-TC5FEN5R.js")
3895
+ },
3896
+ {
3897
+ path: "create",
3898
+ lazy: () => import("./location-create-ZVVQT2KP.js")
3899
+ },
3900
+ {
3901
+ path: "shipping-profiles",
3902
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
3903
+ handle: {
3904
+ breadcrumb: () => t("shippingProfile.domain")
3905
+ },
3906
+ children: [
3907
+ {
3908
+ path: "",
3909
+ lazy: () => import("./shipping-profiles-list-WOGGP7IT.js"),
3910
+ children: [
3911
+ {
3912
+ path: "create",
3913
+ lazy: () => import("./shipping-profile-create-3OWHNAOB.js")
3914
+ }
3915
+ ]
3916
+ },
3917
+ {
3918
+ path: ":shipping_profile_id",
3919
+ lazy: async () => {
3920
+ const { Component, Breadcrumb, loader } = await import("./shipping-profile-detail-WW7IVUVV.js");
3921
+ return {
3922
+ Component,
3923
+ loader,
3924
+ handle: {
3925
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3926
+ }
3927
+ };
3928
+ },
3929
+ children: [
3930
+ {
3931
+ path: "metadata/edit",
3932
+ lazy: () => import("./shipping-profile-metadata-AD3DSZLR.js")
3933
+ }
3934
+ ]
3935
+ }
3936
+ ]
3937
+ },
3938
+ {
3939
+ path: "shipping-option-types",
3940
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
3941
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
3942
+ handle: {
3943
+ breadcrumb: () => t("shippingOptionTypes.domain")
3944
+ },
3945
+ children: [
3946
+ {
3947
+ path: "",
3948
+ lazy: () => import("./shipping-option-type-list-36ZS2QZO.js"),
3949
+ children: [
3950
+ {
3951
+ path: "create",
3952
+ lazy: () => import("./shipping-option-type-create-7KYU5NNF.js")
3953
+ }
3954
+ ]
3955
+ },
3956
+ {
3957
+ path: ":id",
3958
+ lazy: async () => {
3959
+ const { Component, Breadcrumb, loader } = await import("./shipping-option-type-detail-4CNTT3MO.js");
3960
+ return {
3961
+ Component,
3962
+ loader,
3963
+ handle: {
3964
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3965
+ }
3966
+ };
3967
+ },
3968
+ children: [
3969
+ {
3970
+ path: "edit",
3971
+ lazy: () => import("./shipping-option-type-edit-AN6IPVI6.js")
3972
+ }
3973
+ ]
3974
+ }
3975
+ ]
3976
+ },
3977
+ {
3978
+ path: ":location_id",
3979
+ lazy: async () => {
3980
+ const { Component, Breadcrumb, loader } = await import("./location-detail-A5SHPUQN.js");
3981
+ return {
3982
+ Component,
3983
+ loader,
3984
+ handle: {
3985
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
3986
+ }
3987
+ };
3988
+ },
3989
+ children: [
3990
+ {
3991
+ path: "edit",
3992
+ lazy: () => import("./location-edit-QSRHHDQ2.js")
3993
+ },
3994
+ {
3995
+ path: "sales-channels",
3996
+ lazy: () => import("./location-sales-channels-STDHWQSC.js")
3997
+ },
3998
+ {
3999
+ path: "fulfillment-providers",
4000
+ lazy: () => import("./location-fulfillment-providers-4HMT5L7L.js")
4001
+ },
4002
+ {
4003
+ path: "fulfillment-set/:fset_id",
4004
+ children: [
4005
+ {
4006
+ path: "service-zones/create",
4007
+ lazy: () => import("./location-service-zone-create-63LUYCJI.js")
4008
+ },
4009
+ {
4010
+ path: "service-zone/:zone_id",
4011
+ children: [
4012
+ {
4013
+ path: "edit",
4014
+ lazy: () => import("./location-service-zone-edit-UNXI5BQV.js")
4015
+ },
4016
+ {
4017
+ path: "areas",
4018
+ lazy: () => import("./location-service-zone-manage-areas-UMD6CZDZ.js")
4019
+ },
4020
+ {
4021
+ path: "shipping-option",
4022
+ children: [
4023
+ {
4024
+ path: "create",
4025
+ lazy: () => import("./location-service-zone-shipping-option-create-5L73SAGE.js")
4026
+ },
4027
+ {
4028
+ path: ":so_id",
4029
+ children: [
4030
+ {
4031
+ path: "edit",
4032
+ lazy: () => import("./location-service-zone-shipping-option-edit-2FEWQD6Y.js")
4033
+ },
4034
+ {
4035
+ path: "pricing",
4036
+ lazy: () => import("./location-service-zone-shipping-option-pricing-QSB56QZD.js")
4037
+ }
4038
+ ]
4039
+ }
4040
+ ]
4041
+ }
4042
+ ]
4043
+ }
4044
+ ]
4045
+ }
4046
+ ]
4047
+ }
4048
+ ]
4049
+ },
4050
+ {
4051
+ path: "product-tags",
4052
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
4053
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
4054
+ handle: {
4055
+ breadcrumb: () => t("productTags.domain")
4056
+ },
4057
+ children: [
4058
+ {
4059
+ path: "",
4060
+ lazy: () => import("./product-tag-list-DY7GJUJQ.js"),
4061
+ children: [
4062
+ {
4063
+ path: "create",
4064
+ lazy: () => import("./product-tag-create-5JJPPELP.js")
4065
+ }
4066
+ ]
4067
+ },
4068
+ {
4069
+ path: ":id",
4070
+ lazy: async () => {
4071
+ const { Component, Breadcrumb, loader } = await import("./product-tag-detail-CGLCH3BJ.js");
4072
+ return {
4073
+ Component,
4074
+ loader,
4075
+ handle: {
4076
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
4077
+ }
4078
+ };
4079
+ },
4080
+ children: [
4081
+ {
4082
+ path: "edit",
4083
+ lazy: () => import("./product-tag-edit-OR7KSC7I.js")
4084
+ },
4085
+ {
4086
+ path: "metadata/edit",
4087
+ lazy: () => import("./product-tag-metadata-BFGPRMME.js")
4088
+ }
4089
+ ]
4090
+ }
4091
+ ]
4092
+ },
4093
+ {
4094
+ path: "product-types",
4095
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
4096
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
4097
+ handle: {
4098
+ breadcrumb: () => t("productTypes.domain")
4099
+ },
4100
+ children: [
4101
+ {
4102
+ path: "",
4103
+ lazy: () => import("./product-type-list-FK237DSQ.js"),
4104
+ children: [
4105
+ {
4106
+ path: "create",
4107
+ lazy: () => import("./product-type-create-FPVSGIKL.js")
4108
+ }
4109
+ ]
4110
+ },
4111
+ {
4112
+ path: ":id",
4113
+ lazy: async () => {
4114
+ const { Component, Breadcrumb, loader } = await import("./product-type-detail-JYW2DAM4.js");
4115
+ return {
4116
+ Component,
4117
+ loader,
4118
+ handle: {
4119
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
4120
+ }
4121
+ };
4122
+ },
4123
+ children: [
4124
+ {
4125
+ path: "edit",
4126
+ lazy: () => import("./product-type-edit-FBT4Z4ZJ.js")
4127
+ },
4128
+ {
4129
+ path: "metadata/edit",
4130
+ lazy: () => import("./product-type-metadata-SFJR5OQN.js")
4131
+ }
4132
+ ]
4133
+ }
4134
+ ]
4135
+ },
4136
+ {
4137
+ path: "publishable-api-keys",
4138
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
4139
+ handle: {
4140
+ breadcrumb: () => t("apiKeyManagement.domain.publishable")
4141
+ },
4142
+ children: [
4143
+ {
4144
+ path: "",
4145
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
4146
+ children: [
4147
+ {
4148
+ path: "",
4149
+ lazy: () => import("./api-key-management-list-QQHOCVV4.js"),
4150
+ children: [
4151
+ {
4152
+ path: "create",
4153
+ lazy: () => import("./api-key-management-create-KERROZ6Z.js")
4154
+ }
4155
+ ]
4156
+ }
4157
+ ]
4158
+ },
4159
+ {
4160
+ path: ":id",
4161
+ lazy: async () => {
4162
+ const { Component, Breadcrumb, loader } = await import("./api-key-management-detail-PXY2ZH4V.js");
4163
+ return {
4164
+ Component,
4165
+ loader,
4166
+ handle: {
4167
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
4168
+ }
4169
+ };
4170
+ },
4171
+ children: [
4172
+ {
4173
+ path: "edit",
4174
+ lazy: () => import("./api-key-management-edit-7IPPTW37.js")
4175
+ },
4176
+ {
4177
+ path: "sales-channels",
4178
+ lazy: () => import("./api-key-management-sales-channels-AO6SRCAW.js")
4179
+ }
4180
+ ]
4181
+ }
4182
+ ]
4183
+ },
4184
+ {
4185
+ path: "secret-api-keys",
4186
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
4187
+ handle: {
4188
+ breadcrumb: () => t("apiKeyManagement.domain.secret")
4189
+ },
4190
+ children: [
4191
+ {
4192
+ path: "",
4193
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
4194
+ children: [
4195
+ {
4196
+ path: "",
4197
+ lazy: () => import("./api-key-management-list-QQHOCVV4.js"),
4198
+ children: [
4199
+ {
4200
+ path: "create",
4201
+ lazy: () => import("./api-key-management-create-KERROZ6Z.js")
4202
+ }
4203
+ ]
4204
+ }
4205
+ ]
4206
+ },
4207
+ {
4208
+ path: ":id",
4209
+ lazy: async () => {
4210
+ const { Component, Breadcrumb, loader } = await import("./api-key-management-detail-PXY2ZH4V.js");
4211
+ return {
4212
+ Component,
4213
+ loader,
4214
+ handle: {
4215
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
4216
+ }
4217
+ };
4218
+ },
4219
+ children: [
4220
+ {
4221
+ path: "edit",
4222
+ lazy: () => import("./api-key-management-edit-7IPPTW37.js")
4223
+ }
4224
+ ]
4225
+ }
4226
+ ]
4227
+ },
4228
+ {
4229
+ path: "tax-regions",
4230
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
4231
+ handle: {
4232
+ breadcrumb: () => t("taxRegions.domain")
4233
+ },
4234
+ children: [
4235
+ {
4236
+ path: "",
4237
+ lazy: () => import("./tax-region-list-XRAYDYK3.js"),
4238
+ children: [
4239
+ {
4240
+ path: "create",
4241
+ lazy: () => import("./tax-region-create-XTX4YWRA.js")
4242
+ }
4243
+ ]
4244
+ },
4245
+ {
4246
+ path: ":id",
4247
+ Component: Outlet4,
4248
+ loader: taxRegionLoader,
4249
+ handle: {
4250
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(TaxRegionDetailBreadcrumb, { ...match })
4251
+ },
4252
+ children: [
4253
+ {
4254
+ path: "",
4255
+ lazy: async () => {
4256
+ const { Component } = await import("./tax-region-detail-XUYJHBHI.js");
4257
+ return {
4258
+ Component
4259
+ };
4260
+ },
4261
+ children: [
4262
+ {
4263
+ path: "edit",
4264
+ lazy: () => import("./tax-region-edit-AC64YA64.js")
4265
+ },
4266
+ {
4267
+ path: "provinces/create",
4268
+ lazy: () => import("./tax-region-province-create-GDL65SQF.js")
4269
+ },
4270
+ {
4271
+ path: "overrides/create",
4272
+ lazy: () => import("./tax-region-tax-override-create-X2QWOHSU.js")
4273
+ },
4274
+ {
4275
+ path: "overrides/:tax_rate_id/edit",
4276
+ lazy: () => import("./tax-region-tax-override-edit-VZJ6EPSU.js")
4277
+ },
4278
+ {
4279
+ path: "tax-rates/create",
4280
+ lazy: () => import("./tax-region-tax-rate-create-VC2WDVJJ.js")
4281
+ },
4282
+ {
4283
+ path: "tax-rates/:tax_rate_id/edit",
4284
+ lazy: () => import("./tax-region-tax-rate-edit-SDW36H6I.js")
4285
+ },
4286
+ {
4287
+ path: "metadata/edit",
4288
+ lazy: () => import("./tax-region-metadata-YDQX3Y4X.js")
4289
+ }
4290
+ ]
4291
+ },
4292
+ {
4293
+ path: "provinces/:province_id",
4294
+ lazy: async () => {
4295
+ const { Component, Breadcrumb, loader } = await import("./tax-region-province-detail-QMPIKT7K.js");
4296
+ return {
4297
+ Component,
4298
+ loader,
4299
+ handle: {
4300
+ breadcrumb: (match) => /* @__PURE__ */ jsx15(Breadcrumb, { ...match })
4301
+ }
4302
+ };
4303
+ },
4304
+ children: [
4305
+ {
4306
+ path: "tax-rates/create",
4307
+ lazy: () => import("./tax-region-tax-rate-create-VC2WDVJJ.js")
4308
+ },
4309
+ {
4310
+ path: "tax-rates/:tax_rate_id/edit",
4311
+ lazy: () => import("./tax-region-tax-rate-edit-SDW36H6I.js")
4312
+ },
4313
+ {
4314
+ path: "overrides/create",
4315
+ lazy: () => import("./tax-region-tax-override-create-X2QWOHSU.js")
4316
+ },
4317
+ {
4318
+ path: "overrides/:tax_rate_id/edit",
4319
+ lazy: () => import("./tax-region-tax-override-edit-VZJ6EPSU.js")
4320
+ }
4321
+ ]
4322
+ }
4323
+ ]
4324
+ }
4325
+ ]
4326
+ },
4327
+ {
4328
+ path: "return-reasons",
4329
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
4330
+ handle: {
4331
+ breadcrumb: () => t("returnReasons.domain")
4332
+ },
4333
+ children: [
4334
+ {
4335
+ path: "",
4336
+ lazy: () => import("./return-reason-list-HBSKNIMW.js"),
4337
+ children: [
4338
+ {
4339
+ path: "create",
4340
+ lazy: () => import("./return-reason-create-KTKI6NJE.js")
4341
+ },
4342
+ {
4343
+ path: ":id",
4344
+ children: [
4345
+ {
4346
+ path: "edit",
4347
+ lazy: () => import("./return-reason-edit-5KU7WKJF.js")
4348
+ }
4349
+ ]
4350
+ }
4351
+ ]
4352
+ }
4353
+ ]
4354
+ },
4355
+ {
4356
+ path: "refund-reasons",
4357
+ element: /* @__PURE__ */ jsx15(Outlet4, {}),
4358
+ handle: {
4359
+ breadcrumb: () => t("refundReasons.domain")
4360
+ },
4361
+ children: [
4362
+ {
4363
+ path: "",
4364
+ lazy: () => import("./refund-reason-list-ZEKWYQ45.js"),
4365
+ children: [
4366
+ {
4367
+ path: "create",
4368
+ lazy: () => import("./refund-reason-create-LZCL6QJI.js")
4369
+ },
4370
+ {
4371
+ path: ":id",
4372
+ children: [
4373
+ {
4374
+ path: "edit",
4375
+ lazy: () => import("./refund-reason-edit-QNGFKZMN.js")
4376
+ }
4377
+ ]
4378
+ }
4379
+ ]
4380
+ }
4381
+ ]
4382
+ }
4383
+ ],
4384
+ customSettingsRoutes?.[0]?.children || []
4385
+ )
4386
+ }
4387
+ ]
4388
+ },
4389
+ {
4390
+ element: /* @__PURE__ */ jsx15(PublicLayout, {}),
4391
+ children: [
4392
+ {
4393
+ errorElement: /* @__PURE__ */ jsx15(ErrorBoundary, {}),
4394
+ children: [
4395
+ {
4396
+ path: "/login",
4397
+ lazy: () => import("./login-V4HZQTCQ.js")
4398
+ },
4399
+ {
4400
+ path: "/reset-password",
4401
+ lazy: () => import("./reset-password-VZPICVMM.js")
4402
+ },
4403
+ {
4404
+ path: "/invite",
4405
+ lazy: () => import("./invite-HJ7BRO6H.js")
4406
+ },
4407
+ ...customPublicRoutes,
4408
+ {
4409
+ path: "*",
4410
+ lazy: () => import("./no-match-JLVLPCRH.js")
4411
+ }
4412
+ ]
4413
+ }
4414
+ ]
4415
+ }
4416
+ ];
4417
+ }
4418
+
4419
+ // src/utils/routes.ts
4420
+ var createBranchRoute = (segment) => ({
4421
+ path: segment,
4422
+ children: []
4423
+ });
4424
+ var createLeafRoute = (Component, loader, handle, path = "") => ({
4425
+ path,
4426
+ ErrorBoundary,
4427
+ async lazy() {
4428
+ const result = { Component };
4429
+ if (loader) {
4430
+ result.loader = loader;
4431
+ }
4432
+ if (handle) {
4433
+ result.handle = handle;
4434
+ }
4435
+ return result;
4436
+ }
4437
+ });
4438
+ var createParallelRoute = (path, Component, loader, handle) => ({
4439
+ path,
4440
+ async lazy() {
4441
+ const result = { Component };
4442
+ if (loader) {
4443
+ result.loader = loader;
4444
+ }
4445
+ if (handle) {
4446
+ result.handle = handle;
4447
+ }
4448
+ return result;
4449
+ }
4450
+ });
4451
+ var processParallelRoutes = (parallelRoutes, currentFullPath) => {
4452
+ return parallelRoutes?.map(({ path, Component, loader, handle }) => {
4453
+ const childPath = path?.replace(currentFullPath, "").replace(/^\/+/, "");
4454
+ if (!childPath) {
4455
+ return null;
4456
+ }
4457
+ return createParallelRoute(childPath, Component, loader, handle);
4458
+ }).filter(Boolean);
4459
+ };
4460
+ var addRoute = (pathSegments, Component, currentLevel, loader, handle, parallelRoutes, fullPath, componentPath) => {
4461
+ if (!pathSegments.length) {
4462
+ return;
4463
+ }
4464
+ const [currentSegment, ...remainingSegments] = pathSegments;
4465
+ let route = currentLevel.find((r) => r.path === currentSegment);
4466
+ if (!route) {
4467
+ route = createBranchRoute(currentSegment);
4468
+ currentLevel.push(route);
4469
+ }
4470
+ const currentFullPath = fullPath ? `${fullPath}/${currentSegment}` : currentSegment;
4471
+ const isComponentSegment = currentFullPath === componentPath;
4472
+ if (isComponentSegment || remainingSegments.length === 0) {
4473
+ route.children || (route.children = []);
4474
+ if (handle) {
4475
+ route.handle = handle;
4476
+ }
4477
+ if (loader) {
4478
+ route.loader = loader;
4479
+ }
4480
+ if (currentSegment === "*?" || currentSegment === "*") {
4481
+ const leaf = createLeafRoute(Component, loader, handle, currentSegment);
4482
+ leaf.children = processParallelRoutes(parallelRoutes, currentFullPath);
4483
+ Object.assign(route, leaf);
4484
+ } else {
4485
+ const leaf = createLeafRoute(Component, loader);
4486
+ leaf.children = processParallelRoutes(parallelRoutes, currentFullPath);
4487
+ route.children.push(leaf);
4488
+ }
4489
+ if (remainingSegments.length > 0) {
4490
+ addRoute(
4491
+ remainingSegments,
4492
+ Component,
4493
+ route.children,
4494
+ void 0,
4495
+ void 0,
4496
+ void 0,
4497
+ currentFullPath
4498
+ );
4499
+ }
4500
+ } else {
4501
+ route.children || (route.children = []);
4502
+ addRoute(
4503
+ remainingSegments,
4504
+ Component,
4505
+ route.children,
4506
+ loader,
4507
+ handle,
4508
+ parallelRoutes,
4509
+ currentFullPath,
4510
+ componentPath
4511
+ );
4512
+ }
4513
+ };
4514
+ var createRouteMap = (routes, ignore) => {
4515
+ const root = [];
4516
+ routes.forEach(({ path, Component, loader, handle, children }) => {
4517
+ const cleanedPath = ignore ? path.replace(ignore, "").replace(/^\/+/, "") : path.replace(/^\/+/, "");
4518
+ const pathSegments = cleanedPath.split("/").filter(Boolean);
4519
+ addRoute(
4520
+ pathSegments,
4521
+ Component,
4522
+ root,
4523
+ loader,
4524
+ handle,
4525
+ children,
4526
+ void 0,
4527
+ path
4528
+ );
4529
+ });
4530
+ return root;
4531
+ };
4532
+ var settingsRouteRegex = /^\/settings\//;
4533
+ var getRoutesByType = (routes, type) => {
4534
+ return routes.filter((route) => {
4535
+ if (type === "public") {
4536
+ return route.isPublic === true;
4537
+ }
4538
+ if (type === "settings") {
4539
+ return !route.isPublic && settingsRouteRegex.test(route.path);
4540
+ }
4541
+ return !route.isPublic && !settingsRouteRegex.test(route.path);
4542
+ });
4543
+ };
4544
+
4545
+ // src/app.tsx
4546
+ import { useMemo as useMemo5 } from "react";
4547
+ import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
4548
+ function App() {
4549
+ const routes = useMemo5(() => {
4550
+ return {
4551
+ settingsRoutes: createRouteMap(getRoutesByType(customRoutes, "settings")),
4552
+ mainRoutes: createRouteMap(getRoutesByType(customRoutes, "main")),
4553
+ publicRoutes: createRouteMap(getRoutesByType(customRoutes, "public"))
4554
+ };
4555
+ }, [customRoutes]);
4556
+ return /* @__PURE__ */ jsx16(TooltipProvider, { children: /* @__PURE__ */ jsx16(HelmetProvider, { children: /* @__PURE__ */ jsx16(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxs10(ThemeProvider, { children: [
4557
+ /* @__PURE__ */ jsx16(I18n, {}),
4558
+ /* @__PURE__ */ jsx16(I18nProvider, { children: /* @__PURE__ */ jsx16(
4559
+ RouterProvider,
4560
+ {
4561
+ router: createBrowserRouter(getRouteMap(routes))
4562
+ }
4563
+ ) }),
4564
+ /* @__PURE__ */ jsx16(Toaster, {})
4565
+ ] }) }) }) });
4566
+ }
4567
+
4568
+ // src/components/tabbed-form/tabbed-form.tsx
4569
+ import { Button as Button2, ProgressTabs } from "@medusajs/ui";
4570
+ import {
4571
+ Children as Children2,
4572
+ createContext as createContext5,
4573
+ useContext as useContext5,
4574
+ useMemo as useMemo7
4575
+ } from "react";
4576
+ import { useTranslation as useTranslation11 } from "react-i18next";
4577
+
4578
+ // src/components/tabbed-form/use-tab-management.ts
4579
+ import { useCallback as useCallback6, useEffect as useEffect11, useMemo as useMemo6, useState as useState13 } from "react";
4580
+ var useTabManagement = ({
4581
+ tabs,
4582
+ form
4583
+ }) => {
4584
+ const visibleTabs = useMemo6(
4585
+ () => tabs.filter((t2) => !t2.isVisible || t2.isVisible(form)),
4586
+ [tabs, form]
4587
+ );
4588
+ const [activeTabId, setActiveTabId] = useState13(
4589
+ visibleTabs[0]?.id ?? ""
4590
+ );
4591
+ const [tabState, setTabState] = useState13(() => {
4592
+ const state = {};
4593
+ visibleTabs.forEach((t2, i) => {
4594
+ state[t2.id] = i === 0 ? "in-progress" : "not-started";
4595
+ });
4596
+ return state;
4597
+ });
4598
+ useEffect11(() => {
4599
+ const newState = {};
4600
+ const activeIndex2 = visibleTabs.findIndex((t2) => t2.id === activeTabId);
4601
+ visibleTabs.forEach((t2, i) => {
4602
+ if (i < activeIndex2) {
4603
+ newState[t2.id] = "completed";
4604
+ } else if (i === activeIndex2) {
4605
+ newState[t2.id] = "in-progress";
4606
+ } else {
4607
+ newState[t2.id] = tabState[t2.id] ?? "not-started";
4608
+ }
4609
+ });
4610
+ setTabState(newState);
4611
+ }, [activeTabId, visibleTabs]);
4612
+ const activeIndex = visibleTabs.findIndex((t2) => t2.id === activeTabId);
4613
+ const isLastTab = activeIndex === visibleTabs.length - 1;
4614
+ const onNext = useCallback6(async () => {
4615
+ const valid = await form.trigger();
4616
+ if (!valid) {
4617
+ return;
4618
+ }
4619
+ if (activeIndex < visibleTabs.length - 1) {
4620
+ setActiveTabId(visibleTabs[activeIndex + 1].id);
4621
+ }
4622
+ }, [form, activeIndex, visibleTabs]);
4623
+ const onTabChange = useCallback6(
4624
+ async (tabId) => {
4625
+ const valid = await form.trigger();
4626
+ if (!valid) {
4627
+ return;
4628
+ }
4629
+ setActiveTabId(tabId);
4630
+ },
4631
+ [form]
4632
+ );
4633
+ return {
4634
+ activeTabId,
4635
+ setActiveTabId,
4636
+ tabState,
4637
+ visibleTabs,
4638
+ isLastTab,
4639
+ onNext,
4640
+ onTabChange
4641
+ };
4642
+ };
4643
+
4644
+ // src/components/tabbed-form/tabbed-form.tsx
4645
+ import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
4646
+ var TabbedFormContext = createContext5(null);
4647
+ var useTabbedForm = () => {
4648
+ const form = useContext5(TabbedFormContext);
4649
+ if (!form) {
4650
+ throw new Error("useTabbedForm must be used within a TabbedForm");
4651
+ }
4652
+ return form;
4653
+ };
4654
+ function resolveTabMeta(child) {
4655
+ const type = child.type;
4656
+ const meta = type?._tabMeta;
4657
+ if (!meta && !child.props?.id) {
4658
+ return null;
4659
+ }
4660
+ return {
4661
+ id: child.props?.id ?? meta?.id ?? "",
4662
+ labelKey: meta?.labelKey ?? "",
4663
+ label: child.props?.label,
4664
+ validationFields: child.props?.validationFields ?? meta?.validationFields,
4665
+ isVisible: child.props?.isVisible ?? meta?.isVisible
4666
+ };
4667
+ }
4668
+ function collectTabs(children) {
4669
+ const tabs = [];
4670
+ const elements = [];
4671
+ Children2.forEach(children, (child) => {
4672
+ if (!child || typeof child !== "object" || !("type" in child)) {
4673
+ return;
4674
+ }
4675
+ const meta = resolveTabMeta(child);
4676
+ if (meta) {
4677
+ tabs.push(meta);
4678
+ elements.push(child);
4679
+ }
4680
+ });
4681
+ return { tabs, elements };
4682
+ }
4683
+ function Root({
4684
+ form,
4685
+ onSubmit,
4686
+ children,
4687
+ isLoading,
4688
+ footer,
4689
+ transformTabs
4690
+ }) {
4691
+ const { t: t2 } = useTranslation11();
4692
+ const { tabs: rawTabs, elements } = useMemo7(
4693
+ () => collectTabs(children),
4694
+ [children]
4695
+ );
4696
+ const tabs = useMemo7(
4697
+ () => transformTabs ? transformTabs(rawTabs) : rawTabs,
4698
+ [transformTabs, rawTabs]
4699
+ );
4700
+ const {
4701
+ activeTabId,
4702
+ tabState,
4703
+ visibleTabs,
4704
+ isLastTab,
4705
+ onNext,
4706
+ onTabChange
4707
+ } = useTabManagement({
4708
+ tabs,
4709
+ form
4710
+ });
4711
+ const visibleElements = elements.filter((el) => {
4712
+ const meta = resolveTabMeta(el);
4713
+ return meta && visibleTabs.some((vt) => vt.id === meta.id);
4714
+ });
4715
+ return /* @__PURE__ */ jsx17(TabbedFormContext.Provider, { value: form, children: /* @__PURE__ */ jsx17(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs11(
4716
+ KeyboundForm,
4717
+ {
4718
+ onKeyDown: (e) => {
4719
+ if (e.key === "Enter") {
4720
+ if (e.target instanceof HTMLTextAreaElement && !(e.metaKey || e.ctrlKey)) {
4721
+ return;
4722
+ }
4723
+ e.preventDefault();
4724
+ if (e.metaKey || e.ctrlKey) {
4725
+ if (!isLastTab) {
4726
+ e.preventDefault();
4727
+ e.stopPropagation();
4728
+ onNext();
4729
+ return;
4730
+ }
4731
+ onSubmit();
4732
+ }
4733
+ }
4734
+ },
4735
+ onSubmit,
4736
+ className: "flex h-full flex-col",
4737
+ children: [
4738
+ /* @__PURE__ */ jsxs11(
4739
+ ProgressTabs,
4740
+ {
4741
+ value: activeTabId,
4742
+ onValueChange: onTabChange,
4743
+ className: "flex h-full flex-col overflow-hidden",
4744
+ children: [
4745
+ /* @__PURE__ */ jsx17(RouteFocusModal.Header, { children: /* @__PURE__ */ jsx17("div", { className: "-my-2 w-full border-l", children: /* @__PURE__ */ jsx17(ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: visibleTabs.map((tab) => /* @__PURE__ */ jsx17(
4746
+ ProgressTabs.Trigger,
4747
+ {
4748
+ status: tabState[tab.id] ?? "not-started",
4749
+ value: tab.id,
4750
+ className: "max-w-[200px] truncate",
4751
+ children: tab.label ?? t2(tab.labelKey)
4752
+ },
4753
+ tab.id
4754
+ )) }) }) }),
4755
+ /* @__PURE__ */ jsx17(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: visibleElements.map((element) => {
4756
+ const meta = resolveTabMeta(element);
4757
+ return /* @__PURE__ */ jsx17(
4758
+ ProgressTabs.Content,
4759
+ {
4760
+ className: "size-full overflow-y-auto",
4761
+ value: meta.id,
4762
+ children: element
4763
+ },
4764
+ meta.id
4765
+ );
4766
+ }) })
4767
+ ]
4768
+ }
4769
+ ),
4770
+ /* @__PURE__ */ jsx17(RouteFocusModal.Footer, { children: footer ? footer({ isLastTab, onNext, isLoading }) : /* @__PURE__ */ jsx17(
4771
+ DefaultFooter,
4772
+ {
4773
+ isLastTab,
4774
+ onNext,
4775
+ isLoading
4776
+ }
4777
+ ) })
4778
+ ]
4779
+ }
4780
+ ) }) });
4781
+ }
4782
+ var DefaultFooter = ({
4783
+ isLastTab,
4784
+ onNext,
4785
+ isLoading
4786
+ }) => {
4787
+ const { t: t2 } = useTranslation11();
4788
+ return /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-end gap-x-2", children: [
4789
+ /* @__PURE__ */ jsx17(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx17(Button2, { variant: "secondary", size: "small", children: t2("actions.cancel") }) }),
4790
+ isLastTab ? /* @__PURE__ */ jsx17(
4791
+ Button2,
4792
+ {
4793
+ type: "submit",
4794
+ variant: "primary",
4795
+ size: "small",
4796
+ isLoading,
4797
+ children: t2("actions.save")
4798
+ },
4799
+ "submit-button"
4800
+ ) : /* @__PURE__ */ jsx17(
4801
+ Button2,
4802
+ {
4803
+ type: "button",
4804
+ variant: "primary",
4805
+ size: "small",
4806
+ onClick: () => onNext(),
4807
+ children: t2("actions.continue")
4808
+ },
4809
+ "next-button"
4810
+ )
4811
+ ] });
4812
+ };
4813
+ var Tab = ({
4814
+ children
4815
+ }) => {
4816
+ return /* @__PURE__ */ jsx17("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsx17("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children }) });
4817
+ };
4818
+ var TabbedForm = Object.assign(Root, { Tab, useForm: useTabbedForm });
4819
+ export {
4820
+ Notifications,
4821
+ TabbedForm,
4822
+ App as default,
4823
+ useTabbedForm
4824
+ };