@unchainedshop/admin-ui 5.0.0-alpha.6 → 5.0.0-alpha.7

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 (711) hide show
  1. package/README.md +27 -19
  2. package/dist/chunk-2RTX42IE.js +2083 -0
  3. package/dist/chunk-6UGLNLJG.js +44 -0
  4. package/dist/{chunk-UXG7EYHC.js → chunk-7PPOGX7R.js} +2 -35
  5. package/dist/{chunk-45H2WVIC.js → chunk-COV7BREX.js} +0 -1
  6. package/dist/{chunk-RHUFQVKL.js → chunk-F2TCVEQX.js} +1 -1
  7. package/dist/{chunk-UFYR5WZT.js → chunk-GY2DRQGW.js} +2 -1
  8. package/dist/{chunk-BGCKJQGS.js → chunk-JAVEZY3Q.js} +22 -15
  9. package/dist/{chunk-6TXD4TA7.js → chunk-KCN7DDPH.js} +2 -82
  10. package/dist/{chunk-YSKZE2KN.js → chunk-MSPWYMDY.js} +37 -24
  11. package/dist/chunk-RORNAN2J.js +12 -0
  12. package/dist/chunk-YZGQJJCD.js +37 -0
  13. package/dist/components/ui/Tag/TagInput.d.ts +10 -5
  14. package/dist/components/ui/Tag/TagInput.d.ts.map +1 -1
  15. package/dist/components/ui/form/TagInputField.d.ts +2 -1
  16. package/dist/components/ui/form/TagInputField.d.ts.map +1 -1
  17. package/dist/form.js +699 -2497
  18. package/dist/gql/operation-types.d.ts +13043 -0
  19. package/dist/gql/operation-types.d.ts.map +1 -0
  20. package/dist/gql/schema-types.d.ts +3820 -0
  21. package/dist/gql/schema-types.d.ts.map +1 -0
  22. package/dist/gql/types.d.ts +2 -17208
  23. package/dist/gql/types.d.ts.map +1 -1
  24. package/dist/hooks.js +3 -2
  25. package/dist/modal.js +9 -5
  26. package/dist/modules/accounts/fragment/UserFragment.d.ts.map +1 -1
  27. package/dist/modules/accounts/hooks/useCurrentUser.d.ts.map +1 -1
  28. package/dist/modules/accounts.js +219 -63
  29. package/dist/modules/assortment.js +9 -4
  30. package/dist/modules/common/hooks/useApp.d.ts +1 -1
  31. package/dist/modules/common/hooks/useBulkResultHandler.d.ts +8 -0
  32. package/dist/modules/common/hooks/useBulkResultHandler.d.ts.map +1 -0
  33. package/dist/modules/common/hooks/useBulkSelection.d.ts +12 -0
  34. package/dist/modules/common/hooks/useBulkSelection.d.ts.map +1 -0
  35. package/dist/modules/common/hooks/useScrollRestoration.d.ts +8 -0
  36. package/dist/modules/common/hooks/useScrollRestoration.d.ts.map +1 -0
  37. package/dist/modules/common/hooks/useShopInfo.d.ts +13 -13
  38. package/dist/modules/common/hooks/useShopInfo.d.ts.map +1 -1
  39. package/dist/modules/common/utils/useFormatDateTime.d.ts +10 -1
  40. package/dist/modules/common/utils/useFormatDateTime.d.ts.map +1 -1
  41. package/dist/modules/country/hooks/useCountries.d.ts +4 -4
  42. package/dist/modules/enrollment.js +23 -2
  43. package/dist/modules/event.js +1 -1
  44. package/dist/modules/filter.js +1 -1
  45. package/dist/modules/language/hooks/useLanguages.d.ts +4 -4
  46. package/dist/modules/modal/components/DangerMessage.d.ts +2 -1
  47. package/dist/modules/modal/components/DangerMessage.d.ts.map +1 -1
  48. package/dist/modules/order/hooks/useOrders.d.ts +20 -20
  49. package/dist/modules/order/hooks/useOrders.d.ts.map +1 -1
  50. package/dist/modules/order.js +9 -3
  51. package/dist/modules/product-review.js +24 -5
  52. package/dist/modules/product.js +12 -16
  53. package/dist/modules/quotation.js +22 -2
  54. package/dist/modules/token.js +1 -1
  55. package/dist/modules/work/hooks/useWork.d.ts +14 -14
  56. package/dist/modules/work.js +17 -5
  57. package/dist/plugins.js +6 -1
  58. package/dist/providers.js +3 -3
  59. package/dist/sdk/plugins.d.ts +11 -0
  60. package/dist/sdk/plugins.d.ts.map +1 -1
  61. package/dist/sdk/shims/admin-ui-plugins.d.ts +3 -0
  62. package/dist/sdk/shims/admin-ui-plugins.d.ts.map +1 -0
  63. package/dist/sdk/shims/apollo-client-react.d.ts +3 -0
  64. package/dist/sdk/shims/apollo-client-react.d.ts.map +1 -0
  65. package/dist/sdk/shims/apollo-client.d.ts +3 -0
  66. package/dist/sdk/shims/apollo-client.d.ts.map +1 -0
  67. package/dist/sdk/shims/host.d.ts +17 -0
  68. package/dist/sdk/shims/host.d.ts.map +1 -0
  69. package/dist/sdk/shims/next-head.d.ts +3 -0
  70. package/dist/sdk/shims/next-head.d.ts.map +1 -0
  71. package/dist/sdk/shims/next-image.d.ts +3 -0
  72. package/dist/sdk/shims/next-image.d.ts.map +1 -0
  73. package/dist/sdk/shims/next-link.d.ts +3 -0
  74. package/dist/sdk/shims/next-link.d.ts.map +1 -0
  75. package/dist/sdk/shims/next-router.d.ts +3 -0
  76. package/dist/sdk/shims/next-router.d.ts.map +1 -0
  77. package/dist/sdk/shims/react-dom-client.d.ts +3 -0
  78. package/dist/sdk/shims/react-dom-client.d.ts.map +1 -0
  79. package/dist/sdk/shims/react-dom.d.ts +3 -0
  80. package/dist/sdk/shims/react-dom.d.ts.map +1 -0
  81. package/dist/sdk/shims/react-hook-form.d.ts +3 -0
  82. package/dist/sdk/shims/react-hook-form.d.ts.map +1 -0
  83. package/dist/sdk/shims/react-intl.d.ts +3 -0
  84. package/dist/sdk/shims/react-intl.d.ts.map +1 -0
  85. package/dist/sdk/shims/react-jsx-runtime.d.ts +3 -0
  86. package/dist/sdk/shims/react-jsx-runtime.d.ts.map +1 -0
  87. package/dist/sdk/shims/react-toastify.d.ts +3 -0
  88. package/dist/sdk/shims/react-toastify.d.ts.map +1 -0
  89. package/dist/sdk/shims/react.d.ts +3 -0
  90. package/dist/sdk/shims/react.d.ts.map +1 -0
  91. package/dist/shims/admin-ui-plugins.js +9 -0
  92. package/dist/shims/apollo-client-react.js +25 -0
  93. package/dist/shims/apollo-client.js +55 -0
  94. package/dist/shims/next-head.js +9 -0
  95. package/dist/shims/next-image.js +9 -0
  96. package/dist/shims/next-link.js +9 -0
  97. package/dist/shims/next-router.js +13 -0
  98. package/dist/shims/react-dom-client.js +11 -0
  99. package/dist/shims/react-dom.js +22 -0
  100. package/dist/shims/react-hook-form.js +25 -0
  101. package/dist/shims/react-intl.js +37 -0
  102. package/dist/shims/react-jsx-runtime.js +11 -0
  103. package/dist/shims/react-toastify.js +16 -0
  104. package/dist/shims/react.js +52 -0
  105. package/dist/ui.js +1261 -3443
  106. package/out/403/index.html +2 -2
  107. package/out/404/index.html +2 -2
  108. package/out/404.html +2 -2
  109. package/out/423/index.html +2 -2
  110. package/out/500/index.html +2 -2
  111. package/out/_next/static/chunks/0-2b37ubdpy0o.js +7 -0
  112. package/out/_next/static/chunks/0-cyinqk2ne8t.js +16 -0
  113. package/out/_next/static/chunks/00tf1qsuwqywe.js +17 -0
  114. package/out/_next/static/chunks/015ge5k3o3f-r.js +226 -0
  115. package/out/_next/static/chunks/0208v89kdo_s9.js +13 -0
  116. package/out/_next/static/chunks/05-ui58k9illr.js +234 -0
  117. package/out/_next/static/chunks/05au-xyt__0f2.js +3 -0
  118. package/out/_next/static/chunks/{087a2d-0e1pvn.js → 05nn5xr3ufcsh.js} +1 -1
  119. package/out/_next/static/chunks/{1m5m15javwn8p.js → 05o_q7jg8wucs.js} +1 -1
  120. package/out/_next/static/chunks/0752goe9_9g2s.js +110 -0
  121. package/out/_next/static/chunks/07o7bmqljy89r.js +1 -0
  122. package/out/_next/static/chunks/083ylavob4a8d.js +3 -0
  123. package/out/_next/static/chunks/09qx8ltnvw8f2.js +12 -0
  124. package/out/_next/static/chunks/0_puys1lwhv9m.js +16 -0
  125. package/out/_next/static/chunks/0_xtedn8e1vu_.js +13 -0
  126. package/out/_next/static/chunks/0a_bg-ub3r2eo.js +60 -0
  127. package/out/_next/static/chunks/0b33bcf7x5rgy.js +20 -0
  128. package/out/_next/static/chunks/0ckhtcvz1kyxg.js +1 -0
  129. package/out/_next/static/chunks/0dewly3vo-mcq.js +20 -0
  130. package/out/_next/static/chunks/{19y4w6_d_qiou.js → 0dnh0kr83_tj0.js} +1 -1
  131. package/out/_next/static/chunks/0dxu94yin5gdn.js +35 -0
  132. package/out/_next/static/chunks/0e2c-jlh2q_eq.js +74 -0
  133. package/out/_next/static/chunks/0fv1w56e25gt5.js +14 -0
  134. package/out/_next/static/chunks/0i9ymn9xxs0nx.js +18 -0
  135. package/out/_next/static/chunks/0ij8fs6-w0pr_.js +22 -0
  136. package/out/_next/static/chunks/0iqjlf_9c6eo_.js +59 -0
  137. package/out/_next/static/chunks/0j838r-8ied1f.js +1 -0
  138. package/out/_next/static/chunks/0jeddko6bac8h.js +1 -0
  139. package/out/_next/static/chunks/0kwf2vel2xmdi.js +13 -0
  140. package/out/_next/static/chunks/0m6jydfuy_4o3.js +1 -0
  141. package/out/_next/static/chunks/0mez27zlo26ni.js +103 -0
  142. package/out/_next/static/chunks/0n9to89fz811b.js +3 -0
  143. package/out/_next/static/chunks/0nga8f0q2d0bl.js +14 -0
  144. package/out/_next/static/chunks/0nkkcq0-s-9fo.js +1 -0
  145. package/out/_next/static/chunks/0nlirgt-x5pqr.js +337 -0
  146. package/out/_next/static/chunks/0o7k5vanq57ch.js +807 -0
  147. package/out/_next/static/chunks/0om7fxf5bczpu.js +13 -0
  148. package/out/_next/static/chunks/0ou6gsnpn0wml.js +1 -0
  149. package/out/_next/static/chunks/0p09_ncs0g7m2.js +14 -0
  150. package/out/_next/static/chunks/0pji5t2zheb2j.js +234 -0
  151. package/out/_next/static/chunks/0q6-fplpae_ie.js +21 -0
  152. package/out/_next/static/chunks/0qh0vqpui2alf.js +9 -0
  153. package/out/_next/static/chunks/0qq_lp3pk8bjf.js +27 -0
  154. package/out/_next/static/chunks/0rgdxqr_0y-g-.js +136 -0
  155. package/out/_next/static/chunks/0rqjr_lmrk4pz.js +5 -0
  156. package/out/_next/static/chunks/0sc71p-6lnm1e.js +13 -0
  157. package/out/_next/static/chunks/0tej_--_qru5h.js +126 -0
  158. package/out/_next/static/chunks/0tnyefaaxof6-.js +247 -0
  159. package/out/_next/static/chunks/{1dsjo02ozub3p.js → 0ubzi2s1spm4e.js} +4 -4
  160. package/out/_next/static/chunks/0uecw_5mn0zvr.js +110 -0
  161. package/out/_next/static/chunks/0vbqa5pd_ajm5.js +1 -0
  162. package/out/_next/static/chunks/0w7ic_22nz92w.js +58 -0
  163. package/out/_next/static/chunks/0y4eg57kgif01.js +1 -0
  164. package/out/_next/static/chunks/0ywlba3uh1t0x.js +16 -0
  165. package/out/_next/static/chunks/0zoum0jzrtu0s.js +145 -0
  166. package/out/_next/static/chunks/1184evhxs01_c.js +11 -0
  167. package/out/_next/static/chunks/11oq6l46lynfn.js +22 -0
  168. package/out/_next/static/chunks/11zynllx8mmh5.js +15 -0
  169. package/out/_next/static/chunks/13__7-sf28ub5.js +17 -0
  170. package/out/_next/static/chunks/13u_a5l2xngm4.js +1 -0
  171. package/out/_next/static/chunks/13wfvr2b0-qlj.js +30 -0
  172. package/out/_next/static/chunks/14c_mq04p7pu0.js +171 -0
  173. package/out/_next/static/chunks/151puw-sc__by.js +103 -0
  174. package/out/_next/static/chunks/15vz50rks0o2-.js +238 -0
  175. package/out/_next/static/chunks/17b4rvj5k8ye2.js +807 -0
  176. package/out/_next/static/chunks/188l-km9dyejj.js +34 -0
  177. package/out/_next/static/chunks/{252n_i72ate30.js → 18juy_eauk94g.js} +2 -2
  178. package/out/_next/static/chunks/{0k-vf2ns330qm.js → 19eflki8bmivb.js} +1 -1
  179. package/out/_next/static/chunks/19eu5d-wm2hfr.js +23 -0
  180. package/out/_next/static/chunks/19ou9pxeiwehs.js +15 -0
  181. package/out/_next/static/chunks/19pi48hqksvo9.js +9 -0
  182. package/out/_next/static/chunks/1_5ba1obzc231.js +1 -0
  183. package/out/_next/static/chunks/1_lrjs51fhhko.js +807 -0
  184. package/out/_next/static/chunks/1am9n6exll687.js +807 -0
  185. package/out/_next/static/chunks/1cfjbvjo0o9fx.js +104 -0
  186. package/out/_next/static/chunks/1cqhbfj3zp710.js +1 -0
  187. package/out/_next/static/chunks/1cy-2yb5j5_9b.js +157 -0
  188. package/out/_next/static/chunks/1dqgs827_hiod.js +16 -0
  189. package/out/_next/static/chunks/{1ji44prsmhq_a.js → 1dt9_bzfioi8a.js} +3 -3
  190. package/out/_next/static/chunks/1fg6jbuxeuj0w.js +14 -0
  191. package/out/_next/static/chunks/1fvr9k_o63j_m.js +16 -0
  192. package/out/_next/static/chunks/1h_o__x8jw8gt.js +15 -0
  193. package/out/_next/static/chunks/1imv5a-ymrj2t.js +15 -0
  194. package/out/_next/static/chunks/1k4ep4igedo8p.js +1 -0
  195. package/out/_next/static/chunks/1kn74nabrpy14.js +3 -0
  196. package/out/_next/static/chunks/{34sm1u3s14z4b.js → 1ndk3s-aeqfej.js} +1 -1
  197. package/out/_next/static/chunks/1o4hor3cwzcxc.js +15 -0
  198. package/out/_next/static/chunks/1og09fg689_nc.js +180 -0
  199. package/out/_next/static/chunks/1q_sewe1wbxsk.js +54 -0
  200. package/out/_next/static/chunks/1qwid0d89bzpw.js +17 -0
  201. package/out/_next/static/chunks/1r7dh_p70r7o8.js +13 -0
  202. package/out/_next/static/chunks/1r_e-dk-1oicl.js +2 -0
  203. package/out/_next/static/chunks/1rtv3c_klo0jk.js +1 -0
  204. package/out/_next/static/chunks/1rw6681ieb3-5.js +8 -0
  205. package/out/_next/static/chunks/1srfjl1rurrm9.js +3 -0
  206. package/out/_next/static/chunks/1t8mb2td_pm1h.js +43 -0
  207. package/out/_next/static/chunks/1v-2aqdslc2g1.js +1 -0
  208. package/out/_next/static/chunks/1w5uao_cylgd1.js +234 -0
  209. package/out/_next/static/chunks/1x-t9f0f5vr10.js +329 -0
  210. package/out/_next/static/chunks/1ylgjha1c0ua_.js +124 -0
  211. package/out/_next/static/chunks/1yp98n-n4gxwy.js +15 -0
  212. package/out/_next/static/chunks/1yy_-xc9xthfo.js +3 -0
  213. package/out/_next/static/chunks/1z1esw-t8kopy.js +1 -0
  214. package/out/_next/static/chunks/2-7e3ttj92hfr.js +17 -0
  215. package/out/_next/static/chunks/200_u2ywg-be1.js +43 -0
  216. package/out/_next/static/chunks/224ovcn90ebcs.js +25 -0
  217. package/out/_next/static/chunks/24-pobk4qjjvp.js +3 -0
  218. package/out/_next/static/chunks/2540mqfxc7ehr.js +15 -0
  219. package/out/_next/static/chunks/{1rgwj4dr0k4_b.js → 270ua9t85a7ev.js} +1 -1
  220. package/out/_next/static/chunks/27jaailh2k450.js +879 -0
  221. package/out/_next/static/chunks/2_l14rwu6kgzl.js +11 -0
  222. package/out/_next/static/chunks/2_vu2hve2j-6g.js +5 -0
  223. package/out/_next/static/chunks/2cmaw01_r48ot.js +21 -0
  224. package/out/_next/static/chunks/2d1zehr8zc3vb.js +9 -0
  225. package/out/_next/static/chunks/{2tw-iq1oliu-h.js → 2dvrbmh97duba.js} +1 -1
  226. package/out/_next/static/chunks/{34dhtdp_8idgm.js → 2dyj8q92_k5el.js} +112 -62
  227. package/out/_next/static/chunks/2e0dz59httb-e.js +43 -0
  228. package/out/_next/static/chunks/2e47h0g7w7si3.js +7 -0
  229. package/out/_next/static/chunks/2fjmw94mat8m0.js +807 -0
  230. package/out/_next/static/chunks/{0f7z8oojvqahv.js → 2fo2ki1egxbah.js} +1 -1
  231. package/out/_next/static/chunks/2httcwd92at4i.js +9 -0
  232. package/out/_next/static/chunks/2ib6fee-nqe-z.js +23 -0
  233. package/out/_next/static/chunks/2l4pfo_tsvn5w.js +11 -0
  234. package/out/_next/static/chunks/2l629mu99aqil.js +9 -0
  235. package/out/_next/static/chunks/2le8e8u2nvp0j.js +16 -0
  236. package/out/_next/static/chunks/2lx_iig9xewfj.js +52 -0
  237. package/out/_next/static/chunks/2nm_wdmfjcbyc.js +25 -0
  238. package/out/_next/static/chunks/2o9hdz0gk1-s7.js +165 -0
  239. package/out/_next/static/chunks/2ork76jhxvxke.js +138 -0
  240. package/out/_next/static/chunks/2ou2_nhvunq72.js +13 -0
  241. package/out/_next/static/chunks/2pf0d3jgcae7b.js +99 -0
  242. package/out/_next/static/chunks/2q-mpau-4gsvd.js +1 -0
  243. package/out/_next/static/chunks/2qzxq2qs80c_8.js +11 -0
  244. package/out/_next/static/chunks/2rddaar-ns45d.js +116 -0
  245. package/out/_next/static/chunks/2rve5gtfjiz-p.js +100 -0
  246. package/out/_next/static/chunks/2rywg4dn0aeez.js +1 -0
  247. package/out/_next/static/chunks/2s6u8274_jzk2.js +105 -0
  248. package/out/_next/static/chunks/2t-_fecnp5yzr.js +15 -0
  249. package/out/_next/static/chunks/2tm822rgn8g7-.js +19 -0
  250. package/out/_next/static/chunks/{1cgliwmj52a0t.js → 2u6jwsqz0uhes.js} +3 -3
  251. package/out/_next/static/chunks/2u8ns-x384r3i.js +22 -0
  252. package/out/_next/static/chunks/{08o69avnk4qvk.js → 2v4k4vpb2id7m.js} +1 -1
  253. package/out/_next/static/chunks/2v57_n8he320z.js +83 -0
  254. package/out/_next/static/chunks/2vkqez8xx-yp9.js +807 -0
  255. package/out/_next/static/chunks/2ztcyhxd9w5_m.js +1 -0
  256. package/out/_next/static/chunks/304cl99rh8rs_.js +2 -0
  257. package/out/_next/static/chunks/30_ns6urg1dkn.js +41 -0
  258. package/out/_next/static/chunks/{0gurfn3nhm859.js → 313i1x81q2xj1.js} +1 -1
  259. package/out/_next/static/chunks/325a7n__tfxy_.js +61 -0
  260. package/out/_next/static/chunks/326rk3t0gtxp_.js +14 -0
  261. package/out/_next/static/chunks/32te9ivrk54l0.js +15 -0
  262. package/out/_next/static/chunks/339y1tm7s80tn.js +22 -0
  263. package/out/_next/static/chunks/33emlry70k-lv.js +2 -0
  264. package/out/_next/static/chunks/{202a3z9hys0o7.js → 346itdsbw-5tn.js} +2 -2
  265. package/out/_next/static/chunks/351jscvbk_wb9.js +13 -0
  266. package/out/_next/static/chunks/355nca7if7l9n.js +17 -0
  267. package/out/_next/static/chunks/357odtev0t245.js +59 -0
  268. package/out/_next/static/chunks/{2oz58zpay0wub.js → 35fjd9uhctw7y.js} +1 -1
  269. package/out/_next/static/chunks/36aqs7u7s-lb1.js +119 -0
  270. package/out/_next/static/chunks/36zrtyhmqlx_n.js +807 -0
  271. package/out/_next/static/chunks/{18yg2pj3hb_in.js → 37uz0njkj43tz.js} +1 -1
  272. package/out/_next/static/chunks/38ffn8gazqz8_.js +3 -0
  273. package/out/_next/static/chunks/39-19ao-xkexy.js +2 -0
  274. package/out/_next/static/chunks/39m5tbxzzsmn4.js +807 -0
  275. package/out/_next/static/chunks/3_dqxs_vhmfqd.js +14 -0
  276. package/out/_next/static/chunks/3bgtu00fe99yc.js +1 -0
  277. package/out/_next/static/chunks/3c1rc1w-xe4u7.js +39 -0
  278. package/out/_next/static/chunks/3cdfuacs4_0d-.js +1 -0
  279. package/out/_next/static/chunks/3cp9qqljcytup.js +9 -0
  280. package/out/_next/static/chunks/3cq123yj25_36.js +1 -0
  281. package/out/_next/static/chunks/3d1ofcqmlbg-5.js +52 -0
  282. package/out/_next/static/chunks/3dopaxkoi5px6.js +1 -0
  283. package/out/_next/static/chunks/3doujqxnfq19f.js +16 -0
  284. package/out/_next/static/chunks/3grllla8v0ctl.js +14 -0
  285. package/out/_next/static/chunks/3hqec4-3one07.js +15 -0
  286. package/out/_next/static/chunks/3ic_dagw-uvrx.js +234 -0
  287. package/out/_next/static/chunks/3idwjqiel9n9v.js +18 -0
  288. package/out/_next/static/chunks/{0qjv_q4seojfh.js → 3il9u-mfrp2sn.js} +1 -1
  289. package/out/_next/static/chunks/3jtzvr48aaoo0.js +13 -0
  290. package/out/_next/static/chunks/3k5lt5_-g36w9.js +9 -0
  291. package/out/_next/static/chunks/3l-9xxd1i1sya.js +1 -0
  292. package/out/_next/static/chunks/3l1zucp3a411p.js +50 -0
  293. package/out/_next/static/chunks/3ls4kv54f3x8u.js +15 -0
  294. package/out/_next/static/chunks/3m2yam5_cs1h7.js +13 -0
  295. package/out/_next/static/chunks/3mancxzz8c7hl.js +51 -0
  296. package/out/_next/static/chunks/3nkse7h0-kbyx.js +126 -0
  297. package/out/_next/static/chunks/3o23w25lfn4mo.js +27 -0
  298. package/out/_next/static/chunks/{3m7-q-ztmzcf5.js → 3oynij37wfjb2.js} +2 -2
  299. package/out/_next/static/chunks/3oz5p4rrvnew1.js +807 -0
  300. package/out/_next/static/chunks/{434iz38padke2.js → 3pbyo5kkko3wh.js} +1 -1
  301. package/out/_next/static/chunks/3qjgt-x153i6u.js +234 -0
  302. package/out/_next/static/chunks/3s-n0xc-vi0ww.js +31 -0
  303. package/out/_next/static/chunks/3t_3vlnk1ntkb.js +95 -0
  304. package/out/_next/static/chunks/3ti7tims6gz1j.js +234 -0
  305. package/out/_next/static/chunks/3tzaludii6vtu.js +54 -0
  306. package/out/_next/static/chunks/{01q9gliprwq-_.js → 3u504487p_y7e.js} +2 -2
  307. package/out/_next/static/chunks/3ufg-in2riva7.js +1 -0
  308. package/out/_next/static/chunks/3ugwv1vrnbivg.js +1 -0
  309. package/out/_next/static/chunks/3ulbhhqw8rxd8.js +15 -0
  310. package/out/_next/static/chunks/3uytb2p7vzafp.js +15 -0
  311. package/out/_next/static/chunks/3v38tvcona4gy.js +16 -0
  312. package/out/_next/static/chunks/3vet2a9q9rf2c.js +61 -0
  313. package/out/_next/static/chunks/3vz3gqmojh7sx.js +4 -0
  314. package/out/_next/static/chunks/3w9xrlkiztuwi.js +23 -0
  315. package/out/_next/static/chunks/3wy5jhrulhwb9.js +15 -0
  316. package/out/_next/static/chunks/3xmtbqm0gddn8.js +3 -0
  317. package/out/_next/static/chunks/3yqmjvx7t3t0_.js +1 -0
  318. package/out/_next/static/chunks/3yvmkdc088aly.js +1 -0
  319. package/out/_next/static/chunks/401o5bfi_90qs.js +141 -0
  320. package/out/_next/static/chunks/40s6ngsexc737.js +15 -0
  321. package/out/_next/static/chunks/40xhwnc_48o73.js +297 -0
  322. package/out/_next/static/chunks/41e2wlkp9_pvk.js +28 -0
  323. package/out/_next/static/chunks/41g7mv3yuhz6k.js +68 -0
  324. package/out/_next/static/chunks/429ihwc6co7u7.js +32 -0
  325. package/out/_next/static/chunks/42p2hm8ca34f6.js +16 -0
  326. package/out/_next/static/chunks/43jyzccx6x0lw.js +1 -0
  327. package/out/_next/static/chunks/447b5tn4-avdv.js +16 -0
  328. package/out/_next/static/chunks/44daaafswok67.css +1 -0
  329. package/out/_next/static/chunks/turbopack-02cmv-knpzk52.js +1 -0
  330. package/out/_next/static/chunks/{turbopack-04ukk4jyuwwfc.js → turbopack-05rmr02n9n2u0.js} +1 -1
  331. package/out/_next/static/chunks/{turbopack-0cwxwz82vstff.js → turbopack-07fw0g9aver98.js} +1 -1
  332. package/out/_next/static/chunks/turbopack-08x92457_z4ve.js +1 -0
  333. package/out/_next/static/chunks/{turbopack-13v4uorj3l10n.js → turbopack-0a2sfur4bx222.js} +1 -1
  334. package/out/_next/static/chunks/{turbopack-3b2k0p0g1mako.js → turbopack-0b-g0lpiikryt.js} +1 -1
  335. package/out/_next/static/chunks/turbopack-0dj-aua684j9c.js +1 -0
  336. package/out/_next/static/chunks/{turbopack-3p-k1txa6-4ik.js → turbopack-0h5lj7lnf9_tb.js} +1 -1
  337. package/out/_next/static/chunks/{turbopack-04s7-zvvb1coi.js → turbopack-0k8oea6xmzbjh.js} +1 -1
  338. package/out/_next/static/chunks/{turbopack-14kspgbfigjpa.js → turbopack-0m1qzkhnpuk2j.js} +1 -1
  339. package/out/_next/static/chunks/{turbopack-41cj0-dssfw9l.js → turbopack-0n73ad0fad4yl.js} +1 -1
  340. package/out/_next/static/chunks/{turbopack-2k2d3c2qq-0z0.js → turbopack-0qxkaq0f9ka24.js} +1 -1
  341. package/out/_next/static/chunks/{turbopack-34749rlp0_n5c.js → turbopack-0ricnx7znhztj.js} +1 -1
  342. package/out/_next/static/chunks/turbopack-0s-h1cgwrfgo-.js +1 -0
  343. package/out/_next/static/chunks/turbopack-0xgswwqf_4vrt.js +1 -0
  344. package/out/_next/static/chunks/{turbopack-1sllc7f9its9a.js → turbopack-1330tdm8r390q.js} +1 -1
  345. package/out/_next/static/chunks/{turbopack-0qa163y1bx_g6.js → turbopack-14rn07-ki7f_7.js} +1 -1
  346. package/out/_next/static/chunks/turbopack-1azvbmrq_bxq7.js +1 -0
  347. package/out/_next/static/chunks/turbopack-1bjaxey2pj8nn.js +1 -0
  348. package/out/_next/static/chunks/turbopack-1csu0s9cycwgo.js +1 -0
  349. package/out/_next/static/chunks/{turbopack-0w2ztfttfubzl.js → turbopack-1g8mmayckmfib.js} +1 -1
  350. package/out/_next/static/chunks/turbopack-1hty_7i5tzg63.js +1 -0
  351. package/out/_next/static/chunks/turbopack-1p11xfz8qe15i.js +1 -0
  352. package/out/_next/static/chunks/turbopack-1r_uprn020kr7.js +1 -0
  353. package/out/_next/static/chunks/{turbopack-29n-soxzu37jf.js → turbopack-1rdxfvyldfwrq.js} +1 -1
  354. package/out/_next/static/chunks/{turbopack-40xcd2mr6qovi.js → turbopack-1td004byboyz2.js} +1 -1
  355. package/out/_next/static/chunks/turbopack-1y3x6n223v6d1.js +1 -0
  356. package/out/_next/static/chunks/turbopack-2068cl63o32re.js +1 -0
  357. package/out/_next/static/chunks/turbopack-298vdad77pw5z.js +1 -0
  358. package/out/_next/static/chunks/{turbopack-1wqjl3y4c1ij-.js → turbopack-2d5v28yt0xnri.js} +1 -1
  359. package/out/_next/static/chunks/{turbopack-3jw01psrsjqdi.js → turbopack-2dicmowo2x4t1.js} +1 -1
  360. package/out/_next/static/chunks/turbopack-2gehqsln39zg1.js +1 -0
  361. package/out/_next/static/chunks/turbopack-2hj-ffuco6-u7.js +1 -0
  362. package/out/_next/static/chunks/turbopack-2it1jk212m2ud.js +1 -0
  363. package/out/_next/static/chunks/{turbopack-0sv7lr_kx3kdq.js → turbopack-2l-gbnaw39ht4.js} +1 -1
  364. package/out/_next/static/chunks/turbopack-2mbsjg411_ndq.js +1 -0
  365. package/out/_next/static/chunks/turbopack-2n2ksqygaakbh.js +1 -0
  366. package/out/_next/static/chunks/turbopack-2q65pei-ck559.js +1 -0
  367. package/out/_next/static/chunks/turbopack-2sqnlbl-ardf7.js +1 -0
  368. package/out/_next/static/chunks/turbopack-2t6ex34_bkvoe.js +1 -0
  369. package/out/_next/static/chunks/{turbopack-1au-y5u3wzv22.js → turbopack-2w9_vscbr0eag.js} +1 -1
  370. package/out/_next/static/chunks/turbopack-2z2joyd6mdhpo.js +1 -0
  371. package/out/_next/static/chunks/turbopack-338xrj-0fpsqu.js +1 -0
  372. package/out/_next/static/chunks/turbopack-3458e7jmj1e27.js +1 -0
  373. package/out/_next/static/chunks/turbopack-351l-va10h8kw.js +1 -0
  374. package/out/_next/static/chunks/turbopack-35awx_qvevnch.js +1 -0
  375. package/out/_next/static/chunks/{turbopack-1noe2ur-_o71n.js → turbopack-3a196kafnj312.js} +1 -1
  376. package/out/_next/static/chunks/turbopack-3a6igydfvv1_v.js +1 -0
  377. package/out/_next/static/chunks/{turbopack-1-ceqxb_000x-.js → turbopack-3bnkwdcrz_ts-.js} +1 -1
  378. package/out/_next/static/chunks/{turbopack-32kxihayw_v97.js → turbopack-3hsu2nw8qlox4.js} +1 -1
  379. package/out/_next/static/chunks/turbopack-3iiyu2cek78ut.js +1 -0
  380. package/out/_next/static/chunks/turbopack-3nta8sa99guti.js +1 -0
  381. package/out/_next/static/chunks/turbopack-3r17oio1oe7jw.js +1 -0
  382. package/out/_next/static/chunks/turbopack-3r9uyzwi0dtwb.js +1 -0
  383. package/out/_next/static/chunks/turbopack-3rgdcfralfvsa.js +1 -0
  384. package/out/_next/static/chunks/{turbopack-1h9u07n6a83dl.js → turbopack-3tntqotcyx6oq.js} +1 -1
  385. package/out/_next/static/chunks/turbopack-3uc-2ah0uehj3.js +1 -0
  386. package/out/_next/static/chunks/turbopack-3uvfl95p1ubqn.js +1 -0
  387. package/out/_next/static/chunks/turbopack-3vncwrj5x9j44.js +1 -0
  388. package/out/_next/static/chunks/turbopack-3ww1zabqxbxit.js +1 -0
  389. package/out/_next/static/chunks/{turbopack-17gr4a9fxe8he.js → turbopack-3wxlut7e7jmsi.js} +1 -1
  390. package/out/_next/static/chunks/turbopack-3yk72bgipb8hc.js +1 -0
  391. package/out/_next/static/chunks/turbopack-4025_4zwqnrk-.js +1 -0
  392. package/out/_next/static/chunks/{turbopack-298r66lt68r_n.js → turbopack-425nfopoa8wxd.js} +1 -1
  393. package/out/_next/static/{VYWUvBJY94uiS3jm4HOFN → hH8h6SzcZWEUFySYqRPbW}/_buildManifest.js +63 -63
  394. package/out/_offline/index.html +2 -2
  395. package/out/account/forgot-password/index.html +2 -2
  396. package/out/account/index.html +2 -2
  397. package/out/assortments/AssortmentDetailPage/index.html +2 -2
  398. package/out/assortments/index.html +2 -2
  399. package/out/assortments/new/index.html +2 -2
  400. package/out/copilot/index.html +2 -2
  401. package/out/country/CountryDetailPage/index.html +2 -2
  402. package/out/country/index.html +2 -2
  403. package/out/country/new/index.html +2 -2
  404. package/out/currency/CurrencyDetailPage/index.html +2 -2
  405. package/out/currency/index.html +2 -2
  406. package/out/currency/new/index.html +2 -2
  407. package/out/delivery-provider/DeliveryProviderDetailPage/index.html +2 -2
  408. package/out/delivery-provider/index.html +2 -2
  409. package/out/delivery-provider/new/index.html +2 -2
  410. package/out/enrollments/EnrollmentDetailPage/index.html +2 -2
  411. package/out/enrollments/index.html +2 -2
  412. package/out/events/EventDetailPage/index.html +2 -2
  413. package/out/events/index.html +2 -2
  414. package/out/exports/index.html +2 -2
  415. package/out/ext/[[...slug]]/index.html +2 -2
  416. package/out/external/index.html +2 -2
  417. package/out/filters/FilterDetailPage/index.html +2 -2
  418. package/out/filters/index.html +2 -2
  419. package/out/filters/new/index.html +2 -2
  420. package/out/index.html +2 -2
  421. package/out/install/index.html +2 -2
  422. package/out/language/LanguageDetailPage/index.html +2 -2
  423. package/out/language/index.html +2 -2
  424. package/out/language/new/index.html +2 -2
  425. package/out/log-in/index.html +2 -2
  426. package/out/orders/OrderDetailPage/index.html +2 -2
  427. package/out/orders/index.html +2 -2
  428. package/out/payment-provider/PaymentProviderDetailPage/index.html +2 -2
  429. package/out/payment-provider/index.html +2 -2
  430. package/out/payment-provider/new/index.html +2 -2
  431. package/out/products/ProductDetailPage/index.html +2 -2
  432. package/out/products/index.html +2 -2
  433. package/out/products/new/index.html +2 -2
  434. package/out/quotations/QuotationDetailPage/index.html +2 -2
  435. package/out/quotations/index.html +2 -2
  436. package/out/reset-password/index.html +2 -2
  437. package/out/sign-up/index.html +2 -2
  438. package/out/styleguide/index.html +2 -2
  439. package/out/tokens/TokenDetailPage/index.html +2 -2
  440. package/out/tokens/index.html +2 -2
  441. package/out/users/UserDetailPage/index.html +2 -2
  442. package/out/users/index.html +2 -2
  443. package/out/users/new/index.html +2 -2
  444. package/out/verify-email/index.html +2 -2
  445. package/out/warehousing-provider/WarehousingProviderDetailPage/index.html +2 -2
  446. package/out/warehousing-provider/index.html +2 -2
  447. package/out/warehousing-provider/new/index.html +2 -2
  448. package/out/works/WorkDetailPage/index.html +2 -2
  449. package/out/works/WorkQueueListView/index.html +2 -2
  450. package/out/works/index.html +2 -2
  451. package/out/works/management/index.html +2 -2
  452. package/package.json +18 -13
  453. package/src/sdk/README.md +195 -0
  454. package/src/sdk/plugin-build.mjs +81 -98
  455. package/src/sdk/plugin-build.test.mjs +6 -3
  456. package/src/sdk/plugin-runtime.cjs +66 -0
  457. package/src/sdk/plugin-runtime.d.mts +11 -0
  458. package/src/sdk/plugin-runtime.mjs +27 -0
  459. package/src/sdk/plugin-runtime.test.mjs +32 -0
  460. package/src/sdk/plugins.mjs +17 -0
  461. package/src/sdk/plugins.ts +17 -0
  462. package/src/sdk/shims/admin-ui-plugins.ts +3 -0
  463. package/src/sdk/shims/apollo-client-react.ts +3 -0
  464. package/src/sdk/shims/apollo-client.ts +3 -0
  465. package/src/sdk/shims/host.ts +61 -0
  466. package/src/sdk/shims/next-head.ts +3 -0
  467. package/src/sdk/shims/next-image.ts +3 -0
  468. package/src/sdk/shims/next-link.ts +3 -0
  469. package/src/sdk/shims/next-router.ts +3 -0
  470. package/src/sdk/shims/react-dom-client.ts +3 -0
  471. package/src/sdk/shims/react-dom.ts +3 -0
  472. package/src/sdk/shims/react-hook-form.ts +3 -0
  473. package/src/sdk/shims/react-intl.ts +3 -0
  474. package/src/sdk/shims/react-jsx-runtime.ts +3 -0
  475. package/src/sdk/shims/react-toastify.ts +3 -0
  476. package/src/sdk/shims/react.ts +3 -0
  477. package/out/_next/static/chunks/00zpb_zgq36h-.js +0 -14
  478. package/out/_next/static/chunks/02aa23atze2y4.js +0 -119
  479. package/out/_next/static/chunks/02u93m0n7n-q-.js +0 -12
  480. package/out/_next/static/chunks/03n4up296yhei.js +0 -138
  481. package/out/_next/static/chunks/03zrzz0sb-gy8.js +0 -14
  482. package/out/_next/static/chunks/044dmimivt13x.js +0 -233
  483. package/out/_next/static/chunks/07pwkvl-lm4vp.js +0 -24
  484. package/out/_next/static/chunks/08vf2wf3mxta3.js +0 -13
  485. package/out/_next/static/chunks/094s-grteo6tb.js +0 -31
  486. package/out/_next/static/chunks/0_wt7zjqgpl76.js +0 -807
  487. package/out/_next/static/chunks/0a81cjauoijka.js +0 -1
  488. package/out/_next/static/chunks/0ab_-095b34n5.js +0 -90
  489. package/out/_next/static/chunks/0ac9c5ecooaav.js +0 -234
  490. package/out/_next/static/chunks/0b--0624xswmi.js +0 -16
  491. package/out/_next/static/chunks/0b3hl4d_27v6q.js +0 -173
  492. package/out/_next/static/chunks/0braigkg4hdry.js +0 -39
  493. package/out/_next/static/chunks/0cdcsn87u-tzw.js +0 -1
  494. package/out/_next/static/chunks/0d9cf7svcpjcu.js +0 -1
  495. package/out/_next/static/chunks/0eooy6dat270h.js +0 -226
  496. package/out/_next/static/chunks/0ety-u93s5lsq.js +0 -188
  497. package/out/_next/static/chunks/0fb5j_lva6f8h.js +0 -19
  498. package/out/_next/static/chunks/0hm6-xlqw4vmr.js +0 -1
  499. package/out/_next/static/chunks/0im5k2e2u2uz_.js +0 -8
  500. package/out/_next/static/chunks/0iv288bepx0ug.js +0 -29
  501. package/out/_next/static/chunks/0ld2eenwz_blg.js +0 -52
  502. package/out/_next/static/chunks/0m9y8-nk64c1e.js +0 -12
  503. package/out/_next/static/chunks/0nz8nqr7k7pni.js +0 -61
  504. package/out/_next/static/chunks/0pyfoz6288y0f.js +0 -1
  505. package/out/_next/static/chunks/0qfjbvj6nn9zr.js +0 -18
  506. package/out/_next/static/chunks/0r0l1vs8bls6y.js +0 -1
  507. package/out/_next/static/chunks/0r2v5se5riad_.js +0 -227
  508. package/out/_next/static/chunks/0rdl1jrsef2ew.js +0 -3
  509. package/out/_next/static/chunks/0sutuaadm9sa2.js +0 -11
  510. package/out/_next/static/chunks/0tmo-o_wjgk4-.js +0 -8
  511. package/out/_next/static/chunks/0u-md-qpvyccn.js +0 -149
  512. package/out/_next/static/chunks/0u881hesm8z4s.js +0 -14
  513. package/out/_next/static/chunks/0u_efcr52k9v1.js +0 -15
  514. package/out/_next/static/chunks/0ukobsq85_to1.js +0 -135
  515. package/out/_next/static/chunks/0vxvcl2s96x4f.js +0 -24
  516. package/out/_next/static/chunks/0vyfm3usoot1p.js +0 -60
  517. package/out/_next/static/chunks/0wr0r7tr1jbcz.js +0 -10
  518. package/out/_next/static/chunks/0x_i69reqib8u.js +0 -3
  519. package/out/_next/static/chunks/0xxl7fb2bi8_8.js +0 -82
  520. package/out/_next/static/chunks/0z7jldn83dst6.js +0 -13
  521. package/out/_next/static/chunks/1-4f-vlpf5end.js +0 -43
  522. package/out/_next/static/chunks/1293ysgb8y4y3.js +0 -12
  523. package/out/_next/static/chunks/129pi8m3j6761.js +0 -1
  524. package/out/_next/static/chunks/12lbg_ctrshrg.js +0 -1
  525. package/out/_next/static/chunks/13f9ypdy9t6l8.js +0 -15
  526. package/out/_next/static/chunks/13g90lbjehcp1.js +0 -12
  527. package/out/_next/static/chunks/1413uu5ol2rfr.js +0 -166
  528. package/out/_next/static/chunks/15-duc2e3btcy.js +0 -1
  529. package/out/_next/static/chunks/155jjdhtr4dhn.js +0 -30
  530. package/out/_next/static/chunks/1679i7xv8jnle.js +0 -117
  531. package/out/_next/static/chunks/16a-8jlyrl0m8.js +0 -12
  532. package/out/_next/static/chunks/16bdu48a5vry_.js +0 -13
  533. package/out/_next/static/chunks/16r_t7quts1w0.js +0 -289
  534. package/out/_next/static/chunks/189epg0ebf7bc.js +0 -13
  535. package/out/_next/static/chunks/18ujb5-7bg1p4.js +0 -1
  536. package/out/_next/static/chunks/19fzi9f2kw8zv.js +0 -233
  537. package/out/_next/static/chunks/1_ov-8bomgh6c.js +0 -54
  538. package/out/_next/static/chunks/1axp79-x4n7i4.js +0 -242
  539. package/out/_next/static/chunks/1bga5_ny7avyr.js +0 -23
  540. package/out/_next/static/chunks/1bgsls3okrjue.js +0 -1
  541. package/out/_next/static/chunks/1cliieayy_gw1.js +0 -13
  542. package/out/_next/static/chunks/1cvyi5qu_s_d7.js +0 -10
  543. package/out/_next/static/chunks/1dcw-b0uqh6b0.js +0 -1
  544. package/out/_next/static/chunks/1drrou5kp4qdz.js +0 -1
  545. package/out/_next/static/chunks/1e4ue1_7qn6kz.js +0 -14
  546. package/out/_next/static/chunks/1emope9zm_-ch.js +0 -14
  547. package/out/_next/static/chunks/1f7ar56dj5j8s.js +0 -21
  548. package/out/_next/static/chunks/1fk9whsy-495f.js +0 -1
  549. package/out/_next/static/chunks/1fp7uihlvzcij.js +0 -13
  550. package/out/_next/static/chunks/1g0syfr6r0rj8.js +0 -111
  551. package/out/_next/static/chunks/1g5l7e7du4p25.js +0 -1
  552. package/out/_next/static/chunks/1h03py7retxw8.js +0 -13
  553. package/out/_next/static/chunks/1i6-vxhyp4fan.js +0 -73
  554. package/out/_next/static/chunks/1ihjqvn68cj5e.js +0 -36
  555. package/out/_next/static/chunks/1ij-bgloqrwlw.js +0 -809
  556. package/out/_next/static/chunks/1l1_ntden2a5-.js +0 -58
  557. package/out/_next/static/chunks/1m0x2mb91rv2i.js +0 -13
  558. package/out/_next/static/chunks/1mw35msx036qx.js +0 -66
  559. package/out/_next/static/chunks/1ou8q3ltdifd1.js +0 -34
  560. package/out/_next/static/chunks/1prx7jjoz9cq8.js +0 -3
  561. package/out/_next/static/chunks/1q1js93yqv2ym.js +0 -14
  562. package/out/_next/static/chunks/1qkgln72hya5g.js +0 -1
  563. package/out/_next/static/chunks/1qn6du1pk46f0.js +0 -14
  564. package/out/_next/static/chunks/1r_q8-_cl6_b-.js +0 -23
  565. package/out/_next/static/chunks/1rirgtcu6_bpa.js +0 -17
  566. package/out/_next/static/chunks/1rpgl9uhsj7jq.js +0 -28
  567. package/out/_next/static/chunks/1tzo3v9d5ccon.js +0 -15
  568. package/out/_next/static/chunks/1uculcrefh01f.js +0 -16
  569. package/out/_next/static/chunks/1uinfdu-lhddb.js +0 -1
  570. package/out/_next/static/chunks/1uiqmuia9hpwc.js +0 -32
  571. package/out/_next/static/chunks/1ukg1j06gk9j7.js +0 -233
  572. package/out/_next/static/chunks/1v2r-dm5xnwxd.js +0 -95
  573. package/out/_next/static/chunks/1x8c4f-tlz8oq.js +0 -54
  574. package/out/_next/static/chunks/1xic7x33en-_t.js +0 -46
  575. package/out/_next/static/chunks/1y-vwb0-v5xv0.js +0 -304
  576. package/out/_next/static/chunks/1ymswtxkxcnfi.js +0 -11
  577. package/out/_next/static/chunks/1yrby6v2msnio.js +0 -13
  578. package/out/_next/static/chunks/1yx8v1-jzs__q.js +0 -234
  579. package/out/_next/static/chunks/1yxsj_p-0xiav.js +0 -14
  580. package/out/_next/static/chunks/2-1ihmwxm5nd8.js +0 -13
  581. package/out/_next/static/chunks/2-hsn5zne_kbo.js +0 -18
  582. package/out/_next/static/chunks/20ndjd4r5l6vk.js +0 -1
  583. package/out/_next/static/chunks/22l-2aehes9lx.js +0 -153
  584. package/out/_next/static/chunks/23ju3v8ue0m8a.js +0 -8
  585. package/out/_next/static/chunks/23lmor9w4r767.js +0 -1
  586. package/out/_next/static/chunks/24p5ic154k1id.js +0 -50
  587. package/out/_next/static/chunks/250qu8q7duhe7.js +0 -1
  588. package/out/_next/static/chunks/25asi1rq6d8hb.js +0 -7
  589. package/out/_next/static/chunks/263u-_eyq54xn.js +0 -155
  590. package/out/_next/static/chunks/26ca8aneaqvre.js +0 -2
  591. package/out/_next/static/chunks/27_5des_qn7kz.js +0 -1
  592. package/out/_next/static/chunks/27ek8w2c2mk46.js +0 -15
  593. package/out/_next/static/chunks/28d90lqq_6ddl.js +0 -135
  594. package/out/_next/static/chunks/29yitf66u5w9d.js +0 -1
  595. package/out/_next/static/chunks/2_3qu55ddb4jo.js +0 -3
  596. package/out/_next/static/chunks/2b8nhs_3rpawc.js +0 -1
  597. package/out/_next/static/chunks/2bby8chs2h2zt.js +0 -190
  598. package/out/_next/static/chunks/2ch1ir5bauqm-.js +0 -41
  599. package/out/_next/static/chunks/2cwzq52lgg7tg.js +0 -147
  600. package/out/_next/static/chunks/2dbrybnhe5thu.css +0 -1
  601. package/out/_next/static/chunks/2dddh3jepg6r9.js +0 -22
  602. package/out/_next/static/chunks/2epfbio36cp2x.js +0 -13
  603. package/out/_next/static/chunks/2ev7bgw2foqui.js +0 -12
  604. package/out/_next/static/chunks/2f0e2t3pz-rua.js +0 -1
  605. package/out/_next/static/chunks/2ibnigbqfhrjb.js +0 -8
  606. package/out/_next/static/chunks/2iuu4shi025hv.js +0 -10
  607. package/out/_next/static/chunks/2n3x1m3a_ria_.js +0 -1
  608. package/out/_next/static/chunks/2ngg-2uli_wsk.js +0 -17
  609. package/out/_next/static/chunks/2nofj6ud99639.js +0 -2
  610. package/out/_next/static/chunks/2onfts3kpe9d8.js +0 -1
  611. package/out/_next/static/chunks/2rdh3y4-gf0r1.js +0 -7
  612. package/out/_next/static/chunks/2ry72x6et3uyk.js +0 -235
  613. package/out/_next/static/chunks/2t2zzfasof1ej.js +0 -18
  614. package/out/_next/static/chunks/2twd9trj9horc.js +0 -61
  615. package/out/_next/static/chunks/2uln0xj_hk2xv.js +0 -22
  616. package/out/_next/static/chunks/2x0c4v5dipld3.js +0 -13
  617. package/out/_next/static/chunks/2xhllcys1_u52.js +0 -14
  618. package/out/_next/static/chunks/3-n5bzlk225-y.js +0 -1
  619. package/out/_next/static/chunks/3154519pby2gj.js +0 -5
  620. package/out/_next/static/chunks/327jk4epgudqh.js +0 -110
  621. package/out/_next/static/chunks/334lcmrt6lgtz.js +0 -14
  622. package/out/_next/static/chunks/33bnjdrokmipf.js +0 -12
  623. package/out/_next/static/chunks/33g91_yljnpiw.js +0 -807
  624. package/out/_next/static/chunks/33getgbb1rmpa.js +0 -43
  625. package/out/_next/static/chunks/342etvf_c28cb.js +0 -39
  626. package/out/_next/static/chunks/34kqgu8bnykwx.js +0 -315
  627. package/out/_next/static/chunks/34zya3wqxvl8k.js +0 -19
  628. package/out/_next/static/chunks/35k7e1g1muu56.js +0 -5
  629. package/out/_next/static/chunks/399t21noeueqk.js +0 -13
  630. package/out/_next/static/chunks/39ze4mwy903wm.js +0 -13
  631. package/out/_next/static/chunks/3_8h-x8lcmhr7.js +0 -339
  632. package/out/_next/static/chunks/3_j5zrbyysq1g.js +0 -31
  633. package/out/_next/static/chunks/3a8a8fpl7-ndf.js +0 -1
  634. package/out/_next/static/chunks/3a9g7ouf888jt.js +0 -1
  635. package/out/_next/static/chunks/3anxg7pk9-h3t.js +0 -50
  636. package/out/_next/static/chunks/3blzs4z5wryub.js +0 -1
  637. package/out/_next/static/chunks/3cfkqo3t0m0es.js +0 -3
  638. package/out/_next/static/chunks/3coz1fo064u6a.js +0 -12
  639. package/out/_next/static/chunks/3cr1as0q659er.js +0 -1
  640. package/out/_next/static/chunks/3crdcex_nrx3o.js +0 -12
  641. package/out/_next/static/chunks/3crkl2ligc-kt.js +0 -14
  642. package/out/_next/static/chunks/3d0ic2ovyeue7.js +0 -2
  643. package/out/_next/static/chunks/3ddaet08eakmw.js +0 -18
  644. package/out/_next/static/chunks/3dh3x6thy7fef.js +0 -1
  645. package/out/_next/static/chunks/3e75y5wr7_vem.js +0 -327
  646. package/out/_next/static/chunks/3e98ykfx_vamf.js +0 -60
  647. package/out/_next/static/chunks/3eq-uts_yz1e5.js +0 -1
  648. package/out/_next/static/chunks/3ghzaufs2n8uq.js +0 -2
  649. package/out/_next/static/chunks/3ie60090urams.js +0 -16
  650. package/out/_next/static/chunks/3jffivfbeet7f.js +0 -15
  651. package/out/_next/static/chunks/3mskn3uvx6s77.js +0 -142
  652. package/out/_next/static/chunks/3oppyz2wurlv-.js +0 -329
  653. package/out/_next/static/chunks/3p-pioxz8jyip.js +0 -15
  654. package/out/_next/static/chunks/3po1wffu1pc3k.js +0 -12
  655. package/out/_next/static/chunks/3rvxjwpm2hkzt.js +0 -13
  656. package/out/_next/static/chunks/3snnfwi0hsfwy.js +0 -31
  657. package/out/_next/static/chunks/3so-jsqyai73m.js +0 -1
  658. package/out/_next/static/chunks/3voheu4m42ctw.js +0 -14
  659. package/out/_next/static/chunks/3x3oqxb68-ull.js +0 -7
  660. package/out/_next/static/chunks/3ysj3lx_q697-.js +0 -124
  661. package/out/_next/static/chunks/3zncjth-kop8p.js +0 -1
  662. package/out/_next/static/chunks/3zp4iedgev460.js +0 -35
  663. package/out/_next/static/chunks/40jzqlki-ix7b.js +0 -17
  664. package/out/_next/static/chunks/4138xi7jgdv_o.js +0 -107
  665. package/out/_next/static/chunks/413d2n3_vvshb.js +0 -14
  666. package/out/_next/static/chunks/41mslgyvxwsej.js +0 -1
  667. package/out/_next/static/chunks/44kw4hk598ruu.js +0 -1
  668. package/out/_next/static/chunks/44um3bi95nxcy.js +0 -1
  669. package/out/_next/static/chunks/44xj9eghssy4h.js +0 -1
  670. package/out/_next/static/chunks/turbopack-00bqo3amk802l.js +0 -1
  671. package/out/_next/static/chunks/turbopack-00xv5x2980kaw.js +0 -1
  672. package/out/_next/static/chunks/turbopack-07riv31885zxj.js +0 -1
  673. package/out/_next/static/chunks/turbopack-0_sc_n1p1bcp9.js +0 -1
  674. package/out/_next/static/chunks/turbopack-0a3d8s54evtiu.js +0 -1
  675. package/out/_next/static/chunks/turbopack-0eg08vs3s4808.js +0 -1
  676. package/out/_next/static/chunks/turbopack-0j5aiynif9rh6.js +0 -1
  677. package/out/_next/static/chunks/turbopack-0utbjxefp9fml.js +0 -1
  678. package/out/_next/static/chunks/turbopack-12eu9ngd0g762.js +0 -1
  679. package/out/_next/static/chunks/turbopack-169mif_3j2xs7.js +0 -1
  680. package/out/_next/static/chunks/turbopack-16y9ecuw-sg_1.js +0 -1
  681. package/out/_next/static/chunks/turbopack-19agtluuz9hs9.js +0 -1
  682. package/out/_next/static/chunks/turbopack-1qm1ao7m24ujy.js +0 -1
  683. package/out/_next/static/chunks/turbopack-1tefm98ftz444.js +0 -1
  684. package/out/_next/static/chunks/turbopack-1yd96mx8ypi2r.js +0 -1
  685. package/out/_next/static/chunks/turbopack-1yr-b62bnm8pn.js +0 -1
  686. package/out/_next/static/chunks/turbopack-20jztdd3emk_4.js +0 -1
  687. package/out/_next/static/chunks/turbopack-24wh5-0ze4f20.js +0 -1
  688. package/out/_next/static/chunks/turbopack-27e97jv6b-s-_.js +0 -1
  689. package/out/_next/static/chunks/turbopack-2_-s3bsa7fy5n.js +0 -1
  690. package/out/_next/static/chunks/turbopack-2agmtzzi93gcu.js +0 -1
  691. package/out/_next/static/chunks/turbopack-2krkwbmqyusjo.js +0 -1
  692. package/out/_next/static/chunks/turbopack-2ktr6ad7w59-u.js +0 -1
  693. package/out/_next/static/chunks/turbopack-2o3ztc3qxaqmv.js +0 -1
  694. package/out/_next/static/chunks/turbopack-2ocojyxy_6ohm.js +0 -1
  695. package/out/_next/static/chunks/turbopack-2p09rgir8a_rr.js +0 -1
  696. package/out/_next/static/chunks/turbopack-2s314huts4-ih.js +0 -1
  697. package/out/_next/static/chunks/turbopack-2uy0-z_9q9r-t.js +0 -1
  698. package/out/_next/static/chunks/turbopack-2xkr4g1kb-c30.js +0 -1
  699. package/out/_next/static/chunks/turbopack-38uc2-slitwye.js +0 -1
  700. package/out/_next/static/chunks/turbopack-3_vxq7t7y83kn.js +0 -1
  701. package/out/_next/static/chunks/turbopack-3b4ho7bon8y1n.js +0 -1
  702. package/out/_next/static/chunks/turbopack-3j07f1odh4keh.js +0 -1
  703. package/out/_next/static/chunks/turbopack-3ldzloccscyev.js +0 -1
  704. package/out/_next/static/chunks/turbopack-3o2wlpvy73vfc.js +0 -1
  705. package/out/_next/static/chunks/turbopack-3u8iq4uiukeh-.js +0 -1
  706. package/out/_next/static/chunks/turbopack-3ywen4wf3l3h-.js +0 -1
  707. package/out/_next/static/chunks/turbopack-3zajpzv2knbum.js +0 -1
  708. package/out/_next/static/chunks/turbopack-42c24-sypz5zz.js +0 -1
  709. /package/dist/{chunk-BYXBJQAS.js → chunk-QWQ3WJJN.js} +0 -0
  710. /package/out/_next/static/{VYWUvBJY94uiS3jm4HOFN → hH8h6SzcZWEUFySYqRPbW}/_clientMiddlewareManifest.js +0 -0
  711. /package/out/_next/static/{VYWUvBJY94uiS3jm4HOFN → hH8h6SzcZWEUFySYqRPbW}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42929,10878,97057,95379,51628,e=>{"use strict";var t=e.i(91398),a=e.i(69322),s=e.i(66773),l=e.i(25705),i=e.i(50243),d=e.i(94330),r=e.i(43054),n=e.i(95336),o=e.i(16113),u=e.i(82191),c=e.i(31004),m=e.i(76929),p=e.i(27927),f=e.i(61113),x=e.i(49740),g=e.i(11056),h=e.i(42532),v=e.i(10785),b=e.i(1330),y=e.i(73356),j=e.i(50099),I=e.i(77035),w=e.i(56902),M=e.i(72264),P=e.i(56779),N=e.i(19051),_=e.i(11907),k=e.i(34948),$=e.i(41418),C=e.i(58971),S=e.i(91788),T=e.i(44112),q=e.i(5505),R=e.i(53296),A=e.i(59080),V=e.i(32171),D=e.i(1880);let E=A.gql`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42929,10878,97057,95379,51628,e=>{"use strict";var t=e.i(91398),a=e.i(69322);e.i(51523);var s=e.i(19518),l=e.i(25705),i=e.i(50243),d=e.i(94330),r=e.i(43054),n=e.i(95336),o=e.i(16113),u=e.i(82191),c=e.i(31004),m=e.i(76929),p=e.i(27927),f=e.i(61113),x=e.i(49740),g=e.i(11056),h=e.i(42532),v=e.i(10785),b=e.i(1330),y=e.i(73356),j=e.i(50099),I=e.i(77035),w=e.i(56902),M=e.i(72264),P=e.i(56779),N=e.i(19051),_=e.i(11907),k=e.i(34948),$=e.i(41418),C=e.i(58971),S=e.i(91788),T=e.i(44112),q=e.i(5505),R=e.i(53296),A=e.i(59080),D=e.i(32171),V=e.i(1880);let E=A.gql`
2
2
  fragment ProductAssignmentFragment on ProductVariationAssignment {
3
3
  _id
4
4
  vectors {
@@ -32,7 +32,7 @@
32
32
  }
33
33
  }
34
34
  }
