@shopify/hydrogen 0.12.0 → 0.13.2

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 (264) hide show
  1. package/CHANGELOG.md +331 -27
  2. package/dist/esnext/client.d.ts +2 -0
  3. package/dist/esnext/client.js +2 -0
  4. package/dist/esnext/components/CartLineProvider/context.d.ts +10 -10
  5. package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +1 -1
  6. package/dist/esnext/components/CartProvider/CartProvider.client.js +2 -1
  7. package/dist/esnext/components/CartProvider/cart-queries.d.ts +9 -0
  8. package/dist/esnext/components/CartProvider/cart-queries.js +876 -0
  9. package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +1 -1
  10. package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +1 -1
  11. package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +1 -1
  12. package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +1 -1
  13. package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +1 -1
  14. package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +1 -1
  15. package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +1 -1
  16. package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +1 -1
  17. package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +1 -1
  18. package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +1 -1
  19. package/dist/esnext/components/CartProvider/hooks.d.ts +1 -1
  20. package/dist/esnext/components/CartProvider/hooks.js +4 -1
  21. package/dist/esnext/components/CartProvider/types.d.ts +1 -1
  22. package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +6 -5
  23. package/dist/esnext/components/ExternalVideo/ExternalVideo.js +5 -2
  24. package/dist/esnext/components/Image/Image.d.ts +14 -12
  25. package/dist/esnext/components/Image/Image.js +17 -14
  26. package/dist/esnext/components/Link/Link.client.d.ts +4 -5
  27. package/dist/esnext/components/Link/Link.client.js +5 -4
  28. package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -3
  29. package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +0 -1
  30. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +2 -2
  31. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +15 -4
  32. package/dist/esnext/components/LocalizationProvider/LocalizationQuery.d.ts +1 -8
  33. package/dist/esnext/components/LocalizationProvider/index.d.ts +0 -1
  34. package/dist/esnext/components/LocalizationProvider/index.js +0 -1
  35. package/dist/esnext/components/MediaFile/MediaFile.d.ts +4 -3
  36. package/dist/esnext/components/Metafield/Metafield.client.d.ts +2 -2
  37. package/dist/esnext/components/Metafield/Metafield.client.js +8 -5
  38. package/dist/esnext/components/Metafield/types.d.ts +1 -1
  39. package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +57 -56
  40. package/dist/esnext/components/ModelViewer/ModelViewer.client.js +10 -4
  41. package/dist/esnext/components/Money/Money.client.d.ts +5 -4
  42. package/dist/esnext/components/Money/Money.client.js +1 -1
  43. package/dist/esnext/components/ProductDescription/ProductDescription.client.d.ts +9 -4
  44. package/dist/esnext/components/ProductDescription/ProductDescription.client.js +4 -3
  45. package/dist/esnext/components/ProductMetafield/ProductMetafield.client.js +3 -3
  46. package/dist/esnext/components/ProductPrice/ProductPrice.client.js +2 -2
  47. package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +3 -2
  48. package/dist/esnext/components/ProductProvider/ProductProvider.client.js +1 -0
  49. package/dist/esnext/components/ProductProvider/context.d.ts +23 -14
  50. package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +3 -2
  51. package/dist/esnext/components/Seo/CollectionSeo.client.js +2 -2
  52. package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +3 -2
  53. package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +2 -2
  54. package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
  55. package/dist/esnext/components/Seo/ImageSeo.client.d.ts +3 -2
  56. package/dist/esnext/components/Seo/ImageSeo.client.js +1 -1
  57. package/dist/esnext/components/Seo/PageSeo.client.d.ts +3 -2
  58. package/dist/esnext/components/Seo/ProductSeo.client.d.ts +3 -3
  59. package/dist/esnext/components/Seo/ProductSeo.client.js +10 -5
  60. package/dist/esnext/components/Seo/Seo.client.d.ts +10 -7
  61. package/dist/esnext/components/Seo/TitleSeo.client.d.ts +3 -4
  62. package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +1 -1
  63. package/dist/esnext/components/Seo/seo-types.d.ts +17 -0
  64. package/dist/esnext/components/{ExternalVideo/ExternalVideoFragment.js → Seo/seo-types.js} +0 -0
  65. package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +7 -6
  66. package/dist/esnext/components/UnitPrice/UnitPrice.client.js +1 -1
  67. package/dist/esnext/components/Video/Video.d.ts +5 -4
  68. package/dist/esnext/components/Video/Video.js +10 -2
  69. package/dist/esnext/components/index.d.ts +0 -3
  70. package/dist/esnext/components/index.js +0 -3
  71. package/dist/esnext/entry-client.js +9 -4
  72. package/dist/esnext/entry-server.d.ts +1 -0
  73. package/dist/esnext/entry-server.js +101 -88
  74. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +22 -0
  75. package/dist/esnext/foundation/{Router/FileRoutes.js → FileRoutes/FileRoutes.server.js} +20 -10
  76. package/dist/esnext/foundation/Redirect/Redirect.client.d.ts +5 -0
  77. package/dist/esnext/foundation/Redirect/Redirect.client.js +14 -0
  78. package/dist/esnext/foundation/Route/Route.server.d.ts +12 -0
  79. package/dist/esnext/foundation/Route/Route.server.js +33 -0
  80. package/dist/esnext/foundation/Router/{Router.d.ts → BrowserRouter.client.d.ts} +3 -2
  81. package/dist/esnext/foundation/Router/{Router.js → BrowserRouter.client.js} +7 -5
  82. package/dist/esnext/foundation/Router/Router.server.d.ts +5 -3
  83. package/dist/esnext/foundation/Router/Router.server.js +7 -22
  84. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +19 -24
  85. package/dist/esnext/foundation/ShopifyProvider/index.d.ts +0 -1
  86. package/dist/esnext/foundation/ShopifyProvider/index.js +0 -1
  87. package/dist/esnext/foundation/index.d.ts +0 -1
  88. package/dist/esnext/foundation/index.js +0 -1
  89. package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.d.ts +6 -3
  90. package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.js +4 -1
  91. package/dist/esnext/foundation/useQuery/hooks.d.ts +5 -4
  92. package/dist/esnext/foundation/useQuery/hooks.js +13 -4
  93. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +9 -0
  94. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +7 -0
  95. package/dist/esnext/foundation/useRouteParams/useRouteParams.d.ts +4 -0
  96. package/dist/esnext/foundation/useRouteParams/useRouteParams.js +9 -0
  97. package/dist/esnext/foundation/useUrl/useUrl.js +1 -1
  98. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
  99. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +28 -7
  100. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
  101. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +5 -0
  102. package/dist/esnext/framework/cache/in-memory.d.ts +1 -0
  103. package/dist/esnext/framework/cache/in-memory.js +15 -5
  104. package/dist/esnext/framework/middleware.js +25 -3
  105. package/dist/esnext/framework/plugin.js +6 -1
  106. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
  107. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +28 -0
  108. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +61 -75
  109. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +1 -1
  110. package/dist/esnext/hooks/index.d.ts +0 -1
  111. package/dist/esnext/hooks/index.js +0 -1
  112. package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +10 -10
  113. package/dist/esnext/hooks/useCountry/useCountry.d.ts +4 -4
  114. package/dist/esnext/hooks/useMoney/hooks.d.ts +3 -3
  115. package/dist/esnext/hooks/useMoney/hooks.js +2 -2
  116. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +17 -2
  117. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.js +7 -3
  118. package/dist/esnext/hooks/useProduct/useProduct.d.ts +34 -96
  119. package/dist/esnext/hooks/useProductOptions/helpers.d.ts +6 -4
  120. package/dist/esnext/hooks/useProductOptions/helpers.js +13 -6
  121. package/dist/esnext/hooks/useProductOptions/types.d.ts +15 -35
  122. package/dist/esnext/hooks/useProductOptions/useProductOptions.d.ts +6 -5
  123. package/dist/esnext/hooks/useProductOptions/useProductOptions.js +13 -3
  124. package/dist/esnext/hooks/useShopQuery/hooks.js +68 -15
  125. package/dist/esnext/index.d.ts +7 -5
  126. package/dist/esnext/index.js +7 -5
  127. package/dist/esnext/platforms/node.d.ts +2 -3
  128. package/dist/esnext/platforms/node.js +5 -3
  129. package/dist/esnext/platforms/worker-event.d.ts +0 -8
  130. package/dist/esnext/platforms/worker-event.js +2 -23
  131. package/dist/esnext/platforms/worker.d.ts +14 -0
  132. package/dist/esnext/platforms/worker.js +25 -0
  133. package/dist/esnext/{graphql/types/types.d.ts → storefront-api-types.d.ts} +389 -32
  134. package/dist/esnext/{graphql/types/types.js → storefront-api-types.js} +326 -30
  135. package/dist/esnext/streaming.server.d.ts +9 -5
  136. package/dist/esnext/streaming.server.js +2 -18
  137. package/dist/esnext/types.d.ts +1 -16
  138. package/dist/esnext/utilities/apiRoutes.d.ts +5 -1
  139. package/dist/esnext/utilities/apiRoutes.js +5 -4
  140. package/dist/esnext/utilities/devtools.d.ts +11 -0
  141. package/dist/esnext/utilities/devtools.js +11 -0
  142. package/dist/esnext/utilities/fetch.d.ts +7 -1
  143. package/dist/esnext/utilities/fetch.js +9 -10
  144. package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +3 -2
  145. package/dist/esnext/utilities/flattenConnection/flattenConnection.js +6 -2
  146. package/dist/esnext/utilities/graphql-tracker.d.ts +17 -0
  147. package/dist/esnext/utilities/graphql-tracker.js +119 -0
  148. package/dist/esnext/utilities/image_size.d.ts +5 -4
  149. package/dist/esnext/utilities/log/log-query-timeline.d.ts +1 -1
  150. package/dist/esnext/utilities/log/log-query-timeline.js +1 -2
  151. package/dist/esnext/utilities/log/log.d.ts +1 -0
  152. package/dist/esnext/utilities/log/utils.js +3 -0
  153. package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.d.ts +3 -2
  154. package/dist/esnext/version.d.ts +1 -1
  155. package/dist/esnext/version.js +1 -1
  156. package/dist/node/entry-server.d.ts +1 -0
  157. package/dist/node/entry-server.js +106 -89
  158. package/dist/node/foundation/Redirect/Redirect.client.d.ts +5 -0
  159. package/dist/node/foundation/Redirect/Redirect.client.js +17 -0
  160. package/dist/node/foundation/Router/BrowserRouter.client.d.ts +13 -0
  161. package/dist/node/foundation/Router/BrowserRouter.client.js +77 -0
  162. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +24 -25
  163. package/dist/node/foundation/ServerRequestProvider/index.js +5 -1
  164. package/dist/node/foundation/ServerStateProvider/ServerStateProvider.js +5 -1
  165. package/dist/node/foundation/ssr-interop.d.ts +29 -0
  166. package/dist/node/foundation/ssr-interop.js +39 -0
  167. package/dist/node/foundation/useNavigate/useNavigate.d.ts +13 -0
  168. package/dist/node/foundation/useNavigate/useNavigate.js +18 -0
  169. package/dist/node/foundation/useServerState/index.d.ts +1 -0
  170. package/dist/node/foundation/useServerState/index.js +5 -0
  171. package/dist/node/foundation/useServerState/use-server-state.d.ts +16 -0
  172. package/dist/node/foundation/useServerState/use-server-state.js +24 -0
  173. package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
  174. package/dist/node/framework/Hydration/ServerComponentRequest.server.js +28 -7
  175. package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
  176. package/dist/node/framework/Hydration/ServerComponentResponse.server.js +8 -0
  177. package/dist/node/framework/cache/in-memory.d.ts +1 -0
  178. package/dist/node/framework/cache/in-memory.js +15 -5
  179. package/dist/node/framework/middleware.js +30 -4
  180. package/dist/node/framework/plugin.js +11 -2
  181. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
  182. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +31 -0
  183. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +61 -75
  184. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +1 -1
  185. package/dist/node/{graphql/types/types.d.ts → storefront-api-types.d.ts} +389 -32
  186. package/dist/node/{graphql/types/types.js → storefront-api-types.js} +327 -31
  187. package/dist/node/streaming.server.d.ts +9 -5
  188. package/dist/node/streaming.server.js +2 -18
  189. package/dist/node/types.d.ts +1 -16
  190. package/dist/node/utilities/apiRoutes.d.ts +5 -1
  191. package/dist/node/utilities/apiRoutes.js +5 -4
  192. package/dist/node/utilities/fetch.d.ts +7 -1
  193. package/dist/node/utilities/fetch.js +9 -10
  194. package/dist/node/utilities/log/log-query-timeline.d.ts +1 -1
  195. package/dist/node/utilities/log/log-query-timeline.js +1 -2
  196. package/dist/node/utilities/log/log.d.ts +1 -0
  197. package/dist/node/utilities/log/utils.js +3 -0
  198. package/dist/node/utilities/web-api-polyfill.js +5 -1
  199. package/dist/node/version.d.ts +1 -1
  200. package/dist/node/version.js +1 -1
  201. package/package.json +9 -12
  202. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +43 -104
  203. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +1566 -848
  204. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +36 -421
  205. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +1523 -864
  206. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +35 -437
  207. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +507 -517
  208. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +10 -246
  209. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +16 -23
  210. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +47 -108
  211. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +1033 -306
  212. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +965 -293
  213. package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +98 -108
  214. package/vendor/react-server-dom-vite/package.json +0 -2
  215. package/dist/esnext/components/ExternalVideo/ExternalVideoFragment.d.ts +0 -8
  216. package/dist/esnext/components/Image/ImageFragment.d.ts +0 -8
  217. package/dist/esnext/components/Image/ImageFragment.js +0 -1
  218. package/dist/esnext/components/MediaFile/MediaFileFragment.d.ts +0 -36
  219. package/dist/esnext/components/MediaFile/MediaFileFragment.js +0 -1
  220. package/dist/esnext/components/Metafield/MetafieldFragment.d.ts +0 -22
  221. package/dist/esnext/components/Metafield/MetafieldFragment.js +0 -1
  222. package/dist/esnext/components/ModelViewer/Model3DFragment.d.ts +0 -15
  223. package/dist/esnext/components/ModelViewer/Model3DFragment.js +0 -1
  224. package/dist/esnext/components/Money/MoneyFragment.d.ts +0 -8
  225. package/dist/esnext/components/Money/MoneyFragment.js +0 -1
  226. package/dist/esnext/components/ProductProvider/ProductProviderFragment.d.ts +0 -247
  227. package/dist/esnext/components/ProductProvider/ProductProviderFragment.js +0 -1
  228. package/dist/esnext/components/ProductProvider/types.d.ts +0 -19
  229. package/dist/esnext/components/ProductProvider/types.js +0 -1
  230. package/dist/esnext/components/RawHtml/RawHtml.d.ts +0 -17
  231. package/dist/esnext/components/RawHtml/RawHtml.js +0 -21
  232. package/dist/esnext/components/RawHtml/index.d.ts +0 -1
  233. package/dist/esnext/components/RawHtml/index.js +0 -1
  234. package/dist/esnext/components/Seo/SeoFragment.d.ts +0 -66
  235. package/dist/esnext/components/Seo/SeoFragment.js +0 -1
  236. package/dist/esnext/components/Seo/types.d.ts +0 -15
  237. package/dist/esnext/components/Seo/types.js +0 -1
  238. package/dist/esnext/components/UnitPrice/UnitPriceFragment.d.ts +0 -15
  239. package/dist/esnext/components/UnitPrice/UnitPriceFragment.js +0 -1
  240. package/dist/esnext/components/Video/VideoFragment.d.ts +0 -15
  241. package/dist/esnext/components/Video/VideoFragment.js +0 -1
  242. package/dist/esnext/foundation/Router/FileRoutes.d.ts +0 -18
  243. package/dist/esnext/foundation/Router/Route.server.d.ts +0 -9
  244. package/dist/esnext/foundation/Router/Route.server.js +0 -6
  245. package/dist/esnext/foundation/Router/useParams.d.ts +0 -1
  246. package/dist/esnext/foundation/Router/useParams.js +0 -5
  247. package/dist/esnext/fragments.d.ts +0 -20
  248. package/dist/esnext/fragments.js +0 -10
  249. package/dist/esnext/graphql/graphql-constants.d.ts +0 -1756
  250. package/dist/esnext/graphql/graphql-constants.js +0 -3447
  251. package/dist/esnext/hooks/useAvailableCountries/index.d.ts +0 -1
  252. package/dist/esnext/hooks/useAvailableCountries/index.js +0 -1
  253. package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.d.ts +0 -11
  254. package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.js +0 -17
  255. package/dist/esnext/hooks/useNavigate/index.d.ts +0 -1
  256. package/dist/esnext/hooks/useNavigate/index.js +0 -1
  257. package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.d.ts +0 -31
  258. package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.js +0 -1
  259. package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.d.ts +0 -46
  260. package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.js +0 -1
  261. package/dist/esnext/hooks/useProductOptions/VariantFragment.d.ts +0 -106
  262. package/dist/esnext/hooks/useProductOptions/VariantFragment.js +0 -1
  263. package/fragments.d.ts +0 -1
  264. package/fragments.js +0 -1
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartAttributesUpdateMutationVariables = Types.Exact<{
7
7
  attributes: Array<Types.AttributeInput> | Types.AttributeInput;
8
8
  cartId: Types.Scalars['ID'];
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartBuyerIdentityUpdateMutationVariables = Types.Exact<{
7
7
  cartId: Types.Scalars['ID'];
8
8
  buyerIdentity: Types.CartBuyerIdentityInput;
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartCreateMutationVariables = Types.Exact<{
7
7
  input: Types.CartInput;
8
8
  numCartLines?: Types.InputMaybe<Types.Scalars['Int']>;
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartDiscountCodesUpdateMutationVariables = Types.Exact<{
7
7
  cartId: Types.Scalars['ID'];
8
8
  discountCodes?: Types.InputMaybe<Array<Types.Scalars['String']> | Types.Scalars['String']>;
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartFragmentFragment = {
7
7
  __typename?: 'Cart';
8
8
  } & Pick<Types.Cart, 'id' | 'checkoutUrl' | 'note'> & {
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartLineAddMutationVariables = Types.Exact<{
7
7
  cartId: Types.Scalars['ID'];
8
8
  lines: Array<Types.CartLineInput> | Types.CartLineInput;
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartLineRemoveMutationVariables = Types.Exact<{
7
7
  cartId: Types.Scalars['ID'];
8
8
  lines: Array<Types.Scalars['ID']> | Types.Scalars['ID'];
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartLineUpdateMutationVariables = Types.Exact<{
7
7
  cartId: Types.Scalars['ID'];
8
8
  lines: Array<Types.CartLineUpdateInput> | Types.CartLineUpdateInput;
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartNoteUpdateMutationVariables = Types.Exact<{
7
7
  cartId: Types.Scalars['ID'];
8
8
  note?: Types.InputMaybe<Types.Scalars['String']>;
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../../graphql/types/types';
5
+ import * as Types from '../../../storefront-api-types';
6
6
  export declare type CartQueryQueryVariables = Types.Exact<{
7
7
  id: Types.Scalars['ID'];
8
8
  numCartLines?: Types.InputMaybe<Types.Scalars['Int']>;
@@ -1,4 +1,4 @@
1
- import { CartInput } from '../../graphql/types/types';
1
+ import { CartInput } from '../../storefront-api-types';
2
2
  import { Cart } from './types';
3
3
  export declare function useCartFetch(): <T, K>({ query, variables, }: {
4
4
  query: string;
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { useShop } from '../../foundation';
3
3
  import { flattenConnection } from '../../utilities';
4
- import { CartCreate } from '../../graphql/graphql-constants';
4
+ import { CartCreate } from './cart-queries';
5
5
  export function useCartFetch() {
6
6
  const { storeDomain, storefrontApiVersion, storefrontToken } = useShop();
7
7
  return React.useCallback(({ query, variables, }) => {
@@ -9,6 +9,8 @@ export function useCartFetch() {
9
9
  method: 'POST',
10
10
  headers: {
11
11
  'Content-Type': 'application/json',
12
+ 'X-SDK-Variant': 'hydrogen',
13
+ 'X-SDK-Version': storefrontApiVersion,
12
14
  'X-Shopify-Storefront-Access-Token': storefrontToken,
13
15
  },
14
16
  body: JSON.stringify({
@@ -47,6 +49,7 @@ export function useInstantCheckout() {
47
49
  const dataCart = data.cartCreate.cart;
48
50
  updateCart({
49
51
  ...dataCart,
52
+ // @ts-expect-error While the cart still uses fragments, there will be a TS error here until we remove those fragments and get the type in-line
50
53
  lines: flattenConnection(dataCart.lines),
51
54
  note: (_b = dataCart.note) !== null && _b !== void 0 ? _b : undefined,
52
55
  });
@@ -1,4 +1,4 @@
1
- import { CartInput, CartLineInput, CartLineUpdateInput, MutationCartNoteUpdateArgs, CartBuyerIdentityInput, MutationCartAttributesUpdateArgs } from '../../graphql/types/types';
1
+ import { CartInput, CartLineInput, CartLineUpdateInput, MutationCartNoteUpdateArgs, CartBuyerIdentityInput, MutationCartAttributesUpdateArgs } from '../../storefront-api-types';
2
2
  import { CartFragmentFragment } from './graphql/CartFragment';
3
3
  export declare type Status = State['status'];
4
4
  export interface Cart {
@@ -1,10 +1,11 @@
1
1
  import { YouTube, Vimeo } from '../../utilities';
2
- import type { ExternalVideoFragmentFragment } from './ExternalVideoFragment';
2
+ import type { ExternalVideo as ExternalVideoType } from '../../storefront-api-types';
3
+ import type { PartialDeep } from 'type-fest';
3
4
  interface ExternalVideoProps {
4
- /** An object with the keys `host`, `embedUrl`, and `id`. Refer to the Storefront API's
5
- * [`ExternalVideo` type](/api/storefront/reference/products/externalvideo).
5
+ /**
6
+ * An object with fields that correspond to the Storefront API's [ExternalVideo object](/api/storefront/reference/products/externalvideo).
6
7
  */
7
- data: ExternalVideoFragmentFragment;
8
+ data: PartialDeep<ExternalVideoType>;
8
9
  /** An object containing the options available for either
9
10
  * [YouTube](https://developers.google.com/youtube/player_parameters#Parameters) or
10
11
  * [Vimeo](https://vimeo.zendesk.com/hc/en-us/articles/360001494447-Using-Player-Parameters).
@@ -14,7 +15,7 @@ interface ExternalVideoProps {
14
15
  declare type PropsWeControl = 'src';
15
16
  /**
16
17
  * The `ExternalVideo` component renders an embedded video for the Storefront
17
- * API's [`ExternalVideo` object](/api/storefront/reference/products/externalvideo).
18
+ * API's [ExternalVideo object](/api/storefront/reference/products/externalvideo).
18
19
  */
19
20
  export declare function ExternalVideo(props: Omit<JSX.IntrinsicElements['iframe'], PropsWeControl> & ExternalVideoProps): JSX.Element;
20
21
  export {};
@@ -2,10 +2,13 @@ import React from 'react';
2
2
  import { useEmbeddedVideoUrl } from '../../utilities';
3
3
  /**
4
4
  * The `ExternalVideo` component renders an embedded video for the Storefront
5
- * API's [`ExternalVideo` object](/api/storefront/reference/products/externalvideo).
5
+ * API's [ExternalVideo object](/api/storefront/reference/products/externalvideo).
6
6
  */
7
7
  export function ExternalVideo(props) {
8
8
  const { data, options, id = data.id, frameBorder = '0', allow = 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture', allowFullScreen = true, ...passthroughProps } = props;
9
+ if (!data.embedUrl) {
10
+ throw new Error(`<ExternalVideo/> requires the 'embedUrl' property`);
11
+ }
9
12
  const url = useEmbeddedVideoUrl(data.embedUrl, options);
10
- return (React.createElement("iframe", { ...passthroughProps, id: id, frameBorder: frameBorder, allow: allow, allowFullScreen: allowFullScreen, src: url }));
13
+ return (React.createElement("iframe", { ...passthroughProps, id: id !== null && id !== void 0 ? id : data.embedUrl, frameBorder: frameBorder, allow: allow, allowFullScreen: allowFullScreen, src: url }));
11
14
  }
@@ -1,26 +1,26 @@
1
1
  import React from 'react';
2
- import { Props } from '../types';
3
2
  import { ImageSizeOptions, ImageLoaderOptions } from '../../utilities';
4
- import type { ImageFragmentFragment } from './ImageFragment';
3
+ import type { Image as ImageType } from '../../storefront-api-types';
4
+ import type { PartialDeep, Merge, MergeExclusive } from 'type-fest';
5
5
  export interface BaseImageProps {
6
6
  /** A custom function that generates the image URL. Parameters passed into this function includes
7
7
  * `src` and an `options` object that contains the provided `width`, `height` and `loaderOptions` values.
8
8
  */
9
9
  loader?(props: ImageLoaderOptions): string;
10
10
  /** An object of `loader` function options. For example, if the `loader` function requires a `scale` option,
11
- * then the value can be a property of the `loaderOptions` object (eg. `{scale: 2}`).
11
+ * then the value can be a property of the `loaderOptions` object (for example, `{scale: 2}`).
12
12
  */
13
13
  loaderOptions?: ImageLoaderOptions['options'];
14
14
  }
15
- interface MediaImageProps extends BaseImageProps {
16
- /** An object with the keys `url`, `altText`, `id`, `width` and `height`. Refer to the
17
- * Storefront API's [`Image` object](/api/storefront/reference/common-objects/image).
15
+ interface MediaImagePropsBase extends BaseImageProps {
16
+ /** An object with fields that correspond to the Storefront API's
17
+ * [Image object](/api/storefront/reference/common-objects/image).
18
18
  */
19
- data: ImageFragmentFragment;
19
+ data: PartialDeep<ImageType>;
20
20
  /** An object of image size options for Shopify CDN images. */
21
21
  options?: ImageSizeOptions;
22
22
  }
23
- interface ExternalImageProps extends BaseImageProps {
23
+ interface ExternalImagePropsBase extends BaseImageProps {
24
24
  /** A URL string. This string can be an absolute path or a relative path depending on the `loader`. */
25
25
  src: string;
26
26
  /** The integer value for the width of the image. This is a required prop when `src` is present. */
@@ -28,11 +28,13 @@ interface ExternalImageProps extends BaseImageProps {
28
28
  /** The integer value for the height of the image. This is a required prop when `src` is present. */
29
29
  height: number;
30
30
  }
31
- declare type ImageProps = MediaImageProps | ExternalImageProps;
32
- declare type PropsWeControl = 'src' | 'width' | 'height';
31
+ declare type BaseElementProps = React.ImgHTMLAttributes<HTMLImageElement>;
32
+ declare type MediaImageProps = Merge<BaseElementProps, MediaImagePropsBase>;
33
+ declare type ExternalImageProps = Merge<BaseElementProps, ExternalImagePropsBase>;
34
+ declare type ImageProps = MergeExclusive<MediaImageProps, ExternalImageProps>;
33
35
  /**
34
36
  * The `Image` component renders an image for the Storefront API's
35
- * [`Image` object](/api/storefront/reference/common-objects/image).
37
+ * [Image object](/api/storefront/reference/common-objects/image).
36
38
  */
37
- export declare function Image<TTag extends React.ElementType = 'img'>(props: Props<TTag, PropsWeControl> & ImageProps): JSX.Element;
39
+ export declare function Image(props: ImageProps): JSX.Element;
38
40
  export {};
@@ -1,21 +1,8 @@
1
1
  import React from 'react';
2
2
  import { shopifyImageLoader, getShopifyImageDimensions, } from '../../utilities';
3
- function convertShopifyImageData({ data, options, loader, loaderOptions, id: propId, alt, }) {
4
- const { url: src, altText, id } = data;
5
- const { width, height } = getShopifyImageDimensions(data, options);
6
- return {
7
- src,
8
- id: propId ? propId : id,
9
- alt: alt ? alt : altText,
10
- width,
11
- height,
12
- loader: loader ? loader : shopifyImageLoader,
13
- loaderOptions: { ...options, ...loaderOptions },
14
- };
15
- }
16
3
  /**
17
4
  * The `Image` component renders an image for the Storefront API's
18
- * [`Image` object](/api/storefront/reference/common-objects/image).
5
+ * [Image object](/api/storefront/reference/common-objects/image).
19
6
  */
20
7
  export function Image(props) {
21
8
  var _a, _b, _c, _d;
@@ -49,3 +36,19 @@ export function Image(props) {
49
36
  : imgProps.src;
50
37
  return (React.createElement("img", { id: (_a = imgProps.id) !== null && _a !== void 0 ? _a : '', loading: "lazy", alt: (_b = imgProps.alt) !== null && _b !== void 0 ? _b : '', ...passthroughProps, src: srcPath, width: (_c = imgProps.width) !== null && _c !== void 0 ? _c : undefined, height: (_d = imgProps.height) !== null && _d !== void 0 ? _d : undefined }));
51
38
  }
39
+ function convertShopifyImageData({ data, options, loader, loaderOptions, id: propId, alt, }) {
40
+ const { url: src, altText, id } = data;
41
+ if (!src) {
42
+ throw new Error(`<Image/> requires 'data.url' when using the 'data' prop`);
43
+ }
44
+ const { width, height } = getShopifyImageDimensions(data, options);
45
+ return {
46
+ src,
47
+ id: propId ? propId : id,
48
+ alt: alt ? alt : altText,
49
+ width,
50
+ height,
51
+ loader: loader ? loader : shopifyImageLoader,
52
+ loaderOptions: { ...options, ...loaderOptions },
53
+ };
54
+ }
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
- export interface LinkProps
3
- /** All properties available to an `<a>` element are available. See [anchor element documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes).*/
4
- extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
2
+ export interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
5
3
  /** The destination URL that the link points to. This is the `href` attribute of the underlying `<a>` element. */
6
4
  to: string;
7
5
  /** Whether to update the state object or URL of the current history entry. Refer to the [history.replaceState documentation](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState). */
@@ -12,7 +10,8 @@ export interface LinkProps
12
10
  reloadDocument?: boolean;
13
11
  }
14
12
  /**
15
- * The `Link` component lets users navigate from one page to another.
16
- * It renders an accessible `<a>` element.
13
+ * The `Link` component is used to navigate between routes. Because it renders an underlying `<a>` element, all
14
+ * properties available to the `<a>` element are also available to the `Link` component.
15
+ * For more information, refer to the [`<a>` element documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes).
17
16
  */
18
17
  export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
@@ -1,10 +1,11 @@
1
1
  import React, { useCallback } from 'react';
2
- import { useRouter } from '../../foundation/Router/Router';
2
+ import { useRouter } from '../../foundation/Router/BrowserRouter.client';
3
3
  import { createPath } from 'history';
4
- import { useNavigate } from '../../hooks/useNavigate';
4
+ import { useNavigate } from '../../foundation/useNavigate/useNavigate';
5
5
  /**
6
- * The `Link` component lets users navigate from one page to another.
7
- * It renders an accessible `<a>` element.
6
+ * The `Link` component is used to navigate between routes. Because it renders an underlying `<a>` element, all
7
+ * properties available to the `<a>` element are also available to the `Link` component.
8
+ * For more information, refer to the [`<a>` element documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes).
8
9
  */
9
10
  export const Link = React.forwardRef(function Link(props, ref) {
10
11
  const navigate = useNavigate();
@@ -4,7 +4,6 @@ import { useServerState } from '../../foundation/useServerState';
4
4
  export default function LocalizationClientProvider({ localization, children, }) {
5
5
  const { setServerState } = useServerState();
6
6
  const [country, setCountry] = useState(localization.country);
7
- const [availableCountries] = useState(localization.availableCountries);
8
7
  const setter = useCallback((country) => {
9
8
  setCountry(country);
10
9
  setServerState('country', country);
@@ -13,8 +12,7 @@ export default function LocalizationClientProvider({ localization, children, })
13
12
  return {
14
13
  country,
15
14
  setCountry: setter,
16
- availableCountries,
17
15
  };
18
- }, [country, setter, availableCountries]);
16
+ }, [country, setter]);
19
17
  return (React.createElement(LocalizationContext.Provider, { value: contextValue }, children));
20
18
  }
@@ -2,7 +2,6 @@ import { LocalizationQuery } from './LocalizationQuery';
2
2
  export declare type Localization = LocalizationQuery['localization'];
3
3
  export interface LocalizationContextValue {
4
4
  country?: Localization['country'];
5
- availableCountries: Localization['availableCountries'];
6
5
  setCountry(country: Localization['country']): void;
7
6
  }
8
7
  export declare const LocalizationContext: import("react").Context<LocalizationContextValue | null>;
@@ -12,9 +12,9 @@ export interface LocalizationProviderProps {
12
12
  /**
13
13
  * The `LocalizationProvider` component automatically queries the Storefront API's
14
14
  * [`localization`](/api/storefront/reference/common-objects/queryroot) field
15
- * for the `isoCode` and `name` of the `country` and `availableCountries` and keeps this information in a context.
15
+ * for the `isoCode` and `name` of the `country` and keeps this information in a context.
16
16
  *
17
- * Any descendents of this provider can use the `useCountry` and `useAvailableCountries` hooks.
17
+ * Any descendents of this provider can use the `useCountry` hook.
18
18
  * The `isoCode` of the `country` can be used in the Storefront API's
19
19
  * `@inContext` directive as the `country` value.
20
20
  */
@@ -1,22 +1,33 @@
1
1
  import React from 'react';
2
2
  import LocalizationClientProvider from './LocalizationClientProvider.client';
3
3
  import { useShopQuery } from '../../hooks/useShopQuery';
4
- import { Localization } from '../../graphql/graphql-constants';
5
4
  import { CacheDays } from '../../framework/CachingStrategy';
6
5
  /**
7
6
  * The `LocalizationProvider` component automatically queries the Storefront API's
8
7
  * [`localization`](/api/storefront/reference/common-objects/queryroot) field
9
- * for the `isoCode` and `name` of the `country` and `availableCountries` and keeps this information in a context.
8
+ * for the `isoCode` and `name` of the `country` and keeps this information in a context.
10
9
  *
11
- * Any descendents of this provider can use the `useCountry` and `useAvailableCountries` hooks.
10
+ * Any descendents of this provider can use the `useCountry` hook.
12
11
  * The `isoCode` of the `country` can be used in the Storefront API's
13
12
  * `@inContext` directive as the `country` value.
14
13
  */
15
14
  export function LocalizationProvider(props) {
16
15
  const { data: { localization }, } = useShopQuery({
17
- query: Localization,
16
+ query: query,
18
17
  cache: CacheDays(),
19
18
  preload: props.preload,
20
19
  });
21
20
  return (React.createElement(LocalizationClientProvider, { localization: localization }, props.children));
22
21
  }
22
+ const query = `query Localization {
23
+ localization {
24
+ country {
25
+ isoCode
26
+ name
27
+ currency {
28
+ isoCode
29
+ }
30
+ }
31
+ }
32
+ }
33
+ `;
@@ -2,7 +2,7 @@
2
2
  * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
3
3
  * Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
4
4
  */
5
- import * as Types from '../../graphql/types/types';
5
+ import * as Types from '../../storefront-api-types';
6
6
  export declare type LocalizationQueryVariables = Types.Exact<{
7
7
  [key: string]: never;
8
8
  }>;
@@ -19,12 +19,5 @@ export declare type LocalizationQuery = {
19
19
  __typename?: 'Currency';
20
20
  } & Pick<Types.Currency, 'isoCode'>;
21
21
  };
22
- availableCountries: Array<{
23
- __typename?: 'Country';
24
- } & Pick<Types.Country, 'isoCode' | 'name'> & {
25
- currency: {
26
- __typename?: 'Currency';
27
- } & Pick<Types.Currency, 'isoCode'>;
28
- }>;
29
22
  };
30
23
  };
@@ -1,3 +1,2 @@
1
1
  export { LocalizationProvider } from './LocalizationProvider.server';
2
2
  export { useCountry } from '../../hooks/useCountry/useCountry';
3
- export { useAvailableCountries } from '../../hooks/useAvailableCountries/useAvailableCountries';
@@ -1,3 +1,2 @@
1
1
  export { LocalizationProvider } from './LocalizationProvider.server';
2
2
  export { useCountry } from '../../hooks/useCountry/useCountry';
3
- export { useAvailableCountries } from '../../hooks/useAvailableCountries/useAvailableCountries';
@@ -2,10 +2,11 @@ import React from 'react';
2
2
  import { Image } from '../Image';
3
3
  import { Video } from '../Video';
4
4
  import { ExternalVideo } from '../ExternalVideo';
5
- import type { MediaFileFragmentFragment } from './MediaFileFragment';
5
+ import type { MediaEdge as MediaEdgeType } from '../../storefront-api-types';
6
+ import type { PartialDeep } from 'type-fest';
6
7
  export interface MediaFileProps {
7
- /** A [Media object](/api/storefront/reference/products/media). */
8
- data: MediaFileFragmentFragment;
8
+ /** An object with fields that correspond to the Storefront API's [Media object](/api/storefront/reference/products/media). */
9
+ data: PartialDeep<MediaEdgeType['node']>;
9
10
  /** The options for the `Image`, `Video`, or `ExternalVideo` components. */
10
11
  options?: React.ComponentProps<typeof Image>['options'] | React.ComponentProps<typeof Video>['options'] | React.ComponentProps<typeof ExternalVideo>['options'];
11
12
  }
@@ -2,7 +2,7 @@ import { ElementType } from 'react';
2
2
  import { Props } from '../types';
3
3
  import { ParsedMetafield } from '../../types';
4
4
  export interface MetafieldProps<TTag> {
5
- /** A [Metafield object](/api/storefront/reference/common-objects/metafield) from the Storefront API. */
5
+ /** An object with fields that correspond to the Storefront API's [Metafield object](/api/storefront/reference/common-objects/metafield). */
6
6
  data: ParsedMetafield;
7
7
  /** An HTML tag to be rendered as the base element wrapper. The default value varies depending on [metafield.type](/apps/metafields/types). */
8
8
  as?: TTag;
@@ -12,6 +12,6 @@ export interface MetafieldProps<TTag> {
12
12
  * API's [Metafield object](/api/storefront/reference/common-objects/metafield).
13
13
  *
14
14
  * Renders a smart default of the
15
- * Metafield's `value`. For more information, refer to the [Default Output](#default-output) section.
15
+ * Metafield's `value`. For more information, refer to the [Default output](#default-output) section.
16
16
  */
17
17
  export declare function Metafield<TTag extends ElementType>(props: Props<TTag> & MetafieldProps<TTag>): JSX.Element | null;
@@ -1,14 +1,13 @@
1
1
  import React from 'react';
2
2
  import { useShop } from '../../foundation';
3
3
  import { getMeasurementAsString } from '../../utilities';
4
- import { RawHtml } from '../RawHtml';
5
4
  import { Image } from '../Image';
6
5
  /**
7
6
  * The `Metafield` component renders the value of a Storefront
8
7
  * API's [Metafield object](/api/storefront/reference/common-objects/metafield).
9
8
  *
10
9
  * Renders a smart default of the
11
- * Metafield's `value`. For more information, refer to the [Default Output](#default-output) section.
10
+ * Metafield's `value`. For more information, refer to the [Default output](#default-output) section.
12
11
  */
13
12
  export function Metafield(props) {
14
13
  var _a;
@@ -38,10 +37,14 @@ export function Metafield(props) {
38
37
  return (React.createElement(Wrapper, { ...passthroughProps }, data.value.value));
39
38
  }
40
39
  case 'single_line_text_field': {
41
- return (React.createElement(RawHtml, { ...passthroughProps, as: as !== null && as !== void 0 ? as : 'span', string: data.value }));
40
+ const Wrapper = as !== null && as !== void 0 ? as : 'span';
41
+ return (React.createElement(Wrapper, { ...passthroughProps, dangerouslySetInnerHTML: { __html: data.value } }));
42
42
  }
43
43
  case 'multi_line_text_field': {
44
- return (React.createElement(RawHtml, { ...passthroughProps, as: as !== null && as !== void 0 ? as : 'span', string: data.value.split('\n').join('<br/>') }));
44
+ const Wrapper = as !== null && as !== void 0 ? as : 'div';
45
+ return (React.createElement(Wrapper, { ...passthroughProps, dangerouslySetInnerHTML: {
46
+ __html: data.value.split('\n').join('<br/>'),
47
+ } }));
45
48
  }
46
49
  case 'url':
47
50
  return (React.createElement("a", { href: data.value, ...passthroughProps }, data.value));
@@ -51,7 +54,7 @@ export function Metafield(props) {
51
54
  case 'file_reference': {
52
55
  if (((_a = data.reference) === null || _a === void 0 ? void 0 : _a.__typename) === 'MediaImage') {
53
56
  const ref = data.reference;
54
- return ref.data ? (React.createElement(Image, { data: ref.data, ...passthroughProps })) : null;
57
+ return ref.image ? (React.createElement(Image, { data: ref.image, ...passthroughProps })) : null;
55
58
  }
56
59
  }
57
60
  default: {
@@ -1,4 +1,4 @@
1
- import { Metafield } from '../../graphql/types/types';
1
+ import { Metafield } from '../../storefront-api-types';
2
2
  export declare type MetafieldType = Omit<Partial<Metafield>, 'value'> & {
3
3
  value?: string | number | boolean | Date | Record<string, any>;
4
4
  };