@unchainedshop/admin-ui 5.0.0-alpha.12 → 5.0.0-alpha.14

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 (292) hide show
  1. package/dist/{chunk-ATZJXTRA.js → chunk-5UHBGLFV.js} +39 -1
  2. package/dist/{chunk-4MXPTVDL.js → chunk-6WMH7PLC.js} +1 -1
  3. package/dist/{chunk-GWMLIF3C.js → chunk-EKWWSFDK.js} +1 -1
  4. package/dist/{chunk-Q6S3LBUF.js → chunk-JC6PXYZP.js} +7 -1
  5. package/dist/{chunk-BOMSMJF2.js → chunk-JGER2LQO.js} +1 -0
  6. package/dist/{chunk-YUXHILXY.js → chunk-M2242FCR.js} +1 -1
  7. package/dist/{chunk-33ZO52Z7.js → chunk-NUGWX3KO.js} +123 -19
  8. package/dist/{chunk-ED2FP42R.js → chunk-XZ2V6XTD.js} +2 -2
  9. package/dist/components/ui/index.d.ts +1 -0
  10. package/dist/components/ui/index.d.ts.map +1 -1
  11. package/dist/form.js +7 -99
  12. package/dist/gql/operation-types.d.ts +51 -18
  13. package/dist/gql/operation-types.d.ts.map +1 -1
  14. package/dist/gql/schema-types.d.ts +25 -0
  15. package/dist/gql/schema-types.d.ts.map +1 -1
  16. package/dist/hooks.js +4 -4
  17. package/dist/modules/UnchainedContext/UnchainedContext.d.ts +1 -0
  18. package/dist/modules/UnchainedContext/UnchainedContext.d.ts.map +1 -1
  19. package/dist/modules/UnchainedContext/useUnchainedContext.d.ts +1 -0
  20. package/dist/modules/UnchainedContext/useUnchainedContext.d.ts.map +1 -1
  21. package/dist/modules/accounts.js +47 -1
  22. package/dist/modules/assortment.js +1 -1
  23. package/dist/modules/common/components/SearchWithTags.d.ts +10 -0
  24. package/dist/modules/common/components/SearchWithTags.d.ts.map +1 -0
  25. package/dist/modules/common/hooks/useShopInfo.d.ts +1 -0
  26. package/dist/modules/common/hooks/useShopInfo.d.ts.map +1 -1
  27. package/dist/modules/enrollment.js +24 -10
  28. package/dist/modules/forms/lib/validators.d.ts +3 -1
  29. package/dist/modules/forms/lib/validators.d.ts.map +1 -1
  30. package/dist/modules/order/fragments/OrderDetailFragment.d.ts.map +1 -1
  31. package/dist/modules/order.js +0 -1
  32. package/dist/modules/product/hooks/useProductsCount.d.ts +1 -1
  33. package/dist/modules/product/hooks/useProductsCount.d.ts.map +1 -1
  34. package/dist/modules/product-review.js +1 -1
  35. package/dist/modules/product.js +436 -24
  36. package/dist/modules/quotation.js +1 -0
  37. package/dist/ui.js +1317 -411
  38. package/out/403/index.html +3 -3
  39. package/out/404/index.html +3 -3
  40. package/out/404.html +3 -3
  41. package/out/423/index.html +3 -3
  42. package/out/500/index.html +3 -3
  43. package/out/_next/static/WEaZ5SW9HLnJWzXs84JMH/_buildManifest.js +266 -0
  44. package/out/_next/static/chunks/{2_0v0fw6x71zy.js → 00p6gl0n0kga2.js} +4 -4
  45. package/out/_next/static/chunks/0389l__ljgq-b.js +1 -0
  46. package/out/_next/static/chunks/039xltalow0bh.js +1 -0
  47. package/out/_next/static/chunks/{0w9d4swf95hvu.js → 03awz8e25u6-9.js} +1 -1
  48. package/out/_next/static/chunks/04kydtjv2qqb1.js +39 -0
  49. package/out/_next/static/chunks/05ghb-a4hshp1.js +24 -0
  50. package/out/_next/static/chunks/06gqojz2tfk7h.js +33 -0
  51. package/out/_next/static/chunks/08e3-wndual-j.js +183 -0
  52. package/out/_next/static/chunks/{41c4n9whpyrjc.js → 08gngcgmdigfl.js} +2 -2
  53. package/out/_next/static/chunks/{3e7d8sb4289js.js → 08htfpcq8k2ct.js} +1 -1
  54. package/out/_next/static/chunks/{45c05mbjow5wz.js → 0ao00r36i0nko.js} +1 -1
  55. package/out/_next/static/chunks/{01isyk4v59s_4.js → 0az9r1m1m5nw7.js} +2 -2
  56. package/out/_next/static/chunks/{2q988j4vovsiy.js → 0bahbwxzev843.js} +3 -3
  57. package/out/_next/static/chunks/{1z-etrje5tsj6.js → 0ejd4so6pfsb9.js} +2 -1
  58. package/out/_next/static/chunks/0f0aouv41459l.js +99 -0
  59. package/out/_next/static/chunks/{3fevbt4ysloo8.js → 0f4mwm9gegsvc.js} +3 -3
  60. package/out/_next/static/chunks/{1fehej_7rgmmo.js → 0ffdde8s4b7e2.js} +1 -1
  61. package/out/_next/static/chunks/0ftb36h7poyeo.js +235 -0
  62. package/out/_next/static/chunks/{1z1d11slpalrq.js → 0gclli_nyb0px.js} +1 -1
  63. package/out/_next/static/chunks/{0hv3x0mo1tt7i.js → 0hv62tllrjbgx.js} +2 -2
  64. package/out/_next/static/chunks/0ik3suboifvvc.js +1 -0
  65. package/out/_next/static/chunks/{3exy4ii5maq4x.js → 0jsbw2npug66o.js} +1 -1
  66. package/out/_next/static/chunks/0lgoprkr2wj68.js +12 -0
  67. package/out/_next/static/chunks/0mpgc4f7hc1dd.js +7 -0
  68. package/out/_next/static/chunks/{2y11qf38baxpu.js → 0oauw10y-zu7q.js} +5 -5
  69. package/out/_next/static/chunks/0pnifxx4n6jz4.js +30 -0
  70. package/out/_next/static/chunks/{2bxdh-td1el8z.js → 0rj53mrsrvu49.js} +1 -1
  71. package/out/_next/static/chunks/{3ek680kdzjdr7.js → 0v2f0xq8mp63h.js} +1 -1
  72. package/out/_next/static/chunks/{32whi9clpxjd0.js → 0wvck3kmtd8h3.js} +1 -1
  73. package/out/_next/static/chunks/{3h6a3clw5m5ro.js → 0y-xf7e4lgmru.js} +1 -1
  74. package/out/_next/static/chunks/12z0--swhgre2.js +33 -0
  75. package/out/_next/static/chunks/139wqbl161pdw.js +12 -0
  76. package/out/_next/static/chunks/{1hzt0aoixrv4_.js → 13sl42_jx13hh.js} +2 -2
  77. package/out/_next/static/chunks/14wav1vmqi2oo.js +371 -0
  78. package/out/_next/static/chunks/{3b1kt-r_75q1a.js → 15oodwh44nrve.js} +2 -2
  79. package/out/_next/static/chunks/15ullli2vlj87.js +8 -0
  80. package/out/_next/static/chunks/17g3a6iz0s59f.js +837 -0
  81. package/out/_next/static/chunks/{2m38nntt3z8zi.js → 19-fs9eq1syvw.js} +3 -3
  82. package/out/_next/static/chunks/{3fu072xwkf88o.js → 195cwzh3q1i0h.js} +2 -1
  83. package/out/_next/static/chunks/1fou9xz0_rm6d.js +5 -0
  84. package/out/_next/static/chunks/{37jjn1wguhj-a.js → 1k1b69hvwr-0g.js} +1 -1
  85. package/out/_next/static/chunks/{0rrhyxuk32t3n.js → 1kyjdq0bnkw10.js} +2 -2
  86. package/out/_next/static/chunks/{0v1tb34y7e1y4.js → 1l2ix83845lui.js} +1 -1
  87. package/out/_next/static/chunks/{3x_gia2m5w9_l.js → 1ossmsdseqyeu.js} +6 -6
  88. package/out/_next/static/chunks/1pm7k55e4pfpm.js +59 -0
  89. package/out/_next/static/chunks/1pqyz1opm5_7r.js +1 -0
  90. package/out/_next/static/chunks/{39moagn46hde9.js → 1qd4fupa708s4.js} +2 -2
  91. package/out/_next/static/chunks/{3o-h2po9z09dk.js → 1t1ecrjkykbv1.js} +1 -1
  92. package/out/_next/static/chunks/{28o6402k4vuky.js → 1tej7js0fwv1h.js} +3 -3
  93. package/out/_next/static/chunks/1th8knz7txt9f.js +5 -0
  94. package/out/_next/static/chunks/1tuf110jbpl_r.js +1 -0
  95. package/out/_next/static/chunks/1tzkeg4c-br-z.js +17 -0
  96. package/out/_next/static/chunks/{0_3suta3t3lus.js → 1u7l4tos3wysc.js} +2 -2
  97. package/out/_next/static/chunks/1v0ag3k96c56s.js +1 -0
  98. package/out/_next/static/chunks/1w6iuc_ba9g-3.js +3 -0
  99. package/out/_next/static/chunks/1x7cm_fuwp9m8.js +1 -0
  100. package/out/_next/static/chunks/1yv22tvuqofr_.js +296 -0
  101. package/out/_next/static/chunks/{0rt4le6syjqdj.js → 2-s-hteo3lrnj.js} +12 -12
  102. package/out/_next/static/chunks/20p146xfq-xrq.js +5 -0
  103. package/out/_next/static/chunks/{3ujdligrod612.js → 20t2g2u3jhtvy.js} +1 -1
  104. package/out/_next/static/chunks/{1ug1ie2lrhi0a.js → 231mhpexhdm2g.js} +1 -1
  105. package/out/_next/static/chunks/24zfmgc4cu-n1.js +9 -0
  106. package/out/_next/static/chunks/{44b7_q6pkf1k9.js → 25b_pi2_ro9yy.js} +1 -1
  107. package/out/_next/static/chunks/{2uo6puoi0y082.js → 2693w1263bb3s.js} +1 -1
  108. package/out/_next/static/chunks/{0i481ym5-ss1t.js → 26yarz_db5ms0.js} +1 -1
  109. package/out/_next/static/chunks/28xbb7hkhkoup.js +1 -0
  110. package/out/_next/static/chunks/299pou8yuoq6b.js +116 -0
  111. package/out/_next/static/chunks/2_cq751vth7u7.js +81 -0
  112. package/out/_next/static/chunks/2a2cayocu5mc3.js +1 -0
  113. package/out/_next/static/chunks/{1th1-x1szvnq8.js → 2dn2ma73q9ye0.js} +1 -1
  114. package/out/_next/static/chunks/{3www97fxyknos.js → 2fnn6q9fmhu3s.js} +1 -1
  115. package/out/_next/static/chunks/{3pls-kicv4xu9.js → 2ga95n_v_6_7b.js} +1 -1
  116. package/out/_next/static/chunks/{1q7wxp4rlhy0x.js → 2gfljy_oo0nnr.js} +5 -5
  117. package/out/_next/static/chunks/{0qv2nce7okzy5.js → 2gfot_-pkeohl.js} +1 -1
  118. package/out/_next/static/chunks/2h4bxz0oww5pk.js +4 -0
  119. package/out/_next/static/chunks/2j4g1tyyp8ta1.js +1 -0
  120. package/out/_next/static/chunks/2mt78e61hd_4p.js +100 -0
  121. package/out/_next/static/chunks/{05474mknnr_tw.js → 2rri_ex6s-d8g.js} +1 -1
  122. package/out/_next/static/chunks/{2ud5j0_nqocf4.js → 2sc6dwzzc2t7n.js} +1 -1
  123. package/out/_next/static/chunks/2texlu369byon.js +1 -0
  124. package/out/_next/static/chunks/{3lr6hkso67d68.js → 2tq8sqd3-wavo.js} +2 -2
  125. package/out/_next/static/chunks/2u2obxhc_n6xk.js +119 -0
  126. package/out/_next/static/chunks/{157ndq6b9jcvv.js → 2u4cc_r_qo0s4.js} +4 -4
  127. package/out/_next/static/chunks/2u6n7ohruqpxp.js +1 -0
  128. package/out/_next/static/chunks/2u9myo1sjc-q0.js +276 -0
  129. package/out/_next/static/chunks/{0we1tw4xvdb7o.js → 2ubbeh02scr2l.js} +2 -2
  130. package/out/_next/static/chunks/{1w6gc_cygbi6h.js → 2v_bdu-atp2qq.js} +1 -1
  131. package/out/_next/static/chunks/{1gv0k-w7m83om.js → 2vyv371s8n48m.js} +2 -2
  132. package/out/_next/static/chunks/{24caedynuzux0.js → 2xd_5hafdvicw.js} +1 -1
  133. package/out/_next/static/chunks/2ym9q2u0yw0m8.js +326 -0
  134. package/out/_next/static/chunks/{131uuhqexo4si.js → 3-grp4-_b_uin.js} +2 -1
  135. package/out/_next/static/chunks/{2s-0q8i8lr2p2.js → 31i76bjr7wp3u.js} +1 -1
  136. package/out/_next/static/chunks/{1j2gw9gyg8j80.js → 32thgoqghnqfk.js} +2 -2
  137. package/out/_next/static/chunks/{3hmoy4f23y1s4.js → 33svzh7wrh2ca.js} +4 -4
  138. package/out/_next/static/chunks/{345s7967cwd02.js → 33v1m9okpss0r.js} +1 -1
  139. package/out/_next/static/chunks/34gspkpv7wikw.js +8 -0
  140. package/out/_next/static/chunks/{0mcu2o1ir2t_w.js → 35zhvtyq31ani.js} +1 -1
  141. package/out/_next/static/chunks/36vqjcd_y2j30.js +1 -0
  142. package/out/_next/static/chunks/{1msc4qrgaanh7.js → 38043sp-g7lor.js} +2 -2
  143. package/out/_next/static/chunks/395bs5xmcnl_3.js +31 -0
  144. package/out/_next/static/chunks/{2w3z7kqh6nbmw.js → 3_jqu6hq_bq0s.js} +2 -2
  145. package/out/_next/static/chunks/{153-_av1r1ssb.js → 3_tuio1shb_8w.js} +1 -1
  146. package/out/_next/static/chunks/{0br42_xli8-2x.js → 3_u_uxeaysv2y.js} +1 -1
  147. package/out/_next/static/chunks/{1bypzyw5fs3w2.js → 3e9x78_cfl4gs.js} +4 -4
  148. package/out/_next/static/chunks/3i7obrooylax2.js +1 -0
  149. package/out/_next/static/chunks/3ij_85v4doyfu.js +2 -0
  150. package/out/_next/static/chunks/3jgmo9q79w1-c.js +290 -0
  151. package/out/_next/static/chunks/{42dygj7ul4k54.js → 3jp_xvjzuj3ts.js} +2 -2
  152. package/out/_next/static/chunks/{1k06h8wbfrx_v.js → 3l9ixfzewn8ct.js} +1 -1
  153. package/out/_next/static/chunks/3ltrxqm61t2um.js +1 -0
  154. package/out/_next/static/chunks/{1bxznw06g-5u2.js → 3qt1oiw306jtf.js} +2 -2
  155. package/out/_next/static/chunks/{0zqdvl0b4w5nc.js → 3s5_6nq23zb_5.js} +1 -1
  156. package/out/_next/static/chunks/{1vzs8hvrsoslf.js → 3s_74oi_rqb7q.js} +1 -1
  157. package/out/_next/static/chunks/{2-qo63s4vlxol.js → 3skconxcf6r_s.js} +5 -5
  158. package/out/_next/static/chunks/{3xs_undkbcqp7.js → 3ud-crkzgoj7q.js} +3 -3
  159. package/out/_next/static/chunks/{2u64ldp2xfy8a.js → 3wr9v36meolw7.js} +71 -70
  160. package/out/_next/static/chunks/3xun85a44o067.js +1 -0
  161. package/out/_next/static/chunks/{0cdk-eqghrgee.js → 407elvwrmcfn6.js} +1 -1
  162. package/out/_next/static/chunks/40j4nxaeofft-.js +1 -0
  163. package/out/_next/static/chunks/{3k01tdsm6l20w.js → 42ijceja_327z.js} +2 -2
  164. package/out/_next/static/chunks/440jwge6wnjj6.js +1 -0
  165. package/out/_next/static/chunks/44xnlcqhabyj6.js +174 -0
  166. package/out/_offline/index.html +3 -3
  167. package/out/account/forgot-password/index.html +3 -3
  168. package/out/account/index.html +3 -3
  169. package/out/assortments/AssortmentDetailPage/index.html +3 -3
  170. package/out/assortments/index.html +3 -3
  171. package/out/assortments/new/index.html +3 -3
  172. package/out/copilot/index.html +3 -3
  173. package/out/country/CountryDetailPage/index.html +3 -3
  174. package/out/country/index.html +3 -3
  175. package/out/country/new/index.html +3 -3
  176. package/out/currency/CurrencyDetailPage/index.html +3 -3
  177. package/out/currency/index.html +3 -3
  178. package/out/currency/new/index.html +3 -3
  179. package/out/delivery-provider/DeliveryProviderDetailPage/index.html +3 -3
  180. package/out/delivery-provider/index.html +3 -3
  181. package/out/delivery-provider/new/index.html +3 -3
  182. package/out/enrollments/EnrollmentDetailPage/index.html +3 -3
  183. package/out/enrollments/index.html +3 -3
  184. package/out/events/EventDetailPage/index.html +3 -3
  185. package/out/events/index.html +3 -3
  186. package/out/exports/index.html +3 -3
  187. package/out/ext/[[...slug]]/index.html +3 -3
  188. package/out/external/index.html +3 -3
  189. package/out/filters/FilterDetailPage/index.html +3 -3
  190. package/out/filters/index.html +3 -3
  191. package/out/filters/new/index.html +3 -3
  192. package/out/index.html +3 -3
  193. package/out/install/index.html +3 -3
  194. package/out/language/LanguageDetailPage/index.html +3 -3
  195. package/out/language/index.html +3 -3
  196. package/out/language/new/index.html +3 -3
  197. package/out/log-in/index.html +3 -3
  198. package/out/login-code/index.html +12 -0
  199. package/out/orders/OrderDetailPage/index.html +3 -3
  200. package/out/orders/index.html +3 -3
  201. package/out/payment-provider/PaymentProviderDetailPage/index.html +3 -3
  202. package/out/payment-provider/index.html +3 -3
  203. package/out/payment-provider/new/index.html +3 -3
  204. package/out/products/ProductDetailPage/index.html +3 -3
  205. package/out/products/index.html +3 -3
  206. package/out/products/new/index.html +3 -3
  207. package/out/quotations/QuotationDetailPage/index.html +3 -3
  208. package/out/quotations/index.html +3 -3
  209. package/out/reset-password/index.html +3 -3
  210. package/out/sign-up/index.html +3 -3
  211. package/out/styleguide/index.html +3 -3
  212. package/out/tokens/TokenDetailPage/index.html +3 -3
  213. package/out/tokens/index.html +3 -3
  214. package/out/users/UserDetailPage/index.html +3 -3
  215. package/out/users/index.html +3 -3
  216. package/out/users/new/index.html +3 -3
  217. package/out/verify-email/index.html +3 -3
  218. package/out/warehousing-provider/WarehousingProviderDetailPage/index.html +3 -3
  219. package/out/warehousing-provider/index.html +3 -3
  220. package/out/warehousing-provider/new/index.html +3 -3
  221. package/out/works/WorkDetailPage/index.html +3 -3
  222. package/out/works/WorkQueueListView/index.html +3 -3
  223. package/out/works/index.html +3 -3
  224. package/out/works/management/index.html +3 -3
  225. package/package.json +1 -1
  226. package/src/modules/accounts/hooks/useLoginWithLoginCode.ts +45 -0
  227. package/src/modules/accounts/hooks/useRequestLoginCode.ts +31 -0
  228. package/src/modules/accounts/index.ts +2 -0
  229. package/src/modules/common/hooks/useShopInfo.ts +1 -0
  230. package/src/modules/enrollment/fragments/EnrollmentDetailFragment.ts +3 -2
  231. package/src/modules/enrollment/hooks/useSuspendEnrollment.ts +5 -3
  232. package/src/modules/enrollment/hooks/useTerminateEnrollment.ts +15 -3
  233. package/src/modules/enrollment/hooks/useUpdateEnrollmentExpires.ts +38 -0
  234. package/src/modules/order/fragments/OrderDetailFragment.ts +0 -1
  235. package/src/modules/product/hooks/useProductTokenization.ts +1 -0
  236. package/src/modules/product/hooks/useProductsCount.ts +4 -0
  237. package/src/modules/product/hooks/useUpdateProductCommerce.ts +2 -13
  238. package/src/modules/product/hooks/useUpdateProductTokenization.ts +8 -1
  239. package/src/modules/product/index.ts +3 -0
  240. package/src/modules/quotation/fragments/QuotationDetailFragment.ts +1 -0
  241. package/src/sdk/README.md +1 -1
  242. package/out/_next/static/bg3Z_ZBjStiTvJAHlsPDE/_buildManifest.js +0 -262
  243. package/out/_next/static/chunks/00wlebfe9j80r.js +0 -24
  244. package/out/_next/static/chunks/03x_mgpai_kbn.js +0 -1
  245. package/out/_next/static/chunks/04327_1fq5i7-.js +0 -9
  246. package/out/_next/static/chunks/0_a5fzdztv84p.js +0 -272
  247. package/out/_next/static/chunks/0d54jo566j9ka.js +0 -12
  248. package/out/_next/static/chunks/0gfia1t8drmnx.js +0 -182
  249. package/out/_next/static/chunks/0gwd6ju8j_bwr.js +0 -39
  250. package/out/_next/static/chunks/0j46qnxaxeqk_.js +0 -1
  251. package/out/_next/static/chunks/0op3htrvd-ix6.js +0 -5
  252. package/out/_next/static/chunks/1-wbp_4f-c4-3.js +0 -837
  253. package/out/_next/static/chunks/11vnr4kb9qkjr.js +0 -1
  254. package/out/_next/static/chunks/14eqp21pspjud.js +0 -234
  255. package/out/_next/static/chunks/1eokbzdgdicpa.js +0 -33
  256. package/out/_next/static/chunks/1f0t23r6y0hni.js +0 -1
  257. package/out/_next/static/chunks/1ia6hdgf7pj9y.js +0 -174
  258. package/out/_next/static/chunks/1oqc8etm-romv.js +0 -1
  259. package/out/_next/static/chunks/1tbd6m-xvx0um.js +0 -353
  260. package/out/_next/static/chunks/1tw97cvdosb89.js +0 -5
  261. package/out/_next/static/chunks/1ubmbegreszhk.js +0 -1
  262. package/out/_next/static/chunks/1uw7hr3o4w5cj.js +0 -8
  263. package/out/_next/static/chunks/1xybsisfyvqrj.js +0 -115
  264. package/out/_next/static/chunks/1zdral15la_p7.js +0 -99
  265. package/out/_next/static/chunks/2-4610weysas_.js +0 -1
  266. package/out/_next/static/chunks/22duvsj-priip.js +0 -7
  267. package/out/_next/static/chunks/22rdge7enz4nd.js +0 -12
  268. package/out/_next/static/chunks/2b4k5t_myq-pa.js +0 -1
  269. package/out/_next/static/chunks/2dz0_3jf4m9cy.js +0 -31
  270. package/out/_next/static/chunks/2erqawjj0rnih.js +0 -117
  271. package/out/_next/static/chunks/2grm6dtosrvoq.js +0 -1
  272. package/out/_next/static/chunks/2imf3_f1_ex86.js +0 -1
  273. package/out/_next/static/chunks/2iwst7mjldlcz.js +0 -1
  274. package/out/_next/static/chunks/2ja0dztzyw8zw.js +0 -1
  275. package/out/_next/static/chunks/2ja1--2x_gs49.js +0 -83
  276. package/out/_next/static/chunks/2lec5u8obskt6.js +0 -5
  277. package/out/_next/static/chunks/2pogx3xggqd8y.js +0 -1
  278. package/out/_next/static/chunks/3205eg3ochzp4.js +0 -297
  279. package/out/_next/static/chunks/3368kg846t33d.js +0 -57
  280. package/out/_next/static/chunks/33oz-znvi5-m6.js +0 -1
  281. package/out/_next/static/chunks/3e38rrs6dszgt.js +0 -8
  282. package/out/_next/static/chunks/3eth7s2-06yuz.js +0 -1
  283. package/out/_next/static/chunks/3i4_3b36nutw7.js +0 -33
  284. package/out/_next/static/chunks/3lzin6_25n8rs.js +0 -30
  285. package/out/_next/static/chunks/3onharcadlou0.js +0 -327
  286. package/out/_next/static/chunks/3tg_clsx6ux4o.js +0 -1
  287. package/out/_next/static/chunks/3ttz1zgoq3xmp.js +0 -1
  288. package/out/_next/static/chunks/3ytp87o76hzmx.js +0 -100
  289. package/out/_next/static/chunks/40kvu3lk3s9h2.js +0 -276
  290. package/out/_next/static/chunks/44qc0zn0tudui.js +0 -2
  291. /package/out/_next/static/{bg3Z_ZBjStiTvJAHlsPDE → WEaZ5SW9HLnJWzXs84JMH}/_clientMiddlewareManifest.js +0 -0
  292. /package/out/_next/static/{bg3Z_ZBjStiTvJAHlsPDE → WEaZ5SW9HLnJWzXs84JMH}/_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),s=e.i(3326);e.i(51523);var a=e.i(19518),i=e.i(25705),l=e.i(50243),r=e.i(94330),d=e.i(43054),n=e.i(95336),o=e.i(16113),c=e.i(82191),u=e.i(31004),m=e.i(76929),f=e.i(27927),p=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),w=e.i(77035),N=e.i(56902),M=e.i(72264),P=e.i(56779),_=e.i(19051),I=e.i(11907),C=e.i(34948),k=e.i(41418),$=e.i(58971),S=e.i(91788),T=e.i(44112),V=e.i(5505),D=e.i(53296),E=e.i(59080),R=e.i(32171),q=e.i(1880);let A=E.a`
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(3326);e.i(51523);var s=e.i(19518),i=e.i(25705),l=e.i(50243),r=e.i(94330),d=e.i(43054),n=e.i(95336),o=e.i(16113),c=e.i(82191),u=e.i(31004),m=e.i(76929),f=e.i(27927),p=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),w=e.i(77035),N=e.i(56902),M=e.i(72264),P=e.i(56779),_=e.i(19051),I=e.i(11907),C=e.i(34948),k=e.i(41418),$=e.i(58971),S=e.i(91788),T=e.i(44112),V=e.i(5505),D=e.i(53296),E=e.i(59080),R=e.i(32171),q=e.i(1880);let A=E.a`
2
2
  fragment ProductAssignmentFragment on ProductVariationAssignment {
3
3
  _id
4
4
  vectors {
@@ -66,7 +66,7 @@
66
66
  }
67
67
  }
