@shopify/hydrogen 0.22.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +207 -0
- package/dist/esnext/components/AddToCartButton/AddToCartButton.client.js +5 -5
- package/dist/esnext/components/CartLines/{CartLines.d.ts → CartLines.client.d.ts} +0 -0
- package/dist/esnext/components/CartLines/{CartLines.js → CartLines.client.js} +0 -0
- package/dist/esnext/components/CartLines/index.d.ts +1 -1
- package/dist/esnext/components/CartLines/index.js +1 -1
- package/dist/esnext/components/DevTools.client.js +1 -1
- package/dist/esnext/components/Image/Image.d.ts +8 -0
- package/dist/esnext/components/Image/Image.js +58 -10
- package/dist/esnext/components/Link/Link.client.d.ts +2 -0
- package/dist/esnext/components/Link/Link.client.js +7 -4
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +1 -1
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
- package/dist/esnext/components/ProductOptionsProvider/ProductOptionsProvider.client.js +140 -0
- package/dist/esnext/components/ProductOptionsProvider/context.d.ts +2 -0
- package/dist/esnext/components/{ProductProvider → ProductOptionsProvider}/context.js +0 -1
- package/dist/esnext/components/ProductOptionsProvider/index.d.ts +2 -0
- package/dist/esnext/components/ProductOptionsProvider/index.js +2 -0
- package/dist/esnext/components/ProductPrice/ProductPrice.client.d.ts +5 -2
- package/dist/esnext/components/ProductPrice/ProductPrice.client.js +10 -12
- package/dist/esnext/components/index.d.ts +1 -1
- package/dist/esnext/components/index.js +1 -1
- package/dist/esnext/entry-client.js +106 -6
- package/dist/esnext/entry-server.d.ts +2 -15
- package/dist/esnext/entry-server.js +245 -321
- package/dist/esnext/foundation/Analytics/Analytics.client.js +15 -13
- package/dist/esnext/foundation/Analytics/Analytics.server.js +27 -20
- package/dist/esnext/foundation/Analytics/ClientAnalytics.d.ts +4 -2
- package/dist/esnext/foundation/Analytics/ClientAnalytics.js +15 -13
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/{PerformanceMetrics.server.js → ServerAnalyticsConnector.server.js} +7 -6
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.d.ts +1 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.server.js +19 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +190 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +24 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/const.d.ts +28 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/const.js +51 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.d.ts +3 -0
- package/dist/esnext/foundation/Analytics/connectors/Shopify/utils.js +56 -0
- package/dist/esnext/foundation/Analytics/hook.js +4 -2
- package/dist/esnext/foundation/Analytics/utils.d.ts +2 -0
- package/dist/esnext/foundation/Analytics/utils.js +21 -0
- package/dist/{node/framework → esnext/foundation/Cache}/cache-sub-request.d.ts +1 -1
- package/dist/esnext/{framework → foundation/Cache}/cache-sub-request.js +3 -3
- package/dist/esnext/{framework → foundation/Cache}/cache.d.ts +1 -1
- package/dist/esnext/{framework → foundation/Cache}/cache.js +3 -3
- package/dist/{node/framework/CachingStrategy → esnext/foundation/Cache/strategies}/index.d.ts +1 -1
- package/dist/esnext/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +0 -0
- package/dist/esnext/foundation/Cookie/Cookie.d.ts +3 -3
- package/dist/{node/framework/Hydration → esnext/foundation/Html}/Html.d.ts +3 -1
- package/dist/esnext/{framework/Hydration → foundation/Html}/Html.js +15 -2
- package/dist/{node/framework/Hydration/ServerComponentRequest.server.d.ts → esnext/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +7 -3
- package/dist/esnext/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +1 -1
- package/dist/{node/framework/Hydration/ServerComponentResponse.server.d.ts → esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts} +7 -10
- package/dist/esnext/{framework/Hydration/ServerComponentResponse.server.js → foundation/HydrogenResponse/HydrogenResponse.server.js} +19 -15
- package/dist/esnext/foundation/Router/BrowserRouter.client.js +16 -9
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
- package/dist/esnext/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -1
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +4 -4
- package/dist/esnext/foundation/ServerRequestProvider/ServerRequestProvider.js +2 -2
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.d.ts +1 -1
- package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.js +1 -1
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +1 -0
- package/dist/esnext/foundation/index.d.ts +1 -1
- package/dist/esnext/foundation/index.js +1 -1
- package/dist/esnext/foundation/runtime.d.ts +2 -0
- package/dist/esnext/foundation/runtime.js +6 -0
- package/dist/esnext/foundation/session/session.d.ts +3 -3
- package/dist/esnext/foundation/ssr-interop.d.ts +2 -2
- package/dist/esnext/foundation/useNavigate/useNavigate.d.ts +2 -0
- package/dist/esnext/foundation/useNavigate/useNavigate.js +11 -4
- package/dist/esnext/foundation/useQuery/hooks.js +9 -6
- package/dist/esnext/framework/Hydration/rsc.js +2 -0
- package/dist/esnext/framework/plugin.js +2 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +5 -2
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +1 -1
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-rsc.js +4 -12
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
- package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +19 -0
- package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +2 -2
- package/dist/esnext/hooks/useProductOptions/types.d.ts +16 -14
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.d.ts +1 -15
- package/dist/esnext/hooks/useProductOptions/useProductOptions.client.js +8 -107
- package/dist/esnext/hooks/useShopQuery/hooks.js +12 -6
- package/dist/esnext/index.d.ts +6 -3
- package/dist/esnext/index.js +6 -3
- package/dist/esnext/streaming.server.d.ts +0 -1
- package/dist/esnext/streaming.server.js +0 -4
- package/dist/esnext/types.d.ts +32 -23
- package/dist/esnext/utilities/apiRoutes.d.ts +2 -2
- package/dist/esnext/utilities/graphql-tracker.js +1 -1
- package/dist/esnext/utilities/index.d.ts +1 -1
- package/dist/esnext/utilities/index.js +1 -1
- package/dist/esnext/utilities/isBrowser/index.d.ts +1 -0
- package/dist/esnext/utilities/isBrowser/index.js +1 -0
- package/dist/esnext/utilities/isBrowser/isBrowser.d.ts +4 -0
- package/dist/esnext/utilities/isBrowser/isBrowser.js +6 -0
- package/dist/esnext/utilities/isServer/isServer.js +2 -2
- package/dist/esnext/utilities/log/index.d.ts +1 -1
- package/dist/esnext/utilities/log/index.js +1 -1
- package/dist/esnext/utilities/log/log-cache-header.d.ts +4 -4
- package/dist/esnext/utilities/log/log-query-timeline.d.ts +3 -3
- package/dist/esnext/utilities/log/log.d.ts +17 -11
- package/dist/esnext/utilities/log/log.js +29 -20
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/client.d.ts +16 -0
- package/dist/node/client.js +43 -0
- package/dist/node/components/AddToCartButton/AddToCartButton.client.d.ts +23 -0
- package/dist/node/components/AddToCartButton/AddToCartButton.client.js +74 -0
- package/dist/node/components/AddToCartButton/index.d.ts +1 -0
- package/dist/node/components/AddToCartButton/index.js +5 -0
- package/dist/node/components/BuyNowButton/BuyNowButton.client.d.ts +18 -0
- package/dist/node/components/BuyNowButton/BuyNowButton.client.js +53 -0
- package/dist/node/components/BuyNowButton/index.d.ts +1 -0
- package/dist/node/components/BuyNowButton/index.js +5 -0
- package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.d.ts +11 -0
- package/dist/node/components/CartCheckoutButton/CartCheckoutButton.client.js +44 -0
- package/dist/node/components/CartCheckoutButton/index.d.ts +1 -0
- package/dist/node/components/CartCheckoutButton/index.js +5 -0
- package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.d.ts +14 -0
- package/dist/node/components/CartEstimatedCost/CartEstimatedCost.client.js +36 -0
- package/dist/node/components/CartEstimatedCost/index.d.ts +1 -0
- package/dist/node/components/CartEstimatedCost/index.js +5 -0
- package/dist/node/components/CartLineImage/CartLineImage.client.d.ts +9 -0
- package/dist/node/components/CartLineImage/CartLineImage.client.js +18 -0
- package/dist/node/components/CartLineImage/index.d.ts +1 -0
- package/dist/node/components/CartLineImage/index.js +5 -0
- package/dist/node/components/CartLinePrice/CartLinePrice.client.d.ts +12 -0
- package/dist/node/components/CartLinePrice/CartLinePrice.client.js +28 -0
- package/dist/node/components/CartLinePrice/index.d.ts +1 -0
- package/dist/node/components/CartLinePrice/index.js +5 -0
- package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.d.ts +8 -0
- package/dist/node/components/CartLineProductTitle/CartLineProductTitle.client.js +19 -0
- package/dist/node/components/CartLineProductTitle/index.d.ts +1 -0
- package/dist/node/components/CartLineProductTitle/index.js +5 -0
- package/dist/node/components/CartLineProvider/CartLineProvider.client.d.ts +11 -0
- package/dist/node/components/CartLineProvider/CartLineProvider.client.js +15 -0
- package/dist/node/components/CartLineProvider/context.d.ts +26 -0
- package/dist/node/components/CartLineProvider/context.js +5 -0
- package/dist/node/components/CartLineProvider/index.d.ts +2 -0
- package/dist/node/components/CartLineProvider/index.js +7 -0
- package/dist/node/components/CartLineQuantity/CartLineQuantity.client.d.ts +8 -0
- package/dist/node/components/CartLineQuantity/CartLineQuantity.client.js +19 -0
- package/dist/node/components/CartLineQuantity/index.d.ts +1 -0
- package/dist/node/components/CartLineQuantity/index.js +5 -0
- package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.d.ts +14 -0
- package/dist/node/components/CartLineQuantityAdjustButton/CartLineQuantityAdjustButton.js +31 -0
- package/dist/node/components/CartLineQuantityAdjustButton/index.d.ts +1 -0
- package/dist/node/components/CartLineQuantityAdjustButton/index.js +5 -0
- package/dist/node/components/CartLines/CartLines.client.d.ts +15 -0
- package/dist/node/components/CartLines/CartLines.client.js +44 -0
- package/dist/node/components/CartLines/index.d.ts +1 -0
- package/dist/node/components/CartLines/index.js +5 -0
- package/dist/node/components/CartProvider/CartProvider.client.d.ts +41 -0
- package/dist/node/components/CartProvider/CartProvider.client.js +550 -0
- package/dist/node/components/CartProvider/cart-queries.d.ts +10 -0
- package/dist/node/components/CartProvider/cart-queries.js +203 -0
- package/dist/node/components/CartProvider/constants.d.ts +2 -0
- package/dist/node/components/CartProvider/constants.js +5 -0
- package/dist/node/components/CartProvider/context.d.ts +2 -0
- package/dist/node/components/CartProvider/context.js +5 -0
- package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartAttributesUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartBuyerIdentityUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartCreateMutation.d.ts +85 -0
- package/dist/node/components/CartProvider/graphql/CartCreateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartDiscountCodesUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartFragment.d.ts +72 -0
- package/dist/node/components/CartProvider/graphql/CartFragment.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartLineAddMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartLineAddMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartLineRemoveMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartLineUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.d.ts +86 -0
- package/dist/node/components/CartProvider/graphql/CartNoteUpdateMutation.js +2 -0
- package/dist/node/components/CartProvider/graphql/CartQuery.d.ts +81 -0
- package/dist/node/components/CartProvider/graphql/CartQuery.js +2 -0
- package/dist/node/components/CartProvider/hooks.client.d.ts +15 -0
- package/dist/node/components/CartProvider/hooks.client.js +90 -0
- package/dist/node/components/CartProvider/index.d.ts +4 -0
- package/dist/node/components/CartProvider/index.js +10 -0
- package/dist/node/components/CartProvider/types.d.ts +102 -0
- package/dist/node/components/CartProvider/types.js +2 -0
- package/dist/node/components/CartShopPayButton/CartShopPayButton.client.d.ts +9 -0
- package/dist/node/components/CartShopPayButton/CartShopPayButton.client.js +46 -0
- package/dist/node/components/CartShopPayButton/index.d.ts +1 -0
- package/dist/node/components/CartShopPayButton/index.js +5 -0
- package/dist/node/components/ExternalVideo/ExternalVideo.d.ts +21 -0
- package/dist/node/components/ExternalVideo/ExternalVideo.js +21 -0
- package/dist/node/components/ExternalVideo/index.d.ts +1 -0
- package/dist/node/components/ExternalVideo/index.js +5 -0
- package/dist/node/components/Image/Image.d.ts +8 -0
- package/dist/node/components/Image/Image.js +57 -9
- package/dist/node/components/Link/Link.client.d.ts +25 -0
- package/dist/node/components/Link/Link.client.js +165 -0
- package/dist/node/components/Link/index.d.ts +1 -0
- package/dist/node/components/Link/index.js +5 -0
- package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.d.ts +6 -0
- package/dist/node/components/LocalizationProvider/LocalizationClientProvider.client.js +11 -0
- package/dist/node/components/LocalizationProvider/LocalizationContext.client.d.ts +6 -0
- package/dist/node/components/LocalizationProvider/LocalizationContext.client.js +5 -0
- package/dist/node/components/LocalizationProvider/LocalizationProvider.server.d.ts +33 -0
- package/dist/node/components/LocalizationProvider/LocalizationProvider.server.js +51 -0
- package/dist/node/components/MediaFile/MediaFile.d.ts +19 -0
- package/dist/node/components/MediaFile/MediaFile.js +39 -0
- package/dist/node/components/MediaFile/index.d.ts +1 -0
- package/dist/node/components/MediaFile/index.js +5 -0
- package/dist/node/components/Metafield/Metafield.client.d.ts +21 -0
- package/dist/node/components/Metafield/Metafield.client.js +75 -0
- package/dist/node/components/Metafield/index.d.ts +2 -0
- package/dist/node/components/Metafield/index.js +5 -0
- package/dist/node/components/Metafield/types.d.ts +4 -0
- package/dist/node/components/Metafield/types.js +2 -0
- package/dist/node/components/ModelViewer/ModelViewer.client.d.ts +128 -0
- package/dist/node/components/ModelViewer/ModelViewer.client.js +132 -0
- package/dist/node/components/ModelViewer/index.d.ts +1 -0
- package/dist/node/components/ModelViewer/index.js +5 -0
- package/dist/node/components/Money/Money.client.d.ts +25 -0
- package/dist/node/components/Money/Money.client.js +46 -0
- package/dist/node/components/Money/index.d.ts +1 -0
- package/dist/node/components/Money/index.js +5 -0
- package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.d.ts +21 -0
- package/dist/node/components/ProductOptionsProvider/ProductOptionsProvider.client.js +167 -0
- package/dist/node/components/ProductOptionsProvider/context.d.ts +2 -0
- package/dist/node/components/ProductOptionsProvider/context.js +5 -0
- package/dist/node/components/ProductOptionsProvider/index.d.ts +2 -0
- package/dist/node/components/ProductOptionsProvider/index.js +7 -0
- package/dist/node/components/ProductPrice/ProductPrice.client.d.ts +18 -0
- package/dist/node/components/ProductPrice/ProductPrice.client.js +61 -0
- package/dist/node/components/ProductPrice/index.d.ts +1 -0
- package/dist/node/components/ProductPrice/index.js +5 -0
- package/dist/node/components/Seo/CollectionSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/CollectionSeo.client.js +22 -0
- package/dist/node/components/Seo/DefaultPageSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/DefaultPageSeo.client.js +25 -0
- package/dist/node/components/Seo/DescriptionSeo.client.d.ts +4 -0
- package/dist/node/components/Seo/DescriptionSeo.client.js +17 -0
- package/dist/node/components/Seo/HomePageSeo.client.d.ts +2 -0
- package/dist/node/components/Seo/HomePageSeo.client.js +32 -0
- package/dist/node/components/Seo/ImageSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/ImageSeo.client.js +17 -0
- package/dist/node/components/Seo/NoIndexSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/NoIndexSeo.client.js +17 -0
- package/dist/node/components/Seo/PageSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/PageSeo.client.js +20 -0
- package/dist/node/components/Seo/ProductSeo.client.d.ts +5 -0
- package/dist/node/components/Seo/ProductSeo.client.js +70 -0
- package/dist/node/components/Seo/Seo.client.d.ts +30 -0
- package/dist/node/components/Seo/Seo.client.js +38 -0
- package/dist/node/components/Seo/TitleSeo.client.d.ts +3 -0
- package/dist/node/components/Seo/TitleSeo.client.js +17 -0
- package/dist/node/components/Seo/TwitterSeo.client.d.ts +2 -0
- package/dist/node/components/Seo/TwitterSeo.client.js +16 -0
- package/dist/node/components/Seo/index.d.ts +1 -0
- package/dist/node/components/Seo/index.js +5 -0
- package/dist/node/components/Seo/seo-types.d.ts +17 -0
- package/dist/node/components/Seo/seo-types.js +2 -0
- package/dist/node/components/ShopPayButton/ShopPayButton.client.d.ts +38 -0
- package/dist/node/components/ShopPayButton/ShopPayButton.client.js +60 -0
- package/dist/node/components/ShopPayButton/index.d.ts +1 -0
- package/dist/node/components/ShopPayButton/index.js +5 -0
- package/dist/node/components/Video/Video.d.ts +14 -0
- package/dist/node/components/Video/Video.js +31 -0
- package/dist/node/components/Video/index.d.ts +1 -0
- package/dist/node/components/Video/index.js +5 -0
- package/dist/node/components/index.d.ts +28 -0
- package/dist/node/components/index.js +59 -0
- package/dist/node/components/types.d.ts +71 -0
- package/dist/node/components/types.js +11 -0
- package/dist/node/entry-server.d.ts +2 -15
- package/dist/node/entry-server.js +244 -320
- package/dist/node/foundation/Analytics/Analytics.client.js +15 -13
- package/dist/node/foundation/Analytics/Analytics.server.js +27 -20
- package/dist/node/foundation/Analytics/ClientAnalytics.d.ts +4 -2
- package/dist/node/foundation/Analytics/ClientAnalytics.js +14 -12
- package/dist/node/foundation/Analytics/ServerAnalyticsRoute.server.js +7 -5
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.d.ts +7 -0
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +68 -0
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.d.ts +1 -0
- package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetricsDebug.client.js +27 -0
- package/dist/node/foundation/Analytics/hook.js +4 -2
- package/dist/node/foundation/Analytics/index.d.ts +1 -0
- package/dist/node/foundation/Analytics/index.js +5 -0
- package/dist/node/foundation/Analytics/utils.d.ts +2 -0
- package/dist/node/foundation/Analytics/utils.js +24 -1
- package/dist/{esnext/framework → node/foundation/Cache}/cache-sub-request.d.ts +1 -1
- package/dist/node/{framework → foundation/Cache}/cache-sub-request.js +4 -4
- package/dist/node/{framework → foundation/Cache}/cache.d.ts +1 -1
- package/dist/node/{framework → foundation/Cache}/cache.js +5 -5
- package/dist/{esnext/framework/CachingStrategy → node/foundation/Cache/strategies}/index.d.ts +1 -1
- package/dist/node/{framework/CachingStrategy → foundation/Cache/strategies}/index.js +0 -0
- package/dist/node/foundation/Head/Head.client.d.ts +5 -0
- package/dist/node/foundation/Head/Head.client.js +17 -0
- package/dist/node/foundation/Head/index.d.ts +1 -0
- package/dist/node/foundation/Head/index.js +5 -0
- package/dist/{esnext/framework/Hydration → node/foundation/Html}/Html.d.ts +3 -1
- package/dist/node/{framework/Hydration → foundation/Html}/Html.js +15 -2
- package/dist/{esnext/framework/Hydration/ServerComponentRequest.server.d.ts → node/foundation/HydrogenRequest/HydrogenRequest.server.d.ts} +7 -3
- package/dist/node/{framework/Hydration/ServerComponentRequest.server.js → foundation/HydrogenRequest/HydrogenRequest.server.js} +3 -3
- package/dist/{esnext/framework/Hydration/ServerComponentResponse.server.d.ts → node/foundation/HydrogenResponse/HydrogenResponse.server.d.ts} +7 -10
- package/dist/node/{framework/Hydration/ServerComponentResponse.server.js → foundation/HydrogenResponse/HydrogenResponse.server.js} +23 -19
- package/dist/node/foundation/Router/BrowserRouter.client.js +16 -9
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.d.ts +2 -1
- package/dist/node/foundation/ServerPropsProvider/ServerPropsProvider.js +1 -1
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.d.ts +4 -4
- package/dist/node/foundation/ServerRequestProvider/ServerRequestProvider.js +2 -2
- package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.d.ts +7 -0
- package/dist/node/foundation/ShopifyProvider/ShopifyProvider.client.js +35 -0
- package/dist/node/foundation/ShopifyProvider/index.d.ts +1 -0
- package/dist/node/foundation/ShopifyProvider/index.js +5 -0
- package/dist/node/foundation/fetchSync/client/fetchSync.d.ts +10 -0
- package/dist/node/foundation/fetchSync/client/fetchSync.js +33 -0
- package/dist/node/foundation/fetchSync/server/fetchSync.d.ts +8 -0
- package/dist/node/foundation/fetchSync/server/fetchSync.js +33 -0
- package/dist/node/foundation/fetchSync/types.d.ts +5 -0
- package/dist/node/foundation/fetchSync/types.js +2 -0
- package/dist/node/foundation/index.d.ts +3 -0
- package/dist/node/foundation/index.js +10 -0
- package/dist/node/foundation/runtime.d.ts +2 -0
- package/dist/node/foundation/runtime.js +11 -0
- package/dist/node/foundation/session/session.d.ts +3 -3
- package/dist/node/foundation/ssr-interop.d.ts +2 -2
- package/dist/node/foundation/useNavigate/useNavigate.d.ts +2 -0
- package/dist/node/foundation/useNavigate/useNavigate.js +11 -4
- package/dist/node/foundation/useQuery/hooks.d.ts +36 -0
- package/dist/node/foundation/useQuery/hooks.js +104 -0
- package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.d.ts +10 -0
- package/dist/node/foundation/useRouteParams/RouteParamsProvider.client.js +34 -0
- package/dist/node/foundation/useRouteParams/useRouteParams.d.ts +4 -0
- package/dist/node/foundation/useRouteParams/useRouteParams.js +13 -0
- package/dist/node/foundation/useServerProps/index.d.ts +1 -0
- package/dist/node/foundation/useServerProps/index.js +5 -0
- package/dist/node/foundation/useSession/useSession.d.ts +2 -0
- package/dist/node/foundation/useSession/useSession.js +12 -0
- package/dist/node/foundation/useShop/index.d.ts +1 -0
- package/dist/node/foundation/useShop/index.js +5 -0
- package/dist/node/foundation/useShop/use-shop.d.ts +6 -0
- package/dist/node/foundation/useShop/use-shop.js +18 -0
- package/dist/node/foundation/useUrl/index.d.ts +1 -0
- package/dist/node/foundation/useUrl/index.js +5 -0
- package/dist/node/foundation/useUrl/useUrl.d.ts +4 -0
- package/dist/node/foundation/useUrl/useUrl.js +32 -0
- package/dist/node/framework/Hydration/rsc.js +2 -0
- package/dist/node/framework/plugin.js +2 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +5 -2
- package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +1 -1
- package/dist/node/framework/plugins/vite-plugin-hydrogen-rsc.js +4 -12
- package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.d.ts +3 -0
- package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +21 -0
- package/dist/node/hooks/index.d.ts +6 -0
- package/dist/node/hooks/index.js +28 -0
- package/dist/node/hooks/useCart/index.d.ts +1 -0
- package/dist/node/hooks/useCart/index.js +5 -0
- package/dist/node/hooks/useCart/useCart.d.ts +4 -0
- package/dist/node/hooks/useCart/useCart.js +19 -0
- package/dist/node/hooks/useCartLine/index.d.ts +1 -0
- package/dist/node/hooks/useCartLine/index.js +5 -0
- package/dist/node/hooks/useCartLine/useCartLine.d.ts +29 -0
- package/dist/node/hooks/useCartLine/useCartLine.js +16 -0
- package/dist/node/hooks/useCountry/index.d.ts +1 -0
- package/dist/node/hooks/useCountry/index.js +5 -0
- package/dist/node/hooks/useCountry/useCountry.d.ts +7 -0
- package/dist/node/hooks/useCountry/useCountry.js +21 -0
- package/dist/node/hooks/useLoadScript/index.d.ts +1 -0
- package/dist/node/hooks/useLoadScript/index.js +5 -0
- package/dist/node/hooks/useLoadScript/useLoadScript.client.d.ts +8 -0
- package/dist/node/hooks/useLoadScript/useLoadScript.client.js +27 -0
- package/dist/node/hooks/useMeasurement/hooks.d.ts +9 -0
- package/dist/node/hooks/useMeasurement/hooks.js +17 -0
- package/dist/node/hooks/useMeasurement/index.d.ts +1 -0
- package/dist/node/hooks/useMeasurement/index.js +5 -0
- package/dist/node/hooks/useMoney/hooks.d.ts +54 -0
- package/dist/node/hooks/useMoney/hooks.js +70 -0
- package/dist/node/hooks/useMoney/index.d.ts +1 -0
- package/dist/node/hooks/useMoney/index.js +5 -0
- package/dist/node/hooks/useParsedMetafields/index.d.ts +1 -0
- package/dist/node/hooks/useParsedMetafields/index.js +5 -0
- package/dist/node/hooks/useParsedMetafields/useParsedMetafields.d.ts +21 -0
- package/dist/node/hooks/useParsedMetafields/useParsedMetafields.js +25 -0
- package/dist/node/hooks/useProductOptions/helpers.d.ts +6 -0
- package/dist/node/hooks/useProductOptions/helpers.js +46 -0
- package/dist/node/hooks/useProductOptions/index.d.ts +2 -0
- package/dist/node/hooks/useProductOptions/index.js +20 -0
- package/dist/node/hooks/useProductOptions/types.d.ts +44 -0
- package/dist/node/hooks/useProductOptions/types.js +2 -0
- package/dist/node/hooks/useProductOptions/useProductOptions.client.d.ts +1 -0
- package/dist/node/hooks/useProductOptions/useProductOptions.client.js +13 -0
- package/dist/node/hooks/useShopQuery/hooks.d.ts +28 -0
- package/dist/node/hooks/useShopQuery/hooks.js +171 -0
- package/dist/node/hooks/useShopQuery/index.d.ts +1 -0
- package/dist/node/hooks/useShopQuery/index.js +5 -0
- package/dist/node/streaming.server.d.ts +0 -1
- package/dist/node/streaming.server.js +1 -6
- package/dist/node/types.d.ts +32 -23
- package/dist/node/utilities/apiRoutes.d.ts +2 -2
- package/dist/node/utilities/devtools.d.ts +11 -0
- package/dist/node/utilities/devtools.js +15 -0
- package/dist/node/utilities/graphql-tag.d.ts +1 -0
- package/dist/node/utilities/graphql-tag.js +10 -0
- package/dist/node/utilities/graphql-tracker.d.ts +17 -0
- package/dist/node/utilities/graphql-tracker.js +130 -0
- package/dist/node/utilities/index.d.ts +1 -1
- package/dist/node/utilities/index.js +3 -3
- package/dist/node/utilities/isBrowser/index.d.ts +1 -0
- package/dist/node/utilities/isBrowser/index.js +5 -0
- package/dist/node/utilities/isBrowser/isBrowser.d.ts +4 -0
- package/dist/node/utilities/isBrowser/isBrowser.js +10 -0
- package/dist/node/utilities/isServer/isServer.js +2 -2
- package/dist/node/utilities/log/index.d.ts +1 -1
- package/dist/node/utilities/log/index.js +1 -3
- package/dist/node/utilities/log/log-cache-header.d.ts +4 -4
- package/dist/node/utilities/log/log-query-timeline.d.ts +3 -3
- package/dist/node/utilities/log/log.d.ts +17 -11
- package/dist/node/utilities/log/log.js +30 -23
- package/dist/node/version.d.ts +1 -1
- package/dist/node/version.js +1 -1
- package/package.json +3 -1
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +203 -52
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +77 -59
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +30 -30
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +199 -70
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +38 -35
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.development.js +9 -8
- package/vendor/react-server-dom-vite/cjs/react-server-dom-vite.production.min.js +3 -3
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-client-proxy.js +3 -7
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +204 -53
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +77 -59
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +199 -70
- package/vendor/react-server-dom-vite/esm/react-server-dom-vite.js +9 -8
- package/vendor/react-server-dom-vite/package.json +1 -1
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.d.ts +0 -8
- package/dist/esnext/components/ProductProvider/ProductOptionsProvider.client.js +0 -12
- package/dist/esnext/components/ProductProvider/ProductProvider.client.d.ts +0 -24
- package/dist/esnext/components/ProductProvider/ProductProvider.client.js +0 -34
- package/dist/esnext/components/ProductProvider/context.d.ts +0 -29
- package/dist/esnext/components/ProductProvider/index.d.ts +0 -2
- package/dist/esnext/components/ProductProvider/index.js +0 -2
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.server.d.ts +0 -1
- package/dist/esnext/framework/config.d.ts +0 -6
- package/dist/esnext/framework/config.js +0 -6
- package/dist/esnext/framework/runtime.d.ts +0 -13
- package/dist/esnext/framework/runtime.js +0 -27
- package/dist/esnext/hooks/useProduct/index.d.ts +0 -1
- package/dist/esnext/hooks/useProduct/index.js +0 -1
- package/dist/esnext/hooks/useProduct/useProduct.d.ts +0 -52
- package/dist/esnext/hooks/useProduct/useProduct.js +0 -43
- package/dist/esnext/utilities/isClient/index.d.ts +0 -1
- package/dist/esnext/utilities/isClient/index.js +0 -1
- package/dist/esnext/utilities/isClient/isClient.d.ts +0 -4
- package/dist/esnext/utilities/isClient/isClient.js +0 -6
- package/dist/node/framework/config.d.ts +0 -6
- package/dist/node/framework/config.js +0 -11
- package/dist/node/framework/runtime.d.ts +0 -13
- package/dist/node/framework/runtime.js +0 -35
- package/dist/node/utilities/defer.d.ts +0 -6
- package/dist/node/utilities/defer.js +0 -18
- package/dist/node/utilities/isClient/index.d.ts +0 -1
- package/dist/node/utilities/isClient/index.js +0 -5
- package/dist/node/utilities/isClient/isClient.d.ts +0 -4
- package/dist/node/utilities/isClient/isClient.js +0 -10
|
@@ -6,16 +6,12 @@ const ClientAnalytics_1 = require("./ClientAnalytics");
|
|
|
6
6
|
function Analytics({ analyticsDataFromServer, }) {
|
|
7
7
|
(0, react_1.useEffect)(() => {
|
|
8
8
|
const urlParams = new URLSearchParams(window.location.search);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
content: urlParams.get('utm_content'),
|
|
16
|
-
term: urlParams.get('utm_term'),
|
|
17
|
-
}, 'utm');
|
|
18
|
-
}
|
|
9
|
+
addUTMData(urlParams, 'id');
|
|
10
|
+
addUTMData(urlParams, 'source');
|
|
11
|
+
addUTMData(urlParams, 'campaign');
|
|
12
|
+
addUTMData(urlParams, 'medium');
|
|
13
|
+
addUTMData(urlParams, 'content');
|
|
14
|
+
addUTMData(urlParams, 'term');
|
|
19
15
|
ClientAnalytics_1.ClientAnalytics.pushToPageAnalyticsData(analyticsDataFromServer);
|
|
20
16
|
ClientAnalytics_1.ClientAnalytics.publish(ClientAnalytics_1.ClientAnalytics.eventNames.PAGE_VIEW, true);
|
|
21
17
|
if (analyticsDataFromServer.publishEventsOnNavigate) {
|
|
@@ -23,10 +19,16 @@ function Analytics({ analyticsDataFromServer, }) {
|
|
|
23
19
|
ClientAnalytics_1.ClientAnalytics.publish(eventName, true);
|
|
24
20
|
});
|
|
25
21
|
}
|
|
26
|
-
return function cleanup() {
|
|
27
|
-
ClientAnalytics_1.ClientAnalytics.resetPageAnalyticsData();
|
|
28
|
-
};
|
|
29
22
|
}, [analyticsDataFromServer]);
|
|
30
23
|
return null;
|
|
31
24
|
}
|
|
32
25
|
exports.Analytics = Analytics;
|
|
26
|
+
function addUTMData(urlParams, key) {
|
|
27
|
+
if (urlParams.has(`utm_${key}`)) {
|
|
28
|
+
ClientAnalytics_1.ClientAnalytics.pushToPageAnalyticsData({
|
|
29
|
+
utm: {
|
|
30
|
+
[key]: urlParams.get(`utm_${key}`),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -32,29 +32,20 @@ const hook_1 = require("./hook");
|
|
|
32
32
|
const Analytics_client_1 = require("./Analytics.client");
|
|
33
33
|
const ServerRequestProvider_1 = require("../ServerRequestProvider");
|
|
34
34
|
const AnalyticsErrorBoundary_client_1 = __importDefault(require("../AnalyticsErrorBoundary.client"));
|
|
35
|
-
const
|
|
35
|
+
const utilities_1 = require("../../utilities");
|
|
36
|
+
const DELAY_KEY_1 = 'analytics-delay-1';
|
|
37
|
+
const DELAY_KEY_2 = 'analytics-delay-2';
|
|
36
38
|
function Analytics() {
|
|
37
39
|
const cache = (0, ServerRequestProvider_1.useServerRequest)().ctx.cache;
|
|
38
40
|
// If render cache is empty, create a 50 ms delay so that React doesn't resolve this
|
|
39
41
|
// component too early and potentially cause a mismatch in hydration
|
|
40
|
-
if (cache.size === 0 && !cache.has(
|
|
41
|
-
|
|
42
|
-
let promise;
|
|
43
|
-
cache.set(DELAY_KEY, () => {
|
|
44
|
-
if (result !== undefined) {
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
if (!promise) {
|
|
48
|
-
promise = new Promise((resolve) => {
|
|
49
|
-
setTimeout(() => {
|
|
50
|
-
result = true;
|
|
51
|
-
resolve(true);
|
|
52
|
-
}, 50);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
throw promise;
|
|
56
|
-
});
|
|
42
|
+
if (cache.size === 0 && !cache.has(DELAY_KEY_1)) {
|
|
43
|
+
analyticsDelay(cache, DELAY_KEY_1, 50);
|
|
57
44
|
}
|
|
45
|
+
// If this delay is created, execute it
|
|
46
|
+
cache.has(DELAY_KEY_1) && cache.get(DELAY_KEY_1).read();
|
|
47
|
+
// clean up this key so that it won't be saved to the preload cache
|
|
48
|
+
cache.delete(DELAY_KEY_1);
|
|
58
49
|
// Make sure all queries have returned before rendering the Analytics server component
|
|
59
50
|
cache.forEach((cacheFn) => {
|
|
60
51
|
if (cacheFn && typeof cacheFn === 'function') {
|
|
@@ -63,8 +54,24 @@ function Analytics() {
|
|
|
63
54
|
throw result;
|
|
64
55
|
}
|
|
65
56
|
});
|
|
66
|
-
|
|
57
|
+
// If all queries has returned (could be from cached queries),
|
|
58
|
+
// delay Analytic component by another 1ms (put this component
|
|
59
|
+
// to the end of the render queue) so that other scheduled
|
|
60
|
+
// render work can be processed by React's concurrent render first
|
|
61
|
+
if (cache.size > 1 && !cache.has(DELAY_KEY_2)) {
|
|
62
|
+
analyticsDelay(cache, DELAY_KEY_2, 1);
|
|
63
|
+
}
|
|
64
|
+
cache.has(DELAY_KEY_2) && cache.get(DELAY_KEY_2).read();
|
|
65
|
+
cache.delete(DELAY_KEY_2);
|
|
67
66
|
return (React.createElement(AnalyticsErrorBoundary_client_1.default, null,
|
|
68
|
-
React.createElement(Analytics_client_1.Analytics, { analyticsDataFromServer:
|
|
67
|
+
React.createElement(Analytics_client_1.Analytics, { analyticsDataFromServer: (0, hook_1.useServerAnalytics)() })));
|
|
69
68
|
}
|
|
70
69
|
exports.Analytics = Analytics;
|
|
70
|
+
function analyticsDelay(cache, delayKey, delay) {
|
|
71
|
+
const delayPromise = (0, utilities_1.wrapPromise)(new Promise((resolve) => {
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
resolve(true);
|
|
74
|
+
}, delay);
|
|
75
|
+
}));
|
|
76
|
+
cache.set(delayKey, delayPromise);
|
|
77
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Subscriber, SubscriberFunction } from './types';
|
|
2
|
-
declare function pushToPageAnalyticsData(data: any
|
|
2
|
+
declare function pushToPageAnalyticsData(data: any): void;
|
|
3
3
|
declare function getPageAnalyticsData(): any;
|
|
4
4
|
declare function resetPageAnalyticsData(): void;
|
|
5
|
-
declare function publish(eventname: string, guardDup?: boolean, payload?:
|
|
5
|
+
declare function publish(eventname: string, guardDup?: boolean, payload?: {}): void;
|
|
6
6
|
declare function subscribe(eventname: string, callbackFunction: SubscriberFunction): Subscriber;
|
|
7
7
|
declare function pushToServer(init?: RequestInit, searchParam?: string): Promise<Response>;
|
|
8
|
+
declare function hasSentFirstPageView(): Boolean;
|
|
8
9
|
export declare const ClientAnalytics: {
|
|
9
10
|
pushToPageAnalyticsData: typeof pushToPageAnalyticsData;
|
|
10
11
|
getPageAnalyticsData: typeof getPageAnalyticsData;
|
|
@@ -21,5 +22,6 @@ export declare const ClientAnalytics: {
|
|
|
21
22
|
DISCOUNT_CODE_UPDATED: string;
|
|
22
23
|
PERFORMANCE: string;
|
|
23
24
|
};
|
|
25
|
+
hasSentFirstPageView: typeof hasSentFirstPageView;
|
|
24
26
|
};
|
|
25
27
|
export {};
|
|
@@ -7,6 +7,7 @@ const constants_1 = require("../../constants");
|
|
|
7
7
|
const ssr_interop_1 = require("../ssr-interop");
|
|
8
8
|
const subscribers = {};
|
|
9
9
|
let pageAnalyticsData = {};
|
|
10
|
+
let isFirstPageViewSent = false;
|
|
10
11
|
const guardDupEvents = {};
|
|
11
12
|
const USAGE_ERROR = 'ClientAnalytics should only be used within the useEffect callback or event handlers';
|
|
12
13
|
function isInvokedFromServer() {
|
|
@@ -16,15 +17,10 @@ function isInvokedFromServer() {
|
|
|
16
17
|
}
|
|
17
18
|
return false;
|
|
18
19
|
}
|
|
19
|
-
function pushToPageAnalyticsData(data
|
|
20
|
+
function pushToPageAnalyticsData(data) {
|
|
20
21
|
if (isInvokedFromServer())
|
|
21
22
|
return;
|
|
22
|
-
|
|
23
|
-
pageAnalyticsData[namespace] = Object.assign({}, pageAnalyticsData[namespace] || {}, data);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
pageAnalyticsData = Object.assign({}, pageAnalyticsData, data);
|
|
27
|
-
}
|
|
23
|
+
pageAnalyticsData = (0, utils_1.mergeDeep)(pageAnalyticsData, data);
|
|
28
24
|
}
|
|
29
25
|
function getPageAnalyticsData() {
|
|
30
26
|
if (isInvokedFromServer())
|
|
@@ -36,12 +32,11 @@ function resetPageAnalyticsData() {
|
|
|
36
32
|
return;
|
|
37
33
|
pageAnalyticsData = {};
|
|
38
34
|
}
|
|
39
|
-
function publish(eventname, guardDup = false, payload) {
|
|
35
|
+
function publish(eventname, guardDup = false, payload = {}) {
|
|
40
36
|
if (isInvokedFromServer())
|
|
41
37
|
return;
|
|
42
38
|
const namedspacedEventname = (0, utils_1.getNamedspacedEventname)(eventname);
|
|
43
39
|
const subs = subscribers[namedspacedEventname];
|
|
44
|
-
const combinedPayload = Object.assign({}, pageAnalyticsData, payload);
|
|
45
40
|
// De-dup events due to re-renders
|
|
46
41
|
if (guardDup) {
|
|
47
42
|
const eventGuardTimeout = guardDupEvents[namedspacedEventname];
|
|
@@ -49,15 +44,18 @@ function publish(eventname, guardDup = false, payload) {
|
|
|
49
44
|
clearTimeout(eventGuardTimeout);
|
|
50
45
|
}
|
|
51
46
|
const namespacedTimeout = setTimeout(() => {
|
|
52
|
-
publishEvent(subs,
|
|
47
|
+
publishEvent(namedspacedEventname, subs, (0, utils_1.mergeDeep)(pageAnalyticsData, payload));
|
|
53
48
|
}, 100);
|
|
54
49
|
guardDupEvents[namedspacedEventname] = namespacedTimeout;
|
|
55
50
|
}
|
|
56
51
|
else {
|
|
57
|
-
publishEvent(subs,
|
|
52
|
+
publishEvent(namedspacedEventname, subs, (0, utils_1.mergeDeep)(pageAnalyticsData, payload));
|
|
58
53
|
}
|
|
59
54
|
}
|
|
60
|
-
function publishEvent(subs, payload) {
|
|
55
|
+
function publishEvent(eventname, subs, payload) {
|
|
56
|
+
if (!isFirstPageViewSent && eventname === const_1.eventNames.PAGE_VIEW) {
|
|
57
|
+
isFirstPageViewSent = true;
|
|
58
|
+
}
|
|
61
59
|
if (subs) {
|
|
62
60
|
Object.keys(subs).forEach((key) => {
|
|
63
61
|
subs[key](payload);
|
|
@@ -89,6 +87,9 @@ function pushToServer(init, searchParam) {
|
|
|
89
87
|
},
|
|
90
88
|
}, init));
|
|
91
89
|
}
|
|
90
|
+
function hasSentFirstPageView() {
|
|
91
|
+
return isFirstPageViewSent;
|
|
92
|
+
}
|
|
92
93
|
exports.ClientAnalytics = {
|
|
93
94
|
pushToPageAnalyticsData,
|
|
94
95
|
getPageAnalyticsData,
|
|
@@ -97,4 +98,5 @@ exports.ClientAnalytics = {
|
|
|
97
98
|
subscribe,
|
|
98
99
|
pushToServer,
|
|
99
100
|
eventNames: const_1.eventNames,
|
|
101
|
+
hasSentFirstPageView,
|
|
100
102
|
};
|
|
@@ -3,16 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ServerAnalyticsRoute = void 0;
|
|
4
4
|
const log_1 = require("../../utilities/log");
|
|
5
5
|
function ServerAnalyticsRoute(request, serverAnalyticsConnectors) {
|
|
6
|
-
|
|
6
|
+
const requestHeader = request.headers;
|
|
7
|
+
const requestUrl = request.url;
|
|
8
|
+
if (requestHeader.get('Content-Length') === '0') {
|
|
7
9
|
serverAnalyticsConnectors === null || serverAnalyticsConnectors === void 0 ? void 0 : serverAnalyticsConnectors.forEach((connector) => {
|
|
8
|
-
connector.request(request);
|
|
10
|
+
connector.request(requestUrl, request.headers);
|
|
9
11
|
});
|
|
10
12
|
}
|
|
11
|
-
else if (
|
|
13
|
+
else if (requestHeader.get('Content-Type') === 'application/json') {
|
|
12
14
|
Promise.resolve(request.json())
|
|
13
15
|
.then((data) => {
|
|
14
16
|
serverAnalyticsConnectors === null || serverAnalyticsConnectors === void 0 ? void 0 : serverAnalyticsConnectors.forEach((connector) => {
|
|
15
|
-
connector.request(
|
|
17
|
+
connector.request(requestUrl, requestHeader, data, 'json');
|
|
16
18
|
});
|
|
17
19
|
})
|
|
18
20
|
.catch((error) => {
|
|
@@ -23,7 +25,7 @@ function ServerAnalyticsRoute(request, serverAnalyticsConnectors) {
|
|
|
23
25
|
Promise.resolve(request.text())
|
|
24
26
|
.then((data) => {
|
|
25
27
|
serverAnalyticsConnectors === null || serverAnalyticsConnectors === void 0 ? void 0 : serverAnalyticsConnectors.forEach((connector) => {
|
|
26
|
-
connector.request(
|
|
28
|
+
connector.request(requestUrl, requestHeader, data, 'text');
|
|
27
29
|
});
|
|
28
30
|
})
|
|
29
31
|
.catch((error) => {
|
package/dist/node/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PerformanceMetrics = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const load_script_1 = require("../../../../utilities/load_script");
|
|
6
|
+
const ClientAnalytics_1 = require("../../ClientAnalytics");
|
|
7
|
+
const useShop_1 = require("../../../useShop");
|
|
8
|
+
const URL = 'https://cdn.shopify.com/shopifycloud/boomerang/shopify-boomerang-hydrogen.min.js';
|
|
9
|
+
function PerformanceMetrics() {
|
|
10
|
+
const { storeDomain } = (0, useShop_1.useShop)();
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
12
|
+
try {
|
|
13
|
+
(function () {
|
|
14
|
+
if (window.BOOMR &&
|
|
15
|
+
(window.BOOMR.version || window.BOOMR.snippetExecuted)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
// Executes only on first mount
|
|
19
|
+
window.BOOMR = window.BOOMR || {};
|
|
20
|
+
window.BOOMR.hydrogenPerformanceEvent = (data) => {
|
|
21
|
+
ClientAnalytics_1.ClientAnalytics.publish(ClientAnalytics_1.ClientAnalytics.eventNames.PERFORMANCE, true, data);
|
|
22
|
+
ClientAnalytics_1.ClientAnalytics.pushToServer({
|
|
23
|
+
body: JSON.stringify(data),
|
|
24
|
+
}, ClientAnalytics_1.ClientAnalytics.eventNames.PERFORMANCE);
|
|
25
|
+
};
|
|
26
|
+
window.BOOMR.storeDomain = storeDomain;
|
|
27
|
+
function boomerangSaveLoadTime(e) {
|
|
28
|
+
window.BOOMR_onload = (e && e.timeStamp) || Date.now();
|
|
29
|
+
}
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
function boomerangInit(e) {
|
|
32
|
+
e.detail.BOOMR.init();
|
|
33
|
+
e.detail.BOOMR.t_end = Date.now();
|
|
34
|
+
}
|
|
35
|
+
if (window.addEventListener) {
|
|
36
|
+
window.addEventListener('load', boomerangSaveLoadTime, false);
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
}
|
|
39
|
+
else if (window.attachEvent) {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
window.attachEvent('onload', boomerangSaveLoadTime);
|
|
42
|
+
}
|
|
43
|
+
if (document.addEventListener) {
|
|
44
|
+
document.addEventListener('onBoomerangLoaded', boomerangInit);
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
}
|
|
47
|
+
else if (document.attachEvent) {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
document.attachEvent('onpropertychange', function (e) {
|
|
50
|
+
if (!e)
|
|
51
|
+
e = event;
|
|
52
|
+
if (e.propertyName === 'onBoomerangLoaded')
|
|
53
|
+
boomerangInit(e);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
})();
|
|
57
|
+
(0, load_script_1.loadScript)(URL).catch(() => {
|
|
58
|
+
// ignore if boomerang doesn't load
|
|
59
|
+
// most likely because of an ad blocker
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
// Do nothing
|
|
64
|
+
}
|
|
65
|
+
}, [storeDomain]);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
exports.PerformanceMetrics = PerformanceMetrics;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PerformanceMetricsDebug(): null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PerformanceMetricsDebug = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const index_1 = require("../../index");
|
|
6
|
+
const PAD = 10;
|
|
7
|
+
let isInit = false;
|
|
8
|
+
function PerformanceMetricsDebug() {
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
if (!isInit) {
|
|
11
|
+
isInit = true;
|
|
12
|
+
index_1.ClientAnalytics.subscribe(index_1.ClientAnalytics.eventNames.PERFORMANCE, (data) => {
|
|
13
|
+
console.group(`Performance - ${data.page_load_type} load`);
|
|
14
|
+
logMetricIf('TTFB:', data.response_start - data.navigation_start);
|
|
15
|
+
logMetricIf('FCP:', data.first_contentful_paint);
|
|
16
|
+
logMetricIf('LCP:', data.largest_contentful_paint);
|
|
17
|
+
logMetricIf('Duration:', data.response_end - data.navigation_start);
|
|
18
|
+
console.groupEnd();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
exports.PerformanceMetricsDebug = PerformanceMetricsDebug;
|
|
25
|
+
function logMetricIf(lable, data) {
|
|
26
|
+
data && console.log(`${lable.padEnd(PAD)}${Math.round(data)} ms`);
|
|
27
|
+
}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useServerAnalytics = void 0;
|
|
4
4
|
const ServerRequestProvider_1 = require("../ServerRequestProvider");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
5
6
|
function useServerAnalytics(data) {
|
|
6
7
|
const request = (0, ServerRequestProvider_1.useServerRequest)();
|
|
7
|
-
if (data)
|
|
8
|
-
request.ctx.analyticsData =
|
|
8
|
+
if (data) {
|
|
9
|
+
request.ctx.analyticsData = (0, utils_1.mergeDeep)(request.ctx.analyticsData, data);
|
|
10
|
+
}
|
|
9
11
|
return request.ctx.analyticsData;
|
|
10
12
|
}
|
|
11
13
|
exports.useServerAnalytics = useServerAnalytics;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ClientAnalytics } from './ClientAnalytics';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientAnalytics = void 0;
|
|
4
|
+
var ClientAnalytics_1 = require("./ClientAnalytics");
|
|
5
|
+
Object.defineProperty(exports, "ClientAnalytics", { enumerable: true, get: function () { return ClientAnalytics_1.ClientAnalytics; } });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getNamedspacedEventname = void 0;
|
|
3
|
+
exports.mergeDeep = exports.isObject = exports.getNamedspacedEventname = void 0;
|
|
4
4
|
const const_1 = require("./const");
|
|
5
5
|
const RESERVED_EVENT_NAMES = Object.values(const_1.eventNames);
|
|
6
6
|
function getNamedspacedEventname(eventname) {
|
|
@@ -10,3 +10,26 @@ function getNamedspacedEventname(eventname) {
|
|
|
10
10
|
: eventname;
|
|
11
11
|
}
|
|
12
12
|
exports.getNamedspacedEventname = getNamedspacedEventname;
|
|
13
|
+
function isObject(item) {
|
|
14
|
+
return item && typeof item === 'object' && !Array.isArray(item);
|
|
15
|
+
}
|
|
16
|
+
exports.isObject = isObject;
|
|
17
|
+
function mergeDeep(target, ...sources) {
|
|
18
|
+
if (!sources.length)
|
|
19
|
+
return target;
|
|
20
|
+
const source = sources.shift();
|
|
21
|
+
if (isObject(target) && isObject(source)) {
|
|
22
|
+
for (const key in source) {
|
|
23
|
+
if (isObject(source[key])) {
|
|
24
|
+
if (!target[key])
|
|
25
|
+
Object.assign(target, { [key]: {} });
|
|
26
|
+
mergeDeep(target[key], source[key]);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
Object.assign(target, { [key]: source[key] });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return mergeDeep(target, ...sources);
|
|
34
|
+
}
|
|
35
|
+
exports.mergeDeep = mergeDeep;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QueryKey, CachingStrategy } from '
|
|
1
|
+
import type { QueryKey, CachingStrategy } from '../../types';
|
|
2
2
|
export declare function generateSubRequestCacheControlHeader(userCacheOptions?: CachingStrategy): string;
|
|
3
3
|
/**
|
|
4
4
|
* Get an item from the cache. If a match is found, returns a tuple
|
|
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.isStale = exports.deleteItemFromCache = exports.setItemInCache = exports.getItemFromCache = exports.generateSubRequestCacheControlHeader = void 0;
|
|
27
|
-
const runtime_1 = require("
|
|
28
|
-
const hash_1 = require("
|
|
27
|
+
const runtime_1 = require("../runtime");
|
|
28
|
+
const hash_1 = require("../../utilities/hash");
|
|
29
29
|
const CacheApi = __importStar(require("./cache"));
|
|
30
|
-
const
|
|
30
|
+
const strategies_1 = require("./strategies");
|
|
31
31
|
/**
|
|
32
32
|
* Wrapper Cache functions for sub queries
|
|
33
33
|
*/
|
|
@@ -38,7 +38,7 @@ function getKeyUrl(key) {
|
|
|
38
38
|
return `https://shopify.dev/?${key}`;
|
|
39
39
|
}
|
|
40
40
|
function getCacheOption(userCacheOptions) {
|
|
41
|
-
return userCacheOptions || (0,
|
|
41
|
+
return userCacheOptions || (0, strategies_1.CacheSeconds)();
|
|
42
42
|
}
|
|
43
43
|
function generateSubRequestCacheControlHeader(userCacheOptions) {
|
|
44
44
|
return CacheApi.generateDefaultCacheControlHeader(getCacheOption(userCacheOptions));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CachingStrategy } from '
|
|
1
|
+
import type { CachingStrategy } from '../../types';
|
|
2
2
|
export declare function generateDefaultCacheControlHeader(userCacheOptions?: CachingStrategy): string;
|
|
3
3
|
/**
|
|
4
4
|
* Get an item from the cache. If a match is found, returns a tuple
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isStale = exports.deleteItemFromCache = exports.setItemInCache = exports.getItemFromCache = exports.generateDefaultCacheControlHeader = void 0;
|
|
4
|
-
const runtime_1 = require("
|
|
5
|
-
const
|
|
6
|
-
const log_1 = require("
|
|
4
|
+
const runtime_1 = require("../runtime");
|
|
5
|
+
const strategies_1 = require("./strategies");
|
|
6
|
+
const log_1 = require("../../utilities/log");
|
|
7
7
|
function getCacheControlSetting(userCacheOptions, options) {
|
|
8
8
|
if (userCacheOptions && options) {
|
|
9
9
|
return {
|
|
@@ -12,11 +12,11 @@ function getCacheControlSetting(userCacheOptions, options) {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
return userCacheOptions || (0,
|
|
15
|
+
return userCacheOptions || (0, strategies_1.CacheSeconds)();
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
function generateDefaultCacheControlHeader(userCacheOptions) {
|
|
19
|
-
return (0,
|
|
19
|
+
return (0, strategies_1.generateCacheControlHeader)(getCacheControlSetting(userCacheOptions));
|
|
20
20
|
}
|
|
21
21
|
exports.generateDefaultCacheControlHeader = generateDefaultCacheControlHeader;
|
|
22
22
|
/**
|
package/dist/{esnext/framework/CachingStrategy → node/foundation/Cache/strategies}/index.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CachingStrategy, AllCacheOptions, NoStoreStrategy } from '
|
|
1
|
+
import type { CachingStrategy, AllCacheOptions, NoStoreStrategy } from '../../../types';
|
|
2
2
|
export declare function generateCacheControlHeader(cacheOptions: CachingStrategy): string;
|
|
3
3
|
export declare function NoStore(): NoStoreStrategy;
|
|
4
4
|
export declare function CacheSeconds(overrideOptions?: CachingStrategy): AllCacheOptions;
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Head = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_helmet_async_1 = require("react-helmet-async");
|
|
9
|
+
const ssr_interop_1 = require("../ssr-interop");
|
|
10
|
+
const clientHeadData = new react_helmet_async_1.HelmetData({});
|
|
11
|
+
function Head({ children, ...props }) {
|
|
12
|
+
const headData = (0, ssr_interop_1.useEnvContext)((req) => req.ctx.head, clientHeadData);
|
|
13
|
+
return (
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
react_1.default.createElement(react_helmet_async_1.Helmet, { ...props, helmetData: headData }, children));
|
|
16
|
+
}
|
|
17
|
+
exports.Head = Head;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Head } from './Head.client';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import type { HelmetData as HeadData } from 'react-helmet-async';
|
|
3
|
+
import { ResolvedHydrogenConfig } from '../../types';
|
|
3
4
|
declare type HtmlOptions = {
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
template: string;
|
|
6
7
|
htmlAttrs?: Record<string, string>;
|
|
7
8
|
bodyAttrs?: Record<string, string>;
|
|
9
|
+
hydrogenConfig: ResolvedHydrogenConfig;
|
|
8
10
|
};
|
|
9
|
-
export declare function Html({ children, template, htmlAttrs, bodyAttrs }: HtmlOptions): JSX.Element;
|
|
11
|
+
export declare function Html({ children, template, htmlAttrs, bodyAttrs, hydrogenConfig, }: HtmlOptions): JSX.Element;
|
|
10
12
|
export declare function applyHtmlHead(html: string, head: HeadData, template: string): string;
|
|
11
13
|
export {};
|
|
@@ -27,7 +27,11 @@ function propsToAttrs(props) {
|
|
|
27
27
|
.map(([key, value]) => `${key === REACT_ATTR_MAP.class ? 'class' : key}="${value}"`)
|
|
28
28
|
.join(' ');
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
const clientConfigOptions = [
|
|
31
|
+
'strictMode',
|
|
32
|
+
'showDevTools',
|
|
33
|
+
];
|
|
34
|
+
function Html({ children, template, htmlAttrs, bodyAttrs, hydrogenConfig, }) {
|
|
31
35
|
let head = template.match(/<head>(.+?)<\/head>/s)[1] || '';
|
|
32
36
|
// @ts-ignore
|
|
33
37
|
if (import.meta.env.DEV) {
|
|
@@ -37,10 +41,19 @@ function Html({ children, template, htmlAttrs, bodyAttrs }) {
|
|
|
37
41
|
'<script></script>' + // Fix for Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1737882
|
|
38
42
|
head.replace(/>(\s*?import[\s\w]+?['"]\/@react-refresh)/, ' async="">$1');
|
|
39
43
|
}
|
|
44
|
+
const clientConfig = {};
|
|
45
|
+
for (const key of clientConfigOptions) {
|
|
46
|
+
if (hydrogenConfig[key] != null) {
|
|
47
|
+
clientConfig[key] = hydrogenConfig[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const clientConfigAttr = Object.keys(clientConfig).length > 0
|
|
51
|
+
? JSON.stringify(clientConfig)
|
|
52
|
+
: undefined;
|
|
40
53
|
return (react_1.default.createElement("html", { ...attrsToProps(getHtmlAttrs(template)), ...htmlAttrs },
|
|
41
54
|
react_1.default.createElement("head", { dangerouslySetInnerHTML: { __html: head } }),
|
|
42
55
|
react_1.default.createElement("body", { ...attrsToProps(getBodyAttrs(template)), ...bodyAttrs },
|
|
43
|
-
react_1.default.createElement("div", { id: "root" }, children))));
|
|
56
|
+
react_1.default.createElement("div", { id: "root", "data-client-config": clientConfigAttr }, children))));
|
|
44
57
|
}
|
|
45
58
|
exports.Html = Html;
|
|
46
59
|
function applyHtmlHead(html, head, template) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { ShopifyContextValue } from '
|
|
1
|
+
import type { ShopifyContextValue } from '../ShopifyProvider/types';
|
|
2
2
|
import type { QueryCacheControlHeaders } from '../../utilities/log/log-cache-header';
|
|
3
3
|
import type { QueryTiming } from '../../utilities/log/log-query-timeline';
|
|
4
4
|
import type { ResolvedHydrogenConfig, PreloadOptions, QueryKey } from '../../types';
|
|
5
5
|
import { HelmetData as HeadData } from 'react-helmet-async';
|
|
6
|
-
import { SessionSyncApi } from '
|
|
6
|
+
import { SessionSyncApi } from '../session/session';
|
|
7
|
+
export interface RuntimeContext {
|
|
8
|
+
waitUntil: (fn: Promise<any>) => void;
|
|
9
|
+
}
|
|
7
10
|
export declare type PreloadQueryEntry = {
|
|
8
11
|
key: QueryKey;
|
|
9
12
|
fetcher: () => Promise<unknown>;
|
|
@@ -23,7 +26,7 @@ export declare type RouterContextData = {
|
|
|
23
26
|
* - Adds a `cookies` map for easy access
|
|
24
27
|
* - Adds a static constructor to convert a Node.js `IncomingMessage` to a Request.
|
|
25
28
|
*/
|
|
26
|
-
export declare class
|
|
29
|
+
export declare class HydrogenRequest extends Request {
|
|
27
30
|
cookies: Map<string, string>;
|
|
28
31
|
id: string;
|
|
29
32
|
time: number;
|
|
@@ -40,6 +43,7 @@ export declare class ServerComponentRequest extends Request {
|
|
|
40
43
|
router: RouterContextData;
|
|
41
44
|
buyerIpHeader?: string;
|
|
42
45
|
session?: SessionSyncApi;
|
|
46
|
+
runtime?: RuntimeContext;
|
|
43
47
|
[key: string]: any;
|
|
44
48
|
};
|
|
45
49
|
constructor(input: any);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.HydrogenRequest = void 0;
|
|
4
4
|
const timing_1 = require("../../utilities/timing");
|
|
5
5
|
const hash_1 = require("../../utilities/hash");
|
|
6
6
|
const react_helmet_async_1 = require("react-helmet-async");
|
|
@@ -23,7 +23,7 @@ const PRELOAD_ALL = '*';
|
|
|
23
23
|
* - Adds a `cookies` map for easy access
|
|
24
24
|
* - Adds a static constructor to convert a Node.js `IncomingMessage` to a Request.
|
|
25
25
|
*/
|
|
26
|
-
class
|
|
26
|
+
class HydrogenRequest extends Request {
|
|
27
27
|
constructor(input, init) {
|
|
28
28
|
if (input instanceof Request) {
|
|
29
29
|
super(input, init);
|
|
@@ -99,7 +99,7 @@ class ServerComponentRequest extends Request {
|
|
|
99
99
|
return this.headers.get((_a = this.ctx.buyerIpHeader) !== null && _a !== void 0 ? _a : 'x-forwarded-for');
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
exports.
|
|
102
|
+
exports.HydrogenRequest = HydrogenRequest;
|
|
103
103
|
function mergeMapEntries(map1, map2) {
|
|
104
104
|
map2 && map2.forEach((v, k) => map1.set(k, v));
|
|
105
105
|
}
|