@vendure/dashboard 3.5.0-minor-202510161257 → 3.5.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.
Files changed (57) hide show
  1. package/dist/vite/types.d.ts +39 -0
  2. package/dist/vite/utils/plugin-discovery.js +15 -4
  3. package/dist/vite/vite-plugin-ui-config.d.ts +27 -0
  4. package/dist/vite/vite-plugin-vendure-dashboard.d.ts +18 -1
  5. package/dist/vite/vite-plugin-vendure-dashboard.js +19 -7
  6. package/lingui.config.js +1 -0
  7. package/package.json +172 -172
  8. package/src/app/routes/_authenticated/_collections/components/collection-contents-preview-table.tsx +88 -61
  9. package/src/app/routes/_authenticated/_collections/components/move-collections-dialog.tsx +46 -47
  10. package/src/app/routes/_authenticated/_orders/orders.tsx +2 -0
  11. package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +14 -1
  12. package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +12 -7
  13. package/src/app/routes/_authenticated/_products/products.tsx +13 -1
  14. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +8 -2
  15. package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +1 -0
  16. package/src/i18n/locales/ar.po +214 -186
  17. package/src/i18n/locales/cs.po +214 -186
  18. package/src/i18n/locales/de.po +214 -186
  19. package/src/i18n/locales/en.po +214 -186
  20. package/src/i18n/locales/es.po +214 -186
  21. package/src/i18n/locales/fa.po +214 -186
  22. package/src/i18n/locales/fr.po +214 -186
  23. package/src/i18n/locales/he.po +214 -186
  24. package/src/i18n/locales/hr.po +214 -186
  25. package/src/i18n/locales/it.po +214 -186
  26. package/src/i18n/locales/ja.po +214 -186
  27. package/src/i18n/locales/nb.po +214 -186
  28. package/src/i18n/locales/ne.po +214 -186
  29. package/src/i18n/locales/pl.po +214 -186
  30. package/src/i18n/locales/pt_BR.po +214 -186
  31. package/src/i18n/locales/pt_PT.po +214 -186
  32. package/src/i18n/locales/ru.po +214 -186
  33. package/src/i18n/locales/sv.po +214 -186
  34. package/src/i18n/locales/tr.po +214 -186
  35. package/src/i18n/locales/uk.po +214 -186
  36. package/src/i18n/locales/zh_Hans.po +214 -186
  37. package/src/i18n/locales/zh_Hant.po +214 -186
  38. package/src/lib/components/data-input/{password-input.stories.tsx → password-form-input.stories.tsx} +9 -9
  39. package/src/lib/components/data-input/{password-input.tsx → password-form-input.tsx} +1 -1
  40. package/src/lib/components/data-table/data-table-pagination.tsx +4 -4
  41. package/src/lib/components/data-table/data-table.stories.tsx +1 -1
  42. package/src/lib/components/data-table/data-table.tsx +1 -1
  43. package/src/lib/components/data-table/use-generated-columns.tsx +5 -1
  44. package/src/lib/components/layout/app-layout.tsx +0 -2
  45. package/src/lib/components/shared/asset/asset-gallery.stories.tsx +1 -1
  46. package/src/lib/components/shared/asset/asset-picker-dialog.stories.tsx +1 -1
  47. package/src/lib/components/shared/detail-page-button.stories.tsx +1 -1
  48. package/src/lib/components/shared/facet-value-selector.stories.tsx +1 -1
  49. package/src/lib/components/shared/paginated-list-data-table.stories.tsx +1 -1
  50. package/src/lib/components/shared/permission-guard.stories.tsx +1 -1
  51. package/src/lib/components/shared/vendure-image.stories.tsx +1 -1
  52. package/src/lib/components/ui/password-input.tsx +3 -7
  53. package/src/lib/framework/alert/alert-item.tsx +2 -2
  54. package/src/lib/framework/extension-api/input-component-extensions.tsx +2 -2
  55. package/src/lib/hooks/use-alerts.ts +2 -2
  56. package/src/lib/index.ts +13 -8
  57. package/src/lib/components/layout/prerelease-popup.tsx +0 -34
@@ -3,6 +3,7 @@ import { Alert, AlertDescription, AlertTitle } from '@/vdb/components/ui/alert.j
3
3
  import { Button } from '@/vdb/components/ui/button.js';
4
4
  import { addCustomFields } from '@/vdb/framework/document-introspection/add-custom-fields.js';
5
5
  import { graphql } from '@/vdb/graphql/graphql.js';
