Skip to content

Commit 5e49b06

Browse files
fix js doc comments
1 parent 4e4f454 commit 5e49b06

26 files changed

+445
-5089
lines changed

packages/hydrogen-react/src/ExternalVideo.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ export type ExternalVideoProps = Omit<
2121
> &
2222
ExternalVideoBaseProps;
2323

24-
/**
25-
* The `ExternalVideo` component renders an embedded video for the Storefront
26-
* API's [ExternalVideo object](https://shopify.dev/api/storefront/reference/products/externalvideo).
27-
* @publicDocs
28-
*/
24+
/** @publicDocs */
2925
export const ExternalVideo = forwardRef<HTMLIFrameElement, ExternalVideoProps>(
3026
(props, ref): JSX.Element => {
3127
const {

packages/hydrogen-react/src/MediaFile.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import type {ModelViewerElement} from '@google/model-viewer/lib/model-viewer.js'
99
type BaseProps = React.HTMLAttributes<
1010
HTMLImageElement | HTMLVideoElement | HTMLIFrameElement | ModelViewerElement
1111
>;
12-
/**
13-
* MediaFile renders an `Image`, `Video`, `ExternalVideo`, or `ModelViewer` component. Use the `mediaOptions` prop to customize the props sent to each of these components.
14-
* @publicDocs
15-
*/
12+
/** @publicDocs */
1613
export interface MediaFileProps extends BaseProps {
1714
/** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */
1815
data: PartialDeep<MediaEdgeType['node'], {recurseIntoArrays: true}>;
@@ -34,13 +31,7 @@ type MediaOptions = {
3431
modelViewer?: Omit<typeof ModelViewer, 'data'>;
3532
};
3633

37-
/**
38-
* The `MediaFile` component renders the media for the Storefront API's
39-
* [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a
40-
* `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.
41-
* Use the `mediaOptions` prop to customize the props sent to each of these components.
42-
* @publicDocs
43-
*/
34+
/** @publicDocs */
4435
export function MediaFile({
4536
data,
4637
mediaOptions,

packages/hydrogen-react/src/ModelViewer.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,7 @@ export type ModelViewerBaseProps = {
5454
onSceneGraphReady?: (event: Event) => void;
5555
};
5656

57-
/**
58-
* The `ModelViewer` component renders a 3D model (with the `model-viewer` custom element) for
59-
* the Storefront API's [Model3d object](https://shopify.dev/api/storefront/reference/products/model3d).
60-
*
61-
* The `model-viewer` custom element is lazily downloaded through a dynamically-injected `<script type="module">` tag when the `<ModelViewer />` component is rendered
62-
*
63-
* ModelViewer is using version `1.21.1` of the `@google/model-viewer` library.
64-
* @publicDocs
65-
*/
57+
/** @publicDocs */
6658
export function ModelViewer(props: ModelViewerProps): JSX.Element | null {
6759
const [modelViewer, setModelViewer] = useState<undefined | HTMLElement>(
6860
undefined,

packages/hydrogen-react/src/ShopPayButton.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ function isChannel(
6565
return channel === 'headless' || channel === 'hydrogen';
6666
}
6767

68-
/**
69-
* The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout.
70-
* It renders a [`<shop-pay-button>`](https://shopify.dev/custom-storefronts/tools/web-components) custom element, for which it will lazy-load the source code automatically.
71-
* It relies on the `<ShopProvider>` context provider.
72-
* @publicDocs
73-
*/
68+
/** @publicDocs */
7469
export function ShopPayButton({
7570
channel,
7671
variantIds,

packages/hydrogen-react/src/analytics.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ import {
1919
} from './analytics-schema-custom-storefront-customer-tracking.js';
2020
import {getTrackingValues} from './tracking-utils.js';
2121

22-
/** @publicDocs */
22+
/**
23+
* Set user and session cookies and refresh the expiry time
24+
* @param event - The analytics event.
25+
* @param shopDomain - The Online Store domain to sent Shopify analytics under the same
26+
* top level domain.
27+
* @publicDocs
28+
*/
29+
2330
export function sendShopifyAnalytics(
2431
event: ShopifyAnalytics,
2532
shopDomain?: string,

packages/hydrogen-react/src/cookies-utils.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function hexTime(): string {
5959
}
6060

6161
/**
62+
* Gets the values of _shopify_y and _shopify_s cookies from the provided cookie string.
6263
* @deprecated Use getTrackingValues instead.
6364
* @publicDocs
6465
*/

packages/hydrogen-react/src/flatten-connection.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import type {PartialDeep} from 'type-fest';
22

3-
/**
4-
* The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](https://shopify.dev/api/storefront/reference/products/product)) into a flat array of nodes.
5-
* The utility works with either `nodes` or `edges.node`.
6-
*
7-
* If `connection` is null or undefined, will return an empty array instead in production. In development, an error will be thrown.
8-
* @publicDocs
9-
*/
3+
/** @publicDocs */
104
export function flattenConnection<
115
ConnectionGeneric extends
126
| PartialDeep<ConnectionEdges, {recurseIntoArrays: true}>
@@ -91,8 +85,5 @@ type ConnectionNodes = {
9185
export interface ConnectionGenericForDoc {
9286
connection?: ConnectionEdges | ConnectionNodes;
9387
}
94-
/**
95-
* The return type of the `flattenConnection` utility: a flat array of nodes extracted from a Storefront API connection object.
96-
* @publicDocs
97-
*/
88+
/** @publicDocs */
9889
export type FlattenConnectionReturnForDoc = unknown[];

packages/hydrogen-react/src/optionValueDecoder.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,13 @@ const V1_CONTROL_CHARS = {
2020
RANGE: '-',
2121
};
2222

23-
/**
24-
* A function type that determines whether a given option value combination is present in an encoded variant field from the Storefront API.
25-
* @publicDocs
26-
*/
23+
/** @publicDocs */
2724
export type IsOptionValueCombinationInEncodedVariant = (
2825
targetOptionValueCombination: number[],
2926
encodedVariantField: string,
3027
) => boolean;
3128

32-
/**
33-
* Determine whether an option value combination is present in an encoded option value string. Function is memoized by encodedVariantField.
34-
*
35-
* @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.
36-
* @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2026-01/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2026-01/objects/Product#field-encodedvariantavailability)
37-
* @returns - True if a full or partial targetOptionValueIndices is present in the encoded option value string, false otherwise.
38-
* @publicDocs
39-
*/
29+
/** @publicDocs */
4030
export const isOptionValueCombinationInEncodedVariant: IsOptionValueCombinationInEncodedVariant =
4131
((): IsOptionValueCombinationInEncodedVariant => {
4232
const decodedOptionValues = new Map<string, Set<string>>();
@@ -81,12 +71,7 @@ type EncodedVariantField =
8171
| Product['encodedVariantExistence'];
8272
type DecodedOptionValues = number[][];
8373

84-
/**
85-
* For an encoded option value string, decode into option value combinations. Entries represent a valid combination formatted as an array of option value positions.
86-
* @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2026-01/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2026-01/objects/Product#field-encodedvariantavailability)
87-
* @returns Decoded option value combinations
88-
* @publicDocs
89-
*/
74+
/** @publicDocs */
9075
export function decodeEncodedVariant(
9176
encodedVariantField: EncodedVariantField,
9277
): DecodedOptionValues {

0 commit comments

Comments
 (0)