35
- `,U=A.gql`
35
+ `,O=A.gql`
36
36
  query ProductAssignments($productId: ID, $slug: String) {
37
37
  product(productId: $productId, slug: $slug) {
38
38
  _id
@@ -66,7 +66,7 @@
66
66
  }
67
67
  }
68
68
  ${E}
69
- `;var O=e.i(8918);let L=(e,t,a)=>{let s=e[a],l=[];return(s?.values.filter(e=>e.length).forEach(e=>{let a={};a[s.key]=e,t.length>0?t.forEach(e=>{l.push({...e,...a})}):l.push(a)}),e.length>a+1)?L(e,l,a+1):Array.from(new Set(l.map(e=>JSON.stringify(e)))).map(e=>JSON.parse(e))},F=({_id:e,texts:t})=>({value:e,label:t?.title});var Q=e.i(21623),B=e.i(24557),z=e.i(24994),K=e.i(2765),H=e.i(15971),Z=e.i(6607),W=e.i(76204);let G=A.gql`
69
+ `;var U=e.i(8918);let L=(e,t,a)=>{let s=e[a],l=[];return(s?.values.filter(e=>e.length).forEach(e=>{let a={};a[s.key]=e,t.length>0?t.forEach(e=>{l.push({...e,...a})}):l.push(a)}),e.length>a+1)?L(e,l,a+1):Array.from(new Set(l.map(e=>JSON.stringify(e)))).map(e=>JSON.parse(e))},F=({_id:e,texts:t})=>({value:e,label:t?.title});var Q=e.i(21623),B=e.i(24557),z=e.i(24994),K=e.i(2765),H=e.i(15971),W=e.i(6607),Z=e.i(76204);let G=A.gql`
70
70
  mutation AddProductAssignment(
71
71
  $proxyId: ID!
72
72
  $productId: ID!
@@ -80,7 +80,7 @@
80
80
  _id
81
81
  }
82
82
  }
83
- `,X=()=>{let[e]=(0,W.useMutation)(G);return{addProductAssignment:async({productId:t,proxyId:a,vectors:s})=>e({variables:{productId:t,proxyId:a,vectors:s},refetchQueries:["ProductAssignments"]})}};var J=e.i(24112);let Y=A.gql`
83
+ `,X=()=>{let[e]=(0,Z.useMutation)(G);return{addProductAssignment:async({productId:t,proxyId:a,vectors:s})=>e({variables:{productId:t,proxyId:a,vectors:s},refetchQueries:["ProductAssignments"]})}};var J=e.i(24112);let Y=A.gql`
84
84
  mutation RemoveProductAssignment(
85
85
  $proxyId: ID!
86
86
  $vectors: [ProductAssignmentVectorInput!]!
@@ -89,7 +89,7 @@
89
89
  _id
90
90
  }
91
91
  }
