@shopify/hydrogen 1.0.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/esnext/FileSessionStorage.d.ts +1 -1
- package/dist/esnext/FileSessionStorage.js +1 -1
- package/dist/esnext/client.d.ts +16 -16
- package/dist/esnext/client.js +16 -16
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.d.ts +5 -2
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +6 -5
- package/dist/esnext/components/AddToCartButton/index.d.ts +1 -1
- package/dist/esnext/components/AddToCartButton/index.js +1 -1
- package/dist/esnext/components/BaseButton/BaseButton.client.d.ts +7 -5
- package/dist/esnext/components/BaseButton/BaseButton.client.js +5 -4
- package/dist/esnext/components/BaseButton/index.d.ts +1 -1
- package/dist/esnext/components/BaseButton/index.js +1 -1
- package/dist/esnext/components/BuyNowButton/BuyNowButton.client.d.ts +3 -2
- package/dist/esnext/components/BuyNowButton/BuyNowButton.client.js +2 -2
- package/dist/esnext/components/BuyNowButton/index.d.ts +1 -1
- package/dist/esnext/components/BuyNowButton/index.js +1 -1
- package/dist/esnext/components/CartCheckoutButton/CartCheckoutButton.client.js +1 -1
- package/dist/esnext/components/CartCheckoutButton/index.d.ts +1 -1
- package/dist/esnext/components/CartCheckoutButton/index.js +1 -1
- package/dist/esnext/components/CartCost/CartCost.client.d.ts +1 -1
- package/dist/esnext/components/CartCost/CartCost.client.js +2 -2
- package/dist/esnext/components/CartCost/index.d.ts +1 -1
- package/dist/esnext/components/CartCost/index.js +1 -1
- package/dist/esnext/components/CartLineImage/CartLineImage.client.d.ts +1 -1
- package/dist/esnext/components/CartLineImage/CartLineImage.client.js +2 -2
- package/dist/esnext/components/CartLineImage/index.d.ts +1 -1
- package/dist/esnext/components/CartLineImage/index.js +1 -1
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.d.ts +1 -1
- package/dist/esnext/components/CartLinePrice/CartLinePrice.client.js +2 -2
- package/dist/esnext/components/CartLinePrice/index.d.ts +1 -1
- package/dist/esnext/components/CartLinePrice/index.js +1 -1
- package/dist/esnext/components/CartLineProductTitle/CartLineProductTitle.client.js +1 -1
- package/dist/esnext/components/CartLineProductTitle/index.d.ts +1 -1
- package/dist/esnext/components/CartLineProductTitle/index.js +1 -1
- package/dist/esnext/components/CartLineProvider/CartLineProvider.client.d.ts +1 -1
- package/dist/esnext/components/CartLineProvider/CartLineProvider.client.js +1 -1
- package/dist/esnext/components/CartLineProvider/context.d.ts +13 -13
- package/dist/esnext/components/CartLineProvider/index.d.ts +2 -2
- package/dist/esnext/components/CartLineProvider/index.js +2 -2
- package/dist/esnext/components/CartLineQuantity/CartLineQuantity.client.js +1 -1
- package/dist/esnext/components/CartLineQuantity/index.d.ts +1 -1
- package/dist/esnext/components/CartLineQuantity/index.js +1 -1
- package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +7 -8
- package/dist/esnext/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +3 -3
- package/dist/esnext/components/CartLineQuantityAdjustButton/index.d.ts +1 -1
- package/dist/esnext/components/CartLineQuantityAdjustButton/index.js +1 -1
- package/dist/esnext/components/CartLines/CartLines.client.d.ts +1 -1
- package/dist/esnext/components/CartLines/CartLines.client.js +2 -2
- package/dist/esnext/components/CartLines/index.d.ts +1 -1
- package/dist/esnext/components/CartLines/index.js +1 -1
- package/dist/esnext/components/CartProvider/CartProvider.client.d.ts +2 -2
- package/dist/esnext/components/CartProvider/CartProvider.client.js +13 -7
- package/dist/esnext/components/CartProvider/cart-queries.d.ts +1 -1
- package/dist/esnext/components/CartProvider/cart-queries.js +1 -0
- package/dist/esnext/components/CartProvider/context.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartCreateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartFragment.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartLineAddMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +1 -1
- package/dist/esnext/components/CartProvider/graphql/CartQuery.d.ts +1 -1
- package/dist/esnext/components/CartProvider/hooks.client.d.ts +2 -2
- package/dist/esnext/components/CartProvider/hooks.client.js +4 -4
- package/dist/esnext/components/CartProvider/index.d.ts +4 -4
- package/dist/esnext/components/CartProvider/index.js +3 -3
- package/dist/esnext/components/CartProvider/types.d.ts +2 -2
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.d.ts +1 -1
- package/dist/esnext/components/CartShopPayButton/CartShopPayButton.client.js +2 -2
- package/dist/esnext/components/CartShopPayButton/index.d.ts +1 -1
- package/dist/esnext/components/CartShopPayButton/index.js +1 -1
- package/dist/esnext/components/ExternalVideo/ExternalVideo.d.ts +2 -2
- package/dist/esnext/components/ExternalVideo/ExternalVideo.js +1 -1
- package/dist/esnext/components/ExternalVideo/index.d.ts +1 -1
- package/dist/esnext/components/ExternalVideo/index.js +1 -1
- package/dist/esnext/components/Image/Image.d.ts +2 -2
- package/dist/esnext/components/Image/Image.js +5 -5
- package/dist/esnext/components/Image/index.d.ts +2 -2
- package/dist/esnext/components/Image/index.js +1 -1
- package/dist/esnext/components/Link/Link.client.js +5 -5
- package/dist/esnext/components/Link/index.d.ts +1 -1
- package/dist/esnext/components/Link/index.js +1 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +1 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationClientProvider.client.js +1 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +1 -1
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +5 -5
- package/dist/esnext/components/LocalizationProvider/index.d.ts +1 -1
- package/dist/esnext/components/LocalizationProvider/index.js +1 -1
- package/dist/esnext/components/MediaFile/MediaFile.d.ts +4 -4
- package/dist/esnext/components/MediaFile/MediaFile.js +4 -4
- package/dist/esnext/components/MediaFile/index.d.ts +1 -1
- package/dist/esnext/components/MediaFile/index.js +1 -1
- package/dist/esnext/components/Metafield/Metafield.client.d.ts +2 -2
- package/dist/esnext/components/Metafield/Metafield.client.js +6 -6
- package/dist/esnext/components/Metafield/components/StarRating/StarRating.d.ts +1 -1
- package/dist/esnext/components/Metafield/components/StarRating/index.d.ts +1 -1
- package/dist/esnext/components/Metafield/components/StarRating/index.js +1 -1
- package/dist/esnext/components/Metafield/components/index.d.ts +1 -1
- package/dist/esnext/components/Metafield/components/index.js +1 -1
- package/dist/esnext/components/Metafield/index.d.ts +2 -2
- package/dist/esnext/components/Metafield/index.js +1 -1
- package/dist/esnext/components/Metafield/types.d.ts +1 -1
- package/dist/esnext/components/ModelViewer/ModelViewer.client.d.ts +2 -2
- package/dist/esnext/components/ModelViewer/ModelViewer.client.js +1 -1
- package/dist/esnext/components/ModelViewer/index.d.ts +1 -1
- package/dist/esnext/components/ModelViewer/index.js +1 -1
- package/dist/esnext/components/Money/Money.client.d.ts +1 -1
- package/dist/esnext/components/Money/Money.client.js +1 -1
- package/dist/esnext/components/Money/index.d.ts +1 -1
- package/dist/esnext/components/Money/index.js +1 -1
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +1 -1
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.js +3 -3
- package/dist/esnext/components/ProductOptionsProvider/context.d.ts +1 -1
- package/dist/esnext/components/ProductOptionsProvider/index.d.ts +1 -1
- package/dist/esnext/components/ProductOptionsProvider/index.js +1 -1
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +2 -2
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +2 -2
- package/dist/esnext/components/ProductPrice/index.d.ts +1 -1
- package/dist/esnext/components/ProductPrice/index.js +1 -1
- package/dist/esnext/components/Seo/CollectionSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/CollectionSeo.client.js +4 -4
- package/dist/esnext/components/Seo/DefaultPageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/DefaultPageSeo.client.js +5 -5
- package/dist/esnext/components/Seo/DescriptionSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/DescriptionSeo.client.js +1 -1
- package/dist/esnext/components/Seo/HomePageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/HomePageSeo.client.js +3 -3
- package/dist/esnext/components/Seo/ImageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/ImageSeo.client.js +1 -1
- package/dist/esnext/components/Seo/NoIndexSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/NoIndexSeo.client.js +2 -2
- package/dist/esnext/components/Seo/PageSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/PageSeo.client.js +3 -3
- package/dist/esnext/components/Seo/ProductSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/ProductSeo.client.js +6 -6
- package/dist/esnext/components/Seo/Seo.client.d.ts +4 -4
- package/dist/esnext/components/Seo/Seo.client.js +7 -7
- package/dist/esnext/components/Seo/TitleSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/TitleSeo.client.js +1 -1
- package/dist/esnext/components/Seo/TwitterSeo.client.d.ts +1 -1
- package/dist/esnext/components/Seo/TwitterSeo.client.js +1 -1
- package/dist/esnext/components/Seo/index.d.ts +1 -1
- package/dist/esnext/components/Seo/index.js +1 -1
- package/dist/esnext/components/Seo/seo-types.d.ts +1 -1
- package/dist/esnext/components/ShopPayButton/ShopPayButton.client.js +2 -2
- package/dist/esnext/components/ShopPayButton/index.d.ts +1 -1
- package/dist/esnext/components/ShopPayButton/index.js +1 -1
- package/dist/esnext/components/Video/Video.d.ts +7 -2
- package/dist/esnext/components/Video/Video.js +3 -3
- package/dist/esnext/components/Video/index.d.ts +1 -1
- package/dist/esnext/components/Video/index.js +1 -1
- package/dist/esnext/components/index.d.ts +27 -27
- package/dist/esnext/components/index.js +25 -25
- package/dist/esnext/config.d.ts +5 -5
- package/dist/esnext/config.js +4 -4
- package/dist/esnext/constants.d.ts +1 -0
- package/dist/esnext/constants.js +1 -0
- package/dist/esnext/entry-client.d.ts +1 -1
- package/dist/esnext/entry-client.js +35 -14
- package/dist/esnext/entry-server.d.ts +1 -1
- package/dist/esnext/entry-server.js +86 -60
- package/dist/esnext/experimental.d.ts +2 -0
- package/dist/esnext/experimental.js +2 -0
- package/dist/esnext/foundation/Analytics/Analytics.client.js +1 -1
- package/dist/esnext/foundation/Analytics/Analytics.server.js +5 -5
- package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +1 -1
- package/dist/esnext/foundation/Analytics/ClientAnalytics.js +4 -4
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.d.ts +1 -1
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.js +1 -1
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +7 -5
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +1 -1
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.js +1 -1
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.js +1 -1
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +3 -3
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +9 -9
- package/dist/esnext/foundation/Analytics/hook.js +2 -2
- package/dist/esnext/foundation/Analytics/index.d.ts +1 -1
- package/dist/esnext/foundation/Analytics/index.js +1 -1
- package/dist/esnext/foundation/Analytics/utils.js +1 -1
- package/dist/esnext/foundation/BuiltInRoutes/BuiltInRoutes.d.ts +1 -1
- package/dist/esnext/foundation/BuiltInRoutes/BuiltInRoutes.js +3 -3
- package/dist/esnext/foundation/Cache/cache-sub-request.d.ts +1 -1
- package/dist/esnext/foundation/Cache/cache-sub-request.js +4 -4
- package/dist/esnext/foundation/Cache/cache.d.ts +1 -1
- package/dist/esnext/foundation/Cache/cache.js +3 -4
- package/dist/esnext/foundation/Cache/strategies/index.d.ts +1 -1
- package/dist/esnext/foundation/Cookie/Cookie.js +2 -2
- package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.d.ts +2 -2
- package/dist/esnext/foundation/CookieSessionStorage/CookieSessionStorage.js +2 -1
- package/dist/esnext/foundation/DevTools/DevTools.client.js +1 -1
- package/dist/esnext/foundation/DevTools/DevTools.server.js +4 -3
- package/dist/esnext/foundation/DevTools/components/Heading.js +1 -1
- package/dist/esnext/foundation/DevTools/components/Interface.client.js +1 -1
- package/dist/esnext/foundation/DevTools/components/Panels.d.ts +2 -2
- package/dist/esnext/foundation/DevTools/components/Panels.js +28 -22
- package/dist/esnext/foundation/DevTools/components/Performance.client.js +1 -2
- package/dist/esnext/foundation/DevTools/components/Settings.client.d.ts +2 -1
- package/dist/esnext/foundation/DevTools/components/Settings.client.js +2 -5
- package/dist/esnext/foundation/DevTools/components/Table.js +3 -3
- package/dist/esnext/foundation/DevTools/components/index.d.ts +2 -2
- package/dist/esnext/foundation/DevTools/components/index.js +2 -2
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.d.ts +1 -1
- package/dist/esnext/foundation/FileRoutes/FileRoutes.server.js +5 -5
- package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.d.ts +3 -3
- package/dist/esnext/foundation/FileSessionStorage/FileSessionStorage.js +2 -2
- package/dist/esnext/foundation/Form/Form.client.d.ts +11 -0
- package/dist/esnext/foundation/Form/Form.client.js +51 -0
- package/dist/esnext/foundation/Head/Head.client.js +1 -1
- package/dist/esnext/foundation/Head/index.d.ts +1 -1
- package/dist/esnext/foundation/Head/index.js +1 -1
- package/dist/esnext/foundation/Html/Html.d.ts +1 -1
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts +6 -5
- package/dist/esnext/foundation/HydrogenRequest/HydrogenRequest.server.js +6 -7
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +2 -4
- package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.js +4 -18
- package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.d.ts +2 -2
- package/dist/esnext/foundation/MemorySessionStorage/MemorySessionStorage.js +1 -1
- package/dist/esnext/foundation/Redirect/Redirect.client.js +1 -1
- package/dist/esnext/foundation/Route/Route.server.js +3 -3
- package/dist/esnext/foundation/Router/BrowserRouter.client.js +2 -2
- package/dist/esnext/foundation/Router/Router.server.js +1 -1
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +3 -1
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +7 -7
- package/dist/esnext/foundation/ServerPropsProvider/index.d.ts +1 -1
- package/dist/esnext/foundation/ServerPropsProvider/index.js +1 -1
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +2 -2
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +3 -3
- package/dist/esnext/foundation/ServerRequestProvider/index.d.ts +1 -1
- package/dist/esnext/foundation/ServerRequestProvider/index.js +1 -1
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +1 -1
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.d.ts +2 -2
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +7 -6
- package/dist/esnext/foundation/ShopifyProvider/index.d.ts +1 -1
- package/dist/esnext/foundation/ShopifyProvider/index.js +1 -1
- package/dist/esnext/foundation/ShopifyProvider/types.d.ts +4 -3
- package/dist/esnext/foundation/fetchSync/ResponseSync.d.ts +14 -0
- package/dist/esnext/foundation/fetchSync/ResponseSync.js +38 -0
- package/dist/esnext/foundation/fetchSync/client/fetchSync.d.ts +2 -2
- package/dist/esnext/foundation/fetchSync/client/fetchSync.js +5 -10
- package/dist/esnext/foundation/fetchSync/server/fetchSync.d.ts +3 -3
- package/dist/esnext/foundation/fetchSync/server/fetchSync.js +7 -13
- package/dist/esnext/foundation/index.d.ts +3 -3
- package/dist/esnext/foundation/index.js +3 -3
- package/dist/esnext/foundation/session/session-types.d.ts +15 -0
- package/dist/esnext/foundation/{fetchSync/types.js → session/session-types.js} +0 -0
- package/dist/esnext/foundation/session/session.d.ts +7 -16
- package/dist/esnext/foundation/session/session.js +17 -1
- package/dist/esnext/foundation/ssr-interop.d.ts +2 -2
- package/dist/esnext/foundation/ssr-interop.js +2 -2
- package/dist/esnext/foundation/useNavigate/useNavigate.js +2 -2
- package/dist/esnext/foundation/useQuery/hooks.d.ts +4 -1
- package/dist/esnext/foundation/useQuery/hooks.js +5 -5
- package/dist/esnext/foundation/useQuery/index.d.ts +1 -1
- package/dist/esnext/foundation/useQuery/index.js +1 -1
- package/dist/esnext/foundation/useRequestContext/index.js +1 -1
- package/dist/esnext/foundation/useRouteParams/useRouteParams.js +2 -2
- package/dist/esnext/foundation/useServerProps/index.d.ts +1 -1
- package/dist/esnext/foundation/useServerProps/index.js +1 -1
- package/dist/esnext/foundation/useServerProps/use-server-props.d.ts +1 -1
- package/dist/esnext/foundation/useServerProps/use-server-props.js +1 -1
- package/dist/esnext/foundation/useSession/useSession.d.ts +1 -0
- package/dist/esnext/foundation/useSession/useSession.js +14 -1
- package/dist/esnext/foundation/useShop/index.d.ts +1 -1
- package/dist/esnext/foundation/useShop/index.js +1 -1
- package/dist/esnext/foundation/useShop/use-shop.d.ts +1 -1
- package/dist/esnext/foundation/useShop/use-shop.js +2 -2
- package/dist/esnext/foundation/useUrl/index.d.ts +1 -1
- package/dist/esnext/foundation/useUrl/index.js +1 -1
- package/dist/esnext/foundation/useUrl/useUrl.js +4 -4
- package/dist/esnext/framework/graphiql.js +26 -30
- package/dist/esnext/framework/load-config.js +2 -2
- package/dist/esnext/framework/middleware.d.ts +1 -1
- package/dist/esnext/framework/middleware.js +2 -2
- package/dist/esnext/framework/plugin.d.ts +1 -1
- package/dist/esnext/framework/plugin.js +17 -15
- package/dist/esnext/framework/plugins/vite-plugin-assets-version.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-assets-version.js +8 -0
- package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-css-rsc.d.ts +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-css-rsc.js +108 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.d.ts +2 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +8 -4
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +3 -3
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +2 -2
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +35 -7
- package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +36 -7
- package/dist/esnext/framework/types.d.ts +14 -0
- package/dist/esnext/hooks/index.d.ts +6 -6
- package/dist/esnext/hooks/index.js +6 -6
- package/dist/esnext/hooks/useCart/index.d.ts +1 -1
- package/dist/esnext/hooks/useCart/index.js +1 -1
- package/dist/esnext/hooks/useCart/useCart.d.ts +1 -1
- package/dist/esnext/hooks/useCart/useCart.js +1 -1
- package/dist/esnext/hooks/useCartLine/index.d.ts +1 -1
- package/dist/esnext/hooks/useCartLine/index.js +1 -1
- package/dist/esnext/hooks/useCartLine/useCartLine.d.ts +13 -13
- package/dist/esnext/hooks/useCartLine/useCartLine.js +1 -1
- package/dist/esnext/hooks/useLoadScript/index.d.ts +1 -1
- package/dist/esnext/hooks/useLoadScript/index.js +1 -1
- package/dist/esnext/hooks/useLoadScript/useLoadScript.client.d.ts +1 -1
- package/dist/esnext/hooks/useLoadScript/useLoadScript.client.js +1 -1
- package/dist/esnext/hooks/useLocalization/useLocalization.d.ts +2 -3
- package/dist/esnext/hooks/useLocalization/useLocalization.js +2 -2
- package/dist/esnext/hooks/useMeasurement/hooks.d.ts +1 -1
- package/dist/esnext/hooks/useMeasurement/hooks.js +2 -2
- package/dist/esnext/hooks/useMeasurement/index.d.ts +1 -1
- package/dist/esnext/hooks/useMeasurement/index.js +1 -1
- package/dist/esnext/hooks/useMoney/hooks.d.ts +1 -1
- package/dist/esnext/hooks/useMoney/hooks.js +1 -1
- package/dist/esnext/hooks/useMoney/index.d.ts +1 -1
- package/dist/esnext/hooks/useMoney/index.js +1 -1
- package/dist/esnext/hooks/useProductOptions/helpers.d.ts +2 -2
- package/dist/esnext/hooks/useProductOptions/index.d.ts +2 -2
- package/dist/esnext/hooks/useProductOptions/index.js +2 -2
- package/dist/esnext/hooks/useProductOptions/types.d.ts +1 -1
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +1 -1
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +1 -1
- package/dist/esnext/hooks/useShopQuery/hooks.d.ts +1 -1
- package/dist/esnext/hooks/useShopQuery/hooks.js +25 -17
- package/dist/esnext/hooks/useShopQuery/index.d.ts +1 -1
- package/dist/esnext/hooks/useShopQuery/index.js +1 -1
- package/dist/esnext/index.d.ts +26 -26
- package/dist/esnext/index.js +22 -22
- package/dist/esnext/node.d.ts +1 -1
- package/dist/esnext/node.js +1 -1
- package/dist/esnext/platforms/index.d.ts +1 -0
- package/dist/esnext/platforms/index.js +1 -0
- package/dist/esnext/platforms/node.d.ts +1 -1
- package/dist/esnext/platforms/node.js +5 -11
- package/dist/esnext/platforms/virtual.d.ts +8 -0
- package/dist/esnext/platforms/virtual.js +12 -0
- package/dist/esnext/platforms/worker-event.js +1 -1
- package/dist/esnext/platforms/worker.js +7 -7
- package/dist/esnext/shared-types.d.ts +3 -0
- package/dist/esnext/types.d.ts +8 -7
- package/dist/esnext/types.js +1 -1
- package/dist/esnext/utilities/apiRoutes.d.ts +4 -4
- package/dist/esnext/utilities/apiRoutes.js +51 -6
- package/dist/esnext/utilities/error.js +1 -1
- package/dist/esnext/utilities/fetch.js +1 -1
- package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +1 -1
- package/dist/esnext/utilities/flattenConnection/index.d.ts +1 -1
- package/dist/esnext/utilities/flattenConnection/index.js +1 -1
- package/dist/esnext/utilities/hash.d.ts +1 -1
- package/dist/esnext/utilities/hash.js +1 -1
- package/dist/esnext/utilities/image_size.d.ts +1 -1
- package/dist/esnext/utilities/index.d.ts +12 -12
- package/dist/esnext/utilities/index.js +12 -12
- package/dist/esnext/utilities/isBrowser/index.d.ts +1 -1
- package/dist/esnext/utilities/isBrowser/index.js +1 -1
- package/dist/esnext/utilities/isServer/index.d.ts +1 -1
- package/dist/esnext/utilities/isServer/index.js +1 -1
- package/dist/esnext/utilities/isServer/isServer.js +1 -1
- package/dist/esnext/utilities/load_script.d.ts +1 -0
- package/dist/esnext/utilities/load_script.js +6 -1
- package/dist/esnext/utilities/locale/index.d.ts +1 -0
- package/dist/esnext/utilities/locale/index.js +1 -0
- package/dist/esnext/utilities/locale/locale.d.ts +7 -0
- package/dist/esnext/utilities/locale/locale.js +22 -0
- package/dist/esnext/utilities/log/index.d.ts +4 -4
- package/dist/esnext/utilities/log/index.js +4 -4
- package/dist/esnext/utilities/log/log-cache-api-status.js +1 -1
- package/dist/esnext/utilities/log/log-cache-header.d.ts +4 -4
- package/dist/esnext/utilities/log/log-cache-header.js +3 -3
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +3 -3
- package/dist/esnext/utilities/log/log-query-timeline.js +13 -10
- package/dist/esnext/utilities/log/log.d.ts +1 -1
- package/dist/esnext/utilities/log/log.js +2 -2
- package/dist/esnext/utilities/log/utils.d.ts +1 -1
- package/dist/esnext/utilities/log/utils.js +1 -1
- package/dist/esnext/utilities/measurement.d.ts +1 -1
- package/dist/esnext/utilities/parseMetafield/index.d.ts +1 -1
- package/dist/esnext/utilities/parseMetafield/index.js +1 -1
- package/dist/esnext/utilities/parseMetafield/parseMetafield.d.ts +2 -2
- package/dist/esnext/utilities/parseMetafield/parseMetafield.js +1 -1
- package/dist/esnext/utilities/storefrontApi.js +1 -1
- package/dist/esnext/utilities/suspense.d.ts +1 -1
- package/dist/esnext/utilities/suspense.js +1 -1
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/foundation/session/session-types.d.ts +15 -0
- package/dist/node/foundation/session/session-types.js +2 -0
- package/dist/node/framework/graphiql.js +26 -30
- package/dist/node/framework/load-config.js +3 -3
- package/dist/node/framework/middleware.d.ts +1 -1
- package/dist/node/framework/middleware.js +3 -3
- package/dist/node/framework/plugin.d.ts +1 -1
- package/dist/node/framework/plugin.js +26 -24
- package/dist/node/framework/plugins/vite-plugin-assets-version.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-assets-version.js +11 -0
- package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +3 -3
- package/dist/node/framework/plugins/vite-plugin-css-rsc.d.ts +2 -0
- package/dist/node/framework/plugins/vite-plugin-css-rsc.js +114 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.d.ts +2 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +11 -4
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.d.ts +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +7 -7
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.d.ts +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +5 -5
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.d.ts +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +35 -7
- package/dist/node/framework/plugins/vite-plugin-platform-entry.js +36 -7
- package/dist/node/framework/types.d.ts +14 -0
- package/dist/node/shared-types.d.ts +3 -0
- package/package.json +20 -3
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +36 -14
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +36 -14
- package/dist/esnext/foundation/fetchSync/types.d.ts +0 -5
- package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.d.ts +0 -3
- package/dist/esnext/framework/plugins/vite-plugin-purge-query-cache.js +0 -11
- package/dist/node/framework/plugins/vite-plugin-purge-query-cache.d.ts +0 -3
- package/dist/node/framework/plugins/vite-plugin-purge-query-cache.js +0 -16
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { ClientAnalytics } from '../../Analytics';
|
|
3
|
-
import { Performance } from './Performance.client';
|
|
4
|
-
import { Settings } from './Settings.client';
|
|
2
|
+
import { ClientAnalytics } from '../../Analytics/index.js';
|
|
3
|
+
import { Performance } from './Performance.client.js';
|
|
4
|
+
import { Settings } from './Settings.client.js';
|
|
5
|
+
const isComponentPanel = (panel) => panel.component !== undefined;
|
|
5
6
|
export function Panels({ settings }) {
|
|
6
7
|
const [selectedPanel, setSelectedPanel] = useState(0);
|
|
7
8
|
const [navigations, setNavigations] = useState([]);
|
|
@@ -22,36 +23,41 @@ export function Panels({ settings }) {
|
|
|
22
23
|
});
|
|
23
24
|
}, [setNavigations, navigations]);
|
|
24
25
|
const panels = getPanels({ settings, performance: { navigations } });
|
|
25
|
-
const panelComponents = panels.map((obj, index) => (React.createElement("div", { key: obj.content, style: { display: selectedPanel === index ? 'block' : 'none' } }, obj.
|
|
26
|
+
const panelComponents = panels.map((obj, index) => isComponentPanel(obj) ? (React.createElement("div", { key: obj.content, style: { display: selectedPanel === index ? 'block' : 'none' } }, obj.component)) : null);
|
|
26
27
|
return (React.createElement("div", { style: { display: 'flex', height: '100%' } },
|
|
27
|
-
React.createElement("div", { style: { borderRight: '1px solid', padding: '1em 0em' } }, panels.map((
|
|
28
|
+
React.createElement("div", { style: { borderRight: '1px solid', padding: '1em 0em' } }, panels.map((panel, index) => {
|
|
28
29
|
const active = selectedPanel === index;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
const style = {
|
|
31
|
+
padding: '0em 1.25em',
|
|
32
|
+
fontWeight: 'bold',
|
|
33
|
+
textDecoration: active ? 'underline' : 'none',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
justifyContent: 'space-between',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
};
|
|
38
|
+
if (isComponentPanel(panel)) {
|
|
39
|
+
return (React.createElement("button", { key: panel.id, type: "button", style: style, onClick: () => setSelectedPanel(index) },
|
|
40
|
+
React.createElement("span", null, panel.content)));
|
|
41
|
+
}
|
|
42
|
+
return (React.createElement("a", { style: style, target: "_blank", rel: "noreferrer", href: panel.url, key: panel.url },
|
|
43
|
+
panel.content,
|
|
44
|
+
React.createElement("span", null, "\u2197")));
|
|
38
45
|
})),
|
|
39
|
-
React.createElement("div", { style: { padding: '
|
|
40
|
-
}
|
|
41
|
-
function Panel({ children }) {
|
|
42
|
-
return React.createElement("div", null, children);
|
|
46
|
+
React.createElement("div", { style: { padding: '1em', width: '100%' } }, panelComponents[selectedPanel ? selectedPanel : 0])));
|
|
43
47
|
}
|
|
44
48
|
function getPanels({ settings, performance }) {
|
|
45
49
|
const panels = {
|
|
46
50
|
settings: {
|
|
47
51
|
content: 'Settings',
|
|
48
|
-
|
|
49
|
-
icon: '🎛',
|
|
52
|
+
component: React.createElement(Settings, { ...settings }),
|
|
50
53
|
},
|
|
51
54
|
performance: {
|
|
52
55
|
content: 'Performance',
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
component: React.createElement(Performance, { ...performance }),
|
|
57
|
+
},
|
|
58
|
+
graphiql: {
|
|
59
|
+
content: 'GraphiQL',
|
|
60
|
+
url: '/___graphql',
|
|
55
61
|
},
|
|
56
62
|
};
|
|
57
63
|
return Object.keys(panels).map((key) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Heading } from './Heading';
|
|
2
|
+
import { Heading } from './Heading.js';
|
|
3
3
|
export function Performance({ navigations }) {
|
|
4
4
|
const navigationsMarkup = navigations.map(({ url, ttfb, fcp, size, duration, type }) => (React.createElement("li", { key: url, style: { padding: '0.5em 0', borderBottom: '1px solid' } },
|
|
5
5
|
React.createElement(Item, { label: type, value: url.replace('http://localhost:3000', '') }),
|
|
@@ -19,7 +19,6 @@ const Item = ({ label, value, unit }) => {
|
|
|
19
19
|
return (React.createElement("span", { style: {
|
|
20
20
|
fontFamily: 'monospace',
|
|
21
21
|
padding: '0 2em 0 0',
|
|
22
|
-
fontSize: '0.75em',
|
|
23
22
|
} },
|
|
24
23
|
label && label.padEnd(10),
|
|
25
24
|
val));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Table } from './Table';
|
|
2
|
+
import { Table } from './Table.js';
|
|
4
3
|
const KEY_MAP = {
|
|
5
4
|
locale: 'Locale',
|
|
6
5
|
storeDomain: 'Domain',
|
|
@@ -14,7 +13,5 @@ export function Settings(props) {
|
|
|
14
13
|
type: typeof value,
|
|
15
14
|
};
|
|
16
15
|
});
|
|
17
|
-
return
|
|
18
|
-
React.createElement(Heading, null, "Config"),
|
|
19
|
-
React.createElement(Table, { items: items })));
|
|
16
|
+
return React.createElement(Table, { items: items });
|
|
20
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export function Table({ items }) {
|
|
3
|
-
const itemsMarkup = items.map(({ key, value }) => (React.createElement("div", { key: key, style: { display: 'flex' } },
|
|
4
|
-
React.createElement("span", { style: {
|
|
5
|
-
React.createElement("span", { style: { width: '70%', fontFamily: 'monospace'
|
|
3
|
+
const itemsMarkup = items.map(({ key, value }) => (React.createElement("div", { key: key, style: { display: 'flex', paddingBottom: '1em', flexDirection: 'column' } },
|
|
4
|
+
React.createElement("span", { style: { fontWeight: 'bold' } }, key),
|
|
5
|
+
React.createElement("span", { style: { width: '70%', fontFamily: 'monospace' } }, value))));
|
|
6
6
|
return React.createElement("ul", null, itemsMarkup);
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Interface } from './Interface.client';
|
|
2
|
-
export { Panels } from './Panels';
|
|
1
|
+
export { Interface } from './Interface.client.js';
|
|
2
|
+
export { Panels } from './Panels.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Interface } from './Interface.client';
|
|
2
|
-
export { Panels } from './Panels';
|
|
1
|
+
export { Interface } from './Interface.client.js';
|
|
2
|
+
export { Panels } from './Panels.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImportGlobEagerOutput } from '../../types';
|
|
1
|
+
import type { ImportGlobEagerOutput } from '../../types.js';
|
|
2
2
|
interface FileRoutesProps {
|
|
3
3
|
/** The routes defined by Vite's [import.meta.globEager](https://vitejs.dev/guide/features.html#glob-import) method. */
|
|
4
4
|
routes?: ImportGlobEagerOutput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { matchPath } from '../../utilities/matchPath';
|
|
3
|
-
import { log } from '../../utilities/log';
|
|
4
|
-
import { extractPathFromRoutesKey } from '../../utilities/apiRoutes';
|
|
5
|
-
import { useServerRequest } from '../ServerRequestProvider';
|
|
6
|
-
import { RouteParamsProvider } from '../useRouteParams/RouteParamsProvider.client';
|
|
2
|
+
import { matchPath } from '../../utilities/matchPath.js';
|
|
3
|
+
import { log } from '../../utilities/log/index.js';
|
|
4
|
+
import { extractPathFromRoutesKey } from '../../utilities/apiRoutes.js';
|
|
5
|
+
import { useServerRequest } from '../ServerRequestProvider/index.js';
|
|
6
|
+
import { RouteParamsProvider } from '../useRouteParams/RouteParamsProvider.client.js';
|
|
7
7
|
/**
|
|
8
8
|
* The `FileRoutes` component builds a set of default Hydrogen routes based on the output provided by Vite's
|
|
9
9
|
* [import.meta.globEager](https://vitejs.dev/guide/features.html#glob-import) method. You can have multiple
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { SessionStorageAdapter } from '../session/session';
|
|
2
|
-
import type { CookieOptions } from '../Cookie/Cookie';
|
|
3
|
-
import { Logger } from '../../utilities/log';
|
|
1
|
+
import type { SessionStorageAdapter } from '../session/session-types.js';
|
|
2
|
+
import type { CookieOptions } from '../Cookie/Cookie.js';
|
|
3
|
+
import { Logger } from '../../utilities/log/index.js';
|
|
4
4
|
/** The `FileSessionStorage` component persists session data to the file system.
|
|
5
5
|
*/
|
|
6
6
|
export declare const FileSessionStorage: (name: string, dir: string, cookieOptions: CookieOptions) => (log: Logger) => SessionStorageAdapter;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Cookie } from '../Cookie/Cookie';
|
|
1
|
+
import { Cookie } from '../Cookie/Cookie.js';
|
|
2
2
|
import { v4 as uid } from 'uuid';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { promises as fsp } from 'fs';
|
|
5
|
-
import { parseJSON } from '../../utilities/parse';
|
|
5
|
+
import { parseJSON } from '../../utilities/parse.js';
|
|
6
6
|
async function wait() {
|
|
7
7
|
return new Promise((resolve) => setTimeout(resolve));
|
|
8
8
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { FormEvent } from 'react';
|
|
2
|
+
interface FormProps {
|
|
3
|
+
action: string;
|
|
4
|
+
method?: string;
|
|
5
|
+
children?: Array<React.ReactNode>;
|
|
6
|
+
onSubmit?: (e: FormEvent<HTMLFormElement>) => void;
|
|
7
|
+
encType?: string;
|
|
8
|
+
noValidate?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function Form({ action, method, children, onSubmit, encType, noValidate, ...props }: FormProps): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import { createFromFetch } from '@shopify/hydrogen/vendor/react-server-dom-vite';
|
|
4
|
+
import { useInternalServerProps } from '../useServerProps/use-server-props.js';
|
|
5
|
+
export function Form({ action, method, children, onSubmit, encType = 'application/x-www-form-urlencoded', noValidate, ...props }) {
|
|
6
|
+
const { setRscResponseFromApiRoute } = useInternalServerProps();
|
|
7
|
+
const [_, startTransition] = React.useTransition();
|
|
8
|
+
const [loading, setLoading] = useState(false);
|
|
9
|
+
const [error, setError] = useState(null);
|
|
10
|
+
const submit = useCallback(async (e) => {
|
|
11
|
+
onSubmit && onSubmit(e);
|
|
12
|
+
if (e.defaultPrevented)
|
|
13
|
+
return;
|
|
14
|
+
setLoading(true);
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
const formData = new FormData(e.target);
|
|
17
|
+
// @ts-expect-error
|
|
18
|
+
// It's valid to pass a FormData instance to a URLSearchParams constructor
|
|
19
|
+
// @todo - support multipart forms
|
|
20
|
+
const formBody = new URLSearchParams(formData);
|
|
21
|
+
startTransition(() => {
|
|
22
|
+
fetch(action, {
|
|
23
|
+
method,
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
|
26
|
+
'Hydrogen-Client': 'Form-Action',
|
|
27
|
+
},
|
|
28
|
+
body: formBody.toString(),
|
|
29
|
+
})
|
|
30
|
+
.then((fetchResponse) => {
|
|
31
|
+
const rscPathname = fetchResponse.headers.get('Hydrogen-RSC-Pathname');
|
|
32
|
+
if (!rscPathname)
|
|
33
|
+
throw new Error(`The component's \`action\` attribute must point to an API route that responds with a new Request()\nRead more at https://shopify.dev/custom-storefronts/hydrogen/framework/forms`);
|
|
34
|
+
if (rscPathname !== window.location.pathname) {
|
|
35
|
+
window.history.pushState(null, '', rscPathname);
|
|
36
|
+
}
|
|
37
|
+
const rscResponse = createFromFetch(Promise.resolve(fetchResponse));
|
|
38
|
+
setRscResponseFromApiRoute({
|
|
39
|
+
url: method + action,
|
|
40
|
+
response: rscResponse,
|
|
41
|
+
});
|
|
42
|
+
setLoading(false);
|
|
43
|
+
})
|
|
44
|
+
.catch((error) => {
|
|
45
|
+
setError(error);
|
|
46
|
+
setLoading(false);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}, [onSubmit, startTransition, action, method, setRscResponseFromApiRoute]);
|
|
50
|
+
return (React.createElement("form", { action: action, method: method, onSubmit: submit, encType: "application/x-www-form-urlencoded", noValidate: noValidate, ...props }, children instanceof Function ? children({ loading, error }) : children));
|
|
51
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Helmet, HelmetData as HeadData, } from 'react-helmet-async';
|
|
3
|
-
import { useEnvContext } from '../ssr-interop';
|
|
3
|
+
import { useEnvContext } from '../ssr-interop.js';
|
|
4
4
|
const clientHeadData = new HeadData({});
|
|
5
5
|
export function Head({ children, ...props }) {
|
|
6
6
|
const headData = useEnvContext((req) => req.ctx.head, clientHeadData);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Head } from './Head.client';
|
|
1
|
+
export { Head } from './Head.client.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Head } from './Head.client';
|
|
1
|
+
export { Head } from './Head.client.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import type { HelmetData as HeadData } from 'react-helmet-async';
|
|
3
|
-
import { ResolvedHydrogenConfig } from '../../types';
|
|
3
|
+
import { ResolvedHydrogenConfig } from '../../types.js';
|
|
4
4
|
declare type HtmlOptions = {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
template: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ShopifyContextValue, LocalizationContextValue } from '../ShopifyProvider/types';
|
|
2
|
-
import type { QueryCacheControlHeaders } from '../../utilities/log/log-cache-header';
|
|
3
|
-
import type { QueryTiming } from '../../utilities/log/log-query-timeline';
|
|
4
|
-
import type { ResolvedHydrogenConfig, PreloadOptions, QueryKey, RuntimeContext } from '../../types';
|
|
1
|
+
import type { ShopifyContextValue, LocalizationContextValue } from '../ShopifyProvider/types.js';
|
|
2
|
+
import type { QueryCacheControlHeaders } from '../../utilities/log/log-cache-header.js';
|
|
3
|
+
import type { QueryTiming } from '../../utilities/log/log-query-timeline.js';
|
|
4
|
+
import type { ResolvedHydrogenConfig, PreloadOptions, QueryKey, RuntimeContext } from '../../types.js';
|
|
5
5
|
import { HelmetData as HeadData } from 'react-helmet-async';
|
|
6
|
-
import { SessionSyncApi } from '../session/session';
|
|
6
|
+
import type { SessionSyncApi } from '../session/session-types.js';
|
|
7
7
|
export declare type PreloadQueryEntry = {
|
|
8
8
|
key: QueryKey;
|
|
9
9
|
fetcher: (request: HydrogenRequest) => Promise<unknown>;
|
|
@@ -46,6 +46,7 @@ export declare class HydrogenRequest extends Request {
|
|
|
46
46
|
router: RouterContextData;
|
|
47
47
|
buyerIpHeader?: string;
|
|
48
48
|
session?: SessionSyncApi;
|
|
49
|
+
flashSession: Record<string, any>;
|
|
49
50
|
runtime?: RuntimeContext;
|
|
50
51
|
scopes: Map<string, Record<string, any>>;
|
|
51
52
|
localization?: LocalizationContextValue;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getTime } from '../../utilities/timing';
|
|
2
|
-
import { hashKey } from '../../utilities/hash';
|
|
1
|
+
import { getTime } from '../../utilities/timing.js';
|
|
2
|
+
import { hashKey } from '../../utilities/hash.js';
|
|
3
3
|
import { HelmetData as HeadData } from 'react-helmet-async';
|
|
4
|
-
import { RSC_PATHNAME } from '../../constants';
|
|
5
|
-
import { parseJSON } from '../../utilities/parse';
|
|
4
|
+
import { RSC_PATHNAME } from '../../constants.js';
|
|
5
|
+
import { parseJSON } from '../../utilities/parse.js';
|
|
6
6
|
let reqCounter = 0; // For debugging
|
|
7
7
|
const generateId = typeof crypto !== 'undefined' &&
|
|
8
8
|
// @ts-ignore
|
|
@@ -43,9 +43,7 @@ export class HydrogenRequest extends Request {
|
|
|
43
43
|
}
|
|
44
44
|
this.time = getTime();
|
|
45
45
|
this.id = generateId();
|
|
46
|
-
this.normalizedUrl = this.isRscRequest()
|
|
47
|
-
? normalizeUrl(this.url)
|
|
48
|
-
: this.url;
|
|
46
|
+
this.normalizedUrl = decodeURIComponent(this.isRscRequest() ? normalizeUrl(this.url) : this.url);
|
|
49
47
|
this.ctx = {
|
|
50
48
|
cache: new Map(),
|
|
51
49
|
head: new HeadData({}),
|
|
@@ -62,6 +60,7 @@ export class HydrogenRequest extends Request {
|
|
|
62
60
|
},
|
|
63
61
|
preloadQueries: new Map(),
|
|
64
62
|
scopes: new Map(),
|
|
63
|
+
flashSession: {},
|
|
65
64
|
};
|
|
66
65
|
this.cookies = this.parseCookies();
|
|
67
66
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import type { CachingStrategy } from '../../types';
|
|
1
|
+
import type { CachingStrategy } from '../../types.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export declare class HydrogenResponse extends Response {
|
|
4
4
|
private wait;
|
|
5
5
|
private cacheOptions;
|
|
6
|
-
private proxy;
|
|
7
6
|
status: number;
|
|
8
7
|
statusText: string;
|
|
9
|
-
constructor(...args: ConstructorParameters<typeof Response>);
|
|
10
8
|
/**
|
|
11
9
|
* Buffer the current response until all queries have resolved,
|
|
12
10
|
* and prevent it from streaming back early.
|
|
13
11
|
*/
|
|
14
12
|
doNotStream(): void;
|
|
15
13
|
canStream(): boolean;
|
|
16
|
-
cache(options?: CachingStrategy): import("../../types").AllCacheOptions;
|
|
14
|
+
cache(options?: CachingStrategy): import("../../types.js").AllCacheOptions;
|
|
17
15
|
get cacheControlHeader(): string;
|
|
18
16
|
redirect(location: string, status?: number): React.FunctionComponentElement<{
|
|
19
17
|
to: string;
|
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
import { CacheShort, generateCacheControlHeader } from '../Cache/strategies';
|
|
2
|
-
import Redirect from '../Redirect/Redirect.client';
|
|
1
|
+
import { CacheShort, generateCacheControlHeader, } from '../Cache/strategies/index.js';
|
|
2
|
+
import Redirect from '../Redirect/Redirect.client.js';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export class HydrogenResponse extends Response {
|
|
5
5
|
wait = false;
|
|
6
6
|
cacheOptions = CacheShort();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
status: { value: 200, writable: true },
|
|
10
|
-
statusText: { value: '', writable: true },
|
|
11
|
-
});
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
status;
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
statusText;
|
|
16
|
-
constructor(...args) {
|
|
17
|
-
super(...args);
|
|
18
|
-
return new Proxy(this, {
|
|
19
|
-
get: (target, key) => target.proxy[key] ?? Reflect.get(target, key),
|
|
20
|
-
set: (target, key, value) => Reflect.set(key in target.proxy ? target.proxy : target, key, value),
|
|
21
|
-
});
|
|
22
|
-
}
|
|
7
|
+
status = 200;
|
|
8
|
+
statusText = '';
|
|
23
9
|
/**
|
|
24
10
|
* Buffer the current response until all queries have resolved,
|
|
25
11
|
* and prevent it from streaming back early.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SessionStorageAdapter } from '../session/session';
|
|
2
|
-
import type { CookieOptions } from '../Cookie/Cookie';
|
|
1
|
+
import type { SessionStorageAdapter } from '../session/session-types.js';
|
|
2
|
+
import type { CookieOptions } from '../Cookie/Cookie.js';
|
|
3
3
|
/** The `MemorySessionStorage` component stores session data within Hydrogen runtime memory.
|
|
4
4
|
*/
|
|
5
5
|
export declare const MemorySessionStorage: (name: string, options: CookieOptions) => () => SessionStorageAdapter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import { useNavigate } from '../../foundation/useNavigate/useNavigate';
|
|
2
|
+
import { useNavigate } from '../../foundation/useNavigate/useNavigate.js';
|
|
3
3
|
export default function Redirect({ to }) {
|
|
4
4
|
const navigate = useNavigate();
|
|
5
5
|
useEffect(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { cloneElement } from 'react';
|
|
2
|
-
import { useServerRequest } from '../ServerRequestProvider';
|
|
3
|
-
import { matchPath } from '../../utilities/matchPath';
|
|
4
|
-
import { RouteParamsProvider } from '../useRouteParams/RouteParamsProvider.client';
|
|
2
|
+
import { useServerRequest } from '../ServerRequestProvider/index.js';
|
|
3
|
+
import { matchPath } from '../../utilities/matchPath.js';
|
|
4
|
+
import { RouteParamsProvider } from '../useRouteParams/RouteParamsProvider.client.js';
|
|
5
5
|
/**
|
|
6
6
|
* The `Route` component is used to set up a route in Hydrogen that's independent of the file system. Routes are
|
|
7
7
|
* matched in the order that they're defined.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createBrowserHistory } from 'history';
|
|
2
2
|
import React, { createContext, useContext, useMemo, useState, useEffect, useLayoutEffect, useCallback, } from 'react';
|
|
3
|
-
import { META_ENV_SSR } from '../ssr-interop';
|
|
4
|
-
import { useInternalServerProps } from '../useServerProps/use-server-props';
|
|
3
|
+
import { META_ENV_SSR } from '../ssr-interop.js';
|
|
4
|
+
import { useInternalServerProps } from '../useServerProps/use-server-props.js';
|
|
5
5
|
export const RouterContext = createContext(undefined);
|
|
6
6
|
let isFirstLoad = true;
|
|
7
7
|
const positions = {};
|
|
@@ -26,6 +26,7 @@ export interface InternalServerPropsContextValue extends BaseServerPropsContextV
|
|
|
26
26
|
serverProps: ServerProps;
|
|
27
27
|
locationServerProps: LocationServerProps;
|
|
28
28
|
getProposedLocationServerProps: ProposedServerPropsSetter;
|
|
29
|
+
setRscResponseFromApiRoute: (response: any) => void;
|
|
29
30
|
}
|
|
30
31
|
export interface ServerPropsContextValue extends BaseServerPropsContextValue {
|
|
31
32
|
serverProps: ServerProps;
|
|
@@ -35,7 +36,8 @@ export declare const ServerPropsContext: React.Context<InternalServerPropsContex
|
|
|
35
36
|
interface ServerPropsProviderProps {
|
|
36
37
|
initialServerProps: LocationServerProps;
|
|
37
38
|
setServerPropsForRsc: React.Dispatch<React.SetStateAction<LocationServerProps>>;
|
|
39
|
+
setRscResponseFromApiRoute: (response: any) => void;
|
|
38
40
|
children: ReactNode;
|
|
39
41
|
}
|
|
40
|
-
export declare function ServerPropsProvider({ initialServerProps, setServerPropsForRsc, children, }: ServerPropsProviderProps): JSX.Element;
|
|
42
|
+
export declare function ServerPropsProvider({ initialServerProps, setServerPropsForRsc, setRscResponseFromApiRoute, children, }: ServerPropsProviderProps): JSX.Element;
|
|
41
43
|
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import React, { createContext, useMemo, useCallback,
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
useTransition, useState, } from 'react';
|
|
1
|
+
import React, { createContext, useMemo, useCallback, useTransition, useState, } from 'react';
|
|
4
2
|
const PRIVATE_PROPS = ['request', 'response'];
|
|
5
3
|
export const ServerPropsContext = createContext(null);
|
|
6
|
-
export function ServerPropsProvider({ initialServerProps, setServerPropsForRsc, children, }) {
|
|
4
|
+
export function ServerPropsProvider({ initialServerProps, setServerPropsForRsc, setRscResponseFromApiRoute, children, }) {
|
|
7
5
|
const [locationServerProps, setLocationServerProps] = useState(initialServerProps);
|
|
8
6
|
const [serverProps, setServerProps] = useState({});
|
|
9
7
|
const [pending, startTransition] = useTransition();
|
|
@@ -13,12 +11,12 @@ export function ServerPropsProvider({ initialServerProps, setServerPropsForRsc,
|
|
|
13
11
|
setServerPropsForRsc((prev) => getNewValue(prev, input, propValue));
|
|
14
12
|
});
|
|
15
13
|
}, [setServerProps, setServerPropsForRsc]);
|
|
16
|
-
const setLocationServerPropsCallback = useCallback((input
|
|
14
|
+
const setLocationServerPropsCallback = useCallback((input) => {
|
|
17
15
|
// Flush the existing user server state when location changes, leaving only the persisted state
|
|
18
16
|
startTransition(() => {
|
|
19
|
-
setServerPropsForRsc(
|
|
17
|
+
setServerPropsForRsc(input);
|
|
20
18
|
setServerProps({});
|
|
21
|
-
setLocationServerProps(
|
|
19
|
+
setLocationServerProps(input);
|
|
22
20
|
});
|
|
23
21
|
}, [setServerProps, setServerPropsForRsc, setLocationServerProps]);
|
|
24
22
|
const getProposedLocationServerPropsCallback = useCallback((input, propValue) => {
|
|
@@ -53,6 +51,7 @@ export function ServerPropsProvider({ initialServerProps, setServerPropsForRsc,
|
|
|
53
51
|
setServerProps: setServerPropsCallback,
|
|
54
52
|
setLocationServerProps: setLocationServerPropsCallback,
|
|
55
53
|
getProposedLocationServerProps: getProposedLocationServerPropsCallback,
|
|
54
|
+
setRscResponseFromApiRoute,
|
|
56
55
|
}), [
|
|
57
56
|
pending,
|
|
58
57
|
locationServerProps,
|
|
@@ -60,6 +59,7 @@ export function ServerPropsProvider({ initialServerProps, setServerPropsForRsc,
|
|
|
60
59
|
setServerPropsCallback,
|
|
61
60
|
setLocationServerPropsCallback,
|
|
62
61
|
getProposedLocationServerPropsCallback,
|
|
62
|
+
setRscResponseFromApiRoute,
|
|
63
63
|
]);
|
|
64
64
|
return (React.createElement(ServerPropsContext.Provider, { value: value }, children));
|
|
65
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ServerPropsProvider, ServerPropsContext, type ServerProps, type ServerPropsContextValue, } from './ServerPropsProvider';
|
|
1
|
+
export { ServerPropsProvider, ServerPropsContext, type ServerProps, type ServerPropsContextValue, } from './ServerPropsProvider.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ServerPropsProvider, ServerPropsContext, } from './ServerPropsProvider';
|
|
1
|
+
export { ServerPropsProvider, ServerPropsContext, } from './ServerPropsProvider.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { HydrogenRequest } from '../HydrogenRequest/HydrogenRequest.server';
|
|
3
|
-
import type { QueryKey } from '../../types';
|
|
2
|
+
import type { HydrogenRequest } from '../HydrogenRequest/HydrogenRequest.server.js';
|
|
3
|
+
import type { QueryKey } from '../../types.js';
|
|
4
4
|
declare type ServerRequestProviderProps = {
|
|
5
5
|
request: HydrogenRequest;
|
|
6
6
|
children: React.ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { createContext, useContext } from 'react';
|
|
2
|
-
import { getTime } from '../../utilities/timing';
|
|
3
|
-
import { hashKey } from '../../utilities/hash';
|
|
4
|
-
import { collectQueryTimings } from '../../utilities/log';
|
|
2
|
+
import { getTime } from '../../utilities/timing.js';
|
|
3
|
+
import { hashKey } from '../../utilities/hash.js';
|
|
4
|
+
import { collectQueryTimings } from '../../utilities/log/index.js';
|
|
5
5
|
// Context to inject current request in SSR
|
|
6
6
|
const RequestContextSSR = createContext(null);
|
|
7
7
|
// Cache to inject current request in RSC
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './ServerRequestProvider';
|
|
1
|
+
export * from './ServerRequestProvider.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './ServerRequestProvider';
|
|
1
|
+
export * from './ServerRequestProvider.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ShopifyContextValue, LocalizationContextValue } from './types';
|
|
1
|
+
import type { ShopifyContextValue, LocalizationContextValue } from './types.js';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
3
|
export declare const ShopifyContext: React.Context<ShopifyContextValue | null>;
|
|
4
4
|
export declare const LocalizationContext: React.Context<LocalizationContextValue | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ShopifyProviderProps, LocalizationContextValue } from './types';
|
|
2
|
-
import type { CountryCode, LanguageCode } from '../../storefront-api-types';
|
|
1
|
+
import type { ShopifyProviderProps, LocalizationContextValue } from './types.js';
|
|
2
|
+
import type { CountryCode, LanguageCode } from '../../storefront-api-types.js';
|
|
3
3
|
export declare const SHOPIFY_PROVIDER_CONTEXT_KEY: unique symbol;
|
|
4
4
|
/**
|
|
5
5
|
* The `ShopifyProvider` component wraps your entire app and provides support for hooks.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { ShopifyProviderClient } from './ShopifyProvider.client';
|
|
3
|
-
import { DEFAULT_COUNTRY, DEFAULT_LANGUAGE } from '../constants';
|
|
4
|
-
import { useRequestCacheData, useServerRequest } from '../ServerRequestProvider';
|
|
5
|
-
import { getOxygenVariable } from '../../utilities/storefrontApi';
|
|
6
|
-
import { SHOPIFY_STOREFRONT_ID_VARIABLE } from '../../constants';
|
|
2
|
+
import { ShopifyProviderClient } from './ShopifyProvider.client.js';
|
|
3
|
+
import { DEFAULT_COUNTRY, DEFAULT_LANGUAGE } from '../constants.js';
|
|
4
|
+
import { useRequestCacheData, useServerRequest, } from '../ServerRequestProvider/index.js';
|
|
5
|
+
import { getOxygenVariable } from '../../utilities/storefrontApi.js';
|
|
6
|
+
import { SHOPIFY_STOREFRONT_ID_VARIABLE } from '../../constants.js';
|
|
7
|
+
import { getLocale } from '../../utilities/locale/index.js';
|
|
7
8
|
function makeShopifyContext(shopifyConfig) {
|
|
8
9
|
const countryCode = shopifyConfig.defaultCountryCode ?? DEFAULT_COUNTRY;
|
|
9
10
|
const languageCode = shopifyConfig.defaultLanguageCode ?? DEFAULT_LANGUAGE;
|
|
@@ -71,7 +72,7 @@ export function getLocalizationContextValue(defaultLanguageCode, defaultCountryC
|
|
|
71
72
|
language: {
|
|
72
73
|
isoCode: runtimeLanguageCode,
|
|
73
74
|
},
|
|
74
|
-
locale:
|
|
75
|
+
locale: getLocale(runtimeLanguageCode, runtimeCountryCode),
|
|
75
76
|
};
|
|
76
77
|
}, [defaultLanguageCode, defaultCountryCode, countryCode, languageCode]);
|
|
77
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ShopifyContext } from './ShopifyProvider.client';
|
|
1
|
+
export { ShopifyContext } from './ShopifyProvider.client.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ShopifyContext } from './ShopifyProvider.client';
|
|
1
|
+
export { ShopifyContext } from './ShopifyProvider.client.js';
|