@shopify/hydrogen 0.0.0-experimental-20220526194818
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 +1643 -0
- package/README.md +29 -0
- package/client.d.ts +1 -0
- package/client.js +1 -0
- package/config.d.ts +1 -0
- package/config.js +1 -0
- package/dist/esnext/FileSessionStorage.d.ts +1 -0
- package/dist/esnext/FileSessionStorage.js +1 -0
- package/dist/esnext/client.d.ts +16 -0
- package/dist/esnext/client.js +16 -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 +9 -0
- package/dist/esnext/components/CartLineImage/CartLineImage.client.js +11 -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 +41 -0
- package/dist/esnext/components/CartProvider/CartProvider.client.js +523 -0
- package/dist/esnext/components/CartProvider/cart-queries.d.ts +10 -0
- package/dist/esnext/components/CartProvider/cart-queries.js +191 -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.client.d.ts +15 -0
- package/dist/esnext/components/CartProvider/hooks.client.js +62 -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 +102 -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/DevTools.client.d.ts +1 -0
- package/dist/esnext/components/DevTools.client.js +129 -0
- package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +21 -0
- package/dist/esnext/components/ExternalVideo/ExternalVideo.js +14 -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 +84 -0
- package/dist/esnext/components/Image/Image.js +59 -0
- package/dist/esnext/components/Image/index.d.ts +2 -0
- package/dist/esnext/components/Image/index.js +1 -0
- package/dist/esnext/components/Link/Link.client.d.ts +23 -0
- package/dist/esnext/components/Link/Link.client.js +135 -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 +5 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +6 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.js +2 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +33 -0
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +44 -0
- package/dist/esnext/components/LocalizationProvider/index.d.ts +2 -0
- package/dist/esnext/components/LocalizationProvider/index.js +2 -0
- package/dist/esnext/components/MediaFile/MediaFile.d.ts +19 -0
- package/dist/esnext/components/MediaFile/MediaFile.js +31 -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 +21 -0
- package/dist/esnext/components/Metafield/Metafield.client.js +68 -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/ModelViewer.client.d.ts +128 -0
- package/dist/esnext/components/ModelViewer/ModelViewer.client.js +105 -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 +25 -0
- package/dist/esnext/components/Money/Money.client.js +39 -0
- package/dist/esnext/components/Money/index.d.ts +1 -0
- package/dist/esnext/components/Money/index.js +1 -0
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +15 -0
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +56 -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 +24 -0
- package/dist/esnext/components/ProductProvider/ProductProvider.client.js +34 -0
- package/dist/esnext/components/ProductProvider/context.d.ts +29 -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/Seo/CollectionSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/CollectionSeo.client.js +15 -0
- package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/DefaultPageSeo.client.js +18 -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 +3 -0
- package/dist/esnext/components/Seo/ImageSeo.client.js +10 -0
- package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +3 -0
- package/dist/esnext/components/Seo/NoIndexSeo.client.js +10 -0
- package/dist/esnext/components/Seo/PageSeo.client.d.ts +3 -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 +63 -0
- package/dist/esnext/components/Seo/Seo.client.d.ts +30 -0
- package/dist/esnext/components/Seo/Seo.client.js +31 -0
- package/dist/esnext/components/Seo/TitleSeo.client.d.ts +3 -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/seo-types.d.ts +17 -0
- package/dist/esnext/components/Seo/seo-types.js +1 -0
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.d.ts +38 -0
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +52 -0
- package/dist/esnext/components/ShopPayButton/index.d.ts +1 -0
- package/dist/esnext/components/ShopPayButton/index.js +1 -0
- package/dist/esnext/components/Video/Video.d.ts +14 -0
- package/dist/esnext/components/Video/Video.js +24 -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 +28 -0
- package/dist/esnext/components/index.js +26 -0
- package/dist/esnext/components/types.d.ts +71 -0
- package/dist/esnext/components/types.js +10 -0
- package/dist/esnext/config.d.ts +3 -0
- package/dist/esnext/config.js +1 -0
- package/dist/esnext/constants.d.ts +7 -0
- package/dist/esnext/constants.js +7 -0
- package/dist/esnext/entry-client.d.ts +3 -0
- package/dist/esnext/entry-client.js +73 -0
- package/dist/esnext/entry-server.d.ts +35 -0
- package/dist/esnext/entry-server.js +529 -0
- package/dist/esnext/foundation/Analytics/Analytics.client.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/Analytics.client.js +28 -0
- package/dist/esnext/foundation/Analytics/Analytics.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/Analytics.server.js +40 -0
- package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +25 -0
- package/dist/esnext/foundation/Analytics/ClientAnalytics.js +97 -0
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.server.d.ts +2 -0
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.server.js +33 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.d.ts +7 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +64 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.server.js +24 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +23 -0
- package/dist/esnext/foundation/Analytics/const.d.ts +9 -0
- package/dist/esnext/foundation/Analytics/const.js +9 -0
- package/dist/esnext/foundation/Analytics/hook.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/hook.js +7 -0
- package/dist/esnext/foundation/Analytics/index.d.ts +2 -0
- package/dist/esnext/foundation/Analytics/index.js +2 -0
- package/dist/esnext/foundation/Analytics/types.d.ts +5 -0
- package/dist/esnext/foundation/Analytics/types.js +1 -0
- package/dist/esnext/foundation/Analytics/utils.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/utils.js +8 -0
- package/dist/esnext/foundation/AnalyticsErrorBoundary.client.d.ts +4 -0
- package/dist/esnext/foundation/AnalyticsErrorBoundary.client.js +8 -0
- package/dist/esnext/foundation/Cookie/Cookie.d.ts +48 -0
- package/dist/esnext/foundation/Cookie/Cookie.js +67 -0
- package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.d.ts +5 -0
- package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.js +31 -0
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +22 -0
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +74 -0
- package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.d.ts +6 -0
- package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.js +149 -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/MemorySessionStorage/MemorySessionStorage.d.ts +5 -0
- package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.js +53 -0
- package/dist/esnext/foundation/Redirect/Redirect.client.d.ts +5 -0
- package/dist/esnext/foundation/Redirect/Redirect.client.js +15 -0
- package/dist/esnext/foundation/Route/Route.server.d.ts +12 -0
- package/dist/esnext/foundation/Route/Route.server.js +28 -0
- package/dist/esnext/foundation/Router/BrowserRouter.client.d.ts +13 -0
- package/dist/esnext/foundation/Router/BrowserRouter.client.js +130 -0
- 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/ServerPropsProvider/ServerPropsProvider.d.ts +40 -0
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +67 -0
- package/dist/esnext/foundation/ServerPropsProvider/index.d.ts +2 -0
- package/dist/esnext/foundation/ServerPropsProvider/index.js +1 -0
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +23 -0
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +128 -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 +30 -0
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.js +59 -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 +16 -0
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +58 -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 +13 -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/fetchSync/client/fetchSync.d.ts +10 -0
- package/dist/esnext/foundation/fetchSync/client/fetchSync.js +28 -0
- package/dist/esnext/foundation/fetchSync/server/fetchSync.d.ts +8 -0
- package/dist/esnext/foundation/fetchSync/server/fetchSync.js +29 -0
- package/dist/esnext/foundation/fetchSync/types.d.ts +5 -0
- package/dist/esnext/foundation/fetchSync/types.js +1 -0
- package/dist/esnext/foundation/index.d.ts +3 -0
- package/dist/esnext/foundation/index.js +3 -0
- package/dist/esnext/foundation/session/session.d.ts +27 -0
- package/dist/esnext/foundation/session/session.js +37 -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 +36 -0
- package/dist/esnext/foundation/useQuery/hooks.js +97 -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/useServerProps/index.d.ts +1 -0
- package/dist/esnext/foundation/useServerProps/index.js +1 -0
- package/dist/esnext/foundation/useServerProps/use-server-props.d.ts +21 -0
- package/dist/esnext/foundation/useServerProps/use-server-props.js +35 -0
- package/dist/esnext/foundation/useSession/useSession.d.ts +2 -0
- package/dist/esnext/foundation/useSession/useSession.js +8 -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 +6 -0
- package/dist/esnext/foundation/useShop/use-shop.js +14 -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 +28 -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 +86 -0
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.d.ts +58 -0
- package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +146 -0
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.d.ts +26 -0
- package/dist/esnext/framework/Hydration/ServerComponentResponse.server.js +42 -0
- package/dist/esnext/framework/Hydration/rsc.d.ts +8 -0
- package/dist/esnext/framework/Hydration/rsc.js +100 -0
- package/dist/esnext/framework/cache/in-memory.d.ts +12 -0
- package/dist/esnext/framework/cache/in-memory.js +52 -0
- package/dist/esnext/framework/cache-sub-request.d.ts +17 -0
- package/dist/esnext/framework/cache-sub-request.js +64 -0
- package/dist/esnext/framework/cache.d.ts +17 -0
- package/dist/esnext/framework/cache.js +127 -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 +21 -0
- package/dist/esnext/framework/middleware.js +98 -0
- package/dist/esnext/framework/plugin.d.ts +4 -0
- package/dist/esnext/framework/plugin.js +28 -0
- package/dist/esnext/framework/plugins/vite-plugin-client-imports.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-client-imports.js +25 -0
- 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 +98 -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 +35 -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 +96 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +11 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +110 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +35 -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 +16 -0
- package/dist/esnext/framework/runtime.d.ts +13 -0
- package/dist/esnext/framework/runtime.js +27 -0
- package/dist/esnext/hooks/index.d.ts +6 -0
- package/dist/esnext/hooks/index.js +6 -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 +7 -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.client.d.ts +8 -0
- package/dist/esnext/hooks/useLoadScript/useLoadScript.client.js +23 -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 +54 -0
- package/dist/esnext/hooks/useMoney/hooks.js +66 -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 +21 -0
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.js +21 -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 +52 -0
- package/dist/esnext/hooks/useProduct/useProduct.js +43 -0
- package/dist/esnext/hooks/useProductOptions/helpers.d.ts +6 -0
- package/dist/esnext/hooks/useProductOptions/helpers.js +40 -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 +42 -0
- package/dist/esnext/hooks/useProductOptions/types.js +1 -0
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +15 -0
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +108 -0
- package/dist/esnext/hooks/useShopQuery/hooks.d.ts +28 -0
- package/dist/esnext/hooks/useShopQuery/hooks.js +161 -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 +27 -0
- package/dist/esnext/index.js +31 -0
- package/dist/esnext/node.d.ts +1 -0
- package/dist/esnext/node.js +1 -0
- package/dist/esnext/platforms/node.d.ts +9 -0
- package/dist/esnext/platforms/node.js +40 -0
- package/dist/esnext/platforms/worker-event.d.ts +1 -0
- package/dist/esnext/platforms/worker-event.js +3 -0
- package/dist/esnext/platforms/worker.d.ts +14 -0
- package/dist/esnext/platforms/worker.js +25 -0
- package/dist/esnext/storefront-api-types.d.ts +6405 -0
- package/dist/esnext/storefront-api-types.js +1763 -0
- package/dist/esnext/streaming.server.d.ts +24 -0
- package/dist/esnext/streaming.server.js +33 -0
- package/dist/esnext/types.d.ts +98 -0
- package/dist/esnext/types.js +1 -0
- package/dist/esnext/utilities/apiRoutes.d.ts +37 -0
- package/dist/esnext/utilities/apiRoutes.js +156 -0
- package/dist/esnext/utilities/bot-ua.d.ts +4 -0
- package/dist/esnext/utilities/bot-ua.js +61 -0
- package/dist/esnext/utilities/defer.d.ts +6 -0
- package/dist/esnext/utilities/defer.js +14 -0
- package/dist/esnext/utilities/devtools.d.ts +11 -0
- package/dist/esnext/utilities/devtools.js +11 -0
- package/dist/esnext/utilities/empty-hydrogen-config.d.ts +2 -0
- package/dist/esnext/utilities/empty-hydrogen-config.js +2 -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 +9 -0
- package/dist/esnext/utilities/fetch.js +31 -0
- package/dist/esnext/utilities/findRoutePrefix.d.ts +1 -0
- package/dist/esnext/utilities/findRoutePrefix.js +17 -0
- package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +6 -0
- package/dist/esnext/utilities/flattenConnection/flattenConnection.js +11 -0
- package/dist/esnext/utilities/flattenConnection/index.d.ts +1 -0
- package/dist/esnext/utilities/flattenConnection/index.js +1 -0
- package/dist/esnext/utilities/graphql-tag.d.ts +1 -0
- package/dist/esnext/utilities/graphql-tag.js +6 -0
- package/dist/esnext/utilities/graphql-tracker.d.ts +17 -0
- package/dist/esnext/utilities/graphql-tracker.js +123 -0
- package/dist/esnext/utilities/hash.d.ts +2 -0
- package/dist/esnext/utilities/hash.js +7 -0
- package/dist/esnext/utilities/html-encoding.d.ts +2 -0
- package/dist/esnext/utilities/html-encoding.js +16 -0
- package/dist/esnext/utilities/image_size.d.ts +12 -0
- package/dist/esnext/utilities/image_size.js +62 -0
- package/dist/esnext/utilities/index.d.ts +12 -0
- package/dist/esnext/utilities/index.js +12 -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 +13 -0
- package/dist/esnext/utilities/log/log-cache-header.d.ts +10 -0
- package/dist/esnext/utilities/log/log-cache-header.js +30 -0
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +12 -0
- package/dist/esnext/utilities/log/log-query-timeline.js +83 -0
- package/dist/esnext/utilities/log/log.d.ts +22 -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 +16 -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/parse.d.ts +1 -0
- package/dist/esnext/utilities/parse.js +9 -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 +6 -0
- package/dist/esnext/utilities/parseMetafieldValue/parseMetafieldValue.js +36 -0
- package/dist/esnext/utilities/storefrontApi.d.ts +4 -0
- package/dist/esnext/utilities/storefrontApi.js +22 -0
- package/dist/esnext/utilities/suspense.d.ts +12 -0
- package/dist/esnext/utilities/suspense.js +58 -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/components/Image/Image.d.ts +84 -0
- package/dist/node/components/Image/Image.js +86 -0
- package/dist/node/components/Image/index.d.ts +2 -0
- package/dist/node/components/Image/index.js +5 -0
- package/dist/node/constants.d.ts +7 -0
- package/dist/node/constants.js +10 -0
- package/dist/node/entry-server.d.ts +35 -0
- package/dist/node/entry-server.js +556 -0
- package/dist/node/foundation/Analytics/Analytics.client.d.ts +3 -0
- package/dist/node/foundation/Analytics/Analytics.client.js +32 -0
- package/dist/node/foundation/Analytics/Analytics.server.d.ts +1 -0
- package/dist/node/foundation/Analytics/Analytics.server.js +70 -0
- package/dist/node/foundation/Analytics/ClientAnalytics.d.ts +25 -0
- package/dist/node/foundation/Analytics/ClientAnalytics.js +100 -0
- package/dist/node/foundation/Analytics/ServerAnalyticsRoute.server.d.ts +2 -0
- package/dist/node/foundation/Analytics/ServerAnalyticsRoute.server.js +37 -0
- package/dist/node/foundation/Analytics/const.d.ts +9 -0
- package/dist/node/foundation/Analytics/const.js +12 -0
- package/dist/node/foundation/Analytics/hook.d.ts +1 -0
- package/dist/node/foundation/Analytics/hook.js +11 -0
- package/dist/node/foundation/Analytics/index.d.ts +2 -0
- package/dist/node/foundation/Analytics/index.js +7 -0
- package/dist/node/foundation/Analytics/types.d.ts +5 -0
- package/dist/node/foundation/Analytics/types.js +2 -0
- package/dist/node/foundation/Analytics/utils.d.ts +1 -0
- package/dist/node/foundation/Analytics/utils.js +12 -0
- package/dist/node/foundation/AnalyticsErrorBoundary.client.d.ts +4 -0
- package/dist/node/foundation/AnalyticsErrorBoundary.client.js +14 -0
- package/dist/node/foundation/Redirect/Redirect.client.d.ts +5 -0
- package/dist/node/foundation/Redirect/Redirect.client.js +18 -0
- package/dist/node/foundation/Router/BrowserRouter.client.d.ts +13 -0
- package/dist/node/foundation/Router/BrowserRouter.client.js +159 -0
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +40 -0
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.js +92 -0
- package/dist/node/foundation/ServerPropsProvider/index.d.ts +2 -0
- package/dist/node/foundation/ServerPropsProvider/index.js +6 -0
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +23 -0
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +158 -0
- package/dist/node/foundation/ServerRequestProvider/index.d.ts +1 -0
- package/dist/node/foundation/ServerRequestProvider/index.js +17 -0
- package/dist/node/foundation/ShopifyProvider/types.d.ts +13 -0
- package/dist/node/foundation/ShopifyProvider/types.js +2 -0
- package/dist/node/foundation/session/session.d.ts +27 -0
- package/dist/node/foundation/session/session.js +43 -0
- 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/useServerProps/use-server-props.d.ts +21 -0
- package/dist/node/foundation/useServerProps/use-server-props.js +40 -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 +94 -0
- package/dist/node/framework/Hydration/ServerComponentRequest.server.d.ts +58 -0
- package/dist/node/framework/Hydration/ServerComponentRequest.server.js +150 -0
- package/dist/node/framework/Hydration/ServerComponentResponse.server.d.ts +26 -0
- package/dist/node/framework/Hydration/ServerComponentResponse.server.js +49 -0
- package/dist/node/framework/Hydration/rsc.d.ts +8 -0
- package/dist/node/framework/Hydration/rsc.js +103 -0
- package/dist/node/framework/cache/in-memory.d.ts +12 -0
- package/dist/node/framework/cache/in-memory.js +56 -0
- package/dist/node/framework/cache-sub-request.d.ts +17 -0
- package/dist/node/framework/cache-sub-request.js +95 -0
- package/dist/node/framework/cache.d.ts +17 -0
- package/dist/node/framework/cache.js +135 -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 +21 -0
- package/dist/node/framework/middleware.js +125 -0
- package/dist/node/framework/plugin.d.ts +4 -0
- package/dist/node/framework/plugin.js +33 -0
- package/dist/node/framework/plugins/vite-plugin-client-imports.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-client-imports.js +28 -0
- 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 +104 -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 +40 -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 +98 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +11 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +116 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +41 -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 +18 -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 +6405 -0
- package/dist/node/storefront-api-types.js +1766 -0
- package/dist/node/streaming.server.d.ts +24 -0
- package/dist/node/streaming.server.js +33 -0
- package/dist/node/types.d.ts +98 -0
- package/dist/node/types.js +2 -0
- package/dist/node/utilities/apiRoutes.d.ts +37 -0
- package/dist/node/utilities/apiRoutes.js +163 -0
- package/dist/node/utilities/bot-ua.d.ts +4 -0
- package/dist/node/utilities/bot-ua.js +65 -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 +9 -0
- package/dist/node/utilities/fetch.js +37 -0
- package/dist/node/utilities/findRoutePrefix.d.ts +1 -0
- package/dist/node/utilities/findRoutePrefix.js +21 -0
- package/dist/node/utilities/flattenConnection/flattenConnection.d.ts +6 -0
- package/dist/node/utilities/flattenConnection/flattenConnection.js +15 -0
- package/dist/node/utilities/flattenConnection/index.d.ts +1 -0
- package/dist/node/utilities/flattenConnection/index.js +5 -0
- package/dist/node/utilities/hash.d.ts +2 -0
- package/dist/node/utilities/hash.js +11 -0
- package/dist/node/utilities/html-encoding.d.ts +2 -0
- package/dist/node/utilities/html-encoding.js +21 -0
- package/dist/node/utilities/image_size.d.ts +12 -0
- package/dist/node/utilities/image_size.js +68 -0
- package/dist/node/utilities/index.d.ts +12 -0
- package/dist/node/utilities/index.js +34 -0
- package/dist/node/utilities/isClient/index.d.ts +1 -0
- package/dist/node/utilities/isClient/index.js +5 -0
- package/dist/node/utilities/isClient/isClient.d.ts +4 -0
- package/dist/node/utilities/isClient/isClient.js +10 -0
- package/dist/node/utilities/isServer/index.d.ts +1 -0
- package/dist/node/utilities/isServer/index.js +5 -0
- package/dist/node/utilities/isServer/isServer.d.ts +4 -0
- package/dist/node/utilities/isServer/isServer.js +11 -0
- package/dist/node/utilities/load_script.d.ts +3 -0
- package/dist/node/utilities/load_script.js +27 -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 +17 -0
- package/dist/node/utilities/log/log-cache-header.d.ts +10 -0
- package/dist/node/utilities/log/log-cache-header.js +35 -0
- package/dist/node/utilities/log/log-query-timeline.d.ts +12 -0
- package/dist/node/utilities/log/log-query-timeline.js +88 -0
- package/dist/node/utilities/log/log.d.ts +22 -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 +21 -0
- package/dist/node/utilities/matchPath.d.ts +10 -0
- package/dist/node/utilities/matchPath.js +58 -0
- package/dist/node/utilities/measurement.d.ts +3 -0
- package/dist/node/utilities/measurement.js +103 -0
- package/dist/node/utilities/parse.d.ts +1 -0
- package/dist/node/utilities/parse.js +13 -0
- package/dist/node/utilities/parseMetafieldValue/index.d.ts +1 -0
- package/dist/node/utilities/parseMetafieldValue/index.js +5 -0
- package/dist/node/utilities/parseMetafieldValue/parseMetafieldValue.d.ts +6 -0
- package/dist/node/utilities/parseMetafieldValue/parseMetafieldValue.js +40 -0
- package/dist/node/utilities/storefrontApi.d.ts +4 -0
- package/dist/node/utilities/storefrontApi.js +26 -0
- package/dist/node/utilities/suspense.d.ts +12 -0
- package/dist/node/utilities/suspense.js +64 -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/video_parameters.d.ts +47 -0
- package/dist/node/utilities/video_parameters.js +27 -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/middleware.d.ts +1 -0
- package/middleware.js +1 -0
- package/package.json +125 -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 +356 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +1753 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +46 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +1716 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +44 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +613 -0
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +19 -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 +88 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +352 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +1745 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +1708 -0
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +603 -0
- package/vendor/react-server-dom-vite/index.js +7 -0
- package/vendor/react-server-dom-vite/package.json +67 -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,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CartBuyerIdentityInput, CountryCode } from '../../storefront-api-types';
|
|
3
|
+
import { CartFragmentFragment } from './graphql/CartFragment';
|
|
4
|
+
/**
|
|
5
|
+
* The `CartProvider` component creates a context for using a cart. It creates a cart object and callbacks
|
|
6
|
+
* that can be accessed by any descendent component using the `useCart` hook and related hooks. It also carries out
|
|
7
|
+
* any callback props when a relevant action is performed. For example, if a `onLineAdd` callback is provided,
|
|
8
|
+
* then the callback will be called when a new line item is successfully added to the cart.
|
|
9
|
+
*
|
|
10
|
+
* The `CartProvider` component must be a descendent of the `ShopifyProvider` component.
|
|
11
|
+
* You must use this component if you want to use the `useCart` hook or related hooks, or if you would like to use the `AddToCartButton` component.
|
|
12
|
+
*/
|
|
13
|
+
export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, cartFragment, customerAccessToken, countryCode, }: {
|
|
14
|
+
/** Any `ReactNode` elements. */
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
numCartLines?: number;
|
|
17
|
+
/** A callback that is invoked when the process to create a cart begins, but before the cart is created in the Storefront API. */
|
|
18
|
+
onCreate?: () => void;
|
|
19
|
+
/** A callback that is invoked when the process to add a line item to the cart begins, but before the line item is added to the Storefront API. */
|
|
20
|
+
onLineAdd?: () => void;
|
|
21
|
+
/** A callback that is invoked when the process to remove a line item to the cart begins, but before the line item is removed from the Storefront API. */
|
|
22
|
+
onLineRemove?: () => void;
|
|
23
|
+
/** A callback that is invoked when the process to update a line item in the cart begins, but before the line item is updated in the Storefront API. */
|
|
24
|
+
onLineUpdate?: () => void;
|
|
25
|
+
/** A callback that is invoked when the process to add or update a note in the cart begins, but before the note is added or updated in the Storefront API. */
|
|
26
|
+
onNoteUpdate?: () => void;
|
|
27
|
+
/** A callback that is invoked when the process to update the buyer identity begins, but before the buyer identity is updated in the Storefront API. */
|
|
28
|
+
onBuyerIdentityUpdate?: () => void;
|
|
29
|
+
/** A callback that is invoked when the process to update the cart attributes begins, but before the attributes are updated in the Storefront API. */
|
|
30
|
+
onAttributesUpdate?: () => void;
|
|
31
|
+
/** A callback that is invoked when the process to update the cart discount codes begins, but before the discount codes are updated in the Storefront API. */
|
|
32
|
+
onDiscountCodesUpdate?: () => void;
|
|
33
|
+
/** An object with fields that correspond to the Storefront API's [Cart object](https://shopify.dev/api/storefront/latest/objects/cart). */
|
|
34
|
+
data?: CartFragmentFragment;
|
|
35
|
+
/** A fragment used to query the Storefront API's [Cart object](https://shopify.dev/api/storefront/latest/objects/cart) for all queries and mutations. A default value is used if no argument is provided. */
|
|
36
|
+
cartFragment?: string;
|
|
37
|
+
/** A customer access token that's accessible on the server if there's a customer login. */
|
|
38
|
+
customerAccessToken?: CartBuyerIdentityInput['customerAccessToken'];
|
|
39
|
+
/** The ISO country code for i18n. */
|
|
40
|
+
countryCode?: CountryCode;
|
|
41
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
import React, { useEffect, useCallback, useReducer, useMemo, useRef, } from 'react';
|
|
2
|
+
import { flattenConnection } from '../../utilities';
|
|
3
|
+
import { CartLineAdd, CartCreate, CartLineRemove, CartLineUpdate, CartNoteUpdate, CartBuyerIdentityUpdate, CartAttributesUpdate, CartDiscountCodesUpdate, CartQuery, defaultCartFragment, } from './cart-queries';
|
|
4
|
+
import { CountryCode, } from '../../storefront-api-types';
|
|
5
|
+
import { useCartFetch } from './hooks.client';
|
|
6
|
+
import { CartContext } from './context';
|
|
7
|
+
import { CART_ID_STORAGE_KEY } from './constants';
|
|
8
|
+
import { ClientAnalytics } from '../../foundation/Analytics';
|
|
9
|
+
function cartReducer(state, action) {
|
|
10
|
+
switch (action.type) {
|
|
11
|
+
case 'cartFetch': {
|
|
12
|
+
if (state.status === 'uninitialized') {
|
|
13
|
+
return {
|
|
14
|
+
status: 'fetching',
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
case 'cartCreate': {
|
|
20
|
+
if (state.status === 'uninitialized') {
|
|
21
|
+
return {
|
|
22
|
+
status: 'creating',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case 'resolve': {
|
|
28
|
+
const resolvableStatuses = ['updating', 'fetching', 'creating'];
|
|
29
|
+
if (resolvableStatuses.includes(state.status)) {
|
|
30
|
+
return {
|
|
31
|
+
status: 'idle',
|
|
32
|
+
cart: action.cart,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case 'reject': {
|
|
38
|
+
if (state.status === 'fetching' || state.status === 'creating') {
|
|
39
|
+
return { status: 'uninitialized', error: action.error };
|
|
40
|
+
}
|
|
41
|
+
else if (state.status === 'updating') {
|
|
42
|
+
return {
|
|
43
|
+
status: 'idle',
|
|
44
|
+
cart: state.lastValidCart,
|
|
45
|
+
error: action.error,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case 'resetCart': {
|
|
51
|
+
if (state.status === 'fetching') {
|
|
52
|
+
return { status: 'uninitialized' };
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case 'addLineItem': {
|
|
57
|
+
if (state.status === 'idle') {
|
|
58
|
+
return {
|
|
59
|
+
status: 'updating',
|
|
60
|
+
cart: state.cart,
|
|
61
|
+
lastValidCart: state.cart,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case 'removeLineItem': {
|
|
67
|
+
if (state.status === 'idle') {
|
|
68
|
+
return {
|
|
69
|
+
status: 'updating',
|
|
70
|
+
cart: {
|
|
71
|
+
...state.cart,
|
|
72
|
+
lines: state.cart.lines.filter(({ id }) => !action.lines.includes(id)),
|
|
73
|
+
},
|
|
74
|
+
lastValidCart: state.cart,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
case 'updateLineItem': {
|
|
80
|
+
if (state.status === 'idle') {
|
|
81
|
+
return {
|
|
82
|
+
status: 'updating',
|
|
83
|
+
cart: {
|
|
84
|
+
...state.cart,
|
|
85
|
+
lines: state.cart.lines.map((line) => {
|
|
86
|
+
const updatedLine = action.lines.find(({ id }) => id === line.id);
|
|
87
|
+
if (updatedLine && updatedLine.quantity) {
|
|
88
|
+
return {
|
|
89
|
+
...line,
|
|
90
|
+
quantity: updatedLine.quantity,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return line;
|
|
94
|
+
}),
|
|
95
|
+
},
|
|
96
|
+
lastValidCart: state.cart,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case 'noteUpdate': {
|
|
102
|
+
if (state.status === 'idle') {
|
|
103
|
+
return {
|
|
104
|
+
status: 'updating',
|
|
105
|
+
cart: state.cart,
|
|
106
|
+
lastValidCart: state.cart,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case 'buyerIdentityUpdate': {
|
|
112
|
+
if (state.status === 'idle') {
|
|
113
|
+
return {
|
|
114
|
+
status: 'updating',
|
|
115
|
+
cart: state.cart,
|
|
116
|
+
lastValidCart: state.cart,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case 'cartAttributesUpdate': {
|
|
122
|
+
if (state.status === 'idle') {
|
|
123
|
+
return {
|
|
124
|
+
status: 'updating',
|
|
125
|
+
cart: state.cart,
|
|
126
|
+
lastValidCart: state.cart,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
case 'discountCodesUpdate': {
|
|
132
|
+
if (state.status === 'idle') {
|
|
133
|
+
return {
|
|
134
|
+
status: 'updating',
|
|
135
|
+
cart: state.cart,
|
|
136
|
+
lastValidCart: state.cart,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
throw new Error(`Cannot dispatch event (${action.type}) for current cart state (${state.status})`);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The `CartProvider` component creates a context for using a cart. It creates a cart object and callbacks
|
|
146
|
+
* that can be accessed by any descendent component using the `useCart` hook and related hooks. It also carries out
|
|
147
|
+
* any callback props when a relevant action is performed. For example, if a `onLineAdd` callback is provided,
|
|
148
|
+
* then the callback will be called when a new line item is successfully added to the cart.
|
|
149
|
+
*
|
|
150
|
+
* The `CartProvider` component must be a descendent of the `ShopifyProvider` component.
|
|
151
|
+
* You must use this component if you want to use the `useCart` hook or related hooks, or if you would like to use the `AddToCartButton` component.
|
|
152
|
+
*/
|
|
153
|
+
export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, data: cart, cartFragment = defaultCartFragment, customerAccessToken, countryCode = CountryCode.Us, }) {
|
|
154
|
+
const initialStatus = cart
|
|
155
|
+
? { status: 'idle', cart: cartFromGraphQL(cart) }
|
|
156
|
+
: { status: 'uninitialized' };
|
|
157
|
+
const [state, dispatch] = useReducer((state, dispatch) => cartReducer(state, dispatch), initialStatus);
|
|
158
|
+
const fetchCart = useCartFetch();
|
|
159
|
+
const cartFetch = useCallback(async (cartId) => {
|
|
160
|
+
dispatch({ type: 'cartFetch' });
|
|
161
|
+
const { data } = await fetchCart({
|
|
162
|
+
query: CartQuery(cartFragment),
|
|
163
|
+
variables: {
|
|
164
|
+
id: cartId,
|
|
165
|
+
numCartLines,
|
|
166
|
+
country: countryCode,
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
if (!(data === null || data === void 0 ? void 0 : data.cart)) {
|
|
170
|
+
window.localStorage.removeItem(CART_ID_STORAGE_KEY);
|
|
171
|
+
dispatch({ type: 'resetCart' });
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
dispatch({ type: 'resolve', cart: cartFromGraphQL(data.cart) });
|
|
175
|
+
}, [fetchCart, cartFragment, numCartLines, countryCode]);
|
|
176
|
+
const cartCreate = useCallback(async (cart) => {
|
|
177
|
+
var _a, _b, _c;
|
|
178
|
+
dispatch({ type: 'cartCreate' });
|
|
179
|
+
onCreate === null || onCreate === void 0 ? void 0 : onCreate();
|
|
180
|
+
if (countryCode && !((_a = cart.buyerIdentity) === null || _a === void 0 ? void 0 : _a.countryCode)) {
|
|
181
|
+
if (cart.buyerIdentity == null) {
|
|
182
|
+
cart.buyerIdentity = {};
|
|
183
|
+
}
|
|
184
|
+
cart.buyerIdentity.countryCode = countryCode;
|
|
185
|
+
}
|
|
186
|
+
if (customerAccessToken && !((_b = cart.buyerIdentity) === null || _b === void 0 ? void 0 : _b.customerAccessToken)) {
|
|
187
|
+
if (cart.buyerIdentity == null) {
|
|
188
|
+
cart.buyerIdentity = {};
|
|
189
|
+
}
|
|
190
|
+
cart.buyerIdentity.customerAccessToken = customerAccessToken;
|
|
191
|
+
}
|
|
192
|
+
const { data, error } = await fetchCart({
|
|
193
|
+
query: CartCreate(cartFragment),
|
|
194
|
+
variables: {
|
|
195
|
+
input: cart,
|
|
196
|
+
numCartLines,
|
|
197
|
+
country: countryCode,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
if (error) {
|
|
201
|
+
dispatch({
|
|
202
|
+
type: 'reject',
|
|
203
|
+
error,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
if ((_c = data === null || data === void 0 ? void 0 : data.cartCreate) === null || _c === void 0 ? void 0 : _c.cart) {
|
|
207
|
+
if (cart.lines) {
|
|
208
|
+
ClientAnalytics.publish(ClientAnalytics.eventNames.ADD_TO_CART, true, {
|
|
209
|
+
addedCartLines: cart.lines,
|
|
210
|
+
cart: data.cartCreate.cart,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
dispatch({
|
|
214
|
+
type: 'resolve',
|
|
215
|
+
cart: cartFromGraphQL(data.cartCreate.cart),
|
|
216
|
+
});
|
|
217
|
+
window.localStorage.setItem(CART_ID_STORAGE_KEY, data.cartCreate.cart.id);
|
|
218
|
+
}
|
|
219
|
+
}, [
|
|
220
|
+
onCreate,
|
|
221
|
+
countryCode,
|
|
222
|
+
fetchCart,
|
|
223
|
+
cartFragment,
|
|
224
|
+
numCartLines,
|
|
225
|
+
customerAccessToken,
|
|
226
|
+
]);
|
|
227
|
+
const addLineItem = useCallback(async (lines, state) => {
|
|
228
|
+
var _a;
|
|
229
|
+
if (state.status === 'idle') {
|
|
230
|
+
dispatch({ type: 'addLineItem' });
|
|
231
|
+
onLineAdd === null || onLineAdd === void 0 ? void 0 : onLineAdd();
|
|
232
|
+
const { data, error } = await fetchCart({
|
|
233
|
+
query: CartLineAdd(cartFragment),
|
|
234
|
+
variables: {
|
|
235
|
+
cartId: state.cart.id,
|
|
236
|
+
lines,
|
|
237
|
+
numCartLines,
|
|
238
|
+
country: countryCode,
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
if (error) {
|
|
242
|
+
dispatch({
|
|
243
|
+
type: 'reject',
|
|
244
|
+
error,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
if ((_a = data === null || data === void 0 ? void 0 : data.cartLinesAdd) === null || _a === void 0 ? void 0 : _a.cart) {
|
|
248
|
+
ClientAnalytics.publish(ClientAnalytics.eventNames.ADD_TO_CART, true, {
|
|
249
|
+
addedCartLines: lines,
|
|
250
|
+
cart: data.cartLinesAdd.cart,
|
|
251
|
+
});
|
|
252
|
+
dispatch({
|
|
253
|
+
type: 'resolve',
|
|
254
|
+
cart: cartFromGraphQL(data.cartLinesAdd.cart),
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}, [onLineAdd, fetchCart, cartFragment, numCartLines, countryCode]);
|
|
259
|
+
const removeLineItem = useCallback(async (lines, state) => {
|
|
260
|
+
var _a;
|
|
261
|
+
if (state.status === 'idle') {
|
|
262
|
+
dispatch({ type: 'removeLineItem', lines });
|
|
263
|
+
onLineRemove === null || onLineRemove === void 0 ? void 0 : onLineRemove();
|
|
264
|
+
const { data, error } = await fetchCart({
|
|
265
|
+
query: CartLineRemove(cartFragment),
|
|
266
|
+
variables: {
|
|
267
|
+
cartId: state.cart.id,
|
|
268
|
+
lines,
|
|
269
|
+
numCartLines,
|
|
270
|
+
country: countryCode,
|
|
271
|
+
},
|
|
272
|
+
});
|
|
273
|
+
if (error) {
|
|
274
|
+
dispatch({
|
|
275
|
+
type: 'reject',
|
|
276
|
+
error,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
if ((_a = data === null || data === void 0 ? void 0 : data.cartLinesRemove) === null || _a === void 0 ? void 0 : _a.cart) {
|
|
280
|
+
ClientAnalytics.publish(ClientAnalytics.eventNames.REMOVE_FROM_CART, true, {
|
|
281
|
+
removedCartLines: lines,
|
|
282
|
+
cart: data.cartLinesRemove.cart,
|
|
283
|
+
});
|
|
284
|
+
dispatch({
|
|
285
|
+
type: 'resolve',
|
|
286
|
+
cart: cartFromGraphQL(data.cartLinesRemove.cart),
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}, [onLineRemove, fetchCart, cartFragment, numCartLines, countryCode]);
|
|
291
|
+
const updateLineItem = useCallback(async (lines, state) => {
|
|
292
|
+
var _a;
|
|
293
|
+
if (state.status === 'idle') {
|
|
294
|
+
dispatch({ type: 'updateLineItem', lines });
|
|
295
|
+
onLineUpdate === null || onLineUpdate === void 0 ? void 0 : onLineUpdate();
|
|
296
|
+
const { data, error } = await fetchCart({
|
|
297
|
+
query: CartLineUpdate(cartFragment),
|
|
298
|
+
variables: {
|
|
299
|
+
cartId: state.cart.id,
|
|
300
|
+
lines,
|
|
301
|
+
numCartLines,
|
|
302
|
+
country: countryCode,
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
if (error) {
|
|
306
|
+
dispatch({
|
|
307
|
+
type: 'reject',
|
|
308
|
+
error,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
if ((_a = data === null || data === void 0 ? void 0 : data.cartLinesUpdate) === null || _a === void 0 ? void 0 : _a.cart) {
|
|
312
|
+
ClientAnalytics.publish(ClientAnalytics.eventNames.UPDATE_CART, true, {
|
|
313
|
+
updatedCartLines: lines,
|
|
314
|
+
oldCart: state.cart,
|
|
315
|
+
});
|
|
316
|
+
dispatch({
|
|
317
|
+
type: 'resolve',
|
|
318
|
+
cart: cartFromGraphQL(data.cartLinesUpdate.cart),
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}, [onLineUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
|
|
323
|
+
const noteUpdate = useCallback(async (note, state) => {
|
|
324
|
+
var _a;
|
|
325
|
+
if (state.status === 'idle') {
|
|
326
|
+
dispatch({ type: 'noteUpdate' });
|
|
327
|
+
onNoteUpdate === null || onNoteUpdate === void 0 ? void 0 : onNoteUpdate();
|
|
328
|
+
const { data, error } = await fetchCart({
|
|
329
|
+
query: CartNoteUpdate(cartFragment),
|
|
330
|
+
variables: {
|
|
331
|
+
cartId: state.cart.id,
|
|
332
|
+
note,
|
|
333
|
+
numCartLines,
|
|
334
|
+
country: countryCode,
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
if (error) {
|
|
338
|
+
dispatch({
|
|
339
|
+
type: 'reject',
|
|
340
|
+
error,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
if ((_a = data === null || data === void 0 ? void 0 : data.cartNoteUpdate) === null || _a === void 0 ? void 0 : _a.cart) {
|
|
344
|
+
dispatch({
|
|
345
|
+
type: 'resolve',
|
|
346
|
+
cart: cartFromGraphQL(data.cartNoteUpdate.cart),
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}, [onNoteUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
|
|
351
|
+
const buyerIdentityUpdate = useCallback(async (buyerIdentity, state) => {
|
|
352
|
+
var _a;
|
|
353
|
+
if (state.status === 'idle') {
|
|
354
|
+
dispatch({ type: 'buyerIdentityUpdate' });
|
|
355
|
+
onBuyerIdentityUpdate === null || onBuyerIdentityUpdate === void 0 ? void 0 : onBuyerIdentityUpdate();
|
|
356
|
+
const { data, error } = await fetchCart({
|
|
357
|
+
query: CartBuyerIdentityUpdate(cartFragment),
|
|
358
|
+
variables: {
|
|
359
|
+
cartId: state.cart.id,
|
|
360
|
+
buyerIdentity,
|
|
361
|
+
numCartLines,
|
|
362
|
+
country: countryCode,
|
|
363
|
+
},
|
|
364
|
+
});
|
|
365
|
+
if (error) {
|
|
366
|
+
dispatch({
|
|
367
|
+
type: 'reject',
|
|
368
|
+
error,
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
if ((_a = data === null || data === void 0 ? void 0 : data.cartBuyerIdentityUpdate) === null || _a === void 0 ? void 0 : _a.cart) {
|
|
372
|
+
dispatch({
|
|
373
|
+
type: 'resolve',
|
|
374
|
+
cart: cartFromGraphQL(data.cartBuyerIdentityUpdate.cart),
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}, [onBuyerIdentityUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
|
|
379
|
+
const cartAttributesUpdate = useCallback(async (attributes, state) => {
|
|
380
|
+
var _a;
|
|
381
|
+
if (state.status === 'idle') {
|
|
382
|
+
dispatch({ type: 'cartAttributesUpdate' });
|
|
383
|
+
onAttributesUpdate === null || onAttributesUpdate === void 0 ? void 0 : onAttributesUpdate();
|
|
384
|
+
const { data, error } = await fetchCart({
|
|
385
|
+
query: CartAttributesUpdate(cartFragment),
|
|
386
|
+
variables: {
|
|
387
|
+
cartId: state.cart.id,
|
|
388
|
+
attributes,
|
|
389
|
+
numCartLines,
|
|
390
|
+
country: countryCode,
|
|
391
|
+
},
|
|
392
|
+
});
|
|
393
|
+
if (error) {
|
|
394
|
+
dispatch({
|
|
395
|
+
type: 'reject',
|
|
396
|
+
error,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
if ((_a = data === null || data === void 0 ? void 0 : data.cartAttributesUpdate) === null || _a === void 0 ? void 0 : _a.cart) {
|
|
400
|
+
dispatch({
|
|
401
|
+
type: 'resolve',
|
|
402
|
+
cart: cartFromGraphQL(data.cartAttributesUpdate.cart),
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}, [onAttributesUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
|
|
407
|
+
const discountCodesUpdate = useCallback(async (discountCodes, state) => {
|
|
408
|
+
var _a;
|
|
409
|
+
if (state.status === 'idle') {
|
|
410
|
+
dispatch({ type: 'discountCodesUpdate' });
|
|
411
|
+
onDiscountCodesUpdate === null || onDiscountCodesUpdate === void 0 ? void 0 : onDiscountCodesUpdate();
|
|
412
|
+
const { data, error } = await fetchCart({
|
|
413
|
+
query: CartDiscountCodesUpdate(cartFragment),
|
|
414
|
+
variables: {
|
|
415
|
+
cartId: state.cart.id,
|
|
416
|
+
discountCodes,
|
|
417
|
+
numCartLines,
|
|
418
|
+
country: countryCode,
|
|
419
|
+
},
|
|
420
|
+
});
|
|
421
|
+
if (error) {
|
|
422
|
+
dispatch({
|
|
423
|
+
type: 'reject',
|
|
424
|
+
error,
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
if ((_a = data === null || data === void 0 ? void 0 : data.cartDiscountCodesUpdate) === null || _a === void 0 ? void 0 : _a.cart) {
|
|
428
|
+
ClientAnalytics.publish(ClientAnalytics.eventNames.DISCOUNT_CODE_UPDATED, true, {
|
|
429
|
+
updatedDiscountCodes: discountCodes,
|
|
430
|
+
cart: data.cartDiscountCodesUpdate.cart,
|
|
431
|
+
});
|
|
432
|
+
dispatch({
|
|
433
|
+
type: 'resolve',
|
|
434
|
+
cart: cartFromGraphQL(data.cartDiscountCodesUpdate.cart),
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}, [onDiscountCodesUpdate, fetchCart, cartFragment, numCartLines, countryCode]);
|
|
439
|
+
const didFetchCart = useRef(false);
|
|
440
|
+
useEffect(() => {
|
|
441
|
+
if (localStorage.getItem(CART_ID_STORAGE_KEY) &&
|
|
442
|
+
state.status === 'uninitialized' &&
|
|
443
|
+
!didFetchCart.current) {
|
|
444
|
+
didFetchCart.current = true;
|
|
445
|
+
cartFetch(localStorage.getItem(CART_ID_STORAGE_KEY));
|
|
446
|
+
}
|
|
447
|
+
}, [cartFetch, state]);
|
|
448
|
+
useEffect(() => {
|
|
449
|
+
if (state.status !== 'idle') {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
buyerIdentityUpdate({ countryCode, customerAccessToken }, state);
|
|
453
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
454
|
+
}, [countryCode, customerAccessToken]);
|
|
455
|
+
const cartContextValue = useMemo(() => {
|
|
456
|
+
return {
|
|
457
|
+
...('cart' in state
|
|
458
|
+
? state.cart
|
|
459
|
+
: {
|
|
460
|
+
lines: [],
|
|
461
|
+
attributes: [],
|
|
462
|
+
...(cart ? cartFromGraphQL(cart) : {}),
|
|
463
|
+
}),
|
|
464
|
+
status: state.status,
|
|
465
|
+
error: 'error' in state ? state.error : undefined,
|
|
466
|
+
totalQuantity: 'cart' in state
|
|
467
|
+
? state.cart.lines.reduce((previous, current) => {
|
|
468
|
+
return previous + current.quantity;
|
|
469
|
+
}, 0)
|
|
470
|
+
: 0,
|
|
471
|
+
cartCreate,
|
|
472
|
+
linesAdd(lines) {
|
|
473
|
+
if ('cart' in state && state.cart.id) {
|
|
474
|
+
addLineItem(lines, state);
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
cartCreate({ lines });
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
linesRemove(lines) {
|
|
481
|
+
removeLineItem(lines, state);
|
|
482
|
+
},
|
|
483
|
+
linesUpdate(lines) {
|
|
484
|
+
updateLineItem(lines, state);
|
|
485
|
+
},
|
|
486
|
+
noteUpdate(note) {
|
|
487
|
+
noteUpdate(note, state);
|
|
488
|
+
},
|
|
489
|
+
buyerIdentityUpdate(buyerIdentity) {
|
|
490
|
+
buyerIdentityUpdate(buyerIdentity, state);
|
|
491
|
+
},
|
|
492
|
+
cartAttributesUpdate(attributes) {
|
|
493
|
+
cartAttributesUpdate(attributes, state);
|
|
494
|
+
},
|
|
495
|
+
discountCodesUpdate(discountCodes) {
|
|
496
|
+
discountCodesUpdate(discountCodes, state);
|
|
497
|
+
},
|
|
498
|
+
cartFragment,
|
|
499
|
+
};
|
|
500
|
+
}, [
|
|
501
|
+
state,
|
|
502
|
+
cart,
|
|
503
|
+
cartCreate,
|
|
504
|
+
cartFragment,
|
|
505
|
+
addLineItem,
|
|
506
|
+
removeLineItem,
|
|
507
|
+
updateLineItem,
|
|
508
|
+
noteUpdate,
|
|
509
|
+
buyerIdentityUpdate,
|
|
510
|
+
cartAttributesUpdate,
|
|
511
|
+
discountCodesUpdate,
|
|
512
|
+
]);
|
|
513
|
+
return (React.createElement(CartContext.Provider, { value: cartContextValue }, children));
|
|
514
|
+
}
|
|
515
|
+
function cartFromGraphQL(cart) {
|
|
516
|
+
var _a;
|
|
517
|
+
return {
|
|
518
|
+
...cart,
|
|
519
|
+
// @ts-expect-error While the cart still uses fragments, there will be a TS error here until we remove those fragments and get the type in-line
|
|
520
|
+
lines: flattenConnection(cart.lines),
|
|
521
|
+
note: (_a = cart.note) !== null && _a !== void 0 ? _a : undefined,
|
|
522
|
+
};
|
|
523
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const CartLineAdd: (cartFragment: string) => string;
|
|
2
|
+
export declare const CartCreate: (cartFragment: string) => string;
|
|
3
|
+
export declare const CartLineRemove: (cartFragment: string) => string;
|
|
4
|
+
export declare const CartLineUpdate: (cartFragment: string) => string;
|
|
5
|
+
export declare const CartNoteUpdate: (cartFragment: string) => string;
|
|
6
|
+
export declare const CartBuyerIdentityUpdate: (cartFragment: string) => string;
|
|
7
|
+
export declare const CartAttributesUpdate: (cartFragment: string) => string;
|
|
8
|
+
export declare const CartDiscountCodesUpdate: (cartFragment: string) => string;
|
|
9
|
+
export declare const CartQuery: (cartFragment: string) => string;
|
|
10
|
+
export declare const defaultCartFragment = "\nfragment CartFragment on Cart {\n id\n checkoutUrl\n buyerIdentity {\n countryCode\n customer {\n id\n email\n firstName\n lastName\n displayName\n }\n email\n phone\n }\n lines(first: $numCartLines) {\n edges {\n node {\n id\n quantity\n attributes {\n key\n value\n }\n merchandise {\n ... on ProductVariant {\n id\n availableForSale\n compareAtPriceV2 {\n ...MoneyFragment\n }\n priceV2 {\n ...MoneyFragment\n }\n requiresShipping\n title\n image {\n ...ImageFragment\n }\n product {\n handle\n title\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n estimatedCost {\n subtotalAmount {\n ...MoneyFragment\n }\n totalAmount {\n ...MoneyFragment\n }\n totalDutyAmount {\n ...MoneyFragment\n }\n totalTaxAmount {\n ...MoneyFragment\n }\n }\n note\n attributes {\n key\n value\n }\n discountCodes {\n code\n }\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";
|