92
- `;var ee=e.i(41158),et=e.i(57748),ea=e.i(98949),es=e.i(69211),el=e.i(16984),ei=e.i(21128);let ed={SimpleProduct:"SIMPLE_PRODUCT",BundleProduct:"BUNDLE_PRODUCT",PlanProduct:"PLAN_PRODUCT",ConfigurableProduct:"CONFIGURABLE_PRODUCT",TokenizedProduct:"TOKENIZED_PRODUCT"};e.s(["PRODUCT_TYPES",0,ed],10878);var er=e.i(38994);let en=function({proxyProduct:e,vectors:t,onSuccess:s,locale:l}){let{createProduct:i}=(0,er.default)(),{addProductAssignment:d}=X(),{formatMessage:r}=(0,a.useIntl)();return async({title:a,type:n})=>{let o=[{title:a,slug:a.toLowerCase().replace(/\s+/g,"-"),locale:l}],{data:u}=await i({product:{type:n||ed.SimpleProduct},texts:o}),c=u?.createProduct,m=c?._id;if(!m)throw Error(r({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return await d({productId:m,proxyId:e?._id,vectors:t}),s?.(c),{success:!0}}};var eo=e.i(10685),eu=e.i(57561);let ec=({proxyProduct:e,vectors:l,onSuccess:i})=>{let{formatMessage:d}=(0,a.useIntl)(),{selectedLocale:r}=(0,eu.default)(),n=en({onSuccess:i,proxyProduct:e,vectors:l,locale:r}),{hasRole:o}=(0,C.default)(),u=(0,S.useMemo)(()=>l.map(({value:e})=>e),[l]),c=(0,S.useMemo)(()=>{let t=e?.texts?.title??"";return`${u.join("-")} ${t}`.trim()},[u,e]),m=async({title:e,type:t})=>{try{return await n({title:e,type:t}),{success:!0}}catch(e){return{success:!1,error:{message:e?.message}}}},p=d({id:"product-scaffolded-success",defaultMessage:"Product scaffolded successfully"}),f=(0,ea.default)({submit:m,successMessage:p,enableReinitialize:!0,initialValues:{title:c,type:s.IProductType.SimpleProduct}});return(0,t.jsxs)(es.default,{className:"mt-3 rounded-md",form:f,children:[(0,t.jsxs)("div",{className:"p-5 pb-7 sm:max-w-full flex flex-col gap-3",children:[(0,t.jsx)(el.default,{name:"title",id:"title",label:d({id:"name",defaultMessage:"Name"}),required:!0,className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(eo.default,{className:"mt-1 w-full",label:d({id:"type",defaultMessage:"Type"}),placeholder:d({id:"type",defaultMessage:"Type"}),required:!0,name:"type",options:Object.fromEntries(Object.entries(s.IProductType).map(([e,t])=>[t,e]))})]}),o(s.IRoleAction.ManageProducts)&&(0,t.jsx)("div",{className:"border-t border-t-border-subtle bg-surface-subtle p-5 text-right",children:(0,t.jsx)(ei.default,{label:d({id:"scaffold_product",defaultMessage:"Scaffold"})})})]})},em=({columns:e,variationProduct:l,product:i,loading:d,disabled:r,proxyId:n,columnKeys:o})=>{let{formatMessage:u}=(0,a.useIntl)(),[c,m]=(0,S.useState)(""),{addProductAssignment:p}=X(),{removeProductAssignment:f}=(()=>{let[e]=(0,W.useMutation)(Y);return{removeProductAssignment:async({proxyId:t,vectors:a})=>e({variables:{proxyId:t,vectors:a},refetchQueries:["ProductAssignments"]})}})(),{hasRole:x}=(0,C.default)(),{setModal:g}=(0,Z.default)(),{products:h}=(0,J.default)({queryString:c,limit:50,sort:[{key:"created",value:s.ISortDirection.Desc}]}),v=(0,S.useMemo)(()=>e.map((e,t)=>({key:o[t],value:e})).filter(({value:e})=>e),[e,o]),b=(0,S.useCallback)(async e=>{e&&"string"==typeof e&&await p({proxyId:n,productId:e,vectors:v})},[v,p,n]),y=(0,S.useCallback)(async()=>{await g((0,t.jsx)(H.default,{onCancelClick:async()=>g(""),message:u({id:"delete_product_assignment",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this assignment? "}),onOkClick:async()=>{g(""),await f({proxyId:n,vectors:v})},okText:u({id:"delete_variation_assignment",defaultMessage:"Delete assignment"})}))},[n,v,u,g,f]),j=(0,S.useMemo)(()=>(0,K.default)(200)(m),[]),I=!l&&i?.variations?.length!==e?.length,w=(0,S.useMemo)(()=>h?.map(F).filter(({value:e})=>e!==n)||[],[h,n]),M=async()=>{await g((0,t.jsx)(ec,{proxyProduct:i,vectors:v,onSuccess:()=>{g(null)}}))};return(0,t.jsxs)(O.default.Row,{children:[e.map((e,a)=>(0,t.jsx)(O.default.Cell,{className:"font-medium",children:e},`${e}`)),(0,t.jsx)(O.default.Cell,{children:l?(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)(ee.default,{href:`/products?slug=${(0,D.default)(l)}`,children:(0,t.jsx)("span",{className:"text-green-700 dark:text-green-300 font-medium",children:l?.texts?.title})})}):I?(0,t.jsx)("div",{className:"mt-1 text-sm text-rose-600 italic",children:u({id:"assign_product_needs_variations",defaultMessage:"Please configure all variation options before assigning a product."})}):(0,t.jsx)("div",{className:"relative w-full",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(z.default,{name:"productId",placeholder:u({id:"search_product",defaultMessage:"Search product"}),isLoading:d,disabled:r,onChange:b,onSearch:j,options:w,className:"mt-1 w-full"})}),x(s.IRoleAction.ManageProducts)&&(0,t.jsx)(Q.default,{onClick:M,children:(0,t.jsx)(et.SparklesIcon,{className:"h-5 w-5"})})]})})}),(0,t.jsx)(O.default.Cell,{children:l&&l._id&&(0,t.jsx)(Q.default,{variant:"danger",size:"xs",rounded:"full",icon:(0,t.jsx)(B.TrashIcon,{className:"h-5 w-5"}),onClick:y})})]})};var ep=e.i(82078);let ef=({proxyId:e,disabled:s=!1})=>{let{formatMessage:l}=(0,a.useIntl)(),{product:i,loading:d}=(({productId:e=null,slug:t=null}={})=>{let a=(0,D.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,V.useQuery)(U,{skip:!e&&!a,variables:{productId:e||a}});return{product:s?.product,loading:l,error:i}})({productId:e}),r=i&&i?.variations||[],n=i&&i.assignments||[],o=(0,S.useMemo)(()=>r.filter(({options:e})=>e.length).map(({key:e})=>e),[r]),u=(0,S.useMemo)(()=>r.map(({key:e,options:t})=>({values:t?.map(e=>e.value),key:e})),[r]),c=(0,S.useMemo)(()=>{let e=u.filter(({values:e})=>e?.length);return e.length>0?L(e,[],0):[]},[u]),m=(0,S.useMemo)(()=>n.map(e=>{let t={};return o.forEach(a=>{let s=e.vectors.find(e=>e.variation?.key===a);t[a]=s?.option?.value??""}),t}),[n,o]),p=(0,S.useMemo)(()=>{let e=[...c,...m],t=new Set;return e.filter(e=>{let a=Object.values(e).join("::");return!t.has(a)&&(t.add(a),!0)})},[c,m]),f=(0,S.useMemo)(()=>n.map(e=>{let t={};return e.vectors.forEach(e=>{e?.variation?.key&&e?.option?.value&&(t[e.variation.key]=e.option.value)}),{keys:t,product:e.product}}),[n]),x=(0,S.useMemo)(()=>p.map(e=>{let t=f.find(({keys:t})=>Object.entries(t).every(([t,a])=>e[t]===a));return{_id:Object.values(e).join("::"),product:t?.product,columns:Object.values(e),columnsText:Object.values(e)}}),[p,f]),g=(0,S.useMemo)(()=>r.length>0,[r]),h=(0,S.useMemo)(()=>r.some(e=>e.options&&e.options.length>0),[r]);return(0,t.jsxs)(q.default,{children:[(0,t.jsx)(ep.default,{title:l({id:"product_assignments_explanation_title",defaultMessage:"About Product Assignments"}),description:l({id:"product_assignments_explanation_text",defaultMessage:"Product assignments allow you to link specific products to each unique combination of variation options. For example, if you have a t-shirt with 'Size' and 'Color' variations, you can assign different product SKUs to each combination like 'Large + Red' or 'Small + Blue'. This is useful for managing inventory, pricing, and product details for each specific variant."})}),!g&&(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 dark:bg-gray-800 mb-4",children:(0,t.jsx)(T.InformationCircleIcon,{className:"w-8 h-8 text-gray-400"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-text-primary mb-2",children:l({id:"no_variations_configured",defaultMessage:"No variations configured yet. Please add variations and their options in the Variations tab first."})})]}),g&&h&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(R.default,{messageKey:"assignment_matrix_help",defaultMessage:"Each row represents a unique combination of your product variations. Assign a specific product to each combination to create a complete product catalog."})}),(0,t.jsxs)(O.default,{children:[(0,t.jsxs)(O.default.Row,{children:[o.map(e=>(0,t.jsx)(O.default.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:r.find(t=>t.key===e)?.texts?.title||e},e)),(0,t.jsx)(O.default.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:l({id:"assigned_product_column_header",defaultMessage:"Assigned Product"})}),(0,t.jsx)(O.default.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:l({id:"actions_column_header",defaultMessage:"Actions"})})]}),x.length>0&&x.map(({_id:a,columns:l,product:r})=>(0,t.jsx)(em,{columns:l,disabled:s,loading:d,product:i,variationProduct:r,columnKeys:o,proxyId:e},a))]})]}),g&&!h&&(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-yellow-100 dark:bg-yellow-900/30 mb-4",children:(0,t.jsx)(T.InformationCircleIcon,{className:"w-8 h-8 text-yellow-600 dark:text-yellow-400"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-text-primary mb-2",children:l({id:"assign_product_needs_variations",defaultMessage:"Please configure all variation options before assigning a product."})}),(0,t.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:l({id:"assignment_matrix_help",defaultMessage:"Each row represents a unique combination of your product variations. Assign a specific product to each combination to create a complete product catalog."})})]})]})};var ex=e.i(60195),eg=e.i(1504);let eh=A.gql`
92
+ `;var ee=e.i(41158),et=e.i(57748),ea=e.i(98949),es=e.i(69211),el=e.i(16984),ei=e.i(21128);let ed={SimpleProduct:"SIMPLE_PRODUCT",BundleProduct:"BUNDLE_PRODUCT",PlanProduct:"PLAN_PRODUCT",ConfigurableProduct:"CONFIGURABLE_PRODUCT",TokenizedProduct:"TOKENIZED_PRODUCT"};e.s(["PRODUCT_TYPES",0,ed],10878);var er=e.i(38994);let en=function({proxyProduct:e,vectors:t,onSuccess:s,locale:l}){let{createProduct:i}=(0,er.default)(),{addProductAssignment:d}=X(),{formatMessage:r}=(0,a.useIntl)();return async({title:a,type:n})=>{let o=[{title:a,slug:a.toLowerCase().replace(/\s+/g,"-"),locale:l}],{data:u}=await i({product:{type:n||ed.SimpleProduct},texts:o}),c=u?.createProduct,m=c?._id;if(!m)throw Error(r({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return await d({productId:m,proxyId:e?._id,vectors:t}),s?.(c),{success:!0}}};var eo=e.i(10685),eu=e.i(57561);let ec=({proxyProduct:e,vectors:l,onSuccess:i})=>{let{formatMessage:d}=(0,a.useIntl)(),{selectedLocale:r}=(0,eu.default)(),n=en({onSuccess:i,proxyProduct:e,vectors:l,locale:r}),{hasRole:o}=(0,C.default)(),u=(0,S.useMemo)(()=>l.map(({value:e})=>e),[l]),c=(0,S.useMemo)(()=>{let t=e?.texts?.title??"";return`${u.join("-")} ${t}`.trim()},[u,e]),m=async({title:e,type:t})=>{try{return await n({title:e,type:t}),{success:!0}}catch(e){return{success:!1,error:{message:e?.message}}}},p=d({id:"product-scaffolded-success",defaultMessage:"Product scaffolded successfully"}),f=(0,ea.default)({submit:m,successMessage:p,enableReinitialize:!0,initialValues:{title:c,type:s.IProductType.SimpleProduct}});return(0,t.jsxs)(es.default,{className:"mt-3 rounded-md",form:f,children:[(0,t.jsxs)("div",{className:"p-5 pb-7 sm:max-w-full flex flex-col gap-3",children:[(0,t.jsx)(el.default,{name:"title",id:"title",label:d({id:"name",defaultMessage:"Name"}),required:!0,className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(eo.default,{className:"mt-1 w-full",label:d({id:"type",defaultMessage:"Type"}),placeholder:d({id:"type",defaultMessage:"Type"}),required:!0,name:"type",options:Object.fromEntries(Object.entries(s.IProductType).map(([e,t])=>[t,e]))})]}),o(s.IRoleAction.ManageProducts)&&(0,t.jsx)("div",{className:"border-t border-t-border-subtle bg-surface-subtle p-5 text-right",children:(0,t.jsx)(ei.default,{label:d({id:"scaffold_product",defaultMessage:"Scaffold"})})})]})},em=({columns:e,variationProduct:l,product:i,loading:d,disabled:r,proxyId:n,columnKeys:o})=>{let{formatMessage:u}=(0,a.useIntl)(),[c,m]=(0,S.useState)(""),{addProductAssignment:p}=X(),{removeProductAssignment:f}=(()=>{let[e]=(0,Z.useMutation)(Y);return{removeProductAssignment:async({proxyId:t,vectors:a})=>e({variables:{proxyId:t,vectors:a},refetchQueries:["ProductAssignments"]})}})(),{hasRole:x}=(0,C.default)(),{setModal:g}=(0,W.default)(),{products:h}=(0,J.default)({queryString:c,limit:50,sort:[{key:"created",value:s.ISortDirection.Desc}]}),v=(0,S.useMemo)(()=>e.map((e,t)=>({key:o[t],value:e})).filter(({value:e})=>e),[e,o]),b=(0,S.useCallback)(async e=>{e&&"string"==typeof e&&await p({proxyId:n,productId:e,vectors:v})},[v,p,n]),y=(0,S.useCallback)(async()=>{await g((0,t.jsx)(H.default,{onCancelClick:async()=>g(""),message:u({id:"delete_product_assignment",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this assignment? "}),onOkClick:async()=>{g(""),await f({proxyId:n,vectors:v})},okText:u({id:"delete_variation_assignment",defaultMessage:"Delete assignment"})}))},[n,v,u,g,f]),j=(0,S.useMemo)(()=>(0,K.default)(200)(m),[]),I=!l&&i?.variations?.length!==e?.length,w=(0,S.useMemo)(()=>h?.map(F).filter(({value:e})=>e!==n)||[],[h,n]),M=async()=>{await g((0,t.jsx)(ec,{proxyProduct:i,vectors:v,onSuccess:()=>{g(null)}}))};return(0,t.jsxs)(U.default.Row,{children:[e.map((e,a)=>(0,t.jsx)(U.default.Cell,{className:"font-medium",children:e},`${e}`)),(0,t.jsx)(U.default.Cell,{children:l?(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)(ee.default,{href:`/products?slug=${(0,V.default)(l)}`,children:(0,t.jsx)("span",{className:"text-green-700 dark:text-green-300 font-medium",children:l?.texts?.title})})}):I?(0,t.jsx)("div",{className:"mt-1 text-sm text-rose-600 italic",children:u({id:"assign_product_needs_variations",defaultMessage:"Please configure all variation options before assigning a product."})}):(0,t.jsx)("div",{className:"relative w-full",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(z.default,{name:"productId",placeholder:u({id:"search_product",defaultMessage:"Search product"}),isLoading:d,disabled:r,onChange:b,onSearch:j,options:w,className:"mt-1 w-full"})}),x(s.IRoleAction.ManageProducts)&&(0,t.jsx)(Q.default,{onClick:M,children:(0,t.jsx)(et.SparklesIcon,{className:"h-5 w-5"})})]})})}),(0,t.jsx)(U.default.Cell,{children:l&&l._id&&(0,t.jsx)(Q.default,{variant:"danger",size:"xs",rounded:"full",icon:(0,t.jsx)(B.TrashIcon,{className:"h-5 w-5"}),onClick:y})})]})};var ep=e.i(82078);let ef=({proxyId:e,disabled:s=!1})=>{let{formatMessage:l}=(0,a.useIntl)(),{product:i,loading:d}=(({productId:e=null,slug:t=null}={})=>{let a=(0,V.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,D.useQuery)(O,{skip:!e&&!a,variables:{productId:e||a}});return{product:s?.product,loading:l,error:i}})({productId:e}),r=i&&i?.variations||[],n=i&&i.assignments||[],o=(0,S.useMemo)(()=>r.filter(({options:e})=>e.length).map(({key:e})=>e),[r]),u=(0,S.useMemo)(()=>r.map(({key:e,options:t})=>({values:t?.map(e=>e.value),key:e})),[r]),c=(0,S.useMemo)(()=>{let e=u.filter(({values:e})=>e?.length);return e.length>0?L(e,[],0):[]},[u]),m=(0,S.useMemo)(()=>n.map(e=>{let t={};return o.forEach(a=>{let s=e.vectors.find(e=>e.variation?.key===a);t[a]=s?.option?.value??""}),t}),[n,o]),p=(0,S.useMemo)(()=>{let e=[...c,...m],t=new Set;return e.filter(e=>{let a=Object.values(e).join("::");return!t.has(a)&&(t.add(a),!0)})},[c,m]),f=(0,S.useMemo)(()=>n.map(e=>{let t={};return e.vectors.forEach(e=>{e?.variation?.key&&e?.option?.value&&(t[e.variation.key]=e.option.value)}),{keys:t,product:e.product}}),[n]),x=(0,S.useMemo)(()=>p.map(e=>{let t=f.find(({keys:t})=>Object.entries(t).every(([t,a])=>e[t]===a));return{_id:Object.values(e).join("::"),product:t?.product,columns:Object.values(e),columnsText:Object.values(e)}}),[p,f]),g=(0,S.useMemo)(()=>r.length>0,[r]),h=(0,S.useMemo)(()=>r.some(e=>e.options&&e.options.length>0),[r]);return(0,t.jsxs)(q.default,{children:[(0,t.jsx)(ep.default,{title:l({id:"product_assignments_explanation_title",defaultMessage:"About Product Assignments"}),description:l({id:"product_assignments_explanation_text",defaultMessage:"Product assignments allow you to link specific products to each unique combination of variation options. For example, if you have a t-shirt with 'Size' and 'Color' variations, you can assign different product SKUs to each combination like 'Large + Red' or 'Small + Blue'. This is useful for managing inventory, pricing, and product details for each specific variant."})}),!g&&(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 dark:bg-gray-800 mb-4",children:(0,t.jsx)(T.InformationCircleIcon,{className:"w-8 h-8 text-gray-400"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-text-primary mb-2",children:l({id:"no_variations_configured",defaultMessage:"No variations configured yet. Please add variations and their options in the Variations tab first."})})]}),g&&h&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(R.default,{messageKey:"assignment_matrix_help",defaultMessage:"Each row represents a unique combination of your product variations. Assign a specific product to each combination to create a complete product catalog."})}),(0,t.jsxs)(U.default,{children:[(0,t.jsxs)(U.default.Row,{children:[o.map(e=>(0,t.jsx)(U.default.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:r.find(t=>t.key===e)?.texts?.title||e},e)),(0,t.jsx)(U.default.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:l({id:"assigned_product_column_header",defaultMessage:"Assigned Product"})}),(0,t.jsx)(U.default.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:l({id:"actions_column_header",defaultMessage:"Actions"})})]}),x.length>0&&x.map(({_id:a,columns:l,product:r})=>(0,t.jsx)(em,{columns:l,disabled:s,loading:d,product:i,variationProduct:r,columnKeys:o,proxyId:e},a))]})]}),g&&!h&&(0,t.jsxs)("div",{className:"text-center py-8",children:[(0,t.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-yellow-100 dark:bg-yellow-900/30 mb-4",children:(0,t.jsx)(T.InformationCircleIcon,{className:"w-8 h-8 text-yellow-600 dark:text-yellow-400"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-text-primary mb-2",children:l({id:"assign_product_needs_variations",defaultMessage:"Please configure all variation options before assigning a product."})}),(0,t.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:l({id:"assignment_matrix_help",defaultMessage:"Each row represents a unique combination of your product variations. Assign a specific product to each combination to create a complete product catalog."})})]})]})};var ex=e.i(60195),eg=e.i(1504);let eh=A.gql`
93
93
  query ProductTokenization($productId: ID, $slug: String) {
94
94
  product(productId: $productId, slug: $slug) {
95
95
  _id
@@ -124,21 +124,21 @@
124
124
  _id
125
125
  }
126
126
  }
127
- `,ey=({productId:e,disabled:l=!1})=>{let{formatMessage:i}=(0,a.useIntl)(),{hasRole:d}=(0,C.default)(),{smartContractStandards:r}=(()=>{let{data:e,loading:t,error:a}=(0,V.useQuery)(ev);return{smartContractStandards:e?.smartContractStandards?.options||[],loading:t,error:a}})(),{updateProductTokenization:n}=(()=>{let[e]=(0,W.useMutation)(eb);return{updateProductTokenization:async({productId:t,tokenization:{contractAddress:a,contractStandard:s,tokenId:l,supply:i}})=>e({variables:{productId:t,tokenization:{contractAddress:a,contractStandard:s,tokenId:l,supply:parseInt(i,10)}},refetchQueries:["Product","Products"]})}})(),{product:o,loading:u}=(({productId:e=null,slug:t=null}={})=>{let a=(0,D.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,V.useQuery)(eh,{skip:!e&&!t,variables:{productId:e||a}});return{product:s?.product,loading:l,error:i}})({productId:e}),c=async({contractAddress:t,contractStandard:a,tokenId:s,supply:l})=>(await n({productId:e,tokenization:{contractAddress:t,contractStandard:a,tokenId:s||"",supply:l}}),{success:!0}),m=i({id:"token_updated",defaultMessage:"Token update successfully!"}),p=(0,ea.default)({disabled:l,submit:c,successMessage:m,initialValues:{contractAddress:"",contractStandard:"",tokenId:"",supply:""}});return(0,S.useEffect)(()=>{u||p.api.setValues({contractAddress:o?.contractAddress||"",contractStandard:o?.contractStandard||"",tokenId:o?.contractConfiguration?.tokenId||"",supply:o?.contractConfiguration?.supply||""})},[u]),(0,t.jsx)(ex.default,{documentationLabel:i({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,t.jsx)(a.FormattedMessage,{id:"tokenized_product_text_form_description",defaultMessage:"<b>Contract standards </b> <ol> \n <dt><b> ERC721 </b></dt> <dd> Buying multiple Products leads to multiple Tokens (make sure to set the tokenId to 0 to make it auto generate new id's) </dd>\n <dt> <b> ERC1155 </b></dt> <dd> Buying multiple Products leads to a new token with balance 3 of token with tokenId assigned </dd>\n <dt> <b> Contract address </b></dt> <dd> Address of a token on a given network </dd> </ol>",values:{ol:e=>(0,t.jsxs)("ol",{children:[e," "]}),dt:e=>(0,t.jsxs)("dt",{className:"bold",children:[e," "]}),dd:e=>(0,t.jsxs)("dd",{children:[e," "]}),b:e=>(0,t.jsxs)("b",{children:[e," "]})}}),children:(0,t.jsx)(q.default,{children:(0,t.jsxs)(es.default,{form:p,children:[(0,t.jsxs)("div",{className:"p-5 pb-7 sm:max-w-full flex flex-col gap-y-5",children:[(0,t.jsx)(eo.default,{className:"w-full",label:i({id:"contract-standard",defaultMessage:"Contract standard"}),placeholder:i({id:"contract-standard",defaultMessage:"Contract standard"}),required:!0,name:"contractStandard",options:(0,eg.default)(r,"label","value")}),(0,t.jsx)(el.default,{name:"contractAddress",id:"contractAddress",label:i({id:"contract-address-label",defaultMessage:"Contract Address"}),placeholder:i({id:"contract-address-label",defaultMessage:"Contract Address"}),required:!0,className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(el.default,{name:"supply",id:"supply",type:"number",label:i({id:"token-supply",defaultMessage:"Supply"}),placeholder:i({id:"token-supply",defaultMessage:"Supply"}),required:!0,className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(el.default,{name:"tokenId",id:"tokenId",label:i({id:"token-id-label",defaultMessage:"Token Serial Number"}),placeholder:i({id:"token-id-label",defaultMessage:"Token Serial Number"}),className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"})]}),d(s.IRoleAction.ManageProducts)&&(0,t.jsx)("div",{className:"space-y-6 border-t border-t-border-subtle bg-surface-subtle p-5 text-right",children:(0,t.jsx)(ei.default,{label:i({id:"update_token",defaultMessage:"Update token"})})})]})})})};var ej=e.i(31494),eI=e.i(83788),ew=e.i(13534),eM=e.i(70475);let eP=({id:e,selectedView:a="",disableAll:s=!1,...l})=>{if("texts"===a)return(0,t.jsx)(g.default,{children:(0,t.jsx)(v.default,{productId:e,disabled:s})});if("media"===a)return(0,t.jsx)(eI.default,{children:(0,t.jsx)(g.default,{children:(0,t.jsx)(b.default,{productId:e})})});if("commerce"===a)return(0,t.jsx)(h.default,{productId:e,disabled:s});if("supply"===a)return(0,t.jsx)(j.default,{productId:e,disabled:s});if("warehousing"===a)return(0,t.jsx)(w.default,{productId:e,disabled:s});if("fulfillment"===a)return(0,t.jsx)(M.default,{productId:e});if("variations"===a)return(0,t.jsx)(g.default,{children:(0,t.jsx)(I.default,{productId:e,disabled:s})});if("bundled_products"===a)return(0,t.jsx)(g.default,{children:(0,t.jsx)(_.default,{productId:e,disabled:s})});if("subscriptions"===a)return(0,t.jsx)(y.default,{productId:e,disabled:s});if("reviews"===a)return(0,t.jsx)(N.default,{productId:e});if("assignments"===a)return(0,t.jsx)(g.default,{children:(0,t.jsx)(ef,{proxyId:e,disabled:s})});if("token"===a)return(0,t.jsx)(ey,{productId:e,disabled:s});if("extended"===a)return(0,t.jsx)(ej.default,{data:l});if(a?.startsWith("plugin:")){let s=a.replace("plugin:","");return(0,t.jsx)(eM.default,{slot:"product:tabs",entityId:e,children:(a,l)=>l.component===s?(0,t.jsx)(a,{entityId:e}):null})}return(0,t.jsx)(g.default,{children:(0,t.jsx)(v.default,{productId:e})})};e.s(["default",0,({product:e,extendedData:g={}})=>{let{formatMessage:h}=(0,a.useIntl)(),{hasRole:v}=(0,C.default)(),{updateProduct:b}=(0,$.default)(),{shopInfo:y}=(0,eu.default)(),{getSlotPlugins:j}=(0,ew.usePlugins)(),{__typename:I}=e||{},w=[{id:"texts",title:h({id:"general_text",defaultMessage:"Text"}),Icon:(0,t.jsx)(l.DocumentTextIcon,{className:"h-5 w-5"})},{id:"media",title:h({id:"media",defaultMessage:"Media"}),Icon:(0,t.jsx)(i.FilmIcon,{className:"h-5 w-5"})},"ConfigurableProduct"!==I&&{id:"commerce",title:h({id:"commerce",defaultMessage:"Commerce"}),Icon:(0,t.jsx)(d.ShoppingBagIcon,{className:"h-5 w-5"})},"SimpleProduct"===I&&{id:"supply",title:h({id:"supply",defaultMessage:"Supply"}),Icon:(0,t.jsx)(r.ChartPieIcon,{className:"h-5 w-5"})},"SimpleProduct"===I&&{id:"warehousing",title:h({id:"warehousing",defaultMessage:"Warehousing"}),Icon:(0,t.jsx)(n.ArchiveBoxIcon,{className:"h-5 w-5"})},"SimpleProduct"===I&&{id:"fulfillment",title:h({id:"fulfillment",defaultMessage:"Fulfillment"}),Icon:(0,t.jsx)(x.TruckIcon,{className:"h-5 w-5"})},"ConfigurableProduct"===I&&{id:"variations",title:h({id:"variations",defaultMessage:"Variations"}),Icon:(0,t.jsx)(o.SwatchIcon,{className:"h-5 w-5"})},"BundleProduct"===I&&{id:"bundled_products",title:h({id:"bundled_items",defaultMessage:"Bundled items"}),Icon:(0,t.jsx)(u.PresentationChartLineIcon,{className:"h-5 w-5"})},"PlanProduct"===I&&{id:"subscriptions",title:h({id:"subscriptions",defaultMessage:"Subscriptions"}),Icon:(0,t.jsx)(c.UsersIcon,{className:"h-5 w-5"})},"ConfigurableProduct"===I&&{id:"assignments",title:h({id:"assignments",defaultMessage:"Assignments"}),Icon:(0,t.jsx)(p.LinkIcon,{className:"h-5 w-5"})},"TokenizedProduct"===I&&{id:"token",title:h({id:"token",defaultMessage:"Token"}),Icon:(0,t.jsx)(p.LinkIcon,{className:"h-5 w-5"})},{id:"reviews",title:h({id:"reviews",defaultMessage:"Reviews"}),Icon:(0,t.jsx)(f.StarIcon,{className:"h-5 w-5"})},null!==g&&{id:"extended",title:h({id:"extended-fields",defaultMessage:"Extended"}),Icon:(0,t.jsx)(m.PuzzlePieceIcon,{className:"h-5 w-5"})}].filter(e=>e),M=j("product:tabs").map(({config:e})=>({id:`plugin:${e.component}`,title:e.label,Icon:(0,t.jsx)(m.PuzzlePieceIcon,{className:"h-5 w-5"})}));w.push(...M);let N=async({tags:t})=>(await b({productId:e?._id,product:{tags:t}}),!0);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mt-5 flex flex-wrap items-center justify-between gap-10",children:(0,t.jsx)(k.default,{defaultValue:e?.tags,onSubmit:N,enableEdit:v(s.IRoleAction.ManageProducts),availableTagOptions:y?.adminUiConfig?.productTags.filter(t=>!(e?.tags||[])?.includes(t)).map(e=>({value:e,label:e}))})}),(0,t.jsx)(P.default,{tabItems:w,defaultTab:"texts",children:(0,t.jsx)(eP,{disableAll:e?.status===s.IProductStatus.Deleted,id:e?._id,...g})})]})}],42929);var eN=e.i(87284);e.s(["default",0,({media:e=[],onEditMedia:a})=>(0,t.jsx)("div",{className:"my-5",children:(0,t.jsx)("div",{className:"flex gap-3 overflow-x-auto",children:e.map(e=>(0,t.jsx)("div",{className:"relative flex-shrink-0 group",children:(0,t.jsx)("div",{className:"w-16 h-16 bg-surface-raised rounded-lg overflow-hidden cursor-pointer border border-border-subtle",onClick:()=>{var t;return t=e._id,void(a&&a(t))},children:(0,t.jsx)(eN.default,{src:e?.file?.url,alt:e.texts?.[0]?.title||e?.file?.url,width:128,height:128,className:"w-full h-full object-cover"})})},e._id))})})],97057);var e_=e.i(62199);let ek=A.gql`
127
+ `,ey=({productId:e,disabled:l=!1})=>{let{formatMessage:i}=(0,a.useIntl)(),{hasRole:d}=(0,C.default)(),{smartContractStandards:r}=(()=>{let{data:e,loading:t,error:a}=(0,D.useQuery)(ev);return{smartContractStandards:e?.smartContractStandards?.options||[],loading:t,error:a}})(),{updateProductTokenization:n}=(()=>{let[e]=(0,Z.useMutation)(eb);return{updateProductTokenization:async({productId:t,tokenization:{contractAddress:a,contractStandard:s,tokenId:l,supply:i}})=>e({variables:{productId:t,tokenization:{contractAddress:a,contractStandard:s,tokenId:l,supply:parseInt(i,10)}},refetchQueries:["Product","Products"]})}})(),{product:o,loading:u}=(({productId:e=null,slug:t=null}={})=>{let a=(0,V.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,D.useQuery)(eh,{skip:!e&&!t,variables:{productId:e||a}});return{product:s?.product,loading:l,error:i}})({productId:e}),c=async({contractAddress:t,contractStandard:a,tokenId:s,supply:l})=>(await n({productId:e,tokenization:{contractAddress:t,contractStandard:a,tokenId:s||"",supply:l}}),{success:!0}),m=i({id:"token_updated",defaultMessage:"Token update successfully!"}),p=(0,ea.default)({disabled:l,submit:c,successMessage:m,initialValues:{contractAddress:"",contractStandard:"",tokenId:"",supply:""}});return(0,S.useEffect)(()=>{u||p.api.setValues({contractAddress:o?.contractAddress||"",contractStandard:o?.contractStandard||"",tokenId:o?.contractConfiguration?.tokenId||"",supply:o?.contractConfiguration?.supply||""})},[u]),(0,t.jsx)(ex.default,{documentationLabel:i({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,t.jsx)(a.FormattedMessage,{id:"tokenized_product_text_form_description",defaultMessage:"<b>Contract standards </b> <ol> \n <dt><b> ERC721 </b></dt> <dd> Buying multiple Products leads to multiple Tokens (make sure to set the tokenId to 0 to make it auto generate new id's) </dd>\n <dt> <b> ERC1155 </b></dt> <dd> Buying multiple Products leads to a new token with balance 3 of token with tokenId assigned </dd>\n <dt> <b> Contract address </b></dt> <dd> Address of a token on a given network </dd> </ol>",values:{ol:e=>(0,t.jsxs)("ol",{children:[e," "]}),dt:e=>(0,t.jsxs)("dt",{className:"bold",children:[e," "]}),dd:e=>(0,t.jsxs)("dd",{children:[e," "]}),b:e=>(0,t.jsxs)("b",{children:[e," "]})}}),children:(0,t.jsx)(q.default,{children:(0,t.jsxs)(es.default,{form:p,children:[(0,t.jsxs)("div",{className:"p-5 pb-7 sm:max-w-full flex flex-col gap-y-5",children:[(0,t.jsx)(eo.default,{className:"w-full",label:i({id:"contract-standard",defaultMessage:"Contract standard"}),placeholder:i({id:"contract-standard",defaultMessage:"Contract standard"}),required:!0,name:"contractStandard",options:(0,eg.default)(r,"label","value")}),(0,t.jsx)(el.default,{name:"contractAddress",id:"contractAddress",label:i({id:"contract-address-label",defaultMessage:"Contract Address"}),placeholder:i({id:"contract-address-label",defaultMessage:"Contract Address"}),required:!0,className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(el.default,{name:"supply",id:"supply",type:"number",label:i({id:"token-supply",defaultMessage:"Supply"}),placeholder:i({id:"token-supply",defaultMessage:"Supply"}),required:!0,className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(el.default,{name:"tokenId",id:"tokenId",label:i({id:"token-id-label",defaultMessage:"Token Serial Number"}),placeholder:i({id:"token-id-label",defaultMessage:"Token Serial Number"}),className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"})]}),d(s.IRoleAction.ManageProducts)&&(0,t.jsx)("div",{className:"space-y-6 border-t border-t-border-subtle bg-surface-subtle p-5 text-right",children:(0,t.jsx)(ei.default,{label:i({id:"update_token",defaultMessage:"Update token"})})})]})})})};var ej=e.i(31494),eI=e.i(83788),ew=e.i(13534),eM=e.i(70475);let eP=({id:e,selectedView:a="",disableAll:s=!1,...l})=>{if("texts"===a)return(0,t.jsx)(g.default,{children:(0,t.jsx)(v.default,{productId:e,disabled:s})});if("media"===a)return(0,t.jsx)(eI.default,{children:(0,t.jsx)(g.default,{children:(0,t.jsx)(b.default,{productId:e})})});if("commerce"===a)return(0,t.jsx)(h.default,{productId:e,disabled:s});if("supply"===a)return(0,t.jsx)(j.default,{productId:e,disabled:s});if("warehousing"===a)return(0,t.jsx)(w.default,{productId:e,disabled:s});if("fulfillment"===a)return(0,t.jsx)(M.default,{productId:e});if("variations"===a)return(0,t.jsx)(g.default,{children:(0,t.jsx)(I.default,{productId:e,disabled:s})});if("bundled_products"===a)return(0,t.jsx)(g.default,{children:(0,t.jsx)(_.default,{productId:e,disabled:s})});if("subscriptions"===a)return(0,t.jsx)(y.default,{productId:e,disabled:s});if("reviews"===a)return(0,t.jsx)(N.default,{productId:e});if("assignments"===a)return(0,t.jsx)(g.default,{children:(0,t.jsx)(ef,{proxyId:e,disabled:s})});if("token"===a)return(0,t.jsx)(ey,{productId:e,disabled:s});if("extended"===a)return(0,t.jsx)(ej.default,{data:l});if(a?.startsWith("plugin:")){let s=a.replace("plugin:","");return(0,t.jsx)(eM.default,{slot:"product:tabs",entityId:e,children:(a,l)=>l.component===s?(0,t.jsx)(a,{entityId:e}):null})}return(0,t.jsx)(g.default,{children:(0,t.jsx)(v.default,{productId:e})})};e.s(["default",0,({product:e,extendedData:g={}})=>{let{formatMessage:h}=(0,a.useIntl)(),{hasRole:v}=(0,C.default)(),{updateProduct:b}=(0,$.default)(),{shopInfo:y}=(0,eu.default)(),{getSlotPlugins:j}=(0,ew.usePlugins)(),{__typename:I}=e||{},w=[{id:"texts",title:h({id:"general_text",defaultMessage:"Text"}),Icon:(0,t.jsx)(l.DocumentTextIcon,{className:"h-5 w-5"})},{id:"media",title:h({id:"media",defaultMessage:"Media"}),Icon:(0,t.jsx)(i.FilmIcon,{className:"h-5 w-5"})},"ConfigurableProduct"!==I&&{id:"commerce",title:h({id:"commerce",defaultMessage:"Commerce"}),Icon:(0,t.jsx)(d.ShoppingBagIcon,{className:"h-5 w-5"})},"SimpleProduct"===I&&{id:"supply",title:h({id:"supply",defaultMessage:"Supply"}),Icon:(0,t.jsx)(r.ChartPieIcon,{className:"h-5 w-5"})},"SimpleProduct"===I&&{id:"warehousing",title:h({id:"warehousing",defaultMessage:"Warehousing"}),Icon:(0,t.jsx)(n.ArchiveBoxIcon,{className:"h-5 w-5"})},"SimpleProduct"===I&&{id:"fulfillment",title:h({id:"fulfillment",defaultMessage:"Fulfillment"}),Icon:(0,t.jsx)(x.TruckIcon,{className:"h-5 w-5"})},"ConfigurableProduct"===I&&{id:"variations",title:h({id:"variations",defaultMessage:"Variations"}),Icon:(0,t.jsx)(o.SwatchIcon,{className:"h-5 w-5"})},"BundleProduct"===I&&{id:"bundled_products",title:h({id:"bundled_items",defaultMessage:"Bundled items"}),Icon:(0,t.jsx)(u.PresentationChartLineIcon,{className:"h-5 w-5"})},"PlanProduct"===I&&{id:"subscriptions",title:h({id:"subscriptions",defaultMessage:"Subscriptions"}),Icon:(0,t.jsx)(c.UsersIcon,{className:"h-5 w-5"})},"ConfigurableProduct"===I&&{id:"assignments",title:h({id:"assignments",defaultMessage:"Assignments"}),Icon:(0,t.jsx)(p.LinkIcon,{className:"h-5 w-5"})},"TokenizedProduct"===I&&{id:"token",title:h({id:"token",defaultMessage:"Token"}),Icon:(0,t.jsx)(p.LinkIcon,{className:"h-5 w-5"})},{id:"reviews",title:h({id:"reviews",defaultMessage:"Reviews"}),Icon:(0,t.jsx)(f.StarIcon,{className:"h-5 w-5"})},null!==g&&{id:"extended",title:h({id:"extended-fields",defaultMessage:"Extended"}),Icon:(0,t.jsx)(m.PuzzlePieceIcon,{className:"h-5 w-5"})}].filter(e=>e),M=j("product:tabs").map(({config:e})=>({id:`plugin:${e.component}`,title:e.label,Icon:(0,t.jsx)(m.PuzzlePieceIcon,{className:"h-5 w-5"})}));w.push(...M);let N=async({tags:t})=>(await b({productId:e?._id,product:{tags:t}}),!0);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mt-5 flex flex-wrap items-center justify-between gap-10",children:(0,t.jsx)(k.default,{defaultValue:e?.tags,onSubmit:N,enableEdit:v(s.IRoleAction.ManageProducts),availableTagOptions:y?.adminUiConfig?.productTags.filter(t=>!(e?.tags||[])?.includes(t)).map(e=>({value:e,label:e}))})}),(0,t.jsx)(P.default,{tabItems:w,defaultTab:"texts",children:(0,t.jsx)(eP,{disableAll:e?.status===s.IProductStatus.Deleted,id:e?._id,...g})})]})}],42929);var eN=e.i(87284);e.s(["default",0,({media:e=[],onEditMedia:a})=>(0,t.jsx)("div",{className:"my-5",children:(0,t.jsx)("div",{className:"flex gap-3 overflow-x-auto",children:e.map(e=>(0,t.jsx)("div",{className:"relative flex-shrink-0 group",children:(0,t.jsx)("div",{className:"w-16 h-16 bg-surface-raised rounded-lg overflow-hidden cursor-pointer border border-border-subtle",onClick:()=>{var t;return t=e._id,void(a&&a(t))},children:(0,t.jsx)(eN.default,{src:e?.file?.url,alt:e.texts?.[0]?.title||e?.file?.url,width:128,height:128,className:"w-full h-full object-cover"})})},e._id))})})],97057);var e_=e.i(62199);let ek=A.gql`
128
128
  mutation PublishProduct($productId: ID!) {
129
129
  publishProduct(productId: $productId) {
130
130
  ...ProductDetailFragment
131
131
  }
132
132
  }
133
133
  ${e_.default}
134
- `;e.s(["default",0,()=>{let[e]=(0,W.useMutation)(ek);return{publishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],95379);let e$=A.gql`
134
+ `;e.s(["default",0,()=>{let[e]=(0,Z.useMutation)(ek);return{publishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],95379);let e$=A.gql`
135
135
  mutation UnpublishProduct($productId: ID!) {
136
136
  unpublishProduct(productId: $productId) {
137
137
  ...ProductDetailFragment
138
138
  }
139
139
  }
140
140
  ${e_.default}
141
- `;e.s(["default",0,()=>{let[e]=(0,W.useMutation)(e$);return{unPublishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],51628)},88604,e=>{"use strict";var t=e.i(59080),a=e.i(76204);let s=t.gql`
141
+ `;e.s(["default",0,()=>{let[e]=(0,Z.useMutation)(e$);return{unPublishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],51628)},88604,e=>{"use strict";var t=e.i(59080),a=e.i(76204);let s=t.gql`
142
142
  mutation RemoveProduct($productId: ID!) {
143
143
  removeProduct(productId: $productId) {
144
144
  _id
@@ -151,7 +151,7 @@
151
151
  }
152
152
  }
153
153
  ${s.default}
