@mercurjs/vendor 2.1.2 → 2.2.0-canary.1

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 (230) hide show
  1. package/dist/{[id]-PDGHF5J2.js → [id]-2DQX3YWJ.js} +35 -31
  2. package/dist/{[id]-TO6KT3ZE.js → [id]-4OBGG7OH.js} +23 -21
  3. package/dist/{[id]-X4DDKOMQ.js → [id]-4PKMKNJH.js} +26 -22
  4. package/dist/[id]-4STHLE4N.js +1442 -0
  5. package/dist/{[id]-4VCL3MMM.js → [id]-5UFO4RKF.js} +26 -22
  6. package/dist/{[id]-H3C3ZSC6.js → [id]-6MXCVV5J.js} +25 -21
  7. package/dist/{[id]-6PXEWRG7.js → [id]-7BAKUHUO.js} +13 -13
  8. package/dist/{[id]-7RUAH3TI.js → [id]-K2CT7BXQ.js} +4 -4
  9. package/dist/{[id]-3G5G7ZFV.js → [id]-KJIQTFGE.js} +22 -20
  10. package/dist/{[id]-INOFZHL7.js → [id]-LTNOHLGE.js} +16 -16
  11. package/dist/{[id]-B3LHVQM5.js → [id]-PGIT5WJC.js} +25 -21
  12. package/dist/{[id]-T2ROPEGY.js → [id]-Y2ISCLUD.js} +7 -7
  13. package/dist/{[id]-Y7GAMNC5.js → [id]-ZCMSBEVM.js} +4 -4
  14. package/dist/{[id]-UTKO3VG4.js → [id]-ZWWMJAKI.js} +9 -9
  15. package/dist/{[location_id]-D55RQOXT.js → [location_id]-NUBXDDJC.js} +9 -9
  16. package/dist/{[province_id]-OFH2ZOFQ.js → [province_id]-H2QAPKVH.js} +20 -18
  17. package/dist/{add-C6OX5C54.js → add-GZJ7OMV3.js} +34 -30
  18. package/dist/add-KQAABWCR.js +392 -0
  19. package/dist/{add-customer-groups-PJRJUWS2.js → add-customer-groups-RAHCP67U.js} +16 -14
  20. package/dist/{add-products-INOLNPO6.js → add-products-TSVQHC67.js} +23 -19
  21. package/dist/{add-promotions-AHDOP52Q.js → add-promotions-CSCAJZHV.js} +7 -7
  22. package/dist/{add-to-campaign-HL6NGRR4.js → add-to-campaign-DLP7PSQB.js} +4 -4
  23. package/dist/{address-KRENKSLP.js → address-7F5SN7PV.js} +17 -15
  24. package/dist/{adjust-inventory-H4EUP7J3.js → adjust-inventory-SZF4W7LR.js} +2 -2
  25. package/dist/{allocate-items-SUCUZU4D.js → allocate-items-SDFS5GYN.js} +6 -6
  26. package/dist/{areas-UUMZDXLX.js → areas-7Y6BVS5A.js} +8 -8
  27. package/dist/{attributes-CALEHJJG.js → attributes-MBZ76HVZ.js} +3 -3
  28. package/dist/{breadcrumb-BS7Y5OKF.js → breadcrumb-65SAGUUL.js} +2 -2
  29. package/dist/{breadcrumb-6W2VP3OZ.js → breadcrumb-7PURSRTT.js} +13 -11
  30. package/dist/{breadcrumb-M5Z5WA6I.js → breadcrumb-EDPMEN2P.js} +2 -2
  31. package/dist/breadcrumb-FLDHJRVY.js +26 -0
  32. package/dist/{breadcrumb-VNNZ3TTW.js → breadcrumb-HND5FFWC.js} +2 -2
  33. package/dist/{breadcrumb-OIGGCB3L.js → breadcrumb-QV2IAX7N.js} +8 -2
  34. package/dist/{breadcrumb-KQSFIXQ4.js → breadcrumb-VWELWDB2.js} +1 -1
  35. package/dist/{breadcrumb-IG7VZGW2.js → breadcrumb-WRG4SITG.js} +13 -11
  36. package/dist/{breadcrumb-TW5JEOYS.js → breadcrumb-ZCG2RHIU.js} +12 -10
  37. package/dist/{campaigns-HS6MIO7X.js → campaigns-L6ULR6KR.js} +5 -5
  38. package/dist/{categories-PKWR3FM3.js → categories-FUZQKBXV.js} +6 -6
  39. package/dist/{chunk-PDQSPKG5.js → chunk-2DXNJURE.js} +1 -1
  40. package/dist/{chunk-ZZO3INVE.js → chunk-2MDGYHWN.js} +128 -25
  41. package/dist/{chunk-5UD4P6YL.js → chunk-2USXZSTK.js} +4 -4
  42. package/dist/{chunk-6SBMVLJ2.js → chunk-36L54SQQ.js} +1 -1
  43. package/dist/chunk-37G4Y5I7.js +101 -0
  44. package/dist/{chunk-5M3SL4UZ.js → chunk-3CVJA5UE.js} +9 -104
  45. package/dist/chunk-432S4FGR.js +0 -0
  46. package/dist/{chunk-KQGVSLUI.js → chunk-44RQ5PTN.js} +1803 -914
  47. package/dist/{chunk-Y2QI7KWS.js → chunk-4LVP635F.js} +408 -664
  48. package/dist/{chunk-UL4O5M4S.js → chunk-4S6XGIC6.js} +1 -18
  49. package/dist/chunk-5ZVWOCAC.js +426 -0
  50. package/dist/{chunk-WITQNQXN.js → chunk-6BS2AVGJ.js} +3 -3
  51. package/dist/{chunk-ZYOXKUKZ.js → chunk-7LBY5JLV.js} +1 -1
  52. package/dist/chunk-7SLWXX6L.js +811 -0
  53. package/dist/{chunk-LQYMBSRQ.js → chunk-AIZM66CG.js} +1 -1
  54. package/dist/{chunk-IZ5RG5XI.js → chunk-AJLGY3LQ.js} +1 -21
  55. package/dist/{chunk-WFE6CT6M.js → chunk-AVOIZO63.js} +21 -77
  56. package/dist/chunk-C2FG3SX2.js +68 -0
  57. package/dist/chunk-CFRWIQIZ.js +43 -0
  58. package/dist/{chunk-WNVEMFIK.js → chunk-CNMY5HVP.js} +2 -2
  59. package/dist/{chunk-BLVJAKBA.js → chunk-DDH7ULIQ.js} +1 -1
  60. package/dist/chunk-DIW4GRTI.js +503 -0
  61. package/dist/{chunk-JQP7MOFH.js → chunk-DVEKYLPV.js} +1 -1
  62. package/dist/{chunk-QX45GVAL.js → chunk-EIUYXS7E.js} +8 -8
  63. package/dist/{chunk-N7OVXN72.js → chunk-EROX26D4.js} +1 -1
  64. package/dist/{chunk-2RHAI7WK.js → chunk-EZ3JOAUS.js} +1 -1
  65. package/dist/{chunk-HFRHHT36.js → chunk-FDR22JMM.js} +63 -8
  66. package/dist/{chunk-PEKANQ3T.js → chunk-FJUUGFXL.js} +2 -2
  67. package/dist/{chunk-3CK6OINO.js → chunk-GDWBOQI5.js} +3 -5
  68. package/dist/{chunk-47SXTGLN.js → chunk-GXIAIITP.js} +63 -200
  69. package/dist/{chunk-4MFMCZEJ.js → chunk-H6LZ77GX.js} +2 -2
  70. package/dist/chunk-IWLDKGYQ.js +95 -0
  71. package/dist/chunk-K4X324QP.js +18 -0
  72. package/dist/{chunk-VQ5EKDA3.js → chunk-KD7RYE6R.js} +1 -1
  73. package/dist/chunk-LEWA4BPH.js +18 -0
  74. package/dist/{chunk-7Q5SDEK7.js → chunk-LNM2D2I4.js} +4 -4
  75. package/dist/{chunk-LPOAVK6Y.js → chunk-LQD232FW.js} +47 -12
  76. package/dist/{chunk-OXXL4WQU.js → chunk-M7KSRYRI.js} +5 -5
  77. package/dist/chunk-MBFHMJHN.js +2063 -0
  78. package/dist/{chunk-I2IKYOZX.js → chunk-N4MVIBFM.js} +19 -19
  79. package/dist/{chunk-PCMNEUMV.js → chunk-NHFEY3EI.js} +1 -1
  80. package/dist/{chunk-RTAWYMQP.js → chunk-NJMNYS7G.js} +1 -1
  81. package/dist/{chunk-HGQTL7NX.js → chunk-NSZQERLE.js} +2 -2
  82. package/dist/{chunk-RL7SFZOF.js → chunk-NXNJQZCP.js} +1 -1
  83. package/dist/{chunk-CNLP35S7.js → chunk-OD3U3TX4.js} +16 -31
  84. package/dist/{chunk-D2MA5TAP.js → chunk-PBD36EZJ.js} +2 -2
  85. package/dist/{chunk-4ZGFODSC.js → chunk-PZ44R4AS.js} +1 -1
  86. package/dist/{chunk-ZEVYT6IX.js → chunk-QNNJN4H6.js} +116 -286
  87. package/dist/{chunk-WBI7FEGI.js → chunk-QS6RWIBL.js} +1 -1
  88. package/dist/chunk-QT7YFHCA.js +198 -0
  89. package/dist/{chunk-GYV6SKY7.js → chunk-QXLRABYH.js} +4 -6
  90. package/dist/chunk-RXZFEFNV.js +73 -0
  91. package/dist/{chunk-RUE5BPC2.js → chunk-RZLN2Q6G.js} +1 -1
  92. package/dist/{chunk-NYDJTWRL.js → chunk-SGR4DMCW.js} +4 -4
  93. package/dist/chunk-T6LHVNWO.js +27 -0
  94. package/dist/{chunk-DKQ4XMSN.js → chunk-TNVYTMBL.js} +6 -6
  95. package/dist/{chunk-32RYSB2V.js → chunk-TODJFRLH.js} +2 -2
  96. package/dist/{chunk-P3ZTO6T2.js → chunk-UAF2S447.js} +1 -1
  97. package/dist/{chunk-J6BRLL3F.js → chunk-UCQKXXLD.js} +2 -2
  98. package/dist/chunk-UORPTGV2.js +114 -0
  99. package/dist/{chunk-CYTNBXWF.js → chunk-UX7J5NZG.js} +9 -9
  100. package/dist/{chunk-X4FLOQ45.js → chunk-WBHFU3MG.js} +2 -2
  101. package/dist/chunk-WLT7K7K7.js +63 -0
  102. package/dist/{chunk-4URLUCTD.js → chunk-WUPJADSO.js} +2 -2
  103. package/dist/{chunk-ITI54CII.js → chunk-X4INVIWL.js} +5 -5
  104. package/dist/{chunk-PTW7JNAP.js → chunk-XFQJU6FA.js} +4 -4
  105. package/dist/{collections-DJZI2RM2.js → collections-3OPR3DSD.js} +22 -19
  106. package/dist/{configuration-RHPIO2QT.js → configuration-C4IGBNXH.js} +1 -1
  107. package/dist/{configuration-GN3TO77H.js → configuration-UOSNP45I.js} +3 -3
  108. package/dist/{create-3EK5CNNX.js → create-2MQFQHTE.js} +33 -29
  109. package/dist/{create-YO55Z3YD.js → create-2PCLG7TV.js} +32 -38
  110. package/dist/{create-G4T2PAJH.js → create-35MYQPVM.js} +23 -21
  111. package/dist/{create-HKJVSFB7.js → create-BJ4OO6LS.js} +23 -21
  112. package/dist/create-DDPIXCXT.js +210 -0
  113. package/dist/{create-7S7CZWEN.js → create-GB3ZA4LH.js} +4 -4
  114. package/dist/create-JDGM5KXE.js +193 -0
  115. package/dist/{create-IDVCZHIX.js → create-ORXYT74H.js} +14 -12
  116. package/dist/{create-GHM7OTCR.js → create-R7K3ECN6.js} +1 -1
  117. package/dist/{create-D6EW3EWC.js → create-SFU3W3ZH.js} +1 -1
  118. package/dist/{create-3ZVXEPX5.js → create-SQ3FYMGI.js} +25 -21
  119. package/dist/{create-33TRLASX.js → create-UPYB65PD.js} +1 -1
  120. package/dist/{create-OCFPLNNY.js → create-UQNYMVBM.js} +6 -6
  121. package/dist/{create-OGLPDVOI.js → create-XAD5NMSJ.js} +37 -35
  122. package/dist/{create-KGYL7FBM.js → create-XVHOCZHJ.js} +1 -1
  123. package/dist/{create-4AE3VTWN.js → create-YBF4YGWG.js} +2 -2
  124. package/dist/{customers-6ZLE65UX.js → customers-ETXVNM3G.js} +5 -5
  125. package/dist/{edit-QBISX7D3.js → edit-2Q7TRUTL.js} +14 -12
  126. package/dist/{edit-B5B3XKDM.js → edit-522DG3BY.js} +1 -1
  127. package/dist/{edit-ATXE6CM5.js → edit-C4OCKQVU.js} +1 -1
  128. package/dist/{edit-IR6V2IDN.js → edit-FKXIQ6ZI.js} +19 -17
  129. package/dist/{edit-4HZHLYI3.js → edit-GQNIINRR.js} +1 -1
  130. package/dist/{edit-LRRJTHV2.js → edit-KAKVPHZZ.js} +1 -1
  131. package/dist/{edit-ZSOI56BQ.js → edit-L5ZZLMAY.js} +22 -22
  132. package/dist/{edit-FNDDSSMT.js → edit-NYD45J2Q.js} +37 -8
  133. package/dist/{edit-GIJXLMC3.js → edit-O4JLGKQR.js} +2 -2
  134. package/dist/{edit-5CJZRHAA.js → edit-ORXS3A2Y.js} +1 -1
  135. package/dist/{edit-FC64DWB2.js → edit-Q3UQIOLS.js} +1 -1
  136. package/dist/{edit-7HTH2UJF.js → edit-REDDBLTA.js} +3 -3
  137. package/dist/{edit-2KRJIPRK.js → edit-SGUY2CCK.js} +19 -17
  138. package/dist/{edit-B75KK5ZX.js → edit-SWRWWFW6.js} +35 -31
  139. package/dist/{edit-7GVP6SRA.js → edit-ZAHCMF5U.js} +1 -1
  140. package/dist/{edit-RNT555GP.js → edit-ZCXUG42Q.js} +13 -11
  141. package/dist/{edit-MYSWY6W4.js → edit-ZMERG3L7.js} +1 -1
  142. package/dist/{edit-budget-J27CSEZH.js → edit-budget-L3CCEWNF.js} +1 -1
  143. package/dist/{edit-inventory-item-US77M2FF.js → edit-inventory-item-6B7ITDGD.js} +2 -2
  144. package/dist/{edit-inventory-item-attributes-UGAE2NAZ.js → edit-inventory-item-attributes-Y7MQZLXI.js} +3 -3
  145. package/dist/{fulfillment-DCS67LTK.js → fulfillment-75Z4H23W.js} +16 -14
  146. package/dist/{fulfillment-providers-GM5PO6N3.js → fulfillment-providers-KCQWL62T.js} +20 -17
  147. package/dist/index.css +27 -62
  148. package/dist/index.d.ts +3 -10
  149. package/dist/index.js +522 -458
  150. package/dist/{inventory-OPZ2FSEE.js → inventory-KAUVPMPZ.js} +6 -6
  151. package/dist/{invite-764K3TJS.js → invite-6CPYVHDX.js} +24 -21
  152. package/dist/{invite-KEJLNXEZ.js → invite-CI2P4GF6.js} +15 -12
  153. package/dist/loader-FBB5OQRT.js +31 -0
  154. package/dist/{locations-ZVPTQCQY.js → locations-INS6FTMJ.js} +4 -4
  155. package/dist/{login-OUHRNNXA.js → login-KY342RMK.js} +12 -10
  156. package/dist/{manage-locations-YUKEFCBJ.js → manage-locations-WNHEBS3A.js} +2 -2
  157. package/dist/{media-4KYFHB5V.js → media-KOYAOXG6.js} +41 -9
  158. package/dist/{metadata-NYYL26MQ.js → metadata-2CMH4I6U.js} +16 -14
  159. package/dist/{metadata-AWUKZ25V.js → metadata-5BPOBBU2.js} +3 -3
  160. package/dist/{metadata-OCE6A3JE.js → metadata-GWI6R4ES.js} +15 -13
  161. package/dist/{metadata-G7KZXVNE.js → metadata-NUXUC2JA.js} +15 -13
  162. package/dist/{metadata-XP3ZYW2M.js → metadata-TLDUF5KV.js} +17 -15
  163. package/dist/{metadata-PYY4IB7K.js → metadata-WR4RFXO5.js} +16 -14
  164. package/dist/offer-create-page-YKMHHTU5.js +743 -0
  165. package/dist/offer-detail-page-6MAHNNIO.js +488 -0
  166. package/dist/offer-edit-page-DYQFU6JU.js +151 -0
  167. package/dist/offer-inventory-batch-page-WKCWNDNK.js +290 -0
  168. package/dist/offer-pricing-edit-page-4TYGGSOE.js +195 -0
  169. package/dist/offers-UGQJNGTD.js +32 -0
  170. package/dist/{onboarding-WXZHW62K.js → onboarding-43LQQQGQ.js} +22 -20
  171. package/dist/{orders-LWJ472VM.js → orders-R2LOJ6N5.js} +24 -21
  172. package/dist/organization-XGFU4YDG.js +375 -0
  173. package/dist/{organize-RFOMQCBG.js → organize-HNJUHEEG.js} +4 -4
  174. package/dist/{organize-OVKJ3HZO.js → organize-K6QMAMEN.js} +4 -4
  175. package/dist/pages/index.d.ts +415 -758
  176. package/dist/pages/index.js +81 -77
  177. package/dist/{payment-details-UVXYCTUK.js → payment-details-64US5XWD.js} +17 -15
  178. package/dist/{payouts-TR7K5I37.js → payouts-UXJDTXDL.js} +6 -6
  179. package/dist/{price-lists-S2WNELFZ.js → price-lists-KBPUVSZI.js} +8 -8
  180. package/dist/{pricing-UF27DAXA.js → pricing-DF6C5XK4.js} +35 -32
  181. package/dist/{product-tags-2CKH2M6D.js → product-tags-CL7HSEDI.js} +32 -28
  182. package/dist/{product-types-FX43JEO2.js → product-types-UUHBV4IZ.js} +5 -5
  183. package/dist/product-variant-detail-RVWEYVPC.js +220 -0
  184. package/dist/{product-variant-edit-P3DSIFE3.js → product-variant-edit-MNCS7ZYW.js} +126 -66
  185. package/dist/{products-H5EMRJYS.js → products-4KV5Y2JY.js} +23 -19
  186. package/dist/{products-2LHGS7X3.js → products-SXYTQFJ3.js} +40 -43
  187. package/dist/{professional-details-HYKTH44B.js → professional-details-5T2VS6MM.js} +16 -14
  188. package/dist/{profile-PB27WIRW.js → profile-6XGHAT7H.js} +20 -18
  189. package/dist/{promotions-5EYPGHJP.js → promotions-O7U4BTK6.js} +8 -8
  190. package/dist/{register-4O4F6YZK.js → register-GDKN3SKM.js} +16 -14
  191. package/dist/{reset-password-GTWLBOFK.js → reset-password-EICPAY2N.js} +1 -1
  192. package/dist/{return-reasons-LOKYRGMI.js → return-reasons-M6IR77XW.js} +16 -14
  193. package/dist/{sales-channels-7R2IY3KG.js → sales-channels-B6FULRWI.js} +8 -7
  194. package/dist/{sales-channels-Y4LRP7JC.js → sales-channels-JW3QUYR7.js} +8 -7
  195. package/dist/{settings-2XDLFYMS.js → settings-SAAHTUZZ.js} +39 -35
  196. package/dist/{shipment-4GW2JFWB.js → shipment-Q33QBMXX.js} +13 -11
  197. package/dist/{shipping-profile-R3NABPQF.js → shipping-profile-Y4SNEPZX.js} +2 -2
  198. package/dist/{shipping-profiles-QVKNFLCW.js → shipping-profiles-2NWKCEJK.js} +18 -16
  199. package/dist/{stock-5RXNUPUT.js → stock-7CSVEJJU.js} +19 -17
  200. package/dist/{store-DE2RGX7T.js → store-GHFWU7EV.js} +28 -25
  201. package/dist/{store-closure-DNMCHUXD.js → store-closure-P5PD2RSV.js} +16 -14
  202. package/dist/{store-select-GZEJHRZ7.js → store-select-KDT6USQA.js} +17 -15
  203. package/dist/{tax-regions-UD6P5FVC.js → tax-regions-YXZW7UVX.js} +5 -5
  204. package/dist/{team-JXKAVRPU.js → team-EDJ62747.js} +25 -23
  205. package/dist/types-CtCEtTE6.d.ts +16 -0
  206. package/package.json +3 -3
  207. package/dist/[id]-BYP37PU4.js +0 -1314
  208. package/dist/add-KRAGFFBJ.js +0 -158
  209. package/dist/bulk-edit-3SMBLIOA.js +0 -244
  210. package/dist/chunk-4KX6CBJ4.js +0 -178
  211. package/dist/chunk-DLNNTQRY.js +0 -217
  212. package/dist/chunk-FX4V5JCF.js +0 -37
  213. package/dist/chunk-GC33DBKG.js +0 -143
  214. package/dist/chunk-NK4NR6MN.js +0 -173
  215. package/dist/chunk-PFU6FSXY.js +0 -430
  216. package/dist/chunk-QJEOPT2P.js +0 -330
  217. package/dist/chunk-QSGR43JM.js +0 -30
  218. package/dist/chunk-STR3NGWE.js +0 -3736
  219. package/dist/create-3DOO3RNH.js +0 -716
  220. package/dist/create-I7HV3RM6.js +0 -150
  221. package/dist/edit-K2AD335I.js +0 -237
  222. package/dist/edit-VO5XLIEL.js +0 -362
  223. package/dist/edit-stocks-and-prices-MHHQFWFA.js +0 -408
  224. package/dist/organization-LPYQRTQC.js +0 -303
  225. package/dist/prices-3OXV5RGY.js +0 -270
  226. package/dist/product-variant-detail-WV4KXVXR.js +0 -590
  227. package/dist/stock-GPC3BCL6.js +0 -500
  228. package/dist/{chunk-SDSEW72R.js → chunk-E2HQPY32.js} +3 -3
  229. package/dist/{chunk-6WY5X4PE.js → chunk-L7QKFC5N.js} +7 -7
  230. /package/dist/{chunk-CAS74NLJ.js → chunk-YV6MK4PZ.js} +0 -0
