@shopify/hydrogen-react 2024.10.0 → 2025.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/customer-account.schema.json +1 -1
- package/dist/browser-dev/AddToCartButton.mjs.map +1 -1
- package/dist/browser-dev/BuyNowButton.mjs.map +1 -1
- package/dist/browser-dev/CartCost.mjs.map +1 -1
- package/dist/browser-dev/CartLineProvider.mjs.map +1 -1
- package/dist/browser-dev/CartProvider.mjs.map +1 -1
- package/dist/browser-dev/ExternalVideo.mjs.map +1 -1
- package/dist/browser-dev/Image.mjs.map +1 -1
- package/dist/browser-dev/ModelViewer.mjs.map +1 -1
- package/dist/browser-dev/Money.mjs.map +1 -1
- package/dist/browser-dev/ProductPrice.mjs.map +1 -1
- package/dist/browser-dev/RichText.mjs.map +1 -1
- package/dist/browser-dev/Video.mjs.map +1 -1
- package/dist/browser-dev/codegen.helpers.mjs.map +1 -1
- package/dist/browser-dev/getProductOptions.mjs +241 -0
- package/dist/browser-dev/getProductOptions.mjs.map +1 -0
- package/dist/browser-dev/index.mjs +6 -0
- package/dist/browser-dev/index.mjs.map +1 -1
- package/dist/browser-dev/optionValueDecoder.mjs +10 -8
- package/dist/browser-dev/optionValueDecoder.mjs.map +1 -1
- package/dist/browser-dev/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/browser-dev/storefront-api-constants.mjs +1 -1
- package/dist/browser-dev/storefront-api-constants.mjs.map +1 -1
- package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-dev/useCartActions.mjs.map +1 -1
- package/dist/browser-dev/useSelectedOptionInUrlParam.mjs +30 -0
- package/dist/browser-dev/useSelectedOptionInUrlParam.mjs.map +1 -0
- package/dist/browser-prod/AddToCartButton.mjs.map +1 -1
- package/dist/browser-prod/BuyNowButton.mjs.map +1 -1
- package/dist/browser-prod/CartCost.mjs.map +1 -1
- package/dist/browser-prod/CartLineProvider.mjs.map +1 -1
- package/dist/browser-prod/CartProvider.mjs.map +1 -1
- package/dist/browser-prod/ExternalVideo.mjs.map +1 -1
- package/dist/browser-prod/Image.mjs.map +1 -1
- package/dist/browser-prod/ModelViewer.mjs.map +1 -1
- package/dist/browser-prod/Money.mjs.map +1 -1
- package/dist/browser-prod/ProductPrice.mjs.map +1 -1
- package/dist/browser-prod/RichText.mjs.map +1 -1
- package/dist/browser-prod/Video.mjs.map +1 -1
- package/dist/browser-prod/codegen.helpers.mjs.map +1 -1
- package/dist/browser-prod/getProductOptions.mjs +241 -0
- package/dist/browser-prod/getProductOptions.mjs.map +1 -0
- package/dist/browser-prod/index.mjs +6 -0
- package/dist/browser-prod/index.mjs.map +1 -1
- package/dist/browser-prod/optionValueDecoder.mjs +10 -8
- package/dist/browser-prod/optionValueDecoder.mjs.map +1 -1
- package/dist/browser-prod/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/browser-prod/storefront-api-constants.mjs +1 -1
- package/dist/browser-prod/storefront-api-constants.mjs.map +1 -1
- package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-prod/useCartActions.mjs.map +1 -1
- package/dist/browser-prod/useSelectedOptionInUrlParam.mjs +30 -0
- package/dist/browser-prod/useSelectedOptionInUrlParam.mjs.map +1 -0
- package/dist/node-dev/AddToCartButton.js.map +1 -1
- package/dist/node-dev/AddToCartButton.mjs.map +1 -1
- package/dist/node-dev/BuyNowButton.js.map +1 -1
- package/dist/node-dev/BuyNowButton.mjs.map +1 -1
- package/dist/node-dev/CartCost.js.map +1 -1
- package/dist/node-dev/CartCost.mjs.map +1 -1
- package/dist/node-dev/CartLineProvider.js.map +1 -1
- package/dist/node-dev/CartLineProvider.mjs.map +1 -1
- package/dist/node-dev/CartProvider.js.map +1 -1
- package/dist/node-dev/CartProvider.mjs.map +1 -1
- package/dist/node-dev/ExternalVideo.js.map +1 -1
- package/dist/node-dev/ExternalVideo.mjs.map +1 -1
- package/dist/node-dev/Image.js.map +1 -1
- package/dist/node-dev/Image.mjs.map +1 -1
- package/dist/node-dev/ModelViewer.js.map +1 -1
- package/dist/node-dev/ModelViewer.mjs.map +1 -1
- package/dist/node-dev/Money.js.map +1 -1
- package/dist/node-dev/Money.mjs.map +1 -1
- package/dist/node-dev/ProductPrice.js.map +1 -1
- package/dist/node-dev/ProductPrice.mjs.map +1 -1
- package/dist/node-dev/RichText.js.map +1 -1
- package/dist/node-dev/RichText.mjs.map +1 -1
- package/dist/node-dev/Video.js.map +1 -1
- package/dist/node-dev/Video.mjs.map +1 -1
- package/dist/node-dev/codegen.helpers.js.map +1 -1
- package/dist/node-dev/codegen.helpers.mjs.map +1 -1
- package/dist/node-dev/getProductOptions.js +241 -0
- package/dist/node-dev/getProductOptions.js.map +1 -0
- package/dist/node-dev/getProductOptions.mjs +241 -0
- package/dist/node-dev/getProductOptions.mjs.map +1 -0
- package/dist/node-dev/index.js +6 -0
- package/dist/node-dev/index.js.map +1 -1
- package/dist/node-dev/index.mjs +6 -0
- package/dist/node-dev/index.mjs.map +1 -1
- package/dist/node-dev/optionValueDecoder.js +10 -8
- package/dist/node-dev/optionValueDecoder.js.map +1 -1
- package/dist/node-dev/optionValueDecoder.mjs +10 -8
- package/dist/node-dev/optionValueDecoder.mjs.map +1 -1
- package/dist/node-dev/packages/hydrogen-react/package.json.js +1 -1
- package/dist/node-dev/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/node-dev/storefront-api-constants.js +1 -1
- package/dist/node-dev/storefront-api-constants.js.map +1 -1
- package/dist/node-dev/storefront-api-constants.mjs +1 -1
- package/dist/node-dev/storefront-api-constants.mjs.map +1 -1
- package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-dev/useCartActions.js.map +1 -1
- package/dist/node-dev/useCartActions.mjs.map +1 -1
- package/dist/node-dev/useSelectedOptionInUrlParam.js +30 -0
- package/dist/node-dev/useSelectedOptionInUrlParam.js.map +1 -0
- package/dist/node-dev/useSelectedOptionInUrlParam.mjs +30 -0
- package/dist/node-dev/useSelectedOptionInUrlParam.mjs.map +1 -0
- package/dist/node-prod/AddToCartButton.js.map +1 -1
- package/dist/node-prod/AddToCartButton.mjs.map +1 -1
- package/dist/node-prod/BuyNowButton.js.map +1 -1
- package/dist/node-prod/BuyNowButton.mjs.map +1 -1
- package/dist/node-prod/CartCost.js.map +1 -1
- package/dist/node-prod/CartCost.mjs.map +1 -1
- package/dist/node-prod/CartLineProvider.js.map +1 -1
- package/dist/node-prod/CartLineProvider.mjs.map +1 -1
- package/dist/node-prod/CartProvider.js.map +1 -1
- package/dist/node-prod/CartProvider.mjs.map +1 -1
- package/dist/node-prod/ExternalVideo.js.map +1 -1
- package/dist/node-prod/ExternalVideo.mjs.map +1 -1
- package/dist/node-prod/Image.js.map +1 -1
- package/dist/node-prod/Image.mjs.map +1 -1
- package/dist/node-prod/ModelViewer.js.map +1 -1
- package/dist/node-prod/ModelViewer.mjs.map +1 -1
- package/dist/node-prod/Money.js.map +1 -1
- package/dist/node-prod/Money.mjs.map +1 -1
- package/dist/node-prod/ProductPrice.js.map +1 -1
- package/dist/node-prod/ProductPrice.mjs.map +1 -1
- package/dist/node-prod/RichText.js.map +1 -1
- package/dist/node-prod/RichText.mjs.map +1 -1
- package/dist/node-prod/Video.js.map +1 -1
- package/dist/node-prod/Video.mjs.map +1 -1
- package/dist/node-prod/codegen.helpers.js.map +1 -1
- package/dist/node-prod/codegen.helpers.mjs.map +1 -1
- package/dist/node-prod/getProductOptions.js +241 -0
- package/dist/node-prod/getProductOptions.js.map +1 -0
- package/dist/node-prod/getProductOptions.mjs +241 -0
- package/dist/node-prod/getProductOptions.mjs.map +1 -0
- package/dist/node-prod/index.js +6 -0
- package/dist/node-prod/index.js.map +1 -1
- package/dist/node-prod/index.mjs +6 -0
- package/dist/node-prod/index.mjs.map +1 -1
- package/dist/node-prod/optionValueDecoder.js +10 -8
- package/dist/node-prod/optionValueDecoder.js.map +1 -1
- package/dist/node-prod/optionValueDecoder.mjs +10 -8
- package/dist/node-prod/optionValueDecoder.mjs.map +1 -1
- package/dist/node-prod/packages/hydrogen-react/package.json.js +1 -1
- package/dist/node-prod/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/node-prod/storefront-api-constants.js +1 -1
- package/dist/node-prod/storefront-api-constants.js.map +1 -1
- package/dist/node-prod/storefront-api-constants.mjs +1 -1
- package/dist/node-prod/storefront-api-constants.mjs.map +1 -1
- package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-prod/useCartActions.js.map +1 -1
- package/dist/node-prod/useCartActions.mjs.map +1 -1
- package/dist/node-prod/useSelectedOptionInUrlParam.js +30 -0
- package/dist/node-prod/useSelectedOptionInUrlParam.js.map +1 -0
- package/dist/node-prod/useSelectedOptionInUrlParam.mjs +30 -0
- package/dist/node-prod/useSelectedOptionInUrlParam.mjs.map +1 -0
- package/dist/types/CartLineProvider.d.ts +1 -1
- package/dist/types/CartProvider.d.ts +6 -5
- package/dist/types/Image.d.ts +1 -1
- package/dist/types/ModelViewer.d.ts +1 -1
- package/dist/types/Money.d.ts +1 -1
- package/dist/types/Video.d.ts +1 -1
- package/dist/types/codegen.helpers.d.ts +2 -2
- package/dist/types/getProductOptions.d.ts +49 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/optionValueDecoder.d.ts +2 -2
- package/dist/types/storefront-api-constants.d.ts +1 -1
- package/dist/types/storefront-api-response.types.d.ts +5 -5
- package/dist/types/storefront-api-types.d.ts +641 -127
- package/dist/types/useCartAPIStateMachine.d.ts +2 -2
- package/dist/types/useCartActions.d.ts +2 -2
- package/dist/types/useSelectedOptionInUrlParam.d.ts +2 -0
- package/dist/umd/hydrogen-react.dev.js +351 -88
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +18 -18
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +3 -3
- package/storefront.schema.json +1 -1
|
@@ -43,17 +43,17 @@ type CartProviderProps = {
|
|
|
43
43
|
onAttributesUpdateComplete?: () => void;
|
|
44
44
|
/** A callback that is invoked when the process to update the cart discount codes completes */
|
|
45
45
|
onDiscountCodesUpdateComplete?: () => void;
|
|
46
|
-
/** An object with fields that correspond to the Storefront API's [Cart object](https://shopify.dev/api/storefront/
|
|
46
|
+
/** An object with fields that correspond to the Storefront API's [Cart object](https://shopify.dev/api/storefront/2025-01/objects/cart). */
|
|
47
47
|
data?: PartialDeep<CartType, {
|
|
48
48
|
recurseIntoArrays: true;
|
|
49
49
|
}>;
|
|
50
|
-
/** A fragment used to query the Storefront API's [Cart object](https://shopify.dev/api/storefront/
|
|
50
|
+
/** A fragment used to query the Storefront API's [Cart object](https://shopify.dev/api/storefront/2025-01/objects/cart) for all queries and mutations. A default value is used if no argument is provided. */
|
|
51
51
|
cartFragment?: string;
|
|
52
52
|
/** A customer access token that's accessible on the server if there's a customer login. */
|
|
53
53
|
customerAccessToken?: CartBuyerIdentityInput['customerAccessToken'];
|
|
54
54
|
/** The ISO country code for i18n. */
|
|
55
55
|
countryCode?: CountryCode;
|
|
56
|
-
/** The ISO
|
|
56
|
+
/** The ISO language code for i18n. */
|
|
57
57
|
languageCode?: LanguageCode;
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
@@ -67,8 +67,9 @@ type CartProviderProps = {
|
|
|
67
67
|
* The `CartProvider` component must be a descendant of the `ShopifyProvider` component.
|
|
68
68
|
*/
|
|
69
69
|
export declare function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, onCreateComplete, onLineAddComplete, onLineRemoveComplete, onLineUpdateComplete, onNoteUpdateComplete, onBuyerIdentityUpdateComplete, onAttributesUpdateComplete, onDiscountCodesUpdateComplete, data: cart, cartFragment, customerAccessToken, countryCode, languageCode, }: CartProviderProps): JSX.Element;
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
70
|
+
/**
|
|
71
|
+
* Check for storage availability function obtained from
|
|
72
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API
|
|
72
73
|
*/
|
|
73
74
|
export declare function storageAvailable(type: 'localStorage' | 'sessionStorage'): boolean;
|
|
74
75
|
export {};
|
package/dist/types/Image.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ type HydrogenImageBaseProps = {
|
|
|
42
42
|
* @defaultValue `center`
|
|
43
43
|
*/
|
|
44
44
|
crop?: Crop;
|
|
45
|
-
/** Data mapping to the [Storefront API `Image`](https://shopify.dev/docs/api/storefront/
|
|
45
|
+
/** Data mapping to the [Storefront API `Image`](https://shopify.dev/docs/api/storefront/2025-01/objects/Image) object. Must be an Image object.
|
|
46
46
|
*
|
|
47
47
|
* @example
|
|
48
48
|
* ```
|
|
@@ -14,7 +14,7 @@ type ModelViewerProps = Omit<PartialDeep<JSX.IntrinsicElements['model-viewer'],
|
|
|
14
14
|
recurseIntoArrays: true;
|
|
15
15
|
}>, 'src'> & ModelViewerBaseProps;
|
|
16
16
|
type ModelViewerBaseProps = {
|
|
17
|
-
/** An object with fields that correspond to the Storefront API's [Model3D object](https://shopify.dev/api/storefront/
|
|
17
|
+
/** An object with fields that correspond to the Storefront API's [Model3D object](https://shopify.dev/api/storefront/2025-01/objects/model3d). */
|
|
18
18
|
data: PartialDeep<Model3d, {
|
|
19
19
|
recurseIntoArrays: true;
|
|
20
20
|
}>;
|
package/dist/types/Money.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface MoneyPropsBase<ComponentGeneric extends React.ElementType> {
|
|
|
12
12
|
withoutCurrency?: boolean;
|
|
13
13
|
/** Whether to remove trailing zeros (fractional money) from the output. */
|
|
14
14
|
withoutTrailingZeros?: boolean;
|
|
15
|
-
/** A [UnitPriceMeasurement object](https://shopify.dev/api/storefront/
|
|
15
|
+
/** A [UnitPriceMeasurement object](https://shopify.dev/api/storefront/2025-01/objects/unitpricemeasurement). */
|
|
16
16
|
measurement?: PartialDeep<UnitPriceMeasurement, {
|
|
17
17
|
recurseIntoArrays: true;
|
|
18
18
|
}>;
|
package/dist/types/Video.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { shopifyLoader } from './Image.js';
|
|
|
3
3
|
import type { Video as VideoType } from './storefront-api-types.js';
|
|
4
4
|
import type { PartialDeep } from 'type-fest';
|
|
5
5
|
export interface VideoProps {
|
|
6
|
-
/** An object with fields that correspond to the Storefront API's [Video object](https://shopify.dev/api/storefront/
|
|
6
|
+
/** An object with fields that correspond to the Storefront API's [Video object](https://shopify.dev/api/storefront/2025-01/objects/video). */
|
|
7
7
|
data: PartialDeep<VideoType, {
|
|
8
8
|
recurseIntoArrays: true;
|
|
9
9
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Meant to be used with GraphQL CodeGen to type the Storefront API's custom scalars correctly.
|
|
3
|
-
* Reference for the GraphQL types: https://shopify.dev/docs/api/storefront/
|
|
3
|
+
* Reference for the GraphQL types: https://shopify.dev/docs/api/storefront/2025-01/scalars/HTML
|
|
4
4
|
* Note: JSON is generated as 'unknown' by default.
|
|
5
5
|
*/
|
|
6
6
|
export declare const storefrontApiCustomScalars: {
|
|
@@ -13,7 +13,7 @@ export declare const storefrontApiCustomScalars: {
|
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Meant to be used with GraphQL CodeGen to type the Storefront API's custom scalars correctly.
|
|
16
|
-
* Reference for the GraphQL types: https://shopify.dev/docs/api/customer/
|
|
16
|
+
* Reference for the GraphQL types: https://shopify.dev/docs/api/customer/2025-01/scalars/HTML
|
|
17
17
|
* Note: JSON is generated as 'unknown' by default.
|
|
18
18
|
*/
|
|
19
19
|
export declare const customerAccountApiCustomScalars: {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Product, ProductOption, ProductOptionValue, ProductVariant, SelectedOption } from './storefront-api-types';
|
|
2
|
+
export type RecursivePartial<T> = {
|
|
3
|
+
[P in keyof T]?: RecursivePartial<T[P]>;
|
|
4
|
+
};
|
|
5
|
+
type ProductOptionValueState = {
|
|
6
|
+
variant: ProductVariant;
|
|
7
|
+
handle: string;
|
|
8
|
+
variantUriQuery: string;
|
|
9
|
+
selected: boolean;
|
|
10
|
+
exists: boolean;
|
|
11
|
+
available: boolean;
|
|
12
|
+
isDifferentProduct: boolean;
|
|
13
|
+
};
|
|
14
|
+
type MappedProductOptionValue = ProductOptionValue & ProductOptionValueState;
|
|
15
|
+
/**
|
|
16
|
+
* Converts the product option into an Object\<key, value\> for building query params
|
|
17
|
+
* For example, a selected product option of
|
|
18
|
+
* [
|
|
19
|
+
* \{
|
|
20
|
+
* name: 'Color',
|
|
21
|
+
* value: 'Red',
|
|
22
|
+
* \},
|
|
23
|
+
* \{
|
|
24
|
+
* name: 'Size',
|
|
25
|
+
* value: 'Medium',
|
|
26
|
+
* \}
|
|
27
|
+
* ]
|
|
28
|
+
* Would return
|
|
29
|
+
* \{
|
|
30
|
+
* Color: 'Red',
|
|
31
|
+
* Size: 'Medium',
|
|
32
|
+
* \}
|
|
33
|
+
*/
|
|
34
|
+
export declare function mapSelectedProductOptionToObject(options: Pick<SelectedOption, 'name' | 'value'>[]): Record<string, string>;
|
|
35
|
+
export type MappedProductOptions = Omit<ProductOption, 'optionValues'> & {
|
|
36
|
+
optionValues: MappedProductOptionValue[];
|
|
37
|
+
};
|
|
38
|
+
export declare function checkProductParam(product: RecursivePartial<Product>, checkAll?: boolean): Product;
|
|
39
|
+
/**
|
|
40
|
+
* Finds all the variants provided by adjacentVariants, options.optionValues.firstAvailableVariant,
|
|
41
|
+
* and selectedOrFirstAvailableVariant and return them in a single array
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAdjacentAndFirstAvailableVariants(product: RecursivePartial<Product>): ProductVariant[];
|
|
44
|
+
/**
|
|
45
|
+
* Returns a product options array with its relevant information
|
|
46
|
+
* about the variant
|
|
47
|
+
*/
|
|
48
|
+
export declare function getProductOptions(product: RecursivePartial<Product>): MappedProductOptions[];
|
|
49
|
+
export {};
|
package/dist/types/index.d.cts
CHANGED
|
@@ -16,6 +16,7 @@ export { customerAccountApiCustomScalars, storefrontApiCustomScalars, } from './
|
|
|
16
16
|
export { getShopifyCookies } from './cookies-utils.js';
|
|
17
17
|
export { ExternalVideo } from './ExternalVideo.js';
|
|
18
18
|
export { flattenConnection } from './flatten-connection.js';
|
|
19
|
+
export { getAdjacentAndFirstAvailableVariants, getProductOptions, type MappedProductOptions, mapSelectedProductOptionToObject, } from './getProductOptions.js';
|
|
19
20
|
export { Image, IMAGE_FRAGMENT } from './Image.js';
|
|
20
21
|
export { useLoadScript } from './load-script.js';
|
|
21
22
|
export { MediaFile } from './MediaFile.js';
|
|
@@ -32,5 +33,6 @@ export type { StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiRe
|
|
|
32
33
|
export type { StorefrontClientProps } from './storefront-client.js';
|
|
33
34
|
export { createStorefrontClient } from './storefront-client.js';
|
|
34
35
|
export { useMoney } from './useMoney.js';
|
|
36
|
+
export { useSelectedOptionInUrlParam } from './useSelectedOptionInUrlParam.js';
|
|
35
37
|
export { useShopifyCookies } from './useShopifyCookies.js';
|
|
36
38
|
export { Video } from './Video.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { customerAccountApiCustomScalars, storefrontApiCustomScalars, } from './
|
|
|
16
16
|
export { getShopifyCookies } from './cookies-utils.js';
|
|
17
17
|
export { ExternalVideo } from './ExternalVideo.js';
|
|
18
18
|
export { flattenConnection } from './flatten-connection.js';
|
|
19
|
+
export { getAdjacentAndFirstAvailableVariants, getProductOptions, type MappedProductOptions, mapSelectedProductOptionToObject, } from './getProductOptions.js';
|
|
19
20
|
export { Image, IMAGE_FRAGMENT } from './Image.js';
|
|
20
21
|
export { useLoadScript } from './load-script.js';
|
|
21
22
|
export { MediaFile } from './MediaFile.js';
|
|
@@ -32,5 +33,6 @@ export type { StorefrontApiResponse, StorefrontApiResponseError, StorefrontApiRe
|
|
|
32
33
|
export type { StorefrontClientProps } from './storefront-client.js';
|
|
33
34
|
export { createStorefrontClient } from './storefront-client.js';
|
|
34
35
|
export { useMoney } from './useMoney.js';
|
|
36
|
+
export { useSelectedOptionInUrlParam } from './useSelectedOptionInUrlParam.js';
|
|
35
37
|
export { useShopifyCookies } from './useShopifyCookies.js';
|
|
36
38
|
export { Video } from './Video.js';
|
|
@@ -14,7 +14,7 @@ export type IsOptionValueCombinationInEncodedVariant = (targetOptionValueCombina
|
|
|
14
14
|
* Determine whether an option value combination is present in an encoded option value string. Function is memoized by encodedVariantField.
|
|
15
15
|
*
|
|
16
16
|
* @param targetOptionValueCombination - Indices of option values to look up in the encoded option value string. A partial set of indices may be passed to determine whether a node or any children is present. For example, if a product has 3 options, passing [0] will return true if any option value combination for the first option's option value is present in the encoded string.
|
|
17
|
-
* @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/
|
|
17
|
+
* @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantavailability)
|
|
18
18
|
* @returns - True if a full or partial targetOptionValueIndices is present in the encoded option value string, false otherwise.
|
|
19
19
|
*/
|
|
20
20
|
export declare const isOptionValueCombinationInEncodedVariant: IsOptionValueCombinationInEncodedVariant;
|
|
@@ -22,7 +22,7 @@ type EncodedVariantField = Product['encodedVariantAvailability'] | Product['enco
|
|
|
22
22
|
type DecodedOptionValues = number[][];
|
|
23
23
|
/**
|
|
24
24
|
* For an encoded option value string, decode into option value combinations. Entries represent a valid combination formatted as an array of option value positions.
|
|
25
|
-
* @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/
|
|
25
|
+
* @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-01/objects/Product#field-encodedvariantavailability)
|
|
26
26
|
* @returns Decoded option value combinations
|
|
27
27
|
*/
|
|
28
28
|
export declare function decodeEncodedVariant(encodedVariantField: EncodedVariantField): DecodedOptionValues;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SFAPI_VERSION = "
|
|
1
|
+
export declare const SFAPI_VERSION = "2025-01";
|
|
@@ -7,14 +7,14 @@ import type { PartialDeep } from 'type-fest';
|
|
|
7
7
|
type StorefrontApiExtensions = {
|
|
8
8
|
/**
|
|
9
9
|
* Shows error codes common to Shopify. Additional error codes may also be shown.
|
|
10
|
-
* https://shopify.dev/api/storefront#status_and_error_codes
|
|
10
|
+
* @see https://shopify.dev/api/storefront#status_and_error_codes
|
|
11
11
|
*/
|
|
12
12
|
code?: 'THROTTLED' | 'ACCESS_DENIED' | 'SHOP_INACTIVE' | 'INTERNAL_SERVER_ERROR' | (string & {});
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* The Storefront API can return a 200 OK response code when the query succeeds, and will populate the `data` property. The generic you pass in through type parameters will be the shape of the `data` object if successful. If you prefer a "deeply-partial" version of that generic object, consider using `StorefrontApiResponseOkPartial` instead.
|
|
16
16
|
*
|
|
17
|
-
* The Storefront API can also return a 200 OK response code in cases that would typically produce 4xx errors in REST. This will
|
|
17
|
+
* The Storefront API can also return a 200 OK response code in cases that would typically produce 4xx errors in REST. This will populate the `errors` property.
|
|
18
18
|
*
|
|
19
19
|
* Refer to https://shopify.dev/api/storefront#status_and_error_codes for more information.
|
|
20
20
|
*/
|
|
@@ -22,7 +22,7 @@ export type StorefrontApiResponseOk<DataGeneric> = FormattedExecutionResult<Data
|
|
|
22
22
|
/**
|
|
23
23
|
* The Storefront API can return a 200 OK response code when the query succeeds, and will populate the `data` property. The generic you pass in through type parameters will be the shape of the `data` object, with `Partial` deeply-applied to all nested objects and properties, if successful. If you prefer not using this "deeply-partial" generic data object, consider using `StorefrontApiResponseOk` instead.
|
|
24
24
|
*
|
|
25
|
-
* The Storefront API can also return a 200 OK response code in cases that would typically produce 4xx errors in REST. This will
|
|
25
|
+
* The Storefront API can also return a 200 OK response code in cases that would typically produce 4xx errors in REST. This will populate the `errors` property.
|
|
26
26
|
*
|
|
27
27
|
* Refer to https://shopify.dev/api/storefront#status_and_error_codes for more information.
|
|
28
28
|
*/
|
|
@@ -48,7 +48,7 @@ export type StorefrontApiResponseError = string | {
|
|
|
48
48
|
/**
|
|
49
49
|
* The Storefront API can return a 200 OK response code when the query succeeds, and will populate the `data` property. The generic you pass in through type parameters will be the shape of the `data` object if successful. If you prefer a "deeply-partial" version of that generic object, consider using `StorefrontApiResponseOkPartial` instead.
|
|
50
50
|
*
|
|
51
|
-
* The Storefront API can also return a 200 OK response code in cases that would typically produce 4xx errors in REST. This will
|
|
51
|
+
* The Storefront API can also return a 200 OK response code in cases that would typically produce 4xx errors in REST. This will populate the `errors` property.
|
|
52
52
|
*
|
|
53
53
|
* 4xx and 5xx errors occur infrequently. They are often related to network communications, your account, or an issue with Shopify’s services. Commonly the response is a `JSON.parse`-able string, but in rare occasions may also return HTML which is not `JSON.parse()`-able.
|
|
54
54
|
*
|
|
@@ -58,7 +58,7 @@ export type StorefrontApiResponse<DataGeneric> = StorefrontApiResponseOk<DataGen
|
|
|
58
58
|
/**
|
|
59
59
|
* The Storefront API can return a 200 OK response code when the query succeeds, and will populate the `data` property. The generic you pass in through type parameters will be the shape of the `data` object, with `Partial` deeply-applied to all nested objects and properties, if successful. If you prefer not using this "deeply-partial" generic data object, consider using `StorefrontApiResponseOk` instead.
|
|
60
60
|
*
|
|
61
|
-
* The Storefront API can also return a 200 OK response code in cases that would typically produce 4xx errors in REST. This will
|
|
61
|
+
* The Storefront API can also return a 200 OK response code in cases that would typically produce 4xx errors in REST. This will populate the `errors` property.
|
|
62
62
|
*
|
|
63
63
|
* 4xx and 5xx errors occur infrequently. They are often related to network communications, your account, or an issue with Shopify’s services. Commonly the response is a `JSON.parse`-able string, but in rare occasions may also return HTML which is not `JSON.parse()`-able.
|
|
64
64
|
*
|