@vendure/dashboard 3.4.2-master-202509090229 → 3.4.2

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.
Files changed (72) hide show
  1. package/package.json +4 -4
  2. package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +3 -3
  3. package/src/app/routes/_authenticated/_channels/channels_.$id.tsx +4 -4
  4. package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +3 -3
  5. package/src/app/routes/_authenticated/_countries/countries_.$id.tsx +3 -3
  6. package/src/app/routes/_authenticated/_customer-groups/customer-groups_.$id.tsx +3 -3
  7. package/src/app/routes/_authenticated/_customers/customers_.$id.tsx +4 -4
  8. package/src/app/routes/_authenticated/_facets/facets.tsx +5 -8
  9. package/src/app/routes/_authenticated/_facets/facets_.$facetId.values_.$id.tsx +3 -3
  10. package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +3 -3
  11. package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +3 -3
  12. package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +3 -3
  13. package/src/app/routes/_authenticated/_products/products_.$id.tsx +3 -3
  14. package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +4 -4
  15. package/src/app/routes/_authenticated/_roles/roles_.$id.tsx +3 -3
  16. package/src/app/routes/_authenticated/_sellers/sellers_.$id.tsx +3 -3
  17. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +3 -3
  18. package/src/app/routes/_authenticated/_stock-locations/stock-locations_.$id.tsx +3 -3
  19. package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +3 -3
  20. package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +4 -3
  21. package/src/app/routes/_authenticated/_zones/zones_.$id.tsx +3 -3
  22. package/src/lib/components/data-input/affixed-input.tsx +18 -0
  23. package/src/lib/components/data-input/boolean-input.tsx +7 -0
  24. package/src/lib/components/data-input/checkbox-input.tsx +7 -0
  25. package/src/lib/components/data-input/datetime-input.tsx +7 -0
  26. package/src/lib/components/data-input/money-input.tsx +8 -0
  27. package/src/lib/components/data-input/number-input.tsx +7 -0
  28. package/src/lib/components/data-input/password-input.tsx +7 -0
  29. package/src/lib/components/data-input/rich-text-input.tsx +7 -0
  30. package/src/lib/components/data-input/text-input.tsx +7 -0
  31. package/src/lib/components/data-input/textarea-input.tsx +7 -0
  32. package/src/lib/components/data-table/data-table-view-options.tsx +29 -26
  33. package/src/lib/components/data-table/data-table.tsx +20 -0
  34. package/src/lib/components/data-table/types.ts +39 -0
  35. package/src/lib/components/layout/channel-switcher.tsx +1 -3
  36. package/src/lib/components/shared/asset/asset-gallery.tsx +58 -0
  37. package/src/lib/components/shared/asset/asset-picker-dialog.tsx +39 -0
  38. package/src/lib/components/shared/detail-page-button.tsx +8 -22
  39. package/src/lib/components/shared/facet-value-chip.tsx +7 -0
  40. package/src/lib/components/shared/facet-value-selector.tsx +55 -0
  41. package/src/lib/components/shared/form-field-wrapper.tsx +51 -0
  42. package/src/lib/components/shared/paginated-list-data-table.tsx +128 -16
  43. package/src/lib/components/shared/permission-guard.tsx +30 -0
  44. package/src/lib/components/shared/table-cell/order-table-cell-components.tsx +1 -1
  45. package/src/lib/components/shared/translatable-form-field.tsx +52 -0
  46. package/src/lib/components/shared/vendure-image.tsx +114 -2
  47. package/src/lib/framework/extension-api/define-dashboard-extension.ts +25 -3
  48. package/src/lib/framework/extension-api/extension-api-types.ts +12 -3
  49. package/src/lib/framework/extension-api/types/alerts.ts +2 -3
  50. package/src/lib/framework/extension-api/types/data-table.ts +2 -2
  51. package/src/lib/framework/extension-api/types/detail-forms.ts +2 -2
  52. package/src/lib/framework/extension-api/types/form-components.ts +2 -2
  53. package/src/lib/framework/extension-api/types/layout.ts +24 -13
  54. package/src/lib/framework/extension-api/types/login.ts +6 -5
  55. package/src/lib/framework/extension-api/types/navigation.ts +3 -3
  56. package/src/lib/framework/extension-api/types/widgets.ts +7 -3
  57. package/src/lib/framework/form-engine/form-engine-types.ts +13 -7
  58. package/src/lib/framework/form-engine/use-generated-form.tsx +44 -0
  59. package/src/lib/framework/layout-engine/page-layout.tsx +94 -31
  60. package/src/lib/framework/page/detail-page.tsx +3 -5
  61. package/src/lib/framework/page/list-page.tsx +87 -5
  62. package/src/lib/framework/page/use-detail-page.ts +4 -5
  63. package/src/lib/graphql/api.ts +2 -2
  64. package/src/lib/graphql/graphql-env.d.ts +7 -16
  65. package/src/lib/hooks/use-auth.tsx +1 -3
  66. package/src/lib/hooks/use-channel.ts +4 -2
  67. package/src/lib/hooks/use-page-block.tsx +9 -0
  68. package/src/lib/hooks/use-permissions.ts +6 -2
  69. package/src/lib/index.ts +2 -0
  70. package/src/lib/providers/auth.tsx +34 -2
  71. package/src/lib/providers/channel-provider.tsx +22 -1
  72. package/src/lib/components/shared/table-cell/table-cell-types.ts +0 -33
