@shopify/hydrogen 2026.1.4 → 2026.4.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.
@@ -267,7 +267,8 @@ function useCustomerPrivacy(props) {
267
267
  useEffect(() => {
268
268
  if (observing.current.customerPrivacy) return;
269
269
  observing.current.customerPrivacy = true;
270
- let customCustomerPrivacy = null;
270
+ let backendConsentStub = null;
271
+ let fullCustomerPrivacy = null;
271
272
  let customShopify = window.Shopify || void 0;
272
273
  Object.defineProperty(window, "Shopify", {
273
274
  configurable: true,
@@ -277,15 +278,16 @@ function useCustomerPrivacy(props) {
277
278
  set(value) {
278
279
  if (typeof value === "object" && value !== null && Object.keys(value).length === 0) {
279
280
  customShopify = value;
281
+ backendConsentStub = { backendConsentEnabled: true };
280
282
  Object.defineProperty(window.Shopify, "customerPrivacy", {
281
283
  configurable: true,
282
284
  get() {
283
- return customCustomerPrivacy;
285
+ return fullCustomerPrivacy ?? backendConsentStub;
284
286
  },
285
287
  set(value2) {
286
288
  if (typeof value2 === "object" && value2 !== null && "setTrackingConsent" in value2) {
287
289
  const customerPrivacy = value2;
288
- customCustomerPrivacy = {
290
+ fullCustomerPrivacy = {
289
291
  ...customerPrivacy,
290
292
  // Note: this method is not used by the privacy-banner,
291
293
  // it bundles its own setTrackingConsent.
@@ -295,7 +297,7 @@ function useCustomerPrivacy(props) {
295
297
  };
296
298
  customShopify = {
297
299
  ...customShopify,
298
- customerPrivacy: customCustomerPrivacy
300
+ customerPrivacy: fullCustomerPrivacy
299
301
  };
300
302
  setLoaded.customerPrivacy();
301
303
  }
@@ -420,7 +422,8 @@ function overridePrivacyBannerMethods({
420
422
  }
421
423
  function getCustomerPrivacy() {
422
424
  try {
423
- return window.Shopify && window.Shopify.customerPrivacy ? window.Shopify?.customerPrivacy : null;
425
+ const cp = window.Shopify?.customerPrivacy;
426
+ return cp && "setTrackingConsent" in cp ? cp : null;
424
427
  } catch (e) {
425
428
  return null;
426
429
  }
@@ -434,7 +437,7 @@ function getPrivacyBanner() {
434
437
  }
435
438
 
436
439
  // package.json
437
- var version = "2026.1.4";
440
+ var version = "2026.4.0";
438
441
 
439
442
  // src/analytics-manager/ShopifyAnalytics.tsx
440
443
  function getCustomerPrivacyRequired() {
@@ -957,7 +960,7 @@ function register(key) {
957
960
  }
958
961
  function shopifyCanTrack() {
959
962
  try {
960
- return window.Shopify.customerPrivacy.analyticsProcessingAllowed();
963
+ return window.Shopify.customerPrivacy?.analyticsProcessingAllowed?.() ?? false;
961
964
  } catch (e) {
962
965
  }
963
966
  return false;
@@ -1830,7 +1833,7 @@ function generateUUID() {
1830
1833
  }
1831
1834
 
1832
1835
  // src/version.ts
1833
- var LIB_VERSION = "2026.1.4";
1836
+ var LIB_VERSION = "2026.4.0";
1834
1837
 
1835
1838
  // src/utils/graphql.ts
1836
1839
  function minifyQuery(string) {
@@ -3485,7 +3488,7 @@ var hydrogenContext = {
3485
3488
  };
3486
3489
 
3487
3490
  // src/customer/constants.ts
3488
- var DEFAULT_CUSTOMER_API_VERSION = "2026-01";
3491
+ var DEFAULT_CUSTOMER_API_VERSION = "2026-04";
3489
3492
  var USER_AGENT = `Shopify Hydrogen ${LIB_VERSION}`;
3490
3493
  var CUSTOMER_API_CLIENT_ID = "30243aa5-17c1-465a-8493-944bcc4e88aa";
3491
3494
  var CUSTOMER_ACCOUNT_SESSION_KEY = "customerAccount";
@@ -4412,8 +4415,7 @@ function createRequestHandler({
4412
4415
  mode,
4413
4416
  poweredByHeader = true,
4414
4417
  getLoadContext,
4415
- collectTrackingInformation = true,
4416
- proxyStandardRoutes = true
4418
+ collectTrackingInformation = true
4417
4419
  }) {
4418
4420
  const handleRequest = createRequestHandler$1(build, mode);
4419
4421
  const appendPoweredByHeader = poweredByHeader ? (response) => response.headers.append("powered-by", "Shopify, Hydrogen") : void 0;
@@ -4435,32 +4437,28 @@ function createRequestHandler({
4435
4437
  }
4436
4438
  const context = await getLoadContext?.(request);
4437
4439
  const storefront = context?.storefront || context?.get?.(storefrontContext);
4438
- if (proxyStandardRoutes) {
4439
- if (!storefront) {
4440
- warnOnce(
4441
- "[h2:createRequestHandler] Storefront instance is required to proxy standard routes."
4442
- );
4443
- }
4444
- if (storefront?.isStorefrontApiUrl(request)) {
4445
- const response2 = await storefront.forward(request);
4446
- appendPoweredByHeader?.(response2);
4447
- return response2;
4448
- }
4449
- if (storefront?.isMcpUrl(request)) {
4450
- const response2 = await storefront.forwardMcp(request);
4451
- appendPoweredByHeader?.(response2);
4452
- return response2;
4453
- }
4440
+ if (!storefront) {
4441
+ throw new Error(
4442
+ "[h2:createRequestHandler] Storefront instance is required in the load context. Make sure to use createHydrogenContext() or provide a storefront instance via getLoadContext."
4443
+ );
4444
+ }
4445
+ if (storefront.isStorefrontApiUrl(request)) {
4446
+ const response2 = await storefront.forward(request);
4447
+ appendPoweredByHeader?.(response2);
4448
+ return response2;
4449
+ }
4450
+ if (storefront.isMcpUrl(request)) {
4451
+ const response2 = await storefront.forwardMcp(request);
4452
+ appendPoweredByHeader?.(response2);
4453
+ return response2;
4454
4454
  }
4455
4455
  const response = await handleRequest(request, context);
4456
- if (storefront && proxyStandardRoutes) {
4457
- if (collectTrackingInformation) {
4458
- storefront.setCollectedSubrequestHeaders(response);
4459
- }
4460
- const fetchDest = request.headers.get("sec-fetch-dest");
4461
- if (fetchDest && fetchDest === "document" || request.headers.get("accept")?.includes("text/html")) {
4462
- appendServerTimingHeader(response, { [HYDROGEN_SFAPI_PROXY_KEY]: "1" });
4463
- }
4456
+ if (collectTrackingInformation) {
4457
+ storefront.setCollectedSubrequestHeaders(response);
4458
+ }
4459
+ const fetchDest = request.headers.get("sec-fetch-dest");
4460
+ if (fetchDest && fetchDest === "document" || request.headers.get("accept")?.includes("text/html")) {
4461
+ appendServerTimingHeader(response, { [HYDROGEN_SFAPI_PROXY_KEY]: "1" });
4464
4462
  }
4465
4463
  appendPoweredByHeader?.(response);
4466
4464
  return response;
@@ -6500,14 +6498,14 @@ var QUERIES = {
6500
6498
  //! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartNoteUpdate
6501
6499
  //! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartSelectedDeliveryOptionsUpdate
6502
6500
  //! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartMetafieldsSet
6503
- //! @see https://shopify.dev/docs/api/storefront/2026-01/mutations/cartMetafieldDelete
6501
+ //! @see https://shopify.dev/docs/api/storefront/2026-04/mutations/cartMetafieldDelete
6504
6502
  //! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartGiftCardCodesUpdate
6505
6503
  //! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartGiftCardCodesAdd
6506
6504
  //! @see https://shopify.dev/docs/api/storefront/latest/mutations/cartGiftCardCodesRemove
6507
6505
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesAdd
6508
6506
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesRemove
6509
6507
  //! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartDeliveryAddressesUpdate
6510
- //! @see: https://shopify.dev/docs/api/storefront/2026-01/mutations/cartDeliveryAddressesReplace
6508
+ //! @see: https://shopify.dev/docs/api/storefront/2026-04/mutations/cartDeliveryAddressesReplace
6511
6509
 
6512
6510
  export { Analytics, AnalyticsEvent, CacheCustom, CacheLong, CacheNone, CacheShort, CartForm, InMemoryCache, NonceProvider, OptimisticInput, Pagination, RichText, Script, Seo, ShopPayButton, VariantSelector, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartGiftCardCodesAddDefault, cartGiftCardCodesRemoveDefault, cartGiftCardCodesUpdateDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, changelogHandler, createCartHandler, createContentSecurityPolicy, createCustomerAccountClient, createHydrogenContext, createRequestHandler, createStorefrontClient, createWithCache, formatAPIResult, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, getSeoMeta, getShopAnalytics, getSitemap, getSitemapIndex, graphiqlLoader, hydrogenContext, hydrogenPreset, hydrogenRoutes, storefrontRedirect, useAnalytics, useCustomerPrivacy, useNonce, useOptimisticCart, useOptimisticData, useOptimisticVariant };
6513
6511
  //# sourceMappingURL=index.js.map