68
68
  ${A}
69
- `;var L=e.i(8918);let U=(e,t,s)=>{let a=e[s],i=[];return(a?.values.filter(e=>e.length).forEach(e=>{let s={};s[a.key]=e,t.length>0?t.forEach(e=>{i.push({...e,...s})}):i.push(s)}),e.length>s+1)?U(e,i,s+1):Array.from(new Set(i.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),X=e.i(2765),K=e.i(15971),W=e.i(6607),Z=e.i(76204);let H=E.a`
69
+ `;var U=e.i(8918);let L=(e,t,a)=>{let s=e[a],i=[];return(s?.values.filter(e=>e.length).forEach(e=>{let a={};a[s.key]=e,t.length>0?t.forEach(e=>{i.push({...e,...a})}):i.push(a)}),e.length>a+1)?L(e,i,a+1):Array.from(new Set(i.map(e=>JSON.stringify(e)))).map(e=>JSON.parse(e))},F=({_id:e,texts:t})=>({value:e,label:t?.title});var B=e.i(21623),Q=e.i(24557),z=e.i(24994),X=e.i(2765),K=e.i(15971),W=e.i(6607),Z=e.i(76204);let H=E.a`
70
70
  mutation AddProductAssignment(
71
71
  $proxyId: ID!
72
72
  $productId: ID!
@@ -80,7 +80,7 @@
80
80
  _id
81
81
  }
82
82
  }
