@shopify/hydrogen 2025.4.0 → 2025.4.2

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.
@@ -2,9 +2,9 @@ import * as react from 'react';
2
2
  import { ReactNode, ComponentType, ScriptHTMLAttributes, FC, Ref, ComponentProps } from 'react';
3
3
  import { BuyerInput, LanguageCode, CountryCode, Cart, CartMetafieldsSetInput, Scalars, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, CartWarning, Product, ProductVariant, CartLine, ComponentizableCartLine, CurrencyCode, AttributeInput, CartBuyerIdentityInput, CartInput, CartLineInput, CartLineUpdateInput, CartSelectedDeliveryOptionInput, CartSelectableAddressInput, CartSelectableAddressUpdateInput, PageInfo, Maybe, ProductOptionValue, SelectedOptionInput, ProductOption, ProductVariantConnection } from '@shopify/hydrogen-react/storefront-api-types';
4
4
  import { createStorefrontClient as createStorefrontClient$1, StorefrontClientProps, RichText as RichText$1, ShopPayButton as ShopPayButton$1 } from '@shopify/hydrogen-react';
5
- export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MappedProductOptions, MediaFile, ModelViewer, Money, ParsedMetafields, ShopifyAnalytics as SendShopifyAnalyticsEvent, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, customerAccountApiCustomScalars, decodeEncodedVariant, flattenConnection, getAdjacentAndFirstAvailableVariants, getClientBrowserParameters, getProductOptions, getShopifyCookies, isOptionValueCombinationInEncodedVariant, mapSelectedProductOptionToObject, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useSelectedOptionInUrlParam, useShopifyCookies } from '@shopify/hydrogen-react';
5
+ export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MappedProductOptions, MediaFile, ModelViewer, Money, ParsedMetafields, ShopifyAnalytics as SendShopifyAnalyticsEvent, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, customerAccountApiCustomScalars, decodeEncodedVariant, flattenConnection, getAdjacentAndFirstAvailableVariants, getClientBrowserParameters, getProductOptions, getShopifyCookies, getTrackingValues, isOptionValueCombinationInEncodedVariant, mapSelectedProductOptionToObject, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useSelectedOptionInUrlParam, useShopifyCookies } from '@shopify/hydrogen-react';
6
6
  import { ExecutionArgs } from 'graphql';
7
- import { SessionData, FlashSessionData, Session, SessionStorage, LoaderFunctionArgs, LoaderFunction, SerializeFrom } from '@remix-run/server-runtime';
7
+ import { SessionData, FlashSessionData, Session, SessionStorage, ServerBuild, LoaderFunctionArgs, LoaderFunction, SerializeFrom } from '@remix-run/server-runtime';
8
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
9
  import { FetcherWithComponents, LinkProps, MetaFunction, Params, Location } from '@remix-run/react';
10
10
  import { PartialDeep } from 'type-fest';
@@ -639,9 +639,11 @@ type StorefrontHeaders = {
639
639
  requestGroupId: string | null;
640
640
  /** The IP address of the client. */
641
641
  buyerIp: string | null;
642
+ /** The signature of the client's IP address for verification. */
643
+ buyerIpSig: string | null;
642
644
  /** The cookie header from the client */
643
645
  cookie: string | null;
644
- /** The purpose header value for debugging */
646
+ /** The sec-purpose or purpose header value */
645
647
  purpose: string | null;
646
648
  };
647
649
 
@@ -717,6 +719,26 @@ type Storefront<TI18n extends I18nBase = I18nBase> = {
717
719
  getShopifyDomain: ReturnType<typeof createStorefrontClient$1>['getShopifyDomain'];
718
720
  getApiUrl: ReturnType<typeof createStorefrontClient$1>['getStorefrontApiUrl'];
719
721
  i18n: TI18n;
722
+ getHeaders: () => Record<string, string>;
723
+ /**
724
+ * Checks if the request URL matches the Storefront API GraphQL endpoint.
725
+ */
726
+ isStorefrontApiUrl: (request: {
727
+ url?: string;
728
+ }) => boolean;
729
+ /**
730
+ * Forwards the request to the Storefront API.
731
+ * It reads the API version from the request URL.
732
+ */
733
+ forward: (request: Request, options?: Pick<StorefrontCommonExtraParams, 'storefrontApiVersion'>) => Promise<Response>;
734
+ /**
735
+ * Sets the collected subrequest headers in the response.
736
+ * Useful to forward the cookies and server-timing headers
737
+ * from server subrequests to the browser.
738
+ */
739
+ setCollectedSubrequestHeaders: (response: {
740
+ headers: Headers;
741
+ }) => void;
720
742
  };
