@shopify/hydrogen 1.0.2 → 1.3.0

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 (419) hide show
  1. package/README.md +1 -1
  2. package/dist/esnext/FileSessionStorage.d.ts +1 -1
  3. package/dist/esnext/FileSessionStorage.js +1 -1
  4. package/dist/esnext/client.d.ts +16 -16
  5. package/dist/esnext/client.js +16 -16
  6. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +5 -2
  7. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +6 -5
  8. package/dist/esnext/components/AddToCartButton/index.d.ts +1 -1
  9. package/dist/esnext/components/AddToCartButton/index.js +1 -1
  10. package/dist/esnext/components/BaseButton/BaseButton.client.d.ts +7 -5
  11. package/dist/esnext/components/BaseButton/BaseButton.client.js +5 -4
  12. package/dist/esnext/components/BaseButton/index.d.ts +1 -1
  13. package/dist/esnext/components/BaseButton/index.js +1 -1
  14. package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +3 -2
  15. package/dist/esnext/components/BuyNowButton/BuyNowButton.client.js +2 -2
  16. package/dist/esnext/components/BuyNowButton/index.d.ts +1 -1
  17. package/dist/esnext/components/BuyNowButton/index.js +1 -1
  18. package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.js +1 -1
  19. package/dist/esnext/components/CartCheckoutButton/index.d.ts +1 -1
  20. package/dist/esnext/components/CartCheckoutButton/index.js +1 -1
  21. package/dist/esnext/components/CartCost/CartCost.client.d.ts +1 -1
  22. package/dist/esnext/components/CartCost/CartCost.client.js +2 -2
  23. package/dist/esnext/components/CartCost/index.d.ts +1 -1
  24. package/dist/esnext/components/CartCost/index.js +1 -1
  25. package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +1 -1
  26. package/dist/esnext/components/CartLineImage/CartLineImage.client.js +2 -2
  27. package/dist/esnext/components/CartLineImage/index.d.ts +1 -1
  28. package/dist/esnext/components/CartLineImage/index.js +1 -1
  29. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +1 -1
  30. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +2 -2
  31. package/dist/esnext/components/CartLinePrice/index.d.ts +1 -1
  32. package/dist/esnext/components/CartLinePrice/index.js +1 -1
  33. package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.js +1 -1
  34. package/dist/esnext/components/CartLineProductTitle/index.d.ts +1 -1
  35. package/dist/esnext/components/CartLineProductTitle/index.js +1 -1
  36. package/dist/esnext/components/CartLineProvider/CartLineProvider.client.d.ts +1 -1
  37. package/dist/esnext/components/CartLineProvider/CartLineProvider.client.js +1 -1
  38. package/dist/esnext/components/CartLineProvider/context.d.ts +13 -13
  39. package/dist/esnext/components/CartLineProvider/index.d.ts +2 -2
  40. package/dist/esnext/components/CartLineProvider/index.js +2 -2
  41. package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.js +1 -1
  42. package/dist/esnext/components/CartLineQuantity/index.d.ts +1 -1
  43. package/dist/esnext/components/CartLineQuantity/index.js +1 -1
  44. package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +7 -8
  45. package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +3 -3
  46. package/dist/esnext/components/CartLineQuantityAdjustButton/index.d.ts +1 -1
  47. package/dist/esnext/components/CartLineQuantityAdjustButton/index.js +1 -1
  48. package/dist/esnext/components/CartLines/CartLines.client.d.ts +1 -1
  49. package/dist/esnext/components/CartLines/CartLines.client.js +2 -2
  50. package/dist/esnext/components/CartLines/index.d.ts +1 -1
  51. package/dist/esnext/components/CartLines/index.js +1 -1
  52. package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +2 -2
  53. package/dist/esnext/components/CartProvider/CartProvider.client.js +13 -7
  54. package/dist/esnext/components/CartProvider/cart-queries.d.ts +1 -1
  55. package/dist/esnext/components/CartProvider/cart-queries.js +1 -0
  56. package/dist/esnext/components/CartProvider/context.d.ts +1 -1
  57. package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +1 -1
  58. package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +1 -1
  59. package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +1 -1
  60. package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +1 -1
  61. package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +1 -1
  62. package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +1 -1
  63. package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +1 -1
  64. package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +1 -1
  65. package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +1 -1
  66. package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +1 -1
  67. package/dist/esnext/components/CartProvider/hooks.client.d.ts +2 -2
  68. package/dist/esnext/components/CartProvider/hooks.client.js +4 -4
  69. package/dist/esnext/components/CartProvider/index.d.ts +4 -4
  70. package/dist/esnext/components/CartProvider/index.js +3 -3
  71. package/dist/esnext/components/CartProvider/types.d.ts +2 -2
  72. package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +1 -1
  73. package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.js +2 -2
  74. package/dist/esnext/components/CartShopPayButton/index.d.ts +1 -1
  75. package/dist/esnext/components/CartShopPayButton/index.js +1 -1
  76. package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +2 -2
  77. package/dist/esnext/components/ExternalVideo/ExternalVideo.js +1 -1
  78. package/dist/esnext/components/ExternalVideo/index.d.ts +1 -1
  79. package/dist/esnext/components/ExternalVideo/index.js +1 -1
  80. package/dist/esnext/components/Image/Image.d.ts +2 -2
  81. package/dist/esnext/components/Image/Image.js +5 -5
  82. package/dist/esnext/components/Image/index.d.ts +2 -2
  83. package/dist/esnext/components/Image/index.js +1 -1
  84. package/dist/esnext/components/Link/Link.client.js +5 -5
  85. package/dist/esnext/components/Link/index.d.ts +1 -1
  86. package/dist/esnext/components/Link/index.js +1 -1
  87. package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +1 -1
  88. package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -1
  89. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +1 -1
  90. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +5 -5
  91. package/dist/esnext/components/LocalizationProvider/index.d.ts +1 -1
  92. package/dist/esnext/components/LocalizationProvider/index.js +1 -1
  93. package/dist/esnext/components/MediaFile/MediaFile.d.ts +4 -4
  94. package/dist/esnext/components/MediaFile/MediaFile.js +4 -4
  95. package/dist/esnext/components/MediaFile/index.d.ts +1 -1
  96. package/dist/esnext/components/MediaFile/index.js +1 -1
  97. package/dist/esnext/components/Metafield/Metafield.client.d.ts +2 -2
  98. package/dist/esnext/components/Metafield/Metafield.client.js +6 -6
  99. package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +1 -1
  100. package/dist/esnext/components/Metafield/components/StarRating/index.d.ts +1 -1
  101. package/dist/esnext/components/Metafield/components/StarRating/index.js +1 -1
  102. package/dist/esnext/components/Metafield/components/index.d.ts +1 -1
  103. package/dist/esnext/components/Metafield/components/index.js +1 -1
  104. package/dist/esnext/components/Metafield/index.d.ts +2 -2
  105. package/dist/esnext/components/Metafield/index.js +1 -1
  106. package/dist/esnext/components/Metafield/types.d.ts +1 -1
  107. package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +2 -2
  108. package/dist/esnext/components/ModelViewer/ModelViewer.client.js +1 -1
  109. package/dist/esnext/components/ModelViewer/index.d.ts +1 -1
  110. package/dist/esnext/components/ModelViewer/index.js +1 -1
  111. package/dist/esnext/components/Money/Money.client.d.ts +1 -1
  112. package/dist/esnext/components/Money/Money.client.js +1 -1
  113. package/dist/esnext/components/Money/index.d.ts +1 -1
  114. package/dist/esnext/components/Money/index.js +1 -1
  115. package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +1 -1
  116. package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.js +3 -3
  117. package/dist/esnext/components/ProductOptionsProvider/context.d.ts +1 -1
  118. package/dist/esnext/components/ProductOptionsProvider/index.d.ts +1 -1
  119. package/dist/esnext/components/ProductOptionsProvider/index.js +1 -1
  120. package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +2 -2
  121. package/dist/esnext/components/ProductPrice/ProductPrice.client.js +2 -2
  122. package/dist/esnext/components/ProductPrice/index.d.ts +1 -1
  123. package/dist/esnext/components/ProductPrice/index.js +1 -1
  124. package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +1 -1
  125. package/dist/esnext/components/Seo/CollectionSeo.client.js +4 -4
  126. package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +1 -1
  127. package/dist/esnext/components/Seo/DefaultPageSeo.client.js +5 -5
  128. package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +1 -1
  129. package/dist/esnext/components/Seo/DescriptionSeo.client.js +1 -1
  130. package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
  131. package/dist/esnext/components/Seo/HomePageSeo.client.js +3 -3
  132. package/dist/esnext/components/Seo/ImageSeo.client.d.ts +1 -1
  133. package/dist/esnext/components/Seo/ImageSeo.client.js +1 -1
  134. package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +1 -1
  135. package/dist/esnext/components/Seo/NoIndexSeo.client.js +2 -2
  136. package/dist/esnext/components/Seo/PageSeo.client.d.ts +1 -1
  137. package/dist/esnext/components/Seo/PageSeo.client.js +3 -3
  138. package/dist/esnext/components/Seo/ProductSeo.client.d.ts +1 -1
  139. package/dist/esnext/components/Seo/ProductSeo.client.js +6 -6
  140. package/dist/esnext/components/Seo/Seo.client.d.ts +4 -4
  141. package/dist/esnext/components/Seo/Seo.client.js +7 -7
  142. package/dist/esnext/components/Seo/TitleSeo.client.d.ts +1 -1
  143. package/dist/esnext/components/Seo/TitleSeo.client.js +1 -1
  144. package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +1 -1
  145. package/dist/esnext/components/Seo/TwitterSeo.client.js +1 -1
  146. package/dist/esnext/components/Seo/index.d.ts +1 -1
  147. package/dist/esnext/components/Seo/index.js +1 -1
  148. package/dist/esnext/components/Seo/seo-types.d.ts +1 -1
  149. package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +2 -2
  150. package/dist/esnext/components/ShopPayButton/index.d.ts +1 -1
  151. package/dist/esnext/components/ShopPayButton/index.js +1 -1
  152. package/dist/esnext/components/Video/Video.d.ts +7 -2
  153. package/dist/esnext/components/Video/Video.js +3 -3
  154. package/dist/esnext/components/Video/index.d.ts +1 -1
  155. package/dist/esnext/components/Video/index.js +1 -1
  156. package/dist/esnext/components/index.d.ts +27 -27
  157. package/dist/esnext/components/index.js +25 -25
  158. package/dist/esnext/config.d.ts +5 -5
  159. package/dist/esnext/config.js +4 -4
  160. package/dist/esnext/constants.d.ts +1 -0
  161. package/dist/esnext/constants.js +1 -0
  162. package/dist/esnext/entry-client.d.ts +1 -1
  163. package/dist/esnext/entry-client.js +35 -14
  164. package/dist/esnext/entry-server.d.ts +1 -1
  165. package/dist/esnext/entry-server.js +86 -60
  166. package/dist/esnext/experimental.d.ts +2 -0
  167. package/dist/esnext/experimental.js +2 -0
  168. package/dist/esnext/foundation/Analytics/Analytics.client.js +1 -1
  169. package/dist/esnext/foundation/Analytics/Analytics.server.js +5 -5
  170. package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +1 -1
  171. package/dist/esnext/foundation/Analytics/ClientAnalytics.js +4 -4
  172. package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.d.ts +1 -1
  173. package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.js +1 -1
  174. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +7 -5
  175. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +1 -1
  176. package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.js +1 -1
  177. package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.js +1 -1
  178. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +3 -3
  179. package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +9 -9
  180. package/dist/esnext/foundation/Analytics/hook.js +2 -2
  181. package/dist/esnext/foundation/Analytics/index.d.ts +1 -1
  182. package/dist/esnext/foundation/Analytics/index.js +1 -1
  183. package/dist/esnext/foundation/Analytics/utils.js +1 -1
  184. package/dist/esnext/foundation/BuiltInRoutes/BuiltInRoutes.d.ts +1 -1
  185. package/dist/esnext/foundation/BuiltInRoutes/BuiltInRoutes.js +3 -3
  186. package/dist/esnext/foundation/Cache/cache-sub-request.d.ts +1 -1
  187. package/dist/esnext/foundation/Cache/cache-sub-request.js +4 -4
  188. package/dist/esnext/foundation/Cache/cache.d.ts +1 -1
  189. package/dist/esnext/foundation/Cache/cache.js +3 -4
  190. package/dist/esnext/foundation/Cache/strategies/index.d.ts +1 -1
  191. package/dist/esnext/foundation/Cookie/Cookie.js +2 -2
  192. package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.d.ts +2 -2
  193. package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.js +2 -1
  194. package/dist/esnext/foundation/DevTools/DevTools.client.js +1 -1
  195. package/dist/esnext/foundation/DevTools/DevTools.server.js +4 -3
  196. package/dist/esnext/foundation/DevTools/components/Heading.js +1 -1
  197. package/dist/esnext/foundation/DevTools/components/Interface.client.js +1 -1
  198. package/dist/esnext/foundation/DevTools/components/Panels.d.ts +2 -2
  199. package/dist/esnext/foundation/DevTools/components/Panels.js +28 -22
  200. package/dist/esnext/foundation/DevTools/components/Performance.client.js +1 -2
  201. package/dist/esnext/foundation/DevTools/components/Settings.client.d.ts +2 -1
  202. package/dist/esnext/foundation/DevTools/components/Settings.client.js +2 -5
  203. package/dist/esnext/foundation/DevTools/components/Table.js +3 -3
  204. package/dist/esnext/foundation/DevTools/components/index.d.ts +2 -2
  205. package/dist/esnext/foundation/DevTools/components/index.js +2 -2
  206. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +1 -1
  207. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +5 -5
  208. package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.d.ts +3 -3
  209. package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.js +2 -2
  210. package/dist/esnext/foundation/Form/Form.client.d.ts +11 -0
  211. package/dist/esnext/foundation/Form/Form.client.js +51 -0
  212. package/dist/esnext/foundation/Head/Head.client.js +1 -1
  213. package/dist/esnext/foundation/Head/index.d.ts +1 -1
  214. package/dist/esnext/foundation/Head/index.js +1 -1
  215. package/dist/esnext/foundation/Html/Html.d.ts +1 -1
  216. package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts +6 -5
  217. package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.js +6 -7
  218. package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +2 -4
  219. package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.js +4 -18
  220. package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.d.ts +2 -2
  221. package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.js +1 -1
  222. package/dist/esnext/foundation/Redirect/Redirect.client.js +1 -1
  223. package/dist/esnext/foundation/Route/Route.server.js +3 -3
  224. package/dist/esnext/foundation/Router/BrowserRouter.client.js +2 -2
  225. package/dist/esnext/foundation/Router/Router.server.js +1 -1
  226. package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +3 -1
  227. package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +7 -7
  228. package/dist/esnext/foundation/ServerPropsProvider/index.d.ts +1 -1
  229. package/dist/esnext/foundation/ServerPropsProvider/index.js +1 -1
  230. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +2 -2
  231. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +3 -3
  232. package/dist/esnext/foundation/ServerRequestProvider/index.d.ts +1 -1
  233. package/dist/esnext/foundation/ServerRequestProvider/index.js +1 -1
  234. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +1 -1
  235. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.d.ts +2 -2
  236. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +7 -6
  237. package/dist/esnext/foundation/ShopifyProvider/index.d.ts +1 -1
  238. package/dist/esnext/foundation/ShopifyProvider/index.js +1 -1
  239. package/dist/esnext/foundation/ShopifyProvider/types.d.ts +4 -3
  240. package/dist/esnext/foundation/fetchSync/ResponseSync.d.ts +14 -0
  241. package/dist/esnext/foundation/fetchSync/ResponseSync.js +38 -0
  242. package/dist/esnext/foundation/fetchSync/client/fetchSync.d.ts +2 -2
  243. package/dist/esnext/foundation/fetchSync/client/fetchSync.js +5 -10
  244. package/dist/esnext/foundation/fetchSync/server/fetchSync.d.ts +3 -3
  245. package/dist/esnext/foundation/fetchSync/server/fetchSync.js +7 -13
  246. package/dist/esnext/foundation/index.d.ts +3 -3
  247. package/dist/esnext/foundation/index.js +3 -3
  248. package/dist/esnext/foundation/session/session-types.d.ts +15 -0
  249. package/dist/esnext/foundation/{fetchSync/types.js → session/session-types.js} +0 -0
  250. package/dist/esnext/foundation/session/session.d.ts +7 -16
  251. package/dist/esnext/foundation/session/session.js +17 -1
  252. package/dist/esnext/foundation/ssr-interop.d.ts +2 -2
  253. package/dist/esnext/foundation/ssr-interop.js +2 -2
  254. package/dist/esnext/foundation/useNavigate/useNavigate.js +2 -2
  255. package/dist/esnext/foundation/useQuery/hooks.d.ts +4 -1
  256. package/dist/esnext/foundation/useQuery/hooks.js +5 -5
  257. package/dist/esnext/foundation/useQuery/index.d.ts +1 -1
  258. package/dist/esnext/foundation/useQuery/index.js +1 -1
  259. package/dist/esnext/foundation/useRequestContext/index.js +1 -1
  260. package/dist/esnext/foundation/useRouteParams/useRouteParams.js +2 -2
  261. package/dist/esnext/foundation/useServerProps/index.d.ts +1 -1
  262. package/dist/esnext/foundation/useServerProps/index.js +1 -1
  263. package/dist/esnext/foundation/useServerProps/use-server-props.d.ts +1 -1
  264. package/dist/esnext/foundation/useServerProps/use-server-props.js +1 -1
  265. package/dist/esnext/foundation/useSession/useSession.d.ts +1 -0
  266. package/dist/esnext/foundation/useSession/useSession.js +14 -1
  267. package/dist/esnext/foundation/useShop/index.d.ts +1 -1
  268. package/dist/esnext/foundation/useShop/index.js +1 -1
  269. package/dist/esnext/foundation/useShop/use-shop.d.ts +1 -1
  270. package/dist/esnext/foundation/useShop/use-shop.js +2 -2
  271. package/dist/esnext/foundation/useUrl/index.d.ts +1 -1
  272. package/dist/esnext/foundation/useUrl/index.js +1 -1
  273. package/dist/esnext/foundation/useUrl/useUrl.js +4 -4
  274. package/dist/esnext/framework/graphiql.js +26 -30
  275. package/dist/esnext/framework/load-config.js +2 -2
  276. package/dist/esnext/framework/middleware.d.ts +1 -1
  277. package/dist/esnext/framework/middleware.js +2 -2
  278. package/dist/esnext/framework/plugin.d.ts +1 -1
  279. package/dist/esnext/framework/plugin.js +17 -15
  280. package/dist/esnext/framework/plugins/vite-plugin-assets-version.d.ts +2 -0
  281. package/dist/esnext/framework/plugins/vite-plugin-assets-version.js +8 -0
  282. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +1 -1
  283. package/dist/esnext/framework/plugins/vite-plugin-css-rsc.d.ts +2 -0
  284. package/dist/esnext/framework/plugins/vite-plugin-css-rsc.js +108 -0
  285. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.d.ts +2 -1
  286. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +8 -4
  287. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
  288. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +3 -3
  289. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -1
  290. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +2 -2
  291. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +1 -1
  292. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +35 -7
  293. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +36 -7
  294. package/dist/esnext/framework/types.d.ts +14 -0
  295. package/dist/esnext/hooks/index.d.ts +6 -6
  296. package/dist/esnext/hooks/index.js +6 -6
  297. package/dist/esnext/hooks/useCart/index.d.ts +1 -1
  298. package/dist/esnext/hooks/useCart/index.js +1 -1
  299. package/dist/esnext/hooks/useCart/useCart.d.ts +1 -1
  300. package/dist/esnext/hooks/useCart/useCart.js +1 -1
  301. package/dist/esnext/hooks/useCartLine/index.d.ts +1 -1
  302. package/dist/esnext/hooks/useCartLine/index.js +1 -1
  303. package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +13 -13
  304. package/dist/esnext/hooks/useCartLine/useCartLine.js +1 -1
  305. package/dist/esnext/hooks/useLoadScript/index.d.ts +1 -1
  306. package/dist/esnext/hooks/useLoadScript/index.js +1 -1
  307. package/dist/esnext/hooks/useLoadScript/useLoadScript.client.d.ts +1 -1
  308. package/dist/esnext/hooks/useLoadScript/useLoadScript.client.js +1 -1
  309. package/dist/esnext/hooks/useLocalization/useLocalization.d.ts +2 -3
  310. package/dist/esnext/hooks/useLocalization/useLocalization.js +2 -2
  311. package/dist/esnext/hooks/useMeasurement/hooks.d.ts +1 -1
  312. package/dist/esnext/hooks/useMeasurement/hooks.js +2 -2
  313. package/dist/esnext/hooks/useMeasurement/index.d.ts +1 -1
  314. package/dist/esnext/hooks/useMeasurement/index.js +1 -1
  315. package/dist/esnext/hooks/useMoney/hooks.d.ts +1 -1
  316. package/dist/esnext/hooks/useMoney/hooks.js +1 -1
  317. package/dist/esnext/hooks/useMoney/index.d.ts +1 -1
  318. package/dist/esnext/hooks/useMoney/index.js +1 -1
  319. package/dist/esnext/hooks/useProductOptions/helpers.d.ts +2 -2
  320. package/dist/esnext/hooks/useProductOptions/index.d.ts +2 -2
  321. package/dist/esnext/hooks/useProductOptions/index.js +2 -2
  322. package/dist/esnext/hooks/useProductOptions/types.d.ts +1 -1
  323. package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +1 -1
  324. package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +1 -1
  325. package/dist/esnext/hooks/useShopQuery/hooks.d.ts +1 -1
  326. package/dist/esnext/hooks/useShopQuery/hooks.js +25 -17
  327. package/dist/esnext/hooks/useShopQuery/index.d.ts +1 -1
  328. package/dist/esnext/hooks/useShopQuery/index.js +1 -1
  329. package/dist/esnext/index.d.ts +26 -26
  330. package/dist/esnext/index.js +22 -22
  331. package/dist/esnext/node.d.ts +1 -1
  332. package/dist/esnext/node.js +1 -1
  333. package/dist/esnext/platforms/index.d.ts +1 -0
  334. package/dist/esnext/platforms/index.js +1 -0
  335. package/dist/esnext/platforms/node.d.ts +1 -1
  336. package/dist/esnext/platforms/node.js +5 -11
  337. package/dist/esnext/platforms/virtual.d.ts +8 -0
  338. package/dist/esnext/platforms/virtual.js +12 -0
  339. package/dist/esnext/platforms/worker-event.js +1 -1
  340. package/dist/esnext/platforms/worker.js +7 -7
  341. package/dist/esnext/shared-types.d.ts +3 -0
  342. package/dist/esnext/types.d.ts +8 -7
  343. package/dist/esnext/types.js +1 -1
  344. package/dist/esnext/utilities/apiRoutes.d.ts +4 -4
  345. package/dist/esnext/utilities/apiRoutes.js +51 -6
  346. package/dist/esnext/utilities/error.js +1 -1
  347. package/dist/esnext/utilities/fetch.js +1 -1
  348. package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +1 -1
  349. package/dist/esnext/utilities/flattenConnection/index.d.ts +1 -1
  350. package/dist/esnext/utilities/flattenConnection/index.js +1 -1
  351. package/dist/esnext/utilities/hash.d.ts +1 -1
  352. package/dist/esnext/utilities/hash.js +1 -1
  353. package/dist/esnext/utilities/image_size.d.ts +1 -1
  354. package/dist/esnext/utilities/index.d.ts +12 -12
  355. package/dist/esnext/utilities/index.js +12 -12
  356. package/dist/esnext/utilities/isBrowser/index.d.ts +1 -1
  357. package/dist/esnext/utilities/isBrowser/index.js +1 -1
  358. package/dist/esnext/utilities/isServer/index.d.ts +1 -1
  359. package/dist/esnext/utilities/isServer/index.js +1 -1
  360. package/dist/esnext/utilities/isServer/isServer.js +1 -1
  361. package/dist/esnext/utilities/load_script.d.ts +1 -0
  362. package/dist/esnext/utilities/load_script.js +6 -1
  363. package/dist/esnext/utilities/locale/index.d.ts +1 -0
  364. package/dist/esnext/utilities/locale/index.js +1 -0
  365. package/dist/esnext/utilities/locale/locale.d.ts +7 -0
  366. package/dist/esnext/utilities/locale/locale.js +22 -0
  367. package/dist/esnext/utilities/log/index.d.ts +4 -4
  368. package/dist/esnext/utilities/log/index.js +4 -4
  369. package/dist/esnext/utilities/log/log-cache-api-status.js +1 -1
  370. package/dist/esnext/utilities/log/log-cache-header.d.ts +4 -4
  371. package/dist/esnext/utilities/log/log-cache-header.js +3 -3
  372. package/dist/esnext/utilities/log/log-query-timeline.d.ts +3 -3
  373. package/dist/esnext/utilities/log/log-query-timeline.js +13 -10
  374. package/dist/esnext/utilities/log/log.d.ts +1 -1
  375. package/dist/esnext/utilities/log/log.js +2 -2
  376. package/dist/esnext/utilities/log/utils.d.ts +1 -1
  377. package/dist/esnext/utilities/log/utils.js +1 -1
  378. package/dist/esnext/utilities/measurement.d.ts +1 -1
  379. package/dist/esnext/utilities/parseMetafield/index.d.ts +1 -1
  380. package/dist/esnext/utilities/parseMetafield/index.js +1 -1
  381. package/dist/esnext/utilities/parseMetafield/parseMetafield.d.ts +2 -2
  382. package/dist/esnext/utilities/parseMetafield/parseMetafield.js +1 -1
  383. package/dist/esnext/utilities/storefrontApi.js +1 -1
  384. package/dist/esnext/utilities/suspense.d.ts +1 -1
  385. package/dist/esnext/utilities/suspense.js +1 -1
  386. package/dist/esnext/version.d.ts +1 -1
  387. package/dist/esnext/version.js +1 -1
  388. package/dist/node/foundation/session/session-types.d.ts +15 -0
  389. package/dist/node/foundation/session/session-types.js +2 -0
  390. package/dist/node/framework/graphiql.js +26 -30
  391. package/dist/node/framework/load-config.js +3 -3
  392. package/dist/node/framework/middleware.d.ts +1 -1
  393. package/dist/node/framework/middleware.js +3 -3
  394. package/dist/node/framework/plugin.d.ts +1 -1
  395. package/dist/node/framework/plugin.js +26 -24
  396. package/dist/node/framework/plugins/vite-plugin-assets-version.d.ts +2 -0
  397. package/dist/node/framework/plugins/vite-plugin-assets-version.js +11 -0
  398. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +3 -3
  399. package/dist/node/framework/plugins/vite-plugin-css-rsc.d.ts +2 -0
  400. package/dist/node/framework/plugins/vite-plugin-css-rsc.js +114 -0
  401. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.d.ts +2 -1
  402. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +11 -4
  403. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
  404. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +7 -7
  405. package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -1
  406. package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +5 -5
  407. package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +1 -1
  408. package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +35 -7
  409. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +36 -7
  410. package/dist/node/framework/types.d.ts +14 -0
  411. package/dist/node/shared-types.d.ts +3 -0
  412. package/package.json +20 -3
  413. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +36 -14
  414. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +36 -14
  415. package/dist/esnext/foundation/fetchSync/types.d.ts +0 -5
  416. package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.d.ts +0 -3
  417. package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.js +0 -11
  418. package/dist/node/framework/plugins/vite-plugin-purge-query-cache.d.ts +0 -3
  419. package/dist/node/framework/plugins/vite-plugin-purge-query-cache.js +0 -16