83
- `,G=()=>{let[e]=(0,Z.f)(H);return{addProductAssignment:async({productId:t,proxyId:s,vectors:a})=>e({variables:{productId:t,proxyId:s,vectors:a},refetchQueries:["ProductAssignments"]})}};var J=e.i(24112);let Y=E.a`
83
+ `,G=()=>{let[e]=(0,Z.f)(H);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=E.a`
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),es=e.i(98949),ea=e.i(69211),ei=e.i(16984),el=e.i(21128);let er={SimpleProduct:"SIMPLE_PRODUCT",BundleProduct:"BUNDLE_PRODUCT",PlanProduct:"PLAN_PRODUCT",ConfigurableProduct:"CONFIGURABLE_PRODUCT",TokenizedProduct:"TOKENIZED_PRODUCT"};e.s(["f",0,er],10878);var ed=e.i(38994);let en=function({proxyProduct:e,vectors:t,onSuccess:a,locale:i}){let{createProduct:l}=(0,ed.f)(),{addProductAssignment:r}=G(),{formatMessage:d}=(0,s.X)();return async({title:s,type:n})=>{let o=[{title:s,slug:s.toLowerCase().replace(/\s+/g,"-"),locale:i}],{data:c}=await l({product:{type:n||er.SimpleProduct},texts:o}),u=c?.createProduct,m=u?._id;if(!m)throw Error(d({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return await r({productId:m,proxyId:e?._id,vectors:t}),a?.(u),{success:!0}}};var eo=e.i(10685),ec=e.i(57561);let eu=({proxyProduct:e,vectors:i,onSuccess:l})=>{let{formatMessage:r}=(0,s.X)(),{selectedLocale:d}=(0,ec.f)(),n=en({onSuccess:l,proxyProduct:e,vectors:i,locale:d}),{hasRole:o}=(0,$.f)(),c=(0,S.useMemo)(()=>i.map(({value:e})=>e),[i]),u=(0,S.useMemo)(()=>{let t=e?.texts?.title??"";return`${c.join("-")} ${t}`.trim()},[c,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}}}},f=r({id:"product-scaffolded-success",defaultMessage:"Product scaffolded successfully"}),p=(0,es.f)({submit:m,successMessage:f,enableReinitialize:!0,initialValues:{title:u,type:a.f.SimpleProduct}});return(0,t.jsxs)(ea.f,{className:"mt-3 rounded-md",form:p,children:[(0,t.jsxs)("div",{className:"p-5 pb-7 sm:max-w-full flex flex-col gap-3",children:[(0,t.jsx)(ei.f,{name:"title",id:"title",label:r({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.f,{className:"mt-1 w-full",label:r({id:"type",defaultMessage:"Type"}),placeholder:r({id:"type",defaultMessage:"Type"}),required:!0,name:"type",options:Object.fromEntries(Object.entries(a.f).map(([e,t])=>[t,e]))})]}),o(a.C.ManageProducts)&&(0,t.jsx)("div",{className:"border-t border-t-border-subtle bg-surface-subtle p-5 text-right",children:(0,t.jsx)(el.f,{label:r({id:"scaffold_product",defaultMessage:"Scaffold"})})})]})},em=({columns:e,variationProduct:i,product:l,loading:r,disabled:d,proxyId:n,columnKeys:o})=>{let{formatMessage:c}=(0,s.X)(),[u,m]=(0,S.useState)(""),{addProductAssignment:f}=G(),{removeProductAssignment:p}=(()=>{let[e]=(0,Z.f)(Y);return{removeProductAssignment:async({proxyId:t,vectors:s})=>e({variables:{proxyId:t,vectors:s},refetchQueries:["ProductAssignments"]})}})(),{hasRole:x}=(0,$.f)(),{setModal:g}=(0,W.f)(),{products:h}=(0,J.f)({queryString:u,limit:50,sort:[{key:"created",value:a.A.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 f({proxyId:n,productId:e,vectors:v})},[v,f,n]),y=(0,S.useCallback)(async()=>{await g((0,t.jsx)(K.f,{onCancelClick:async()=>g(""),message:c({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 p({proxyId:n,vectors:v})},okText:c({id:"delete_variation_assignment",defaultMessage:"Delete assignment"})}))},[n,v,c,g,p]),j=(0,S.useMemo)(()=>(0,X.f)(200)(m),[]),w=!i&&l?.variations?.length!==e?.length,N=(0,S.useMemo)(()=>h?.map(F).filter(({value:e})=>e!==n)||[],[h,n]),M=async()=>{await g((0,t.jsx)(eu,{proxyProduct:l,vectors:v,onSuccess:()=>{g(null)}}))};return(0,t.jsxs)(L.f.Row,{children:[e.map((e,s)=>(0,t.jsx)(L.f.Cell,{className:"font-medium",children:e},`${e}`)),(0,t.jsx)(L.f.Cell,{children:i?(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)(ee.default,{href:`/products?slug=${(0,q.U)(i)}`,children:(0,t.jsx)("span",{className:"text-green-700 dark:text-green-300 font-medium",children:i?.texts?.title})})}):w?(0,t.jsx)("div",{className:"mt-1 text-sm text-rose-600 italic",children:c({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.f,{name:"productId",placeholder:c({id:"search_product",defaultMessage:"Search product"}),isLoading:r,disabled:d,onChange:b,onSearch:j,options:N,className:"mt-1 w-full"})}),x(a.C.ManageProducts)&&(0,t.jsx)(Q.f,{onClick:M,children:(0,t.jsx)(et.f,{className:"h-5 w-5"})})]})})}),(0,t.jsx)(L.f.Cell,{children:i&&i._id&&(0,t.jsx)(Q.f,{variant:"danger",size:"xs",rounded:"full",icon:(0,t.jsx)(B.f,{className:"h-5 w-5"}),onClick:y})})]})};var ef=e.i(82078);let ep=({proxyId:e,disabled:a=!1})=>{let{formatMessage:i}=(0,s.X)(),{product:l,loading:r}=(({productId:e=null,slug:t=null}={})=>{let s=(0,q.Q)(t),{data:a,loading:i,error:l}=(0,R.f)(O,{skip:!e&&!s,variables:{productId:e||s}});return{product:a?.product,loading:i,error:l}})({productId:e}),d=l&&l?.variations||[],n=l&&l.assignments||[],o=(0,S.useMemo)(()=>d.filter(({options:e})=>e.length).map(({key:e})=>e),[d]),c=(0,S.useMemo)(()=>d.map(({key:e,options:t})=>({values:t?.map(e=>e.value),key:e})),[d]),u=(0,S.useMemo)(()=>{let e=c.filter(({values:e})=>e?.length);return e.length>0?U(e,[],0):[]},[c]),m=(0,S.useMemo)(()=>n.map(e=>{let t={};return o.forEach(s=>{let a=e.vectors.find(e=>e.variation?.key===s);t[s]=a?.option?.value??""}),t}),[n,o]),f=(0,S.useMemo)(()=>{let e=[...u,...m],t=new Set;return e.filter(e=>{let s=Object.values(e).join("::");return!t.has(s)&&(t.add(s),!0)})},[u,m]),p=(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)(()=>f.map(e=>{let t=p.find(({keys:t})=>Object.entries(t).every(([t,s])=>e[t]===s));return{_id:Object.values(e).join("::"),product:t?.product,columns:Object.values(e),columnsText:Object.values(e)}}),[f,p]),g=(0,S.useMemo)(()=>d.length>0,[d]),h=(0,S.useMemo)(()=>d.some(e=>e.options&&e.options.length>0),[d]);return(0,t.jsxs)(V.U,{children:[(0,t.jsx)(ef.f,{title:i({id:"product_assignments_explanation_title",defaultMessage:"About Product Assignments"}),description:i({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.f,{className:"w-8 h-8 text-gray-400"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-text-primary mb-2",children:i({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)(D.f,{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)(L.f,{children:[(0,t.jsxs)(L.f.Row,{children:[o.map(e=>(0,t.jsx)(L.f.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:d.find(t=>t.key===e)?.texts?.title||e},e)),(0,t.jsx)(L.f.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:i({id:"assigned_product_column_header",defaultMessage:"Assigned Product"})}),(0,t.jsx)(L.f.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:i({id:"actions_column_header",defaultMessage:"Actions"})})]}),x.length>0&&x.map(({_id:s,columns:i,product:d})=>(0,t.jsx)(em,{columns:i,disabled:a,loading:r,product:l,variationProduct:d,columnKeys:o,proxyId:e},s))]})]}),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.f,{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:i({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:i({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=E.a`
92
+ `;var ee=e.i(41158),et=e.i(57748),ea=e.i(98949),es=e.i(69211),ei=e.i(16984),el=e.i(21128);let er={SimpleProduct:"SIMPLE_PRODUCT",BundleProduct:"BUNDLE_PRODUCT",PlanProduct:"PLAN_PRODUCT",ConfigurableProduct:"CONFIGURABLE_PRODUCT",TokenizedProduct:"TOKENIZED_PRODUCT"};e.s(["f",0,er],10878);var ed=e.i(38994);let en=function({proxyProduct:e,vectors:t,onSuccess:s,locale:i}){let{createProduct:l}=(0,ed.f)(),{addProductAssignment:r}=G(),{formatMessage:d}=(0,a.X)();return async({title:a,type:n})=>{let o=[{title:a,slug:a.toLowerCase().replace(/\s+/g,"-"),locale:i}],{data:c}=await l({product:{type:n||er.SimpleProduct},texts:o}),u=c?.createProduct,m=u?._id;if(!m)throw Error(d({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return await r({productId:m,proxyId:e?._id,vectors:t}),s?.(u),{success:!0}}};var eo=e.i(10685),ec=e.i(57561);let eu=({proxyProduct:e,vectors:i,onSuccess:l})=>{let{formatMessage:r}=(0,a.X)(),{selectedLocale:d}=(0,ec.f)(),n=en({onSuccess:l,proxyProduct:e,vectors:i,locale:d}),{hasRole:o}=(0,$.f)(),c=(0,S.useMemo)(()=>i.map(({value:e})=>e),[i]),u=(0,S.useMemo)(()=>{let t=e?.texts?.title??"";return`${c.join("-")} ${t}`.trim()},[c,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}}}},f=r({id:"product-scaffolded-success",defaultMessage:"Product scaffolded successfully"}),p=(0,ea.f)({submit:m,successMessage:f,enableReinitialize:!0,initialValues:{title:u,type:s.f.SimpleProduct}});return(0,t.jsxs)(es.f,{className:"mt-3 rounded-md",form:p,children:[(0,t.jsxs)("div",{className:"p-5 pb-7 sm:max-w-full flex flex-col gap-3",children:[(0,t.jsx)(ei.f,{name:"title",id:"title",label:r({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.f,{className:"mt-1 w-full",label:r({id:"type",defaultMessage:"Type"}),placeholder:r({id:"type",defaultMessage:"Type"}),required:!0,name:"type",options:Object.fromEntries(Object.entries(s.f).map(([e,t])=>[t,e]))})]}),o(s.C.ManageProducts)&&(0,t.jsx)("div",{className:"border-t border-t-border-subtle bg-surface-subtle p-5 text-right",children:(0,t.jsx)(el.f,{label:r({id:"scaffold_product",defaultMessage:"Scaffold"})})})]})},em=({columns:e,variationProduct:i,product:l,loading:r,disabled:d,proxyId:n,columnKeys:o})=>{let{formatMessage:c}=(0,a.X)(),[u,m]=(0,S.useState)(""),{addProductAssignment:f}=G(),{removeProductAssignment:p}=(()=>{let[e]=(0,Z.f)(Y);return{removeProductAssignment:async({proxyId:t,vectors:a})=>e({variables:{proxyId:t,vectors:a},refetchQueries:["ProductAssignments"]})}})(),{hasRole:x}=(0,$.f)(),{setModal:g}=(0,W.f)(),{products:h}=(0,J.f)({queryString:u,limit:50,sort:[{key:"created",value:s.B.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 f({proxyId:n,productId:e,vectors:v})},[v,f,n]),y=(0,S.useCallback)(async()=>{await g((0,t.jsx)(K.f,{onCancelClick:async()=>g(""),message:c({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 p({proxyId:n,vectors:v})},okText:c({id:"delete_variation_assignment",defaultMessage:"Delete assignment"})}))},[n,v,c,g,p]),j=(0,S.useMemo)(()=>(0,X.f)(200)(m),[]),w=!i&&l?.variations?.length!==e?.length,N=(0,S.useMemo)(()=>h?.map(F).filter(({value:e})=>e!==n)||[],[h,n]),M=async()=>{await g((0,t.jsx)(eu,{proxyProduct:l,vectors:v,onSuccess:()=>{g(null)}}))};return(0,t.jsxs)(U.f.Row,{children:[e.map((e,a)=>(0,t.jsx)(U.f.Cell,{className:"font-medium",children:e},`${e}`)),(0,t.jsx)(U.f.Cell,{children:i?(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)(ee.default,{href:`/products?slug=${(0,q.U)(i)}`,children:(0,t.jsx)("span",{className:"text-green-700 dark:text-green-300 font-medium",children:i?.texts?.title})})}):w?(0,t.jsx)("div",{className:"mt-1 text-sm text-rose-600 italic",children:c({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.f,{name:"productId",placeholder:c({id:"search_product",defaultMessage:"Search product"}),isLoading:r,disabled:d,onChange:b,onSearch:j,options:N,className:"mt-1 w-full"})}),x(s.C.ManageProducts)&&(0,t.jsx)(B.f,{onClick:M,children:(0,t.jsx)(et.f,{className:"h-5 w-5"})})]})})}),(0,t.jsx)(U.f.Cell,{children:i&&i._id&&(0,t.jsx)(B.f,{variant:"danger",size:"xs",rounded:"full",icon:(0,t.jsx)(Q.f,{className:"h-5 w-5"}),onClick:y})})]})};var ef=e.i(82078);let ep=({proxyId:e,disabled:s=!1})=>{let{formatMessage:i}=(0,a.X)(),{product:l,loading:r}=(({productId:e=null,slug:t=null}={})=>{let a=(0,q.Q)(t),{data:s,loading:i,error:l}=(0,R.f)(O,{skip:!e&&!a,variables:{productId:e||a}});return{product:s?.product,loading:i,error:l}})({productId:e}),d=l&&l?.variations||[],n=l&&l.assignments||[],o=(0,S.useMemo)(()=>d.filter(({options:e})=>e.length).map(({key:e})=>e),[d]),c=(0,S.useMemo)(()=>d.map(({key:e,options:t})=>({values:t?.map(e=>e.value),key:e})),[d]),u=(0,S.useMemo)(()=>{let e=c.filter(({values:e})=>e?.length);return e.length>0?L(e,[],0):[]},[c]),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]),f=(0,S.useMemo)(()=>{let e=[...u,...m],t=new Set;return e.filter(e=>{let a=Object.values(e).join("::");return!t.has(a)&&(t.add(a),!0)})},[u,m]),p=(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)(()=>f.map(e=>{let t=p.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)}}),[f,p]),g=(0,S.useMemo)(()=>d.length>0,[d]),h=(0,S.useMemo)(()=>d.some(e=>e.options&&e.options.length>0),[d]);return(0,t.jsxs)(V.U,{children:[(0,t.jsx)(ef.f,{title:i({id:"product_assignments_explanation_title",defaultMessage:"About Product Assignments"}),description:i({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.f,{className:"w-8 h-8 text-gray-400"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-text-primary mb-2",children:i({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)(D.f,{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.f,{children:[(0,t.jsxs)(U.f.Row,{children:[o.map(e=>(0,t.jsx)(U.f.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:d.find(t=>t.key===e)?.texts?.title||e},e)),(0,t.jsx)(U.f.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:i({id:"assigned_product_column_header",defaultMessage:"Assigned Product"})}),(0,t.jsx)(U.f.Cell,{className:"font-semibold bg-gray-50 dark:bg-gray-800",children:i({id:"actions_column_header",defaultMessage:"Actions"})})]}),x.length>0&&x.map(({_id:a,columns:i,product:d})=>(0,t.jsx)(em,{columns:i,disabled:s,loading:r,product:l,variationProduct:d,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.f,{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:i({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:i({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),eh=e.i(23239);let ev=E.a`
93
93
  query ProductTokenization($productId: ID, $slug: String) {
94
94
  product(productId: $productId, slug: $slug) {
95
95
  _id
@@ -97,13 +97,14 @@
97
97
  contractConfiguration {
98
98
  tokenId
99
99
  supply
100
+ ercMetadataProperties
100
101
  }
101
102
  contractStandard
102
103
  contractAddress
103
104
  }
104
105
  }
105
106
  }
106
- `,ev=E.a`
107
+ `,eb=E.a`
107
108
  query SmartContractStandards {
108
109
  smartContractStandards: __type(name: "SmartContractStandard") {
109
110
  options: enumValues {
@@ -112,7 +113,7 @@
112
113
  }
113
114
  }
114
115
  }
115
- `,eb=E.a`
116
+ `,ey=E.a`
116
117
  mutation UpdateProductTokenization(
117
118
  $productId: ID!
118
119
  $tokenization: UpdateProductTokenizationInput!
@@ -124,34 +125,34 @@
124
125
  _id
125
126
  }
126
127
  }
127
- `,ey=({productId:e,disabled:i=!1})=>{let{formatMessage:l}=(0,s.X)(),{hasRole:r}=(0,$.f)(),{smartContractStandards:d}=(()=>{let{data:e,loading:t,error:s}=(0,R.f)(ev);return{smartContractStandards:e?.smartContractStandards?.options||[],loading:t,error:s}})(),{updateProductTokenization:n}=(()=>{let[e]=(0,Z.f)(eb);return{updateProductTokenization:async({productId:t,tokenization:{contractAddress:s,contractStandard:a,tokenId:i,supply:l}})=>e({variables:{productId:t,tokenization:{contractAddress:s,contractStandard:a,tokenId:i,supply:parseInt(l,10)}},refetchQueries:["Product","Products"]})}})(),{product:o,loading:c}=(({productId:e=null,slug:t=null}={})=>{let s=(0,q.Q)(t),{data:a,loading:i,error:l}=(0,R.f)(eh,{skip:!e&&!t,variables:{productId:e||s}});return{product:a?.product,loading:i,error:l}})({productId:e}),u=async({contractAddress:t,contractStandard:s,tokenId:a,supply:i})=>(await n({productId:e,tokenization:{contractAddress:t,contractStandard:s,tokenId:a||"",supply:i}}),{success:!0}),m=l({id:"token_updated",defaultMessage:"Token update successfully!"}),f=(0,es.f)({disabled:i,submit:u,successMessage:m,initialValues:{contractAddress:"",contractStandard:"",tokenId:"",supply:""}});return(0,S.useEffect)(()=>{c||f.api.setValues({contractAddress:o?.contractAddress||"",contractStandard:o?.contractStandard||"",tokenId:o?.contractConfiguration?.tokenId||"",supply:o?.contractConfiguration?.supply||""})},[c]),(0,t.jsx)(ex.f,{documentationLabel:l({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,t.jsx)(s.L,{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)(V.U,{children:(0,t.jsxs)(ea.f,{form:f,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.f,{className:"w-full",label:l({id:"contract-standard",defaultMessage:"Contract standard"}),placeholder:l({id:"contract-standard",defaultMessage:"Contract standard"}),required:!0,name:"contractStandard",options:(0,eg.f)(d,"label","value")}),(0,t.jsx)(ei.f,{name:"contractAddress",id:"contractAddress",label:l({id:"contract-address-label",defaultMessage:"Contract Address"}),placeholder:l({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)(ei.f,{name:"supply",id:"supply",type:"number",label:l({id:"token-supply",defaultMessage:"Supply"}),placeholder:l({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)(ei.f,{name:"tokenId",id:"tokenId",label:l({id:"token-id-label",defaultMessage:"Token Serial Number"}),placeholder:l({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"})]}),r(a.C.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)(el.f,{label:l({id:"update_token",defaultMessage:"Update token"})})})]})})})};var ej=e.i(31494),ew=e.i(83788),eN=e.i(13534),eM=e.i(70475);let eP=({id:e,selectedView:s="",disableAll:a=!1,...i})=>{if("texts"===s)return(0,t.jsx)(g.f,{children:(0,t.jsx)(v.f,{productId:e,disabled:a})});if("media"===s)return(0,t.jsx)(ew.f,{children:(0,t.jsx)(g.f,{children:(0,t.jsx)(b.f,{productId:e})})});if("commerce"===s)return(0,t.jsx)(h.f,{productId:e,disabled:a});if("supply"===s)return(0,t.jsx)(j.f,{productId:e,disabled:a});if("warehousing"===s)return(0,t.jsx)(N.f,{productId:e,disabled:a});if("fulfillment"===s)return(0,t.jsx)(M.f,{productId:e});if("variations"===s)return(0,t.jsx)(g.f,{children:(0,t.jsx)(w.f,{productId:e,disabled:a})});if("bundled_products"===s)return(0,t.jsx)(g.f,{children:(0,t.jsx)(I.f,{productId:e,disabled:a})});if("subscriptions"===s)return(0,t.jsx)(y.f,{productId:e,disabled:a});if("reviews"===s)return(0,t.jsx)(_.f,{productId:e});if("assignments"===s)return(0,t.jsx)(g.f,{children:(0,t.jsx)(ep,{proxyId:e,disabled:a})});if("token"===s)return(0,t.jsx)(ey,{productId:e,disabled:a});if("extended"===s)return(0,t.jsx)(ej.f,{data:i});if(s?.startsWith("plugin:")){let a=s.replace("plugin:","");return(0,t.jsx)(eM.f,{slot:"product:tabs",entityId:e,children:(s,i)=>i.component===a?(0,t.jsx)(s,{entityId:e}):null})}return(0,t.jsx)(g.f,{children:(0,t.jsx)(v.f,{productId:e})})};e.s(["f",0,({product:e,extendedData:g={}})=>{let{formatMessage:h}=(0,s.X)(),{hasRole:v}=(0,$.f)(),{updateProduct:b}=(0,k.f)(),{shopInfo:y}=(0,ec.f)(),{getSlotPlugins:j}=(0,eN.L)(),{__typename:w}=e||{},N=[{id:"texts",title:h({id:"general_text",defaultMessage:"Text"}),Icon:(0,t.jsx)(i.f,{className:"h-5 w-5"})},{id:"media",title:h({id:"media",defaultMessage:"Media"}),Icon:(0,t.jsx)(l.f,{className:"h-5 w-5"})},"ConfigurableProduct"!==w&&{id:"commerce",title:h({id:"commerce",defaultMessage:"Commerce"}),Icon:(0,t.jsx)(r.f,{className:"h-5 w-5"})},"SimpleProduct"===w&&{id:"supply",title:h({id:"supply",defaultMessage:"Supply"}),Icon:(0,t.jsx)(d.f,{className:"h-5 w-5"})},"SimpleProduct"===w&&{id:"warehousing",title:h({id:"warehousing",defaultMessage:"Warehousing"}),Icon:(0,t.jsx)(n.f,{className:"h-5 w-5"})},"SimpleProduct"===w&&{id:"fulfillment",title:h({id:"fulfillment",defaultMessage:"Fulfillment"}),Icon:(0,t.jsx)(x.f,{className:"h-5 w-5"})},"ConfigurableProduct"===w&&{id:"variations",title:h({id:"variations",defaultMessage:"Variations"}),Icon:(0,t.jsx)(o.f,{className:"h-5 w-5"})},"BundleProduct"===w&&{id:"bundled_products",title:h({id:"bundled_items",defaultMessage:"Bundled items"}),Icon:(0,t.jsx)(c.f,{className:"h-5 w-5"})},"PlanProduct"===w&&{id:"subscriptions",title:h({id:"subscriptions",defaultMessage:"Subscriptions"}),Icon:(0,t.jsx)(u.f,{className:"h-5 w-5"})},"ConfigurableProduct"===w&&{id:"assignments",title:h({id:"assignments",defaultMessage:"Assignments"}),Icon:(0,t.jsx)(f.f,{className:"h-5 w-5"})},"TokenizedProduct"===w&&{id:"token",title:h({id:"token",defaultMessage:"Token"}),Icon:(0,t.jsx)(f.f,{className:"h-5 w-5"})},{id:"reviews",title:h({id:"reviews",defaultMessage:"Reviews"}),Icon:(0,t.jsx)(p.f,{className:"h-5 w-5"})},null!==g&&{id:"extended",title:h({id:"extended-fields",defaultMessage:"Extended"}),Icon:(0,t.jsx)(m.f,{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.f,{className:"h-5 w-5"})}));N.push(...M);let _=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)(C.f,{defaultValue:e?.tags,onSubmit:_,enableEdit:v(a.C.ManageProducts),availableTagOptions:y?.adminUiConfig?.productTags.filter(t=>!(e?.tags||[])?.includes(t)).map(e=>({value:e,label:e}))})}),(0,t.jsx)(P.f,{tabItems:N,defaultTab:"texts",children:(0,t.jsx)(eP,{disableAll:e?.status===a.X.Deleted,id:e?._id,...g})})]})}],42929);var e_=e.i(87284);e.s(["f",0,({media:e=[],onEditMedia:s})=>(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(s&&s(t))},children:(0,t.jsx)(e_.f,{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 eI=e.i(62199);let eC=E.a`
128
+ `,ej=({productId:e,disabled:i=!1})=>{let{formatMessage:l}=(0,a.X)(),{hasRole:r}=(0,$.f)(),{smartContractStandards:d}=(()=>{let{data:e,loading:t,error:a}=(0,R.f)(eb);return{smartContractStandards:e?.smartContractStandards?.options||[],loading:t,error:a}})(),{updateProductTokenization:n}=(()=>{let[e]=(0,Z.f)(ey);return{updateProductTokenization:async({productId:t,tokenization:{contractAddress:a,contractStandard:s,tokenId:i,supply:l,ercMetadataProperties:r}})=>e({variables:{productId:t,tokenization:{contractAddress:a,contractStandard:s,tokenId:i,supply:parseInt(l,10),ercMetadataProperties:r}},refetchQueries:["Product","Products"]})}})(),{product:o,loading:c}=(({productId:e=null,slug:t=null}={})=>{let a=(0,q.Q)(t),{data:s,loading:i,error:l}=(0,R.f)(ev,{skip:!e&&!t,variables:{productId:e||a}});return{product:s?.product,loading:i,error:l}})({productId:e}),u=async({contractAddress:t,contractStandard:a,tokenId:s,supply:i,ercMetadataProperties:l})=>(await n({productId:e,tokenization:{contractAddress:t||void 0,contractStandard:a,tokenId:s||void 0,supply:i,ercMetadataProperties:l?JSON.parse(l):void 0}}),{success:!0}),m=l({id:"token_updated",defaultMessage:"Token update successfully!"}),f=(0,ea.f)({disabled:i,submit:u,successMessage:m,initialValues:{contractAddress:"",contractStandard:"",tokenId:"",supply:"",ercMetadataProperties:null}});return(0,S.useEffect)(()=>{if(!c){let e=o?.contractConfiguration?.ercMetadataProperties;f.api.setValues({contractAddress:o?.contractAddress||"",contractStandard:o?.contractStandard||"",tokenId:o?.contractConfiguration?.tokenId||"",supply:o?.contractConfiguration?.supply||"",ercMetadataProperties:e?JSON.stringify(e,null,2):null})}},[c]),(0,t.jsx)(ex.f,{documentationLabel:l({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,t.jsx)(a.L,{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)(V.U,{children:(0,t.jsxs)(es.f,{form:f,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.f,{className:"w-full",label:l({id:"contract-standard",defaultMessage:"Contract standard"}),placeholder:l({id:"contract-standard",defaultMessage:"Contract standard"}),required:!0,name:"contractStandard",options:(0,eg.f)(d,"label","value")}),(0,t.jsx)(ei.f,{name:"contractAddress",id:"contractAddress",label:l({id:"contract-address-label",defaultMessage:"Contract Address"}),placeholder:l({id:"contract-address-label",defaultMessage:"Contract Address"}),className:"block w-full max-w-full rounded-md border-border-default text-sm focus:ring-focus-ring sm:text-sm"}),(0,t.jsx)(ei.f,{name:"supply",id:"supply",type:"number",label:l({id:"token-supply",defaultMessage:"Supply"}),placeholder:l({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)(ei.f,{name:"tokenId",id:"tokenId",label:l({id:"token-id-label",defaultMessage:"Token Serial Number"}),placeholder:l({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"}),(0,t.jsx)(eh.f,{name:"ercMetadataProperties",required:!1,rows:6,label:l({id:"erc_metadata_properties",defaultMessage:"ERC metadata properties"})})]}),r(s.C.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)(el.f,{label:l({id:"update_token",defaultMessage:"Update token"})})})]})})})};var ew=e.i(31494),eN=e.i(83788),eM=e.i(13534),eP=e.i(70475);let e_=({id:e,selectedView:a="",disableAll:s=!1,...i})=>{if("texts"===a)return(0,t.jsx)(g.f,{children:(0,t.jsx)(v.f,{productId:e,disabled:s})});if("media"===a)return(0,t.jsx)(eN.f,{children:(0,t.jsx)(g.f,{children:(0,t.jsx)(b.f,{productId:e})})});if("commerce"===a)return(0,t.jsx)(h.f,{productId:e,disabled:s});if("supply"===a)return(0,t.jsx)(j.f,{productId:e,disabled:s});if("warehousing"===a)return(0,t.jsx)(N.f,{productId:e,disabled:s});if("fulfillment"===a)return(0,t.jsx)(M.f,{productId:e});if("variations"===a)return(0,t.jsx)(g.f,{children:(0,t.jsx)(w.f,{productId:e,disabled:s})});if("bundled_products"===a)return(0,t.jsx)(g.f,{children:(0,t.jsx)(I.f,{productId:e,disabled:s})});if("subscriptions"===a)return(0,t.jsx)(y.f,{productId:e,disabled:s});if("reviews"===a)return(0,t.jsx)(_.f,{productId:e});if("assignments"===a)return(0,t.jsx)(g.f,{children:(0,t.jsx)(ep,{proxyId:e,disabled:s})});if("token"===a)return(0,t.jsx)(ej,{productId:e,disabled:s});if("extended"===a)return(0,t.jsx)(ew.f,{data:i});if(a?.startsWith("plugin:")){let s=a.replace("plugin:","");return(0,t.jsx)(eP.f,{slot:"product:tabs",entityId:e,children:(a,i)=>i.component===s?(0,t.jsx)(a,{entityId:e}):null})}return(0,t.jsx)(g.f,{children:(0,t.jsx)(v.f,{productId:e})})};e.s(["f",0,({product:e,extendedData:g={}})=>{let{formatMessage:h}=(0,a.X)(),{hasRole:v}=(0,$.f)(),{updateProduct:b}=(0,k.f)(),{shopInfo:y}=(0,ec.f)(),{getSlotPlugins:j}=(0,eM.L)(),{__typename:w}=e||{},N=[{id:"texts",title:h({id:"general_text",defaultMessage:"Text"}),Icon:(0,t.jsx)(i.f,{className:"h-5 w-5"})},{id:"media",title:h({id:"media",defaultMessage:"Media"}),Icon:(0,t.jsx)(l.f,{className:"h-5 w-5"})},"ConfigurableProduct"!==w&&{id:"commerce",title:h({id:"commerce",defaultMessage:"Commerce"}),Icon:(0,t.jsx)(r.f,{className:"h-5 w-5"})},"SimpleProduct"===w&&{id:"supply",title:h({id:"supply",defaultMessage:"Supply"}),Icon:(0,t.jsx)(d.f,{className:"h-5 w-5"})},"SimpleProduct"===w&&{id:"warehousing",title:h({id:"warehousing",defaultMessage:"Warehousing"}),Icon:(0,t.jsx)(n.f,{className:"h-5 w-5"})},"SimpleProduct"===w&&{id:"fulfillment",title:h({id:"fulfillment",defaultMessage:"Fulfillment"}),Icon:(0,t.jsx)(x.f,{className:"h-5 w-5"})},"ConfigurableProduct"===w&&{id:"variations",title:h({id:"variations",defaultMessage:"Variations"}),Icon:(0,t.jsx)(o.f,{className:"h-5 w-5"})},"BundleProduct"===w&&{id:"bundled_products",title:h({id:"bundled_items",defaultMessage:"Bundled items"}),Icon:(0,t.jsx)(c.f,{className:"h-5 w-5"})},"PlanProduct"===w&&{id:"subscriptions",title:h({id:"subscriptions",defaultMessage:"Subscriptions"}),Icon:(0,t.jsx)(u.f,{className:"h-5 w-5"})},"ConfigurableProduct"===w&&{id:"assignments",title:h({id:"assignments",defaultMessage:"Assignments"}),Icon:(0,t.jsx)(f.f,{className:"h-5 w-5"})},"TokenizedProduct"===w&&{id:"token",title:h({id:"token",defaultMessage:"Token"}),Icon:(0,t.jsx)(f.f,{className:"h-5 w-5"})},{id:"reviews",title:h({id:"reviews",defaultMessage:"Reviews"}),Icon:(0,t.jsx)(p.f,{className:"h-5 w-5"})},null!==g&&{id:"extended",title:h({id:"extended-fields",defaultMessage:"Extended"}),Icon:(0,t.jsx)(m.f,{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.f,{className:"h-5 w-5"})}));N.push(...M);let _=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)(C.f,{defaultValue:e?.tags,onSubmit:_,enableEdit:v(s.C.ManageProducts),availableTagOptions:y?.adminUiConfig?.productTags.filter(t=>!(e?.tags||[])?.includes(t)).map(e=>({value:e,label:e}))})}),(0,t.jsx)(P.f,{tabItems:N,defaultTab:"texts",children:(0,t.jsx)(e_,{disableAll:e?.status===s.X.Deleted,id:e?._id,...g})})]})}],42929);var eI=e.i(87284);e.s(["f",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)(eI.f,{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 eC=e.i(62199);let ek=E.a`
128
129
  mutation PublishProduct($productId: ID!) {
129
130
  publishProduct(productId: $productId) {
130
131
  ...ProductDetailFragment
131
132
  }
132
133
  }
133
- ${eI.f}
134
- `;e.s(["f",0,()=>{let[e]=(0,Z.f)(eC);return{publishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],95379);let ek=E.a`
134
+ ${eC.f}
135
+ `;e.s(["f",0,()=>{let[e]=(0,Z.f)(ek);return{publishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],95379);let e$=E.a`
135
136
  mutation UnpublishProduct($productId: ID!) {
136
137
  unpublishProduct(productId: $productId) {
137
138
  ...ProductDetailFragment
138
139
  }
139
140
  }
140
- ${eI.f}
141
- `;e.s(["f",0,()=>{let[e]=(0,Z.f)(ek);return{unPublishProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Product","ShopStatus"],awaitRefetchQueries:!0})}}],51628)},88604,e=>{"use strict";var t=e.i(59080),s=e.i(76204);let a=t.a`
141
+ ${eC.f}
142
+ `;e.s(["f",0,()=>{let[e]=(0,Z.f)(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.a`
142
143
  mutation RemoveProduct($productId: ID!) {
143
144
  removeProduct(productId: $productId) {
144
145
  _id
145
146
  }
146
147
  }
147
- `;e.s(["f",0,()=>{let[e]=(0,s.f)(a);return{removeProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},41418,e=>{"use strict";var t=e.i(59080),s=e.i(76204),a=e.i(62199);let i=t.a`
148
+ `;e.s(["f",0,()=>{let[e]=(0,a.f)(s);return{removeProduct:async({productId:t})=>e({variables:{productId:t},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},41418,e=>{"use strict";var t=e.i(59080),a=e.i(76204),s=e.i(62199);let i=t.a`
148
149
  mutation UpdateProduct($productId: ID!, $product: UpdateProductInput!) {
149
150
  updateProduct(productId: $productId, product: $product) {
150
151
  ...ProductDetailFragment
151
152
  }
152
153
  }
153
- ${a.f}
154
- `;e.s(["f",0,()=>{let[e]=(0,s.f)(i);return{updateProduct:async({productId:t,product:{tags:s,sequence:a,meta:i}})=>e({variables:{productId:t,product:{tags:s,sequence:a,meta:i}},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},30311,e=>{"use strict";var t=e.i(91398),s=e.i(3326);e.i(51523);var a=e.i(19518),i=e.i(28401),l=e.i(50595),r=e.i(53576),d=e.i(25327),n=e.i(84818),o=e.i(42929),c=e.i(97057),u=e.i(84278),m=e.i(92276),f=e.i(95379),p=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),w=e.i(58971),N=e.i(24608),M=e.i(91788),P=e.i(34728);e.s(["default",0,({slug:e})=>{let{formatMessage:_}=(0,s.X)(),{formatDateTime:I}=(0,n.f)(),{hasRole:C}=(0,w.f)(),{publishProduct:k}=(0,f.f)(),{unPublishProduct:$}=(0,p.f)(),{removeProduct:S}=(0,h.f)(),{updateProduct:T}=(0,x.f)(),{setModal:V}=(0,v.f)(),D=(0,j.useRouter)(),{push:E}=(0,j.useRouter)(),{product:R,loading:q,error:A,extendedData:O}=(0,u.f)({slug:e}),L=R?.status||"DRAFT",U=(0,M.useMemo)(()=>[{id:"published",title:_({id:"published",defaultMessage:"Published"}),description:_({id:"publish_product_description",defaultMessage:"Product will be searchable and is available for orders"}),current:"ACTIVE"===L,selectedTitle:_({id:"published",defaultMessage:"Published"}),onClick:async()=>{try{await k({productId:R?._id}),i.toast.success(_({id:"product_published",defaultMessage:"Published successfully "}))}catch(t){console.error("Failed to publish product:",t);let e=t?.message||"Unknown error";i.toast.error(`${_({id:"product_publish_error",defaultMessage:"Failed to publish product"})}: ${e}`)}},bgColor:"green",disable:!C(a.C.ManageProducts)},{id:"draft",title:_({id:"draft",defaultMessage:"Draft"}),description:_({id:"draft_product_description",defaultMessage:"Product will not be discoverable and can not be orderose"}),current:"DRAFT"===L,selectedTitle:_({id:"not_published",defaultMessage:"Not published"}),bgColor:"amber",disable:"ACTIVE"===L&&!C(a.C.ManageProducts),onClick:async()=>{if(C(a.C.ManageProducts))try{await $({productId:R?._id}),i.toast.success(_({id:"product_drafted",defaultMessage:"Drafted successfully "}))}catch(t){console.error("Failed to unpublish product:",t);let e=t?.message||"Unknown error";i.toast.error(`${_({id:"product_unpublish_error",defaultMessage:"Failed to unpublish product"})}: ${e}`)}}}],[R]);if(A)return console.error("Error loading product:",A),(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:_({id:"product_load_error",defaultMessage:"Failed to load product"})})})});let F=async e=>{e.target.value&&await T({productId:R?._id,product:{sequence:parseInt(e.target.value,10)}})},Q=async()=>{"proxies"in R&&R.proxies?.length?await V((0,t.jsx)(P.f,{headerText:_({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:_({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 R&&R.proxies.map(({__typename:e},s)=>(0,t.jsx)("li",{children:e.replace("Product","")},s))}),(0,t.jsx)("p",{children:_({id:"product_delete_blocked_action",defaultMessage:"Please unlink it before trying to delete it."})})]}),buttonText:_({id:"ok",defaultMessage:"Ok"}),onOkClick:()=>V(null)})):await V((0,t.jsx)(b.f,{onCancelClick:()=>V(""),message:_({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()=>{V("");try{await S({productId:R?._id}),i.toast.success(_({id:"product_deleted_success",defaultMessage:"Deleted successfully"})),D.push("/products")}catch(e){await V((0,t.jsx)(b.f,{onCancelClick:()=>V(""),headerText:_({id:"error",defaultMessage:"Error"}),message:e instanceof y.f?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)(N.f,{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:_({id:"ok",defaultMessage:"Ok"}),onOkClick:async()=>{V("")}}))}}}))};return R||q?q?(0,t.jsx)(r.f,{variant:"detail"}):(0,t.jsxs)("div",{className:"mt-5 max-w-full",children:[(0,t.jsx)(l.f,{routeName:e,depth:3,currentPageTitle:R?.texts?.title}),"DELETED"===L&&(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:_({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)(d.f,{headerText:(0,t.jsxs)(t.Fragment,{children:[R?.texts?.title||"Untitled Product","DELETED"===L&&(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:_({id:"deleted_status",defaultMessage:"Deleted"})})]}),title:`${R?.texts?.title||"Product"} (${R?._id})`}),(0,t.jsxs)("div",{className:"publish-and-order flex flex-wrap gap-3",children:[L&&"DELETED"!==L&&(0,t.jsx)(m.f,{options:U,type:_({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:_({id:"sequence",defaultMessage:"Display Order"})}),(0,t.jsx)("input",{type:"number",id:"sequence-input",disabled:!C(a.C.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:R?.sequence,onBlur:F})]}),"DRAFT"===L&&C(a.C.ManageProducts)&&(0,t.jsx)(g.f,{variant:"danger",icon:(0,t.jsx)(N.f,{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:R?._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:R?.__typename})]}),R?.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:[_({id:"created",defaultMessage:"Created"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:I(R.created,{dateStyle:"medium",timeStyle:"short"})})]}),R?.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:[_({id:"updated",defaultMessage:"Updated"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:I(R.updated,{dateStyle:"medium",timeStyle:"short"})})]}),R?.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:[_({id:"published",defaultMessage:"Published"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:I(R.published,{dateStyle:"medium",timeStyle:"short"})})]})]})]}),(0,t.jsx)(c.f,{productId:R?._id,media:R?.media||[],onEditMedia:e=>{D.push({pathname:D.pathname,query:{...D.query,tab:"media"}},void 0,{shallow:!0})},canEdit:C(a.C.ManageProducts)}),(0,t.jsx)(o.f,{product:R,extendedData:O})]}):(E("/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 s=t.forwardRef(function({title:e,titleId:s,...a},i){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:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},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(["f",0,s],43054);let a=t.forwardRef(function({title:e,titleId:s,...a},i){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:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},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(["f",0,a],95336);let i=t.forwardRef(function({title:e,titleId:s,...a},i){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:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},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(["f",0,i],16113);let l=t.forwardRef(function({title:e,titleId:s,...a},i){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:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},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(["f",0,l],82191);var r=e.i(91398);e.i(51523);var d=e.i(19518),n=e.i(58021),o=e.i(3326),c=e.i(58971),u=e.i(5505),m=e.i(1504),f=e.i(98520),p=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),w=e.i(98949),N=e.i(82226),M=e.i(59080),P=e.i(32171);let _=M.a`
154
+ ${s.f}
155
+ `;e.s(["f",0,()=>{let[e]=(0,a.f)(i);return{updateProduct:async({productId:t,product:{tags:a,sequence:s,meta:i}})=>e({variables:{productId:t,product:{tags:a,sequence:s,meta:i}},refetchQueries:["Products","ShopStatus","ShopInfo"]})}}])},30311,e=>{"use strict";var t=e.i(91398),a=e.i(3326);e.i(51523);var s=e.i(19518),i=e.i(28401),l=e.i(50595),r=e.i(53576),d=e.i(25327),n=e.i(84818),o=e.i(42929),c=e.i(97057),u=e.i(84278),m=e.i(92276),f=e.i(95379),p=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),w=e.i(58971),N=e.i(24608),M=e.i(91788),P=e.i(34728);e.s(["default",0,({slug:e})=>{let{formatMessage:_}=(0,a.X)(),{formatDateTime:I}=(0,n.f)(),{hasRole:C}=(0,w.f)(),{publishProduct:k}=(0,f.f)(),{unPublishProduct:$}=(0,p.f)(),{removeProduct:S}=(0,h.f)(),{updateProduct:T}=(0,x.f)(),{setModal:V}=(0,v.f)(),D=(0,j.useRouter)(),{push:E}=(0,j.useRouter)(),{product:R,loading:q,error:A,extendedData:O}=(0,u.f)({slug:e}),U=R?.status||"DRAFT",L=(0,M.useMemo)(()=>[{id:"published",title:_({id:"published",defaultMessage:"Published"}),description:_({id:"publish_product_description",defaultMessage:"Product will be searchable and is available for orders"}),current:"ACTIVE"===U,selectedTitle:_({id:"published",defaultMessage:"Published"}),onClick:async()=>{try{await k({productId:R?._id}),i.toast.success(_({id:"product_published",defaultMessage:"Published successfully "}))}catch(t){console.error("Failed to publish product:",t);let e=t?.message||"Unknown error";i.toast.error(`${_({id:"product_publish_error",defaultMessage:"Failed to publish product"})}: ${e}`)}},bgColor:"green",disable:!C(s.C.ManageProducts)},{id:"draft",title:_({id:"draft",defaultMessage:"Draft"}),description:_({id:"draft_product_description",defaultMessage:"Product will not be discoverable and can not be orderose"}),current:"DRAFT"===U,selectedTitle:_({id:"not_published",defaultMessage:"Not published"}),bgColor:"amber",disable:"ACTIVE"===U&&!C(s.C.ManageProducts),onClick:async()=>{if(C(s.C.ManageProducts))try{await $({productId:R?._id}),i.toast.success(_({id:"product_drafted",defaultMessage:"Drafted successfully "}))}catch(t){console.error("Failed to unpublish product:",t);let e=t?.message||"Unknown error";i.toast.error(`${_({id:"product_unpublish_error",defaultMessage:"Failed to unpublish product"})}: ${e}`)}}}],[R]);if(A)return console.error("Error loading product:",A),(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:_({id:"product_load_error",defaultMessage:"Failed to load product"})})})});let F=async e=>{e.target.value&&await T({productId:R?._id,product:{sequence:parseInt(e.target.value,10)}})},B=async()=>{"proxies"in R&&R.proxies?.length?await V((0,t.jsx)(P.f,{headerText:_({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:_({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 R&&R.proxies.map(({__typename:e},a)=>(0,t.jsx)("li",{children:e.replace("Product","")},a))}),(0,t.jsx)("p",{children:_({id:"product_delete_blocked_action",defaultMessage:"Please unlink it before trying to delete it."})})]}),buttonText:_({id:"ok",defaultMessage:"Ok"}),onOkClick:()=>V(null)})):await V((0,t.jsx)(b.f,{onCancelClick:()=>V(""),message:_({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()=>{V("");try{await S({productId:R?._id}),i.toast.success(_({id:"product_deleted_success",defaultMessage:"Deleted successfully"})),D.push("/products")}catch(e){await V((0,t.jsx)(b.f,{onCancelClick:()=>V(""),headerText:_({id:"error",defaultMessage:"Error"}),message:e instanceof y.f?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)(N.f,{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:_({id:"ok",defaultMessage:"Ok"}),onOkClick:async()=>{V("")}}))}}}))};return R||q?q?(0,t.jsx)(r.f,{variant:"detail"}):(0,t.jsxs)("div",{className:"mt-5 max-w-full",children:[(0,t.jsx)(l.f,{routeName:e,depth:3,currentPageTitle:R?.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:_({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)(d.f,{headerText:(0,t.jsxs)(t.Fragment,{children:[R?.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:_({id:"deleted_status",defaultMessage:"Deleted"})})]}),title:`${R?.texts?.title||"Product"} (${R?._id})`}),(0,t.jsxs)("div",{className:"publish-and-order flex flex-wrap gap-3",children:[U&&"DELETED"!==U&&(0,t.jsx)(m.f,{options:L,type:_({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:_({id:"sequence",defaultMessage:"Display Order"})}),(0,t.jsx)("input",{type:"number",id:"sequence-input",disabled:!C(s.C.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:R?.sequence,onBlur:F})]}),"DRAFT"===U&&C(s.C.ManageProducts)&&(0,t.jsx)(g.f,{variant:"danger",icon:(0,t.jsx)(N.f,{className:"h-5 w-5"}),text:"Delete",onClick:B})]})]}),(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:R?._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:R?.__typename})]}),R?.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:[_({id:"created",defaultMessage:"Created"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:I(R.created,{dateStyle:"medium",timeStyle:"short"})})]}),R?.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:[_({id:"updated",defaultMessage:"Updated"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:I(R.updated,{dateStyle:"medium",timeStyle:"short"})})]}),R?.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:[_({id:"published",defaultMessage:"Published"}),":"]}),(0,t.jsx)("span",{className:"text-sm font-mono",children:I(R.published,{dateStyle:"medium",timeStyle:"short"})})]})]})]}),(0,t.jsx)(c.f,{productId:R?._id,media:R?.media||[],onEditMedia:e=>{D.push({pathname:D.pathname,query:{...D.query,tab:"media"}},void 0,{shallow:!0})},canEdit:C(s.C.ManageProducts)}),(0,t.jsx)(o.f,{product:R,extendedData:O})]}):(E("/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},i){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:i,"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(["f",0,a],43054);let s=t.forwardRef(function({title:e,titleId:a,...s},i){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:i,"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(["f",0,s],95336);let i=t.forwardRef(function({title:e,titleId:a,...s},i){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:i,"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(["f",0,i],16113);let l=t.forwardRef(function({title:e,titleId:a,...s},i){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:i,"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(["f",0,l],82191);var r=e.i(91398);e.i(51523);var d=e.i(19518),n=e.i(3326),o=e.i(58971),c=e.i(5505),u=e.i(98520),m=e.i(79093),f=e.i(69211),p=e.i(63094),x=e.i(21128),g=e.i(98949),h=e.i(59080),v=e.i(32171);let b=h.a`
155
156
  fragment ProductCatalogPriceFragment on ProductCatalogPrice {
156
157
  isTaxable
157
158
  isNetPrice
@@ -169,14 +170,14 @@
169
170
  amount
170
171
  minQuantity
171
172
  }
172
- `,I=M.a`
173
+ `,y=h.a`
173
174
  query ProductCatalogPrices($productId: ID!) {
174
175
  productCatalogPrices(productId: $productId) {
175
176
  ...ProductCatalogPriceFragment
176
177
  }
177
178
  }
178
- ${_}
179
- `;var C=e.i(76204),k=e.i(62199);let $=M.a`
179
+ ${b}
180
+ `;var j=e.i(76204),w=e.i(62199),N=e.i(25520);let M=h.a`
180
181
  mutation UpdateProductCommerce(
181
182
  $productId: ID!
182
183
  $commerce: UpdateProductCommerceInput!
@@ -185,23 +186,23 @@
185
186
  ...ProductDetailFragment
186
187
  }
187
188
  }
188
- ${k.f}
189
- `,S=({defaultCountryValue:e,defaultCurrencyValue:t,countries:s,currencies:a})=>{let{formatMessage:i}=(0,o.X)(),{hasRole:l}=(0,c.f)(),{watch:u,getValues:f,trigger:p}=(0,n.useFormContext)(),{fields:g,append:h,remove:b}=(0,n.useFieldArray)({name:"pricing"});u("pricing");let w=()=>f("pricing"),M=()=>{let e=g.map((e,t)=>`pricing.${t}.minQuantity`);setTimeout(()=>p(e),0)};return(0,r.jsxs)("div",{children:[g.map((n,o)=>{let c=[(0,N.D)(o,w)];return 0===o&&c.push((0,N.P)(w)),(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)(y.f,{className:"w-full",disabled:!l(d.C.ManageProducts),validators:c,name:`pricing.${o}.minQuantity`,id:`pricing.${o}.minQuantity`,type:"number",min:0,hideLabel:!0,onChange:M,label:i({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)(y.f,{type:"number",className:"w-full",disabled:!l(d.C.ManageProducts),name:`pricing.${o}.amount`,id:`pricing.${o}.amount`,required:!0,hideLabel:!0,label:i({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)(x.f,{name:`pricing.${o}.isTaxable`,labelClassName:"lg:sr-only items-center ",disabled:!l(d.C.ManageProducts),label:i({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)(x.f,{name:`pricing.${o}.isNetPrice`,labelClassName:"lg:sr-only items-center",disabled:!l(d.C.ManageProducts),label:i({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)(v.f,{defaultValue:e,className:"w-full lg:ml-4 lg:mr-4",label:i({id:"country",defaultMessage:"Country"}),name:`pricing.${o}.countryCode`,id:`pricing.${o}.countryCode`,disabled:!l(d.C.ManageProducts),required:!0,options:(0,m.f)(s,"isoCode","isoCode"),hideLabel:!0}),(0,r.jsx)(v.f,{defaultValue:t,className:"w-full lg:mr-8 ",label:i({id:"currency",defaultMessage:"Currency"}),disabled:!l(d.C.ManageProducts),name:`pricing.${o}.currencyCode`,id:`pricing.${o}.currencyCode`,required:!0,options:(0,m.f)(a,"isoCode","isoCode"),hideLabel:!0,placeholder:i({id:"country_currency",defaultMessage:"Currency"})})]}),l(d.C.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:()=>b(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"})]})})})]},n.id)}),l(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(j.f,{variant:"tertiary",text:i({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(["f",0,({productId:e,disabled:t=!1})=>{let{formatMessage:s}=(0,o.X)(),{catalogPrices:a}=(({productId:e})=>{let{data:t,loading:s,error:a}=(0,P.f)(I,{skip:!e,variables:{productId:e}});return{catalogPrices:t?.productCatalogPrices||[],loading:s,error:a}})({productId:e}),{hasRole:i}=(0,c.f)(),{updateProductCommerce:l}=(()=>{let[e]=(0,C.f)($),{currencies:t}=(0,p.f)();return{updateProductCommerce:async({productId:s,commerce:{pricing:a}})=>e({variables:{productId:s,commerce:{pricing:a.map(e=>{let s=t.find(({isoCode:t})=>t===e.currencyCode),a=((e,t)=>{if(!e||t<0)return 0;let s=e.trim();if(!/^-?\d*\.?\d*$/.test(s))return 0;let a=s.indexOf(".");return -1===a?Number(s)*10**t:Number((s.slice(0,a)||"0")+s.slice(a+1).slice(0,t).padEnd(t,"0"))})(e.amount.toString(),s.decimals);return{...e,amount:a}})}},refetchQueries:["Products"]})}})(),{countries:n}=(0,f.f)(),{currencies:m}=(0,p.f)(),x=n?.find(({isBase:e})=>e),v=x?.isoCode,y=x?.defaultCurrency?.isoCode,j=async({pricing:t})=>(await l({productId:e,commerce:{pricing:t}}),{success:!0}),N=s({id:"saved",defaultMessage:"Saved"}),M=((e=[],t=[])=>t.length?e.map(e=>{let s=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 s=e.toString();if("0"===s)return"0."+"0".repeat(t);let a=s.startsWith("-"),i=a?s.slice(1):s;if(i.length<=t){let e=i.padStart(t,"0");return`${a?"-":""}0.${e}`}let l=i.length-t,r=i.slice(0,l),d=i.slice(l);return`${a?"-":""}${r}.${d}`})(e.amount,s?.decimals),minQuantity:e.minQuantity}}):[])(a,m),_=(0,w.f)({disabled:t,submit:j,successMessage:N,enableReinitialize:!0,initialValues:{pricing:[...M?.length?M:[{minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:y,countryCode:v}]]}});return(0,r.jsx)("div",{children:(0,r.jsxs)("div",{className:"mt-5 md:col-span-3 lg:mt-0",children:[(0,r.jsx)(u.U,{children:(0,r.jsxs)(g.f,{className:"mt-3 rounded-md",form:_,disabled:!i(d.C.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:s({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)("span",{className:"w-full lg:ml-5",children:s({id:"price",defaultMessage:"Price"})})]}),(0,r.jsxs)("span",{className:"flex w-full",children:[(0,r.jsx)("span",{className:"w-full lg:ml-8",children:s({id:"vat_suspect",defaultMessage:"Vat Suspect"})}),(0,r.jsx)("span",{className:"w-full lg:ml-12",children:s({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:s({id:"country",defaultMessage:"Country"})}),(0,r.jsx)("span",{className:"w-full",children:s({id:"currency",defaultMessage:"Currency"})})]})]}),(0,r.jsx)(S,{defaultCountryValue:v,defaultCurrencyValue:y,countries:n,currencies:m})]}),(0,r.jsx)(h.f,{displayFieldErrors:!0}),i(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"-mx-6 p-6 bg-surface-subtle text-right",children:(0,r.jsx)(b.f,{className:"mx-6",label:s({id:"save",defaultMessage:"Save"})})})]})}),(0,r.jsx)("p",{className:"mt-6 mb-10 text-sm text-text-muted",children:s({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),V=e.i(14336);let D=M.a`
189
+ ${w.f}
190
+ `;var P=e.i(58021),_=e.i(1504),I=e.i(30434),C=e.i(10685),k=e.i(16984),$=e.i(21623),S=e.i(82226);let T=({name:e,defaultCountryValue:t,defaultCurrencyValue:a,countries:s,currencies:i})=>{let{formatMessage:l}=(0,n.X)(),{hasRole:c}=(0,o.f)(),{watch:u,getValues:m,trigger:f}=(0,P.useFormContext)(),{fields:p,append:x,remove:g}=(0,P.useFieldArray)({name:e});u(e);let h=()=>m(e),v=()=>{let t=p.map((t,a)=>`${e}.${a}.minQuantity`);setTimeout(()=>f(t),0)};return(0,r.jsxs)("div",{children:[p.map((n,o)=>{let u=[(0,S.D)(o,h),(0,S.P)(o,h)];return(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)(k.f,{className:"w-full",disabled:!c(d.C.ManageProducts),validators:u,name:`${e}.${o}.minQuantity`,id:`${e}.${o}.minQuantity`,type:"number",min:0,hideLabel:!0,onChange:v,label:l({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)(k.f,{type:"number",className:"w-full",disabled:!c(d.C.ManageProducts),name:`${e}.${o}.amount`,id:`${e}.${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)(I.f,{name:`${e}.${o}.isTaxable`,labelClassName:"lg:sr-only items-center ",disabled:!c(d.C.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)(I.f,{name:`${e}.${o}.isNetPrice`,labelClassName:"lg:sr-only items-center",disabled:!c(d.C.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)(C.f,{defaultValue:t,className:"w-full lg:ml-4 lg:mr-4",label:l({id:"country",defaultMessage:"Country"}),name:`${e}.${o}.countryCode`,id:`${e}.${o}.countryCode`,disabled:!c(d.C.ManageProducts),required:!0,options:(0,_.f)(s,"isoCode","isoCode"),hideLabel:!0,onChange:v}),(0,r.jsx)(C.f,{defaultValue:a,className:"w-full lg:mr-8 ",label:l({id:"currency",defaultMessage:"Currency"}),disabled:!c(d.C.ManageProducts),name:`${e}.${o}.currencyCode`,id:`${e}.${o}.currencyCode`,required:!0,options:(0,_.f)(i,"isoCode","isoCode"),hideLabel:!0,onChange:v,placeholder:l({id:"country_currency",defaultMessage:"Currency"})})]}),c(d.C.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:()=>{g(o),v()},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"})]})})})]},n.id)}),c(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)($.f,{variant:"tertiary",text:l({id:"add_price_row",defaultMessage:"Add Price Row"}),className:"w-full items-center justify-center",onClick:()=>x({minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:a,countryCode:t})})})]})},V=({name:e="pricing",defaultCountryValue:t,defaultCurrencyValue:a,countries:s,currencies:i})=>{let{formatMessage:l}=(0,n.X)();return(0,r.jsxs)(r.Fragment,{children:[(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:l({id:"min_quantity",defaultMessage:"Min Quantity"})}),(0,r.jsx)("span",{className:"w-full lg:ml-5",children:l({id:"price",defaultMessage:"Price"})})]}),(0,r.jsxs)("span",{className:"flex w-full",children:[(0,r.jsx)("span",{className:"w-full lg:ml-8",children:l({id:"vat_suspect",defaultMessage:"Vat Suspect"})}),(0,r.jsx)("span",{className:"w-full lg:ml-12",children:l({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:l({id:"country",defaultMessage:"Country"})}),(0,r.jsx)("span",{className:"w-full",children:l({id:"currency",defaultMessage:"Currency"})})]})]}),(0,r.jsx)(T,{name:e,defaultCountryValue:t,defaultCurrencyValue:a,countries:s,currencies:i})]})};e.s(["f",0,({productId:e,disabled:t=!1})=>{let{formatMessage:a}=(0,n.X)(),{catalogPrices:s}=(({productId:e})=>{let{data:t,loading:a,error:s}=(0,v.f)(y,{skip:!e,variables:{productId:e}});return{catalogPrices:t?.productCatalogPrices||[],loading:a,error:s}})({productId:e}),{hasRole:i}=(0,o.f)(),{updateProductCommerce:l}=(()=>{let[e]=(0,j.f)(M),{currencies:t}=(0,m.f)();return{updateProductCommerce:async({productId:a,commerce:{pricing:s}})=>e({variables:{productId:a,commerce:{pricing:(0,N.m)(s,t)}},refetchQueries:["Products"]})}})(),{countries:h}=(0,u.f)(),{currencies:b}=(0,m.f)(),w=h?.find(({isBase:e})=>e),P=w?.isoCode,_=w?.defaultCurrency?.isoCode,I=async({pricing:t})=>(await l({productId:e,commerce:{pricing:t}}),{success:!0}),C=a({id:"saved",defaultMessage:"Saved"}),k=((e=[],t=[])=>t.length?(0,N.b)(e.map(({country:e,currency:t,...a})=>({...a,countryCode:e.isoCode,currencyCode:t.isoCode})),t):[])(s,b),$=(0,g.f)({disabled:t,submit:I,successMessage:C,enableReinitialize:!0,initialValues:{pricing:[...k?.length?k:[{minQuantity:"",amount:null,isTaxable:!1,isNetPrice:!1,currencyCode:_,countryCode:P}]]}});return(0,r.jsx)("div",{children:(0,r.jsxs)("div",{className:"mt-5 md:col-span-3 lg:mt-0",children:[(0,r.jsx)(c.U,{children:(0,r.jsxs)(f.f,{className:"mt-3 rounded-md",form:$,disabled:!i(d.C.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.jsx)(V,{name:"pricing",defaultCountryValue:P,defaultCurrencyValue:_,countries:h,currencies:b})]}),(0,r.jsx)(p.f,{displayFieldErrors:!0}),i(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"-mx-6 p-6 bg-surface-subtle text-right",children:(0,r.jsx)(x.f,{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:"Every country and currency needs one price with a min quantity of 0 (or empty), and no two prices may share the same min quantity, currency and country"})})]})})}],42532);var D=e.i(70693),E=e.i(14336);let R=h.a`
190
191
  mutation UpdateProductTexts($productId: ID!, $texts: [ProductTextInput!]!) {
191
192
  updateProductTexts(productId: $productId, texts: $texts) {
192
193
  ...ProductTextsFragment
193
194
  }
194
195
  }
195
- ${V.f}
196
- `;var E=e.i(60195),R=e.i(83094),q=e.i(13120),A=e.i(53296),O=e.i(57561),L=e.i(48539);e.s(["f",0,({productId:e,disabled:s=!1})=>{let{selectedLocale:a,setSelectedLocale:i,languageDialectList:l}=(0,O.f)(),{formatMessage:n}=(0,o.X)(),{hasRole:m}=(0,c.f)(),{defaultLocale:f,shopInfo:p,loading:x}=(0,L.f)(),{translatedTexts:h}=(({productId:e})=>{let{customProperties:t}=(0,T.f)(),{data:s,loading:a,error:i}=(0,P.f)(((e="")=>M.a`
196
+ ${E.f}
197
+ `;var q=e.i(60195),A=e.i(83094),O=e.i(13120),U=e.i(53296),L=e.i(57561),F=e.i(48539);e.s(["f",0,({productId:e,disabled:a=!1})=>{let{selectedLocale:s,setSelectedLocale:i,languageDialectList:l}=(0,L.f)(),{formatMessage:u}=(0,n.X)(),{hasRole:m}=(0,o.f)(),{defaultLocale:p,shopInfo:b,loading:y}=(0,F.f)(),{translatedTexts:w}=(({productId:e})=>{let{customProperties:t}=(0,D.f)(),{data:a,loading:s,error:i}=(0,v.f)(((e="")=>h.a`
197
198
  query TranslatedProductTexts($productId: ID!) {
198
199
  translatedProductTexts(productId: $productId) {
199
200
  ...ProductTextsFragment
200
201
  ${e}
201
202
  }
202
203
  }
203
- ${V.f}
204
- `)(t?.ProductTexts),{skip:!e,variables:{productId:e}});return{translatedTexts:s?.translatedProductTexts||[],loading:a,error:i}})({productId:e}),v=n({id:"saved",defaultMessage:"Saved"}),{updateProductTexts:j}=(()=>{let[e]=(0,C.f)(D);return{updateProductTexts:async({productId:t,texts:s})=>e({variables:{productId:t,texts:s},refetchQueries:["TranslatedProductTexts"]})}})(),N=async({slug:t,title:s,subtitle:i,vendor:l,description:r,brand:d,labels:n})=>(await j({productId:e,texts:[{locale:a,slug:t,title:s,subtitle:i,vendor:l,description:r,brand:d,labels:n}]}),{success:!0}),_=(0,w.f)({disabled:s,submit:N,successMessage:v,initialValues:{slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[]}});return(0,t.useEffect)(()=>{let e=h?.find(e=>e.locale===a);_.api.setValues({slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[],...e||{}})},[h,a]),(0,t.useEffect)(()=>{if(p&&h?.length&&!h?.find(({locale:e})=>e===a))if(f&&h?.find(({locale:e})=>e===f))i(f);else if(f&&h?.find(({locale:e})=>e===f.split("-")[0]))i(f.split("-")[0]);else{let e=h?.find(({locale:e})=>e&&l?.find(({isoCode:t})=>t===e));i(e?.locale)}},[x,h]),(0,r.jsx)(E.f,{documentationLabel:n({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(o.L,{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)(u.U,{children:(0,r.jsxs)(g.f,{form:_,disabled:!m(d.C.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)(y.f,{name:"slug",disabled:!m(d.C.ManageProducts),required:!0,id:"slug",label:n({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)(y.f,{name:"title",disabled:!m(d.C.ManageProducts),required:!0,id:"title",label:n({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)(y.f,{name:"subtitle",disabled:!m(d.C.ManageProducts),id:"subtitle",label:n({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)(y.f,{name:"vendor",disabled:!m(d.C.ManageProducts),id:"vendor",label:n({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)(y.f,{name:"brand",disabled:!m(d.C.ManageProducts),id:"brand",label:n({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)(q.f,{name:"labels",id:"labels",disabled:!m(d.C.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,r.jsx)(A.f,{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)(R.f,{name:"description",id:"description",disabled:!m(d.C.ManageProducts),label:n({id:"description",defaultMessage:"Description"})})})]}),m(d.C.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)(b.f,{label:n({id:"save",defaultMessage:"Save"})})})]})})})}],10785);var U=e.i(28401),F=e.i(59295),Q=e.i(6277),B=e.i(33006),z=e.i(93994),X=e.i(64479);let K=M.a`
204
+ ${E.f}
205
+ `)(t?.ProductTexts),{skip:!e,variables:{productId:e}});return{translatedTexts:a?.translatedProductTexts||[],loading:s,error:i}})({productId:e}),N=u({id:"saved",defaultMessage:"Saved"}),{updateProductTexts:M}=(()=>{let[e]=(0,j.f)(R);return{updateProductTexts:async({productId:t,texts:a})=>e({variables:{productId:t,texts:a},refetchQueries:["TranslatedProductTexts"]})}})(),P=async({slug:t,title:a,subtitle:i,vendor:l,description:r,brand:d,labels:n})=>(await M({productId:e,texts:[{locale:s,slug:t,title:a,subtitle:i,vendor:l,description:r,brand:d,labels:n}]}),{success:!0}),_=(0,g.f)({disabled:a,submit:P,successMessage:N,initialValues:{slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[]}});return(0,t.useEffect)(()=>{let e=w?.find(e=>e.locale===s);_.api.setValues({slug:"",title:"",subtitle:"",vendor:"",description:"",brand:"",labels:[],...e||{}})},[w,s]),(0,t.useEffect)(()=>{if(b&&w?.length&&!w?.find(({locale:e})=>e===s))if(p&&w?.find(({locale:e})=>e===p))i(p);else if(p&&w?.find(({locale:e})=>e===p.split("-")[0]))i(p.split("-")[0]);else{let e=w?.find(({locale:e})=>e&&l?.find(({isoCode:t})=>t===e));i(e?.locale)}},[y,w]),(0,r.jsx)(q.f,{documentationLabel:u({id:"texts",defaultMessage:"Texts"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(n.L,{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)(c.U,{children:(0,r.jsxs)(f.f,{form:_,disabled:!m(d.C.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)(k.f,{name:"slug",disabled:!m(d.C.ManageProducts),required:!0,id:"slug",label:u({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)(k.f,{name:"title",disabled:!m(d.C.ManageProducts),required:!0,id:"title",label:u({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)(k.f,{name:"subtitle",disabled:!m(d.C.ManageProducts),id:"subtitle",label:u({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)(k.f,{name:"vendor",disabled:!m(d.C.ManageProducts),id:"vendor",label:u({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)(k.f,{name:"brand",disabled:!m(d.C.ManageProducts),id:"brand",label:u({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)(O.f,{name:"labels",id:"labels",disabled:!m(d.C.ManageProducts),label:u({id:"labels",defaultMessage:"Labels"}),placeholder:u({id:"label",defaultMessage:"Label"}),buttonText:u({id:"add",defaultMessage:"Add"}),autoComplete:"on",className:"text-sm"}),(0,r.jsx)(U.f,{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)(A.f,{name:"description",id:"description",disabled:!m(d.C.ManageProducts),label:u({id:"description",defaultMessage:"Description"})})})]}),m(d.C.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)(x.f,{label:u({id:"save",defaultMessage:"Save"})})})]})})})}],10785);var B=e.i(28401),Q=e.i(59295),z=e.i(6277),X=e.i(33006),K=e.i(93994),W=e.i(64479);let Z=h.a`
205
206
  mutation PrepareProductMediaUpload($mediaName: String!, $productId: ID!) {
206
207
  prepareProductMediaUpload(mediaName: $mediaName, productId: $productId) {
207
208
  _id
@@ -209,7 +210,7 @@
209
210
  expires
210
211
  }
211
212
  }
212
- `;var W=e.i(1880);let Z=M.a`
213
+ `;var H=e.i(1880);let G=h.a`
213
214
  fragment ProductMediaFragment on ProductMedia {
214
215
  _id
215
216
  tags
@@ -228,7 +229,7 @@
228
229
  subtitle
229
230
  }
230
231
  }
231
- `,H=M.a`
232
+ `,J=h.a`
232
233
  query ProductMedia($productId: ID, $slug: String) {
233
234
  product(productId: $productId, slug: $slug) {
234
235
  _id
@@ -237,22 +238,22 @@
237
238
  }
238
239
  }
239
240
  }
240
- ${Z}
241
- `;var G=e.i(2194),J=e.i(90062);let Y=M.a`
241
+ ${G}
242
+ `;var Y=e.i(2194),ee=e.i(90062);let et=h.a`
242
243
  fragment ProductMediaTextsFragment on ProductMediaTexts {
243
244
  _id
244
245
  locale
245
246
  title
246
247
  subtitle
247
248
  }
248
- `,ee=M.a`
249
+ `,ea=h.a`
249
250
  query TranslatedProductMediaTexts($productMediaId: ID!) {
250
251
  translatedProductMediaTexts(productMediaId: $productMediaId) {
251
252
  ...ProductMediaTextsFragment
252
253
  }
253
254
  }
254
- ${Y}
255
- `,et=M.a`
255
+ ${et}
256
+ `,es=h.a`
256
257
  mutation UpdateProductMediaTexts(
257
258
  $productMediaId: ID!
258
259
  $texts: [ProductMediaTextInput!]!
@@ -261,20 +262,20 @@
261
262
  ...ProductMediaTextsFragment
262
263
  }
263
264
  }
264
- ${Y}
265
- `;var es=e.i(15971);let ea=M.a`
265
+ ${et}
266
+ `;var ei=e.i(15971);let el=h.a`
266
267
  mutation RemoveProductMedia($productMediaId: ID!) {
267
268
  removeProductMedia(productMediaId: $productMediaId) {
268
269
  _id
269
270
  }
270
271
  }
271
- `;var ei=e.i(6607);let el=({media:e,id:s})=>{let{setModal:a}=(0,ei.f)(),{removeProductMedia:i}=(()=>{let[e]=(0,C.f)(ea);return{removeProductMedia:async({productMediaId:t})=>e({variables:{productMediaId:t},refetchQueries:["ProductMedia"]})}})(),{formatMessage:l}=(0,o.X)(),{selectedLocale:n}=(0,O.f)(),{updateProductMediaTexts:u}=(()=>{let[e]=(0,C.f)(et);return{updateProductMediaTexts:async({productMediaId:t,texts:s})=>e({variables:{productMediaId:t,texts:s},refetchQueries:["TranslatedProductMediaTexts"]})}})(),[m,f]=(0,t.useState)(!1),{hasRole:p}=(0,c.f)(),{translatedMediaTexts:x}=(({productMediaId:e})=>{let{data:t,loading:s,error:a}=(0,P.f)(ee,{skip:!e,variables:{productMediaId:e}});return{translatedMediaTexts:t?.translatedProductMediaTexts||[],loading:s,error:a}})({productMediaId:e._id}),g=x?.find(e=>e.locale===n)||{},h=async e=>{await a((0,r.jsx)(es.f,{onCancelClick:async()=>a(""),message:l({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()=>{a(""),await i({productMediaId:e}),U.toast.success(l({id:"product_media_deleted",defaultMessage:"Media deleted successfully"}))},okText:l({id:"delete_product_media",defaultMessage:"Delete media"})}))},v=async({title:t,subtitle:s})=>(await u({productMediaId:e._id,texts:[{title:t,locale:n,subtitle:s}]}),f(!1),!0);return(0,r.jsx)(J.f,{id:s,media:e,mediaText:g,isEdit:m,onDelete:p(d.C.ManageProducts)?h:void 0,onEdit:p(d.C.ManageProducts)?f:void 0,onUpdate:p(d.C.ManageProducts)?v:void 0})},er=({medias:e,items:t})=>{let{formatMessage:s}=(0,o.X)();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:s({id:"product_media",defaultMessage:"Product Media"})}),(0,r.jsx)("div",{className:"flow-root",children:(0,r.jsx)(Q.V,{items:t,strategy:Q.W,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 s=Object.values(e).find(e=>e._id===t);return(0,r.jsx)(el,{id:t,media:s},s._id)}):(0,r.jsx)(G.f,{message:s({id:"media",defaultMessage:"Media"})})})})})]})})},ed=M.a`
272
+ `;var er=e.i(6607);let ed=({media:e,id:a})=>{let{setModal:s}=(0,er.f)(),{removeProductMedia:i}=(()=>{let[e]=(0,j.f)(el);return{removeProductMedia:async({productMediaId:t})=>e({variables:{productMediaId:t},refetchQueries:["ProductMedia"]})}})(),{formatMessage:l}=(0,n.X)(),{selectedLocale:c}=(0,L.f)(),{updateProductMediaTexts:u}=(()=>{let[e]=(0,j.f)(es);return{updateProductMediaTexts:async({productMediaId:t,texts:a})=>e({variables:{productMediaId:t,texts:a},refetchQueries:["TranslatedProductMediaTexts"]})}})(),[m,f]=(0,t.useState)(!1),{hasRole:p}=(0,o.f)(),{translatedMediaTexts:x}=(({productMediaId:e})=>{let{data:t,loading:a,error:s}=(0,v.f)(ea,{skip:!e,variables:{productMediaId:e}});return{translatedMediaTexts:t?.translatedProductMediaTexts||[],loading:a,error:s}})({productMediaId:e._id}),g=x?.find(e=>e.locale===c)||{},h=async e=>{await s((0,r.jsx)(ei.f,{onCancelClick:async()=>s(""),message:l({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 i({productMediaId:e}),B.toast.success(l({id:"product_media_deleted",defaultMessage:"Media deleted successfully"}))},okText:l({id:"delete_product_media",defaultMessage:"Delete media"})}))},b=async({title:t,subtitle:a})=>(await u({productMediaId:e._id,texts:[{title:t,locale:c,subtitle:a}]}),f(!1),!0);return(0,r.jsx)(ee.f,{id:a,media:e,mediaText:g,isEdit:m,onDelete:p(d.C.ManageProducts)?h:void 0,onEdit:p(d.C.ManageProducts)?f:void 0,onUpdate:p(d.C.ManageProducts)?b:void 0})},en=({medias:e,items:t})=>{let{formatMessage:a}=(0,n.X)();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)(z.V,{items:t,strategy:z.W,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)(Y.f,{message:a({id:"media",defaultMessage:"Media"})})})})})]})})},eo=h.a`
272
273
  mutation ReOrderProductMedia($sortKeys: [ReorderProductMediaInput!]!) {
273
274
  reorderProductMedia(sortKeys: $sortKeys) {
274
275
  _id
275
276
  }
276
277
  }
277
- `;e.s(["f",0,({productId:e})=>{let{productMedia:t}=(({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{data:a,loading:i,error:l}=(0,P.f)(H,{skip:!e&&!s,variables:{productId:e||s}});return{productMedia:a?.product?.media||[],loading:i,error:l}})({productId:e}),{formatMessage:s}=(0,o.X)(),{hasRole:a}=(0,c.f)(),{addProductMedia:i}=(()=>{let[e]=(0,C.f)(K),{confirmMediaUpload:t}=(0,X.f)({refetchQueries:["Product"]});return{addProductMedia:async({productId:s,media:a})=>{let{data:i}=await e({variables:{productId:s,mediaName:a.name}}),{prepareProductMediaUpload:l}=i;return await (0,z.f)(a,l.putURL),t({mediaUploadTicketId:l._id,size:a?.size,type:a.type})}}})(),{reOrderProductMedia:l}=(()=>{let[e]=(0,C.f)(ed);return{reOrderProductMedia:async({sortKeys:t})=>e({variables:{sortKeys:t},refetchQueries:["ProductMedia"]})}})(),n=t?.map(e=>e._id),u=async t=>{try{await i({productId:e,media:t}),U.toast.success(s({id:"product_media_upload",defaultMessage:"Media uploaded successfully"}))}catch(e){U.toast.error(s({id:"fail_upload",defaultMessage:"Media upload failed"}))}},m=async e=>{let{active:t,over:a}=e;if(t.id!==a.id){let e=n.indexOf(t.id),i=n.indexOf(a.id),r=(0,Q.e)(n,e,i).map((e,t)=>({productMediaId:e,sortKey:t}));try{await l({sortKeys:r}),U.toast.success(s({id:"link_reorder",defaultMessage:"Link reorder successfully"}))}catch(e){U.toast.error(s({id:"fail_reorder",defaultMessage:"Reordering failed, Try again!"}))}}else U.toast.info(s({id:"reorder_original",defaultMessage:"Reorder to original location"}))},f=(0,F.n)((0,F.J)(F.k,{activationConstraint:{distance:5}}),(0,F.J)(F.y,{coordinateGetter:Q.j}));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:[a(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"mx-auto w-full px-6 lg:col-span-6 lg:col-start-1",children:(0,r.jsx)(B.f,{onlyDragAndDrop:!0,addMedia:u})}),(0,r.jsx)(F.H,{sensors:f,collisionDetection:F.P,onDragEnd:m,children:(0,r.jsx)(er,{medias:t,items:n})})]})}],1330);let en=M.a`
278
+ `;e.s(["f",0,({productId:e})=>{let{productMedia:t}=(({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{data:s,loading:i,error:l}=(0,v.f)(J,{skip:!e&&!a,variables:{productId:e||a}});return{productMedia:s?.product?.media||[],loading:i,error:l}})({productId:e}),{formatMessage:a}=(0,n.X)(),{hasRole:s}=(0,o.f)(),{addProductMedia:i}=(()=>{let[e]=(0,j.f)(Z),{confirmMediaUpload:t}=(0,W.f)({refetchQueries:["Product"]});return{addProductMedia:async({productId:a,media:s})=>{let{data:i}=await e({variables:{productId:a,mediaName:s.name}}),{prepareProductMediaUpload:l}=i;return await (0,K.f)(s,l.putURL),t({mediaUploadTicketId:l._id,size:s?.size,type:s.type})}}})(),{reOrderProductMedia:l}=(()=>{let[e]=(0,j.f)(eo);return{reOrderProductMedia:async({sortKeys:t})=>e({variables:{sortKeys:t},refetchQueries:["ProductMedia"]})}})(),c=t?.map(e=>e._id),u=async t=>{try{await i({productId:e,media:t}),B.toast.success(a({id:"product_media_upload",defaultMessage:"Media uploaded successfully"}))}catch(e){B.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=c.indexOf(t.id),i=c.indexOf(s.id),r=(0,z.e)(c,e,i).map((e,t)=>({productMediaId:e,sortKey:t}));try{await l({sortKeys:r}),B.toast.success(a({id:"link_reorder",defaultMessage:"Link reorder successfully"}))}catch(e){B.toast.error(a({id:"fail_reorder",defaultMessage:"Reordering failed, Try again!"}))}}else B.toast.info(a({id:"reorder_original",defaultMessage:"Reorder to original location"}))},f=(0,Q.n)((0,Q.J)(Q.k,{activationConstraint:{distance:5}}),(0,Q.J)(Q.y,{coordinateGetter:z.j}));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(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"mx-auto w-full px-6 lg:col-span-6 lg:col-start-1",children:(0,r.jsx)(X.f,{onlyDragAndDrop:!0,addMedia:u})}),(0,r.jsx)(Q.H,{sensors:f,collisionDetection:Q.P,onDragEnd:m,children:(0,r.jsx)(en,{medias:t,items:c})})]})}],1330);let ec=h.a`
278
279
  fragment ProductPlanConfigurationFragment on ProductPlanConfiguration {
279
280
  usageCalculationType
280
281
  billingInterval
@@ -283,7 +284,7 @@
283
284
  billingIntervalCount
284
285
  minimumCommitmentPeriods
285
286
  }
286
- `,eo=M.a`
287
+ `,eu=h.a`
287
288
  query ProductPlan($productId: ID, $slug: String) {
288
289
  product(productId: $productId, slug: $slug) {
289
290
  _id
@@ -294,8 +295,8 @@
294
295
  }
295
296
  }
296
297
  }
297
- ${en}
298
- `,ec=M.a`
298
+ ${ec}
299
+ `,em=h.a`
299
300
  query ProductPlanConfigurationOptions {
300
301
  usageCalculationTypes: __type(name: "ProductPlanUsageCalculationType") {
301
302
  options: enumValues {
@@ -310,13 +311,13 @@
310
311
  }
311
312
  }
312
313
  }
313
- `,eu=M.a`
314
+ `,ef=h.a`
314
315
  mutation UpdateProductPlan($productId: ID!, $plan: UpdateProductPlanInput!) {
315
316
  updateProductPlan(productId: $productId, plan: $plan) {
316
317
  _id
317
318
  }
318
319
  }
319
- `;e.s(["f",0,({productId:e,disabled:s=!1})=>{let{formatMessage:a}=(0,o.X)(),{configurationIntervals:i,usageCalculationTypes:l}=(()=>{let{data:e,loading:t,error:s}=(0,P.f)(ec),a=e?.usageCalculationTypes?.options||[];return{configurationIntervals:e?.configurationIntervals?.options||[],usageCalculationTypes:a,loading:t,error:s}})(),{plan:n,loading:f}=(({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{data:a,loading:i,error:l}=(0,P.f)(eo,{skip:!e&&!s,variables:{productId:e||s}}),r=a?.product;return{plan:r?.plan,loading:i,error:l}})({productId:e}),{hasRole:p}=(0,c.f)(),{updateProductPlan:x}=(()=>{let[e]=(0,C.f)(eu);return{updateProductPlan:async({productId:t,plan:{usageCalculationType:s,billingInterval:a,billingIntervalCount:i=null,trialInterval:l=null,trialIntervalCount:r=null,minimumCommitmentPeriods:d=null}})=>e({variables:{productId:t,plan:{usageCalculationType:s,billingInterval:a,billingIntervalCount:i,trialInterval:l,trialIntervalCount:r,minimumCommitmentPeriods:d}},refetchQueries:["Products"]})}})(),h=a({id:"enrollment_updated_successfully",defaultMessage:"Enrollment saved successfully"}),j=async({trialInterval:t,trialIntervalCount:s,billingInterval:a,billingIntervalCount:i,usageCalculationType:l,minimumCommitmentPeriods:r})=>(await x({productId:e,plan:{billingInterval:a,usageCalculationType:l,billingIntervalCount:i,trialInterval:t,trialIntervalCount:s,minimumCommitmentPeriods:r?parseInt(r,10):null}}),{success:!0}),N=(0,w.f)({disabled:s,submit:j,successMessage:h,initialValues:{trialInterval:"",trialIntervalCount:"",billingInterval:"",billingIntervalCount:"",usageCalculationType:"",minimumCommitmentPeriods:""},getSubmitErrorMessage:e=>e?.message?.includes("Status of the product does not allow this operation")?a({id:"subscription_product_type_not_valid",defaultMessage:"Status of the product does not allow this operation"}):e?.message||""});return(0,t.useEffect)(()=>{n&&!f&&N.api.setValues(n)},[n]),(0,r.jsx)(E.f,{documentationLabel:a({id:"subscription",defaultMessage:"Subscription"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(o.L,{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)(u.U,{children:(0,r.jsx)(g.f,{form:N,children:(0,r.jsxs)("div",{className:"relative max-w-full space-y-6 rounded-md sm:p-6",children:[(0,r.jsx)(v.f,{required:!0,className:"mt-2.5 w-full py-1.5 text-sm font-medium text-slate-500",label:a({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),placeholder:a({id:"usage_calculation_type",defaultMessage:"Usage calculation type"}),name:"usageCalculationType",options:(0,m.f)(l,"value","value")}),(0,r.jsxs)("div",{className:"w-full items-end justify-end sm:flex",children:[(0,r.jsx)(v.f,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",required:!0,label:a({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),placeholder:a({id:"billing_interval_unit",defaultMessage:"Billing interval unit"}),name:"billingInterval",options:(0,m.f)(i,"value","value")}),(0,r.jsx)(y.f,{name:"billingIntervalCount",id:"billing_unit",type:"number",required:!0,label:a({id:"billing_unit",defaultMessage:"Billing Unit"}),placeholder:a({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)(v.f,{className:"mt-2.5 w-full text-sm font-medium text-slate-500",label:a({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),placeholder:a({id:"trial_interval_unit",defaultMessage:"Trial interval unit"}),name:"trialInterval",options:(0,m.f)(i,"value","value")}),(0,r.jsx)(y.f,{type:"number",name:"trialIntervalCount",id:"trialIntervalCount ",label:a({id:"trial_unit",defaultMessage:"Trial Unit"}),placeholder:a({id:"trial_unit",defaultMessage:"Trial Unit"}),required:!0,className:"mt-1 w-full text-sm font-medium text-slate-500 sm:ml-1"})]}),(0,r.jsx)(y.f,{type:"number",name:"minimumCommitmentPeriods",id:"minimumCommitmentPeriods",label:a({id:"minimum_commitment_periods",defaultMessage:"Minimum commitment periods"}),placeholder:a({id:"minimum_commitment_periods_placeholder",defaultMessage:"e.g. 12 for a 12-period contract"}),className:"mt-1 w-full text-sm font-medium text-slate-500"}),p(d.C.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)(b.f,{label:a({id:"save",defaultMessage:"Save"})})})]})})})})}],73356);var em=e.i(60959);let ef=M.a`
320
+ `;e.s(["f",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,n.X)(),{configurationIntervals:i,usageCalculationTypes:l}=(()=>{let{data:e,loading:t,error:a}=(0,v.f)(em),s=e?.usageCalculationTypes?.options||[];return{configurationIntervals:e?.configurationIntervals?.options||[],usageCalculationTypes:s,loading:t,error:a}})(),{plan:u,loading:m}=(({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{data:s,loading:i,error:l}=(0,v.f)(eu,{skip:!e&&!a,variables:{productId:e||a}}),r=s?.product;return{plan:r?.plan,loading:i,error:l}})({productId:e}),{hasRole:p}=(0,o.f)(),{updateProductPlan:h}=(()=>{let[e]=(0,j.f)(ef);return{updateProductPlan:async({productId:t,plan:{usageCalculationType:a,billingInterval:s,billingIntervalCount:i=null,trialInterval:l=null,trialIntervalCount:r=null,minimumCommitmentPeriods:d=null}})=>e({variables:{productId:t,plan:{usageCalculationType:a,billingInterval:s,billingIntervalCount:i,trialInterval:l,trialIntervalCount:r,minimumCommitmentPeriods:d}},refetchQueries:["Products"]})}})(),b=s({id:"enrollment_updated_successfully",defaultMessage:"Enrollment saved successfully"}),y=async({trialInterval:t,trialIntervalCount:a,billingInterval:s,billingIntervalCount:i,usageCalculationType:l,minimumCommitmentPeriods:r})=>(await h({productId:e,plan:{billingInterval:s,usageCalculationType:l,billingIntervalCount:i,trialInterval:t,trialIntervalCount:a,minimumCommitmentPeriods:r?parseInt(r,10):null}}),{success:!0}),w=(0,g.f)({disabled:a,submit:y,successMessage:b,initialValues:{trialInterval:"",trialIntervalCount:"",billingInterval:"",billingIntervalCount:"",usageCalculationType:"",minimumCommitmentPeriods:""},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)(()=>{u&&!m&&w.api.setValues(u)},[u]),(0,r.jsx)(q.f,{documentationLabel:s({id:"subscription",defaultMessage:"Subscription"}),className:"mt-2 lg:mt-5",documentation:(0,r.jsx)(n.L,{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)(c.U,{children:(0,r.jsx)(f.f,{form:w,children:(0,r.jsxs)("div",{className:"relative max-w-full space-y-6 rounded-md sm:p-6",children:[(0,r.jsx)(C.f,{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,_.f)(l,"value","value")}),(0,r.jsxs)("div",{className:"w-full items-end justify-end sm:flex",children:[(0,r.jsx)(C.f,{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,_.f)(i,"value","value")}),(0,r.jsx)(k.f,{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)(C.f,{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,_.f)(i,"value","value")}),(0,r.jsx)(k.f,{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"})]}),(0,r.jsx)(k.f,{type:"number",name:"minimumCommitmentPeriods",id:"minimumCommitmentPeriods",label:s({id:"minimum_commitment_periods",defaultMessage:"Minimum commitment periods"}),placeholder:s({id:"minimum_commitment_periods_placeholder",defaultMessage:"e.g. 12 for a 12-period contract"}),className:"mt-1 w-full text-sm font-medium text-slate-500"}),p(d.C.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)(x.f,{label:s({id:"save",defaultMessage:"Save"})})})]})})})})}],73356);var ep=e.i(60959);let ex=h.a`
320
321
  query ProductSupply($productId: ID, $slug: String) {
321
322
  product(productId: $productId, slug: $slug) {
322
323
  _id
@@ -327,8 +328,8 @@
327
328
  }
328
329
  }
329
330
  }
330
- ${em.f}
331
- `,ep=M.a`
331
+ ${ep.f}
332
+ `,eg=h.a`
332
333
  mutation UpdateProductSupply(
333
334
  $productId: ID!
334
335
  $supply: UpdateProductSupplyInput!
@@ -342,8 +343,8 @@
342
343
  }
343
344
  }
344
345
  }
345
- ${em.f}
346
- `;e.s(["f",0,({productId:e,disabled:s=!1})=>{let{formatMessage:a}=(0,o.X)(),i=a({id:"saved",defaultMessage:"Saved"}),{hasRole:l}=(0,c.f)(),{updateProductSupply:n}=(()=>{let[e]=(0,C.f)(ep);return{updateProductSupply:async({productId:t,supply:{weightInGram:s=null,heightInMillimeters:a=null,lengthInMillimeters:i=null,widthInMillimeters:l=null}})=>e({variables:{productId:t,supply:{weightInGram:s||null,heightInMillimeters:a||null,lengthInMillimeters:i||null,widthInMillimeters:l||null}},refetchQueries:["Products"]})}})(),{dimensions:m}=(({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{data:a,loading:i,error:l}=(0,P.f)(ef,{skip:!e&&!t,variables:{productId:e||s}}),r=a?.product;return{dimensions:r?.dimensions||{},loading:i,error:l}})({productId:e}),f=async({weight:t,length:s,width:a,height:i})=>(await n({productId:e,supply:{weightInGram:t,lengthInMillimeters:s,heightInMillimeters:i,widthInMillimeters:a}}),{success:!0}),p=(0,w.f)({disabled:s,submit:f,getSubmitErrorMessage:e=>(e.message.includes("supply.weightInGram")&&e.message.includes("Expected type Int")?p.api.setFieldError("weight","Invalid value, only integer is accepted"):e.message.includes("supply.heightInMillimeters")&&e.message.includes("Expected type Int")?p.api.setFieldError("height","Invalid value, only integer is accepted"):e.message.includes("supply.lengthInMillimeters")&&e.message.includes("Expected type Int")&&p.api.setFieldError("length","Invalid value, only integer is accepted"),null),successMessage:i,initialValues:{weight:"",length:"",width:"",height:""}});return(0,t.useEffect)(()=>{Object.keys(m).length&&p.api.setValues(m)},[m]),(0,r.jsx)("div",{className:"mt-5 md:col-span-2 md:mt-0",children:(0,r.jsx)(u.U,{children:(0,r.jsxs)(g.f,{form:p,disabled:!l(d.C.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)(y.f,{validators:[(0,N.j)()],type:"number",name:"weight",disabled:!l(d.C.ManageProducts),id:"weight",label:a({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)(y.f,{validators:[(0,N.j)()],name:"length",disabled:!l(d.C.ManageProducts),id:"length",type:"number",label:a({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)(y.f,{validators:[(0,N.j)()],type:"number",name:"width",disabled:!l(d.C.ManageProducts),id:"width ",label:a({id:"width",defaultMessage:"Width (Millimeter)"}),className:"text-sm "})}),(0,r.jsx)("div",{className:"col-span-6 sm:col-span-3",children:(0,r.jsx)(y.f,{validators:[(0,N.j)()],name:"height",disabled:!l(d.C.ManageProducts),type:"number",id:"height",label:a({id:"height",defaultMessage:"Height (Millimeter)"}),className:"text-sm "})})]})}),l(d.C.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)(b.f,{label:a({id:"save",defaultMessage:"Save"}),full:!0})})]})})})}],50099);var ex=e.i(37369),eg=e.i(53576);let eh=M.a`
346
+ ${ep.f}
347
+ `;e.s(["f",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,n.X)(),i=s({id:"saved",defaultMessage:"Saved"}),{hasRole:l}=(0,o.f)(),{updateProductSupply:u}=(()=>{let[e]=(0,j.f)(eg);return{updateProductSupply:async({productId:t,supply:{weightInGram:a=null,heightInMillimeters:s=null,lengthInMillimeters:i=null,widthInMillimeters:l=null}})=>e({variables:{productId:t,supply:{weightInGram:a||null,heightInMillimeters:s||null,lengthInMillimeters:i||null,widthInMillimeters:l||null}},refetchQueries:["Products"]})}})(),{dimensions:m}=(({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{data:s,loading:i,error:l}=(0,v.f)(ex,{skip:!e&&!t,variables:{productId:e||a}}),r=s?.product;return{dimensions:r?.dimensions||{},loading:i,error:l}})({productId:e}),p=async({weight:t,length:a,width:s,height:i})=>(await u({productId:e,supply:{weightInGram:t,lengthInMillimeters:a,heightInMillimeters:i,widthInMillimeters:s}}),{success:!0}),h=(0,g.f)({disabled:a,submit:p,getSubmitErrorMessage:e=>(e.message.includes("supply.weightInGram")&&e.message.includes("Expected type Int")?h.api.setFieldError("weight","Invalid value, only integer is accepted"):e.message.includes("supply.heightInMillimeters")&&e.message.includes("Expected type Int")?h.api.setFieldError("height","Invalid value, only integer is accepted"):e.message.includes("supply.lengthInMillimeters")&&e.message.includes("Expected type Int")&&h.api.setFieldError("length","Invalid value, only integer is accepted"),null),successMessage:i,initialValues:{weight:"",length:"",width:"",height:""}});return(0,t.useEffect)(()=>{Object.keys(m).length&&h.api.setValues(m)},[m]),(0,r.jsx)("div",{className:"mt-5 md:col-span-2 md:mt-0",children:(0,r.jsx)(c.U,{children:(0,r.jsxs)(f.f,{form:h,disabled:!l(d.C.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)(k.f,{validators:[(0,S.j)()],type:"number",name:"weight",disabled:!l(d.C.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)(k.f,{validators:[(0,S.j)()],name:"length",disabled:!l(d.C.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)(k.f,{validators:[(0,S.j)()],type:"number",name:"width",disabled:!l(d.C.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)(k.f,{validators:[(0,S.j)()],name:"height",disabled:!l(d.C.ManageProducts),type:"number",id:"height",label:s({id:"height",defaultMessage:"Height (Millimeter)"}),className:"text-sm "})})]})}),l(d.C.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)(x.f,{label:s({id:"save",defaultMessage:"Save"}),full:!0})})]})})})}],50099);var eh=e.i(37369),ev=e.i(53576);let eb=h.a`
347
348
  mutation CreateProductVariation(
348
349
  $productId: ID!
349
350
  $variation: CreateProductVariationInput!
@@ -357,7 +358,7 @@
357
358
  _id
358
359
  }
359
360
  }
360
- `,ev=M.a`
361
+ `,ey=h.a`
361
362
  fragment ProductVariationFragment on ProductVariation {
362
363
  _id
363
364
  type
@@ -379,7 +380,7 @@
379
380
  value
380
381
  }
381
382
  }
