hydrogen-sfdgspsdmq-test1 0.0.1-security → 2024.1.14

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of hydrogen-sfdgspsdmq-test1 might be problematic. Click here for more details.

@@ -0,0 +1,1515 @@
1
+ import { createStorefrontClient as createStorefrontClient$1, StorefrontClientProps, ShopPayButton as ShopPayButton$1 } from '@shopify/hydrogen-react';
2
+ export { AnalyticsEventName, AnalyticsPageType, ClientBrowserParameters, ExternalVideo, IMAGE_FRAGMENT, Image, MediaFile, ModelViewer, Money, ParsedMetafields, ShopifyAddToCart, ShopifyAddToCartPayload, ShopifyAnalytics, ShopifyAnalyticsPayload, ShopifyAnalyticsProduct, ShopifyCookies, ShopifyPageView, ShopifyPageViewPayload, ShopifySalesChannel, StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiResponseOk, StorefrontApiResponseOkPartial, StorefrontApiResponsePartial, Video, customerAccountApiCustomScalars, flattenConnection, getClientBrowserParameters, getShopifyCookies, parseGid, parseMetafield, sendShopifyAnalytics, storefrontApiCustomScalars, useLoadScript, useMoney, useShopifyCookies } from '@shopify/hydrogen-react';
3
+ import { LanguageCode, CountryCode, Maybe, PageInfo, CartMetafieldsSetInput, Cart, Scalars, CartUserError, MetafieldsSetUserError, MetafieldDeleteUserError, AttributeInput, CartBuyerIdentityInput, CartInput, CartLineInput, CartLineUpdateInput, CartSelectedDeliveryOptionInput, ProductOption, ProductVariantConnection, ProductVariant, SelectedOptionInput } from '@shopify/hydrogen-react/storefront-api-types';
4
+ import { ExecutionArgs } from 'graphql';
5
+ import { LoaderFunctionArgs, LoaderFunction, SerializeFrom, SessionData, FlashSessionData, Session, SessionStorage } from '@remix-run/server-runtime';
6
+ import * as react from 'react';
7
+ import { FC, Ref, ReactNode, ComponentType, ComponentProps } from 'react';
8
+ import { Params, Location, LinkProps, FetcherWithComponents } from '@remix-run/react';
9
+ import { Thing, WithContext } from 'schema-dts';
10
+ import { PartialDeep } from 'type-fest';
11
+ import * as react_jsx_runtime from 'react/jsx-runtime';
12
+
13
+ /**
14
+ * Override options for a cache strategy.
15
+ */
16
+ interface AllCacheOptions {
17
+ /**
18
+ * The caching mode, generally `public`, `private`, or `no-store`.
19
+ */
20
+ mode?: string;
21
+ /**
22
+ * The maximum amount of time in seconds that a resource will be considered fresh. See `max-age` in the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#:~:text=Response%20Directives-,max%2Dage,-The%20max%2Dage).
23
+ */
24
+ maxAge?: number;
25
+ /**
26
+ * Indicate that the cache should serve the stale response in the background while revalidating the cache. See `stale-while-revalidate` in the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#stale-while-revalidate).
27
+ */
28
+ staleWhileRevalidate?: number;
29
+ /**
30
+ * Similar to `maxAge` but specific to shared caches. See `s-maxage` in the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#s-maxage).
31
+ */
32
+ sMaxAge?: number;
33
+ /**
34
+ * Indicate that the cache should serve the stale response if an error occurs while revalidating the cache. See `stale-if-error` in the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#stale-if-error).
35
+ */
36
+ staleIfError?: number;
37
+ }
38
+ /**
39
+ * Use the `CachingStrategy` to define a custom caching mechanism for your data. Or use one of the pre-defined caching strategies: CacheNone, CacheShort, CacheLong.
40
+ */
41
+ type CachingStrategy = AllCacheOptions;
42
+ type NoStoreStrategy = {
43
+ mode: string;
44
+ };
45
+ declare function generateCacheControlHeader(cacheOptions: CachingStrategy): string;
46
+ /**
47
+ *
48
+ * @public
49
+ */
50
+ declare function CacheNone(): NoStoreStrategy;
51
+ /**
52
+ *
53
+ * @public
54
+ */
55
+ declare function CacheShort(overrideOptions?: CachingStrategy): AllCacheOptions;
56
+ /**
57
+ *
58
+ * @public
59
+ */
60
+ declare function CacheLong(overrideOptions?: CachingStrategy): AllCacheOptions;
61
+ /**
62
+ *
63
+ * @public
64
+ */
65
+ declare function CacheCustom(overrideOptions: CachingStrategy): AllCacheOptions;
66
+
67
+ /**
68
+ Returns a boolean for whether the two given types are equal.
69
+
70
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
71
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
72
+
73
+ Use-cases:
74
+ - If you want to make a conditional branch based on the result of a comparison of two types.
75
+
76
+ @example
77
+ ```
78
+ import type {IsEqual} from 'type-fest';
79
+
80
+ // This type returns a boolean for whether the given array includes the given item.
81
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
82
+ type Includes<Value extends readonly any[], Item> =
83
+ Value extends readonly [Value[0], ...infer rest]
84
+ ? IsEqual<Value[0], Item> extends true
85
+ ? true
86
+ : Includes<rest, Item>
87
+ : false;
88
+ ```
89
+
90
+ @category Type Guard
91
+ @category Utilities
92
+ */
93
+ type IsEqual<A, B> = (<G>() => G extends A ? 1 : 2) extends (<G>() => G extends B ? 1 : 2) ? true : false;
94
+ /**
95
+ Filter out keys from an object.
96
+
97
+ Returns `never` if `Exclude` is strictly equal to `Key`.
98
+ Returns `never` if `Key` extends `Exclude`.
99
+ Returns `Key` otherwise.
100
+
101
+ @example
102
+ ```
103
+ type Filtered = Filter<'foo', 'foo'>;
104
+ //=> never
105
+ ```
106
+
107
+ @example
108
+ ```
109
+ type Filtered = Filter<'bar', string>;
110
+ //=> never
111
+ ```
112
+
113
+ @example
114
+ ```
115
+ type Filtered = Filter<'bar', 'foo'>;
116
+ //=> 'bar'
117
+ ```
118
+
119
+ @see {Except}
120
+ */
121
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
122
+ type ExceptOptions = {
123
+ /**
124
+ Disallow assigning non-specified properties.
125
+
126
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
127
+
128
+ @default false
129
+ */
130
+ requireExactProps?: boolean;
131
+ };
132
+ /**
133
+ Create a type from an object type without certain keys.
134
+
135
+ We recommend setting the `requireExactProps` option to `true`.
136
+
137
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
138
+
139
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
140
+
141
+ @example
142
+ ```
143
+ import type {Except} from 'type-fest';
144
+
145
+ type Foo = {
146
+ a: number;
147
+ b: string;
148
+ };
149
+
150
+ type FooWithoutA = Except<Foo, 'a'>;
151
+ //=> {b: string}
152
+
153
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
154
+ //=> errors: 'a' does not exist in type '{ b: string; }'
155
+
156
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
157
+ //=> {a: number} & Partial<Record<"b", never>>
158
+
159
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
160
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
161
+ ```
162
+
163
+ @category Object
164
+ */
165
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {
166
+ requireExactProps: false;
167
+ }> = {
168
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
169
+ } & (Options["requireExactProps"] extends true ? Partial<Record<KeysType, never>> : {});
170
+ /**
171
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
172
+
173
+ @example
174
+ ```
175
+ import type {Simplify} from 'type-fest';
176
+
177
+ type PositionProps = {
178
+ top: number;
179
+ left: number;
180
+ };
181
+
182
+ type SizeProps = {
183
+ width: number;
184
+ height: number;
185
+ };
186
+
187
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
188
+ type Props = Simplify<PositionProps & SizeProps>;
189
+ ```
190
+
191
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
192
+
193
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
194
+
195
+ @example
196
+ ```
197
+ import type {Simplify} from 'type-fest';
198
+
199
+ interface SomeInterface {
200
+ foo: number;
201
+ bar?: string;
202
+ baz: number | undefined;
203
+ }
204
+
205
+ type SomeType = {
206
+ foo: number;
207
+ bar?: string;
208
+ baz: number | undefined;
209
+ };
210
+
211
+ const literal = {foo: 123, bar: 'hello', baz: 456};
212
+ const someType: SomeType = literal;
213
+ const someInterface: SomeInterface = literal;
214
+
215
+ function fn(object: Record<string, unknown>): void {}
216
+
217
+ fn(literal); // Good: literal object type is sealed
218
+ fn(someType); // Good: type is sealed
219
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
220
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
221
+ ```
222
+
223
+ @link https://github.com/microsoft/TypeScript/issues/15300
224
+
225
+ @category Object
226
+ */
227
+ type Simplify<T> = {
228
+ [KeyType in keyof T]: T[KeyType];
229
+ } & {};
230
+ /**
231
+ Returns a boolean for whether the given type is `never`.
232
+
233
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
234
+ @link https://stackoverflow.com/a/53984913/10292952
235
+ @link https://www.zhenghao.io/posts/ts-never
236
+
237
+ Useful in type utilities, such as checking if something does not occur.
238
+
239
+ @example
240
+ ```
241
+ import type {IsNever} from 'type-fest';
242
+
243
+ type And<A, B> =
244
+ A extends true
245
+ ? B extends true
246
+ ? true
247
+ : false
248
+ : false;
249
+
250
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
251
+ type AreStringsEqual<A extends string, B extends string> =
252
+ And<
253
+ IsNever<Exclude<A, B>> extends true ? true : false,
254
+ IsNever<Exclude<B, A>> extends true ? true : false
255
+ >;
256
+
257
+ type EndIfEqual<I extends string, O extends string> =
258
+ AreStringsEqual<I, O> extends true
259
+ ? never
260
+ : void;
261
+
262
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
263
+ if (input === output) {
264
+ process.exit(0);
265
+ }
266
+ }
267
+
268
+ endIfEqual('abc', 'abc');
269
+ //=> never
270
+
271
+ endIfEqual('abc', '123');
272
+ //=> void
273
+ ```
274
+
275
+ @category Type Guard
276
+ @category Utilities
277
+ */
278
+ type IsNever<T> = [
279
+ T
280
+ ] extends [
281
+ never
282
+ ] ? true : false;
283
+ /**
284
+ Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type.
285
+
286
+ Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
287
+
288
+ @example
289
+ ```
290
+ import type {SetOptional} from 'type-fest';
291
+
292
+ type Foo = {
293
+ a: number;
294
+ b?: string;
295
+ c: boolean;
296
+ }
297
+
298
+ type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
299
+ // type SomeOptional = {
300
+ // a: number;
301
+ // b?: string; // Was already optional and still is.
302
+ // c?: boolean; // Is now optional.
303
+ // }
304
+ ```
305
+
306
+ @category Object
307
+ */
308
+ type SetOptional<BaseType, Keys extends keyof BaseType> = Simplify<
309
+ // Pick just the keys that are readonly from the base type.
310
+ Except<BaseType, Keys> &
311
+ // Pick the keys that should be mutable from the base type and make them mutable.
312
+ Partial<Pick<BaseType, Keys>>>;
313
+ /**
314
+ * This file has utilities to create GraphQL clients
315
+ * that consume the types generated by the preset.
316
+ */
317
+ /**
318
+ * A generic type for `variables` in GraphQL clients
319
+ */
320
+ type GenericVariables = ExecutionArgs["variableValues"];
321
+ /**
322
+ * Use this type to make parameters optional in GraphQL clients
323
+ * when no variables need to be passed.
324
+ */
325
+ type EmptyVariables = {
326
+ [key: string]: never;
327
+ };
328
+ /**
329
+ * GraphQL client's generic operation interface.
330
+ */
331
+ interface CodegenOperations {
332
+ [key: string]: any;
333
+ }
334
+ /**
335
+ * Used as the return type for GraphQL clients. It picks
336
+ * the return type from the generated operation types.
337
+ * @example
338
+ * graphqlQuery: (...) => Promise<ClientReturn<...>>
339
+ * graphqlQuery: (...) => Promise<{data: ClientReturn<...>}>
340
+ */
341
+ type ClientReturn<GeneratedOperations extends CodegenOperations, RawGqlString extends string, OverrideReturnType extends any = never> = IsNever<OverrideReturnType> extends true ? RawGqlString extends keyof GeneratedOperations ? GeneratedOperations[RawGqlString]["return"] : any : OverrideReturnType;
342
+ /**
343
+ * Checks if the generated variables for an operation
344
+ * are optional or required.
345
+ */
346
+ type IsOptionalVariables<VariablesParam, OptionalVariableNames extends string = never, VariablesWithoutOptionals = Omit<VariablesParam, OptionalVariableNames>> = VariablesWithoutOptionals extends EmptyVariables ? true : GenericVariables extends VariablesParam ? true : Partial<VariablesWithoutOptionals> extends VariablesWithoutOptionals ? true : false;
347
+ /**
348
+ * Used as the type for the GraphQL client's variables. It checks
349
+ * the generated operation types to see if variables are optional.
350
+ * @example
351
+ * graphqlQuery: (query: string, param: ClientVariables<...>) => Promise<...>
352
+ * Where `param` is required.
353
+ */
354
+ type ClientVariables<GeneratedOperations extends CodegenOperations, RawGqlString extends string, OptionalVariableNames extends string = never, VariablesKey extends string = "variables", GeneratedVariables = RawGqlString extends keyof GeneratedOperations ? SetOptional<GeneratedOperations[RawGqlString]["variables"], Extract<keyof GeneratedOperations[RawGqlString]["variables"], OptionalVariableNames>> : GenericVariables, VariablesWrapper = Record<VariablesKey, GeneratedVariables>> = IsOptionalVariables<GeneratedVariables, OptionalVariableNames> extends true ? Partial<VariablesWrapper> : VariablesWrapper;
355
+ /**
356
+ * Similar to ClientVariables, but makes the whole wrapper optional:
357
+ * @example
358
+ * graphqlQuery: (query: string, ...params: ClientVariablesInRestParams<...>) => Promise<...>
359
+ * Where the first item in `params` might be optional depending on the query.
360
+ */
361
+ type ClientVariablesInRestParams<GeneratedOperations extends CodegenOperations, RawGqlString extends string, OtherParams extends Record<string, any> = {}, OptionalVariableNames extends string = never, ProcessedVariables = OtherParams & ClientVariables<GeneratedOperations, RawGqlString, OptionalVariableNames>> = Partial<OtherParams> extends OtherParams ? IsOptionalVariables<GeneratedOperations[RawGqlString]["variables"], OptionalVariableNames> extends true ? [
362
+ ProcessedVariables?
363
+ ] : [
364
+ ProcessedVariables
365
+ ] : [
366
+ ProcessedVariables
367
+ ];
368
+
369
+ declare class GraphQLError extends Error {
370
+ /**
371
+ * If an error can be associated to a particular point in the requested
372
+ * GraphQL document, it should contain a list of locations.
373
+ */
374
+ locations?: Array<{
375
+ line: number;
376
+ column: number;
377
+ }>;
378
+ /**
379
+ * If an error can be associated to a particular field in the GraphQL result,
380
+ * it _must_ contain an entry with the key `path` that details the path of
381
+ * the response field which experienced the error. This allows clients to
382
+ * identify whether a null result is intentional or caused by a runtime error.
383
+ */
384
+ path?: Array<string | number>;
385
+ /**
386
+ * Reserved for implementors to extend the protocol however they see fit,
387
+ * and hence there are no additional restrictions on its contents.
388
+ */
389
+ extensions?: {
390
+ [key: string]: unknown;
391
+ };
392
+ constructor(message?: string, options?: Pick<GraphQLError, 'locations' | 'path' | 'extensions' | 'stack' | 'cause'> & {
393
+ query?: string;
394
+ queryVariables?: GenericVariables;
395
+ requestId?: string | null;
396
+ clientOperation?: string;
397
+ });
398
+ get [Symbol.toStringTag](): string;
399
+ /**
400
+ * Note: `toString()` is internally used by `console.log(...)` / `console.error(...)`
401
+ * when ingesting logs in Oxygen production. Therefore, we want to make sure that
402
+ * the error message is as informative as possible instead of `[object Object]`.
403
+ */
404
+ toString(): string;
405
+ /**
406
+ * Note: toJSON` is internally used by `JSON.stringify(...)`.
407
+ * The most common scenario when this error instance is going to be stringified is
408
+ * when it's passed to Remix' `json` and `defer` functions: e.g. `defer({promise: storefront.query(...)})`.
409
+ * In this situation, we don't want to expose private error information to the browser so we only
410
+ * do it in development.
411
+ */
412
+ toJSON(): Pick<GraphQLError, "locations" | "path" | "extensions" | "stack" | "name" | "message">;
413
+ }
414
+
415
+ type I18nBase = {
416
+ language: LanguageCode;
417
+ country: CountryCode;
418
+ };
419
+ type JsonGraphQLError$1 = ReturnType<GraphQLError['toJSON']>;
420
+ type StorefrontApiErrors = JsonGraphQLError$1[] | undefined;
421
+ type StorefrontError = {
422
+ errors?: StorefrontApiErrors;
423
+ };
424
+ /**
425
+ * Wraps all the returned utilities from `createStorefrontClient`.
426
+ */
427
+ type StorefrontClient<TI18n extends I18nBase> = {
428
+ storefront: Storefront<TI18n>;
429
+ };
430
+ /**
431
+ * Maps all the queries found in the project to variables and return types.
432
+ */
433
+ interface StorefrontQueries {
434
+ }
435
+ /**
436
+ * Maps all the mutations found in the project to variables and return types.
437
+ */
438
+ interface StorefrontMutations {
439
+ }
440
+ type AutoAddedVariableNames = 'country' | 'language';
441
+ type StorefrontCommonExtraParams = {
442
+ headers?: HeadersInit;
443
+ storefrontApiVersion?: string;
444
+ displayName?: string;
445
+ };
446
+ /**
447
+ * Interface to interact with the Storefront API.
448
+ */
449
+ type Storefront<TI18n extends I18nBase = I18nBase> = {
450
+ query: <OverrideReturnType extends any = never, RawGqlString extends string = string>(query: RawGqlString, ...options: ClientVariablesInRestParams<StorefrontQueries, RawGqlString, StorefrontCommonExtraParams & Pick<StorefrontQueryOptions, 'cache'>, AutoAddedVariableNames>) => Promise<ClientReturn<StorefrontQueries, RawGqlString, OverrideReturnType> & StorefrontError>;
451
+ mutate: <OverrideReturnType extends any = never, RawGqlString extends string = string>(mutation: RawGqlString, ...options: ClientVariablesInRestParams<StorefrontMutations, RawGqlString, StorefrontCommonExtraParams, AutoAddedVariableNames>) => Promise<ClientReturn<StorefrontMutations, RawGqlString, OverrideReturnType> & StorefrontError>;
452
+ cache?: Cache;
453
+ CacheNone: typeof CacheNone;
454
+ CacheLong: typeof CacheLong;
455
+ CacheShort: typeof CacheShort;
456
+ CacheCustom: typeof CacheCustom;
457
+ generateCacheControlHeader: typeof generateCacheControlHeader;
458
+ getPublicTokenHeaders: ReturnType<typeof createStorefrontClient$1>['getPublicTokenHeaders'];
459
+ getPrivateTokenHeaders: ReturnType<typeof createStorefrontClient$1>['getPrivateTokenHeaders'];
460
+ getShopifyDomain: ReturnType<typeof createStorefrontClient$1>['getShopifyDomain'];
461
+ getApiUrl: ReturnType<typeof createStorefrontClient$1>['getStorefrontApiUrl'];
462
+ isApiError: (error: any) => boolean;
463
+ i18n: TI18n;
464
+ };
465
+ type HydrogenClientProps<TI18n> = {
466
+ /** Storefront API headers. If on Oxygen, use `getStorefrontHeaders()` */
467
+ storefrontHeaders?: StorefrontHeaders;
468
+ /** An instance that implements the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) */
469
+ cache?: Cache;
470
+ /** The globally unique identifier for the Shop */
471
+ storefrontId?: string;
472
+ /** 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. */
473
+ waitUntil?: ExecutionContext['waitUntil'];
474
+ /** An object containing a country code and language code */
475
+ i18n?: TI18n;
476
+ /** Whether it should print GraphQL errors automatically. Defaults to true */
477
+ logErrors?: boolean | ((error?: Error) => boolean);
478
+ };
479
+ type CreateStorefrontClientOptions<TI18n extends I18nBase> = HydrogenClientProps<TI18n> & StorefrontClientProps;
480
+ type StorefrontHeaders = {
481
+ /** A unique ID that correlates all sub-requests together. */
482
+ requestGroupId: string | null;
483
+ /** The IP address of the client. */
484
+ buyerIp: string | null;
485
+ /** The cookie header from the client */
486
+ cookie: string | null;
487
+ /** The purpose header value for debugging */
488
+ purpose: string | null;
489
+ };
490
+ type StorefrontQueryOptions = StorefrontCommonExtraParams & {
491
+ query: string;
492
+ mutation?: never;
493
+ cache?: CachingStrategy;
494
+ };
495
+ /**
496
+ * This function extends `createStorefrontClient` from [Hydrogen React](/docs/api/hydrogen-react/2024-01/utilities/createstorefrontclient). The additional arguments enable internationalization (i18n), caching, and other features particular to Remix and Oxygen.
497
+ *
498
+ * Learn more about [data fetching in Hydrogen](/docs/custom-storefronts/hydrogen/data-fetching/fetch-data).
499
+ */
500
+ declare function createStorefrontClient<TI18n extends I18nBase>(options: CreateStorefrontClientOptions<TI18n>): StorefrontClient<TI18n>;
501
+ declare function formatAPIResult<T>(data: T, errors: StorefrontApiErrors): T & StorefrontError;
502
+ type CreateStorefrontClientForDocs<TI18n extends I18nBase> = {
503
+ storefront?: StorefrontForDoc<TI18n>;
504
+ };
505
+ type StorefrontForDoc<TI18n extends I18nBase = I18nBase> = {
506
+ /** The function to run a query on Storefront API. */
507
+ query?: <TData = any>(query: string, options: StorefrontQueryOptionsForDocs) => Promise<TData & StorefrontError>;
508
+ /** The function to run a mutation on Storefront API. */
509
+ mutate?: <TData = any>(mutation: string, options: StorefrontMutationOptionsForDocs) => Promise<TData & StorefrontError>;
510
+ /** The cache instance passed in from the `createStorefrontClient` argument. */
511
+ cache?: Cache;
512
+ /** Re-export of [`CacheNone`](/docs/api/hydrogen/2024-01/utilities/cachenone). */
513
+ CacheNone?: typeof CacheNone;
514
+ /** Re-export of [`CacheLong`](/docs/api/hydrogen/2024-01/utilities/cachelong). */
515
+ CacheLong?: typeof CacheLong;
516
+ /** Re-export of [`CacheShort`](/docs/api/hydrogen/2024-01/utilities/cacheshort). */
517
+ CacheShort?: typeof CacheShort;
518
+ /** Re-export of [`CacheCustom`](/docs/api/hydrogen/2024-01/utilities/cachecustom). */
519
+ CacheCustom?: typeof CacheCustom;
520
+ /** Re-export of [`generateCacheControlHeader`](/docs/api/hydrogen/2024-01/utilities/generatecachecontrolheader). */
521
+ generateCacheControlHeader?: typeof generateCacheControlHeader;
522
+ /** 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/2024-01/utilities/createstorefrontclient#:~:text=%27graphql%27.-,getPublicTokenHeaders,-(props%3F%3A) for more details. */
523
+ getPublicTokenHeaders?: ReturnType<typeof createStorefrontClient$1>['getPublicTokenHeaders'];
524
+ /** 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/2024-01/utilities/createstorefrontclient#:~:text=storefrontApiVersion-,getPrivateTokenHeaders,-(props%3F%3A) for more details.*/
525
+ getPrivateTokenHeaders?: ReturnType<typeof createStorefrontClient$1>['getPrivateTokenHeaders'];
526
+ /** Creates the fully-qualified URL to your myshopify.com domain. See [`getShopifyDomain` in Hydrogen React](/docs/api/hydrogen-react/2024-01/utilities/createstorefrontclient#:~:text=StorefrontClientReturn-,getShopifyDomain,-(props%3F%3A) for more details. */
527
+ getShopifyDomain?: ReturnType<typeof createStorefrontClient$1>['getShopifyDomain'];
528
+ /** Creates the fully-qualified URL to your store's GraphQL endpoint. See [`getStorefrontApiUrl` in Hydrogen React](/docs/api/hydrogen-react/2024-01/utilities/createstorefrontclient#:~:text=storeDomain-,getStorefrontApiUrl,-(props%3F%3A) for more details.*/
529
+ getApiUrl?: ReturnType<typeof createStorefrontClient$1>['getStorefrontApiUrl'];
530
+ /**
531
+ * @deprecated Use the `errors` object returned from the API if exists.
532
+ * */
533
+ isApiError?: (error: any) => boolean;
534
+ /** The `i18n` object passed in from the `createStorefrontClient` argument. */
535
+ i18n?: TI18n;
536
+ };
537
+ type StorefrontQueryOptionsForDocs = {
538
+ /** The variables for the GraphQL query statement. */
539
+ variables?: Record<string, unknown>;
540
+ /** The cache strategy for this query. Default to max-age=1, stale-while-revalidate=86399. */
541
+ cache?: CachingStrategy;
542
+ /** Additional headers for this query. */
543
+ headers?: HeadersInit;
544
+ /** Override the Storefront API version for this query. */
545
+ storefrontApiVersion?: string;
546
+ /** The name of the query for debugging in the Subrequest Profiler. */
547
+ displayName?: string;
548
+ };
549
+ type StorefrontMutationOptionsForDocs = {
550
+ /** The variables for the GraphQL mutation statement. */
551
+ variables?: Record<string, unknown>;
552
+ /** Additional headers for this query. */
553
+ headers?: HeadersInit;
554
+ /** Override the Storefront API version for this query. */
555
+ storefrontApiVersion?: string;
556
+ /** The name of the query for debugging in the Subrequest Profiler. */
557
+ displayName?: string;
558
+ };
559
+
560
+ /**
561
+ * The cache key is used to uniquely identify a value in the cache.
562
+ */
563
+ type CacheKey = string | readonly unknown[];
564
+ type AddDebugDataParam = {
565
+ displayName?: string;
566
+ response?: Response;
567
+ };
568
+ type CacheActionFunctionParam = {
569
+ addDebugData: (info: AddDebugDataParam) => void;
570
+ };
571
+
572
+ type CrossRuntimeRequest = {
573
+ url?: string;
574
+ method?: string;
575
+ headers: {
576
+ get?: (key: string) => string | null | undefined;
577
+ [key: string]: any;
578
+ };
579
+ };
580
+
581
+ type CreateWithCacheOptions = {
582
+ /** An instance that implements the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) */
583
+ cache: Cache;
584
+ /** 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. */
585
+ waitUntil: ExecutionContext['waitUntil'];
586
+ /** The `request` object is used to access certain headers for debugging */
587
+ request?: CrossRuntimeRequest;
588
+ };
589
+ /**
590
+ * Creates a utility function that executes an asynchronous operation
591
+ * like `fetch` and caches the result according to the strategy provided.
592
+ * Use this to call any third-party APIs from loaders or actions.
593
+ * By default, it uses the `CacheShort` strategy.
594
+ *
595
+ */
596
+ declare function createWithCache<T = unknown>({ cache, waitUntil, request, }: CreateWithCacheOptions): CreateWithCacheReturn<T>;
597
+ /**
598
+ * This is a caching async function. Whatever data is returned from the `actionFn` will be cached according to the strategy provided.
599
+ *
600
+ * Use the `CachingStrategy` to define a custom caching mechanism for your data. Or use one of the built-in caching strategies: `CacheNone`, `CacheShort`, `CacheLong`.
601
+ */
602
+ type CreateWithCacheReturn<T> = <U = T>(cacheKey: CacheKey, strategy: CachingStrategy, actionFn: ({ addDebugData }: CacheActionFunctionParam) => U | Promise<U>) => Promise<U>;
603
+ type WithCache = ReturnType<typeof createWithCache>;
604
+
605
+ /**
606
+ * This is a limited implementation of an in-memory cache.
607
+ * It only supports the `cache-control` header.
608
+ * It does NOT support `age` or `expires` headers.
609
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Cache
610
+ */
611
+ declare class InMemoryCache implements Cache {
612
+ #private;
613
+ constructor();
614
+ add(request: RequestInfo): Promise<void>;
615
+ addAll(requests: RequestInfo[]): Promise<void>;
616
+ matchAll(request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Response[]>;
617
+ put(request: Request, response: Response): Promise<void>;
618
+ match(request: Request): Promise<Response | undefined>;
619
+ delete(request: Request): Promise<boolean>;
620
+ keys(request?: Request): Promise<Request[]>;
621
+ }
622
+
623
+ type StorefrontRedirect = {
624
+ /** The [Storefront client](/docs/api/hydrogen/2024-01/utilities/createstorefrontclient) instance */
625
+ storefront: Storefront<I18nBase>;
626
+ /** The [MDN Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object that was passed to the `server.ts` request handler. */
627
+ request: Request;
628
+ /** The [MDN Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) object created by `handleRequest` */
629
+ response?: Response;
630
+ /** By default the `/admin` route is redirected to the Shopify Admin page for the current storefront. Disable this redirect by passing `true`. */
631
+ noAdminRedirect?: boolean;
632
+ };
633
+ /**
634
+ * Queries the Storefront API to see if there is any redirect
635
+ * created for the current route and performs it. Otherwise,
636
+ * it returns the response passed in the parameters. Useful for
637
+ * conditionally redirecting after a 404 response.
638
+ *
639
+ * @see {@link https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect Creating URL redirects in Shopify}
640
+ */
641
+ declare function storefrontRedirect(options: StorefrontRedirect): Promise<Response>;
642
+
643
+ type GraphiQLLoader = (args: LoaderFunctionArgs) => Promise<Response>;
644
+ declare const graphiqlLoader: GraphiQLLoader;
645
+
646
+ interface SeoConfig<Schema extends Thing = Thing> {
647
+ /**
648
+ * The <title> HTML element defines the document's title that is shown in a browser's title bar or a page's tab. It
649
+ * only contains text; tags within the element are ignored.
650
+ *
651
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
652
+ */
653
+ title?: Maybe<string>;
654
+ /**
655
+ * Generate the title from a template that includes a `%s` placeholder for the title.
656
+ *
657
+ * @example
658
+ * ```js
659
+ * {
660
+ * title: 'My Page',
661
+ * titleTemplate: 'My Site - %s',
662
+ * }
663
+ * ```
664
+ */
665
+ titleTemplate?: Maybe<string> | null;
666
+ /**
667
+ * The media associated with the given page (images, videos, etc). If you pass a string, it will be used as the
668
+ * `og:image` meta tag. If you pass an object or an array of objects, that will be used to generate `og:<type of
669
+ * media>` meta tags. The `url` property should be the URL of the media. The `height` and `width` properties are
670
+ * optional and should be the height and width of the media. The `altText` property is optional and should be a
671
+ * description of the media.
672
+ *
673
+ * @example
674
+ * ```js
675
+ * {
676
+ * media: [
677
+ * {
678
+ * url: 'https://example.com/image.jpg',
679
+ * type: 'image',
680
+ * height: '400',
681
+ * width: '400',
682
+ * altText: 'A custom snowboard with an alpine color pallet.',
683
+ * }
684
+ * ]
685
+ * }
686
+ * ```
687
+ *
688
+ */
689
+ media?: Maybe<string> | Partial<SeoMedia> | (Partial<SeoMedia> | Maybe<string>)[];
690
+ /**
691
+ * The description of the page. This is used in the `name="description"` meta tag as well as the `og:description` meta
692
+ * tag.
693
+ *
694
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
695
+ */
696
+ description?: Maybe<string>;
697
+ /**
698
+ * The canonical URL of the page. This is used to tell search engines which URL is the canonical version of a page.
699
+ * This is useful when you have multiple URLs that point to the same page. The value here will be used in the
700
+ * `rel="canonical"` link tag as well as the `og:url` meta tag.
701
+ *
702
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
703
+ */
704
+ url?: Maybe<string>;
705
+ /**
706
+ * The handle is used to generate the `twitter:site` and `twitter:creator` meta tags. Include the `@` symbol in the
707
+ * handle.
708
+ *
709
+ * @example
710
+ * ```js
711
+ * {
712
+ * handle: '@shopify'
713
+ * }
714
+ * ```
715
+ */
716
+ handle?: Maybe<string>;
717
+ /**
718
+ * The `jsonLd` property is used to generate the `application/ld+json` script tag. This is used to provide structured
719
+ * data to search engines. The value should be an object that conforms to the schema.org spec. The `type` property
720
+ * should be the type of schema you are using. The `type` property is required and should be one of the following:
721
+ *
722
+ * - `Product`
723
+ * - `ItemList`
724
+ * - `Organization`
725
+ * - `WebSite`
726
+ * - `WebPage`
727
+ * - `BlogPosting`
728
+ * - `Thing`
729
+ *
730
+ * @example
731
+ * ```js
732
+ * {
733
+ * jsonLd: {
734
+ * '@context': 'https://schema.org',
735
+ * '@type': 'Product',
736
+ * name: 'My Product',
737
+ * image: 'https://hydrogen.shop/image.jpg',
738
+ * description: 'A product that is great',
739
+ * sku: '12345',
740
+ * mpn: '12345',
741
+ * brand: {
742
+ * '@type': 'Thing',
743
+ * name: 'My Brand',
744
+ * },
745
+ * aggregateRating: {
746
+ * '@type': 'AggregateRating',
747
+ * ratingValue: '4.5',
748
+ * reviewCount: '100',
749
+ * },
750
+ * offers: {
751
+ * '@type': 'Offer',
752
+ * priceCurrency: 'USD',
753
+ * price: '100',
754
+ * priceValidUntil: '2020-11-05',
755
+ * itemCondition: 'https://schema.org/NewCondition',
756
+ * availability: 'https://schema.org/InStock',
757
+ * seller: {
758
+ * '@type': 'Organization',
759
+ * name: 'My Brand',
760
+ * },
761
+ * },
762
+ * }
763
+ * }
764
+ * ```
765
+ *
766
+ * @see https://schema.org/docs/schemas.html
767
+ * @see https://developers.google.com/search/docs/guides/intro-structured-data
768
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
769
+ *
770
+ */
771
+ jsonLd?: WithContext<Schema> | WithContext<Schema>[];
772
+ /**
773
+ * The `alternates` property is used to specify the language and geographical targeting when you have multiple
774
+ * versions of the same page in different languages. The `url` property tells search engines about these variations
775
+ * and helps them to serve the correct version to their users.
776
+ *
777
+ * @example
778
+ * ```js
779
+ * {
780
+ * alternates: [
781
+ * {
782
+ * language: 'en-US',
783
+ * url: 'https://hydrogen.shop/en-us',
784
+ * default: true,
785
+ * },
786
+ * {
787
+ * language: 'fr-CA',
788
+ * url: 'https://hydrogen.shop/fr-ca',
789
+ * },
790
+ * ]
791
+ * }
792
+ * ```
793
+ *
794
+ * @see https://support.google.com/webmasters/answer/189077?hl=en
795
+ */
796
+ alternates?: LanguageAlternate | LanguageAlternate[];
797
+ /**
798
+ * The `robots` property is used to specify the robots meta tag. This is used to tell search engines which pages
799
+ * should be indexed and which should not.
800
+ *
801
+ * @see https://developers.google.com/search/reference/robots_meta_tag
802
+ */
803
+ robots?: RobotsOptions;
804
+ }
805
+ /**
806
+ * @see https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag
807
+ */
808
+ interface RobotsOptions {
809
+ /**
810
+ * Set the maximum size of an image preview for this page in a search results Can be one of the following:
811
+ *
812
+ * - `none` - No image preview is to be shown.
813
+ * - `standard` - A default image preview may be shown.
814
+ * - `large` - A larger image preview, up to the width of the viewport, may be shown.
815
+ *
816
+ * If no value is specified a default image preview size is used.
817
+ */
818
+ maxImagePreview?: 'none' | 'standard' | 'large';
819
+ /**
820
+ * A number representing the maximum of amount characters to use as a textual snippet for a search result. This value
821
+ * can also be set to one of the following special values:
822
+ *
823
+ * - 0 - No snippet is to be shown. Equivalent to nosnippet.
824
+ * - 1 - The Search engine will choose the snippet length that it believes is most effective to help users discover
825
+ * your content and direct users to your site
826
+ * - -1 - No limit on the number of characters that can be shown in the snippet.
827
+ */
828
+ maxSnippet?: number;
829
+ /**
830
+ * The maximum number of seconds for videos on this page to show in search results. This value can also be set to one
831
+ * of the following special values:
832
+ *
833
+ * - 0 - A static image may be used with the `maxImagePreview` setting.
834
+ * - 1 - There is no limit to the size of the video preview.
835
+ *
836
+ * This applies to all forms of search results (at Google: web search, Google Images, Google Videos, Discover,
837
+ * Assistant).
838
+ */
839
+ maxVideoPreview?: number;
840
+ /**
841
+ * Do not show a cached link in search results.
842
+ */
843
+ noArchive?: boolean;
844
+ /**
845
+ * Do not follow the links on this page.
846
+ *
847
+ * @see https://developers.google.com/search/docs/advanced/guidelines/qualify-outbound-links
848
+ */
849
+ noFollow?: boolean;
850
+ /**
851
+ * Do not index images on this page.
852
+ */
853
+ noImageIndex?: boolean;
854
+ /**
855
+ * Do not show this page, media, or resource in search results.
856
+ */
857
+ noIndex?: boolean;
858
+ /**
859
+ * Do not show a text snippet or video preview in the search results for this page.
860
+ */
861
+ noSnippet?: boolean;
862
+ /**
863
+ * Do not offer translation of this page in search results.
864
+ */
865
+ noTranslate?: boolean;
866
+ /**
867
+ * Do not show this page in search results after the specified date/time.
868
+ */
869
+ unavailableAfter?: string;
870
+ }
871
+ interface LanguageAlternate {
872
+ /**
873
+ * Language code for the alternate page. This is used to generate the hreflang meta tag property.
874
+ */
875
+ language: string;
876
+ /**
877
+ * Whether the alternate page is the default page. This will add the `x-default` attribution to the language code.
878
+ */
879
+ default?: boolean;
880
+ /**
881
+ * The url of the alternate page. This is used to generate the hreflang meta tag property.
882
+ */
883
+ url: string;
884
+ }
885
+ type SeoMedia = {
886
+ /**
887
+ * Used to generate og:<type of media> meta tag
888
+ */
889
+ type: 'image' | 'video' | 'audio';
890
+ /**
891
+ * The url value populates both url and secure_url and is used to infer the og:<type of media>:type meta tag.
892
+ */
893
+ url: Maybe<string> | undefined;
894
+ /**
895
+ * The height in pixels of the media. This is used to generate the og:<type of media>:height meta tag.
896
+ */
897
+ height: Maybe<number> | undefined;
898
+ /**
899
+ * The width in pixels of the media. This is used to generate the og:<type of media>:width meta tag.
900
+ */
901
+ width: Maybe<number> | undefined;
902
+ /**
903
+ * The alt text for the media. This is used to generate the og:<type of media>:alt meta tag.
904
+ */
905
+ altText: Maybe<string> | undefined;
906
+ };
907
+
908
+ interface SeoHandleFunction<Loader extends LoaderFunction | unknown = unknown, StructuredDataSchema extends Thing = Thing> {
909
+ (args: {
910
+ data: Loader extends LoaderFunction ? SerializeFrom<Loader> : unknown;
911
+ id: string;
912
+ params: Params;
913
+ pathname: Location['pathname'];
914
+ search: Location['search'];
915
+ hash: Location['hash'];
916
+ key: string;
917
+ }): Partial<SeoConfig<StructuredDataSchema>>;
918
+ }
919
+ interface SeoProps {
920
+ /** Enable debug mode that prints SEO properties for route in the console */
921
+ debug?: boolean;
922
+ }
923
+ declare function Seo({ debug }: SeoProps): react.FunctionComponentElement<{
924
+ children?: react.ReactNode;
925
+ }>;
926
+
927
+ declare global {
928
+ interface Window {
929
+ __hydrogenHydrated?: boolean;
930
+ }
931
+ }
932
+ type Connection<NodesType> = {
933
+ nodes: Array<NodesType>;
934
+ pageInfo: PageInfo;
935
+ } | {
936
+ edges: Array<{
937
+ node: NodesType;
938
+ }>;
939
+ pageInfo: PageInfo;
940
+ };
941
+ interface PaginationInfo<NodesType> {
942
+ /** The paginated array of nodes. You should map over and render this array. */
943
+ nodes: Array<NodesType>;
944
+ /** The `<NextLink>` is a helper component that makes it easy to navigate to the next page of paginated data. Alternatively you can build your own `<Link>` component: `<Link to={nextPageUrl} state={state} preventScrollReset />` */
945
+ NextLink: FC<Omit<LinkProps, 'to'> & {
946
+ ref?: Ref<HTMLAnchorElement>;
947
+ }>;
948
+ /** The `<PreviousLink>` is a helper component that makes it easy to navigate to the previous page of paginated data. Alternatively you can build your own `<Link>` component: `<Link to={previousPageUrl} state={state} preventScrollReset />` */
949
+ PreviousLink: FC<Omit<LinkProps, 'to'> & {
950
+ ref?: Ref<HTMLAnchorElement>;
951
+ }>;
952
+ /** The URL to the previous page of paginated data. Use this prop to build your own `<Link>` component. */
953
+ previousPageUrl: string;
954
+ /** The URL to the next page of paginated data. Use this prop to build your own `<Link>` component. */
955
+ nextPageUrl: string;
956
+ /** True if the cursor has next paginated data */
957
+ hasNextPage: boolean;
958
+ /** True if the cursor has previous paginated data */
959
+ hasPreviousPage: boolean;
960
+ /** True if we are in the process of fetching another page of data */
961
+ isLoading: boolean;
962
+ /** The `state` property is important to use when building your own `<Link>` component if you want paginated data to continuously append to the page. This means that every time the user clicks "Next page", the next page of data will be apppended inline with the previous page. If you want the whole page to re-render with only the next page results, do not pass the `state` prop to the Remix `<Link>` component. */
963
+ state: {
964
+ nodes: Array<NodesType>;
965
+ pageInfo: {
966
+ endCursor: Maybe<string> | undefined;
967
+ startCursor: Maybe<string> | undefined;
968
+ hasPreviousPage: boolean;
969
+ };
970
+ };
971
+ }
972
+ type PaginationProps<NodesType> = {
973
+ /** The response from `storefront.query` for a paginated request. Make sure the query is passed pagination variables and that the query has `pageInfo` with `hasPreviousPage`, `hasNextpage`, `startCursor`, and `endCursor` defined. */
974
+ connection: Connection<NodesType>;
975
+ /** A render prop that includes pagination data and helpers. */
976
+ children: PaginationRenderProp<NodesType>;
977
+ };
978
+ type PaginationRenderProp<NodesType> = FC<PaginationInfo<NodesType>>;
979
+ /**
980
+ *
981
+ * The [Storefront API uses cursors](https://shopify.dev/docs/api/usage/pagination-graphql) to paginate through lists of data
982
+ * and the \`<Pagination />\` component makes it easy to paginate data from the Storefront API.
983
+ *
984
+ * @prop connection The response from `storefront.query` for a paginated request. Make sure the query is passed pagination variables and that the query has `pageInfo` with `hasPreviousPage`, `hasNextpage`, `startCursor`, and `endCursor` defined.
985
+ * @prop children A render prop that includes pagination data and helpers.
986
+ */
987
+ declare function Pagination<NodesType>({ connection, children, }: PaginationProps<NodesType>): ReturnType<FC>;
988
+ /**
989
+ * @param request The request object passed to your Remix loader function.
990
+ * @param options Options for how to configure the pagination variables. Includes the ability to change how many nodes are within each page.
991
+ *
992
+ * @returns Variables to be used with the `storefront.query` function
993
+ */
994
+ declare function getPaginationVariables(request: Request, options?: {
995
+ pageBy: number;
996
+ }): {
997
+ last: number;
998
+ startCursor: string | null;
999
+ } | {
1000
+ first: number;
1001
+ endCursor: string | null;
1002
+ };
1003
+
1004
+ interface HydrogenSessionData {
1005
+ customerAccount: {
1006
+ accessToken?: string;
1007
+ expiresAt?: string;
1008
+ refreshToken?: string;
1009
+ codeVerifier?: string;
1010
+ idToken?: string;
1011
+ nonce?: string;
1012
+ state?: string;
1013
+ redirectPath?: string;
1014
+ };
1015
+ }
1016
+
1017
+ interface HydrogenSession<
1018
+ Data = SessionData,
1019
+ FlashData = FlashSessionData,
1020
+ > {
1021
+ get: Session<HydrogenSessionData & Data, FlashData>['get'];
1022
+ set: Session<HydrogenSessionData & Data, FlashData>['set'];
1023
+ unset: Session<HydrogenSessionData & Data, FlashData>['unset'];
1024
+ commit: () => ReturnType<
1025
+ SessionStorage<HydrogenSessionData & Data, FlashData>['commitSession']
1026
+ >;
1027
+ }
1028
+
1029
+ type DataFunctionValue = Response | NonNullable<unknown> | null;
1030
+ type JsonGraphQLError = ReturnType<GraphQLError['toJSON']>;
1031
+ type CustomerAPIResponse<ReturnType> = {
1032
+ data: ReturnType;
1033
+ errors: Array<{
1034
+ message: string;
1035
+ locations?: Array<{
1036
+ line: number;
1037
+ column: number;
1038
+ }>;
1039
+ path?: Array<string>;
1040
+ extensions: {
1041
+ code: string;
1042
+ };
1043
+ }>;
1044
+ extensions: {
1045
+ cost: {
1046
+ requestQueryCost: number;
1047
+ actualQueryCakes: number;
1048
+ throttleStatus: {
1049
+ maximumAvailable: number;
1050
+ currentAvailable: number;
1051
+ restoreRate: number;
1052
+ };
1053
+ };
1054
+ };
1055
+ };
1056
+ interface CustomerAccountQueries {
1057
+ }
1058
+ interface CustomerAccountMutations {
1059
+ }
1060
+ type CustomerAccount = {
1061
+ /** Start the OAuth login flow. This function should be called and returned from a Remix action. It redirects the customer to a Shopify login domain. It also defined the final path the customer lands on at the end of the oAuth flow with the value of the `return_to` query param. (This is automatically setup unless `customAuthStatusHandler` option is in use) */
1062
+ login: () => Promise<Response>;
1063
+ /** On successful login, the customer redirects 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 in admin. */
1064
+ authorize: () => Promise<Response>;
1065
+ /** Returns if the customer is logged in. It also checks if the access token is expired and refreshes it if needed. */
1066
+ isLoggedIn: () => Promise<boolean>;
1067
+ /** Check for a not logged in customer and redirect customer to login page. The redirect can be overwritten with `customAuthStatusHandler` option. */
1068
+ handleAuthStatus: () => void | DataFunctionValue;
1069
+ /** Returns CustomerAccessToken if the customer is logged in. It also run a expiry check and does a token refresh if needed. */
1070
+ getAccessToken: () => Promise<string | undefined>;
1071
+ /** Creates the fully-qualified URL to your store's GraphQL endpoint.*/
1072
+ getApiUrl: () => string;
1073
+ /** Logout the customer by clearing the session and redirecting to the login domain. It should be called and returned from a Remix action. The path app should redirect to after logout can be setup in Customer Account API settings in admin.*/
1074
+ logout: () => Promise<Response>;
1075
+ /** Execute a GraphQL query against the Customer Account API. This method execute `handleAuthStatus()` ahead of query. */
1076
+ query: <OverrideReturnType extends any = never, RawGqlString extends string = string>(query: RawGqlString, ...options: ClientVariablesInRestParams<CustomerAccountQueries, RawGqlString>) => Promise<Omit<CustomerAPIResponse<ClientReturn<CustomerAccountQueries, RawGqlString, OverrideReturnType>>, 'errors'> & {
1077
+ errors?: JsonGraphQLError[];
1078
+ }>;
1079
+ /** Execute a GraphQL mutation against the Customer Account API. This method execute `handleAuthStatus()` ahead of mutation. */
1080
+ mutate: <OverrideReturnType extends any = never, RawGqlString extends string = string>(mutation: RawGqlString, ...options: ClientVariablesInRestParams<CustomerAccountMutations, RawGqlString>) => Promise<Omit<CustomerAPIResponse<ClientReturn<CustomerAccountMutations, RawGqlString, OverrideReturnType>>, 'errors'> & {
1081
+ errors?: JsonGraphQLError[];
1082
+ }>;
1083
+ };
1084
+ type CustomerAccountOptions = {
1085
+ /** 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. */
1086
+ session: HydrogenSession;
1087
+ /** Unique UUID prefixed with `shp_` associated with the application, this should be visible in the customer account api settings in the Hydrogen admin channel. Mock.shop doesn't automatically supply customerAccountId. Use `npx shopify hydrogen env pull` to link your store credentials. */
1088
+ customerAccountId: string;
1089
+ /** The account URL associated with the application, this should be visible in the customer account api settings in the Hydrogen admin channel. Mock.shop doesn't automatically supply customerAccountUrl. Use `npx shopify hydrogen env pull` to link your store credentials. */
1090
+ customerAccountUrl: string;
1091
+ /** Override the version of the API */
1092
+ customerApiVersion?: string;
1093
+ /** The object for the current Request. It should be provided by your platform. */
1094
+ request: CrossRuntimeRequest;
1095
+ /** 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. */
1096
+ waitUntil?: ExecutionContext['waitUntil'];
1097
+ /** This is the route in your app that authorizes the customer after logging in. Make sure to call `customer.authorize()` within the loader on this route. It defaults to `/account/authorize`. */
1098
+ authUrl?: string;
1099
+ /** Use this method to overwrite the default logged-out redirect behavior. The default handler [throws a redirect](https://remix.run/docs/en/main/utils/redirect#:~:text=!session) to `/account/login` with current path as `return_to` query param. */
1100
+ customAuthStatusHandler?: () => DataFunctionValue;
1101
+ /** Whether it should print GraphQL errors automatically. Defaults to true */
1102
+ logErrors?: boolean | ((error?: Error) => boolean);
1103
+ };
1104
+
1105
+ declare function createCustomerAccountClient({ session, customerAccountId, customerAccountUrl, customerApiVersion, request, waitUntil, authUrl, customAuthStatusHandler, logErrors, }: CustomerAccountOptions): CustomerAccount;
1106
+
1107
+ /**
1108
+ * A custom Remix loader handler that fetches the changelog.json from GitHub.
1109
+ * It is used by the `upgrade` command inside the route `https://hydrogen.shopify.dev/changelog.json`
1110
+ */
1111
+ declare function changelogHandler({ request, changelogUrl, }: {
1112
+ request: Request;
1113
+ changelogUrl?: string;
1114
+ }): Promise<Response>;
1115
+
1116
+ type CartOptionalInput = {
1117
+ /**
1118
+ * The cart id.
1119
+ * @default cart.getCartId();
1120
+ */
1121
+ cartId?: Scalars['ID']['input'];
1122
+ /**
1123
+ * The country code.
1124
+ * @default storefront.i18n.country
1125
+ */
1126
+ country?: CountryCode;
1127
+ /**
1128
+ * The language code.
1129
+ * @default storefront.i18n.language
1130
+ */
1131
+ language?: LanguageCode;
1132
+ };
1133
+ type MetafieldWithoutOwnerId = Omit<CartMetafieldsSetInput, 'ownerId'>;
1134
+ type CartQueryOptions = {
1135
+ /**
1136
+ * The storefront client instance created by [`createStorefrontClient`](docs/api/hydrogen/latest/utilities/createstorefrontclient).
1137
+ */
1138
+ storefront: Storefront;
1139
+ /**
1140
+ * A function that returns the cart ID.
1141
+ */
1142
+ getCartId: () => string | undefined;
1143
+ /**
1144
+ * The cart fragment to override the one used in this query.
1145
+ */
1146
+ cartFragment?: string;
1147
+ };
1148
+ type CartReturn = Cart & {
1149
+ errors?: StorefrontApiErrors;
1150
+ };
1151
+ type CartQueryData = {
1152
+ cart: Cart;
1153
+ userErrors?: CartUserError[] | MetafieldsSetUserError[] | MetafieldDeleteUserError[];
1154
+ };
1155
+ type CartQueryDataReturn = CartQueryData & {
1156
+ errors?: StorefrontApiErrors;
1157
+ };
1158
+ type CartQueryReturn<T> = (requiredParams: T, optionalParams?: CartOptionalInput) => Promise<CartQueryData>;
1159
+
1160
+ type OtherFormData = {
1161
+ [key: string]: unknown;
1162
+ };
1163
+ type CartAttributesUpdateProps = {
1164
+ action: 'AttributesUpdateInput';
1165
+ inputs?: {
1166
+ attributes: AttributeInput[];
1167
+ } & OtherFormData;
1168
+ };
1169
+ type CartAttributesUpdateRequire = {
1170
+ action: 'AttributesUpdateInput';
1171
+ inputs: {
1172
+ attributes: AttributeInput[];
1173
+ } & OtherFormData;
1174
+ };
1175
+ type CartBuyerIdentityUpdateProps = {
1176
+ action: 'BuyerIdentityUpdate';
1177
+ inputs?: {
1178
+ buyerIdentity: CartBuyerIdentityInput;
1179
+ } & OtherFormData;
1180
+ };
1181
+ type CartBuyerIdentityUpdateRequire = {
1182
+ action: 'BuyerIdentityUpdate';
1183
+ inputs: {
1184
+ buyerIdentity: CartBuyerIdentityInput;
1185
+ } & OtherFormData;
1186
+ };
1187
+ type CartCreateProps = {
1188
+ action: 'Create';
1189
+ inputs?: {
1190
+ input: CartInput;
1191
+ } & OtherFormData;
1192
+ };
1193
+ type CartCreateRequire = {
1194
+ action: 'Create';
1195
+ inputs: {
1196
+ input: CartInput;
1197
+ } & OtherFormData;
1198
+ };
1199
+ type CartDiscountCodesUpdateProps = {
1200
+ action: 'DiscountCodesUpdate';
1201
+ inputs?: {
1202
+ discountCodes: string[];
1203
+ } & OtherFormData;
1204
+ };
1205
+ type CartDiscountCodesUpdateRequire = {
1206
+ action: 'DiscountCodesUpdate';
1207
+ inputs: {
1208
+ discountCodes: string[];
1209
+ } & OtherFormData;
1210
+ };
1211
+ type CartLinesAddProps = {
1212
+ action: 'LinesAdd';
1213
+ inputs?: {
1214
+ lines: CartLineInput[];
1215
+ } & OtherFormData;
1216
+ };
1217
+ type CartLinesAddRequire = {
1218
+ action: 'LinesAdd';
1219
+ inputs: {
1220
+ lines: CartLineInput[];
1221
+ } & OtherFormData;
1222
+ };
1223
+ type CartLinesUpdateProps = {
1224
+ action: 'LinesUpdate';
1225
+ inputs?: {
1226
+ lines: CartLineUpdateInput[];
1227
+ } & OtherFormData;
1228
+ };
1229
+ type CartLinesUpdateRequire = {
1230
+ action: 'LinesUpdate';
1231
+ inputs: {
1232
+ lines: CartLineUpdateInput[];
1233
+ } & OtherFormData;
1234
+ };
1235
+ type CartLinesRemoveProps = {
1236
+ action: 'LinesRemove';
1237
+ inputs?: {
1238
+ lineIds: string[];
1239
+ } & OtherFormData;
1240
+ };
1241
+ type CartLinesRemoveRequire = {
1242
+ action: 'LinesRemove';
1243
+ inputs: {
1244
+ lineIds: string[];
1245
+ } & OtherFormData;
1246
+ };
1247
+ type CartNoteUpdateProps = {
1248
+ action: 'NoteUpdate';
1249
+ inputs?: {
1250
+ note: string;
1251
+ } & OtherFormData;
1252
+ };
1253
+ type CartNoteUpdateRequire = {
1254
+ action: 'NoteUpdate';
1255
+ inputs: {
1256
+ note: string;
1257
+ } & OtherFormData;
1258
+ };
1259
+ type CartSelectedDeliveryOptionsUpdateProps = {
1260
+ action: 'SelectedDeliveryOptionsUpdate';
1261
+ inputs?: {
1262
+ selectedDeliveryOptions: CartSelectedDeliveryOptionInput[];
1263
+ } & OtherFormData;
1264
+ };
1265
+ type CartSelectedDeliveryOptionsUpdateRequire = {
1266
+ action: 'SelectedDeliveryOptionsUpdate';
1267
+ inputs: {
1268
+ selectedDeliveryOptions: CartSelectedDeliveryOptionInput[];
1269
+ } & OtherFormData;
1270
+ };
1271
+ type CartMetafieldsSetProps = {
1272
+ action: 'MetafieldsSet';
1273
+ inputs?: {
1274
+ metafields: MetafieldWithoutOwnerId[];
1275
+ } & OtherFormData;
1276
+ };
1277
+ type CartMetafieldsSetRequire = {
1278
+ action: 'MetafieldsSet';
1279
+ inputs: {
1280
+ metafields: MetafieldWithoutOwnerId[];
1281
+ } & OtherFormData;
1282
+ };
1283
+ type CartMetafieldDeleteProps = {
1284
+ action: 'MetafieldsDelete';
1285
+ inputs?: {
1286
+ key: Scalars['String']['input'];
1287
+ } & OtherFormData;
1288
+ };
1289
+ type CartMetafieldDeleteRequire = {
1290
+ action: 'MetafieldsDelete';
1291
+ inputs: {
1292
+ key: Scalars['String']['input'];
1293
+ } & OtherFormData;
1294
+ };
1295
+ type CartCustomProps = {
1296
+ action: `Custom${string}`;
1297
+ inputs?: Record<string, unknown>;
1298
+ };
1299
+ type CartCustomRequire = {
1300
+ action: `Custom${string}`;
1301
+ inputs: Record<string, unknown>;
1302
+ };
1303
+ type CartFormCommonProps = {
1304
+ /**
1305
+ * Children nodes of CartForm.
1306
+ * Children can be a render prop that receives the fetcher.
1307
+ */
1308
+ children: ReactNode | ((fetcher: FetcherWithComponents<any>) => ReactNode);
1309
+ /**
1310
+ * The route to submit the form to. Defaults to the current route.
1311
+ */
1312
+ route?: string;
1313
+ /**
1314
+ * Optional key to use for the fetcher.
1315
+ * @see https://remix.run/hooks/use-fetcher#key
1316
+ */
1317
+ fetcherKey?: string;
1318
+ };
1319
+ type CartActionInputProps = CartAttributesUpdateProps | CartBuyerIdentityUpdateProps | CartCreateProps | CartDiscountCodesUpdateProps | CartLinesAddProps | CartLinesUpdateProps | CartLinesRemoveProps | CartNoteUpdateProps | CartSelectedDeliveryOptionsUpdateProps | CartMetafieldsSetProps | CartMetafieldDeleteProps | CartCustomProps;
1320
+ type CartActionInput = CartAttributesUpdateRequire | CartBuyerIdentityUpdateRequire | CartCreateRequire | CartDiscountCodesUpdateRequire | CartLinesAddRequire | CartLinesUpdateRequire | CartLinesRemoveRequire | CartNoteUpdateRequire | CartSelectedDeliveryOptionsUpdateRequire | CartMetafieldsSetRequire | CartMetafieldDeleteRequire | CartCustomRequire;
1321
+ type CartFormProps = CartActionInputProps & CartFormCommonProps;
1322
+ declare function CartForm({ children, action, inputs, route, fetcherKey, }: CartFormProps): JSX.Element;
1323
+ declare namespace CartForm {
1324
+ var INPUT_NAME: string;
1325
+ var ACTIONS: {
1326
+ readonly AttributesUpdateInput: "AttributesUpdateInput";
1327
+ readonly BuyerIdentityUpdate: "BuyerIdentityUpdate";
1328
+ readonly Create: "Create";
1329
+ readonly DiscountCodesUpdate: "DiscountCodesUpdate";
1330
+ readonly LinesAdd: "LinesAdd";
1331
+ readonly LinesRemove: "LinesRemove";
1332
+ readonly LinesUpdate: "LinesUpdate";
1333
+ readonly NoteUpdate: "NoteUpdate";
1334
+ readonly SelectedDeliveryOptionsUpdate: "SelectedDeliveryOptionsUpdate";
1335
+ readonly MetafieldsSet: "MetafieldsSet";
1336
+ readonly MetafieldDelete: "MetafieldDelete";
1337
+ };
1338
+ var getFormInput: (formData: FormData) => CartActionInput;
1339
+ }
1340
+
1341
+ type CartCreateFunction = (input: CartInput, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1342
+ declare function cartCreateDefault(options: CartQueryOptions): CartCreateFunction;
1343
+
1344
+ type CartGetProps = {
1345
+ /**
1346
+ * The cart ID.
1347
+ * @default cart.getCartId();
1348
+ */
1349
+ cartId?: string;
1350
+ /**
1351
+ * The country code.
1352
+ * @default storefront.i18n.country
1353
+ */
1354
+ country?: CountryCode;
1355
+ /**
1356
+ * The language code.
1357
+ * @default storefront.i18n.language
1358
+ */
1359
+ language?: LanguageCode;
1360
+ /**
1361
+ * The number of cart lines to be returned.
1362
+ * @default 100
1363
+ */
1364
+ numCartLines?: number;
1365
+ };
1366
+ type CartGetFunction = (cartInput?: CartGetProps) => Promise<CartReturn | null>;
1367
+ type CartGetOptions = CartQueryOptions & {
1368
+ /**
1369
+ * The customer account client instance created by [`createCustomerAccountClient`](docs/api/hydrogen/latest/utilities/createcustomeraccountclient).
1370
+ */
1371
+ customerAccount?: CustomerAccount;
1372
+ };
1373
+ declare function cartGetDefault({ storefront, customerAccount, getCartId, cartFragment, }: CartGetOptions): CartGetFunction;
1374
+
1375
+ type CartLinesAddFunction = (lines: CartLineInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1376
+ declare function cartLinesAddDefault(options: CartQueryOptions): CartLinesAddFunction;
1377
+
1378
+ type CartLinesUpdateFunction = (lines: CartLineUpdateInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1379
+ declare function cartLinesUpdateDefault(options: CartQueryOptions): CartLinesUpdateFunction;
1380
+
1381
+ type CartLinesRemoveFunction = (lineIds: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1382
+ declare function cartLinesRemoveDefault(options: CartQueryOptions): CartLinesRemoveFunction;
1383
+
1384
+ type CartDiscountCodesUpdateFunction = (discountCodes: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1385
+ declare function cartDiscountCodesUpdateDefault(options: CartQueryOptions): CartDiscountCodesUpdateFunction;
1386
+
1387
+ type CartBuyerIdentityUpdateFunction = (buyerIdentity: CartBuyerIdentityInput, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1388
+ declare function cartBuyerIdentityUpdateDefault(options: CartQueryOptions): CartBuyerIdentityUpdateFunction;
1389
+
1390
+ type CartNoteUpdateFunction = (note: string, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1391
+ declare function cartNoteUpdateDefault(options: CartQueryOptions): CartNoteUpdateFunction;
1392
+
1393
+ type CartSelectedDeliveryOptionsUpdateFunction = (selectedDeliveryOptions: CartSelectedDeliveryOptionInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1394
+ declare function cartSelectedDeliveryOptionsUpdateDefault(options: CartQueryOptions): CartSelectedDeliveryOptionsUpdateFunction;
1395
+
1396
+ type CartAttributesUpdateFunction = (attributes: AttributeInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1397
+ declare function cartAttributesUpdateDefault(options: CartQueryOptions): CartAttributesUpdateFunction;
1398
+
1399
+ type CartMetafieldsSetFunction = (metafields: MetafieldWithoutOwnerId[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1400
+ declare function cartMetafieldsSetDefault(options: CartQueryOptions): CartMetafieldsSetFunction;
1401
+
1402
+ type CartMetafieldDeleteFunction = (key: Scalars['String']['input'], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
1403
+ declare function cartMetafieldDeleteDefault(options: CartQueryOptions): CartMetafieldDeleteFunction;
1404
+
1405
+ declare const cartGetIdDefault: (requestHeaders: Headers) => () => string | undefined;
1406
+
1407
+ type CookieOptions = {
1408
+ maxage?: number;
1409
+ expires?: Date | number | string;
1410
+ samesite?: 'Lax' | 'Strict' | 'None';
1411
+ secure?: boolean;
1412
+ httponly?: boolean;
1413
+ domain?: string;
1414
+ path?: string;
1415
+ };
1416
+ declare const cartSetIdDefault: (cookieOptions?: CookieOptions) => (cartId: string) => Headers;
1417
+
1418
+ type CartHandlerOptions = {
1419
+ storefront: Storefront;
1420
+ customerAccount?: CustomerAccount;
1421
+ getCartId: () => string | undefined;
1422
+ setCartId: (cartId: string) => Headers;
1423
+ cartQueryFragment?: string;
1424
+ cartMutateFragment?: string;
1425
+ };
1426
+ type CustomMethodsBase = Record<string, Function>;
1427
+ type CartHandlerOptionsWithCustom<TCustomMethods extends CustomMethodsBase> = CartHandlerOptions & {
1428
+ customMethods?: TCustomMethods;
1429
+ };
1430
+ type HydrogenCart = {
1431
+ get: ReturnType<typeof cartGetDefault>;
1432
+ getCartId: () => string | undefined;
1433
+ setCartId: (cartId: string) => Headers;
1434
+ create: ReturnType<typeof cartCreateDefault>;
1435
+ addLines: ReturnType<typeof cartLinesAddDefault>;
1436
+ updateLines: ReturnType<typeof cartLinesUpdateDefault>;
1437
+ removeLines: ReturnType<typeof cartLinesRemoveDefault>;
1438
+ updateDiscountCodes: ReturnType<typeof cartDiscountCodesUpdateDefault>;
1439
+ updateBuyerIdentity: ReturnType<typeof cartBuyerIdentityUpdateDefault>;
1440
+ updateNote: ReturnType<typeof cartNoteUpdateDefault>;
1441
+ updateSelectedDeliveryOption: ReturnType<typeof cartSelectedDeliveryOptionsUpdateDefault>;
1442
+ updateAttributes: ReturnType<typeof cartAttributesUpdateDefault>;
1443
+ setMetafields: ReturnType<typeof cartMetafieldsSetDefault>;
1444
+ deleteMetafield: ReturnType<typeof cartMetafieldDeleteDefault>;
1445
+ };
1446
+ type HydrogenCartCustom<TCustomMethods extends Partial<HydrogenCart> & CustomMethodsBase> = Omit<HydrogenCart, keyof TCustomMethods> & TCustomMethods;
1447
+ declare function createCartHandler(options: CartHandlerOptions): HydrogenCart;
1448
+ declare function createCartHandler<TCustomMethods extends CustomMethodsBase>(options: CartHandlerOptionsWithCustom<TCustomMethods>): HydrogenCartCustom<TCustomMethods>;
1449
+
1450
+ type VariantOption = {
1451
+ name: string;
1452
+ value?: string;
1453
+ values: Array<VariantOptionValue>;
1454
+ };
1455
+ type VariantOptionValue = {
1456
+ value: string;
1457
+ isAvailable: boolean;
1458
+ to: string;
1459
+ search: string;
1460
+ isActive: boolean;
1461
+ };
1462
+ type VariantSelectorProps = {
1463
+ /** The product handle for all of the variants */
1464
+ handle: string;
1465
+ /** Product options from the [Storefront API](/docs/api/storefront/2024-01/objects/ProductOption). Make sure both `name` and `values` are apart of your query. */
1466
+ options: Array<PartialDeep<ProductOption>> | undefined;
1467
+ /** Product variants from the [Storefront API](/docs/api/storefront/2024-01/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`. */
1468
+ variants?: PartialDeep<ProductVariantConnection> | Array<PartialDeep<ProductVariant>>;
1469
+ /** By default all products are under /products. Use this prop to provide a custom path. */
1470
+ productPath?: string;
1471
+ children: ({ option }: {
1472
+ option: VariantOption;
1473
+ }) => ReactNode;
1474
+ };
1475
+ declare function VariantSelector({ handle, options, variants: _variants, productPath, children, }: VariantSelectorProps): react.FunctionComponentElement<{
1476
+ children?: ReactNode;
1477
+ }>;
1478
+ type GetSelectedProductOptions = (request: Request) => SelectedOptionInput[];
1479
+ declare const getSelectedProductOptions: GetSelectedProductOptions;
1480
+
1481
+ declare const useNonce: () => string | undefined;
1482
+ type ContentSecurityPolicy = {
1483
+ /** A randomly generated nonce string that should be passed to any custom `script` element */
1484
+ nonce: string;
1485
+ /** The content security policy header */
1486
+ header: string;
1487
+ NonceProvider: ComponentType<{
1488
+ children: ReactNode;
1489
+ }>;
1490
+ };
1491
+ /**
1492
+ * @param directives - Pass custom [content security policy directives](https://content-security-policy.com/). This is important if you load content in your app from third-party domains.
1493
+ */
1494
+ declare function createContentSecurityPolicy(directives?: Record<string, string[] | string | boolean>): ContentSecurityPolicy;
1495
+
1496
+ declare const Script: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>, "ref"> & react.RefAttributes<HTMLScriptElement>>;
1497
+
1498
+ declare function useOptimisticData<T>(identifier: string): T;
1499
+ type OptimisticInputProps = {
1500
+ /**
1501
+ * A unique identifier for the optimistic input. Use the same identifier in `useOptimisticData`
1502
+ * to retrieve the optimistic data from actions.
1503
+ */
1504
+ id: string;
1505
+ /**
1506
+ * The data to be stored in the optimistic input. Use for creating an optimistic successful state
1507
+ * of this form action.
1508
+ */
1509
+ data: Record<string, unknown>;
1510
+ };
1511
+ declare function OptimisticInput({ id, data }: OptimisticInputProps): react_jsx_runtime.JSX.Element;
1512
+
1513
+ declare function ShopPayButton(props: ComponentProps<typeof ShopPayButton$1>): react_jsx_runtime.JSX.Element;
1514
+
1515
+ export { CacheCustom, CacheKey, CacheLong, CacheNone, CacheShort, CachingStrategy, CartActionInput, CartForm, CartQueryDataReturn, CartQueryOptions, CartQueryReturn, CartReturn, CookieOptions, CreateStorefrontClientForDocs, CreateStorefrontClientOptions, CustomerAccount, CustomerAccountMutations, CustomerAccountQueries, CustomerAccount as CustomerClient, HydrogenCart, HydrogenCartCustom, HydrogenSession, HydrogenSessionData, I18nBase, InMemoryCache, MetafieldWithoutOwnerId, NoStoreStrategy, OptimisticInput, Pagination, Script, Seo, SeoConfig, SeoHandleFunction, ShopPayButton, Storefront, StorefrontApiErrors, StorefrontClient, StorefrontForDoc, StorefrontMutationOptionsForDocs, StorefrontMutations, StorefrontQueries, StorefrontQueryOptionsForDocs, VariantOption, VariantOptionValue, VariantSelector, WithCache, cartAttributesUpdateDefault, cartBuyerIdentityUpdateDefault, cartCreateDefault, cartDiscountCodesUpdateDefault, cartGetDefault, cartGetIdDefault, cartLinesAddDefault, cartLinesRemoveDefault, cartLinesUpdateDefault, cartMetafieldDeleteDefault, cartMetafieldsSetDefault, cartNoteUpdateDefault, cartSelectedDeliveryOptionsUpdateDefault, cartSetIdDefault, changelogHandler, createCartHandler, createContentSecurityPolicy, createCustomerAccountClient, createStorefrontClient, createWithCache, formatAPIResult, generateCacheControlHeader, getPaginationVariables, getSelectedProductOptions, graphiqlLoader, storefrontRedirect, useNonce, useOptimisticData };