@shopify/hydrogen 2024.4.4 → 2024.4.6

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.
@@ -484,7 +484,7 @@ async function fetchWithServerCache(url, requestInit, {
484
484
  }
485
485
 
486
486
  // src/version.ts
487
- var LIB_VERSION = "2024.4.4";
487
+ var LIB_VERSION = "2024.4.6";
488
488
 
489
489
  // src/constants.ts
490
490
  var STOREFRONT_REQUEST_GROUP_ID_HEADER = "Custom-Storefront-Request-Group-ID";
@@ -4203,8 +4203,9 @@ function ShopifyAnalytics({
4203
4203
  }
4204
4204
  });
4205
4205
  hydrogenReact.useShopifyCookies({
4206
- hasUserConsent: canTrack(),
4207
- domain
4206
+ hasUserConsent: shopifyReady && privacyReady ? canTrack() : true,
4207
+ domain,
4208
+ checkoutDomain
4208
4209
  });
4209
4210
  react.useEffect(() => {
4210
4211
  subscribe2(AnalyticsEvent.PAGE_VIEWED, pageViewHandler);
@@ -4450,7 +4451,7 @@ function formatProduct(products) {
4450
4451
  }
4451
4452
  function logMissingField(fieldName) {
4452
4453
  console.error(
4453
- `[h2:error:CartAnalytics] Unable to set up cart analytics events: ${fieldName} is missing.`
4454
+ `[h2:error:CartAnalytics] Can't set up cart analytics events because the \`cart.${fieldName}\` value is missing from your GraphQL cart query. In standard Hydrogen projects, the cart query is contained in \`app/lib/fragments.js\`. Make sure it includes \`cart.${fieldName}\`. Check the Hydrogen Skeleton template for reference: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/lib/fragments.ts#L59.`
4454
4455
  );
4455
4456
  }
4456
4457
  function CartAnalytics({
@@ -4465,11 +4466,11 @@ function CartAnalytics({
4465
4466
  Promise.resolve(currentCart).then((updatedCart) => {
4466
4467
  if (updatedCart && updatedCart.lines) {
4467
4468
  if (!updatedCart.id) {
4468
- logMissingField("cart.id");
4469
+ logMissingField("id");
4469
4470
  return;
4470
4471
  }
4471
4472
  if (!updatedCart.updatedAt) {
4472
- logMissingField("cart.updatedAt");
4473
+ logMissingField("updatedAt");
4473
4474
  return;
4474
4475
  }
4475
4476
  }