382
- `,eb=M.a`
383
+ `,ej=h.a`
383
384
  query ProductVariations($productId: ID, $slug: String, $locale: Locale) {
384
385
  product(productId: $productId, slug: $slug) {
385
386
  _id
@@ -390,8 +391,8 @@
390
391
  }
391
392
  }
392
393
  }
393
- ${ev}
394
- `,ey=M.a`
394
+ ${ey}
395
+ `,ew=h.a`
395
396
  query ProductVariationType {
396
397
  variationTypes: __type(name: "ProductVariationType") {
397
398
  options: enumValues {
@@ -400,13 +401,13 @@
400
401
  }
401
402
  }
402
403
  }
403
- `,ej=({helpKey:e,helpText:t,helpValues:s,...a})=>(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(y.f,{...a}),(e||t)&&(0,r.jsx)(A.f,{messageKey:e||`${a.name}_help`,defaultMessage:t,values:s,className:"mt-1"})]});var ew=e.i(95789);let eN=M.a`
404
+ `,eN=({helpKey:e,helpText:t,helpValues:a,...s})=>(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(k.f,{...s}),(e||t)&&(0,r.jsx)(U.f,{messageKey:e||`${s.name}_help`,defaultMessage:t,values:a,className:"mt-1"})]});var eM=e.i(95789);let eP=h.a`
404
405
  mutation RemoveProductVariation($productVariationId: ID!) {
405
406
  removeProductVariation(productVariationId: $productVariationId) {
406
407
  _id
407
408
  }
408
409
  }
