@shopify/hydrogen 0.0.0-unstable-20220314172608
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 +869 -0
- package/README.md +29 -0
- package/client.d.ts +1 -0
- package/client.js +1 -0
- package/dist/esnext/client.d.ts +9 -0
- package/dist/esnext/client.js +9 -0
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +23 -0
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +47 -0
- package/dist/esnext/components/AddToCartButton/index.d.ts +1 -0
- package/dist/esnext/components/AddToCartButton/index.js +1 -0
- package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +18 -0
- package/dist/esnext/components/BuyNowButton/BuyNowButton.client.js +26 -0
- package/dist/esnext/components/BuyNowButton/index.d.ts +1 -0
- package/dist/esnext/components/BuyNowButton/index.js +1 -0
- package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +11 -0
- package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.js +17 -0
- package/dist/esnext/components/CartCheckoutButton/index.d.ts +1 -0
- package/dist/esnext/components/CartCheckoutButton/index.js +1 -0
- package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +14 -0
- package/dist/esnext/components/CartEstimatedCost/CartEstimatedCost.client.js +29 -0
- package/dist/esnext/components/CartEstimatedCost/index.d.ts +1 -0
- package/dist/esnext/components/CartEstimatedCost/index.js +1 -0
- package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +12 -0
- package/dist/esnext/components/CartLineImage/CartLineImage.client.js +12 -0
- package/dist/esnext/components/CartLineImage/index.d.ts +1 -0
- package/dist/esnext/components/CartLineImage/index.js +1 -0
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +12 -0
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +21 -0
- package/dist/esnext/components/CartLinePrice/index.d.ts +1 -0
- package/dist/esnext/components/CartLinePrice/index.js +1 -0
- package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +8 -0
- package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.js +12 -0
- package/dist/esnext/components/CartLineProductTitle/index.d.ts +1 -0
- package/dist/esnext/components/CartLineProductTitle/index.js +1 -0
- package/dist/esnext/components/CartLineProvider/CartLineProvider.client.d.ts +11 -0
- package/dist/esnext/components/CartLineProvider/CartLineProvider.client.js +8 -0
- package/dist/esnext/components/CartLineProvider/context.d.ts +26 -0
- package/dist/esnext/components/CartLineProvider/context.js +2 -0
- package/dist/esnext/components/CartLineProvider/index.d.ts +2 -0
- package/dist/esnext/components/CartLineProvider/index.js +2 -0
- package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.d.ts +8 -0
- package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.js +12 -0
- package/dist/esnext/components/CartLineQuantity/index.d.ts +1 -0
- package/dist/esnext/components/CartLineQuantity/index.js +1 -0
- package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +14 -0
- package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +24 -0
- package/dist/esnext/components/CartLineQuantityAdjustButton/index.d.ts +1 -0
- package/dist/esnext/components/CartLineQuantityAdjustButton/index.js +1 -0
- package/dist/esnext/components/CartLines/CartLines.d.ts +15 -0
- package/dist/esnext/components/CartLines/CartLines.js +17 -0
- package/dist/esnext/components/CartLines/index.d.ts +1 -0
- package/dist/esnext/components/CartLines/index.js +1 -0
- package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +36 -0
- package/dist/esnext/components/CartProvider/CartProvider.client.js +486 -0
- package/dist/esnext/components/CartProvider/constants.d.ts +2 -0
- package/dist/esnext/components/CartProvider/constants.js +2 -0
- package/dist/esnext/components/CartProvider/context.d.ts +2 -0
- package/dist/esnext/components/CartProvider/context.js +2 -0
- package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +85 -0
- package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +72 -0
- package/dist/esnext/components/CartProvider/graphql/CartFragment.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +86 -0
- package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.js +1 -0
- package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +81 -0
- package/dist/esnext/components/CartProvider/graphql/CartQuery.js +1 -0
- package/dist/esnext/components/CartProvider/hooks.d.ts +15 -0
- package/dist/esnext/components/CartProvider/hooks.js +57 -0
- package/dist/esnext/components/CartProvider/index.d.ts +4 -0
- package/dist/esnext/components/CartProvider/index.js +3 -0
- package/dist/esnext/components/CartProvider/types.d.ts +100 -0
- package/dist/esnext/components/CartProvider/types.js +1 -0
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +9 -0
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.js +19 -0
- package/dist/esnext/components/CartShopPayButton/index.d.ts +1 -0
- package/dist/esnext/components/CartShopPayButton/index.js +1 -0
- package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +20 -0
- package/dist/esnext/components/ExternalVideo/ExternalVideo.js +11 -0
- package/dist/esnext/components/ExternalVideo/ExternalVideoFragment.d.ts +8 -0
- package/dist/esnext/components/ExternalVideo/ExternalVideoFragment.js +1 -0
- package/dist/esnext/components/ExternalVideo/index.d.ts +1 -0
- package/dist/esnext/components/ExternalVideo/index.js +1 -0
- package/dist/esnext/components/Image/Image.d.ts +38 -0
- package/dist/esnext/components/Image/Image.js +51 -0
- package/dist/esnext/components/Image/ImageFragment.d.ts +8 -0
- package/dist/esnext/components/Image/ImageFragment.js +1 -0
- package/dist/esnext/components/Image/index.d.ts +1 -0
- package/dist/esnext/components/Image/index.js +1 -0
- package/dist/esnext/components/Link/Link.client.d.ts +18 -0
- package/dist/esnext/components/Link/Link.client.js +43 -0
- package/dist/esnext/components/Link/index.d.ts +1 -0
- package/dist/esnext/components/Link/index.js +1 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +6 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +20 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +8 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.js +2 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +21 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +22 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationQuery.d.ts +30 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationQuery.js +1 -0
- package/dist/esnext/components/LocalizationProvider/index.d.ts +3 -0
- package/dist/esnext/components/LocalizationProvider/index.js +3 -0
- package/dist/esnext/components/MediaFile/MediaFile.d.ts +18 -0
- package/dist/esnext/components/MediaFile/MediaFile.js +31 -0
- package/dist/esnext/components/MediaFile/MediaFileFragment.d.ts +36 -0
- package/dist/esnext/components/MediaFile/MediaFileFragment.js +1 -0
- package/dist/esnext/components/MediaFile/index.d.ts +1 -0
- package/dist/esnext/components/MediaFile/index.js +1 -0
- package/dist/esnext/components/Metafield/Metafield.client.d.ts +17 -0
- package/dist/esnext/components/Metafield/Metafield.client.js +65 -0
- package/dist/esnext/components/Metafield/MetafieldFragment.d.ts +22 -0
- package/dist/esnext/components/Metafield/MetafieldFragment.js +1 -0
- package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +12 -0
- package/dist/esnext/components/Metafield/components/StarRating/StarRating.js +48 -0
- package/dist/esnext/components/Metafield/components/StarRating/index.d.ts +1 -0
- package/dist/esnext/components/Metafield/components/StarRating/index.js +1 -0
- package/dist/esnext/components/Metafield/components/index.d.ts +1 -0
- package/dist/esnext/components/Metafield/components/index.js +1 -0
- package/dist/esnext/components/Metafield/index.d.ts +2 -0
- package/dist/esnext/components/Metafield/index.js +1 -0
- package/dist/esnext/components/Metafield/types.d.ts +4 -0
- package/dist/esnext/components/Metafield/types.js +1 -0
- package/dist/esnext/components/ModelViewer/Model3DFragment.d.ts +15 -0
- package/dist/esnext/components/ModelViewer/Model3DFragment.js +1 -0
- package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +127 -0
- package/dist/esnext/components/ModelViewer/ModelViewer.client.js +99 -0
- package/dist/esnext/components/ModelViewer/index.d.ts +1 -0
- package/dist/esnext/components/ModelViewer/index.js +1 -0
- package/dist/esnext/components/Money/Money.client.d.ts +14 -0
- package/dist/esnext/components/Money/Money.client.js +13 -0
- package/dist/esnext/components/Money/MoneyFragment.d.ts +8 -0
- package/dist/esnext/components/Money/MoneyFragment.js +1 -0
- package/dist/esnext/components/Money/index.d.ts +1 -0
- package/dist/esnext/components/Money/index.js +1 -0
- package/dist/esnext/components/ProductDescription/ProductDescription.client.d.ts +13 -0
- package/dist/esnext/components/ProductDescription/ProductDescription.client.js +16 -0
- package/dist/esnext/components/ProductDescription/index.d.ts +1 -0
- package/dist/esnext/components/ProductDescription/index.js +1 -0
- package/dist/esnext/components/ProductMetafield/ProductMetafield.client.d.ts +21 -0
- package/dist/esnext/components/ProductMetafield/ProductMetafield.client.js +42 -0
- package/dist/esnext/components/ProductMetafield/index.d.ts +2 -0
- package/dist/esnext/components/ProductMetafield/index.js +1 -0
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +16 -0
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +57 -0
- package/dist/esnext/components/ProductPrice/index.d.ts +1 -0
- package/dist/esnext/components/ProductPrice/index.js +1 -0
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.d.ts +8 -0
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.js +12 -0
- package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +19 -0
- package/dist/esnext/components/ProductProvider/ProductProvider.client.js +33 -0
- package/dist/esnext/components/ProductProvider/ProductProviderFragment.d.ts +247 -0
- package/dist/esnext/components/ProductProvider/ProductProviderFragment.js +1 -0
- package/dist/esnext/components/ProductProvider/context.d.ts +20 -0
- package/dist/esnext/components/ProductProvider/context.js +3 -0
- package/dist/esnext/components/ProductProvider/index.d.ts +2 -0
- package/dist/esnext/components/ProductProvider/index.js +2 -0
- package/dist/esnext/components/ProductProvider/types.d.ts +19 -0
- package/dist/esnext/components/ProductProvider/types.js +1 -0
- package/dist/esnext/components/ProductTitle/ProductTitle.client.d.ts +13 -0
- package/dist/esnext/components/ProductTitle/ProductTitle.client.js +16 -0
- package/dist/esnext/components/ProductTitle/index.d.ts +1 -0
- package/dist/esnext/components/ProductTitle/index.js +1 -0
- package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +2 -0
- package/dist/esnext/components/Seo/CollectionSeo.client.js +15 -0
- package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +2 -0
- package/dist/esnext/components/Seo/DefaultPageSeo.client.js +19 -0
- package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +4 -0
- package/dist/esnext/components/Seo/DescriptionSeo.client.js +10 -0
- package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +2 -0
- package/dist/esnext/components/Seo/HomePageSeo.client.js +25 -0
- package/dist/esnext/components/Seo/ImageSeo.client.d.ts +2 -0
- package/dist/esnext/components/Seo/ImageSeo.client.js +10 -0
- package/dist/esnext/components/Seo/PageSeo.client.d.ts +2 -0
- package/dist/esnext/components/Seo/PageSeo.client.js +13 -0
- package/dist/esnext/components/Seo/ProductSeo.client.d.ts +5 -0
- package/dist/esnext/components/Seo/ProductSeo.client.js +58 -0
- package/dist/esnext/components/Seo/Seo.client.d.ts +23 -0
- package/dist/esnext/components/Seo/Seo.client.js +28 -0
- package/dist/esnext/components/Seo/SeoFragment.d.ts +66 -0
- package/dist/esnext/components/Seo/SeoFragment.js +1 -0
- package/dist/esnext/components/Seo/TitleSeo.client.d.ts +4 -0
- package/dist/esnext/components/Seo/TitleSeo.client.js +10 -0
- package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +2 -0
- package/dist/esnext/components/Seo/TwitterSeo.client.js +9 -0
- package/dist/esnext/components/Seo/index.d.ts +1 -0
- package/dist/esnext/components/Seo/index.js +1 -0
- package/dist/esnext/components/Seo/types.d.ts +15 -0
- package/dist/esnext/components/Seo/types.js +1 -0
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.d.ts +38 -0
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +48 -0
- package/dist/esnext/components/ShopPayButton/index.d.ts +1 -0
- package/dist/esnext/components/ShopPayButton/index.js +1 -0
- package/dist/esnext/components/UnitPrice/UnitPrice.client.d.ts +14 -0
- package/dist/esnext/components/UnitPrice/UnitPrice.client.js +22 -0
- package/dist/esnext/components/UnitPrice/UnitPriceFragment.d.ts +15 -0
- package/dist/esnext/components/UnitPrice/UnitPriceFragment.js +1 -0
- package/dist/esnext/components/UnitPrice/index.d.ts +1 -0
- package/dist/esnext/components/UnitPrice/index.js +1 -0
- package/dist/esnext/components/Video/Video.d.ts +13 -0
- package/dist/esnext/components/Video/Video.js +11 -0
- package/dist/esnext/components/Video/VideoFragment.d.ts +15 -0
- package/dist/esnext/components/Video/VideoFragment.js +1 -0
- package/dist/esnext/components/Video/index.d.ts +1 -0
- package/dist/esnext/components/Video/index.js +1 -0
- package/dist/esnext/components/index.d.ts +32 -0
- package/dist/esnext/components/index.js +30 -0
- package/dist/esnext/components/types.d.ts +71 -0
- package/dist/esnext/components/types.js +10 -0
- package/dist/esnext/constants.d.ts +1 -0
- package/dist/esnext/constants.js +1 -0
- package/dist/esnext/entry-client.d.ts +3 -0
- package/dist/esnext/entry-client.js +48 -0
- package/dist/esnext/entry-server.d.ts +22 -0
- package/dist/esnext/entry-server.js +511 -0
- package/dist/esnext/foundation/Boomerang/Boomerang.client.d.ts +9 -0
- package/dist/esnext/foundation/Boomerang/Boomerang.client.js +64 -0
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +23 -0
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +78 -0
- package/dist/esnext/foundation/Head/Head.client.d.ts +5 -0
- package/dist/esnext/foundation/Head/Head.client.js +10 -0
- package/dist/esnext/foundation/Head/index.d.ts +1 -0
- package/dist/esnext/foundation/Head/index.js +1 -0
- package/dist/esnext/foundation/Route/Route.server.d.ts +13 -0
- package/dist/esnext/foundation/Route/Route.server.js +34 -0
- package/dist/esnext/foundation/Router/BrowserRouter.client.d.ts +13 -0
- package/dist/esnext/foundation/Router/BrowserRouter.client.js +48 -0
- package/dist/esnext/foundation/Router/Router.server.d.ts +11 -0
- package/dist/esnext/foundation/Router/Router.server.js +10 -0
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +23 -0
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +113 -0
- package/dist/esnext/foundation/ServerRequestProvider/index.d.ts +1 -0
- package/dist/esnext/foundation/ServerRequestProvider/index.js +1 -0
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.d.ts +25 -0
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.js +47 -0
- package/dist/esnext/foundation/ServerStateProvider/index.d.ts +2 -0
- package/dist/esnext/foundation/ServerStateProvider/index.js +1 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +7 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.js +8 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.d.ts +9 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +29 -0
- package/dist/esnext/foundation/ShopifyProvider/index.d.ts +1 -0
- package/dist/esnext/foundation/ShopifyProvider/index.js +1 -0
- package/dist/esnext/foundation/ShopifyProvider/types.d.ts +15 -0
- package/dist/esnext/foundation/ShopifyProvider/types.js +1 -0
- package/dist/esnext/foundation/constants.d.ts +1 -0
- package/dist/esnext/foundation/constants.js +3 -0
- package/dist/esnext/foundation/index.d.ts +3 -0
- package/dist/esnext/foundation/index.js +3 -0
- package/dist/esnext/foundation/ssr-interop.d.ts +29 -0
- package/dist/esnext/foundation/ssr-interop.js +35 -0
- package/dist/esnext/foundation/useNavigate/useNavigate.d.ts +13 -0
- package/dist/esnext/foundation/useNavigate/useNavigate.js +14 -0
- package/dist/esnext/foundation/useQuery/hooks.d.ts +31 -0
- package/dist/esnext/foundation/useQuery/hooks.js +85 -0
- package/dist/esnext/foundation/useQuery/index.d.ts +1 -0
- package/dist/esnext/foundation/useQuery/index.js +1 -0
- 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/useServerState/index.d.ts +1 -0
- package/dist/esnext/foundation/useServerState/index.js +1 -0
- package/dist/esnext/foundation/useServerState/use-server-state.d.ts +16 -0
- package/dist/esnext/foundation/useServerState/use-server-state.js +20 -0
- package/dist/esnext/foundation/useShop/index.d.ts +1 -0
- package/dist/esnext/foundation/useShop/index.js +1 -0
- package/dist/esnext/foundation/useShop/use-shop.d.ts +4 -0
- package/dist/esnext/foundation/useShop/use-shop.js +12 -0
- package/dist/esnext/foundation/useUrl/index.d.ts +1 -0
- package/dist/esnext/foundation/useUrl/index.js +1 -0
- package/dist/esnext/foundation/useUrl/useUrl.d.ts +4 -0
- package/dist/esnext/foundation/useUrl/useUrl.js +18 -0
- package/dist/esnext/fragments.d.ts +20 -0
- package/dist/esnext/fragments.js +10 -0
- package/dist/esnext/framework/CachingStrategy/index.d.ts +10 -0
- package/dist/esnext/framework/CachingStrategy/index.js +96 -0
- package/dist/esnext/framework/Hydration/Html.d.ts +11 -0
- package/dist/esnext/framework/Hydration/Html.js +84 -0
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +47 -0
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +114 -0
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +32 -0
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +55 -0
- package/dist/esnext/framework/Hydration/rsc.d.ts +11 -0
- package/dist/esnext/framework/Hydration/rsc.js +72 -0
- package/dist/esnext/framework/cache/in-memory.d.ts +11 -0
- package/dist/esnext/framework/cache/in-memory.js +48 -0
- package/dist/esnext/framework/cache.d.ts +26 -0
- package/dist/esnext/framework/cache.js +87 -0
- package/dist/esnext/framework/config.d.ts +6 -0
- package/dist/esnext/framework/config.js +6 -0
- package/dist/esnext/framework/graphiql.d.ts +1 -0
- package/dist/esnext/framework/graphiql.js +38 -0
- package/dist/esnext/framework/middleware.d.ts +22 -0
- package/dist/esnext/framework/middleware.js +107 -0
- package/dist/esnext/framework/plugin.d.ts +4 -0
- package/dist/esnext/framework/plugin.js +41 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydration-auto-import.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydration-auto-import.js +38 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +9 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.js +37 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +84 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +11 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +56 -0
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +70 -0
- package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.js +11 -0
- package/dist/esnext/framework/plugins/vite-plugin-ssr-interop.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-ssr-interop.js +13 -0
- package/dist/esnext/framework/runtime.d.ts +13 -0
- package/dist/esnext/framework/runtime.js +27 -0
- package/dist/esnext/graphql/graphql-constants.d.ts +1756 -0
- package/dist/esnext/graphql/graphql-constants.js +3447 -0
- package/dist/esnext/hooks/index.d.ts +6 -0
- package/dist/esnext/hooks/index.js +6 -0
- package/dist/esnext/hooks/useAvailableCountries/index.d.ts +1 -0
- package/dist/esnext/hooks/useAvailableCountries/index.js +1 -0
- package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.d.ts +11 -0
- package/dist/esnext/hooks/useAvailableCountries/useAvailableCountries.js +17 -0
- package/dist/esnext/hooks/useCart/index.d.ts +1 -0
- package/dist/esnext/hooks/useCart/index.js +1 -0
- package/dist/esnext/hooks/useCart/useCart.d.ts +4 -0
- package/dist/esnext/hooks/useCart/useCart.js +12 -0
- package/dist/esnext/hooks/useCartLine/index.d.ts +1 -0
- package/dist/esnext/hooks/useCartLine/index.js +1 -0
- package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +29 -0
- package/dist/esnext/hooks/useCartLine/useCartLine.js +12 -0
- package/dist/esnext/hooks/useCountry/index.d.ts +1 -0
- package/dist/esnext/hooks/useCountry/index.js +1 -0
- package/dist/esnext/hooks/useCountry/useCountry.d.ts +17 -0
- package/dist/esnext/hooks/useCountry/useCountry.js +17 -0
- package/dist/esnext/hooks/useLoadScript/index.d.ts +1 -0
- package/dist/esnext/hooks/useLoadScript/index.js +1 -0
- package/dist/esnext/hooks/useLoadScript/useLoadScript.d.ts +8 -0
- package/dist/esnext/hooks/useLoadScript/useLoadScript.js +22 -0
- package/dist/esnext/hooks/useMeasurement/hooks.d.ts +9 -0
- package/dist/esnext/hooks/useMeasurement/hooks.js +13 -0
- package/dist/esnext/hooks/useMeasurement/index.d.ts +1 -0
- package/dist/esnext/hooks/useMeasurement/index.js +1 -0
- package/dist/esnext/hooks/useMoney/hooks.d.ts +42 -0
- package/dist/esnext/hooks/useMoney/hooks.js +42 -0
- package/dist/esnext/hooks/useMoney/index.d.ts +1 -0
- package/dist/esnext/hooks/useMoney/index.js +1 -0
- package/dist/esnext/hooks/useParsedMetafields/index.d.ts +1 -0
- package/dist/esnext/hooks/useParsedMetafields/index.js +1 -0
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +6 -0
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.js +19 -0
- package/dist/esnext/hooks/useProduct/index.d.ts +1 -0
- package/dist/esnext/hooks/useProduct/index.js +1 -0
- package/dist/esnext/hooks/useProduct/useProduct.d.ts +114 -0
- package/dist/esnext/hooks/useProduct/useProduct.js +43 -0
- package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.d.ts +31 -0
- package/dist/esnext/hooks/useProductOptions/SellingPlanFragment.js +1 -0
- package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.d.ts +46 -0
- package/dist/esnext/hooks/useProductOptions/SellingPlanGroupsFragment.js +1 -0
- package/dist/esnext/hooks/useProductOptions/VariantFragment.d.ts +106 -0
- package/dist/esnext/hooks/useProductOptions/VariantFragment.js +1 -0
- package/dist/esnext/hooks/useProductOptions/helpers.d.ts +4 -0
- package/dist/esnext/hooks/useProductOptions/helpers.js +33 -0
- package/dist/esnext/hooks/useProductOptions/index.d.ts +2 -0
- package/dist/esnext/hooks/useProductOptions/index.js +2 -0
- package/dist/esnext/hooks/useProductOptions/types.d.ts +62 -0
- package/dist/esnext/hooks/useProductOptions/types.js +1 -0
- package/dist/esnext/hooks/useProductOptions/useProductOptions.d.ts +14 -0
- package/dist/esnext/hooks/useProductOptions/useProductOptions.js +115 -0
- package/dist/esnext/hooks/useShopQuery/hooks.d.ts +29 -0
- package/dist/esnext/hooks/useShopQuery/hooks.js +83 -0
- package/dist/esnext/hooks/useShopQuery/index.d.ts +1 -0
- package/dist/esnext/hooks/useShopQuery/index.js +1 -0
- package/dist/esnext/index.d.ts +15 -0
- package/dist/esnext/index.js +19 -0
- package/dist/esnext/platforms/node.d.ts +10 -0
- package/dist/esnext/platforms/node.js +38 -0
- package/dist/esnext/platforms/worker-event.d.ts +9 -0
- package/dist/esnext/platforms/worker-event.js +24 -0
- package/dist/esnext/storefront-api-types.d.ts +6121 -0
- package/dist/esnext/storefront-api-types.js +1709 -0
- package/dist/esnext/streaming.server.d.ts +20 -0
- package/dist/esnext/streaming.server.js +49 -0
- package/dist/esnext/types.d.ts +98 -0
- package/dist/esnext/types.js +1 -0
- package/dist/esnext/utilities/apiRoutes.d.ts +36 -0
- package/dist/esnext/utilities/apiRoutes.js +109 -0
- package/dist/esnext/utilities/bot-ua.d.ts +4 -0
- package/dist/esnext/utilities/bot-ua.js +54 -0
- package/dist/esnext/utilities/defer.d.ts +6 -0
- package/dist/esnext/utilities/defer.js +14 -0
- package/dist/esnext/utilities/error.d.ts +1 -0
- package/dist/esnext/utilities/error.js +6 -0
- package/dist/esnext/utilities/fetch.d.ts +4 -0
- package/dist/esnext/utilities/fetch.js +34 -0
- package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +5 -0
- package/dist/esnext/utilities/flattenConnection/flattenConnection.js +7 -0
- package/dist/esnext/utilities/flattenConnection/index.d.ts +1 -0
- package/dist/esnext/utilities/flattenConnection/index.js +1 -0
- package/dist/esnext/utilities/image_size.d.ts +29 -0
- package/dist/esnext/utilities/image_size.js +80 -0
- package/dist/esnext/utilities/index.d.ts +11 -0
- package/dist/esnext/utilities/index.js +11 -0
- package/dist/esnext/utilities/isClient/index.d.ts +1 -0
- package/dist/esnext/utilities/isClient/index.js +1 -0
- package/dist/esnext/utilities/isClient/isClient.d.ts +4 -0
- package/dist/esnext/utilities/isClient/isClient.js +6 -0
- package/dist/esnext/utilities/isServer/index.d.ts +1 -0
- package/dist/esnext/utilities/isServer/index.js +1 -0
- package/dist/esnext/utilities/isServer/isServer.d.ts +4 -0
- package/dist/esnext/utilities/isServer/isServer.js +7 -0
- package/dist/esnext/utilities/load_script.d.ts +3 -0
- package/dist/esnext/utilities/load_script.js +23 -0
- package/dist/esnext/utilities/log/index.d.ts +4 -0
- package/dist/esnext/utilities/log/index.js +4 -0
- package/dist/esnext/utilities/log/log-cache-api-status.d.ts +1 -0
- package/dist/esnext/utilities/log/log-cache-api-status.js +9 -0
- package/dist/esnext/utilities/log/log-cache-header.d.ts +10 -0
- package/dist/esnext/utilities/log/log-cache-header.js +30 -0
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +12 -0
- package/dist/esnext/utilities/log/log-query-timeline.js +84 -0
- package/dist/esnext/utilities/log/log.d.ts +21 -0
- package/dist/esnext/utilities/log/log.js +66 -0
- package/dist/esnext/utilities/log/utils.d.ts +3 -0
- package/dist/esnext/utilities/log/utils.js +13 -0
- package/dist/esnext/utilities/matchPath.d.ts +10 -0
- package/dist/esnext/utilities/matchPath.js +54 -0
- package/dist/esnext/utilities/measurement.d.ts +3 -0
- package/dist/esnext/utilities/measurement.js +98 -0
- package/dist/esnext/utilities/object.d.ts +5 -0
- package/dist/esnext/utilities/object.js +7 -0
- package/dist/esnext/utilities/parseMetafieldValue/index.d.ts +1 -0
- package/dist/esnext/utilities/parseMetafieldValue/index.js +1 -0
- package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.d.ts +5 -0
- package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.js +35 -0
- package/dist/esnext/utilities/suspense.d.ts +7 -0
- package/dist/esnext/utilities/suspense.js +26 -0
- package/dist/esnext/utilities/template.d.ts +9 -0
- package/dist/esnext/utilities/template.js +23 -0
- package/dist/esnext/utilities/timing.d.ts +7 -0
- package/dist/esnext/utilities/timing.js +14 -0
- package/dist/esnext/utilities/video_parameters.d.ts +47 -0
- package/dist/esnext/utilities/video_parameters.js +22 -0
- package/dist/esnext/utilities/web-api-polyfill.d.ts +1 -0
- package/dist/esnext/utilities/web-api-polyfill.js +19 -0
- package/dist/esnext/version.d.ts +1 -0
- package/dist/esnext/version.js +1 -0
- package/dist/node/constants.d.ts +1 -0
- package/dist/node/constants.js +4 -0
- package/dist/node/entry-server.d.ts +22 -0
- package/dist/node/entry-server.js +541 -0
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +23 -0
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +143 -0
- package/dist/node/foundation/ServerRequestProvider/index.d.ts +1 -0
- package/dist/node/foundation/ServerRequestProvider/index.js +17 -0
- package/dist/node/foundation/ServerStateProvider/ServerStateProvider.d.ts +25 -0
- package/dist/node/foundation/ServerStateProvider/ServerStateProvider.js +72 -0
- package/dist/node/foundation/ServerStateProvider/index.d.ts +2 -0
- package/dist/node/foundation/ServerStateProvider/index.js +6 -0
- package/dist/node/foundation/ShopifyProvider/types.d.ts +15 -0
- package/dist/node/foundation/ShopifyProvider/types.js +2 -0
- package/dist/node/framework/CachingStrategy/index.d.ts +10 -0
- package/dist/node/framework/CachingStrategy/index.js +108 -0
- package/dist/node/framework/Hydration/Html.d.ts +11 -0
- package/dist/node/framework/Hydration/Html.js +92 -0
- package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +47 -0
- package/dist/node/framework/Hydration/ServerComponentRequest.server.js +118 -0
- package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +32 -0
- package/dist/node/framework/Hydration/ServerComponentResponse.server.js +59 -0
- package/dist/node/framework/Hydration/rsc.d.ts +11 -0
- package/dist/node/framework/Hydration/rsc.js +75 -0
- package/dist/node/framework/cache/in-memory.d.ts +11 -0
- package/dist/node/framework/cache/in-memory.js +52 -0
- package/dist/node/framework/cache.d.ts +26 -0
- package/dist/node/framework/cache.js +97 -0
- package/dist/node/framework/config.d.ts +6 -0
- package/dist/node/framework/config.js +11 -0
- package/dist/node/framework/graphiql.d.ts +1 -0
- package/dist/node/framework/graphiql.js +42 -0
- package/dist/node/framework/middleware.d.ts +22 -0
- package/dist/node/framework/middleware.js +134 -0
- package/dist/node/framework/plugin.d.ts +4 -0
- package/dist/node/framework/plugin.js +69 -0
- package/dist/node/framework/plugins/vite-plugin-hydration-auto-import.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-hydration-auto-import.js +43 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +9 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.js +39 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +86 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +11 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +62 -0
- package/dist/node/framework/plugins/vite-plugin-platform-entry.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +75 -0
- package/dist/node/framework/plugins/vite-plugin-purge-query-cache.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-purge-query-cache.js +16 -0
- package/dist/node/framework/plugins/vite-plugin-ssr-interop.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-ssr-interop.js +15 -0
- package/dist/node/framework/runtime.d.ts +13 -0
- package/dist/node/framework/runtime.js +35 -0
- package/dist/node/storefront-api-types.d.ts +6121 -0
- package/dist/node/storefront-api-types.js +1712 -0
- package/dist/node/streaming.server.d.ts +20 -0
- package/dist/node/streaming.server.js +49 -0
- package/dist/node/types.d.ts +98 -0
- package/dist/node/types.js +2 -0
- package/dist/node/utilities/apiRoutes.d.ts +36 -0
- package/dist/node/utilities/apiRoutes.js +115 -0
- package/dist/node/utilities/bot-ua.d.ts +4 -0
- package/dist/node/utilities/bot-ua.js +58 -0
- package/dist/node/utilities/defer.d.ts +6 -0
- package/dist/node/utilities/defer.js +18 -0
- package/dist/node/utilities/error.d.ts +1 -0
- package/dist/node/utilities/error.js +10 -0
- package/dist/node/utilities/fetch.d.ts +4 -0
- package/dist/node/utilities/fetch.js +40 -0
- package/dist/node/utilities/log/index.d.ts +4 -0
- package/dist/node/utilities/log/index.js +18 -0
- package/dist/node/utilities/log/log-cache-api-status.d.ts +1 -0
- package/dist/node/utilities/log/log-cache-api-status.js +13 -0
- package/dist/node/utilities/log/log-cache-header.d.ts +10 -0
- package/dist/node/utilities/log/log-cache-header.js +35 -0
- package/dist/node/utilities/log/log-query-timeline.d.ts +12 -0
- package/dist/node/utilities/log/log-query-timeline.js +89 -0
- package/dist/node/utilities/log/log.d.ts +21 -0
- package/dist/node/utilities/log/log.js +74 -0
- package/dist/node/utilities/log/utils.d.ts +3 -0
- package/dist/node/utilities/log/utils.js +18 -0
- package/dist/node/utilities/matchPath.d.ts +10 -0
- package/dist/node/utilities/matchPath.js +58 -0
- package/dist/node/utilities/template.d.ts +9 -0
- package/dist/node/utilities/template.js +27 -0
- package/dist/node/utilities/timing.d.ts +7 -0
- package/dist/node/utilities/timing.js +18 -0
- package/dist/node/utilities/web-api-polyfill.d.ts +1 -0
- package/dist/node/utilities/web-api-polyfill.js +47 -0
- package/dist/node/version.d.ts +1 -0
- package/dist/node/version.js +4 -0
- package/entry-client.d.ts +1 -0
- package/entry-client.js +1 -0
- package/entry-server.d.ts +1 -0
- package/entry-server.js +1 -0
- package/fragments.d.ts +1 -0
- package/fragments.js +1 -0
- package/middleware.d.ts +1 -0
- package/middleware.js +1 -0
- package/package.json +121 -0
- package/plugin.d.ts +1 -0
- package/plugin.js +1 -0
- package/vendor/react-server-dom-vite/LICENSE +21 -0
- package/vendor/react-server-dom-vite/README.md +5 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +243 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +1031 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +430 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +1053 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +446 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +623 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +255 -0
- package/vendor/react-server-dom-vite/esm/package.json +3 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +83 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +239 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +1014 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +1032 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +613 -0
- package/vendor/react-server-dom-vite/index.js +7 -0
- package/vendor/react-server-dom-vite/package.json +68 -0
- package/vendor/react-server-dom-vite/plugin.js +3 -0
- package/vendor/react-server-dom-vite/writer.browser.server.js +7 -0
- package/vendor/react-server-dom-vite/writer.node.server.js +7 -0
- package/web-polyfills.js +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ElementType } from 'react';
|
|
2
|
+
import { Props } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* The `ProductTitle` component renders a `span` element (or the type of
|
|
5
|
+
* HTML element specified by the `as` prop) with the product's [`title`](/api/storefront/reference/products/product).
|
|
6
|
+
* It must be a descendent of the `ProductProvider` component.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ProductTitle<TTag extends ElementType = 'span'>(props: Props<TTag> & {
|
|
9
|
+
/** An HTML tag to wrap the title. If not specified, then the
|
|
10
|
+
* title is wrapped in a `span` element.
|
|
11
|
+
*/
|
|
12
|
+
as?: TTag;
|
|
13
|
+
}): JSX.Element | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useProduct } from '../ProductProvider';
|
|
3
|
+
/**
|
|
4
|
+
* The `ProductTitle` component renders a `span` element (or the type of
|
|
5
|
+
* HTML element specified by the `as` prop) with the product's [`title`](/api/storefront/reference/products/product).
|
|
6
|
+
* It must be a descendent of the `ProductProvider` component.
|
|
7
|
+
*/
|
|
8
|
+
export function ProductTitle(props) {
|
|
9
|
+
const product = useProduct();
|
|
10
|
+
if (product == null) {
|
|
11
|
+
throw new Error('Expected a ProductProvider context, but none was found');
|
|
12
|
+
}
|
|
13
|
+
const { as, ...passthroughProps } = props;
|
|
14
|
+
const Wrapper = as ? as : 'span';
|
|
15
|
+
return product.title ? (React.createElement(Wrapper, { ...passthroughProps }, product.title)) : null;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProductTitle } from './ProductTitle.client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProductTitle } from './ProductTitle.client';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TitleSeo } from './TitleSeo.client';
|
|
3
|
+
import { DescriptionSeo } from './DescriptionSeo.client';
|
|
4
|
+
import { TwitterSeo } from './TwitterSeo.client';
|
|
5
|
+
import { ImageSeo } from './ImageSeo.client';
|
|
6
|
+
export function CollectionSeo({ title, description, seo, image, }) {
|
|
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;
|
|
10
|
+
return (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement(TitleSeo, { title: seoTitle }),
|
|
12
|
+
React.createElement(DescriptionSeo, { description: seoDescription }),
|
|
13
|
+
React.createElement(TwitterSeo, { title: seoTitle, description: seoDescription }),
|
|
14
|
+
image && React.createElement(ImageSeo, { ...image })));
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useShop } from '../../foundation';
|
|
3
|
+
import { Head } from '../../client';
|
|
4
|
+
import { TitleSeo } from './TitleSeo.client';
|
|
5
|
+
import { DescriptionSeo } from './DescriptionSeo.client';
|
|
6
|
+
import { TwitterSeo } from './TwitterSeo.client';
|
|
7
|
+
export function DefaultPageSeo({ title, description, url, titleTemplate, lang, }) {
|
|
8
|
+
const { locale } = useShop();
|
|
9
|
+
const fallBacklang = locale.split(/[-_]/)[0];
|
|
10
|
+
return (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement(Head, { defaultTitle: title !== null && title !== void 0 ? title : '', titleTemplate: titleTemplate !== null && titleTemplate !== void 0 ? titleTemplate : `%s - ${title}` },
|
|
12
|
+
React.createElement("html", { lang: lang !== null && lang !== void 0 ? lang : fallBacklang }),
|
|
13
|
+
React.createElement("meta", { property: "og:type", content: "website" }),
|
|
14
|
+
React.createElement("meta", { property: "og:site_name", content: title !== null && title !== void 0 ? title : '' }),
|
|
15
|
+
React.createElement("meta", { property: "og:url", content: url })),
|
|
16
|
+
React.createElement(TitleSeo, { title: title }),
|
|
17
|
+
React.createElement(DescriptionSeo, { description: description }),
|
|
18
|
+
React.createElement(TwitterSeo, { title: title, description: description })));
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Head } from '../../client';
|
|
3
|
+
export function DescriptionSeo({ description, }) {
|
|
4
|
+
if (!description) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
return (React.createElement(Head, null,
|
|
8
|
+
React.createElement("meta", { name: "description", content: description }),
|
|
9
|
+
React.createElement("meta", { property: "og:description", content: description })));
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Head } from '../../client';
|
|
3
|
+
import { TitleSeo } from './TitleSeo.client';
|
|
4
|
+
import { DescriptionSeo } from './DescriptionSeo.client';
|
|
5
|
+
export function HomePageSeo({ title, description, url }) {
|
|
6
|
+
const organizationSchema = {
|
|
7
|
+
'@context': 'http://schema.org',
|
|
8
|
+
'@type': 'Organization',
|
|
9
|
+
name: title,
|
|
10
|
+
url,
|
|
11
|
+
};
|
|
12
|
+
const webSiteSchema = {
|
|
13
|
+
'@context': 'http://schema.org',
|
|
14
|
+
'@type': 'WebSite',
|
|
15
|
+
name: title,
|
|
16
|
+
url,
|
|
17
|
+
};
|
|
18
|
+
return (React.createElement(React.Fragment, null,
|
|
19
|
+
React.createElement(Head, null,
|
|
20
|
+
React.createElement("meta", { property: "og:url", content: url }),
|
|
21
|
+
React.createElement("script", { type: "application/ld+json" }, JSON.stringify(organizationSchema)),
|
|
22
|
+
React.createElement("script", { type: "application/ld+json" }, JSON.stringify(webSiteSchema))),
|
|
23
|
+
React.createElement(TitleSeo, { title: title }),
|
|
24
|
+
description && React.createElement(DescriptionSeo, { description: description })));
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Head } from '../../client';
|
|
3
|
+
export function ImageSeo({ url, width, height, altText, }) {
|
|
4
|
+
return (React.createElement(Head, null,
|
|
5
|
+
url && React.createElement("meta", { property: "og:image", content: url }),
|
|
6
|
+
url && React.createElement("meta", { property: "og:image:secure_url", content: url }),
|
|
7
|
+
width && React.createElement("meta", { property: "og:image:width", content: `${width}` }),
|
|
8
|
+
height && React.createElement("meta", { property: "og:image:height", content: `${height}` }),
|
|
9
|
+
altText && React.createElement("meta", { property: "og:image:alt", content: altText })));
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TitleSeo } from './TitleSeo.client';
|
|
3
|
+
import { DescriptionSeo } from './DescriptionSeo.client';
|
|
4
|
+
import { TwitterSeo } from './TwitterSeo.client';
|
|
5
|
+
export function PageSeo({ title, seo }) {
|
|
6
|
+
var _a;
|
|
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
|
+
return (React.createElement(React.Fragment, null,
|
|
10
|
+
React.createElement(TitleSeo, { title: seoTitle }),
|
|
11
|
+
React.createElement(DescriptionSeo, { description: seoDescription }),
|
|
12
|
+
React.createElement(TwitterSeo, { title: seoTitle, description: seoDescription })));
|
|
13
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProductSeoFragmentFragment } from './SeoFragment';
|
|
2
|
+
import type { Scalars } from '../../storefront-api-types';
|
|
3
|
+
export declare function ProductSeo({ url, title, description, seo, vendor, featuredImage, variants, }: ProductSeoFragmentFragment & {
|
|
4
|
+
url: Scalars['URL'];
|
|
5
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Head } from '../../client';
|
|
3
|
+
import { TitleSeo } from './TitleSeo.client';
|
|
4
|
+
import { DescriptionSeo } from './DescriptionSeo.client';
|
|
5
|
+
import { TwitterSeo } from './TwitterSeo.client';
|
|
6
|
+
import { ImageSeo } from './ImageSeo.client';
|
|
7
|
+
export function ProductSeo({ url, title, description, seo, vendor, featuredImage, variants, }) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const seoTitle = (_a = seo === null || seo === void 0 ? void 0 : seo.title) !== null && _a !== void 0 ? _a : title;
|
|
10
|
+
const seoDescription = (_b = seo === null || seo === void 0 ? void 0 : seo.description) !== null && _b !== void 0 ? _b : description;
|
|
11
|
+
let firstVariantPrice;
|
|
12
|
+
const productSchema = {
|
|
13
|
+
'@context': 'http://schema.org/',
|
|
14
|
+
'@type': 'Product',
|
|
15
|
+
name: title,
|
|
16
|
+
description,
|
|
17
|
+
brand: {
|
|
18
|
+
'@type': 'Thing',
|
|
19
|
+
name: vendor,
|
|
20
|
+
},
|
|
21
|
+
url,
|
|
22
|
+
};
|
|
23
|
+
if (featuredImage) {
|
|
24
|
+
productSchema.image = featuredImage.url;
|
|
25
|
+
}
|
|
26
|
+
if (variants.edges.length > 0) {
|
|
27
|
+
const firstVariant = variants.edges[0].node;
|
|
28
|
+
firstVariantPrice = firstVariant.priceV2;
|
|
29
|
+
if (firstVariant && firstVariant.sku) {
|
|
30
|
+
productSchema.sku = firstVariant.sku;
|
|
31
|
+
}
|
|
32
|
+
productSchema.offers = variants.edges.map(({ node }) => {
|
|
33
|
+
const offerSchema = {
|
|
34
|
+
'@type': 'Offer',
|
|
35
|
+
availability: `https://schema.org/${node.availableForSale ? 'InStock' : 'OutOfStock'}`,
|
|
36
|
+
price: node.priceV2.amount,
|
|
37
|
+
priceCurrency: node.priceV2.currencyCode,
|
|
38
|
+
};
|
|
39
|
+
if (node.sku) {
|
|
40
|
+
offerSchema.sku = node.sku;
|
|
41
|
+
}
|
|
42
|
+
if (node.image && node.image.url) {
|
|
43
|
+
offerSchema.image = node.image.url;
|
|
44
|
+
}
|
|
45
|
+
return offerSchema;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return (React.createElement(React.Fragment, null,
|
|
49
|
+
React.createElement(Head, null,
|
|
50
|
+
React.createElement("meta", { property: "og:type", content: "og:product" }),
|
|
51
|
+
firstVariantPrice && (React.createElement("meta", { property: "og:price:amount", content: `${firstVariantPrice.amount}` })),
|
|
52
|
+
firstVariantPrice && (React.createElement("meta", { property: "og:price:currency", content: firstVariantPrice.currencyCode })),
|
|
53
|
+
React.createElement("script", { type: "application/ld+json" }, JSON.stringify(productSchema))),
|
|
54
|
+
React.createElement(TitleSeo, { title: seoTitle }),
|
|
55
|
+
React.createElement(DescriptionSeo, { description: seoDescription }),
|
|
56
|
+
React.createElement(TwitterSeo, { title: seoTitle, description: seoDescription }),
|
|
57
|
+
featuredImage && React.createElement(ImageSeo, { ...featuredImage })));
|
|
58
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DefaultPage, HomePage } from './types';
|
|
2
|
+
import type { ProductSeoFragmentFragment, CollectionSeoFragmentFragment, PageSeoFragmentFragment } from './SeoFragment';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
type: 'defaultSeo';
|
|
5
|
+
data: Omit<DefaultPage, 'url'>;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'homepage';
|
|
8
|
+
data: Omit<HomePage, 'url'>;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'product';
|
|
11
|
+
data: ProductSeoFragmentFragment;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'collection';
|
|
14
|
+
data: CollectionSeoFragmentFragment;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'page';
|
|
17
|
+
data: PageSeoFragmentFragment;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The `Seo` component renders SEO information on a webpage.
|
|
21
|
+
*/
|
|
22
|
+
export declare function Seo(props: Props): JSX.Element | null;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useUrl } from '../../foundation';
|
|
3
|
+
import { DefaultPageSeo } from './DefaultPageSeo.client';
|
|
4
|
+
import { HomePageSeo } from './HomePageSeo.client';
|
|
5
|
+
import { ProductSeo } from './ProductSeo.client';
|
|
6
|
+
import { CollectionSeo } from './CollectionSeo.client';
|
|
7
|
+
import { PageSeo } from './PageSeo.client';
|
|
8
|
+
/**
|
|
9
|
+
* The `Seo` component renders SEO information on a webpage.
|
|
10
|
+
*/
|
|
11
|
+
export function Seo(props) {
|
|
12
|
+
const url = useUrl().href;
|
|
13
|
+
switch (props.type) {
|
|
14
|
+
case 'defaultSeo':
|
|
15
|
+
return React.createElement(DefaultPageSeo, { ...{ url, ...props.data } });
|
|
16
|
+
case 'homepage':
|
|
17
|
+
return React.createElement(HomePageSeo, { ...{ url, ...props.data } });
|
|
18
|
+
case 'product':
|
|
19
|
+
return React.createElement(ProductSeo, { ...{ url, ...props.data } });
|
|
20
|
+
case 'collection':
|
|
21
|
+
return React.createElement(CollectionSeo, { ...props.data });
|
|
22
|
+
case 'page':
|
|
23
|
+
return React.createElement(PageSeo, { ...props.data });
|
|
24
|
+
default:
|
|
25
|
+
console.warn('The <Seo/> only accepts type prop with values of defaultSeo, homepage, product, collection, or page.');
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
|
|
3
|
+
* Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
|
|
4
|
+
*/
|
|
5
|
+
import * as Types from '../../storefront-api-types';
|
|
6
|
+
export declare type DefaultPageSeoFragmentFragment = {
|
|
7
|
+
__typename?: 'Shop';
|
|
8
|
+
} & Pick<Types.Shop, 'description'> & {
|
|
9
|
+
title: Types.Shop['name'];
|
|
10
|
+
};
|
|
11
|
+
export declare type HomeSeoFragmentFragment = {
|
|
12
|
+
__typename?: 'Shop';
|
|
13
|
+
} & Pick<Types.Shop, 'description'> & {
|
|
14
|
+
title: Types.Shop['name'];
|
|
15
|
+
};
|
|
16
|
+
export declare type ImageSeoFragmentFragment = {
|
|
17
|
+
__typename?: 'Image';
|
|
18
|
+
} & Pick<Types.Image, 'url' | 'width' | 'height' | 'altText'>;
|
|
19
|
+
export declare type SeoFragmentFragment = {
|
|
20
|
+
__typename?: 'SEO';
|
|
21
|
+
} & Pick<Types.Seo, 'description' | 'title'>;
|
|
22
|
+
export declare type ProductSeoFragmentFragment = {
|
|
23
|
+
__typename?: 'Product';
|
|
24
|
+
} & Pick<Types.Product, 'title' | 'description' | 'vendor'> & {
|
|
25
|
+
seo: {
|
|
26
|
+
__typename?: 'SEO';
|
|
27
|
+
} & Pick<Types.Seo, 'description' | 'title'>;
|
|
28
|
+
featuredImage?: Types.Maybe<{
|
|
29
|
+
__typename?: 'Image';
|
|
30
|
+
} & Pick<Types.Image, 'url' | 'width' | 'height' | 'altText'>>;
|
|
31
|
+
variants: {
|
|
32
|
+
__typename?: 'ProductVariantConnection';
|
|
33
|
+
} & {
|
|
34
|
+
edges: Array<{
|
|
35
|
+
__typename?: 'ProductVariantEdge';
|
|
36
|
+
} & {
|
|
37
|
+
node: {
|
|
38
|
+
__typename?: 'ProductVariant';
|
|
39
|
+
} & Pick<Types.ProductVariant, 'availableForSale' | 'sku'> & {
|
|
40
|
+
image?: Types.Maybe<{
|
|
41
|
+
__typename?: 'Image';
|
|
42
|
+
} & Pick<Types.Image, 'url'>>;
|
|
43
|
+
priceV2: {
|
|
44
|
+
__typename?: 'MoneyV2';
|
|
45
|
+
} & Pick<Types.MoneyV2, 'amount' | 'currencyCode'>;
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export declare type CollectionSeoFragmentFragment = {
|
|
51
|
+
__typename?: 'Collection';
|
|
52
|
+
} & Pick<Types.Collection, 'title' | 'description'> & {
|
|
53
|
+
seo: {
|
|
54
|
+
__typename?: 'SEO';
|
|
55
|
+
} & Pick<Types.Seo, 'description' | 'title'>;
|
|
56
|
+
image?: Types.Maybe<{
|
|
57
|
+
__typename?: 'Image';
|
|
58
|
+
} & Pick<Types.Image, 'url' | 'width' | 'height' | 'altText'>>;
|
|
59
|
+
};
|
|
60
|
+
export declare type PageSeoFragmentFragment = {
|
|
61
|
+
__typename?: 'Page';
|
|
62
|
+
} & Pick<Types.Page, 'title'> & {
|
|
63
|
+
seo?: Types.Maybe<{
|
|
64
|
+
__typename?: 'SEO';
|
|
65
|
+
} & Pick<Types.Seo, 'description' | 'title'>>;
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Head } from '../../client';
|
|
3
|
+
export function TitleSeo({ title }) {
|
|
4
|
+
if (!title) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
return (React.createElement(Head, null,
|
|
8
|
+
React.createElement("title", null, title),
|
|
9
|
+
React.createElement("meta", { property: "og:title", content: title })));
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Head } from '../../client';
|
|
3
|
+
export function TwitterSeo({ site, title, description }) {
|
|
4
|
+
return (React.createElement(Head, null,
|
|
5
|
+
React.createElement("meta", { name: "twitter:card", content: "summary_large_image" }),
|
|
6
|
+
site && React.createElement("meta", { name: "twitter:site", content: site }),
|
|
7
|
+
title && React.createElement("meta", { name: "twitter:title", content: title }),
|
|
8
|
+
description && React.createElement("meta", { name: "twitter:description", content: description })));
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Seo } from './Seo.client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Seo } from './Seo.client';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SeoFragmentFragment, DefaultPageSeoFragmentFragment, HomeSeoFragmentFragment } from './SeoFragment';
|
|
2
|
+
import type { Scalars } from '../../storefront-api-types';
|
|
3
|
+
export interface Twitter {
|
|
4
|
+
site: string;
|
|
5
|
+
title: SeoFragmentFragment['title'];
|
|
6
|
+
description: SeoFragmentFragment['description'];
|
|
7
|
+
}
|
|
8
|
+
export interface HomePage extends HomeSeoFragmentFragment {
|
|
9
|
+
url: Scalars['URL'];
|
|
10
|
+
}
|
|
11
|
+
export interface DefaultPage extends DefaultPageSeoFragmentFragment {
|
|
12
|
+
url: Scalars['URL'];
|
|
13
|
+
titleTemplate?: string;
|
|
14
|
+
lang?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare type ShopPayButtonProps = {
|
|
2
|
+
/** A string of classes to apply to the `div` that wraps the Shop Pay button. */
|
|
3
|
+
className?: string;
|
|
4
|
+
} & ({
|
|
5
|
+
/** An array of IDs of the variants to purchase with Shop Pay. This will only ever have a quantity of 1 for each variant. If you want to use other quantities, then use 'variantIdsAndQuantities'. */
|
|
6
|
+
variantIds: string[];
|
|
7
|
+
/** An array of variant IDs and quantities to purchase with Shop Pay. */
|
|
8
|
+
variantIdsAndQuantities?: never;
|
|
9
|
+
} | {
|
|
10
|
+
/** An array of IDs of the variants to purchase with Shop Pay. This will only ever have a quantity of 1 for each variant. If you want to use other quantities, then use 'variantIdsAndQuantities'. */
|
|
11
|
+
variantIds?: never;
|
|
12
|
+
/** An array of variant IDs and quantities to purchase with Shop Pay. */
|
|
13
|
+
variantIdsAndQuantities: Array<{
|
|
14
|
+
id: string;
|
|
15
|
+
quantity: number;
|
|
16
|
+
}>;
|
|
17
|
+
});
|
|
18
|
+
declare global {
|
|
19
|
+
namespace JSX {
|
|
20
|
+
interface IntrinsicElements {
|
|
21
|
+
'shop-pay-button': {
|
|
22
|
+
variants: string;
|
|
23
|
+
'store-url': string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ShopPayButton({ variantIds, className, variantIdsAndQuantities, }: ShopPayButtonProps): JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Takes a string in the format of "gid://shopify/ProductVariant/41007289630776" and returns a string of the ID part at the end: "41007289630776"
|
|
34
|
+
*/
|
|
35
|
+
export declare function getIdFromGid(id?: string): string | undefined;
|
|
36
|
+
export declare const MissingPropsErrorMessage = "You must pass in either \"variantIds\" or \"variantIdsAndQuantities\" to ShopPayButton";
|
|
37
|
+
export declare const DoublePropsErrorMessage = "You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component";
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useShop } from '../../foundation/useShop';
|
|
3
|
+
import { useLoadScript } from '../../hooks/useLoadScript/useLoadScript';
|
|
4
|
+
const URL = 'https://cdn.shopify.com/shopifycloud/shop-js/v0.8/client.js';
|
|
5
|
+
/**
|
|
6
|
+
* The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout.
|
|
7
|
+
*/
|
|
8
|
+
export function ShopPayButton({ variantIds, className, variantIdsAndQuantities, }) {
|
|
9
|
+
const { storeDomain } = useShop();
|
|
10
|
+
const shopPayLoadedStatus = useLoadScript(URL);
|
|
11
|
+
let ids;
|
|
12
|
+
if (variantIds && variantIdsAndQuantities) {
|
|
13
|
+
throw new Error(DoublePropsErrorMessage);
|
|
14
|
+
}
|
|
15
|
+
if (variantIds) {
|
|
16
|
+
ids = variantIds.reduce((prev, curr) => {
|
|
17
|
+
const bareId = getIdFromGid(curr);
|
|
18
|
+
if (bareId) {
|
|
19
|
+
prev.push(bareId);
|
|
20
|
+
}
|
|
21
|
+
return prev;
|
|
22
|
+
}, []);
|
|
23
|
+
}
|
|
24
|
+
else if (variantIdsAndQuantities) {
|
|
25
|
+
ids = variantIdsAndQuantities.reduce((prev, curr) => {
|
|
26
|
+
var _a;
|
|
27
|
+
const bareId = getIdFromGid(curr === null || curr === void 0 ? void 0 : curr.id);
|
|
28
|
+
if (bareId) {
|
|
29
|
+
prev.push(`${bareId}:${(_a = curr === null || curr === void 0 ? void 0 : curr.quantity) !== null && _a !== void 0 ? _a : 1}`);
|
|
30
|
+
}
|
|
31
|
+
return prev;
|
|
32
|
+
}, []);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw new Error(MissingPropsErrorMessage);
|
|
36
|
+
}
|
|
37
|
+
return (React.createElement("div", { className: className, tabIndex: 1 }, shopPayLoadedStatus === 'done' && (React.createElement("shop-pay-button", { "store-url": `https://${storeDomain}`, variants: ids.join(',') }))));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Takes a string in the format of "gid://shopify/ProductVariant/41007289630776" and returns a string of the ID part at the end: "41007289630776"
|
|
41
|
+
*/
|
|
42
|
+
export function getIdFromGid(id) {
|
|
43
|
+
if (!id)
|
|
44
|
+
return;
|
|
45
|
+
return id.split('/').pop();
|
|
46
|
+
}
|
|
47
|
+
export const MissingPropsErrorMessage = `You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton`;
|
|
48
|
+
export const DoublePropsErrorMessage = `You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShopPayButton } from './ShopPayButton.client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShopPayButton } from './ShopPayButton.client';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UnitPriceFragmentFragment } from './UnitPriceFragment';
|
|
2
|
+
export interface UnitPriceProps<TTag> {
|
|
3
|
+
/** An object with keys that correspond to the Storefront API's [MoneyV2 object](/api/storefront/reference/common-objects/moneyv2). */
|
|
4
|
+
data: UnitPriceFragmentFragment['unitPrice'];
|
|
5
|
+
/** A [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement). */
|
|
6
|
+
measurement: UnitPriceFragmentFragment['unitPriceMeasurement'];
|
|
7
|
+
/** An HTML tag to be rendered as the base element wrapper. The default is `div`. */
|
|
8
|
+
as?: TTag;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The `UnitPrice` component renders a string with a [UnitPrice](/themes/pricing-payments/unit-pricing) as the
|
|
12
|
+
* Storefront API's [MoneyV2 object](/api/storefront/reference/common-objects/moneyv2) with a reference unit from the Storefront API's [UnitPriceMeasurement object](/api/storefront/reference/products/unitpricemeasurement).
|
|
13
|
+
*/
|
|
14
|
+
export declare function UnitPrice<TTag extends keyof JSX.IntrinsicElements = 'div'>(props: JSX.IntrinsicElements[TTag] & UnitPriceProps<TTag>): JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Money } from '../Money';
|
|
3
|
+
/**
|
|
4
|
+
* The `UnitPrice` component renders a string with a [UnitPrice](/themes/pricing-payments/unit-pricing) as the
|
|
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).
|
|
6
|
+
*/
|
|
7
|
+
export function UnitPrice(props) {
|
|
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
|
+
}
|
|
17
|
+
const Wrapper = as !== null && as !== void 0 ? as : 'div';
|
|
18
|
+
return (React.createElement(Wrapper, { ...passthroughProps },
|
|
19
|
+
React.createElement(Money, { data: data }),
|
|
20
|
+
"/",
|
|
21
|
+
measurement.referenceUnit));
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
|
|
3
|
+
* Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
|
|
4
|
+
*/
|
|
5
|
+
import * as Types from '../../storefront-api-types';
|
|
6
|
+
export declare type UnitPriceFragmentFragment = {
|
|
7
|
+
__typename?: 'ProductVariant';
|
|
8
|
+
} & {
|
|
9
|
+
unitPriceMeasurement?: Types.Maybe<{
|
|
10
|
+
__typename?: 'UnitPriceMeasurement';
|
|
11
|
+
} & Pick<Types.UnitPriceMeasurement, 'measuredType' | 'quantityUnit' | 'quantityValue' | 'referenceUnit' | 'referenceValue'>>;
|
|
12
|
+
unitPrice?: Types.Maybe<{
|
|
13
|
+
__typename?: 'MoneyV2';
|
|
14
|
+
} & Pick<Types.MoneyV2, 'currencyCode' | 'amount'>>;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UnitPrice } from './UnitPrice.client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UnitPrice } from './UnitPrice.client';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ImageSizeOptions } from '../../utilities';
|
|
2
|
+
import type { VideoFragmentFragment } from './VideoFragment';
|
|
3
|
+
interface VideoProps {
|
|
4
|
+
/** An object with keys that correspond to the Storefront API's [Video object](/api/storefront/latest/objects/video). */
|
|
5
|
+
data: VideoFragmentFragment;
|
|
6
|
+
/** An object of image size options for the video's `previewImage`. */
|
|
7
|
+
options?: ImageSizeOptions;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The `Video` component renders a `video` for the Storefront API's [Video object](/api/storefront/reference/products/video).
|
|
11
|
+
*/
|
|
12
|
+
export declare function Video(props: JSX.IntrinsicElements['video'] & VideoProps): JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useImageUrl } from '../../utilities';
|
|
3
|
+
/**
|
|
4
|
+
* The `Video` component renders a `video` for the Storefront API's [Video object](/api/storefront/reference/products/video).
|
|
5
|
+
*/
|
|
6
|
+
export function Video(props) {
|
|
7
|
+
var _a;
|
|
8
|
+
const { data, options, id = data.id, playsInline = true, controls = true, ...passthroughProps } = props;
|
|
9
|
+
const posterUrl = useImageUrl((_a = data.previewImage) === null || _a === void 0 ? void 0 : _a.url, options);
|
|
10
|
+
return (React.createElement("video", { ...passthroughProps, id: id, playsInline: playsInline, controls: controls, poster: posterUrl }, data.sources.map((source) => (React.createElement("source", { key: source.url, src: source.url, type: source.mimeType })))));
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
|
|
3
|
+
* Instead, you can edit the associated .graphql file to query for additional fields and this file will be updated when you run `yarn graphql-types`
|
|
4
|
+
*/
|
|
5
|
+
import * as Types from '../../storefront-api-types';
|
|
6
|
+
export declare type VideoFragmentFragment = {
|
|
7
|
+
__typename?: 'Video';
|
|
8
|
+
} & Pick<Types.Video, 'id'> & {
|
|
9
|
+
previewImage?: Types.Maybe<{
|
|
10
|
+
__typename?: 'Image';
|
|
11
|
+
} & Pick<Types.Image, 'url'>>;
|
|
12
|
+
sources: Array<{
|
|
13
|
+
__typename?: 'VideoSource';
|
|
14
|
+
} & Pick<Types.VideoSource, 'mimeType' | 'url'>>;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Video } from './Video';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Video } from './Video';
|