@shopify/hydrogen 2023.7.13 → 2023.10.1

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,7 +2,7 @@ import { createStorefrontClient as createStorefrontClient$1, StorefrontClientPro
2
2
  export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MediaFile, ModelViewer, Money, ParsedMetafields, ShopPayButton, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalytics, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, flattenConnection, getClientBrowserParameters, getShopifyCookies, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useShopifyCookies } from '@shopify/hydrogen-react';
3
3
  import { ExecutionArgs } from 'graphql';
4
4
  import { LanguageCode, CountryCode, Maybe, PageInfo, CartMetafieldsSetInput, Cart, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, Scalars, AttributeInput, CartBuyerIdentityInput, CartInput, CartLineInput, CartLineUpdateInput, CartSelectedDeliveryOptionInput, ProductOption, ProductVariantConnection, ProductVariant, SelectedOptionInput } from '@shopify/hydrogen-react/storefront-api-types';
5
- import { LoaderArgs, LoaderFunction, SerializeFrom, AppData } from '@remix-run/server-runtime';
5
+ import { LoaderFunctionArgs, LoaderFunction, SerializeFrom } from '@remix-run/server-runtime';
6
6
  import * as react from 'react';
7
7
  import { ReactNode, Ref, ComponentType } from 'react';
8
8
  import { Params, Location, LinkProps, FetcherWithComponents } from '@remix-run/react';