409
- `;var eM=e.i(42469);let eP=M.a`
410
+ `;var e_=e.i(42469);let eI=h.a`
410
411
  mutation UpdateProductVariationTexts(
411
412
  $productVariationId: ID!
412
413
  $productVariationOptionValue: String
@@ -420,7 +421,7 @@
420
421
  _id
421
422
  }
422
423
  }
423
- `,e_=()=>{let[e]=(0,C.f)(eP);return{updateProductVariationTexts:async({productVariationId:t,productVariationOptionValue:s,texts:a})=>e({variables:{productVariationId:t,productVariationOptionValue:s,texts:a},refetchQueries:["ProductVariations"]})}},eI=({variation:e,onCancel:t,onSuccess:s})=>{let{updateProductVariationTexts:a}=e_(),{formatMessage:i}=(0,o.X)(),{selectedLocale:l}=(0,O.f)(),d=async({title:t,subtitle:i})=>(await a({productVariationId:e._id,texts:[{title:t,subtitle:i,locale:l}]}),s(),{success:!0}),n=(0,w.f)({submit:d,initialValues:{title:e?.texts?.title??"",subtitle:e?.texts?.subtitle??""}});return(0,r.jsx)(g.f,{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)(y.f,{className:"mt-0 py-1",name:"title",required:!0,label:i({id:"title",defaultMessage:"Title"})})}),e?.type&&(0,r.jsx)(eM.f,{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)(y.f,{className:"mt-0 py-1",name:"subtitle",label:i({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)(j.f,{onClick:t,type:"button",variant:"secondary",size:"sm",text:i({id:"cancel",defaultMessage:"Cancel"})}),(0,r.jsx)(j.f,{onClick:()=>n.api.submitForm(),type:"submit",variant:"primary",size:"sm",text:i({id:"save",defaultMessage:"Save"})})]})]})})};var eC=e.i(86712),ek=e.i(64481),e$=e.i(37650),eS=e.i(24557);let eT=({type:e,variation:s,onEdit:a,onDelete:i})=>{let[l,d]=(0,t.useState)(!1),{formatMessage:n}=(0,o.X)(),{buttonRef:c,menuRef:u,menuPosition:m}=((e,s)=>{let a=(0,t.useRef)(null),i=(0,t.useRef)(null),[l,r]=(0,t.useState)({top:0,left:0});return(0,t.useEffect)(()=>{let e=e=>{a.current&&!a.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]),(0,t.useEffect)(()=>{if(e&&i.current){let e=i.current.getBoundingClientRect(),t=e.bottom+4,s=e.right-192;s<8&&(s=8),t+80>window.innerHeight-8&&(t=e.top-80-4),r({top:t,left:s})}},[e]),{buttonRef:i,menuRef:a,menuPosition:l}})(l,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:s?.texts?.title}),e&&(0,r.jsx)(eM.f,{text:e,color:"slate",className:"rounded-md uppercase text-xs font-medium flex-shrink-0"}),s?.texts?.subtitle&&(0,r.jsx)("div",{className:"text-sm text-text-muted truncate",children:s?.texts?.subtitle}),s?.options?.length>0&&(0,r.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:s.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:["(",s?.key,")"]})]}),(0,r.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,r.jsx)("button",{ref:c,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)(eC.f,{className:"w-5 h-5 text-text-muted"})}),l&&(0,r.jsx)(ek.f,{children:(0,r.jsx)("div",{ref:u,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(),a(),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)(e$.f,{className:"mr-3 h-5 w-5"}),n({id:"edit",defaultMessage:"Edit"})]}),(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),i(s._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)(eS.f,{className:"mr-3 h-5 w-5"}),n({id:"delete",defaultMessage:"Delete"})]})]})})})]})]})})},eV=({type:e,variation:s,onDelete:a})=>{let[i,l]=(0,t.useState)(!1);return i?(0,r.jsx)(eI,{variation:s,onCancel:()=>l(!1),onSuccess:()=>l(!1)}):(0,r.jsx)(eT,{type:e,variation:s,onEdit:()=>l(!0),onDelete:a})},eD=M.a`
424
+ `,eC=()=>{let[e]=(0,j.f)(eI);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}=eC(),{formatMessage:i}=(0,n.X)(),{selectedLocale:l}=(0,L.f)(),d=async({title:t,subtitle:i})=>(await s({productVariationId:e._id,texts:[{title:t,subtitle:i,locale:l}]}),a(),{success:!0}),o=(0,g.f)({submit:d,initialValues:{title:e?.texts?.title??"",subtitle:e?.texts?.subtitle??""}});return(0,r.jsx)(f.f,{form:o,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)(k.f,{className:"mt-0 py-1",name:"title",required:!0,label:i({id:"title",defaultMessage:"Title"})})}),e?.type&&(0,r.jsx)(e_.f,{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)(k.f,{className:"mt-0 py-1",name:"subtitle",label:i({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)($.f,{onClick:t,type:"button",variant:"secondary",size:"sm",text:i({id:"cancel",defaultMessage:"Cancel"})}),(0,r.jsx)($.f,{onClick:()=>o.api.submitForm(),type:"submit",variant:"primary",size:"sm",text:i({id:"save",defaultMessage:"Save"})})]})]})})};var e$=e.i(86712),eS=e.i(64481),eT=e.i(37650),eV=e.i(24557);let eD=({type:e,variation:a,onEdit:s,onDelete:i})=>{let[l,d]=(0,t.useState)(!1),{formatMessage:o}=(0,n.X)(),{buttonRef:c,menuRef:u,menuPosition:m}=((e,a)=>{let s=(0,t.useRef)(null),i=(0,t.useRef)(null),[l,r]=(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&&i.current){let e=i.current.getBoundingClientRect(),t=e.bottom+4,a=e.right-192;a<8&&(a=8),t+80>window.innerHeight-8&&(t=e.top-80-4),r({top:t,left:a})}},[e]),{buttonRef:i,menuRef:s,menuPosition:l}})(l,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)(e_.f,{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:c,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$.f,{className:"w-5 h-5 text-text-muted"})}),l&&(0,r.jsx)(eS.f,{children:(0,r.jsx)("div",{ref:u,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)(eT.f,{className:"mr-3 h-5 w-5"}),o({id:"edit",defaultMessage:"Edit"})]}),(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),e.preventDefault(),i(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)(eV.f,{className:"mr-3 h-5 w-5"}),o({id:"delete",defaultMessage:"Delete"})]})]})})})]})]})})},eE=({type:e,variation:a,onDelete:s})=>{let[i,l]=(0,t.useState)(!1);return i?(0,r.jsx)(ek,{variation:a,onCancel:()=>l(!1),onSuccess:()=>l(!1)}):(0,r.jsx)(eD,{type:e,variation:a,onEdit:()=>l(!0),onDelete:s})},eR=h.a`
424
425
  mutation CreateProductVariationOption(
425
426
  $productVariationId: ID!
426
427
  $option: String!
@@ -434,7 +435,7 @@
434
435
  _id
435
436
  }