154
- `;e.s(["default",0,()=>{let[e]=(0,a.useMutation)(l);return{updateProduct:async({productId:t,product:{tags:a,sequence:s,meta:l}})=>e({variables:{productId:t,product:{tags:a,sequence:s,meta:l}},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},30311,e=>{"use strict";var t=e.i(91398),a=e.i(69322),s=e.i(66773),l=e.i(28401),i=e.i(50595),d=e.i(53576),r=e.i(25327),n=e.i(84818),o=e.i(42929),u=e.i(97057),c=e.i(84278),m=e.i(92276),p=e.i(95379),f=e.i(51628),x=e.i(41418),g=e.i(21623),h=e.i(88604),v=e.i(6607),b=e.i(15971),y=e.i(41215),j=e.i(3828),I=e.i(58971),w=e.i(24608),M=e.i(91788),P=e.i(34728);e.s(["default",0,({slug:e})=>{let{formatMessage:N}=(0,a.useIntl)(),{formatDateTime:_}=(0,n.default)(),{hasRole:k}=(0,I.default)(),{publishProduct:$}=(0,p.default)(),{unPublishProduct:C}=(0,f.default)(),{removeProduct:S}=(0,h.default)(),{updateProduct:T}=(0,x.default)(),{setModal:q}=(0,v.default)(),R=(0,j.useRouter)(),{push:A}=(0,j.useRouter)(),{product:V,loading:D,error:E,extendedData:U}=(0,c.default)({slug:e}),O=V?.status||"DRAFT",L=(0,M.useMemo)(()=>[{id:"published",title:N({id:"published",defaultMessage:"Published"}),description:N({id:"publish_product_description",defaultMessage:"Product will be searchable and is available for orders"}),current:"ACTIVE"===O,selectedTitle:N({id:"published",defaultMessage:"Published"}),onClick:async()=>{try{await $({productId:V?._id}),l.toast.success(N({id:"product_published",defaultMessage:"Published successfully "}))}catch(t){console.error("Failed to publish product:",t);let e=t?.message||"Unknown error";l.toast.error(`${N({id:"product_publish_error",defaultMessage:"Failed to publish product"})}: ${e}`)}},bgColor:"green",disable:!k(s.IRoleAction.ManageProducts)},{id:"draft",title:N({id:"draft",defaultMessage:"Draft"}),description:N({id:"draft_product_description",defaultMessage:"Product will not be discoverable and can not be orderose"}),current:"DRAFT"===O,selectedTitle:N({id:"not_published",defaultMessage:"Not published"}),bgColor:"amber",disable:"ACTIVE"===O&&!k(s.IRoleAction.ManageProducts),onClick:async()=>{if(k(s.IRoleAction.ManageProducts))try{await C({productId:V?._id}),l.toast.success(N({id:"product_drafted",defaultMessage:"Drafted successfully "}))}catch(t){console.error("Failed to unpublish product:",t);let e=t?.message||"Unknown error";l.toast.error(`${N({id:"product_unpublish_error",defaultMessage:"Failed to unpublish product"})}: ${e}`)}}}],[V]);if(E)return console.error("Error loading product:",E),(0,t.jsx)("div",{className:"mt-5 max-w-full",children:(0,t.jsx)("div",{className:"text-center py-8",children:(0,t.jsx)("p",{className:"text-danger",children:N({id:"product_load_error",defaultMessage:"Failed to load product"})})})});let F=async e=>{e.target.value&&await T({productId:V?._id,product:{sequence:parseInt(e.target.value,10)}})},Q=async()=>{"proxies"in V&&V.proxies?.length?await q((0,t.jsx)(P.default,{headerText:N({id:"product_delete_blocked_header",defaultMessage:"Remove links before deleting"}),message:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{children:N({id:"product_delete_blocked_intro",defaultMessage:"This product is linked to the following product types:"})}),(0,t.jsx)("ul",{className:"list-disc list-inside text-sm text-text-secondary",children:"proxies"in V&&V.proxies.map(({__typename:e},a)=>(0,t.jsx)("li",{children:e.replace("Product","")},a))}),(0,t.jsx)("p",{children:N({id:"product_delete_blocked_action",defaultMessage:"Please unlink it before trying to delete it."})})]}),buttonText:N({id:"ok",defaultMessage:"Ok"}),onOkClick:()=>q(null)})):await q((0,t.jsx)(b.default,{onCancelClick:()=>q(""),message:N({id:"delete_product_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it and it is nonreversible. Are you sure you want to delete this product?"}),onOkClick:async()=>{q("");try{await S({productId:V?._id}),l.toast.success(N({id:"product_deleted_success",defaultMessage:"Deleted successfully"})),R.push("/products")}catch(e){await q((0,t.jsx)(b.default,{onCancelClick:()=>q(""),headerText:N({id:"error",defaultMessage:"Error"}),message:e instanceof y.default?e.message:e,icon:(0,t.jsx)("div",{className:"mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-rose-100 dark:bg-rose-900/30 sm:mx-0 sm:h-10 sm:w-10",children:(0,t.jsx)(w.XMarkIcon,{className:"h-6 w-6 text-danger",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})}),okText:N({id:"ok",defaultMessage:"Ok"}),onOkClick:async()=>{q("")}}))}}}))};return V||D?D?(0,t.jsx)(d.default,{}):(0,t.jsxs)("div",{className:"mt-5 max-w-full",children:[(0,t.jsx)(i.default,{routeName:e,depth:3,currentPageTitle:V?.texts?.title}),"DELETED"===O&&(0,t.jsx)("div",{className:"mb-4 rounded-md border border-rose-300 bg-rose-50 p-4 text-sm text-rose-800 dark:border-rose-700 dark:bg-rose-900/30 dark:text-rose-300",children:N({id:"product_deleted_notice",defaultMessage:"This product has been deleted and is no longer active. Some actions may be restricted."})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"items-center flex-wrap flex gap-5 min-w-full justify-between",children:[(0,t.jsx)(r.default,{headerText:(0,t.jsxs)(t.Fragment,{children:[V?.texts?.title||"Untitled Product","DELETED"===O&&(0,t.jsx)("span",{className:"ml-3 rounded bg-rose-100 px-2 py-1 text-xs font-semibold text-rose-800 dark:bg-rose-900/40 dark:text-rose-300",children:N({id:"deleted_status",defaultMessage:"Deleted"})})]}),title:`${V?.texts?.title||"Product"} (${V?._id})`}),(0,t.jsxs)("div",{className:"publish-and-order flex flex-wrap gap-3",children:[O&&"DELETED"!==O&&(0,t.jsx)(m.default,{options:L,type:N({id:"product",defaultMessage:"Product"})}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-md dark:border-slate-600 px-4 py-2 text-sm font-medium leading-5 shadow-xs bg-surface h-[38px]",children:[(0,t.jsx)("label",{htmlFor:"sequence-input",className:"text-text-secondary font-medium cursor-pointer",children:N({id:"sequence",defaultMessage:"Display Order"})}),(0,t.jsx)("input",{type:"number",id:"sequence-input",disabled:!k(s.IRoleAction.ManageProducts),className:"text-center w-12 bg-transparent border border-border-default rounded focus:ring-2 focus:ring-focus-ring focus:border-transparent focus:outline-none text-sm font-semibold text-text-primary px-2 py-1 transition-all",defaultValue:V?.sequence,onBlur:F})]}),"DRAFT"===O&&k(s.IRoleAction.ManageProducts)&&(0,t.jsx)(g.default,{variant:"danger",icon:(0,t.jsx)(w.XMarkIcon,{className:"h-5 w-5"}),text:"Delete",onClick:Q})]})]}),(0,t.jsxs)("div",{className:"mt-8 flex flex-wrap gap-3 gap-x-10 text-text-secondary",children:[(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsx)("span",{className:"mr-2 text-xs text-text-muted",children:"ID:"}),(0,t.jsx)("span",{className:"text-sm font-mono",children:V?._id})]}),(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsx)("span",{className:"text-xs text-text-muted",children:"Type:"}),(0,t.jsx)("p",{className:"text-sm font-mono",children:V?.__typename})]}),V?.created&&(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[N({id:"created",defaultMessage:"Created"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:_(V.created,{dateStyle:"medium",timeStyle:"short"})})]}),V?.updated&&(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[N({id:"updated",defaultMessage:"Updated"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:_(V.updated,{dateStyle:"medium",timeStyle:"short"})})]}),V?.published&&(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[N({id:"published",defaultMessage:"Published"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:_(V.published,{dateStyle:"medium",timeStyle:"short"})})]})]})]}),(0,t.jsx)(u.default,{productId:V?._id,media:V?.media||[],onEditMedia:e=>{R.push({pathname:R.pathname,query:{...R.query,tab:"media"}},void 0,{shallow:!0})},canEdit:k(s.IRoleAction.ManageProducts)}),(0,t.jsx)(o.default,{product:V,extendedData:U})]}):(A("/404"),null)}])},94330,43054,95336,16113,82191,42532,10785,1330,73356,50099,77035,56902,72264,19051,84278,11907,e=>{"use strict";var t=e.i(91788);let a=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{fillRule:"evenodd",d:"M6 5v1H4.667a1.75 1.75 0 0 0-1.743 1.598l-.826 9.5A1.75 1.75 0 0 0 3.84 19H16.16a1.75 1.75 0 0 0 1.743-1.902l-.826-9.5A1.75 1.75 0 0 0 15.333 6H14V5a4 4 0 0 0-8 0Zm4-2.5A2.5 2.5 0 0 0 7.5 5v1h5V5A2.5 2.5 0 0 0 10 2.5ZM7.5 10a2.5 2.5 0 0 0 5 0V8.75a.75.75 0 0 1 1.5 0V10a4 4 0 0 1-8 0V8.75a.75.75 0 0 1 1.5 0V10Z",clipRule:"evenodd"}))});e.s(["ShoppingBagIcon",0,a],94330);let s=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{d:"M12 9a1 1 0 0 1-1-1V3c0-.552.45-1.007.997-.93a7.004 7.004 0 0 1 5.933 5.933c.078.547-.378.997-.93.997h-5Z"}),t.createElement("path",{d:"M8.003 4.07C8.55 3.994 9 4.449 9 5v5a1 1 0 0 0 1 1h5c.552 0 1.008.45.93.997A7.001 7.001 0 0 1 2 11a7.002 7.002 0 0 1 6.003-6.93Z"}))});e.s(["ChartPieIcon",0,s],43054);let l=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{d:"M2 3a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H2Z"}),t.createElement("path",{fillRule:"evenodd",d:"M2 7.5h16l-.811 7.71a2 2 0 0 1-1.99 1.79H4.802a2 2 0 0 1-1.99-1.79L2 7.5ZM7 11a1 1 0 0 1 1-1h4a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1Z",clipRule:"evenodd"}))});e.s(["ArchiveBoxIcon",0,l],95336);let i=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{fillRule:"evenodd",d:"M3.5 2A1.5 1.5 0 0 0 2 3.5V15a3 3 0 1 0 6 0V3.5A1.5 1.5 0 0 0 6.5 2h-3Zm11.753 6.99L9.5 14.743V6.257l1.51-1.51a1.5 1.5 0 0 1 2.122 0l2.121 2.121a1.5 1.5 0 0 1 0 2.122ZM8.364 18H16.5a1.5 1.5 0 0 0 1.5-1.5v-3a1.5 1.5 0 0 0-1.5-1.5h-2.136l-6 6ZM5 16a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"}))});e.s(["SwatchIcon",0,i],16113);let d=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{fillRule:"evenodd",d:"M1 2.75A.75.75 0 0 1 1.75 2h16.5a.75.75 0 0 1 0 1.5H18v8.75A2.75 2.75 0 0 1 15.25 15h-1.072l.798 3.06a.75.75 0 0 1-1.452.38L13.41 18H6.59l-.114.44a.75.75 0 0 1-1.452-.38L5.823 15H4.75A2.75 2.75 0 0 1 2 12.25V3.5h-.25A.75.75 0 0 1 1 2.75ZM7.373 15l-.391 1.5h6.037l-.392-1.5H7.373Zm7.49-8.931a.75.75 0 0 1-.175 1.046 19.326 19.326 0 0 0-3.398 3.098.75.75 0 0 1-1.097.04L8.5 8.561l-2.22 2.22A.75.75 0 1 1 5.22 9.72l2.75-2.75a.75.75 0 0 1 1.06 0l1.664 1.663a20.786 20.786 0 0 1 3.122-2.74.75.75 0 0 1 1.046.176Z",clipRule:"evenodd"}))});e.s(["PresentationChartLineIcon",0,d],82191);var r=e.i(91398),n=e.i(66773),o=e.i(58021),u=e.i(69322),c=e.i(58971),m=e.i(5505),p=e.i(1504),f=e.i(98520),x=e.i(79093),g=e.i(30434),h=e.i(69211),v=e.i(63094),b=e.i(10685),y=e.i(21128),j=e.i(16984),I=e.i(21623),w=e.i(98949),M=e.i(82226),P=e.i(59080),N=e.i(32171);let _=P.gql`
154
+ `;e.s(["default",0,()=>{let[e]=(0,a.useMutation)(l);return{updateProduct:async({productId:t,product:{tags:a,sequence:s,meta:l}})=>e({variables:{productId:t,product:{tags:a,sequence:s,meta:l}},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},30311,e=>{"use strict";var t=e.i(91398),a=e.i(69322);e.i(51523);var s=e.i(19518),l=e.i(28401),i=e.i(50595),d=e.i(53576),r=e.i(25327),n=e.i(84818),o=e.i(42929),u=e.i(97057),c=e.i(84278),m=e.i(92276),p=e.i(95379),f=e.i(51628),x=e.i(41418),g=e.i(21623),h=e.i(88604),v=e.i(6607),b=e.i(15971),y=e.i(41215),j=e.i(3828),I=e.i(58971),w=e.i(24608),M=e.i(91788),P=e.i(34728);e.s(["default",0,({slug:e})=>{let{formatMessage:N}=(0,a.useIntl)(),{formatDateTime:_}=(0,n.default)(),{hasRole:k}=(0,I.default)(),{publishProduct:$}=(0,p.default)(),{unPublishProduct:C}=(0,f.default)(),{removeProduct:S}=(0,h.default)(),{updateProduct:T}=(0,x.default)(),{setModal:q}=(0,v.default)(),R=(0,j.useRouter)(),{push:A}=(0,j.useRouter)(),{product:D,loading:V,error:E,extendedData:O}=(0,c.default)({slug:e}),U=D?.status||"DRAFT",L=(0,M.useMemo)(()=>[{id:"published",title:N({id:"published",defaultMessage:"Published"}),description:N({id:"publish_product_description",defaultMessage:"Product will be searchable and is available for orders"}),current:"ACTIVE"===U,selectedTitle:N({id:"published",defaultMessage:"Published"}),onClick:async()=>{try{await $({productId:D?._id}),l.toast.success(N({id:"product_published",defaultMessage:"Published successfully "}))}catch(t){console.error("Failed to publish product:",t);let e=t?.message||"Unknown error";l.toast.error(`${N({id:"product_publish_error",defaultMessage:"Failed to publish product"})}: ${e}`)}},bgColor:"green",disable:!k(s.IRoleAction.ManageProducts)},{id:"draft",title:N({id:"draft",defaultMessage:"Draft"}),description:N({id:"draft_product_description",defaultMessage:"Product will not be discoverable and can not be orderose"}),current:"DRAFT"===U,selectedTitle:N({id:"not_published",defaultMessage:"Not published"}),bgColor:"amber",disable:"ACTIVE"===U&&!k(s.IRoleAction.ManageProducts),onClick:async()=>{if(k(s.IRoleAction.ManageProducts))try{await C({productId:D?._id}),l.toast.success(N({id:"product_drafted",defaultMessage:"Drafted successfully "}))}catch(t){console.error("Failed to unpublish product:",t);let e=t?.message||"Unknown error";l.toast.error(`${N({id:"product_unpublish_error",defaultMessage:"Failed to unpublish product"})}: ${e}`)}}}],[D]);if(E)return console.error("Error loading product:",E),(0,t.jsx)("div",{className:"mt-5 max-w-full",children:(0,t.jsx)("div",{className:"text-center py-8",children:(0,t.jsx)("p",{className:"text-danger",children:N({id:"product_load_error",defaultMessage:"Failed to load product"})})})});let F=async e=>{e.target.value&&await T({productId:D?._id,product:{sequence:parseInt(e.target.value,10)}})},Q=async()=>{"proxies"in D&&D.proxies?.length?await q((0,t.jsx)(P.default,{headerText:N({id:"product_delete_blocked_header",defaultMessage:"Remove links before deleting"}),message:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{children:N({id:"product_delete_blocked_intro",defaultMessage:"This product is linked to the following product types:"})}),(0,t.jsx)("ul",{className:"list-disc list-inside text-sm text-text-secondary",children:"proxies"in D&&D.proxies.map(({__typename:e},a)=>(0,t.jsx)("li",{children:e.replace("Product","")},a))}),(0,t.jsx)("p",{children:N({id:"product_delete_blocked_action",defaultMessage:"Please unlink it before trying to delete it."})})]}),buttonText:N({id:"ok",defaultMessage:"Ok"}),onOkClick:()=>q(null)})):await q((0,t.jsx)(b.default,{onCancelClick:()=>q(""),message:N({id:"delete_product_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it and it is nonreversible. Are you sure you want to delete this product?"}),onOkClick:async()=>{q("");try{await S({productId:D?._id}),l.toast.success(N({id:"product_deleted_success",defaultMessage:"Deleted successfully"})),R.push("/products")}catch(e){await q((0,t.jsx)(b.default,{onCancelClick:()=>q(""),headerText:N({id:"error",defaultMessage:"Error"}),message:e instanceof y.default?e.message:e,icon:(0,t.jsx)("div",{className:"mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-rose-100 dark:bg-rose-900/30 sm:mx-0 sm:h-10 sm:w-10",children:(0,t.jsx)(w.XMarkIcon,{className:"h-6 w-6 text-danger",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})}),okText:N({id:"ok",defaultMessage:"Ok"}),onOkClick:async()=>{q("")}}))}}}))};return D||V?V?(0,t.jsx)(d.default,{}):(0,t.jsxs)("div",{className:"mt-5 max-w-full",children:[(0,t.jsx)(i.default,{routeName:e,depth:3,currentPageTitle:D?.texts?.title}),"DELETED"===U&&(0,t.jsx)("div",{className:"mb-4 rounded-md border border-rose-300 bg-rose-50 p-4 text-sm text-rose-800 dark:border-rose-700 dark:bg-rose-900/30 dark:text-rose-300",children:N({id:"product_deleted_notice",defaultMessage:"This product has been deleted and is no longer active. Some actions may be restricted."})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"items-center flex-wrap flex gap-5 min-w-full justify-between",children:[(0,t.jsx)(r.default,{headerText:(0,t.jsxs)(t.Fragment,{children:[D?.texts?.title||"Untitled Product","DELETED"===U&&(0,t.jsx)("span",{className:"ml-3 rounded bg-rose-100 px-2 py-1 text-xs font-semibold text-rose-800 dark:bg-rose-900/40 dark:text-rose-300",children:N({id:"deleted_status",defaultMessage:"Deleted"})})]}),title:`${D?.texts?.title||"Product"} (${D?._id})`}),(0,t.jsxs)("div",{className:"publish-and-order flex flex-wrap gap-3",children:[U&&"DELETED"!==U&&(0,t.jsx)(m.default,{options:L,type:N({id:"product",defaultMessage:"Product"})}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-md dark:border-slate-600 px-4 py-2 text-sm font-medium leading-5 shadow-xs bg-surface h-[38px]",children:[(0,t.jsx)("label",{htmlFor:"sequence-input",className:"text-text-secondary font-medium cursor-pointer",children:N({id:"sequence",defaultMessage:"Display Order"})}),(0,t.jsx)("input",{type:"number",id:"sequence-input",disabled:!k(s.IRoleAction.ManageProducts),className:"text-center w-12 bg-transparent border border-border-default rounded focus:ring-2 focus:ring-focus-ring focus:border-transparent focus:outline-none text-sm font-semibold text-text-primary px-2 py-1 transition-all",defaultValue:D?.sequence,onBlur:F})]}),"DRAFT"===U&&k(s.IRoleAction.ManageProducts)&&(0,t.jsx)(g.default,{variant:"danger",icon:(0,t.jsx)(w.XMarkIcon,{className:"h-5 w-5"}),text:"Delete",onClick:Q})]})]}),(0,t.jsxs)("div",{className:"mt-8 flex flex-wrap gap-3 gap-x-10 text-text-secondary",children:[(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsx)("span",{className:"mr-2 text-xs text-text-muted",children:"ID:"}),(0,t.jsx)("span",{className:"text-sm font-mono",children:D?._id})]}),(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsx)("span",{className:"text-xs text-text-muted",children:"Type:"}),(0,t.jsx)("p",{className:"text-sm font-mono",children:D?.__typename})]}),D?.created&&(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[N({id:"created",defaultMessage:"Created"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:_(D.created,{dateStyle:"medium",timeStyle:"short"})})]}),D?.updated&&(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[N({id:"updated",defaultMessage:"Updated"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:_(D.updated,{dateStyle:"medium",timeStyle:"short"})})]}),D?.published&&(0,t.jsxs)("div",{className:"flex flex-col items-baseline gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:[N({id:"published",defaultMessage:"Published"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:_(D.published,{dateStyle:"medium",timeStyle:"short"})})]})]})]}),(0,t.jsx)(u.default,{productId:D?._id,media:D?.media||[],onEditMedia:e=>{R.push({pathname:R.pathname,query:{...R.query,tab:"media"}},void 0,{shallow:!0})},canEdit:k(s.IRoleAction.ManageProducts)}),(0,t.jsx)(o.default,{product:D,extendedData:O})]}):(A("/404"),null)}])},43054,95336,16113,82191,42532,10785,1330,73356,50099,77035,56902,72264,19051,84278,11907,e=>{"use strict";var t=e.i(91788);let a=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{d:"M12 9a1 1 0 0 1-1-1V3c0-.552.45-1.007.997-.93a7.004 7.004 0 0 1 5.933 5.933c.078.547-.378.997-.93.997h-5Z"}),t.createElement("path",{d:"M8.003 4.07C8.55 3.994 9 4.449 9 5v5a1 1 0 0 0 1 1h5c.552 0 1.008.45.93.997A7.001 7.001 0 0 1 2 11a7.002 7.002 0 0 1 6.003-6.93Z"}))});e.s(["ChartPieIcon",0,a],43054);let s=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{d:"M2 3a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H2Z"}),t.createElement("path",{fillRule:"evenodd",d:"M2 7.5h16l-.811 7.71a2 2 0 0 1-1.99 1.79H4.802a2 2 0 0 1-1.99-1.79L2 7.5ZM7 11a1 1 0 0 1 1-1h4a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1Z",clipRule:"evenodd"}))});e.s(["ArchiveBoxIcon",0,s],95336);let l=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{fillRule:"evenodd",d:"M3.5 2A1.5 1.5 0 0 0 2 3.5V15a3 3 0 1 0 6 0V3.5A1.5 1.5 0 0 0 6.5 2h-3Zm11.753 6.99L9.5 14.743V6.257l1.51-1.51a1.5 1.5 0 0 1 2.122 0l2.121 2.121a1.5 1.5 0 0 1 0 2.122ZM8.364 18H16.5a1.5 1.5 0 0 0 1.5-1.5v-3a1.5 1.5 0 0 0-1.5-1.5h-2.136l-6 6ZM5 16a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"}))});e.s(["SwatchIcon",0,l],16113);let i=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{fillRule:"evenodd",d:"M1 2.75A.75.75 0 0 1 1.75 2h16.5a.75.75 0 0 1 0 1.5H18v8.75A2.75 2.75 0 0 1 15.25 15h-1.072l.798 3.06a.75.75 0 0 1-1.452.38L13.41 18H6.59l-.114.44a.75.75 0 0 1-1.452-.38L5.823 15H4.75A2.75 2.75 0 0 1 2 12.25V3.5h-.25A.75.75 0 0 1 1 2.75ZM7.373 15l-.391 1.5h6.037l-.392-1.5H7.373Zm7.49-8.931a.75.75 0 0 1-.175 1.046 19.326 19.326 0 0 0-3.398 3.098.75.75 0 0 1-1.097.04L8.5 8.561l-2.22 2.22A.75.75 0 1 1 5.22 9.72l2.75-2.75a.75.75 0 0 1 1.06 0l1.664 1.663a20.786 20.786 0 0 1 3.122-2.74.75.75 0 0 1 1.046.176Z",clipRule:"evenodd"}))});e.s(["PresentationChartLineIcon",0,i],82191);var d=e.i(91398);e.i(51523);var r=e.i(19518),n=e.i(58021),o=e.i(69322),u=e.i(58971),c=e.i(5505),m=e.i(1504),p=e.i(98520),f=e.i(79093),x=e.i(30434),g=e.i(69211),h=e.i(63094),v=e.i(10685),b=e.i(21128),y=e.i(16984),j=e.i(21623),I=e.i(98949),w=e.i(82226),M=e.i(59080),P=e.i(32171);let N=M.gql`
155
155
  fragment ProductCatalogPriceFragment on ProductCatalogPrice {
156
156
  isTaxable
157
157
  isNetPrice
@@ -169,14 +169,14 @@
169
169
  amount
170
170
  minQuantity
171
171
  }
172
- `,k=P.gql`
172
+ `,_=M.gql`
173
173
  query ProductCatalogPrices($productId: ID!) {
174
174
  productCatalogPrices(productId: $productId) {
175
175
  ...ProductCatalogPriceFragment
176
176
  }
177
177
  }
178
- ${_}
179
- `;var $=e.i(76204),C=e.i(62199);let S=P.gql`
178
+ ${N}
179
+ `;var k=e.i(76204),$=e.i(62199);let C=M.gql`
180
180
  mutation UpdateProductCommerce(
181
181
  $productId: ID!
182
182
  $commerce: UpdateProductCommerceInput!
@@ -185,23 +185,23 @@
185
185
  ...ProductDetailFragment
186
186
  }
187
187
  }
188
- ${C.default}
189
- `,T=({defaultCountryValue:e,defaultCurrencyValue:t,countries:a,currencies:s})=>{let{formatMessage:l}=(0,u.useIntl)(),{hasRole:i}=(0,c.default)(),{watch:d,getValues:m,trigger:f}=(0,o.useFormContext)(),{fields:x,append:h,remove:v}=(0,o.useFieldArray)({name:"pricing"});d("pricing");let y=()=>m("pricing"),w=()=>{let e=x.map((e,t)=>`pricing.${t}.minQuantity`);setTimeout(()=>f(e),0)};return(0,r.jsxs)("div",{children:[x.map((d,o)=>{let u=[(0,M.validateProductCommerce)(o,y)];return 0===o&&u.push((0,M.validateProductCommerceOneZero)(y)),(0,r.jsxs)("div",{className:"relative max-w-full border-b dark:border-slate-700 pt-1 pb-5 mb-3 align-baseline lg:flex",children:[(0,r.jsxs)("div",{className:"flex w-full gap-x-2",children:[(0,r.jsx)(j.default,{className:"w-full",disabled:!i(n.IRoleAction.ManageProducts),validators:u,name:`pricing.${o}.minQuantity`,id:`pricing.${o}.minQuantity`,type:"number",min:0,hideLabel:!0,onChange:w,label:l({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)(j.default,{type:"number",className:"w-full",disabled:!i(n.IRoleAction.ManageProducts),name:`pricing.${o}.amount`,id:`pricing.${o}.amount`,required:!0,hideLabel:!0,label:l({id:"price",defaultMessage:"Price "})})]}),(0,r.jsxs)("div",{className:"flex w-full gap-x-2 pt-3 pb-2",children:[(0,r.jsx)("div",{className:"w-full lg:ml-8 lg:items-center",children:(0,r.jsx)(g.default,{name:`pricing.${o}.isTaxable`,labelClassName:"lg:sr-only items-center ",disabled:!i(n.IRoleAction.ManageProducts),label:l({id:"vat_suspect",defaultMessage:"Vat Suspect"}),className:"mr-2 h-4 w-4 rounded-sm border-border-default bg-white dark:!bg-slate-900 text-slate-950 focus:ring-focus-ring lg:items-center",type:"checkbox"})}),(0,r.jsx)("div",{className:"w-full lg:ml-8",children:(0,r.jsx)(g.default,{name:`pricing.${o}.isNetPrice`,labelClassName:"lg:sr-only items-center",disabled:!i(n.IRoleAction.ManageProducts),label:l({id:"net_price",defaultMessage:"Net Price"}),hideLabel:!0,className:"mr-2 h-4 w-4 justify-between rounded-sm border-border-default bg-white dark:!bg-slate-900 text-slate-950 focus:ring-focus-ring lg:items-center",type:"checkbox"})})]}),(0,r.jsxs)("div",{className:"flex w-full gap-x-2 mt-1",children:[(0,r.jsx)(b.default,{defaultValue:e,className:"w-full lg:ml-4 lg:mr-4",label:l({id:"country",defaultMessage:"Country"}),name:`pricing.${o}.countryCode`,id:`pricing.${o}.countryCode`,disabled:!i(n.IRoleAction.ManageProducts),required:!0,options:(0,p.default)(a,"isoCode","isoCode"),hideLabel:!0}),(0,r.jsx)(b.default,{defaultValue:t,className:"w-full lg:mr-8 ",label:l({id:"currency",defaultMessage:"Currency"}),disabled:!i(n.IRoleAction.ManageProducts),name:`pricing.${o}.currencyCode`,id:`pricing.${o}.currencyCode`,required:!0,options:(0,p.default)(s,"isoCode","isoCode"),hideLabel:!0,placeholder:l({id:"country_currency",defaultMessage:"Currency"})})]}),i(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"absolute -top-2 right-0 mt-0 mr-0 shrink-0 pb-1 md:mr-0 lg:mt-6 lg:py-0 lg:px-0 ",children:(0,r.jsx)("button",{className:"items-center rounded-full bg-surface-input px-1 py-1 text-sm text-rose-500 dark:text-rose-400 hover:bg-rose-50 focus:outline-hidden focus:ring-0 focus:ring-rose-500 focus:ring-offset-2",type:"button",onClick:()=>v(o),children:(0,r.jsxs)("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,r.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),(0,r.jsx)("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),(0,r.jsx)("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})})})]},d.id)}),i(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(I.default,{variant:"tertiary",text:l({id:"add_price_row",defaultMessage:"Add Price Row"}),className:"w-full items-center justify-center",onClick:()=>h({minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:t,countryCode:e})})})]})};e.s(["default",0,({productId:e,disabled:t=!1})=>{let{formatMessage:a}=(0,u.useIntl)(),{catalogPrices:s}=(({productId:e})=>{let{data:t,loading:a,error:s}=(0,N.useQuery)(k,{skip:!e,variables:{productId:e}});return{catalogPrices:t?.productCatalogPrices||[],loading:a,error:s}})({productId:e}),{hasRole:l}=(0,c.default)(),{updateProductCommerce:i}=(()=>{let[e]=(0,$.useMutation)(S),{currencies:t}=(0,x.default)();return{updateProductCommerce:async({productId:a,commerce:{pricing:s}})=>e({variables:{productId:a,commerce:{pricing:s.map(e=>{let a=t.find(({isoCode:t})=>t===e.currencyCode),s=((e,t)=>{if(!e||t<0)return 0;let a=e.trim();if(!/^-?\d*\.?\d*$/.test(a))return 0;let s=a.indexOf(".");return -1===s?Number(a)*10**t:Number((a.slice(0,s)||"0")+a.slice(s+1).slice(0,t).padEnd(t,"0"))})(e.amount.toString(),a.decimals);return{...e,amount:s}})}},refetchQueries:["Products"]})}})(),{countries:d}=(0,f.default)(),{currencies:o}=(0,x.default)(),p=d?.find(({isBase:e})=>e),g=p?.isoCode,b=p?.defaultCurrency?.isoCode,j=async({pricing:t})=>(await i({productId:e,commerce:{pricing:t}}),{success:!0}),I=a({id:"saved",defaultMessage:"Saved"}),M=((e=[],t=[])=>t.length?e.map(e=>{let a=t.find(({isoCode:t})=>t.toLowerCase()===e.currency.isoCode.toLowerCase());return{countryCode:e.country.isoCode,currencyCode:e.currency.isoCode,isTaxable:!!e.isTaxable,isNetPrice:!!e.isNetPrice,amount:((e,t)=>{if(t<0)return"0";if(0===t)return e.toString();let a=e.toString();if("0"===a)return"0."+"0".repeat(t);let s=a.startsWith("-"),l=s?a.slice(1):a;if(l.length<=t){let e=l.padStart(t,"0");return`${s?"-":""}0.${e}`}let i=l.length-t,d=l.slice(0,i),r=l.slice(i);return`${s?"-":""}${d}.${r}`})(e.amount,a?.decimals),minQuantity:e.minQuantity}}):[])(s,o),P=(0,w.default)({disabled:t,submit:j,successMessage:I,enableReinitialize:!0,initialValues:{pricing:[...M?.length?M:[{minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:b,countryCode:g}]]}});return(0,r.jsx)("div",{children:(0,r.jsxs)("div",{className:"mt-5 md:col-span-3 lg:mt-0",children:[(0,r.jsx)(m.default,{children:(0,r.jsxs)(h.default,{className:"mt-3 rounded-md",form:P,disabled:!l(n.IRoleAction.ManageProducts),children:[(0,r.jsxs)("div",{className:"relative max-w-full p-3 sm:px-5",children:[(0,r.jsx)("div",{className:"max-w-full justify-between align-baseline"}),(0,r.jsxs)("label",{className:"sr-only flex w-full font-sans text-sm text-text-muted lg:not-sr-only",children:[(0,r.jsxs)("span",{className:"flex w-full",children:[(0,r.jsx)("span",{className:"w-full",children:a({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)("span",{className:"w-full lg:ml-5",children:a({id:"price",defaultMessage:"Price"})})]}),(0,r.jsxs)("span",{className:"flex w-full",children:[(0,r.jsx)("span",{className:"w-full lg:ml-8",children:a({id:"vat_suspect",defaultMessage:"Vat Suspect"})}),(0,r.jsx)("span",{className:"w-full lg:ml-12",children:a({id:"net_price",defaultMessage:"Net Price"})})]}),(0,r.jsxs)("span",{className:"mr-5 flex w-full",children:[(0,r.jsx)("span",{className:"ml-10 w-full",children:a({id:"country",defaultMessage:"Country"})}),(0,r.jsx)("span",{className:"w-full",children:a({id:"currency",defaultMessage:"Currency"})})]})]}),(0,r.jsx)(T,{defaultCountryValue:g,defaultCurrencyValue:b,countries:d,currencies:o})]}),(0,r.jsx)(v.default,{displayFieldErrors:!0}),l(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"-mx-6 p-6 bg-surface-subtle text-right",children:(0,r.jsx)(y.default,{className:"mx-6",label:a({id:"save",defaultMessage:"Save"})})})]})}),(0,r.jsx)("p",{className:"mt-6 mb-10 text-sm text-text-muted",children:a({id:"product_commerce_info",defaultMessage:"One price should have a min quantity of 0 (or empty) and no two prices should share the same min quantity, currency and country"})})]})})}],42532);var q=e.i(70693),R=e.i(14336);let A=P.gql`
188
+ ${$.default}
189
+ `,S=({defaultCountryValue:e,defaultCurrencyValue:t,countries:a,currencies:s})=>{let{formatMessage:l}=(0,o.useIntl)(),{hasRole:i}=(0,u.default)(),{watch:c,getValues:p,trigger:f}=(0,n.useFormContext)(),{fields:g,append:h,remove:b}=(0,n.useFieldArray)({name:"pricing"});c("pricing");let I=()=>p("pricing"),M=()=>{let e=g.map((e,t)=>`pricing.${t}.minQuantity`);setTimeout(()=>f(e),0)};return(0,d.jsxs)("div",{children:[g.map((n,o)=>{let u=[(0,w.validateProductCommerce)(o,I)];return 0===o&&u.push((0,w.validateProductCommerceOneZero)(I)),(0,d.jsxs)("div",{className:"relative max-w-full border-b dark:border-slate-700 pt-1 pb-5 mb-3 align-baseline lg:flex",children:[(0,d.jsxs)("div",{className:"flex w-full gap-x-2",children:[(0,d.jsx)(y.default,{className:"w-full",disabled:!i(r.IRoleAction.ManageProducts),validators:u,name:`pricing.${o}.minQuantity`,id:`pricing.${o}.minQuantity`,type:"number",min:0,hideLabel:!0,onChange:M,label:l({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,d.jsx)(y.default,{type:"number",className:"w-full",disabled:!i(r.IRoleAction.ManageProducts),name:`pricing.${o}.amount`,id:`pricing.${o}.amount`,required:!0,hideLabel:!0,label:l({id:"price",defaultMessage:"Price "})})]}),(0,d.jsxs)("div",{className:"flex w-full gap-x-2 pt-3 pb-2",children:[(0,d.jsx)("div",{className:"w-full lg:ml-8 lg:items-center",children:(0,d.jsx)(x.default,{name:`pricing.${o}.isTaxable`,labelClassName:"lg:sr-only items-center ",disabled:!i(r.IRoleAction.ManageProducts),label:l({id:"vat_suspect",defaultMessage:"Vat Suspect"}),className:"mr-2 h-4 w-4 rounded-sm border-border-default bg-white dark:!bg-slate-900 text-slate-950 focus:ring-focus-ring lg:items-center",type:"checkbox"})}),(0,d.jsx)("div",{className:"w-full lg:ml-8",children:(0,d.jsx)(x.default,{name:`pricing.${o}.isNetPrice`,labelClassName:"lg:sr-only items-center",disabled:!i(r.IRoleAction.ManageProducts),label:l({id:"net_price",defaultMessage:"Net Price"}),hideLabel:!0,className:"mr-2 h-4 w-4 justify-between rounded-sm border-border-default bg-white dark:!bg-slate-900 text-slate-950 focus:ring-focus-ring lg:items-center",type:"checkbox"})})]}),(0,d.jsxs)("div",{className:"flex w-full gap-x-2 mt-1",children:[(0,d.jsx)(v.default,{defaultValue:e,className:"w-full lg:ml-4 lg:mr-4",label:l({id:"country",defaultMessage:"Country"}),name:`pricing.${o}.countryCode`,id:`pricing.${o}.countryCode`,disabled:!i(r.IRoleAction.ManageProducts),required:!0,options:(0,m.default)(a,"isoCode","isoCode"),hideLabel:!0}),(0,d.jsx)(v.default,{defaultValue:t,className:"w-full lg:mr-8 ",label:l({id:"currency",defaultMessage:"Currency"}),disabled:!i(r.IRoleAction.ManageProducts),name:`pricing.${o}.currencyCode`,id:`pricing.${o}.currencyCode`,required:!0,options:(0,m.default)(s,"isoCode","isoCode"),hideLabel:!0,placeholder:l({id:"country_currency",defaultMessage:"Currency"})})]}),i(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"absolute -top-2 right-0 mt-0 mr-0 shrink-0 pb-1 md:mr-0 lg:mt-6 lg:py-0 lg:px-0 ",children:(0,d.jsx)("button",{className:"items-center rounded-full bg-surface-input px-1 py-1 text-sm text-rose-500 dark:text-rose-400 hover:bg-rose-50 focus:outline-hidden focus:ring-0 focus:ring-rose-500 focus:ring-offset-2",type:"button",onClick:()=>b(o),children:(0,d.jsxs)("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,d.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),(0,d.jsx)("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),(0,d.jsx)("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})})})]},n.id)}),i(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"mt-6",children:(0,d.jsx)(j.default,{variant:"tertiary",text:l({id:"add_price_row",defaultMessage:"Add Price Row"}),className:"w-full items-center justify-center",onClick:()=>h({minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:t,countryCode:e})})})]})};e.s(["default",0,({productId:e,disabled:t=!1})=>{let{formatMessage:a}=(0,o.useIntl)(),{catalogPrices:s}=(({productId:e})=>{let{data:t,loading:a,error:s}=(0,P.useQuery)(_,{skip:!e,variables:{productId:e}});return{catalogPrices:t?.productCatalogPrices||[],loading:a,error:s}})({productId:e}),{hasRole:l}=(0,u.default)(),{updateProductCommerce:i}=(()=>{let[e]=(0,k.useMutation)(C),{currencies:t}=(0,f.default)();return{updateProductCommerce:async({productId:a,commerce:{pricing:s}})=>e({variables:{productId:a,commerce:{pricing:s.map(e=>{let a=t.find(({isoCode:t})=>t===e.currencyCode),s=((e,t)=>{if(!e||t<0)return 0;let a=e.trim();if(!/^-?\d*\.?\d*$/.test(a))return 0;let s=a.indexOf(".");return -1===s?Number(a)*10**t:Number((a.slice(0,s)||"0")+a.slice(s+1).slice(0,t).padEnd(t,"0"))})(e.amount.toString(),a.decimals);return{...e,amount:s}})}},refetchQueries:["Products"]})}})(),{countries:n}=(0,p.default)(),{currencies:m}=(0,f.default)(),x=n?.find(({isBase:e})=>e),v=x?.isoCode,y=x?.defaultCurrency?.isoCode,j=async({pricing:t})=>(await i({productId:e,commerce:{pricing:t}}),{success:!0}),w=a({id:"saved",defaultMessage:"Saved"}),M=((e=[],t=[])=>t.length?e.map(e=>{let a=t.find(({isoCode:t})=>t.toLowerCase()===e.currency.isoCode.toLowerCase());return{countryCode:e.country.isoCode,currencyCode:e.currency.isoCode,isTaxable:!!e.isTaxable,isNetPrice:!!e.isNetPrice,amount:((e,t)=>{if(t<0)return"0";if(0===t)return e.toString();let a=e.toString();if("0"===a)return"0."+"0".repeat(t);let s=a.startsWith("-"),l=s?a.slice(1):a;if(l.length<=t){let e=l.padStart(t,"0");return`${s?"-":""}0.${e}`}let i=l.length-t,d=l.slice(0,i),r=l.slice(i);return`${s?"-":""}${d}.${r}`})(e.amount,a?.decimals),minQuantity:e.minQuantity}}):[])(s,m),N=(0,I.default)({disabled:t,submit:j,successMessage:w,enableReinitialize:!0,initialValues:{pricing:[...M?.length?M:[{minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:y,countryCode:v}]]}});return(0,d.jsx)("div",{children:(0,d.jsxs)("div",{className:"mt-5 md:col-span-3 lg:mt-0",children:[(0,d.jsx)(c.default,{children:(0,d.jsxs)(g.default,{className:"mt-3 rounded-md",form:N,disabled:!l(r.IRoleAction.ManageProducts),children:[(0,d.jsxs)("div",{className:"relative max-w-full p-3 sm:px-5",children:[(0,d.jsx)("div",{className:"max-w-full justify-between align-baseline"}),(0,d.jsxs)("label",{className:"sr-only flex w-full font-sans text-sm text-text-muted lg:not-sr-only",children:[(0,d.jsxs)("span",{className:"flex w-full",children:[(0,d.jsx)("span",{className:"w-full",children:a({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,d.jsx)("span",{className:"w-full lg:ml-5",children:a({id:"price",defaultMessage:"Price"})})]}),(0,d.jsxs)("span",{className:"flex w-full",children:[(0,d.jsx)("span",{className:"w-full lg:ml-8",children:a({id:"vat_suspect",defaultMessage:"Vat Suspect"})}),(0,d.jsx)("span",{className:"w-full lg:ml-12",children:a({id:"net_price",defaultMessage:"Net Price"})})]}),(0,d.jsxs)("span",{className:"mr-5 flex w-full",children:[(0,d.jsx)("span",{className:"ml-10 w-full",children:a({id:"country",defaultMessage:"Country"})}),(0,d.jsx)("span",{className:"w-full",children:a({id:"currency",defaultMessage:"Currency"})})]})]}),(0,d.jsx)(S,{defaultCountryValue:v,defaultCurrencyValue:y,countries:n,currencies:m})]}),(0,d.jsx)(h.default,{displayFieldErrors:!0}),l(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"-mx-6 p-6 bg-surface-subtle text-right",children:(0,d.jsx)(b.default,{className:"mx-6",label:a({id:"save",defaultMessage:"Save"})})})]})}),(0,d.jsx)("p",{className:"mt-6 mb-10 text-sm text-text-muted",children:a({id:"product_commerce_info",defaultMessage:"One price should have a min quantity of 0 (or empty) and no two prices should share the same min quantity, currency and country"})})]})})}],42532);var T=e.i(70693),q=e.i(14336);let R=M.gql`
190
190
  mutation UpdateProductTexts($productId: ID!, $texts: [ProductTextInput!]!) {
191
191
  updateProductTexts(productId: $productId, texts: $texts) {
192
192
  ...ProductTextsFragment
193
193
  }
194
194
  }