6
+ import { Trans } from '@lingui/react/macro';
6
7
  import { useQuery } from '@tanstack/react-query';
7
8
  import { Link } from '@tanstack/react-router';
8
9
  import { ColumnFiltersState, SortingState } from '@tanstack/react-table';
@@ -52,7 +53,15 @@ export function CollectionContentsPreviewTable({
52
53
  for (const arg of filterDef.args) {
53
54
  const argPair = f.arguments.find(a => a.name === arg.name);
54
55
  const argValue = argPair?.value ?? arg.defaultValue;
55
- if (arg.required && argValue == null) {
56
+ let isValidValue = true;
57
+ if (arg.list) {
58
+ try {
59
+ JSON.parse(argValue);
60
+ } catch (e) {
61
+ isValidValue = false;
62
+ }
63
+ }
64
+ if (!isValidValue || (arg.required && argValue == null)) {
56
65
  return false;
57
66
  }
58
67
  }
@@ -61,66 +70,84 @@ export function CollectionContentsPreviewTable({
61
70
 
62
71
  return (
63
72
  <div>
64
- <Alert className="mb-4">
65
- <Eye className="h-4 w-4" />
66
- <AlertTitle>Preview</AlertTitle>
67
- <AlertDescription>
68
- This is a preview of the collection contents based on the current filter settings. Once
69
- you save the collection, the contents will be updated to reflect the new filter settings.
70
- </AlertDescription>
71
- </Alert>
72
-
73
- <PaginatedListDataTable
74
- listQuery={addCustomFields(previewCollectionContentsDocument)}
75
- transformQueryKey={queryKey => {
76
- return [...queryKey, JSON.stringify(effectiveFilters), inheritFilters];
77
- }}
78
- transformVariables={variables => {
79
- return {
80
- options: variables.options,
81
- input: {
82
- parentId,
83
- filters: effectiveFilters,
84
- inheritFilters,
85
- },
86
- };
87
- }}
88
- customizeColumns={{
89
- name: {
90
- header: 'Variant name',
91
- cell: ({ row }) => {
92
- return (
93
- <Button asChild variant="ghost">
94
- <Link to={`../../product-variants/${row.original.id}`}>
95
- {row.original.name}{' '}
96
- </Link>
97
- </Button>
98
- );
99
- },
100
- },
101
- }}
102
- page={page}
103
- itemsPerPage={pageSize}
104
- sorting={sorting}
105
- columnFilters={filters}
106
- onPageChange={(_, page, perPage) => {
107
- setPage(page);
108
- setPageSize(perPage);
109
- }}
110
- onSortChange={(_, sorting) => {
111
- setSorting(sorting);
112
- }}
113
- onFilterChange={(_, filters) => {
114
- setFilters(filters);
115
- }}
116
- onSearchTermChange={searchTerm => {
117
- return {
118
- name: {
119
- contains: searchTerm,
120
- },
121
- };
122
- }}
123
- />
73
+ {effectiveFilters.length === 0 ? (
74
+ <Alert className="mb-4">
75
+ <Eye className="h-4 w-4" />
76
+ <AlertTitle>
77
+ <Trans>Preview</Trans>
78
+ </AlertTitle>
79
+ <AlertDescription>
80
+ <Trans>Add filters to preview the collection contents.</Trans>
81
+ </AlertDescription>
82
+ </Alert>
83
+ ) : (
84
+ <>
85
+ <Alert className="mb-4">
86
+ <Eye className="h-4 w-4" />
87
+ <AlertTitle>
88
+ <Trans>Preview</Trans>
89
+ </AlertTitle>
90
+ <AlertDescription>
91
+ <Trans>
92
+ This is a preview of the collection contents based on the current filter
93
+ settings. Once you save the collection, the contents will be updated to
94
+ reflect the new filter settings.
95
+ </Trans>
96
+ </AlertDescription>
97
+ </Alert>
98
+ <PaginatedListDataTable
99
+ listQuery={addCustomFields(previewCollectionContentsDocument)}
100
+ transformQueryKey={queryKey => {
101
+ return [...queryKey, JSON.stringify(effectiveFilters), inheritFilters];
102
+ }}
103
+ transformVariables={variables => {
104
+ return {
105
+ options: variables.options,
106
+ input: {
107
+ parentId,
108
+ filters: effectiveFilters,
109
+ inheritFilters,
110
+ },
111
+ };
112
+ }}
113
+ customizeColumns={{
114
+ name: {
115
+ header: 'Variant name',
116
+ cell: ({ row }) => {
117
+ return (
118
+ <Button asChild variant="ghost">
119
+ <Link to={`../../product-variants/${row.original.id}`}>
120
+ {row.original.name}{' '}
121
+ </Link>
122
+ </Button>
123
+ );
124
+ },
125
+ },
126
+ }}
127
+ page={page}
128
+ itemsPerPage={pageSize}
129
+ sorting={sorting}
130
+ columnFilters={filters}
131
+ onPageChange={(_, page, perPage) => {
132
+ setPage(page);
133
+ setPageSize(perPage);
134
+ }}
135
+ onSortChange={(_, sorting) => {
136
+ setSorting(sorting);
137
+ }}
138
+ onFilterChange={(_, filters) => {
139
+ setFilters(filters);
140
+ }}
141
+ onSearchTermChange={searchTerm => {
142
+ return {
143
+ name: {
144
+ contains: searchTerm,
145
+ },
146
+ };
147
+ }}
148
+ />
149
+ </>
150
+ )}
124
151
  </div>
125
152
  );
126
153
  }
@@ -14,7 +14,6 @@ import {
14
14
  DialogTitle,
15
15
  } from '@/vdb/components/ui/dialog.js';
16
16
  import { Input } from '@/vdb/components/ui/input.js';
17
- import { ScrollArea } from '@/vdb/components/ui/scroll-area.js';
18
17
  import { api } from '@/vdb/graphql/api.js';
19
18
  import { Trans, useLingui } from '@lingui/react/macro';
20
19
  import { ChevronRight, Folder, FolderOpen, Search } from 'lucide-react';
@@ -68,7 +67,7 @@ function TargetAlert({
68
67
  collectionNameCache,
69
68
  }: Readonly<TargetAlertProps>) {
70
69
  return (
71
- <Alert className={selectedCollectionId ? 'border-blue-200 bg-blue-50' : ''}>
70
+ <Alert className={selectedCollectionId ? 'border-blue-200 bg-blue-50' : 'opacity-50'}>
72
71
  <Folder className="h-4 w-4" />
73
72
  <AlertDescription>
74
73
  {selectedCollectionId ? (
@@ -330,8 +329,8 @@ export function MoveCollectionsDialog({
330
329
 
331
330
  return (
332
331
  <Dialog open={open} onOpenChange={onOpenChange}>
333
- <DialogContent className="sm:max-w-[600px] max-h-[80vh]">
334
- <DialogHeader>
332
+ <DialogContent className="sm:max-w-[600px] h-[90vh] flex flex-col p-0 gap-0">
333
+ <DialogHeader className="px-6 pt-6 pb-4">
335
334
  <DialogTitle>
336
335
  <Trans>Move Collections</Trans>
337
336
  </DialogTitle>
@@ -345,7 +344,7 @@ export function MoveCollectionsDialog({
345
344
  </Trans>
346
345
  </DialogDescription>
347
346
  </DialogHeader>
348
- <div className="px-6 py-3 bg-muted/50 border-b">
347
+ <div className="px-6 py-3 bg-muted/50 border-y shrink-0">
349
348
  <div className="flex flex-wrap gap-2">
350
349
  {collectionsToMove.map(collection => (
351
350
  <div
@@ -358,9 +357,9 @@ export function MoveCollectionsDialog({
358
357
  ))}
359
358
  </div>
360
359
  </div>
361
- <div className="py-4">
362
- <div className="px-6 pb-3">
363
- <div className="relative mb-3">
360
+ <div className="flex-1 min-h-0 overflow-auto px-6 py-4">
361
+ <div className="h-full flex flex-col gap-3">
362
+ <div className="relative shrink-0">
364
363
  <Search className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" />
365
364
  <Input
366
365
  placeholder={t`Filter by collection name`}
@@ -369,47 +368,47 @@ export function MoveCollectionsDialog({
369
368
  className="pl-10"
370
369
  />
371
370
  </div>
372
- <ScrollArea className="h-[400px]">
373
- <div className="space-y-1">
374
- {isLoading ? (
375
- <div className="flex items-center justify-center py-8">
376
- <Trans>Loading collections...</Trans>
377
- </div>
378
- ) : (
379
- <>
380
- {!debouncedSearchTerm && !selectionHasTopLevelParent && (
381
- <MoveToTopLevel
382
- selectedCollectionId={selectedCollectionId}
383
- topLevelCollectionId={topLevelCollectionId}
384
- onSelect={setSelectedCollectionId}
385
- />
386
- )}
387
- {collections.map((collection: Collection) => (
388
- <CollectionTreeNode
389
- key={collection.id}
390
- collection={collection}
391
- depth={0}
392
- expanded={expanded}
393
- onToggleExpanded={handleToggleExpanded}
394
- onSelect={handleSelect}
395
- selectedCollectionId={selectedCollectionId}
396
- collectionsToMove={collectionsToMove}
397
- childCollectionsByParentId={childCollectionsByParentId}
398
- />
399
- ))}
400
- </>
401
- )}
402
- </div>
403
- </ScrollArea>
404
- <TargetAlert
405
- selectedCollectionId={selectedCollectionId}
406
- collectionsToMove={collectionsToMove}
407
- topLevelCollectionId={topLevelCollectionId}
408
- collectionNameCache={collectionNameCache}
409
- />
371
+ <div className="space-y-1">
372
+ {isLoading ? (
373
+ <div className="flex items-center justify-center py-8">
374
+ <Trans>Loading collections...</Trans>
375
+ </div>
376
+ ) : (
377
+ <>
378
+ {!debouncedSearchTerm && !selectionHasTopLevelParent && (
379
+ <MoveToTopLevel
380
+ selectedCollectionId={selectedCollectionId}
381
+ topLevelCollectionId={topLevelCollectionId}
382
+ onSelect={setSelectedCollectionId}
383
+ />
384
+ )}
385
+ {collections.map((collection: Collection) => (
386
+ <CollectionTreeNode
387
+ key={collection.id}
388
+ collection={collection}
389
+ depth={0}
390
+ expanded={expanded}
391
+ onToggleExpanded={handleToggleExpanded}
392
+ onSelect={handleSelect}
393
+ selectedCollectionId={selectedCollectionId}
394
+ collectionsToMove={collectionsToMove}
395
+ childCollectionsByParentId={childCollectionsByParentId}
396
+ />
397
+ ))}
398
+ </>
399
+ )}
400
+ </div>
401
+ <div className="shrink-0">
402
+ <TargetAlert
403
+ selectedCollectionId={selectedCollectionId}
404
+ collectionsToMove={collectionsToMove}
405
+ topLevelCollectionId={topLevelCollectionId}
406
+ collectionNameCache={collectionNameCache}
407
+ />
408
+ </div>
410
409
  </div>
411
410
  </div>
412
- <DialogFooter>
411
+ <DialogFooter className="px-6 pb-6 pt-4 shrink-0">
413
412
  <Button variant="outline" onClick={() => onOpenChange(false)}>
414
413
  <Trans>Cancel</Trans>
415
414
  </Button>
@@ -61,9 +61,11 @@ function OrderListPage() {
61
61
  route={Route}
62
62
  customizeColumns={{
63
63
  total: {
64
+ meta: { dependencies: ['currencyCode'] },
64
65
  cell: OrderMoneyCell,
65
66
  },
66
67
  totalWithTax: {
68
+ meta: { dependencies: ['currencyCode'] },
67
69
  cell: OrderMoneyCell,
68
70
  },
69
71
  state: {
@@ -61,11 +61,13 @@ function ProductListPage() {
61
61
  cell: ({ row: { original } }) => formatCurrencyName(original.currencyCode, 'full'),
62
62
  },
63
63
  price: {
64
+ meta: { dependencies: ['currencyCode'] },
64
65
  cell: ({ row: { original } }) => (
65
66
  <Money value={original.price} currency={original.currencyCode} />
66
67
  ),
67
68
  },
68
69
  priceWithTax: {
70
+ meta: { dependencies: ['currencyCode'] },
69
71
  cell: ({ row: { original } }) => (
70
72
  <Money value={original.priceWithTax} currency={original.currencyCode} />
71
73
  ),
@@ -75,8 +77,19 @@ function ProductListPage() {
75
77
  },
76
78
  }}
77
79
  onSearchTermChange={searchTerm => {
80
+ return searchTerm
81
+ ? {
82
+ name: { contains: searchTerm },
83
+ sku: { contains: searchTerm },
84
+ }
85
+ : {};
86
+ }}
87
+ transformVariables={variables => {
78
88
  return {
79
- name: { contains: searchTerm },
89
+ options: {
90
+ ...variables.options,
91
+ filterOperator: 'OR',
92
+ },
80
93
  };
81
94
  }}
82
95
  route={Route}
@@ -1,6 +1,7 @@
1
1
  import { MoneyInput } from '@/vdb/components/data-input/money-input.js';
2
2
  import { NumberInput } from '@/vdb/components/data-input/number-input.js';
3
3
  import { AssignedFacetValues } from '@/vdb/components/shared/assigned-facet-values.js';
4
+ import { DetailPageButton } from '@/vdb/components/shared/detail-page-button.js';
4
5
  import { EntityAssets } from '@/vdb/components/shared/entity-assets.js';
5
6
  import { ErrorPage } from '@/vdb/components/shared/error-page.js';
6
7
  import { FormFieldWrapper } from '@/vdb/components/shared/form-field-wrapper.js';
@@ -234,7 +235,7 @@ function ProductVariantDetailPage() {
234
235
  <TranslatableFormFieldWrapper
235
236
  control={form.control}
236
237
  name="name"
237
- label={<Trans>Product name</Trans>}
238
+ label={<Trans>Variant name</Trans>}
238
239
  render={({ field }) => <Input {...field} />}
239
240
  />
240
241
 
@@ -422,21 +423,25 @@ function ProductVariantDetailPage() {
422
423
  />
423
424
  </PageBlock>
424
425
 
425
- <PageBlock column="side" blockId="facet-values">
426
+ <PageBlock column="side" blockId="facet-values" title={<Trans>Facet Values</Trans>}>
426
427
  <FormFieldWrapper
427
428
  control={form.control}
428
429
  name="facetValueIds"
429
- label={<Trans>Facet values</Trans>}
430
430
  render={({ field }) => (
431
431
  <AssignedFacetValues facetValues={entity?.facetValues ?? []} {...field} />
432
432
  )}
433
433
  />
434
434
  </PageBlock>
435
- <PageBlock column="side" blockId="assets">
435
+
436
+ <PageBlock column="side" blockId="parent-product" title={<Trans>Parent product</Trans>}>
437
+ <DetailPageButton
438
+ label={entity?.product.name}
439
+ href={`/products/${entity?.product.id}`}
440
+ className="border"
441
+ />
442
+ </PageBlock>
443
+ <PageBlock column="side" blockId="assets" title={<Trans>Assets</Trans>}>
436
444
  <FormItem>
437
- <FormLabel>
438
- <Trans>Assets</Trans>
439
- </FormLabel>
440
445
  <FormControl>
441
446
  <EntityAssets
442
447
  assets={entity?.assets}
@@ -54,8 +54,20 @@ function ProductListPage() {
54
54
  },
55
55
  }}
56
56
  onSearchTermChange={searchTerm => {
57
+ return searchTerm
58
+ ? {
59
+ name: { contains: searchTerm },
60
+ slug: { contains: searchTerm },
61
+ sku: { contains: searchTerm },
62
+ }
63
+ : {};
64
+ }}
65
+ transformVariables={variables => {
57
66
  return {
58
- name: { contains: searchTerm },
67
+ options: {
68
+ ...variables.options,
69
+ filterOperator: 'OR',
70
+ },
59
71
  };
60
72
  }}
61
73
  defaultVisibility={{
@@ -121,7 +121,13 @@ function ShippingMethodDetailPage() {
121
121
  <PermissionGuard requires={['UpdateShippingMethod']}>
122
122
  <Button
123
123
  type="submit"
124
- disabled={!form.formState.isDirty || !form.formState.isValid || isPending}
124
+ disabled={
125
+ !form.formState.isDirty ||
126
+ !form.formState.isValid ||
127
+ isPending ||
128
+ !checker?.code ||
129
+ !calculator?.code
130
+ }
125
131
  >
126
132
  {creatingNewEntity ? <Trans>Create</Trans> : <Trans>Update</Trans>}
127
133
  </Button>
@@ -163,7 +169,7 @@ function ShippingMethodDetailPage() {
163
169
  />
164
170
  </DetailFormGrid>
165
171
  </PageBlock>
166
- <CustomFieldsPageBlock column="main" entityType="Promotion" control={form.control} />
172
+ <CustomFieldsPageBlock column="main" entityType="ShippingMethod" control={form.control} />
167
173
  <PageBlock column="main" blockId="conditions" title={<Trans>Conditions</Trans>}>
168
174
  <FormFieldWrapper
169
175
  control={form.control}
@@ -58,6 +58,7 @@ function TaxCategoryDetailPage() {
58
58
  return {
59
59
  id: entity.id,
60
60
  name: entity.name,
61
+ isDefault: entity.isDefault,
61
62
  customFields: entity.customFields,
62
63
  };
63
64
  },