@shopify/hydrogen-react 2022.10.0 → 2022.10.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 (389) hide show
  1. package/dist/dev/CartProvider.js +35 -35
  2. package/dist/dev/CartProvider.js.map +1 -1
  3. package/dist/dev/{CartProvider.cjs → CartProvider.mjs} +36 -36
  4. package/dist/dev/{CartProvider.cjs.map → CartProvider.mjs.map} +1 -1
  5. package/dist/dev/ExternalVideo.js +5 -5
  6. package/dist/dev/ExternalVideo.js.map +1 -1
  7. package/dist/dev/{ExternalVideo.cjs → ExternalVideo.mjs} +6 -6
  8. package/dist/{prod/ExternalVideo.cjs.map → dev/ExternalVideo.mjs.map} +1 -1
  9. package/dist/dev/Image.js +12 -12
  10. package/dist/dev/Image.js.map +1 -1
  11. package/dist/dev/{Image.cjs → Image.mjs} +13 -13
  12. package/dist/dev/{Image.cjs.map → Image.mjs.map} +1 -1
  13. package/dist/dev/MediaFile.js +12 -12
  14. package/dist/dev/MediaFile.js.map +1 -1
  15. package/dist/dev/{MediaFile.cjs → MediaFile.mjs} +13 -13
  16. package/dist/dev/{MediaFile.cjs.map → MediaFile.mjs.map} +1 -1
  17. package/dist/dev/Metafield.js +32 -32
  18. package/dist/dev/Metafield.js.map +1 -1
  19. package/dist/dev/{Metafield.cjs → Metafield.mjs} +33 -33
  20. package/dist/dev/{Metafield.cjs.map → Metafield.mjs.map} +1 -1
  21. package/dist/dev/ModelViewer.js +11 -11
  22. package/dist/dev/ModelViewer.js.map +1 -1
  23. package/dist/dev/{ModelViewer.cjs → ModelViewer.mjs} +12 -12
  24. package/dist/dev/{ModelViewer.cjs.map → ModelViewer.mjs.map} +1 -1
  25. package/dist/dev/Money.js +8 -8
  26. package/dist/dev/Money.js.map +1 -1
  27. package/dist/{prod/Money.cjs → dev/Money.mjs} +9 -9
  28. package/dist/dev/{Money.cjs.map → Money.mjs.map} +1 -1
  29. package/dist/dev/ProductPrice.js +9 -9
  30. package/dist/dev/ProductPrice.js.map +1 -1
  31. package/dist/{prod/ProductPrice.cjs → dev/ProductPrice.mjs} +10 -10
  32. package/dist/dev/{ProductPrice.cjs.map → ProductPrice.mjs.map} +1 -1
  33. package/dist/dev/ProductProvider.js +25 -25
  34. package/dist/dev/ProductProvider.js.map +1 -1
  35. package/dist/{prod/ProductProvider.cjs → dev/ProductProvider.mjs} +26 -26
  36. package/dist/dev/{ProductProvider.cjs.map → ProductProvider.mjs.map} +1 -1
  37. package/dist/dev/ShopPayButton.js +13 -13
  38. package/dist/dev/ShopPayButton.js.map +1 -1
  39. package/dist/{prod/ShopPayButton.cjs → dev/ShopPayButton.mjs} +14 -14
  40. package/dist/{prod/ShopPayButton.cjs.map → dev/ShopPayButton.mjs.map} +1 -1
  41. package/dist/dev/ShopifyProvider.js +14 -14
  42. package/dist/dev/ShopifyProvider.js.map +1 -1
  43. package/dist/dev/ShopifyProvider.mjs +46 -0
  44. package/dist/dev/{ShopifyProvider.cjs.map → ShopifyProvider.mjs.map} +1 -1
  45. package/dist/dev/Video.js +9 -9
  46. package/dist/dev/Video.js.map +1 -1
  47. package/dist/dev/{Video.cjs → Video.mjs} +10 -10
  48. package/dist/dev/{Video.cjs.map → Video.mjs.map} +1 -1
  49. package/dist/dev/_virtual/index.js +3 -3
  50. package/dist/dev/_virtual/index.js.map +1 -1
  51. package/dist/dev/_virtual/index.mjs +5 -0
  52. package/dist/dev/_virtual/index.mjs.map +1 -0
  53. package/dist/dev/_virtual/use-sync-external-store-shim.development.js +3 -3
  54. package/dist/dev/_virtual/use-sync-external-store-shim.development.js.map +1 -1
  55. package/dist/dev/_virtual/use-sync-external-store-shim.development.mjs +5 -0
  56. package/dist/dev/_virtual/use-sync-external-store-shim.development.mjs.map +1 -0
  57. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.js +3 -3
  58. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.js.map +1 -1
  59. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.mjs +5 -0
  60. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.mjs.map +1 -0
  61. package/dist/dev/_virtual/with-selector.development.js +3 -3
  62. package/dist/dev/_virtual/with-selector.development.js.map +1 -1
  63. package/dist/dev/_virtual/with-selector.development.mjs +5 -0
  64. package/dist/dev/_virtual/with-selector.development.mjs.map +1 -0
  65. package/dist/dev/_virtual/with-selector.js +3 -3
  66. package/dist/dev/_virtual/with-selector.js.map +1 -1
  67. package/dist/dev/_virtual/with-selector.mjs +5 -0
  68. package/dist/dev/_virtual/with-selector.mjs.map +1 -0
  69. package/dist/dev/_virtual/with-selector.production.min.js +3 -3
  70. package/dist/dev/_virtual/with-selector.production.min.js.map +1 -1
  71. package/dist/dev/_virtual/with-selector.production.min.mjs +5 -0
  72. package/dist/dev/_virtual/with-selector.production.min.mjs.map +1 -0
  73. package/dist/dev/cart-constants.js +9 -9
  74. package/dist/dev/cart-constants.js.map +1 -1
  75. package/dist/dev/cart-constants.mjs +17 -0
  76. package/dist/dev/{cart-constants.cjs.map → cart-constants.mjs.map} +1 -1
  77. package/dist/dev/cart-hooks.js +15 -15
  78. package/dist/dev/cart-hooks.js.map +1 -1
  79. package/dist/dev/cart-hooks.mjs +48 -0
  80. package/dist/dev/{cart-hooks.cjs.map → cart-hooks.mjs.map} +1 -1
  81. package/dist/dev/cart-queries.js +11 -11
  82. package/dist/dev/cart-queries.js.map +1 -1
  83. package/dist/{prod/cart-queries.cjs → dev/cart-queries.mjs} +12 -12
  84. package/dist/dev/{cart-queries.cjs.map → cart-queries.mjs.map} +1 -1
  85. package/dist/dev/flatten-connection.js +3 -3
  86. package/dist/dev/flatten-connection.js.map +1 -1
  87. package/dist/dev/{flatten-connection.cjs → flatten-connection.mjs} +4 -4
  88. package/dist/dev/{flatten-connection.cjs.map → flatten-connection.mjs.map} +1 -1
  89. package/dist/dev/image-size.js +6 -6
  90. package/dist/dev/image-size.js.map +1 -1
  91. package/dist/dev/{image-size.cjs → image-size.mjs} +7 -7
  92. package/dist/{prod/image-size.cjs.map → dev/image-size.mjs.map} +1 -1
  93. package/dist/dev/index.js +37 -37
  94. package/dist/dev/index.js.map +1 -1
  95. package/dist/dev/index.mjs +38 -0
  96. package/dist/dev/index.mjs.map +1 -0
  97. package/dist/dev/load-script.js +7 -7
  98. package/dist/dev/load-script.js.map +1 -1
  99. package/dist/{prod/load-script.cjs → dev/load-script.mjs} +8 -8
  100. package/dist/dev/{load-script.cjs.map → load-script.mjs.map} +1 -1
  101. package/dist/dev/node_modules/@xstate/fsm/es/index.js +34 -35
  102. package/dist/dev/node_modules/@xstate/fsm/es/index.js.map +1 -1
  103. package/dist/{prod/node_modules/@xstate/fsm/es/index.cjs → dev/node_modules/@xstate/fsm/es/index.mjs} +36 -35
  104. package/dist/dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -0
  105. package/dist/dev/node_modules/@xstate/react/es/fsm.js +21 -21
  106. package/dist/dev/node_modules/@xstate/react/es/fsm.js.map +1 -1
  107. package/dist/{prod/node_modules/@xstate/react/es/fsm.cjs → dev/node_modules/@xstate/react/es/fsm.mjs} +22 -22
  108. package/dist/dev/node_modules/@xstate/react/es/{fsm.cjs.map → fsm.mjs.map} +1 -1
  109. package/dist/dev/node_modules/@xstate/react/es/useConstant.js +23 -5
  110. package/dist/dev/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  111. package/dist/dev/node_modules/@xstate/react/es/useConstant.mjs +12 -0
  112. package/dist/dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -0
  113. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +4 -5
  114. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js.map +1 -1
  115. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs +6 -0
  116. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/{use-isomorphic-layout-effect.browser.esm.cjs.map → use-isomorphic-layout-effect.browser.esm.mjs.map} +1 -1
  117. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +13 -11
  118. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  119. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.development.cjs → with-selector.development.mjs} +12 -14
  120. package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs.map → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map} +1 -1
  121. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +12 -10
  122. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  123. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.production.min.cjs → with-selector.production.min.mjs} +11 -13
  124. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -0
  125. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +11 -9
  126. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  127. package/dist/dev/node_modules/use-sync-external-store/cjs/{use-sync-external-store-shim.development.cjs → use-sync-external-store-shim.development.mjs} +10 -12
  128. package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map} +1 -1
  129. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +11 -9
  130. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  131. package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs} +10 -12
  132. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -0
  133. package/dist/dev/node_modules/use-sync-external-store/shim/index.js +12 -12
  134. package/dist/dev/node_modules/use-sync-external-store/shim/index.js.map +1 -1
  135. package/dist/dev/node_modules/use-sync-external-store/shim/index.mjs +21 -0
  136. package/dist/dev/node_modules/use-sync-external-store/shim/{index.cjs.map → index.mjs.map} +1 -1
  137. package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.js +7 -6
  138. package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
  139. package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.mjs +11 -0
  140. package/dist/dev/node_modules/use-sync-external-store/shim/{with-selector.cjs.map → with-selector.mjs.map} +1 -1
  141. package/dist/dev/node_modules/worktop/cookie/index.js +3 -3
  142. package/dist/dev/node_modules/worktop/cookie/index.js.map +1 -1
  143. package/dist/{prod/node_modules/worktop/cookie/index.cjs → dev/node_modules/worktop/cookie/index.mjs} +4 -4
  144. package/dist/dev/node_modules/worktop/cookie/{index.cjs.map → index.mjs.map} +1 -1
  145. package/dist/dev/storefront-api-constants.js +3 -3
  146. package/dist/dev/storefront-api-constants.js.map +1 -1
  147. package/dist/dev/storefront-api-constants.mjs +5 -0
  148. package/dist/dev/storefront-api-constants.mjs.map +1 -0
  149. package/dist/dev/storefront-client.js +6 -6
  150. package/dist/dev/storefront-client.js.map +1 -1
  151. package/dist/dev/{storefront-client.cjs → storefront-client.mjs} +7 -7
  152. package/dist/dev/storefront-client.mjs.map +1 -0
  153. package/dist/dev/useCartAPIStateMachine.js +20 -20
  154. package/dist/dev/useCartAPIStateMachine.js.map +1 -1
  155. package/dist/{prod/useCartAPIStateMachine.cjs → dev/useCartAPIStateMachine.mjs} +21 -21
  156. package/dist/dev/{useCartAPIStateMachine.cjs.map → useCartAPIStateMachine.mjs.map} +1 -1
  157. package/dist/dev/useCartActions.js +26 -26
  158. package/dist/dev/useCartActions.js.map +1 -1
  159. package/dist/{prod/useCartActions.cjs → dev/useCartActions.mjs} +27 -27
  160. package/dist/dev/{useCartActions.cjs.map → useCartActions.mjs.map} +1 -1
  161. package/dist/dev/useMoney.js +10 -10
  162. package/dist/dev/useMoney.js.map +1 -1
  163. package/dist/{prod/useMoney.cjs → dev/useMoney.mjs} +11 -11
  164. package/dist/dev/{useMoney.cjs.map → useMoney.mjs.map} +1 -1
  165. package/dist/prod/CartProvider.js +35 -35
  166. package/dist/prod/CartProvider.js.map +1 -1
  167. package/dist/prod/{CartProvider.cjs → CartProvider.mjs} +36 -36
  168. package/dist/prod/{CartProvider.cjs.map → CartProvider.mjs.map} +1 -1
  169. package/dist/prod/ExternalVideo.js +5 -5
  170. package/dist/prod/ExternalVideo.js.map +1 -1
  171. package/dist/prod/{ExternalVideo.cjs → ExternalVideo.mjs} +6 -6
  172. package/dist/{dev/ExternalVideo.cjs.map → prod/ExternalVideo.mjs.map} +1 -1
  173. package/dist/prod/Image.js +12 -12
  174. package/dist/prod/Image.js.map +1 -1
  175. package/dist/prod/{Image.cjs → Image.mjs} +13 -13
  176. package/dist/prod/{Image.cjs.map → Image.mjs.map} +1 -1
  177. package/dist/prod/MediaFile.js +12 -12
  178. package/dist/prod/MediaFile.js.map +1 -1
  179. package/dist/prod/{MediaFile.cjs → MediaFile.mjs} +13 -13
  180. package/dist/prod/{MediaFile.cjs.map → MediaFile.mjs.map} +1 -1
  181. package/dist/prod/Metafield.js +32 -32
  182. package/dist/prod/Metafield.js.map +1 -1
  183. package/dist/prod/{Metafield.cjs → Metafield.mjs} +33 -33
  184. package/dist/prod/{Metafield.cjs.map → Metafield.mjs.map} +1 -1
  185. package/dist/prod/ModelViewer.js +11 -11
  186. package/dist/prod/ModelViewer.js.map +1 -1
  187. package/dist/prod/{ModelViewer.cjs → ModelViewer.mjs} +12 -12
  188. package/dist/prod/{ModelViewer.cjs.map → ModelViewer.mjs.map} +1 -1
  189. package/dist/prod/Money.js +8 -8
  190. package/dist/prod/Money.js.map +1 -1
  191. package/dist/{dev/Money.cjs → prod/Money.mjs} +9 -9
  192. package/dist/prod/{Money.cjs.map → Money.mjs.map} +1 -1
  193. package/dist/prod/ProductPrice.js +9 -9
  194. package/dist/prod/ProductPrice.js.map +1 -1
  195. package/dist/{dev/ProductPrice.cjs → prod/ProductPrice.mjs} +10 -10
  196. package/dist/prod/{ProductPrice.cjs.map → ProductPrice.mjs.map} +1 -1
  197. package/dist/prod/ProductProvider.js +25 -25
  198. package/dist/prod/ProductProvider.js.map +1 -1
  199. package/dist/{dev/ProductProvider.cjs → prod/ProductProvider.mjs} +26 -26
  200. package/dist/prod/{ProductProvider.cjs.map → ProductProvider.mjs.map} +1 -1
  201. package/dist/prod/ShopPayButton.js +13 -13
  202. package/dist/prod/ShopPayButton.js.map +1 -1
  203. package/dist/{dev/ShopPayButton.cjs → prod/ShopPayButton.mjs} +14 -14
  204. package/dist/{dev/ShopPayButton.cjs.map → prod/ShopPayButton.mjs.map} +1 -1
  205. package/dist/prod/ShopifyProvider.js +14 -14
  206. package/dist/prod/ShopifyProvider.js.map +1 -1
  207. package/dist/prod/ShopifyProvider.mjs +46 -0
  208. package/dist/prod/{ShopifyProvider.cjs.map → ShopifyProvider.mjs.map} +1 -1
  209. package/dist/prod/Video.js +9 -9
  210. package/dist/prod/Video.js.map +1 -1
  211. package/dist/prod/{Video.cjs → Video.mjs} +10 -10
  212. package/dist/prod/{Video.cjs.map → Video.mjs.map} +1 -1
  213. package/dist/prod/_virtual/index.js +3 -3
  214. package/dist/prod/_virtual/index.js.map +1 -1
  215. package/dist/prod/_virtual/index.mjs +5 -0
  216. package/dist/prod/_virtual/index.mjs.map +1 -0
  217. package/dist/prod/_virtual/use-sync-external-store-shim.development.js +3 -3
  218. package/dist/prod/_virtual/use-sync-external-store-shim.development.js.map +1 -1
  219. package/dist/prod/_virtual/use-sync-external-store-shim.development.mjs +5 -0
  220. package/dist/prod/_virtual/use-sync-external-store-shim.development.mjs.map +1 -0
  221. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.js +3 -3
  222. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.js.map +1 -1
  223. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.mjs +5 -0
  224. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.mjs.map +1 -0
  225. package/dist/prod/_virtual/with-selector.development.js +3 -3
  226. package/dist/prod/_virtual/with-selector.development.js.map +1 -1
  227. package/dist/prod/_virtual/with-selector.development.mjs +5 -0
  228. package/dist/prod/_virtual/with-selector.development.mjs.map +1 -0
  229. package/dist/prod/_virtual/with-selector.js +3 -3
  230. package/dist/prod/_virtual/with-selector.js.map +1 -1
  231. package/dist/prod/_virtual/with-selector.mjs +5 -0
  232. package/dist/prod/_virtual/with-selector.mjs.map +1 -0
  233. package/dist/prod/_virtual/with-selector.production.min.js +3 -3
  234. package/dist/prod/_virtual/with-selector.production.min.js.map +1 -1
  235. package/dist/prod/_virtual/with-selector.production.min.mjs +5 -0
  236. package/dist/prod/_virtual/with-selector.production.min.mjs.map +1 -0
  237. package/dist/prod/cart-constants.js +9 -9
  238. package/dist/prod/cart-constants.js.map +1 -1
  239. package/dist/prod/cart-constants.mjs +17 -0
  240. package/dist/prod/{cart-constants.cjs.map → cart-constants.mjs.map} +1 -1
  241. package/dist/prod/cart-hooks.js +15 -15
  242. package/dist/prod/cart-hooks.js.map +1 -1
  243. package/dist/prod/cart-hooks.mjs +48 -0
  244. package/dist/prod/{cart-hooks.cjs.map → cart-hooks.mjs.map} +1 -1
  245. package/dist/prod/cart-queries.js +11 -11
  246. package/dist/prod/cart-queries.js.map +1 -1
  247. package/dist/{dev/cart-queries.cjs → prod/cart-queries.mjs} +12 -12
  248. package/dist/prod/{cart-queries.cjs.map → cart-queries.mjs.map} +1 -1
  249. package/dist/prod/flatten-connection.js +3 -3
  250. package/dist/prod/flatten-connection.js.map +1 -1
  251. package/dist/prod/{flatten-connection.cjs → flatten-connection.mjs} +4 -4
  252. package/dist/prod/{flatten-connection.cjs.map → flatten-connection.mjs.map} +1 -1
  253. package/dist/prod/image-size.js +6 -6
  254. package/dist/prod/image-size.js.map +1 -1
  255. package/dist/prod/{image-size.cjs → image-size.mjs} +7 -7
  256. package/dist/{dev/image-size.cjs.map → prod/image-size.mjs.map} +1 -1
  257. package/dist/prod/index.js +37 -37
  258. package/dist/prod/index.js.map +1 -1
  259. package/dist/prod/index.mjs +38 -0
  260. package/dist/prod/index.mjs.map +1 -0
  261. package/dist/prod/load-script.js +7 -7
  262. package/dist/prod/load-script.js.map +1 -1
  263. package/dist/{dev/load-script.cjs → prod/load-script.mjs} +8 -8
  264. package/dist/prod/{load-script.cjs.map → load-script.mjs.map} +1 -1
  265. package/dist/prod/node_modules/@xstate/fsm/es/index.js +34 -35
  266. package/dist/prod/node_modules/@xstate/fsm/es/index.js.map +1 -1
  267. package/dist/{dev/node_modules/@xstate/fsm/es/index.cjs → prod/node_modules/@xstate/fsm/es/index.mjs} +36 -35
  268. package/dist/prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -0
  269. package/dist/prod/node_modules/@xstate/react/es/fsm.js +21 -21
  270. package/dist/prod/node_modules/@xstate/react/es/fsm.js.map +1 -1
  271. package/dist/{dev/node_modules/@xstate/react/es/fsm.cjs → prod/node_modules/@xstate/react/es/fsm.mjs} +22 -22
  272. package/dist/prod/node_modules/@xstate/react/es/{fsm.cjs.map → fsm.mjs.map} +1 -1
  273. package/dist/prod/node_modules/@xstate/react/es/useConstant.js +23 -5
  274. package/dist/prod/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  275. package/dist/prod/node_modules/@xstate/react/es/useConstant.mjs +12 -0
  276. package/dist/prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -0
  277. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +4 -5
  278. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js.map +1 -1
  279. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs +6 -0
  280. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/{use-isomorphic-layout-effect.browser.esm.cjs.map → use-isomorphic-layout-effect.browser.esm.mjs.map} +1 -1
  281. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +13 -11
  282. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  283. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.development.cjs → with-selector.development.mjs} +12 -14
  284. package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs.map → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map} +1 -1
  285. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +12 -10
  286. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  287. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.production.min.cjs → with-selector.production.min.mjs} +11 -13
  288. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -0
  289. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +11 -9
  290. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  291. package/dist/prod/node_modules/use-sync-external-store/cjs/{use-sync-external-store-shim.development.cjs → use-sync-external-store-shim.development.mjs} +10 -12
  292. package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map} +1 -1
  293. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +11 -9
  294. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  295. package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs} +10 -12
  296. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -0
  297. package/dist/prod/node_modules/use-sync-external-store/shim/index.js +12 -12
  298. package/dist/prod/node_modules/use-sync-external-store/shim/index.js.map +1 -1
  299. package/dist/prod/node_modules/use-sync-external-store/shim/index.mjs +21 -0
  300. package/dist/prod/node_modules/use-sync-external-store/shim/{index.cjs.map → index.mjs.map} +1 -1
  301. package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.js +7 -6
  302. package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
  303. package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.mjs +11 -0
  304. package/dist/prod/node_modules/use-sync-external-store/shim/{with-selector.cjs.map → with-selector.mjs.map} +1 -1
  305. package/dist/prod/node_modules/worktop/cookie/index.js +3 -3
  306. package/dist/prod/node_modules/worktop/cookie/index.js.map +1 -1
  307. package/dist/{dev/node_modules/worktop/cookie/index.cjs → prod/node_modules/worktop/cookie/index.mjs} +4 -4
  308. package/dist/prod/node_modules/worktop/cookie/{index.cjs.map → index.mjs.map} +1 -1
  309. package/dist/prod/storefront-api-constants.js +3 -3
  310. package/dist/prod/storefront-api-constants.js.map +1 -1
  311. package/dist/prod/storefront-api-constants.mjs +5 -0
  312. package/dist/prod/storefront-api-constants.mjs.map +1 -0
  313. package/dist/prod/storefront-client.js +6 -6
  314. package/dist/prod/storefront-client.js.map +1 -1
  315. package/dist/prod/{storefront-client.cjs → storefront-client.mjs} +7 -7
  316. package/dist/prod/storefront-client.mjs.map +1 -0
  317. package/dist/prod/useCartAPIStateMachine.js +20 -20
  318. package/dist/prod/useCartAPIStateMachine.js.map +1 -1
  319. package/dist/{dev/useCartAPIStateMachine.cjs → prod/useCartAPIStateMachine.mjs} +21 -21
  320. package/dist/prod/{useCartAPIStateMachine.cjs.map → useCartAPIStateMachine.mjs.map} +1 -1
  321. package/dist/prod/useCartActions.js +26 -26
  322. package/dist/prod/useCartActions.js.map +1 -1
  323. package/dist/{dev/useCartActions.cjs → prod/useCartActions.mjs} +27 -27
  324. package/dist/prod/{useCartActions.cjs.map → useCartActions.mjs.map} +1 -1
  325. package/dist/prod/useMoney.js +10 -10
  326. package/dist/prod/useMoney.js.map +1 -1
  327. package/dist/{dev/useMoney.cjs → prod/useMoney.mjs} +11 -11
  328. package/dist/prod/{useMoney.cjs.map → useMoney.mjs.map} +1 -1
  329. package/dist/umd/hydrogen-react.dev.js +1 -1
  330. package/dist/umd/hydrogen-react.dev.js.map +1 -1
  331. package/dist/umd/hydrogen-react.prod.js +1 -1
  332. package/dist/umd/hydrogen-react.prod.js.map +1 -1
  333. package/package.json +14 -14
  334. package/dist/dev/ShopifyProvider.cjs +0 -46
  335. package/dist/dev/_virtual/index.cjs +0 -5
  336. package/dist/dev/_virtual/index.cjs.map +0 -1
  337. package/dist/dev/_virtual/use-sync-external-store-shim.development.cjs +0 -5
  338. package/dist/dev/_virtual/use-sync-external-store-shim.development.cjs.map +0 -1
  339. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.cjs +0 -5
  340. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.cjs.map +0 -1
  341. package/dist/dev/_virtual/with-selector.cjs +0 -5
  342. package/dist/dev/_virtual/with-selector.cjs.map +0 -1
  343. package/dist/dev/_virtual/with-selector.development.cjs +0 -5
  344. package/dist/dev/_virtual/with-selector.development.cjs.map +0 -1
  345. package/dist/dev/_virtual/with-selector.production.min.cjs +0 -5
  346. package/dist/dev/_virtual/with-selector.production.min.cjs.map +0 -1
  347. package/dist/dev/cart-constants.cjs +0 -17
  348. package/dist/dev/cart-hooks.cjs +0 -48
  349. package/dist/dev/index.cjs +0 -38
  350. package/dist/dev/index.cjs.map +0 -1
  351. package/dist/dev/node_modules/@xstate/fsm/es/index.cjs.map +0 -1
  352. package/dist/dev/node_modules/@xstate/react/es/useConstant.cjs +0 -30
  353. package/dist/dev/node_modules/@xstate/react/es/useConstant.cjs.map +0 -1
  354. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs +0 -5
  355. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs.map +0 -1
  356. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs.map +0 -1
  357. package/dist/dev/node_modules/use-sync-external-store/shim/index.cjs +0 -21
  358. package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.cjs +0 -12
  359. package/dist/dev/storefront-api-constants.cjs +0 -5
  360. package/dist/dev/storefront-api-constants.cjs.map +0 -1
  361. package/dist/dev/storefront-client.cjs.map +0 -1
  362. package/dist/prod/ShopifyProvider.cjs +0 -46
  363. package/dist/prod/_virtual/index.cjs +0 -5
  364. package/dist/prod/_virtual/index.cjs.map +0 -1
  365. package/dist/prod/_virtual/use-sync-external-store-shim.development.cjs +0 -5
  366. package/dist/prod/_virtual/use-sync-external-store-shim.development.cjs.map +0 -1
  367. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.cjs +0 -5
  368. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.cjs.map +0 -1
  369. package/dist/prod/_virtual/with-selector.cjs +0 -5
  370. package/dist/prod/_virtual/with-selector.cjs.map +0 -1
  371. package/dist/prod/_virtual/with-selector.development.cjs +0 -5
  372. package/dist/prod/_virtual/with-selector.development.cjs.map +0 -1
  373. package/dist/prod/_virtual/with-selector.production.min.cjs +0 -5
  374. package/dist/prod/_virtual/with-selector.production.min.cjs.map +0 -1
  375. package/dist/prod/cart-constants.cjs +0 -17
  376. package/dist/prod/cart-hooks.cjs +0 -48
  377. package/dist/prod/index.cjs +0 -38
  378. package/dist/prod/index.cjs.map +0 -1
  379. package/dist/prod/node_modules/@xstate/fsm/es/index.cjs.map +0 -1
  380. package/dist/prod/node_modules/@xstate/react/es/useConstant.cjs +0 -30
  381. package/dist/prod/node_modules/@xstate/react/es/useConstant.cjs.map +0 -1
  382. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs +0 -5
  383. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs.map +0 -1
  384. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs.map +0 -1
  385. package/dist/prod/node_modules/use-sync-external-store/shim/index.cjs +0 -21
  386. package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.cjs +0 -12
  387. package/dist/prod/storefront-api-constants.cjs +0 -5
  388. package/dist/prod/storefront-api-constants.cjs.map +0 -1
  389. package/dist/prod/storefront-client.cjs.map +0 -1