195
- ${R.default}
196
- `;var V=e.i(60195),D=e.i(83094),E=e.i(13120),U=e.i(53296),O=e.i(57561),L=e.i(48539);e.s(["default",0,({productId:e,disabled:a=!1})=>{let{selectedLocale:s,setSelectedLocale:l,languageDialectList:i}=(0,O.default)(),{formatMessage:d}=(0,u.useIntl)(),{hasRole:o}=(0,c.default)(),{defaultLocale:p,shopInfo:f,loading:x}=(0,L.default)(),{translatedTexts:g}=(({productId:e})=>{let{customProperties:t}=(0,q.default)(),{data:a,loading:s,error:l}=(0,N.useQuery)(((e="")=>P.gql`
195
+ ${q.default}
196
+ `;var A=e.i(60195),D=e.i(83094),V=e.i(13120),E=e.i(53296),O=e.i(57561),U=e.i(48539);e.s(["default",0,({productId:e,disabled:a=!1})=>{let{selectedLocale:s,setSelectedLocale:l,languageDialectList:i}=(0,O.default)(),{formatMessage:n}=(0,o.useIntl)(),{hasRole:m}=(0,u.default)(),{defaultLocale:p,shopInfo:f,loading:x}=(0,U.default)(),{translatedTexts:h}=(({productId:e})=>{let{customProperties:t}=(0,T.default)(),{data:a,loading:s,error:l}=(0,P.useQuery)(((e="")=>M.gql`
197
197
  query TranslatedProductTexts($productId: ID!) {
198
198
  translatedProductTexts(productId: $productId) {
199
199
  ...ProductTextsFragment
200
200
  ${e}
201
201
  }
202
202
  }
203
- ${R.default}
204
- `)(t?.ProductTexts),{skip:!e,variables:{productId:e}});return{translatedTexts:a?.translatedProductTexts||[],loading:s,error:l}})({productId:e}),v=d({id:"saved",defaultMessage:"Saved"}),{updateProductTexts:b}=(()=>{let[e]=(0,$.useMutation)(A);return{updateProductTexts:async({productId:t,texts:a})=>e({variables:{productId:t,texts:a},refetchQueries:["TranslatedProductTexts"]})}})(),I=async({slug:t,title:a,subtitle:l,vendor:i,description:d,brand:r,labels:n})=>(await b({productId:e,texts:[{locale:s,slug:t,title:a,subtitle:l,vendor:i,description:d,brand:r,labels:n}]}),{success:!0}),M=(0,w.default)({disabled:a,submit:I,successMessage:v,initialValues:{slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[]}});return(0,t.useEffect)(()=>{let e=g?.find(e=>e.locale===s);M.api.setValues({slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[],...e||{}})},[g,s]),(0,t.useEffect)(()=>{if(f&&g?.length&&!g?.find(({locale:e})=>e===s))if(p&&g?.find(({locale:e})=>e===p))l(p);else if(p&&g?.find(({locale:e})=>e===p.split("-")[0]))l(p.split("-")[0]);else{let e=g?.find(({locale:e})=>e&&i?.find(({isoCode:t})=>t===e));l(e?.locale)}},[x,g]),(0,r.jsx)(V.default,{documentationLabel:d({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(u.FormattedMessage,{id:"product_text_form_description",defaultMessage:"<ul> <li><strong>Slug:</strong> The unique part of your product URL (e.g., 'my-awesome-product'). Keep it short and descriptive.</li>\n <li><strong>Localization:</strong> Switch languages using the dropdown at the top left to translate content for different markets.</li>\n <li><strong>Description:</strong> Supports Markdown and HTML formatting. Use double backslash (\\\\\\\\) for line breaks.</li>\n <li><strong>Labels:</strong> Eye-catching badges that appear on your product (e.g., 'New Arrival', '50% Off', 'Limited Edition'). Perfect for promotions and highlighting special features. Each language can have unique labels.</li>\n <li><strong>Key Difference:</strong> Labels are customer-facing promotional badges, while Tags are internal keywords for organization and filtering.</li>\n </ul>",values:{ul:e=>(0,r.jsxs)("ul",{className:"space-y-2",children:[e," "]}),li:e=>(0,r.jsxs)("li",{className:"text-sm",children:[e," "]},Math.random()),strong:e=>(0,r.jsx)("strong",{className:"font-semibold text-text-secondary",children:e})}}),children:(0,r.jsx)(m.default,{children:(0,r.jsxs)(h.default,{form:M,disabled:!o(n.IRoleAction.ManageProducts),children:[(0,r.jsxs)("div",{className:"relative text-text-muted px-4 py-5 sm:p-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-6 gap-6",children:[(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(j.default,{name:"slug",disabled:!o(n.IRoleAction.ManageProducts),required:!0,id:"slug",label:d({id:"slug",defaultMessage:"Slug"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(j.default,{name:"title",disabled:!o(n.IRoleAction.ManageProducts),required:!0,id:"title",label:d({id:"title",defaultMessage:"Title"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(j.default,{name:"subtitle",disabled:!o(n.IRoleAction.ManageProducts),id:"subtitle",label:d({id:"subtitle",defaultMessage:"Subtitle"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(j.default,{name:"vendor",disabled:!o(n.IRoleAction.ManageProducts),id:"vendor",label:d({id:"vendor",defaultMessage:"Vendor"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(j.default,{name:"brand",disabled:!o(n.IRoleAction.ManageProducts),id:"brand",label:d({id:"brand",defaultMessage:"Brand"}),autoComplete:"on",className:"text-sm"})}),(0,r.jsxs)("div",{className:"col-span-6 sm:col-span-3",children:[(0,r.jsx)(E.default,{name:"labels",id:"labels",disabled:!o(n.IRoleAction.ManageProducts),label:d({id:"labels",defaultMessage:"Labels"}),placeholder:d({id:"label",defaultMessage:"Label"}),buttonText:d({id:"add",defaultMessage:"Add"}),autoComplete:"on",className:"text-sm"}),(0,r.jsx)(U.default,{messageKey:"product_labels_help",defaultMessage:"Add promotional badges like 'New Arrival', '50% Off', or 'Limited Edition' that customers will see on your product. Perfect for highlighting deals and special features.",className:"mt-3"})]})]}),(0,r.jsx)("div",{className:"col-span-6 mt-6 sm:col-span-3",children:(0,r.jsx)(D.default,{name:"description",id:"description",disabled:!o(n.IRoleAction.ManageProducts),label:d({id:"description",defaultMessage:"Description"})})})]}),o(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"border-t-slate-100 border-t border-t-border-subtle bg-surface-subtle px-4 py-5 text-right sm:px-6",children:(0,r.jsx)(y.default,{label:d({id:"save",defaultMessage:"Save"})})})]})})})}],10785);var F=e.i(28401),Q=e.i(59295),B=e.i(6277),z=e.i(33006),K=e.i(93994),H=e.i(64479);let Z=P.gql`
203
+ ${q.default}
204
+ `)(t?.ProductTexts),{skip:!e,variables:{productId:e}});return{translatedTexts:a?.translatedProductTexts||[],loading:s,error:l}})({productId:e}),v=n({id:"saved",defaultMessage:"Saved"}),{updateProductTexts:j}=(()=>{let[e]=(0,k.useMutation)(R);return{updateProductTexts:async({productId:t,texts:a})=>e({variables:{productId:t,texts:a},refetchQueries:["TranslatedProductTexts"]})}})(),w=async({slug:t,title:a,subtitle:l,vendor:i,description:d,brand:r,labels:n})=>(await j({productId:e,texts:[{locale:s,slug:t,title:a,subtitle:l,vendor:i,description:d,brand:r,labels:n}]}),{success:!0}),N=(0,I.default)({disabled:a,submit:w,successMessage:v,initialValues:{slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[]}});return(0,t.useEffect)(()=>{let e=h?.find(e=>e.locale===s);N.api.setValues({slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[],...e||{}})},[h,s]),(0,t.useEffect)(()=>{if(f&&h?.length&&!h?.find(({locale:e})=>e===s))if(p&&h?.find(({locale:e})=>e===p))l(p);else if(p&&h?.find(({locale:e})=>e===p.split("-")[0]))l(p.split("-")[0]);else{let e=h?.find(({locale:e})=>e&&i?.find(({isoCode:t})=>t===e));l(e?.locale)}},[x,h]),(0,d.jsx)(A.default,{documentationLabel:n({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,d.jsx)(o.FormattedMessage,{id:"product_text_form_description",defaultMessage:"<ul> <li><strong>Slug:</strong> The unique part of your product URL (e.g., 'my-awesome-product'). Keep it short and descriptive.</li>\n <li><strong>Localization:</strong> Switch languages using the dropdown at the top left to translate content for different markets.</li>\n <li><strong>Description:</strong> Supports Markdown and HTML formatting. Use double backslash (\\\\\\\\) for line breaks.</li>\n <li><strong>Labels:</strong> Eye-catching badges that appear on your product (e.g., 'New Arrival', '50% Off', 'Limited Edition'). Perfect for promotions and highlighting special features. Each language can have unique labels.</li>\n <li><strong>Key Difference:</strong> Labels are customer-facing promotional badges, while Tags are internal keywords for organization and filtering.</li>\n </ul>",values:{ul:e=>(0,d.jsxs)("ul",{className:"space-y-2",children:[e," "]}),li:e=>(0,d.jsxs)("li",{className:"text-sm",children:[e," "]},Math.random()),strong:e=>(0,d.jsx)("strong",{className:"font-semibold text-text-secondary",children:e})}}),children:(0,d.jsx)(c.default,{children:(0,d.jsxs)(g.default,{form:N,disabled:!m(r.IRoleAction.ManageProducts),children:[(0,d.jsxs)("div",{className:"relative text-text-muted px-4 py-5 sm:p-6",children:[(0,d.jsxs)("div",{className:"grid grid-cols-6 gap-6",children:[(0,d.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,d.jsx)(y.default,{name:"slug",disabled:!m(r.IRoleAction.ManageProducts),required:!0,id:"slug",label:n({id:"slug",defaultMessage:"Slug"}),autoComplete:"on",className:"text-sm"})}),(0,d.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,d.jsx)(y.default,{name:"title",disabled:!m(r.IRoleAction.ManageProducts),required:!0,id:"title",label:n({id:"title",defaultMessage:"Title"}),autoComplete:"on",className:"text-sm"})}),(0,d.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,d.jsx)(y.default,{name:"subtitle",disabled:!m(r.IRoleAction.ManageProducts),id:"subtitle",label:n({id:"subtitle",defaultMessage:"Subtitle"}),autoComplete:"on",className:"text-sm"})}),(0,d.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,d.jsx)(y.default,{name:"vendor",disabled:!m(r.IRoleAction.ManageProducts),id:"vendor",label:n({id:"vendor",defaultMessage:"Vendor"}),autoComplete:"on",className:"text-sm"})}),(0,d.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,d.jsx)(y.default,{name:"brand",disabled:!m(r.IRoleAction.ManageProducts),id:"brand",label:n({id:"brand",defaultMessage:"Brand"}),autoComplete:"on",className:"text-sm"})}),(0,d.jsxs)("div",{className:"col-span-6 sm:col-span-3",children:[(0,d.jsx)(V.default,{name:"labels",id:"labels",disabled:!m(r.IRoleAction.ManageProducts),label:n({id:"labels",defaultMessage:"Labels"}),placeholder:n({id:"label",defaultMessage:"Label"}),buttonText:n({id:"add",defaultMessage:"Add"}),autoComplete:"on",className:"text-sm"}),(0,d.jsx)(E.default,{messageKey:"product_labels_help",defaultMessage:"Add promotional badges like 'New Arrival', '50% Off', or 'Limited Edition' that customers will see on your product. Perfect for highlighting deals and special features.",className:"mt-3"})]})]}),(0,d.jsx)("div",{className:"col-span-6 mt-6 sm:col-span-3",children:(0,d.jsx)(D.default,{name:"description",id:"description",disabled:!m(r.IRoleAction.ManageProducts),label:n({id:"description",defaultMessage:"Description"})})})]}),m(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"border-t-slate-100 border-t border-t-border-subtle bg-surface-subtle px-4 py-5 text-right sm:px-6",children:(0,d.jsx)(b.default,{label:n({id:"save",defaultMessage:"Save"})})})]})})})}],10785);var L=e.i(28401),F=e.i(59295),Q=e.i(6277),B=e.i(33006),z=e.i(93994),K=e.i(64479);let H=M.gql`
205
205
  mutation PrepareProductMediaUpload($mediaName: String!, $productId: ID!) {
206
206
  prepareProductMediaUpload(mediaName: $mediaName, productId: $productId) {
207
207
  _id
@@ -209,7 +209,7 @@
209
209
  expires
210
210
  }
211
211
  }
212
- `;var W=e.i(1880);let G=P.gql`
212
+ `;var W=e.i(1880);let Z=M.gql`
213
213
  fragment ProductMediaFragment on ProductMedia {
214
214
  _id
215
215
  tags
@@ -228,7 +228,7 @@
228
228
  subtitle
229
229
  }
230
230
  }
231
- `,X=P.gql`
231
+ `,G=M.gql`
232
232
  query ProductMedia($productId: ID, $slug: String) {
233
233
  product(productId: $productId, slug: $slug) {
234
234
  _id
@@ -237,22 +237,22 @@
237
237
  }
238
238
  }
239
239
  }
240
- ${G}
241
- `;var J=e.i(2194),Y=e.i(90062);let ee=P.gql`
240
+ ${Z}
241
+ `;var X=e.i(2194),J=e.i(90062);let Y=M.gql`
242
242
  fragment ProductMediaTextsFragment on ProductMediaTexts {
243
243
  _id
244
244
  locale
245
245
  title
246
246
  subtitle
247
247
  }
248
- `,et=P.gql`
248
+ `,ee=M.gql`
249
249
  query TranslatedProductMediaTexts($productMediaId: ID!) {
250
250
  translatedProductMediaTexts(productMediaId: $productMediaId) {
251
251
  ...ProductMediaTextsFragment
252
252
  }
253
253
  }
254
- ${ee}
255
- `,ea=P.gql`
254
+ ${Y}
255
+ `,et=M.gql`
256
256
  mutation UpdateProductMediaTexts(
257
257
  $productMediaId: ID!
258
258
  $texts: [ProductMediaTextInput!]!
@@ -261,20 +261,20 @@
261
261
  ...ProductMediaTextsFragment
262
262
  }
263
263
  }
264
- ${ee}
265
- `;var es=e.i(15971);let el=P.gql`
264
+ ${Y}
265
+ `;var ea=e.i(15971);let es=M.gql`
266
266
  mutation RemoveProductMedia($productMediaId: ID!) {
267
267
  removeProductMedia(productMediaId: $productMediaId) {
268
268
  _id
269
269
  }
270
270
  }
271
- `;var ei=e.i(6607);let ed=({media:e,id:a})=>{let{setModal:s}=(0,ei.default)(),{removeProductMedia:l}=(()=>{let[e]=(0,$.useMutation)(el);return{removeProductMedia:async({productMediaId:t})=>e({variables:{productMediaId:t},refetchQueries:["ProductMedia"]})}})(),{formatMessage:i}=(0,u.useIntl)(),{selectedLocale:d}=(0,O.default)(),{updateProductMediaTexts:o}=(()=>{let[e]=(0,$.useMutation)(ea);return{updateProductMediaTexts:async({productMediaId:t,texts:a})=>e({variables:{productMediaId:t,texts:a},refetchQueries:["TranslatedProductMediaTexts"]})}})(),[m,p]=(0,t.useState)(!1),{hasRole:f}=(0,c.default)(),{translatedMediaTexts:x}=(({productMediaId:e})=>{let{data:t,loading:a,error:s}=(0,N.useQuery)(et,{skip:!e,variables:{productMediaId:e}});return{translatedMediaTexts:t?.translatedProductMediaTexts||[],loading:a,error:s}})({productMediaId:e._id}),g=x?.find(e=>e.locale===d)||{},h=async e=>{await s((0,r.jsx)(es.default,{onCancelClick:async()=>s(""),message:i({id:"delete_product_media_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this media? "}),onOkClick:async()=>{s(""),await l({productMediaId:e}),F.toast.success(i({id:"product_media_deleted",defaultMessage:"Media deleted successfully"}))},okText:i({id:"delete_product_media",defaultMessage:"Delete media"})}))},v=async({title:t,subtitle:a})=>(await o({productMediaId:e._id,texts:[{title:t,locale:d,subtitle:a}]}),p(!1),!0);return(0,r.jsx)(Y.default,{id:a,media:e,mediaText:g,isEdit:m,onDelete:f(n.IRoleAction.ManageProducts)?h:void 0,onEdit:f(n.IRoleAction.ManageProducts)?p:void 0,onUpdate:f(n.IRoleAction.ManageProducts)?v:void 0})},er=({medias:e,items:t})=>{let{formatMessage:a}=(0,u.useIntl)();return(0,r.jsx)("div",{className:"rounded-md lg:col-span-6 px-6",children:(0,r.jsxs)("div",{className:"mx-auto overflow-hidden",children:[(0,r.jsx)("h2",{className:"sr-only",children:a({id:"product_media",defaultMessage:"Product Media"})}),(0,r.jsx)("div",{className:"flow-root",children:(0,r.jsx)(B.SortableContext,{items:t,strategy:B.verticalListSortingStrategy,children:(0,r.jsx)("ul",{className:"flex flex-col gap-3 rounded-md transition-[background-color] ease-in-out delay-200 ",children:e?.length?t.map(t=>{let a=Object.values(e).find(e=>e._id===t);return(0,r.jsx)(ed,{id:t,media:a},a._id)}):(0,r.jsx)(J.default,{message:a({id:"media",defaultMessage:"Media"})})})})})]})})},en=P.gql`
271
+ `;var el=e.i(6607);let ei=({media:e,id:a})=>{let{setModal:s}=(0,el.default)(),{removeProductMedia:l}=(()=>{let[e]=(0,k.useMutation)(es);return{removeProductMedia:async({productMediaId:t})=>e({variables:{productMediaId:t},refetchQueries:["ProductMedia"]})}})(),{formatMessage:i}=(0,o.useIntl)(),{selectedLocale:n}=(0,O.default)(),{updateProductMediaTexts:c}=(()=>{let[e]=(0,k.useMutation)(et);return{updateProductMediaTexts:async({productMediaId:t,texts:a})=>e({variables:{productMediaId:t,texts:a},refetchQueries:["TranslatedProductMediaTexts"]})}})(),[m,p]=(0,t.useState)(!1),{hasRole:f}=(0,u.default)(),{translatedMediaTexts:x}=(({productMediaId:e})=>{let{data:t,loading:a,error:s}=(0,P.useQuery)(ee,{skip:!e,variables:{productMediaId:e}});return{translatedMediaTexts:t?.translatedProductMediaTexts||[],loading:a,error:s}})({productMediaId:e._id}),g=x?.find(e=>e.locale===n)||{},h=async e=>{await s((0,d.jsx)(ea.default,{onCancelClick:async()=>s(""),message:i({id:"delete_product_media_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this media? "}),onOkClick:async()=>{s(""),await l({productMediaId:e}),L.toast.success(i({id:"product_media_deleted",defaultMessage:"Media deleted successfully"}))},okText:i({id:"delete_product_media",defaultMessage:"Delete media"})}))},v=async({title:t,subtitle:a})=>(await c({productMediaId:e._id,texts:[{title:t,locale:n,subtitle:a}]}),p(!1),!0);return(0,d.jsx)(J.default,{id:a,media:e,mediaText:g,isEdit:m,onDelete:f(r.IRoleAction.ManageProducts)?h:void 0,onEdit:f(r.IRoleAction.ManageProducts)?p:void 0,onUpdate:f(r.IRoleAction.ManageProducts)?v:void 0})},ed=({medias:e,items:t})=>{let{formatMessage:a}=(0,o.useIntl)();return(0,d.jsx)("div",{className:"rounded-md lg:col-span-6 px-6",children:(0,d.jsxs)("div",{className:"mx-auto overflow-hidden",children:[(0,d.jsx)("h2",{className:"sr-only",children:a({id:"product_media",defaultMessage:"Product Media"})}),(0,d.jsx)("div",{className:"flow-root",children:(0,d.jsx)(Q.SortableContext,{items:t,strategy:Q.verticalListSortingStrategy,children:(0,d.jsx)("ul",{className:"flex flex-col gap-3 rounded-md transition-[background-color] ease-in-out delay-200 ",children:e?.length?t.map(t=>{let a=Object.values(e).find(e=>e._id===t);return(0,d.jsx)(ei,{id:t,media:a},a._id)}):(0,d.jsx)(X.default,{message:a({id:"media",defaultMessage:"Media"})})})})})]})})},er=M.gql`
272
272
  mutation ReOrderProductMedia($sortKeys: [ReorderProductMediaInput!]!) {
273
273
  reorderProductMedia(sortKeys: $sortKeys) {
274
274
  _id
275
275
  }
276
276
  }
277
- `;e.s(["default",0,({productId:e})=>{let{productMedia:t}=(({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,N.useQuery)(X,{skip:!e&&!a,variables:{productId:e||a}});return{productMedia:s?.product?.media||[],loading:l,error:i}})({productId:e}),{formatMessage:a}=(0,u.useIntl)(),{hasRole:s}=(0,c.default)(),{addProductMedia:l}=(()=>{let[e]=(0,$.useMutation)(Z),{confirmMediaUpload:t}=(0,H.default)({refetchQueries:["Product"]});return{addProductMedia:async({productId:a,media:s})=>{let{data:l}=await e({variables:{productId:a,mediaName:s.name}}),{prepareProductMediaUpload:i}=l;return await (0,K.default)(s,i.putURL),t({mediaUploadTicketId:i._id,size:s?.size,type:s.type})}}})(),{reOrderProductMedia:i}=(()=>{let[e]=(0,$.useMutation)(en);return{reOrderProductMedia:async({sortKeys:t})=>e({variables:{sortKeys:t},refetchQueries:["ProductMedia"]})}})(),d=t?.map(e=>e._id),o=async t=>{try{await l({productId:e,media:t}),F.toast.success(a({id:"product_media_upload",defaultMessage:"Media uploaded successfully"}))}catch(e){F.toast.error(a({id:"fail_upload",defaultMessage:"Media upload failed"}))}},m=async e=>{let{active:t,over:s}=e;if(t.id!==s.id){let e=d.indexOf(t.id),l=d.indexOf(s.id),r=(0,B.arrayMove)(d,e,l).map((e,t)=>({productMediaId:e,sortKey:t}));try{await i({sortKeys:r}),F.toast.success(a({id:"link_reorder",defaultMessage:"Link reorder successfully"}))}catch(e){F.toast.error(a({id:"fail_reorder",defaultMessage:"Reordering failed, Try again!"}))}}else F.toast.info(a({id:"reorder_original",defaultMessage:"Reorder to original location"}))},p=(0,Q.useSensors)((0,Q.useSensor)(Q.PointerSensor,{activationConstraint:{distance:5}}),(0,Q.useSensor)(Q.KeyboardSensor,{coordinateGetter:B.sortableKeyboardCoordinates}));return(0,r.jsxs)("div",{className:"mx-auto mt-5 space-y-5 lg:space-y-0 max-w-full py-6 lg:grid lg:grid-cols-12 lg:gap-4",children:[s(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"mx-auto w-full px-6 lg:col-span-6 lg:col-start-1",children:(0,r.jsx)(z.default,{onlyDragAndDrop:!0,addMedia:o})}),(0,r.jsx)(Q.DndContext,{sensors:p,collisionDetection:Q.closestCenter,onDragEnd:m,children:(0,r.jsx)(er,{medias:t,items:d})})]})}],1330);let eo=P.gql`
277
+ `;e.s(["default",0,({productId:e})=>{let{productMedia:t}=(({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,P.useQuery)(G,{skip:!e&&!a,variables:{productId:e||a}});return{productMedia:s?.product?.media||[],loading:l,error:i}})({productId:e}),{formatMessage:a}=(0,o.useIntl)(),{hasRole:s}=(0,u.default)(),{addProductMedia:l}=(()=>{let[e]=(0,k.useMutation)(H),{confirmMediaUpload:t}=(0,K.default)({refetchQueries:["Product"]});return{addProductMedia:async({productId:a,media:s})=>{let{data:l}=await e({variables:{productId:a,mediaName:s.name}}),{prepareProductMediaUpload:i}=l;return await (0,z.default)(s,i.putURL),t({mediaUploadTicketId:i._id,size:s?.size,type:s.type})}}})(),{reOrderProductMedia:i}=(()=>{let[e]=(0,k.useMutation)(er);return{reOrderProductMedia:async({sortKeys:t})=>e({variables:{sortKeys:t},refetchQueries:["ProductMedia"]})}})(),n=t?.map(e=>e._id),c=async t=>{try{await l({productId:e,media:t}),L.toast.success(a({id:"product_media_upload",defaultMessage:"Media uploaded successfully"}))}catch(e){L.toast.error(a({id:"fail_upload",defaultMessage:"Media upload failed"}))}},m=async e=>{let{active:t,over:s}=e;if(t.id!==s.id){let e=n.indexOf(t.id),l=n.indexOf(s.id),d=(0,Q.arrayMove)(n,e,l).map((e,t)=>({productMediaId:e,sortKey:t}));try{await i({sortKeys:d}),L.toast.success(a({id:"link_reorder",defaultMessage:"Link reorder successfully"}))}catch(e){L.toast.error(a({id:"fail_reorder",defaultMessage:"Reordering failed, Try again!"}))}}else L.toast.info(a({id:"reorder_original",defaultMessage:"Reorder to original location"}))},p=(0,F.useSensors)((0,F.useSensor)(F.PointerSensor,{activationConstraint:{distance:5}}),(0,F.useSensor)(F.KeyboardSensor,{coordinateGetter:Q.sortableKeyboardCoordinates}));return(0,d.jsxs)("div",{className:"mx-auto mt-5 space-y-5 lg:space-y-0 max-w-full py-6 lg:grid lg:grid-cols-12 lg:gap-4",children:[s(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"mx-auto w-full px-6 lg:col-span-6 lg:col-start-1",children:(0,d.jsx)(B.default,{onlyDragAndDrop:!0,addMedia:c})}),(0,d.jsx)(F.DndContext,{sensors:p,collisionDetection:F.closestCenter,onDragEnd:m,children:(0,d.jsx)(ed,{medias:t,items:n})})]})}],1330);let en=M.gql`
278
278
  fragment ProductPlanConfigurationFragment on ProductPlanConfiguration {
279
279
  usageCalculationType
280
280
  billingInterval
@@ -282,7 +282,7 @@
282
282
  trialIntervalCount
283
283
  billingIntervalCount
284
284
  }
285
- `,eu=P.gql`
285
+ `,eo=M.gql`
286
286
  query ProductPlan($productId: ID, $slug: String) {
287
287
  product(productId: $productId, slug: $slug) {
288
288
  _id
@@ -293,8 +293,8 @@
293
293
  }
294
294
  }
295
295
  }
296
- ${eo}
297
- `,ec=P.gql`
296
+ ${en}
297
+ `,eu=M.gql`
298
298
  query ProductPlanConfigurationOptions {
299
299
  usageCalculationTypes: __type(name: "ProductPlanUsageCalculationType") {
300
300
  options: enumValues {
@@ -309,13 +309,13 @@
309
309
  }
310
310
  }
311
311
  }
312
- `,em=P.gql`
312
+ `,ec=M.gql`
313
313
  mutation UpdateProductPlan($productId: ID!, $plan: UpdateProductPlanInput!) {
314
314
  updateProductPlan(productId: $productId, plan: $plan) {
315
315
  _id
316
316
  }
317
317
  }