@@ -116,23 +116,23 @@ type Storefront<TI18n extends I18nBase = I18nBase> = {
116
116
  mutate: <OverrideReturnType = any, RawGqlString extends string = string>(mutation: RawGqlString, ...options: RawGqlString extends keyof StorefrontMutations ? IsOptionalVariables<StorefrontMutations[RawGqlString]> extends true ? [StorefrontMutateSecondParam<RawGqlString>?] : [StorefrontMutateSecondParam<RawGqlString>] : [StorefrontMutateSecondParam?]) => Promise<RawGqlString extends keyof StorefrontMutations ? StorefrontMutations[RawGqlString]['return'] : OverrideReturnType>;
117
117
  /** The cache instance passed in from the `createStorefrontClient` argument. */
118
118
  cache?: Cache;
119
- /** Re-export of [`CacheNone`](/docs/api/hydrogen/2023-07/utilities/cachenone). */
119
+ /** Re-export of [`CacheNone`](/docs/api/hydrogen/2023-10/utilities/cachenone). */
120
120
  CacheNone: typeof CacheNone;
121
- /** Re-export of [`CacheLong`](/docs/api/hydrogen/2023-07/utilities/cachelong). */
121
+ /** Re-export of [`CacheLong`](/docs/api/hydrogen/2023-10/utilities/cachelong). */
122
122
  CacheLong: typeof CacheLong;
123
- /** Re-export of [`CacheShort`](/docs/api/hydrogen/2023-07/utilities/cacheshort). */
123
+ /** Re-export of [`CacheShort`](/docs/api/hydrogen/2023-10/utilities/cacheshort). */
124
124
  CacheShort: typeof CacheShort;
125
- /** Re-export of [`CacheCustom`](/docs/api/hydrogen/2023-07/utilities/cachecustom). */
125
+ /** Re-export of [`CacheCustom`](/docs/api/hydrogen/2023-10/utilities/cachecustom). */
126
126
  CacheCustom: typeof CacheCustom;
127
- /** Re-export of [`generateCacheControlHeader`](/docs/api/hydrogen/2023-07/utilities/generatecachecontrolheader). */
127
+ /** Re-export of [`generateCacheControlHeader`](/docs/api/hydrogen/2023-10/utilities/generatecachecontrolheader). */
128
128
  generateCacheControlHeader: typeof generateCacheControlHeader;
129
- /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint. See [`getPublicTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient#:~:text=%27graphql%27.-,getPublicTokenHeaders,-(props%3F%3A) for more details. */
129
+ /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint. See [`getPublicTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient#:~:text=%27graphql%27.-,getPublicTokenHeaders,-(props%3F%3A) for more details. */
130
130
  getPublicTokenHeaders: ReturnType<typeof createStorefrontClient$1>['getPublicTokenHeaders'];
131
- /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint for API calls made from a server. See [`getPrivateTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient#:~:text=storefrontApiVersion-,getPrivateTokenHeaders,-(props%3F%3A) for more details.*/
131
+ /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint for API calls made from a server. See [`getPrivateTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient#:~:text=storefrontApiVersion-,getPrivateTokenHeaders,-(props%3F%3A) for more details.*/
132
132
  getPrivateTokenHeaders: ReturnType<typeof createStorefrontClient$1>['getPrivateTokenHeaders'];
133
- /** Creates the fully-qualified URL to your myshopify.com domain. See [`getShopifyDomain` in Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient#:~:text=StorefrontClientReturn-,getShopifyDomain,-(props%3F%3A) for more details. */
133
+ /** Creates the fully-qualified URL to your myshopify.com domain. See [`getShopifyDomain` in Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient#:~:text=StorefrontClientReturn-,getShopifyDomain,-(props%3F%3A) for more details. */
134
134
  getShopifyDomain: ReturnType<typeof createStorefrontClient$1>['getShopifyDomain'];
135
- /** Creates the fully-qualified URL to your store's GraphQL endpoint. See [`getStorefrontApiUrl` in Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient#:~:text=storeDomain-,getStorefrontApiUrl,-(props%3F%3A) for more details.*/
135
+ /** Creates the fully-qualified URL to your store's GraphQL endpoint. See [`getStorefrontApiUrl` in Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient#:~:text=storeDomain-,getStorefrontApiUrl,-(props%3F%3A) for more details.*/
136
136
  getApiUrl: ReturnType<typeof createStorefrontClient$1>['getStorefrontApiUrl'];
137
137
  /** Determines if the error is resulted from a Storefront API call. */
138
138
  isApiError: (error: any) => boolean;
@@ -144,10 +144,6 @@ type HydrogenClientProps<TI18n> = {
144
144
  storefrontHeaders?: StorefrontHeaders;
145
145
  /** An instance that implements the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) */
146
146
  cache?: Cache;
147
- /** @deprecated use storefrontHeaders instead */
148
- buyerIp?: string;
149
- /** @deprecated use storefrontHeaders instead */
150
- requestGroupId?: string | null;
151
147
  /** The globally unique identifier for the Shop */
152
148
  storefrontId?: string;
153
149
  /** The `waitUntil` function is used to keep the current request/response lifecycle alive even after a response has been sent. It should be provided by your platform. */
@@ -169,7 +165,7 @@ type StorefrontHeaders = {
169
165
  declare const StorefrontApiError: ErrorConstructor;
170
166
  declare const isStorefrontApiError: (error: any) => boolean;
171
167
  /**
172
- * This function extends `createStorefrontClient` from [Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient). The additional arguments enable internationalization (i18n), caching, and other features particular to Remix and Oxygen.
168
+ * This function extends `createStorefrontClient` from [Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient). The additional arguments enable internationalization (i18n), caching, and other features particular to Remix and Oxygen.
173
169
  *
174
170
  * Learn more about [data fetching in Hydrogen](/docs/custom-storefronts/hydrogen/data-fetching/fetch-data).
175
171
  */
@@ -232,7 +228,7 @@ declare class InMemoryCache implements Cache {
232
228
  }
233
229
 
234
230
  type StorefrontRedirect = {
235
- /** The [Storefront client](/docs/api/hydrogen/2023-07/utilities/createstorefrontclient) instance */
231
+ /** The [Storefront client](/docs/api/hydrogen/2023-10/utilities/createstorefrontclient) instance */
236
232
  storefront: Storefront<I18nBase>;
237
233
  /** The [MDN Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object that was passed to the `server.ts` request handler. */
238
234
  request: Request;
@@ -251,7 +247,7 @@ type StorefrontRedirect = {
251
247
  */
252
248
  declare function storefrontRedirect(options: StorefrontRedirect): Promise<Response>;
253
249
 
254
- type GraphiQLLoader = (args: LoaderArgs) => Promise<Response>;
250
+ type GraphiQLLoader = (args: LoaderFunctionArgs) => Promise<Response>;
255
251
  declare const graphiqlLoader: GraphiQLLoader;
256
252
 
257
253
  interface SeoConfig<Schema extends Thing = Thing> {
@@ -518,7 +514,7 @@ type SeoMedia = {
518
514
 
519
515
  interface SeoHandleFunction<Loader extends LoaderFunction | unknown = unknown, StructuredDataSchema extends Thing = Thing> {
520
516
  (args: {
521
- data: Loader extends LoaderFunction ? SerializeFrom<Loader> : AppData;
517
+ data: Loader extends LoaderFunction ? SerializeFrom<Loader> : unknown;
522
518
  id: string;
523
519
  params: Params;
524
520
  pathname: Location['pathname'];
@@ -607,12 +603,53 @@ declare function getPaginationVariables(request: Request, options?: {
607
603
  endCursor: string | null;
608
604
  };
609
605
 
606
+ interface HydrogenSession {
607
+ get: (key: string) => string | undefined;
608
+ set: (key: string, value: string) => void;
609
+ unset: (key: string) => void;
610
+ commit: () => Promise<string>;
611
+ }
612
+
613
+ type CustomerClient = {
614
+ /** Start the OAuth login flow. This function should be called and returned from a Remix action. It redirects the user to a login domain. */
615
+ login: () => Promise<Response>;
616
+ /** On successful login, the user is redirect back to your app. This function validates the OAuth response and exchanges the authorization code for an access token and refresh token. It also persists the tokens on your session. This function should be called and returned from the Remix loader configured as the redirect URI within the Customer Account API settings. */
617
+ authorize: (redirectPath?: string) => Promise<Response>;
618
+ /** Returns if the user is logged in. It also checks if the access token is expired and refreshes it if needed. */
619
+ isLoggedIn: () => Promise<boolean>;
620
+ /** Logout the user by clearing the session and redirecting to the login domain. It should be called and returned from a Remix action. */
621
+ logout: () => Promise<Response>;
622
+ /** Execute a GraphQL query against the Customer Account API. Usually you should first check if the user is logged in before querying the API. */
623
+ query: <ReturnType = any, RawGqlString extends string = string>(query: RawGqlString, options?: {
624
+ variables: Record<string, any>;
625
+ }) => Promise<ReturnType>;
626
+ /** Execute a GraphQL mutation against the Customer Account API. Usually you should first check if the user is logged in before querying the API. */
627
+ mutate: <ReturnType = any, RawGqlString extends string = string>(mutation: RawGqlString, options?: {
628
+ variables: Record<string, any>;
629
+ }) => Promise<ReturnType>;
630
+ };
631
+ type CustomerClientOptions = {
632
+ /** The client requires a session to persist the auth and refresh token. By default Hydrogen ships with cookie session storage, but you can use [another session storage](https://remix.run/docs/en/main/utils/sessions) implementation. */
633
+ session: HydrogenSession;
634
+ /** Unique UUID prefixed with `shp_` associated with the application, this should be visible in the customer account api settings in the Hydrogen admin channel. */
635
+ customerAccountId: string;
636
+ /** The account URL associated with the application, this should be visible in the customer account api settings in the Hydrogen admin channel. */
637
+ customerAccountUrl: string;
638
+ /** Override the version of the API */
639
+ customerApiVersion?: string;
640
+ /** The object for the current Request. It should be provided by your platform. */
641
+ request: CrossRuntimeRequest;
642
+ /** The waitUntil function is used to keep the current request/response lifecycle alive even after a response has been sent. It should be provided by your platform. */
643
+ waitUntil?: ExecutionContext['waitUntil'];
644
+ };
645
+ declare function createCustomerClient({ session, customerAccountId, customerAccountUrl, customerApiVersion, request, waitUntil, }: CustomerClientOptions): CustomerClient;
646
+
610
647
  type CartOptionalInput = {
611
648
  /**
612
649
  * The cart id.
613
650
  * @default cart.getCartId();
614
651
  */
615
- cartId?: Scalars['ID'];
652
+ cartId?: Scalars['ID']['input'];
616
653
  /**
617
654
  * The country code.
618
655
  * @default storefront.i18n.country
@@ -771,13 +808,13 @@ type CartMetafieldsSetRequire = {
771
808
  type CartMetafieldDeleteProps = {
772
809
  action: 'MetafieldsDelete';
773
810
  inputs?: {
774
- key: Scalars['String'];
811
+ key: Scalars['String']['input'];
775
812
  } & OtherFormData;
776
813
  };
777
814
  type CartMetafieldDeleteRequire = {
778
815
  action: 'MetafieldsDelete';
779
816
  inputs: {
780
- key: Scalars['String'];
817
+ key: Scalars['String']['input'];
781
818
  } & OtherFormData;
782
819
  };
783
820
  type CartCustomProps = {
@@ -876,7 +913,7 @@ declare function cartAttributesUpdateDefault(options: CartQueryOptions): CartAtt
876
913
  type CartMetafieldsSetFunction = (metafields: MetafieldWithoutOwnerId[], optionalParams?: CartOptionalInput) => Promise<CartQueryData>;
877
914
  declare function cartMetafieldsSetDefault(options: CartQueryOptions): CartMetafieldsSetFunction;
878
915
 
879
- type CartMetafieldDeleteFunction = (key: Scalars['String'], optionalParams?: CartOptionalInput) => Promise<CartQueryData>;
916
+ type CartMetafieldDeleteFunction = (key: Scalars['String']['input'], optionalParams?: CartOptionalInput) => Promise<CartQueryData>;
880
917
  declare function cartMetafieldDeleteDefault(options: CartQueryOptions): CartMetafieldDeleteFunction;
881
918
 
882
919
  declare const cartGetIdDefault: (requestHeaders: Headers) => () => string | undefined;
@@ -901,7 +938,7 @@ type CartHandlerOptions = {
901
938
  };
902
939
  type CustomMethodsBase = Record<string, Function>;
903
940
  type CartHandlerOptionsWithCustom<TCustomMethods extends CustomMethodsBase> = CartHandlerOptions & {
904
- customMethods__unstable?: TCustomMethods;
941
+ customMethods?: TCustomMethods;
905
942
  };
906
943
  type HydrogenCart = {
907
944
  get: ReturnType<typeof cartGetDefault>;
@@ -938,9 +975,9 @@ type VariantOptionValue = {
938
975
  type VariantSelectorProps = {
939
976
  /** The product handle for all of the variants */
940
977
  handle: string;
941
- /** Product options from the [Storefront API](/docs/api/storefront/2023-07/objects/ProductOption). Make sure both `name` and `values` are apart of your query. */
978
+ /** Product options from the [Storefront API](/docs/api/storefront/2023-10/objects/ProductOption). Make sure both `name` and `values` are apart of your query. */
942
979
  options: Array<PartialDeep<ProductOption>> | undefined;
943
- /** Product variants from the [Storefront API](/docs/api/storefront/2023-07/objects/ProductVariant). You only need to pass this prop if you want to show product availability. If a product option combination is not found within `variants`, it is assumed to be available. Make sure to include `availableForSale` and `selectedOptions.name` and `selectedOptions.value`. */
980
+ /** Product variants from the [Storefront API](/docs/api/storefront/2023-10/objects/ProductVariant). You only need to pass this prop if you want to show product availability. If a product option combination is not found within `variants`, it is assumed to be available. Make sure to include `availableForSale` and `selectedOptions.name` and `selectedOptions.value`. */
944
981
  variants?: PartialDeep<ProductVariantConnection> | Array<PartialDeep<ProductVariant>>;
945
982
  /** By default all products are under /products. Use this prop to provide a custom path. */
946
983
  productPath?: string;
@@ -986,4 +1023,4 @@ type OptimisticInputProps = {
986
1023
  };
987
1024
  declare function OptimisticInput({ id, data }: OptimisticInputProps): react_jsx_runtime.JSX.Element;
988
1025
 
989
- export { CacheCustom, CacheLong, CacheNone, CacheShort, CartActionInput, CartForm, CartQueryData, CartQueryOptions, CartQueryReturn, CookieOptions, CreateStorefrontClientOptions, HydrogenCart, HydrogenCartCustom, I18nBase, InMemoryCache, MetafieldWithoutOwnerId, OptimisticInput, Pagination, Script, Seo, SeoConfig, SeoHandleFunction, Storefront, StorefrontApiError, StorefrontClient, StorefrontMutations, StorefrontQueries, VariantOption, VariantOptionValue, VariantSelector, WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, createCartHandler, createContentSecurityPolicy, createStorefrontClient, createWithCache, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, graphiqlLoader, isStorefrontApiError, storefrontRedirect, useNonce, useOptimisticData };
1026
+ export { CacheCustom, CacheLong, CacheNone, CacheShort, CartActionInput, CartForm, CartQueryData, CartQueryOptions, CartQueryReturn, CookieOptions, CreateStorefrontClientOptions, CustomerClient, HydrogenCart, HydrogenCartCustom, I18nBase, InMemoryCache, MetafieldWithoutOwnerId, OptimisticInput, Pagination, Script, Seo, SeoConfig, SeoHandleFunction, Storefront, StorefrontApiError, StorefrontClient, StorefrontMutations, StorefrontQueries, VariantOption, VariantOptionValue, VariantSelector, WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, createCartHandler, createContentSecurityPolicy, createCustomerClient as createCustomerClient__unstable, createStorefrontClient, createWithCache, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, graphiqlLoader, isStorefrontApiError, storefrontRedirect, useNonce, useOptimisticData };
@@ -2,7 +2,7 @@ import { createStorefrontClient as createStorefrontClient$1, StorefrontClientPro
2
2
  export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MediaFile, ModelViewer, Money, ParsedMetafields, ShopPayButton, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalytics, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, flattenConnection, getClientBrowserParameters, getShopifyCookies, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useShopifyCookies } from '@shopify/hydrogen-react';
3
3
  import { ExecutionArgs } from 'graphql';
4
4
  import { LanguageCode, CountryCode, Maybe, PageInfo, CartMetafieldsSetInput, Cart, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, Scalars, AttributeInput, CartBuyerIdentityInput, CartInput, CartLineInput, CartLineUpdateInput, CartSelectedDeliveryOptionInput, ProductOption, ProductVariantConnection, ProductVariant, SelectedOptionInput } from '@shopify/hydrogen-react/storefront-api-types';
5
- import { LoaderArgs, LoaderFunction, SerializeFrom, AppData } from '@remix-run/server-runtime';
5
+ import { LoaderFunctionArgs, LoaderFunction, SerializeFrom } from '@remix-run/server-runtime';
6
6
  import * as react from 'react';
7
7
  import { ReactNode, Ref, ComponentType } from 'react';
8
8
  import { Params, Location, LinkProps, FetcherWithComponents } from '@remix-run/react';
@@ -116,23 +116,23 @@ type Storefront<TI18n extends I18nBase = I18nBase> = {
116
116
  mutate: <OverrideReturnType = any, RawGqlString extends string = string>(mutation: RawGqlString, ...options: RawGqlString extends keyof StorefrontMutations ? IsOptionalVariables<StorefrontMutations[RawGqlString]> extends true ? [StorefrontMutateSecondParam<RawGqlString>?] : [StorefrontMutateSecondParam<RawGqlString>] : [StorefrontMutateSecondParam?]) => Promise<RawGqlString extends keyof StorefrontMutations ? StorefrontMutations[RawGqlString]['return'] : OverrideReturnType>;
117
117
  /** The cache instance passed in from the `createStorefrontClient` argument. */
118
118
  cache?: Cache;
119
- /** Re-export of [`CacheNone`](/docs/api/hydrogen/2023-07/utilities/cachenone). */
119
+ /** Re-export of [`CacheNone`](/docs/api/hydrogen/2023-10/utilities/cachenone). */
120
120
  CacheNone: typeof CacheNone;
121
- /** Re-export of [`CacheLong`](/docs/api/hydrogen/2023-07/utilities/cachelong). */
121
+ /** Re-export of [`CacheLong`](/docs/api/hydrogen/2023-10/utilities/cachelong). */
122
122
  CacheLong: typeof CacheLong;
123
- /** Re-export of [`CacheShort`](/docs/api/hydrogen/2023-07/utilities/cacheshort). */
123
+ /** Re-export of [`CacheShort`](/docs/api/hydrogen/2023-10/utilities/cacheshort). */
124
124
  CacheShort: typeof CacheShort;
125
- /** Re-export of [`CacheCustom`](/docs/api/hydrogen/2023-07/utilities/cachecustom). */
125
+ /** Re-export of [`CacheCustom`](/docs/api/hydrogen/2023-10/utilities/cachecustom). */
126
126
  CacheCustom: typeof CacheCustom;
127
- /** Re-export of [`generateCacheControlHeader`](/docs/api/hydrogen/2023-07/utilities/generatecachecontrolheader). */
127
+ /** Re-export of [`generateCacheControlHeader`](/docs/api/hydrogen/2023-10/utilities/generatecachecontrolheader). */
128
128
  generateCacheControlHeader: typeof generateCacheControlHeader;
129
- /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint. See [`getPublicTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient#:~:text=%27graphql%27.-,getPublicTokenHeaders,-(props%3F%3A) for more details. */
129
+ /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint. See [`getPublicTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient#:~:text=%27graphql%27.-,getPublicTokenHeaders,-(props%3F%3A) for more details. */
130
130
  getPublicTokenHeaders: ReturnType<typeof createStorefrontClient$1>['getPublicTokenHeaders'];
131
- /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint for API calls made from a server. See [`getPrivateTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient#:~:text=storefrontApiVersion-,getPrivateTokenHeaders,-(props%3F%3A) for more details.*/
131
+ /** Returns an object that contains headers that are needed for each query to Storefront API GraphQL endpoint for API calls made from a server. See [`getPrivateTokenHeaders` in Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient#:~:text=storefrontApiVersion-,getPrivateTokenHeaders,-(props%3F%3A) for more details.*/
132
132
  getPrivateTokenHeaders: ReturnType<typeof createStorefrontClient$1>['getPrivateTokenHeaders'];
133
- /** Creates the fully-qualified URL to your myshopify.com domain. See [`getShopifyDomain` in Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient#:~:text=StorefrontClientReturn-,getShopifyDomain,-(props%3F%3A) for more details. */
133
+ /** Creates the fully-qualified URL to your myshopify.com domain. See [`getShopifyDomain` in Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient#:~:text=StorefrontClientReturn-,getShopifyDomain,-(props%3F%3A) for more details. */
134
134
  getShopifyDomain: ReturnType<typeof createStorefrontClient$1>['getShopifyDomain'];
135
- /** Creates the fully-qualified URL to your store's GraphQL endpoint. See [`getStorefrontApiUrl` in Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient#:~:text=storeDomain-,getStorefrontApiUrl,-(props%3F%3A) for more details.*/
135
+ /** Creates the fully-qualified URL to your store's GraphQL endpoint. See [`getStorefrontApiUrl` in Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient#:~:text=storeDomain-,getStorefrontApiUrl,-(props%3F%3A) for more details.*/
136
136
  getApiUrl: ReturnType<typeof createStorefrontClient$1>['getStorefrontApiUrl'];
137
137
  /** Determines if the error is resulted from a Storefront API call. */
138
138
  isApiError: (error: any) => boolean;
@@ -144,10 +144,6 @@ type HydrogenClientProps<TI18n> = {
144
144
  storefrontHeaders?: StorefrontHeaders;
145
145
  /** An instance that implements the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) */
146
146
  cache?: Cache;
147
- /** @deprecated use storefrontHeaders instead */
148
- buyerIp?: string;
149
- /** @deprecated use storefrontHeaders instead */
150
- requestGroupId?: string | null;
151
147
  /** The globally unique identifier for the Shop */
152
148
  storefrontId?: string;
153
149
  /** The `waitUntil` function is used to keep the current request/response lifecycle alive even after a response has been sent. It should be provided by your platform. */
@@ -169,7 +165,7 @@ type StorefrontHeaders = {
169
165
  declare const StorefrontApiError: ErrorConstructor;
170
166
  declare const isStorefrontApiError: (error: any) => boolean;
171
167
  /**
172
- * This function extends `createStorefrontClient` from [Hydrogen React](/docs/api/hydrogen-react/2023-07/utilities/createstorefrontclient). The additional arguments enable internationalization (i18n), caching, and other features particular to Remix and Oxygen.
168
+ * This function extends `createStorefrontClient` from [Hydrogen React](/docs/api/hydrogen-react/2023-10/utilities/createstorefrontclient). The additional arguments enable internationalization (i18n), caching, and other features particular to Remix and Oxygen.
173
169
  *
174
170
  * Learn more about [data fetching in Hydrogen](/docs/custom-storefronts/hydrogen/data-fetching/fetch-data).
175
171
  */
@@ -232,7 +228,7 @@ declare class InMemoryCache implements Cache {
232
228
  }
233
229
 
234
230
  type StorefrontRedirect = {
235
- /** The [Storefront client](/docs/api/hydrogen/2023-07/utilities/createstorefrontclient) instance */
231
+ /** The [Storefront client](/docs/api/hydrogen/2023-10/utilities/createstorefrontclient) instance */
236
232
  storefront: Storefront<I18nBase>;
237
233
  /** The [MDN Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object that was passed to the `server.ts` request handler. */
238
234
  request: Request;
@@ -251,7 +247,7 @@ type StorefrontRedirect = {
251
247
  */
252
248
  declare function storefrontRedirect(options: StorefrontRedirect): Promise<Response>;
253
249
 
254
- type GraphiQLLoader = (args: LoaderArgs) => Promise<Response>;
250
+ type GraphiQLLoader = (args: LoaderFunctionArgs) => Promise<Response>;
255
251
  declare const graphiqlLoader: GraphiQLLoader;
256
252
 
257
253
  interface SeoConfig<Schema extends Thing = Thing> {
@@ -518,7 +514,7 @@ type SeoMedia = {
518
514
 
519
515
  interface SeoHandleFunction<Loader extends LoaderFunction | unknown = unknown, StructuredDataSchema extends Thing = Thing> {
520
516
  (args: {
521
- data: Loader extends LoaderFunction ? SerializeFrom<Loader> : AppData;
517
+ data: Loader extends LoaderFunction ? SerializeFrom<Loader> : unknown;
522
518
  id: string;
523
519
  params: Params;
524
520
  pathname: Location['pathname'];
@@ -607,12 +603,53 @@ declare function getPaginationVariables(request: Request, options?: {
607
603
  endCursor: string | null;
608
604
  };
609
605
 
606
+ interface HydrogenSession {
607
+ get: (key: string) => string | undefined;
608
+ set: (key: string, value: string) => void;
609
+ unset: (key: string) => void;
610
+ commit: () => Promise<string>;
611
+ }
612
+
613
+ type CustomerClient = {
614
+ /** Start the OAuth login flow. This function should be called and returned from a Remix action. It redirects the user to a login domain. */
615
+ login: () => Promise<Response>;
616
+ /** On successful login, the user is redirect back to your app. This function validates the OAuth response and exchanges the authorization code for an access token and refresh token. It also persists the tokens on your session. This function should be called and returned from the Remix loader configured as the redirect URI within the Customer Account API settings. */
617
+ authorize: (redirectPath?: string) => Promise<Response>;
618
+ /** Returns if the user is logged in. It also checks if the access token is expired and refreshes it if needed. */
619
+ isLoggedIn: () => Promise<boolean>;
620
+ /** Logout the user by clearing the session and redirecting to the login domain. It should be called and returned from a Remix action. */
621
+ logout: () => Promise<Response>;
622
+ /** Execute a GraphQL query against the Customer Account API. Usually you should first check if the user is logged in before querying the API. */
623
+ query: <ReturnType = any, RawGqlString extends string = string>(query: RawGqlString, options?: {
624
+ variables: Record<string, any>;
625
+ }) => Promise<ReturnType>;
626
+ /** Execute a GraphQL mutation against the Customer Account API. Usually you should first check if the user is logged in before querying the API. */
627
+ mutate: <ReturnType = any, RawGqlString extends string = string>(mutation: RawGqlString, options?: {
628
+ variables: Record<string, any>;
629
+ }) => Promise<ReturnType>;
630
+ };
631
+ type CustomerClientOptions = {
632
+ /** The client requires a session to persist the auth and refresh token. By default Hydrogen ships with cookie session storage, but you can use [another session storage](https://remix.run/docs/en/main/utils/sessions) implementation. */
633
+ session: HydrogenSession;
634
+ /** Unique UUID prefixed with `shp_` associated with the application, this should be visible in the customer account api settings in the Hydrogen admin channel. */
635
+ customerAccountId: string;
636
+ /** The account URL associated with the application, this should be visible in the customer account api settings in the Hydrogen admin channel. */
637
+ customerAccountUrl: string;
638
+ /** Override the version of the API */
639
+ customerApiVersion?: string;
640
+ /** The object for the current Request. It should be provided by your platform. */
641
+ request: CrossRuntimeRequest;
642
+ /** The waitUntil function is used to keep the current request/response lifecycle alive even after a response has been sent. It should be provided by your platform. */
643
+ waitUntil?: ExecutionContext['waitUntil'];
644
+ };
645
+ declare function createCustomerClient({ session, customerAccountId, customerAccountUrl, customerApiVersion, request, waitUntil, }: CustomerClientOptions): CustomerClient;
646
+
610
647
  type CartOptionalInput = {
611
648
  /**
612
649
  * The cart id.
613
650
  * @default cart.getCartId();
614
651
  */
615
- cartId?: Scalars['ID'];
652
+ cartId?: Scalars['ID']['input'];
616
653
  /**
617
654
  * The country code.
618
655
  * @default storefront.i18n.country
@@ -771,13 +808,13 @@ type CartMetafieldsSetRequire = {
771
808
  type CartMetafieldDeleteProps = {
772
809
  action: 'MetafieldsDelete';
773
810
  inputs?: {
774
- key: Scalars['String'];
811
+ key: Scalars['String']['input'];
775
812
  } & OtherFormData;
776
813
  };
777
814
  type CartMetafieldDeleteRequire = {
778
815
  action: 'MetafieldsDelete';
779
816
  inputs: {
780
- key: Scalars['String'];
817
+ key: Scalars['String']['input'];
781
818
  } & OtherFormData;
782
819
  };
783
820
  type CartCustomProps = {
@@ -876,7 +913,7 @@ declare function cartAttributesUpdateDefault(options: CartQueryOptions): CartAtt
876
913
  type CartMetafieldsSetFunction = (metafields: MetafieldWithoutOwnerId[], optionalParams?: CartOptionalInput) => Promise<CartQueryData>;
877
914
  declare function cartMetafieldsSetDefault(options: CartQueryOptions): CartMetafieldsSetFunction;
878
915
 
879
- type CartMetafieldDeleteFunction = (key: Scalars['String'], optionalParams?: CartOptionalInput) => Promise<CartQueryData>;
916
+ type CartMetafieldDeleteFunction = (key: Scalars['String']['input'], optionalParams?: CartOptionalInput) => Promise<CartQueryData>;
880
917
  declare function cartMetafieldDeleteDefault(options: CartQueryOptions): CartMetafieldDeleteFunction;
881
918
 
882
919
  declare const cartGetIdDefault: (requestHeaders: Headers) => () => string | undefined;
@@ -901,7 +938,7 @@ type CartHandlerOptions = {
901
938
  };
902
939
  type CustomMethodsBase = Record<string, Function>;
903
940
  type CartHandlerOptionsWithCustom<TCustomMethods extends CustomMethodsBase> = CartHandlerOptions & {
904
- customMethods__unstable?: TCustomMethods;
941
+ customMethods?: TCustomMethods;
905
942
  };
906
943
  type HydrogenCart = {
907
944
  get: ReturnType<typeof cartGetDefault>;
@@ -938,9 +975,9 @@ type VariantOptionValue = {
938
975
  type VariantSelectorProps = {
939
976
  /** The product handle for all of the variants */
940
977
  handle: string;
941
- /** Product options from the [Storefront API](/docs/api/storefront/2023-07/objects/ProductOption). Make sure both `name` and `values` are apart of your query. */
978
+ /** Product options from the [Storefront API](/docs/api/storefront/2023-10/objects/ProductOption). Make sure both `name` and `values` are apart of your query. */
942
979
  options: Array<PartialDeep<ProductOption>> | undefined;
943
- /** Product variants from the [Storefront API](/docs/api/storefront/2023-07/objects/ProductVariant). You only need to pass this prop if you want to show product availability. If a product option combination is not found within `variants`, it is assumed to be available. Make sure to include `availableForSale` and `selectedOptions.name` and `selectedOptions.value`. */
980
+ /** Product variants from the [Storefront API](/docs/api/storefront/2023-10/objects/ProductVariant). You only need to pass this prop if you want to show product availability. If a product option combination is not found within `variants`, it is assumed to be available. Make sure to include `availableForSale` and `selectedOptions.name` and `selectedOptions.value`. */
944
981
  variants?: PartialDeep<ProductVariantConnection> | Array<PartialDeep<ProductVariant>>;
945
982
  /** By default all products are under /products. Use this prop to provide a custom path. */
946
983
  productPath?: string;
@@ -986,4 +1023,4 @@ type OptimisticInputProps = {
986
1023
  };
987
1024
  declare function OptimisticInput({ id, data }: OptimisticInputProps): react_jsx_runtime.JSX.Element;
988
1025
 
989
- export { CacheCustom, CacheLong, CacheNone, CacheShort, CartActionInput, CartForm, CartQueryData, CartQueryOptions, CartQueryReturn, CookieOptions, CreateStorefrontClientOptions, HydrogenCart, HydrogenCartCustom, I18nBase, InMemoryCache, MetafieldWithoutOwnerId, OptimisticInput, Pagination, Script, Seo, SeoConfig, SeoHandleFunction, Storefront, StorefrontApiError, StorefrontClient, StorefrontMutations, StorefrontQueries, VariantOption, VariantOptionValue, VariantSelector, WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, createCartHandler, createContentSecurityPolicy, createStorefrontClient, createWithCache, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, graphiqlLoader, isStorefrontApiError, storefrontRedirect, useNonce, useOptimisticData };
1026
+ export { CacheCustom, CacheLong, CacheNone, CacheShort, CartActionInput, CartForm, CartQueryData, CartQueryOptions, CartQueryReturn, CookieOptions, CreateStorefrontClientOptions, CustomerClient, HydrogenCart, HydrogenCartCustom, I18nBase, InMemoryCache, MetafieldWithoutOwnerId, OptimisticInput, Pagination, Script, Seo, SeoConfig, SeoHandleFunction, Storefront, StorefrontApiError, StorefrontClient, StorefrontMutations, StorefrontQueries, VariantOption, VariantOptionValue, VariantSelector, WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, createCartHandler, createContentSecurityPolicy, createCustomerClient as createCustomerClient__unstable, createStorefrontClient, createWithCache, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, graphiqlLoader, isStorefrontApiError, storefrontRedirect, useNonce, useOptimisticData };