@shopify/hydrogen 2026.4.0 → 2026.4.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.
- package/dist/development/index.cjs +228 -174
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +228 -174
- package/dist/development/index.js.map +1 -1
- package/dist/oxygen/index.d.ts +1 -1
- package/dist/production/index.cjs +121 -153
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.d.cts +64 -1
- package/dist/production/index.d.ts +64 -1
- package/dist/production/index.js +121 -153
- package/dist/production/index.js.map +1 -1
- package/dist/vite/{chunk-ZSWP2RO7.js → chunk-4O5OI3OO.js} +0 -4
- package/dist/vite/{chunk-XTDF5RJS.js → chunk-QXBQVDMY.js} +1 -2
- package/dist/vite/hydrogen-middleware.js +2 -2
- package/dist/vite/plugin.js +2 -3
- package/dist/vite/request-events.d.ts +0 -1
- package/dist/vite/request-events.js +1 -1
- package/package.json +3 -3
|
@@ -45,25 +45,30 @@ type CachingStrategy = AllCacheOptions;
|
|
|
45
45
|
type NoStoreStrategy = {
|
|
46
46
|
mode: string;
|
|
47
47
|
};
|
|
48
|
+
/** @publicDocs */
|
|
48
49
|
declare function generateCacheControlHeader(cacheOptions: CachingStrategy): string;
|
|
49
50
|
/**
|
|
50
51
|
*
|
|
51
52
|
* @public
|
|
53
|
+
* @publicDocs
|
|
52
54
|
*/
|
|
53
55
|
declare function CacheNone(): NoStoreStrategy;
|
|
54
56
|
/**
|
|
55
57
|
*
|
|
56
58
|
* @public
|
|
59
|
+
* @publicDocs
|
|
57
60
|
*/
|
|
58
61
|
declare function CacheShort(overrideOptions?: CachingStrategy): AllCacheOptions;
|
|
59
62
|
/**
|
|
60
63
|
*
|
|
61
64
|
* @public
|
|
65
|
+
* @publicDocs
|
|
62
66
|
*/
|
|
63
67
|
declare function CacheLong(overrideOptions?: CachingStrategy): AllCacheOptions;
|
|
64
68
|
/**
|
|
65
69
|
*
|
|
66
70
|
* @public
|
|
71
|
+
* @publicDocs
|
|
67
72
|
*/
|
|
68
73
|
declare function CacheCustom(overrideOptions: CachingStrategy): AllCacheOptions;
|
|
69
74
|
|
|
@@ -1115,39 +1120,51 @@ type CartGetOptions = CartQueryOptions & {
|
|
|
1115
1120
|
*/
|
|
1116
1121
|
customerAccount?: CustomerAccount;
|
|
1117
1122
|
};
|
|
1123
|
+
/** @publicDocs */
|
|
1118
1124
|
declare function cartGetDefault({ storefront, customerAccount, getCartId, cartFragment, }: CartGetOptions): CartGetFunction;
|
|
1119
1125
|
|
|
1120
1126
|
type CartCreateFunction = (input: CartInput, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1127
|
+
/** @publicDocs */
|
|
1121
1128
|
declare function cartCreateDefault(options: CartQueryOptions): CartCreateFunction;
|
|
1122
1129
|
|
|
1123
1130
|
type CartLinesAddFunction = (lines: Array<CartLineInput>, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1131
|
+
/** @publicDocs */
|
|
1124
1132
|
declare function cartLinesAddDefault(options: CartQueryOptions): CartLinesAddFunction;
|
|
1125
1133
|
|
|
1126
1134
|
type CartLinesUpdateFunction = (lines: CartLineUpdateInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1135
|
+
/** @publicDocs */
|
|
1127
1136
|
declare function cartLinesUpdateDefault(options: CartQueryOptions): CartLinesUpdateFunction;
|
|
1128
1137
|
|
|
1129
1138
|
type CartLinesRemoveFunction = (lineIds: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1139
|
+
/** @publicDocs */
|
|
1130
1140
|
declare function cartLinesRemoveDefault(options: CartQueryOptions): CartLinesRemoveFunction;
|
|
1131
1141
|
|
|
1132
1142
|
type CartDiscountCodesUpdateFunction = (discountCodes: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1143
|
+
/** @publicDocs */
|
|
1133
1144
|
declare function cartDiscountCodesUpdateDefault(options: CartQueryOptions): CartDiscountCodesUpdateFunction;
|
|
1134
1145
|
|
|
1135
1146
|
type CartBuyerIdentityUpdateFunction = (buyerIdentity: CartBuyerIdentityInput, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1147
|
+
/** @publicDocs */
|
|
1136
1148
|
declare function cartBuyerIdentityUpdateDefault(options: CartQueryOptions): CartBuyerIdentityUpdateFunction;
|
|
1137
1149
|
|
|
1138
1150
|
type CartNoteUpdateFunction = (note: string, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1151
|
+
/** @publicDocs */
|
|
1139
1152
|
declare function cartNoteUpdateDefault(options: CartQueryOptions): CartNoteUpdateFunction;
|
|
1140
1153
|
|
|
1141
1154
|
type CartSelectedDeliveryOptionsUpdateFunction = (selectedDeliveryOptions: CartSelectedDeliveryOptionInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1155
|
+
/** @publicDocs */
|
|
1142
1156
|
declare function cartSelectedDeliveryOptionsUpdateDefault(options: CartQueryOptions): CartSelectedDeliveryOptionsUpdateFunction;
|
|
1143
1157
|
|
|
1144
1158
|
type CartAttributesUpdateFunction = (attributes: AttributeInput[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1159
|
+
/** @publicDocs */
|
|
1145
1160
|
declare function cartAttributesUpdateDefault(options: CartQueryOptions): CartAttributesUpdateFunction;
|
|
1146
1161
|
|
|
1147
1162
|
type CartMetafieldsSetFunction = (metafields: MetafieldWithoutOwnerId[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1163
|
+
/** @publicDocs */
|
|
1148
1164
|
declare function cartMetafieldsSetDefault(options: CartQueryOptions): CartMetafieldsSetFunction;
|
|
1149
1165
|
|
|
1150
1166
|
type CartMetafieldDeleteFunction = (key: Scalars['String']['input'], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1167
|
+
/** @publicDocs */
|
|
1151
1168
|
declare function cartMetafieldDeleteDefault(options: CartQueryOptions): CartMetafieldDeleteFunction;
|
|
1152
1169
|
|
|
1153
1170
|
type CartGiftCardCodesUpdateFunction = (giftCardCodes: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
@@ -1162,6 +1179,7 @@ type CartGiftCardCodesUpdateFunction = (giftCardCodes: string[], optionalParams?
|
|
|
1162
1179
|
* @example Replace all gift card codes
|
|
1163
1180
|
* const updateGiftCardCodes = cartGiftCardCodesUpdateDefault({ storefront, getCartId });
|
|
1164
1181
|
* await updateGiftCardCodes(['SUMMER2025', 'WELCOME10']);
|
|
1182
|
+
* @publicDocs
|
|
1165
1183
|
*/
|
|
1166
1184
|
declare function cartGiftCardCodesUpdateDefault(options: CartQueryOptions): CartGiftCardCodesUpdateFunction;
|
|
1167
1185
|
|
|
@@ -1178,10 +1196,12 @@ type CartGiftCardCodesAddFunction = (giftCardCodes: string[], optionalParams?: C
|
|
|
1178
1196
|
* @example Add gift card codes
|
|
1179
1197
|
* const addGiftCardCodes = cartGiftCardCodesAddDefault({ storefront, getCartId });
|
|
1180
1198
|
* await addGiftCardCodes(['SUMMER2025', 'WELCOME10']);
|
|
1199
|
+
* @publicDocs
|
|
1181
1200
|
*/
|
|
1182
1201
|
declare function cartGiftCardCodesAddDefault(options: CartQueryOptions): CartGiftCardCodesAddFunction;
|
|
1183
1202
|
|
|
1184
1203
|
type CartGiftCardCodesRemoveFunction = (appliedGiftCardIds: string[], optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
1204
|
+
/** @publicDocs */
|
|
1185
1205
|
declare function cartGiftCardCodesRemoveDefault(options: CartQueryOptions): CartGiftCardCodesRemoveFunction;
|
|
1186
1206
|
|
|
1187
1207
|
type CartDeliveryAddressesAddFunction = (addresses: Array<CartSelectableAddressInput>, optionalParams?: CartOptionalInput) => Promise<CartQueryDataReturn>;
|
|
@@ -1205,6 +1225,7 @@ type CartDeliveryAddressesAddFunction = (addresses: Array<CartSelectableAddressI
|
|
|
1205
1225
|
* }
|
|
1206
1226
|
* ], { someOptionalParam: 'value' }
|
|
1207
1227
|
* );
|
|
1228
|
+
* @publicDocs
|
|
1208
1229
|
*/
|
|
1209
1230
|
declare function cartDeliveryAddressesAddDefault(options: CartQueryOptions): CartDeliveryAddressesAddFunction;
|
|
1210
1231
|
|
|
@@ -1224,6 +1245,7 @@ type CartDeliveryAddressesRemoveFunction = (addressIds: Array<Scalars['ID']['inp
|
|
|
1224
1245
|
* "gid://shopify/<objectName>/10079785100"
|
|
1225
1246
|
* ],
|
|
1226
1247
|
* { someOptionalParam: 'value' });
|
|
1248
|
+
* @publicDocs
|
|
1227
1249
|
*/
|
|
1228
1250
|
declare function cartDeliveryAddressesRemoveDefault(options: CartQueryOptions): CartDeliveryAddressesRemoveFunction;
|
|
1229
1251
|
|
|
@@ -1265,6 +1287,7 @@ type CartDeliveryAddressesUpdateFunction = (addresses: Array<CartSelectableAddre
|
|
|
1265
1287
|
"validationStrategy": "COUNTRY_CODE_ONLY"
|
|
1266
1288
|
}
|
|
1267
1289
|
],{ someOptionalParam: 'value' });
|
|
1290
|
+
* @publicDocs
|
|
1268
1291
|
*/
|
|
1269
1292
|
declare function cartDeliveryAddressesUpdateDefault(options: CartQueryOptions): CartDeliveryAddressesUpdateFunction;
|
|
1270
1293
|
|
|
@@ -1293,6 +1316,7 @@ type CartDeliveryAddressesReplaceFunction = (addresses: Array<CartSelectableAddr
|
|
|
1293
1316
|
* }
|
|
1294
1317
|
* ], { someOptionalParam: 'value' }
|
|
1295
1318
|
* );
|
|
1319
|
+
* @publicDocs
|
|
1296
1320
|
*/
|
|
1297
1321
|
declare function cartDeliveryAddressesReplaceDefault(options: CartQueryOptions): CartDeliveryAddressesReplaceFunction;
|
|
1298
1322
|
|
|
@@ -1425,11 +1449,11 @@ type HydrogenCart = {
|
|
|
1425
1449
|
replaceDeliveryAddresses: ReturnType<typeof cartDeliveryAddressesReplaceDefault>;
|
|
1426
1450
|
};
|
|
1427
1451
|
type HydrogenCartCustom<TCustomMethods extends Partial<HydrogenCart> & CustomMethodsBase> = Omit<HydrogenCart, keyof TCustomMethods> & TCustomMethods;
|
|
1452
|
+
/** @publicDocs */
|
|
1428
1453
|
declare function createCartHandler(options: CartHandlerOptions): HydrogenCart;
|
|
1429
1454
|
declare function createCartHandler<TCustomMethods extends CustomMethodsBase>(options: CartHandlerOptionsWithCustom<TCustomMethods>): HydrogenCartCustom<TCustomMethods>;
|
|
1430
1455
|
|
|
1431
1456
|
type RequestEventPayload = {
|
|
1432
|
-
__fromVite?: boolean;
|
|
1433
1457
|
url: string;
|
|
1434
1458
|
eventType: 'request' | 'subrequest';
|
|
1435
1459
|
requestId?: string | null;
|
|
@@ -1550,6 +1574,7 @@ type CustomerPrivacyApiProps = {
|
|
|
1550
1574
|
*/
|
|
1551
1575
|
sameDomainForStorefrontApi?: boolean;
|
|
1552
1576
|
};
|
|
1577
|
+
/** @publicDocs */
|
|
1553
1578
|
declare function useCustomerPrivacy(props: CustomerPrivacyApiProps): {
|
|
1554
1579
|
customerPrivacy: CustomerPrivacy | null;
|
|
1555
1580
|
privacyBanner?: PrivacyBanner | null;
|
|
@@ -1764,9 +1789,11 @@ type StorefrontQueryOptions = StorefrontCommonExtraParams & {
|
|
|
1764
1789
|
* This function extends `createStorefrontClient` from [Hydrogen React](/docs/api/hydrogen-react/2026-04/utilities/createstorefrontclient). The additional arguments enable internationalization (i18n), caching, and other features particular to Remix and Oxygen.
|
|
1765
1790
|
*
|
|
1766
1791
|
* Learn more about [data fetching in Hydrogen](/docs/custom-storefronts/hydrogen/data-fetching/fetch-data).
|
|
1792
|
+
* @publicDocs
|
|
1767
1793
|
*/
|
|
1768
1794
|
declare function createStorefrontClient<TI18n extends I18nBase>(options: CreateStorefrontClientOptions<TI18n>): StorefrontClient<TI18n>;
|
|
1769
1795
|
declare function formatAPIResult<T>(data: T, errors: StorefrontApiErrors): T & StorefrontError;
|
|
1796
|
+
/** @publicDocs */
|
|
1770
1797
|
type CreateStorefrontClientForDocs<TI18n extends I18nBase> = {
|
|
1771
1798
|
storefront?: StorefrontForDoc<TI18n>;
|
|
1772
1799
|
};
|
|
@@ -1991,10 +2018,15 @@ type CustomViewProps = {
|
|
|
1991
2018
|
data?: OtherData;
|
|
1992
2019
|
customData?: OtherData;
|
|
1993
2020
|
};
|
|
2021
|
+
/** @publicDocs */
|
|
1994
2022
|
declare function AnalyticsProductView(props: ProductViewProps): react_jsx_runtime.JSX.Element;
|
|
2023
|
+
/** @publicDocs */
|
|
1995
2024
|
declare function AnalyticsCollectionView(props: CollectionViewProps): react_jsx_runtime.JSX.Element;
|
|
2025
|
+
/** @publicDocs */
|
|
1996
2026
|
declare function AnalyticsCartView(props: BasicViewProps): react_jsx_runtime.JSX.Element;
|
|
2027
|
+
/** @publicDocs */
|
|
1997
2028
|
declare function AnalyticsSearchView(props: SearchViewProps): react_jsx_runtime.JSX.Element;
|
|
2029
|
+
/** @publicDocs */
|
|
1998
2030
|
declare function AnalyticsCustomView(props: CustomViewProps): react_jsx_runtime.JSX.Element;
|
|
1999
2031
|
|
|
2000
2032
|
type ShopAnalytics = {
|
|
@@ -2010,6 +2042,7 @@ type ShopAnalytics = {
|
|
|
2010
2042
|
type Consent = Partial<Pick<CustomerPrivacyApiProps, 'checkoutDomain' | 'sameDomainForStorefrontApi' | 'storefrontAccessToken' | 'withPrivacyBanner' | 'country'>> & {
|
|
2011
2043
|
language?: LanguageCode$1;
|
|
2012
2044
|
};
|
|
2045
|
+
/** @publicDocs */
|
|
2013
2046
|
type AnalyticsProviderProps = {
|
|
2014
2047
|
/** React children to render. */
|
|
2015
2048
|
children?: ReactNode;
|
|
@@ -2070,6 +2103,7 @@ declare function publish(event: typeof AnalyticsEvent.PRODUCT_ADD_TO_CART, paylo
|
|
|
2070
2103
|
declare function publish(event: typeof AnalyticsEvent.PRODUCT_REMOVED_FROM_CART, payload: CartLineUpdatePayload): void;
|
|
2071
2104
|
declare function publish(event: typeof AnalyticsEvent.CUSTOM_EVENT, payload: OtherData): void;
|
|
2072
2105
|
declare function AnalyticsProvider({ canTrack: customCanTrack, cart: currentCart, children, consent, customData, shop: shopProp, cookieDomain, }: AnalyticsProviderProps): JSX.Element;
|
|
2106
|
+
/** @publicDocs */
|
|
2073
2107
|
declare function useAnalytics(): AnalyticsContextValue;
|
|
2074
2108
|
type ShopAnalyticsProps = {
|
|
2075
2109
|
/**
|
|
@@ -2081,6 +2115,7 @@ type ShopAnalyticsProps = {
|
|
|
2081
2115
|
*/
|
|
2082
2116
|
publicStorefrontId: string;
|
|
2083
2117
|
};
|
|
2118
|
+
/** @publicDocs */
|
|
2084
2119
|
declare function getShopAnalytics({ storefront, publicStorefrontId, }: ShopAnalyticsProps): Promise<ShopAnalytics | null>;
|
|
2085
2120
|
declare const Analytics: {
|
|
2086
2121
|
CartView: typeof AnalyticsCartView;
|
|
@@ -2141,6 +2176,7 @@ type WithCache = {
|
|
|
2141
2176
|
response: Response;
|
|
2142
2177
|
}>;
|
|
2143
2178
|
};
|
|
2179
|
+
/** @publicDocs */
|
|
2144
2180
|
declare function createWithCache(cacheOptions: CreateWithCacheOptions): WithCache;
|
|
2145
2181
|
|
|
2146
2182
|
/**
|
|
@@ -2148,6 +2184,7 @@ declare function createWithCache(cacheOptions: CreateWithCacheOptions): WithCach
|
|
|
2148
2184
|
* It only supports the `cache-control` header.
|
|
2149
2185
|
* It does NOT support `age` or `expires` headers.
|
|
2150
2186
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Cache
|
|
2187
|
+
* @publicDocs
|
|
2151
2188
|
*/
|
|
2152
2189
|
declare class InMemoryCache implements Cache {
|
|
2153
2190
|
#private;
|
|
@@ -2410,6 +2447,7 @@ type CartFormCommonProps = {
|
|
|
2410
2447
|
type CartActionInputProps = CartAttributesUpdateProps | CartBuyerIdentityUpdateProps | CartCreateProps | CartDiscountCodesUpdateProps | CartGiftCardCodesUpdateProps | CartGiftCardCodesAddProps | CartGiftCardCodesRemoveProps | CartLinesAddProps | CartLinesUpdateProps | CartLinesRemoveProps | CartNoteUpdateProps | CartSelectedDeliveryOptionsUpdateProps | CartMetafieldsSetProps | CartMetafieldDeleteProps | CartDeliveryAddressesAddProps | CartDeliveryAddressesRemoveProps | CartDeliveryAddressesUpdateProps | CartDeliveryAddressesReplaceProps | CartCustomProps;
|
|
2411
2448
|
type CartActionInput = CartAttributesUpdateRequire | CartBuyerIdentityUpdateRequire | CartCreateRequire | CartDiscountCodesUpdateRequire | CartGiftCardCodesUpdateRequire | CartGiftCardCodesAddRequire | CartGiftCardCodesRemoveRequire | CartLinesAddRequire | CartLinesUpdateRequire | CartLinesRemoveRequire | CartNoteUpdateRequire | CartSelectedDeliveryOptionsUpdateRequire | CartMetafieldsSetRequire | CartMetafieldDeleteRequire | CartDeliveryAddressesAddRequire | CartDeliveryAddressesRemoveRequire | CartDeliveryAddressesUpdateRequire | CartDeliveryAddressesReplaceRequire | CartCustomRequire;
|
|
2412
2449
|
type CartFormProps = CartActionInputProps & CartFormCommonProps;
|
|
2450
|
+
/** @publicDocs */
|
|
2413
2451
|
declare function CartForm({ children, action, inputs, route, fetcherKey, }: CartFormProps): JSX.Element;
|
|
2414
2452
|
declare namespace CartForm {
|
|
2415
2453
|
var INPUT_NAME: string;
|
|
@@ -2436,6 +2474,7 @@ declare namespace CartForm {
|
|
|
2436
2474
|
var getFormInput: (formData: FormData) => CartActionInput;
|
|
2437
2475
|
}
|
|
2438
2476
|
|
|
2477
|
+
/** @publicDocs */
|
|
2439
2478
|
declare const cartGetIdDefault: (requestHeaders: CrossRuntimeRequest["headers"]) => () => string | undefined;
|
|
2440
2479
|
|
|
2441
2480
|
type CookieOptions = {
|
|
@@ -2447,6 +2486,7 @@ type CookieOptions = {
|
|
|
2447
2486
|
domain?: string;
|
|
2448
2487
|
path?: string;
|
|
2449
2488
|
};
|
|
2489
|
+
/** @publicDocs */
|
|
2450
2490
|
declare const cartSetIdDefault: (cookieOptions?: CookieOptions) => (cartId: string) => Headers;
|
|
2451
2491
|
|
|
2452
2492
|
type LikeACart = {
|
|
@@ -2477,6 +2517,7 @@ type OptimisticCart<T = CartReturn> = T extends undefined | null ? // This is th
|
|
|
2477
2517
|
* @param cart The cart object from `context.cart.get()` returned by a server loader.
|
|
2478
2518
|
*
|
|
2479
2519
|
* @returns A new cart object augmented with optimistic state for `lines` and `totalQuantity`. Each cart line item that is optimistically added includes an `isOptimistic` property. Also if the cart has _any_ optimistic state, a root property `isOptimistic` will be set to `true`.
|
|
2520
|
+
* @publicDocs
|
|
2480
2521
|
*/
|
|
2481
2522
|
declare function useOptimisticCart<DefaultCart = {
|
|
2482
2523
|
lines?: {
|
|
@@ -2512,6 +2553,7 @@ declare function changelogHandler({ request, changelogUrl, }: {
|
|
|
2512
2553
|
* const cart = context.get(hydrogenContext.cart);
|
|
2513
2554
|
* }
|
|
2514
2555
|
* ```
|
|
2556
|
+
* @publicDocs
|
|
2515
2557
|
*/
|
|
2516
2558
|
declare const hydrogenContext: {
|
|
2517
2559
|
readonly storefront: react_router.RouterContext<Storefront<I18nBase>>;
|
|
@@ -2592,6 +2634,7 @@ interface HydrogenContext<TSession extends HydrogenSession = HydrogenSession, TC
|
|
|
2592
2634
|
/** Any cookie implementation. By default Hydrogen ships with cookie session storage, but you can use [another session storage](https://remix.run/docs/en/main/utils/sessions) implementation. */
|
|
2593
2635
|
session: TSession;
|
|
2594
2636
|
}
|
|
2637
|
+
/** @publicDocs */
|
|
2595
2638
|
declare function createHydrogenContext<TSession extends HydrogenSession, TCustomMethods extends CustomMethodsBase | undefined = {}, TI18n extends I18nBase = I18nBase, TEnv extends HydrogenEnv = Env, TAdditionalContext extends Record<string, any> = {}>(options: HydrogenContextOptions<TSession, TCustomMethods, TI18n, TEnv>, additionalContext?: TAdditionalContext): HydrogenRouterContextProvider<TSession, TCustomMethods, TI18n, TEnv> & TAdditionalContext;
|
|
2596
2639
|
|
|
2597
2640
|
type CreateRequestHandlerOptions<Context = unknown> = {
|
|
@@ -2620,10 +2663,12 @@ type CreateRequestHandlerOptions<Context = unknown> = {
|
|
|
2620
2663
|
};
|
|
2621
2664
|
/**
|
|
2622
2665
|
* Creates a request handler for Hydrogen apps using React Router.
|
|
2666
|
+
* @publicDocs
|
|
2623
2667
|
*/
|
|
2624
2668
|
declare function createRequestHandler<Context = unknown>({ build, mode, poweredByHeader, getLoadContext, collectTrackingInformation, }: CreateRequestHandlerOptions<Context>): (request: Request) => Promise<Response>;
|
|
2625
2669
|
|
|
2626
2670
|
declare const NonceProvider: react.Provider<string | undefined>;
|
|
2671
|
+
/** @publicDocs */
|
|
2627
2672
|
declare const useNonce: () => string | undefined;
|
|
2628
2673
|
type ContentSecurityPolicy = {
|
|
2629
2674
|
/** A randomly generated nonce string that should be passed to any custom `script` element */
|
|
@@ -2673,6 +2718,7 @@ type ShopProp = {
|
|
|
2673
2718
|
};
|
|
2674
2719
|
/**
|
|
2675
2720
|
* @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.
|
|
2721
|
+
* @publicDocs
|
|
2676
2722
|
*/
|
|
2677
2723
|
declare function createContentSecurityPolicy(props?: CreateContentSecurityPolicy & ShopProp): ContentSecurityPolicy;
|
|
2678
2724
|
|
|
@@ -2682,12 +2728,15 @@ interface HydrogenScriptProps {
|
|
|
2682
2728
|
}
|
|
2683
2729
|
interface ScriptAttributes extends ScriptHTMLAttributes<HTMLScriptElement> {
|
|
2684
2730
|
}
|
|
2731
|
+
/** @publicDocs */
|
|
2685
2732
|
declare const Script: react.ForwardRefExoticComponent<HydrogenScriptProps & ScriptAttributes & react.RefAttributes<HTMLScriptElement>>;
|
|
2686
2733
|
|
|
2734
|
+
/** @publicDocs */
|
|
2687
2735
|
declare function createCustomerAccountClient({ session, customerAccountId, shopId, customerApiVersion, request, waitUntil, authUrl, customAuthStatusHandler, logErrors, loginPath, authorizePath, defaultRedirectPath, language, useCustomAuthDomain, }: CustomerAccountOptions): CustomerAccount;
|
|
2688
2736
|
|
|
2689
2737
|
declare function hydrogenRoutes(currentRoutes: Array<RouteConfigEntry>): Promise<Array<RouteConfigEntry>>;
|
|
2690
2738
|
|
|
2739
|
+
/** @publicDocs */
|
|
2691
2740
|
declare function useOptimisticData<T>(identifier: string): T;
|
|
2692
2741
|
type OptimisticInputProps = {
|
|
2693
2742
|
/**
|
|
@@ -2701,6 +2750,7 @@ type OptimisticInputProps = {
|
|
|
2701
2750
|
*/
|
|
2702
2751
|
data: Record<string, unknown>;
|
|
2703
2752
|
};
|
|
2753
|
+
/** @publicDocs */
|
|
2704
2754
|
declare function OptimisticInput({ id, data }: OptimisticInputProps): react_jsx_runtime.JSX.Element;
|
|
2705
2755
|
|
|
2706
2756
|
declare global {
|
|
@@ -2760,6 +2810,7 @@ type PaginationRenderProp<NodesType> = FC<PaginationInfo<NodesType>>;
|
|
|
2760
2810
|
*
|
|
2761
2811
|
* @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.
|
|
2762
2812
|
* @prop children A render prop that includes pagination data and helpers.
|
|
2813
|
+
* @publicDocs
|
|
2763
2814
|
*/
|
|
2764
2815
|
declare function Pagination<NodesType>({ connection, children, namespace, }: PaginationProps<NodesType>): ReturnType<FC>;
|
|
2765
2816
|
/**
|
|
@@ -2767,6 +2818,7 @@ declare function Pagination<NodesType>({ connection, children, namespace, }: Pag
|
|
|
2767
2818
|
* @param options Options for how to configure the pagination variables. Includes the ability to change how many nodes are within each page as well as a namespace to avoid URL param conflicts when using multiple `Pagination` components on a single page.
|
|
2768
2819
|
*
|
|
2769
2820
|
* @returns Variables to be used with the `storefront.query` function
|
|
2821
|
+
* @publicDocs
|
|
2770
2822
|
*/
|
|
2771
2823
|
declare function getPaginationVariables(request: Request, options?: {
|
|
2772
2824
|
pageBy: number;
|
|
@@ -2788,6 +2840,7 @@ type OptimisticProductVariants = Array<PartialDeep<ProductVariant>> | Promise<Ar
|
|
|
2788
2840
|
* @param selectedVariant The `selectedVariant` field queried with `variantBySelectedOptions`.
|
|
2789
2841
|
* @param variants The available product variants for the product. This can be an array of variants, a promise that resolves to an array of variants, or an object with a `product` key that contains the variants.
|
|
2790
2842
|
* @returns A new product object where the `selectedVariant` property is set to the variant that matches the current URL search params. If no variant is found, the original product object is returned. The `isOptimistic` property is set to `true` if the `selectedVariant` has been optimistically changed.
|
|
2843
|
+
* @publicDocs
|
|
2791
2844
|
*/
|
|
2792
2845
|
declare function useOptimisticVariant<SelectedVariant = OptimisticVariantInput, Variants = OptimisticProductVariants>(selectedVariant: SelectedVariant, variants: Variants): OptimisticVariant<SelectedVariant>;
|
|
2793
2846
|
|
|
@@ -2843,10 +2896,12 @@ type VariantSelectorProps = {
|
|
|
2843
2896
|
* [getAdjacentAndFirstAvailableVariants](https://shopify.dev/docs/api/hydrogen/latest/utilities/getadjacentandfirstavailablevariants) utils instead.
|
|
2844
2897
|
* and [useSelectedOptionInUrlParam](https://shopify.dev/docs/api/hydrogen/latest/utilities/useselectedoptioninurlparam)
|
|
2845
2898
|
* For a full implementation see the Skeleton template [routes/product.$handle.tsx](https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/app/routes/products.%24handle.tsx).
|
|
2899
|
+
* @publicDocs
|
|
2846
2900
|
*/
|
|
2847
2901
|
declare function VariantSelector({ handle, options: _options, variants: _variants, productPath, waitForNavigation, selectedVariant, children, }: VariantSelectorProps): react.FunctionComponentElement<{
|
|
2848
2902
|
children?: ReactNode | undefined;
|
|
2849
2903
|
}>;
|
|
2904
|
+
/** @publicDocs */
|
|
2850
2905
|
type GetSelectedProductOptions = (request: Request) => SelectedOptionInput[];
|
|
2851
2906
|
/**
|
|
2852
2907
|
* Extract searchParams from a Request instance and return an array of selected options.
|
|
@@ -2867,6 +2922,7 @@ type GetSelectedProductOptions = (request: Request) => SelectedOptionInput[];
|
|
|
2867
2922
|
* // {name: 'size', value: 'large'}
|
|
2868
2923
|
* // ]
|
|
2869
2924
|
* ```
|
|
2925
|
+
* @publicDocs
|
|
2870
2926
|
**/
|
|
2871
2927
|
declare const getSelectedProductOptions: GetSelectedProductOptions;
|
|
2872
2928
|
|
|
@@ -2914,7 +2970,9 @@ declare function hydrogenPreset(): Preset;
|
|
|
2914
2970
|
|
|
2915
2971
|
declare const RichText: typeof RichText$1;
|
|
2916
2972
|
|
|
2973
|
+
/** @publicDocs */
|
|
2917
2974
|
type GraphiQLLoader = (args: LoaderFunctionArgs) => Promise<Response>;
|
|
2975
|
+
/** @publicDocs */
|
|
2918
2976
|
declare const graphiqlLoader: GraphiQLLoader;
|
|
2919
2977
|
|
|
2920
2978
|
type StorefrontRedirect = {
|
|
@@ -2936,6 +2994,7 @@ type StorefrontRedirect = {
|
|
|
2936
2994
|
* conditionally redirecting after a 404 response.
|
|
2937
2995
|
*
|
|
2938
2996
|
* @see {@link https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect Creating URL redirects in Shopify}
|
|
2997
|
+
* @publicDocs
|
|
2939
2998
|
*/
|
|
2940
2999
|
declare function storefrontRedirect(options: StorefrontRedirect): Promise<Response>;
|
|
2941
3000
|
|
|
@@ -3207,6 +3266,7 @@ type GetSeoMetaReturn = ReturnType<MetaFunction>;
|
|
|
3207
3266
|
type Optional<T> = T | null | undefined;
|
|
3208
3267
|
/**
|
|
3209
3268
|
* Generate a Remix meta array from one or more SEO configuration objects. This is useful to pass SEO configuration for the parent route(s) and the current route. Similar to `Object.assign()`, each property is overwritten based on the object order. The exception is `jsonLd`, which is preserved so that each route has it's own independent jsonLd meta data.
|
|
3269
|
+
* @publicDocs
|
|
3210
3270
|
*/
|
|
3211
3271
|
declare function getSeoMeta(...seoInputs: Optional<SeoConfig>[]): GetSeoMetaReturn;
|
|
3212
3272
|
|
|
@@ -3227,6 +3287,7 @@ interface SeoProps {
|
|
|
3227
3287
|
}
|
|
3228
3288
|
/**
|
|
3229
3289
|
* @deprecated - use `getSeoMeta` instead
|
|
3290
|
+
* @publicDocs
|
|
3230
3291
|
*/
|
|
3231
3292
|
declare function Seo({ debug }: SeoProps): react.FunctionComponentElement<{
|
|
3232
3293
|
children?: react.ReactNode | undefined;
|
|
@@ -3247,6 +3308,7 @@ interface SitemapIndexOptions {
|
|
|
3247
3308
|
}
|
|
3248
3309
|
/**
|
|
3249
3310
|
* Generate a sitemap index that links to separate sitemaps for each resource type. Returns a standard Response object.
|
|
3311
|
+
* @publicDocs
|
|
3250
3312
|
*/
|
|
3251
3313
|
declare function getSitemapIndex(options: SitemapIndexOptions): Promise<Response>;
|
|
3252
3314
|
interface GetSiteMapOptions {
|
|
@@ -3275,6 +3337,7 @@ interface GetSiteMapOptions {
|
|
|
3275
3337
|
}
|
|
3276
3338
|
/**
|
|
3277
3339
|
* Generate a sitemap for a specific resource type.
|
|
3340
|
+
* @publicDocs
|
|
3278
3341
|
*/
|
|
3279
3342
|
declare function getSitemap(options: GetSiteMapOptions): Promise<Response>;
|
|
3280
3343
|
|