Skip to content

Commit 9743d74

Browse files
fix js doc comments
1 parent 4e4f454 commit 9743d74

26 files changed

+452
-5050
lines changed

packages/hydrogen-react/src/CartLineProvider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ type CartLinePartialDeep = PartialDeep<
1212

1313
export const CartLineContext = createContext<CartLinePartialDeep | null>(null);
1414

15-
/** @publicDocs */
15+
/**
16+
* The `useCartLine` hook provides access to the [CartLine object](https://shopify.dev/api/storefront/2026-01/objects/cartline) from the Storefront API. It must be a descendent of a `CartProvider` component.
17+
*/
1618
export function useCartLine(): CartLinePartialDeep {
1719
const context = useContext(CartLineContext);
1820

packages/hydrogen-react/src/MediaFile.tsx

Lines changed: 1 addition & 5 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}>;
@@ -38,7 +35,6 @@ type MediaOptions = {
3835
* The `MediaFile` component renders the media for the Storefront API's
3936
* [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a
4037
* `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.
4238
* @publicDocs
4339
*/
4440
export function MediaFile({

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: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,5 @@ type ConnectionNodes = {
9191
export interface ConnectionGenericForDoc {
9292
connection?: ConnectionEdges | ConnectionNodes;
9393
}
94-
/**
95-
* The return type of the `flattenConnection` utility: a flat array of nodes extracted from a Storefront API connection object.
96-
* @publicDocs
97-
*/
94+
/** @publicDocs */
9895
export type FlattenConnectionReturnForDoc = unknown[];

packages/hydrogen-react/src/optionValueDecoder.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ 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,

packages/hydrogen-react/src/parse-metafield.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ import type {PartialDeep, Simplify} from 'type-fest';
1313
import {flattenConnection} from './flatten-connection.js';
1414
import {RootASTNode as RichTextRootASTNode} from './RichText.types.js';
1515

16-
/** @publicDocs */
16+
/**
17+
* A function that uses `metafield.type` to parse the Metafield's `value` or `reference` or `references` (depending on the `metafield.type`) and places the result in `metafield.parsedValue`
18+
*
19+
* TypeScript developers can use the type `ParsedMetafields` from this package to get the returned object's type correct. For example:
20+
*
21+
* ```
22+
* parseMetafield<ParsedMetafields['boolean']>({type: 'boolean', value: 'false'}
23+
* ```
24+
* @publicDocs
25+
*/
1726
export function parseMetafield<ReturnGeneric>(
1827
metafield: PartialDeep<MetafieldBaseType, {recurseIntoArrays: true}>,
1928
): ReturnGeneric {

0 commit comments

Comments
 (0)