436
437
  }
437
- `,eE=M.a`
438
+ `,eq=h.a`
438
439
  mutation RemoveProductVariationOption(
439
440
  $productVariationId: ID!
440
441
  $productVariationOptionValue: String!
@@ -446,7 +447,7 @@
446
447
  _id
447
448
  }
448
449
  }
449
- `,eR=({onSubmit:e})=>{let{formatMessage:t}=(0,o.X)(),{hasRole:s}=(0,c.f)(),a=t({id:"variation_option_added",defaultMessage:"Variation option added successfully!"}),i=(0,w.f)({submit:e,successMessage:a,initialValues:{value:"",title:""}});return(0,r.jsxs)(g.f,{form:i,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)(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,r.jsx)("div",{className:"col-span-1",children:(0,r.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})})]}),s(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"text-right mt-2 px-6 pb-6",children:(0,r.jsx)(b.f,{className:"py-2.5",label:t({id:"add_variation_option",defaultMessage:"Add option"})})})]})};var eq=e.i(3095);let eA=({option:e,onDelete:s,variationId:a})=>{let{formatMessage:i}=(0,o.X)(),{selectedLocale:l}=(0,O.f)(),[d,n]=(0,t.useState)(!1),c=i({id:"variation_option_updated",defaultMessage:"Variation option updated successfully!"}),{updateProductVariationTexts:u}=e_(),m=async({title:t,subtitle:s})=>{let i=await u({productVariationId:a,productVariationOptionValue:e.value,texts:[{title:t,subtitle:s,locale:l}]});return n(!1),{data:i,success:!0}},f=(0,w.f)({submit:m,successMessage:c,initialValues:{title:e?.texts?.title,subtitle:e?.texts?.subtitle}});return(0,r.jsx)(g.f,{form:f,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)(eM.f,{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)(y.f,{className:"mt-0",name:"title",required:!0,label:i({id:"title",defaultMessage:"Title"})}):e?.texts?.title}),(0,r.jsx)("p",{className:"truncate text-sm text-slate-500",children:d?(0,r.jsx)(y.f,{className:"mt-0",name:"subtitle",label:i({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":i({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:i({id:"cancel",defaultMessage:"Cancel"})}),(0,r.jsx)("button",{type:"submit","aria-label":i({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:i({id:"save",defaultMessage:"Save"})})]}):(0,r.jsx)(eq.f,{onEdit:()=>{n(!0)},onDelete:()=>{s(e.value)},showEdit:!0,showDelete:!0})})]})})})})},eO=({variationId:e,options:t})=>{let{createProductVariationOption:s}=(()=>{let[e]=(0,C.f)(eD);return{createProductVariationOption:async({productVariationId:t,option:s,texts:a})=>e({variables:{productVariationId:t,option:s,texts:a},refetchQueries:["ProductVariations","Product"]})}})(),{formatMessage:a}=(0,o.X)(),{selectedLocale:i}=(0,O.f)(),{setModal:l}=(0,ei.f)(),{removeProductVariationOption:d}=(()=>{let[e]=(0,C.f)(eE);return{removeProductVariationOption:async({productVariationId:t,productVariationOptionValue:s})=>e({variables:{productVariationId:t,productVariationOptionValue:s},refetchQueries:["ProductVariations"]})}})(),n=async t=>{await l((0,r.jsx)(es.f,{message:a({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:()=>l(""),onOkClick:async()=>{l(""),await d({productVariationId:e,productVariationOptionValue:t}),U.toast.success(a({id:"product_variation_option_deleted",defaultMessage:"Variation option deleted successfully"}))},okText:a({id:"delete_variation_option",defaultMessage:"Delete option"})}))},c=async({value:t,title:a})=>(await s({productVariationId:e,option:t,texts:[{title:a,locale:i}]}),{success:!0});return(0,r.jsxs)("div",{className:"relative overflow-visible",children:[(0,r.jsx)(eR,{onSubmit:c}),t.length?t.map(t=>(0,r.jsx)(eA,{variationId:e,option:t,onDelete:n},t._id)):(0,r.jsx)(G.f,{message:a({id:"option",defaultMessage:"Option"})})]})},eL=({productVariationId:e,variation:t})=>{let{formatMessage:s}=(0,o.X)(),{setModal:a}=(0,ei.f)(),{options:i}=t,{removeProductVariation:l}=(()=>{let[e]=(0,C.f)(eN);return{removeProductVariation:async({productVariationId:t})=>e({variables:{productVariationId:t},refetchQueries:["ProductVariations"]})}})(),d=async()=>{await a((0,r.jsx)(es.f,{onCancelClick:async()=>a(""),message:s({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()=>{a(""),await l({productVariationId:e}),U.toast.success(s({id:"product_variation_deleted",defaultMessage:"Variation deleted successfully"}))},okText:s({id:"delete_product_variation",defaultMessage:"Delete variation"})}))},n=[{header:(0,r.jsx)(eV,{onDelete:d,variation:t,...t}),body:(0,r.jsx)(eO,{variationId:t._id,options:i},e)}];return(0,r.jsx)(ew.f,{"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})},eU=({onSubmit:e,disabled:t,formatMessage:s})=>{let{variationTypes:a}=(()=>{let{data:e,loading:t,error:s}=(0,P.f)(ey);return{variationTypes:e?.variationTypes?.options||[],loading:t,error:s}})(),{hasRole:i}=(0,c.f)(),l=s({id:"product_variation_added",defaultMessage:"Product variation added successfully"}),n=(0,w.f)({disabled:t,submit:e,successMessage:l,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:s({id:"product_variations_explanation_title",defaultMessage:"About Product Variations"})}),(0,r.jsx)("p",{className:"text-sm text-text-secondary",children:s({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)(g.f,{form:n,children:[(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(ej,{name:"title",id:"title",label:s({id:"title",defaultMessage:"Title"}),helpText:s({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)(ej,{name:"key",id:"key",label:s({id:"key",defaultMessage:"Key"}),helpText:s({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)(v.f,{required:!0,className:"w-full",label:s({id:"type",defaultMessage:"Type"}),placeholder:s({id:"type",defaultMessage:"Type"}),name:"type",options:(0,m.f)(a,"value","value")}),(0,r.jsx)(A.f,{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"})]})]}),i(d.C.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)(b.f,{label:s({id:"add_variation",defaultMessage:"Add variation"})})})]})]})};e.s(["f",0,({productId:e,disabled:t=!1})=>{let{createProductVariation:s}=(()=>{let[e]=(0,C.f)(eh);return{createProductVariation:async({productId:t,variation:{key:s,type:a},texts:i})=>e({variables:{productId:t,variation:{key:s,type:a},texts:i},refetchQueries:["ProductVariations"]})}})(),{selectedLocale:a}=(0,O.f)(),{formatMessage:i}=(0,o.X)(),{setModal:l}=(0,ei.f)(),{variations:d,loading:n}=(({productId:e=null,slug:t=null,locale:s=null}={})=>{let a=(0,W.Q)(t),{data:i,loading:l,error:r}=(0,P.f)(eb,{skip:!e&&!a,variables:{productId:e||a,locale:s}}),d=i?.product;return{variations:d?.variations,loading:l,error:r}})({productId:e,locale:a}),c=async({title:t,key:i,type:r})=>(await s({productId:e,variation:{key:i,type:r},texts:[{title:t,locale:a}]}),l(""),{success:!0});return n?(0,r.jsx)(eg.f,{variant:"list"}):(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)(j.f,{className:"m-1",onClick:()=>{l((0,r.jsx)(eU,{onSubmit:c,disabled:t,formatMessage:i}))},disabled:t,variant:"secondary",icon:(0,r.jsx)(ex.f,{className:"w-5 h-5"}),text:i({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)(G.f,{message:i({id:"variations",defaultMessage:"Variations"})})})]})}],77035);let eF=M.a`
450
+ `,eA=({onSubmit:e})=>{let{formatMessage:t}=(0,n.X)(),{hasRole:a}=(0,o.f)(),s=t({id:"variation_option_added",defaultMessage:"Variation option added successfully!"}),i=(0,g.f)({submit:e,successMessage:s,initialValues:{value:"",title:""}});return(0,r.jsxs)(f.f,{form:i,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)(eN,{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)(eN,{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(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"text-right mt-2 px-6 pb-6",children:(0,r.jsx)(x.f,{className:"py-2.5",label:t({id:"add_variation_option",defaultMessage:"Add option"})})})]})};var eO=e.i(3095);let eU=({option:e,onDelete:a,variationId:s})=>{let{formatMessage:i}=(0,n.X)(),{selectedLocale:l}=(0,L.f)(),[d,o]=(0,t.useState)(!1),c=i({id:"variation_option_updated",defaultMessage:"Variation option updated successfully!"}),{updateProductVariationTexts:u}=eC(),m=async({title:t,subtitle:a})=>{let i=await u({productVariationId:s,productVariationOptionValue:e.value,texts:[{title:t,subtitle:a,locale:l}]});return o(!1),{data:i,success:!0}},p=(0,g.f)({submit:m,successMessage:c,initialValues:{title:e?.texts?.title,subtitle:e?.texts?.subtitle}});return(0,r.jsx)(f.f,{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)(e_.f,{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)(k.f,{className:"mt-0",name:"title",required:!0,label:i({id:"title",defaultMessage:"Title"})}):e?.texts?.title}),(0,r.jsx)("p",{className:"truncate text-sm text-slate-500",children:d?(0,r.jsx)(k.f,{className:"mt-0",name:"subtitle",label:i({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:()=>o(!d),"aria-label":i({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:i({id:"cancel",defaultMessage:"Cancel"})}),(0,r.jsx)("button",{type:"submit","aria-label":i({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:i({id:"save",defaultMessage:"Save"})})]}):(0,r.jsx)(eO.f,{onEdit:()=>{o(!0)},onDelete:()=>{a(e.value)},showEdit:!0,showDelete:!0})})]})})})})},eL=({variationId:e,options:t})=>{let{createProductVariationOption:a}=(()=>{let[e]=(0,j.f)(eR);return{createProductVariationOption:async({productVariationId:t,option:a,texts:s})=>e({variables:{productVariationId:t,option:a,texts:s},refetchQueries:["ProductVariations","Product"]})}})(),{formatMessage:s}=(0,n.X)(),{selectedLocale:i}=(0,L.f)(),{setModal:l}=(0,er.f)(),{removeProductVariationOption:d}=(()=>{let[e]=(0,j.f)(eq);return{removeProductVariationOption:async({productVariationId:t,productVariationOptionValue:a})=>e({variables:{productVariationId:t,productVariationOptionValue:a},refetchQueries:["ProductVariations"]})}})(),o=async t=>{await l((0,r.jsx)(ei.f,{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:()=>l(""),onOkClick:async()=>{l(""),await d({productVariationId:e,productVariationOptionValue:t}),B.toast.success(s({id:"product_variation_option_deleted",defaultMessage:"Variation option deleted successfully"}))},okText:s({id:"delete_variation_option",defaultMessage:"Delete option"})}))},c=async({value:t,title:s})=>(await a({productVariationId:e,option:t,texts:[{title:s,locale:i}]}),{success:!0});return(0,r.jsxs)("div",{className:"relative overflow-visible",children:[(0,r.jsx)(eA,{onSubmit:c}),t.length?t.map(t=>(0,r.jsx)(eU,{variationId:e,option:t,onDelete:o},t._id)):(0,r.jsx)(Y.f,{message:s({id:"option",defaultMessage:"Option"})})]})},eF=({productVariationId:e,variation:t})=>{let{formatMessage:a}=(0,n.X)(),{setModal:s}=(0,er.f)(),{options:i}=t,{removeProductVariation:l}=(()=>{let[e]=(0,j.f)(eP);return{removeProductVariation:async({productVariationId:t})=>e({variables:{productVariationId:t},refetchQueries:["ProductVariations"]})}})(),d=async()=>{await s((0,r.jsx)(ei.f,{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 l({productVariationId:e}),B.toast.success(a({id:"product_variation_deleted",defaultMessage:"Variation deleted successfully"}))},okText:a({id:"delete_product_variation",defaultMessage:"Delete variation"})}))},o=[{header:(0,r.jsx)(eE,{onDelete:d,variation:t,...t}),body:(0,r.jsx)(eL,{variationId:t._id,options:i},e)}];return(0,r.jsx)(eM.f,{"data-variationid":t._id,data:o,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})},eB=({onSubmit:e,disabled:t,formatMessage:a})=>{let{variationTypes:s}=(()=>{let{data:e,loading:t,error:a}=(0,v.f)(ew);return{variationTypes:e?.variationTypes?.options||[],loading:t,error:a}})(),{hasRole:i}=(0,o.f)(),l=a({id:"product_variation_added",defaultMessage:"Product variation added successfully"}),n=(0,g.f)({disabled:t,submit:e,successMessage:l,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)(f.f,{form:n,children:[(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(eN,{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)(eN,{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)(C.f,{required:!0,className:"w-full",label:a({id:"type",defaultMessage:"Type"}),placeholder:a({id:"type",defaultMessage:"Type"}),name:"type",options:(0,_.f)(s,"value","value")}),(0,r.jsx)(U.f,{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"})]})]}),i(d.C.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)(x.f,{label:a({id:"add_variation",defaultMessage:"Add variation"})})})]})]})};e.s(["f",0,({productId:e,disabled:t=!1})=>{let{createProductVariation:a}=(()=>{let[e]=(0,j.f)(eb);return{createProductVariation:async({productId:t,variation:{key:a,type:s},texts:i})=>e({variables:{productId:t,variation:{key:a,type:s},texts:i},refetchQueries:["ProductVariations"]})}})(),{selectedLocale:s}=(0,L.f)(),{formatMessage:i}=(0,n.X)(),{setModal:l}=(0,er.f)(),{variations:d,loading:o}=(({productId:e=null,slug:t=null,locale:a=null}={})=>{let s=(0,H.Q)(t),{data:i,loading:l,error:r}=(0,v.f)(ej,{skip:!e&&!s,variables:{productId:e||s,locale:a}}),d=i?.product;return{variations:d?.variations,loading:l,error:r}})({productId:e,locale:s}),c=async({title:t,key:i,type:r})=>(await a({productId:e,variation:{key:i,type:r},texts:[{title:t,locale:s}]}),l(""),{success:!0});return o?(0,r.jsx)(ev.f,{variant:"list"}):(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)($.f,{className:"m-1",onClick:()=>{l((0,r.jsx)(eB,{onSubmit:c,disabled:t,formatMessage:i}))},disabled:t,variant:"secondary",icon:(0,r.jsx)(eh.f,{className:"w-5 h-5"}),text:i({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)(eF,{productVariationId:e._id,variation:e},e._id)):(0,r.jsx)(Y.f,{message:i({id:"variations",defaultMessage:"Variations"})})})]})}],77035);let eQ=h.a`
450
451
  query ProductWarehousing($productId: ID, $slug: String) {
451
452
  product(productId: $productId, slug: $slug) {
452
453
  _id
@@ -456,7 +457,7 @@
456
457
  }
457
458
  }