@@ -1,11 +1,13 @@
1
- import { getShopifyImageDimensions, shopifyImageLoader, IMG_SRC_SET_SIZES, addImageSizeParametersToUrl } from "./image-size.js";
2
- import { jsx } from "react/jsx-runtime";
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const imageSize = require("./image-size.js");
4
+ const jsxRuntime = require("react/jsx-runtime");
3
5
  function Image({
4
6
  data,
5
7
  width,
6
8
  height,
7
9
  loading,
8
- loader = shopifyImageLoader,
10
+ loader = imageSize.shopifyImageLoader,
9
11
  loaderOptions,
10
12
  widths,
11
13
  decoding = "async",
@@ -22,7 +24,7 @@ function Image({
22
24
  const {
23
25
  width: imgElementWidth,
24
26
  height: imgElementHeight
25
- } = getShopifyImageDimensions({
27
+ } = imageSize.getShopifyImageDimensions({
26
28
  data,
27
29
  loaderOptions,
28
30
  elementProps: {
@@ -51,7 +53,7 @@ function Image({
51
53
  height: imgElementHeight,
52
54
  loader
53
55
  });
54
- return /* @__PURE__ */ jsx("img", {
56
+ return /* @__PURE__ */ jsxRuntime.jsx("img", {
55
57
  id: (_d = data.id) != null ? _d : "",
56
58
  alt: (_f = (_e = data.altText) != null ? _e : rest.alt) != null ? _f : "",
57
59
  loading: loading != null ? loading : "lazy",
@@ -80,11 +82,11 @@ function internalImageSrcSet({
80
82
  if (width && height) {
81
83
  aspectRatio = Number(height) / Number(width);
82
84
  }
83
- let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;
84
- if (!hasCustomWidths && width && width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]) {
85
- setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);
85
+ let setSizes = hasCustomWidths ? widths : imageSize.IMG_SRC_SET_SIZES;
86
+ if (!hasCustomWidths && width && width < imageSize.IMG_SRC_SET_SIZES[imageSize.IMG_SRC_SET_SIZES.length - 1]) {
87
+ setSizes = imageSize.IMG_SRC_SET_SIZES.filter((size) => size <= width);
86
88
  }
87
- const srcGenerator = loader ? loader : addImageSizeParametersToUrl;
89
+ const srcGenerator = loader ? loader : imageSize.addImageSizeParametersToUrl;
88
90
  return setSizes.map((size) => `${srcGenerator({
89
91
  src,
90
92
  width: size,
@@ -93,7 +95,5 @@ function internalImageSrcSet({
93
95
  scale
94
96
  })} ${size}w`).join(", ");
95
97
  }
96
- export {
97
- Image
98
- };
98
+ exports.Image = Image;
99
99
  //# sourceMappingURL=Image.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Image.js","sources":["../../src/Image.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getShopifyImageDimensions,\n shopifyImageLoader,\n addImageSizeParametersToUrl,\n IMG_SRC_SET_SIZES,\n} from './image-size.js';\nimport type {Image as ImageType} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\n\ntype HtmlImageProps = React.ImgHTMLAttributes<HTMLImageElement>;\n\nexport type ShopifyLoaderOptions = {\n crop?: 'top' | 'bottom' | 'left' | 'right' | 'center';\n scale?: 2 | 3;\n width?: HtmlImageProps['width'] | ImageType['width'];\n height?: HtmlImageProps['height'] | ImageType['height'];\n};\nexport type ShopifyLoaderParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n }\n>;\nexport type ShopifyImageProps = Omit<HtmlImageProps, 'src'> & {\n /** An object with fields that correspond to the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image).\n * The `data` prop is required.\n */\n data: PartialDeep<ImageType, {recurseIntoArrays: true}>;\n /** A custom function that generates the image URL. Parameters passed in\n * are `ShopifyLoaderParams`\n */\n loader?: (params: ShopifyLoaderParams) => string;\n /** An object of `loader` function options. For example, if the `loader` function\n * requires a `scale` option, then the value can be a property of the\n * `loaderOptions` object (for example, `{scale: 2}`). The object shape is `ShopifyLoaderOptions`.\n */\n loaderOptions?: ShopifyLoaderOptions;\n /**\n * `src` isn't used, and should instead be passed as part of the `data` object\n */\n src?: never;\n /**\n * An array of pixel widths to overwrite the default generated srcset. For example, `[300, 600, 800]`.\n */\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n};\n\n/**\n * The `Image` component renders an image for the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image) by using the `data` prop. You can [customize this component](https://shopify.dev/api/hydrogen/components#customizing-hydrogen-components) using passthrough props.\n *\n * An image's width and height are determined using the following priority list:\n * 1. The width and height values for the `loaderOptions` prop\n * 2. The width and height values for bare props\n * 3. The width and height values for the `data` prop\n *\n * If only one of `width` or `height` are defined, then the other will attempt to be calculated based on the image's aspect ratio,\n * provided that both `data.width` and `data.height` are available. If `data.width` and `data.height` aren't available, then the aspect ratio cannot be determined and the missing\n * value will remain as `null`\n */\nexport function Image({\n data,\n width,\n height,\n loading,\n loader = shopifyImageLoader,\n loaderOptions,\n widths,\n decoding = 'async',\n ...rest\n}: ShopifyImageProps) {\n if (!data.url) {\n const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${\n data.id ?? 'no ID provided'\n }`;\n\n if (__HYDROGEN_DEV__) {\n throw new Error(missingUrlError);\n } else {\n console.error(missingUrlError);\n }\n\n return null;\n }\n\n if (__HYDROGEN_DEV__ && !data.altText && !rest.alt) {\n console.warn(\n `<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n const {width: imgElementWidth, height: imgElementHeight} =\n getShopifyImageDimensions({\n data,\n loaderOptions,\n elementProps: {\n width,\n height,\n },\n });\n\n if (__HYDROGEN_DEV__ && (!imgElementWidth || !imgElementHeight)) {\n console.warn(\n `<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n let finalSrc = data.url;\n\n if (loader) {\n finalSrc = loader({\n ...loaderOptions,\n src: data.url,\n width: imgElementWidth,\n height: imgElementHeight,\n });\n if (typeof finalSrc !== 'string' || !finalSrc) {\n throw new Error(\n `<Image/>: 'loader' did not return a valid string. Image: ${\n data.id ?? data.url\n }`\n );\n }\n }\n\n // determining what the intended width of the image is. For example, if the width is specified and lower than the image width, then that is the maximum image width\n // to prevent generating a srcset with widths bigger than needed or to generate images that would distort because of being larger than original\n const maxWidth =\n width && imgElementWidth && width < imgElementWidth\n ? width\n : imgElementWidth;\n const finalSrcset =\n rest.srcSet ??\n internalImageSrcSet({\n ...loaderOptions,\n widths,\n src: data.url,\n width: maxWidth,\n height: imgElementHeight,\n loader,\n });\n\n /* eslint-disable hydrogen/prefer-image-component */\n return (\n <img\n id={data.id ?? ''}\n alt={data.altText ?? rest.alt ?? ''}\n loading={loading ?? 'lazy'}\n {...rest}\n src={finalSrc}\n width={imgElementWidth ?? undefined}\n height={imgElementHeight ?? undefined}\n srcSet={finalSrcset}\n decoding={decoding}\n />\n );\n /* eslint-enable hydrogen/prefer-image-component */\n}\n\ntype InternalShopifySrcSetGeneratorsParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n loader?: (params: ShopifyLoaderParams) => string;\n }\n>;\nfunction internalImageSrcSet({\n src,\n width,\n crop,\n scale,\n widths,\n loader,\n height,\n}: InternalShopifySrcSetGeneratorsParams) {\n const hasCustomWidths = widths && Array.isArray(widths);\n if (hasCustomWidths && widths.some((size) => isNaN(size as number))) {\n throw new Error(\n `<Image/>: the 'widths' must be an array of numbers. Image: ${src}`\n );\n }\n\n let aspectRatio = 1;\n if (width && height) {\n aspectRatio = Number(height) / Number(width);\n }\n\n let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;\n if (\n !hasCustomWidths &&\n width &&\n width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]\n ) {\n setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);\n }\n const srcGenerator = loader ? loader : addImageSizeParametersToUrl;\n return setSizes\n .map(\n (size) =>\n `${srcGenerator({\n src,\n width: size,\n // height is not applied if there is no crop\n // if there is crop, then height is applied as a ratio of the original width + height aspect ratio * size\n height: crop ? Number(size) * aspectRatio : undefined,\n crop,\n scale,\n })} ${size}w`\n )\n .join(', ');\n}\n"],"names":["Image","data","width","height","loading","loader","shopifyImageLoader","loaderOptions","widths","decoding","rest","url","missingUrlError","id","console","error","imgElementWidth","imgElementHeight","getShopifyImageDimensions","elementProps","finalSrc","src","Error","maxWidth","finalSrcset","srcSet","internalImageSrcSet","altText","alt","undefined","crop","scale","hasCustomWidths","Array","isArray","some","size","isNaN","aspectRatio","Number","setSizes","IMG_SRC_SET_SIZES","length","filter","srcGenerator","addImageSizeParametersToUrl","map","join"],"mappings":";;AA6DO,SAASA,MAAM;AAAA,EACpBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,KACRC;AATiB,GAUA;;AAChB,MAAA,CAACT,KAAKU,KAAK;AACPC,UAAAA,kBAAmB,kEACvBX,UAAKY,OAALZ,YAAW;AAKN;AACLa,cAAQC,MAAMH,eAAd;AAAA,IACD;AAEM,WAAA;AAAA,EACR;AAUK,QAAA;AAAA,IAACV,OAAOc;AAAAA,IAAiBb,QAAQc;AAAAA,MACrCC,0BAA0B;AAAA,IACxBjB;AAAAA,IACAM;AAAAA,IACAY,cAAc;AAAA,MACZjB;AAAAA,MACAC;AAAAA,IAFY;AAAA,EAAA,CAHS;AAiB3B,MAAIiB,WAAWnB,KAAKU;AAEpB,MAAIN,QAAQ;AACVe,eAAWf,OAAO;AAAA,MAChB,GAAGE;AAAAA,MACHc,KAAKpB,KAAKU;AAAAA,MACVT,OAAOc;AAAAA,MACPb,QAAQc;AAAAA,IAAAA,CAJO;AAMjB,QAAI,OAAOG,aAAa,YAAY,CAACA,UAAU;AAC7C,YAAM,IAAIE,MACP,6DACCrB,UAAKY,OAALZ,YAAWA,KAAKU,KAFd;AAAA,IAKP;AAAA,EACF;AAID,QAAMY,WACJrB,SAASc,mBAAmBd,QAAQc,kBAChCd,QACAc;AACAQ,QAAAA,eACJd,UAAKe,WAALf,YACAgB,oBAAoB;AAAA,IAClB,GAAGnB;AAAAA,IACHC;AAAAA,IACAa,KAAKpB,KAAKU;AAAAA,IACVT,OAAOqB;AAAAA,IACPpB,QAAQc;AAAAA,IACRZ;AAAAA,EAAAA,CANiB;AAUrB,6BACE,OAAA;AAAA,IACE,KAAIJ,UAAKY,OAALZ,YAAW;AAAA,IACf,MAAKA,gBAAK0B,YAAL1B,YAAgBS,KAAKkB,QAArB3B,YAA4B;AAAA,IACjC,SAASG,4BAAW;AAAA,IAHtB,GAIMM;AAAAA,IACJ,KAAKU;AAAAA,IACL,OAAOJ,4CAAmBa;AAAAA,IAC1B,QAAQZ,8CAAoBY;AAAAA,IAC5B,QAAQL;AAAAA,IACR;AAAA,EAAA,CAVJ;AAcD;AASD,SAASE,oBAAoB;AAAA,EAC3BL;AAAAA,EACAnB;AAAAA,EACA4B;AAAAA,EACAC;AAAAA,EACAvB;AAAAA,EACAH;AAAAA,EACAF;AAP2B,GAQa;AACxC,QAAM6B,kBAAkBxB,UAAUyB,MAAMC,QAAQ1B,MAAd;AAClC,MAAIwB,mBAAmBxB,OAAO2B,KAAMC,UAASC,MAAMD,IAAD,CAA3B,GAA8C;AAC7D,UAAA,IAAId,MACP,8DAA6DD,KAD1D;AAAA,EAGP;AAED,MAAIiB,cAAc;AAClB,MAAIpC,SAASC,QAAQ;AACnBmC,kBAAcC,OAAOpC,MAAD,IAAWoC,OAAOrC,KAAD;AAAA,EACtC;AAEGsC,MAAAA,WAAWR,kBAAkBxB,SAASiC;AAC1C,MACE,CAACT,mBACD9B,SACAA,QAAQuC,kBAAkBA,kBAAkBC,SAAS,IACrD;AACAF,eAAWC,kBAAkBE,OAAQP,CAASA,SAAAA,QAAQlC,KAA3C;AAAA,EACZ;AACK0C,QAAAA,eAAevC,SAASA,SAASwC;AACvC,SAAOL,SACJM,IACEV,CACE,SAAA,GAAEQ,aAAa;AAAA,IACdvB;AAAAA,IACAnB,OAAOkC;AAAAA,IAGPjC,QAAQ2B,OAAOS,OAAOH,IAAD,IAASE,cAAcT;AAAAA,IAC5CC;AAAAA,IACAC;AAAAA,EAAAA,CAPa,KAQTK,OAXL,EAaJW,KAAK,IAbD;AAcR;"}
1
+ {"version":3,"file":"Image.js","sources":["../../src/Image.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getShopifyImageDimensions,\n shopifyImageLoader,\n addImageSizeParametersToUrl,\n IMG_SRC_SET_SIZES,\n} from './image-size.js';\nimport type {Image as ImageType} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\n\ntype HtmlImageProps = React.ImgHTMLAttributes<HTMLImageElement>;\n\nexport type ShopifyLoaderOptions = {\n crop?: 'top' | 'bottom' | 'left' | 'right' | 'center';\n scale?: 2 | 3;\n width?: HtmlImageProps['width'] | ImageType['width'];\n height?: HtmlImageProps['height'] | ImageType['height'];\n};\nexport type ShopifyLoaderParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n }\n>;\nexport type ShopifyImageProps = Omit<HtmlImageProps, 'src'> & {\n /** An object with fields that correspond to the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image).\n * The `data` prop is required.\n */\n data: PartialDeep<ImageType, {recurseIntoArrays: true}>;\n /** A custom function that generates the image URL. Parameters passed in\n * are `ShopifyLoaderParams`\n */\n loader?: (params: ShopifyLoaderParams) => string;\n /** An object of `loader` function options. For example, if the `loader` function\n * requires a `scale` option, then the value can be a property of the\n * `loaderOptions` object (for example, `{scale: 2}`). The object shape is `ShopifyLoaderOptions`.\n */\n loaderOptions?: ShopifyLoaderOptions;\n /**\n * `src` isn't used, and should instead be passed as part of the `data` object\n */\n src?: never;\n /**\n * An array of pixel widths to overwrite the default generated srcset. For example, `[300, 600, 800]`.\n */\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n};\n\n/**\n * The `Image` component renders an image for the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image) by using the `data` prop. You can [customize this component](https://shopify.dev/api/hydrogen/components#customizing-hydrogen-components) using passthrough props.\n *\n * An image's width and height are determined using the following priority list:\n * 1. The width and height values for the `loaderOptions` prop\n * 2. The width and height values for bare props\n * 3. The width and height values for the `data` prop\n *\n * If only one of `width` or `height` are defined, then the other will attempt to be calculated based on the image's aspect ratio,\n * provided that both `data.width` and `data.height` are available. If `data.width` and `data.height` aren't available, then the aspect ratio cannot be determined and the missing\n * value will remain as `null`\n */\nexport function Image({\n data,\n width,\n height,\n loading,\n loader = shopifyImageLoader,\n loaderOptions,\n widths,\n decoding = 'async',\n ...rest\n}: ShopifyImageProps) {\n if (!data.url) {\n const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${\n data.id ?? 'no ID provided'\n }`;\n\n if (__HYDROGEN_DEV__) {\n throw new Error(missingUrlError);\n } else {\n console.error(missingUrlError);\n }\n\n return null;\n }\n\n if (__HYDROGEN_DEV__ && !data.altText && !rest.alt) {\n console.warn(\n `<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n const {width: imgElementWidth, height: imgElementHeight} =\n getShopifyImageDimensions({\n data,\n loaderOptions,\n elementProps: {\n width,\n height,\n },\n });\n\n if (__HYDROGEN_DEV__ && (!imgElementWidth || !imgElementHeight)) {\n console.warn(\n `<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n let finalSrc = data.url;\n\n if (loader) {\n finalSrc = loader({\n ...loaderOptions,\n src: data.url,\n width: imgElementWidth,\n height: imgElementHeight,\n });\n if (typeof finalSrc !== 'string' || !finalSrc) {\n throw new Error(\n `<Image/>: 'loader' did not return a valid string. Image: ${\n data.id ?? data.url\n }`\n );\n }\n }\n\n // determining what the intended width of the image is. For example, if the width is specified and lower than the image width, then that is the maximum image width\n // to prevent generating a srcset with widths bigger than needed or to generate images that would distort because of being larger than original\n const maxWidth =\n width && imgElementWidth && width < imgElementWidth\n ? width\n : imgElementWidth;\n const finalSrcset =\n rest.srcSet ??\n internalImageSrcSet({\n ...loaderOptions,\n widths,\n src: data.url,\n width: maxWidth,\n height: imgElementHeight,\n loader,\n });\n\n /* eslint-disable hydrogen/prefer-image-component */\n return (\n <img\n id={data.id ?? ''}\n alt={data.altText ?? rest.alt ?? ''}\n loading={loading ?? 'lazy'}\n {...rest}\n src={finalSrc}\n width={imgElementWidth ?? undefined}\n height={imgElementHeight ?? undefined}\n srcSet={finalSrcset}\n decoding={decoding}\n />\n );\n /* eslint-enable hydrogen/prefer-image-component */\n}\n\ntype InternalShopifySrcSetGeneratorsParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n loader?: (params: ShopifyLoaderParams) => string;\n }\n>;\nfunction internalImageSrcSet({\n src,\n width,\n crop,\n scale,\n widths,\n loader,\n height,\n}: InternalShopifySrcSetGeneratorsParams) {\n const hasCustomWidths = widths && Array.isArray(widths);\n if (hasCustomWidths && widths.some((size) => isNaN(size as number))) {\n throw new Error(\n `<Image/>: the 'widths' must be an array of numbers. Image: ${src}`\n );\n }\n\n let aspectRatio = 1;\n if (width && height) {\n aspectRatio = Number(height) / Number(width);\n }\n\n let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;\n if (\n !hasCustomWidths &&\n width &&\n width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]\n ) {\n setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);\n }\n const srcGenerator = loader ? loader : addImageSizeParametersToUrl;\n return setSizes\n .map(\n (size) =>\n `${srcGenerator({\n src,\n width: size,\n // height is not applied if there is no crop\n // if there is crop, then height is applied as a ratio of the original width + height aspect ratio * size\n height: crop ? Number(size) * aspectRatio : undefined,\n crop,\n scale,\n })} ${size}w`\n )\n .join(', ');\n}\n"],"names":["Image","data","width","height","loading","loader","shopifyImageLoader","loaderOptions","widths","decoding","rest","url","missingUrlError","id","console","error","imgElementWidth","imgElementHeight","getShopifyImageDimensions","elementProps","finalSrc","src","Error","maxWidth","finalSrcset","srcSet","internalImageSrcSet","altText","alt","undefined","crop","scale","hasCustomWidths","Array","isArray","some","size","isNaN","aspectRatio","Number","setSizes","IMG_SRC_SET_SIZES","length","filter","srcGenerator","addImageSizeParametersToUrl","map","join"],"mappings":";;;;AA6DO,SAASA,MAAM;AAAA,EACpBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAASC,UAAAA;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,KACRC;AATiB,GAUA;;AAChB,MAAA,CAACT,KAAKU,KAAK;AACPC,UAAAA,kBAAmB,kEACvBX,UAAKY,OAALZ,YAAW;AAKN;AACLa,cAAQC,MAAMH,eAAd;AAAA,IACD;AAEM,WAAA;AAAA,EACR;AAUK,QAAA;AAAA,IAACV,OAAOc;AAAAA,IAAiBb,QAAQc;AAAAA,MACrCC,oCAA0B;AAAA,IACxBjB;AAAAA,IACAM;AAAAA,IACAY,cAAc;AAAA,MACZjB;AAAAA,MACAC;AAAAA,IAFY;AAAA,EAAA,CAHS;AAiB3B,MAAIiB,WAAWnB,KAAKU;AAEpB,MAAIN,QAAQ;AACVe,eAAWf,OAAO;AAAA,MAChB,GAAGE;AAAAA,MACHc,KAAKpB,KAAKU;AAAAA,MACVT,OAAOc;AAAAA,MACPb,QAAQc;AAAAA,IAAAA,CAJO;AAMjB,QAAI,OAAOG,aAAa,YAAY,CAACA,UAAU;AAC7C,YAAM,IAAIE,MACP,6DACCrB,UAAKY,OAALZ,YAAWA,KAAKU,KAFd;AAAA,IAKP;AAAA,EACF;AAID,QAAMY,WACJrB,SAASc,mBAAmBd,QAAQc,kBAChCd,QACAc;AACAQ,QAAAA,eACJd,UAAKe,WAALf,YACAgB,oBAAoB;AAAA,IAClB,GAAGnB;AAAAA,IACHC;AAAAA,IACAa,KAAKpB,KAAKU;AAAAA,IACVT,OAAOqB;AAAAA,IACPpB,QAAQc;AAAAA,IACRZ;AAAAA,EAAAA,CANiB;AAUrB,wCACE,OAAA;AAAA,IACE,KAAIJ,UAAKY,OAALZ,YAAW;AAAA,IACf,MAAKA,gBAAK0B,YAAL1B,YAAgBS,KAAKkB,QAArB3B,YAA4B;AAAA,IACjC,SAASG,4BAAW;AAAA,IAHtB,GAIMM;AAAAA,IACJ,KAAKU;AAAAA,IACL,OAAOJ,4CAAmBa;AAAAA,IAC1B,QAAQZ,8CAAoBY;AAAAA,IAC5B,QAAQL;AAAAA,IACR;AAAA,EAAA,CAVJ;AAcD;AASD,SAASE,oBAAoB;AAAA,EAC3BL;AAAAA,EACAnB;AAAAA,EACA4B;AAAAA,EACAC;AAAAA,EACAvB;AAAAA,EACAH;AAAAA,EACAF;AAP2B,GAQa;AACxC,QAAM6B,kBAAkBxB,UAAUyB,MAAMC,QAAQ1B,MAAd;AAClC,MAAIwB,mBAAmBxB,OAAO2B,KAAMC,UAASC,MAAMD,IAAD,CAA3B,GAA8C;AAC7D,UAAA,IAAId,MACP,8DAA6DD,KAD1D;AAAA,EAGP;AAED,MAAIiB,cAAc;AAClB,MAAIpC,SAASC,QAAQ;AACnBmC,kBAAcC,OAAOpC,MAAD,IAAWoC,OAAOrC,KAAD;AAAA,EACtC;AAEGsC,MAAAA,WAAWR,kBAAkBxB,SAASiC;AAC1C,MACE,CAACT,mBACD9B,SACAA,QAAQuC,UAAkBA,kBAAAA,4BAAkBC,SAAS,IACrD;AACAF,eAAWC,UAAkBE,kBAAAA,OAAQP,CAASA,SAAAA,QAAQlC,KAA3C;AAAA,EACZ;AACK0C,QAAAA,eAAevC,SAASA,SAASwC;AACvC,SAAOL,SACJM,IACEV,CACE,SAAA,GAAEQ,aAAa;AAAA,IACdvB;AAAAA,IACAnB,OAAOkC;AAAAA,IAGPjC,QAAQ2B,OAAOS,OAAOH,IAAD,IAASE,cAAcT;AAAAA,IAC5CC;AAAAA,IACAC;AAAAA,EAAAA,CAPa,KAQTK,OAXL,EAaJW,KAAK,IAbD;AAcR;;"}
@@ -1,13 +1,11 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const imageSize = require("./image-size.cjs");
4
- const jsxRuntime = require("react/jsx-runtime");
1
+ import { getShopifyImageDimensions, shopifyImageLoader, IMG_SRC_SET_SIZES, addImageSizeParametersToUrl } from "./image-size.mjs";
2
+ import { jsx } from "react/jsx-runtime";
5
3
  function Image({
6
4
  data,
7
5
  width,
8
6
  height,
9
7
  loading,
10
- loader = imageSize.shopifyImageLoader,
8
+ loader = shopifyImageLoader,
11
9
  loaderOptions,
12
10
  widths,
13
11
  decoding = "async",
@@ -24,7 +22,7 @@ function Image({
24
22
  const {
25
23
  width: imgElementWidth,
26
24
  height: imgElementHeight
27
- } = imageSize.getShopifyImageDimensions({
25
+ } = getShopifyImageDimensions({
28
26
  data,
29
27
  loaderOptions,
30
28
  elementProps: {
@@ -53,7 +51,7 @@ function Image({
53
51
  height: imgElementHeight,
54
52
  loader
55
53
  });
56
- return /* @__PURE__ */ jsxRuntime.jsx("img", {
54
+ return /* @__PURE__ */ jsx("img", {
57
55
  id: (_d = data.id) != null ? _d : "",
58
56
  alt: (_f = (_e = data.altText) != null ? _e : rest.alt) != null ? _f : "",
59
57
  loading: loading != null ? loading : "lazy",
@@ -82,11 +80,11 @@ function internalImageSrcSet({
82
80
  if (width && height) {
83
81
  aspectRatio = Number(height) / Number(width);
84
82
  }
85
- let setSizes = hasCustomWidths ? widths : imageSize.IMG_SRC_SET_SIZES;
86
- if (!hasCustomWidths && width && width < imageSize.IMG_SRC_SET_SIZES[imageSize.IMG_SRC_SET_SIZES.length - 1]) {
87
- setSizes = imageSize.IMG_SRC_SET_SIZES.filter((size) => size <= width);
83
+ let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;
84
+ if (!hasCustomWidths && width && width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]) {
85
+ setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);
88
86
  }
89
- const srcGenerator = loader ? loader : imageSize.addImageSizeParametersToUrl;
87
+ const srcGenerator = loader ? loader : addImageSizeParametersToUrl;
90
88
  return setSizes.map((size) => `${srcGenerator({
91
89
  src,
92
90
  width: size,
@@ -95,5 +93,7 @@ function internalImageSrcSet({
95
93
  scale
96
94
  })} ${size}w`).join(", ");
97
95
  }
98
- exports.Image = Image;
99
- //# sourceMappingURL=Image.cjs.map
96
+ export {
97
+ Image
98
+ };
99
+ //# sourceMappingURL=Image.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Image.cjs","sources":["../../src/Image.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getShopifyImageDimensions,\n shopifyImageLoader,\n addImageSizeParametersToUrl,\n IMG_SRC_SET_SIZES,\n} from './image-size.js';\nimport type {Image as ImageType} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\n\ntype HtmlImageProps = React.ImgHTMLAttributes<HTMLImageElement>;\n\nexport type ShopifyLoaderOptions = {\n crop?: 'top' | 'bottom' | 'left' | 'right' | 'center';\n scale?: 2 | 3;\n width?: HtmlImageProps['width'] | ImageType['width'];\n height?: HtmlImageProps['height'] | ImageType['height'];\n};\nexport type ShopifyLoaderParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n }\n>;\nexport type ShopifyImageProps = Omit<HtmlImageProps, 'src'> & {\n /** An object with fields that correspond to the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image).\n * The `data` prop is required.\n */\n data: PartialDeep<ImageType, {recurseIntoArrays: true}>;\n /** A custom function that generates the image URL. Parameters passed in\n * are `ShopifyLoaderParams`\n */\n loader?: (params: ShopifyLoaderParams) => string;\n /** An object of `loader` function options. For example, if the `loader` function\n * requires a `scale` option, then the value can be a property of the\n * `loaderOptions` object (for example, `{scale: 2}`). The object shape is `ShopifyLoaderOptions`.\n */\n loaderOptions?: ShopifyLoaderOptions;\n /**\n * `src` isn't used, and should instead be passed as part of the `data` object\n */\n src?: never;\n /**\n * An array of pixel widths to overwrite the default generated srcset. For example, `[300, 600, 800]`.\n */\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n};\n\n/**\n * The `Image` component renders an image for the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image) by using the `data` prop. You can [customize this component](https://shopify.dev/api/hydrogen/components#customizing-hydrogen-components) using passthrough props.\n *\n * An image's width and height are determined using the following priority list:\n * 1. The width and height values for the `loaderOptions` prop\n * 2. The width and height values for bare props\n * 3. The width and height values for the `data` prop\n *\n * If only one of `width` or `height` are defined, then the other will attempt to be calculated based on the image's aspect ratio,\n * provided that both `data.width` and `data.height` are available. If `data.width` and `data.height` aren't available, then the aspect ratio cannot be determined and the missing\n * value will remain as `null`\n */\nexport function Image({\n data,\n width,\n height,\n loading,\n loader = shopifyImageLoader,\n loaderOptions,\n widths,\n decoding = 'async',\n ...rest\n}: ShopifyImageProps) {\n if (!data.url) {\n const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${\n data.id ?? 'no ID provided'\n }`;\n\n if (__HYDROGEN_DEV__) {\n throw new Error(missingUrlError);\n } else {\n console.error(missingUrlError);\n }\n\n return null;\n }\n\n if (__HYDROGEN_DEV__ && !data.altText && !rest.alt) {\n console.warn(\n `<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n const {width: imgElementWidth, height: imgElementHeight} =\n getShopifyImageDimensions({\n data,\n loaderOptions,\n elementProps: {\n width,\n height,\n },\n });\n\n if (__HYDROGEN_DEV__ && (!imgElementWidth || !imgElementHeight)) {\n console.warn(\n `<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n let finalSrc = data.url;\n\n if (loader) {\n finalSrc = loader({\n ...loaderOptions,\n src: data.url,\n width: imgElementWidth,\n height: imgElementHeight,\n });\n if (typeof finalSrc !== 'string' || !finalSrc) {\n throw new Error(\n `<Image/>: 'loader' did not return a valid string. Image: ${\n data.id ?? data.url\n }`\n );\n }\n }\n\n // determining what the intended width of the image is. For example, if the width is specified and lower than the image width, then that is the maximum image width\n // to prevent generating a srcset with widths bigger than needed or to generate images that would distort because of being larger than original\n const maxWidth =\n width && imgElementWidth && width < imgElementWidth\n ? width\n : imgElementWidth;\n const finalSrcset =\n rest.srcSet ??\n internalImageSrcSet({\n ...loaderOptions,\n widths,\n src: data.url,\n width: maxWidth,\n height: imgElementHeight,\n loader,\n });\n\n /* eslint-disable hydrogen/prefer-image-component */\n return (\n <img\n id={data.id ?? ''}\n alt={data.altText ?? rest.alt ?? ''}\n loading={loading ?? 'lazy'}\n {...rest}\n src={finalSrc}\n width={imgElementWidth ?? undefined}\n height={imgElementHeight ?? undefined}\n srcSet={finalSrcset}\n decoding={decoding}\n />\n );\n /* eslint-enable hydrogen/prefer-image-component */\n}\n\ntype InternalShopifySrcSetGeneratorsParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n loader?: (params: ShopifyLoaderParams) => string;\n }\n>;\nfunction internalImageSrcSet({\n src,\n width,\n crop,\n scale,\n widths,\n loader,\n height,\n}: InternalShopifySrcSetGeneratorsParams) {\n const hasCustomWidths = widths && Array.isArray(widths);\n if (hasCustomWidths && widths.some((size) => isNaN(size as number))) {\n throw new Error(\n `<Image/>: the 'widths' must be an array of numbers. Image: ${src}`\n );\n }\n\n let aspectRatio = 1;\n if (width && height) {\n aspectRatio = Number(height) / Number(width);\n }\n\n let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;\n if (\n !hasCustomWidths &&\n width &&\n width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]\n ) {\n setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);\n }\n const srcGenerator = loader ? loader : addImageSizeParametersToUrl;\n return setSizes\n .map(\n (size) =>\n `${srcGenerator({\n src,\n width: size,\n // height is not applied if there is no crop\n // if there is crop, then height is applied as a ratio of the original width + height aspect ratio * size\n height: crop ? Number(size) * aspectRatio : undefined,\n crop,\n scale,\n })} ${size}w`\n )\n .join(', ');\n}\n"],"names":["Image","data","width","height","loading","loader","shopifyImageLoader","loaderOptions","widths","decoding","rest","url","missingUrlError","id","console","error","imgElementWidth","imgElementHeight","getShopifyImageDimensions","elementProps","finalSrc","src","Error","maxWidth","finalSrcset","srcSet","internalImageSrcSet","altText","alt","undefined","crop","scale","hasCustomWidths","Array","isArray","some","size","isNaN","aspectRatio","Number","setSizes","IMG_SRC_SET_SIZES","length","filter","srcGenerator","addImageSizeParametersToUrl","map","join"],"mappings":";;;;AA6DO,SAASA,MAAM;AAAA,EACpBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAASC,UAAAA;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,KACRC;AATiB,GAUA;;AAChB,MAAA,CAACT,KAAKU,KAAK;AACPC,UAAAA,kBAAmB,kEACvBX,UAAKY,OAALZ,YAAW;AAKN;AACLa,cAAQC,MAAMH,eAAd;AAAA,IACD;AAEM,WAAA;AAAA,EACR;AAUK,QAAA;AAAA,IAACV,OAAOc;AAAAA,IAAiBb,QAAQc;AAAAA,MACrCC,oCAA0B;AAAA,IACxBjB;AAAAA,IACAM;AAAAA,IACAY,cAAc;AAAA,MACZjB;AAAAA,MACAC;AAAAA,IAFY;AAAA,EAAA,CAHS;AAiB3B,MAAIiB,WAAWnB,KAAKU;AAEpB,MAAIN,QAAQ;AACVe,eAAWf,OAAO;AAAA,MAChB,GAAGE;AAAAA,MACHc,KAAKpB,KAAKU;AAAAA,MACVT,OAAOc;AAAAA,MACPb,QAAQc;AAAAA,IAAAA,CAJO;AAMjB,QAAI,OAAOG,aAAa,YAAY,CAACA,UAAU;AAC7C,YAAM,IAAIE,MACP,6DACCrB,UAAKY,OAALZ,YAAWA,KAAKU,KAFd;AAAA,IAKP;AAAA,EACF;AAID,QAAMY,WACJrB,SAASc,mBAAmBd,QAAQc,kBAChCd,QACAc;AACAQ,QAAAA,eACJd,UAAKe,WAALf,YACAgB,oBAAoB;AAAA,IAClB,GAAGnB;AAAAA,IACHC;AAAAA,IACAa,KAAKpB,KAAKU;AAAAA,IACVT,OAAOqB;AAAAA,IACPpB,QAAQc;AAAAA,IACRZ;AAAAA,EAAAA,CANiB;AAUrB,wCACE,OAAA;AAAA,IACE,KAAIJ,UAAKY,OAALZ,YAAW;AAAA,IACf,MAAKA,gBAAK0B,YAAL1B,YAAgBS,KAAKkB,QAArB3B,YAA4B;AAAA,IACjC,SAASG,4BAAW;AAAA,IAHtB,GAIMM;AAAAA,IACJ,KAAKU;AAAAA,IACL,OAAOJ,4CAAmBa;AAAAA,IAC1B,QAAQZ,8CAAoBY;AAAAA,IAC5B,QAAQL;AAAAA,IACR;AAAA,EAAA,CAVJ;AAcD;AASD,SAASE,oBAAoB;AAAA,EAC3BL;AAAAA,EACAnB;AAAAA,EACA4B;AAAAA,EACAC;AAAAA,EACAvB;AAAAA,EACAH;AAAAA,EACAF;AAP2B,GAQa;AACxC,QAAM6B,kBAAkBxB,UAAUyB,MAAMC,QAAQ1B,MAAd;AAClC,MAAIwB,mBAAmBxB,OAAO2B,KAAMC,UAASC,MAAMD,IAAD,CAA3B,GAA8C;AAC7D,UAAA,IAAId,MACP,8DAA6DD,KAD1D;AAAA,EAGP;AAED,MAAIiB,cAAc;AAClB,MAAIpC,SAASC,QAAQ;AACnBmC,kBAAcC,OAAOpC,MAAD,IAAWoC,OAAOrC,KAAD;AAAA,EACtC;AAEGsC,MAAAA,WAAWR,kBAAkBxB,SAASiC;AAC1C,MACE,CAACT,mBACD9B,SACAA,QAAQuC,UAAkBA,kBAAAA,4BAAkBC,SAAS,IACrD;AACAF,eAAWC,UAAkBE,kBAAAA,OAAQP,CAASA,SAAAA,QAAQlC,KAA3C;AAAA,EACZ;AACK0C,QAAAA,eAAevC,SAASA,SAASwC;AACvC,SAAOL,SACJM,IACEV,CACE,SAAA,GAAEQ,aAAa;AAAA,IACdvB;AAAAA,IACAnB,OAAOkC;AAAAA,IAGPjC,QAAQ2B,OAAOS,OAAOH,IAAD,IAASE,cAAcT;AAAAA,IAC5CC;AAAAA,IACAC;AAAAA,EAAAA,CAPa,KAQTK,OAXL,EAaJW,KAAK,IAbD;AAcR;;"}
1
+ {"version":3,"file":"Image.mjs","sources":["../../src/Image.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getShopifyImageDimensions,\n shopifyImageLoader,\n addImageSizeParametersToUrl,\n IMG_SRC_SET_SIZES,\n} from './image-size.js';\nimport type {Image as ImageType} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\n\ntype HtmlImageProps = React.ImgHTMLAttributes<HTMLImageElement>;\n\nexport type ShopifyLoaderOptions = {\n crop?: 'top' | 'bottom' | 'left' | 'right' | 'center';\n scale?: 2 | 3;\n width?: HtmlImageProps['width'] | ImageType['width'];\n height?: HtmlImageProps['height'] | ImageType['height'];\n};\nexport type ShopifyLoaderParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n }\n>;\nexport type ShopifyImageProps = Omit<HtmlImageProps, 'src'> & {\n /** An object with fields that correspond to the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image).\n * The `data` prop is required.\n */\n data: PartialDeep<ImageType, {recurseIntoArrays: true}>;\n /** A custom function that generates the image URL. Parameters passed in\n * are `ShopifyLoaderParams`\n */\n loader?: (params: ShopifyLoaderParams) => string;\n /** An object of `loader` function options. For example, if the `loader` function\n * requires a `scale` option, then the value can be a property of the\n * `loaderOptions` object (for example, `{scale: 2}`). The object shape is `ShopifyLoaderOptions`.\n */\n loaderOptions?: ShopifyLoaderOptions;\n /**\n * `src` isn't used, and should instead be passed as part of the `data` object\n */\n src?: never;\n /**\n * An array of pixel widths to overwrite the default generated srcset. For example, `[300, 600, 800]`.\n */\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n};\n\n/**\n * The `Image` component renders an image for the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image) by using the `data` prop. You can [customize this component](https://shopify.dev/api/hydrogen/components#customizing-hydrogen-components) using passthrough props.\n *\n * An image's width and height are determined using the following priority list:\n * 1. The width and height values for the `loaderOptions` prop\n * 2. The width and height values for bare props\n * 3. The width and height values for the `data` prop\n *\n * If only one of `width` or `height` are defined, then the other will attempt to be calculated based on the image's aspect ratio,\n * provided that both `data.width` and `data.height` are available. If `data.width` and `data.height` aren't available, then the aspect ratio cannot be determined and the missing\n * value will remain as `null`\n */\nexport function Image({\n data,\n width,\n height,\n loading,\n loader = shopifyImageLoader,\n loaderOptions,\n widths,\n decoding = 'async',\n ...rest\n}: ShopifyImageProps) {\n if (!data.url) {\n const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${\n data.id ?? 'no ID provided'\n }`;\n\n if (__HYDROGEN_DEV__) {\n throw new Error(missingUrlError);\n } else {\n console.error(missingUrlError);\n }\n\n return null;\n }\n\n if (__HYDROGEN_DEV__ && !data.altText && !rest.alt) {\n console.warn(\n `<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n const {width: imgElementWidth, height: imgElementHeight} =\n getShopifyImageDimensions({\n data,\n loaderOptions,\n elementProps: {\n width,\n height,\n },\n });\n\n if (__HYDROGEN_DEV__ && (!imgElementWidth || !imgElementHeight)) {\n console.warn(\n `<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n let finalSrc = data.url;\n\n if (loader) {\n finalSrc = loader({\n ...loaderOptions,\n src: data.url,\n width: imgElementWidth,\n height: imgElementHeight,\n });\n if (typeof finalSrc !== 'string' || !finalSrc) {\n throw new Error(\n `<Image/>: 'loader' did not return a valid string. Image: ${\n data.id ?? data.url\n }`\n );\n }\n }\n\n // determining what the intended width of the image is. For example, if the width is specified and lower than the image width, then that is the maximum image width\n // to prevent generating a srcset with widths bigger than needed or to generate images that would distort because of being larger than original\n const maxWidth =\n width && imgElementWidth && width < imgElementWidth\n ? width\n : imgElementWidth;\n const finalSrcset =\n rest.srcSet ??\n internalImageSrcSet({\n ...loaderOptions,\n widths,\n src: data.url,\n width: maxWidth,\n height: imgElementHeight,\n loader,\n });\n\n /* eslint-disable hydrogen/prefer-image-component */\n return (\n <img\n id={data.id ?? ''}\n alt={data.altText ?? rest.alt ?? ''}\n loading={loading ?? 'lazy'}\n {...rest}\n src={finalSrc}\n width={imgElementWidth ?? undefined}\n height={imgElementHeight ?? undefined}\n srcSet={finalSrcset}\n decoding={decoding}\n />\n );\n /* eslint-enable hydrogen/prefer-image-component */\n}\n\ntype InternalShopifySrcSetGeneratorsParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n loader?: (params: ShopifyLoaderParams) => string;\n }\n>;\nfunction internalImageSrcSet({\n src,\n width,\n crop,\n scale,\n widths,\n loader,\n height,\n}: InternalShopifySrcSetGeneratorsParams) {\n const hasCustomWidths = widths && Array.isArray(widths);\n if (hasCustomWidths && widths.some((size) => isNaN(size as number))) {\n throw new Error(\n `<Image/>: the 'widths' must be an array of numbers. Image: ${src}`\n );\n }\n\n let aspectRatio = 1;\n if (width && height) {\n aspectRatio = Number(height) / Number(width);\n }\n\n let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;\n if (\n !hasCustomWidths &&\n width &&\n width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]\n ) {\n setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);\n }\n const srcGenerator = loader ? loader : addImageSizeParametersToUrl;\n return setSizes\n .map(\n (size) =>\n `${srcGenerator({\n src,\n width: size,\n // height is not applied if there is no crop\n // if there is crop, then height is applied as a ratio of the original width + height aspect ratio * size\n height: crop ? Number(size) * aspectRatio : undefined,\n crop,\n scale,\n })} ${size}w`\n )\n .join(', ');\n}\n"],"names":["Image","data","width","height","loading","loader","shopifyImageLoader","loaderOptions","widths","decoding","rest","url","missingUrlError","id","console","error","imgElementWidth","imgElementHeight","getShopifyImageDimensions","elementProps","finalSrc","src","Error","maxWidth","finalSrcset","srcSet","internalImageSrcSet","altText","alt","undefined","crop","scale","hasCustomWidths","Array","isArray","some","size","isNaN","aspectRatio","Number","setSizes","IMG_SRC_SET_SIZES","length","filter","srcGenerator","addImageSizeParametersToUrl","map","join"],"mappings":";;AA6DO,SAASA,MAAM;AAAA,EACpBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,KACRC;AATiB,GAUA;;AAChB,MAAA,CAACT,KAAKU,KAAK;AACPC,UAAAA,kBAAmB,kEACvBX,UAAKY,OAALZ,YAAW;AAKN;AACLa,cAAQC,MAAMH,eAAd;AAAA,IACD;AAEM,WAAA;AAAA,EACR;AAUK,QAAA;AAAA,IAACV,OAAOc;AAAAA,IAAiBb,QAAQc;AAAAA,MACrCC,0BAA0B;AAAA,IACxBjB;AAAAA,IACAM;AAAAA,IACAY,cAAc;AAAA,MACZjB;AAAAA,MACAC;AAAAA,IAFY;AAAA,EAAA,CAHS;AAiB3B,MAAIiB,WAAWnB,KAAKU;AAEpB,MAAIN,QAAQ;AACVe,eAAWf,OAAO;AAAA,MAChB,GAAGE;AAAAA,MACHc,KAAKpB,KAAKU;AAAAA,MACVT,OAAOc;AAAAA,MACPb,QAAQc;AAAAA,IAAAA,CAJO;AAMjB,QAAI,OAAOG,aAAa,YAAY,CAACA,UAAU;AAC7C,YAAM,IAAIE,MACP,6DACCrB,UAAKY,OAALZ,YAAWA,KAAKU,KAFd;AAAA,IAKP;AAAA,EACF;AAID,QAAMY,WACJrB,SAASc,mBAAmBd,QAAQc,kBAChCd,QACAc;AACAQ,QAAAA,eACJd,UAAKe,WAALf,YACAgB,oBAAoB;AAAA,IAClB,GAAGnB;AAAAA,IACHC;AAAAA,IACAa,KAAKpB,KAAKU;AAAAA,IACVT,OAAOqB;AAAAA,IACPpB,QAAQc;AAAAA,IACRZ;AAAAA,EAAAA,CANiB;AAUrB,6BACE,OAAA;AAAA,IACE,KAAIJ,UAAKY,OAALZ,YAAW;AAAA,IACf,MAAKA,gBAAK0B,YAAL1B,YAAgBS,KAAKkB,QAArB3B,YAA4B;AAAA,IACjC,SAASG,4BAAW;AAAA,IAHtB,GAIMM;AAAAA,IACJ,KAAKU;AAAAA,IACL,OAAOJ,4CAAmBa;AAAAA,IAC1B,QAAQZ,8CAAoBY;AAAAA,IAC5B,QAAQL;AAAAA,IACR;AAAA,EAAA,CAVJ;AAcD;AASD,SAASE,oBAAoB;AAAA,EAC3BL;AAAAA,EACAnB;AAAAA,EACA4B;AAAAA,EACAC;AAAAA,EACAvB;AAAAA,EACAH;AAAAA,EACAF;AAP2B,GAQa;AACxC,QAAM6B,kBAAkBxB,UAAUyB,MAAMC,QAAQ1B,MAAd;AAClC,MAAIwB,mBAAmBxB,OAAO2B,KAAMC,UAASC,MAAMD,IAAD,CAA3B,GAA8C;AAC7D,UAAA,IAAId,MACP,8DAA6DD,KAD1D;AAAA,EAGP;AAED,MAAIiB,cAAc;AAClB,MAAIpC,SAASC,QAAQ;AACnBmC,kBAAcC,OAAOpC,MAAD,IAAWoC,OAAOrC,KAAD;AAAA,EACtC;AAEGsC,MAAAA,WAAWR,kBAAkBxB,SAASiC;AAC1C,MACE,CAACT,mBACD9B,SACAA,QAAQuC,kBAAkBA,kBAAkBC,SAAS,IACrD;AACAF,eAAWC,kBAAkBE,OAAQP,CAASA,SAAAA,QAAQlC,KAA3C;AAAA,EACZ;AACK0C,QAAAA,eAAevC,SAASA,SAASwC;AACvC,SAAOL,SACJM,IACEV,CACE,SAAA,GAAEQ,aAAa;AAAA,IACdvB;AAAAA,IACAnB,OAAOkC;AAAAA,IAGPjC,QAAQ2B,OAAOS,OAAOH,IAAD,IAASE,cAAcT;AAAAA,IAC5CC;AAAAA,IACAC;AAAAA,EAAAA,CAPa,KAQTK,OAXL,EAaJW,KAAK,IAbD;AAcR;"}
@@ -1,8 +1,10 @@
1
- import { Image } from "./Image.js";
2
- import { Video } from "./Video.js";
3
- import { ExternalVideo } from "./ExternalVideo.js";
4
- import { ModelViewer } from "./ModelViewer.js";
5
- import { jsx } from "react/jsx-runtime";
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const Image = require("./Image.js");
4
+ const Video = require("./Video.js");
5
+ const ExternalVideo = require("./ExternalVideo.js");
6
+ const ModelViewer = require("./ModelViewer.js");
7
+ const jsxRuntime = require("react/jsx-runtime");
6
8
  function MediaFile({
7
9
  data,
8
10
  mediaOptions,
@@ -17,28 +19,28 @@ function MediaFile({
17
19
  return null;
18
20
  }
19
21
  }
20
- return /* @__PURE__ */ jsx(Image, {
22
+ return /* @__PURE__ */ jsxRuntime.jsx(Image.Image, {
21
23
  ...passthroughProps,
22
24
  ...mediaOptions == null ? void 0 : mediaOptions.image,
23
25
  data: data.image
24
26
  });
25
27
  }
26
28
  case "Video": {
27
- return /* @__PURE__ */ jsx(Video, {
29
+ return /* @__PURE__ */ jsxRuntime.jsx(Video.Video, {
28
30
  ...passthroughProps,
29
31
  ...mediaOptions == null ? void 0 : mediaOptions.video,
30
32
  data
31
33
  });
32
34
  }
33
35
  case "ExternalVideo": {
34
- return /* @__PURE__ */ jsx(ExternalVideo, {
36
+ return /* @__PURE__ */ jsxRuntime.jsx(ExternalVideo.ExternalVideo, {
35
37
  ...passthroughProps,
36
38
  ...mediaOptions == null ? void 0 : mediaOptions.externalVideo,
37
39
  data
38
40
  });
39
41
  }
40
42
  case "Model3d": {
41
- return /* @__PURE__ */ jsx(ModelViewer, {
43
+ return /* @__PURE__ */ jsxRuntime.jsx(ModelViewer.ModelViewer, {
42
44
  ...passthroughProps,
43
45
  ...mediaOptions == null ? void 0 : mediaOptions.modelViewer,
44
46
  data
@@ -53,7 +55,5 @@ function MediaFile({
53
55
  }
54
56
  }
55
57
  }
56
- export {
57
- MediaFile
58
- };
58
+ exports.MediaFile = MediaFile;
59
59
  //# sourceMappingURL=MediaFile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MediaFile.js","sources":["../../src/MediaFile.tsx"],"sourcesContent":["import {Image, type ShopifyImageProps} from './Image.js';\nimport {Video} from './Video.js';\nimport {ExternalVideo} from './ExternalVideo.js';\nimport {ModelViewer} from './ModelViewer.js';\nimport type {MediaEdge as MediaEdgeType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\n\ninterface MediaFileProps {\n /** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */\n data: PartialDeep<MediaEdgeType['node'], {recurseIntoArrays: true}>;\n /** The options for the `Image`, `Video`, or `ExternalVideo` components. */\n mediaOptions?: {\n /** Props that will only apply when an `<Image />` is rendered */\n image: Omit<ShopifyImageProps, 'data'>;\n /** Props that will only apply when a `<Video />` is rendered */\n video: Omit<React.ComponentProps<typeof Video>, 'data'>;\n /** Props that will only apply when an `<ExternalVideo />` is rendered */\n externalVideo: Omit<\n React.ComponentProps<typeof ExternalVideo>['options'],\n 'data'\n >;\n /** Props that will only apply when a `<ModelViewer />` is rendered */\n modelViewer: Omit<typeof ModelViewer, 'data'>;\n };\n}\n\n/**\n * The `MediaFile` component renders the media for the Storefront API's\n * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a\n * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.\n */\nexport function MediaFile({\n data,\n mediaOptions,\n ...passthroughProps\n}: MediaFileProps) {\n switch (data.__typename) {\n case 'MediaImage': {\n if (!data.image) {\n const noDataImage = `<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noDataImage);\n } else {\n console.warn(noDataImage);\n return null;\n }\n }\n\n return (\n <Image\n {...passthroughProps}\n {...mediaOptions?.image}\n data={data.image}\n />\n );\n }\n case 'Video': {\n return (\n <Video {...passthroughProps} {...mediaOptions?.video} data={data} />\n );\n }\n case 'ExternalVideo': {\n return (\n <ExternalVideo\n {...passthroughProps}\n {...mediaOptions?.externalVideo}\n data={data}\n />\n );\n }\n case 'Model3d': {\n return (\n <ModelViewer\n {...passthroughProps}\n {...mediaOptions?.modelViewer}\n data={data}\n />\n );\n }\n default: {\n const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to correctly render the correct component for this media. Rendering 'null' by default`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typenameMissingMessage);\n } else {\n console.error(typenameMissingMessage);\n return null;\n }\n }\n }\n}\n"],"names":["MediaFile","data","mediaOptions","passthroughProps","__typename","image","noDataImage","console","warn","video","externalVideo","modelViewer","typenameMissingMessage","error"],"mappings":";;;;;AA+BO,SAASA,UAAU;AAAA,EACxBC;AAAAA,EACAC;AAAAA,KACGC;AAHqB,GAIP;AACjB,UAAQF,KAAKG,YAAb;AAAA,IACE,KAAK,cAAc;AACb,UAAA,CAACH,KAAKI,OAAO;AACf,cAAMC,cAAe;AAGd;AACLC,kBAAQC,KAAKF,WAAb;AACO,iBAAA;AAAA,QACR;AAAA,MACF;AAED,iCACG,OAAD;AAAA,QAAA,GACMH;AAAAA,QADN,GAEMD,6CAAcG;AAAAA,QAClB,MAAMJ,KAAKI;AAAAA,MAAAA,CAJf;AAAA,IAOD;AAAA,IACD,KAAK,SAAS;AACZ,iCACG,OAAD;AAAA,QAAA,GAAWF;AAAAA,QAAX,GAAiCD,6CAAcO;AAAAA,QAAO;AAAA,MAAA,CADxD;AAAA,IAGD;AAAA,IACD,KAAK,iBAAiB;AACpB,iCACG,eAAD;AAAA,QAAA,GACMN;AAAAA,QADN,GAEMD,6CAAcQ;AAAAA,QAClB;AAAA,MAAA,CAJJ;AAAA,IAOD;AAAA,IACD,KAAK,WAAW;AACd,iCACG,aAAD;AAAA,QAAA,GACMP;AAAAA,QADN,GAEMD,6CAAcS;AAAAA,QAClB;AAAA,MAAA,CAJJ;AAAA,IAOD;AAAA,IACD,SAAS;AACP,YAAMC,yBAA0B;AAGzB;AACLL,gBAAQM,MAAMD,sBAAd;AACO,eAAA;AAAA,MACR;AAAA,IACF;AAAA,EAnDH;AAqDD;"}
1
+ {"version":3,"file":"MediaFile.js","sources":["../../src/MediaFile.tsx"],"sourcesContent":["import {Image, type ShopifyImageProps} from './Image.js';\nimport {Video} from './Video.js';\nimport {ExternalVideo} from './ExternalVideo.js';\nimport {ModelViewer} from './ModelViewer.js';\nimport type {MediaEdge as MediaEdgeType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\n\ninterface MediaFileProps {\n /** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */\n data: PartialDeep<MediaEdgeType['node'], {recurseIntoArrays: true}>;\n /** The options for the `Image`, `Video`, or `ExternalVideo` components. */\n mediaOptions?: {\n /** Props that will only apply when an `<Image />` is rendered */\n image: Omit<ShopifyImageProps, 'data'>;\n /** Props that will only apply when a `<Video />` is rendered */\n video: Omit<React.ComponentProps<typeof Video>, 'data'>;\n /** Props that will only apply when an `<ExternalVideo />` is rendered */\n externalVideo: Omit<\n React.ComponentProps<typeof ExternalVideo>['options'],\n 'data'\n >;\n /** Props that will only apply when a `<ModelViewer />` is rendered */\n modelViewer: Omit<typeof ModelViewer, 'data'>;\n };\n}\n\n/**\n * The `MediaFile` component renders the media for the Storefront API's\n * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a\n * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.\n */\nexport function MediaFile({\n data,\n mediaOptions,\n ...passthroughProps\n}: MediaFileProps) {\n switch (data.__typename) {\n case 'MediaImage': {\n if (!data.image) {\n const noDataImage = `<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noDataImage);\n } else {\n console.warn(noDataImage);\n return null;\n }\n }\n\n return (\n <Image\n {...passthroughProps}\n {...mediaOptions?.image}\n data={data.image}\n />\n );\n }\n case 'Video': {\n return (\n <Video {...passthroughProps} {...mediaOptions?.video} data={data} />\n );\n }\n case 'ExternalVideo': {\n return (\n <ExternalVideo\n {...passthroughProps}\n {...mediaOptions?.externalVideo}\n data={data}\n />\n );\n }\n case 'Model3d': {\n return (\n <ModelViewer\n {...passthroughProps}\n {...mediaOptions?.modelViewer}\n data={data}\n />\n );\n }\n default: {\n const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to correctly render the correct component for this media. Rendering 'null' by default`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typenameMissingMessage);\n } else {\n console.error(typenameMissingMessage);\n return null;\n }\n }\n }\n}\n"],"names":["MediaFile","data","mediaOptions","passthroughProps","__typename","image","noDataImage","console","warn","Image","Video","video","ExternalVideo","externalVideo","ModelViewer","modelViewer","typenameMissingMessage","error"],"mappings":";;;;;;;AA+BO,SAASA,UAAU;AAAA,EACxBC;AAAAA,EACAC;AAAAA,KACGC;AAHqB,GAIP;AACjB,UAAQF,KAAKG,YAAb;AAAA,IACE,KAAK,cAAc;AACb,UAAA,CAACH,KAAKI,OAAO;AACf,cAAMC,cAAe;AAGd;AACLC,kBAAQC,KAAKF,WAAb;AACO,iBAAA;AAAA,QACR;AAAA,MACF;AAED,4CACGG,MAAAA,OAAD;AAAA,QAAA,GACMN;AAAAA,QADN,GAEMD,6CAAcG;AAAAA,QAClB,MAAMJ,KAAKI;AAAAA,MAAAA,CAJf;AAAA,IAOD;AAAA,IACD,KAAK,SAAS;AACZ,4CACGK,MAAAA,OAAD;AAAA,QAAA,GAAWP;AAAAA,QAAX,GAAiCD,6CAAcS;AAAAA,QAAO;AAAA,MAAA,CADxD;AAAA,IAGD;AAAA,IACD,KAAK,iBAAiB;AACpB,4CACGC,cAAAA,eAAD;AAAA,QAAA,GACMT;AAAAA,QADN,GAEMD,6CAAcW;AAAAA,QAClB;AAAA,MAAA,CAJJ;AAAA,IAOD;AAAA,IACD,KAAK,WAAW;AACd,4CACGC,YAAAA,aAAD;AAAA,QAAA,GACMX;AAAAA,QADN,GAEMD,6CAAca;AAAAA,QAClB;AAAA,MAAA,CAJJ;AAAA,IAOD;AAAA,IACD,SAAS;AACP,YAAMC,yBAA0B;AAGzB;AACLT,gBAAQU,MAAMD,sBAAd;AACO,eAAA;AAAA,MACR;AAAA,IACF;AAAA,EAnDH;AAqDD;;"}
@@ -1,10 +1,8 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const Image = require("./Image.cjs");
4
- const Video = require("./Video.cjs");
5
- const ExternalVideo = require("./ExternalVideo.cjs");
6
- const ModelViewer = require("./ModelViewer.cjs");
7
- const jsxRuntime = require("react/jsx-runtime");
1
+ import { Image } from "./Image.mjs";
2
+ import { Video } from "./Video.mjs";
3
+ import { ExternalVideo } from "./ExternalVideo.mjs";
4
+ import { ModelViewer } from "./ModelViewer.mjs";
5
+ import { jsx } from "react/jsx-runtime";
8
6
  function MediaFile({
9
7
  data,
10
8
  mediaOptions,
@@ -19,28 +17,28 @@ function MediaFile({
19
17
  return null;
20
18
  }
21
19
  }
22
- return /* @__PURE__ */ jsxRuntime.jsx(Image.Image, {
20
+ return /* @__PURE__ */ jsx(Image, {
23
21
  ...passthroughProps,
24
22
  ...mediaOptions == null ? void 0 : mediaOptions.image,
25
23
  data: data.image
26
24
  });
27
25
  }
28
26
  case "Video": {
29
- return /* @__PURE__ */ jsxRuntime.jsx(Video.Video, {
27
+ return /* @__PURE__ */ jsx(Video, {
30
28
  ...passthroughProps,
31
29
  ...mediaOptions == null ? void 0 : mediaOptions.video,
32
30
  data
33
31
  });
34
32
  }
35
33
  case "ExternalVideo": {
36
- return /* @__PURE__ */ jsxRuntime.jsx(ExternalVideo.ExternalVideo, {
34
+ return /* @__PURE__ */ jsx(ExternalVideo, {
37
35
  ...passthroughProps,
38
36
  ...mediaOptions == null ? void 0 : mediaOptions.externalVideo,
39
37
  data
40
38
  });
41
39
  }
42
40
  case "Model3d": {
43
- return /* @__PURE__ */ jsxRuntime.jsx(ModelViewer.ModelViewer, {
41
+ return /* @__PURE__ */ jsx(ModelViewer, {
44
42
  ...passthroughProps,
45
43
  ...mediaOptions == null ? void 0 : mediaOptions.modelViewer,
46
44
  data
@@ -55,5 +53,7 @@ function MediaFile({
55
53
  }
56
54
  }
57
55
  }
58
- exports.MediaFile = MediaFile;
59
- //# sourceMappingURL=MediaFile.cjs.map
56
+ export {
57
+ MediaFile
58
+ };
59
+ //# sourceMappingURL=MediaFile.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"MediaFile.cjs","sources":["../../src/MediaFile.tsx"],"sourcesContent":["import {Image, type ShopifyImageProps} from './Image.js';\nimport {Video} from './Video.js';\nimport {ExternalVideo} from './ExternalVideo.js';\nimport {ModelViewer} from './ModelViewer.js';\nimport type {MediaEdge as MediaEdgeType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\n\ninterface MediaFileProps {\n /** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */\n data: PartialDeep<MediaEdgeType['node'], {recurseIntoArrays: true}>;\n /** The options for the `Image`, `Video`, or `ExternalVideo` components. */\n mediaOptions?: {\n /** Props that will only apply when an `<Image />` is rendered */\n image: Omit<ShopifyImageProps, 'data'>;\n /** Props that will only apply when a `<Video />` is rendered */\n video: Omit<React.ComponentProps<typeof Video>, 'data'>;\n /** Props that will only apply when an `<ExternalVideo />` is rendered */\n externalVideo: Omit<\n React.ComponentProps<typeof ExternalVideo>['options'],\n 'data'\n >;\n /** Props that will only apply when a `<ModelViewer />` is rendered */\n modelViewer: Omit<typeof ModelViewer, 'data'>;\n };\n}\n\n/**\n * The `MediaFile` component renders the media for the Storefront API's\n * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a\n * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.\n */\nexport function MediaFile({\n data,\n mediaOptions,\n ...passthroughProps\n}: MediaFileProps) {\n switch (data.__typename) {\n case 'MediaImage': {\n if (!data.image) {\n const noDataImage = `<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noDataImage);\n } else {\n console.warn(noDataImage);\n return null;\n }\n }\n\n return (\n <Image\n {...passthroughProps}\n {...mediaOptions?.image}\n data={data.image}\n />\n );\n }\n case 'Video': {\n return (\n <Video {...passthroughProps} {...mediaOptions?.video} data={data} />\n );\n }\n case 'ExternalVideo': {\n return (\n <ExternalVideo\n {...passthroughProps}\n {...mediaOptions?.externalVideo}\n data={data}\n />\n );\n }\n case 'Model3d': {\n return (\n <ModelViewer\n {...passthroughProps}\n {...mediaOptions?.modelViewer}\n data={data}\n />\n );\n }\n default: {\n const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to correctly render the correct component for this media. Rendering 'null' by default`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typenameMissingMessage);\n } else {\n console.error(typenameMissingMessage);\n return null;\n }\n }\n }\n}\n"],"names":["MediaFile","data","mediaOptions","passthroughProps","__typename","image","noDataImage","console","warn","Image","Video","video","ExternalVideo","externalVideo","ModelViewer","modelViewer","typenameMissingMessage","error"],"mappings":";;;;;;;AA+BO,SAASA,UAAU;AAAA,EACxBC;AAAAA,EACAC;AAAAA,KACGC;AAHqB,GAIP;AACjB,UAAQF,KAAKG,YAAb;AAAA,IACE,KAAK,cAAc;AACb,UAAA,CAACH,KAAKI,OAAO;AACf,cAAMC,cAAe;AAGd;AACLC,kBAAQC,KAAKF,WAAb;AACO,iBAAA;AAAA,QACR;AAAA,MACF;AAED,4CACGG,MAAAA,OAAD;AAAA,QAAA,GACMN;AAAAA,QADN,GAEMD,6CAAcG;AAAAA,QAClB,MAAMJ,KAAKI;AAAAA,MAAAA,CAJf;AAAA,IAOD;AAAA,IACD,KAAK,SAAS;AACZ,4CACGK,MAAAA,OAAD;AAAA,QAAA,GAAWP;AAAAA,QAAX,GAAiCD,6CAAcS;AAAAA,QAAO;AAAA,MAAA,CADxD;AAAA,IAGD;AAAA,IACD,KAAK,iBAAiB;AACpB,4CACGC,cAAAA,eAAD;AAAA,QAAA,GACMT;AAAAA,QADN,GAEMD,6CAAcW;AAAAA,QAClB;AAAA,MAAA,CAJJ;AAAA,IAOD;AAAA,IACD,KAAK,WAAW;AACd,4CACGC,YAAAA,aAAD;AAAA,QAAA,GACMX;AAAAA,QADN,GAEMD,6CAAca;AAAAA,QAClB;AAAA,MAAA,CAJJ;AAAA,IAOD;AAAA,IACD,SAAS;AACP,YAAMC,yBAA0B;AAGzB;AACLT,gBAAQU,MAAMD,sBAAd;AACO,eAAA;AAAA,MACR;AAAA,IACF;AAAA,EAnDH;AAqDD;;"}
1
+ {"version":3,"file":"MediaFile.mjs","sources":["../../src/MediaFile.tsx"],"sourcesContent":["import {Image, type ShopifyImageProps} from './Image.js';\nimport {Video} from './Video.js';\nimport {ExternalVideo} from './ExternalVideo.js';\nimport {ModelViewer} from './ModelViewer.js';\nimport type {MediaEdge as MediaEdgeType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\n\ninterface MediaFileProps {\n /** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */\n data: PartialDeep<MediaEdgeType['node'], {recurseIntoArrays: true}>;\n /** The options for the `Image`, `Video`, or `ExternalVideo` components. */\n mediaOptions?: {\n /** Props that will only apply when an `<Image />` is rendered */\n image: Omit<ShopifyImageProps, 'data'>;\n /** Props that will only apply when a `<Video />` is rendered */\n video: Omit<React.ComponentProps<typeof Video>, 'data'>;\n /** Props that will only apply when an `<ExternalVideo />` is rendered */\n externalVideo: Omit<\n React.ComponentProps<typeof ExternalVideo>['options'],\n 'data'\n >;\n /** Props that will only apply when a `<ModelViewer />` is rendered */\n modelViewer: Omit<typeof ModelViewer, 'data'>;\n };\n}\n\n/**\n * The `MediaFile` component renders the media for the Storefront API's\n * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a\n * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.\n */\nexport function MediaFile({\n data,\n mediaOptions,\n ...passthroughProps\n}: MediaFileProps) {\n switch (data.__typename) {\n case 'MediaImage': {\n if (!data.image) {\n const noDataImage = `<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noDataImage);\n } else {\n console.warn(noDataImage);\n return null;\n }\n }\n\n return (\n <Image\n {...passthroughProps}\n {...mediaOptions?.image}\n data={data.image}\n />\n );\n }\n case 'Video': {\n return (\n <Video {...passthroughProps} {...mediaOptions?.video} data={data} />\n );\n }\n case 'ExternalVideo': {\n return (\n <ExternalVideo\n {...passthroughProps}\n {...mediaOptions?.externalVideo}\n data={data}\n />\n );\n }\n case 'Model3d': {\n return (\n <ModelViewer\n {...passthroughProps}\n {...mediaOptions?.modelViewer}\n data={data}\n />\n );\n }\n default: {\n const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to correctly render the correct component for this media. Rendering 'null' by default`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typenameMissingMessage);\n } else {\n console.error(typenameMissingMessage);\n return null;\n }\n }\n }\n}\n"],"names":["MediaFile","data","mediaOptions","passthroughProps","__typename","image","noDataImage","console","warn","video","externalVideo","modelViewer","typenameMissingMessage","error"],"mappings":";;;;;AA+BO,SAASA,UAAU;AAAA,EACxBC;AAAAA,EACAC;AAAAA,KACGC;AAHqB,GAIP;AACjB,UAAQF,KAAKG,YAAb;AAAA,IACE,KAAK,cAAc;AACb,UAAA,CAACH,KAAKI,OAAO;AACf,cAAMC,cAAe;AAGd;AACLC,kBAAQC,KAAKF,WAAb;AACO,iBAAA;AAAA,QACR;AAAA,MACF;AAED,iCACG,OAAD;AAAA,QAAA,GACMH;AAAAA,QADN,GAEMD,6CAAcG;AAAAA,QAClB,MAAMJ,KAAKI;AAAAA,MAAAA,CAJf;AAAA,IAOD;AAAA,IACD,KAAK,SAAS;AACZ,iCACG,OAAD;AAAA,QAAA,GAAWF;AAAAA,QAAX,GAAiCD,6CAAcO;AAAAA,QAAO;AAAA,MAAA,CADxD;AAAA,IAGD;AAAA,IACD,KAAK,iBAAiB;AACpB,iCACG,eAAD;AAAA,QAAA,GACMN;AAAAA,QADN,GAEMD,6CAAcQ;AAAAA,QAClB;AAAA,MAAA,CAJJ;AAAA,IAOD;AAAA,IACD,KAAK,WAAW;AACd,iCACG,aAAD;AAAA,QAAA,GACMP;AAAAA,QADN,GAEMD,6CAAcS;AAAAA,QAClB;AAAA,MAAA,CAJJ;AAAA,IAOD;AAAA,IACD,SAAS;AACP,YAAMC,yBAA0B;AAGzB;AACLL,gBAAQM,MAAMD,sBAAd;AACO,eAAA;AAAA,MACR;AAAA,IACF;AAAA,EAnDH;AAqDD;"}
@@ -1,9 +1,11 @@
1
- import { useMemo } from "react";
2
- import { useShop } from "./ShopifyProvider.js";
3
- import { Image } from "./Image.js";
4
- import { Video } from "./Video.js";
5
- import { flattenConnection } from "./flatten-connection.js";
6
- import { jsx } from "react/jsx-runtime";
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const require$$0 = require("react");
4
+ const ShopifyProvider = require("./ShopifyProvider.js");
5
+ const Image = require("./Image.js");
6
+ const Video = require("./Video.js");
7
+ const flattenConnection = require("./flatten-connection.js");
8
+ const jsxRuntime = require("react/jsx-runtime");
7
9
  function Metafield(props) {
8
10
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
9
11
  const {
@@ -13,8 +15,8 @@ function Metafield(props) {
13
15
  } = props;
14
16
  const {
15
17
  locale
16
- } = useShop();
17
- const parsedMetafield = useMemo(() => parseMetafield(data), [data]);
18
+ } = ShopifyProvider.useShop();
19
+ const parsedMetafield = require$$0.useMemo(() => parseMetafield(data), [data]);
18
20
  if (!parsedMetafield) {
19
21
  const noDataPropWarning = `<Metafield/>: nothing was passed to the data prop 'data'. Rendering 'null'`;
20
22
  {
@@ -32,14 +34,14 @@ function Metafield(props) {
32
34
  switch (parsedMetafield.type) {
33
35
  case "date": {
34
36
  const Wrapper2 = as != null ? as : "time";
35
- return /* @__PURE__ */ jsx(Wrapper2, {
37
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, {
36
38
  ...passthroughProps,
37
39
  children: parsedMetafield.value.toLocaleDateString(locale)
38
40
  });
39
41
  }
40
42
  case "date_time": {
41
43
  const Wrapper2 = as != null ? as : "time";
42
- return /* @__PURE__ */ jsx(Wrapper2, {
44
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, {
43
45
  ...passthroughProps,
44
46
  children: parsedMetafield.value.toLocaleString(locale)
45
47
  });
@@ -48,21 +50,21 @@ function Metafield(props) {
48
50
  case "dimension":
49
51
  case "volume": {
50
52
  const Wrapper2 = as != null ? as : "span";
51
- return /* @__PURE__ */ jsx(Wrapper2, {
53
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, {
52
54
  ...passthroughProps,
53
55
  children: getMeasurementAsString(parsedMetafield.value, locale)
54
56
  });
55
57
  }
56
58
  case "rating": {
57
59
  const Wrapper2 = as != null ? as : "span";
58
- return /* @__PURE__ */ jsx(Wrapper2, {
60
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, {
59
61
  ...passthroughProps,
60
62
  children: parsedMetafield.value.value
61
63
  });
62
64
  }
63
65
  case "single_line_text_field": {
64
66
  const Wrapper2 = as != null ? as : "span";
65
- return /* @__PURE__ */ jsx(Wrapper2, {
67
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, {
66
68
  ...passthroughProps,
67
69
  dangerouslySetInnerHTML: {
68
70
  __html: parsedMetafield.value
@@ -71,7 +73,7 @@ function Metafield(props) {
71
73
  }
72
74
  case "multi_line_text_field": {
73
75
  const Wrapper2 = as != null ? as : "div";
74
- return /* @__PURE__ */ jsx(Wrapper2, {
76
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, {
75
77
  ...passthroughProps,
76
78
  dangerouslySetInnerHTML: {
77
79
  __html: parsedMetafield.value.split("\n").join("<br/>")
@@ -80,7 +82,7 @@ function Metafield(props) {
80
82
  }
81
83
  case "url": {
82
84
  const protocolLessUrl = new URL(parsedMetafield.value);
83
- return /* @__PURE__ */ jsx("a", {
85
+ return /* @__PURE__ */ jsxRuntime.jsx("a", {
84
86
  href: protocolLessUrl.href.replace(protocolLessUrl.protocol, ""),
85
87
  ...passthroughProps,
86
88
  children: parsedMetafield.value
@@ -88,7 +90,7 @@ function Metafield(props) {
88
90
  }
89
91
  case "json": {
90
92
  const Wrapper2 = as != null ? as : "span";
91
- return /* @__PURE__ */ jsx(Wrapper2, {
93
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, {
92
94
  ...passthroughProps,
93
95
  children: JSON.stringify(parsedMetafield.value)
94
96
  });
@@ -98,17 +100,17 @@ function Metafield(props) {
98
100
  case "page_reference": {
99
101
  const Wrapper2 = as != null ? as : "span";
100
102
  const ref = parsedMetafield.reference;
101
- return /* @__PURE__ */ jsx(Wrapper2, {
103
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, {
102
104
  ...passthroughProps,
103
105
  children: (_c = (_b = ref == null ? void 0 : ref.title) != null ? _b : ref == null ? void 0 : ref.id) != null ? _c : ""
104
106
  });
105
107
  }
106
108
  case "list.single_line_text_field": {
107
109
  const Wrapper2 = as != null ? as : "ul";
108
- const refArray = parsedMetafield.references ? flattenConnection(parsedMetafield.references) : [];
109
- return /* @__PURE__ */ jsx(Wrapper2, {
110
+ const refArray = parsedMetafield.references ? flattenConnection.flattenConnection(parsedMetafield.references) : [];
111
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper2, {
110
112
  ...passthroughProps,
111
- children: refArray.map((ref, index) => /* @__PURE__ */ jsx("li", {
113
+ children: refArray.map((ref, index) => /* @__PURE__ */ jsxRuntime.jsx("li", {
112
114
  children: ref
113
115
  }, `${ref != null ? ref : ""}-${index}`))
114
116
  });
@@ -116,22 +118,22 @@ function Metafield(props) {
116
118
  case "file_reference": {
117
119
  if (((_d = parsedMetafield.reference) == null ? void 0 : _d.__typename) === "MediaImage") {
118
120
  const ref = parsedMetafield.reference;
119
- return ref.image ? /* @__PURE__ */ jsx(Image, {
121
+ return ref.image ? /* @__PURE__ */ jsxRuntime.jsx(Image.Image, {
120
122
  data: ref.image,
121
123
  ...passthroughProps
122
124
  }) : null;
123
125
  } else if (((_e = parsedMetafield.reference) == null ? void 0 : _e.__typename) === "GenericFile") {
124
126
  const ref = parsedMetafield.reference;
125
- return ref.previewImage ? /* @__PURE__ */ jsx("a", {
127
+ return ref.previewImage ? /* @__PURE__ */ jsxRuntime.jsx("a", {
126
128
  href: (_g = (_f = parsedMetafield.reference) == null ? void 0 : _f.url) != null ? _g : "",
127
129
  ...passthroughProps,
128
- children: /* @__PURE__ */ jsx(Image, {
130
+ children: /* @__PURE__ */ jsxRuntime.jsx(Image.Image, {
129
131
  data: ref.previewImage
130
132
  })
131
133
  }) : null;
132
134
  } else if (((_h = parsedMetafield.reference) == null ? void 0 : _h.__typename) === "Video") {
133
135
  const ref = parsedMetafield.reference;
134
- return /* @__PURE__ */ jsx(Video, {
136
+ return /* @__PURE__ */ jsxRuntime.jsx(Video.Video, {
135
137
  ...passthroughProps,
136
138
  data: ref
137
139
  });
@@ -139,7 +141,7 @@ function Metafield(props) {
139
141
  }
140
142
  }
141
143
  const Wrapper = as != null ? as : "span";
142
- return /* @__PURE__ */ jsx(Wrapper, {
144
+ return /* @__PURE__ */ jsxRuntime.jsx(Wrapper, {
143
145
  ...passthroughProps,
144
146
  children: (_i = parsedMetafield.value) == null ? void 0 : _i.toString()
145
147
  });
@@ -278,11 +280,9 @@ function convertToSupportedUnit(value, unit) {
278
280
  throw new Error(`Unit not supported: ${unit}`);
279
281
  }
280
282
  }
281
- export {
282
- Metafield,
283
- getMeasurementAsString,
284
- parseJSON,
285
- parseMetafield,
286
- parseMetafieldValue
287
- };
283
+ exports.Metafield = Metafield;
284
+ exports.getMeasurementAsString = getMeasurementAsString;
285
+ exports.parseJSON = parseJSON;
286
+ exports.parseMetafield = parseMetafield;
287
+ exports.parseMetafieldValue = parseMetafieldValue;
288
288
  //# sourceMappingURL=Metafield.js.map