package/README.md CHANGED
@@ -8,7 +8,7 @@ Hydrogen is a React framework and SDK that you can use to build fast and dynamic
8
8
 
9
9
  **Requirements:**
10
10
 
11
- - Node.js version 16.5.0 or higher
11
+ - Node.js version 16.14.0 or higher
12
12
  - Yarn
13
13
 
14
14
  ```bash
@@ -1 +1 @@
1
- export { FileSessionStorage } from './foundation/FileSessionStorage/FileSessionStorage';
1
+ export { FileSessionStorage } from './foundation/FileSessionStorage/FileSessionStorage.js';
@@ -1 +1 @@
1
- export { FileSessionStorage } from './foundation/FileSessionStorage/FileSessionStorage';
1
+ export { FileSessionStorage } from './foundation/FileSessionStorage/FileSessionStorage.js';
@@ -1,16 +1,16 @@
1
- export * from './components';
2
- export * from './hooks';
3
- export { useServerProps } from './foundation/useServerProps';
4
- export { useShop } from './foundation/useShop';
5
- export { ServerPropsProvider, ServerPropsContext, type ServerProps, type ServerPropsContextValue, } from './foundation/ServerPropsProvider';
6
- export { useUrl } from './foundation/useUrl';
7
- export { Head } from './foundation/Head';
8
- export * from './utilities';
9
- export { gql } from './utilities/graphql-tag';
10
- export { ClientAnalytics } from './foundation/Analytics';
11
- export { useRouteParams } from './foundation/useRouteParams/useRouteParams';
12
- export { useNavigate } from './foundation/useNavigate/useNavigate';
13
- export { fetchSync } from './foundation/fetchSync/client/fetchSync';
14
- export { suspendFunction, preloadFunction } from './utilities/suspense';
15
- export { PerformanceMetrics } from './foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client';
16
- export { PerformanceMetricsDebug } from './foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client';
1
+ export * from './components/index.js';
2
+ export * from './hooks/index.js';
3
+ export { useServerProps } from './foundation/useServerProps/index.js';
4
+ export { useShop } from './foundation/useShop/index.js';
5
+ export { ServerPropsProvider, ServerPropsContext, type ServerProps, type ServerPropsContextValue, } from './foundation/ServerPropsProvider/index.js';
6
+ export { useUrl } from './foundation/useUrl/index.js';
7
+ export { Head } from './foundation/Head/index.js';
8
+ export * from './utilities/index.js';
9
+ export { gql } from './utilities/graphql-tag.js';
10
+ export { ClientAnalytics } from './foundation/Analytics/index.js';
11
+ export { useRouteParams } from './foundation/useRouteParams/useRouteParams.js';
12
+ export { useNavigate } from './foundation/useNavigate/useNavigate.js';
13
+ export { fetchSync } from './foundation/fetchSync/client/fetchSync.js';
14
+ export { suspendFunction, preloadFunction } from './utilities/suspense.js';
15
+ export { PerformanceMetrics } from './foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js';
16
+ export { PerformanceMetricsDebug } from './foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js';
@@ -1,16 +1,16 @@
1
- export * from './components';
2
- export * from './hooks';
3
- export { useServerProps } from './foundation/useServerProps';
4
- export { useShop } from './foundation/useShop';
5
- export { ServerPropsProvider, ServerPropsContext, } from './foundation/ServerPropsProvider';
6
- export { useUrl } from './foundation/useUrl';
7
- export { Head } from './foundation/Head';
8
- export * from './utilities';
9
- export { gql } from './utilities/graphql-tag';
10
- export { ClientAnalytics } from './foundation/Analytics';
11
- export { useRouteParams } from './foundation/useRouteParams/useRouteParams';
12
- export { useNavigate } from './foundation/useNavigate/useNavigate';
13
- export { fetchSync } from './foundation/fetchSync/client/fetchSync';
14
- export { suspendFunction, preloadFunction } from './utilities/suspense';
15
- export { PerformanceMetrics } from './foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client';
16
- export { PerformanceMetricsDebug } from './foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client';
1
+ export * from './components/index.js';
2
+ export * from './hooks/index.js';
3
+ export { useServerProps } from './foundation/useServerProps/index.js';
4
+ export { useShop } from './foundation/useShop/index.js';
5
+ export { ServerPropsProvider, ServerPropsContext, } from './foundation/ServerPropsProvider/index.js';
6
+ export { useUrl } from './foundation/useUrl/index.js';
7
+ export { Head } from './foundation/Head/index.js';
8
+ export * from './utilities/index.js';
9
+ export { gql } from './utilities/graphql-tag.js';
10
+ export { ClientAnalytics } from './foundation/Analytics/index.js';
11
+ export { useRouteParams } from './foundation/useRouteParams/useRouteParams.js';
12
+ export { useNavigate } from './foundation/useNavigate/useNavigate.js';
13
+ export { fetchSync } from './foundation/fetchSync/client/fetchSync.js';
14
+ export { suspendFunction, preloadFunction } from './utilities/suspense.js';
15
+ export { PerformanceMetrics } from './foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js';
16
+ export { PerformanceMetricsDebug } from './foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js';
@@ -1,4 +1,5 @@
1
- import { BaseButtonProps } from '../BaseButton';
1
+ import React from 'react';
2
+ import { BaseButtonProps } from '../BaseButton/index.js';
2
3
  interface AddToCartButtonProps {
3
4
  /** An array of cart line attributes that belong to the item being added to the cart. */
4
5
  attributes?: {
@@ -11,10 +12,12 @@ interface AddToCartButtonProps {
11
12
  quantity?: number;
12
13
  /** The text that is announced by the screen reader when the item is being added to the cart. Used for accessibility purposes only and not displayed on the page. */
13
14
  accessibleAddingToCartLabel?: string;
15
+ /** The selling plan ID of the subscription variant */
16
+ sellingPlanId?: string;
14
17
  }
15
18
  /**
16
19
  * The `AddToCartButton` component renders a button that adds an item to the cart when pressed.
17
20
  * It must be a descendent of the `CartProvider` component.
18
21
  */
19
- export declare function AddToCartButton(props: AddToCartButtonProps & BaseButtonProps): JSX.Element;
22
+ export declare function AddToCartButton<AsType extends React.ElementType = 'button'>(props: AddToCartButtonProps & BaseButtonProps<AsType>): JSX.Element;
20
23
  export {};
@@ -1,14 +1,14 @@
1
1
  import React, { useCallback, useEffect, useState } from 'react';
2
- import { useCart } from '../CartProvider';
3
- import { useProductOptions } from '../../hooks/useProductOptions';
4
- import { BaseButton } from '../BaseButton';
2
+ import { useCart } from '../CartProvider/index.js';
3
+ import { useProductOptions } from '../../hooks/useProductOptions/index.js';
4
+ import { BaseButton } from '../BaseButton/index.js';
5
5
  /**
6
6
  * The `AddToCartButton` component renders a button that adds an item to the cart when pressed.
7
7
  * It must be a descendent of the `CartProvider` component.
8
8
  */
9
9
  export function AddToCartButton(props) {
10
10
  const [addingItem, setAddingItem] = useState(false);
11
- const { variantId: explicitVariantId, quantity = 1, attributes, onClick, children, accessibleAddingToCartLabel, ...passthroughProps } = props;
11
+ const { variantId: explicitVariantId, quantity = 1, attributes, sellingPlanId, onClick, children, accessibleAddingToCartLabel, ...passthroughProps } = props;
12
12
  const { status, linesAdd } = useCart();
13
13
  const { selectedVariant } = useProductOptions();
14
14
  const variantId = explicitVariantId ?? selectedVariant?.id ?? '';
@@ -29,9 +29,10 @@ export function AddToCartButton(props) {
29
29
  quantity,
30
30
  merchandiseId: variantId,
31
31
  attributes,
32
+ sellingPlanId,
32
33
  },
33
34
  ]);
34
- }, [linesAdd, quantity, variantId, attributes]);
35
+ }, [linesAdd, quantity, variantId, attributes, sellingPlanId]);
35
36
  return (React.createElement(React.Fragment, null,
36
37
  React.createElement(BaseButton, { ...passthroughProps, disabled: disabled, onClick: onClick, defaultOnClick: handleAddItem }, children),
37
38
  accessibleAddingToCartLabel ? (React.createElement("p", { style: {
@@ -1 +1 @@
1
- export { AddToCartButton } from './AddToCartButton.client';
1
+ export { AddToCartButton } from './AddToCartButton.client.js';
@@ -1 +1 @@
1
- export { AddToCartButton } from './AddToCartButton.client';
1
+ export { AddToCartButton } from './AddToCartButton.client.js';
@@ -1,14 +1,16 @@
1
1
  import React, { ReactNode, Ref } from 'react';
2
- interface Props {
2
+ export interface CustomBaseButtonProps<AsType> {
3
+ /** Provide a React element or component to render as the underlying button. Note: for accessibility compliance, almost always you should use a `button` element, or a component that renders an underlying button. */
4
+ as?: AsType;
3
5
  /** Any ReactNode elements. */
4
6
  children: ReactNode;
5
7
  /** Click event handler. Default behaviour triggers unless prevented */
6
8
  onClick?: (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | boolean;
7
- /** A default onClick behaviour */
9
+ /** A default onClick behavior */
8
10
  defaultOnClick?: (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | boolean;
9
11
  /** A ref to the underlying button */
10
12
  buttonRef?: Ref<HTMLButtonElement>;
13
+ disabled?: boolean;
11
14
  }
12
- export declare type BaseButtonProps = Omit<JSX.IntrinsicElements['button'], 'onClick' | 'children'> & Props;
13
- export declare function BaseButton({ onClick, defaultOnClick, children, buttonRef, ...passthroughProps }: BaseButtonProps): JSX.Element;
14
- export {};
15
+ export declare type BaseButtonProps<AsType extends React.ElementType> = CustomBaseButtonProps<AsType> & Omit<React.ComponentPropsWithoutRef<AsType>, keyof CustomBaseButtonProps<AsType>>;
16
+ export declare function BaseButton<AsType extends React.ElementType = 'button'>(props: BaseButtonProps<AsType>): JSX.Element;
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { useCallback } from 'react';
3
- export function BaseButton({ onClick, defaultOnClick, children, buttonRef, ...passthroughProps }) {
1
+ import React, { useCallback } from 'react';
2
+ export function BaseButton(props) {
3
+ const { as, onClick, defaultOnClick, children, buttonRef, ...passthroughProps } = props;
4
4
  const handleOnClick = useCallback((event) => {
5
5
  if (onClick) {
6
6
  const clickShouldContinue = onClick(event);
@@ -11,5 +11,6 @@ export function BaseButton({ onClick, defaultOnClick, children, buttonRef, ...pa
11
11
  }
12
12
  defaultOnClick?.(event);
13
13
  }, [defaultOnClick, onClick]);
14
- return (React.createElement("button", { ...passthroughProps, ref: buttonRef, onClick: handleOnClick }, children));
14
+ const Component = as || 'button';
15
+ return (React.createElement(Component, { ref: buttonRef, onClick: handleOnClick, ...passthroughProps }, children));
15
16
  }
@@ -1 +1 @@
1
- export { BaseButton, BaseButtonProps } from './BaseButton.client';
1
+ export { BaseButton, BaseButtonProps } from './BaseButton.client.js';
@@ -1 +1 @@
1
- export { BaseButton } from './BaseButton.client';
1
+ export { BaseButton } from './BaseButton.client.js';
@@ -1,4 +1,5 @@
1
- import { BaseButtonProps } from '../BaseButton';
1
+ import React from 'react';
2
+ import { BaseButtonProps } from '../BaseButton/index.js';
2
3
  interface BuyNowButtonProps {
3
4
  /** The item quantity. Defaults to 1. */
4
5
  quantity?: number;
@@ -11,5 +12,5 @@ interface BuyNowButtonProps {
11
12
  }[];
12
13
  }
13
14
  /** The `BuyNowButton` component renders a button that adds an item to the cart and redirects the customer to checkout. */
14
- export declare function BuyNowButton(props: BuyNowButtonProps & BaseButtonProps): JSX.Element;
15
+ export declare function BuyNowButton<AsType extends React.ElementType = 'button'>(props: BuyNowButtonProps & BaseButtonProps<AsType>): JSX.Element;
15
16
  export {};
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState, useCallback } from 'react';
2
- import { useInstantCheckout } from '../CartProvider';
3
- import { BaseButton } from '../BaseButton';
2
+ import { useInstantCheckout } from '../CartProvider/index.js';
3
+ import { BaseButton } from '../BaseButton/index.js';
4
4
  /** The `BuyNowButton` component renders a button that adds an item to the cart and redirects the customer to checkout. */
5
5
  export function BuyNowButton(props) {
6
6
  const { createInstantCheckout, checkoutUrl } = useInstantCheckout();
@@ -1 +1 @@
1
- export { BuyNowButton } from './BuyNowButton.client';
1
+ export { BuyNowButton } from './BuyNowButton.client.js';
@@ -1 +1 @@
1
- export { BuyNowButton } from './BuyNowButton.client';
1
+ export { BuyNowButton } from './BuyNowButton.client.js';
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { useCart } from '../CartProvider';
2
+ import { useCart } from '../CartProvider/index.js';
3
3
  /**
4
4
  * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.
5
5
  * It must be a descendent of a `CartProvider` component.
@@ -1 +1 @@
1
- export { CartCheckoutButton } from './CartCheckoutButton.client';
1
+ export { CartCheckoutButton } from './CartCheckoutButton.client.js';
@@ -1 +1 @@
1
- export { CartCheckoutButton } from './CartCheckoutButton.client';
1
+ export { CartCheckoutButton } from './CartCheckoutButton.client.js';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Money } from '../Money';
2
+ import { Money } from '../Money/index.js';
3
3
  export interface CartCostProps {
4
4
  /** A string type that defines the type of cost needed. Valid values: `total`, `subtotal`, `tax`, or `duty`. */
5
5
  amountType?: 'total' | 'subtotal' | 'tax' | 'duty';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { useCart } from '../CartProvider';
3
- import { Money } from '../Money';
2
+ import { useCart } from '../CartProvider/index.js';
3
+ import { Money } from '../Money/index.js';
4
4
  /**
5
5
  * The `CartCost` component renders a `Money` component with the
6
6
  * cost associated with the `amountType` prop. If no `amountType` prop is specified, then it defaults to `totalAmount`.
@@ -1 +1 @@
1
- export { CartCost } from './CartCost.client';
1
+ export { CartCost } from './CartCost.client.js';
@@ -1 +1 @@
1
- export { CartCost } from './CartCost.client';
1
+ export { CartCost } from './CartCost.client.js';
@@ -1,4 +1,4 @@
1
- import { type ShopifyImageProps } from '../Image';
1
+ import { type ShopifyImageProps } from '../Image/index.js';
2
2
  import type { Simplify } from 'type-fest';
3
3
  declare type PropsWeControl = 'data';
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { useCartLine } from '../CartLineProvider';
3
- import { Image } from '../Image';
2
+ import { useCartLine } from '../CartLineProvider/index.js';
3
+ import { Image } from '../Image/index.js';
4
4
  /**
5
5
  * The `CartLineImage` component renders an `Image` component for the cart line merchandise's image.
6
6
  * It must be a descendent of a `CartLineProvider` component.
@@ -1 +1 @@
1
- export { CartLineImage } from './CartLineImage.client';
1
+ export { CartLineImage } from './CartLineImage.client.js';
@@ -1 +1 @@
1
- export { CartLineImage } from './CartLineImage.client';
1
+ export { CartLineImage } from './CartLineImage.client.js';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Money } from '../Money';
2
+ import { Money } from '../Money/index.js';
3
3
  interface CartLinePriceProps {
4
4
  /** The type of price. Valid values:`regular` (default) or `compareAt`. */
5
5
  priceType?: 'regular' | 'compareAt';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { useCartLine } from '../CartLineProvider';
3
- import { Money } from '../Money';
2
+ import { useCartLine } from '../CartLineProvider/index.js';
3
+ import { Money } from '../Money/index.js';
4
4
  /**
5
5
  * The `CartLinePrice` component renders a `Money` component for the cart line merchandise's price or
6
6
  * compare at price. It must be a descendent of a `CartLineProvider` component.
@@ -1 +1 @@
1
- export { CartLinePrice } from './CartLinePrice.client';
1
+ export { CartLinePrice } from './CartLinePrice.client.js';
@@ -1 +1 @@
1
- export { CartLinePrice } from './CartLinePrice.client';
1
+ export { CartLinePrice } from './CartLinePrice.client.js';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useCartLine } from '../CartLineProvider';
2
+ import { useCartLine } from '../CartLineProvider/index.js';
3
3
  /**
4
4
  * The `CartLineProductTitle` component renders a `span` element (or the type of HTML element specified by
5
5
  * the `as` prop) with the cart line merchandise's title. It must be a descendent of a `CartLineProvider` component.
@@ -1 +1 @@
1
- export { CartLineProductTitle } from './CartLineProductTitle.client';
1
+ export { CartLineProductTitle } from './CartLineProductTitle.client.js';
@@ -1 +1 @@
1
- export { CartLineProductTitle } from './CartLineProductTitle.client';
1
+ export { CartLineProductTitle } from './CartLineProductTitle.client.js';
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { Cart } from '../CartProvider';
2
+ import { Cart } from '../CartProvider/index.js';
3
3
  /**
4
4
  * The `CartLineProvider` component creates a context for using a cart line.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CartLineContext } from './context';
2
+ import { CartLineContext } from './context.js';
3
3
  /**
4
4
  * The `CartLineProvider` component creates a context for using a cart line.
5
5
  */
@@ -1,36 +1,36 @@
1
1
  export declare const CartLineContext: import("react").Context<({
2
2
  __typename?: "CartLine" | undefined;
3
- } & Pick<import("../../storefront-api-types").CartLine, "id" | "quantity"> & {
3
+ } & Pick<import("../../storefront-api-types.js").CartLine, "id" | "quantity"> & {
4
4
  attributes: ({
5
5
  __typename?: "Attribute" | undefined;
6
- } & Pick<import("../../storefront-api-types").Attribute, "key" | "value">)[];
6
+ } & Pick<import("../../storefront-api-types.js").Attribute, "key" | "value">)[];
7
7
  cost: {
8
8
  __typename?: "CartLineCost" | undefined;
9
9
  } & {
10
10
  totalAmount: {
11
11
  __typename?: "MoneyV2" | undefined;
12
- } & Pick<import("../../storefront-api-types").MoneyV2, "currencyCode" | "amount">;
13
- compareAtAmountPerQuantity?: import("../../storefront-api-types").Maybe<{
12
+ } & Pick<import("../../storefront-api-types.js").MoneyV2, "currencyCode" | "amount">;
13
+ compareAtAmountPerQuantity?: import("../../storefront-api-types.js").Maybe<{
14
14
  __typename?: "MoneyV2" | undefined;
15
- } & Pick<import("../../storefront-api-types").MoneyV2, "currencyCode" | "amount">> | undefined;
15
+ } & Pick<import("../../storefront-api-types.js").MoneyV2, "currencyCode" | "amount">> | undefined;
16
16
  };
17
17
  merchandise: {
18
18
  __typename?: "ProductVariant" | undefined;
19
- } & Pick<import("../../storefront-api-types").ProductVariant, "id" | "title" | "availableForSale" | "requiresShipping"> & {
20
- compareAtPriceV2?: import("../../storefront-api-types").Maybe<{
19
+ } & Pick<import("../../storefront-api-types.js").ProductVariant, "id" | "title" | "availableForSale" | "requiresShipping"> & {
20
+ compareAtPriceV2?: import("../../storefront-api-types.js").Maybe<{
21
21
  __typename?: "MoneyV2" | undefined;
22
- } & Pick<import("../../storefront-api-types").MoneyV2, "currencyCode" | "amount">> | undefined;
22
+ } & Pick<import("../../storefront-api-types.js").MoneyV2, "currencyCode" | "amount">> | undefined;
23
23
  priceV2: {
24
24
  __typename?: "MoneyV2" | undefined;
25
- } & Pick<import("../../storefront-api-types").MoneyV2, "currencyCode" | "amount">;
26
- image?: import("../../storefront-api-types").Maybe<{
25
+ } & Pick<import("../../storefront-api-types.js").MoneyV2, "currencyCode" | "amount">;
26
+ image?: import("../../storefront-api-types.js").Maybe<{
27
27
  __typename?: "Image" | undefined;
28
- } & Pick<import("../../storefront-api-types").Image, "id" | "height" | "width" | "url" | "altText">> | undefined;
28
+ } & Pick<import("../../storefront-api-types.js").Image, "id" | "height" | "width" | "url" | "altText">> | undefined;
29
29
  product: {
30
30
  __typename?: "Product" | undefined;
31
- } & Pick<import("../../storefront-api-types").Product, "title" | "handle">;
31
+ } & Pick<import("../../storefront-api-types.js").Product, "title" | "handle">;
32
32
  selectedOptions: ({
33
33
  __typename?: "SelectedOption" | undefined;
34
- } & Pick<import("../../storefront-api-types").SelectedOption, "name" | "value">)[];
34
+ } & Pick<import("../../storefront-api-types.js").SelectedOption, "name" | "value">)[];
35
35
  };
36
36
  }) | null>;
@@ -1,2 +1,2 @@
1
- export { CartLineProvider } from './CartLineProvider.client';
2
- export { useCartLine } from '../../hooks/useCartLine';
1
+ export { CartLineProvider } from './CartLineProvider.client.js';
2
+ export { useCartLine } from '../../hooks/useCartLine/index.js';
@@ -1,2 +1,2 @@
1
- export { CartLineProvider } from './CartLineProvider.client';
2
- export { useCartLine } from '../../hooks/useCartLine';
1
+ export { CartLineProvider } from './CartLineProvider.client.js';
2
+ export { useCartLine } from '../../hooks/useCartLine/index.js';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useCartLine } from '../CartLineProvider';
2
+ import { useCartLine } from '../CartLineProvider/index.js';
3
3
  /**
4
4
  * The `CartLineQuantity` component renders a `span` element (or the type of HTML element
5
5
  * specified by the `as` prop) with the cart line's quantity. It must be a descendent of a `CartLineProvider` component.
@@ -1 +1 @@
1
- export { CartLineQuantity } from './CartLineQuantity.client';
1
+ export { CartLineQuantity } from './CartLineQuantity.client.js';
@@ -1 +1 @@
1
- export { CartLineQuantity } from './CartLineQuantity.client';
1
+ export { CartLineQuantity } from './CartLineQuantity.client.js';
@@ -1,13 +1,12 @@
1
- import { ElementType } from 'react';
2
- import { Props } from '../types';
3
- import { BaseButtonProps } from '../BaseButton';
4
- declare type PropsWeControl = 'adjust';
1
+ import React from 'react';
2
+ import { BaseButtonProps } from '../BaseButton/index.js';
3
+ interface CartLineQuantityAdjustButtonProps {
4
+ /** The adjustment for a cart line's quantity. Valid values: `increase` (default), `decrease`, or `remove`. */
5
+ adjust?: 'increase' | 'decrease' | 'remove';
6
+ }
5
7
  /**
6
8
  * The `CartLineQuantityAdjustButton` component renders a button that adjusts the cart line's quantity when pressed.
7
9
  * It must be a descendent of a `CartLineProvider` component.
8
10
  */
9
- export declare function CartLineQuantityAdjustButton<TTag extends ElementType = 'button'>(props: Props<TTag, PropsWeControl> & {
10
- /** The adjustment for a cart line's quantity. Valid values: `increase` (default), `decrease`, or `remove`. */
11
- adjust?: 'increase' | 'decrease' | 'remove';
12
- } & BaseButtonProps): JSX.Element;
11
+ export declare function CartLineQuantityAdjustButton<AsType extends React.ElementType = 'button'>(props: CartLineQuantityAdjustButtonProps & BaseButtonProps<AsType>): JSX.Element;
13
12
  export {};
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback } from 'react';
2
- import { useCart } from '../CartProvider';
3
- import { useCartLine } from '../CartLineProvider';
4
- import { BaseButton } from '../BaseButton';
2
+ import { useCart } from '../CartProvider/index.js';
3
+ import { useCartLine } from '../CartLineProvider/index.js';
4
+ import { BaseButton } from '../BaseButton/index.js';
5
5
  /**
6
6
  * The `CartLineQuantityAdjustButton` component renders a button that adjusts the cart line's quantity when pressed.
7
7
  * It must be a descendent of a `CartLineProvider` component.
@@ -1 +1 @@
1
- export { CartLineQuantityAdjustButton } from './CartLineQuantityAdjustButton';
1
+ export { CartLineQuantityAdjustButton } from './CartLineQuantityAdjustButton.js';
@@ -1 +1 @@
1
- export { CartLineQuantityAdjustButton } from './CartLineQuantityAdjustButton';
1
+ export { CartLineQuantityAdjustButton } from './CartLineQuantityAdjustButton.js';
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, ElementType } from 'react';
2
- import { Props } from '../types';
2
+ import { Props } from '../types.js';
3
3
  export interface CartLinesProps {
4
4
  /** A `ReactNode` element. Valid values: `ul` or `undefined`. If `ul`, then each child will
5
5
  * be wrapped with a `li` element.
@@ -1,6 +1,6 @@
1
1
  import React, { Fragment } from 'react';
2
- import { useCart } from '../CartProvider';
3
- import { CartLineProvider } from '../CartLineProvider';
2
+ import { useCart } from '../CartProvider/index.js';
3
+ import { CartLineProvider } from '../CartLineProvider/index.js';
4
4
  /**
5
5
  * The `CartLines` component iterates over each cart line and renders its `children` within
6
6
  * a `CartLineProvider` for each cart line.
@@ -1 +1 @@
1
- export { CartLines } from './CartLines.client';
1
+ export { CartLines } from './CartLines.client.js';
@@ -1 +1 @@
1
- export { CartLines } from './CartLines.client';
1
+ export { CartLines } from './CartLines.client.js';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { CartBuyerIdentityInput, CountryCode } from '../../storefront-api-types';
3
- import { CartFragmentFragment } from './graphql/CartFragment';
2
+ import { CartBuyerIdentityInput, CountryCode } from '../../storefront-api-types.js';
3
+ import { CartFragmentFragment } from './graphql/CartFragment.js';
4
4
  /**
5
5
  * The `CartProvider` component creates a context for using a cart. It creates a cart object and callbacks
6
6
  * that can be accessed by any descendent component using the `useCart` hook and related hooks. It also carries out
@@ -1,11 +1,11 @@
1
1
  import React, { useEffect, useCallback, useReducer, useMemo, useRef, } from 'react';
2
- import { flattenConnection } from '../../utilities/flattenConnection';
3
- import { CartLineAdd, CartCreate, CartLineRemove, CartLineUpdate, CartNoteUpdate, CartBuyerIdentityUpdate, CartAttributesUpdate, CartDiscountCodesUpdate, CartQuery, defaultCartFragment, } from './cart-queries';
4
- import { CountryCode, } from '../../storefront-api-types';
5
- import { useCartFetch } from './hooks.client';
6
- import { CartContext } from './context';
7
- import { CART_ID_STORAGE_KEY } from './constants';
8
- import { ClientAnalytics } from '../../foundation/Analytics/ClientAnalytics';
2
+ import { flattenConnection } from '../../utilities/flattenConnection/index.js';
3
+ import { CartLineAdd, CartCreate, CartLineRemove, CartLineUpdate, CartNoteUpdate, CartBuyerIdentityUpdate, CartAttributesUpdate, CartDiscountCodesUpdate, CartQuery, defaultCartFragment, } from './cart-queries.js';
4
+ import { CountryCode, } from '../../storefront-api-types.js';
5
+ import { useCartFetch } from './hooks.client.js';
6
+ import { CartContext } from './context.js';
7
+ import { CART_ID_STORAGE_KEY } from './constants.js';
8
+ import { ClientAnalytics } from '../../foundation/Analytics/ClientAnalytics.js';
9
9
  function cartReducer(state, action) {
10
10
  switch (action.type) {
11
11
  case 'cartFetch': {
@@ -219,6 +219,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
219
219
  ClientAnalytics.publish(ClientAnalytics.eventNames.ADD_TO_CART, true, {
220
220
  addedCartLines: cart.lines,
221
221
  cart: data.cartCreate.cart,
222
+ prevCart: null,
222
223
  });
223
224
  }
224
225
  dispatch({
@@ -258,6 +259,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
258
259
  ClientAnalytics.publish(ClientAnalytics.eventNames.ADD_TO_CART, true, {
259
260
  addedCartLines: lines,
260
261
  cart: data.cartLinesAdd.cart,
262
+ prevCart: state.cart,
261
263
  });
262
264
  dispatch({
263
265
  type: 'resolve',
@@ -289,6 +291,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
289
291
  ClientAnalytics.publish(ClientAnalytics.eventNames.REMOVE_FROM_CART, true, {
290
292
  removedCartLines: lines,
291
293
  cart: data.cartLinesRemove.cart,
294
+ prevCart: state.cart,
292
295
  });
293
296
  dispatch({
294
297
  type: 'resolve',
@@ -320,6 +323,8 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
320
323
  ClientAnalytics.publish(ClientAnalytics.eventNames.UPDATE_CART, true, {
321
324
  updatedCartLines: lines,
322
325
  oldCart: state.cart,
326
+ cart: data.cartLinesUpdate.cart,
327
+ prevCart: state.cart,
323
328
  });
324
329
  dispatch({
325
330
  type: 'resolve',
@@ -432,6 +437,7 @@ export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLi
432
437
  ClientAnalytics.publish(ClientAnalytics.eventNames.DISCOUNT_CODE_UPDATED, true, {
433
438
  updatedDiscountCodes: discountCodes,
434
439
  cart: data.cartDiscountCodesUpdate.cart,
440
+ prevCart: state.cart,
435
441
  });
436
442
  dispatch({
437
443
  type: 'resolve',