458
459
  }
459
- `,eQ=M.a`
460
+ `,ez=h.a`
460
461
  mutation UpdateProductWarehousing(
461
462
  $productId: ID!
462
463
  $warehousing: UpdateProductWarehousingInput!
@@ -469,7 +470,7 @@
469
470
  }
470
471
  }
471
472
  }
472
- `;e.s(["f",0,({productId:e,disabled:s=!1})=>{let{formatMessage:a}=(0,o.X)(),{product:i}=(({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{data:a,loading:i,error:l}=(0,P.f)(eF,{skip:!e&&!s,variables:{productId:e||s}});return{product:a?.product||{},loading:i,error:l}})({productId:e}),{hasRole:l}=(0,c.f)(),{updateProductWarehousing:n}=(()=>{let[e]=(0,C.f)(eQ);return{updateProductWarehousing:async({productId:t,warehousing:{sku:s=null,baseUnit:a=null}})=>e({variables:{productId:t,warehousing:{sku:s,baseUnit:a}},refetchQueries:["Products"]})}})(),m=a({id:"saved",defaultMessage:"Saved"}),f=async({sku:t,baseUnit:s})=>({data:await n({productId:e,warehousing:{baseUnit:s,sku:t}}),success:!0}),p=(0,w.f)({disabled:s,submit:f,successMessage:m,initialValues:{sku:"",baseUnit:""}});return(0,t.useEffect)(()=>{Object.keys(i).length&&p.api.setValues({...i})},[i]),(0,r.jsx)("div",{className:"mt-5 md:mt-0",children:(0,r.jsx)(u.U,{children:(0,r.jsxs)(g.f,{className:"rounded",form:p,disabled:!l(d.C.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)(y.f,{name:"sku",disabled:!l(d.C.ManageProducts),id:"sku",label:a({id:"sku",defaultMessage:"SKU"}),className:"mb-4 text-sm"}),(0,r.jsx)(y.f,{name:"baseUnit",id:"baseUnit",disabled:!l(d.C.ManageProducts),label:a({id:"baseUnit",defaultMessage:"Base Unit"}),className:"text-sm"})]})}),l(d.C.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)(b.f,{label:a({id:"save",defaultMessage:"Save"})})})]})})})}],56902);var eB=e.i(56417),ez=e.i(27028),eX=e.i(3883),eK=e.i(84818);let eW=M.a`
473
+ `;e.s(["f",0,({productId:e,disabled:a=!1})=>{let{formatMessage:s}=(0,n.X)(),{product:i}=(({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{data:s,loading:i,error:l}=(0,v.f)(eQ,{skip:!e&&!a,variables:{productId:e||a}});return{product:s?.product||{},loading:i,error:l}})({productId:e}),{hasRole:l}=(0,o.f)(),{updateProductWarehousing:u}=(()=>{let[e]=(0,j.f)(ez);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 u({productId:e,warehousing:{baseUnit:a,sku:t}}),success:!0}),h=(0,g.f)({disabled:a,submit:p,successMessage:m,initialValues:{sku:"",baseUnit:""}});return(0,t.useEffect)(()=>{Object.keys(i).length&&h.api.setValues({...i})},[i]),(0,r.jsx)("div",{className:"mt-5 md:mt-0",children:(0,r.jsx)(c.U,{children:(0,r.jsxs)(f.f,{className:"rounded",form:h,disabled:!l(d.C.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)(k.f,{name:"sku",disabled:!l(d.C.ManageProducts),id:"sku",label:s({id:"sku",defaultMessage:"SKU"}),className:"mb-4 text-sm"}),(0,r.jsx)(k.f,{name:"baseUnit",id:"baseUnit",disabled:!l(d.C.ManageProducts),label:s({id:"baseUnit",defaultMessage:"Base Unit"}),className:"text-sm"})]})}),l(d.C.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)(x.f,{label:s({id:"save",defaultMessage:"Save"})})})]})})})}],56902);var eX=e.i(56417),eK=e.i(27028),eW=e.i(3883),eZ=e.i(84818);let eH=h.a`
473
474
  query ProductFulfillmentSimulation(
474
475
  $productId: ID
475
476
  $deliveryProviderType: DeliveryProviderType
@@ -531,7 +532,7 @@
531
532
  }
532
533
  }
533
534
  }
534
- `,eZ=(e,t)=>e?.deliveryProvider?._id===t?.deliveryProvider?._id&&e?.warehousingProvider?._id===t?.warehousingProvider?._id,eH="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",eG=e=>[e?.interface?.label,e?.interface?.version].filter(Boolean).join(" ")||e?._id||null;e.s(["f",0,({productId:e})=>{let{formatMessage:s}=(0,o.X)(),{formatDateTime:a}=(0,eK.f)(),[i,l]=(0,t.useState)(1),[n,c]=(0,t.useState)(null),[u,m]=(0,t.useState)(""),{dispatches:f,unroutedStocks:p,loading:x,error:g}=(({productId:e,deliveryProviderType:s=null,quantity:a=null,referenceDate:i=null})=>{let{data:l,loading:r,error:d}=(0,P.f)(eW,{skip:!e,variables:{productId:e,deliveryProviderType:s,quantity:a,referenceDate:i},errorPolicy:"all"}),{dispatches:n,unroutedStocks:o}=(0,t.useMemo)(()=>{let e=l?.product||{},t=(e?.simulatedDispatches||[]).filter(e=>!s||e?.deliveryProvider?.type===s),a=(e?.simulatedStocks||[]).filter(e=>!s||!e?.deliveryProvider?.type||e?.deliveryProvider?.type===s);return{dispatches:t.map(e=>({...e,stockQuantity:a.find(t=>eZ(t,e))?.quantity??null})),unroutedStocks:a.filter(e=>!t.some(t=>eZ(e,t)))}},[l,s]);return{dispatches:n,unroutedStocks:o,loading:r,error:d}})({productId:e,quantity:i,referenceDate:n?new Date(n).getTime():null,deliveryProviderType:u||null});return(0,r.jsxs)("div",{className:"mt-5 md:mt-0 space-y-6",children:[(0,r.jsx)("div",{children:(0,r.jsx)(A.f,{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:s({id:"quantity",defaultMessage:"Quantity"})}),(0,r.jsx)("input",{type:"number",id:"simulation-quantity",min:1,value:i,onChange:e=>l(Math.max(1,Number(e.target.value))),className:eH})]}),(0,r.jsx)(eX.f,{id:"simulation-reference-date",label:s({id:"simulate_as_of",defaultMessage:"Simulate as of"}),value:n,onChange:c}),(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:s({id:"delivery_type",defaultMessage:"Delivery type"})}),(0,r.jsxs)("select",{id:"simulation-delivery-type",value:u,onChange:e=>m(e.target.value),className:eH,children:[(0,r.jsx)("option",{value:"",children:s({id:"all_types",defaultMessage:"All types"})}),Object.values(d.F).map(e=>(0,r.jsx)("option",{value:e,children:s({id:e,defaultMessage:e,description:"Delivery provider type"})},e))]})]})]}),x?(0,r.jsx)(eg.f,{variant:"list"}):!g||f.length||p.length?f.length||p.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:f.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)(eB.f,{className:"h-5 w-5 shrink-0 text-text-muted"}),(0,r.jsx)("span",{className:"truncate text-sm font-semibold text-text-primary",children:eG(e?.deliveryProvider)||s({id:"unknown_delivery_provider",defaultMessage:"Unknown delivery provider"})})]}),e?.deliveryProvider?.type&&(0,r.jsx)(eM.f,{text:s({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:s({id:"warehouse",defaultMessage:"Warehouse"})}),(0,r.jsxs)("dd",{className:"flex items-center gap-1 text-text-primary truncate",children:[(0,r.jsx)(ez.f,{className:"h-4 w-4 shrink-0 text-text-muted"}),eG(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:s({id:"ships",defaultMessage:"Ships"})}),(0,r.jsx)("dd",{className:"text-text-primary",children:a(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:s({id:"earliest_delivery",defaultMessage:"Earliest delivery"})}),(0,r.jsx)("dd",{className:"text-text-primary",children:a(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:s({id:"stock",defaultMessage:"Stock"})}),(0,r.jsx)("dd",{className:"font-semibold text-text-primary",children:s({id:"units_available",defaultMessage:"{quantity} units available"},{quantity:e.stockQuantity})})]})]})]},`${e?.deliveryProvider?._id}-${e?.warehousingProvider?._id}-${t}`))}),p.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-text-primary",children:s({id:"stock_without_dispatch_route",defaultMessage:"Stock without a dispatch route"})}),(0,r.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:s({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:p.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:[eG(e?.warehousingProvider)||"n/a",e?.deliveryProvider&&` — ${eG(e.deliveryProvider)}`]}),(0,r.jsx)("span",{className:"font-semibold text-text-primary",children:s({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)(G.f,{message:s({id:"dispatch_routes",defaultMessage:"dispatch routes"}),Icon:(0,r.jsx)(eB.f,{className:"h-6 w-6"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-text-muted",children:s({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:[s({id:"fulfillment_simulation_error",defaultMessage:"Fulfillment simulation failed"}),": ",g.message]})]})}],72264);var eJ=d;let eY=M.a`
535
+ `,eG=(e,t)=>e?.deliveryProvider?._id===t?.deliveryProvider?._id&&e?.warehousingProvider?._id===t?.warehousingProvider?._id,eJ="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",eY=e=>[e?.interface?.label,e?.interface?.version].filter(Boolean).join(" ")||e?._id||null;e.s(["f",0,({productId:e})=>{let{formatMessage:a}=(0,n.X)(),{formatDateTime:s}=(0,eZ.f)(),[i,l]=(0,t.useState)(1),[o,c]=(0,t.useState)(null),[u,m]=(0,t.useState)(""),{dispatches:f,unroutedStocks:p,loading:x,error:g}=(({productId:e,deliveryProviderType:a=null,quantity:s=null,referenceDate:i=null})=>{let{data:l,loading:r,error:d}=(0,v.f)(eH,{skip:!e,variables:{productId:e,deliveryProviderType:a,quantity:s,referenceDate:i},errorPolicy:"all"}),{dispatches:n,unroutedStocks:o}=(0,t.useMemo)(()=>{let e=l?.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)))}},[l,a]);return{dispatches:n,unroutedStocks:o,loading:r,error:d}})({productId:e,quantity:i,referenceDate:o?new Date(o).getTime():null,deliveryProviderType:u||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.f,{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:i,onChange:e=>l(Math.max(1,Number(e.target.value))),className:eJ})]}),(0,r.jsx)(eW.f,{id:"simulation-reference-date",label:a({id:"simulate_as_of",defaultMessage:"Simulate as of"}),value:o,onChange:c}),(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:u,onChange:e=>m(e.target.value),className:eJ,children:[(0,r.jsx)("option",{value:"",children:a({id:"all_types",defaultMessage:"All types"})}),Object.values(d.F).map(e=>(0,r.jsx)("option",{value:e,children:a({id:e,defaultMessage:e,description:"Delivery provider type"})},e))]})]})]}),x?(0,r.jsx)(ev.f,{variant:"list"}):!g||f.length||p.length?f.length||p.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:f.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)(eX.f,{className:"h-5 w-5 shrink-0 text-text-muted"}),(0,r.jsx)("span",{className:"truncate text-sm font-semibold text-text-primary",children:eY(e?.deliveryProvider)||a({id:"unknown_delivery_provider",defaultMessage:"Unknown delivery provider"})})]}),e?.deliveryProvider?.type&&(0,r.jsx)(e_.f,{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.f,{className:"h-4 w-4 shrink-0 text-text-muted"}),eY(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}`))}),p.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:p.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:[eY(e?.warehousingProvider)||"n/a",e?.deliveryProvider&&` — ${eY(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)(Y.f,{message:a({id:"dispatch_routes",defaultMessage:"dispatch routes"}),Icon:(0,r.jsx)(eX.f,{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 e0=d;let e1=h.a`
535
536
  fragment ProductReviewDetailFragment on ProductReview {
536
537
  _id
537
538
  created
@@ -581,7 +582,7 @@
581
582
  type
582
583
  }
583
584
  }
584
- `,e0=M.a`
585
+ `,e5=h.a`
585
586
  query ProductReviewByProduct(
586
587
  $productId: ID
587
588
  $slug: String
@@ -598,16 +599,16 @@
598
599
  reviewsCount
599
600
  }
600
601
  }
601
- ${eY}
602
- `;var e1=e.i(66859),e5=e.i(39833),e2=e.i(84339);let e3=t.forwardRef(function({title:e,titleId:s,...a},i){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:i,"aria-labelledby":s},a),e?t.createElement("title",{id:s},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.X)(),s=e.reduce((e,t)=>e+t.upVote,0),a=e.reduce((e,t)=>e+t.downVote,0),i=s?s/(s+a)*100:0,l=i?100-i: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:`${i}`,className:"flex items-center",children:[0,1,2,3,4].map(e=>{let t=i>=20*e;return(0,r.jsx)(e3,{className:`
602
+ ${e1}
603
+ `;var e2=e.i(66859),e3=e.i(39833),e4=e.i(84339);let e6=t.forwardRef(function({title:e,titleId:a,...s},i){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:i,"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"}))}),e9=({productReviews:e})=>{let{formatMessage:t}=(0,n.X)(),a=e.reduce((e,t)=>e+t.upVote,0),s=e.reduce((e,t)=>e+t.downVote,0),i=a?a/(a+s)*100:0,l=i?100-i: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:`${i}`,className:"flex items-center",children:[0,1,2,3,4].map(e=>{let t=i>=20*e;return(0,r.jsx)(e6,{className:`
603
604
  ${t?"text-amber-400":"text-slate-300 dark:text-slate-600"}
