@shopify/hydrogen 0.21.0 → 0.23.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 +304 -0
- package/dist/esnext/client.d.ts +1 -0
- package/dist/esnext/client.js +1 -0
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +5 -5
- package/dist/esnext/components/CartLines/{CartLines.d.ts → CartLines.client.d.ts} +0 -0
- package/dist/esnext/components/CartLines/{CartLines.js → CartLines.client.js} +0 -0
- package/dist/esnext/components/CartLines/index.d.ts +1 -1
- package/dist/esnext/components/CartLines/index.js +1 -1
- package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +7 -4
- package/dist/esnext/components/CartProvider/CartProvider.client.js +22 -12
- package/dist/esnext/components/DevTools.client.js +1 -1
- package/dist/esnext/components/Image/Image.d.ts +11 -3
- package/dist/esnext/components/Image/Image.js +64 -13
- package/dist/esnext/components/Link/Link.client.d.ts +2 -0
- package/dist/esnext/components/Link/Link.client.js +7 -4
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +1 -1
- package/dist/esnext/components/MediaFile/MediaFile.js +3 -2
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.js +140 -0
- package/dist/esnext/components/ProductOptionsProvider/context.d.ts +2 -0
- package/dist/esnext/components/{ProductProvider → ProductOptionsProvider}/context.js +0 -1
- package/dist/esnext/components/ProductOptionsProvider/index.d.ts +2 -0
- package/dist/esnext/components/ProductOptionsProvider/index.js +2 -0
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -2
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +10 -12
- package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/NoIndexSeo.client.js +10 -0
- package/dist/esnext/components/Seo/Seo.client.d.ts +4 -0
- package/dist/esnext/components/Seo/Seo.client.js +3 -0
- package/dist/esnext/components/index.d.ts +1 -1
- package/dist/esnext/components/index.js +1 -1
- package/dist/esnext/config.d.ts +3 -3
- package/dist/esnext/entry-client.js +106 -9
- package/dist/esnext/entry-server.d.ts +3 -16
- package/dist/esnext/entry-server.js +281 -331
- package/dist/esnext/foundation/Analytics/Analytics.client.js +16 -14
- package/dist/esnext/foundation/Analytics/Analytics.server.js +27 -20
- package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +4 -2
- package/dist/esnext/foundation/Analytics/ClientAnalytics.js +17 -15
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +2 -2
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/{PerformanceMetrics.server.js → ServerAnalyticsConnector.server.js} +7 -6
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.js +19 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +190 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +24 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/const.d.ts +28 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/const.js +51 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.js +56 -0
- package/dist/esnext/foundation/Analytics/hook.js +4 -2
- package/dist/esnext/foundation/Analytics/index.d.ts +0 -1
- package/dist/esnext/foundation/Analytics/index.js +0 -1
- package/dist/esnext/foundation/Analytics/utils.d.ts +2 -0
- package/dist/esnext/foundation/Analytics/utils.js +21 -0
- package/dist/{node/framework → esnext/foundation/Cache}/cache-sub-request.d.ts +1 -1
- package/dist/esnext/{framework → foundation/Cache}/cache-sub-request.js +3 -3
- package/dist/esnext/{framework → foundation/Cache}/cache.d.ts +1 -1
- package/dist/esnext/{framework → foundation/Cache}/cache.js +3 -3
- package/dist/{node/framework/CachingStrategy → esnext/foundation/Cache/strategies}/index.d.ts +1 -1
- package/dist/esnext/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +0 -0
- package/dist/esnext/foundation/Cookie/Cookie.d.ts +3 -3
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +5 -10
- package/dist/{node/framework/Hydration → esnext/foundation/Html}/Html.d.ts +3 -1
- package/dist/esnext/{framework/Hydration → foundation/Html}/Html.js +15 -2
- package/dist/{node/framework/Hydration/ServerComponentRequest.server.d.ts → esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +9 -5
- package/dist/esnext/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +1 -1
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +23 -0
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.js +46 -0
- package/dist/esnext/foundation/Router/BrowserRouter.client.d.ts +2 -1
- package/dist/esnext/foundation/Router/BrowserRouter.client.js +17 -10
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -3
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +4 -4
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +2 -2
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.d.ts +1 -1
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.js +1 -1
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +1 -1
- package/dist/esnext/foundation/index.d.ts +1 -1
- package/dist/esnext/foundation/index.js +1 -1
- package/dist/esnext/foundation/runtime.d.ts +2 -0
- package/dist/esnext/foundation/runtime.js +6 -0
- package/dist/esnext/foundation/session/session.d.ts +3 -3
- package/dist/esnext/foundation/ssr-interop.d.ts +2 -2
- package/dist/esnext/foundation/useNavigate/useNavigate.d.ts +2 -0
- package/dist/esnext/foundation/useNavigate/useNavigate.js +11 -4
- package/dist/esnext/foundation/useQuery/hooks.js +9 -6
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +2 -1
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +1 -1
- package/dist/esnext/framework/Hydration/rsc.js +4 -2
- package/dist/esnext/framework/middleware.js +1 -15
- package/dist/esnext/framework/plugin.js +4 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +6 -3
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +7 -48
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +5 -18
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +19 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +7 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +99 -0
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +4 -4
- package/dist/esnext/framework/viteception.d.ts +4 -0
- package/dist/esnext/framework/viteception.js +15 -0
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +2 -2
- package/dist/esnext/hooks/useProductOptions/types.d.ts +16 -14
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +1 -15
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +8 -107
- package/dist/esnext/hooks/useShopQuery/hooks.d.ts +1 -2
- package/dist/esnext/hooks/useShopQuery/hooks.js +12 -7
- package/dist/esnext/index.d.ts +30 -16
- package/dist/esnext/index.js +30 -20
- package/dist/esnext/storefront-api-types.d.ts +1 -1
- package/dist/esnext/streaming.server.d.ts +3 -2
- package/dist/esnext/streaming.server.js +0 -4
- package/dist/esnext/types.d.ts +43 -27
- package/dist/esnext/utilities/apiRoutes.d.ts +5 -6
- package/dist/esnext/utilities/apiRoutes.js +2 -8
- package/dist/esnext/utilities/fetch.d.ts +1 -2
- package/dist/esnext/utilities/fetch.js +1 -3
- package/dist/esnext/utilities/graphql-tag.d.ts +1 -0
- package/dist/esnext/utilities/graphql-tag.js +6 -0
- package/dist/esnext/utilities/graphql-tracker.d.ts +1 -1
- package/dist/esnext/utilities/graphql-tracker.js +4 -0
- package/dist/esnext/utilities/html-encoding.d.ts +0 -1
- package/dist/esnext/utilities/html-encoding.js +0 -8
- package/dist/esnext/utilities/index.d.ts +2 -2
- package/dist/esnext/utilities/index.js +2 -2
- package/dist/esnext/utilities/isBrowser/index.d.ts +1 -0
- package/dist/esnext/utilities/isBrowser/index.js +1 -0
- package/dist/esnext/utilities/isBrowser/isBrowser.d.ts +4 -0
- package/dist/esnext/utilities/isBrowser/isBrowser.js +6 -0
- package/dist/esnext/utilities/isServer/isServer.js +2 -2
- package/dist/esnext/utilities/log/index.d.ts +1 -1
- package/dist/esnext/utilities/log/index.js +1 -1
- package/dist/esnext/utilities/log/log-cache-header.d.ts +4 -4
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +3 -3
- package/dist/esnext/utilities/log/log.d.ts +17 -11
- package/dist/esnext/utilities/log/log.js +29 -20
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/client.d.ts +16 -0
- package/dist/node/client.js +43 -0
- package/dist/node/components/AddToCartButton/AddToCartButton.client.d.ts +23 -0
- package/dist/node/components/AddToCartButton/AddToCartButton.client.js +74 -0
- package/dist/node/components/AddToCartButton/index.d.ts +1 -0
- package/dist/node/components/AddToCartButton/index.js +5 -0
- package/dist/node/components/BuyNowButton/BuyNowButton.client.d.ts +18 -0
- package/dist/node/components/BuyNowButton/BuyNowButton.client.js +53 -0
- package/dist/node/components/BuyNowButton/index.d.ts +1 -0
- package/dist/node/components/BuyNowButton/index.js +5 -0
- package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +11 -0
- package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.js +44 -0
- package/dist/node/components/CartCheckoutButton/index.d.ts +1 -0
- package/dist/node/components/CartCheckoutButton/index.js +5 -0
- package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +14 -0
- package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.js +36 -0
- package/dist/node/components/CartEstimatedCost/index.d.ts +1 -0
- package/dist/node/components/CartEstimatedCost/index.js +5 -0
- package/dist/node/components/CartLineImage/CartLineImage.client.d.ts +9 -0
- package/dist/node/components/CartLineImage/CartLineImage.client.js +18 -0
- package/dist/node/components/CartLineImage/index.d.ts +1 -0
- package/dist/node/components/CartLineImage/index.js +5 -0
- package/dist/node/components/CartLinePrice/CartLinePrice.client.d.ts +12 -0
- package/dist/node/components/CartLinePrice/CartLinePrice.client.js +28 -0
- package/dist/node/components/CartLinePrice/index.d.ts +1 -0
- package/dist/node/components/CartLinePrice/index.js +5 -0
- package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +8 -0
- package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.js +19 -0
- package/dist/node/components/CartLineProductTitle/index.d.ts +1 -0
- package/dist/node/components/CartLineProductTitle/index.js +5 -0
- package/dist/node/components/CartLineProvider/CartLineProvider.client.d.ts +11 -0
- package/dist/node/components/CartLineProvider/CartLineProvider.client.js +15 -0
- package/dist/node/components/CartLineProvider/context.d.ts +26 -0
- package/dist/node/components/CartLineProvider/context.js +5 -0
- package/dist/node/components/CartLineProvider/index.d.ts +2 -0
- package/dist/node/components/CartLineProvider/index.js +7 -0
- package/dist/node/components/CartLineQuantity/CartLineQuantity.client.d.ts +8 -0
- package/dist/node/components/CartLineQuantity/CartLineQuantity.client.js +19 -0
- package/dist/node/components/CartLineQuantity/index.d.ts +1 -0
- package/dist/node/components/CartLineQuantity/index.js +5 -0
- package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +14 -0
- package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +31 -0
- package/dist/node/components/CartLineQuantityAdjustButton/index.d.ts +1 -0
- package/dist/node/components/CartLineQuantityAdjustButton/index.js +5 -0
- package/dist/node/components/CartLines/CartLines.client.d.ts +15 -0
- package/dist/node/components/CartLines/CartLines.client.js +44 -0
- package/dist/node/components/CartLines/index.d.ts +1 -0
- package/dist/node/components/CartLines/index.js +5 -0
- package/dist/node/components/CartProvider/CartProvider.client.d.ts +41 -0
- package/dist/node/components/CartProvider/CartProvider.client.js +550 -0
- package/dist/node/components/CartProvider/cart-queries.d.ts +10 -0
- package/dist/node/components/CartProvider/cart-queries.js +203 -0
- package/dist/node/components/CartProvider/constants.d.ts +2 -0
- package/dist/node/components/CartProvider/constants.js +5 -0
- package/dist/node/components/CartProvider/context.d.ts +2 -0
- package/dist/node/components/CartProvider/context.js +5 -0
- package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartCreateMutation.d.ts +85 -0
- package/dist/node/components/CartProvider/graphql/CartCreateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartFragment.d.ts +72 -0
- package/dist/node/components/CartProvider/graphql/CartFragment.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartLineAddMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartLineAddMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartQuery.d.ts +81 -0
- package/dist/node/components/CartProvider/graphql/CartQuery.js +2 -0
- package/dist/node/components/CartProvider/hooks.client.d.ts +15 -0
- package/dist/node/components/CartProvider/hooks.client.js +90 -0
- package/dist/node/components/CartProvider/index.d.ts +4 -0
- package/dist/node/components/CartProvider/index.js +10 -0
- package/dist/node/components/CartProvider/types.d.ts +102 -0
- package/dist/node/components/CartProvider/types.js +2 -0
- package/dist/node/components/CartShopPayButton/CartShopPayButton.client.d.ts +9 -0
- package/dist/node/components/CartShopPayButton/CartShopPayButton.client.js +46 -0
- package/dist/node/components/CartShopPayButton/index.d.ts +1 -0
- package/dist/node/components/CartShopPayButton/index.js +5 -0
- package/dist/node/components/ExternalVideo/ExternalVideo.d.ts +21 -0
- package/dist/node/components/ExternalVideo/ExternalVideo.js +21 -0
- package/dist/node/components/ExternalVideo/index.d.ts +1 -0
- package/dist/node/components/ExternalVideo/index.js +5 -0
- package/dist/node/components/Image/Image.d.ts +11 -3
- package/dist/node/components/Image/Image.js +63 -12
- package/dist/node/components/Link/Link.client.d.ts +25 -0
- package/dist/node/components/Link/Link.client.js +165 -0
- package/dist/node/components/Link/index.d.ts +1 -0
- package/dist/node/components/Link/index.js +5 -0
- package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +6 -0
- package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.js +11 -0
- package/dist/node/components/LocalizationProvider/LocalizationContext.client.d.ts +6 -0
- package/dist/node/components/LocalizationProvider/LocalizationContext.client.js +5 -0
- package/dist/node/components/LocalizationProvider/LocalizationProvider.server.d.ts +33 -0
- package/dist/node/components/LocalizationProvider/LocalizationProvider.server.js +51 -0
- package/dist/node/components/MediaFile/MediaFile.d.ts +19 -0
- package/dist/node/components/MediaFile/MediaFile.js +39 -0
- package/dist/node/components/MediaFile/index.d.ts +1 -0
- package/dist/node/components/MediaFile/index.js +5 -0
- package/dist/node/components/Metafield/Metafield.client.d.ts +21 -0
- package/dist/node/components/Metafield/Metafield.client.js +75 -0
- package/dist/node/components/Metafield/index.d.ts +2 -0
- package/dist/node/components/Metafield/index.js +5 -0
- package/dist/node/components/Metafield/types.d.ts +4 -0
- package/dist/node/components/Metafield/types.js +2 -0
- package/dist/node/components/ModelViewer/ModelViewer.client.d.ts +128 -0
- package/dist/node/components/ModelViewer/ModelViewer.client.js +132 -0
- package/dist/node/components/ModelViewer/index.d.ts +1 -0
- package/dist/node/components/ModelViewer/index.js +5 -0
- package/dist/node/components/Money/Money.client.d.ts +25 -0
- package/dist/node/components/Money/Money.client.js +46 -0
- package/dist/node/components/Money/index.d.ts +1 -0
- package/dist/node/components/Money/index.js +5 -0
- package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
- package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.js +167 -0
- package/dist/node/components/ProductOptionsProvider/context.d.ts +2 -0
- package/dist/node/components/ProductOptionsProvider/context.js +5 -0
- package/dist/node/components/ProductOptionsProvider/index.d.ts +2 -0
- package/dist/node/components/ProductOptionsProvider/index.js +7 -0
- package/dist/node/components/ProductPrice/ProductPrice.client.d.ts +18 -0
- package/dist/node/components/ProductPrice/ProductPrice.client.js +61 -0
- package/dist/node/components/ProductPrice/index.d.ts +1 -0
- package/dist/node/components/ProductPrice/index.js +5 -0
- package/dist/node/components/Seo/CollectionSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/CollectionSeo.client.js +22 -0
- package/dist/node/components/Seo/DefaultPageSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/DefaultPageSeo.client.js +25 -0
- package/dist/node/components/Seo/DescriptionSeo.client.d.ts +4 -0
- package/dist/node/components/Seo/DescriptionSeo.client.js +17 -0
- package/dist/node/components/Seo/HomePageSeo.client.d.ts +2 -0
- package/dist/node/components/Seo/HomePageSeo.client.js +32 -0
- package/dist/node/components/Seo/ImageSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/ImageSeo.client.js +17 -0
- package/dist/node/components/Seo/NoIndexSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/NoIndexSeo.client.js +17 -0
- package/dist/node/components/Seo/PageSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/PageSeo.client.js +20 -0
- package/dist/node/components/Seo/ProductSeo.client.d.ts +5 -0
- package/dist/node/components/Seo/ProductSeo.client.js +70 -0
- package/dist/node/components/Seo/Seo.client.d.ts +30 -0
- package/dist/node/components/Seo/Seo.client.js +38 -0
- package/dist/node/components/Seo/TitleSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/TitleSeo.client.js +17 -0
- package/dist/node/components/Seo/TwitterSeo.client.d.ts +2 -0
- package/dist/node/components/Seo/TwitterSeo.client.js +16 -0
- package/dist/node/components/Seo/index.d.ts +1 -0
- package/dist/node/components/Seo/index.js +5 -0
- package/dist/node/components/Seo/seo-types.d.ts +17 -0
- package/dist/node/components/Seo/seo-types.js +2 -0
- package/dist/node/components/ShopPayButton/ShopPayButton.client.d.ts +38 -0
- package/dist/node/components/ShopPayButton/ShopPayButton.client.js +60 -0
- package/dist/node/components/ShopPayButton/index.d.ts +1 -0
- package/dist/node/components/ShopPayButton/index.js +5 -0
- package/dist/node/components/Video/Video.d.ts +14 -0
- package/dist/node/components/Video/Video.js +31 -0
- package/dist/node/components/Video/index.d.ts +1 -0
- package/dist/node/components/Video/index.js +5 -0
- package/dist/node/components/index.d.ts +28 -0
- package/dist/node/components/index.js +59 -0
- package/dist/node/components/types.d.ts +71 -0
- package/dist/node/components/types.js +11 -0
- package/dist/node/entry-server.d.ts +3 -16
- package/dist/node/entry-server.js +280 -330
- package/dist/node/foundation/Analytics/Analytics.client.js +19 -17
- package/dist/node/foundation/Analytics/Analytics.server.js +27 -20
- package/dist/node/foundation/Analytics/ClientAnalytics.d.ts +4 -2
- package/dist/node/foundation/Analytics/ClientAnalytics.js +16 -14
- package/dist/node/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.d.ts +7 -0
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +68 -0
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.d.ts +1 -0
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +27 -0
- package/dist/node/foundation/Analytics/hook.js +4 -2
- package/dist/node/foundation/Analytics/index.d.ts +0 -1
- package/dist/node/foundation/Analytics/index.js +1 -3
- package/dist/node/foundation/Analytics/utils.d.ts +2 -0
- package/dist/node/foundation/Analytics/utils.js +24 -1
- package/dist/{esnext/framework → node/foundation/Cache}/cache-sub-request.d.ts +1 -1
- package/dist/node/{framework → foundation/Cache}/cache-sub-request.js +4 -4
- package/dist/node/{framework → foundation/Cache}/cache.d.ts +1 -1
- package/dist/node/{framework → foundation/Cache}/cache.js +5 -5
- package/dist/{esnext/framework/CachingStrategy → node/foundation/Cache/strategies}/index.d.ts +1 -1
- package/dist/node/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +0 -0
- package/dist/node/foundation/Head/Head.client.d.ts +5 -0
- package/dist/node/foundation/Head/Head.client.js +17 -0
- package/dist/node/foundation/Head/index.d.ts +1 -0
- package/dist/node/foundation/Head/index.js +5 -0
- package/dist/{esnext/framework/Hydration → node/foundation/Html}/Html.d.ts +3 -1
- package/dist/node/{framework/Hydration → foundation/Html}/Html.js +15 -2
- package/dist/{esnext/framework/Hydration/ServerComponentRequest.server.d.ts → node/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +9 -5
- package/dist/node/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +3 -3
- package/dist/node/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +23 -0
- package/dist/node/foundation/HydrogenResponse/HydrogenResponse.server.js +53 -0
- package/dist/node/foundation/Router/BrowserRouter.client.d.ts +2 -1
- package/dist/node/foundation/Router/BrowserRouter.client.js +17 -10
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -3
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +4 -4
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +2 -2
- package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +7 -0
- package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.js +35 -0
- package/dist/node/foundation/ShopifyProvider/index.d.ts +1 -0
- package/dist/node/foundation/ShopifyProvider/index.js +5 -0
- package/dist/node/foundation/fetchSync/client/fetchSync.d.ts +10 -0
- package/dist/node/foundation/fetchSync/client/fetchSync.js +33 -0
- package/dist/node/foundation/fetchSync/server/fetchSync.d.ts +8 -0
- package/dist/node/foundation/fetchSync/server/fetchSync.js +33 -0
- package/dist/node/foundation/fetchSync/types.d.ts +5 -0
- package/dist/node/foundation/fetchSync/types.js +2 -0
- package/dist/node/foundation/index.d.ts +3 -0
- package/dist/node/foundation/index.js +10 -0
- package/dist/node/foundation/runtime.d.ts +2 -0
- package/dist/node/foundation/runtime.js +11 -0
- package/dist/node/foundation/session/session.d.ts +3 -3
- package/dist/node/foundation/ssr-interop.d.ts +2 -2
- package/dist/node/foundation/useNavigate/useNavigate.d.ts +2 -0
- package/dist/node/foundation/useNavigate/useNavigate.js +11 -4
- package/dist/node/foundation/useQuery/hooks.d.ts +36 -0
- package/dist/node/foundation/useQuery/hooks.js +104 -0
- package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.d.ts +10 -0
- package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.js +34 -0
- package/dist/node/foundation/useRouteParams/useRouteParams.d.ts +4 -0
- package/dist/node/foundation/useRouteParams/useRouteParams.js +13 -0
- package/dist/node/foundation/useServerProps/index.d.ts +1 -0
- package/dist/node/foundation/useServerProps/index.js +5 -0
- package/dist/node/foundation/useSession/useSession.d.ts +2 -0
- package/dist/node/foundation/useSession/useSession.js +12 -0
- package/dist/node/foundation/useShop/index.d.ts +1 -0
- package/dist/node/foundation/useShop/index.js +5 -0
- package/dist/node/foundation/useShop/use-shop.d.ts +6 -0
- package/dist/node/foundation/useShop/use-shop.js +18 -0
- package/dist/node/foundation/useUrl/index.d.ts +1 -0
- package/dist/node/foundation/useUrl/index.js +5 -0
- package/dist/node/foundation/useUrl/useUrl.d.ts +4 -0
- package/dist/node/foundation/useUrl/useUrl.js +32 -0
- package/dist/node/framework/Hydration/rsc.js +4 -2
- package/dist/node/framework/middleware.js +1 -15
- package/dist/node/framework/plugin.js +4 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +6 -3
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +6 -47
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +5 -18
- package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +21 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +7 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +105 -0
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +4 -4
- package/dist/node/framework/viteception.d.ts +4 -0
- package/dist/node/framework/viteception.js +19 -0
- package/dist/node/hooks/index.d.ts +6 -0
- package/dist/node/hooks/index.js +28 -0
- package/dist/node/hooks/useCart/index.d.ts +1 -0
- package/dist/node/hooks/useCart/index.js +5 -0
- package/dist/node/hooks/useCart/useCart.d.ts +4 -0
- package/dist/node/hooks/useCart/useCart.js +19 -0
- package/dist/node/hooks/useCartLine/index.d.ts +1 -0
- package/dist/node/hooks/useCartLine/index.js +5 -0
- package/dist/node/hooks/useCartLine/useCartLine.d.ts +29 -0
- package/dist/node/hooks/useCartLine/useCartLine.js +16 -0
- package/dist/node/hooks/useCountry/index.d.ts +1 -0
- package/dist/node/hooks/useCountry/index.js +5 -0
- package/dist/node/hooks/useCountry/useCountry.d.ts +7 -0
- package/dist/node/hooks/useCountry/useCountry.js +21 -0
- package/dist/node/hooks/useLoadScript/index.d.ts +1 -0
- package/dist/node/hooks/useLoadScript/index.js +5 -0
- package/dist/node/hooks/useLoadScript/useLoadScript.client.d.ts +8 -0
- package/dist/node/hooks/useLoadScript/useLoadScript.client.js +27 -0
- package/dist/node/hooks/useMeasurement/hooks.d.ts +9 -0
- package/dist/node/hooks/useMeasurement/hooks.js +17 -0
- package/dist/node/hooks/useMeasurement/index.d.ts +1 -0
- package/dist/node/hooks/useMeasurement/index.js +5 -0
- package/dist/node/hooks/useMoney/hooks.d.ts +54 -0
- package/dist/node/hooks/useMoney/hooks.js +70 -0
- package/dist/node/hooks/useMoney/index.d.ts +1 -0
- package/dist/node/hooks/useMoney/index.js +5 -0
- package/dist/node/hooks/useParsedMetafields/index.d.ts +1 -0
- package/dist/node/hooks/useParsedMetafields/index.js +5 -0
- package/dist/node/hooks/useParsedMetafields/useParsedMetafields.d.ts +21 -0
- package/dist/node/hooks/useParsedMetafields/useParsedMetafields.js +25 -0
- package/dist/node/hooks/useProductOptions/helpers.d.ts +6 -0
- package/dist/node/hooks/useProductOptions/helpers.js +46 -0
- package/dist/node/hooks/useProductOptions/index.d.ts +2 -0
- package/dist/node/hooks/useProductOptions/index.js +20 -0
- package/dist/node/hooks/useProductOptions/types.d.ts +44 -0
- package/dist/node/hooks/useProductOptions/types.js +2 -0
- package/dist/node/hooks/useProductOptions/useProductOptions.client.d.ts +1 -0
- package/dist/node/hooks/useProductOptions/useProductOptions.client.js +13 -0
- package/dist/node/hooks/useShopQuery/hooks.d.ts +28 -0
- package/dist/node/hooks/useShopQuery/hooks.js +171 -0
- package/dist/node/hooks/useShopQuery/index.d.ts +1 -0
- package/dist/node/hooks/useShopQuery/index.js +5 -0
- package/dist/node/storefront-api-types.d.ts +1 -1
- package/dist/node/streaming.server.d.ts +3 -2
- package/dist/node/streaming.server.js +1 -6
- package/dist/node/types.d.ts +43 -27
- package/dist/node/utilities/apiRoutes.d.ts +5 -6
- package/dist/node/utilities/apiRoutes.js +2 -8
- package/dist/node/utilities/devtools.d.ts +11 -0
- package/dist/node/utilities/devtools.js +15 -0
- package/dist/node/utilities/fetch.d.ts +1 -2
- package/dist/node/utilities/fetch.js +1 -3
- package/dist/node/utilities/graphql-tag.d.ts +1 -0
- package/dist/node/utilities/graphql-tag.js +10 -0
- package/dist/node/utilities/graphql-tracker.d.ts +17 -0
- package/dist/node/utilities/graphql-tracker.js +130 -0
- package/dist/node/utilities/html-encoding.d.ts +0 -1
- package/dist/node/utilities/html-encoding.js +1 -10
- package/dist/node/utilities/index.d.ts +2 -2
- package/dist/node/utilities/index.js +3 -4
- package/dist/node/utilities/isBrowser/index.d.ts +1 -0
- package/dist/node/utilities/isBrowser/index.js +5 -0
- package/dist/node/utilities/isBrowser/isBrowser.d.ts +4 -0
- package/dist/node/utilities/isBrowser/isBrowser.js +10 -0
- package/dist/node/utilities/isServer/isServer.js +2 -2
- package/dist/node/utilities/log/index.d.ts +1 -1
- package/dist/node/utilities/log/index.js +1 -3
- package/dist/node/utilities/log/log-cache-header.d.ts +4 -4
- package/dist/node/utilities/log/log-query-timeline.d.ts +3 -3
- package/dist/node/utilities/log/log.d.ts +17 -11
- package/dist/node/utilities/log/log.js +30 -23
- package/dist/node/version.d.ts +1 -1
- package/dist/node/version.js +1 -1
- package/package.json +6 -3
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +219 -51
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +77 -59
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +30 -30
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +199 -70
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +38 -35
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +9 -8
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +3 -3
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +3 -7
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +220 -52
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +77 -59
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +199 -70
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +9 -8
- package/vendor/react-server-dom-vite/package.json +1 -1
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.d.ts +0 -8
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.js +0 -12
- package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +0 -24
- package/dist/esnext/components/ProductProvider/ProductProvider.client.js +0 -34
- package/dist/esnext/components/ProductProvider/context.d.ts +0 -29
- package/dist/esnext/components/ProductProvider/index.d.ts +0 -2
- package/dist/esnext/components/ProductProvider/index.js +0 -2
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.server.d.ts +0 -1
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +0 -35
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +0 -61
- package/dist/esnext/framework/config.d.ts +0 -6
- package/dist/esnext/framework/config.js +0 -6
- package/dist/esnext/framework/runtime.d.ts +0 -13
- package/dist/esnext/framework/runtime.js +0 -27
- package/dist/esnext/hooks/useProduct/index.d.ts +0 -1
- package/dist/esnext/hooks/useProduct/index.js +0 -1
- package/dist/esnext/hooks/useProduct/useProduct.d.ts +0 -52
- package/dist/esnext/hooks/useProduct/useProduct.js +0 -43
- package/dist/esnext/utilities/findRoutePrefix.d.ts +0 -1
- package/dist/esnext/utilities/findRoutePrefix.js +0 -17
- package/dist/esnext/utilities/isClient/index.d.ts +0 -1
- package/dist/esnext/utilities/isClient/index.js +0 -1
- package/dist/esnext/utilities/isClient/isClient.d.ts +0 -4
- package/dist/esnext/utilities/isClient/isClient.js +0 -6
- package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +0 -35
- package/dist/node/framework/Hydration/ServerComponentResponse.server.js +0 -68
- package/dist/node/framework/config.d.ts +0 -6
- package/dist/node/framework/config.js +0 -11
- package/dist/node/framework/runtime.d.ts +0 -13
- package/dist/node/framework/runtime.js +0 -35
- package/dist/node/utilities/defer.d.ts +0 -6
- package/dist/node/utilities/defer.js +0 -18
- package/dist/node/utilities/findRoutePrefix.d.ts +0 -1
- package/dist/node/utilities/findRoutePrefix.js +0 -21
- package/dist/node/utilities/isClient/index.d.ts +0 -1
- package/dist/node/utilities/isClient/index.js +0 -5
- package/dist/node/utilities/isClient/isClient.d.ts +0 -4
- package/dist/node/utilities/isClient/isClient.js +0 -10
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { getShopifyImageDimensions, shopifyImageLoader } from '../../utilities';
|
|
2
|
+
import { getShopifyImageDimensions, shopifyImageLoader, addImageSizeParametersToUrl, } from '../../utilities';
|
|
3
3
|
export function Image(props) {
|
|
4
4
|
if (!props.data && !props.src) {
|
|
5
5
|
throw new Error(`<Image/>: requires either a 'data' or 'src' prop.`);
|
|
6
6
|
}
|
|
7
|
-
if (props.data && props.src) {
|
|
7
|
+
if (__HYDROGEN_DEV__ && props.data && props.src) {
|
|
8
8
|
console.warn(`<Image/>: using both 'data' and 'src' props is not supported; using the 'data' prop by default`);
|
|
9
9
|
}
|
|
10
10
|
if (props.data) {
|
|
@@ -14,17 +14,17 @@ export function Image(props) {
|
|
|
14
14
|
return React.createElement(ExternalImage, { ...props });
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
function ShopifyImage({ data, width, height, loading, loader = shopifyImageLoader, loaderOptions, ...rest }) {
|
|
18
|
-
var _a, _b, _c;
|
|
17
|
+
function ShopifyImage({ data, width, height, loading, loader = shopifyImageLoader, loaderOptions, widths, ...rest }) {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
19
19
|
if (!data.url) {
|
|
20
20
|
throw new Error(`<Image/>: the 'data' prop requires the 'url' property`);
|
|
21
21
|
}
|
|
22
|
-
if (!data.altText && !rest.alt) {
|
|
23
|
-
console.warn(`<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. ${data.id ?
|
|
22
|
+
if (__HYDROGEN_DEV__ && !data.altText && !rest.alt) {
|
|
23
|
+
console.warn(`<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. ${`Image: ${(_a = data.id) !== null && _a !== void 0 ? _a : data.url}`}`);
|
|
24
24
|
}
|
|
25
25
|
const { width: finalWidth, height: finalHeight } = getShopifyImageDimensions(data, loaderOptions);
|
|
26
|
-
if (!finalWidth || !finalHeight) {
|
|
27
|
-
console.warn(`<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties`);
|
|
26
|
+
if ((__HYDROGEN_DEV__ && !finalWidth) || !finalHeight) {
|
|
27
|
+
console.warn(`<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. ${`Image: ${(_b = data.id) !== null && _b !== void 0 ? _b : data.url}`}`);
|
|
28
28
|
}
|
|
29
29
|
let finalSrc = data.url;
|
|
30
30
|
if (loader) {
|
|
@@ -34,18 +34,36 @@ function ShopifyImage({ data, width, height, loading, loader = shopifyImageLoade
|
|
|
34
34
|
width: finalWidth,
|
|
35
35
|
height: finalHeight,
|
|
36
36
|
});
|
|
37
|
+
if (typeof finalSrc !== 'string' || !finalSrc) {
|
|
38
|
+
throw new Error(`<Image/>: 'loader' did not return a valid string. ${`Image: ${(_c = data.id) !== null && _c !== void 0 ? _c : data.url}`}`);
|
|
39
|
+
}
|
|
37
40
|
}
|
|
41
|
+
// determining what the intended width of the image is. For example, if the width is specified and lower than the image width, then that is the maximum image width
|
|
42
|
+
// to prevent generating a srcset with widths bigger than needed or to generate images that would distort because of being larger than original
|
|
43
|
+
const maxWidth = width && finalWidth && width < finalWidth ? width : finalWidth;
|
|
44
|
+
const finalSrcset = (_d = rest.srcSet) !== null && _d !== void 0 ? _d : internalImageSrcSet({
|
|
45
|
+
...loaderOptions,
|
|
46
|
+
widths,
|
|
47
|
+
src: data.url,
|
|
48
|
+
width: maxWidth,
|
|
49
|
+
loader,
|
|
50
|
+
});
|
|
38
51
|
/* eslint-disable hydrogen/prefer-image-component */
|
|
39
|
-
return (React.createElement("img", { id: (
|
|
52
|
+
return (React.createElement("img", { id: (_e = data.id) !== null && _e !== void 0 ? _e : '', alt: (_g = (_f = data.altText) !== null && _f !== void 0 ? _f : rest.alt) !== null && _g !== void 0 ? _g : '', loading: loading !== null && loading !== void 0 ? loading : 'lazy', ...rest, src: finalSrc, width: finalWidth !== null && finalWidth !== void 0 ? finalWidth : undefined, height: finalHeight !== null && finalHeight !== void 0 ? finalHeight : undefined, srcSet: finalSrcset }));
|
|
40
53
|
/* eslint-enable hydrogen/prefer-image-component */
|
|
41
54
|
}
|
|
42
|
-
function ExternalImage({ src, width, height, alt, loader, loaderOptions, loading, ...rest }) {
|
|
55
|
+
function ExternalImage({ src, width, height, alt, loader, loaderOptions, widths, loading, ...rest }) {
|
|
56
|
+
var _a, _b;
|
|
43
57
|
if (!width || !height) {
|
|
44
58
|
throw new Error(`<Image/>: when 'src' is provided, 'width' and 'height' are required and need to be valid values (i.e. greater than zero). Provided values: 'src': ${src}, 'width': ${width}, 'height': ${height}`);
|
|
45
59
|
}
|
|
46
|
-
if (!alt) {
|
|
47
|
-
console.warn(`<Image/>: when 'src' is provided, 'alt' should also be provided`);
|
|
60
|
+
if (__HYDROGEN_DEV__ && !alt) {
|
|
61
|
+
console.warn(`<Image/>: when 'src' is provided, 'alt' should also be provided. ${`Image: ${src}`}`);
|
|
48
62
|
}
|
|
63
|
+
if (widths &&
|
|
64
|
+
Array.isArray(widths) &&
|
|
65
|
+
widths.some((size) => isNaN(size)))
|
|
66
|
+
throw new Error(`<Image/>: the 'widths' property must be an array of numbers`);
|
|
49
67
|
let finalSrc = src;
|
|
50
68
|
if (loader) {
|
|
51
69
|
finalSrc = loader({ src, width, height, ...loaderOptions });
|
|
@@ -53,7 +71,40 @@ function ExternalImage({ src, width, height, alt, loader, loaderOptions, loading
|
|
|
53
71
|
throw new Error(`<Image/>: 'loader' did not return a valid string`);
|
|
54
72
|
}
|
|
55
73
|
}
|
|
74
|
+
let finalSrcset = (_a = rest.srcSet) !== null && _a !== void 0 ? _a : undefined;
|
|
75
|
+
if (!finalSrcset && loader && widths) {
|
|
76
|
+
// Height is a requirement in the LoaderProps, so to keep the aspect ratio, we must determine the height based on the default values
|
|
77
|
+
const heightToWidthRatio = parseInt(height) / parseInt(width);
|
|
78
|
+
finalSrcset = (_b = widths === null || widths === void 0 ? void 0 : widths.map((width) => parseInt(width, 10))) === null || _b === void 0 ? void 0 : _b.map((width) => `${loader({
|
|
79
|
+
...loaderOptions,
|
|
80
|
+
src,
|
|
81
|
+
width,
|
|
82
|
+
height: Math.floor(width * heightToWidthRatio),
|
|
83
|
+
})} ${width}w`).join(', ');
|
|
84
|
+
}
|
|
56
85
|
/* eslint-disable hydrogen/prefer-image-component */
|
|
57
|
-
return (React.createElement("img", { ...rest, src: finalSrc, width: width, height: height, alt: alt !== null && alt !== void 0 ? alt : '', loading: loading !== null && loading !== void 0 ? loading : 'lazy' }));
|
|
86
|
+
return (React.createElement("img", { ...rest, src: finalSrc, width: width, height: height, alt: alt !== null && alt !== void 0 ? alt : '', loading: loading !== null && loading !== void 0 ? loading : 'lazy', srcSet: finalSrcset }));
|
|
58
87
|
/* eslint-enable hydrogen/prefer-image-component */
|
|
59
88
|
}
|
|
89
|
+
// based on the default width sizes used by the Shopify liquid HTML tag img_tag plus a 2560 width to account for 2k resolutions
|
|
90
|
+
// reference: https://shopify.dev/api/liquid/filters/html-filters#image_tag
|
|
91
|
+
const IMG_SRC_SET_SIZES = [352, 832, 1200, 1920, 2560];
|
|
92
|
+
function internalImageSrcSet({ src, width, crop, scale, widths, loader, }) {
|
|
93
|
+
const hasCustomWidths = widths && Array.isArray(widths);
|
|
94
|
+
if (hasCustomWidths && widths.some((size) => isNaN(size)))
|
|
95
|
+
throw new Error(`<Image/>: the 'widths' must be an array of numbers`);
|
|
96
|
+
let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;
|
|
97
|
+
if (!hasCustomWidths &&
|
|
98
|
+
width &&
|
|
99
|
+
width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1])
|
|
100
|
+
setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);
|
|
101
|
+
const srcGenerator = loader ? loader : addImageSizeParametersToUrl;
|
|
102
|
+
return setSizes
|
|
103
|
+
.map((size) => `${srcGenerator({
|
|
104
|
+
src,
|
|
105
|
+
width: size,
|
|
106
|
+
crop,
|
|
107
|
+
scale,
|
|
108
|
+
})} ${size}w`)
|
|
109
|
+
.join(', ');
|
|
110
|
+
}
|
|
@@ -10,6 +10,8 @@ export interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorEle
|
|
|
10
10
|
reloadDocument?: boolean;
|
|
11
11
|
/** Whether to prefetch the link source when the user signals intent. Defaults to `true`. For more information, refer to [Prefetching a link source](https://shopify.dev/custom-storefronts/hydrogen/framework/routes#prefetching-a-link-source). */
|
|
12
12
|
prefetch?: boolean;
|
|
13
|
+
/** Whether to emulate natural browser behavior and restore scroll position on navigation. Defaults to `true`. */
|
|
14
|
+
scroll?: boolean;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* The `Link` component is used to navigate between routes. Because it renders an underlying `<a>` element, all
|
|
@@ -18,7 +18,7 @@ export const Link = React.forwardRef(function Link(props, ref) {
|
|
|
18
18
|
*/
|
|
19
19
|
const [shouldPrefetch, setShouldPrefetch] = useState(false);
|
|
20
20
|
const [maybePrefetch, setMaybePrefetch] = useState(false);
|
|
21
|
-
const { reloadDocument, target, replace: _replace, to, onClick, clientState, prefetch = true, } = props;
|
|
21
|
+
const { reloadDocument, target, replace: _replace, to, onClick, clientState, prefetch = true, scroll = true, } = props;
|
|
22
22
|
const internalClick = useCallback((e) => {
|
|
23
23
|
if (onClick)
|
|
24
24
|
onClick(e);
|
|
@@ -32,18 +32,20 @@ export const Link = React.forwardRef(function Link(props, ref) {
|
|
|
32
32
|
const replace = !!_replace || createPath(location) === createPath({ pathname: to });
|
|
33
33
|
navigate(to, {
|
|
34
34
|
replace,
|
|
35
|
+
scroll,
|
|
35
36
|
clientState,
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
}, [
|
|
40
|
+
onClick,
|
|
39
41
|
reloadDocument,
|
|
40
42
|
target,
|
|
41
43
|
_replace,
|
|
42
|
-
to,
|
|
43
|
-
clientState,
|
|
44
|
-
onClick,
|
|
45
44
|
location,
|
|
45
|
+
to,
|
|
46
46
|
navigate,
|
|
47
|
+
clientState,
|
|
48
|
+
scroll,
|
|
47
49
|
]);
|
|
48
50
|
const signalPrefetchIntent = () => {
|
|
49
51
|
/**
|
|
@@ -91,6 +93,7 @@ export const Link = React.forwardRef(function Link(props, ref) {
|
|
|
91
93
|
'clientState',
|
|
92
94
|
'reloadDocument',
|
|
93
95
|
'prefetch',
|
|
96
|
+
'scroll',
|
|
94
97
|
]), ref: ref, onClick: internalClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onFocus, onBlur: onBlur, onTouchStart: onTouchStart, href: props.to }, props.children),
|
|
95
98
|
shouldPrefetch && React.createElement(Prefetch, { pathname: to })));
|
|
96
99
|
});
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import LocalizationClientProvider from './LocalizationClientProvider.client';
|
|
3
3
|
import { useShop } from '../../foundation/useShop';
|
|
4
4
|
import { useShopQuery } from '../../hooks/useShopQuery';
|
|
5
|
-
import { CacheDays } from '../../
|
|
5
|
+
import { CacheDays } from '../../foundation/Cache/strategies';
|
|
6
6
|
import { useSession } from '../../foundation/useSession/useSession';
|
|
7
7
|
/**
|
|
8
8
|
* The `LocalizationProvider` component automatically queries the Storefront API's
|
|
@@ -12,8 +12,9 @@ import { ModelViewer } from '../ModelViewer';
|
|
|
12
12
|
export function MediaFile({ data, options, ...passthroughProps }) {
|
|
13
13
|
switch (data.mediaContentType) {
|
|
14
14
|
case 'IMAGE': {
|
|
15
|
-
const dataImage = data
|
|
16
|
-
|
|
15
|
+
const dataImage = data
|
|
16
|
+
.image;
|
|
17
|
+
if (!dataImage || !dataImage.url) {
|
|
17
18
|
console.warn(`No "image" property was found on the "data" prop for <MediaFile/>, for the "type='image'"`);
|
|
18
19
|
return null;
|
|
19
20
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Product, ProductVariant as ProductVariantType } from '../../storefront-api-types';
|
|
3
|
+
import type { PartialDeep } from 'type-fest';
|
|
4
|
+
declare type InitialVariantId = ProductVariantType['id'] | null;
|
|
5
|
+
interface ProductOptionsProviderProps {
|
|
6
|
+
/** A [Product object](https://shopify.dev/api/storefront/reference/products/product). */
|
|
7
|
+
data: PartialDeep<Product>;
|
|
8
|
+
/** A `ReactNode` element. */
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* The initially selected variant.
|
|
12
|
+
* The following logic applies to `initialVariantId`:
|
|
13
|
+
* 1. If `initialVariantId` is provided, then it's used even if it's out of stock.
|
|
14
|
+
* 2. If `initialVariantId` is provided but is `null`, then no variant is used.
|
|
15
|
+
* 3. If nothing is passed to `initialVariantId` then the first available / in-stock variant is used.
|
|
16
|
+
* 4. If nothing is passed to `initialVariantId` and no variants are in stock, then the first variant is used.
|
|
17
|
+
*/
|
|
18
|
+
initialVariantId?: InitialVariantId;
|
|
19
|
+
}
|
|
20
|
+
export declare function ProductOptionsProvider({ children, data: product, initialVariantId: explicitVariantId, }: ProductOptionsProviderProps): JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { useMemo, useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { ProductOptionsContext } from './context';
|
|
3
|
+
import { getSelectedVariant, getOptions, } from '../../hooks/useProductOptions/helpers';
|
|
4
|
+
export function ProductOptionsProvider({ children, data: product, initialVariantId: explicitVariantId, }) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
// The flattened variants
|
|
7
|
+
const variants = useMemo(() => { var _a; return (_a = product.variants) === null || _a === void 0 ? void 0 : _a.nodes; }, [(_a = product.variants) === null || _a === void 0 ? void 0 : _a.nodes]);
|
|
8
|
+
if (!isProductVariantArray(variants)) {
|
|
9
|
+
throw new Error(`<ProductOptionsProvider/> requires product.variants.nodes`);
|
|
10
|
+
}
|
|
11
|
+
// All the options available for a product, based on all the variants
|
|
12
|
+
const options = useMemo(() => getOptions(variants), [variants]);
|
|
13
|
+
/**
|
|
14
|
+
* Track the selectedVariant within the provider.
|
|
15
|
+
*/
|
|
16
|
+
const [selectedVariant, setSelectedVariant] = useState(() => getVariantBasedOnIdProp(explicitVariantId, variants));
|
|
17
|
+
/**
|
|
18
|
+
* Track the selectedOptions within the provider. If a `initialVariantId`
|
|
19
|
+
* is passed, use that to select initial options.
|
|
20
|
+
*/
|
|
21
|
+
const [selectedOptions, setSelectedOptions] = useState(() => getSelectedOptions(selectedVariant));
|
|
22
|
+
/**
|
|
23
|
+
* When the initialVariantId changes, we need to make sure we
|
|
24
|
+
* update the selected variant and selected options. If not,
|
|
25
|
+
* then the selected variant and options will reference incorrect
|
|
26
|
+
* values.
|
|
27
|
+
*/
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const newSelectedVariant = getVariantBasedOnIdProp(explicitVariantId, variants);
|
|
30
|
+
setSelectedVariant(newSelectedVariant);
|
|
31
|
+
setSelectedOptions(getSelectedOptions(newSelectedVariant));
|
|
32
|
+
}, [explicitVariantId, variants]);
|
|
33
|
+
/**
|
|
34
|
+
* Allow the developer to select an option.
|
|
35
|
+
*/
|
|
36
|
+
const setSelectedOption = useCallback((name, value) => {
|
|
37
|
+
setSelectedOptions((selectedOptions) => ({
|
|
38
|
+
...selectedOptions,
|
|
39
|
+
[name]: value,
|
|
40
|
+
}));
|
|
41
|
+
}, [setSelectedOptions]);
|
|
42
|
+
const isOptionInStock = useCallback((option, value) => {
|
|
43
|
+
var _a;
|
|
44
|
+
const proposedVariant = getSelectedVariant(variants, {
|
|
45
|
+
...selectedOptions,
|
|
46
|
+
...{ [option]: value },
|
|
47
|
+
});
|
|
48
|
+
return (_a = proposedVariant === null || proposedVariant === void 0 ? void 0 : proposedVariant.availableForSale) !== null && _a !== void 0 ? _a : true;
|
|
49
|
+
}, [selectedOptions, variants]);
|
|
50
|
+
const sellingPlanGroups = useMemo(() => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
return (_b = (_a = product.sellingPlanGroups) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.map((sellingPlanGroup) => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
return ({
|
|
55
|
+
...sellingPlanGroup,
|
|
56
|
+
sellingPlans: (_b = (_a = sellingPlanGroup === null || sellingPlanGroup === void 0 ? void 0 : sellingPlanGroup.sellingPlans) === null || _a === void 0 ? void 0 : _a.nodes) !== null && _b !== void 0 ? _b : [],
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}, [(_b = product.sellingPlanGroups) === null || _b === void 0 ? void 0 : _b.nodes]);
|
|
60
|
+
/**
|
|
61
|
+
* Track the selectedSellingPlan within the hook. If `initialSellingPlanId`
|
|
62
|
+
* is passed, use that as an initial value. Look it up from the `selectedVariant`, since
|
|
63
|
+
* that is also a requirement.
|
|
64
|
+
*/
|
|
65
|
+
const [selectedSellingPlan, setSelectedSellingPlan] = useState(undefined);
|
|
66
|
+
const selectedSellingPlanAllocation = useMemo(() => {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
if (!selectedVariant || !selectedSellingPlan) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!((_a = selectedVariant.sellingPlanAllocations) === null || _a === void 0 ? void 0 : _a.nodes)) {
|
|
72
|
+
throw new Error(`<ProductOptionsProvider/>: You must include 'sellingPlanAllocations.nodes' in your variants in order to calculate selectedSellingPlanAllocation`);
|
|
73
|
+
}
|
|
74
|
+
return (_b = selectedVariant.sellingPlanAllocations.nodes) === null || _b === void 0 ? void 0 : _b.find((allocation) => { var _a; return ((_a = allocation === null || allocation === void 0 ? void 0 : allocation.sellingPlan) === null || _a === void 0 ? void 0 : _a.id) === selectedSellingPlan.id; });
|
|
75
|
+
}, [selectedVariant, selectedSellingPlan]);
|
|
76
|
+
const value = useMemo(() => ({
|
|
77
|
+
variants,
|
|
78
|
+
variantsConnection: product.variants,
|
|
79
|
+
options,
|
|
80
|
+
selectedVariant,
|
|
81
|
+
setSelectedVariant,
|
|
82
|
+
selectedOptions,
|
|
83
|
+
setSelectedOption,
|
|
84
|
+
setSelectedOptions,
|
|
85
|
+
isOptionInStock,
|
|
86
|
+
selectedSellingPlan,
|
|
87
|
+
setSelectedSellingPlan,
|
|
88
|
+
selectedSellingPlanAllocation,
|
|
89
|
+
sellingPlanGroups,
|
|
90
|
+
sellingPlanGroupsConnection: product.sellingPlanGroups,
|
|
91
|
+
}), [
|
|
92
|
+
isOptionInStock,
|
|
93
|
+
options,
|
|
94
|
+
product.sellingPlanGroups,
|
|
95
|
+
product.variants,
|
|
96
|
+
selectedOptions,
|
|
97
|
+
selectedSellingPlan,
|
|
98
|
+
selectedSellingPlanAllocation,
|
|
99
|
+
selectedVariant,
|
|
100
|
+
sellingPlanGroups,
|
|
101
|
+
setSelectedOption,
|
|
102
|
+
variants,
|
|
103
|
+
]);
|
|
104
|
+
return (React.createElement(ProductOptionsContext.Provider, { value: value }, children));
|
|
105
|
+
}
|
|
106
|
+
function getVariantBasedOnIdProp(explicitVariantId, variants) {
|
|
107
|
+
// get the initial variant based on the logic outlined in the comments for 'initialVariantId' above
|
|
108
|
+
// * 1. If `initialVariantId` is provided, then it's used even if it's out of stock.
|
|
109
|
+
if (explicitVariantId) {
|
|
110
|
+
const foundVariant = variants.find((variant) => (variant === null || variant === void 0 ? void 0 : variant.id) === explicitVariantId);
|
|
111
|
+
if (!foundVariant) {
|
|
112
|
+
console.warn(`<ProductOptionsProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID`);
|
|
113
|
+
}
|
|
114
|
+
return foundVariant;
|
|
115
|
+
}
|
|
116
|
+
// * 2. If `initialVariantId` is provided but is `null`, then no variant is used.
|
|
117
|
+
if (explicitVariantId === null) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
// * 3. If nothing is passed to `initialVariantId` then the first available / in-stock variant is used.
|
|
121
|
+
// * 4. If nothing is passed to `initialVariantId` and no variants are in stock, then the first variant is used.
|
|
122
|
+
if (explicitVariantId === undefined) {
|
|
123
|
+
return variants.find((variant) => variant === null || variant === void 0 ? void 0 : variant.availableForSale) || variants[0];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function getSelectedOptions(selectedVariant) {
|
|
127
|
+
return (selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.selectedOptions)
|
|
128
|
+
? selectedVariant.selectedOptions.reduce((memo, optionSet) => {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
memo[(_a = optionSet === null || optionSet === void 0 ? void 0 : optionSet.name) !== null && _a !== void 0 ? _a : ''] = (_b = optionSet === null || optionSet === void 0 ? void 0 : optionSet.value) !== null && _b !== void 0 ? _b : '';
|
|
131
|
+
return memo;
|
|
132
|
+
}, {})
|
|
133
|
+
: {};
|
|
134
|
+
}
|
|
135
|
+
function isProductVariantArray(maybeVariantArray) {
|
|
136
|
+
if (!maybeVariantArray || !Array.isArray(maybeVariantArray)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { Product } from '../../storefront-api-types';
|
|
2
3
|
import { Money } from '../Money';
|
|
4
|
+
import type { PartialDeep } from 'type-fest';
|
|
3
5
|
export interface ProductPriceProps {
|
|
6
|
+
data: PartialDeep<Product>;
|
|
4
7
|
/** The type of price. Valid values: `regular` (default) or `compareAt`. */
|
|
5
8
|
priceType?: 'regular' | 'compareAt';
|
|
6
9
|
/** The type of value. Valid values: `min` (default), `max` or `unit`. */
|
|
@@ -10,6 +13,6 @@ export interface ProductPriceProps {
|
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
15
|
* The `ProductPrice` component renders a `Money` component with the product
|
|
13
|
-
* [`priceRange`](https://shopify.dev/api/storefront/reference/products/productpricerange)'s `maxVariantPrice` or `minVariantPrice`, for either the regular price or compare at price range.
|
|
16
|
+
* [`priceRange`](https://shopify.dev/api/storefront/reference/products/productpricerange)'s `maxVariantPrice` or `minVariantPrice`, for either the regular price or compare at price range.
|
|
14
17
|
*/
|
|
15
|
-
export declare function ProductPrice
|
|
18
|
+
export declare function ProductPrice(props: Omit<React.ComponentProps<typeof Money>, 'data' | 'measurement'> & ProductPriceProps): JSX.Element | null;
|
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Money } from '../Money';
|
|
3
|
-
import { useProduct } from '../ProductProvider';
|
|
4
3
|
/**
|
|
5
4
|
* The `ProductPrice` component renders a `Money` component with the product
|
|
6
|
-
* [`priceRange`](https://shopify.dev/api/storefront/reference/products/productpricerange)'s `maxVariantPrice` or `minVariantPrice`, for either the regular price or compare at price range.
|
|
5
|
+
* [`priceRange`](https://shopify.dev/api/storefront/reference/products/productpricerange)'s `maxVariantPrice` or `minVariantPrice`, for either the regular price or compare at price range.
|
|
7
6
|
*/
|
|
8
7
|
export function ProductPrice(props) {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
|
-
const product =
|
|
11
|
-
const { priceType = 'regular', variantId, valueType = 'min', ...passthroughProps } = props;
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
9
|
+
const { priceType = 'regular', variantId, valueType = 'min', data: product, ...passthroughProps } = props;
|
|
12
10
|
if (product == null) {
|
|
13
|
-
throw new Error(
|
|
11
|
+
throw new Error(`<ProductPrice/> requires a product as the 'data' prop`);
|
|
14
12
|
}
|
|
15
13
|
let price;
|
|
16
14
|
let measurement;
|
|
17
15
|
const variant = variantId
|
|
18
|
-
? (_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)
|
|
16
|
+
? (_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.variants) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.find((variant) => (variant === null || variant === void 0 ? void 0 : variant.id) === variantId)) !== null && _c !== void 0 ? _c : null
|
|
19
17
|
: null;
|
|
20
18
|
if (priceType === 'compareAt') {
|
|
21
19
|
if (variantId && variant) {
|
|
22
|
-
if (((
|
|
20
|
+
if (((_d = variant.compareAtPriceV2) === null || _d === void 0 ? void 0 : _d.amount) === ((_e = variant.priceV2) === null || _e === void 0 ? void 0 : _e.amount)) {
|
|
23
21
|
return null;
|
|
24
22
|
}
|
|
25
23
|
price = variant.compareAtPriceV2;
|
|
26
24
|
}
|
|
27
25
|
else if (valueType === 'max') {
|
|
28
|
-
price = (
|
|
26
|
+
price = (_f = product === null || product === void 0 ? void 0 : product.compareAtPriceRange) === null || _f === void 0 ? void 0 : _f.maxVariantPrice;
|
|
29
27
|
}
|
|
30
28
|
else {
|
|
31
|
-
price = (
|
|
29
|
+
price = (_g = product === null || product === void 0 ? void 0 : product.compareAtPriceRange) === null || _g === void 0 ? void 0 : _g.minVariantPrice;
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
else {
|
|
@@ -40,10 +38,10 @@ export function ProductPrice(props) {
|
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
else if (valueType === 'max') {
|
|
43
|
-
price = (
|
|
41
|
+
price = (_h = product.priceRange) === null || _h === void 0 ? void 0 : _h.maxVariantPrice;
|
|
44
42
|
}
|
|
45
43
|
else {
|
|
46
|
-
price = (
|
|
44
|
+
price = (_j = product.priceRange) === null || _j === void 0 ? void 0 : _j.minVariantPrice;
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
if (!price) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useShop } from '../../foundation';
|
|
3
|
+
import { Head } from '../../client';
|
|
4
|
+
export function NoIndexPageSeo({ title, titleTemplate, lang, }) {
|
|
5
|
+
const { languageCode: fallBacklang } = useShop();
|
|
6
|
+
return (React.createElement(React.Fragment, null,
|
|
7
|
+
React.createElement(Head, { defaultTitle: title !== null && title !== void 0 ? title : '', titleTemplate: titleTemplate !== null && titleTemplate !== void 0 ? titleTemplate : `%s - ${title}` },
|
|
8
|
+
React.createElement("html", { lang: lang !== null && lang !== void 0 ? lang : fallBacklang }),
|
|
9
|
+
React.createElement("meta", { name: "robots", content: "noindex" }))));
|
|
10
|
+
}
|
|
@@ -2,6 +2,7 @@ import { type ComponentProps } from 'react';
|
|
|
2
2
|
import { ProductSeo } from './ProductSeo.client';
|
|
3
3
|
import { CollectionSeo } from './CollectionSeo.client';
|
|
4
4
|
import { PageSeo } from './PageSeo.client';
|
|
5
|
+
import { NoIndexPageSeo } from './NoIndexSeo.client';
|
|
5
6
|
import type { DefaultPage as DefaultPageType, HomePage as HomePageType } from './seo-types';
|
|
6
7
|
declare type Props = {
|
|
7
8
|
type: 'defaultSeo';
|
|
@@ -18,6 +19,9 @@ declare type Props = {
|
|
|
18
19
|
} | {
|
|
19
20
|
type: 'page';
|
|
20
21
|
data: ComponentProps<typeof PageSeo>;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'noindex';
|
|
24
|
+
data: ComponentProps<typeof NoIndexPageSeo>;
|
|
21
25
|
};
|
|
22
26
|
/**
|
|
23
27
|
* The `Seo` component renders SEO information on a webpage.
|
|
@@ -5,6 +5,7 @@ import { HomePageSeo } from './HomePageSeo.client';
|
|
|
5
5
|
import { ProductSeo } from './ProductSeo.client';
|
|
6
6
|
import { CollectionSeo } from './CollectionSeo.client';
|
|
7
7
|
import { PageSeo } from './PageSeo.client';
|
|
8
|
+
import { NoIndexPageSeo } from './NoIndexSeo.client';
|
|
8
9
|
/**
|
|
9
10
|
* The `Seo` component renders SEO information on a webpage.
|
|
10
11
|
*/
|
|
@@ -21,6 +22,8 @@ export function Seo(props) {
|
|
|
21
22
|
return React.createElement(CollectionSeo, { ...props.data });
|
|
22
23
|
case 'page':
|
|
23
24
|
return React.createElement(PageSeo, { ...props.data });
|
|
25
|
+
case 'noindex':
|
|
26
|
+
return React.createElement(NoIndexPageSeo, { ...props.data });
|
|
24
27
|
default:
|
|
25
28
|
console.warn('The <Seo/> only accepts type prop with values of defaultSeo, homepage, product, collection, or page.');
|
|
26
29
|
return null;
|
|
@@ -20,7 +20,7 @@ export { CartShopPayButton } from './CartShopPayButton';
|
|
|
20
20
|
export { CartEstimatedCost } from './CartEstimatedCost';
|
|
21
21
|
export { CartProvider, useCart, useInstantCheckout } from './CartProvider';
|
|
22
22
|
export type { State, Status, Cart, CartWithActions, CartAction, } from './CartProvider';
|
|
23
|
-
export {
|
|
23
|
+
export { ProductOptionsProvider, useProductOptions, } from './ProductOptionsProvider';
|
|
24
24
|
export { ProductPrice } from './ProductPrice';
|
|
25
25
|
export { BuyNowButton } from './BuyNowButton';
|
|
26
26
|
export { ShopPayButton } from './ShopPayButton';
|
|
@@ -18,7 +18,7 @@ export { CartCheckoutButton } from './CartCheckoutButton';
|
|
|
18
18
|
export { CartShopPayButton } from './CartShopPayButton';
|
|
19
19
|
export { CartEstimatedCost } from './CartEstimatedCost';
|
|
20
20
|
export { CartProvider, useCart, useInstantCheckout } from './CartProvider';
|
|
21
|
-
export {
|
|
21
|
+
export { ProductOptionsProvider, useProductOptions, } from './ProductOptionsProvider';
|
|
22
22
|
export { ProductPrice } from './ProductPrice';
|
|
23
23
|
export { BuyNowButton } from './BuyNowButton';
|
|
24
24
|
export { ShopPayButton } from './ShopPayButton';
|
package/dist/esnext/config.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const defineConfig: (params:
|
|
3
|
-
export type { HydrogenConfig };
|
|
1
|
+
import type { InlineHydrogenConfig } from './types';
|
|
2
|
+
export declare const defineConfig: (params: InlineHydrogenConfig) => InlineHydrogenConfig;
|
|
3
|
+
export type { InlineHydrogenConfig as HydrogenConfig };
|