@@ -0,0 +1,743 @@
1
+ import {
2
+ CategoryCell,
3
+ CategoryHeader,
4
+ ProductStatusCell,
5
+ ProductStatusHeader
6
+ } from "./chunk-C2FG3SX2.js";
7
+ import "./chunk-FQERBIVS.js";
8
+ import "./chunk-DB6ANJBO.js";
9
+ import {
10
+ PlaceholderCell
11
+ } from "./chunk-PHOCVOZ5.js";
12
+ import {
13
+ _DataTable,
14
+ useDataTable
15
+ } from "./chunk-AIF2KTEE.js";
16
+ import "./chunk-YN3FGNJM.js";
17
+ import "./chunk-KAZ5BYTQ.js";
18
+ import "./chunk-3EF54XFY.js";
19
+ import {
20
+ DataGrid,
21
+ createDataGridHelper,
22
+ createDataGridLocationStockColumns,
23
+ createDataGridPriceColumns
24
+ } from "./chunk-4LVP635F.js";
25
+ import {
26
+ defineTabMeta
27
+ } from "./chunk-LEWA4BPH.js";
28
+ import "./chunk-IQPN4PZJ.js";
29
+ import {
30
+ TabbedForm
31
+ } from "./chunk-LQD232FW.js";
32
+ import "./chunk-TKGWSUEI.js";
33
+ import "./chunk-U2ZFCAPX.js";
34
+ import {
35
+ RouteFocusModal,
36
+ useRouteModal
37
+ } from "./chunk-GDWBOQI5.js";
38
+ import "./chunk-3QSRE5LS.js";
39
+ import "./chunk-LRD242C7.js";
40
+ import "./chunk-QHQWEERJ.js";
41
+ import {
42
+ useQueryParams
43
+ } from "./chunk-THHRRYRS.js";
44
+ import "./chunk-2MDGYHWN.js";
45
+ import {
46
+ Thumbnail
47
+ } from "./chunk-WIYFXWRI.js";
48
+ import "./chunk-INNFZYX2.js";
49
+ import {
50
+ useVariants
51
+ } from "./chunk-T6LHVNWO.js";
52
+ import {
53
+ usePricePreferences
54
+ } from "./chunk-4S6XGIC6.js";
55
+ import {
56
+ useCurrentSeller
57
+ } from "./chunk-QT7YFHCA.js";
58
+ import {
59
+ useShippingProfiles
60
+ } from "./chunk-IQWK723D.js";
61
+ import {
62
+ useBulkCreateOffers
63
+ } from "./chunk-UORPTGV2.js";
64
+ import {
65
+ useStockLocations
66
+ } from "./chunk-NBPMNUKZ.js";
67
+ import "./chunk-LAVHRER2.js";
68
+ import "./chunk-Y7QKP6QU.js";
69
+ import "./chunk-A5DJIOHN.js";
70
+ import "./chunk-RHKRREUU.js";
71
+ import "./chunk-ZA2KFUFR.js";
72
+ import "./chunk-RIN4CBRB.js";
73
+ import "./chunk-NBMM2TZK.js";
74
+
75
+ // src/pages/offers/create/create-offer-form/create-offer-form.tsx
76
+ import { zodResolver } from "@hookform/resolvers/zod";
77
+ import { Button, toast } from "@medusajs/ui";
78
+ import { useEffect as useEffect2, useState as useState2 } from "react";
79
+ import { useForm } from "react-hook-form";
80
+ import { useTranslation as useTranslation3 } from "react-i18next";
81
+
82
+ // src/pages/offers/create/create-offer-form/create-offer-catalogue.tsx
83
+ import { Checkbox } from "@medusajs/ui";
84
+ import { keepPreviousData } from "@tanstack/react-query";
85
+ import {
86
+ createColumnHelper
87
+ } from "@tanstack/react-table";
88
+ import { useEffect, useMemo, useState } from "react";
89
+ import { useFormContext } from "react-hook-form";
90
+ import { useTranslation } from "react-i18next";
91
+
92
+ // src/hooks/table/query/use-product-variants-table-query.tsx
93
+ var DEFAULT_FIELDS = "*options,*inventory_items,*inventory_items.inventory,*inventory_items.inventory.location_levels";
94
+ var useProductVariantsTableQuery = ({
95
+ prefix,
96
+ pageSize = 10
97
+ }) => {
98
+ const queryObject = useQueryParams(
99
+ [
100
+ "offset",
101
+ "order",
102
+ "q",
103
+ "id",
104
+ "sku",
105
+ "title",
106
+ "manage_inventory",
107
+ "allow_backorder",
108
+ "created_at",
109
+ "updated_at"
110
+ ],
111
+ prefix
112
+ );
113
+ const {
114
+ offset,
115
+ order,
116
+ q,
117
+ id,
118
+ sku,
119
+ title,
120
+ manage_inventory,
121
+ allow_backorder,
122
+ created_at,
123
+ updated_at
124
+ } = queryObject;
125
+ const searchParams = {
126
+ limit: pageSize,
127
+ offset: offset ? Number(offset) : 0,
128
+ fields: DEFAULT_FIELDS,
129
+ order,
130
+ q,
131
+ id: id ? id.split(",") : void 0,
132
+ sku: sku ? sku.split(",") : void 0,
133
+ title: title ? title.split(",") : void 0,
134
+ manage_inventory: manage_inventory ? manage_inventory === "true" : void 0,
135
+ allow_backorder: allow_backorder ? allow_backorder === "true" : void 0,
136
+ created_at: created_at ? JSON.parse(created_at) : void 0,
137
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0
138
+ };
139
+ return {
140
+ searchParams,
141
+ raw: queryObject
142
+ };
143
+ };
144
+
145
+ // src/pages/offers/create/create-offer-form/create-offer-catalogue.tsx
146
+ import { jsx, jsxs } from "react/jsx-runtime";
147
+ var PAGE_SIZE = 10;
148
+ var FIELDS = [
149
+ "id",
150
+ "title",
151
+ "sku",
152
+ "ean",
153
+ "upc",
154
+ "product_id",
155
+ "product.id",
156
+ "product.title",
157
+ "product.thumbnail",
158
+ "product.status",
159
+ "product.categories.id",
160
+ "product.categories.name"
161
+ ].join(",");
162
+ var Root = () => {
163
+ const { t } = useTranslation();
164
+ const form = useFormContext();
165
+ const initialSelection = (form.getValues("selected_variant_ids") ?? []).reduce(
166
+ (acc, id) => {
167
+ acc[id] = true;
168
+ return acc;
169
+ },
170
+ {}
171
+ );
172
+ const [rowSelection, setRowSelection] = useState(initialSelection);
173
+ const updater = (fn) => {
174
+ const state = typeof fn === "function" ? fn(rowSelection) : fn;
175
+ setRowSelection(state);
176
+ const ids = Object.keys(state);
177
+ form.setValue("selected_variant_ids", ids, {
178
+ shouldDirty: true,
179
+ shouldTouch: true,
180
+ shouldValidate: true
181
+ });
182
+ };
183
+ const { searchParams, raw } = useProductVariantsTableQuery({
184
+ pageSize: PAGE_SIZE
185
+ });
186
+ const {
187
+ variants,
188
+ count,
189
+ isPending: isLoading,
190
+ isError,
191
+ error
192
+ } = useVariants(
193
+ { ...searchParams, fields: FIELDS },
194
+ { placeholderData: keepPreviousData }
195
+ );
196
+ const columns = useColumns();
197
+ const { table } = useDataTable({
198
+ data: variants ?? [],
199
+ columns,
200
+ enablePagination: true,
201
+ enableRowSelection: true,
202
+ getRowId: (row) => row.id,
203
+ pageSize: PAGE_SIZE,
204
+ count,
205
+ rowSelection: {
206
+ state: rowSelection,
207
+ updater
208
+ }
209
+ });
210
+ useEffect(() => {
211
+ void form.trigger("selected_variant_ids");
212
+ }, [rowSelection, form]);
213
+ if (isError) {
214
+ throw error;
215
+ }
216
+ return /* @__PURE__ */ jsxs(
217
+ "div",
218
+ {
219
+ className: "flex size-full flex-col",
220
+ "data-testid": "offer-create-tab-catalogue",
221
+ children: [
222
+ /* @__PURE__ */ jsx(
223
+ _DataTable,
224
+ {
225
+ table,
226
+ count,
227
+ columns,
228
+ pageSize: PAGE_SIZE,
229
+ isLoading,
230
+ orderBy: [
231
+ { key: "title", label: t("fields.title") },
232
+ { key: "created_at", label: t("fields.createdAt") },
233
+ { key: "updated_at", label: t("fields.updatedAt") }
234
+ ],
235
+ queryObject: raw,
236
+ layout: "fill",
237
+ pagination: true,
238
+ search: "autofocus"
239
+ }
240
+ ),
241
+ /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-subtle text-ui-fg-subtle border-t px-6 py-4", children: /* @__PURE__ */ jsx("span", { className: "txt-small", children: t("offers.create.tip") }) })
242
+ ]
243
+ }
244
+ );
245
+ };
246
+ var columnHelper = createColumnHelper();
247
+ var useColumns = () => {
248
+ const { t } = useTranslation();
249
+ return useMemo(
250
+ () => [
251
+ columnHelper.display({
252
+ id: "select",
253
+ header: ({ table }) => /* @__PURE__ */ jsx(
254
+ Checkbox,
255
+ {
256
+ checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
257
+ onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value),
258
+ "data-testid": "offer-create-catalogue-select-all-checkbox"
259
+ }
260
+ ),
261
+ cell: ({ row }) => /* @__PURE__ */ jsx(
262
+ Checkbox,
263
+ {
264
+ checked: row.getIsSelected(),
265
+ onCheckedChange: (value) => row.toggleSelected(!!value),
266
+ onClick: (e) => e.stopPropagation(),
267
+ "data-testid": `offer-create-catalogue-select-checkbox-${row.original.id}`
268
+ }
269
+ )
270
+ }),
271
+ columnHelper.display({
272
+ id: "title",
273
+ header: t("fields.title"),
274
+ cell: ({ row }) => {
275
+ const variant = row.original;
276
+ const title = variant.title ?? "";
277
+ if (!title) return /* @__PURE__ */ jsx(PlaceholderCell, {});
278
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full max-w-[320px] items-center gap-x-3 overflow-hidden", children: [
279
+ /* @__PURE__ */ jsx("div", { className: "w-fit flex-shrink-0", children: /* @__PURE__ */ jsx(Thumbnail, { src: variant.product?.thumbnail ?? null }) }),
280
+ /* @__PURE__ */ jsx("span", { className: "truncate", title, children: title })
281
+ ] });
282
+ }
283
+ }),
284
+ columnHelper.display({
285
+ id: "categories",
286
+ header: () => /* @__PURE__ */ jsx(CategoryHeader, {}),
287
+ cell: ({ row }) => /* @__PURE__ */ jsx(CategoryCell, { categories: row.original.product?.categories })
288
+ }),
289
+ columnHelper.accessor("sku", {
290
+ header: t("fields.sku"),
291
+ cell: ({ getValue }) => {
292
+ const sku = getValue();
293
+ if (!sku) return /* @__PURE__ */ jsx(PlaceholderCell, {});
294
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: sku }) });
295
+ }
296
+ }),
297
+ columnHelper.accessor("ean", {
298
+ header: t("offers.fields.ean"),
299
+ cell: ({ getValue }) => {
300
+ const value = getValue();
301
+ if (!value) return /* @__PURE__ */ jsx(PlaceholderCell, {});
302
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: value }) });
303
+ }
304
+ }),
305
+ columnHelper.accessor("upc", {
306
+ header: t("offers.fields.upc"),
307
+ cell: ({ getValue }) => {
308
+ const value = getValue();
309
+ if (!value) return /* @__PURE__ */ jsx(PlaceholderCell, {});
310
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: value }) });
311
+ }
312
+ }),
313
+ columnHelper.display({
314
+ id: "status",
315
+ header: () => /* @__PURE__ */ jsx(ProductStatusHeader, {}),
316
+ cell: ({ row }) => {
317
+ const status = row.original.product?.status;
318
+ if (!status) return /* @__PURE__ */ jsx(PlaceholderCell, {});
319
+ return /* @__PURE__ */ jsx(ProductStatusCell, { status });
320
+ }
321
+ })
322
+ ],
323
+ [t]
324
+ );
325
+ };
326
+ Root._tabMeta = defineTabMeta({
327
+ id: "catalogue",
328
+ labelKey: "offers.create.tabs.catalogue",
329
+ validationFields: ["selected_variant_ids"]
330
+ });
331
+ var CreateOfferCatalogueTab = Root;
332
+
333
+ // src/pages/offers/create/create-offer-form/create-offer-stock-levels-and-prices.tsx
334
+ import { useMemo as useMemo2 } from "react";
335
+ import { useFormContext as useFormContext2, useWatch } from "react-hook-form";
336
+ import { useTranslation as useTranslation2 } from "react-i18next";
337
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
338
+ var Root2 = () => {
339
+ const form = useFormContext2();
340
+ const { setCloseOnEscape } = useRouteModal();
341
+ const { currency_code } = useCurrentSeller();
342
+ const { stock_locations } = useStockLocations({ limit: 100 });
343
+ const { shipping_profiles } = useShippingProfiles({ limit: 100 });
344
+ const { price_preferences: pricePreferences } = usePricePreferences({});
345
+ const variants = useWatch({
346
+ control: form.control,
347
+ name: "variants"
348
+ });
349
+ const columns = useColumns2({
350
+ currencyCode: currency_code,
351
+ stockLocations: stock_locations,
352
+ shippingProfiles: shipping_profiles ?? [],
353
+ pricePreferences
354
+ });
355
+ return /* @__PURE__ */ jsx2(
356
+ "div",
357
+ {
358
+ className: "flex size-full flex-col overflow-hidden",
359
+ "data-testid": "offer-create-tab-stockLevelsAndPrices",
360
+ children: /* @__PURE__ */ jsx2(
361
+ DataGrid,
362
+ {
363
+ columns,
364
+ data: variants ?? [],
365
+ state: form,
366
+ onEditingChange: (editing) => setCloseOnEscape(!editing)
367
+ }
368
+ )
369
+ }
370
+ );
371
+ };
372
+ var columnHelper2 = createDataGridHelper();
373
+ var useColumns2 = ({
374
+ currencyCode,
375
+ stockLocations = [],
376
+ shippingProfiles = [],
377
+ pricePreferences = []
378
+ }) => {
379
+ const { t } = useTranslation2();
380
+ return useMemo2(() => {
381
+ const shippingProfileOptions = shippingProfiles.map((p) => ({
382
+ value: p.id,
383
+ label: p.name ?? p.id
384
+ }));
385
+ const currencies = currencyCode ? [currencyCode] : [];
386
+ return [
387
+ columnHelper2.column({
388
+ id: "title",
389
+ header: t("fields.title"),
390
+ cell: (context) => {
391
+ const entity = context.row.original;
392
+ const title = entity.variant_title || "";
393
+ return /* @__PURE__ */ jsx2(DataGrid.ReadonlyCell, { context, children: /* @__PURE__ */ jsxs2("div", { className: "flex h-full w-full items-center gap-x-2 overflow-hidden", children: [
394
+ /* @__PURE__ */ jsx2(Thumbnail, { src: entity.product_thumbnail ?? null }),
395
+ /* @__PURE__ */ jsx2("span", { className: "truncate", title, children: title })
396
+ ] }) });
397
+ },
398
+ disableHiding: true
399
+ }),
400
+ columnHelper2.column({
401
+ id: "sku",
402
+ name: t("fields.sku"),
403
+ header: t("fields.sku"),
404
+ field: (context) => `variants.${context.row.index}.sku`,
405
+ type: "text",
406
+ cell: (context) => /* @__PURE__ */ jsx2(DataGrid.TextCell, { context })
407
+ }),
408
+ columnHelper2.column({
409
+ id: "shipping_profile",
410
+ name: t("shippingProfile.domain"),
411
+ header: t("shippingProfile.domain"),
412
+ field: (context) => `variants.${context.row.index}.shipping_profile_id`,
413
+ type: "select",
414
+ cell: (context) => /* @__PURE__ */ jsx2(
415
+ DataGrid.SelectCell,
416
+ {
417
+ context,
418
+ options: shippingProfileOptions,
419
+ placeholder: t("shippingProfile.domain")
420
+ }
421
+ )
422
+ }),
423
+ ...createDataGridLocationStockColumns({
424
+ stockLocations,
425
+ getFieldName: (context, index) => {
426
+ const location = stockLocations[index];
427
+ if (!location) return null;
428
+ return `variants.${context.row.index}.inventory.${location.id}`;
429
+ },
430
+ t
431
+ }),
432
+ ...createDataGridPriceColumns({
433
+ currencies,
434
+ pricePreferences,
435
+ getFieldName: (context, value) => {
436
+ if (context.column.id?.startsWith("currency_prices")) {
437
+ return `variants.${context.row.index}.prices.${value}`;
438
+ }
439
+ return null;
440
+ },
441
+ t
442
+ })
443
+ ];
444
+ }, [t, currencyCode, stockLocations, shippingProfiles, pricePreferences]);
445
+ };
446
+ Root2._tabMeta = defineTabMeta({
447
+ id: "stockLevelsAndPrices",
448
+ labelKey: "offers.create.tabs.stockLevelsAndPrices"
449
+ });
450
+ var CreateOfferStockLevelsAndPricesTab = Root2;
451
+
452
+ // src/pages/offers/create/create-offer-form/schema.ts
453
+ import { z } from "zod";
454
+ var VariantRowSchema = z.object({
455
+ variant_id: z.string().min(1),
456
+ product_id: z.string().min(1),
457
+ product_title: z.string(),
458
+ variant_title: z.string(),
459
+ product_thumbnail: z.string().nullish(),
460
+ variant_sku: z.string().nullish(),
461
+ sku: z.string().max(64).default(""),
462
+ shipping_profile_id: z.string().default(""),
463
+ prices: z.record(z.string(), z.union([z.coerce.number().min(0), z.literal("")])).default({}),
464
+ inventory: z.record(
465
+ z.string(),
466
+ z.object({
467
+ checked: z.boolean().default(false),
468
+ quantity: z.union([z.coerce.number().min(0), z.literal("")]).default(""),
469
+ disabledToggle: z.boolean().optional()
470
+ })
471
+ ).default({})
472
+ });
473
+ var CreateOfferSchema = z.object({
474
+ selected_variant_ids: z.array(z.string().min(1)).min(1),
475
+ variants: z.array(VariantRowSchema).min(1)
476
+ });
477
+ var numericOrZero = (v) => {
478
+ if (v === "" || v === null || v === void 0) return 0;
479
+ return Number(v) || 0;
480
+ };
481
+ var isVariantRowPublishable = (row) => {
482
+ const hasSku = !!row.sku && row.sku.trim().length > 0;
483
+ const hasShipping = !!row.shipping_profile_id && row.shipping_profile_id.length > 0;
484
+ const hasEnabledLocation = Object.values(row.inventory ?? {}).some(
485
+ (v) => v.checked
486
+ );
487
+ const hasNonZeroPrice = Object.values(row.prices ?? {}).some(
488
+ (v) => numericOrZero(v) > 0
489
+ );
490
+ return hasSku || hasShipping || hasEnabledLocation || hasNonZeroPrice;
491
+ };
492
+ var variantRowRequiresSku = (row) => {
493
+ const hasEnabledLocation = Object.values(row.inventory ?? {}).some(
494
+ (v) => v.checked
495
+ );
496
+ const hasNonZeroPrice = Object.values(row.prices ?? {}).some(
497
+ (v) => numericOrZero(v) > 0
498
+ );
499
+ return hasEnabledLocation || hasNonZeroPrice;
500
+ };
501
+
502
+ // src/pages/offers/create/create-offer-form/create-offer-form.tsx
503
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
504
+ var DEFAULTS = {
505
+ selected_variant_ids: [],
506
+ variants: []
507
+ };
508
+ var numericOrZero2 = (v) => {
509
+ if (v === "" || v === null || v === void 0) return 0;
510
+ return Number(v) || 0;
511
+ };
512
+ var attachErrorToRow = (message, rows, form) => {
513
+ const variantMatch = message.match(/variant[^a-z0-9]*(?:with id[^a-z0-9]*)?['"`]?(var(?:iant)?_[A-Za-z0-9]+)/i);
514
+ if (variantMatch) {
515
+ const target = rows.find((r) => r.row.variant_id === variantMatch[1]);
516
+ if (target) {
517
+ form.setError(`variants.${target.index}.sku`, { type: "manual", message });
518
+ return true;
519
+ }
520
+ }
521
+ const skuMatch = message.match(/sku\s+['"`]([^'"`]+)['"`]/i) || message.match(/duplicate[^']*['"`]([^'"`]+)['"`]/i);
522
+ if (skuMatch) {
523
+ const target = rows.find((r) => r.sku === skuMatch[1]);
524
+ if (target) {
525
+ form.setError(`variants.${target.index}.sku`, { type: "manual", message });
526
+ return true;
527
+ }
528
+ }
529
+ return false;
530
+ };
531
+ var CreateOfferForm = () => {
532
+ const { t } = useTranslation3();
533
+ const { handleSuccess } = useRouteModal();
534
+ const [isSubmitting, setIsSubmitting] = useState2(false);
535
+ const form = useForm({
536
+ defaultValues: DEFAULTS,
537
+ resolver: zodResolver(CreateOfferSchema)
538
+ });
539
+ const { mutateAsync: bulkCreateOffers } = useBulkCreateOffers();
540
+ const { currency_code } = useCurrentSeller();
541
+ const { stock_locations } = useStockLocations({ limit: 100 });
542
+ const locationIds = (stock_locations ?? []).map((l) => l.id);
543
+ const selectedVariantIds = form.watch("selected_variant_ids") ?? [];
544
+ const selectedVariantIdsKey = selectedVariantIds.join(",");
545
+ const locationsKey = locationIds.join(",");
546
+ const { variants: fetchedVariants } = useVariants(
547
+ {
548
+ id: selectedVariantIds,
549
+ limit: selectedVariantIds.length || 1,
550
+ fields: "id,title,sku,product_id,product.id,product.title,product.thumbnail"
551
+ },
552
+ { enabled: selectedVariantIds.length > 0 }
553
+ );
554
+ useEffect2(() => {
555
+ const ids = selectedVariantIdsKey ? selectedVariantIdsKey.split(",") : [];
556
+ const locIds = locationsKey ? locationsKey.split(",") : [];
557
+ const emptyPrices = currency_code ? { [currency_code]: "" } : {};
558
+ const emptyInventory = locIds.reduce((acc, locId) => {
559
+ acc[locId] = { checked: false, quantity: "", disabledToggle: false };
560
+ return acc;
561
+ }, {});
562
+ const existing = form.getValues("variants") ?? [];
563
+ const existingByVariantId = new Map(
564
+ existing.map((row) => [row.variant_id, row])
565
+ );
566
+ const next = [];
567
+ for (const variantId of ids) {
568
+ const previous = existingByVariantId.get(variantId);
569
+ if (previous) {
570
+ next.push({
571
+ ...previous,
572
+ prices: { ...emptyPrices, ...previous.prices ?? {} },
573
+ inventory: { ...emptyInventory, ...previous.inventory ?? {} }
574
+ });
575
+ continue;
576
+ }
577
+ const fetched = (fetchedVariants ?? []).find((v) => v.id === variantId);
578
+ if (!fetched) continue;
579
+ next.push({
580
+ variant_id: variantId,
581
+ product_id: fetched.product_id ?? fetched.product?.id ?? "",
582
+ product_title: fetched.product?.title ?? "",
583
+ variant_title: fetched.title ?? variantId,
584
+ product_thumbnail: fetched.product?.thumbnail ?? null,
585
+ variant_sku: fetched.sku ?? null,
586
+ sku: fetched.sku ?? "",
587
+ shipping_profile_id: "",
588
+ prices: { ...emptyPrices },
589
+ inventory: { ...emptyInventory }
590
+ });
591
+ }
592
+ form.setValue("variants", next, { shouldDirty: false });
593
+ }, [
594
+ selectedVariantIdsKey,
595
+ fetchedVariants,
596
+ currency_code,
597
+ locationsKey,
598
+ form
599
+ ]);
600
+ const handleSubmit = form.handleSubmit(async (values) => {
601
+ const variants = values.variants ?? [];
602
+ const publishable = variants.filter((v) => isVariantRowPublishable(v));
603
+ if (publishable.length === 0) {
604
+ toast.error(t("offers.validation.noPublishableRows"));
605
+ return;
606
+ }
607
+ let hasValidationError = false;
608
+ const skuSeen = /* @__PURE__ */ new Map();
609
+ for (let i = 0; i < variants.length; i++) {
610
+ const row = variants[i];
611
+ if (!isVariantRowPublishable(row)) continue;
612
+ const sku = (row.sku ?? "").trim();
613
+ if (variantRowRequiresSku(row) && !sku) {
614
+ form.setError(`variants.${i}.sku`, {
615
+ type: "manual",
616
+ message: t("offers.validation.skuRequired")
617
+ });
618
+ hasValidationError = true;
619
+ continue;
620
+ }
621
+ if (sku) {
622
+ if (skuSeen.has(sku)) {
623
+ form.setError(`variants.${i}.sku`, {
624
+ type: "manual",
625
+ message: t("offers.validation.duplicateSku")
626
+ });
627
+ hasValidationError = true;
628
+ continue;
629
+ }
630
+ skuSeen.set(sku, i);
631
+ }
632
+ if (!row.shipping_profile_id) {
633
+ form.setError(`variants.${i}.shipping_profile_id`, {
634
+ type: "manual",
635
+ message: t("offers.validation.skuRequired")
636
+ });
637
+ hasValidationError = true;
638
+ }
639
+ }
640
+ if (hasValidationError) return;
641
+ setIsSubmitting(true);
642
+ const publishableRows = [];
643
+ for (let i = 0; i < variants.length; i++) {
644
+ const row = variants[i];
645
+ if (!isVariantRowPublishable(row)) continue;
646
+ const sku = (row.sku ?? "").trim() || row.variant_sku || row.variant_id;
647
+ publishableRows.push({ row, index: i, sku });
648
+ }
649
+ const payloadOffers = publishableRows.map(({ row, sku }) => {
650
+ const prices = [];
651
+ if (currency_code) {
652
+ prices.push({
653
+ amount: numericOrZero2(row.prices?.[currency_code]),
654
+ currency_code
655
+ });
656
+ }
657
+ const stock_levels = [];
658
+ for (const [locationId, level] of Object.entries(row.inventory ?? {})) {
659
+ if (!level?.checked) continue;
660
+ stock_levels.push({
661
+ location_id: locationId,
662
+ stocked_quantity: numericOrZero2(level.quantity)
663
+ });
664
+ }
665
+ return {
666
+ sku,
667
+ variant_id: row.variant_id,
668
+ shipping_profile_id: row.shipping_profile_id,
669
+ prices,
670
+ inventory_items: [
671
+ {
672
+ title: row.variant_title,
673
+ stock_levels
674
+ }
675
+ ]
676
+ };
677
+ });
678
+ try {
679
+ await bulkCreateOffers({ offers: payloadOffers });
680
+ toast.success(t("offers.create.successToast"));
681
+ handleSuccess("/offers");
682
+ } catch (err) {
683
+ const message = err instanceof Error ? err.message : "Unknown error";
684
+ const attributed = attachErrorToRow(message, publishableRows, form);
685
+ if (!attributed) {
686
+ toast.error(message);
687
+ }
688
+ } finally {
689
+ setIsSubmitting(false);
690
+ }
691
+ });
692
+ return /* @__PURE__ */ jsxs3(
693
+ TabbedForm,
694
+ {
695
+ form,
696
+ onSubmit: handleSubmit,
697
+ isLoading: isSubmitting,
698
+ footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-end gap-x-2", children: [
699
+ /* @__PURE__ */ jsx3(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx3(Button, { variant: "secondary", size: "small", children: t("actions.cancel") }) }),
700
+ isLastTab ? /* @__PURE__ */ jsx3(
701
+ Button,
702
+ {
703
+ type: "submit",
704
+ variant: "primary",
705
+ size: "small",
706
+ isLoading,
707
+ "data-testid": "offer-create-publish",
708
+ children: t("offers.create.publish")
709
+ },
710
+ "publish-button"
711
+ ) : /* @__PURE__ */ jsx3(
712
+ Button,
713
+ {
714
+ type: "button",
715
+ variant: "primary",
716
+ size: "small",
717
+ onClick: () => onNext(),
718
+ disabled: (form.watch("selected_variant_ids")?.length ?? 0) === 0,
719
+ children: t("actions.continue")
720
+ },
721
+ "next-button"
722
+ )
723
+ ] }),
724
+ children: [
725
+ /* @__PURE__ */ jsx3(CreateOfferCatalogueTab, {}),
726
+ /* @__PURE__ */ jsx3(CreateOfferStockLevelsAndPricesTab, {})
727
+ ]
728
+ }
729
+ );
730
+ };
731
+
732
+ // src/pages/offers/create/offer-create-page.tsx
733
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
734
+ var OfferCreatePage = () => /* @__PURE__ */ jsxs4(RouteFocusModal, { children: [
735
+ /* @__PURE__ */ jsx4(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Create offer" }) }),
736
+ /* @__PURE__ */ jsx4(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Select variants and configure stock levels and prices to create offers." }) }),
737
+ /* @__PURE__ */ jsx4(CreateOfferForm, {})
738
+ ] });
739
+ var Component = OfferCreatePage;
740
+ export {
741
+ Component,
742
+ OfferCreatePage
743
+ };