@shopify/hydrogen 0.11.0-experimental.1 → 0.11.1-experimental.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +504 -0
- package/dist/esnext/client.d.ts +1 -1
- package/dist/esnext/client.js +1 -1
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +1 -1
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +11 -2
- package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.js +1 -1
- package/dist/esnext/components/CartLineImage/CartLineImage.client.js +2 -2
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +1 -1
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +1 -1
- package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +2 -2
- package/dist/esnext/components/CartProvider/CartProvider.client.js +1 -1
- package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +1 -1
- package/dist/esnext/components/ExternalVideo/ExternalVideo.js +2 -2
- package/dist/esnext/components/Image/Image.d.ts +1 -1
- package/dist/esnext/components/Image/Image.js +9 -9
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +13 -4
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +5 -3
- package/dist/esnext/components/MediaFile/MediaFile.d.ts +8 -6
- package/dist/esnext/components/MediaFile/MediaFile.js +6 -6
- package/dist/esnext/components/Metafield/Metafield.client.d.ts +1 -1
- package/dist/esnext/components/Metafield/Metafield.client.js +16 -16
- package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +1 -1
- package/dist/esnext/components/ModelViewer/ModelViewer.client.js +1 -1
- package/dist/esnext/components/Money/Money.client.d.ts +1 -1
- package/dist/esnext/components/Money/Money.client.js +2 -2
- package/dist/esnext/components/ProductMetafield/ProductMetafield.client.d.ts +3 -1
- package/dist/esnext/components/ProductMetafield/ProductMetafield.client.js +21 -4
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -3
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +30 -9
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.d.ts +8 -0
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.js +12 -0
- package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +8 -7
- package/dist/esnext/components/ProductProvider/ProductProvider.client.js +9 -35
- package/dist/esnext/components/ProductProvider/context.d.ts +10 -6
- package/dist/esnext/components/ProductProvider/context.js +1 -0
- package/dist/esnext/components/Seo/DefaultPageSeo.client.js +2 -2
- package/dist/esnext/components/Seo/DescriptionSeo.client.js +2 -2
- package/dist/esnext/components/Seo/HomePageSeo.client.js +2 -2
- package/dist/esnext/components/Seo/ImageSeo.client.js +2 -2
- package/dist/esnext/components/Seo/ProductSeo.client.js +5 -3
- package/dist/esnext/components/Seo/TitleSeo.client.js +2 -2
- package/dist/esnext/components/Seo/TwitterSeo.client.js +2 -2
- package/dist/esnext/components/Seo/types.d.ts +1 -1
- package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +2 -2
- package/dist/esnext/components/UnitPrice/UnitPrice.client.js +3 -3
- package/dist/esnext/components/Video/Video.d.ts +1 -1
- package/dist/esnext/components/Video/Video.js +3 -3
- package/dist/esnext/components/index.d.ts +0 -8
- package/dist/esnext/components/index.js +0 -8
- package/dist/esnext/entry-client.js +1 -1
- package/dist/esnext/entry-server.d.ts +18 -2
- package/dist/esnext/entry-server.js +347 -329
- package/dist/esnext/foundation/Head/Head.client.d.ts +5 -0
- package/dist/esnext/foundation/Head/Head.client.js +10 -0
- package/dist/esnext/foundation/Head/index.d.ts +1 -0
- package/dist/esnext/foundation/Head/index.js +1 -0
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +2 -1
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +43 -4
- package/dist/esnext/foundation/useQuery/hooks.d.ts +11 -3
- package/dist/esnext/foundation/useQuery/hooks.js +21 -5
- package/dist/esnext/framework/CachingStrategy/index.d.ts +10 -0
- package/dist/esnext/framework/CachingStrategy/index.js +96 -0
- package/dist/esnext/framework/Hydration/Html.js +5 -12
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +20 -2
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +51 -2
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +2 -2
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +2 -11
- package/dist/esnext/framework/cache/in-memory.js +6 -5
- package/dist/esnext/framework/cache.d.ts +3 -3
- package/dist/esnext/framework/cache.js +4 -18
- package/dist/esnext/framework/middleware.d.ts +7 -7
- package/dist/esnext/framework/middleware.js +15 -43
- package/dist/esnext/framework/plugin.js +14 -3
- package/dist/esnext/framework/plugins/vite-plugin-hydration-auto-import.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydration-auto-import.js +38 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +9 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.js +37 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +2 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +3 -1
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +70 -0
- package/dist/esnext/hooks/useProduct/useProduct.d.ts +150 -1
- package/dist/esnext/hooks/useProduct/useProduct.js +36 -3
- package/dist/esnext/hooks/useProductOptions/types.d.ts +1 -1
- package/dist/esnext/hooks/useProductOptions/useProductOptions.d.ts +1 -1
- package/dist/esnext/hooks/useProductOptions/useProductOptions.js +6 -6
- package/dist/esnext/hooks/useShopQuery/hooks.d.ts +11 -4
- package/dist/esnext/hooks/useShopQuery/hooks.js +6 -3
- package/dist/esnext/index.d.ts +2 -1
- package/dist/esnext/index.js +2 -1
- package/dist/esnext/platforms/node.d.ts +10 -0
- package/dist/esnext/platforms/node.js +38 -0
- package/dist/esnext/platforms/worker-event.d.ts +9 -0
- package/dist/esnext/platforms/worker-event.js +24 -0
- package/dist/esnext/streaming.server.d.ts +17 -7
- package/dist/esnext/streaming.server.js +44 -0
- package/dist/esnext/types.d.ts +25 -25
- package/dist/esnext/utilities/apiRoutes.d.ts +1 -2
- package/dist/esnext/utilities/apiRoutes.js +4 -3
- package/dist/esnext/utilities/bot-ua.d.ts +4 -0
- package/dist/esnext/utilities/bot-ua.js +54 -0
- package/dist/esnext/utilities/fetch.js +1 -26
- package/dist/esnext/utilities/log/index.d.ts +4 -1
- package/dist/esnext/utilities/log/index.js +4 -1
- package/dist/esnext/utilities/log/log-cache-api-status.d.ts +1 -0
- package/dist/esnext/utilities/log/log-cache-api-status.js +9 -0
- package/dist/esnext/utilities/log/log-cache-header.d.ts +10 -0
- package/dist/esnext/utilities/log/log-cache-header.js +30 -0
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +12 -0
- package/dist/esnext/utilities/log/log-query-timeline.js +83 -0
- package/dist/esnext/utilities/log/log.d.ts +11 -8
- package/dist/esnext/utilities/log/log.js +24 -35
- package/dist/esnext/utilities/log/utils.d.ts +3 -0
- package/dist/esnext/utilities/log/utils.js +13 -0
- package/dist/esnext/utilities/template.d.ts +9 -0
- package/dist/esnext/utilities/template.js +23 -0
- package/dist/{worker/foundation/ShopifyProvider/types.js → esnext/utilities/web-api-polyfill.d.ts} +0 -0
- package/dist/esnext/utilities/web-api-polyfill.js +19 -0
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/entry-server.d.ts +22 -0
- package/dist/node/entry-server.js +581 -0
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +23 -0
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +132 -0
- package/dist/node/foundation/ServerRequestProvider/index.d.ts +1 -0
- package/dist/node/foundation/ServerRequestProvider/index.js +13 -0
- package/dist/node/foundation/ServerStateProvider/ServerStateProvider.client.d.ts +25 -0
- package/dist/node/foundation/ServerStateProvider/ServerStateProvider.client.js +68 -0
- package/dist/node/foundation/ServerStateProvider/index.d.ts +2 -0
- package/dist/node/foundation/ServerStateProvider/index.js +6 -0
- package/dist/node/framework/CachingStrategy/index.d.ts +10 -0
- package/dist/node/framework/CachingStrategy/index.js +108 -0
- package/dist/node/framework/Hydration/Html.js +5 -12
- package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +20 -2
- package/dist/node/framework/Hydration/ServerComponentRequest.server.js +50 -1
- package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +2 -2
- package/dist/node/framework/Hydration/ServerComponentResponse.server.js +2 -11
- package/dist/node/framework/cache/in-memory.js +6 -5
- package/dist/node/framework/cache.d.ts +3 -3
- package/dist/node/framework/cache.js +6 -20
- package/dist/node/framework/middleware.d.ts +7 -7
- package/dist/node/framework/middleware.js +14 -46
- package/dist/node/framework/plugin.js +33 -3
- package/dist/node/framework/plugins/vite-plugin-hydration-auto-import.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-hydration-auto-import.js +43 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +9 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.js +39 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +2 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +4 -1
- package/dist/node/framework/plugins/vite-plugin-platform-entry.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +75 -0
- package/dist/node/streaming.server.d.ts +21 -0
- package/dist/node/streaming.server.js +59 -0
- package/dist/node/types.d.ts +25 -25
- package/dist/node/utilities/apiRoutes.d.ts +1 -2
- package/dist/node/utilities/apiRoutes.js +4 -3
- package/dist/node/utilities/bot-ua.d.ts +4 -0
- package/dist/node/utilities/bot-ua.js +58 -0
- package/dist/node/utilities/defer.d.ts +6 -0
- package/dist/node/utilities/defer.js +18 -0
- package/dist/node/utilities/error.d.ts +1 -0
- package/dist/node/utilities/error.js +10 -0
- package/dist/node/utilities/log/index.d.ts +4 -0
- package/dist/node/utilities/log/index.js +18 -0
- package/dist/node/utilities/log/log-cache-api-status.d.ts +1 -0
- package/dist/node/utilities/log/log-cache-api-status.js +13 -0
- package/dist/node/utilities/log/log-cache-header.d.ts +10 -0
- package/dist/node/utilities/log/log-cache-header.js +35 -0
- package/dist/node/utilities/log/log-query-timeline.d.ts +12 -0
- package/dist/node/utilities/log/log-query-timeline.js +88 -0
- package/dist/node/utilities/log/log.d.ts +11 -8
- package/dist/node/utilities/log/log.js +27 -37
- package/dist/node/utilities/log/utils.d.ts +3 -0
- package/dist/node/utilities/log/utils.js +18 -0
- package/dist/node/utilities/template.d.ts +9 -0
- package/dist/node/utilities/template.js +27 -0
- package/dist/{worker/types.js → node/utilities/web-api-polyfill.d.ts} +0 -0
- package/dist/node/utilities/web-api-polyfill.js +43 -0
- package/package.json +20 -10
- package/web-polyfills.js +1 -0
- package/LICENSE.md +0 -7
- package/dist/esnext/components/CartLineAttributes/CartLineAttributes.client.d.ts +0 -22
- package/dist/esnext/components/CartLineAttributes/CartLineAttributes.client.js +0 -13
- package/dist/esnext/components/CartLineAttributes/index.d.ts +0 -1
- package/dist/esnext/components/CartLineAttributes/index.js +0 -1
- package/dist/esnext/components/CartLineSelectedOptions/CartLineSelectedOptions.client.d.ts +0 -21
- package/dist/esnext/components/CartLineSelectedOptions/CartLineSelectedOptions.client.js +0 -13
- package/dist/esnext/components/CartLineSelectedOptions/index.d.ts +0 -1
- package/dist/esnext/components/CartLineSelectedOptions/index.js +0 -1
- package/dist/esnext/components/SelectedVariantAddToCartButton/SelectedVariantAddToCartButton.client.d.ts +0 -11
- package/dist/esnext/components/SelectedVariantAddToCartButton/SelectedVariantAddToCartButton.client.js +0 -17
- package/dist/esnext/components/SelectedVariantAddToCartButton/index.d.ts +0 -1
- package/dist/esnext/components/SelectedVariantAddToCartButton/index.js +0 -1
- package/dist/esnext/components/SelectedVariantBuyNowButton/SelectedVariantBuyNowButton.d.ts +0 -9
- package/dist/esnext/components/SelectedVariantBuyNowButton/SelectedVariantBuyNowButton.js +0 -17
- package/dist/esnext/components/SelectedVariantBuyNowButton/index.d.ts +0 -1
- package/dist/esnext/components/SelectedVariantBuyNowButton/index.js +0 -1
- package/dist/esnext/components/SelectedVariantImage/SelectedVariantImage.client.d.ts +0 -10
- package/dist/esnext/components/SelectedVariantImage/SelectedVariantImage.client.js +0 -16
- package/dist/esnext/components/SelectedVariantImage/index.d.ts +0 -1
- package/dist/esnext/components/SelectedVariantImage/index.js +0 -1
- package/dist/esnext/components/SelectedVariantMetafield/SelectedVariantMetafield.client.d.ts +0 -15
- package/dist/esnext/components/SelectedVariantMetafield/SelectedVariantMetafield.client.js +0 -24
- package/dist/esnext/components/SelectedVariantMetafield/index.d.ts +0 -1
- package/dist/esnext/components/SelectedVariantMetafield/index.js +0 -1
- package/dist/esnext/components/SelectedVariantPrice/SelectedVariantPrice.client.d.ts +0 -12
- package/dist/esnext/components/SelectedVariantPrice/SelectedVariantPrice.client.js +0 -22
- package/dist/esnext/components/SelectedVariantPrice/index.d.ts +0 -1
- package/dist/esnext/components/SelectedVariantPrice/index.js +0 -1
- package/dist/esnext/components/SelectedVariantShopPayButton/SelectedVariantShopPayButton.client.d.ts +0 -8
- package/dist/esnext/components/SelectedVariantShopPayButton/SelectedVariantShopPayButton.client.js +0 -18
- package/dist/esnext/components/SelectedVariantShopPayButton/index.d.ts +0 -1
- package/dist/esnext/components/SelectedVariantShopPayButton/index.js +0 -1
- package/dist/esnext/components/SelectedVariantUnitPrice/SelectedVariantUnitPrice.client.d.ts +0 -7
- package/dist/esnext/components/SelectedVariantUnitPrice/SelectedVariantUnitPrice.client.js +0 -16
- package/dist/esnext/components/SelectedVariantUnitPrice/index.d.ts +0 -1
- package/dist/esnext/components/SelectedVariantUnitPrice/index.js +0 -1
- package/dist/esnext/foundation/Helmet/Helmet.client.d.ts +0 -10
- package/dist/esnext/foundation/Helmet/Helmet.client.js +0 -10
- package/dist/esnext/foundation/Helmet/index.d.ts +0 -1
- package/dist/esnext/foundation/Helmet/index.js +0 -1
- package/dist/esnext/handle-event.d.ts +0 -23
- package/dist/esnext/handle-event.js +0 -132
- package/dist/esnext/handle-worker-event.d.ts +0 -11
- package/dist/esnext/handle-worker-event.js +0 -14
- package/dist/node/foundation/Helmet/Helmet.client.d.ts +0 -10
- package/dist/node/foundation/Helmet/Helmet.client.js +0 -17
- package/dist/node/foundation/Helmet/index.d.ts +0 -1
- package/dist/node/foundation/Helmet/index.js +0 -5
- package/dist/node/foundation/ssr-interop.d.ts +0 -29
- package/dist/node/foundation/ssr-interop.js +0 -39
- package/dist/node/handle-event.d.ts +0 -23
- package/dist/node/handle-event.js +0 -135
- package/dist/worker/constants.d.ts +0 -1
- package/dist/worker/constants.js +0 -1
- package/dist/worker/foundation/Helmet/Helmet.client.d.ts +0 -10
- package/dist/worker/foundation/Helmet/Helmet.client.js +0 -10
- package/dist/worker/foundation/Helmet/index.d.ts +0 -1
- package/dist/worker/foundation/Helmet/index.js +0 -1
- package/dist/worker/foundation/ShopifyProvider/types.d.ts +0 -15
- package/dist/worker/foundation/ssr-interop.d.ts +0 -29
- package/dist/worker/foundation/ssr-interop.js +0 -35
- package/dist/worker/framework/Hydration/ServerComponentRequest.server.d.ts +0 -23
- package/dist/worker/framework/Hydration/ServerComponentRequest.server.js +0 -57
- package/dist/worker/framework/config.d.ts +0 -6
- package/dist/worker/framework/config.js +0 -6
- package/dist/worker/framework/runtime.d.ts +0 -13
- package/dist/worker/framework/runtime.js +0 -27
- package/dist/worker/graphql/types/types.d.ts +0 -5761
- package/dist/worker/graphql/types/types.js +0 -1436
- package/dist/worker/handle-event.d.ts +0 -23
- package/dist/worker/handle-event.js +0 -132
- package/dist/worker/handle-worker-event.d.ts +0 -11
- package/dist/worker/handle-worker-event.js +0 -14
- package/dist/worker/types.d.ts +0 -96
- package/dist/worker/utilities/apiRoutes.d.ts +0 -21
- package/dist/worker/utilities/apiRoutes.js +0 -87
- package/dist/worker/utilities/log/log.d.ts +0 -18
- package/dist/worker/utilities/log/log.js +0 -77
- package/dist/worker/utilities/matchPath.d.ts +0 -10
- package/dist/worker/utilities/matchPath.js +0 -54
- package/dist/worker/utilities/timing.d.ts +0 -7
- package/dist/worker/utilities/timing.js +0 -14
- package/worker.js +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
<!-- ## [Unreleased] -->
|
|
9
|
+
|
|
10
|
+
## 0.11.1-experimental.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- b96179fd: Ensure ProductSeo knows how to handle `featuredImage = null`
|
|
15
|
+
- 2e487b7e: Switch to using Changesets for changelogs.
|
|
16
|
+
- 2d8ab7e2: Hydrogen docs: Preloaded queries and query timing
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Make `featuredImage` optional and handle it in <Seo />
|
|
21
|
+
|
|
22
|
+
## [0.11.0] - 2022-02-24
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- New React hook `useScriptLoader` is available to more easily load external scripts
|
|
27
|
+
- Add `totalQuantity` to the returned object from `useCart()`
|
|
28
|
+
- Export `ProductPrice` and `ProductMetafield` standalone components
|
|
29
|
+
- Added `useUrl` hook that allows the consumer to get the current url in server or client component
|
|
30
|
+
- Added logging option `showCacheApiStatus` and `cacheControlHeader` by @wizardlyhel in [#472](https://github.com/Shopify/hydrogen/pull/472)
|
|
31
|
+
- Pass HYDROGEN_ASSET_BASE_URL into config to set base URL for compiled assets
|
|
32
|
+
- Introduce Hydrogen the `<Link>` component and `useNavigate` hook for routing
|
|
33
|
+
- Add a default virtual entry-client in `/@shopify/hydrogen/entry-client` that can be used in `index.html`
|
|
34
|
+
- Enable early hydration when streaming
|
|
35
|
+
- Add variantId prop to `<ProductMetafield />` component [#730](https://github.com/Shopify/hydrogen/pull/730)
|
|
36
|
+
- Add query timing logging option `showQueryTiming` [#699](https://github.com/Shopify/hydrogen/pull/699)
|
|
37
|
+
- Add variantId prop to `<ProductPrice />` component
|
|
38
|
+
- Add `preload` option to `useQuery` and `useShopQuery` [#700](https://github.com/Shopify/hydrogen/pull/700)
|
|
39
|
+
|
|
40
|
+
### Breaking Change
|
|
41
|
+
|
|
42
|
+
- `<Model3D>` has been renamed to `<ModelViewer>`
|
|
43
|
+
- `<Product />` and `<CartLine />` aliases have been removed; use the original components `<ProductProvider />` and `<CartLineProvider />` instead. Their nested component aliases, such as `<Product.Image />`, have also been removed; in this example you should use `<ProductImage />`.
|
|
44
|
+
- Merge `/src/entry-server.jsx` entry point into `App.server.jsx`
|
|
45
|
+
- The following components had their prop name renamed. Refer to the documentation or [#627](https://github.com/Shopify/hydrogen/issues/627) for more details.
|
|
46
|
+
- `<ExternalVideo />`: renamed video prop to data
|
|
47
|
+
- `<Video />`: renamed video prop to data
|
|
48
|
+
- `<Image>`: renamed image prop to data
|
|
49
|
+
- `<MediaFile>`: renamed media prop to data
|
|
50
|
+
- `<ModelViewer>`: renamed model prop to data
|
|
51
|
+
- `<Metafield>`: renamed metafield prop to data
|
|
52
|
+
- `<Money>`: renamed money prop to data
|
|
53
|
+
- `<UnitPrice>`: renamed unitPrice prop to data, unitPriceMeasurement prop to measurement
|
|
54
|
+
- `<ProductProvider>`: renamed product prop to data
|
|
55
|
+
- `<CartProvider>`: renamed cart prop to data
|
|
56
|
+
- Helmet component has been renamed to Head
|
|
57
|
+
- Remove the `<SelectedVariantBuyNowButton />` component in favour of using `<BuyNowButton variantId={product.selectedVariant.id} />`
|
|
58
|
+
- `<SelectedVariantAddToCartButton />` has been removed; the `<AddToCartButton />` will now use the selectedVariant by default.
|
|
59
|
+
- Remove the `<SelectedVariantImage />` component in favour of using `<Image data={product.selectedVariant.image} />`
|
|
60
|
+
- Remove the `<SelectedVariantMetafield />` component in favour of using `<ProductMetafield variantId={product.selectedVariant.id} />`
|
|
61
|
+
- Remove the `<SelectedVariantShopPayButton />` component in favour of using `<ShopPayButton variantId={product.selectedVariant.id} />`
|
|
62
|
+
- Remove the `<SelectedVariantPrice/>` and `<SelectedVariantUnitPrice/>` component in favour of using `<ProductPrice variantId={product.selectedVariant.id} />`
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- Change `/react` RSC path to `/__rsc`
|
|
67
|
+
- `<ShopifyProvider>` can again be used in server components
|
|
68
|
+
- Use hashes as client component ids instead of absolute paths
|
|
69
|
+
- Transition away from deprecated currency selector in favor of country selector
|
|
70
|
+
- Simplify Helmet usage and make it compatible with RSC
|
|
71
|
+
- The `Seo.client` component has been moved from `src/components` to `@shopify/hydrogen`. The props of the `Seo.client` component also changed to always take in `type` and `data`. Refer to the [`Seo` component reference](../src/components/Seo/README.md) for more details. [#539](https://github.com/Shopify/hydrogen/pull/539)
|
|
72
|
+
- Standardize cache control header into caching strategies by @wizardlyhel in [#629](https://github.com/Shopify/hydrogen/pull/629)
|
|
73
|
+
- Target future release to use '2022-01' API Version
|
|
74
|
+
- Correct Typescript issue where `as` was a default prop for all components when it should not be
|
|
75
|
+
- Update types and docs for `useCart()` hook and `<CartProvider>`
|
|
76
|
+
- Track page load performance
|
|
77
|
+
- The following money components no longer allow the function-as-a-child (also known as "render props") pattern; see [#589](https://github.com/Shopify/hydrogen/pull/589)
|
|
78
|
+
- `<Money>` Use `useMoney()` for customization
|
|
79
|
+
- `<CartLinePrice>` Use `useMoney()` for customization
|
|
80
|
+
- `<ProductPrice>` Use `useMoney()` for customization
|
|
81
|
+
- `<SelectedVariantPrice>` Use `useMoney()` for customization
|
|
82
|
+
- `<Metafield>` Use `useParsedMetafields()` for customization
|
|
83
|
+
- `<ProductMetafield>` Use `useParsedMetafields()` for customization
|
|
84
|
+
- `<SelectedVariantMetafield>` Use `useParsedMetafields()` for customization
|
|
85
|
+
- `<UnitPrice>` Use `useMoney()` for customization
|
|
86
|
+
- `<CartLines>` Use `useCart()` for customization
|
|
87
|
+
- `<Metafield>` now renders `ratings` as a `<span>` with text instead of stars; `multi_line_text_field` inside of a `<span>` instead of a `<div>`
|
|
88
|
+
- Use `featureImage` instead of images(first:1) on product query
|
|
89
|
+
- Update `react-helmet-async` to 1.2.3 and remove our custom types
|
|
90
|
+
|
|
91
|
+
### Fixed
|
|
92
|
+
|
|
93
|
+
- Fix index routes. See [#562](https://github.com/Shopify/hydrogen/issues/562)
|
|
94
|
+
- Fix missing server state on SSR pass
|
|
95
|
+
- Fix mobile navigation in example that scrolls the body underneath when shown by @Francismori7 in [#582](https://github.com/Shopify/hydrogen/pull/582)
|
|
96
|
+
- Add charset to content type in HTML responses
|
|
97
|
+
- Fix header shift when cart is opened by @Francismori7 in [#600](https://github.com/Shopify/hydrogen/pull/600)
|
|
98
|
+
- Fix bug where search param is not being pass along during RSC streaming call [#623](https://github.com/Shopify/hydrogen/pull/623)
|
|
99
|
+
- Allow custom entry-client filenames
|
|
100
|
+
- Clear browser fetch cache by @wizardlyhel in [#591](https://github.com/Shopify/hydrogen/pull/591)
|
|
101
|
+
- Cannot redefine property error when updating client components
|
|
102
|
+
- `ShopPayButton` supports quantities greater than 1. Also fixed issues with IDs in Storefront API version 2022-01
|
|
103
|
+
- Render error in `Gallery.client.jsx` component when product resource has an external video or no images.
|
|
104
|
+
- Ensure youtube external videos are embed compatible urls
|
|
105
|
+
- Prevent client components from being cached during development
|
|
106
|
+
- Backticks in HTML break RSC hydration.
|
|
107
|
+
|
|
108
|
+
### Removed
|
|
109
|
+
|
|
110
|
+
- <CartLineSelectedOptions /> and <CartLineAttributes /> components. These components used the “function-as-a-child” pattern which doesn’t allow the `children` prop to be serialized, preventing them from being rendered within Server components.
|
|
111
|
+
|
|
112
|
+
_Migration_
|
|
113
|
+
|
|
114
|
+
The functionality provided by these components can be replicated using the `useCartLine()` hook instead.
|
|
115
|
+
|
|
116
|
+
_Example_
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
// Before
|
|
120
|
+
function SomeComponent() {
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
<CartLineSelectedOptions as="ul" className="text-xs space-y-1">
|
|
124
|
+
{({name, value}) => (
|
|
125
|
+
<>
|
|
126
|
+
{name}: {value}
|
|
127
|
+
</>
|
|
128
|
+
)}
|
|
129
|
+
</CartLineSelectedOptions>
|
|
130
|
+
<CartLineAttributes as="ul" className="text-sm space-y-1">
|
|
131
|
+
{({key, value}) => (
|
|
132
|
+
<>
|
|
133
|
+
{key}: {value}
|
|
134
|
+
</>
|
|
135
|
+
)}
|
|
136
|
+
</CartLineAttributes>
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// After
|
|
142
|
+
function SomeComponent() {
|
|
143
|
+
const {merchandise} = useCartLine();
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<>
|
|
147
|
+
<ul className="text-xs space-y-1">
|
|
148
|
+
{merchandise.selectedOptions.map(({name, value}) => (
|
|
149
|
+
<li key={name}>
|
|
150
|
+
{name}: {value}
|
|
151
|
+
</li>
|
|
152
|
+
))}
|
|
153
|
+
</ul>
|
|
154
|
+
</>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
- Remove `fetch` workaround
|
|
160
|
+
- Remove the following hooks. (All the same functionality can be retrieved through the `useCart()` hook)
|
|
161
|
+
- `useCartAttributesUpdateCallback`
|
|
162
|
+
- `useCartBuyerIdentityUpdateCallback`
|
|
163
|
+
- `useCartCheckoutUrl`
|
|
164
|
+
- `useCartCreateCallback`
|
|
165
|
+
- `useCartDiscountCodesUpdateCallback`
|
|
166
|
+
- `useCartLinesAddCallback`
|
|
167
|
+
- `useCartLinesRemoveCallback`
|
|
168
|
+
- `useCartLinesTotalQuantity`
|
|
169
|
+
- `useCartLinesUpdateCallback`
|
|
170
|
+
- `useCartNoteUpdateCallback`
|
|
171
|
+
- Remove React Router on the client
|
|
172
|
+
- Remove `handleEvent` in favor of `handleRequest`
|
|
173
|
+
- Remove `assetHandler` parameter in the new `handleRequest`
|
|
174
|
+
- `<SelectedVariantAddToCartButton />` has been removed; the `<AddToCartButton />` will now use the selectedVariant by default.
|
|
175
|
+
- Remove the `<SelectedVariantImage />` component in favour of using `<Image data={product.selectedVariant.image} />`
|
|
176
|
+
- Remove the `<SelectedVariantMetafield />` component in favour of using `<ProductMetafield variantId={product.selectedVariant.id} />`
|
|
177
|
+
- Remove the `<SelectedVariantBuyNowButton />` component in favour of using `<BuyNowButton variantId={product.selectedVariant.id} />`
|
|
178
|
+
- Remove the `<SelectedVariantShopPayButton />` component in favour of using `<ShopPayButton variantId={product.selectedVariant.id} />`
|
|
179
|
+
|
|
180
|
+
## [0.10.1] - 2022-01-26
|
|
181
|
+
|
|
182
|
+
### Fixed
|
|
183
|
+
|
|
184
|
+
- Hot reload for newly added page files
|
|
185
|
+
|
|
186
|
+
## [0.10.0] - 2022-01-25
|
|
187
|
+
|
|
188
|
+
### Changed
|
|
189
|
+
|
|
190
|
+
- Warn instead of error when a page server component is missing valid exports
|
|
191
|
+
- Adopt upstream version of React Server Components. See [#498](https://github.com/Shopify/hydrogen/pull/498) for breaking changes
|
|
192
|
+
- Bump to latest version of React experimental to include [upstream context bugfix](https://github.com/facebook/react/issues/23089)
|
|
193
|
+
- Improve API routes by allowing [strings and JS objects](https://github.com/Shopify/hydrogen/issues/476) to be returned.
|
|
194
|
+
|
|
195
|
+
### Breaking Change
|
|
196
|
+
|
|
197
|
+
- The 'locale' option in shopify.config.js had been renamed to 'defaultLocale'
|
|
198
|
+
- Rename `graphqlApiVersion` to `storefrontApiVersion` in `shopify.config.js`
|
|
199
|
+
|
|
200
|
+
### Fixed
|
|
201
|
+
|
|
202
|
+
- Make sure that API routes [hot reload properly](https://github.com/Shopify/hydrogen/issues/497)
|
|
203
|
+
|
|
204
|
+
## [0.9.1] - 2022-01-20
|
|
205
|
+
|
|
206
|
+
### Changed
|
|
207
|
+
|
|
208
|
+
- Transitive dependency bump.
|
|
209
|
+
|
|
210
|
+
## [0.9.0] - 2022-01-20
|
|
211
|
+
|
|
212
|
+
### Added
|
|
213
|
+
|
|
214
|
+
- API routes 🎉
|
|
215
|
+
|
|
216
|
+
### Changed
|
|
217
|
+
|
|
218
|
+
- Move to undici instead of node-fetch
|
|
219
|
+
|
|
220
|
+
## [0.8.3] - 2022-01-13
|
|
221
|
+
|
|
222
|
+
### Added
|
|
223
|
+
|
|
224
|
+
- Add optional `locale` param to `useShopQuery` to be used as `Accept-Language` in the store Storefront API query
|
|
225
|
+
- Optional purge query cache per build
|
|
226
|
+
|
|
227
|
+
### Fixed
|
|
228
|
+
|
|
229
|
+
- Replace log abbreviations with full text.
|
|
230
|
+
|
|
231
|
+
## [0.8.2] - 2022-01-07
|
|
232
|
+
|
|
233
|
+
### Changed
|
|
234
|
+
|
|
235
|
+
- Warn when requests take longer than 3000ms instead of erroring
|
|
236
|
+
- `useQuery` returns an error if the query's fetch was unsuccessful
|
|
237
|
+
- `useShopQuery` will give error hints to look at `shopify.config.js` when the Storefront API responds with a 403
|
|
238
|
+
|
|
239
|
+
### Fixed
|
|
240
|
+
|
|
241
|
+
- Load logger only once.
|
|
242
|
+
- Do not attempt to decode product IDs, as they are no longer base64-encoded in `unstable`
|
|
243
|
+
|
|
244
|
+
## [0.8.1] - 2022-01-04
|
|
245
|
+
|
|
246
|
+
### Added
|
|
247
|
+
|
|
248
|
+
- Detect bot user agents and give bots a non-streamed response.
|
|
249
|
+
- Add global `Oxygen.env` for server-only environment variables.
|
|
250
|
+
- Logging abstraction with default timing information
|
|
251
|
+
|
|
252
|
+
### Changed
|
|
253
|
+
|
|
254
|
+
- Upgrade to latest React 18 experimental version
|
|
255
|
+
|
|
256
|
+
### Fixed
|
|
257
|
+
|
|
258
|
+
- Cart decrease button removes at zero quantity
|
|
259
|
+
|
|
260
|
+
## [0.8.0] - 2021-12-07
|
|
261
|
+
|
|
262
|
+
### Fixed
|
|
263
|
+
|
|
264
|
+
- Export `CartLineSelectedOptions` properly
|
|
265
|
+
- Fix suspense utility function
|
|
266
|
+
|
|
267
|
+
## [0.7.1] - 2021-12-02
|
|
268
|
+
|
|
269
|
+
### Changed
|
|
270
|
+
|
|
271
|
+
- Allow `useShopQuery` to be skippable if no query is passed
|
|
272
|
+
- Remove usage of `react-query` (Not a breaking change)
|
|
273
|
+
|
|
274
|
+
### Fixed
|
|
275
|
+
|
|
276
|
+
- Avoid repeating the same identifier for default and named exports
|
|
277
|
+
- Remove sourcemap warnings
|
|
278
|
+
|
|
279
|
+
## [0.7.0] - 2021-11-22
|
|
280
|
+
|
|
281
|
+
### Added
|
|
282
|
+
|
|
283
|
+
- Add file reference metafield support
|
|
284
|
+
- Allow custom Model3D poster
|
|
285
|
+
- Support synchronous server redirects
|
|
286
|
+
|
|
287
|
+
### Fixed
|
|
288
|
+
|
|
289
|
+
- Binding of waitUntil in playground/server-components-worker
|
|
290
|
+
- Default to `retry: false` in `useQuery`
|
|
291
|
+
- Warn and ignore reserved properties in server state
|
|
292
|
+
- Run graphiql middleware before vite, fixing graphiql
|
|
293
|
+
|
|
294
|
+
## [0.6.4] - 2021-11-11
|
|
295
|
+
|
|
296
|
+
### Fixed
|
|
297
|
+
|
|
298
|
+
- Let Vite handle public assets in development
|
|
299
|
+
- New lines in hydration request break JSON.parse
|
|
300
|
+
- Normalize POSIX separators to support windows [#201](https://github.com/Shopify/hydrogen/pull/201)
|
|
301
|
+
- Scroll to top on app first load
|
|
302
|
+
- Update variantID to variantId [#78](https://github.com/Shopify/hydrogen/pull/78)
|
|
303
|
+
|
|
304
|
+
## [0.6.3] - 2021-11-10
|
|
305
|
+
|
|
306
|
+
### Fixed
|
|
307
|
+
|
|
308
|
+
- Add trailing slash to user components glob
|
|
309
|
+
|
|
310
|
+
## [0.6.2] - 2021-11-10
|
|
311
|
+
|
|
312
|
+
### Fixed
|
|
313
|
+
|
|
314
|
+
- Remove CartProvider from BuyNowButton
|
|
315
|
+
- Reading property of null for component props
|
|
316
|
+
- Transform deeply-imported client components
|
|
317
|
+
- Duplicated files and contexts in browser
|
|
318
|
+
|
|
319
|
+
## [0.6.1] - 2021-11-08
|
|
320
|
+
|
|
321
|
+
### Changed
|
|
322
|
+
|
|
323
|
+
- Transitive dependency bump.
|
|
324
|
+
|
|
325
|
+
### Fixed
|
|
326
|
+
|
|
327
|
+
- Do not set headers after they are sent to client
|
|
328
|
+
|
|
329
|
+
## [0.6.0] - 2021-11-05
|
|
330
|
+
|
|
331
|
+
### Changed
|
|
332
|
+
|
|
333
|
+
- Disable the quantity adjust button when the cart is not idle
|
|
334
|
+
- Use country server state in cart for the inContext directive
|
|
335
|
+
- Use Image url field instead of deprecated originalSrc field
|
|
336
|
+
- Switch to unstable API
|
|
337
|
+
|
|
338
|
+
### Fixed
|
|
339
|
+
|
|
340
|
+
- Update interaction prompt and interaction promp style attributes for Model3d
|
|
341
|
+
- Make sure all errors show an error dialog when hydrogen is in dev mode
|
|
342
|
+
- MediaFile component warning on non-Model3D types
|
|
343
|
+
- Remove console logs for caching
|
|
344
|
+
- Lowercased SVG tags in RSC
|
|
345
|
+
- Make the URL search property available via hooks
|
|
346
|
+
|
|
347
|
+
## 0.5.8 - 2021-11-04
|
|
348
|
+
|
|
349
|
+
### Fixed
|
|
350
|
+
|
|
351
|
+
- Ensure delayed callback is fired for cache purposes in Workers runtimes.
|
|
352
|
+
|
|
353
|
+
## 0.5.3 - 2021-11-02
|
|
354
|
+
|
|
355
|
+
### Changed
|
|
356
|
+
|
|
357
|
+
- No updates. Transitive dependency bump.
|
|
358
|
+
|
|
359
|
+
## 0.5.2 - 2021-11-02
|
|
360
|
+
|
|
361
|
+
### Changed
|
|
362
|
+
|
|
363
|
+
- No updates. Transitive dependency bump.
|
|
364
|
+
|
|
365
|
+
## 0.5.1 - 2021-11-02
|
|
366
|
+
|
|
367
|
+
### Changed
|
|
368
|
+
|
|
369
|
+
- No updates. Transitive dependency bump.
|
|
370
|
+
|
|
371
|
+
## 0.5.0 - 2021-11-01
|
|
372
|
+
|
|
373
|
+
### Fixed
|
|
374
|
+
|
|
375
|
+
- Update the ServerStateProvider context
|
|
376
|
+
- Add tabIndex to ShopPayButton
|
|
377
|
+
- Update LocalizationProvider query, context, and exports
|
|
378
|
+
|
|
379
|
+
## 0.4.3 - 2021-10-29
|
|
380
|
+
|
|
381
|
+
### Added
|
|
382
|
+
|
|
383
|
+
- Introduct full-page and sub-request caching API.
|
|
384
|
+
|
|
385
|
+
## 0.4.2 - 2021-10-29
|
|
386
|
+
|
|
387
|
+
### Changed
|
|
388
|
+
|
|
389
|
+
- Update Model3D props and add binding to model-viewer events
|
|
390
|
+
|
|
391
|
+
### Fixed
|
|
392
|
+
|
|
393
|
+
- Add `passthoughProps.disabled` to `AddToCartButton`
|
|
394
|
+
- Do not show undefined currency symbol in production
|
|
395
|
+
|
|
396
|
+
## 0.4.0 - 2021-10-27
|
|
397
|
+
|
|
398
|
+
### Added
|
|
399
|
+
|
|
400
|
+
- Add external image support to Image component
|
|
401
|
+
|
|
402
|
+
### Changed
|
|
403
|
+
|
|
404
|
+
- Make `CartProvider` a client-only concern. [#631](https://github.com/Shopify/hydrogen/pull/631)
|
|
405
|
+
- Use `Accept: application/hydrogen` as a header when making `fetch` calls against a Hydrogen page. Useful for Custom Responses.
|
|
406
|
+
|
|
407
|
+
### Fixed
|
|
408
|
+
|
|
409
|
+
- Lock model-viewer.js version to 1.8
|
|
410
|
+
- Use the Intl.NumberFormat parts for determining the amount value returned by the useMoney hook
|
|
411
|
+
- Optimize React related dependencies at server start to avoid page reloads
|
|
412
|
+
- Do not throw when `storeDomain` contains protocol.
|
|
413
|
+
|
|
414
|
+
## 0.3.0 - 2021-10-20
|
|
415
|
+
|
|
416
|
+
### Added
|
|
417
|
+
|
|
418
|
+
- Export utilities in client bundle
|
|
419
|
+
|
|
420
|
+
### Fixed
|
|
421
|
+
|
|
422
|
+
- `parseCookies` will split only on first =
|
|
423
|
+
- Make BuyNowButton a client component since it uses useEffect
|
|
424
|
+
- Preserve original aspect ratio for product images
|
|
425
|
+
- Invoke CartProvider callbacks before performing the GraphQL mutations
|
|
426
|
+
- Fix the accessible label in the AddToCartButton component when an item is added to cart
|
|
427
|
+
- Cart fetch to return stringified error
|
|
428
|
+
|
|
429
|
+
### Removed
|
|
430
|
+
|
|
431
|
+
- Remove sourcemap warnings
|
|
432
|
+
|
|
433
|
+
## 0.2.1 - 2021-10-12
|
|
434
|
+
|
|
435
|
+
### Fixed
|
|
436
|
+
|
|
437
|
+
- Starter template GalleryPreview unique key warning
|
|
438
|
+
- Mitigation for upcoming breaking minor Vite update
|
|
439
|
+
|
|
440
|
+
## 0.2.0 - 2021-10-08
|
|
441
|
+
|
|
442
|
+
### Added
|
|
443
|
+
|
|
444
|
+
- Added support for images and collections in the ProductProvider component
|
|
445
|
+
- Added more GraphQL fragments for building block components (Metafield, UnitPrice) and updated exports of these fragments
|
|
446
|
+
|
|
447
|
+
### Breaking Change
|
|
448
|
+
|
|
449
|
+
- `useQuery` now behaves exactly like [react-query's hook of the same name](https://react-query.tanstack.com/reference/useQuery#_top)
|
|
450
|
+
|
|
451
|
+
### Fixed
|
|
452
|
+
|
|
453
|
+
- Handle products with selling plans
|
|
454
|
+
|
|
455
|
+
## 0.1.2 - 2021-09-30
|
|
456
|
+
|
|
457
|
+
### Fixed
|
|
458
|
+
|
|
459
|
+
- SSR issue when running Vite 2.6
|
|
460
|
+
- Occasional `ProductProviderFragment` error when booting Hydrogen dev server [#571](https://github.com/Shopify/hydrogen/issues/571)
|
|
461
|
+
|
|
462
|
+
## 0.1.1 - 2021-09-24
|
|
463
|
+
|
|
464
|
+
### Added
|
|
465
|
+
|
|
466
|
+
- New GraphQL fragments for Variants, SellingPlans, and SellingPlanGroups
|
|
467
|
+
|
|
468
|
+
### Changed
|
|
469
|
+
|
|
470
|
+
- Updated types for the `useProductOptions` hook
|
|
471
|
+
|
|
472
|
+
### Fixed
|
|
473
|
+
|
|
474
|
+
- `Dynamic require of "stream" is not supported` error in browser logs
|
|
475
|
+
|
|
476
|
+
## 0.1.0 - 2021-09-23
|
|
477
|
+
|
|
478
|
+
### Changed
|
|
479
|
+
|
|
480
|
+
- No updates. Transitive dependency bump.
|
|
481
|
+
|
|
482
|
+
## 1.0.0-alpha.22 - 2021-09-22
|
|
483
|
+
|
|
484
|
+
### Changed
|
|
485
|
+
|
|
486
|
+
- No updates. Transitive dependency bump.
|
|
487
|
+
|
|
488
|
+
[0.6.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.0
|
|
489
|
+
[0.6.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.1
|
|
490
|
+
[0.6.2]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.2
|
|
491
|
+
[0.6.3]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.3
|
|
492
|
+
[0.6.4]: https://github.com/Shopify/hydrogen/releases/tag/v0.6.4
|
|
493
|
+
[0.7.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.7.0
|
|
494
|
+
[0.7.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.7.1
|
|
495
|
+
[0.8.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.8.0
|
|
496
|
+
[0.8.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.8.1
|
|
497
|
+
[0.8.2]: https://github.com/Shopify/hydrogen/releases/tag/v0.8.2
|
|
498
|
+
[0.8.3]: https://github.com/Shopify/hydrogen/releases/tag/v0.8.3
|
|
499
|
+
[0.9.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.9.0
|
|
500
|
+
[0.9.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.9.1
|
|
501
|
+
[0.10.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.10.0
|
|
502
|
+
[0.10.1]: https://github.com/Shopify/hydrogen/releases/tag/v0.10.1
|
|
503
|
+
[0.11.0]: https://github.com/Shopify/hydrogen/releases/tag/v0.11.0
|
|
504
|
+
[unreleased]: https://github.com/Shopify/hydrogen/compare/v0.11.0...HEAD
|
package/dist/esnext/client.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export * from './hooks';
|
|
|
3
3
|
export * from './foundation/useServerState';
|
|
4
4
|
export * from './foundation/useShop';
|
|
5
5
|
export * from './foundation/ServerStateProvider';
|
|
6
|
-
export {
|
|
6
|
+
export { Head } from './foundation/Head';
|
|
7
7
|
export * from './utilities';
|
package/dist/esnext/client.js
CHANGED
|
@@ -3,5 +3,5 @@ export * from './hooks';
|
|
|
3
3
|
export * from './foundation/useServerState';
|
|
4
4
|
export * from './foundation/useShop';
|
|
5
5
|
export * from './foundation/ServerStateProvider';
|
|
6
|
-
export {
|
|
6
|
+
export { Head } from './foundation/Head';
|
|
7
7
|
export * from './utilities';
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useCart } from '../CartProvider';
|
|
3
|
+
import { useProduct } from '../ProductProvider';
|
|
3
4
|
/**
|
|
4
5
|
* The `AddToCartButton` component renders a button that adds an item to the cart when pressed.
|
|
5
6
|
* It must be a descendent of the `CartProvider` component.
|
|
6
7
|
*/
|
|
7
8
|
export function AddToCartButton(props) {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8
10
|
const [addingItem, setAddingItem] = useState(false);
|
|
9
|
-
const { variantId, quantity = 1, attributes, children, onAdd, accessibleAddingToCartLabel, ...passthroughProps } = props;
|
|
11
|
+
const { variantId: explicitVariantId, quantity = 1, attributes, children, onAdd, accessibleAddingToCartLabel, ...passthroughProps } = props;
|
|
10
12
|
const { status, id, cartCreate, linesAdd } = useCart();
|
|
13
|
+
const product = useProduct();
|
|
14
|
+
const variantId = (_h = (_e = (_b = explicitVariantId !== null && explicitVariantId !== void 0 ? explicitVariantId : (_a = product === null || product === void 0 ? void 0 : product.selectedVariant) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : (_d = (_c = product === null || product === void 0 ? void 0 : product.variants) === null || _c === void 0 ? void 0 : _c.find((variant) => variant.availableForSale)) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : (_g = (_f = product === null || product === void 0 ? void 0 : product.variants) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.id) !== null && _h !== void 0 ? _h : '';
|
|
15
|
+
const disabled = explicitVariantId === null ||
|
|
16
|
+
variantId === '' ||
|
|
17
|
+
(product === null || product === void 0 ? void 0 : product.selectedVariant) === null ||
|
|
18
|
+
addingItem ||
|
|
19
|
+
passthroughProps.disabled;
|
|
11
20
|
useEffect(() => {
|
|
12
21
|
if (addingItem && status === 'idle') {
|
|
13
22
|
setAddingItem(false);
|
|
14
23
|
}
|
|
15
24
|
}, [status, addingItem]);
|
|
16
25
|
return (React.createElement(React.Fragment, null,
|
|
17
|
-
React.createElement("button", { ...passthroughProps, disabled:
|
|
26
|
+
React.createElement("button", { ...passthroughProps, disabled: disabled, onClick: () => {
|
|
18
27
|
setAddingItem(true);
|
|
19
28
|
if (!id) {
|
|
20
29
|
cartCreate({
|
|
@@ -25,5 +25,5 @@ export function CartEstimatedCost(props) {
|
|
|
25
25
|
if (amount == null) {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
-
return (React.createElement(Money, { ...passthroughProps,
|
|
28
|
+
return (React.createElement(Money, { ...passthroughProps, data: amount }, children));
|
|
29
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useCartLine } from '../CartLineProvider';
|
|
3
|
-
import { Image
|
|
3
|
+
import { Image } from '../Image';
|
|
4
4
|
/**
|
|
5
5
|
* The `CartLineImage` component renders an `Image` component for the cart line merchandise's image.
|
|
6
6
|
* It must be a descendent of a `CartLineProvider` component.
|
|
@@ -8,5 +8,5 @@ import { Image as ImageComponent } from '../Image';
|
|
|
8
8
|
export function CartLineImage(props) {
|
|
9
9
|
const cartLine = useCartLine();
|
|
10
10
|
const { options, ...passthroughProps } = props;
|
|
11
|
-
return cartLine.merchandise.image ? (React.createElement(
|
|
11
|
+
return cartLine.merchandise.image ? (React.createElement(Image, { ...passthroughProps, data: cartLine.merchandise.image, options: options })) : null;
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementType } from 'react';
|
|
2
2
|
import { MoneyProps } from '../Money';
|
|
3
3
|
import { Props } from '../types';
|
|
4
|
-
export interface CartLinePriceProps extends Omit<MoneyProps, '
|
|
4
|
+
export interface CartLinePriceProps extends Omit<MoneyProps, 'data'> {
|
|
5
5
|
/** The type of price. Valid values:`regular` (default) or `compareAt`. */
|
|
6
6
|
priceType?: 'regular' | 'compareAt';
|
|
7
7
|
}
|
|
@@ -14,7 +14,7 @@ export function CartLinePrice(props) {
|
|
|
14
14
|
if (price == null) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
|
-
return (React.createElement(Money, { ...passthroughProps,
|
|
17
|
+
return (React.createElement(Money, { ...passthroughProps, data: {
|
|
18
18
|
amount: price.amount * cartLine.quantity,
|
|
19
19
|
currencyCode: price.currencyCode,
|
|
20
20
|
} }));
|
|
@@ -9,7 +9,7 @@ import { CartFragmentFragment } from './graphql/CartFragment';
|
|
|
9
9
|
* The `CartProvider` component must be a descendent of the `ShopifyProvider` component.
|
|
10
10
|
* You must use this component if you want to use the `useCart` hook or related hooks, or if you would like to use the `AddToCartButton` component.
|
|
11
11
|
*/
|
|
12
|
-
export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, cart, }: {
|
|
12
|
+
export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, }: {
|
|
13
13
|
/** Any `ReactNode` elements. */
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
numCartLines?: number;
|
|
@@ -32,5 +32,5 @@ export declare function CartProvider({ children, numCartLines, onCreate, onLineA
|
|
|
32
32
|
/**
|
|
33
33
|
* A cart object from the Storefront API to populate the initial state of the provider.
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
data?: CartFragmentFragment;
|
|
36
36
|
}): JSX.Element;
|
|
@@ -149,7 +149,7 @@ function cartReducer(state, action) {
|
|
|
149
149
|
* The `CartProvider` component must be a descendent of the `ShopifyProvider` component.
|
|
150
150
|
* You must use this component if you want to use the `useCart` hook or related hooks, or if you would like to use the `AddToCartButton` component.
|
|
151
151
|
*/
|
|
152
|
-
export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, cart, }) {
|
|
152
|
+
export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, }) {
|
|
153
153
|
var _a;
|
|
154
154
|
const { serverState } = useServerState();
|
|
155
155
|
const countryCode = (_a = serverState === null || serverState === void 0 ? void 0 : serverState.country) === null || _a === void 0 ? void 0 : _a.isoCode;
|
|
@@ -6,7 +6,7 @@ export interface ExternalVideoProps {
|
|
|
6
6
|
/** An object with the keys `host`, `embeddedUrl`, and `id`. Refer to the Storefront API's
|
|
7
7
|
* [`ExternalVideo` type](/api/storefront/reference/products/externalvideo).
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
data: Pick<ExternalVideoType, 'host' | 'embeddedUrl' | 'id'>;
|
|
10
10
|
/** An object containing the options available for either
|
|
11
11
|
* [YouTube](https://developers.google.com/youtube/player_parameters#Parameters) or
|
|
12
12
|
* [Vimeo](https://vimeo.zendesk.com/hc/en-us/articles/360001494447-Using-Player-Parameters).
|
|
@@ -6,8 +6,8 @@ import { ExternalVideoFragment as Fragment } from '../../graphql/graphql-constan
|
|
|
6
6
|
* API's [`ExternalVideo` object](/api/storefront/reference/products/externalvideo).
|
|
7
7
|
*/
|
|
8
8
|
export function ExternalVideo(props) {
|
|
9
|
-
const {
|
|
10
|
-
const url = useEmbeddedVideoUrl(
|
|
9
|
+
const { data, options, id = data.id, frameBorder = '0', allow = 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture', allowFullScreen = true, ...passthroughProps } = props;
|
|
10
|
+
const url = useEmbeddedVideoUrl(data.embeddedUrl, options);
|
|
11
11
|
return (React.createElement("iframe", { ...passthroughProps, id: id, frameBorder: frameBorder, allow: allow, allowFullScreen: allowFullScreen, src: url }));
|
|
12
12
|
}
|
|
13
13
|
ExternalVideo.Fragment = Fragment;
|
|
@@ -16,7 +16,7 @@ export interface MediaImageProps extends BaseImageProps {
|
|
|
16
16
|
/** An object with the keys `url`, `altText`, `id`, `width` and `height`. Refer to the
|
|
17
17
|
* Storefront API's [`Image` object](/api/storefront/reference/common-objects/image).
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
data: Pick<ImageType, 'altText' | 'url' | 'id' | 'width' | 'height'>;
|
|
20
20
|
/** An object of image size options for Shopify CDN images. */
|
|
21
21
|
options?: ImageSizeOptions;
|
|
22
22
|
}
|