@@ -4,7 +4,7 @@ import type React from 'react';
4
4
  * @description
5
5
  * Defines a custom logo component for the login page.
6
6
  *
7
- * @docsCategory extensions
7
+ * @docsCategory extensions-api
8
8
  * @docsPage Login
9
9
  * @since 3.4.0
10
10
  */
@@ -20,7 +20,7 @@ export interface LoginLogoExtension {
20
20
  * @description
21
21
  * Defines content to display before the login form.
22
22
  *
23
- * @docsCategory extensions
23
+ * @docsCategory extensions-api
24
24
  * @docsPage Login
25
25
  * @since 3.4.0
26
26
  */
@@ -36,7 +36,7 @@ export interface LoginBeforeFormExtension {
36
36
  * @description
37
37
  * Defines content to display after the login form.
38
38
  *
39
- * @docsCategory extensions
39
+ * @docsCategory extensions-api
40
40
  * @docsPage Login
41
41
  * @since 3.4.0
42
42
  */
@@ -52,7 +52,7 @@ export interface LoginAfterFormExtension {
52
52
  * @description
53
53
  * Defines a custom login image component that replaces the default image panel.
54
54
  *
55
- * @docsCategory extensions
55
+ * @docsCategory extensions-api
56
56
  * @docsPage Login
57
57
  * @since 3.4.0
58
58
  */
@@ -68,8 +68,9 @@ export interface LoginImageExtension {
68
68
  * @description
69
69
  * Defines all available login page extensions.
70
70
  *
71
- * @docsCategory extensions
71
+ * @docsCategory extensions-api
72
72
  * @docsPage Login
73
+ * @docsWeight 0
73
74
  * @since 3.4.0
74
75
  */
75
76
  export interface DashboardLoginExtensions {
@@ -8,8 +8,8 @@ import { NavMenuItem } from '../../nav-menu/nav-menu-extensions.js';
8
8
  * @description
9
9
  * Defines a custom route for the dashboard with optional navigation menu integration.
10
10
  *
11
- * @docsCategory extensions
12
- * @docsPage Navigation
11
+ * @docsCategory extensions-api
12
+ * @docsPage Routes
13
13
  * @since 3.4.0
14
14
  */
15
15
  export interface DashboardRouteDefinition {
@@ -42,7 +42,7 @@ export interface DashboardRouteDefinition {
42
42
  * @description
43
43
  * Defines a custom navigation section in the dashboard sidebar.
44
44
  *
45
- * @docsCategory extensions
45
+ * @docsCategory extensions-api
46
46
  * @docsPage Navigation
47
47
  * @since 3.4.0
48
48
  */
@@ -4,7 +4,8 @@ import React, { PropsWithChildren } from 'react';
4
4
  * @description
5
5
  * Base props interface for dashboard widgets.
6
6
  *
7
- * @docsCategory extensions
7
+ * @docsCategory extensions-api
8
+ * @docsPage widgets
8
9
  * @since 3.3.0
9
10
  */
10
11
  export type DashboardBaseWidgetProps = PropsWithChildren<{
@@ -19,7 +20,8 @@ export type DashboardBaseWidgetProps = PropsWithChildren<{
19
20
  * @description
20
21
  * Represents an instance of a dashboard widget with its layout and configuration.
21
22
  *
22
- * @docsCategory extensions
23
+ * @docsCategory extensions-api
24
+ * @docsPage widgets
23
25
  * @since 3.3.0
24
26
  */
25
27
  export type DashboardWidgetInstance = {
@@ -60,7 +62,9 @@ export type DashboardWidgetInstance = {
60
62
  *
61
63
  * Defines a dashboard widget that can be added to the dashboard.
62
64
  *
63
- * @docsCategory extensions
65
+ * @docsCategory extensions-api
66
+ * @docsPage Widgets
67
+ * @docsWeight 0
64
68
  * @since 3.3.0
65
69
  */
66
70
  export type DashboardWidgetDefinition = {
@@ -85,8 +85,9 @@ export type DateTimeStructField = Extract<StructField, { type: 'datetime' }>;
85
85
  * }
86
86
  * ```
87
87
  *
88
- * @docsCategory forms
89
- * @docsPage DashboardFormComponent
88
+ * @docsCategory extensions-api
89
+ * @docsPage FormComponents
90
+ * @since 3.4.0
90
91
  */
91
92
  export type DashboardFormComponentProps<
92
93
  TFieldValues extends FieldValues = FieldValues,
@@ -116,8 +117,9 @@ export type DashboardFormComponentProps<
116
117
  * // highlight-end
117
118
  * ```
118
119
  *
119
- * @docsCategory forms
120
- * @docsPage DashboardFormComponent
120
+ * @docsCategory extensions-api
121
+ * @docsPage FormComponents
122
+ * @since 3.4.0
121
123
  */
122
124
  export type DashboardFormComponentMetadata = {
123
125
  /**
@@ -127,6 +129,10 @@ export type DashboardFormComponentMetadata = {
127
129
  * handle both lists and single values.
128
130
  */
129
131
  isListInput?: boolean | 'dynamic';
132
+ /**
133
+ * @description
134
+ * TODO: not currently implemented
135
+ */
130
136
  isFullWidth?: boolean;
131
137
  };
132
138
 
@@ -154,9 +160,9 @@ export type DashboardFormComponentMetadata = {
154
160
  * };
155
161
  * ```
156
162
  *
157
- * @docsCategory forms
158
- * @docsPage DashboardFormComponent
159
- * @docsWeight 0
163
+ * @docsCategory extensions-api
164
+ * @docsPage FormComponents
165
+ * @since 3.4.0
160
166
  */
161
167
  export type DashboardFormComponent = React.ComponentType<DashboardFormComponentProps> & {
162
168
  metadata?: DashboardFormComponentMetadata;
@@ -9,13 +9,33 @@ import { getOperationVariablesFields } from '../document-introspection/get-docum
9
9
  import { createFormSchemaFromFields, getDefaultValuesFromFields } from './form-schema-tools.js';
10
10
  import { removeEmptyIdFields, transformRelationFields } from './utils.js';
11
11
 
12
+ /**
13
+ * @description
14
+ * Options for the useGeneratedForm hook.
15
+ *
16
+ * @docsCategory detail-views
17
+ * @docsPage useGeneratedForm
18
+ * @since 3.3.0
19
+ */
12
20
  export interface GeneratedFormOptions<
13
21
  T extends TypedDocumentNode<any, any>,
14
22
  VarName extends keyof VariablesOf<T> | undefined = 'input',
15
23
  E extends Record<string, any> = Record<string, any>,
16
24
  > {
25
+ /**
26
+ * @description
27
+ * The document to use to generate the form.
28
+ */
17
29
  document?: T;
30
+ /**
31
+ * @description
32
+ * The name of the variable to use in the document.
33
+ */
18
34
  varName?: VarName;
35
+ /**
36
+ * @description
37
+ * The entity to use to generate the form.
38
+ */
19
39
  entity: E | null | undefined;
20
40
  customFieldConfig?: any[]; // Add custom field config for validation
21
41
  setValues: (
@@ -32,6 +52,30 @@ export interface GeneratedFormOptions<
32
52
  * It will create a form with the fields defined in the document's input type.
33
53
  * It will also create a submit handler that will submit the form to the server.
34
54
  *
55
+ * This hook is mostly used internally by the higher-level {@link useDetailPage} hook,
56
+ * but can in some cases be useful to use directly.
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * const { form, submitHandler } = useGeneratedForm({
61
+ * document: setDraftOrderCustomFieldsDocument,
62
+ * varName: undefined,
63
+ * entity: entity,
64
+ * setValues: entity => {
65
+ * return {
66
+ * orderId: entity.id,
67
+ * input: {
68
+ * customFields: entity.customFields,
69
+ * },
70
+ * };
71
+ * },
72
+ * });
73
+ * ```
74
+ *
75
+ * @docsCategory detail-views
76
+ * @docsPage useGeneratedForm
77
+ * @since 3.3.0
78
+ * @docsWeight 0
35
79
  */
36
80
  export function useGeneratedForm<
37
81
  T extends TypedDocumentNode<any, any>,
@@ -20,8 +20,21 @@ import { PageContext, PageContextValue } from '@/vdb/framework/layout-engine/pag
20
20
  import { getDashboardActionBarItems, getDashboardPageBlocks } from './layout-extensions.js';
21
21
  import { LocationWrapper } from './location-wrapper.js';
22
22
 
23
+ /**
24
+ * @description
25
+ * The props used to configure the {@link Page} component.
26
+ *
27
+ * @docsCategory page-layout
28
+ * @docsPage Page
29
+ * @since 3.3.0
30
+ */
23
31
  export interface PageProps extends ComponentProps<'div'> {
32
+ /**
33
+ * @description
34
+ * A string identifier for the page, e.g. "product-list", "review-detail", etc.
35
+ */
24
36
  pageId?: string;
37
+
25
38
  entity?: any;
26
39
  form?: UseFormReturn<any>;
27
40
  submitHandler?: any;
@@ -29,8 +42,6 @@ export interface PageProps extends ComponentProps<'div'> {
29
42
 
30
43
  /**
31
44
  * @description
32
- * **Status: Developer Preview**
33
- *
34
45
  * This component should be used to wrap _all_ pages in the dashboard. It provides
35
46
  * a consistent layout as well as a context for the slot-based PageBlock system.
36
47
  *
@@ -39,8 +50,33 @@ export interface PageProps extends ComponentProps<'div'> {
39
50
  * - {@link PageTitle}
40
51
  * - {@link PageActionBar}
41
52
  * - {@link PageLayout}
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * import { Page, PageTitle, PageActionBar, PageLayout, PageBlock, Button } from '\@vendure/dashboard';
57
+ *
58
+ * const pageId = 'my-page';
59
+ *
60
+ * export function MyPage() {
61
+ * return (
62
+ * <Page pageId={pageId} form={form} submitHandler={submitHandler} entity={entity}>
63
+ * <PageTitle>My Page</PageTitle>
64
+ * <PageActionBar>
65
+ * <PageActionBarRight>
66
+ * <Button>Save</Button>
67
+ * </PageActionBarRight>
68
+ * </PageActionBar>
69
+ * <PageLayout>
70
+ * <PageBlock column="main" blockId="my-block">
71
+ * <div>My Block</div>
72
+ * </PageBlock>
73
+ * </PageLayout>
74
+ * </Page>
75
+ * )
76
+ * }
77
+ * ```
42
78
  *
43
- * @docsCategory components
79
+ * @docsCategory page-layout
44
80
  * @docsPage Page
45
81
  * @docsWeight 0
46
82
  * @since 3.3.0
@@ -133,7 +169,7 @@ export function PageContentWithOptionalForm({
133
169
  * @description
134
170
  * **Status: Developer Preview**
135
171
  *
136
- * @docsCategory components
172
+ * @docsCategory page-layout
137
173
  * @docsPage PageLayout
138
174
  * @since 3.3.0
139
175
  */
@@ -156,13 +192,11 @@ function isPageBlock(child: unknown): child is React.ReactElement<PageBlockProps
156
192
  }
157
193
 
158
194
  /**
159
- * @description
160
- * **Status: Developer Preview**
161
- *
195
+ * @description *
162
196
  * This component governs the layout of the contents of a {@link Page} component.
163
197
  * It should contain all the {@link PageBlock} components that are to be displayed on the page.
164
198
  *
165
- * @docsCategory components
199
+ * @docsCategory page-layout
166
200
  * @docsPage PageLayout
167
201
  * @docsWeight 0
168
202
  * @since 3.3.0
@@ -247,11 +281,9 @@ export function DetailFormGrid({ children }: Readonly<{ children: React.ReactNod
247
281
 
248
282
  /**
249
283
  * @description
250
- * **Status: Developer Preview**
251
- *
252
284
  * A component for displaying the title of a page. This should be used inside the {@link Page} component.
253
285
  *
254
- * @docsCategory components
286
+ * @docsCategory page-layout
255
287
  * @docsPage PageTitle
256
288
  * @since 3.3.0
257
289
  */
@@ -260,14 +292,12 @@ export function PageTitle({ children }: Readonly<{ children: React.ReactNode }>)
260
292
  }
261
293
 
262
294
  /**
263
- * @description
264
- * **Status: Developer Preview**
265
- *
295
+ * @description *
266
296
  * A component for displaying the main actions for a page. This should be used inside the {@link Page} component.
267
297
  * It should be used in conjunction with the {@link PageActionBarLeft} and {@link PageActionBarRight} components
268
298
  * as direct children.
269
299
  *
270
- * @docsCategory components
300
+ * @docsCategory page-layout
271
301
  * @docsPage PageActionBar
272
302
  * @docsWeight 0
273
303
  * @since 3.3.0
@@ -288,9 +318,9 @@ export function PageActionBar({ children }: Readonly<{ children: React.ReactNode
288
318
 
289
319
  /**
290
320
  * @description
291
- * **Status: Developer Preview**
292
- *
293
- * @docsCategory components
321
+ * The PageActionBarLeft component should be used to display the left content of the action bar.
322
+ *
323
+ * @docsCategory page-layout
294
324
  * @docsPage PageActionBar
295
325
  * @since 3.3.0
296
326
  */
@@ -302,9 +332,9 @@ type InlineDropdownItem = Omit<DashboardActionBarItem, 'type' | 'pageId'>;
302
332
 
303
333
  /**
304
334
  * @description
305
- * **Status: Developer Preview**
335
+ * The PageActionBarRight component should be used to display the right content of the action bar.
306
336
  *
307
- * @docsCategory components
337
+ * @docsCategory page-layout
308
338
  * @docsPage PageActionBar
309
339
  * @since 3.3.0
310
340
  */
@@ -375,31 +405,59 @@ function PageActionBarDropdown({
375
405
 
376
406
  /**
377
407
  * @description
378
- * **Status: Developer Preview**
408
+ * Props used to configure the {@link PageBlock} component.
379
409
  *
380
- * @docsCategory components
410
+ * @docsCategory page-layout
381
411
  * @docsPage PageBlock
382
412
  * @since 3.3.0
383
413
  */
384
414
  export type PageBlockProps = {
415
+ /**
416
+ * @description
417
+ * The content of the block.
418
+ */
385
419
  children?: React.ReactNode;
386
- /** Which column this block should appear in */
420
+ /**
421
+ * @description
422
+ * Which column this block should appear in
423
+ */
387
424
  column: 'main' | 'side';
425
+ /**
426
+ * @description
427
+ * The ID of the block, e.g. "gift-cards" or "related-products".
428
+ */
388
429
  blockId?: string;
430
+ /**
431
+ * @description
432
+ * The title of the block, e.g. "Gift Cards" or "Related Products".
433
+ */
389
434
  title?: React.ReactNode | string;
435
+ /**
436
+ * @description
437
+ * An optional description of the block.
438
+ */
390
439
  description?: React.ReactNode | string;
440
+ /**
441
+ * @description
442
+ * An optional set of CSS classes to apply to the block.
443
+ */
391
444
  className?: string;
392
445
  };
393
446
 
394
447
  /**
395
- * @description
396
- * **Status: Developer Preview**
397
- *
448
+ * @description *
398
449
  * A component for displaying a block of content on a page. This should be used inside the {@link PageLayout} component.
399
450
  * It should be provided with a `column` prop to determine which column it should appear in, and a `blockId` prop
400
451
  * to identify the block.
452
+ *
453
+ * @example
454
+ * ```tsx
455
+ * <PageBlock column="main" blockId="my-block">
456
+ * <div>My Block</div>
457
+ * </PageBlock>
458
+ * ```
401
459
  *
402
- * @docsCategory components
460
+ * @docsCategory page-layout
403
461
  * @docsPage PageBlock
404
462
  * @docsWeight 0
405
463
  * @since 3.3.0
@@ -465,12 +523,17 @@ export function FullWidthPageBlock({
465
523
  }
466
524
 
467
525
  /**
468
- * @description
469
- * **Status: Developer Preview**
470
- *
526
+ * @description *
471
527
  * A component for displaying an auto-generated form for custom fields on a page.
528
+ * This is a special form of {@link PageBlock} that automatically generates
529
+ * a form corresponding to the custom fields for the given entity type.
472
530
  *
473
- * @docsCategory components
531
+ * @example
532
+ * ```tsx
533
+ * <CustomFieldsPageBlock column="main" entityType="Product" control={form.control} />
534
+ * ```
535
+ *
536
+ * @docsCategory page-layout
474
537
  * @docsPage PageBlock
475
538
  * @since 3.3.0
476
539
  */
@@ -33,9 +33,9 @@ import { DetailEntityPath } from './page-types.js';
33
33
 
34
34
  /**
35
35
  * @description
36
- * **Status: Developer Preview**
36
+ * Props to configure the {@link DetailPage} component.
37
37
  *
38
- * @docsCategory components
38
+ * @docsCategory detail-views
39
39
  * @docsPage DetailPage
40
40
  * @since 3.3.0
41
41
  */
@@ -138,13 +138,11 @@ function FieldInputRenderer<
138
138
 
139
139
  /**
140
140
  * @description
141
- * **Status: Developer Preview**
142
- *
143
141
  * Auto-generates a detail page with a form based on the provided query and mutation documents.
144
142
  *
145
143
  * For more control over the layout, you would use the more low-level {@link Page} component.
146
144
  *
147
- * @docsCategory components
145
+ * @docsCategory detail-views
148
146
  * @docsPage DetailPage
149
147
  * @docsWeight 0
150
148
  * @since 3.3.0
@@ -22,9 +22,9 @@ import { FullWidthPageBlock, Page, PageActionBar, PageLayout, PageTitle } from '
22
22
 
23
23
  /**
24
24
  * @description
25
- * **Status: Developer Preview**
25
+ * Props to configure the {@link ListPage} component.
26
26
  *
27
- * @docsCategory components
27
+ * @docsCategory list-views
28
28
  * @docsPage ListPage
29
29
  * @since 3.3.0
30
30
  */
@@ -55,6 +55,7 @@ export interface ListPageProps<
55
55
  setTableOptions?: (table: TableOptions<any>) => TableOptions<any>;
56
56
  bulkActions?: BulkAction[];
57
57
  /**
58
+ * @description
58
59
  * Register a function that allows you to assign a refresh function for
59
60
  * this list. The function can be assigned to a ref and then called when
60
61
  * the list needs to be refreshed.
@@ -64,11 +65,92 @@ export interface ListPageProps<
64
65
 
65
66
  /**
66
67
  * @description
67
- * **Status: Developer Preview**
68
- *
69
68
  * Auto-generates a list page with columns generated based on the provided query document fields.
70
69
  *
71
- * @docsCategory components
70
+ * @example
71
+ * ```tsx
72
+ * import {
73
+ * Button,
74
+ * DashboardRouteDefinition,
75
+ * ListPage,
76
+ * PageActionBarRight,
77
+ * DetailPageButton,
78
+ * } from '@vendure/dashboard';
79
+ * import { Link } from '@tanstack/react-router';
80
+ * import { PlusIcon } from 'lucide-react';
81
+ *
82
+ * // This function is generated for you by the `vendureDashboardPlugin` in your Vite config.
83
+ * // It uses gql-tada to generate TypeScript types which give you type safety as you write
84
+ * // your queries and mutations.
85
+ * import { graphql } from '@/gql';
86
+ *
87
+ * // The fields you select here will be automatically used to generate the appropriate columns in the
88
+ * // data table below.
89
+ * const getArticleList = graphql(`
90
+ * query GetArticles($options: ArticleListOptions) {
91
+ * articles(options: $options) {
92
+ * items {
93
+ * id
94
+ * createdAt
95
+ * updatedAt
96
+ * isPublished
97
+ * title
98
+ * slug
99
+ * body
100
+ * customFields
101
+ * }
102
+ * }
103
+ * }
104
+ * `);
105
+ *
106
+ * const deleteArticleDocument = graphql(`
107
+ * mutation DeleteArticle($id: ID!) {
108
+ * deleteArticle(id: $id) {
109
+ * result
110
+ * }
111
+ * }
112
+ * `);
113
+ *
114
+ * export const articleList: DashboardRouteDefinition = {
115
+ * navMenuItem: {
116
+ * sectionId: 'catalog',
117
+ * id: 'articles',
118
+ * url: '/articles',
119
+ * title: 'CMS Articles',
120
+ * },
121
+ * path: '/articles',
122
+ * loader: () => ({
123
+ * breadcrumb: 'Articles',
124
+ * }),
125
+ * component: route => (
126
+ * <ListPage
127
+ * pageId="article-list"
128
+ * title="Articles"
129
+ * listQuery={getArticleList}
130
+ * deleteMutation={deleteArticleDocument}
131
+ * route={route}
132
+ * customizeColumns={{
133
+ * title: {
134
+ * cell: ({ row }) => {
135
+ * const post = row.original;
136
+ * return <DetailPageButton id={post.id} label={post.title} />;
137
+ * },
138
+ * },
139
+ * }}
140
+ * >
141
+ * <PageActionBarRight>
142
+ * <Button asChild>
143
+ * <Link to="./new">
144
+ * <PlusIcon className="mr-2 h-4 w-4" />
145
+ * New article
146
+ * </Link>
147
+ * </Button>
148
+ * </PageActionBarRight>
149
+ * </ListPage>
150
+ * ),
151
+ * };
152
+ * ```
153
+ * @docsCategory list-views
72
154
  * @docsPage ListPage
73
155
  * @docsWeight 0
74
156
  * @since 3.3.0
@@ -37,9 +37,9 @@ const NEW_ENTITY_ID = '__NEW__';
37
37
 
38
38
  /**
39
39
  * @description
40
- * **Status: Developer Preview**
40
+ * Options used to configure the result of the `useDetailPage` hook.
41
41
  *
42
- * @docsCategory hooks
42
+ * @docsCategory detail-views
43
43
  * @docsPage useDetailPage
44
44
  * @since 3.3.0
45
45
  */
@@ -148,9 +148,8 @@ export type DetailPageEntity<
148
148
 
149
149
  /**
150
150
  * @description
151
- * **Status: Developer Preview**
152
151
  *
153
- * @docsCategory hooks
152
+ * @docsCategory detail-views
154
153
  * @docsPage useDetailPage
155
154
  * @since 3.3.0
156
155
  */
@@ -231,7 +230,7 @@ export interface UseDetailPageResult<
231
230
  * });
232
231
  * ```
233
232
  *
234
- * @docsCategory hooks
233
+ * @docsCategory detail-views
235
234
  * @docsPage useDetailPage
236
235
  * @docsWeight 0
237
236
  * @since 3.3.0
@@ -4,8 +4,8 @@ import { DocumentNode, print } from 'graphql';
4
4
  import { uiConfig } from 'virtual:vendure-ui-config';
5
5
 
6
6
  const API_URL =
7
- uiConfig.api.host +
8
- (uiConfig.api.port !== 'auto' ? `:${uiConfig.api.port}` : '') +
7
+ (uiConfig.api.host !== "auto" ? uiConfig.api.host : `${window.location.protocol}//${window.location.hostname}`) +
8
+ `:${(uiConfig.api.port !== 'auto' ? uiConfig.api.port : window.location.port)}` +
9
9
  `/${uiConfig.api.adminApiPath}`;
10
10
 
11
11
  export const SELECTED_CHANNEL_TOKEN_KEY = 'vendure-selected-channel-token';