@shopify/hydrogen 0.11.1 → 0.13.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 (318) hide show
  1. package/CHANGELOG.md +500 -3
  2. package/dist/esnext/client.d.ts +2 -0
  3. package/dist/esnext/client.js +2 -0
  4. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +3 -4
  5. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +9 -22
  6. package/dist/esnext/components/AddToCartButton/index.d.ts +1 -1
  7. package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +4 -5
  8. package/dist/esnext/components/BuyNowButton/index.d.ts +1 -1
  9. package/dist/esnext/components/BuyNowButton/index.js +1 -1
  10. package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +2 -3
  11. package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +3 -3
  12. package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +5 -3
  13. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +5 -5
  14. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +1 -1
  15. package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +1 -3
  16. package/dist/esnext/components/CartLineProvider/context.d.ts +10 -16
  17. package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.d.ts +1 -3
  18. package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +1 -1
  19. package/dist/esnext/components/CartProvider/CartProvider.client.js +8 -2
  20. package/dist/esnext/components/CartProvider/cart-queries.d.ts +9 -0
  21. package/dist/esnext/components/CartProvider/cart-queries.js +876 -0
  22. package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +72 -5
  23. package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +72 -5
  24. package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +72 -5
  25. package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +73 -6
  26. package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +13 -11
  27. package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +72 -5
  28. package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +72 -5
  29. package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +72 -5
  30. package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +73 -6
  31. package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +72 -5
  32. package/dist/esnext/components/CartProvider/hooks.d.ts +1 -1
  33. package/dist/esnext/components/CartProvider/hooks.js +4 -1
  34. package/dist/esnext/components/CartProvider/types.d.ts +1 -1
  35. package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +3 -2
  36. package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +8 -13
  37. package/dist/esnext/components/ExternalVideo/ExternalVideo.js +7 -7
  38. package/dist/esnext/components/ExternalVideo/index.d.ts +1 -1
  39. package/dist/esnext/components/ExternalVideo/index.js +1 -1
  40. package/dist/esnext/components/Image/Image.d.ts +14 -16
  41. package/dist/esnext/components/Image/Image.js +17 -17
  42. package/dist/esnext/components/Image/index.d.ts +1 -1
  43. package/dist/esnext/components/Image/index.js +1 -1
  44. package/dist/esnext/components/Link/Link.client.d.ts +4 -5
  45. package/dist/esnext/components/Link/Link.client.js +5 -4
  46. package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -3
  47. package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +0 -1
  48. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +4 -5
  49. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +15 -4
  50. package/dist/esnext/components/LocalizationProvider/LocalizationQuery.d.ts +5 -8
  51. package/dist/esnext/components/LocalizationProvider/index.d.ts +0 -1
  52. package/dist/esnext/components/LocalizationProvider/index.js +0 -1
  53. package/dist/esnext/components/MediaFile/MediaFile.d.ts +10 -21
  54. package/dist/esnext/components/MediaFile/MediaFile.js +7 -5
  55. package/dist/esnext/components/MediaFile/index.d.ts +1 -1
  56. package/dist/esnext/components/MediaFile/index.js +1 -1
  57. package/dist/esnext/components/Metafield/Metafield.client.d.ts +2 -6
  58. package/dist/esnext/components/Metafield/Metafield.client.js +8 -8
  59. package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +1 -3
  60. package/dist/esnext/components/Metafield/index.d.ts +1 -2
  61. package/dist/esnext/components/Metafield/index.js +1 -1
  62. package/dist/esnext/components/Metafield/types.d.ts +1 -1
  63. package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +58 -66
  64. package/dist/esnext/components/ModelViewer/ModelViewer.client.js +10 -7
  65. package/dist/esnext/components/ModelViewer/index.d.ts +1 -1
  66. package/dist/esnext/components/Money/Money.client.d.ts +8 -12
  67. package/dist/esnext/components/Money/Money.client.js +1 -4
  68. package/dist/esnext/components/Money/index.d.ts +1 -1
  69. package/dist/esnext/components/Money/index.js +1 -1
  70. package/dist/esnext/components/ProductDescription/ProductDescription.client.d.ts +7 -2
  71. package/dist/esnext/components/ProductDescription/ProductDescription.client.js +4 -3
  72. package/dist/esnext/components/ProductMetafield/ProductMetafield.client.js +3 -3
  73. package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -5
  74. package/dist/esnext/components/ProductPrice/ProductPrice.client.js +2 -2
  75. package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +8 -8
  76. package/dist/esnext/components/ProductProvider/ProductProvider.client.js +2 -4
  77. package/dist/esnext/components/ProductProvider/context.d.ts +23 -14
  78. package/dist/esnext/components/ProductProvider/index.d.ts +1 -1
  79. package/dist/esnext/components/ProductProvider/index.js +1 -1
  80. package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +3 -2
  81. package/dist/esnext/components/Seo/CollectionSeo.client.js +3 -3
  82. package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +3 -2
  83. package/dist/esnext/components/Seo/DefaultPageSeo.client.js +2 -2
  84. package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +3 -3
  85. package/dist/esnext/components/Seo/DescriptionSeo.client.js +1 -1
  86. package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
  87. package/dist/esnext/components/Seo/ImageSeo.client.d.ts +3 -2
  88. package/dist/esnext/components/Seo/PageSeo.client.d.ts +3 -2
  89. package/dist/esnext/components/Seo/PageSeo.client.js +2 -2
  90. package/dist/esnext/components/Seo/ProductSeo.client.d.ts +5 -2
  91. package/dist/esnext/components/Seo/ProductSeo.client.js +10 -5
  92. package/dist/esnext/components/Seo/Seo.client.d.ts +11 -7
  93. package/dist/esnext/components/Seo/Seo.client.js +8 -14
  94. package/dist/esnext/components/Seo/TitleSeo.client.d.ts +3 -4
  95. package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +1 -1
  96. package/dist/esnext/components/Seo/seo-types.d.ts +17 -0
  97. package/dist/esnext/components/{ExternalVideo/ExternalVideoFragment.js → Seo/seo-types.js} +0 -0
  98. package/dist/esnext/components/ShopPayButton/ShopPayButton.client.d.ts +2 -1
  99. package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +1 -9
  100. package/dist/esnext/components/ShopPayButton/index.d.ts +1 -1
  101. package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +8 -13
  102. package/dist/esnext/components/UnitPrice/UnitPrice.client.js +9 -4
  103. package/dist/esnext/components/UnitPrice/index.d.ts +1 -1
  104. package/dist/esnext/components/UnitPrice/index.js +1 -1
  105. package/dist/esnext/components/Video/Video.d.ts +8 -16
  106. package/dist/esnext/components/Video/Video.js +11 -6
  107. package/dist/esnext/components/Video/index.d.ts +1 -2
  108. package/dist/esnext/components/Video/index.js +1 -1
  109. package/dist/esnext/components/index.d.ts +3 -16
  110. package/dist/esnext/components/index.js +2 -5
  111. package/dist/esnext/entry-client.js +27 -8
  112. package/dist/esnext/entry-server.d.ts +2 -1
  113. package/dist/esnext/entry-server.js +127 -160
  114. package/dist/esnext/foundation/Boomerang/Boomerang.client.d.ts +3 -1
  115. package/dist/esnext/foundation/Boomerang/Boomerang.client.js +17 -3
  116. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +22 -0
  117. package/dist/esnext/foundation/{Router/DefaultRoutes.js → FileRoutes/FileRoutes.server.js} +24 -23
  118. package/dist/esnext/foundation/Redirect/Redirect.client.d.ts +5 -0
  119. package/dist/esnext/foundation/Redirect/Redirect.client.js +14 -0
  120. package/dist/esnext/foundation/Route/Route.server.d.ts +12 -0
  121. package/dist/esnext/foundation/Route/Route.server.js +33 -0
  122. package/dist/esnext/foundation/Router/{Router.client.d.ts → BrowserRouter.client.d.ts} +3 -2
  123. package/dist/esnext/foundation/Router/{Router.client.js → BrowserRouter.client.js} +11 -7
  124. package/dist/esnext/foundation/Router/Router.server.d.ts +10 -0
  125. package/dist/esnext/foundation/Router/Router.server.js +8 -0
  126. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +19 -24
  127. package/dist/esnext/foundation/ServerStateProvider/{ServerStateProvider.client.d.ts → ServerStateProvider.d.ts} +0 -0
  128. package/dist/esnext/foundation/ServerStateProvider/{ServerStateProvider.client.js → ServerStateProvider.js} +0 -0
  129. package/dist/esnext/foundation/ServerStateProvider/index.d.ts +2 -2
  130. package/dist/esnext/foundation/ServerStateProvider/index.js +1 -1
  131. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.js +3 -0
  132. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +3 -0
  133. package/dist/esnext/foundation/ShopifyProvider/index.d.ts +0 -1
  134. package/dist/esnext/foundation/ShopifyProvider/index.js +0 -1
  135. package/dist/esnext/foundation/index.d.ts +0 -2
  136. package/dist/esnext/foundation/index.js +0 -2
  137. package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.d.ts +6 -3
  138. package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.js +4 -1
  139. package/dist/esnext/foundation/useQuery/hooks.d.ts +5 -4
  140. package/dist/esnext/foundation/useQuery/hooks.js +13 -4
  141. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +9 -0
  142. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +7 -0
  143. package/dist/esnext/foundation/useRouteParams/useRouteParams.d.ts +4 -0
  144. package/dist/esnext/foundation/useRouteParams/useRouteParams.js +9 -0
  145. package/dist/esnext/foundation/useUrl/useUrl.js +1 -1
  146. package/dist/esnext/framework/Hydration/Html.d.ts +2 -0
  147. package/dist/esnext/framework/Hydration/Html.js +71 -2
  148. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
  149. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +28 -7
  150. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
  151. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +5 -0
  152. package/dist/esnext/framework/Hydration/rsc.js +1 -1
  153. package/dist/esnext/framework/cache/in-memory.d.ts +1 -0
  154. package/dist/esnext/framework/cache/in-memory.js +15 -5
  155. package/dist/esnext/framework/middleware.js +25 -3
  156. package/dist/esnext/framework/plugin.js +6 -1
  157. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
  158. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +28 -0
  159. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +61 -77
  160. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +1 -1
  161. package/dist/esnext/hooks/index.d.ts +0 -1
  162. package/dist/esnext/hooks/index.js +0 -1
  163. package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +10 -18
  164. package/dist/esnext/hooks/useCountry/useCountry.d.ts +4 -4
  165. package/dist/esnext/hooks/useMoney/hooks.d.ts +3 -3
  166. package/dist/esnext/hooks/useMoney/hooks.js +2 -2
  167. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +17 -2
  168. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.js +7 -3
  169. package/dist/esnext/hooks/useProduct/useProduct.d.ts +36 -138
  170. package/dist/esnext/hooks/useProductOptions/helpers.d.ts +6 -4
  171. package/dist/esnext/hooks/useProductOptions/helpers.js +13 -6
  172. package/dist/esnext/hooks/useProductOptions/types.d.ts +15 -35
  173. package/dist/esnext/hooks/useProductOptions/useProductOptions.d.ts +6 -5
  174. package/dist/esnext/hooks/useProductOptions/useProductOptions.js +13 -3
  175. package/dist/esnext/hooks/useShopQuery/hooks.js +79 -21
  176. package/dist/esnext/index.d.ts +8 -2
  177. package/dist/esnext/index.js +8 -2
  178. package/dist/esnext/platforms/node.d.ts +2 -3
  179. package/dist/esnext/platforms/node.js +5 -3
  180. package/dist/esnext/platforms/worker-event.d.ts +0 -8
  181. package/dist/esnext/platforms/worker-event.js +2 -23
  182. package/dist/esnext/platforms/worker.d.ts +14 -0
  183. package/dist/esnext/platforms/worker.js +25 -0
  184. package/dist/esnext/{graphql/types/types.d.ts → storefront-api-types.d.ts} +2016 -1593
  185. package/dist/esnext/{graphql/types/types.js → storefront-api-types.js} +1025 -732
  186. package/dist/esnext/streaming.server.d.ts +9 -6
  187. package/dist/esnext/streaming.server.js +2 -27
  188. package/dist/esnext/types.d.ts +3 -18
  189. package/dist/esnext/utilities/apiRoutes.d.ts +19 -3
  190. package/dist/esnext/utilities/apiRoutes.js +27 -5
  191. package/dist/esnext/utilities/devtools.d.ts +11 -0
  192. package/dist/esnext/utilities/devtools.js +11 -0
  193. package/dist/esnext/utilities/fetch.d.ts +7 -1
  194. package/dist/esnext/utilities/fetch.js +9 -18
  195. package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +3 -2
  196. package/dist/esnext/utilities/flattenConnection/flattenConnection.js +6 -2
  197. package/dist/esnext/utilities/graphql-tracker.d.ts +17 -0
  198. package/dist/esnext/utilities/graphql-tracker.js +119 -0
  199. package/dist/esnext/utilities/image_size.d.ts +5 -4
  200. package/dist/esnext/utilities/log/log-query-timeline.d.ts +1 -1
  201. package/dist/esnext/utilities/log/log-query-timeline.js +1 -2
  202. package/dist/esnext/utilities/log/log.d.ts +1 -0
  203. package/dist/esnext/utilities/log/utils.js +3 -0
  204. package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.d.ts +3 -2
  205. package/dist/esnext/utilities/video_parameters.js +0 -4
  206. package/dist/esnext/version.d.ts +1 -1
  207. package/dist/esnext/version.js +1 -1
  208. package/dist/node/entry-server.d.ts +2 -1
  209. package/dist/node/entry-server.js +129 -158
  210. package/dist/node/foundation/Redirect/Redirect.client.d.ts +5 -0
  211. package/dist/node/foundation/Redirect/Redirect.client.js +17 -0
  212. package/dist/node/foundation/Router/BrowserRouter.client.d.ts +13 -0
  213. package/dist/node/foundation/Router/BrowserRouter.client.js +77 -0
  214. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +24 -25
  215. package/dist/node/foundation/ServerRequestProvider/index.js +5 -1
  216. package/dist/node/foundation/ServerStateProvider/{ServerStateProvider.client.d.ts → ServerStateProvider.d.ts} +0 -0
  217. package/dist/node/foundation/ServerStateProvider/{ServerStateProvider.client.js → ServerStateProvider.js} +5 -1
  218. package/dist/node/foundation/ServerStateProvider/index.d.ts +2 -2
  219. package/dist/node/foundation/ServerStateProvider/index.js +3 -3
  220. package/dist/node/foundation/ssr-interop.d.ts +29 -0
  221. package/dist/node/foundation/ssr-interop.js +39 -0
  222. package/dist/node/foundation/useNavigate/useNavigate.d.ts +13 -0
  223. package/dist/node/foundation/useNavigate/useNavigate.js +18 -0
  224. package/dist/node/foundation/useServerState/index.d.ts +1 -0
  225. package/dist/node/foundation/useServerState/index.js +5 -0
  226. package/dist/node/foundation/useServerState/use-server-state.d.ts +16 -0
  227. package/dist/node/foundation/useServerState/use-server-state.js +24 -0
  228. package/dist/node/framework/Hydration/Html.d.ts +2 -0
  229. package/dist/node/framework/Hydration/Html.js +73 -3
  230. package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
  231. package/dist/node/framework/Hydration/ServerComponentRequest.server.js +28 -7
  232. package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
  233. package/dist/node/framework/Hydration/ServerComponentResponse.server.js +8 -0
  234. package/dist/node/framework/Hydration/rsc.js +1 -1
  235. package/dist/node/framework/cache/in-memory.d.ts +1 -0
  236. package/dist/node/framework/cache/in-memory.js +15 -5
  237. package/dist/node/framework/middleware.js +30 -4
  238. package/dist/node/framework/plugin.js +11 -2
  239. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
  240. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +31 -0
  241. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +61 -77
  242. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +1 -1
  243. package/dist/node/{graphql/types/types.d.ts → storefront-api-types.d.ts} +2016 -1593
  244. package/dist/node/{graphql/types/types.js → storefront-api-types.js} +1026 -733
  245. package/dist/node/streaming.server.d.ts +9 -6
  246. package/dist/node/streaming.server.js +3 -29
  247. package/dist/node/types.d.ts +3 -18
  248. package/dist/node/utilities/apiRoutes.d.ts +19 -3
  249. package/dist/node/utilities/apiRoutes.js +29 -7
  250. package/dist/node/utilities/fetch.d.ts +10 -0
  251. package/dist/node/utilities/fetch.js +39 -0
  252. package/dist/node/utilities/log/log-query-timeline.d.ts +1 -1
  253. package/dist/node/utilities/log/log-query-timeline.js +1 -2
  254. package/dist/node/utilities/log/log.d.ts +1 -0
  255. package/dist/node/utilities/log/utils.js +3 -0
  256. package/dist/node/utilities/web-api-polyfill.js +5 -1
  257. package/dist/node/version.d.ts +1 -0
  258. package/dist/node/version.js +4 -0
  259. package/package.json +21 -21
  260. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +43 -104
  261. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +1566 -848
  262. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +36 -421
  263. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +1523 -864
  264. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +35 -437
  265. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +507 -517
  266. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +10 -246
  267. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +18 -25
  268. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +47 -108
  269. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +1033 -306
  270. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +965 -293
  271. package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +98 -108
  272. package/vendor/react-server-dom-vite/package.json +0 -2
  273. package/dist/esnext/components/ExternalVideo/ExternalVideoFragment.d.ts +0 -4
  274. package/dist/esnext/components/Image/ImageFragment.d.ts +0 -4
  275. package/dist/esnext/components/Image/ImageFragment.js +0 -1
  276. package/dist/esnext/components/MediaFile/MediaFileFragment.d.ts +0 -22
  277. package/dist/esnext/components/MediaFile/MediaFileFragment.js +0 -1
  278. package/dist/esnext/components/Metafield/MetafieldFragment.d.ts +0 -19
  279. package/dist/esnext/components/Metafield/MetafieldFragment.js +0 -1
  280. package/dist/esnext/components/ModelViewer/Model3DFragment.d.ts +0 -11
  281. package/dist/esnext/components/ModelViewer/Model3DFragment.js +0 -1
  282. package/dist/esnext/components/Money/MoneyFragment.d.ts +0 -4
  283. package/dist/esnext/components/Money/MoneyFragment.js +0 -1
  284. package/dist/esnext/components/ProductProvider/ProductProviderFragment.d.ts +0 -80
  285. package/dist/esnext/components/ProductProvider/ProductProviderFragment.js +0 -1
  286. package/dist/esnext/components/ProductProvider/types.d.ts +0 -19
  287. package/dist/esnext/components/ProductProvider/types.js +0 -1
  288. package/dist/esnext/components/RawHtml/RawHtml.d.ts +0 -19
  289. package/dist/esnext/components/RawHtml/RawHtml.js +0 -21
  290. package/dist/esnext/components/RawHtml/index.d.ts +0 -1
  291. package/dist/esnext/components/RawHtml/index.js +0 -1
  292. package/dist/esnext/components/Router/index.d.ts +0 -1
  293. package/dist/esnext/components/Router/index.js +0 -1
  294. package/dist/esnext/components/Seo/types.d.ts +0 -67
  295. package/dist/esnext/components/Seo/types.js +0 -1
  296. package/dist/esnext/components/UnitPrice/UnitPriceFragment.d.ts +0 -12
  297. package/dist/esnext/components/UnitPrice/UnitPriceFragment.js +0 -1
  298. package/dist/esnext/components/Video/VideoFragment.d.ts +0 -11
  299. package/dist/esnext/components/Video/VideoFragment.js +0 -1
  300. package/dist/esnext/foundation/Boomerang/BoomerangPageTemplate.client.d.ts +0 -3
  301. package/dist/esnext/foundation/Boomerang/BoomerangPageTemplate.client.js +0 -14
  302. package/dist/esnext/foundation/Router/DefaultRoutes.d.ts +0 -22
  303. package/dist/esnext/foundation/Router/index.d.ts +0 -1
  304. package/dist/esnext/foundation/Router/index.js +0 -1
  305. package/dist/esnext/graphql/graphql-constants.d.ts +0 -1751
  306. package/dist/esnext/graphql/graphql-constants.js +0 -3364
  307. package/dist/esnext/hooks/useAvailableCountries/index.d.ts +0 -1
  308. package/dist/esnext/hooks/useAvailableCountries/index.js +0 -1
  309. package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.d.ts +0 -11
  310. package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.js +0 -17
  311. package/dist/esnext/hooks/useNavigate/index.d.ts +0 -1
  312. package/dist/esnext/hooks/useNavigate/index.js +0 -1
  313. package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.d.ts +0 -28
  314. package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.js +0 -1
  315. package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.d.ts +0 -20
  316. package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.js +0 -1
  317. package/dist/esnext/hooks/useProductOptions/VariantFragment.d.ts +0 -64
  318. package/dist/esnext/hooks/useProductOptions/VariantFragment.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,503 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1008](https://github.com/Shopify/hydrogen/pull/1008) [`ca1de82b`](https://github.com/Shopify/hydrogen/commit/ca1de82bc38c1c02caa451fb52065da499555e6f) Thanks [@frandiox](https://github.com/frandiox)! - Allow passing `cache` parameter to `createServer` in Node entry.
8
+
9
+ * [#997](https://github.com/Shopify/hydrogen/pull/997) [`fffdc08f`](https://github.com/Shopify/hydrogen/commit/fffdc08f87f71592352a2eb67a63e80704054db2) Thanks [@frandiox](https://github.com/frandiox)! - Allow empty array values in flattenConnection utility.
10
+
11
+ - [#1007](https://github.com/Shopify/hydrogen/pull/1007) [`7cfca7b0`](https://github.com/Shopify/hydrogen/commit/7cfca7b09289e028a463ababb51e69b4e3943d94) Thanks [@scottdixon](https://github.com/scottdixon)! - Fix API index routes https://github.com/Shopify/hydrogen/issues/562
12
+
13
+ * [#1000](https://github.com/Shopify/hydrogen/pull/1000) [`6d0d5068`](https://github.com/Shopify/hydrogen/commit/6d0d50686029c3d66d9dc0ceb0b5f71456c7b19e) Thanks [@frandiox](https://github.com/frandiox)! - Do not cache Storefront API responses that contain GraphQL errors.
14
+
15
+ - [#1003](https://github.com/Shopify/hydrogen/pull/1003) [`d8a9c929`](https://github.com/Shopify/hydrogen/commit/d8a9c9290aaf7c9d058b2c08567294822bea5396) Thanks [@jplhomer](https://github.com/jplhomer)! - Update useShopQuery to accept a custom Storefront API secret token, and forward the Buyer IP.
16
+
17
+ ## 0.13.0
18
+
19
+ ### Minor Changes
20
+
21
+ - [#922](https://github.com/Shopify/hydrogen/pull/922) [`b5eaddc1`](https://github.com/Shopify/hydrogen/commit/b5eaddc113106ae946fd4b5273ff1485c74a2741) Thanks [@frehner](https://github.com/frehner)! - Fragments and their related types have been removed:
22
+
23
+ - ExternalVideoFragment and ExternalVideoFragmentFragment
24
+ - Model3DFragment and Model3DFragmentFragment
25
+ - ImageFragment and ImageFragmentFragment
26
+ - MoneyFragment and MoneyFragmentFragment
27
+ - UnitPriceFragment and UnitPriceFragmentFragment
28
+ - VideoFragment and VideoFragmentFragment
29
+ - MetafieldFragment and MetafieldFragmentFragment
30
+ - Seo fragments and types:
31
+ - DefaultPageSeoFragment and DefaultPageSeoFragmentFragment
32
+ - HomeSeoFragment and HomeSeoFragmentFragment
33
+ - ProductSeoFragment and ProductSeoFragmentFragment
34
+ - CollectionSeoFragment and CollectionSeoFragmentFragment
35
+ - PageSeoFragment and PageSeoFragmentFragment
36
+ - MediaFile fragments and types:
37
+ - MediaFileFragment and MediaFileFragmentFragment
38
+ - MediaFileFragment_ExternalVideo_Fragment
39
+ - MediaFileFragment_MediaImage_Fragment
40
+ - MediaFileFragment_Model3d_Fragment
41
+ - MediaFileFragment_Video_Fragment
42
+ - ProductFragment and ProductFragmentFragment
43
+
44
+ These fragments have been removed to reduce the chances of over-fetching (in other words, querying for fields you don't use) in your GraphQL queries. Please refer to the [Storefront API documentation](https://shopify.dev/api/storefront) for information and guides.
45
+
46
+ * [#912](https://github.com/Shopify/hydrogen/pull/912) [`de0e0d6a`](https://github.com/Shopify/hydrogen/commit/de0e0d6a6652463243ee09013cd30830ce2a246a) Thanks [@blittle](https://github.com/blittle)! - Change the country selector to lazy load available countries. The motivation to do so is that a _lot_ of countries come with the Demo Store template. The problem is 1) the graphql query to fetch them all is relatively slow and 2) all of them get serialized to the browser in each RSC response.
47
+
48
+ This change removes `availableCountries` from the `LocalizationProvider`. As a result, the `useAvailableCountries` hook is also gone. Instead, the available countries are loaded on demand from an API route.
49
+
50
+ Migratation steps:
51
+
52
+ Create an API route to retrieve available countries:
53
+
54
+ ```jsx
55
+ export async function api(request, {queryShop}) {
56
+ const {
57
+ data: {
58
+ localization: {availableCountries},
59
+ },
60
+ } = await queryShop({
61
+ query: QUERY,
62
+ });
63
+
64
+ return availableCountries.sort((a, b) => a.name.localeCompare(b.name));
65
+ }
66
+
67
+ const QUERY = `
68
+ query Localization {
69
+ localization {
70
+ availableCountries {
71
+ isoCode
72
+ name
73
+ currency {
74
+ isoCode
75
+ }
76
+ }
77
+ }
78
+ }
79
+ `;
80
+ ```
81
+
82
+ Then within your client code, query the API route with a `useEffect` hook:
83
+
84
+ ```jsx
85
+ const [countries, setCountries] = useState([]);
86
+
87
+ useEffect(() => {
88
+ fetch('/api/countries')
89
+ .then((resp) => resp.json())
90
+ .then((c) => setCountries(c))
91
+ .catch((e) => setError(e))
92
+ .finally(() => setLoading(false));
93
+ }, []);
94
+ ```
95
+
96
+ See an example on how this could be done inside the Demo Store template [country selector](https://github.com/Shopify/hydrogen/blob/v1.x-2022-07/examples/template-hydrogen-default/src/components/CountrySelector.client.jsx)
97
+
98
+ - [#698](https://github.com/Shopify/hydrogen/pull/698) [`6f30b9a1`](https://github.com/Shopify/hydrogen/commit/6f30b9a1327f06d648a01dd94d539c7dcb3061e0) Thanks [@jplhomer](https://github.com/jplhomer)! - Basic end-to-end tests have been added to the default Hydrogen template. You can run tests in development:
99
+
100
+ ```bash
101
+ yarn test
102
+ ```
103
+
104
+ Or in continuous-integration (CI) environments:
105
+
106
+ ```bash
107
+ yarn test:ci
108
+ ```
109
+
110
+ * [#932](https://github.com/Shopify/hydrogen/pull/932) [`507c5cbf`](https://github.com/Shopify/hydrogen/commit/507c5cbf233a7f3ca05094e839656de227243299) Thanks [@jplhomer](https://github.com/jplhomer)! - Adds [CSS Modules](https://github.com/css-modules/css-modules) support. Hydrogen now includes a [Vite plugin](https://vitejs.dev/guide/features.html#css-modules) that collects styles for each CSS Module and exports them to a `StyleTag` component. To use CSS Modules in your Hydrogen app, you must render the style tag in the component along with your styles:
111
+
112
+ ```js
113
+ import * as styles from './styles.module.css';
114
+
115
+ export default MyComponent() {
116
+ return (
117
+ <div className={styles.wrapper}>
118
+ // A style is rendered inline
119
+ <styles.StyleTag />
120
+ <p>Hello</p>
121
+ </div>
122
+ );
123
+ }
124
+ ```
125
+
126
+ Explore an [example implementation of CSS Modules in GitHub](https://github.com/Shopify/hydrogen/tree/main/examples/css-modules).
127
+
128
+ - [#846](https://github.com/Shopify/hydrogen/pull/846) [`58c823b5`](https://github.com/Shopify/hydrogen/commit/58c823b5eb5c5c33caa25cae629409ce651b3991) Thanks [@blittle](https://github.com/blittle)! - ## New `<Route>` Component
129
+
130
+ The `<Route>` component is available for routes not defined by the file system. The `<Route>` component must be used within the `<Router>` component.
131
+
132
+ ```jsx
133
+ // app.server.jsx
134
+
135
+ function App({routes, ...serverProps}) {
136
+ return (
137
+ <Suspense fallback={<LoadingFallback />}>
138
+ <ShopifyProvider shopifyConfig={shopifyConfig}>
139
+ <CartProvider>
140
+ <DefaultSeo />
141
+ <Router serverProps={serverProps}>
142
+ <Route path="/custom" page={<CustomRoute />} />
143
+ </Router>
144
+ </CartProvider>
145
+ </ShopifyProvider>
146
+ </Suspense>
147
+ );
148
+ }
149
+
150
+ function CustomRoute() {
151
+ return <h1>Custom route</h1>;
152
+ }
153
+ ```
154
+
155
+ `<Route>` accepts two props:
156
+
157
+ | Property | Type | Required | Description |
158
+ | -------- | --------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------ |
159
+ | `path` | `string` | Yes | The URL path where the route exists. The path can contain variables. For example, `/products/:handle`. |
160
+ | `page` | `A rendered Server Component reference` | Yes | A reference to a React Server Component that's rendered when the route is active. |
161
+
162
+ ## Changes to `<Router>`
163
+
164
+ You can have multiple `<Route>` and `<FileRoutes>` components in your app. Hydrogen will only render one route for each request — whichever it finds first. This means the `<Router>` component no longer takes `fallback` as a prop. It also doesn't need `serverProps`. Instead, to render a 404 "Not Found" page, add `<Route path="*" page={<NotFound />} />` to your app. Make sure it's the last `<Route>` defined inside your app:
165
+
166
+ ```diff
167
+ function App({routes, ...serverProps}) {
168
+ return (
169
+ <ShopifyProvider shopifyConfig={shopifyConfig}>
170
+ <CartProvider>
171
+ <DefaultSeo />
172
+ - <Router
173
+ - fallback={<NotFound response={serverProps.response} />}
174
+ - serverProps={serverProps}
175
+ - >
176
+ + <Router>
177
+ <FileRoutes routes={routes} />
178
+ + <Route path="*" page={<NotFound />} />
179
+ </Router>
180
+ </CartProvider>
181
+ </ShopifyProvider>
182
+ );
183
+ }
184
+ ```
185
+
186
+ ## Changes to `<FileRoutes>`
187
+
188
+ The `<FileRoutes>` component now accepts two additional optional props:
189
+
190
+ | Property | Type | Required | Default Value | Description |
191
+ | ----------- | -------- | -------- | ------------- | ----------------------------------------------------------------------- |
192
+ | `basePath` | `string` | No | `"/"` | A path that's prepended to all file routes. |
193
+ | `dirPrefix` | `string` | No | `"./routes"` | The portion of the file route path that shouldn't be a part of the URL. |
194
+
195
+ You need to modify `dirPrefix` if you want to import routes from a location other than `src/routes`.
196
+
197
+ You can modify `basePath` if you want to prefix all file routes. For example, you can prefix all file routes with a locale:
198
+
199
+ ```jsx
200
+ <Router>
201
+ <FileRoutes basePath={`/${locale}`} routes={routes} />
202
+ <Route path="*" page={<NotFound />} />
203
+ </Router>
204
+ ```
205
+
206
+ ## New `useRouteParams()` hook
207
+
208
+ You can use the `useRouteParams()` hook to retrieve the parameters of an active route. The hook is available in both server and client components:
209
+
210
+ ```jsx
211
+ // products/[handle].server.jsx
212
+
213
+ import {useRouteParams} from '@shopify/hydrogen';
214
+
215
+ export default function Product() {
216
+ const {handle} = useRouteParams();
217
+ // ...
218
+ }
219
+ ```
220
+
221
+ ```jsx
222
+ // ProductDetails.client.jsx
223
+ import {useRouteParams} from '@shopify/hydrogen/client';
224
+
225
+ export default function ProductDetails() {
226
+ const {handle} = useRouteParams();
227
+ // ...
228
+ }
229
+ ```
230
+
231
+ * [#842](https://github.com/Shopify/hydrogen/pull/842) [`626e58ee`](https://github.com/Shopify/hydrogen/commit/626e58eebe3cf994423895bbdf7754c009d701fe) Thanks [@wizardlyhel](https://github.com/wizardlyhel)! - Removed the `Rawhtml` component.
232
+
233
+ Upgrade your project by replacing references to the `RawHtml` component to follow
234
+ [React's `dangerouslySetInnerHTML`](https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml):
235
+
236
+ Change all `RawHtml` component
237
+
238
+ ```jsx
239
+ <RawHtml string="<p>Hello world</p>" />
240
+ ```
241
+
242
+ to jsx equivalent
243
+
244
+ ```jsx
245
+ <div dangerouslySetInnerHTML={{__html: '<p>Hello world</p>'}} />
246
+ ```
247
+
248
+ ### Patch Changes
249
+
250
+ - [#870](https://github.com/Shopify/hydrogen/pull/870) [`4c0fcd8f`](https://github.com/Shopify/hydrogen/commit/4c0fcd8f55a7956ab4641f12a5d9ebcb2587264c) Thanks [@frandiox](https://github.com/frandiox)! - Remove useQuery hook from client exports to avoid leaking server logic to the browser.
251
+
252
+ * [#950](https://github.com/Shopify/hydrogen/pull/950) [`d19fc36b`](https://github.com/Shopify/hydrogen/commit/d19fc36ba548d64a3548df435358ae5bea7cdf8e) Thanks [@frandiox](https://github.com/frandiox)! - Allow disabling minification in vite.config.js
253
+
254
+ - [#981](https://github.com/Shopify/hydrogen/pull/981) [`8dda8a86`](https://github.com/Shopify/hydrogen/commit/8dda8a860bc1cf58511756b6fff999fb7caa6081) Thanks [@michenly](https://github.com/michenly)! - Fix useUrl() when it is in RSC mode
255
+
256
+ * [#965](https://github.com/Shopify/hydrogen/pull/965) [`cdad13ed`](https://github.com/Shopify/hydrogen/commit/cdad13ed85ff17b84981367f39c7d2fe45e72dcf) Thanks [@blittle](https://github.com/blittle)! - Fix server redirects to work properly with RSC responses. For example, the redirect component within the Demo Store template needs to change:
257
+
258
+ ```diff
259
+ export default function Redirect({response}) {
260
+ - response.redirect('/products/snowboard');
261
+ - return <div>This page is redirected</div>;
262
+ + return response.redirect('/products/snowboard');
263
+ }
264
+ ```
265
+
266
+ This server component is rendered two ways:
267
+
268
+ 1. When an app directly loads the redirect route, the server will render a 300 redirect with the proper location header.
269
+ 2. The app is already loaded, but the user navigates to the redirected route. We cannot 300 respond in this scenario, instead `response.redirect(...)` returns a component which will redirect on the client.
270
+
271
+ - [#904](https://github.com/Shopify/hydrogen/pull/904) [`1b46f8d0`](https://github.com/Shopify/hydrogen/commit/1b46f8d00ed5db9abaf0868574e252fa319a8ca9) Thanks [@wizardlyhel](https://github.com/wizardlyhel)! - Log query key when provided in string
272
+
273
+ * [#758](https://github.com/Shopify/hydrogen/pull/758) [`0bee3af0`](https://github.com/Shopify/hydrogen/commit/0bee3af0373acad85dba38a630d3a81e52d6c134) Thanks [@frandiox](https://github.com/frandiox)! - Upgrade to React experimental version `0.0.0-experimental-2bf7c02f0-20220314`.
274
+
275
+ To upgrade your Hydrogen app, change the pinned version of `react` and `react-dom` in your `package.json` file to this version, or run:
276
+
277
+ ```bash
278
+ yarn add @shopify/hydrogen react@0.0.0-experimental-2bf7c02f0-20220314 react-dom@0.0.0-experimental-2bf7c02f0-20220314
279
+ ```
280
+
281
+ - [#895](https://github.com/Shopify/hydrogen/pull/895) [`1017b541`](https://github.com/Shopify/hydrogen/commit/1017b541c275c030f97ee6dee1e310df1fe89fb5) Thanks [@frandiox](https://github.com/frandiox)! - Improve error thrown in development when entry point fails on load.
282
+
283
+ * [#897](https://github.com/Shopify/hydrogen/pull/897) [`c01044e6`](https://github.com/Shopify/hydrogen/commit/c01044e6b4ebe74f8e2e310e78dbaa8178536016) Thanks [@blittle](https://github.com/blittle)! - Add new custom headers for storefront API calls. See Issue [#660](https://github.com/Shopify/hydrogen/issues/660)
284
+
285
+ - [#908](https://github.com/Shopify/hydrogen/pull/908) [`8f4cd100`](https://github.com/Shopify/hydrogen/commit/8f4cd1005ce9d78a1426223b6d4ad44c3cae2ebc) Thanks [@mcvinci](https://github.com/mcvinci)! - Hydrogen docs: Updates to align with latest release
286
+
287
+ * [#871](https://github.com/Shopify/hydrogen/pull/871) [`4cb07c73`](https://github.com/Shopify/hydrogen/commit/4cb07c7357cf05cc63f9d3c2834ac3c43e8859b5) Thanks [@scottdixon](https://github.com/scottdixon)! - Hydrogen docs: Update ProductProvider example query
288
+
289
+ - [#878](https://github.com/Shopify/hydrogen/pull/878) [`587aa3e6`](https://github.com/Shopify/hydrogen/commit/587aa3e6b7bee39f8f8a88685ef95ec9bb7c057b) Thanks [@frandiox](https://github.com/frandiox)! - Fix preloading queries in workers to prevent waterfall requests.
290
+
291
+ **Breaking change**: `fetchBuilder` no longer accepts a `Request` argument. Instead, it now accepts a `url: string` and `options: FetchInit`:
292
+
293
+ ```diff
294
+ -fetchBuilder(new Request('https://my.endpoint.com', {headers: {foo: 'bar'}}));
295
+ +fetchBuilder('https://my.endpoint.com', {headers: {foo: 'bar}});
296
+ ```
297
+
298
+ * [#923](https://github.com/Shopify/hydrogen/pull/923) [`993be985`](https://github.com/Shopify/hydrogen/commit/993be9856f32f282f14e5c893abfa0a69c5636a4) Thanks [@frandiox](https://github.com/frandiox)! - Provide a Logger option to use GraphQL and disable by default. Improve logging of unused query properties.
299
+
300
+ - [#960](https://github.com/Shopify/hydrogen/pull/960) [`2e8a5ea2`](https://github.com/Shopify/hydrogen/commit/2e8a5ea24c4d506b14ad3b5b9ed81147a879fc2e) Thanks [@mcvinci](https://github.com/mcvinci)! - Hydrogen docs: Add reference to robots.txt.server.js file
301
+
302
+ ## 0.12.0
303
+
304
+ ### Minor Changes
305
+
306
+ - [`8271be8`](https://github.com/Shopify/hydrogen/commit/8271be83331c99f27a258e6532983da4fe4f0b5b) Thanks [@michenly](https://github.com/michenly)! - Export Seo components Fragement and use them in the Demo Store template.
307
+
308
+ * [#827](https://github.com/Shopify/hydrogen/pull/827) [`745e8c0`](https://github.com/Shopify/hydrogen/commit/745e8c0a87a7c41803934565e5a756295ff629c2) Thanks [@michenly](https://github.com/michenly)! - Move any static `Fragment` properties on components to the entry point `@shopify/hydrogen/fragments`.
309
+ The migration diff are as follows:
310
+
311
+ ```diff
312
+ - import {ExternalVideoFragment} from '@shopify/hydrogen';
313
+ + import {ExternalVideoFragment} from '@shopify/hydrogen/fragments';
314
+ - import type {ExternalVideoFragmentFragment} from '@shopify/hydrogen';
315
+ + import type {ExternalVideoFragmentFragment} from '@shopify/hydrogen/fragments';
316
+ ```
317
+
318
+ ```diff
319
+ - import {ImageFragment} from '@shopify/hydrogen';
320
+ + import {ImageFragment} from '@shopify/hydrogen/fragments';
321
+ - import type {ImageFragmentFragment} from '@shopify/hydrogen';
322
+ + import type {ImageFragmentFragment} from '@shopify/hydrogen/fragments';
323
+ ```
324
+
325
+ ```diff
326
+ - import {MediaFileFragment} from '@shopify/hydrogen';
327
+ + import {MediaFileFragment} from '@shopify/hydrogen/fragments';
328
+ - import type {MediaFileFragmentFragment} from '@shopify/hydrogen';
329
+ + import type {MediaFileFragmentFragment} from '@shopify/hydrogen/fragments';
330
+ ```
331
+
332
+ ```diff
333
+ - import {MetafieldFragment} from '@shopify/hydrogen';
334
+ + import {MetafieldFragment} from '@shopify/hydrogen/fragments';
335
+ - import type {MetafieldFragmentFragment} from '@shopify/hydrogen';
336
+ + import type {MetafieldFragmentFragment} from '@shopify/hydrogen/fragments';
337
+ ```
338
+
339
+ ```diff
340
+ - import {Model3DFragment} from '@shopify/hydrogen';
341
+ + import {Model3DFragment} from '@shopify/hydrogen/fragments';
342
+ - import type {Model3DFragmentFragment} from '@shopify/hydrogen';
343
+ + import type {Model3DFragmentFragment} from '@shopify/hydrogen/fragments';
344
+ ```
345
+
346
+ ```diff
347
+ - import {MoneyFragment} from '@shopify/hydrogen';
348
+ + import {MoneyFragment} from '@shopify/hydrogen/fragments';
349
+ - import type {MoneyFragmentFragment} from '@shopify/hydrogen';
350
+ + import type {MoneyFragmentFragment} from '@shopify/hydrogen/fragments';
351
+ ```
352
+
353
+ ```diff
354
+ - import {ProductProviderFragment} from '@shopify/hydrogen';
355
+ + import {ProductProviderFragment} from '@shopify/hydrogen/fragments';
356
+ - import type {ProductProviderFragmentFragment} from '@shopify/hydrogen';
357
+ + import type {ProductProviderFragmentFragment} from '@shopify/hydrogen/fragments';
358
+ ```
359
+
360
+ ```diff
361
+ - import {UnitPriceFragment} from '@shopify/hydrogen';
362
+ + import {UnitPriceFragment} from '@shopify/hydrogen/fragments';
363
+ - import type {UnitPriceFragmentFragment} from '@shopify/hydrogen';
364
+ + import type {UnitPriceFragmentFragment} from '@shopify/hydrogen/fragments';
365
+ ```
366
+
367
+ ```diff
368
+ - import {VideoFragment} from '@shopify/hydrogen';
369
+ + import {VideoFragment} from '@shopify/hydrogen/fragments';
370
+ - import type {VideoFragmentFragment} from '@shopify/hydrogen';
371
+ + import type {VideoFragmentFragment} from '@shopify/hydrogen/fragments';
372
+ ```
373
+
374
+ - [#455](https://github.com/Shopify/hydrogen/pull/455) [`81ac653`](https://github.com/Shopify/hydrogen/commit/81ac6534b8464e187b09ee13525319ed0c6c7c1d) Thanks [@johncraigcole](https://github.com/johncraigcole)! - Updated the ExternalVideo component to use the new `embedUrl` Storefront API ([introduced in 2022-04](https://shopify.dev/api/release-notes/2022-04#non-encoded-object-ids-in-the-graphql-storefront-api)) on ExternalVideo.
375
+
376
+ * [#809](https://github.com/Shopify/hydrogen/pull/809) [`47f23f9`](https://github.com/Shopify/hydrogen/commit/47f23f921873b782947aed2e54d997ad034801b8) Thanks [@frehner](https://github.com/frehner)! - Upgrade default Storefront API to version '2022-04'. Some components have been updated to use the 2022-04 features and types as well.
377
+
378
+ One important change is that the `2022-04` Storefront API no longer encodes object IDs: see more [details here](https://shopify.dev/api/release-notes/2022-04#non-encoded-object-ids-in-the-graphql-storefront-api). Because of this, Hydrogen will no longer decode IDs, either, which will cause issues if you are using a previous version of the Storefront API with Hydrogen components.
379
+
380
+ - [#780](https://github.com/Shopify/hydrogen/pull/780) [`122a5c5`](https://github.com/Shopify/hydrogen/commit/122a5c5e0b70fa2a11c2c708b303da987f25fc53) Thanks [@jplhomer](https://github.com/jplhomer)! - Adds `queryShop` helper to API routes. This makes it easy to query the Storefront API, similar to how `useShopQuery` is available in server components:
381
+
382
+ ```jsx
383
+ // my-api.server.js
384
+
385
+ export default function api(request, {queryShop}) {
386
+ return await queryShop({
387
+ query: `query ShopName { shop { name } }`,
388
+ });
389
+ }
390
+ ```
391
+
392
+ `queryShop` accepts a single argument object with the following properties:
393
+
394
+ | Property | Type | Required |
395
+ | ----------- | -------------------------------------- | -------- |
396
+ | `query` | `string \| ASTNode` | Yes |
397
+ | `variables` | `Record<string, any>` | No |
398
+ | `locale` | `string` (defaults to `defaultLocale`) | No |
399
+
400
+ **Important**: In order to use `queryShop`, you should pass `shopifyConfig` to `renderHydrogen` inside `App.server.jsx`:
401
+
402
+ ```diff
403
+ -export default renderHydrogen(App, {routes});
404
+ +export default renderHydrogen(App, {shopifyConfig, routes});
405
+ ```
406
+
407
+ * [#712](https://github.com/Shopify/hydrogen/pull/712) [`6368968`](https://github.com/Shopify/hydrogen/commit/6368968e4c68bb44b01b6b0b6903e403269dc233) Thanks [@blittle](https://github.com/blittle)! - Routing in Hydrogen has been updated according to [Custom Routes proposal](https://github.com/Shopify/hydrogen/discussions/569). Specifically, a new `Router` component has been added, and `DefaultRoutes` has been renamed to `FileRoutes`, along with other minor changes. Custom route components are not implemented yet.
408
+
409
+ Follow these steps to upgrade your `App.server.jsx` file:
410
+
411
+ 1. Rename the parameter `pages` to `routes` when calling `renderHydrogen`.
412
+ 2. Rename the `DefaultRoutes` component to `FileRoutes`.
413
+ 3. Add the new `Router` component as a parent of `FileRoutes` and pass `fallback` and `serverProps` props (previously in `DefaultRoutes`).
414
+ 4. Rename `src/pages` directory to `src/routes` and update the glob import in `App.server.jsx` to `import.meta.globEager('./routes/**/*.server.[jt](s|sx)')`.
415
+
416
+ #### Full example of `App.server.jsx`
417
+
418
+ ```jsx
419
+ import renderHydrogen from '@shopify/hydrogen/entry-server';
420
+ import {Router, FileRoutes, ShopifyProvider} from '@shopify/hydrogen';
421
+ import {Suspense} from 'react';
422
+ import shopifyConfig from '../shopify.config';
423
+ import DefaultSeo from './components/DefaultSeo.server';
424
+ import NotFound from './components/NotFound.server';
425
+ import LoadingFallback from './components/LoadingFallback';
426
+ import CartProvider from './components/CartProvider.client';
427
+
428
+ function App({routes, ...serverProps}) {
429
+ return (
430
+ <Suspense fallback={<LoadingFallback />}>
431
+ <ShopifyProvider shopifyConfig={shopifyConfig}>
432
+ <CartProvider>
433
+ <DefaultSeo />
434
+ <Router fallback={<NotFound />} serverProps={serverProps}>
435
+ <FileRoutes routes={routes} />
436
+ </Router>
437
+ </CartProvider>
438
+ </ShopifyProvider>
439
+ </Suspense>
440
+ );
441
+ }
442
+
443
+ const routes = import.meta.globEager('./routes/**/*.server.[jt](s|sx)');
444
+ export default renderHydrogen(App, {shopifyConfig, routes});
445
+ ```
446
+
447
+ ### Patch Changes
448
+
449
+ - [#799](https://github.com/Shopify/hydrogen/pull/799) [`350293a`](https://github.com/Shopify/hydrogen/commit/350293a9fa113fa9950aad27cf7ccaa6b535bedb) Thanks [@michenly](https://github.com/michenly)! - Update `linesAdd` to create cart if cart does not exist.
450
+
451
+ * [#788](https://github.com/Shopify/hydrogen/pull/788) [`9d4c43d`](https://github.com/Shopify/hydrogen/commit/9d4c43d6cc4f0b52affc33274c438a356c95ad37) Thanks [@mcvinci](https://github.com/mcvinci)! - Hydrogen docs: Static assets and component props
452
+
453
+ - [#813](https://github.com/Shopify/hydrogen/pull/813) [`b1b959c`](https://github.com/Shopify/hydrogen/commit/b1b959c45ae43d7078c655b4012b6d6cd2db6491) Thanks [@frandiox](https://github.com/frandiox)! - Do not scroll to top if the URL pathname has not changed.
454
+
455
+ * [#821](https://github.com/Shopify/hydrogen/pull/821) [`548979e`](https://github.com/Shopify/hydrogen/commit/548979ea7cbc38e52628d3359fd6c4edd19b41cc) Thanks [@jplhomer](https://github.com/jplhomer)! - Add null check for ShopifyProvider
456
+
457
+ - [#850](https://github.com/Shopify/hydrogen/pull/850) [`74b14e4`](https://github.com/Shopify/hydrogen/commit/74b14e4a66c72125bc1b372c57f305a86a2e1fe4) Thanks [@blittle](https://github.com/blittle)! - Ignore when boomerang doesn't load. This often happens when a adblocker is present on the client.
458
+ There is no longer an uncaught promise exception in the console.
459
+
460
+ * [#803](https://github.com/Shopify/hydrogen/pull/803) [`7528bf4`](https://github.com/Shopify/hydrogen/commit/7528bf4956970d76f37452bd33f9c9a692187c4f) Thanks [@frandiox](https://github.com/frandiox)! - Avoid accessing undefined global \_\_flight as a side effect of another unknown error.
461
+
462
+ - [#833](https://github.com/Shopify/hydrogen/pull/833) [`214927a`](https://github.com/Shopify/hydrogen/commit/214927a071b9350d1f70fa02c74227f1e5d77238) Thanks [@frandiox](https://github.com/frandiox)! - Disable worker streaming until it is properly supported.
463
+
464
+ * [#837](https://github.com/Shopify/hydrogen/pull/837) [`2e76d66`](https://github.com/Shopify/hydrogen/commit/2e76d66ac23d84c13cf9c60e0b7aacf9eddda9ce) Thanks [@jplhomer](https://github.com/jplhomer)! - Minify server build output
465
+
466
+ - [#819](https://github.com/Shopify/hydrogen/pull/819) [`09d9ad5`](https://github.com/Shopify/hydrogen/commit/09d9ad5d7b65942d9187c6b766bf4c60a6979453) Thanks [@jplhomer](https://github.com/jplhomer)! - Improve logging for useShopQuery errors
467
+
468
+ * [#825](https://github.com/Shopify/hydrogen/pull/825) [`1215fdb`](https://github.com/Shopify/hydrogen/commit/1215fdb02910190096c6920f533d06f00fc59a6c) Thanks [@michenly](https://github.com/michenly)! - `@shopify/hydrogen` will no longer export the following types
469
+
470
+ - MediaFileProps
471
+ - VideoProps
472
+ - ImageProps
473
+ - ExternalVideoProps
474
+ - RawHtmlProps
475
+ - AddToCartButtonProps
476
+ - ModelViewerProps
477
+ - MoneyProps
478
+ - BuyNowButtonProps
479
+ - BuyNowButtonPropsWeControl
480
+ - ShopPayButtonProps
481
+
482
+ Any Component props type should be typed instead with `React.ComponentProps<typeof MyComponent>`.
483
+
484
+ - [#792](https://github.com/Shopify/hydrogen/pull/792) [`8aad0b5`](https://github.com/Shopify/hydrogen/commit/8aad0b561ddbef55abc598c91c6e9bd642c46d9c) Thanks [@frandiox](https://github.com/frandiox)! - Attributes from `<html>` and `<body>` elements in `index.html` are now included in the SSR response.
485
+
486
+ * [#811](https://github.com/Shopify/hydrogen/pull/811) [`2226b6e`](https://github.com/Shopify/hydrogen/commit/2226b6eda30a29ad79fb89c600a210b615dc5406) Thanks [@frandiox](https://github.com/frandiox)! - Support non-PascalCase filenames for client components.
487
+
488
+ - [#786](https://github.com/Shopify/hydrogen/pull/786) [`d1ecaf7`](https://github.com/Shopify/hydrogen/commit/d1ecaf7efff4595da46b0ece08c3cd94c6cdd55f) Thanks [@frehner](https://github.com/frehner)! - Updated graphql-codegen, which updates the Typescript types available for each Storefront API object
489
+
490
+ * [#849](https://github.com/Shopify/hydrogen/pull/849) [`e64fa17`](https://github.com/Shopify/hydrogen/commit/e64fa17c61585a7dc967bef5a2216dde40b2fc42) Thanks [@blittle](https://github.com/blittle)! - Fix server the server to only log once for the full time it takes to stream render a page
491
+
492
+ - [#394](https://github.com/Shopify/hydrogen/pull/394) [`818312d`](https://github.com/Shopify/hydrogen/commit/818312d72618882056d0344f069568e71766d32d) Thanks [@sahilmob](https://github.com/sahilmob)! - Respond with 404 if the route has no matches.
493
+
494
+ * [#841](https://github.com/Shopify/hydrogen/pull/841) [`0aa74cf`](https://github.com/Shopify/hydrogen/commit/0aa74cf78dae555fc111c06df3d2b73b022af4f0) Thanks [@michenly](https://github.com/michenly)! - Update MediaFile's options prop type to included Image options.
495
+
496
+ - [#796](https://github.com/Shopify/hydrogen/pull/796) [`1dc62e2`](https://github.com/Shopify/hydrogen/commit/1dc62e2514b53411ae750d81c0a1b4f50eae9aff) Thanks [@mcvinci](https://github.com/mcvinci)! - Hydrogen docs: Strict mode
497
+
498
+ * [#813](https://github.com/Shopify/hydrogen/pull/813) [`b1b959c`](https://github.com/Shopify/hydrogen/commit/b1b959c45ae43d7078c655b4012b6d6cd2db6491) Thanks [@frandiox](https://github.com/frandiox)! - Remove Router client-only logic from server bundle and avoid extra waterfall requests during Hydration.
499
+ Extract part of the client bundle into separate modules that can be loaded in parallel.
500
+
3
501
  ## 0.11.1
4
502
 
5
503
  ### Patch Changes
@@ -8,7 +506,7 @@
8
506
 
9
507
  * [#761](https://github.com/Shopify/hydrogen/pull/761) [`1142647`](https://github.com/Shopify/hydrogen/commit/114264716bc8f3027e3e6395d523714adbc92014) Thanks [@frehner](https://github.com/frehner)! - Fix issue with components that take in the `as` prop not validating other props when a component is passed to `as`.
10
508
 
11
- - [#752](https://github.com/Shopify/hydrogen/pull/752) [`b96179f`](https://github.com/Shopify/hydrogen/commit/b96179fdf960da52332a981e29a742b677826834) Thanks [@jplhomer](https://github.com/jplhomer)! - Ensure ProductSeo knows how to handle `featuredImage = null`
509
+ - [#752](https://github.com/Shopify/hydrogen/pull/752) [`428aa7a`](https://github.com/Shopify/hydrogen/commit/428aa7adac179dd1efffc29bf382a7bb0a2c8971) Thanks [@michenly](https://github.com/michenly)! - Ensure ProductSeo knows how to handle `featuredImage = null`
12
510
 
13
511
  * [#774](https://github.com/Shopify/hydrogen/pull/774) [`052f148`](https://github.com/Shopify/hydrogen/commit/052f148e0d33029cdc2540afa5ead32825962f3a) Thanks [@frandiox](https://github.com/frandiox)! - Fix internal url usage in platforms like Vercel, which already provides protocol and host in `request.url`.
14
512
 
@@ -441,7 +939,7 @@ function SomeComponent() {
441
939
 
442
940
  ### Fixed
443
941
 
444
- - Starter template GalleryPreview unique key warning
942
+ - Demo Store template GalleryPreview unique key warning
445
943
  - Mitigation for upcoming breaking minor Vite update
446
944
 
447
945
  ## 0.2.0 - 2021-10-08
@@ -508,4 +1006,3 @@ function SomeComponent() {
508
1006
  [0.10.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.10.0
509
1007
  [0.10.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.10.1
510
1008
  [0.11.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.11.0
511
- [unreleased]: https://github.com/Shopify/hydrogen/compare/v0.11.0...HEAD
@@ -5,3 +5,5 @@ export * from './foundation/useShop';
5
5
  export * from './foundation/ServerStateProvider';
6
6
  export { Head } from './foundation/Head';
7
7
  export * from './utilities';
8
+ export { useRouteParams } from './foundation/useRouteParams/useRouteParams';
9
+ export { useNavigate } from './foundation/useNavigate/useNavigate';
@@ -5,3 +5,5 @@ export * from './foundation/useShop';
5
5
  export * from './foundation/ServerStateProvider';
6
6
  export { Head } from './foundation/Head';
7
7
  export * from './utilities';
8
+ export { useRouteParams } from './foundation/useRouteParams/useRouteParams';
9
+ export { useNavigate } from './foundation/useNavigate/useNavigate';
@@ -1,6 +1,5 @@
1
- import React, { ReactNode } from 'react';
2
- import { Props } from '../types';
3
- export interface AddToCartButtonProps {
1
+ import { ReactNode } from 'react';
2
+ interface AddToCartButtonProps {
4
3
  /** An array of cart line attributes that belong to the item being added to the cart. */
5
4
  attributes?: {
6
5
  key: string;
@@ -20,5 +19,5 @@ declare type PropsWeControl = 'onClick';
20
19
  * The `AddToCartButton` component renders a button that adds an item to the cart when pressed.
21
20
  * It must be a descendent of the `CartProvider` component.
22
21
  */
23
- export declare function AddToCartButton<TTag extends React.ElementType = 'button'>(props: Props<TTag, PropsWeControl> & AddToCartButtonProps): JSX.Element;
22
+ export declare function AddToCartButton(props: Omit<JSX.IntrinsicElements['button'], PropsWeControl> & AddToCartButtonProps): JSX.Element;
24
23
  export {};
@@ -8,8 +8,8 @@ import { useProduct } from '../ProductProvider';
8
8
  export function AddToCartButton(props) {
9
9
  var _a, _b;
10
10
  const [addingItem, setAddingItem] = useState(false);
11
- const { variantId: explicitVariantId, quantity = 1, attributes, children, onAdd, accessibleAddingToCartLabel, ...passthroughProps } = props;
12
- const { status, id, cartCreate, linesAdd } = useCart();
11
+ const { variantId: explicitVariantId, quantity = 1, attributes, children, accessibleAddingToCartLabel, ...passthroughProps } = props;
12
+ const { status, linesAdd } = useCart();
13
13
  const product = useProduct();
14
14
  const variantId = (_b = explicitVariantId !== null && explicitVariantId !== void 0 ? explicitVariantId : (_a = product === null || product === void 0 ? void 0 : product.selectedVariant) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '';
15
15
  const disabled = explicitVariantId === null ||
@@ -25,26 +25,13 @@ export function AddToCartButton(props) {
25
25
  return (React.createElement(React.Fragment, null,
26
26
  React.createElement("button", { ...passthroughProps, disabled: disabled, onClick: () => {
27
27
  setAddingItem(true);
28
- if (!id) {
29
- cartCreate({
30
- lines: [
31
- {
32
- quantity: quantity,
33
- merchandiseId: variantId,
34
- attributes: attributes,
35
- },
36
- ],
37
- });
38
- }
39
- else {
40
- linesAdd([
41
- {
42
- quantity: quantity,
43
- merchandiseId: variantId,
44
- attributes: attributes,
45
- },
46
- ]);
47
- }
28
+ linesAdd([
29
+ {
30
+ quantity: quantity,
31
+ merchandiseId: variantId,
32
+ attributes: attributes,
33
+ },
34
+ ]);
48
35
  } }, children),
49
36
  accessibleAddingToCartLabel ? (React.createElement("p", { style: {
50
37
  position: 'absolute',
@@ -1 +1 @@
1
- export { AddToCartButton, AddToCartButtonProps } from './AddToCartButton.client';
1
+ export { AddToCartButton } from './AddToCartButton.client';
@@ -1,7 +1,5 @@
1
- import { ElementType } from 'react';
2
1
  import type { ReactNode } from 'react';
3
- import { Props } from '../types';
4
- export interface BuyNowButtonProps {
2
+ interface BuyNowButtonProps {
5
3
  /** The item quantity. Defaults to 1. */
6
4
  quantity?: number;
7
5
  /** The ID of the variant. */
@@ -14,6 +12,7 @@ export interface BuyNowButtonProps {
14
12
  /** Any `ReactNode` elements. */
15
13
  children: ReactNode;
16
14
  }
17
- export declare type BuyNowButtonPropsWeControl = 'onClick';
15
+ declare type PropsWeControl = 'onClick';
18
16
  /** The `BuyNowButton` component renders a button that adds an item to the cart and redirects the customer to checkout. */
19
- export declare function BuyNowButton<TTag extends ElementType = 'button'>(props: Props<TTag, BuyNowButtonPropsWeControl> & BuyNowButtonProps): JSX.Element;
17
+ export declare function BuyNowButton(props: Omit<JSX.IntrinsicElements['button'], PropsWeControl> & BuyNowButtonProps): JSX.Element;
18
+ export {};
@@ -1 +1 @@
1
- export { BuyNowButton, BuyNowButtonProps, BuyNowButtonPropsWeControl, } from './BuyNowButton.client';
1
+ export { BuyNowButton } from './BuyNowButton.client';
@@ -1 +1 @@
1
- export { BuyNowButton, } from './BuyNowButton.client';
1
+ export { BuyNowButton } from './BuyNowButton.client';