@vendure-io/docs-provider 0.1.1 → 0.2.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/README.md +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/mdx-components.d.ts +120 -0
- package/dist/mdx-components.d.ts.map +1 -0
- package/docs/mdx-components-reference.md +281 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ Contract types and utilities for Vendure documentation packages. This package de
|
|
|
8
8
|
- [Creating a Docs Package](./docs/creating-a-docs-package.md) - Step-by-step guide to building a documentation package
|
|
9
9
|
- [Manifest Reference](./docs/manifest-reference.md) - Complete API documentation for manifest types and utilities
|
|
10
10
|
- [Frontmatter Reference](./docs/frontmatter-reference.md) - All available MDX frontmatter options
|
|
11
|
+
- [MDX Components Reference](./docs/mdx-components-reference.md) - Available MDX components for reference documentation
|
|
11
12
|
- [Publishing](./docs/publishing.md) - How to publish and integrate with vendure.io
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
@@ -171,6 +172,17 @@ if (hasFrontmatter(mdxContent)) {
|
|
|
171
172
|
| `LoadedDocsPackage` | Result of loading a docs package |
|
|
172
173
|
| `GitHubConfig` | GitHub repository configuration for edit links |
|
|
173
174
|
|
|
175
|
+
### MDX Component Props
|
|
176
|
+
|
|
177
|
+
| Type | Description |
|
|
178
|
+
| -------------------------- | --------------------------------------- |
|
|
179
|
+
| `GenerationInfoProps` | Props for GenerationInfo component |
|
|
180
|
+
| `MemberInfoProps` | Props for MemberInfo component |
|
|
181
|
+
| `MemberDescriptionProps` | Props for MemberDescription component |
|
|
182
|
+
| `CustomFieldPropertyProps` | Props for CustomFieldProperty component |
|
|
183
|
+
| `StackblitzProps` | Props for Stackblitz component |
|
|
184
|
+
| `MdxComponentProps` | Union type of all MDX component props |
|
|
185
|
+
|
|
174
186
|
### Schemas (Zod)
|
|
175
187
|
|
|
176
188
|
All types have corresponding Zod schemas for runtime validation:
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { FrontmatterParseError, extractFrontmatterData, hasFrontmatter, parseFro
|
|
|
4
4
|
export type { ParsedFrontmatter } from './frontmatter';
|
|
5
5
|
export { ManifestValidationError, buildBreadcrumbs, findNavigationNode, flattenNavigation, getLeafNodes, getNodesAtDepth, getPrevNextNodes, isNodeActive, validateManifest, } from './manifest';
|
|
6
6
|
export { getAllFilePaths } from './navigation-utils';
|
|
7
|
+
export type { CustomFieldPropertyProps, GenerationInfoProps, MdxComponentProps, MemberDescriptionProps, MemberInfoProps, StackblitzProps, } from './mdx-components';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAA;AAGhB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,UAAU,CAAA;AAGjB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAA;AAGhB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,UAAU,CAAA;AAGjB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,YAAY,EACV,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,eAAe,GAChB,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MDX Component Contract Types
|
|
3
|
+
*
|
|
4
|
+
* This file defines TypeScript interfaces for MDX components used in Vendure documentation.
|
|
5
|
+
* These contracts are framework-agnostic (no React dependency) and define the expected
|
|
6
|
+
* props for each component.
|
|
7
|
+
*
|
|
8
|
+
* The actual React implementations live in `apps/docs/src/components/mdx/`.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* GenerationInfo Component
|
|
12
|
+
*
|
|
13
|
+
* Displays package metadata with NPM and GitHub source links.
|
|
14
|
+
* Typically shown at the top of reference documentation pages.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```mdx
|
|
18
|
+
* <GenerationInfo
|
|
19
|
+
* packageName="@vendure/core"
|
|
20
|
+
* sourceFile="src/entity/product.entity.ts"
|
|
21
|
+
* sourceLine={42}
|
|
22
|
+
* since="1.0.0"
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export interface GenerationInfoProps {
|
|
27
|
+
/** NPM package name (e.g., "@vendure/core") */
|
|
28
|
+
packageName: string;
|
|
29
|
+
/** Path to source file relative to package root */
|
|
30
|
+
sourceFile: string;
|
|
31
|
+
/** Line number in source file */
|
|
32
|
+
sourceLine: number;
|
|
33
|
+
/** Version when this API was introduced */
|
|
34
|
+
since?: string;
|
|
35
|
+
/** Mark as experimental API */
|
|
36
|
+
experimental?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* MemberInfo Component
|
|
40
|
+
*
|
|
41
|
+
* Displays type information for class/interface members.
|
|
42
|
+
* Used in TypeScript API reference documentation.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```mdx
|
|
46
|
+
* <MemberInfo
|
|
47
|
+
* kind="method"
|
|
48
|
+
* type={<>(<a href="/reference/ctx">RequestContext</a>) => Promise<Product></>}
|
|
49
|
+
* since="2.0.0"
|
|
50
|
+
* />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export interface MemberInfoProps {
|
|
54
|
+
/** Member kind: method, property, getter, setter, constructor */
|
|
55
|
+
kind: 'method' | 'property' | 'getter' | 'setter' | 'constructor';
|
|
56
|
+
/** TypeScript type signature (accepts JSX with links) */
|
|
57
|
+
type: unknown;
|
|
58
|
+
/** Version when this member was introduced */
|
|
59
|
+
since?: string;
|
|
60
|
+
/** Mark as experimental API */
|
|
61
|
+
experimental?: boolean;
|
|
62
|
+
/** Default value (accepts JSX) */
|
|
63
|
+
default?: unknown;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* MemberDescription Component
|
|
67
|
+
*
|
|
68
|
+
* Simple wrapper for member descriptions in API reference documentation.
|
|
69
|
+
* Provides consistent styling for description content.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```mdx
|
|
73
|
+
* <MemberDescription>
|
|
74
|
+
* The `Product` entity represents items in your catalog.
|
|
75
|
+
* It includes pricing, variants, and inventory information.
|
|
76
|
+
* </MemberDescription>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export interface MemberDescriptionProps {
|
|
80
|
+
/** Description content (MDX/JSX) */
|
|
81
|
+
children: unknown;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* CustomFieldProperty Component
|
|
85
|
+
*
|
|
86
|
+
* Shows required/optional status and type information for custom fields.
|
|
87
|
+
* Used in custom field configuration documentation.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```mdx
|
|
91
|
+
* <CustomFieldProperty required={true} type="string" typeLink="/reference/types/string" />
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export interface CustomFieldPropertyProps {
|
|
95
|
+
/** Whether the field is required */
|
|
96
|
+
required: boolean;
|
|
97
|
+
/** Type name to display */
|
|
98
|
+
type: string;
|
|
99
|
+
/** Optional link for the type */
|
|
100
|
+
typeLink?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Stackblitz Component
|
|
104
|
+
*
|
|
105
|
+
* Embeds a Stackblitz editor for interactive code examples.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```mdx
|
|
109
|
+
* <Stackblitz id="vendure-getting-started" />
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export interface StackblitzProps {
|
|
113
|
+
/** Stackblitz project ID */
|
|
114
|
+
id: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Union type of all MDX component props for type checking
|
|
118
|
+
*/
|
|
119
|
+
export type MdxComponentProps = GenerationInfoProps | MemberInfoProps | MemberDescriptionProps | CustomFieldPropertyProps | StackblitzProps;
|
|
120
|
+
//# sourceMappingURL=mdx-components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-components.d.ts","sourceRoot":"","sources":["../src/mdx-components.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAA;IACnB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAA;IAClB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAA;IACjE,yDAAyD;IACzD,IAAI,EAAE,OAAO,CAAA;IACb,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,sBAAsB;IACrC,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,wBAAwB;IACvC,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAA;IACjB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,mBAAmB,GACnB,eAAe,GACf,sBAAsB,GACtB,wBAAwB,GACxB,eAAe,CAAA"}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# MDX Components Reference
|
|
2
|
+
|
|
3
|
+
This document describes the MDX components available for use in Vendure documentation. These components are particularly useful for TypeScript and GraphQL API reference documentation.
|
|
4
|
+
|
|
5
|
+
## General Components
|
|
6
|
+
|
|
7
|
+
### Callout
|
|
8
|
+
|
|
9
|
+
Displays an informational callout box with different variants.
|
|
10
|
+
|
|
11
|
+
#### Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ---------- | ----------------------------------------------------------------- | -------- | ------------------------------ |
|
|
15
|
+
| `type` | `'info' \| 'warning' \| 'danger' \| 'tip' \| 'caution' \| 'note'` | `'info'` | The callout variant |
|
|
16
|
+
| `title` | `string` | - | Optional title for the callout |
|
|
17
|
+
| `children` | `ReactNode` | - | Content of the callout |
|
|
18
|
+
|
|
19
|
+
#### Example
|
|
20
|
+
|
|
21
|
+
```mdx
|
|
22
|
+
<Callout
|
|
23
|
+
type="warning"
|
|
24
|
+
title="Deprecation Notice"
|
|
25
|
+
>
|
|
26
|
+
This API will be removed in version 4.0. Please migrate to the new API.
|
|
27
|
+
</Callout>
|
|
28
|
+
|
|
29
|
+
<Callout type="tip">Use the `RequestContext` to access the current user and channel.</Callout>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Stackblitz
|
|
33
|
+
|
|
34
|
+
Embeds a Stackblitz editor for interactive code examples.
|
|
35
|
+
|
|
36
|
+
#### Props
|
|
37
|
+
|
|
38
|
+
| Prop | Type | Required | Description |
|
|
39
|
+
| ---- | -------- | -------- | ------------------------- |
|
|
40
|
+
| `id` | `string` | Yes | The Stackblitz project ID |
|
|
41
|
+
|
|
42
|
+
#### Example
|
|
43
|
+
|
|
44
|
+
```mdx
|
|
45
|
+
<Stackblitz id="vendure-getting-started" />
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Reference Documentation Components
|
|
51
|
+
|
|
52
|
+
These components are designed for TypeScript/GraphQL API reference documentation.
|
|
53
|
+
|
|
54
|
+
### GenerationInfo
|
|
55
|
+
|
|
56
|
+
Displays package metadata with NPM and GitHub source links. Typically shown at the top of reference documentation pages.
|
|
57
|
+
|
|
58
|
+
#### Props
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Required | Description |
|
|
61
|
+
| -------------- | --------- | -------- | -------------------------------------------- |
|
|
62
|
+
| `packageName` | `string` | Yes | NPM package name (e.g., `@vendure/core`) |
|
|
63
|
+
| `sourceFile` | `string` | Yes | Path to source file relative to package root |
|
|
64
|
+
| `sourceLine` | `number` | Yes | Line number in source file |
|
|
65
|
+
| `since` | `string` | No | Version when this API was introduced |
|
|
66
|
+
| `experimental` | `boolean` | No | Mark as experimental API |
|
|
67
|
+
|
|
68
|
+
#### Example
|
|
69
|
+
|
|
70
|
+
```mdx
|
|
71
|
+
<GenerationInfo
|
|
72
|
+
packageName="@vendure/core"
|
|
73
|
+
sourceFile="src/entity/product.entity.ts"
|
|
74
|
+
sourceLine={42}
|
|
75
|
+
since="1.0.0"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<GenerationInfo
|
|
79
|
+
packageName="@vendure/core"
|
|
80
|
+
sourceFile="src/service/services/product.service.ts"
|
|
81
|
+
sourceLine={156}
|
|
82
|
+
experimental={true}
|
|
83
|
+
/>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### MemberInfo
|
|
87
|
+
|
|
88
|
+
Displays type information for class/interface members. Used in TypeScript API reference documentation.
|
|
89
|
+
|
|
90
|
+
#### Props
|
|
91
|
+
|
|
92
|
+
| Prop | Type | Required | Description |
|
|
93
|
+
| -------------- | ----------------------------------------------------------------- | -------- | -------------------------------------------------- |
|
|
94
|
+
| `kind` | `'method' \| 'property' \| 'getter' \| 'setter' \| 'constructor'` | Yes | The kind of member |
|
|
95
|
+
| `type` | `ReactNode` | Yes | TypeScript type signature (accepts JSX with links) |
|
|
96
|
+
| `since` | `string` | No | Version when this member was introduced |
|
|
97
|
+
| `experimental` | `boolean` | No | Mark as experimental API |
|
|
98
|
+
| `default` | `ReactNode` | No | Default value (accepts JSX) |
|
|
99
|
+
|
|
100
|
+
#### Example
|
|
101
|
+
|
|
102
|
+
```mdx
|
|
103
|
+
{/* Simple property */}
|
|
104
|
+
|
|
105
|
+
<MemberInfo
|
|
106
|
+
kind="property"
|
|
107
|
+
type={<>string</>}
|
|
108
|
+
default={<>'default-value'</>}
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
{/* Method with type links */}
|
|
112
|
+
|
|
113
|
+
<MemberInfo
|
|
114
|
+
kind="method"
|
|
115
|
+
type={
|
|
116
|
+
<>
|
|
117
|
+
(<a href="/reference/ctx">RequestContext</a>, productId: <a href="/reference/id">ID</a>) =>
|
|
118
|
+
Promise<<a href="/reference/product">Product</a>>
|
|
119
|
+
</>
|
|
120
|
+
}
|
|
121
|
+
since="2.0.0"
|
|
122
|
+
/>
|
|
123
|
+
|
|
124
|
+
{/* Experimental getter */}
|
|
125
|
+
|
|
126
|
+
<MemberInfo
|
|
127
|
+
kind="getter"
|
|
128
|
+
type={<>boolean</>}
|
|
129
|
+
experimental={true}
|
|
130
|
+
/>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### MemberDescription
|
|
134
|
+
|
|
135
|
+
Simple wrapper for member descriptions in API reference documentation. Provides consistent styling for description content.
|
|
136
|
+
|
|
137
|
+
#### Props
|
|
138
|
+
|
|
139
|
+
| Prop | Type | Required | Description |
|
|
140
|
+
| ---------- | ----------- | -------- | ----------------------------- |
|
|
141
|
+
| `children` | `ReactNode` | Yes | Description content (MDX/JSX) |
|
|
142
|
+
|
|
143
|
+
#### Example
|
|
144
|
+
|
|
145
|
+
```mdx
|
|
146
|
+
<MemberDescription>
|
|
147
|
+
The `Product` entity represents items in your catalog.
|
|
148
|
+
It includes pricing, variants, and inventory information.
|
|
149
|
+
|
|
150
|
+
See the [Product Guide](/guides/products) for more details.
|
|
151
|
+
|
|
152
|
+
</MemberDescription>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### CustomFieldProperty
|
|
156
|
+
|
|
157
|
+
Shows required/optional status and type information for custom fields. Used in custom field configuration documentation.
|
|
158
|
+
|
|
159
|
+
#### Props
|
|
160
|
+
|
|
161
|
+
| Prop | Type | Required | Description |
|
|
162
|
+
| ---------- | --------- | -------- | ----------------------------- |
|
|
163
|
+
| `required` | `boolean` | Yes | Whether the field is required |
|
|
164
|
+
| `type` | `string` | Yes | Type name to display |
|
|
165
|
+
| `typeLink` | `string` | No | Optional link for the type |
|
|
166
|
+
|
|
167
|
+
#### Example
|
|
168
|
+
|
|
169
|
+
```mdx
|
|
170
|
+
<CustomFieldProperty
|
|
171
|
+
required={true}
|
|
172
|
+
type="string"
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
<CustomFieldProperty
|
|
176
|
+
required={false}
|
|
177
|
+
type="LocalizedString"
|
|
178
|
+
typeLink="/reference/types/localized-string"
|
|
179
|
+
/>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Complete Reference Page Example
|
|
185
|
+
|
|
186
|
+
Here's an example of how these components can be used together for a complete reference page:
|
|
187
|
+
|
|
188
|
+
```mdx
|
|
189
|
+
---
|
|
190
|
+
title: Product
|
|
191
|
+
description: The Product entity represents items in your catalog.
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
# Product
|
|
195
|
+
|
|
196
|
+
<GenerationInfo
|
|
197
|
+
packageName="@vendure/core"
|
|
198
|
+
sourceFile="src/entity/product/product.entity.ts"
|
|
199
|
+
sourceLine={25}
|
|
200
|
+
since="1.0.0"
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
The `Product` entity represents items in your catalog.
|
|
204
|
+
|
|
205
|
+
## Properties
|
|
206
|
+
|
|
207
|
+
### name
|
|
208
|
+
|
|
209
|
+
<MemberInfo
|
|
210
|
+
kind="property"
|
|
211
|
+
type={<>string</>}
|
|
212
|
+
/>
|
|
213
|
+
|
|
214
|
+
<MemberDescription>The name of the product as displayed to customers.</MemberDescription>
|
|
215
|
+
|
|
216
|
+
### slug
|
|
217
|
+
|
|
218
|
+
<MemberInfo
|
|
219
|
+
kind="property"
|
|
220
|
+
type={<>string</>}
|
|
221
|
+
/>
|
|
222
|
+
|
|
223
|
+
<MemberDescription>The URL-friendly identifier for this product.</MemberDescription>
|
|
224
|
+
|
|
225
|
+
## Methods
|
|
226
|
+
|
|
227
|
+
### getVariants
|
|
228
|
+
|
|
229
|
+
<MemberInfo
|
|
230
|
+
kind="method"
|
|
231
|
+
type={
|
|
232
|
+
<>
|
|
233
|
+
(<a href="/reference/ctx">RequestContext</a>) => Promise<
|
|
234
|
+
<a href="/reference/product-variant">ProductVariant</a>[]>
|
|
235
|
+
</>
|
|
236
|
+
}
|
|
237
|
+
since="1.1.0"
|
|
238
|
+
/>
|
|
239
|
+
|
|
240
|
+
<MemberDescription>Returns all variants associated with this product.</MemberDescription>
|
|
241
|
+
|
|
242
|
+
## Custom Fields
|
|
243
|
+
|
|
244
|
+
Products support the following custom field types:
|
|
245
|
+
|
|
246
|
+
<CustomFieldProperty
|
|
247
|
+
required={false}
|
|
248
|
+
type="string"
|
|
249
|
+
/>
|
|
250
|
+
<CustomFieldProperty
|
|
251
|
+
required={false}
|
|
252
|
+
type="int"
|
|
253
|
+
/>
|
|
254
|
+
<CustomFieldProperty
|
|
255
|
+
required={false}
|
|
256
|
+
type="boolean"
|
|
257
|
+
/>
|
|
258
|
+
<CustomFieldProperty
|
|
259
|
+
required={false}
|
|
260
|
+
type="relation"
|
|
261
|
+
typeLink="/reference/custom-fields#relation"
|
|
262
|
+
/>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## TypeScript Contracts
|
|
268
|
+
|
|
269
|
+
All component props have TypeScript interfaces defined in `@vendure-io/docs-provider`:
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
import type {
|
|
273
|
+
GenerationInfoProps,
|
|
274
|
+
MemberInfoProps,
|
|
275
|
+
MemberDescriptionProps,
|
|
276
|
+
CustomFieldPropertyProps,
|
|
277
|
+
StackblitzProps,
|
|
278
|
+
} from '@vendure-io/docs-provider'
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
These interfaces are framework-agnostic and can be used for type checking without importing React.
|