318
- `;e.s(["default",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,u.useIntl)(),{configurationIntervals:l,usageCalculationTypes:i}=(()=>{let{data:e,loading:t,error:a}=(0,N.useQuery)(ec),s=e?.usageCalculationTypes?.options||[];return{configurationIntervals:e?.configurationIntervals?.options||[],usageCalculationTypes:s,loading:t,error:a}})(),{plan:d,loading:o}=(({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,N.useQuery)(eu,{skip:!e&&!a,variables:{productId:e||a}}),d=s?.product;return{plan:d?.plan,loading:l,error:i}})({productId:e}),{hasRole:f}=(0,c.default)(),{updateProductPlan:x}=(()=>{let[e]=(0,$.useMutation)(em);return{updateProductPlan:async({productId:t,plan:{usageCalculationType:a,billingInterval:s,billingIntervalCount:l=null,trialInterval:i=null,trialIntervalCount:d=null}})=>e({variables:{productId:t,plan:{usageCalculationType:a,billingInterval:s,billingIntervalCount:l,trialInterval:i,trialIntervalCount:d}},refetchQueries:["Products"]})}})(),g=s({id:"enrollment_updated_successfully",defaultMessage:"Enrollment saved successfully"}),v=async({trialInterval:t,trialIntervalCount:a,billingInterval:s,billingIntervalCount:l,usageCalculationType:i})=>(await x({productId:e,plan:{billingInterval:s,usageCalculationType:i,billingIntervalCount:l,trialInterval:t,trialIntervalCount:a}}),{success:!0}),I=(0,w.default)({disabled:a,submit:v,successMessage:g,initialValues:{trialInterval:"",trialIntervalCount:"",billingInterval:"",billingIntervalCount:"",usageCalculationType:""},getSubmitErrorMessage:e=>e?.message?.includes("Status of the product does not allow this operation")?s({id:"subscription_product_type_not_valid",defaultMessage:"Status of the product does not allow this operation"}):e?.message||""});return(0,t.useEffect)(()=>{d&&!o&&I.api.setValues(d)},[d]),(0,r.jsx)(V.default,{documentationLabel:s({id:"subscription",defaultMessage:"Subscription"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(u.FormattedMessage,{id:"product_subscription_form_description",defaultMessage:"<ul><li> Information that will be used to calculate price of a subscription based product </li>\n <li>The price specified in commerce section will be used when calculating fees on each interval. </li>\n <li>Price will not be included for the specified trial period </li> </ul>",values:{ul:e=>(0,r.jsxs)("ul",{className:"space-y-1",children:[e," "]}),li:e=>(0,r.jsx)("li",{children:e})}}),children:(0,r.jsx)(m.default,{children:(0,r.jsx)(h.default,{form:I,children:(0,r.jsxs)("div",{className:"relative max-w-full space-y-6 rounded-md sm:p-6",children:[(0,r.jsx)(b.default,{required:!0,className:"mt-2.5 w-full py-1.5 text-sm font-medium text-slate-500",label:s({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),placeholder:s({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),name:"usageCalculationType",options:(0,p.default)(i,"value","value")}),(0,r.jsxs)("div",{className:"w-full items-end justify-end sm:flex",children:[(0,r.jsx)(b.default,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",required:!0,label:s({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),placeholder:s({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),name:"billingInterval",options:(0,p.default)(l,"value","value")}),(0,r.jsx)(j.default,{name:"billingIntervalCount",id:"billing_unit",type:"number",required:!0,label:s({id:"billing_unit",defaultMessage:"Billing Unit"}),placeholder:s({id:"billing_unit",defaultMessage:"Billing Unit"}),className:"mt-1 w-full text-sm font-medium text-slate-500 sm:ml-1"})]}),(0,r.jsxs)("div",{className:"max-w-full items-end justify-end sm:flex",children:[(0,r.jsx)(b.default,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",label:s({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),placeholder:s({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),name:"trialInterval",options:(0,p.default)(l,"value","value")}),(0,r.jsx)(j.default,{type:"number",name:"trialIntervalCount",id:"trialIntervalCount ",label:s({id:"trial_unit",defaultMessage:"Trial Unit"}),placeholder:s({id:"trial_unit",defaultMessage:"Trial Unit"}),required:!0,className:"mt-1 w-full text-sm font-medium text-slate-500 sm:ml-1"})]}),f(n.IRoleAction.CreateEnrollment)&&(0,r.jsx)("div",{className:"-mx-6 -mb-6 mt-6 border-t-slate-100 border-t space-y-6 bg-slate-50 dark:bg-slate-500 text-right sm:p-6",children:(0,r.jsx)(y.default,{label:s({id:"save",defaultMessage:"Save"})})})]})})})})}],73356);var ep=e.i(60959);let ef=P.gql`
318
+ `;e.s(["default",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,o.useIntl)(),{configurationIntervals:l,usageCalculationTypes:i}=(()=>{let{data:e,loading:t,error:a}=(0,P.useQuery)(eu),s=e?.usageCalculationTypes?.options||[];return{configurationIntervals:e?.configurationIntervals?.options||[],usageCalculationTypes:s,loading:t,error:a}})(),{plan:n,loading:p}=(({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,P.useQuery)(eo,{skip:!e&&!a,variables:{productId:e||a}}),d=s?.product;return{plan:d?.plan,loading:l,error:i}})({productId:e}),{hasRole:f}=(0,u.default)(),{updateProductPlan:x}=(()=>{let[e]=(0,k.useMutation)(ec);return{updateProductPlan:async({productId:t,plan:{usageCalculationType:a,billingInterval:s,billingIntervalCount:l=null,trialInterval:i=null,trialIntervalCount:d=null}})=>e({variables:{productId:t,plan:{usageCalculationType:a,billingInterval:s,billingIntervalCount:l,trialInterval:i,trialIntervalCount:d}},refetchQueries:["Products"]})}})(),h=s({id:"enrollment_updated_successfully",defaultMessage:"Enrollment saved successfully"}),j=async({trialInterval:t,trialIntervalCount:a,billingInterval:s,billingIntervalCount:l,usageCalculationType:i})=>(await x({productId:e,plan:{billingInterval:s,usageCalculationType:i,billingIntervalCount:l,trialInterval:t,trialIntervalCount:a}}),{success:!0}),w=(0,I.default)({disabled:a,submit:j,successMessage:h,initialValues:{trialInterval:"",trialIntervalCount:"",billingInterval:"",billingIntervalCount:"",usageCalculationType:""},getSubmitErrorMessage:e=>e?.message?.includes("Status of the product does not allow this operation")?s({id:"subscription_product_type_not_valid",defaultMessage:"Status of the product does not allow this operation"}):e?.message||""});return(0,t.useEffect)(()=>{n&&!p&&w.api.setValues(n)},[n]),(0,d.jsx)(A.default,{documentationLabel:s({id:"subscription",defaultMessage:"Subscription"}),className:"mt-2 lg:mt-5",documentation:(0,d.jsx)(o.FormattedMessage,{id:"product_subscription_form_description",defaultMessage:"<ul><li> Information that will be used to calculate price of a subscription based product </li>\n <li>The price specified in commerce section will be used when calculating fees on each interval. </li>\n <li>Price will not be included for the specified trial period </li> </ul>",values:{ul:e=>(0,d.jsxs)("ul",{className:"space-y-1",children:[e," "]}),li:e=>(0,d.jsx)("li",{children:e})}}),children:(0,d.jsx)(c.default,{children:(0,d.jsx)(g.default,{form:w,children:(0,d.jsxs)("div",{className:"relative max-w-full space-y-6 rounded-md sm:p-6",children:[(0,d.jsx)(v.default,{required:!0,className:"mt-2.5 w-full py-1.5 text-sm font-medium text-slate-500",label:s({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),placeholder:s({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),name:"usageCalculationType",options:(0,m.default)(i,"value","value")}),(0,d.jsxs)("div",{className:"w-full items-end justify-end sm:flex",children:[(0,d.jsx)(v.default,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",required:!0,label:s({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),placeholder:s({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),name:"billingInterval",options:(0,m.default)(l,"value","value")}),(0,d.jsx)(y.default,{name:"billingIntervalCount",id:"billing_unit",type:"number",required:!0,label:s({id:"billing_unit",defaultMessage:"Billing Unit"}),placeholder:s({id:"billing_unit",defaultMessage:"Billing Unit"}),className:"mt-1 w-full text-sm font-medium text-slate-500 sm:ml-1"})]}),(0,d.jsxs)("div",{className:"max-w-full items-end justify-end sm:flex",children:[(0,d.jsx)(v.default,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",label:s({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),placeholder:s({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),name:"trialInterval",options:(0,m.default)(l,"value","value")}),(0,d.jsx)(y.default,{type:"number",name:"trialIntervalCount",id:"trialIntervalCount ",label:s({id:"trial_unit",defaultMessage:"Trial Unit"}),placeholder:s({id:"trial_unit",defaultMessage:"Trial Unit"}),required:!0,className:"mt-1 w-full text-sm font-medium text-slate-500 sm:ml-1"})]}),f(r.IRoleAction.CreateEnrollment)&&(0,d.jsx)("div",{className:"-mx-6 -mb-6 mt-6 border-t-slate-100 border-t space-y-6 bg-slate-50 dark:bg-slate-500 text-right sm:p-6",children:(0,d.jsx)(b.default,{label:s({id:"save",defaultMessage:"Save"})})})]})})})})}],73356);var em=e.i(60959);let ep=M.gql`
319
319
  query ProductSupply($productId: ID, $slug: String) {
320
320
  product(productId: $productId, slug: $slug) {
321
321
  _id
@@ -326,8 +326,8 @@
326
326
  }
327
327
  }
328
328
  }
329
- ${ep.default}
330
- `,ex=P.gql`
329
+ ${em.default}
330
+ `,ef=M.gql`
331
331
  mutation UpdateProductSupply(
332
332
  $productId: ID!
333
333
  $supply: UpdateProductSupplyInput!
@@ -341,8 +341,8 @@
341
341
  }
342
342
  }
343
343
  }
344
- ${ep.default}
345
- `;e.s(["default",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,u.useIntl)(),l=s({id:"saved",defaultMessage:"Saved"}),{hasRole:i}=(0,c.default)(),{updateProductSupply:d}=(()=>{let[e]=(0,$.useMutation)(ex);return{updateProductSupply:async({productId:t,supply:{weightInGram:a=null,heightInMillimeters:s=null,lengthInMillimeters:l=null,widthInMillimeters:i=null}})=>e({variables:{productId:t,supply:{weightInGram:a||null,heightInMillimeters:s||null,lengthInMillimeters:l||null,widthInMillimeters:i||null}},refetchQueries:["Products"]})}})(),{dimensions:o}=(({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,N.useQuery)(ef,{skip:!e&&!t,variables:{productId:e||a}}),d=s?.product;return{dimensions:d?.dimensions||{},loading:l,error:i}})({productId:e}),p=async({weight:t,length:a,width:s,height:l})=>(await d({productId:e,supply:{weightInGram:t,lengthInMillimeters:a,heightInMillimeters:l,widthInMillimeters:s}}),{success:!0}),f=(0,w.default)({disabled:a,submit:p,getSubmitErrorMessage:e=>(e.message.includes("supply.weightInGram")&&e.message.includes("Expected type Int")?f.api.setFieldError("weight","Invalid value, only integer is accepted"):e.message.includes("supply.heightInMillimeters")&&e.message.includes("Expected type Int")?f.api.setFieldError("height","Invalid value, only integer is accepted"):e.message.includes("supply.lengthInMillimeters")&&e.message.includes("Expected type Int")&&f.api.setFieldError("length","Invalid value, only integer is accepted"),null),successMessage:l,initialValues:{weight:"",length:"",width:"",height:""}});return(0,t.useEffect)(()=>{Object.keys(o).length&&f.api.setValues(o)},[o]),(0,r.jsx)("div",{className:"mt-5 md:col-span-2 md:mt-0",children:(0,r.jsx)(m.default,{children:(0,r.jsxs)(h.default,{form:f,disabled:!i(n.IRoleAction.ManageProducts),children:[(0,r.jsx)("div",{className:"relative px-4 py-5 sm:p-6",children:(0,r.jsxs)("div",{className:"grid grid-cols-6 gap-6",children:[(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(j.default,{validators:[(0,M.validateInteger)()],type:"number",name:"weight",disabled:!i(n.IRoleAction.ManageProducts),id:"weight",label:s({id:"weight_gram",defaultMessage:"Weight (Gram)"}),className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(j.default,{validators:[(0,M.validateInteger)()],name:"length",disabled:!i(n.IRoleAction.ManageProducts),id:"length",type:"number",label:s({id:"length_millimeter",defaultMessage:"Length (Millimeter)"}),className:"text-sm"})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(j.default,{validators:[(0,M.validateInteger)()],type:"number",name:"width",disabled:!i(n.IRoleAction.ManageProducts),id:"width ",label:s({id:"width",defaultMessage:"Width (Millimeter)"}),className:"text-sm "})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(j.default,{validators:[(0,M.validateInteger)()],name:"height",disabled:!i(n.IRoleAction.ManageProducts),type:"number",id:"height",label:s({id:"height",defaultMessage:"Height (Millimeter)"}),className:"text-sm "})})]})}),i(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"border-t-slate-100 border-t border-t-border-subtle space-y-6 bg-surface-subtle text-right sm:p-6",children:(0,r.jsx)(y.default,{label:s({id:"save",defaultMessage:"Save"}),full:!0})})]})})})}],50099);var eg=e.i(37369),eh=e.i(53576);let ev=P.gql`
344
+ ${em.default}
345
+ `;e.s(["default",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,o.useIntl)(),l=s({id:"saved",defaultMessage:"Saved"}),{hasRole:i}=(0,u.default)(),{updateProductSupply:n}=(()=>{let[e]=(0,k.useMutation)(ef);return{updateProductSupply:async({productId:t,supply:{weightInGram:a=null,heightInMillimeters:s=null,lengthInMillimeters:l=null,widthInMillimeters:i=null}})=>e({variables:{productId:t,supply:{weightInGram:a||null,heightInMillimeters:s||null,lengthInMillimeters:l||null,widthInMillimeters:i||null}},refetchQueries:["Products"]})}})(),{dimensions:m}=(({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,P.useQuery)(ep,{skip:!e&&!t,variables:{productId:e||a}}),d=s?.product;return{dimensions:d?.dimensions||{},loading:l,error:i}})({productId:e}),p=async({weight:t,length:a,width:s,height:l})=>(await n({productId:e,supply:{weightInGram:t,lengthInMillimeters:a,heightInMillimeters:l,widthInMillimeters:s}}),{success:!0}),f=(0,I.default)({disabled:a,submit:p,getSubmitErrorMessage:e=>(e.message.includes("supply.weightInGram")&&e.message.includes("Expected type Int")?f.api.setFieldError("weight","Invalid value, only integer is accepted"):e.message.includes("supply.heightInMillimeters")&&e.message.includes("Expected type Int")?f.api.setFieldError("height","Invalid value, only integer is accepted"):e.message.includes("supply.lengthInMillimeters")&&e.message.includes("Expected type Int")&&f.api.setFieldError("length","Invalid value, only integer is accepted"),null),successMessage:l,initialValues:{weight:"",length:"",width:"",height:""}});return(0,t.useEffect)(()=>{Object.keys(m).length&&f.api.setValues(m)},[m]),(0,d.jsx)("div",{className:"mt-5 md:col-span-2 md:mt-0",children:(0,d.jsx)(c.default,{children:(0,d.jsxs)(g.default,{form:f,disabled:!i(r.IRoleAction.ManageProducts),children:[(0,d.jsx)("div",{className:"relative px-4 py-5 sm:p-6",children:(0,d.jsxs)("div",{className:"grid grid-cols-6 gap-6",children:[(0,d.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,d.jsx)(y.default,{validators:[(0,w.validateInteger)()],type:"number",name:"weight",disabled:!i(r.IRoleAction.ManageProducts),id:"weight",label:s({id:"weight_gram",defaultMessage:"Weight (Gram)"}),className:"text-sm"})}),(0,d.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,d.jsx)(y.default,{validators:[(0,w.validateInteger)()],name:"length",disabled:!i(r.IRoleAction.ManageProducts),id:"length",type:"number",label:s({id:"length_millimeter",defaultMessage:"Length (Millimeter)"}),className:"text-sm"})}),(0,d.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,d.jsx)(y.default,{validators:[(0,w.validateInteger)()],type:"number",name:"width",disabled:!i(r.IRoleAction.ManageProducts),id:"width ",label:s({id:"width",defaultMessage:"Width (Millimeter)"}),className:"text-sm "})}),(0,d.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,d.jsx)(y.default,{validators:[(0,w.validateInteger)()],name:"height",disabled:!i(r.IRoleAction.ManageProducts),type:"number",id:"height",label:s({id:"height",defaultMessage:"Height (Millimeter)"}),className:"text-sm "})})]})}),i(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"border-t-slate-100 border-t border-t-border-subtle space-y-6 bg-surface-subtle text-right sm:p-6",children:(0,d.jsx)(b.default,{label:s({id:"save",defaultMessage:"Save"}),full:!0})})]})})})}],50099);var ex=e.i(37369),eg=e.i(53576);let eh=M.gql`
346
346
  mutation CreateProductVariation(
347
347
  $productId: ID!
348
348
  $variation: CreateProductVariationInput!
@@ -356,7 +356,7 @@
356
356
  _id
357
357
  }
358
358
  }
359
- `,eb=P.gql`
359
+ `,ev=M.gql`
360
360
  fragment ProductVariationFragment on ProductVariation {
361
361
  _id
362
362
  type
@@ -378,7 +378,7 @@
378
378
  value
379
379
  }
380
380
  }
381
- `,ey=P.gql`
381
+ `,eb=M.gql`
382
382
  query ProductVariations($productId: ID, $slug: String, $locale: Locale) {
383
383
  product(productId: $productId, slug: $slug) {
384
384
  _id
@@ -389,8 +389,8 @@
389
389
  }
390
390
  }
391
391
  }
392
- ${eb}
393
- `,ej=P.gql`
392
+ ${ev}
393
+ `,ey=M.gql`
394
394
  query ProductVariationType {
395
395
  variationTypes: __type(name: "ProductVariationType") {
396
396
  options: enumValues {
@@ -399,13 +399,13 @@
399
399
  }
400
400
  }
401
401
  }
402
- `,eI=({helpKey:e,helpText:t,helpValues:a,...s})=>(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(j.default,{...s}),(e||t)&&(0,r.jsx)(U.default,{messageKey:e||`${s.name}_help`,defaultMessage:t,values:a,className:"mt-1"})]});var ew=e.i(95789);let eM=P.gql`
402
+ `,ej=({helpKey:e,helpText:t,helpValues:a,...s})=>(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)(y.default,{...s}),(e||t)&&(0,d.jsx)(E.default,{messageKey:e||`${s.name}_help`,defaultMessage:t,values:a,className:"mt-1"})]});var eI=e.i(95789);let ew=M.gql`
403
403
  mutation RemoveProductVariation($productVariationId: ID!) {
404
404
  removeProductVariation(productVariationId: $productVariationId) {
405
405
  _id
406
406
  }
407
407
  }
408
- `;var eP=e.i(42469);let eN=P.gql`
408
+ `;var eM=e.i(42469);let eP=M.gql`
409
409
  mutation UpdateProductVariationTexts(
410
410
  $productVariationId: ID!
411
411
  $productVariationOptionValue: String
@@ -419,7 +419,7 @@
419
419
  _id
420
420
  }
421
421
  }
422
- `,e_=()=>{let[e]=(0,$.useMutation)(eN);return{updateProductVariationTexts:async({productVariationId:t,productVariationOptionValue:a,texts:s})=>e({variables:{productVariationId:t,productVariationOptionValue:a,texts:s},refetchQueries:["ProductVariations"]})}},ek=({variation:e,onCancel:t,onSuccess:a})=>{let{updateProductVariationTexts:s}=e_(),{formatMessage:l}=(0,u.useIntl)(),{selectedLocale:i}=(0,O.default)(),d=async({title:t,subtitle:l})=>(await s({productVariationId:e._id,texts:[{title:t,subtitle:l,locale:i}]}),a(),{success:!0}),n=(0,w.default)({submit:d,initialValues:{title:e?.texts?.title??"",subtitle:e?.texts?.subtitle??""}});return(0,r.jsx)(h.default,{form:n,className:"variation-update-form bg-surface px-4 py-3 border-b border-border-subtle w-full overflow-x-hidden overflow-y-visible relative hover:outline hover:outline-2 hover:outline-slate-400 dark:hover:outline-slate-500 transition-all","data-variationid":e._id,children:(0,r.jsxs)("div",{className:"flex items-center justify-between w-full gap-4",tabIndex:-1,children:[(0,r.jsxs)("div",{className:"flex items-center gap-4 flex-1 min-w-0 overflow-hidden flex-wrap",children:[(0,r.jsx)("div",{className:"flex-shrink-0 min-w-[180px]",children:(0,r.jsx)(j.default,{className:"mt-0 py-1",name:"title",required:!0,label:l({id:"title",defaultMessage:"Title"})})}),e?.type&&(0,r.jsx)(eP.default,{text:e.type,color:"slate",className:"rounded-md uppercase text-xs font-medium flex-shrink-0"}),(0,r.jsx)("div",{className:"text-sm text-text-muted truncate min-w-[200px]",children:(0,r.jsx)(j.default,{className:"mt-0 py-1",name:"subtitle",label:l({id:"subtitle",defaultMessage:"Subtitle"})})}),e?.options?.length>0&&(0,r.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:e.options.map((e,t)=>(0,r.jsx)("span",{className:"inline-flex text-nowrap items-center px-2 py-0.5 rounded-lg text-xs font-medium bg-slate-100 dark:bg-slate-900 text-text-secondary border border-border-subtle",children:e?.texts?.title||e.value},e.value||t))}),(0,r.jsxs)("div",{className:"text-sm text-text-muted font-mono flex-shrink-0",children:["(",e?.key,")"]})]}),(0,r.jsxs)("div",{className:"flex space-x-2 flex-shrink-0",children:[(0,r.jsx)(I.default,{onClick:t,type:"button",variant:"secondary",size:"sm",text:l({id:"cancel",defaultMessage:"Cancel"})}),(0,r.jsx)(I.default,{onClick:()=>n.api.submitForm(),type:"submit",variant:"primary",size:"sm",text:l({id:"save",defaultMessage:"Save"})})]})]})})};var e$=e.i(86712),eC=e.i(64481),eS=e.i(37650),eT=e.i(24557);let eq=({type:e,variation:a,onEdit:s,onDelete:l})=>{let[i,d]=(0,t.useState)(!1),{formatMessage:n}=(0,u.useIntl)(),{buttonRef:o,menuRef:c,menuPosition:m}=((e,a)=>{let s=(0,t.useRef)(null),l=(0,t.useRef)(null),[i,d]=(0,t.useState)({top:0,left:0});return(0,t.useEffect)(()=>{let e=e=>{s.current&&!s.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a]),(0,t.useEffect)(()=>{if(e&&l.current){let e=l.current.getBoundingClientRect(),t=e.bottom+4,a=e.right-192;a<8&&(a=8),t+80>window.innerHeight-8&&(t=e.top-80-4),d({top:t,left:a})}},[e]),{buttonRef:l,menuRef:s,menuPosition:i}})(i,d);return(0,r.jsx)("div",{className:"variation-display bg-surface px-4 py-3 border-b border-border-subtle w-full overflow-x-hidden overflow-y-visible relative hover:outline hover:outline-2 hover:outline-slate-400 dark:hover:outline-slate-500 transition-all",children:(0,r.jsxs)("div",{className:"flex items-center justify-between w-full gap-4",tabIndex:-1,children:[(0,r.jsxs)("div",{className:"flex items-center gap-4 flex-1 min-w-0 overflow-hidden",children:[(0,r.jsx)("div",{className:"flex-shrink-0 text-lg font-semibold text-text-primary truncate",children:a?.texts?.title}),e&&(0,r.jsx)(eP.default,{text:e,color:"slate",className:"rounded-md uppercase text-xs font-medium flex-shrink-0"}),a?.texts?.subtitle&&(0,r.jsx)("div",{className:"text-sm text-text-muted truncate",children:a?.texts?.subtitle}),a?.options?.length>0&&(0,r.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:a.options.map((e,t)=>(0,r.jsx)("span",{className:"inline-flex text-nowrap items-center px-2 py-0.5 rounded-lg text-xs font-medium bg-slate-100 dark:bg-slate-900 text-text-secondary border border-border-subtle",children:e?.texts?.title||e.value},e.value||t))}),(0,r.jsxs)("div",{className:"text-sm text-text-muted font-mono flex-shrink-0",children:["(",a?.key,")"]})]}),(0,r.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,r.jsx)("button",{ref:o,type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),d(e=>!e)},className:"flex items-center justify-center w-8 h-8 rounded-md hover:bg-surface-raised transition-colors",children:(0,r.jsx)(e$.EllipsisHorizontalIcon,{className:"w-5 h-5 text-text-muted"})}),i&&(0,r.jsx)(eC.default,{children:(0,r.jsx)("div",{ref:c,className:"fixed w-48 bg-surface rounded-md shadow-xl border border-border-subtle z-[9999]",style:{top:m.top,left:m.left,boxShadow:"0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},children:(0,r.jsxs)("div",{className:"py-1",children:[(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),s(),d(!1)},className:"flex items-center w-full px-4 py-2 text-sm text-text-secondary hover:bg-surface-raised transition-colors",children:[(0,r.jsx)(eS.PencilSquareIcon,{className:"mr-3 h-5 w-5"}),n({id:"edit",defaultMessage:"Edit"})]}),(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),l(a._id),d(!1)},className:"flex items-center w-full px-4 py-2 text-sm text-danger hover:bg-rose-50 dark:hover:bg-rose-900/20 transition-colors",children:[(0,r.jsx)(eT.TrashIcon,{className:"mr-3 h-5 w-5"}),n({id:"delete",defaultMessage:"Delete"})]})]})})})]})]})})},eR=({type:e,variation:a,onDelete:s})=>{let[l,i]=(0,t.useState)(!1);return l?(0,r.jsx)(ek,{variation:a,onCancel:()=>i(!1),onSuccess:()=>i(!1)}):(0,r.jsx)(eq,{type:e,variation:a,onEdit:()=>i(!0),onDelete:s})},eA=P.gql`
422
+ `,eN=()=>{let[e]=(0,k.useMutation)(eP);return{updateProductVariationTexts:async({productVariationId:t,productVariationOptionValue:a,texts:s})=>e({variables:{productVariationId:t,productVariationOptionValue:a,texts:s},refetchQueries:["ProductVariations"]})}},e_=({variation:e,onCancel:t,onSuccess:a})=>{let{updateProductVariationTexts:s}=eN(),{formatMessage:l}=(0,o.useIntl)(),{selectedLocale:i}=(0,O.default)(),r=async({title:t,subtitle:l})=>(await s({productVariationId:e._id,texts:[{title:t,subtitle:l,locale:i}]}),a(),{success:!0}),n=(0,I.default)({submit:r,initialValues:{title:e?.texts?.title??"",subtitle:e?.texts?.subtitle??""}});return(0,d.jsx)(g.default,{form:n,className:"variation-update-form bg-surface px-4 py-3 border-b border-border-subtle w-full overflow-x-hidden overflow-y-visible relative hover:outline hover:outline-2 hover:outline-slate-400 dark:hover:outline-slate-500 transition-all","data-variationid":e._id,children:(0,d.jsxs)("div",{className:"flex items-center justify-between w-full gap-4",tabIndex:-1,children:[(0,d.jsxs)("div",{className:"flex items-center gap-4 flex-1 min-w-0 overflow-hidden flex-wrap",children:[(0,d.jsx)("div",{className:"flex-shrink-0 min-w-[180px]",children:(0,d.jsx)(y.default,{className:"mt-0 py-1",name:"title",required:!0,label:l({id:"title",defaultMessage:"Title"})})}),e?.type&&(0,d.jsx)(eM.default,{text:e.type,color:"slate",className:"rounded-md uppercase text-xs font-medium flex-shrink-0"}),(0,d.jsx)("div",{className:"text-sm text-text-muted truncate min-w-[200px]",children:(0,d.jsx)(y.default,{className:"mt-0 py-1",name:"subtitle",label:l({id:"subtitle",defaultMessage:"Subtitle"})})}),e?.options?.length>0&&(0,d.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:e.options.map((e,t)=>(0,d.jsx)("span",{className:"inline-flex text-nowrap items-center px-2 py-0.5 rounded-lg text-xs font-medium bg-slate-100 dark:bg-slate-900 text-text-secondary border border-border-subtle",children:e?.texts?.title||e.value},e.value||t))}),(0,d.jsxs)("div",{className:"text-sm text-text-muted font-mono flex-shrink-0",children:["(",e?.key,")"]})]}),(0,d.jsxs)("div",{className:"flex space-x-2 flex-shrink-0",children:[(0,d.jsx)(j.default,{onClick:t,type:"button",variant:"secondary",size:"sm",text:l({id:"cancel",defaultMessage:"Cancel"})}),(0,d.jsx)(j.default,{onClick:()=>n.api.submitForm(),type:"submit",variant:"primary",size:"sm",text:l({id:"save",defaultMessage:"Save"})})]})]})})};var ek=e.i(86712),e$=e.i(64481),eC=e.i(37650),eS=e.i(24557);let eT=({type:e,variation:a,onEdit:s,onDelete:l})=>{let[i,r]=(0,t.useState)(!1),{formatMessage:n}=(0,o.useIntl)(),{buttonRef:u,menuRef:c,menuPosition:m}=((e,a)=>{let s=(0,t.useRef)(null),l=(0,t.useRef)(null),[i,d]=(0,t.useState)({top:0,left:0});return(0,t.useEffect)(()=>{let e=e=>{s.current&&!s.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a]),(0,t.useEffect)(()=>{if(e&&l.current){let e=l.current.getBoundingClientRect(),t=e.bottom+4,a=e.right-192;a<8&&(a=8),t+80>window.innerHeight-8&&(t=e.top-80-4),d({top:t,left:a})}},[e]),{buttonRef:l,menuRef:s,menuPosition:i}})(i,r);return(0,d.jsx)("div",{className:"variation-display bg-surface px-4 py-3 border-b border-border-subtle w-full overflow-x-hidden overflow-y-visible relative hover:outline hover:outline-2 hover:outline-slate-400 dark:hover:outline-slate-500 transition-all",children:(0,d.jsxs)("div",{className:"flex items-center justify-between w-full gap-4",tabIndex:-1,children:[(0,d.jsxs)("div",{className:"flex items-center gap-4 flex-1 min-w-0 overflow-hidden",children:[(0,d.jsx)("div",{className:"flex-shrink-0 text-lg font-semibold text-text-primary truncate",children:a?.texts?.title}),e&&(0,d.jsx)(eM.default,{text:e,color:"slate",className:"rounded-md uppercase text-xs font-medium flex-shrink-0"}),a?.texts?.subtitle&&(0,d.jsx)("div",{className:"text-sm text-text-muted truncate",children:a?.texts?.subtitle}),a?.options?.length>0&&(0,d.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:a.options.map((e,t)=>(0,d.jsx)("span",{className:"inline-flex text-nowrap items-center px-2 py-0.5 rounded-lg text-xs font-medium bg-slate-100 dark:bg-slate-900 text-text-secondary border border-border-subtle",children:e?.texts?.title||e.value},e.value||t))}),(0,d.jsxs)("div",{className:"text-sm text-text-muted font-mono flex-shrink-0",children:["(",a?.key,")"]})]}),(0,d.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,d.jsx)("button",{ref:u,type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),r(e=>!e)},className:"flex items-center justify-center w-8 h-8 rounded-md hover:bg-surface-raised transition-colors",children:(0,d.jsx)(ek.EllipsisHorizontalIcon,{className:"w-5 h-5 text-text-muted"})}),i&&(0,d.jsx)(e$.default,{children:(0,d.jsx)("div",{ref:c,className:"fixed w-48 bg-surface rounded-md shadow-xl border border-border-subtle z-[9999]",style:{top:m.top,left:m.left,boxShadow:"0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},children:(0,d.jsxs)("div",{className:"py-1",children:[(0,d.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),s(),r(!1)},className:"flex items-center w-full px-4 py-2 text-sm text-text-secondary hover:bg-surface-raised transition-colors",children:[(0,d.jsx)(eC.PencilSquareIcon,{className:"mr-3 h-5 w-5"}),n({id:"edit",defaultMessage:"Edit"})]}),(0,d.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),l(a._id),r(!1)},className:"flex items-center w-full px-4 py-2 text-sm text-danger hover:bg-rose-50 dark:hover:bg-rose-900/20 transition-colors",children:[(0,d.jsx)(eS.TrashIcon,{className:"mr-3 h-5 w-5"}),n({id:"delete",defaultMessage:"Delete"})]})]})})})]})]})})},eq=({type:e,variation:a,onDelete:s})=>{let[l,i]=(0,t.useState)(!1);return l?(0,d.jsx)(e_,{variation:a,onCancel:()=>i(!1),onSuccess:()=>i(!1)}):(0,d.jsx)(eT,{type:e,variation:a,onEdit:()=>i(!0),onDelete:s})},eR=M.gql`
423
423
  mutation CreateProductVariationOption(
424
424
  $productVariationId: ID!
425
425
  $option: String!
@@ -433,7 +433,7 @@
433
433
  _id
434
434
  }
435
435
  }
436
- `,eV=P.gql`
436
+ `,eA=M.gql`
437
437
  mutation RemoveProductVariationOption(
438
438
  $productVariationId: ID!
439
439
  $productVariationOptionValue: String!
@@ -445,7 +445,7 @@
445
445
  _id
446
446
  }
447
447
  }
