@shopify/hydrogen 0.11.1 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/CHANGELOG.md +500 -3
  2. package/dist/esnext/client.d.ts +2 -0
  3. package/dist/esnext/client.js +2 -0
  4. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +3 -4
  5. package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +9 -22
  6. package/dist/esnext/components/AddToCartButton/index.d.ts +1 -1
  7. package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +4 -5
  8. package/dist/esnext/components/BuyNowButton/index.d.ts +1 -1
  9. package/dist/esnext/components/BuyNowButton/index.js +1 -1
  10. package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +2 -3
  11. package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +3 -3
  12. package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +5 -3
  13. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +5 -5
  14. package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +1 -1
  15. package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +1 -3
  16. package/dist/esnext/components/CartLineProvider/context.d.ts +10 -16
  17. package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.d.ts +1 -3
  18. package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +1 -1
  19. package/dist/esnext/components/CartProvider/CartProvider.client.js +8 -2
  20. package/dist/esnext/components/CartProvider/cart-queries.d.ts +9 -0
  21. package/dist/esnext/components/CartProvider/cart-queries.js +876 -0
  22. package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +72 -5
  23. package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +72 -5
  24. package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +72 -5
  25. package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +73 -6
  26. package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +13 -11
  27. package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +72 -5
  28. package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +72 -5
  29. package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +72 -5
  30. package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +73 -6
  31. package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +72 -5
  32. package/dist/esnext/components/CartProvider/hooks.d.ts +1 -1
  33. package/dist/esnext/components/CartProvider/hooks.js +4 -1
  34. package/dist/esnext/components/CartProvider/types.d.ts +1 -1
  35. package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +3 -2
  36. package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +8 -13
  37. package/dist/esnext/components/ExternalVideo/ExternalVideo.js +7 -7
  38. package/dist/esnext/components/ExternalVideo/index.d.ts +1 -1
  39. package/dist/esnext/components/ExternalVideo/index.js +1 -1
  40. package/dist/esnext/components/Image/Image.d.ts +14 -16
  41. package/dist/esnext/components/Image/Image.js +17 -17
  42. package/dist/esnext/components/Image/index.d.ts +1 -1
  43. package/dist/esnext/components/Image/index.js +1 -1
  44. package/dist/esnext/components/Link/Link.client.d.ts +4 -5
  45. package/dist/esnext/components/Link/Link.client.js +5 -4
  46. package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -3
  47. package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +0 -1
  48. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +4 -5
  49. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +15 -4
  50. package/dist/esnext/components/LocalizationProvider/LocalizationQuery.d.ts +5 -8
  51. package/dist/esnext/components/LocalizationProvider/index.d.ts +0 -1
  52. package/dist/esnext/components/LocalizationProvider/index.js +0 -1
  53. package/dist/esnext/components/MediaFile/MediaFile.d.ts +10 -21
  54. package/dist/esnext/components/MediaFile/MediaFile.js +7 -5
  55. package/dist/esnext/components/MediaFile/index.d.ts +1 -1
  56. package/dist/esnext/components/MediaFile/index.js +1 -1
  57. package/dist/esnext/components/Metafield/Metafield.client.d.ts +2 -6
  58. package/dist/esnext/components/Metafield/Metafield.client.js +8 -8
  59. package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +1 -3
  60. package/dist/esnext/components/Metafield/index.d.ts +1 -2
  61. package/dist/esnext/components/Metafield/index.js +1 -1
  62. package/dist/esnext/components/Metafield/types.d.ts +1 -1
  63. package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +58 -66
  64. package/dist/esnext/components/ModelViewer/ModelViewer.client.js +10 -7
  65. package/dist/esnext/components/ModelViewer/index.d.ts +1 -1
  66. package/dist/esnext/components/Money/Money.client.d.ts +8 -12
  67. package/dist/esnext/components/Money/Money.client.js +1 -4
  68. package/dist/esnext/components/Money/index.d.ts +1 -1
  69. package/dist/esnext/components/Money/index.js +1 -1
  70. package/dist/esnext/components/ProductDescription/ProductDescription.client.d.ts +7 -2
  71. package/dist/esnext/components/ProductDescription/ProductDescription.client.js +4 -3
  72. package/dist/esnext/components/ProductMetafield/ProductMetafield.client.js +3 -3
  73. package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -5
  74. package/dist/esnext/components/ProductPrice/ProductPrice.client.js +2 -2
  75. package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +8 -8
  76. package/dist/esnext/components/ProductProvider/ProductProvider.client.js +2 -4
  77. package/dist/esnext/components/ProductProvider/context.d.ts +23 -14
  78. package/dist/esnext/components/ProductProvider/index.d.ts +1 -1
  79. package/dist/esnext/components/ProductProvider/index.js +1 -1
  80. package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +3 -2
  81. package/dist/esnext/components/Seo/CollectionSeo.client.js +3 -3
  82. package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +3 -2
  83. package/dist/esnext/components/Seo/DefaultPageSeo.client.js +2 -2
  84. package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +3 -3
  85. package/dist/esnext/components/Seo/DescriptionSeo.client.js +1 -1
  86. package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
  87. package/dist/esnext/components/Seo/ImageSeo.client.d.ts +3 -2
  88. package/dist/esnext/components/Seo/PageSeo.client.d.ts +3 -2
  89. package/dist/esnext/components/Seo/PageSeo.client.js +2 -2
  90. package/dist/esnext/components/Seo/ProductSeo.client.d.ts +5 -2
  91. package/dist/esnext/components/Seo/ProductSeo.client.js +10 -5
  92. package/dist/esnext/components/Seo/Seo.client.d.ts +11 -7
  93. package/dist/esnext/components/Seo/Seo.client.js +8 -14
  94. package/dist/esnext/components/Seo/TitleSeo.client.d.ts +3 -4
  95. package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +1 -1
  96. package/dist/esnext/components/Seo/seo-types.d.ts +17 -0
  97. package/dist/esnext/components/{ExternalVideo/ExternalVideoFragment.js → Seo/seo-types.js} +0 -0
  98. package/dist/esnext/components/ShopPayButton/ShopPayButton.client.d.ts +2 -1
  99. package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +1 -9
  100. package/dist/esnext/components/ShopPayButton/index.d.ts +1 -1
  101. package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +8 -13
  102. package/dist/esnext/components/UnitPrice/UnitPrice.client.js +9 -4
  103. package/dist/esnext/components/UnitPrice/index.d.ts +1 -1
  104. package/dist/esnext/components/UnitPrice/index.js +1 -1
  105. package/dist/esnext/components/Video/Video.d.ts +8 -16
  106. package/dist/esnext/components/Video/Video.js +11 -6
  107. package/dist/esnext/components/Video/index.d.ts +1 -2
  108. package/dist/esnext/components/Video/index.js +1 -1
  109. package/dist/esnext/components/index.d.ts +3 -16
  110. package/dist/esnext/components/index.js +2 -5
  111. package/dist/esnext/entry-client.js +27 -8
  112. package/dist/esnext/entry-server.d.ts +2 -1
  113. package/dist/esnext/entry-server.js +127 -160
  114. package/dist/esnext/foundation/Boomerang/Boomerang.client.d.ts +3 -1
  115. package/dist/esnext/foundation/Boomerang/Boomerang.client.js +17 -3
  116. package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +22 -0
  117. package/dist/esnext/foundation/{Router/DefaultRoutes.js → FileRoutes/FileRoutes.server.js} +24 -23
  118. package/dist/esnext/foundation/Redirect/Redirect.client.d.ts +5 -0
  119. package/dist/esnext/foundation/Redirect/Redirect.client.js +14 -0
  120. package/dist/esnext/foundation/Route/Route.server.d.ts +12 -0
  121. package/dist/esnext/foundation/Route/Route.server.js +33 -0
  122. package/dist/esnext/foundation/Router/{Router.client.d.ts → BrowserRouter.client.d.ts} +3 -2
  123. package/dist/esnext/foundation/Router/{Router.client.js → BrowserRouter.client.js} +11 -7
  124. package/dist/esnext/foundation/Router/Router.server.d.ts +10 -0
  125. package/dist/esnext/foundation/Router/Router.server.js +8 -0
  126. package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +19 -24
  127. package/dist/esnext/foundation/ServerStateProvider/{ServerStateProvider.client.d.ts → ServerStateProvider.d.ts} +0 -0
  128. package/dist/esnext/foundation/ServerStateProvider/{ServerStateProvider.client.js → ServerStateProvider.js} +0 -0
  129. package/dist/esnext/foundation/ServerStateProvider/index.d.ts +2 -2
  130. package/dist/esnext/foundation/ServerStateProvider/index.js +1 -1
  131. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.js +3 -0
  132. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +3 -0
  133. package/dist/esnext/foundation/ShopifyProvider/index.d.ts +0 -1
  134. package/dist/esnext/foundation/ShopifyProvider/index.js +0 -1
  135. package/dist/esnext/foundation/index.d.ts +0 -2
  136. package/dist/esnext/foundation/index.js +0 -2
  137. package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.d.ts +6 -3
  138. package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.js +4 -1
  139. package/dist/esnext/foundation/useQuery/hooks.d.ts +5 -4
  140. package/dist/esnext/foundation/useQuery/hooks.js +13 -4
  141. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +9 -0
  142. package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +7 -0
  143. package/dist/esnext/foundation/useRouteParams/useRouteParams.d.ts +4 -0
  144. package/dist/esnext/foundation/useRouteParams/useRouteParams.js +9 -0
  145. package/dist/esnext/foundation/useUrl/useUrl.js +1 -1
  146. package/dist/esnext/framework/Hydration/Html.d.ts +2 -0
  147. package/dist/esnext/framework/Hydration/Html.js +71 -2
  148. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
  149. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +28 -7
  150. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
  151. package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +5 -0
  152. package/dist/esnext/framework/Hydration/rsc.js +1 -1
  153. package/dist/esnext/framework/cache/in-memory.d.ts +1 -0
  154. package/dist/esnext/framework/cache/in-memory.js +15 -5
  155. package/dist/esnext/framework/middleware.js +25 -3
  156. package/dist/esnext/framework/plugin.js +6 -1
  157. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
  158. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +28 -0
  159. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +61 -77
  160. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +1 -1
  161. package/dist/esnext/hooks/index.d.ts +0 -1
  162. package/dist/esnext/hooks/index.js +0 -1
  163. package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +10 -18
  164. package/dist/esnext/hooks/useCountry/useCountry.d.ts +4 -4
  165. package/dist/esnext/hooks/useMoney/hooks.d.ts +3 -3
  166. package/dist/esnext/hooks/useMoney/hooks.js +2 -2
  167. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +17 -2
  168. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.js +7 -3
  169. package/dist/esnext/hooks/useProduct/useProduct.d.ts +36 -138
  170. package/dist/esnext/hooks/useProductOptions/helpers.d.ts +6 -4
  171. package/dist/esnext/hooks/useProductOptions/helpers.js +13 -6
  172. package/dist/esnext/hooks/useProductOptions/types.d.ts +15 -35
  173. package/dist/esnext/hooks/useProductOptions/useProductOptions.d.ts +6 -5
  174. package/dist/esnext/hooks/useProductOptions/useProductOptions.js +13 -3
  175. package/dist/esnext/hooks/useShopQuery/hooks.js +79 -21
  176. package/dist/esnext/index.d.ts +8 -2
  177. package/dist/esnext/index.js +8 -2
  178. package/dist/esnext/platforms/node.d.ts +2 -3
  179. package/dist/esnext/platforms/node.js +5 -3
  180. package/dist/esnext/platforms/worker-event.d.ts +0 -8
  181. package/dist/esnext/platforms/worker-event.js +2 -23
  182. package/dist/esnext/platforms/worker.d.ts +14 -0
  183. package/dist/esnext/platforms/worker.js +25 -0
  184. package/dist/esnext/{graphql/types/types.d.ts → storefront-api-types.d.ts} +2016 -1593
  185. package/dist/esnext/{graphql/types/types.js → storefront-api-types.js} +1025 -732
  186. package/dist/esnext/streaming.server.d.ts +9 -6
  187. package/dist/esnext/streaming.server.js +2 -27
  188. package/dist/esnext/types.d.ts +3 -18
  189. package/dist/esnext/utilities/apiRoutes.d.ts +19 -3
  190. package/dist/esnext/utilities/apiRoutes.js +27 -5
  191. package/dist/esnext/utilities/devtools.d.ts +11 -0
  192. package/dist/esnext/utilities/devtools.js +11 -0
  193. package/dist/esnext/utilities/fetch.d.ts +7 -1
  194. package/dist/esnext/utilities/fetch.js +9 -18
  195. package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +3 -2
  196. package/dist/esnext/utilities/flattenConnection/flattenConnection.js +6 -2
  197. package/dist/esnext/utilities/graphql-tracker.d.ts +17 -0
  198. package/dist/esnext/utilities/graphql-tracker.js +119 -0
  199. package/dist/esnext/utilities/image_size.d.ts +5 -4
  200. package/dist/esnext/utilities/log/log-query-timeline.d.ts +1 -1
  201. package/dist/esnext/utilities/log/log-query-timeline.js +1 -2
  202. package/dist/esnext/utilities/log/log.d.ts +1 -0
  203. package/dist/esnext/utilities/log/utils.js +3 -0
  204. package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.d.ts +3 -2
  205. package/dist/esnext/utilities/video_parameters.js +0 -4
  206. package/dist/esnext/version.d.ts +1 -1
  207. package/dist/esnext/version.js +1 -1
  208. package/dist/node/entry-server.d.ts +2 -1
  209. package/dist/node/entry-server.js +129 -158
  210. package/dist/node/foundation/Redirect/Redirect.client.d.ts +5 -0
  211. package/dist/node/foundation/Redirect/Redirect.client.js +17 -0
  212. package/dist/node/foundation/Router/BrowserRouter.client.d.ts +13 -0
  213. package/dist/node/foundation/Router/BrowserRouter.client.js +77 -0
  214. package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +24 -25
  215. package/dist/node/foundation/ServerRequestProvider/index.js +5 -1
  216. package/dist/node/foundation/ServerStateProvider/{ServerStateProvider.client.d.ts → ServerStateProvider.d.ts} +0 -0
  217. package/dist/node/foundation/ServerStateProvider/{ServerStateProvider.client.js → ServerStateProvider.js} +5 -1
  218. package/dist/node/foundation/ServerStateProvider/index.d.ts +2 -2
  219. package/dist/node/foundation/ServerStateProvider/index.js +3 -3
  220. package/dist/node/foundation/ssr-interop.d.ts +29 -0
  221. package/dist/node/foundation/ssr-interop.js +39 -0
  222. package/dist/node/foundation/useNavigate/useNavigate.d.ts +13 -0
  223. package/dist/node/foundation/useNavigate/useNavigate.js +18 -0
  224. package/dist/node/foundation/useServerState/index.d.ts +1 -0
  225. package/dist/node/foundation/useServerState/index.js +5 -0
  226. package/dist/node/foundation/useServerState/use-server-state.d.ts +16 -0
  227. package/dist/node/foundation/useServerState/use-server-state.js +24 -0
  228. package/dist/node/framework/Hydration/Html.d.ts +2 -0
  229. package/dist/node/framework/Hydration/Html.js +73 -3
  230. package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
  231. package/dist/node/framework/Hydration/ServerComponentRequest.server.js +28 -7
  232. package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
  233. package/dist/node/framework/Hydration/ServerComponentResponse.server.js +8 -0
  234. package/dist/node/framework/Hydration/rsc.js +1 -1
  235. package/dist/node/framework/cache/in-memory.d.ts +1 -0
  236. package/dist/node/framework/cache/in-memory.js +15 -5
  237. package/dist/node/framework/middleware.js +30 -4
  238. package/dist/node/framework/plugin.js +11 -2
  239. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
  240. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +31 -0
  241. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +61 -77
  242. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +1 -1
  243. package/dist/node/{graphql/types/types.d.ts → storefront-api-types.d.ts} +2016 -1593
  244. package/dist/node/{graphql/types/types.js → storefront-api-types.js} +1026 -733
  245. package/dist/node/streaming.server.d.ts +9 -6
  246. package/dist/node/streaming.server.js +3 -29
  247. package/dist/node/types.d.ts +3 -18
  248. package/dist/node/utilities/apiRoutes.d.ts +19 -3
  249. package/dist/node/utilities/apiRoutes.js +29 -7
  250. package/dist/node/utilities/fetch.d.ts +10 -0
  251. package/dist/node/utilities/fetch.js +39 -0
  252. package/dist/node/utilities/log/log-query-timeline.d.ts +1 -1
  253. package/dist/node/utilities/log/log-query-timeline.js +1 -2
  254. package/dist/node/utilities/log/log.d.ts +1 -0
  255. package/dist/node/utilities/log/utils.js +3 -0
  256. package/dist/node/utilities/web-api-polyfill.js +5 -1
  257. package/dist/node/version.d.ts +1 -0
  258. package/dist/node/version.js +4 -0
  259. package/package.json +21 -21
  260. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +43 -104
  261. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +1566 -848
  262. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +36 -421
  263. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +1523 -864
  264. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +35 -437
  265. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +507 -517
  266. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +10 -246
  267. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +18 -25
  268. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +47 -108
  269. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +1033 -306
  270. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +965 -293
  271. package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +98 -108
  272. package/vendor/react-server-dom-vite/package.json +0 -2
  273. package/dist/esnext/components/ExternalVideo/ExternalVideoFragment.d.ts +0 -4
  274. package/dist/esnext/components/Image/ImageFragment.d.ts +0 -4
  275. package/dist/esnext/components/Image/ImageFragment.js +0 -1
  276. package/dist/esnext/components/MediaFile/MediaFileFragment.d.ts +0 -22
  277. package/dist/esnext/components/MediaFile/MediaFileFragment.js +0 -1
  278. package/dist/esnext/components/Metafield/MetafieldFragment.d.ts +0 -19
  279. package/dist/esnext/components/Metafield/MetafieldFragment.js +0 -1
  280. package/dist/esnext/components/ModelViewer/Model3DFragment.d.ts +0 -11
  281. package/dist/esnext/components/ModelViewer/Model3DFragment.js +0 -1
  282. package/dist/esnext/components/Money/MoneyFragment.d.ts +0 -4
  283. package/dist/esnext/components/Money/MoneyFragment.js +0 -1
  284. package/dist/esnext/components/ProductProvider/ProductProviderFragment.d.ts +0 -80
  285. package/dist/esnext/components/ProductProvider/ProductProviderFragment.js +0 -1
  286. package/dist/esnext/components/ProductProvider/types.d.ts +0 -19
  287. package/dist/esnext/components/ProductProvider/types.js +0 -1
  288. package/dist/esnext/components/RawHtml/RawHtml.d.ts +0 -19
  289. package/dist/esnext/components/RawHtml/RawHtml.js +0 -21
  290. package/dist/esnext/components/RawHtml/index.d.ts +0 -1
  291. package/dist/esnext/components/RawHtml/index.js +0 -1
  292. package/dist/esnext/components/Router/index.d.ts +0 -1
  293. package/dist/esnext/components/Router/index.js +0 -1
  294. package/dist/esnext/components/Seo/types.d.ts +0 -67
  295. package/dist/esnext/components/Seo/types.js +0 -1
  296. package/dist/esnext/components/UnitPrice/UnitPriceFragment.d.ts +0 -12
  297. package/dist/esnext/components/UnitPrice/UnitPriceFragment.js +0 -1
  298. package/dist/esnext/components/Video/VideoFragment.d.ts +0 -11
  299. package/dist/esnext/components/Video/VideoFragment.js +0 -1
  300. package/dist/esnext/foundation/Boomerang/BoomerangPageTemplate.client.d.ts +0 -3
  301. package/dist/esnext/foundation/Boomerang/BoomerangPageTemplate.client.js +0 -14
  302. package/dist/esnext/foundation/Router/DefaultRoutes.d.ts +0 -22
  303. package/dist/esnext/foundation/Router/index.d.ts +0 -1
  304. package/dist/esnext/foundation/Router/index.js +0 -1
  305. package/dist/esnext/graphql/graphql-constants.d.ts +0 -1751
  306. package/dist/esnext/graphql/graphql-constants.js +0 -3364
  307. package/dist/esnext/hooks/useAvailableCountries/index.d.ts +0 -1
  308. package/dist/esnext/hooks/useAvailableCountries/index.js +0 -1
  309. package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.d.ts +0 -11
  310. package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.js +0 -17
  311. package/dist/esnext/hooks/useNavigate/index.d.ts +0 -1
  312. package/dist/esnext/hooks/useNavigate/index.js +0 -1
  313. package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.d.ts +0 -28
  314. package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.js +0 -1
  315. package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.d.ts +0 -20
  316. package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.js +0 -1
  317. package/dist/esnext/hooks/useProductOptions/VariantFragment.d.ts +0 -64
  318. package/dist/esnext/hooks/useProductOptions/VariantFragment.js +0 -1