604
605
  h-5 w-5 shrink-0
605
- `,"aria-hidden":"true"},e)})})}),(0,r.jsx)("div",{className:"ml-2 text-sm",children:(0,r.jsx)(o.L,{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:s}),(0,r.jsxs)("div",{"aria-hidden":"true",className:"ml-2 flex flex-1 items-center",children:[(0,r.jsx)(e2.f,{className:`
606
- ${s>0?"text-emerald-500":"text-slate-500"}
607
- 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"}),s>0?(0,r.jsx)("div",{className:"absolute inset-y-0 rounded-full border border-emerald-500 bg-emerald-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),"%"]})]}),(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:[a,(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)(e5.f,{className:`
608
- ${a>0?"text-rose-500":"text-slate-500"}
606
+ `,"aria-hidden":"true"},e)})})}),(0,r.jsx)("div",{className:"ml-2 text-sm",children:(0,r.jsx)(n.L,{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)(e4.f,{className:`
607
+ ${a>0?"text-emerald-500":"text-slate-500"}
608
+ 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(${i}%)`}}):null]})]})]}),(0,r.jsxs)("dd",{className:"ml-3 w-10 text-right text-sm tabular-nums",children:[Math.round(i),"%"]})]}),(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)(e3.f,{className:`
609
+ ${s>0?"text-rose-500":"text-slate-500"}
609
610
  h-5 w-5 shrink-0
610
- `,"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-rose-500 bg-rose-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),"%"]})]})]})]})]})};var e6=e.i(87213);let e9=({onSubmit:e,onSubmitSuccess:t=null,defaultValue:s={},isEdit:a=!1})=>{let{formatMessage:i}=(0,o.X)(),{hasRole:l}=(0,c.f)(),n=i({id:"product_review_added",defaultMessage:"Review added successfully!"}),u=i({id:"product_review_updated",defaultMessage:"Review updated successfully!"}),m=(0,w.f)({submit:e,onSubmitSuccess:t,successMessage:a?u:n,initialValues:{title:"",review:"",rating:1,...s}});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:i({id:"write_review",defaultMessage:"Write a Review"})}),(0,r.jsxs)(g.f,{form:m,children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(y.f,{name:"title",disabled:!l(d.C.ReviewProduct),id:"title",label:i({id:"title",defaultMessage:"Title"}),autoComplete:"off",required:!0}),(0,r.jsx)(e6.f,{rows:4,name:"review",disabled:!l(d.C.ReviewProduct),id:"review",label:i({id:"review",defaultMessage:"Review"}),placeholder:i({id:"review_placeholder",defaultMessage:"Share your thoughts about this product..."})})]}),l(d.C.ReviewProduct)&&(0,r.jsx)("div",{className:"mt-6 flex justify-end",children:(0,r.jsx)(b.f,{label:i(a?{id:"update_review",defaultMessage:"Update Review"}:{id:"add_review",defaultMessage:"Add Review"}),className:"px-6 py-2"})})]})]})},e7=M.a`
611
+ `,"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(${l}%)`}}):null]})]})]}),(0,r.jsxs)("dd",{className:"ml-3 w-10 text-right text-sm tabular-nums",children:[Math.round(l),"%"]})]})]})]})]})};var e7=e.i(87213);let e8=({onSubmit:e,onSubmitSuccess:t=null,defaultValue:a={},isEdit:s=!1})=>{let{formatMessage:i}=(0,n.X)(),{hasRole:l}=(0,o.f)(),c=i({id:"product_review_added",defaultMessage:"Review added successfully!"}),u=i({id:"product_review_updated",defaultMessage:"Review updated successfully!"}),m=(0,g.f)({submit:e,onSubmitSuccess:t,successMessage:s?u:c,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:i({id:"write_review",defaultMessage:"Write a Review"})}),(0,r.jsxs)(f.f,{form:m,children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(k.f,{name:"title",disabled:!l(d.C.ReviewProduct),id:"title",label:i({id:"title",defaultMessage:"Title"}),autoComplete:"off",required:!0}),(0,r.jsx)(e7.f,{rows:4,name:"review",disabled:!l(d.C.ReviewProduct),id:"review",label:i({id:"review",defaultMessage:"Review"}),placeholder:i({id:"review_placeholder",defaultMessage:"Share your thoughts about this product..."})})]}),l(d.C.ReviewProduct)&&(0,r.jsx)("div",{className:"mt-6 flex justify-end",children:(0,r.jsx)(x.f,{label:i(s?{id:"update_review",defaultMessage:"Update Review"}:{id:"add_review",defaultMessage:"Add Review"}),className:"px-6 py-2"})})]})]})},te=h.a`
611
612
  mutation CreateProductReview(
612
613
  $productId: ID!
613
614
  $productReview: ProductReviewInput!
@@ -617,7 +618,7 @@
617
618
  _id
618
619
  }
619
620
  }
620
- `;e.s(["f",0,({productId:e})=>{let{productReviews:t,loadMore:s,reviewsCount:a}=(({productId:e=null,slug:t=null,limit:s=10,offset:a=0,sort:i=[{key:"created",value:eJ.A.Desc}]}={})=>{let{selectedLocale:l}=(0,O.f)(),{data:r,loading:d,error:n,fetchMore:o}=(0,P.f)(e0,{skip:!e,variables:{productId:e,slug:t,limit:s,offset:a,sort:i,forceLocale:l}}),c=r?.product,u=c?.reviews||[];return{productReviews:u,loading:d,error:n,reviewsCount:c?.reviewsCount||0,loadMore:()=>{o({variables:{offset:u?.length}})}}})({productId:e}),{createProductReview:i}=(()=>{let[e]=(0,C.f)(e7);return{createProductReview:async({productId:t,productReview:{title:s,rating:a,review:i}})=>e({variables:{productId:t,productReview:{title:s,rating:a,review:i}},refetchQueries:["ProductReviewByProduct","ProductReviewByUser"]})}})(),{formatMessage:l}=(0,o.X)();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)(e4,{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:s,rating:a})=>await i({productId:e,productReview:{title:t,review:s,rating:10}})}),(0,r.jsx)("h3",{className:"sr-only",children:l({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)(e1.f,{review:e},e._id))})})]})]})}),a>t?.length?(0,r.jsx)(j.f,{text:l({id:"load-more-reviews",defaultMessage:"Load reviews"}),onClick:s}):null]})}],19051);var e8=e.i(47542);let te=M.a`
621
+ `;e.s(["f",0,({productId:e})=>{let{productReviews:t,loadMore:a,reviewsCount:s}=(({productId:e=null,slug:t=null,limit:a=10,offset:s=0,sort:i=[{key:"created",value:e0.B.Desc}]}={})=>{let{selectedLocale:l}=(0,L.f)(),{data:r,loading:d,error:n,fetchMore:o}=(0,v.f)(e5,{skip:!e,variables:{productId:e,slug:t,limit:a,offset:s,sort:i,forceLocale:l}}),c=r?.product,u=c?.reviews||[];return{productReviews:u,loading:d,error:n,reviewsCount:c?.reviewsCount||0,loadMore:()=>{o({variables:{offset:u?.length}})}}})({productId:e}),{createProductReview:i}=(()=>{let[e]=(0,j.f)(te);return{createProductReview:async({productId:t,productReview:{title:a,rating:s,review:i}})=>e({variables:{productId:t,productReview:{title:a,rating:s,review:i}},refetchQueries:["ProductReviewByProduct","ProductReviewByUser"]})}})(),{formatMessage:l}=(0,n.X)();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)(e9,{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)(e8,{onSubmit:async({title:t,review:a,rating:s})=>await i({productId:e,productReview:{title:t,review:a,rating:10}})}),(0,r.jsx)("h3",{className:"sr-only",children:l({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)(e2.f,{review:e},e._id))})})]})]})}),s>t?.length?(0,r.jsx)($.f,{text:l({id:"load-more-reviews",defaultMessage:"Load reviews"}),onClick:a}):null]})}],19051);var tt=e.i(47542);let ta=h.a`
621
622
  mutation CreateProductBundleItem(
622
623
  $productId: ID!
623
624
  $item: CreateProductBundleItemInput!
@@ -626,7 +627,7 @@
626
627
  _id
627
628
  }
628
629
  }
629
- `;var tt=e.i(24112),ts=e.i(5270);let ta={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"]};ta.node;let ti=(0,ts.f)(ta);var tl=e.i(38994);let tr=function({onSuccess:e}){let{selectedLocale:t}=(0,O.f)(),{createProduct:s}=(0,tl.f)(),{formatMessage:a}=(0,o.X)();return async({title:i,type:l,quantity:r=1})=>{let n=[{title:i,slug:i.toLowerCase().replace(/\s+/g,"-"),locale:t}],{data:o}=await s({product:{type:l||d.f.SimpleProduct},texts:n}),c=o?.createProduct;if(!c?._id)throw Error(a({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return e?.(c,r),{success:!0}}},td=({bundleProduct:e,onSuccess:s})=>{let{formatMessage:a}=(0,o.X)(),{hasRole:i}=(0,c.f)(),l=tr({onSuccess:s}),n=(0,t.useMemo)(()=>{let t=e?.texts?.title??"";return`${t} - New Bundle Item`},[e]),u=async({title:e,type:t,quantity:s})=>{try{return await l({title:e,type:t,quantity:s}),{success:!0}}catch(e){return{success:!1,error:{message:e?.message}}}},m=a({id:"bundle-item-scaffolded-success",defaultMessage:"New product scaffolded and added to bundle successfully"}),f=(0,w.f)({submit:u,successMessage:m,enableReinitialize:!0,initialValues:{title:n,type:d.f.SimpleProduct,quantity:1}});return(0,r.jsxs)(g.f,{className:"mt-4 rounded-md border border-border-subtle",form:f,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:a({id:"scaffold_bundle_item_title",defaultMessage:"Scaffold New Bundle Item"})}),(0,r.jsx)(y.f,{name:"title",id:"title",label:a({id:"name",defaultMessage:"Name"}),required:!0,className:"block w-full rounded-md border-border-default text-sm"}),(0,r.jsx)(v.f,{className:"mt-1 w-full",label:a({id:"type",defaultMessage:"Type"}),placeholder:a({id:"type",defaultMessage:"Type"}),required:!0,name:"type",options:Object.fromEntries(Object.entries(d.f).filter(([,e])=>e!==d.f.ConfigurableProduct&&e!==d.f.BundleProduct).map(([e,t])=>[t,e]))}),(0,r.jsx)(y.f,{name:"quantity",type:"number",required:!0,label:a({id:"quantity",defaultMessage:"Quantity"})})]}),i(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"border-t border-border-subtle bg-surface-subtle p-5 text-right",children:(0,r.jsx)(b.f,{label:a({id:"scaffold_and_add",defaultMessage:"Scaffold & Add"})})})]})},tn=({productId:e=null,slug:t=null}={})=>{let s=(0,W.Q)(t),{customProperties:a,hydrateFragment:i}=(0,T.f)(),{data:l,loading:r,error:d}=(0,P.f)(((e="")=>M.a`
630
+ `;var ts=e.i(24112),ti=e.i(5270);let tl={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"]};tl.node;let tr=(0,ti.f)(tl);var td=e.i(38994);let tn=function({onSuccess:e}){let{selectedLocale:t}=(0,L.f)(),{createProduct:a}=(0,td.f)(),{formatMessage:s}=(0,n.X)();return async({title:i,type:l,quantity:r=1})=>{let n=[{title:i,slug:i.toLowerCase().replace(/\s+/g,"-"),locale:t}],{data:o}=await a({product:{type:l||d.f.SimpleProduct},texts:n}),c=o?.createProduct;if(!c?._id)throw Error(s({id:"product_creation_failed",defaultMessage:"Product creation failed"}));return e?.(c,r),{success:!0}}},to=({bundleProduct:e,onSuccess:a})=>{let{formatMessage:s}=(0,n.X)(),{hasRole:i}=(0,o.f)(),l=tn({onSuccess:a}),c=(0,t.useMemo)(()=>{let t=e?.texts?.title??"";return`${t} - New Bundle Item`},[e]),u=async({title:e,type:t,quantity:a})=>{try{return await l({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,g.f)({submit:u,successMessage:m,enableReinitialize:!0,initialValues:{title:c,type:d.f.SimpleProduct,quantity:1}});return(0,r.jsxs)(f.f,{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)(k.f,{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)(C.f,{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(d.f).filter(([,e])=>e!==d.f.ConfigurableProduct&&e!==d.f.BundleProduct).map(([e,t])=>[t,e]))}),(0,r.jsx)(k.f,{name:"quantity",type:"number",required:!0,label:s({id:"quantity",defaultMessage:"Quantity"})})]}),i(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"border-t border-border-subtle bg-surface-subtle p-5 text-right",children:(0,r.jsx)(x.f,{label:s({id:"scaffold_and_add",defaultMessage:"Scaffold & Add"})})})]})},tc=({productId:e=null,slug:t=null}={})=>{let a=(0,H.Q)(t),{customProperties:s,hydrateFragment:i}=(0,D.f)(),{data:l,loading:r,error:d}=(0,v.f)(((e="")=>h.a`
630
631
  query Product($productId: ID, $slug: String) {
631
632
  product(productId: $productId, slug: $slug) {
632
633
  ...ProductDetailFragment
@@ -680,8 +681,8 @@
680
681
  }
681
682
  }
682
683
  }
683
- ${k.f}
684
- `)(a?.Product),{skip:!e&&!s,variables:{productId:e||s}}),n=i(a?.Product,l?.product);return{product:l?.product,loading:r,error:d,extendedData:n}};e.s(["f",0,tn],84278);let to=({productId:e,disabled:s=!1})=>{let{product:a}=tn({productId:e}),{setModal:i}=(0,ei.f)(),[l,n]=(0,t.useState)(""),{createProductBundleItem:u}=(()=>{let[e]=(0,C.f)(te);return{createProductBundleItem:async({productId:t,item:s})=>e({variables:{productId:t,item:s},refetchQueries:["ProductBundleItems"]})}})(),{hasRole:m}=(0,c.f)(),{formatMessage:f}=(0,o.X)(),{products:p,loading:x}=(0,tt.f)({queryString:l,includeDrafts:!0,limit:50,sort:[{key:"created",value:d.A.Desc}]}),h=async({productId:t,quantity:s})=>(await u({item:{productId:t,quantity:s},productId:e}),{success:!0}),v=f({id:"bundle_item_added",defaultMessage:"Bundle product added successfully"}),N=(0,w.f)({disabled:s,submit:h,successMessage:v,onSubmitSuccess:()=>(N.api.resetForm(),null),initialValues:{productId:"",quantity:1}}),M=(0,t.useCallback)(async()=>{await i((0,r.jsx)(td,{bundleProduct:a,onSuccess:async(t,s=1)=>{await u({item:{productId:t._id,quantity:s},productId:e}),i("")}}))},[a]);return(0,r.jsxs)(g.f,{form:N,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)(e8.f,{name:"productId",onFilter:n,queryString:l,label:f({id:"product",defaultMessage:"Product"}),data:((e=[])=>e.map(({_id:e,status:t,texts:s,media:a})=>({id:e,tag:t,...s,image:a?.length?a[0]?.file?.url:null})))(p),isLoading:x,className:"w-full text-sm font-medium text-slate-500",required:!0})}),m(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"pb-3",children:(0,r.jsx)(j.f,{className:"flex items-center justify-center p-2 rounded-md",onClick:M,children:(0,r.jsx)(ti,{className:"h-5 w-5"})})})]}),(0,r.jsx)(y.f,{name:"quantity",type:"number",required:!0,label:f({id:"quantity",defaultMessage:"Quantity"})}),m(d.C.ManageProducts)&&(0,r.jsx)(b.f,{label:f({id:"submit",defaultMessage:"Submit"}),className:"mt-2"})]})};var tc=e.i(54529);let tu=M.a`
684
+ ${w.f}
685
+ `)(s?.Product),{skip:!e&&!a,variables:{productId:e||a}}),n=i(s?.Product,l?.product);return{product:l?.product,loading:r,error:d,extendedData:n}};e.s(["f",0,tc],84278);let tu=({productId:e,disabled:a=!1})=>{let{product:s}=tc({productId:e}),{setModal:i}=(0,er.f)(),[l,c]=(0,t.useState)(""),{createProductBundleItem:u}=(()=>{let[e]=(0,j.f)(ta);return{createProductBundleItem:async({productId:t,item:a})=>e({variables:{productId:t,item:a},refetchQueries:["ProductBundleItems"]})}})(),{hasRole:m}=(0,o.f)(),{formatMessage:p}=(0,n.X)(),{products:h,loading:v}=(0,ts.f)({queryString:l,includeDrafts:!0,limit:50,sort:[{key:"created",value:d.B.Desc}]}),b=async({productId:t,quantity:a})=>(await u({item:{productId:t,quantity:a},productId:e}),{success:!0}),y=p({id:"bundle_item_added",defaultMessage:"Bundle product added successfully"}),w=(0,g.f)({disabled:a,submit:b,successMessage:y,onSubmitSuccess:()=>(w.api.resetForm(),null),initialValues:{productId:"",quantity:1}}),N=(0,t.useCallback)(async()=>{await i((0,r.jsx)(to,{bundleProduct:s,onSuccess:async(t,a=1)=>{await u({item:{productId:t._id,quantity:a},productId:e}),i("")}}))},[s]);return(0,r.jsxs)(f.f,{form:w,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)(tt.f,{name:"productId",onFilter:c,queryString:l,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})))(h),isLoading:v,className:"w-full text-sm font-medium text-slate-500",required:!0})}),m(d.C.ManageProducts)&&(0,r.jsx)("div",{className:"pb-3",children:(0,r.jsx)($.f,{className:"flex items-center justify-center p-2 rounded-md",onClick:N,children:(0,r.jsx)(tr,{className:"h-5 w-5"})})})]}),(0,r.jsx)(k.f,{name:"quantity",type:"number",required:!0,label:p({id:"quantity",defaultMessage:"Quantity"})}),m(d.C.ManageProducts)&&(0,r.jsx)(x.f,{label:p({id:"submit",defaultMessage:"Submit"}),className:"mt-2"})]})};var tm=e.i(54529);let tf=h.a`
685
686
  query ProductBundleItems(
686
687
  $productId: ID
687
688
  $slug: String
@@ -699,11 +700,11 @@
699
700
  }
700
701
  }
701
702
  }
702
- ${tc.f}
703
- `,tm=M.a`
703
+ ${tm.f}
704
+ `,tp=h.a`
704
705
  mutation RemoveBundleItem($productId: ID!, $index: Int!) {
705
706
  removeBundleItem(productId: $productId, index: $index) {
706
707
  _id
707
708
  }
708
709
  }
709
- `;var tf=e.i(41158),tp=e.i(87284),tx=e.i(76069);let tg=({item:e,onDelete:t,index:s})=>{let{product:a,quantity:i}=e;return(0,r.jsx)(tf.default,{href:`/products?slug=${(0,W.U)(a)}`,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:[a.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.f,{className:"mx-auto w-auto",src:a.media[0]?.file?.url,width:160,height:100,alt:a?.texts?.title||a?.texts?.subtitle})})}):(0,r.jsx)(tx.f,{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:a?.texts?.title}),(0,r.jsx)("p",{className:"text-xs text-slate-600 dark:text-slate-200",children:a?.texts?.subtitle})]}),(0,r.jsx)("div",{className:"ml-auto",children:(0,r.jsx)(eM.f,{text:i,color:"slate",square:!0})})]}),(0,r.jsx)(eq.f,{onDelete:()=>{t(s)},showDelete:!0})]})})},th=({productId:e})=>{let{formatMessage:t}=(0,o.X)(),{setModal:s}=(0,ei.f)(),{selectedLocale:a}=(0,O.f)(),{bundleItems:i,loading:l}=(({productId:e=null,slug:t=null}={})=>{let{selectedLocale:s}=(0,O.f)(),a=(0,W.Q)(t),{data:i,loading:l,error:r}=(0,P.f)(tu,{skip:!e&&!a,variables:{productId:e||a,forceLocale:s},context:{headers:{forceLocale:s}}});return{bundleItems:i?.product?.bundleItems||[],loading:l,error:r}})({productId:e,forceLocale:a}),{removeBundleItem:d}=(()=>{let[e]=(0,C.f)(tm);return{removeBundleItem:async({productId:t,index:s})=>e({variables:{productId:t,index:s},refetchQueries:["ProductBundleItems"]})}})(),n=async a=>{await s((0,r.jsx)(es.f,{onCancelClick:async()=>s(""),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()=>{s(""),await d({productId:e,index:a}),U.toast.success(t({id:"bundle_item_deleted",defaultMessage:"Bundle item deleted successfully"}))},okText:t({id:"delete_bundle_item",defaultMessage:"Delete item"})}))};return l?(0,r.jsx)(eg.f,{variant:"list"}):i.length?(0,r.jsx)(r.Fragment,{children:i.map((e,t)=>(0,r.jsx)(tg,{index:t,item:e,onDelete:n},e.product._id))}):(0,r.jsx)(G.f,{message:t({id:"bundle",defaultMessage:"Bundle product"})})};e.s(["f",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)(to,{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)(th,{productId:e})})})]})})],11907)}]);
710
+ `;var tx=e.i(41158),tg=e.i(87284),th=e.i(76069);let tv=({item:e,onDelete:t,index:a})=>{let{product:s,quantity:i}=e;return(0,r.jsx)(tx.default,{href:`/products?slug=${(0,H.U)(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)(tg.f,{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)(th.f,{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)(e_.f,{text:i,color:"slate",square:!0})})]}),(0,r.jsx)(eO.f,{onDelete:()=>{t(a)},showDelete:!0})]})})},tb=({productId:e})=>{let{formatMessage:t}=(0,n.X)(),{setModal:a}=(0,er.f)(),{selectedLocale:s}=(0,L.f)(),{bundleItems:i,loading:l}=(({productId:e=null,slug:t=null}={})=>{let{selectedLocale:a}=(0,L.f)(),s=(0,H.Q)(t),{data:i,loading:l,error:r}=(0,v.f)(tf,{skip:!e&&!s,variables:{productId:e||s,forceLocale:a},context:{headers:{forceLocale:a}}});return{bundleItems:i?.product?.bundleItems||[],loading:l,error:r}})({productId:e,forceLocale:s}),{removeBundleItem:d}=(()=>{let[e]=(0,j.f)(tp);return{removeBundleItem:async({productId:t,index:a})=>e({variables:{productId:t,index:a},refetchQueries:["ProductBundleItems"]})}})(),o=async s=>{await a((0,r.jsx)(ei.f,{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}),B.toast.success(t({id:"bundle_item_deleted",defaultMessage:"Bundle item deleted successfully"}))},okText:t({id:"delete_bundle_item",defaultMessage:"Delete item"})}))};return l?(0,r.jsx)(ev.f,{variant:"list"}):i.length?(0,r.jsx)(r.Fragment,{children:i.map((e,t)=>(0,r.jsx)(tv,{index:t,item:e,onDelete:o},e.product._id))}):(0,r.jsx)(Y.f,{message:t({id:"bundle",defaultMessage:"Bundle product"})})};e.s(["f",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)(tu,{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)(tb,{productId:e})})})]})})],11907)}]);