448
- `,eD=({onSubmit:e})=>{let{formatMessage:t}=(0,u.useIntl)(),{hasRole:a}=(0,c.default)(),s=t({id:"variation_option_added",defaultMessage:"Variation option added successfully!"}),l=(0,w.default)({submit:e,successMessage:s,initialValues:{value:"",title:""}});return(0,r.jsxs)(h.default,{form:l,className:"variation-option-form relative overflow-visible",children:[(0,r.jsx)("div",{className:"mb-4 px-2 sm:px-4 pt-2",children:(0,r.jsx)("div",{className:"p-3 bg-surface-subtle/20 rounded-lg border border-border-subtle",children:(0,r.jsx)("p",{className:"text-sm text-text-secondary",children:t({id:"variation_options_explanation",defaultMessage:'Add individual choices for this variation (e.g., "Red", "Blue", "Green" for a Color variation)'})})})}),(0,r.jsxs)("div",{className:"grid lg:grid-cols-2 gap-3 px-2 sm:px-4 sm:pb-4",children:[(0,r.jsx)("div",{className:"col-span-1",children:(0,r.jsx)(eI,{className:"mt-2 pt-1",name:"title",label:t({id:"title",defaultMessage:"Title"}),helpText:t({id:"variation_option_title_help",defaultMessage:'Display name customers see (e.g., "Red", "Large", "Cotton")'}),required:!0})}),(0,r.jsx)("div",{className:"col-span-1",children:(0,r.jsx)(eI,{className:"mt-2 pt-1",name:"value",label:t({id:"value",defaultMessage:"Value"}),helpText:t({id:"variation_option_value_help",defaultMessage:'Internal identifier (e.g., "red", "large", "cotton")'}),required:!0})})]}),a(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"text-right mt-2 px-6 pb-6",children:(0,r.jsx)(y.default,{className:"py-2.5",label:t({id:"add_variation_option",defaultMessage:"Add option"})})})]})};var eE=e.i(3095);let eU=({option:e,onDelete:a,variationId:s})=>{let{formatMessage:l}=(0,u.useIntl)(),{selectedLocale:i}=(0,O.default)(),[d,n]=(0,t.useState)(!1),o=l({id:"variation_option_updated",defaultMessage:"Variation option updated successfully!"}),{updateProductVariationTexts:c}=e_(),m=async({title:t,subtitle:a})=>{let l=await c({productVariationId:s,productVariationOptionValue:e.value,texts:[{title:t,subtitle:a,locale:i}]});return n(!1),{data:l,success:!0}},p=(0,w.default)({submit:m,successMessage:o,initialValues:{title:e?.texts?.title,subtitle:e?.texts?.subtitle}});return(0,r.jsx)(h.default,{form:p,className:"last:pb-2 variation-option-update-form relative overflow-visible",children:(0,r.jsx)("div",{className:"my-2 rounded-sm border dark:border-slate-700 mx-4 ",children:(0,r.jsx)("div",{className:"p-2 bg-surface-input dark:text-slate-200",children:(0,r.jsxs)("div",{className:"flex gap-2 w-full items-center justify-between",children:[(0,r.jsx)(eP.default,{text:e?.value,color:"slate",className:"rounded-md"}),(0,r.jsxs)("div",{className:"flex items-center gap-4 w-full",children:[(0,r.jsx)("p",{className:"truncate text-sm font-medium text-slate-900 dark:text-slate-400",children:d?(0,r.jsx)(j.default,{className:"mt-0",name:"title",required:!0,label:l({id:"title",defaultMessage:"Title"})}):e?.texts?.title}),(0,r.jsx)("p",{className:"truncate text-sm text-slate-500",children:d?(0,r.jsx)(j.default,{className:"mt-0",name:"subtitle",label:l({id:"subtitle",defaultMessage:"Subtitle"})}):e?.texts?.subtitle})]}),(0,r.jsx)("div",{className:"flex items-center justify-end ml-auto",children:d?(0,r.jsxs)("div",{className:"flex space-x-2 py-2",children:[(0,r.jsx)("button",{onClick:()=>n(!d),"aria-label":l({id:"cancel",defaultMessage:"Cancel"}),type:"button",className:"inline-flex items-center justify-center font-medium shadow-sm focus:outline-hidden focus:ring-2 focus:ring-offset-2 transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50 px-3 py-2 text-sm h-8 rounded-md border border-border-default bg-surface text-text-secondary hover:bg-surface-raised focus:ring-focus-ring",children:l({id:"cancel",defaultMessage:"Cancel"})}),(0,r.jsx)("button",{type:"submit","aria-label":l({id:"save",defaultMessage:"Save"}),className:"inline-flex items-center justify-center font-medium shadow-sm focus:outline-hidden focus:ring-2 focus:ring-offset-2 transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50 px-3 py-2 text-sm h-8 rounded-md border border-accent bg-accent text-text-on-accent hover:bg-accent-hover focus:ring-focus-ring",children:l({id:"save",defaultMessage:"Save"})})]}):(0,r.jsx)(eE.default,{onEdit:()=>{n(!0)},onDelete:()=>{a(e.value)},showEdit:!0,showDelete:!0})})]})})})})},eO=({variationId:e,options:t})=>{let{createProductVariationOption:a}=(()=>{let[e]=(0,$.useMutation)(eA);return{createProductVariationOption:async({productVariationId:t,option:a,texts:s})=>e({variables:{productVariationId:t,option:a,texts:s},refetchQueries:["ProductVariations","Product"]})}})(),{formatMessage:s}=(0,u.useIntl)(),{selectedLocale:l}=(0,O.default)(),{setModal:i}=(0,ei.default)(),{removeProductVariationOption:d}=(()=>{let[e]=(0,$.useMutation)(eV);return{removeProductVariationOption:async({productVariationId:t,productVariationOptionValue:a})=>e({variables:{productVariationId:t,productVariationOptionValue:a},refetchQueries:["ProductVariations"]})}})(),n=async t=>{await i((0,r.jsx)(es.default,{message:s({id:"delete_variation_option_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this option? "}),onCancelClick:()=>i(""),onOkClick:async()=>{i(""),await d({productVariationId:e,productVariationOptionValue:t}),F.toast.success(s({id:"product_variation_option_deleted",defaultMessage:"Variation option deleted successfully"}))},okText:s({id:"delete_variation_option",defaultMessage:"Delete option"})}))},o=async({value:t,title:s})=>(await a({productVariationId:e,option:t,texts:[{title:s,locale:l}]}),{success:!0});return(0,r.jsxs)("div",{className:"relative overflow-visible",children:[(0,r.jsx)(eD,{onSubmit:o}),t.length?t.map(t=>(0,r.jsx)(eU,{variationId:e,option:t,onDelete:n},t._id)):(0,r.jsx)(J.default,{message:s({id:"option",defaultMessage:"Option"})})]})},eL=({productVariationId:e,variation:t})=>{let{formatMessage:a}=(0,u.useIntl)(),{setModal:s}=(0,ei.default)(),{options:l}=t,{removeProductVariation:i}=(()=>{let[e]=(0,$.useMutation)(eM);return{removeProductVariation:async({productVariationId:t})=>e({variables:{productVariationId:t},refetchQueries:["ProductVariations"]})}})(),d=async()=>{await s((0,r.jsx)(es.default,{onCancelClick:async()=>s(""),message:a({id:"delete_product_variation_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this variation? "}),onOkClick:async()=>{s(""),await i({productVariationId:e}),F.toast.success(a({id:"product_variation_deleted",defaultMessage:"Variation deleted successfully"}))},okText:a({id:"delete_product_variation",defaultMessage:"Delete variation"})}))},n=[{header:(0,r.jsx)(eR,{onDelete:d,variation:t,...t}),body:(0,r.jsx)(eO,{variationId:t._id,options:l},e)}];return(0,r.jsx)(ew.default,{"data-variationid":t._id,data:n,containerCSS:"w-full max-w-full !my-0 !border-0 !shadow-none relative",bodyCSS:"bg-surface-subtle !border-t-0 relative overflow-visible",itemContainerCSS:"!mt-0 !mb-0 !border-0",headerCSS:"w-full flex items-center justify-between !p-0 !bg-transparent !border-0",hideChevron:!0})},eF=({onSubmit:e,disabled:t,formatMessage:a})=>{let{variationTypes:s}=(()=>{let{data:e,loading:t,error:a}=(0,N.useQuery)(ej);return{variationTypes:e?.variationTypes?.options||[],loading:t,error:a}})(),{hasRole:l}=(0,c.default)(),i=a({id:"product_variation_added",defaultMessage:"Product variation added successfully"}),d=(0,w.default)({disabled:t,submit:e,successMessage:i,initialValues:{title:"",key:"",type:""}});return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-2",children:a({id:"product_variations_explanation_title",defaultMessage:"About Product Variations"})}),(0,r.jsx)("p",{className:"text-sm text-text-secondary",children:a({id:"product_variations_explanation",defaultMessage:"Variations allow customers to choose different options for your product (like color, size, material). Each variation can have multiple options that customers can select from."})})]}),(0,r.jsxs)(h.default,{form:d,children:[(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(eI,{name:"title",id:"title",label:a({id:"title",defaultMessage:"Title"}),helpText:a({id:"product_variation_title_help",defaultMessage:'The display name customers will see (e.g., "Color", "Size", "Material")'}),required:!0,autoComplete:"on",className:"w-full"}),(0,r.jsx)(eI,{name:"key",id:"key",label:a({id:"key",defaultMessage:"Key"}),helpText:a({id:"product_variation_key_help",defaultMessage:'Unique identifier used internally (e.g., "color", "size"). Use lowercase without spaces.'}),required:!0,autoComplete:"on",className:"w-full"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(b.default,{required:!0,className:"w-full",label:a({id:"type",defaultMessage:"Type"}),placeholder:a({id:"type",defaultMessage:"Type"}),name:"type",options:(0,p.default)(s,"value","value")}),(0,r.jsx)(U.default,{messageKey:"product_variation_type_help",defaultMessage:"COLOR: For predefined options like colors or sizes. TEXT: For free-form input like custom text or measurements.",className:"mt-1"})]})]}),l(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"flex justify-end mt-6 py-6 -mb-6 bg-slate-100 -mx-6 pe-5 border-t border-border-subtle bg-surface-subtle",children:(0,r.jsx)(y.default,{label:a({id:"add_variation",defaultMessage:"Add variation"})})})]})]})};e.s(["default",0,({productId:e,disabled:t=!1})=>{let{createProductVariation:a}=(()=>{let[e]=(0,$.useMutation)(ev);return{createProductVariation:async({productId:t,variation:{key:a,type:s},texts:l})=>e({variables:{productId:t,variation:{key:a,type:s},texts:l},refetchQueries:["ProductVariations"]})}})(),{selectedLocale:s}=(0,O.default)(),{formatMessage:l}=(0,u.useIntl)(),{setModal:i}=(0,ei.default)(),{variations:d,loading:n}=(({productId:e=null,slug:t=null,locale:a=null}={})=>{let s=(0,W.parseUniqueId)(t),{data:l,loading:i,error:d}=(0,N.useQuery)(ey,{skip:!e&&!s,variables:{productId:e||s,locale:a}}),r=l?.product;return{variations:r?.variations,loading:i,error:d}})({productId:e,locale:s}),o=async({title:t,key:l,type:d})=>(await a({productId:e,variation:{key:l,type:d},texts:[{title:t,locale:s}]}),i(""),{success:!0});return n?(0,r.jsx)(eh.default,{}):(0,r.jsxs)("div",{className:"mt-6 overflow-hidden rounded-md w-full max-w-full",children:[(0,r.jsx)("div",{className:"mb-6 flex justify-end items-center",children:(0,r.jsx)(I.default,{className:"m-1",onClick:()=>{i((0,r.jsx)(eF,{onSubmit:o,disabled:t,formatMessage:l}))},disabled:t,variant:"secondary",icon:(0,r.jsx)(eg.PlusIcon,{className:"w-5 h-5"}),text:l({id:"add_variation",defaultMessage:"Add variation"})})}),(0,r.jsx)("div",{className:"flex flex-col border border-border-subtle rounded-md overflow-x-hidden overflow-y-visible w-full relative",children:d?.length?d?.map(e=>(0,r.jsx)(eL,{productVariationId:e._id,variation:e},e._id)):(0,r.jsx)(J.default,{message:l({id:"variations",defaultMessage:"Variations"})})})]})}],77035);let eQ=P.gql`
448
+ `,eD=({onSubmit:e})=>{let{formatMessage:t}=(0,o.useIntl)(),{hasRole:a}=(0,u.default)(),s=t({id:"variation_option_added",defaultMessage:"Variation option added successfully!"}),l=(0,I.default)({submit:e,successMessage:s,initialValues:{value:"",title:""}});return(0,d.jsxs)(g.default,{form:l,className:"variation-option-form relative overflow-visible",children:[(0,d.jsx)("div",{className:"mb-4 px-2 sm:px-4 pt-2",children:(0,d.jsx)("div",{className:"p-3 bg-surface-subtle/20 rounded-lg border border-border-subtle",children:(0,d.jsx)("p",{className:"text-sm text-text-secondary",children:t({id:"variation_options_explanation",defaultMessage:'Add individual choices for this variation (e.g., "Red", "Blue", "Green" for a Color variation)'})})})}),(0,d.jsxs)("div",{className:"grid lg:grid-cols-2 gap-3 px-2 sm:px-4 sm:pb-4",children:[(0,d.jsx)("div",{className:"col-span-1",children:(0,d.jsx)(ej,{className:"mt-2 pt-1",name:"title",label:t({id:"title",defaultMessage:"Title"}),helpText:t({id:"variation_option_title_help",defaultMessage:'Display name customers see (e.g., "Red", "Large", "Cotton")'}),required:!0})}),(0,d.jsx)("div",{className:"col-span-1",children:(0,d.jsx)(ej,{className:"mt-2 pt-1",name:"value",label:t({id:"value",defaultMessage:"Value"}),helpText:t({id:"variation_option_value_help",defaultMessage:'Internal identifier (e.g., "red", "large", "cotton")'}),required:!0})})]}),a(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"text-right mt-2 px-6 pb-6",children:(0,d.jsx)(b.default,{className:"py-2.5",label:t({id:"add_variation_option",defaultMessage:"Add option"})})})]})};var eV=e.i(3095);let eE=({option:e,onDelete:a,variationId:s})=>{let{formatMessage:l}=(0,o.useIntl)(),{selectedLocale:i}=(0,O.default)(),[r,n]=(0,t.useState)(!1),u=l({id:"variation_option_updated",defaultMessage:"Variation option updated successfully!"}),{updateProductVariationTexts:c}=eN(),m=async({title:t,subtitle:a})=>{let l=await c({productVariationId:s,productVariationOptionValue:e.value,texts:[{title:t,subtitle:a,locale:i}]});return n(!1),{data:l,success:!0}},p=(0,I.default)({submit:m,successMessage:u,initialValues:{title:e?.texts?.title,subtitle:e?.texts?.subtitle}});return(0,d.jsx)(g.default,{form:p,className:"last:pb-2 variation-option-update-form relative overflow-visible",children:(0,d.jsx)("div",{className:"my-2 rounded-sm border dark:border-slate-700 mx-4 ",children:(0,d.jsx)("div",{className:"p-2 bg-surface-input dark:text-slate-200",children:(0,d.jsxs)("div",{className:"flex gap-2 w-full items-center justify-between",children:[(0,d.jsx)(eM.default,{text:e?.value,color:"slate",className:"rounded-md"}),(0,d.jsxs)("div",{className:"flex items-center gap-4 w-full",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-slate-900 dark:text-slate-400",children:r?(0,d.jsx)(y.default,{className:"mt-0",name:"title",required:!0,label:l({id:"title",defaultMessage:"Title"})}):e?.texts?.title}),(0,d.jsx)("p",{className:"truncate text-sm text-slate-500",children:r?(0,d.jsx)(y.default,{className:"mt-0",name:"subtitle",label:l({id:"subtitle",defaultMessage:"Subtitle"})}):e?.texts?.subtitle})]}),(0,d.jsx)("div",{className:"flex items-center justify-end ml-auto",children:r?(0,d.jsxs)("div",{className:"flex space-x-2 py-2",children:[(0,d.jsx)("button",{onClick:()=>n(!r),"aria-label":l({id:"cancel",defaultMessage:"Cancel"}),type:"button",className:"inline-flex items-center justify-center font-medium shadow-sm focus:outline-hidden focus:ring-2 focus:ring-offset-2 transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50 px-3 py-2 text-sm h-8 rounded-md border border-border-default bg-surface text-text-secondary hover:bg-surface-raised focus:ring-focus-ring",children:l({id:"cancel",defaultMessage:"Cancel"})}),(0,d.jsx)("button",{type:"submit","aria-label":l({id:"save",defaultMessage:"Save"}),className:"inline-flex items-center justify-center font-medium shadow-sm focus:outline-hidden focus:ring-2 focus:ring-offset-2 transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50 px-3 py-2 text-sm h-8 rounded-md border border-accent bg-accent text-text-on-accent hover:bg-accent-hover focus:ring-focus-ring",children:l({id:"save",defaultMessage:"Save"})})]}):(0,d.jsx)(eV.default,{onEdit:()=>{n(!0)},onDelete:()=>{a(e.value)},showEdit:!0,showDelete:!0})})]})})})})},eO=({variationId:e,options:t})=>{let{createProductVariationOption:a}=(()=>{let[e]=(0,k.useMutation)(eR);return{createProductVariationOption:async({productVariationId:t,option:a,texts:s})=>e({variables:{productVariationId:t,option:a,texts:s},refetchQueries:["ProductVariations","Product"]})}})(),{formatMessage:s}=(0,o.useIntl)(),{selectedLocale:l}=(0,O.default)(),{setModal:i}=(0,el.default)(),{removeProductVariationOption:r}=(()=>{let[e]=(0,k.useMutation)(eA);return{removeProductVariationOption:async({productVariationId:t,productVariationOptionValue:a})=>e({variables:{productVariationId:t,productVariationOptionValue:a},refetchQueries:["ProductVariations"]})}})(),n=async t=>{await i((0,d.jsx)(ea.default,{message:s({id:"delete_variation_option_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this option? "}),onCancelClick:()=>i(""),onOkClick:async()=>{i(""),await r({productVariationId:e,productVariationOptionValue:t}),L.toast.success(s({id:"product_variation_option_deleted",defaultMessage:"Variation option deleted successfully"}))},okText:s({id:"delete_variation_option",defaultMessage:"Delete option"})}))},u=async({value:t,title:s})=>(await a({productVariationId:e,option:t,texts:[{title:s,locale:l}]}),{success:!0});return(0,d.jsxs)("div",{className:"relative overflow-visible",children:[(0,d.jsx)(eD,{onSubmit:u}),t.length?t.map(t=>(0,d.jsx)(eE,{variationId:e,option:t,onDelete:n},t._id)):(0,d.jsx)(X.default,{message:s({id:"option",defaultMessage:"Option"})})]})},eU=({productVariationId:e,variation:t})=>{let{formatMessage:a}=(0,o.useIntl)(),{setModal:s}=(0,el.default)(),{options:l}=t,{removeProductVariation:i}=(()=>{let[e]=(0,k.useMutation)(ew);return{removeProductVariation:async({productVariationId:t})=>e({variables:{productVariationId:t},refetchQueries:["ProductVariations"]})}})(),r=async()=>{await s((0,d.jsx)(ea.default,{onCancelClick:async()=>s(""),message:a({id:"delete_product_variation_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this variation? "}),onOkClick:async()=>{s(""),await i({productVariationId:e}),L.toast.success(a({id:"product_variation_deleted",defaultMessage:"Variation deleted successfully"}))},okText:a({id:"delete_product_variation",defaultMessage:"Delete variation"})}))},n=[{header:(0,d.jsx)(eq,{onDelete:r,variation:t,...t}),body:(0,d.jsx)(eO,{variationId:t._id,options:l},e)}];return(0,d.jsx)(eI.default,{"data-variationid":t._id,data:n,containerCSS:"w-full max-w-full !my-0 !border-0 !shadow-none relative",bodyCSS:"bg-surface-subtle !border-t-0 relative overflow-visible",itemContainerCSS:"!mt-0 !mb-0 !border-0",headerCSS:"w-full flex items-center justify-between !p-0 !bg-transparent !border-0",hideChevron:!0})},eL=({onSubmit:e,disabled:t,formatMessage:a})=>{let{variationTypes:s}=(()=>{let{data:e,loading:t,error:a}=(0,P.useQuery)(ey);return{variationTypes:e?.variationTypes?.options||[],loading:t,error:a}})(),{hasRole:l}=(0,u.default)(),i=a({id:"product_variation_added",defaultMessage:"Product variation added successfully"}),n=(0,I.default)({disabled:t,submit:e,successMessage:i,initialValues:{title:"",key:"",type:""}});return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-6",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-2",children:a({id:"product_variations_explanation_title",defaultMessage:"About Product Variations"})}),(0,d.jsx)("p",{className:"text-sm text-text-secondary",children:a({id:"product_variations_explanation",defaultMessage:"Variations allow customers to choose different options for your product (like color, size, material). Each variation can have multiple options that customers can select from."})})]}),(0,d.jsxs)(g.default,{form:n,children:[(0,d.jsxs)("div",{className:"space-y-6",children:[(0,d.jsx)(ej,{name:"title",id:"title",label:a({id:"title",defaultMessage:"Title"}),helpText:a({id:"product_variation_title_help",defaultMessage:'The display name customers will see (e.g., "Color", "Size", "Material")'}),required:!0,autoComplete:"on",className:"w-full"}),(0,d.jsx)(ej,{name:"key",id:"key",label:a({id:"key",defaultMessage:"Key"}),helpText:a({id:"product_variation_key_help",defaultMessage:'Unique identifier used internally (e.g., "color", "size"). Use lowercase without spaces.'}),required:!0,autoComplete:"on",className:"w-full"}),(0,d.jsxs)("div",{children:[(0,d.jsx)(v.default,{required:!0,className:"w-full",label:a({id:"type",defaultMessage:"Type"}),placeholder:a({id:"type",defaultMessage:"Type"}),name:"type",options:(0,m.default)(s,"value","value")}),(0,d.jsx)(E.default,{messageKey:"product_variation_type_help",defaultMessage:"COLOR: For predefined options like colors or sizes. TEXT: For free-form input like custom text or measurements.",className:"mt-1"})]})]}),l(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"flex justify-end mt-6 py-6 -mb-6 bg-slate-100 -mx-6 pe-5 border-t border-border-subtle bg-surface-subtle",children:(0,d.jsx)(b.default,{label:a({id:"add_variation",defaultMessage:"Add variation"})})})]})]})};e.s(["default",0,({productId:e,disabled:t=!1})=>{let{createProductVariation:a}=(()=>{let[e]=(0,k.useMutation)(eh);return{createProductVariation:async({productId:t,variation:{key:a,type:s},texts:l})=>e({variables:{productId:t,variation:{key:a,type:s},texts:l},refetchQueries:["ProductVariations"]})}})(),{selectedLocale:s}=(0,O.default)(),{formatMessage:l}=(0,o.useIntl)(),{setModal:i}=(0,el.default)(),{variations:r,loading:n}=(({productId:e=null,slug:t=null,locale:a=null}={})=>{let s=(0,W.parseUniqueId)(t),{data:l,loading:i,error:d}=(0,P.useQuery)(eb,{skip:!e&&!s,variables:{productId:e||s,locale:a}}),r=l?.product;return{variations:r?.variations,loading:i,error:d}})({productId:e,locale:s}),u=async({title:t,key:l,type:d})=>(await a({productId:e,variation:{key:l,type:d},texts:[{title:t,locale:s}]}),i(""),{success:!0});return n?(0,d.jsx)(eg.default,{}):(0,d.jsxs)("div",{className:"mt-6 overflow-hidden rounded-md w-full max-w-full",children:[(0,d.jsx)("div",{className:"mb-6 flex justify-end items-center",children:(0,d.jsx)(j.default,{className:"m-1",onClick:()=>{i((0,d.jsx)(eL,{onSubmit:u,disabled:t,formatMessage:l}))},disabled:t,variant:"secondary",icon:(0,d.jsx)(ex.PlusIcon,{className:"w-5 h-5"}),text:l({id:"add_variation",defaultMessage:"Add variation"})})}),(0,d.jsx)("div",{className:"flex flex-col border border-border-subtle rounded-md overflow-x-hidden overflow-y-visible w-full relative",children:r?.length?r?.map(e=>(0,d.jsx)(eU,{productVariationId:e._id,variation:e},e._id)):(0,d.jsx)(X.default,{message:l({id:"variations",defaultMessage:"Variations"})})})]})}],77035);let eF=M.gql`
449
449
  query ProductWarehousing($productId: ID, $slug: String) {
450
450
  product(productId: $productId, slug: $slug) {
451
451
  _id
@@ -455,7 +455,7 @@
455
455
  }
456
456
  }
457
457
  }
458
- `,eB=P.gql`
458
+ `,eQ=M.gql`
459
459
  mutation UpdateProductWarehousing(
460
460
  $productId: ID!
461
461
  $warehousing: UpdateProductWarehousingInput!
@@ -468,7 +468,7 @@
468
468
  }
469
469
  }
470
470
  }
471
- `;e.s(["default",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,u.useIntl)(),{product:l}=(({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,N.useQuery)(eQ,{skip:!e&&!a,variables:{productId:e||a}});return{product:s?.product||{},loading:l,error:i}})({productId:e}),{hasRole:i}=(0,c.default)(),{updateProductWarehousing:d}=(()=>{let[e]=(0,$.useMutation)(eB);return{updateProductWarehousing:async({productId:t,warehousing:{sku:a=null,baseUnit:s=null}})=>e({variables:{productId:t,warehousing:{sku:a,baseUnit:s}},refetchQueries:["Products"]})}})(),o=s({id:"saved",defaultMessage:"Saved"}),p=async({sku:t,baseUnit:a})=>({data:await d({productId:e,warehousing:{baseUnit:a,sku:t}}),success:!0}),f=(0,w.default)({disabled:a,submit:p,successMessage:o,initialValues:{sku:"",baseUnit:""}});return(0,t.useEffect)(()=>{Object.keys(l).length&&f.api.setValues({...l})},[l]),(0,r.jsx)("div",{className:"mt-5 md:mt-0",children:(0,r.jsx)(m.default,{children:(0,r.jsxs)(h.default,{className:"rounded",form:f,disabled:!i(n.IRoleAction.ManageProducts),children:[(0,r.jsx)("div",{className:"relative px-4 pb-5 sm:p-6",children:(0,r.jsxs)("div",{className:"w-full justify-between align-baseline lg:flex gap-6",children:[(0,r.jsx)(j.default,{name:"sku",disabled:!i(n.IRoleAction.ManageProducts),id:"sku",label:s({id:"sku",defaultMessage:"SKU"}),className:"mb-4 text-sm"}),(0,r.jsx)(j.default,{name:"baseUnit",id:"baseUnit",disabled:!i(n.IRoleAction.ManageProducts),label:s({id:"baseUnit",defaultMessage:"Base Unit"}),className:"text-sm"})]})}),i(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"border-t-slate-100 border-t border-t-border-subtle space-y-6 bg-surface-subtle text-right sm:p-6",children:(0,r.jsx)(y.default,{label:s({id:"save",defaultMessage:"Save"})})})]})})})}],56902);var ez=e.i(56417),eK=e.i(27028),eH=e.i(3883),eZ=e.i(84818);let eW=P.gql`
471
+ `;e.s(["default",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,o.useIntl)(),{product:l}=(({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{data:s,loading:l,error:i}=(0,P.useQuery)(eF,{skip:!e&&!a,variables:{productId:e||a}});return{product:s?.product||{},loading:l,error:i}})({productId:e}),{hasRole:i}=(0,u.default)(),{updateProductWarehousing:n}=(()=>{let[e]=(0,k.useMutation)(eQ);return{updateProductWarehousing:async({productId:t,warehousing:{sku:a=null,baseUnit:s=null}})=>e({variables:{productId:t,warehousing:{sku:a,baseUnit:s}},refetchQueries:["Products"]})}})(),m=s({id:"saved",defaultMessage:"Saved"}),p=async({sku:t,baseUnit:a})=>({data:await n({productId:e,warehousing:{baseUnit:a,sku:t}}),success:!0}),f=(0,I.default)({disabled:a,submit:p,successMessage:m,initialValues:{sku:"",baseUnit:""}});return(0,t.useEffect)(()=>{Object.keys(l).length&&f.api.setValues({...l})},[l]),(0,d.jsx)("div",{className:"mt-5 md:mt-0",children:(0,d.jsx)(c.default,{children:(0,d.jsxs)(g.default,{className:"rounded",form:f,disabled:!i(r.IRoleAction.ManageProducts),children:[(0,d.jsx)("div",{className:"relative px-4 pb-5 sm:p-6",children:(0,d.jsxs)("div",{className:"w-full justify-between align-baseline lg:flex gap-6",children:[(0,d.jsx)(y.default,{name:"sku",disabled:!i(r.IRoleAction.ManageProducts),id:"sku",label:s({id:"sku",defaultMessage:"SKU"}),className:"mb-4 text-sm"}),(0,d.jsx)(y.default,{name:"baseUnit",id:"baseUnit",disabled:!i(r.IRoleAction.ManageProducts),label:s({id:"baseUnit",defaultMessage:"Base Unit"}),className:"text-sm"})]})}),i(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"border-t-slate-100 border-t border-t-border-subtle space-y-6 bg-surface-subtle text-right sm:p-6",children:(0,d.jsx)(b.default,{label:s({id:"save",defaultMessage:"Save"})})})]})})})}],56902);var eB=e.i(56417),ez=e.i(27028),eK=e.i(3883),eH=e.i(84818);let eW=M.gql`
472
472
  query ProductFulfillmentSimulation(
473
473
  $productId: ID
474
474
  $deliveryProviderType: DeliveryProviderType
@@ -530,7 +530,57 @@
530
530
  }
531
531
  }
532
532
  }
533
- `,eG=(e,t)=>e?.deliveryProvider?._id===t?.deliveryProvider?._id&&e?.warehousingProvider?._id===t?.warehousingProvider?._id,eX="w-full rounded-md border-1 border-border-default bg-surface-input px-3 py-2 text-sm shadow-xs text-text-primary focus:outline-hidden focus:ring-2 focus:ring-focus-ring",eJ=e=>[e?.interface?.label,e?.interface?.version].filter(Boolean).join(" ")||e?._id||null;e.s(["default",0,({productId:e})=>{let{formatMessage:a}=(0,u.useIntl)(),{formatDateTime:s}=(0,eZ.default)(),[l,i]=(0,t.useState)(1),[d,o]=(0,t.useState)(null),[c,m]=(0,t.useState)(""),{dispatches:p,unroutedStocks:f,loading:x,error:g}=(({productId:e,deliveryProviderType:a=null,quantity:s=null,referenceDate:l=null})=>{let{data:i,loading:d,error:r}=(0,N.useQuery)(eW,{skip:!e,variables:{productId:e,deliveryProviderType:a,quantity:s,referenceDate:l},errorPolicy:"all"}),{dispatches:n,unroutedStocks:o}=(0,t.useMemo)(()=>{let e=i?.product||{},t=(e?.simulatedDispatches||[]).filter(e=>!a||e?.deliveryProvider?.type===a),s=(e?.simulatedStocks||[]).filter(e=>!a||!e?.deliveryProvider?.type||e?.deliveryProvider?.type===a);return{dispatches:t.map(e=>({...e,stockQuantity:s.find(t=>eG(t,e))?.quantity??null})),unroutedStocks:s.filter(e=>!t.some(t=>eG(e,t)))}},[i,a]);return{dispatches:n,unroutedStocks:o,loading:d,error:r}})({productId:e,quantity:l,referenceDate:d?new Date(d).getTime():null,deliveryProviderType:c||null});return(0,r.jsxs)("div",{className:"mt-5 md:mt-0 space-y-6",children:[(0,r.jsx)("div",{children:(0,r.jsx)(U.default,{messageKey:"fulfillment_preview_description",defaultMessage:"Preview which delivery and warehousing providers the engine would use to fulfill this product, exactly as calculated during checkout."})}),(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 max-w-2xl",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("label",{htmlFor:"simulation-quantity",className:"text-sm font-medium text-text-secondary",children:a({id:"quantity",defaultMessage:"Quantity"})}),(0,r.jsx)("input",{type:"number",id:"simulation-quantity",min:1,value:l,onChange:e=>i(Math.max(1,Number(e.target.value))),className:eX})]}),(0,r.jsx)(eH.default,{id:"simulation-reference-date",label:a({id:"simulate_as_of",defaultMessage:"Simulate as of"}),value:d,onChange:o}),(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("label",{htmlFor:"simulation-delivery-type",className:"text-sm font-medium text-text-secondary",children:a({id:"delivery_type",defaultMessage:"Delivery type"})}),(0,r.jsxs)("select",{id:"simulation-delivery-type",value:c,onChange:e=>m(e.target.value),className:eX,children:[(0,r.jsx)("option",{value:"",children:a({id:"all_types",defaultMessage:"All types"})}),Object.values(n.IDeliveryProviderType).map(e=>(0,r.jsx)("option",{value:e,children:a({id:e,defaultMessage:e,description:"Delivery provider type"})},e))]})]})]}),x?(0,r.jsx)(eh.default,{}):!g||p.length||f.length?p.length||f.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:p.map((e,t)=>(0,r.jsxs)("div",{className:"rounded-lg border border-border-default bg-surface p-4 shadow-xs",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)(ez.TruckIcon,{className:"h-5 w-5 shrink-0 text-text-muted"}),(0,r.jsx)("span",{className:"truncate text-sm font-semibold text-text-primary",children:eJ(e?.deliveryProvider)||a({id:"unknown_delivery_provider",defaultMessage:"Unknown delivery provider"})})]}),e?.deliveryProvider?.type&&(0,r.jsx)(eP.default,{text:a({id:e.deliveryProvider.type,defaultMessage:e.deliveryProvider.type,description:"Delivery provider type"}),color:"sky",square:!0})]}),(0,r.jsxs)("dl",{className:"mt-4 space-y-2 text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("dt",{className:"text-text-muted",children:a({id:"warehouse",defaultMessage:"Warehouse"})}),(0,r.jsxs)("dd",{className:"flex items-center gap-1 text-text-primary truncate",children:[(0,r.jsx)(eK.BuildingStorefrontIcon,{className:"h-4 w-4 shrink-0 text-text-muted"}),eJ(e?.warehousingProvider)||"n/a"]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("dt",{className:"text-text-muted",children:a({id:"ships",defaultMessage:"Ships"})}),(0,r.jsx)("dd",{className:"text-text-primary",children:s(e?.shipping,{dateStyle:"medium",timeStyle:"short"})})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("dt",{className:"text-text-muted",children:a({id:"earliest_delivery",defaultMessage:"Earliest delivery"})}),(0,r.jsx)("dd",{className:"text-text-primary",children:s(e?.earliestDelivery,{dateStyle:"medium",timeStyle:"short"})})]}),e?.stockQuantity!==null&&(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("dt",{className:"text-text-muted",children:a({id:"stock",defaultMessage:"Stock"})}),(0,r.jsx)("dd",{className:"font-semibold text-text-primary",children:a({id:"units_available",defaultMessage:"{quantity} units available"},{quantity:e.stockQuantity})})]})]})]},`${e?.deliveryProvider?._id}-${e?.warehousingProvider?._id}-${t}`))}),f.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-text-primary",children:a({id:"stock_without_dispatch_route",defaultMessage:"Stock without a dispatch route"})}),(0,r.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:a({id:"stock_without_dispatch_route_hint",defaultMessage:"Inventory is reported for these provider combinations, but the engine could not calculate a dispatch for them."})}),(0,r.jsx)("ul",{className:"mt-3 space-y-2",children:f.map((e,t)=>(0,r.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-md border border-border-subtle bg-surface-subtle px-3 py-2 text-sm",children:[(0,r.jsxs)("span",{className:"truncate text-text-secondary",children:[eJ(e?.warehousingProvider)||"n/a",e?.deliveryProvider&&` — ${eJ(e.deliveryProvider)}`]}),(0,r.jsx)("span",{className:"font-semibold text-text-primary",children:a({id:"units_available",defaultMessage:"{quantity} units available"},{quantity:e?.quantity??0})})]},`${e?.deliveryProvider?._id}-${e?.warehousingProvider?._id}-${t}`))})]})]}):(0,r.jsxs)("div",{children:[(0,r.jsx)(J.default,{message:a({id:"dispatch_routes",defaultMessage:"dispatch routes"}),Icon:(0,r.jsx)(ez.TruckIcon,{className:"h-6 w-6"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-text-muted",children:a({id:"fulfillment_preview_empty_hint",defaultMessage:"The engine could not simulate any dispatch for this product. Customers will not see delivery options for it. Verify that at least one delivery provider and one warehousing provider are configured, active and free of configuration errors."})})]}):(0,r.jsxs)("div",{className:"text-sm text-danger",children:[a({id:"fulfillment_simulation_error",defaultMessage:"Fulfillment simulation failed"}),": ",g.message]})]})}],72264);var eY=n,e0=e.i(87593);let e1=P.gql`
533
+ `,eZ=(e,t)=>e?.deliveryProvider?._id===t?.deliveryProvider?._id&&e?.warehousingProvider?._id===t?.warehousingProvider?._id,eG="w-full rounded-md border-1 border-border-default bg-surface-input px-3 py-2 text-sm shadow-xs text-text-primary focus:outline-hidden focus:ring-2 focus:ring-focus-ring",eX=e=>[e?.interface?.label,e?.interface?.version].filter(Boolean).join(" ")||e?._id||null;e.s(["default",0,({productId:e})=>{let{formatMessage:a}=(0,o.useIntl)(),{formatDateTime:s}=(0,eH.default)(),[l,i]=(0,t.useState)(1),[n,u]=(0,t.useState)(null),[c,m]=(0,t.useState)(""),{dispatches:p,unroutedStocks:f,loading:x,error:g}=(({productId:e,deliveryProviderType:a=null,quantity:s=null,referenceDate:l=null})=>{let{data:i,loading:d,error:r}=(0,P.useQuery)(eW,{skip:!e,variables:{productId:e,deliveryProviderType:a,quantity:s,referenceDate:l},errorPolicy:"all"}),{dispatches:n,unroutedStocks:o}=(0,t.useMemo)(()=>{let e=i?.product||{},t=(e?.simulatedDispatches||[]).filter(e=>!a||e?.deliveryProvider?.type===a),s=(e?.simulatedStocks||[]).filter(e=>!a||!e?.deliveryProvider?.type||e?.deliveryProvider?.type===a);return{dispatches:t.map(e=>({...e,stockQuantity:s.find(t=>eZ(t,e))?.quantity??null})),unroutedStocks:s.filter(e=>!t.some(t=>eZ(e,t)))}},[i,a]);return{dispatches:n,unroutedStocks:o,loading:d,error:r}})({productId:e,quantity:l,referenceDate:n?new Date(n).getTime():null,deliveryProviderType:c||null});return(0,d.jsxs)("div",{className:"mt-5 md:mt-0 space-y-6",children:[(0,d.jsx)("div",{children:(0,d.jsx)(E.default,{messageKey:"fulfillment_preview_description",defaultMessage:"Preview which delivery and warehousing providers the engine would use to fulfill this product, exactly as calculated during checkout."})}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 max-w-2xl",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("label",{htmlFor:"simulation-quantity",className:"text-sm font-medium text-text-secondary",children:a({id:"quantity",defaultMessage:"Quantity"})}),(0,d.jsx)("input",{type:"number",id:"simulation-quantity",min:1,value:l,onChange:e=>i(Math.max(1,Number(e.target.value))),className:eG})]}),(0,d.jsx)(eK.default,{id:"simulation-reference-date",label:a({id:"simulate_as_of",defaultMessage:"Simulate as of"}),value:n,onChange:u}),(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("label",{htmlFor:"simulation-delivery-type",className:"text-sm font-medium text-text-secondary",children:a({id:"delivery_type",defaultMessage:"Delivery type"})}),(0,d.jsxs)("select",{id:"simulation-delivery-type",value:c,onChange:e=>m(e.target.value),className:eG,children:[(0,d.jsx)("option",{value:"",children:a({id:"all_types",defaultMessage:"All types"})}),Object.values(r.IDeliveryProviderType).map(e=>(0,d.jsx)("option",{value:e,children:a({id:e,defaultMessage:e,description:"Delivery provider type"})},e))]})]})]}),x?(0,d.jsx)(eg.default,{}):!g||p.length||f.length?p.length||f.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:p.map((e,t)=>(0,d.jsxs)("div",{className:"rounded-lg border border-border-default bg-surface p-4 shadow-xs",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,d.jsx)(eB.TruckIcon,{className:"h-5 w-5 shrink-0 text-text-muted"}),(0,d.jsx)("span",{className:"truncate text-sm font-semibold text-text-primary",children:eX(e?.deliveryProvider)||a({id:"unknown_delivery_provider",defaultMessage:"Unknown delivery provider"})})]}),e?.deliveryProvider?.type&&(0,d.jsx)(eM.default,{text:a({id:e.deliveryProvider.type,defaultMessage:e.deliveryProvider.type,description:"Delivery provider type"}),color:"sky",square:!0})]}),(0,d.jsxs)("dl",{className:"mt-4 space-y-2 text-sm",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("dt",{className:"text-text-muted",children:a({id:"warehouse",defaultMessage:"Warehouse"})}),(0,d.jsxs)("dd",{className:"flex items-center gap-1 text-text-primary truncate",children:[(0,d.jsx)(ez.BuildingStorefrontIcon,{className:"h-4 w-4 shrink-0 text-text-muted"}),eX(e?.warehousingProvider)||"n/a"]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("dt",{className:"text-text-muted",children:a({id:"ships",defaultMessage:"Ships"})}),(0,d.jsx)("dd",{className:"text-text-primary",children:s(e?.shipping,{dateStyle:"medium",timeStyle:"short"})})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("dt",{className:"text-text-muted",children:a({id:"earliest_delivery",defaultMessage:"Earliest delivery"})}),(0,d.jsx)("dd",{className:"text-text-primary",children:s(e?.earliestDelivery,{dateStyle:"medium",timeStyle:"short"})})]}),e?.stockQuantity!==null&&(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("dt",{className:"text-text-muted",children:a({id:"stock",defaultMessage:"Stock"})}),(0,d.jsx)("dd",{className:"font-semibold text-text-primary",children:a({id:"units_available",defaultMessage:"{quantity} units available"},{quantity:e.stockQuantity})})]})]})]},`${e?.deliveryProvider?._id}-${e?.warehousingProvider?._id}-${t}`))}),f.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-text-primary",children:a({id:"stock_without_dispatch_route",defaultMessage:"Stock without a dispatch route"})}),(0,d.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:a({id:"stock_without_dispatch_route_hint",defaultMessage:"Inventory is reported for these provider combinations, but the engine could not calculate a dispatch for them."})}),(0,d.jsx)("ul",{className:"mt-3 space-y-2",children:f.map((e,t)=>(0,d.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-md border border-border-subtle bg-surface-subtle px-3 py-2 text-sm",children:[(0,d.jsxs)("span",{className:"truncate text-text-secondary",children:[eX(e?.warehousingProvider)||"n/a",e?.deliveryProvider&&` — ${eX(e.deliveryProvider)}`]}),(0,d.jsx)("span",{className:"font-semibold text-text-primary",children:a({id:"units_available",defaultMessage:"{quantity} units available"},{quantity:e?.quantity??0})})]},`${e?.deliveryProvider?._id}-${e?.warehousingProvider?._id}-${t}`))})]})]}):(0,d.jsxs)("div",{children:[(0,d.jsx)(X.default,{message:a({id:"dispatch_routes",defaultMessage:"dispatch routes"}),Icon:(0,d.jsx)(eB.TruckIcon,{className:"h-6 w-6"})}),(0,d.jsx)("p",{className:"mt-3 text-sm text-text-muted",children:a({id:"fulfillment_preview_empty_hint",defaultMessage:"The engine could not simulate any dispatch for this product. Customers will not see delivery options for it. Verify that at least one delivery provider and one warehousing provider are configured, active and free of configuration errors."})})]}):(0,d.jsxs)("div",{className:"text-sm text-danger",children:[a({id:"fulfillment_simulation_error",defaultMessage:"Fulfillment simulation failed"}),": ",g.message]})]})}],72264);var eJ=r;let eY=M.gql`
534
+ fragment ProductReviewDetailFragment on ProductReview {
535
+ _id
536
+ created
537
+ updated
538
+ deleted
539
+ author {
540
+ _id
541
+ username
542
+ name
543
+ profile {
544
+ displayName
545
+ address {
546
+ firstName
547
+ lastName
548
+ }
549
+ }
550
+ isGuest
551
+ avatar {
552
+ _id
553
+
554
+ url
555
+ }
556
+ }
557
+ product {
558
+ _id
559
+ texts(forceLocale: $forceLocale) {
560
+ _id
561
+ title
562
+ subtitle
563
+ }
564
+ media {
565
+ _id
566
+ file {
567
+ _id
568
+ url
569
+ }
570
+ }
571
+ }
572
+ rating
573
+ title
574
+ review
575
+ upVote: voteCount(type: UPVOTE)
576
+ downVote: voteCount(type: DOWNVOTE)
577
+ voteReport: voteCount(type: REPORT)
578
+ ownVotes {
579
+ timestamp
580
+ type
581
+ }
582
+ }
583
+ `,e0=M.gql`
534
584
  query ProductReviewByProduct(
535
585
  $productId: ID
536
586
  $slug: String
@@ -547,16 +597,16 @@
547
597
  reviewsCount
548
598
  }
