@shopify/hydrogen 0.11.1 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +500 -3
- package/dist/esnext/client.d.ts +2 -0
- package/dist/esnext/client.js +2 -0
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +3 -4
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +9 -22
- package/dist/esnext/components/AddToCartButton/index.d.ts +1 -1
- package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +4 -5
- package/dist/esnext/components/BuyNowButton/index.d.ts +1 -1
- package/dist/esnext/components/BuyNowButton/index.js +1 -1
- package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +2 -3
- package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +3 -3
- package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +5 -3
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +5 -5
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +1 -1
- package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +1 -3
- package/dist/esnext/components/CartLineProvider/context.d.ts +10 -16
- package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.d.ts +1 -3
- package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +1 -1
- package/dist/esnext/components/CartProvider/CartProvider.client.js +8 -2
- package/dist/esnext/components/CartProvider/cart-queries.d.ts +9 -0
- package/dist/esnext/components/CartProvider/cart-queries.js +876 -0
- package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +72 -5
- package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +72 -5
- package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +72 -5
- package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +73 -6
- package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +13 -11
- package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +72 -5
- package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +72 -5
- package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +72 -5
- package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +73 -6
- package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +72 -5
- package/dist/esnext/components/CartProvider/hooks.d.ts +1 -1
- package/dist/esnext/components/CartProvider/hooks.js +4 -1
- package/dist/esnext/components/CartProvider/types.d.ts +1 -1
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +3 -2
- package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +8 -13
- package/dist/esnext/components/ExternalVideo/ExternalVideo.js +7 -7
- package/dist/esnext/components/ExternalVideo/index.d.ts +1 -1
- package/dist/esnext/components/ExternalVideo/index.js +1 -1
- package/dist/esnext/components/Image/Image.d.ts +14 -16
- package/dist/esnext/components/Image/Image.js +17 -17
- package/dist/esnext/components/Image/index.d.ts +1 -1
- package/dist/esnext/components/Image/index.js +1 -1
- package/dist/esnext/components/Link/Link.client.d.ts +4 -5
- package/dist/esnext/components/Link/Link.client.js +5 -4
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -3
- package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +0 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +4 -5
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +15 -4
- package/dist/esnext/components/LocalizationProvider/LocalizationQuery.d.ts +5 -8
- package/dist/esnext/components/LocalizationProvider/index.d.ts +0 -1
- package/dist/esnext/components/LocalizationProvider/index.js +0 -1
- package/dist/esnext/components/MediaFile/MediaFile.d.ts +10 -21
- package/dist/esnext/components/MediaFile/MediaFile.js +7 -5
- package/dist/esnext/components/MediaFile/index.d.ts +1 -1
- package/dist/esnext/components/MediaFile/index.js +1 -1
- package/dist/esnext/components/Metafield/Metafield.client.d.ts +2 -6
- package/dist/esnext/components/Metafield/Metafield.client.js +8 -8
- package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +1 -3
- package/dist/esnext/components/Metafield/index.d.ts +1 -2
- package/dist/esnext/components/Metafield/index.js +1 -1
- package/dist/esnext/components/Metafield/types.d.ts +1 -1
- package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +58 -66
- package/dist/esnext/components/ModelViewer/ModelViewer.client.js +10 -7
- package/dist/esnext/components/ModelViewer/index.d.ts +1 -1
- package/dist/esnext/components/Money/Money.client.d.ts +8 -12
- package/dist/esnext/components/Money/Money.client.js +1 -4
- package/dist/esnext/components/Money/index.d.ts +1 -1
- package/dist/esnext/components/Money/index.js +1 -1
- package/dist/esnext/components/ProductDescription/ProductDescription.client.d.ts +7 -2
- package/dist/esnext/components/ProductDescription/ProductDescription.client.js +4 -3
- package/dist/esnext/components/ProductMetafield/ProductMetafield.client.js +3 -3
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -5
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +2 -2
- package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +8 -8
- package/dist/esnext/components/ProductProvider/ProductProvider.client.js +2 -4
- package/dist/esnext/components/ProductProvider/context.d.ts +23 -14
- package/dist/esnext/components/ProductProvider/index.d.ts +1 -1
- package/dist/esnext/components/ProductProvider/index.js +1 -1
- package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +3 -2
- package/dist/esnext/components/Seo/CollectionSeo.client.js +3 -3
- package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +3 -2
- package/dist/esnext/components/Seo/DefaultPageSeo.client.js +2 -2
- package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +3 -3
- package/dist/esnext/components/Seo/DescriptionSeo.client.js +1 -1
- package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/ImageSeo.client.d.ts +3 -2
- package/dist/esnext/components/Seo/PageSeo.client.d.ts +3 -2
- package/dist/esnext/components/Seo/PageSeo.client.js +2 -2
- package/dist/esnext/components/Seo/ProductSeo.client.d.ts +5 -2
- package/dist/esnext/components/Seo/ProductSeo.client.js +10 -5
- package/dist/esnext/components/Seo/Seo.client.d.ts +11 -7
- package/dist/esnext/components/Seo/Seo.client.js +8 -14
- package/dist/esnext/components/Seo/TitleSeo.client.d.ts +3 -4
- package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/seo-types.d.ts +17 -0
- package/dist/esnext/components/{ExternalVideo/ExternalVideoFragment.js → Seo/seo-types.js} +0 -0
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.d.ts +2 -1
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +1 -9
- package/dist/esnext/components/ShopPayButton/index.d.ts +1 -1
- package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +8 -13
- package/dist/esnext/components/UnitPrice/UnitPrice.client.js +9 -4
- package/dist/esnext/components/UnitPrice/index.d.ts +1 -1
- package/dist/esnext/components/UnitPrice/index.js +1 -1
- package/dist/esnext/components/Video/Video.d.ts +8 -16
- package/dist/esnext/components/Video/Video.js +11 -6
- package/dist/esnext/components/Video/index.d.ts +1 -2
- package/dist/esnext/components/Video/index.js +1 -1
- package/dist/esnext/components/index.d.ts +3 -16
- package/dist/esnext/components/index.js +2 -5
- package/dist/esnext/entry-client.js +27 -8
- package/dist/esnext/entry-server.d.ts +2 -1
- package/dist/esnext/entry-server.js +127 -160
- package/dist/esnext/foundation/Boomerang/Boomerang.client.d.ts +3 -1
- package/dist/esnext/foundation/Boomerang/Boomerang.client.js +17 -3
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +22 -0
- package/dist/esnext/foundation/{Router/DefaultRoutes.js → FileRoutes/FileRoutes.server.js} +24 -23
- package/dist/esnext/foundation/Redirect/Redirect.client.d.ts +5 -0
- package/dist/esnext/foundation/Redirect/Redirect.client.js +14 -0
- package/dist/esnext/foundation/Route/Route.server.d.ts +12 -0
- package/dist/esnext/foundation/Route/Route.server.js +33 -0
- package/dist/esnext/foundation/Router/{Router.client.d.ts → BrowserRouter.client.d.ts} +3 -2
- package/dist/esnext/foundation/Router/{Router.client.js → BrowserRouter.client.js} +11 -7
- package/dist/esnext/foundation/Router/Router.server.d.ts +10 -0
- package/dist/esnext/foundation/Router/Router.server.js +8 -0
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +19 -24
- package/dist/esnext/foundation/ServerStateProvider/{ServerStateProvider.client.d.ts → ServerStateProvider.d.ts} +0 -0
- package/dist/esnext/foundation/ServerStateProvider/{ServerStateProvider.client.js → ServerStateProvider.js} +0 -0
- package/dist/esnext/foundation/ServerStateProvider/index.d.ts +2 -2
- package/dist/esnext/foundation/ServerStateProvider/index.js +1 -1
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.js +3 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +3 -0
- package/dist/esnext/foundation/ShopifyProvider/index.d.ts +0 -1
- package/dist/esnext/foundation/ShopifyProvider/index.js +0 -1
- package/dist/esnext/foundation/index.d.ts +0 -2
- package/dist/esnext/foundation/index.js +0 -2
- package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.d.ts +6 -3
- package/dist/esnext/{hooks → foundation}/useNavigate/useNavigate.js +4 -1
- package/dist/esnext/foundation/useQuery/hooks.d.ts +5 -4
- package/dist/esnext/foundation/useQuery/hooks.js +13 -4
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.d.ts +9 -0
- package/dist/esnext/foundation/useRouteParams/RouteParamsProvider.client.js +7 -0
- package/dist/esnext/foundation/useRouteParams/useRouteParams.d.ts +4 -0
- package/dist/esnext/foundation/useRouteParams/useRouteParams.js +9 -0
- package/dist/esnext/foundation/useUrl/useUrl.js +1 -1
- package/dist/esnext/framework/Hydration/Html.d.ts +2 -0
- package/dist/esnext/framework/Hydration/Html.js +71 -2
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +28 -7
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +5 -0
- package/dist/esnext/framework/Hydration/rsc.js +1 -1
- package/dist/esnext/framework/cache/in-memory.d.ts +1 -0
- package/dist/esnext/framework/cache/in-memory.js +15 -5
- package/dist/esnext/framework/middleware.js +25 -3
- package/dist/esnext/framework/plugin.js +6 -1
- package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +28 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +61 -77
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +1 -1
- package/dist/esnext/hooks/index.d.ts +0 -1
- package/dist/esnext/hooks/index.js +0 -1
- package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +10 -18
- package/dist/esnext/hooks/useCountry/useCountry.d.ts +4 -4
- package/dist/esnext/hooks/useMoney/hooks.d.ts +3 -3
- package/dist/esnext/hooks/useMoney/hooks.js +2 -2
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +17 -2
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.js +7 -3
- package/dist/esnext/hooks/useProduct/useProduct.d.ts +36 -138
- package/dist/esnext/hooks/useProductOptions/helpers.d.ts +6 -4
- package/dist/esnext/hooks/useProductOptions/helpers.js +13 -6
- package/dist/esnext/hooks/useProductOptions/types.d.ts +15 -35
- package/dist/esnext/hooks/useProductOptions/useProductOptions.d.ts +6 -5
- package/dist/esnext/hooks/useProductOptions/useProductOptions.js +13 -3
- package/dist/esnext/hooks/useShopQuery/hooks.js +79 -21
- package/dist/esnext/index.d.ts +8 -2
- package/dist/esnext/index.js +8 -2
- package/dist/esnext/platforms/node.d.ts +2 -3
- package/dist/esnext/platforms/node.js +5 -3
- package/dist/esnext/platforms/worker-event.d.ts +0 -8
- package/dist/esnext/platforms/worker-event.js +2 -23
- package/dist/esnext/platforms/worker.d.ts +14 -0
- package/dist/esnext/platforms/worker.js +25 -0
- package/dist/esnext/{graphql/types/types.d.ts → storefront-api-types.d.ts} +2016 -1593
- package/dist/esnext/{graphql/types/types.js → storefront-api-types.js} +1025 -732
- package/dist/esnext/streaming.server.d.ts +9 -6
- package/dist/esnext/streaming.server.js +2 -27
- package/dist/esnext/types.d.ts +3 -18
- package/dist/esnext/utilities/apiRoutes.d.ts +19 -3
- package/dist/esnext/utilities/apiRoutes.js +27 -5
- package/dist/esnext/utilities/devtools.d.ts +11 -0
- package/dist/esnext/utilities/devtools.js +11 -0
- package/dist/esnext/utilities/fetch.d.ts +7 -1
- package/dist/esnext/utilities/fetch.js +9 -18
- package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +3 -2
- package/dist/esnext/utilities/flattenConnection/flattenConnection.js +6 -2
- package/dist/esnext/utilities/graphql-tracker.d.ts +17 -0
- package/dist/esnext/utilities/graphql-tracker.js +119 -0
- package/dist/esnext/utilities/image_size.d.ts +5 -4
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +1 -1
- package/dist/esnext/utilities/log/log-query-timeline.js +1 -2
- package/dist/esnext/utilities/log/log.d.ts +1 -0
- package/dist/esnext/utilities/log/utils.js +3 -0
- package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.d.ts +3 -2
- package/dist/esnext/utilities/video_parameters.js +0 -4
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/entry-server.d.ts +2 -1
- package/dist/node/entry-server.js +129 -158
- package/dist/node/foundation/Redirect/Redirect.client.d.ts +5 -0
- package/dist/node/foundation/Redirect/Redirect.client.js +17 -0
- package/dist/node/foundation/Router/BrowserRouter.client.d.ts +13 -0
- package/dist/node/foundation/Router/BrowserRouter.client.js +77 -0
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +24 -25
- package/dist/node/foundation/ServerRequestProvider/index.js +5 -1
- package/dist/node/foundation/ServerStateProvider/{ServerStateProvider.client.d.ts → ServerStateProvider.d.ts} +0 -0
- package/dist/node/foundation/ServerStateProvider/{ServerStateProvider.client.js → ServerStateProvider.js} +5 -1
- package/dist/node/foundation/ServerStateProvider/index.d.ts +2 -2
- package/dist/node/foundation/ServerStateProvider/index.js +3 -3
- package/dist/node/foundation/ssr-interop.d.ts +29 -0
- package/dist/node/foundation/ssr-interop.js +39 -0
- package/dist/node/foundation/useNavigate/useNavigate.d.ts +13 -0
- package/dist/node/foundation/useNavigate/useNavigate.js +18 -0
- package/dist/node/foundation/useServerState/index.d.ts +1 -0
- package/dist/node/foundation/useServerState/index.js +5 -0
- package/dist/node/foundation/useServerState/use-server-state.d.ts +16 -0
- package/dist/node/foundation/useServerState/use-server-state.js +24 -0
- package/dist/node/framework/Hydration/Html.d.ts +2 -0
- package/dist/node/framework/Hydration/Html.js +73 -3
- package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +13 -0
- package/dist/node/framework/Hydration/ServerComponentRequest.server.js +28 -7
- package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +4 -1
- package/dist/node/framework/Hydration/ServerComponentResponse.server.js +8 -0
- package/dist/node/framework/Hydration/rsc.js +1 -1
- package/dist/node/framework/cache/in-memory.d.ts +1 -0
- package/dist/node/framework/cache/in-memory.js +15 -5
- package/dist/node/framework/middleware.js +30 -4
- package/dist/node/framework/plugin.js +11 -2
- package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +31 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +61 -77
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +1 -1
- package/dist/node/{graphql/types/types.d.ts → storefront-api-types.d.ts} +2016 -1593
- package/dist/node/{graphql/types/types.js → storefront-api-types.js} +1026 -733
- package/dist/node/streaming.server.d.ts +9 -6
- package/dist/node/streaming.server.js +3 -29
- package/dist/node/types.d.ts +3 -18
- package/dist/node/utilities/apiRoutes.d.ts +19 -3
- package/dist/node/utilities/apiRoutes.js +29 -7
- package/dist/node/utilities/fetch.d.ts +10 -0
- package/dist/node/utilities/fetch.js +39 -0
- package/dist/node/utilities/log/log-query-timeline.d.ts +1 -1
- package/dist/node/utilities/log/log-query-timeline.js +1 -2
- package/dist/node/utilities/log/log.d.ts +1 -0
- package/dist/node/utilities/log/utils.js +3 -0
- package/dist/node/utilities/web-api-polyfill.js +5 -1
- package/dist/node/version.d.ts +1 -0
- package/dist/node/version.js +4 -0
- package/package.json +21 -21
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +43 -104
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +1566 -848
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +36 -421
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +1523 -864
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +35 -437
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +507 -517
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +10 -246
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +18 -25
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +47 -108
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +1033 -306
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +965 -293
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +98 -108
- package/vendor/react-server-dom-vite/package.json +0 -2
- package/dist/esnext/components/ExternalVideo/ExternalVideoFragment.d.ts +0 -4
- package/dist/esnext/components/Image/ImageFragment.d.ts +0 -4
- package/dist/esnext/components/Image/ImageFragment.js +0 -1
- package/dist/esnext/components/MediaFile/MediaFileFragment.d.ts +0 -22
- package/dist/esnext/components/MediaFile/MediaFileFragment.js +0 -1
- package/dist/esnext/components/Metafield/MetafieldFragment.d.ts +0 -19
- package/dist/esnext/components/Metafield/MetafieldFragment.js +0 -1
- package/dist/esnext/components/ModelViewer/Model3DFragment.d.ts +0 -11
- package/dist/esnext/components/ModelViewer/Model3DFragment.js +0 -1
- package/dist/esnext/components/Money/MoneyFragment.d.ts +0 -4
- package/dist/esnext/components/Money/MoneyFragment.js +0 -1
- package/dist/esnext/components/ProductProvider/ProductProviderFragment.d.ts +0 -80
- package/dist/esnext/components/ProductProvider/ProductProviderFragment.js +0 -1
- package/dist/esnext/components/ProductProvider/types.d.ts +0 -19
- package/dist/esnext/components/ProductProvider/types.js +0 -1
- package/dist/esnext/components/RawHtml/RawHtml.d.ts +0 -19
- package/dist/esnext/components/RawHtml/RawHtml.js +0 -21
- package/dist/esnext/components/RawHtml/index.d.ts +0 -1
- package/dist/esnext/components/RawHtml/index.js +0 -1
- package/dist/esnext/components/Router/index.d.ts +0 -1
- package/dist/esnext/components/Router/index.js +0 -1
- package/dist/esnext/components/Seo/types.d.ts +0 -67
- package/dist/esnext/components/Seo/types.js +0 -1
- package/dist/esnext/components/UnitPrice/UnitPriceFragment.d.ts +0 -12
- package/dist/esnext/components/UnitPrice/UnitPriceFragment.js +0 -1
- package/dist/esnext/components/Video/VideoFragment.d.ts +0 -11
- package/dist/esnext/components/Video/VideoFragment.js +0 -1
- package/dist/esnext/foundation/Boomerang/BoomerangPageTemplate.client.d.ts +0 -3
- package/dist/esnext/foundation/Boomerang/BoomerangPageTemplate.client.js +0 -14
- package/dist/esnext/foundation/Router/DefaultRoutes.d.ts +0 -22
- package/dist/esnext/foundation/Router/index.d.ts +0 -1
- package/dist/esnext/foundation/Router/index.js +0 -1
- package/dist/esnext/graphql/graphql-constants.d.ts +0 -1751
- package/dist/esnext/graphql/graphql-constants.js +0 -3364
- package/dist/esnext/hooks/useAvailableCountries/index.d.ts +0 -1
- package/dist/esnext/hooks/useAvailableCountries/index.js +0 -1
- package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.d.ts +0 -11
- package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.js +0 -17
- package/dist/esnext/hooks/useNavigate/index.d.ts +0 -1
- package/dist/esnext/hooks/useNavigate/index.js +0 -1
- package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.d.ts +0 -28
- package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.js +0 -1
- package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.d.ts +0 -20
- package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.js +0 -1
- package/dist/esnext/hooks/useProductOptions/VariantFragment.d.ts +0 -64
- package/dist/esnext/hooks/useProductOptions/VariantFragment.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export interface ProductPriceProps
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Money } from '../Money';
|
|
3
|
+
import { UnitPrice } from '../UnitPrice';
|
|
4
|
+
export interface ProductPriceProps {
|
|
5
5
|
/** The type of price. Valid values: `regular` (default) or `compareAt`. */
|
|
6
6
|
priceType?: 'regular' | 'compareAt';
|
|
7
7
|
/** The type of value. Valid values: `min` (default), `max` or `unit`. */
|
|
@@ -13,4 +13,4 @@ export interface ProductPriceProps<TTag> extends Omit<MoneyProps<TTag>, 'data'>
|
|
|
13
13
|
* The `ProductPrice` component renders a `Money` component with the product
|
|
14
14
|
* [`priceRange`](/api/storefront/reference/products/productpricerange)'s `maxVariantPrice` or `minVariantPrice`, for either the regular price or compare at price range. It must be a descendent of the `ProductProvider` component.
|
|
15
15
|
*/
|
|
16
|
-
export declare function ProductPrice<TTag extends
|
|
16
|
+
export declare function ProductPrice<TTag extends keyof JSX.IntrinsicElements>(props: (Omit<React.ComponentProps<typeof UnitPrice>, 'data' | 'measurement'> | Omit<React.ComponentProps<typeof Money>, 'data'>) & ProductPriceProps): JSX.Element | null;
|
|
@@ -16,7 +16,7 @@ export function ProductPrice(props) {
|
|
|
16
16
|
let price;
|
|
17
17
|
let measurement;
|
|
18
18
|
const variant = variantId
|
|
19
|
-
? (_a = product === null || product === void 0 ? void 0 : product.variants) === null || _a === void 0 ? void 0 : _a.find((variant) => variant.id === variantId)
|
|
19
|
+
? (_a = product === null || product === void 0 ? void 0 : product.variants) === null || _a === void 0 ? void 0 : _a.find((variant) => (variant === null || variant === void 0 ? void 0 : variant.id) === variantId)
|
|
20
20
|
: null;
|
|
21
21
|
if (priceType === 'compareAt') {
|
|
22
22
|
if (variantId && variant) {
|
|
@@ -47,7 +47,7 @@ export function ProductPrice(props) {
|
|
|
47
47
|
price = (_g = product.priceRange) === null || _g === void 0 ? void 0 : _g.minVariantPrice;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
if (price
|
|
50
|
+
if (!price) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
if (measurement) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { useProductOptions } from '../../hooks';
|
|
3
|
-
import { Product } from '
|
|
3
|
+
import type { Product as ProductType } from '../../storefront-api-types';
|
|
4
|
+
import type { PartialDeep } from 'type-fest';
|
|
4
5
|
export interface ProductProviderProps {
|
|
5
6
|
/** A `ReactNode` element. */
|
|
6
7
|
children: ReactNode;
|
|
7
8
|
/** A [Product object](/api/storefront/reference/products/product). */
|
|
8
|
-
data:
|
|
9
|
-
/** The initially selected variant.
|
|
9
|
+
data: PartialDeep<ProductType>;
|
|
10
|
+
/** The initially selected variant. If this is missing, then `selectedVariantId`
|
|
11
|
+
* in the returned `object` from the `useProduct` hook uses the first available variant
|
|
12
|
+
* or the first variant (if none are available).
|
|
13
|
+
*/
|
|
10
14
|
initialVariantId?: Parameters<typeof useProductOptions>['0']['initialVariantId'];
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
17
|
* The `ProductProvider` component sets up a context with product details. Descendents of
|
|
14
|
-
* this component can use the `useProduct` hook
|
|
18
|
+
* this component can use the `useProduct` hook.
|
|
15
19
|
*/
|
|
16
20
|
export declare function ProductProvider({ children, data: product, initialVariantId, }: ProductProviderProps): JSX.Element;
|
|
17
|
-
export declare namespace ProductProvider {
|
|
18
|
-
var Fragment: string;
|
|
19
|
-
}
|
|
20
|
-
export declare const ProductProviderFragment = "\nfragment ProductProviderFragment on Product {\n compareAtPriceRange {\n maxVariantPrice {\n ...MoneyFragment\n }\n minVariantPrice {\n ...MoneyFragment\n }\n }\n descriptionHtml\n handle\n id\n media(first: $numProductMedia) {\n edges {\n node {\n ...MediaFileFragment\n }\n }\n }\n metafields(first: $numProductMetafields) {\n edges {\n node {\n ...MetafieldFragment\n }\n }\n }\n priceRange {\n maxVariantPrice {\n ...MoneyFragment\n }\n minVariantPrice {\n ...MoneyFragment\n }\n }\n title\n variants(first: $numProductVariants) {\n edges {\n node {\n ...VariantFragment\n }\n }\n }\n sellingPlanGroups(first: $numProductSellingPlanGroups) {\n edges {\n node {\n ...SellingPlanGroupsFragment\n }\n }\n }\n}\n\n\nfragment MediaFileFragment on Media {\n ... on MediaImage {\n mediaContentType\n image {\n ...ImageFragment\n }\n }\n ... on Video {\n mediaContentType\n ...VideoFragment\n }\n ... on ExternalVideo {\n mediaContentType\n ...ExternalVideoFragment\n }\n ... on Model3d {\n mediaContentType\n ...Model3DFragment\n }\n}\n\n\nfragment MetafieldFragment on Metafield {\n id\n type\n namespace\n key\n value\n createdAt\n updatedAt\n description\n reference @include(if: $includeReferenceMetafieldDetails) {\n __typename\n ... on MediaImage {\n id\n mediaContentType\n image {\n ...ImageFragment\n }\n }\n }\n}\n\nfragment VariantFragment on ProductVariant {\n id\n title\n availableForSale\n image {\n ...ImageFragment\n }\n ...UnitPriceFragment\n priceV2 {\n ...MoneyFragment\n }\n compareAtPriceV2 {\n ...MoneyFragment\n }\n selectedOptions {\n name\n value\n }\n metafields(first: $numProductVariantMetafields) {\n edges {\n node {\n ...MetafieldFragment\n }\n }\n }\n sellingPlanAllocations(first: $numProductVariantSellingPlanAllocations) {\n edges {\n node {\n priceAdjustments {\n compareAtPrice {\n ...MoneyFragment\n }\n perDeliveryPrice {\n ...MoneyFragment\n }\n price {\n ...MoneyFragment\n }\n unitPrice {\n ...MoneyFragment\n }\n }\n sellingPlan {\n ...SellingPlanFragment\n }\n }\n }\n }\n}\n\n\nfragment SellingPlanGroupsFragment on SellingPlanGroup {\n sellingPlans(first:$numProductSellingPlans) {\n edges {\n node {\n ...SellingPlanFragment\n }\n }\n }\n appName\n name\n options {\n name\n values\n }\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n\nfragment VideoFragment on Video {\n id\n previewImage {\n url\n }\n sources {\n mimeType\n url\n }\n}\n\nfragment ExternalVideoFragment on ExternalVideo {\n id\n embeddedUrl\n host\n}\n\nfragment Model3DFragment on Model3d {\n id\n alt\n mediaContentType\n previewImage {\n url\n }\n sources {\n url\n }\n}\n\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n\n\nfragment SellingPlanFragment on SellingPlan {\n id\n description\n name\n options {\n name\n value\n }\n priceAdjustments {\n orderCount\n adjustmentValue {\n ...on SellingPlanFixedAmountPriceAdjustment {\n adjustmentAmount {\n ...MoneyFragment\n }\n }\n ...on SellingPlanFixedPriceAdjustment {\n price {\n ...MoneyFragment\n }\n }\n ...on SellingPlanPercentagePriceAdjustment {\n adjustmentPercentage\n }\n }\n }\n recurringDeliveries\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n\n\nfragment UnitPriceFragment on ProductVariant {\n unitPriceMeasurement {\n measuredType\n quantityUnit\n quantityValue\n referenceUnit\n referenceValue\n }\n unitPrice {\n ...MoneyFragment\n }\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\n\nfragment SellingPlanFragment on SellingPlan {\n id\n description\n name\n options {\n name\n value\n }\n priceAdjustments {\n orderCount\n adjustmentValue {\n ...on SellingPlanFixedAmountPriceAdjustment {\n adjustmentAmount {\n ...MoneyFragment\n }\n }\n ...on SellingPlanFixedPriceAdjustment {\n price {\n ...MoneyFragment\n }\n }\n ...on SellingPlanPercentagePriceAdjustment {\n adjustmentPercentage\n }\n }\n }\n recurringDeliveries\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}";
|
|
@@ -2,14 +2,14 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import { useParsedMetafields } from '../../hooks';
|
|
3
3
|
import { flattenConnection } from '../../utilities';
|
|
4
4
|
import { ProductContext } from './context';
|
|
5
|
-
import { ProductProviderFragment as Fragment } from '../../graphql/graphql-constants';
|
|
6
5
|
import { ProductOptionsProvider } from './ProductOptionsProvider.client';
|
|
7
6
|
/**
|
|
8
7
|
* The `ProductProvider` component sets up a context with product details. Descendents of
|
|
9
|
-
* this component can use the `useProduct` hook
|
|
8
|
+
* this component can use the `useProduct` hook.
|
|
10
9
|
*/
|
|
11
10
|
export function ProductProvider({ children, data: product, initialVariantId, }) {
|
|
12
11
|
const metafields = useParsedMetafields(product.metafields);
|
|
12
|
+
// @ts-expect-error The types here are broken on main, need to come back and fix them sometime
|
|
13
13
|
const providerValue = useMemo(() => {
|
|
14
14
|
return {
|
|
15
15
|
...product,
|
|
@@ -32,5 +32,3 @@ export function ProductProvider({ children, data: product, initialVariantId, })
|
|
|
32
32
|
return (React.createElement(ProductContext.Provider, { value: providerValue },
|
|
33
33
|
React.createElement(ProductOptionsProvider, { initialVariantId: initialVariantId }, children)));
|
|
34
34
|
}
|
|
35
|
-
ProductProvider.Fragment = Fragment;
|
|
36
|
-
export const ProductProviderFragment = Fragment;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { ProductOptionsHookValue } from '../../hooks';
|
|
2
2
|
import { ParsedMetafield } from '../../types';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import type { Collection, Image, Product as ProductType, ProductVariant as ProductVariantType, MediaEdge as MediaEdgeType } from '../../storefront-api-types';
|
|
4
|
+
import type { PartialDeep } from 'type-fest';
|
|
5
|
+
export declare const ProductContext: import("react").Context<import("type-fest/source/partial-deep").PartialObjectDeep<Omit<ProductType, "media" | "options" | "metafields" | "variants" | "sellingPlanGroups" | "collections" | "images"> & {
|
|
6
|
+
media?: import("../../storefront-api-types").ExternalVideo | import("../../storefront-api-types").MediaImage | import("../../storefront-api-types").Model3d | import("../../storefront-api-types").Video | undefined;
|
|
7
|
+
mediaConnection?: import("../../storefront-api-types").MediaConnection | undefined;
|
|
8
|
+
metafields?: ParsedMetafield[] | undefined;
|
|
9
|
+
metafieldsConnection?: import("../../storefront-api-types").MetafieldConnection | undefined;
|
|
10
|
+
images?: Partial<Image>[] | undefined;
|
|
11
|
+
imagesConnection?: import("../../storefront-api-types").ImageConnection | undefined;
|
|
12
|
+
collections?: Partial<Collection>[] | undefined;
|
|
13
|
+
collectionsConnection?: import("../../storefront-api-types").CollectionConnection | undefined;
|
|
14
|
+
variants?: Partial<ProductVariantType>[] | undefined;
|
|
15
|
+
variantsConnection?: import("../../storefront-api-types").ProductVariantConnection | undefined;
|
|
16
|
+
}> | null>;
|
|
17
|
+
export declare type ProductContextType = PartialDeep<Omit<ProductType, 'media' | 'metafields' | 'images' | 'collections' | 'variants' | 'sellingPlanGroups' | 'options'> & {
|
|
18
|
+
media?: MediaEdgeType['node'];
|
|
19
|
+
mediaConnection?: ProductType['media'];
|
|
11
20
|
metafields?: ParsedMetafield[];
|
|
12
|
-
metafieldsConnection?:
|
|
21
|
+
metafieldsConnection?: ProductType['metafields'];
|
|
13
22
|
images?: Partial<Image>[];
|
|
14
|
-
imagesConnection?:
|
|
23
|
+
imagesConnection?: ProductType['images'];
|
|
15
24
|
collections?: Partial<Collection>[];
|
|
16
|
-
collectionsConnection?:
|
|
17
|
-
variants?: Partial<
|
|
18
|
-
variantsConnection?:
|
|
19
|
-
}
|
|
25
|
+
collectionsConnection?: ProductType['collections'];
|
|
26
|
+
variants?: Partial<ProductVariantType>[];
|
|
27
|
+
variantsConnection?: ProductType['variants'];
|
|
28
|
+
}>;
|
|
20
29
|
export declare const ProductOptionsContext: import("react").Context<ProductOptionsHookValue | null>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ProductProvider
|
|
1
|
+
export { ProductProvider } from './ProductProvider.client';
|
|
2
2
|
export { useProduct } from '../../hooks/useProduct/useProduct';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ProductProvider
|
|
1
|
+
export { ProductProvider } from './ProductProvider.client';
|
|
2
2
|
export { useProduct } from '../../hooks/useProduct/useProduct';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { Collection } from '
|
|
2
|
-
|
|
1
|
+
import type { Collection as CollectionType } from '../../storefront-api-types';
|
|
2
|
+
import type { PartialDeep } from 'type-fest';
|
|
3
|
+
export declare function CollectionSeo({ title, description, seo, image, }: PartialDeep<CollectionType>): JSX.Element;
|
|
@@ -3,10 +3,10 @@ import { TitleSeo } from './TitleSeo.client';
|
|
|
3
3
|
import { DescriptionSeo } from './DescriptionSeo.client';
|
|
4
4
|
import { TwitterSeo } from './TwitterSeo.client';
|
|
5
5
|
import { ImageSeo } from './ImageSeo.client';
|
|
6
|
-
export function CollectionSeo({ title, description, seo, image }) {
|
|
6
|
+
export function CollectionSeo({ title, description, seo, image, }) {
|
|
7
7
|
var _a, _b;
|
|
8
|
-
const seoTitle = (_a = seo.title) !== null && _a !== void 0 ? _a : title;
|
|
9
|
-
const seoDescription = (_b = seo.description) !== null && _b !== void 0 ? _b : description;
|
|
8
|
+
const seoTitle = (_a = seo === null || seo === void 0 ? void 0 : seo.title) !== null && _a !== void 0 ? _a : title;
|
|
9
|
+
const seoDescription = (_b = seo === null || seo === void 0 ? void 0 : seo.description) !== null && _b !== void 0 ? _b : description;
|
|
10
10
|
return (React.createElement(React.Fragment, null,
|
|
11
11
|
React.createElement(TitleSeo, { title: seoTitle }),
|
|
12
12
|
React.createElement(DescriptionSeo, { description: seoDescription }),
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type { DefaultPage } from './types';
|
|
2
|
-
|
|
1
|
+
import type { DefaultPage } from './seo-types';
|
|
2
|
+
import type { PartialDeep } from 'type-fest';
|
|
3
|
+
export declare function DefaultPageSeo({ title, description, url, titleTemplate, lang, }: PartialDeep<DefaultPage>): JSX.Element;
|
|
@@ -8,10 +8,10 @@ export function DefaultPageSeo({ title, description, url, titleTemplate, lang, }
|
|
|
8
8
|
const { locale } = useShop();
|
|
9
9
|
const fallBacklang = locale.split(/[-_]/)[0];
|
|
10
10
|
return (React.createElement(React.Fragment, null,
|
|
11
|
-
React.createElement(Head, { defaultTitle: title, titleTemplate: titleTemplate !== null && titleTemplate !== void 0 ? titleTemplate : `%s - ${title}` },
|
|
11
|
+
React.createElement(Head, { defaultTitle: title !== null && title !== void 0 ? title : '', titleTemplate: titleTemplate !== null && titleTemplate !== void 0 ? titleTemplate : `%s - ${title}` },
|
|
12
12
|
React.createElement("html", { lang: lang !== null && lang !== void 0 ? lang : fallBacklang }),
|
|
13
13
|
React.createElement("meta", { property: "og:type", content: "website" }),
|
|
14
|
-
React.createElement("meta", { property: "og:site_name", content: title }),
|
|
14
|
+
React.createElement("meta", { property: "og:site_name", content: title !== null && title !== void 0 ? title : '' }),
|
|
15
15
|
React.createElement("meta", { property: "og:url", content: url })),
|
|
16
16
|
React.createElement(TitleSeo, { title: title }),
|
|
17
17
|
React.createElement(DescriptionSeo, { description: description }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function DescriptionSeo({ description }: {
|
|
3
|
-
description?:
|
|
1
|
+
import type { Seo as SeoType } from '../../storefront-api-types';
|
|
2
|
+
export declare function DescriptionSeo({ description, }: {
|
|
3
|
+
description?: SeoType['description'];
|
|
4
4
|
}): JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { HomePage } from './types';
|
|
1
|
+
import type { HomePage } from './seo-types';
|
|
2
2
|
export declare function HomePageSeo({ title, description, url }: HomePage): JSX.Element;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type { Image } from '
|
|
2
|
-
|
|
1
|
+
import type { Image } from '../../storefront-api-types';
|
|
2
|
+
import type { PartialDeep } from 'type-fest';
|
|
3
|
+
export declare function ImageSeo({ url, width, height, altText }: PartialDeep<Image>): JSX.Element;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { Page } from '
|
|
2
|
-
|
|
1
|
+
import type { Page as PageType } from '../../storefront-api-types';
|
|
2
|
+
import type { PartialDeep } from 'type-fest';
|
|
3
|
+
export declare function PageSeo({ title, seo }: PartialDeep<PageType>): JSX.Element;
|
|
@@ -4,8 +4,8 @@ import { DescriptionSeo } from './DescriptionSeo.client';
|
|
|
4
4
|
import { TwitterSeo } from './TwitterSeo.client';
|
|
5
5
|
export function PageSeo({ title, seo }) {
|
|
6
6
|
var _a;
|
|
7
|
-
const seoTitle = (_a = seo.title) !== null && _a !== void 0 ? _a : title;
|
|
8
|
-
const seoDescription = seo.description;
|
|
7
|
+
const seoTitle = (_a = seo === null || seo === void 0 ? void 0 : seo.title) !== null && _a !== void 0 ? _a : title;
|
|
8
|
+
const seoDescription = seo === null || seo === void 0 ? void 0 : seo.description;
|
|
9
9
|
return (React.createElement(React.Fragment, null,
|
|
10
10
|
React.createElement(TitleSeo, { title: seoTitle }),
|
|
11
11
|
React.createElement(DescriptionSeo, { description: seoDescription }),
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { Product } from '
|
|
2
|
-
|
|
1
|
+
import type { Scalars, Product as ProductType } from '../../storefront-api-types';
|
|
2
|
+
import type { PartialDeep } from 'type-fest';
|
|
3
|
+
export declare function ProductSeo({ url, title, description, seo, vendor, featuredImage, variants, }: PartialDeep<ProductType> & {
|
|
4
|
+
url: Scalars['URL'];
|
|
5
|
+
}): JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { DescriptionSeo } from './DescriptionSeo.client';
|
|
|
5
5
|
import { TwitterSeo } from './TwitterSeo.client';
|
|
6
6
|
import { ImageSeo } from './ImageSeo.client';
|
|
7
7
|
export function ProductSeo({ url, title, description, seo, vendor, featuredImage, variants, }) {
|
|
8
|
-
var _a, _b;
|
|
8
|
+
var _a, _b, _c;
|
|
9
9
|
const seoTitle = (_a = seo === null || seo === void 0 ? void 0 : seo.title) !== null && _a !== void 0 ? _a : title;
|
|
10
10
|
const seoDescription = (_b = seo === null || seo === void 0 ? void 0 : seo.description) !== null && _b !== void 0 ? _b : description;
|
|
11
11
|
let firstVariantPrice;
|
|
@@ -23,13 +23,18 @@ export function ProductSeo({ url, title, description, seo, vendor, featuredImage
|
|
|
23
23
|
if (featuredImage) {
|
|
24
24
|
productSchema.image = featuredImage.url;
|
|
25
25
|
}
|
|
26
|
-
if (variants.edges.length > 0) {
|
|
27
|
-
const firstVariant = variants.edges[0].node;
|
|
28
|
-
firstVariantPrice = firstVariant.priceV2;
|
|
26
|
+
if ((variants === null || variants === void 0 ? void 0 : variants.edges) && variants.edges.length > 0) {
|
|
27
|
+
const firstVariant = (_c = variants.edges[0]) === null || _c === void 0 ? void 0 : _c.node;
|
|
28
|
+
firstVariantPrice = firstVariant === null || firstVariant === void 0 ? void 0 : firstVariant.priceV2;
|
|
29
29
|
if (firstVariant && firstVariant.sku) {
|
|
30
30
|
productSchema.sku = firstVariant.sku;
|
|
31
31
|
}
|
|
32
|
-
productSchema.offers = variants.edges.map((
|
|
32
|
+
productSchema.offers = variants.edges.map((edge) => {
|
|
33
|
+
var _a;
|
|
34
|
+
const node = edge === null || edge === void 0 ? void 0 : edge.node;
|
|
35
|
+
if (!node || !((_a = node.priceV2) === null || _a === void 0 ? void 0 : _a.amount) || !node.priceV2.currencyCode) {
|
|
36
|
+
throw new Error(`<ProductSeo/> requires variant.PriceV2 'amount' and 'currency`);
|
|
37
|
+
}
|
|
33
38
|
const offerSchema = {
|
|
34
39
|
'@type': 'Offer',
|
|
35
40
|
availability: `https://schema.org/${node.availableForSale ? 'InStock' : 'OutOfStock'}`,
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import { ProductSeo } from './ProductSeo.client';
|
|
3
|
+
import { CollectionSeo } from './CollectionSeo.client';
|
|
4
|
+
import { PageSeo } from './PageSeo.client';
|
|
5
|
+
import type { DefaultPage as DefaultPageType, HomePage as HomePageType } from './seo-types';
|
|
2
6
|
declare type Props = {
|
|
3
7
|
type: 'defaultSeo';
|
|
4
|
-
data:
|
|
8
|
+
data: Omit<DefaultPageType, 'url'>;
|
|
5
9
|
} | {
|
|
6
10
|
type: 'homepage';
|
|
7
|
-
data:
|
|
11
|
+
data: Omit<HomePageType, 'url'>;
|
|
8
12
|
} | {
|
|
9
13
|
type: 'product';
|
|
10
|
-
data:
|
|
14
|
+
data: Omit<ComponentProps<typeof ProductSeo>, 'url'>;
|
|
11
15
|
} | {
|
|
12
16
|
type: 'collection';
|
|
13
|
-
data:
|
|
17
|
+
data: ComponentProps<typeof CollectionSeo>;
|
|
14
18
|
} | {
|
|
15
19
|
type: 'page';
|
|
16
|
-
data:
|
|
20
|
+
data: ComponentProps<typeof PageSeo>;
|
|
17
21
|
};
|
|
18
22
|
/**
|
|
19
23
|
* The `Seo` component renders SEO information on a webpage.
|
|
20
24
|
*/
|
|
21
|
-
export declare function Seo(
|
|
25
|
+
export declare function Seo(props: Props): JSX.Element | null;
|
|
22
26
|
export {};
|
|
@@ -8,27 +8,21 @@ import { PageSeo } from './PageSeo.client';
|
|
|
8
8
|
/**
|
|
9
9
|
* The `Seo` component renders SEO information on a webpage.
|
|
10
10
|
*/
|
|
11
|
-
export function Seo(
|
|
11
|
+
export function Seo(props) {
|
|
12
12
|
const url = useUrl().href;
|
|
13
|
-
|
|
14
|
-
switch (type) {
|
|
13
|
+
switch (props.type) {
|
|
15
14
|
case 'defaultSeo':
|
|
16
|
-
|
|
17
|
-
break;
|
|
15
|
+
return React.createElement(DefaultPageSeo, { ...{ url, ...props.data } });
|
|
18
16
|
case 'homepage':
|
|
19
|
-
|
|
20
|
-
break;
|
|
17
|
+
return React.createElement(HomePageSeo, { ...{ url, ...props.data } });
|
|
21
18
|
case 'product':
|
|
22
|
-
|
|
23
|
-
break;
|
|
19
|
+
return React.createElement(ProductSeo, { ...{ url, ...props.data } });
|
|
24
20
|
case 'collection':
|
|
25
|
-
|
|
26
|
-
break;
|
|
21
|
+
return React.createElement(CollectionSeo, { ...props.data });
|
|
27
22
|
case 'page':
|
|
28
|
-
|
|
29
|
-
break;
|
|
23
|
+
return React.createElement(PageSeo, { ...props.data });
|
|
30
24
|
default:
|
|
31
25
|
console.warn('The <Seo/> only accepts type prop with values of defaultSeo, homepage, product, collection, or page.');
|
|
26
|
+
return null;
|
|
32
27
|
}
|
|
33
|
-
return SeoMarkup;
|
|
34
28
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}): JSX.Element | null;
|
|
1
|
+
import type { Seo as SeoType } from '../../storefront-api-types';
|
|
2
|
+
import type { PartialDeep } from 'type-fest';
|
|
3
|
+
export declare function TitleSeo({ title }: PartialDeep<SeoType>): JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Twitter } from './types';
|
|
1
|
+
import type { Twitter } from './seo-types';
|
|
2
2
|
export declare function TwitterSeo({ site, title, description }: Partial<Twitter>): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Scalars, Shop as ShopType, Seo as SeoType } from '../../storefront-api-types';
|
|
2
|
+
export interface Twitter {
|
|
3
|
+
site: string;
|
|
4
|
+
title: SeoType['title'];
|
|
5
|
+
description: SeoType['description'];
|
|
6
|
+
}
|
|
7
|
+
export interface HomePage {
|
|
8
|
+
description: ShopType['description'];
|
|
9
|
+
title: ShopType['name'];
|
|
10
|
+
url: Scalars['URL'];
|
|
11
|
+
}
|
|
12
|
+
export interface DefaultPage extends ShopType {
|
|
13
|
+
title: ShopType['name'];
|
|
14
|
+
url: Scalars['URL'];
|
|
15
|
+
titleTemplate?: string;
|
|
16
|
+
lang?: string;
|
|
17
|
+
}
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
declare type ShopPayButtonProps = {
|
|
2
2
|
/** A string of classes to apply to the `div` that wraps the Shop Pay button. */
|
|
3
3
|
className?: string;
|
|
4
4
|
} & ({
|
|
@@ -35,3 +35,4 @@ export declare function ShopPayButton({ variantIds, className, variantIdsAndQuan
|
|
|
35
35
|
export declare function getIdFromGid(id?: string): string | undefined;
|
|
36
36
|
export declare const MissingPropsErrorMessage = "You must pass in either \"variantIds\" or \"variantIdsAndQuantities\" to ShopPayButton";
|
|
37
37
|
export declare const DoublePropsErrorMessage = "You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component";
|
|
38
|
+
export {};
|
|
@@ -42,15 +42,7 @@ export function ShopPayButton({ variantIds, className, variantIdsAndQuantities,
|
|
|
42
42
|
export function getIdFromGid(id) {
|
|
43
43
|
if (!id)
|
|
44
44
|
return;
|
|
45
|
-
|
|
46
|
-
// atob() / Buffer required for SFAPI 2022-01. Remove atob() when upgrading to 2022-04
|
|
47
|
-
if (typeof (window === null || window === void 0 ? void 0 : window.atob) !== 'undefined') {
|
|
48
|
-
gid = window.atob(id);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
gid = Buffer.from(id, 'base64').toString('ascii');
|
|
52
|
-
}
|
|
53
|
-
return gid.split('/').pop();
|
|
45
|
+
return id.split('/').pop();
|
|
54
46
|
}
|
|
55
47
|
export const MissingPropsErrorMessage = `You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton`;
|
|
56
48
|
export const DoublePropsErrorMessage = `You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ShopPayButton
|
|
1
|
+
export { ShopPayButton } from './ShopPayButton.client';
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { UnitPriceMeasurement, MoneyV2 } from '../../graphql/types/types';
|
|
1
|
+
import type { UnitPriceMeasurement, MoneyV2 } from '../../storefront-api-types';
|
|
2
|
+
import type { PartialDeep } from 'type-fest';
|
|
4
3
|
export interface UnitPriceProps<TTag> {
|
|
5
|
-
/**
|
|
6
|
-
data: MoneyV2
|
|
7
|
-
/** A [
|
|
8
|
-
measurement: UnitPriceMeasurement
|
|
4
|
+
/** An object with fields that correspond to the Storefront API's [MoneyV2 object](/api/storefront/reference/common-objects/moneyv2). */
|
|
5
|
+
data: PartialDeep<MoneyV2>;
|
|
6
|
+
/** A [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement). */
|
|
7
|
+
measurement: PartialDeep<UnitPriceMeasurement>;
|
|
9
8
|
/** An HTML tag to be rendered as the base element wrapper. The default is `div`. */
|
|
10
9
|
as?: TTag;
|
|
11
10
|
}
|
|
12
11
|
/**
|
|
13
12
|
* The `UnitPrice` component renders a string with a [UnitPrice](/themes/pricing-payments/unit-pricing) as the
|
|
14
|
-
*
|
|
13
|
+
* Storefront API's [MoneyV2 object](/api/storefront/reference/common-objects/moneyv2) with a reference unit from the Storefront API's [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement).
|
|
15
14
|
*/
|
|
16
|
-
export declare function UnitPrice<TTag extends
|
|
17
|
-
export declare namespace UnitPrice {
|
|
18
|
-
var Fragment: string;
|
|
19
|
-
}
|
|
20
|
-
export declare const UnitPriceFragment = "\nfragment UnitPriceFragment on ProductVariant {\n unitPriceMeasurement {\n measuredType\n quantityUnit\n quantityValue\n referenceUnit\n referenceValue\n }\n unitPrice {\n ...MoneyFragment\n }\n}\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}";
|
|
15
|
+
export declare function UnitPrice<TTag extends keyof JSX.IntrinsicElements = 'div'>(props: JSX.IntrinsicElements[TTag] & UnitPriceProps<TTag>): JSX.Element | null;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Money } from '../Money';
|
|
3
|
-
import { UnitPriceFragment as Fragment } from '../../graphql/graphql-constants';
|
|
4
3
|
/**
|
|
5
4
|
* The `UnitPrice` component renders a string with a [UnitPrice](/themes/pricing-payments/unit-pricing) as the
|
|
6
|
-
*
|
|
5
|
+
* Storefront API's [MoneyV2 object](/api/storefront/reference/common-objects/moneyv2) with a reference unit from the Storefront API's [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement).
|
|
7
6
|
*/
|
|
8
7
|
export function UnitPrice(props) {
|
|
9
8
|
const { data, measurement, as, ...passthroughProps } = props;
|
|
9
|
+
if (!data) {
|
|
10
|
+
console.warn(`No "data" prop was passed to <UnitPrice/>`);
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
if (!measurement) {
|
|
14
|
+
console.warn(`No "measurement" prop was passed to <UnitPrice/>`);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
10
17
|
const Wrapper = as !== null && as !== void 0 ? as : 'div';
|
|
11
18
|
return (React.createElement(Wrapper, { ...passthroughProps },
|
|
12
19
|
React.createElement(Money, { data: data }),
|
|
13
20
|
"/",
|
|
14
21
|
measurement.referenceUnit));
|
|
15
22
|
}
|
|
16
|
-
UnitPrice.Fragment = Fragment;
|
|
17
|
-
export const UnitPriceFragment = Fragment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { UnitPrice
|
|
1
|
+
export { UnitPrice } from './UnitPrice.client';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { UnitPrice
|
|
1
|
+
export { UnitPrice } from './UnitPrice.client';
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Props } from '../types';
|
|
3
1
|
import { ImageSizeOptions } from '../../utilities';
|
|
4
|
-
import { Video as VideoType
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
previewImage?: Pick<Image, 'url'>;
|
|
10
|
-
sources: Pick<VideoSource, 'url' | 'mimeType'>[];
|
|
11
|
-
};
|
|
2
|
+
import type { Video as VideoType } from '../../storefront-api-types';
|
|
3
|
+
import type { PartialDeep } from 'type-fest';
|
|
4
|
+
interface VideoProps {
|
|
5
|
+
/** An object with fields that correspond to the Storefront API's [Video object](/api/storefront/latest/objects/video). */
|
|
6
|
+
data: PartialDeep<VideoType>;
|
|
12
7
|
/** An object of image size options for the video's `previewImage`. */
|
|
13
8
|
options?: ImageSizeOptions;
|
|
14
9
|
}
|
|
15
10
|
/**
|
|
16
|
-
* The `Video` component renders a `video` for the Storefront API's [
|
|
11
|
+
* The `Video` component renders a `video` for the Storefront API's [Video object](/api/storefront/reference/products/video).
|
|
17
12
|
*/
|
|
18
|
-
export declare function Video
|
|
19
|
-
export
|
|
20
|
-
var Fragment: string;
|
|
21
|
-
}
|
|
22
|
-
export declare const VideoFragment = "fragment VideoFragment on Video {\n id\n previewImage {\n url\n }\n sources {\n mimeType\n url\n }\n}\n\n";
|
|
13
|
+
export declare function Video(props: JSX.IntrinsicElements['video'] & VideoProps): JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useImageUrl } from '../../utilities';
|
|
3
|
-
import { VideoFragment as Fragment } from '../../graphql/graphql-constants';
|
|
4
3
|
/**
|
|
5
|
-
* The `Video` component renders a `video` for the Storefront API's [
|
|
4
|
+
* The `Video` component renders a `video` for the Storefront API's [Video object](/api/storefront/reference/products/video).
|
|
6
5
|
*/
|
|
7
6
|
export function Video(props) {
|
|
8
7
|
var _a;
|
|
9
8
|
const { data, options, id = data.id, playsInline = true, controls = true, ...passthroughProps } = props;
|
|
10
9
|
const posterUrl = useImageUrl((_a = data.previewImage) === null || _a === void 0 ? void 0 : _a.url, options);
|
|
11
|
-
|
|
10
|
+
if (!data.sources) {
|
|
11
|
+
throw new Error(`<Video/> requires a 'data.sources' array`);
|
|
12
|
+
}
|
|
13
|
+
return (React.createElement("video", { ...passthroughProps, id: id, playsInline: playsInline, controls: controls, poster: posterUrl }, data.sources.map((source) => {
|
|
14
|
+
if (!((source === null || source === void 0 ? void 0 : source.url) && (source === null || source === void 0 ? void 0 : source.mimeType))) {
|
|
15
|
+
throw new Error(`<Video/> needs 'source.url' and 'source.mimeType'`);
|
|
16
|
+
}
|
|
17
|
+
return (React.createElement("source", { key: source.url, src: source.url, type: source.mimeType }));
|
|
18
|
+
})));
|
|
12
19
|
}
|
|
13
|
-
Video.Fragment = Fragment;
|
|
14
|
-
export const VideoFragment = Fragment;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { Video, VideoFragment } from './Video';
|
|
1
|
+
export { Video } from './Video';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Video
|
|
1
|
+
export { Video } from './Video';
|