@@ -1,7 +1,7 @@
1
- import { ElementType } from 'react';
2
- import { MoneyProps } from '../Money';
3
- import { Props } from '../types';
4
- export interface ProductPriceProps<TTag> extends Omit<MoneyProps<TTag>, 'data'> {
1
+ import React from 'react';
2
+ import { Money } from '../Money';
3
+ import { UnitPrice } from '../UnitPrice';
4
+ export interface ProductPriceProps {
5
5
  /** The type of price. Valid values: `regular` (default) or `compareAt`. */
6
6
  priceType?: 'regular' | 'compareAt';
7
7
  /** The type of value. Valid values: `min` (default), `max` or `unit`. */
@@ -13,4 +13,4 @@ export interface ProductPriceProps<TTag> extends Omit<MoneyProps<TTag>, 'data'>
13
13
  * The `ProductPrice` component renders a `Money` component with the product
14
14
  * [`priceRange`](/api/storefront/reference/products/productpricerange)'s `maxVariantPrice` or `minVariantPrice`, for either the regular price or compare at price range. It must be a descendent of the `ProductProvider` component.
15
15
  */
16
- export declare function ProductPrice<TTag extends ElementType>(props: Props<TTag> & ProductPriceProps<TTag>): JSX.Element | null;
16
+ export declare function ProductPrice<TTag extends keyof JSX.IntrinsicElements>(props: (Omit<React.ComponentProps<typeof UnitPrice>, 'data' | 'measurement'> | Omit<React.ComponentProps<typeof Money>, 'data'>) & ProductPriceProps): JSX.Element | null;
@@ -16,7 +16,7 @@ export function ProductPrice(props) {
16
16
  let price;
17
17
  let measurement;
18
18
  const variant = variantId
19
- ? (_a = product === null || product === void 0 ? void 0 : product.variants) === null || _a === void 0 ? void 0 : _a.find((variant) => variant.id === variantId)
19
+ ? (_a = product === null || product === void 0 ? void 0 : product.variants) === null || _a === void 0 ? void 0 : _a.find((variant) => (variant === null || variant === void 0 ? void 0 : variant.id) === variantId)
20
20
  : null;
21
21
  if (priceType === 'compareAt') {
22
22
  if (variantId && variant) {
@@ -47,7 +47,7 @@ export function ProductPrice(props) {
47
47
  price = (_g = product.priceRange) === null || _g === void 0 ? void 0 : _g.minVariantPrice;
48
48
  }
49
49
  }
50
- if (price == null) {
50
+ if (!price) {
51
51
  return null;
52
52
  }
53
53
  if (measurement) {
@@ -1,20 +1,20 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { useProductOptions } from '../../hooks';
3
- import { Product } from './types';
3
+ import type { Product as ProductType } from '../../storefront-api-types';
4
+ import type { PartialDeep } from 'type-fest';
4
5
  export interface ProductProviderProps {
5
6
  /** A `ReactNode` element. */
6
7
  children: ReactNode;
7
8
  /** A [Product object](/api/storefront/reference/products/product). */
8
- data: Product;
9
- /** The initially selected variant. This is required only if you're using a `SelectedVariantX` hook in the `ProductProvider` component.*/
9
+ data: PartialDeep<ProductType>;
10
+ /** The initially selected variant. If this is missing, then `selectedVariantId`
11
+ * in the returned `object` from the `useProduct` hook uses the first available variant
12
+ * or the first variant (if none are available).
13
+ */
10
14
  initialVariantId?: Parameters<typeof useProductOptions>['0']['initialVariantId'];
11
15
  }
12
16
  /**
13
17
  * The `ProductProvider` component sets up a context with product details. Descendents of
14
- * this component can use the `useProduct` hook and the related `ProductX` or `SelectedVariantX` hooks.
18
+ * this component can use the `useProduct` hook.
15
19
  */
16
20
  export declare function ProductProvider({ children, data: product, initialVariantId, }: ProductProviderProps): JSX.Element;
17
- export declare namespace ProductProvider {
18
- var Fragment: string;
19
- }
20
- export declare const ProductProviderFragment = "\nfragment ProductProviderFragment on Product {\n compareAtPriceRange {\n maxVariantPrice {\n ...MoneyFragment\n }\n minVariantPrice {\n ...MoneyFragment\n }\n }\n descriptionHtml\n handle\n id\n media(first: $numProductMedia) {\n edges {\n node {\n ...MediaFileFragment\n }\n }\n }\n metafields(first: $numProductMetafields) {\n edges {\n node {\n ...MetafieldFragment\n }\n }\n }\n priceRange {\n maxVariantPrice {\n ...MoneyFragment\n }\n minVariantPrice {\n ...MoneyFragment\n }\n }\n title\n variants(first: $numProductVariants) {\n edges {\n node {\n ...VariantFragment\n }\n }\n }\n sellingPlanGroups(first: $numProductSellingPlanGroups) {\n edges {\n node {\n ...SellingPlanGroupsFragment\n }\n }\n }\n}\n\n\nfragment MediaFileFragment on Media {\n ... on MediaImage {\n mediaContentType\n image {\n ...ImageFragment\n }\n }\n ... on Video {\n mediaContentType\n ...VideoFragment\n }\n ... on ExternalVideo {\n mediaContentType\n ...ExternalVideoFragment\n }\n ... on Model3d {\n mediaContentType\n ...Model3DFragment\n }\n}\n\n\nfragment MetafieldFragment on Metafield {\n id\n type\n namespace\n key\n value\n createdAt\n updatedAt\n description\n reference @include(if: $includeReferenceMetafieldDetails) {\n __typename\n ... on MediaImage {\n id\n mediaContentType\n image {\n ...ImageFragment\n }\n }\n }\n}\n\nfragment VariantFragment on ProductVariant {\n id\n title\n availableForSale\n image {\n ...ImageFragment\n }\n ...UnitPriceFragment\n priceV2 {\n ...MoneyFragment\n }\n compareAtPriceV2 {\n ...MoneyFragment\n }\n selectedOptions {\n name\n value\n }\n metafields(first: $numProductVariantMetafields) {\n edges {\n node {\n ...MetafieldFragment\n }\n }\n }\n sellingPlanAllocations(first: $numProductVariantSellingPlanAllocations) {\n edges {\n node {\n priceAdjustments {\n compareAtPrice {\n ...MoneyFragment\n }\n perDeliveryPrice {\n ...MoneyFragment\n }\n price {\n ...MoneyFragment\n }\n unitPrice {\n ...MoneyFragment\n }\n }\n sellingPlan {\n ...SellingPlanFragment\n }\n }\n }\n }\n}\n\n\nfragment SellingPlanGroupsFragment on SellingPlanGroup {\n sellingPlans(first:$numProductSellingPlans) {\n edges {\n node {\n ...SellingPlanFragment\n }\n }\n }\n appName\n name\n options {\n name\n values\n }\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n\nfragment VideoFragment on Video {\n id\n previewImage {\n url\n }\n sources {\n mimeType\n url\n }\n}\n\nfragment ExternalVideoFragment on ExternalVideo {\n id\n embeddedUrl\n host\n}\n\nfragment Model3DFragment on Model3d {\n id\n alt\n mediaContentType\n previewImage {\n url\n }\n sources {\n url\n }\n}\n\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n\n\nfragment SellingPlanFragment on SellingPlan {\n id\n description\n name\n options {\n name\n value\n }\n priceAdjustments {\n orderCount\n adjustmentValue {\n ...on SellingPlanFixedAmountPriceAdjustment {\n adjustmentAmount {\n ...MoneyFragment\n }\n }\n ...on SellingPlanFixedPriceAdjustment {\n price {\n ...MoneyFragment\n }\n }\n ...on SellingPlanPercentagePriceAdjustment {\n adjustmentPercentage\n }\n }\n }\n recurringDeliveries\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n\n\nfragment UnitPriceFragment on ProductVariant {\n unitPriceMeasurement {\n measuredType\n quantityUnit\n quantityValue\n referenceUnit\n referenceValue\n }\n unitPrice {\n ...MoneyFragment\n }\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\n\nfragment SellingPlanFragment on SellingPlan {\n id\n description\n name\n options {\n name\n value\n }\n priceAdjustments {\n orderCount\n adjustmentValue {\n ...on SellingPlanFixedAmountPriceAdjustment {\n adjustmentAmount {\n ...MoneyFragment\n }\n }\n ...on SellingPlanFixedPriceAdjustment {\n price {\n ...MoneyFragment\n }\n }\n ...on SellingPlanPercentagePriceAdjustment {\n adjustmentPercentage\n }\n }\n }\n recurringDeliveries\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}";
@@ -2,14 +2,14 @@ import React, { useMemo } from 'react';
2
2
  import { useParsedMetafields } from '../../hooks';
3
3
  import { flattenConnection } from '../../utilities';
4
4
  import { ProductContext } from './context';
5
- import { ProductProviderFragment as Fragment } from '../../graphql/graphql-constants';
6
5
  import { ProductOptionsProvider } from './ProductOptionsProvider.client';
7
6
  /**
8
7
  * The `ProductProvider` component sets up a context with product details. Descendents of
9
- * this component can use the `useProduct` hook and the related `ProductX` or `SelectedVariantX` hooks.
8
+ * this component can use the `useProduct` hook.
10
9
  */
11
10
  export function ProductProvider({ children, data: product, initialVariantId, }) {
12
11
  const metafields = useParsedMetafields(product.metafields);
12
+ // @ts-expect-error The types here are broken on main, need to come back and fix them sometime
13
13
  const providerValue = useMemo(() => {
14
14
  return {
15
15
  ...product,
@@ -32,5 +32,3 @@ export function ProductProvider({ children, data: product, initialVariantId, })
32
32
  return (React.createElement(ProductContext.Provider, { value: providerValue },
33
33
  React.createElement(ProductOptionsProvider, { initialVariantId: initialVariantId }, children)));
34
34
  }
35
- ProductProvider.Fragment = Fragment;
36
- export const ProductProviderFragment = Fragment;
@@ -1,20 +1,29 @@
1
1
  import { ProductOptionsHookValue } from '../../hooks';
2
2
  import { ParsedMetafield } from '../../types';
3
- import { ProductProviderFragmentFragment } from './ProductProviderFragment';
4
- import { Product } from './types';
5
- import { Collection, Image } from '../../graphql/types/types';
6
- import type { Variant } from '../../hooks/useProductOptions';
7
- export declare const ProductContext: import("react").Context<ProductContextType | null>;
8
- export declare type ProductContextType = Omit<Product, 'media' | 'metafields' | 'images' | 'collections' | 'variants' | 'sellingPlanGroups' | 'options'> & {
9
- media?: ProductProviderFragmentFragment['media']['edges'][0]['node'][];
10
- mediaConnection?: Product['media'];
3
+ import type { Collection, Image, Product as ProductType, ProductVariant as ProductVariantType, MediaEdge as MediaEdgeType } from '../../storefront-api-types';
4
+ import type { PartialDeep } from 'type-fest';
5
+ export declare const ProductContext: import("react").Context<import("type-fest/source/partial-deep").PartialObjectDeep<Omit<ProductType, "media" | "options" | "metafields" | "variants" | "sellingPlanGroups" | "collections" | "images"> & {
6
+ media?: import("../../storefront-api-types").ExternalVideo | import("../../storefront-api-types").MediaImage | import("../../storefront-api-types").Model3d | import("../../storefront-api-types").Video | undefined;
7
+ mediaConnection?: import("../../storefront-api-types").MediaConnection | undefined;
8
+ metafields?: ParsedMetafield[] | undefined;
9
+ metafieldsConnection?: import("../../storefront-api-types").MetafieldConnection | undefined;
10
+ images?: Partial<Image>[] | undefined;
11
+ imagesConnection?: import("../../storefront-api-types").ImageConnection | undefined;
12
+ collections?: Partial<Collection>[] | undefined;
13
+ collectionsConnection?: import("../../storefront-api-types").CollectionConnection | undefined;
14
+ variants?: Partial<ProductVariantType>[] | undefined;
15
+ variantsConnection?: import("../../storefront-api-types").ProductVariantConnection | undefined;
16
+ }> | null>;
17
+ export declare type ProductContextType = PartialDeep<Omit<ProductType, 'media' | 'metafields' | 'images' | 'collections' | 'variants' | 'sellingPlanGroups' | 'options'> & {
18
+ media?: MediaEdgeType['node'];
19
+ mediaConnection?: ProductType['media'];
11
20
  metafields?: ParsedMetafield[];
12
- metafieldsConnection?: Product['metafields'];
21
+ metafieldsConnection?: ProductType['metafields'];
13
22
  images?: Partial<Image>[];
14
- imagesConnection?: Product['images'];
23
+ imagesConnection?: ProductType['images'];
15
24
  collections?: Partial<Collection>[];
16
- collectionsConnection?: Product['collections'];
17
- variants?: Partial<Variant>[];
18
- variantsConnection?: Product['variants'];
19
- };
25
+ collectionsConnection?: ProductType['collections'];
26
+ variants?: Partial<ProductVariantType>[];
27
+ variantsConnection?: ProductType['variants'];
28
+ }>;
20
29
  export declare const ProductOptionsContext: import("react").Context<ProductOptionsHookValue | null>;
@@ -1,2 +1,2 @@
1
- export { ProductProvider, ProductProviderFragment, } from './ProductProvider.client';
1
+ export { ProductProvider } from './ProductProvider.client';
2
2
  export { useProduct } from '../../hooks/useProduct/useProduct';
@@ -1,2 +1,2 @@
1
- export { ProductProvider, ProductProviderFragment, } from './ProductProvider.client';
1
+ export { ProductProvider } from './ProductProvider.client';
2
2
  export { useProduct } from '../../hooks/useProduct/useProduct';
@@ -1,2 +1,3 @@
1
- import { Collection } from './types';
2
- export declare function CollectionSeo({ title, description, seo, image }: Collection): JSX.Element;
1
+ import type { Collection as CollectionType } from '../../storefront-api-types';
2
+ import type { PartialDeep } from 'type-fest';
3
+ export declare function CollectionSeo({ title, description, seo, image, }: PartialDeep<CollectionType>): JSX.Element;
@@ -3,10 +3,10 @@ import { TitleSeo } from './TitleSeo.client';
3
3
  import { DescriptionSeo } from './DescriptionSeo.client';
4
4
  import { TwitterSeo } from './TwitterSeo.client';
5
5
  import { ImageSeo } from './ImageSeo.client';
6
- export function CollectionSeo({ title, description, seo, image }) {
6
+ export function CollectionSeo({ title, description, seo, image, }) {
7
7
  var _a, _b;
8
- const seoTitle = (_a = seo.title) !== null && _a !== void 0 ? _a : title;
9
- const seoDescription = (_b = seo.description) !== null && _b !== void 0 ? _b : description;
8
+ const seoTitle = (_a = seo === null || seo === void 0 ? void 0 : seo.title) !== null && _a !== void 0 ? _a : title;
9
+ const seoDescription = (_b = seo === null || seo === void 0 ? void 0 : seo.description) !== null && _b !== void 0 ? _b : description;
10
10
  return (React.createElement(React.Fragment, null,
11
11
  React.createElement(TitleSeo, { title: seoTitle }),
12
12
  React.createElement(DescriptionSeo, { description: seoDescription }),
@@ -1,2 +1,3 @@
1
- import type { DefaultPage } from './types';
2
- export declare function DefaultPageSeo({ title, description, url, titleTemplate, lang, }: DefaultPage): JSX.Element;
1
+ import type { DefaultPage } from './seo-types';
2
+ import type { PartialDeep } from 'type-fest';
3
+ export declare function DefaultPageSeo({ title, description, url, titleTemplate, lang, }: PartialDeep<DefaultPage>): JSX.Element;
@@ -8,10 +8,10 @@ export function DefaultPageSeo({ title, description, url, titleTemplate, lang, }
8
8
  const { locale } = useShop();
9
9
  const fallBacklang = locale.split(/[-_]/)[0];
10
10
  return (React.createElement(React.Fragment, null,
11
- React.createElement(Head, { defaultTitle: title, titleTemplate: titleTemplate !== null && titleTemplate !== void 0 ? titleTemplate : `%s - ${title}` },
11
+ React.createElement(Head, { defaultTitle: title !== null && title !== void 0 ? title : '', titleTemplate: titleTemplate !== null && titleTemplate !== void 0 ? titleTemplate : `%s - ${title}` },
12
12
  React.createElement("html", { lang: lang !== null && lang !== void 0 ? lang : fallBacklang }),
13
13
  React.createElement("meta", { property: "og:type", content: "website" }),
14
- React.createElement("meta", { property: "og:site_name", content: title }),
14
+ React.createElement("meta", { property: "og:site_name", content: title !== null && title !== void 0 ? title : '' }),
15
15
  React.createElement("meta", { property: "og:url", content: url })),
16
16
  React.createElement(TitleSeo, { title: title }),
17
17
  React.createElement(DescriptionSeo, { description: description }),
@@ -1,4 +1,4 @@
1
- import type { Description } from './types';
2
- export declare function DescriptionSeo({ description }: {
3
- description?: Description;
1
+ import type { Seo as SeoType } from '../../storefront-api-types';
2
+ export declare function DescriptionSeo({ description, }: {
3
+ description?: SeoType['description'];
4
4
  }): JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Head } from '../../client';
3
- export function DescriptionSeo({ description }) {
3
+ export function DescriptionSeo({ description, }) {
4
4
  if (!description) {
5
5
  return null;
6
6
  }
@@ -1,2 +1,2 @@
1
- import type { HomePage } from './types';
1
+ import type { HomePage } from './seo-types';
2
2
  export declare function HomePageSeo({ title, description, url }: HomePage): JSX.Element;
@@ -1,2 +1,3 @@
1
- import type { Image } from './types';
2
- export declare function ImageSeo({ url, width, height, altText }: Partial<Image>): JSX.Element;
1
+ import type { Image } from '../../storefront-api-types';
2
+ import type { PartialDeep } from 'type-fest';
3
+ export declare function ImageSeo({ url, width, height, altText }: PartialDeep<Image>): JSX.Element;
@@ -1,2 +1,3 @@
1
- import { Page } from './types';
2
- export declare function PageSeo({ title, seo }: Page): JSX.Element;
1
+ import type { Page as PageType } from '../../storefront-api-types';
2
+ import type { PartialDeep } from 'type-fest';
3
+ export declare function PageSeo({ title, seo }: PartialDeep<PageType>): JSX.Element;
@@ -4,8 +4,8 @@ import { DescriptionSeo } from './DescriptionSeo.client';
4
4
  import { TwitterSeo } from './TwitterSeo.client';
5
5
  export function PageSeo({ title, seo }) {
6
6
  var _a;
7
- const seoTitle = (_a = seo.title) !== null && _a !== void 0 ? _a : title;
8
- const seoDescription = seo.description;
7
+ const seoTitle = (_a = seo === null || seo === void 0 ? void 0 : seo.title) !== null && _a !== void 0 ? _a : title;
8
+ const seoDescription = seo === null || seo === void 0 ? void 0 : seo.description;
9
9
  return (React.createElement(React.Fragment, null,
10
10
  React.createElement(TitleSeo, { title: seoTitle }),
11
11
  React.createElement(DescriptionSeo, { description: seoDescription }),
@@ -1,2 +1,5 @@
1
- import { Product } from './types';
2
- export declare function ProductSeo({ url, title, description, seo, vendor, featuredImage, variants, }: Product): JSX.Element;
1
+ import type { Scalars, Product as ProductType } from '../../storefront-api-types';
2
+ import type { PartialDeep } from 'type-fest';
3
+ export declare function ProductSeo({ url, title, description, seo, vendor, featuredImage, variants, }: PartialDeep<ProductType> & {
4
+ url: Scalars['URL'];
5
+ }): JSX.Element;
@@ -5,7 +5,7 @@ import { DescriptionSeo } from './DescriptionSeo.client';
5
5
  import { TwitterSeo } from './TwitterSeo.client';
6
6
  import { ImageSeo } from './ImageSeo.client';
7
7
  export function ProductSeo({ url, title, description, seo, vendor, featuredImage, variants, }) {
8
- var _a, _b;
8
+ var _a, _b, _c;
9
9
  const seoTitle = (_a = seo === null || seo === void 0 ? void 0 : seo.title) !== null && _a !== void 0 ? _a : title;
10
10
  const seoDescription = (_b = seo === null || seo === void 0 ? void 0 : seo.description) !== null && _b !== void 0 ? _b : description;
11
11
  let firstVariantPrice;
@@ -23,13 +23,18 @@ export function ProductSeo({ url, title, description, seo, vendor, featuredImage
23
23
  if (featuredImage) {
24
24
  productSchema.image = featuredImage.url;
25
25
  }
26
- if (variants.edges.length > 0) {
27
- const firstVariant = variants.edges[0].node;
28
- firstVariantPrice = firstVariant.priceV2;
26
+ if ((variants === null || variants === void 0 ? void 0 : variants.edges) && variants.edges.length > 0) {
27
+ const firstVariant = (_c = variants.edges[0]) === null || _c === void 0 ? void 0 : _c.node;
28
+ firstVariantPrice = firstVariant === null || firstVariant === void 0 ? void 0 : firstVariant.priceV2;
29
29
  if (firstVariant && firstVariant.sku) {
30
30
  productSchema.sku = firstVariant.sku;
31
31
  }
32
- productSchema.offers = variants.edges.map(({ node }) => {
32
+ productSchema.offers = variants.edges.map((edge) => {
33
+ var _a;
34
+ const node = edge === null || edge === void 0 ? void 0 : edge.node;
35
+ if (!node || !((_a = node.priceV2) === null || _a === void 0 ? void 0 : _a.amount) || !node.priceV2.currencyCode) {
36
+ throw new Error(`<ProductSeo/> requires variant.PriceV2 'amount' and 'currency`);
37
+ }
33
38
  const offerSchema = {
34
39
  '@type': 'Offer',
35
40
  availability: `https://schema.org/${node.availableForSale ? 'InStock' : 'OutOfStock'}`,
@@ -1,22 +1,26 @@
1
- import type { DefaultPage, HomePage, Product, Collection, Page } from './types';
1
+ import { type ComponentProps } from 'react';
2
+ import { ProductSeo } from './ProductSeo.client';
3
+ import { CollectionSeo } from './CollectionSeo.client';
4
+ import { PageSeo } from './PageSeo.client';
5
+ import type { DefaultPage as DefaultPageType, HomePage as HomePageType } from './seo-types';
2
6
  declare type Props = {
3
7
  type: 'defaultSeo';
4
- data: Pick<DefaultPage, Exclude<keyof DefaultPage, 'url'>>;
8
+ data: Omit<DefaultPageType, 'url'>;
5
9
  } | {
6
10
  type: 'homepage';
7
- data: Pick<HomePage, Exclude<keyof HomePage, 'url'>>;
11
+ data: Omit<HomePageType, 'url'>;
8
12
  } | {
9
13
  type: 'product';
10
- data: Pick<Product, Exclude<keyof Product, 'url'>>;
14
+ data: Omit<ComponentProps<typeof ProductSeo>, 'url'>;
11
15
  } | {
12
16
  type: 'collection';
13
- data: Collection;
17
+ data: ComponentProps<typeof CollectionSeo>;
14
18
  } | {
15
19
  type: 'page';
16
- data: Page;
20
+ data: ComponentProps<typeof PageSeo>;
17
21
  };
18
22
  /**
19
23
  * The `Seo` component renders SEO information on a webpage.
20
24
  */
21
- export declare function Seo({ type, data }: Props): JSX.Element | null;
25
+ export declare function Seo(props: Props): JSX.Element | null;
22
26
  export {};
@@ -8,27 +8,21 @@ import { PageSeo } from './PageSeo.client';
8
8
  /**
9
9
  * The `Seo` component renders SEO information on a webpage.
10
10
  */
11
- export function Seo({ type, data }) {
11
+ export function Seo(props) {
12
12
  const url = useUrl().href;
13
- let SeoMarkup = null;
14
- switch (type) {
13
+ switch (props.type) {
15
14
  case 'defaultSeo':
16
- SeoMarkup = React.createElement(DefaultPageSeo, { ...{ url, ...data } });
17
- break;
15
+ return React.createElement(DefaultPageSeo, { ...{ url, ...props.data } });
18
16
  case 'homepage':
19
- SeoMarkup = React.createElement(HomePageSeo, { ...{ url, ...data } });
20
- break;
17
+ return React.createElement(HomePageSeo, { ...{ url, ...props.data } });
21
18
  case 'product':
22
- SeoMarkup = React.createElement(ProductSeo, { ...{ url, ...data } });
23
- break;
19
+ return React.createElement(ProductSeo, { ...{ url, ...props.data } });
24
20
  case 'collection':
25
- SeoMarkup = React.createElement(CollectionSeo, { ...data });
26
- break;
21
+ return React.createElement(CollectionSeo, { ...props.data });
27
22
  case 'page':
28
- SeoMarkup = React.createElement(PageSeo, { ...data });
29
- break;
23
+ return React.createElement(PageSeo, { ...props.data });
30
24
  default:
31
25
  console.warn('The <Seo/> only accepts type prop with values of defaultSeo, homepage, product, collection, or page.');
26
+ return null;
32
27
  }
33
- return SeoMarkup;
34
28
  }
@@ -1,4 +1,3 @@
1
- import type { Title } from './types';
2
- export declare function TitleSeo({ title }: {
3
- title?: Title;
4
- }): JSX.Element | null;
1
+ import type { Seo as SeoType } from '../../storefront-api-types';
2
+ import type { PartialDeep } from 'type-fest';
3
+ export declare function TitleSeo({ title }: PartialDeep<SeoType>): JSX.Element | null;
@@ -1,2 +1,2 @@
1
- import type { Twitter } from './types';
1
+ import type { Twitter } from './seo-types';
2
2
  export declare function TwitterSeo({ site, title, description }: Partial<Twitter>): JSX.Element;
@@ -0,0 +1,17 @@
1
+ import type { Scalars, Shop as ShopType, Seo as SeoType } from '../../storefront-api-types';
2
+ export interface Twitter {
3
+ site: string;
4
+ title: SeoType['title'];
5
+ description: SeoType['description'];
6
+ }
7
+ export interface HomePage {
8
+ description: ShopType['description'];
9
+ title: ShopType['name'];
10
+ url: Scalars['URL'];
11
+ }
12
+ export interface DefaultPage extends ShopType {
13
+ title: ShopType['name'];
14
+ url: Scalars['URL'];
15
+ titleTemplate?: string;
16
+ lang?: string;
17
+ }
@@ -1,4 +1,4 @@
1
- export declare type ShopPayButtonProps = {
1
+ declare type ShopPayButtonProps = {
2
2
  /** A string of classes to apply to the `div` that wraps the Shop Pay button. */
3
3
  className?: string;
4
4
  } & ({
@@ -35,3 +35,4 @@ export declare function ShopPayButton({ variantIds, className, variantIdsAndQuan
35
35
  export declare function getIdFromGid(id?: string): string | undefined;
36
36
  export declare const MissingPropsErrorMessage = "You must pass in either \"variantIds\" or \"variantIdsAndQuantities\" to ShopPayButton";
37
37
  export declare const DoublePropsErrorMessage = "You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component";
38
+ export {};
@@ -42,15 +42,7 @@ export function ShopPayButton({ variantIds, className, variantIdsAndQuantities,
42
42
  export function getIdFromGid(id) {
43
43
  if (!id)
44
44
  return;
45
- let gid;
46
- // atob() / Buffer required for SFAPI 2022-01. Remove atob() when upgrading to 2022-04
47
- if (typeof (window === null || window === void 0 ? void 0 : window.atob) !== 'undefined') {
48
- gid = window.atob(id);
49
- }
50
- else {
51
- gid = Buffer.from(id, 'base64').toString('ascii');
52
- }
53
- return gid.split('/').pop();
45
+ return id.split('/').pop();
54
46
  }
55
47
  export const MissingPropsErrorMessage = `You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton`;
56
48
  export const DoublePropsErrorMessage = `You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component`;
@@ -1 +1 @@
1
- export { ShopPayButton, ShopPayButtonProps } from './ShopPayButton.client';
1
+ export { ShopPayButton } from './ShopPayButton.client';
@@ -1,20 +1,15 @@
1
- import { ElementType } from 'react';
2
- import { Props } from '../types';
3
- import { UnitPriceMeasurement, MoneyV2 } from '../../graphql/types/types';
1
+ import type { UnitPriceMeasurement, MoneyV2 } from '../../storefront-api-types';
2
+ import type { PartialDeep } from 'type-fest';
4
3
  export interface UnitPriceProps<TTag> {
5
- /** A [`MoneyV2` object](/api/storefront/reference/common-objects/moneyv2). */
6
- data: MoneyV2;
7
- /** A [`UnitPriceMeasurement` object](/api/storefront/reference/products/unitpricemeasurement). */
8
- measurement: UnitPriceMeasurement;
4
+ /** An object with fields that correspond to the Storefront API's [MoneyV2 object](/api/storefront/reference/common-objects/moneyv2). */
5
+ data: PartialDeep<MoneyV2>;
6
+ /** A [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement). */
7
+ measurement: PartialDeep<UnitPriceMeasurement>;
9
8
  /** An HTML tag to be rendered as the base element wrapper. The default is `div`. */
10
9
  as?: TTag;
11
10
  }
12
11
  /**
13
12
  * The `UnitPrice` component renders a string with a [UnitPrice](/themes/pricing-payments/unit-pricing) as the
14
- * [Storefront API's `MoneyV2` object](/api/storefront/reference/common-objects/moneyv2) with a reference unit from the [Storefront API's `UnitPriceMeasurement` object](/api/storefront/reference/products/unitpricemeasurement).
13
+ * Storefront API's [MoneyV2 object](/api/storefront/reference/common-objects/moneyv2) with a reference unit from the Storefront API's [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement).
15
14
  */
16
- export declare function UnitPrice<TTag extends ElementType>(props: Props<TTag> & UnitPriceProps<TTag>): JSX.Element;
17
- export declare namespace UnitPrice {
18
- var Fragment: string;
19
- }
20
- export declare const UnitPriceFragment = "\nfragment UnitPriceFragment on ProductVariant {\n unitPriceMeasurement {\n measuredType\n quantityUnit\n quantityValue\n referenceUnit\n referenceValue\n }\n unitPrice {\n ...MoneyFragment\n }\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}";
15
+ export declare function UnitPrice<TTag extends keyof JSX.IntrinsicElements = 'div'>(props: JSX.IntrinsicElements[TTag] & UnitPriceProps<TTag>): JSX.Element | null;
@@ -1,17 +1,22 @@
1
1
  import React from 'react';
2
2
  import { Money } from '../Money';
3
- import { UnitPriceFragment as Fragment } from '../../graphql/graphql-constants';
4
3
  /**
5
4
  * The `UnitPrice` component renders a string with a [UnitPrice](/themes/pricing-payments/unit-pricing) as the
6
- * [Storefront API's `MoneyV2` object](/api/storefront/reference/common-objects/moneyv2) with a reference unit from the [Storefront API's `UnitPriceMeasurement` object](/api/storefront/reference/products/unitpricemeasurement).
5
+ * Storefront API's [MoneyV2 object](/api/storefront/reference/common-objects/moneyv2) with a reference unit from the Storefront API's [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement).
7
6
  */
8
7
  export function UnitPrice(props) {
9
8
  const { data, measurement, as, ...passthroughProps } = props;
9
+ if (!data) {
10
+ console.warn(`No "data" prop was passed to <UnitPrice/>`);
11
+ return null;
12
+ }
13
+ if (!measurement) {
14
+ console.warn(`No "measurement" prop was passed to <UnitPrice/>`);
15
+ return null;
16
+ }
10
17
  const Wrapper = as !== null && as !== void 0 ? as : 'div';
11
18
  return (React.createElement(Wrapper, { ...passthroughProps },
12
19
  React.createElement(Money, { data: data }),
13
20
  "/",
14
21
  measurement.referenceUnit));
15
22
  }
16
- UnitPrice.Fragment = Fragment;
17
- export const UnitPriceFragment = Fragment;
@@ -1 +1 @@
1
- export { UnitPrice, UnitPriceFragment } from './UnitPrice.client';
1
+ export { UnitPrice } from './UnitPrice.client';
@@ -1 +1 @@
1
- export { UnitPrice, UnitPriceFragment } from './UnitPrice.client';
1
+ export { UnitPrice } from './UnitPrice.client';
@@ -1,22 +1,14 @@
1
- import * as React from 'react';
2
- import { Props } from '../types';
3
1
  import { ImageSizeOptions } from '../../utilities';
4
- import { Video as VideoType, VideoSource, Image } from '../../graphql/types/types';
5
- export interface VideoProps {
6
- /** An object corresponding to the [GraphQL fragment](#graphql-fragment). */
7
- data: {
8
- id?: VideoType['id'];
9
- previewImage?: Pick<Image, 'url'>;
10
- sources: Pick<VideoSource, 'url' | 'mimeType'>[];
11
- };
2
+ import type { Video as VideoType } from '../../storefront-api-types';
3
+ import type { PartialDeep } from 'type-fest';
4
+ interface VideoProps {
5
+ /** An object with fields that correspond to the Storefront API's [Video object](/api/storefront/latest/objects/video). */
6
+ data: PartialDeep<VideoType>;
12
7
  /** An object of image size options for the video's `previewImage`. */
13
8
  options?: ImageSizeOptions;
14
9
  }
15
10
  /**
16
- * The `Video` component renders a `video` for the Storefront API's [`Video` object](/api/storefront/reference/products/video).
11
+ * The `Video` component renders a `video` for the Storefront API's [Video object](/api/storefront/reference/products/video).
17
12
  */
18
- export declare function Video<TTag extends React.ElementType = 'video'>(props: Props<TTag> & VideoProps): JSX.Element;
19
- export declare namespace Video {
20
- var Fragment: string;
21
- }
22
- export declare const VideoFragment = "fragment VideoFragment on Video {\n id\n previewImage {\n url\n }\n sources {\n mimeType\n url\n }\n}\n\n";
13
+ export declare function Video(props: JSX.IntrinsicElements['video'] & VideoProps): JSX.Element;
14
+ export {};
@@ -1,14 +1,19 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import { useImageUrl } from '../../utilities';
3
- import { VideoFragment as Fragment } from '../../graphql/graphql-constants';
4
3
  /**
5
- * The `Video` component renders a `video` for the Storefront API's [`Video` object](/api/storefront/reference/products/video).
4
+ * The `Video` component renders a `video` for the Storefront API's [Video object](/api/storefront/reference/products/video).
6
5
  */
7
6
  export function Video(props) {
8
7
  var _a;
9
8
  const { data, options, id = data.id, playsInline = true, controls = true, ...passthroughProps } = props;
10
9
  const posterUrl = useImageUrl((_a = data.previewImage) === null || _a === void 0 ? void 0 : _a.url, options);
11
- return (React.createElement("video", { ...passthroughProps, id: id, playsInline: playsInline, controls: controls, poster: posterUrl }, data.sources.map((source) => (React.createElement("source", { key: source.url, src: source.url, type: source.mimeType })))));
10
+ if (!data.sources) {
11
+ throw new Error(`<Video/> requires a 'data.sources' array`);
12
+ }
13
+ return (React.createElement("video", { ...passthroughProps, id: id, playsInline: playsInline, controls: controls, poster: posterUrl }, data.sources.map((source) => {
14
+ if (!((source === null || source === void 0 ? void 0 : source.url) && (source === null || source === void 0 ? void 0 : source.mimeType))) {
15
+ throw new Error(`<Video/> needs 'source.url' and 'source.mimeType'`);
16
+ }
17
+ return (React.createElement("source", { key: source.url, src: source.url, type: source.mimeType }));
18
+ })));
12
19
  }
13
- Video.Fragment = Fragment;
14
- export const VideoFragment = Fragment;
@@ -1,2 +1 @@
1
- export type { VideoProps } from './Video';
2
- export { Video, VideoFragment } from './Video';
1
+ export { Video } from './Video';
@@ -1 +1 @@
1
- export { Video, VideoFragment } from './Video';
1
+ export { Video } from './Video';