549
599
  }
550
- ${e0.default}
551
- `;var e5=e.i(66859),e2=e.i(39833),e3=e.i(84339);let e4=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z",clipRule:"evenodd"}))}),e6=({productReviews:e})=>{let{formatMessage:t}=(0,u.useIntl)(),a=e.reduce((e,t)=>e+t.upVote,0),s=e.reduce((e,t)=>e+t.downVote,0),l=a?a/(a+s)*100:0,i=l?100-l:0;return(0,r.jsxs)("div",{className:"lg:col-span-4",children:[(0,r.jsx)("h2",{className:"text-2xl",children:t({id:"customer_reviews",defaultMessage:"Customer Reviews"})}),(0,r.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,r.jsx)("div",{children:(0,r.jsx)("div",{title:`${l}`,className:"flex items-center",children:[0,1,2,3,4].map(e=>{let t=l>=20*e;return(0,r.jsx)(e4,{className:`
600
+ ${eY}
601
+ `;var e1=e.i(66859),e5=e.i(39833),e2=e.i(84339);let e3=t.forwardRef(function({title:e,titleId:a,...s},l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":a},s),e?t.createElement("title",{id:a},e):null,t.createElement("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z",clipRule:"evenodd"}))}),e4=({productReviews:e})=>{let{formatMessage:t}=(0,o.useIntl)(),a=e.reduce((e,t)=>e+t.upVote,0),s=e.reduce((e,t)=>e+t.downVote,0),l=a?a/(a+s)*100:0,i=l?100-l:0;return(0,d.jsxs)("div",{className:"lg:col-span-4",children:[(0,d.jsx)("h2",{className:"text-2xl",children:t({id:"customer_reviews",defaultMessage:"Customer Reviews"})}),(0,d.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,d.jsx)("div",{children:(0,d.jsx)("div",{title:`${l}`,className:"flex items-center",children:[0,1,2,3,4].map(e=>{let t=l>=20*e;return(0,d.jsx)(e3,{className:`
552
602
  ${t?"text-amber-400":"text-slate-300 dark:text-slate-600"}
553
603
  h-5 w-5 shrink-0
554
- `,"aria-hidden":"true"},e)})})}),(0,r.jsx)("div",{className:"ml-2 text-sm",children:(0,r.jsx)(u.FormattedMessage,{id:"review_summary",defaultMessage:"<div> Based on <cta> {total} </cta> reviews</div>",values:{div:e=>(0,r.jsx)("div",{children:e}),cta:e=>(0,r.jsx)("b",{className:"font-semibold",children:e}),total:e.length}})})]}),(0,r.jsxs)("div",{className:"mt-6",children:[(0,r.jsx)("h3",{className:"sr-only",children:t({id:"review_data",defaultMessage:"Review data"})}),(0,r.jsxs)("dl",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center text-sm",children:[(0,r.jsxs)("dt",{className:"flex flex-1 items-center",children:[(0,r.jsx)("p",{className:"font-medium",children:a}),(0,r.jsxs)("div",{"aria-hidden":"true",className:"ml-2 flex flex-1 items-center",children:[(0,r.jsx)(e3.HandThumbUpIcon,{className:`
604
+ `,"aria-hidden":"true"},e)})})}),(0,d.jsx)("div",{className:"ml-2 text-sm",children:(0,d.jsx)(o.FormattedMessage,{id:"review_summary",defaultMessage:"<div> Based on <cta> {total} </cta> reviews</div>",values:{div:e=>(0,d.jsx)("div",{children:e}),cta:e=>(0,d.jsx)("b",{className:"font-semibold",children:e}),total:e.length}})})]}),(0,d.jsxs)("div",{className:"mt-6",children:[(0,d.jsx)("h3",{className:"sr-only",children:t({id:"review_data",defaultMessage:"Review data"})}),(0,d.jsxs)("dl",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center text-sm",children:[(0,d.jsxs)("dt",{className:"flex flex-1 items-center",children:[(0,d.jsx)("p",{className:"font-medium",children:a}),(0,d.jsxs)("div",{"aria-hidden":"true",className:"ml-2 flex flex-1 items-center",children:[(0,d.jsx)(e2.HandThumbUpIcon,{className:`
555
605
  ${a>0?"text-emerald-500":"text-slate-500"}
556
- h-5 w-5 shrink-0`,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative ml-3 flex-1",children:[(0,r.jsx)("div",{className:"h-3 rounded-full border border-border-default bg-surface-subtle"}),a>0?(0,r.jsx)("div",{className:"absolute inset-y-0 rounded-full border border-emerald-500 bg-emerald-500",style:{width:`calc(${l}%)`}}):null]})]})]}),(0,r.jsxs)("dd",{className:"ml-3 w-10 text-right text-sm tabular-nums",children:[Math.round(l),"%"]})]}),(0,r.jsxs)("div",{className:"flex items-center text-sm",children:[(0,r.jsxs)("dt",{className:"flex flex-1 items-center",children:[(0,r.jsxs)("p",{className:"font-medium",children:[s,(0,r.jsx)("span",{className:"sr-only",children:t({id:"star_reviews",defaultMessage:"Star reviews"})})]}),(0,r.jsxs)("div",{"aria-hidden":"true",className:"ml-2 flex flex-1 items-center",children:[(0,r.jsx)(e2.HandThumbDownIcon,{className:`
606
+ h-5 w-5 shrink-0`,"aria-hidden":"true"}),(0,d.jsxs)("div",{className:"relative ml-3 flex-1",children:[(0,d.jsx)("div",{className:"h-3 rounded-full border border-border-default bg-surface-subtle"}),a>0?(0,d.jsx)("div",{className:"absolute inset-y-0 rounded-full border border-emerald-500 bg-emerald-500",style:{width:`calc(${l}%)`}}):null]})]})]}),(0,d.jsxs)("dd",{className:"ml-3 w-10 text-right text-sm tabular-nums",children:[Math.round(l),"%"]})]}),(0,d.jsxs)("div",{className:"flex items-center text-sm",children:[(0,d.jsxs)("dt",{className:"flex flex-1 items-center",children:[(0,d.jsxs)("p",{className:"font-medium",children:[s,(0,d.jsx)("span",{className:"sr-only",children:t({id:"star_reviews",defaultMessage:"Star reviews"})})]}),(0,d.jsxs)("div",{"aria-hidden":"true",className:"ml-2 flex flex-1 items-center",children:[(0,d.jsx)(e5.HandThumbDownIcon,{className:`
557
607
  ${s>0?"text-rose-500":"text-slate-500"}
558
608
  h-5 w-5 shrink-0
559
- `,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative ml-3 flex-1",children:[(0,r.jsx)("div",{className:"h-3 rounded-full border border-border-default bg-surface-subtle"}),s>0?(0,r.jsx)("div",{className:"absolute inset-y-0 rounded-full border border-rose-500 bg-rose-500",style:{width:`calc(${i}%)`}}):null]})]})]}),(0,r.jsxs)("dd",{className:"ml-3 w-10 text-right text-sm tabular-nums",children:[Math.round(i),"%"]})]})]})]})]})};var e7=e.i(87213);let e9=({onSubmit:e,onSubmitSuccess:t=null,defaultValue:a={},isEdit:s=!1})=>{let{formatMessage:l}=(0,u.useIntl)(),{hasRole:i}=(0,c.default)(),d=l({id:"product_review_added",defaultMessage:"Review added successfully!"}),o=l({id:"product_review_updated",defaultMessage:"Review updated successfully!"}),m=(0,w.default)({submit:e,onSubmitSuccess:t,successMessage:s?o:d,initialValues:{title:"",review:"",rating:1,...a}});return(0,r.jsxs)("div",{className:"bg-surface rounded-md shadow-sm overflow-hidden p-6 mb-6",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-4",children:l({id:"write_review",defaultMessage:"Write a Review"})}),(0,r.jsxs)(h.default,{form:m,children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(j.default,{name:"title",disabled:!i(n.IRoleAction.ReviewProduct),id:"title",label:l({id:"title",defaultMessage:"Title"}),autoComplete:"off",required:!0}),(0,r.jsx)(e7.default,{rows:4,name:"review",disabled:!i(n.IRoleAction.ReviewProduct),id:"review",label:l({id:"review",defaultMessage:"Review"}),placeholder:l({id:"review_placeholder",defaultMessage:"Share your thoughts about this product..."})})]}),i(n.IRoleAction.ReviewProduct)&&(0,r.jsx)("div",{className:"mt-6 flex justify-end",children:(0,r.jsx)(y.default,{label:l(s?{id:"update_review",defaultMessage:"Update Review"}:{id:"add_review",defaultMessage:"Add Review"}),className:"px-6 py-2"})})]})]})},e8=P.gql`
609
+ `,"aria-hidden":"true"}),(0,d.jsxs)("div",{className:"relative ml-3 flex-1",children:[(0,d.jsx)("div",{className:"h-3 rounded-full border border-border-default bg-surface-subtle"}),s>0?(0,d.jsx)("div",{className:"absolute inset-y-0 rounded-full border border-rose-500 bg-rose-500",style:{width:`calc(${i}%)`}}):null]})]})]}),(0,d.jsxs)("dd",{className:"ml-3 w-10 text-right text-sm tabular-nums",children:[Math.round(i),"%"]})]})]})]})]})};var e6=e.i(87213);let e9=({onSubmit:e,onSubmitSuccess:t=null,defaultValue:a={},isEdit:s=!1})=>{let{formatMessage:l}=(0,o.useIntl)(),{hasRole:i}=(0,u.default)(),n=l({id:"product_review_added",defaultMessage:"Review added successfully!"}),c=l({id:"product_review_updated",defaultMessage:"Review updated successfully!"}),m=(0,I.default)({submit:e,onSubmitSuccess:t,successMessage:s?c:n,initialValues:{title:"",review:"",rating:1,...a}});return(0,d.jsxs)("div",{className:"bg-surface rounded-md shadow-sm overflow-hidden p-6 mb-6",children:[(0,d.jsx)("h3",{className:"text-lg font-semibold text-text-primary mb-4",children:l({id:"write_review",defaultMessage:"Write a Review"})}),(0,d.jsxs)(g.default,{form:m,children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(y.default,{name:"title",disabled:!i(r.IRoleAction.ReviewProduct),id:"title",label:l({id:"title",defaultMessage:"Title"}),autoComplete:"off",required:!0}),(0,d.jsx)(e6.default,{rows:4,name:"review",disabled:!i(r.IRoleAction.ReviewProduct),id:"review",label:l({id:"review",defaultMessage:"Review"}),placeholder:l({id:"review_placeholder",defaultMessage:"Share your thoughts about this product..."})})]}),i(r.IRoleAction.ReviewProduct)&&(0,d.jsx)("div",{className:"mt-6 flex justify-end",children:(0,d.jsx)(b.default,{label:l(s?{id:"update_review",defaultMessage:"Update Review"}:{id:"add_review",defaultMessage:"Add Review"}),className:"px-6 py-2"})})]})]})},e7=M.gql`
560
610
  mutation CreateProductReview(
561
611
  $productId: ID!
562
612
  $productReview: ProductReviewInput!
@@ -566,7 +616,7 @@
566
616
  _id
567
617
  }
568
618
  }
569
- `;e.s(["default",0,({productId:e})=>{let{productReviews:t,loadMore:a,reviewsCount:s}=(({productId:e=null,slug:t=null,limit:a=10,offset:s=0,sort:l=[{key:"created",value:eY.ISortDirection.Desc}]}={})=>{let{selectedLocale:i}=(0,O.default)(),{data:d,loading:r,error:n,fetchMore:o}=(0,N.useQuery)(e1,{skip:!e,variables:{productId:e,slug:t,limit:a,offset:s,sort:l,forceLocale:i}}),u=d?.product,c=u?.reviews||[];return{productReviews:c,loading:r,error:n,reviewsCount:u?.reviewsCount||0,loadMore:()=>{o({variables:{offset:c?.length}})}}})({productId:e}),{createProductReview:l}=(()=>{let[e]=(0,$.useMutation)(e8);return{createProductReview:async({productId:t,productReview:{title:a,rating:s,review:l}})=>e({variables:{productId:t,productReview:{title:a,rating:s,review:l}},refetchQueries:["ProductReviewByProduct","ProductReviewByUser"]})}})(),{formatMessage:i}=(0,u.useIntl)();return(0,r.jsxs)("div",{className:"sm:max-w-full",children:[(0,r.jsx)("div",{className:"text-text-primary",children:(0,r.jsxs)("div",{className:"mx-auto p-2 lg:grid lg:max-w-7xl lg:grid-cols-12 lg:gap-x-8",children:[(0,r.jsx)(e6,{productReviews:t}),(0,r.jsxs)("div",{className:"mt-16 lg:col-span-7 lg:col-start-6 lg:mt-0",children:[e&&(0,r.jsx)(e9,{onSubmit:async({title:t,review:a,rating:s})=>await l({productId:e,productReview:{title:t,review:a,rating:10}})}),(0,r.jsx)("h3",{className:"sr-only",children:i({id:"recent_reviews",defaultMessage:"Recent reviews"})}),(0,r.jsx)("div",{className:"flow-root",children:(0,r.jsx)("div",{className:"-my-3",children:t.map(e=>(0,r.jsx)(e5.default,{review:e},e._id))})})]})]})}),s>t?.length?(0,r.jsx)(I.default,{text:i({id:"load-more-reviews",defaultMessage:"Load reviews"}),onClick:a}):null]})}],19051);var te=e.i(47542);let tt=P.gql`
619
+ `;e.s(["default",0,({productId:e})=>{let{productReviews:t,loadMore:a,reviewsCount:s}=(({productId:e=null,slug:t=null,limit:a=10,offset:s=0,sort:l=[{key:"created",value:eJ.ISortDirection.Desc}]}={})=>{let{selectedLocale:i}=(0,O.default)(),{data:d,loading:r,error:n,fetchMore:o}=(0,P.useQuery)(e0,{skip:!e,variables:{productId:e,slug:t,limit:a,offset:s,sort:l,forceLocale:i}}),u=d?.product,c=u?.reviews||[];return{productReviews:c,loading:r,error:n,reviewsCount:u?.reviewsCount||0,loadMore:()=>{o({variables:{offset:c?.length}})}}})({productId:e}),{createProductReview:l}=(()=>{let[e]=(0,k.useMutation)(e7);return{createProductReview:async({productId:t,productReview:{title:a,rating:s,review:l}})=>e({variables:{productId:t,productReview:{title:a,rating:s,review:l}},refetchQueries:["ProductReviewByProduct","ProductReviewByUser"]})}})(),{formatMessage:i}=(0,o.useIntl)();return(0,d.jsxs)("div",{className:"sm:max-w-full",children:[(0,d.jsx)("div",{className:"text-text-primary",children:(0,d.jsxs)("div",{className:"mx-auto p-2 lg:grid lg:max-w-7xl lg:grid-cols-12 lg:gap-x-8",children:[(0,d.jsx)(e4,{productReviews:t}),(0,d.jsxs)("div",{className:"mt-16 lg:col-span-7 lg:col-start-6 lg:mt-0",children:[e&&(0,d.jsx)(e9,{onSubmit:async({title:t,review:a,rating:s})=>await l({productId:e,productReview:{title:t,review:a,rating:10}})}),(0,d.jsx)("h3",{className:"sr-only",children:i({id:"recent_reviews",defaultMessage:"Recent reviews"})}),(0,d.jsx)("div",{className:"flow-root",children:(0,d.jsx)("div",{className:"-my-3",children:t.map(e=>(0,d.jsx)(e1.default,{review:e},e._id))})})]})]})}),s>t?.length?(0,d.jsx)(j.default,{text:i({id:"load-more-reviews",defaultMessage:"Load reviews"}),onClick:a}):null]})}],19051);var e8=e.i(47542);let te=M.gql`
570
620
  mutation CreateProductBundleItem(
571
621
  $productId: ID!
572
622
  $item: CreateProductBundleItemInput!
@@ -575,7 +625,7 @@
575
625
  _id
576
626
  }
577
627
  }
578
- `;var ta=e.i(24112);let ts=(0,e.i(5270).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);var tl=e.i(38994);let ti=function({onSuccess:e}){let{selectedLocale:t}=(0,O.default)(),{createProduct:a}=(0,tl.default)(),{formatMessage:s}=(0,u.useIntl)();return async({title:l,type:i,quantity:d=1})=>{let r=[{title:l,slug:l.toLowerCase().replace(/\s+/g,"-"),locale:t}],{data:o}=await a({product:{type:i||n.IProductType.SimpleProduct},texts:r}),u=o?.createProduct;if(!u?._id)throw Error(s({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return e?.(u,d),{success:!0}}},td=({bundleProduct:e,onSuccess:a})=>{let{formatMessage:s}=(0,u.useIntl)(),{hasRole:l}=(0,c.default)(),i=ti({onSuccess:a}),d=(0,t.useMemo)(()=>{let t=e?.texts?.title??"";return`${t} - New Bundle Item`},[e]),o=async({title:e,type:t,quantity:a})=>{try{return await i({title:e,type:t,quantity:a}),{success:!0}}catch(e){return{success:!1,error:{message:e?.message}}}},m=s({id:"bundle-item-scaffolded-success",defaultMessage:"New product scaffolded and added to bundle successfully"}),p=(0,w.default)({submit:o,successMessage:m,enableReinitialize:!0,initialValues:{title:d,type:n.IProductType.SimpleProduct,quantity:1}});return(0,r.jsxs)(h.default,{className:"mt-4 rounded-md border border-border-subtle",form:p,children:[(0,r.jsxs)("div",{className:"p-5 flex flex-col gap-3",children:[(0,r.jsx)("h3",{className:"text-md font-semibold text-slate-800 dark:text-slate-100",children:s({id:"scaffold_bundle_item_title",defaultMessage:"Scaffold New Bundle Item"})}),(0,r.jsx)(j.default,{name:"title",id:"title",label:s({id:"name",defaultMessage:"Name"}),required:!0,className:"block w-full rounded-md border-border-default text-sm"}),(0,r.jsx)(b.default,{className:"mt-1 w-full",label:s({id:"type",defaultMessage:"Type"}),placeholder:s({id:"type",defaultMessage:"Type"}),required:!0,name:"type",options:Object.fromEntries(Object.entries(n.IProductType).filter(([,e])=>e!==n.IProductType.ConfigurableProduct&&e!==n.IProductType.BundleProduct).map(([e,t])=>[t,e]))}),(0,r.jsx)(j.default,{name:"quantity",type:"number",required:!0,label:s({id:"quantity",defaultMessage:"Quantity"})})]}),l(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"border-t border-border-subtle bg-surface-subtle p-5 text-right",children:(0,r.jsx)(y.default,{label:s({id:"scaffold_and_add",defaultMessage:"Scaffold & Add"})})})]})},tr=({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{customProperties:s,hydrateFragment:l}=(0,q.default)(),{data:i,loading:d,error:r}=(0,N.useQuery)(((e="")=>P.gql`
628
+ `;var tt=e.i(24112),ta=e.i(5270);let ts={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};ts.node;let tl=(0,ta.default)(ts);var ti=e.i(38994);let td=function({onSuccess:e}){let{selectedLocale:t}=(0,O.default)(),{createProduct:a}=(0,ti.default)(),{formatMessage:s}=(0,o.useIntl)();return async({title:l,type:i,quantity:d=1})=>{let n=[{title:l,slug:l.toLowerCase().replace(/\s+/g,"-"),locale:t}],{data:o}=await a({product:{type:i||r.IProductType.SimpleProduct},texts:n}),u=o?.createProduct;if(!u?._id)throw Error(s({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return e?.(u,d),{success:!0}}},tr=({bundleProduct:e,onSuccess:a})=>{let{formatMessage:s}=(0,o.useIntl)(),{hasRole:l}=(0,u.default)(),i=td({onSuccess:a}),n=(0,t.useMemo)(()=>{let t=e?.texts?.title??"";return`${t} - New Bundle Item`},[e]),c=async({title:e,type:t,quantity:a})=>{try{return await i({title:e,type:t,quantity:a}),{success:!0}}catch(e){return{success:!1,error:{message:e?.message}}}},m=s({id:"bundle-item-scaffolded-success",defaultMessage:"New product scaffolded and added to bundle successfully"}),p=(0,I.default)({submit:c,successMessage:m,enableReinitialize:!0,initialValues:{title:n,type:r.IProductType.SimpleProduct,quantity:1}});return(0,d.jsxs)(g.default,{className:"mt-4 rounded-md border border-border-subtle",form:p,children:[(0,d.jsxs)("div",{className:"p-5 flex flex-col gap-3",children:[(0,d.jsx)("h3",{className:"text-md font-semibold text-slate-800 dark:text-slate-100",children:s({id:"scaffold_bundle_item_title",defaultMessage:"Scaffold New Bundle Item"})}),(0,d.jsx)(y.default,{name:"title",id:"title",label:s({id:"name",defaultMessage:"Name"}),required:!0,className:"block w-full rounded-md border-border-default text-sm"}),(0,d.jsx)(v.default,{className:"mt-1 w-full",label:s({id:"type",defaultMessage:"Type"}),placeholder:s({id:"type",defaultMessage:"Type"}),required:!0,name:"type",options:Object.fromEntries(Object.entries(r.IProductType).filter(([,e])=>e!==r.IProductType.ConfigurableProduct&&e!==r.IProductType.BundleProduct).map(([e,t])=>[t,e]))}),(0,d.jsx)(y.default,{name:"quantity",type:"number",required:!0,label:s({id:"quantity",defaultMessage:"Quantity"})})]}),l(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"border-t border-border-subtle bg-surface-subtle p-5 text-right",children:(0,d.jsx)(b.default,{label:s({id:"scaffold_and_add",defaultMessage:"Scaffold & Add"})})})]})},tn=({productId:e=null,slug:t=null}={})=>{let a=(0,W.parseUniqueId)(t),{customProperties:s,hydrateFragment:l}=(0,T.default)(),{data:i,loading:d,error:r}=(0,P.useQuery)(((e="")=>M.gql`
579
629
  query Product($productId: ID, $slug: String) {
580
630
  product(productId: $productId, slug: $slug) {
581
631
  ...ProductDetailFragment
@@ -629,8 +679,8 @@
629
679
  }
630
680
  }
631
681
  }
632
- ${C.default}
633
- `)(s?.Product),{skip:!e&&!a,variables:{productId:e||a}}),n=l(s?.Product,i?.product);return{product:i?.product,loading:d,error:r,extendedData:n}};e.s(["default",0,tr],84278);let tn=({productId:e,disabled:a=!1})=>{let{product:s}=tr({productId:e}),{setModal:l}=(0,ei.default)(),[i,d]=(0,t.useState)(""),{createProductBundleItem:o}=(()=>{let[e]=(0,$.useMutation)(tt);return{createProductBundleItem:async({productId:t,item:a})=>e({variables:{productId:t,item:a},refetchQueries:["ProductBundleItems"]})}})(),{hasRole:m}=(0,c.default)(),{formatMessage:p}=(0,u.useIntl)(),{products:f,loading:x}=(0,ta.default)({queryString:i,includeDrafts:!0,limit:50,sort:[{key:"created",value:n.ISortDirection.Desc}]}),g=async({productId:t,quantity:a})=>(await o({item:{productId:t,quantity:a},productId:e}),{success:!0}),v=p({id:"bundle_item_added",defaultMessage:"Bundle product added successfully"}),b=(0,w.default)({disabled:a,submit:g,successMessage:v,onSubmitSuccess:()=>(b.api.resetForm(),null),initialValues:{productId:"",quantity:1}}),M=(0,t.useCallback)(async()=>{await l((0,r.jsx)(td,{bundleProduct:s,onSuccess:async(t,a=1)=>{await o({item:{productId:t._id,quantity:a},productId:e}),l("")}}))},[s]);return(0,r.jsxs)(h.default,{form:b,children:[(0,r.jsxs)("div",{className:"flex items-end gap-2 w-full",children:[(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(te.default,{name:"productId",onFilter:d,queryString:i,label:p({id:"product",defaultMessage:"Product"}),data:((e=[])=>e.map(({_id:e,status:t,texts:a,media:s})=>({id:e,tag:t,...a,image:s?.length?s[0]?.file?.url:null})))(f),isLoading:x,className:"w-full text-sm font-medium text-slate-500",required:!0})}),m(n.IRoleAction.ManageProducts)&&(0,r.jsx)("div",{className:"pb-3",children:(0,r.jsx)(I.default,{className:"flex items-center justify-center p-2 rounded-md",onClick:M,children:(0,r.jsx)(ts,{className:"h-5 w-5"})})})]}),(0,r.jsx)(j.default,{name:"quantity",type:"number",required:!0,label:p({id:"quantity",defaultMessage:"Quantity"})}),m(n.IRoleAction.ManageProducts)&&(0,r.jsx)(y.default,{label:p({id:"submit",defaultMessage:"Submit"}),className:"mt-2"})]})};var to=e.i(54529);let tu=P.gql`
682
+ ${$.default}
683
+ `)(s?.Product),{skip:!e&&!a,variables:{productId:e||a}}),n=l(s?.Product,i?.product);return{product:i?.product,loading:d,error:r,extendedData:n}};e.s(["default",0,tn],84278);let to=({productId:e,disabled:a=!1})=>{let{product:s}=tn({productId:e}),{setModal:l}=(0,el.default)(),[i,n]=(0,t.useState)(""),{createProductBundleItem:c}=(()=>{let[e]=(0,k.useMutation)(te);return{createProductBundleItem:async({productId:t,item:a})=>e({variables:{productId:t,item:a},refetchQueries:["ProductBundleItems"]})}})(),{hasRole:m}=(0,u.default)(),{formatMessage:p}=(0,o.useIntl)(),{products:f,loading:x}=(0,tt.default)({queryString:i,includeDrafts:!0,limit:50,sort:[{key:"created",value:r.ISortDirection.Desc}]}),h=async({productId:t,quantity:a})=>(await c({item:{productId:t,quantity:a},productId:e}),{success:!0}),v=p({id:"bundle_item_added",defaultMessage:"Bundle product added successfully"}),w=(0,I.default)({disabled:a,submit:h,successMessage:v,onSubmitSuccess:()=>(w.api.resetForm(),null),initialValues:{productId:"",quantity:1}}),M=(0,t.useCallback)(async()=>{await l((0,d.jsx)(tr,{bundleProduct:s,onSuccess:async(t,a=1)=>{await c({item:{productId:t._id,quantity:a},productId:e}),l("")}}))},[s]);return(0,d.jsxs)(g.default,{form:w,children:[(0,d.jsxs)("div",{className:"flex items-end gap-2 w-full",children:[(0,d.jsx)("div",{className:"flex-1",children:(0,d.jsx)(e8.default,{name:"productId",onFilter:n,queryString:i,label:p({id:"product",defaultMessage:"Product"}),data:((e=[])=>e.map(({_id:e,status:t,texts:a,media:s})=>({id:e,tag:t,...a,image:s?.length?s[0]?.file?.url:null})))(f),isLoading:x,className:"w-full text-sm font-medium text-slate-500",required:!0})}),m(r.IRoleAction.ManageProducts)&&(0,d.jsx)("div",{className:"pb-3",children:(0,d.jsx)(j.default,{className:"flex items-center justify-center p-2 rounded-md",onClick:M,children:(0,d.jsx)(tl,{className:"h-5 w-5"})})})]}),(0,d.jsx)(y.default,{name:"quantity",type:"number",required:!0,label:p({id:"quantity",defaultMessage:"Quantity"})}),m(r.IRoleAction.ManageProducts)&&(0,d.jsx)(b.default,{label:p({id:"submit",defaultMessage:"Submit"}),className:"mt-2"})]})};var tu=e.i(54529);let tc=M.gql`
634
684
  query ProductBundleItems(
635
685
  $productId: ID
636
686
  $slug: String
@@ -648,11 +698,11 @@
648
698
  }
649
699
  }
650
700
  }
651
- ${to.default}
652
- `,tc=P.gql`
701
+ ${tu.default}
702
+ `,tm=M.gql`
653
703
  mutation RemoveBundleItem($productId: ID!, $index: Int!) {
654
704
  removeBundleItem(productId: $productId, index: $index) {
655
705
  _id
656
706
  }
657
707
  }
658
- `;var tm=e.i(41158),tp=e.i(87284),tf=e.i(76069);let tx=({item:e,onDelete:t,index:a})=>{let{product:s,quantity:l}=e;return(0,r.jsx)(tm.default,{href:`/products?slug=${(0,W.default)(s)}`,children:(0,r.jsxs)("div",{className:" group flex w-full items-center justify-between border-b border-border-subtle hover:border-slate-300 dark:hover:border-slate-600 hover:bg-slate-50/80 dark:hover:bg-slate-700/50 transition-all duration-200 ease-in-out hover:shadow-sm last:border-none",children:[(0,r.jsxs)("div",{className:"flex w-full items-center space-x-6 py-4",children:[s.media?.length?(0,r.jsx)("div",{className:"flex w-20 flex-col items-center",children:(0,r.jsx)("div",{className:"relative m-1 mr-2 mt-1 flex items-center justify-center rounded-full ",children:(0,r.jsx)(tp.default,{className:"mx-auto w-auto",src:s.media[0]?.file?.url,width:160,height:100,alt:s?.texts?.title||s?.texts?.subtitle})})}):(0,r.jsx)(tf.default,{className:"h-10 w-10"}),(0,r.jsxs)("div",{className:"shrink grow basis-1/2",children:[(0,r.jsx)("h3",{className:"text-lg text-text-secondary",children:s?.texts?.title}),(0,r.jsx)("p",{className:"text-xs text-slate-600 dark:text-slate-200",children:s?.texts?.subtitle})]}),(0,r.jsx)("div",{className:"ml-auto",children:(0,r.jsx)(eP.default,{text:l,color:"slate",square:!0})})]}),(0,r.jsx)(eE.default,{onDelete:()=>{t(a)},showDelete:!0})]})})},tg=({productId:e})=>{let{formatMessage:t}=(0,u.useIntl)(),{setModal:a}=(0,ei.default)(),{selectedLocale:s}=(0,O.default)(),{bundleItems:l,loading:i}=(({productId:e=null,slug:t=null}={})=>{let{selectedLocale:a}=(0,O.default)(),s=(0,W.parseUniqueId)(t),{data:l,loading:i,error:d}=(0,N.useQuery)(tu,{skip:!e&&!s,variables:{productId:e||s,forceLocale:a},context:{headers:{forceLocale:a}}});return{bundleItems:l?.product?.bundleItems||[],loading:i,error:d}})({productId:e,forceLocale:s}),{removeBundleItem:d}=(()=>{let[e]=(0,$.useMutation)(tc);return{removeBundleItem:async({productId:t,index:a})=>e({variables:{productId:t,index:a},refetchQueries:["ProductBundleItems"]})}})(),n=async s=>{await a((0,r.jsx)(es.default,{onCancelClick:async()=>a(""),message:t({id:"delete_bundle_item_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this bundle item? "}),onOkClick:async()=>{a(""),await d({productId:e,index:s}),F.toast.success(t({id:"bundle_item_deleted",defaultMessage:"Bundle item deleted successfully"}))},okText:t({id:"delete_bundle_item",defaultMessage:"Delete item"})}))};return i?(0,r.jsx)(eh.default,{}):l.length?(0,r.jsx)(r.Fragment,{children:l.map((e,t)=>(0,r.jsx)(tx,{index:t,item:e,onDelete:n},e.product._id))}):(0,r.jsx)(J.default,{message:t({id:"bundle",defaultMessage:"Bundle product"})})};e.s(["default",0,({productId:e,disabled:t=!1})=>(0,r.jsx)("div",{className:"mt-6 rounded-md",children:(0,r.jsxs)("div",{className:"lg:grid lg:grid-cols-9",children:[(0,r.jsx)("div",{className:"mb-5 lg:col-span-4 lg:pr-5",children:(0,r.jsx)(tn,{productId:e,disabled:t})}),(0,r.jsx)("div",{className:"col-span-5 ml-auto rounded-md bg-surface px-8 shadow-md dark:shadow-none lg:w-full",children:(0,r.jsx)("div",{className:"py-4",children:(0,r.jsx)(tg,{productId:e})})})]})})],11907)}]);
708
+ `;var tp=e.i(41158),tf=e.i(87284),tx=e.i(76069);let tg=({item:e,onDelete:t,index:a})=>{let{product:s,quantity:l}=e;return(0,d.jsx)(tp.default,{href:`/products?slug=${(0,W.default)(s)}`,children:(0,d.jsxs)("div",{className:" group flex w-full items-center justify-between border-b border-border-subtle hover:border-slate-300 dark:hover:border-slate-600 hover:bg-slate-50/80 dark:hover:bg-slate-700/50 transition-all duration-200 ease-in-out hover:shadow-sm last:border-none",children:[(0,d.jsxs)("div",{className:"flex w-full items-center space-x-6 py-4",children:[s.media?.length?(0,d.jsx)("div",{className:"flex w-20 flex-col items-center",children:(0,d.jsx)("div",{className:"relative m-1 mr-2 mt-1 flex items-center justify-center rounded-full ",children:(0,d.jsx)(tf.default,{className:"mx-auto w-auto",src:s.media[0]?.file?.url,width:160,height:100,alt:s?.texts?.title||s?.texts?.subtitle})})}):(0,d.jsx)(tx.default,{className:"h-10 w-10"}),(0,d.jsxs)("div",{className:"shrink grow basis-1/2",children:[(0,d.jsx)("h3",{className:"text-lg text-text-secondary",children:s?.texts?.title}),(0,d.jsx)("p",{className:"text-xs text-slate-600 dark:text-slate-200",children:s?.texts?.subtitle})]}),(0,d.jsx)("div",{className:"ml-auto",children:(0,d.jsx)(eM.default,{text:l,color:"slate",square:!0})})]}),(0,d.jsx)(eV.default,{onDelete:()=>{t(a)},showDelete:!0})]})})},th=({productId:e})=>{let{formatMessage:t}=(0,o.useIntl)(),{setModal:a}=(0,el.default)(),{selectedLocale:s}=(0,O.default)(),{bundleItems:l,loading:i}=(({productId:e=null,slug:t=null}={})=>{let{selectedLocale:a}=(0,O.default)(),s=(0,W.parseUniqueId)(t),{data:l,loading:i,error:d}=(0,P.useQuery)(tc,{skip:!e&&!s,variables:{productId:e||s,forceLocale:a},context:{headers:{forceLocale:a}}});return{bundleItems:l?.product?.bundleItems||[],loading:i,error:d}})({productId:e,forceLocale:s}),{removeBundleItem:r}=(()=>{let[e]=(0,k.useMutation)(tm);return{removeBundleItem:async({productId:t,index:a})=>e({variables:{productId:t,index:a},refetchQueries:["ProductBundleItems"]})}})(),n=async s=>{await a((0,d.jsx)(ea.default,{onCancelClick:async()=>a(""),message:t({id:"delete_bundle_item_confirmation",defaultMessage:"This action might cause inconsistencies with other data that relates to it. Are you sure you want to delete this bundle item? "}),onOkClick:async()=>{a(""),await r({productId:e,index:s}),L.toast.success(t({id:"bundle_item_deleted",defaultMessage:"Bundle item deleted successfully"}))},okText:t({id:"delete_bundle_item",defaultMessage:"Delete item"})}))};return i?(0,d.jsx)(eg.default,{}):l.length?(0,d.jsx)(d.Fragment,{children:l.map((e,t)=>(0,d.jsx)(tg,{index:t,item:e,onDelete:n},e.product._id))}):(0,d.jsx)(X.default,{message:t({id:"bundle",defaultMessage:"Bundle product"})})};e.s(["default",0,({productId:e,disabled:t=!1})=>(0,d.jsx)("div",{className:"mt-6 rounded-md",children:(0,d.jsxs)("div",{className:"lg:grid lg:grid-cols-9",children:[(0,d.jsx)("div",{className:"mb-5 lg:col-span-4 lg:pr-5",children:(0,d.jsx)(to,{productId:e,disabled:t})}),(0,d.jsx)("div",{className:"col-span-5 ml-auto rounded-md bg-surface px-8 shadow-md dark:shadow-none lg:w-full",children:(0,d.jsx)("div",{className:"py-4",children:(0,d.jsx)(th,{productId:e})})})]})})],11907)}]);