721
743
  type HydrogenClientProps<TI18n> = {
722
744
  /** Storefront API headers. If on Oxygen, use `getStorefrontHeaders()` */
@@ -1122,18 +1144,13 @@ type SetConsentHeadlessParams = VisitorConsent & CustomerPrivacyConsentConfig &
1122
1144
  doesMerchantSupportGranularConsent
1123
1145
  firstPartyMarketingAllowed
1124
1146
  getCCPAConsent
1125
- getRegulation
1126
- getShopPrefs
1127
1147
  getTrackingConsent
1128
- isRegulationEnforced
1129
1148
  marketingAllowed
1130
1149
  preferencesProcessingAllowed
1131
1150
  saleOfDataAllowed
1132
1151
  saleOfDataRegion
1133
- setCCPAConsent
1134
1152
  setTrackingConsent
1135
1153
  shouldShowBanner
1136
- shouldShowCCPABanner
1137
1154
  shouldShowGDPRBanner
1138
1155
  thirdPartyMarketingAllowed
1139
1156
  **/
@@ -1146,6 +1163,7 @@ type OriginalCustomerPrivacy = {
1146
1163
  setTrackingConsent: (consent: SetConsentHeadlessParams, callback: (data: {
1147
1164
  error: string;
1148
1165
  } | undefined) => void) => void;
1166
+ shouldShowBanner: () => boolean;
1149
1167
  };
1150
1168
  type CustomerPrivacy$1 = Omit<OriginalCustomerPrivacy, 'setTrackingConsent'> & {
1151
1169
  setTrackingConsent: (consent: VisitorConsent, // we have already applied the headlessStorefront in the override
@@ -1176,6 +1194,11 @@ type CustomerPrivacyApiProps = {
1176
1194
  onVisitorConsentCollected?: (consent: VisitorConsentCollected) => void;
1177
1195
  /** Callback to be call when customer privacy api is ready. */
1178
1196
  onReady?: () => void;
1197
+ /**
1198
+ * Whether consent libraries can use same-domain requests to the Storefront API.
1199
+ * Defaults to true if the standard route proxy is enabled in Hydrogen server.
1200
+ */
1201
+ sameDomainForStorefrontApi?: boolean;
1179
1202
  };
1180
1203
  declare function useCustomerPrivacy(props: CustomerPrivacyApiProps): {
1181
1204
  customerPrivacy: CustomerPrivacy$1 | null;
@@ -1192,7 +1215,7 @@ type ShopAnalytics = {
1192
1215
  /** The Hydrogen subchannel ID generated by Oxygen in the environment variable. */
1193
1216
  hydrogenSubchannelId: string | '0';
1194
1217
  };
1195
- type Consent = Partial<Pick<CustomerPrivacyApiProps, 'checkoutDomain' | 'storefrontAccessToken' | 'withPrivacyBanner' | 'country'>> & {
1218
+ type Consent = Partial<Pick<CustomerPrivacyApiProps, 'checkoutDomain' | 'sameDomainForStorefrontApi' | 'storefrontAccessToken' | 'withPrivacyBanner' | 'country'>> & {
1196
1219
  language?: LanguageCode;
1197
1220
  };
1198
1221
  type AnalyticsProviderProps = {
@@ -1750,6 +1773,7 @@ type CartHandlerOptions = {
1750
1773
  setCartId: (cartId: string) => Headers;
1751
1774
  cartQueryFragment?: string;
1752
1775
  cartMutateFragment?: string;
1776
+ buyerIdentity?: CartBuyerIdentityInput;
1753
1777
  };
1754
1778
  type CustomMethodsBase = Record<string, Function>;
1755
1779
  type CartHandlerOptionsWithCustom<TCustomMethods extends CustomMethodsBase> = CartHandlerOptions & {
@@ -1951,6 +1975,7 @@ type HydrogenContextOptions<TSession extends HydrogenSession = HydrogenSession,
1951
1975
  */
1952
1976
  customMethods?: TCustomMethods;
1953
1977
  };
1978
+ buyerIdentity?: CartBuyerIdentityInput;
1954
1979
  };
1955
1980
  interface HydrogenContext<TSession extends HydrogenSession = HydrogenSession, TCustomMethods extends CustomMethodsBase | undefined = {}, TI18n extends I18nBase = I18nBase, TEnv extends HydrogenEnv = Env> {
1956
1981
  /** A GraphQL client for querying the [Storefront API](https://shopify.dev/docs/api/storefront). */
@@ -1967,6 +1992,42 @@ interface HydrogenContext<TSession extends HydrogenSession = HydrogenSession, TC
1967
1992
  }
1968
1993
  declare function createHydrogenContext<TSession extends HydrogenSession = HydrogenSession, TCustomMethods extends CustomMethodsBase | undefined = {}, TI18n extends I18nBase = I18nBase, TEnv extends HydrogenEnv = Env>(options: HydrogenContextOptions<TSession, TCustomMethods, TI18n, TEnv>): HydrogenContext<TSession, TCustomMethods, TI18n, TEnv>;
1969
1994
 
1995
+ type CreateRequestHandlerOptions<Context = unknown> = {
1996
+ /** Remix's server build */
1997
+ build: ServerBuild;
1998
+ /** Remix's mode */
1999
+ mode?: string;
2000
+ /**
2001
+ * Function to provide the load context for each request.
2002
+ * It must contain Hydrogen's storefront client instance
2003
+ * for other Hydrogen utilities to work properly.
2004
+ */
2005
+ getLoadContext?: (request: Request) => Promise<Context> | Context;
2006
+ /**
2007
+ * Whether to include the `powered-by` header in responses
2008
+ * @default true
2009
+ */
2010
+ poweredByHeader?: boolean;
2011
+ /**
2012
+ * Collect tracking information from subrequests such as cookies
2013
+ * and forward them to the browser. Disable this if you are not
2014
+ * using Hydrogen's built-in analytics.
2015
+ * @default true
2016
+ */
2017
+ collectTrackingInformation?: boolean;
2018
+ /**
2019
+ * Whether to proxy standard routes such as `/api/.../graphql.json` (Storefront API).
2020
+ * You can disable this if you are handling these routes yourself. Ensure that
2021
+ * the proxy works if you rely on Hydrogen's built-in behaviors such as analytics.
2022
+ * @default true
2023
+ */
2024
+ proxyStandardRoutes?: boolean;
2025
+ };
2026
+ /**
2027
+ * Creates a request handler for Hydrogen apps using Remix.
2028
+ */
2029
+ declare function createRequestHandler<Context = unknown>({ build, mode, poweredByHeader, getLoadContext, collectTrackingInformation, proxyStandardRoutes, }: CreateRequestHandlerOptions<Context>): (request: Request) => Promise<Response>;
2030
+
1970
2031
  declare const useNonce: () => string | undefined;
1971
2032
  type ContentSecurityPolicy = {
1972
2033
  /** A randomly generated nonce string that should be passed to any custom `script` element */
@@ -2581,4 +2642,4 @@ interface GetSiteMapOptions {
2581
2642
  */
2582
2643
  declare function getSitemap(options: GetSiteMapOptions): Promise<Response>;
2583
2644
 
2584
- export { Analytics, AnalyticsEvent, CacheCustom, type CacheKey, CacheLong, CacheNone, CacheShort, type CachingStrategy, type CartActionInput, CartForm, type CartLineUpdatePayload, type CartQueryDataReturn, type CartQueryOptions, type CartQueryReturn, type CartReturn, type CartUpdatePayload, type CartViewPayload, type CollectionViewPayload, type ConsentStatus, type CookieOptions, type CreateStorefrontClientForDocs, type CreateStorefrontClientOptions, type CustomEventMap$1 as CustomEventMap, type CustomerAccount, type CustomerAccountMutations, type CustomerAccountQueries, type CustomerPrivacy$1 as CustomerPrivacy, type CustomerPrivacyApiProps, type CustomerPrivacyConsentConfig, type HydrogenCart, type HydrogenCartCustom, type HydrogenContext, type HydrogenEnv, type HydrogenSession, type HydrogenSessionData, type I18nBase, InMemoryCache, type MetafieldWithoutOwnerId, type NoStoreStrategy, type OptimisticCart, type OptimisticCartLine, type OptimisticCartLineInput, OptimisticInput, type PageViewPayload, Pagination, type PrivacyBanner$1 as PrivacyBanner, type ProductViewPayload, RichText, Script, type SearchViewPayload, Seo, type SeoConfig, type SeoHandleFunction, type SetConsentHeadlessParams, type ShopAnalytics, ShopPayButton, type Storefront, type StorefrontApiErrors, type StorefrontClient, type StorefrontForDoc, type StorefrontMutationOptionsForDocs, type StorefrontMutations, type StorefrontQueries, type StorefrontQueryOptionsForDocs, type VariantOption, type VariantOptionValue, VariantSelector, type VisitorConsent, type VisitorConsentCollected, type WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartGiftCardCodesUpdateDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, changelogHandler, createCartHandler, createContentSecurityPolicy, createCustomerAccountClient, createHydrogenContext, createStorefrontClient, createWithCache, formatAPIResult, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, getSeoMeta, getShopAnalytics, getSitemap, getSitemapIndex, graphiqlLoader, hydrogenRoutes, storefrontRedirect, useAnalytics, useCustomerPrivacy, useNonce, useOptimisticCart, useOptimisticData, useOptimisticVariant };
2645
+ export { Analytics, AnalyticsEvent, CacheCustom, type CacheKey, CacheLong, CacheNone, CacheShort, type CachingStrategy, type CartActionInput, CartForm, type CartLineUpdatePayload, type CartQueryDataReturn, type CartQueryOptions, type CartQueryReturn, type CartReturn, type CartUpdatePayload, type CartViewPayload, type CollectionViewPayload, type ConsentStatus, type CookieOptions, type CreateStorefrontClientForDocs, type CreateStorefrontClientOptions, type CustomEventMap$1 as CustomEventMap, type CustomerAccount, type CustomerAccountMutations, type CustomerAccountQueries, type CustomerPrivacy$1 as CustomerPrivacy, type CustomerPrivacyApiProps, type CustomerPrivacyConsentConfig, type HydrogenCart, type HydrogenCartCustom, type HydrogenContext, type HydrogenEnv, type HydrogenSession, type HydrogenSessionData, type I18nBase, InMemoryCache, type MetafieldWithoutOwnerId, type NoStoreStrategy, type OptimisticCart, type OptimisticCartLine, type OptimisticCartLineInput, OptimisticInput, type PageViewPayload, Pagination, type PrivacyBanner$1 as PrivacyBanner, type ProductViewPayload, RichText, Script, type SearchViewPayload, Seo, type SeoConfig, type SeoHandleFunction, type SetConsentHeadlessParams, type ShopAnalytics, ShopPayButton, type Storefront, type StorefrontApiErrors, type StorefrontClient, type StorefrontForDoc, type StorefrontMutationOptionsForDocs, type StorefrontMutations, type StorefrontQueries, type StorefrontQueryOptionsForDocs, type VariantOption, type VariantOptionValue, VariantSelector, type VisitorConsent, type VisitorConsentCollected, type WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, 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, hydrogenRoutes, storefrontRedirect, useAnalytics, useCustomerPrivacy, useNonce, useOptimisticCart, useOptimisticData, useOptimisticVariant };
@@ -2,9 +2,9 @@ import * as react from 'react';
2
2
  import { ReactNode, ComponentType, ScriptHTMLAttributes, FC, Ref, ComponentProps } from 'react';
3
3
  import { BuyerInput, LanguageCode, CountryCode, Cart, CartMetafieldsSetInput, Scalars, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, CartWarning, Product, ProductVariant, CartLine, ComponentizableCartLine, CurrencyCode, AttributeInput, CartBuyerIdentityInput, CartInput, CartLineInput, CartLineUpdateInput, CartSelectedDeliveryOptionInput, CartSelectableAddressInput, CartSelectableAddressUpdateInput, PageInfo, Maybe, ProductOptionValue, SelectedOptionInput, ProductOption, ProductVariantConnection } from '@shopify/hydrogen-react/storefront-api-types';
4
4
  import { createStorefrontClient as createStorefrontClient$1, StorefrontClientProps, RichText as RichText$1, ShopPayButton as ShopPayButton$1 } from '@shopify/hydrogen-react';
5
- export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MappedProductOptions, MediaFile, ModelViewer, Money, ParsedMetafields, ShopifyAnalytics as SendShopifyAnalyticsEvent, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, customerAccountApiCustomScalars, decodeEncodedVariant, flattenConnection, getAdjacentAndFirstAvailableVariants, getClientBrowserParameters, getProductOptions, getShopifyCookies, isOptionValueCombinationInEncodedVariant, mapSelectedProductOptionToObject, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useSelectedOptionInUrlParam, useShopifyCookies } from '@shopify/hydrogen-react';
5
+ export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MappedProductOptions, MediaFile, ModelViewer, Money, ParsedMetafields, ShopifyAnalytics as SendShopifyAnalyticsEvent, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, customerAccountApiCustomScalars, decodeEncodedVariant, flattenConnection, getAdjacentAndFirstAvailableVariants, getClientBrowserParameters, getProductOptions, getShopifyCookies, getTrackingValues, isOptionValueCombinationInEncodedVariant, mapSelectedProductOptionToObject, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useSelectedOptionInUrlParam, useShopifyCookies } from '@shopify/hydrogen-react';
6
6
  import { ExecutionArgs } from 'graphql';
7
- import { SessionData, FlashSessionData, Session, SessionStorage, LoaderFunctionArgs, LoaderFunction, SerializeFrom } from '@remix-run/server-runtime';
7
+ import { SessionData, FlashSessionData, Session, SessionStorage, ServerBuild, LoaderFunctionArgs, LoaderFunction, SerializeFrom } from '@remix-run/server-runtime';
8
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
9
  import { FetcherWithComponents, LinkProps, MetaFunction, Params, Location } from '@remix-run/react';
10
10
  import { PartialDeep } from 'type-fest';
@@ -639,9 +639,11 @@ type StorefrontHeaders = {
639
639
  requestGroupId: string | null;
640
640
  /** The IP address of the client. */
641
641
  buyerIp: string | null;
642
+ /** The signature of the client's IP address for verification. */
643
+ buyerIpSig: string | null;
642
644
  /** The cookie header from the client */
643
645
  cookie: string | null;
644
- /** The purpose header value for debugging */
646
+ /** The sec-purpose or purpose header value */
645
647
  purpose: string | null;
646
648
  };
647
649
 
@@ -717,6 +719,26 @@ type Storefront<TI18n extends I18nBase = I18nBase> = {
717
719
  getShopifyDomain: ReturnType<typeof createStorefrontClient$1>['getShopifyDomain'];
718
720
  getApiUrl: ReturnType<typeof createStorefrontClient$1>['getStorefrontApiUrl'];
719
721
  i18n: TI18n;
722
+ getHeaders: () => Record<string, string>;
723
+ /**
724
+ * Checks if the request URL matches the Storefront API GraphQL endpoint.
725
+ */
726
+ isStorefrontApiUrl: (request: {
727
+ url?: string;
728
+ }) => boolean;
729
+ /**
730
+ * Forwards the request to the Storefront API.
731
+ * It reads the API version from the request URL.
732
+ */
733
+ forward: (request: Request, options?: Pick<StorefrontCommonExtraParams, 'storefrontApiVersion'>) => Promise<Response>;
734
+ /**
735
+ * Sets the collected subrequest headers in the response.
736
+ * Useful to forward the cookies and server-timing headers
737
+ * from server subrequests to the browser.
738
+ */
739
+ setCollectedSubrequestHeaders: (response: {
740
+ headers: Headers;
741
+ }) => void;
720
742
  };
721
743
  type HydrogenClientProps<TI18n> = {
722
744
  /** Storefront API headers. If on Oxygen, use `getStorefrontHeaders()` */
@@ -1122,18 +1144,13 @@ type SetConsentHeadlessParams = VisitorConsent & CustomerPrivacyConsentConfig &
1122
1144
  doesMerchantSupportGranularConsent
1123
1145
  firstPartyMarketingAllowed
1124
1146
  getCCPAConsent
1125
- getRegulation
1126
- getShopPrefs
1127
1147
  getTrackingConsent
1128
- isRegulationEnforced
1129
1148
  marketingAllowed
1130
1149
  preferencesProcessingAllowed
1131
1150
  saleOfDataAllowed
1132
1151
  saleOfDataRegion
1133
- setCCPAConsent
1134
1152
  setTrackingConsent
1135
1153
  shouldShowBanner
1136
- shouldShowCCPABanner
1137
1154
  shouldShowGDPRBanner
1138
1155
  thirdPartyMarketingAllowed
1139
1156
  **/
@@ -1146,6 +1163,7 @@ type OriginalCustomerPrivacy = {
1146
1163
  setTrackingConsent: (consent: SetConsentHeadlessParams, callback: (data: {
1147
1164
  error: string;
1148
1165
  } | undefined) => void) => void;
1166
+ shouldShowBanner: () => boolean;
1149
1167
  };
1150
1168
  type CustomerPrivacy$1 = Omit<OriginalCustomerPrivacy, 'setTrackingConsent'> & {
1151
1169
  setTrackingConsent: (consent: VisitorConsent, // we have already applied the headlessStorefront in the override
@@ -1176,6 +1194,11 @@ type CustomerPrivacyApiProps = {
1176
1194
  onVisitorConsentCollected?: (consent: VisitorConsentCollected) => void;
1177
1195
  /** Callback to be call when customer privacy api is ready. */
1178
1196
  onReady?: () => void;
1197
+ /**
1198
+ * Whether consent libraries can use same-domain requests to the Storefront API.
1199
+ * Defaults to true if the standard route proxy is enabled in Hydrogen server.
1200
+ */
1201
+ sameDomainForStorefrontApi?: boolean;
1179
1202
  };
1180
1203
  declare function useCustomerPrivacy(props: CustomerPrivacyApiProps): {
1181
1204
  customerPrivacy: CustomerPrivacy$1 | null;
@@ -1192,7 +1215,7 @@ type ShopAnalytics = {
1192
1215
  /** The Hydrogen subchannel ID generated by Oxygen in the environment variable. */
1193
1216
  hydrogenSubchannelId: string | '0';
1194
1217
  };
1195
- type Consent = Partial<Pick<CustomerPrivacyApiProps, 'checkoutDomain' | 'storefrontAccessToken' | 'withPrivacyBanner' | 'country'>> & {
1218
+ type Consent = Partial<Pick<CustomerPrivacyApiProps, 'checkoutDomain' | 'sameDomainForStorefrontApi' | 'storefrontAccessToken' | 'withPrivacyBanner' | 'country'>> & {
1196
1219
  language?: LanguageCode;
1197
1220
  };
1198
1221
  type AnalyticsProviderProps = {
@@ -1750,6 +1773,7 @@ type CartHandlerOptions = {
1750
1773
  setCartId: (cartId: string) => Headers;
1751
1774
  cartQueryFragment?: string;
1752
1775
  cartMutateFragment?: string;
1776
+ buyerIdentity?: CartBuyerIdentityInput;
1753
1777
  };
1754
1778
  type CustomMethodsBase = Record<string, Function>;
1755
1779
  type CartHandlerOptionsWithCustom<TCustomMethods extends CustomMethodsBase> = CartHandlerOptions & {
@@ -1951,6 +1975,7 @@ type HydrogenContextOptions<TSession extends HydrogenSession = HydrogenSession,
1951
1975
  */
1952
1976
  customMethods?: TCustomMethods;
1953
1977
  };
1978
+ buyerIdentity?: CartBuyerIdentityInput;
1954
1979
  };
1955
1980
  interface HydrogenContext<TSession extends HydrogenSession = HydrogenSession, TCustomMethods extends CustomMethodsBase | undefined = {}, TI18n extends I18nBase = I18nBase, TEnv extends HydrogenEnv = Env> {
1956
1981
  /** A GraphQL client for querying the [Storefront API](https://shopify.dev/docs/api/storefront). */
@@ -1967,6 +1992,42 @@ interface HydrogenContext<TSession extends HydrogenSession = HydrogenSession, TC
1967
1992
  }
1968
1993
  declare function createHydrogenContext<TSession extends HydrogenSession = HydrogenSession, TCustomMethods extends CustomMethodsBase | undefined = {}, TI18n extends I18nBase = I18nBase, TEnv extends HydrogenEnv = Env>(options: HydrogenContextOptions<TSession, TCustomMethods, TI18n, TEnv>): HydrogenContext<TSession, TCustomMethods, TI18n, TEnv>;
1969
1994
 
1995
+ type CreateRequestHandlerOptions<Context = unknown> = {
1996
+ /** Remix's server build */
1997
+ build: ServerBuild;
1998
+ /** Remix's mode */
1999
+ mode?: string;
2000
+ /**
2001
+ * Function to provide the load context for each request.
2002
+ * It must contain Hydrogen's storefront client instance
2003
+ * for other Hydrogen utilities to work properly.
2004
+ */
2005
+ getLoadContext?: (request: Request) => Promise<Context> | Context;
2006
+ /**
2007
+ * Whether to include the `powered-by` header in responses
2008
+ * @default true
2009
+ */
2010
+ poweredByHeader?: boolean;
2011
+ /**
2012
+ * Collect tracking information from subrequests such as cookies
2013
+ * and forward them to the browser. Disable this if you are not
2014
+ * using Hydrogen's built-in analytics.
2015
+ * @default true
2016
+ */
2017
+ collectTrackingInformation?: boolean;
2018
+ /**
2019
+ * Whether to proxy standard routes such as `/api/.../graphql.json` (Storefront API).
2020
+ * You can disable this if you are handling these routes yourself. Ensure that
2021
+ * the proxy works if you rely on Hydrogen's built-in behaviors such as analytics.
2022
+ * @default true
2023
+ */
2024
+ proxyStandardRoutes?: boolean;
2025
+ };
2026
+ /**
2027
+ * Creates a request handler for Hydrogen apps using Remix.
2028
+ */
2029
+ declare function createRequestHandler<Context = unknown>({ build, mode, poweredByHeader, getLoadContext, collectTrackingInformation, proxyStandardRoutes, }: CreateRequestHandlerOptions<Context>): (request: Request) => Promise<Response>;
2030
+
1970
2031
  declare const useNonce: () => string | undefined;
1971
2032
  type ContentSecurityPolicy = {
1972
2033
  /** A randomly generated nonce string that should be passed to any custom `script` element */
@@ -2581,4 +2642,4 @@ interface GetSiteMapOptions {
2581
2642
  */
2582
2643
  declare function getSitemap(options: GetSiteMapOptions): Promise<Response>;
2583
2644
 
2584
- export { Analytics, AnalyticsEvent, CacheCustom, type CacheKey, CacheLong, CacheNone, CacheShort, type CachingStrategy, type CartActionInput, CartForm, type CartLineUpdatePayload, type CartQueryDataReturn, type CartQueryOptions, type CartQueryReturn, type CartReturn, type CartUpdatePayload, type CartViewPayload, type CollectionViewPayload, type ConsentStatus, type CookieOptions, type CreateStorefrontClientForDocs, type CreateStorefrontClientOptions, type CustomEventMap$1 as CustomEventMap, type CustomerAccount, type CustomerAccountMutations, type CustomerAccountQueries, type CustomerPrivacy$1 as CustomerPrivacy, type CustomerPrivacyApiProps, type CustomerPrivacyConsentConfig, type HydrogenCart, type HydrogenCartCustom, type HydrogenContext, type HydrogenEnv, type HydrogenSession, type HydrogenSessionData, type I18nBase, InMemoryCache, type MetafieldWithoutOwnerId, type NoStoreStrategy, type OptimisticCart, type OptimisticCartLine, type OptimisticCartLineInput, OptimisticInput, type PageViewPayload, Pagination, type PrivacyBanner$1 as PrivacyBanner, type ProductViewPayload, RichText, Script, type SearchViewPayload, Seo, type SeoConfig, type SeoHandleFunction, type SetConsentHeadlessParams, type ShopAnalytics, ShopPayButton, type Storefront, type StorefrontApiErrors, type StorefrontClient, type StorefrontForDoc, type StorefrontMutationOptionsForDocs, type StorefrontMutations, type StorefrontQueries, type StorefrontQueryOptionsForDocs, type VariantOption, type VariantOptionValue, VariantSelector, type VisitorConsent, type VisitorConsentCollected, type WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartGiftCardCodesUpdateDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, changelogHandler, createCartHandler, createContentSecurityPolicy, createCustomerAccountClient, createHydrogenContext, createStorefrontClient, createWithCache, formatAPIResult, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, getSeoMeta, getShopAnalytics, getSitemap, getSitemapIndex, graphiqlLoader, hydrogenRoutes, storefrontRedirect, useAnalytics, useCustomerPrivacy, useNonce, useOptimisticCart, useOptimisticData, useOptimisticVariant };
2645
+ export { Analytics, AnalyticsEvent, CacheCustom, type CacheKey, CacheLong, CacheNone, CacheShort, type CachingStrategy, type CartActionInput, CartForm, type CartLineUpdatePayload, type CartQueryDataReturn, type CartQueryOptions, type CartQueryReturn, type CartReturn, type CartUpdatePayload, type CartViewPayload, type CollectionViewPayload, type ConsentStatus, type CookieOptions, type CreateStorefrontClientForDocs, type CreateStorefrontClientOptions, type CustomEventMap$1 as CustomEventMap, type CustomerAccount, type CustomerAccountMutations, type CustomerAccountQueries, type CustomerPrivacy$1 as CustomerPrivacy, type CustomerPrivacyApiProps, type CustomerPrivacyConsentConfig, type HydrogenCart, type HydrogenCartCustom, type HydrogenContext, type HydrogenEnv, type HydrogenSession, type HydrogenSessionData, type I18nBase, InMemoryCache, type MetafieldWithoutOwnerId, type NoStoreStrategy, type OptimisticCart, type OptimisticCartLine, type OptimisticCartLineInput, OptimisticInput, type PageViewPayload, Pagination, type PrivacyBanner$1 as PrivacyBanner, type ProductViewPayload, RichText, Script, type SearchViewPayload, Seo, type SeoConfig, type SeoHandleFunction, type SetConsentHeadlessParams, type ShopAnalytics, ShopPayButton, type Storefront, type StorefrontApiErrors, type StorefrontClient, type StorefrontForDoc, type StorefrontMutationOptionsForDocs, type StorefrontMutations, type StorefrontQueries, type StorefrontQueryOptionsForDocs, type VariantOption, type VariantOptionValue, VariantSelector, type VisitorConsent, type VisitorConsentCollected, type WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, 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, hydrogenRoutes, storefrontRedirect, useAnalytics, useCustomerPrivacy, useNonce, useOptimisticCart, useOptimisticData, useOptimisticVariant };