@vendure/dashboard 3.4.3-master-202509190229 → 3.4.3-master-202509200226

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 (43) hide show
  1. package/dist/vite/vite-plugin-config.js +1 -0
  2. package/package.json +4 -4
  3. package/src/app/routes/_authenticated/_administrators/administrators.tsx +1 -2
  4. package/src/app/routes/_authenticated/_assets/assets.graphql.ts +39 -0
  5. package/src/app/routes/_authenticated/_assets/assets_.$id.tsx +18 -7
  6. package/src/app/routes/_authenticated/_assets/components/asset-tag-filter.tsx +206 -0
  7. package/src/app/routes/_authenticated/_assets/components/asset-tags-editor.tsx +226 -0
  8. package/src/app/routes/_authenticated/_assets/components/manage-tags-dialog.tsx +217 -0
  9. package/src/app/routes/_authenticated/_channels/channels.tsx +1 -2
  10. package/src/app/routes/_authenticated/_collections/collections.tsx +2 -16
  11. package/src/app/routes/_authenticated/_countries/countries.tsx +1 -2
  12. package/src/app/routes/_authenticated/_customer-groups/customer-groups.tsx +1 -2
  13. package/src/app/routes/_authenticated/_customers/customers.tsx +1 -2
  14. package/src/app/routes/_authenticated/_facets/facets.tsx +0 -1
  15. package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +1 -2
  16. package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +1 -2
  17. package/src/app/routes/_authenticated/_products/products.tsx +1 -2
  18. package/src/app/routes/_authenticated/_promotions/promotions.tsx +1 -2
  19. package/src/app/routes/_authenticated/_roles/roles.tsx +1 -2
  20. package/src/app/routes/_authenticated/_sellers/sellers.tsx +1 -2
  21. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +1 -2
  22. package/src/app/routes/_authenticated/_stock-locations/stock-locations.tsx +1 -2
  23. package/src/app/routes/_authenticated/_tax-categories/tax-categories.tsx +1 -2
  24. package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +1 -2
  25. package/src/app/routes/_authenticated/_zones/zones.tsx +1 -2
  26. package/src/lib/components/data-table/data-table-bulk-actions.tsx +5 -14
  27. package/src/lib/components/data-table/use-all-bulk-actions.ts +19 -0
  28. package/src/lib/components/data-table/use-generated-columns.tsx +12 -3
  29. package/src/lib/components/layout/nav-main.tsx +50 -25
  30. package/src/lib/components/shared/asset/asset-focal-point-editor.tsx +1 -1
  31. package/src/lib/components/shared/asset/asset-gallery.tsx +83 -50
  32. package/src/lib/components/shared/paginated-list-data-table.tsx +1 -0
  33. package/src/lib/components/shared/vendure-image.tsx +9 -1
  34. package/src/lib/framework/defaults.ts +24 -0
  35. package/src/lib/framework/extension-api/types/navigation.ts +8 -0
  36. package/src/lib/framework/nav-menu/nav-menu-extensions.ts +26 -0
  37. package/src/lib/framework/page/list-page.tsx +7 -0
  38. package/src/lib/hooks/use-custom-field-config.ts +19 -2
  39. package/src/lib/index.ts +0 -1
  40. package/src/lib/providers/channel-provider.tsx +22 -6
  41. package/src/lib/providers/server-config.tsx +1 -0
  42. package/src/app/routes/_authenticated/_collections/components/move-single-collection.tsx +0 -33
  43. package/src/lib/components/shared/asset/focal-point-control.tsx +0 -57
@@ -0,0 +1,217 @@
1
+ import { Button } from '@/vdb/components/ui/button.js';
2
+ import {
3
+ Dialog,
4
+ DialogContent,
5
+ DialogDescription,
6
+ DialogFooter,
7
+ DialogHeader,
8
+ DialogTitle,
9
+ } from '@/vdb/components/ui/dialog.js';
10
+ import { Input } from '@/vdb/components/ui/input.js';
11
+ import { api } from '@/vdb/graphql/api.js';
12
+ import { Trans } from '@/vdb/lib/trans.js';
13
+ import { cn } from '@/vdb/lib/utils.js';
14
+ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
15
+ import { Trash2 } from 'lucide-react';
16
+ import { useState } from 'react';
17
+ import { toast } from 'sonner';
18
+ import { deleteTagDocument, tagListDocument, updateTagDocument } from '../assets.graphql.js';
19
+
20
+ interface ManageTagsDialogProps {
21
+ open: boolean;
22
+ onOpenChange: (open: boolean) => void;
23
+ onTagsUpdated?: () => void;
24
+ }
25
+
26
+ export function ManageTagsDialog({ open, onOpenChange, onTagsUpdated }: Readonly<ManageTagsDialogProps>) {
27
+ const queryClient = useQueryClient();
28
+ const [toDelete, setToDelete] = useState<string[]>([]);
29
+ const [toUpdate, setToUpdate] = useState<Array<{ id: string; value: string }>>([]);
30
+ const [isSaving, setIsSaving] = useState(false);
31
+
32
+ // Fetch all tags
33
+ const { data: tagsData, isLoading } = useQuery({
34
+ queryKey: ['tags'],
35
+ queryFn: () => api.query(tagListDocument, { options: { take: 100 } }),
36
+ staleTime: 1000 * 60 * 5,
37
+ });
38
+
39
+ // Update tag mutation
40
+ const updateTagMutation = useMutation({
41
+ mutationFn: ({ id, value }: { id: string; value: string }) =>
42
+ api.mutate(updateTagDocument, { input: { id, value } }),
43
+ });
44
+
45
+ // Delete tag mutation
46
+ const deleteTagMutation = useMutation({
47
+ mutationFn: (id: string) => api.mutate(deleteTagDocument, { id }),
48
+ });
49
+
50
+ const allTags = tagsData?.tags.items || [];
51
+
52
+ const toggleDelete = (id: string) => {
53
+ if (toDelete.includes(id)) {
54
+ setToDelete(toDelete.filter(_id => _id !== id));
55
+ } else {
56
+ setToDelete([...toDelete, id]);
57
+ }
58
+ };
59
+
60
+ const markedAsDeleted = (id: string) => {
61
+ return toDelete.includes(id);
62
+ };
63
+
64
+ const updateTagValue = (id: string, value: string) => {
65
+ const exists = toUpdate.find(i => i.id === id);
66
+ if (exists) {
67
+ if (value === allTags.find(tag => tag.id === id)?.value) {
68
+ // If value is reverted to original, remove from update list
69
+ setToUpdate(toUpdate.filter(i => i.id !== id));
70
+ } else {
71
+ exists.value = value;
72
+ setToUpdate([...toUpdate]);
73
+ }
74
+ } else {
75
+ setToUpdate([...toUpdate, { id, value }]);
76
+ }
77
+ };
78
+
79
+ const getDisplayValue = (id: string) => {
80
+ const updateItem = toUpdate.find(i => i.id === id);
81
+ if (updateItem) {
82
+ return updateItem.value;
83
+ }
84
+ return allTags.find(tag => tag.id === id)?.value || '';
85
+ };
86
+
87
+ const renderTagsList = () => {
88
+ if (isLoading) {
89
+ return (
90
+ <div className="text-sm text-muted-foreground">
91
+ <Trans>Loading tags...</Trans>
92
+ </div>
93
+ );
94
+ }
95
+
96
+ if (allTags.length === 0) {
97
+ return (
98
+ <div className="text-sm text-muted-foreground">
99
+ <Trans>No tags found</Trans>
100
+ </div>
101
+ );
102
+ }
103
+
104
+ return allTags.map(tag => {
105
+ const isDeleted = markedAsDeleted(tag.id);
106
+ const isModified = toUpdate.some(i => i.id === tag.id);
107
+
108
+ return (
109
+ <div
110
+ key={tag.id}
111
+ className={cn(
112
+ 'flex items-center gap-2 p-2 rounded-md',
113
+ isDeleted && 'opacity-50',
114
+ )}
115
+ >
116
+ <Input
117
+ value={getDisplayValue(tag.id)}
118
+ onChange={e => updateTagValue(tag.id, e.target.value)}
119
+ disabled={isDeleted || isSaving}
120
+ className={cn('flex-1', isModified && !isDeleted && 'border-primary')}
121
+ />
122
+ <Button
123
+ variant={isDeleted ? 'default' : 'ghost'}
124
+ size="icon"
125
+ onClick={() => toggleDelete(tag.id)}
126
+ disabled={isSaving}
127
+ className={cn(isDeleted && 'bg-destructive hover:bg-destructive/90')}
128
+ >
129
+ <Trash2 className="h-4 w-4" />
130
+ </Button>
131
+ </div>
132
+ );
133
+ });
134
+ };
135
+
136
+ const hasChanges = toDelete.length > 0 || toUpdate.length > 0;
137
+
138
+ const handleCancel = () => {
139
+ setToDelete([]);
140
+ setToUpdate([]);
141
+ onOpenChange(false);
142
+ };
143
+
144
+ const handleSave = async () => {
145
+ setIsSaving(true);
146
+
147
+ try {
148
+ const operations = [];
149
+
150
+ // Delete operations
151
+ for (const id of toDelete) {
152
+ operations.push(deleteTagMutation.mutateAsync(id));
153
+ }
154
+
155
+ // Update operations (skip if marked for deletion)
156
+ for (const item of toUpdate) {
157
+ if (!toDelete.includes(item.id)) {
158
+ operations.push(updateTagMutation.mutateAsync(item));
159
+ }
160
+ }
161
+
162
+ await Promise.all(operations);
163
+
164
+ // Invalidate tags query to refresh the list
165
+ await queryClient.invalidateQueries({ queryKey: ['tags'] });
166
+
167
+ // Also invalidate asset queries to refresh any assets using these tags
168
+ await queryClient.invalidateQueries({ queryKey: ['asset'] });
169
+
170
+ toast.success('Tags updated successfully');
171
+
172
+ // Call callback to notify parent component
173
+ if (onTagsUpdated) {
174
+ onTagsUpdated();
175
+ }
176
+
177
+ // Reset state
178
+ setToDelete([]);
179
+ setToUpdate([]);
180
+ onOpenChange(false);
181
+ } catch (error) {
182
+ toast.error('Failed to update tags', {
183
+ description: error instanceof Error ? error.message : 'Unknown error',
184
+ });
185
+ } finally {
186
+ setIsSaving(false);
187
+ }
188
+ };
189
+
190
+ return (
191
+ <Dialog open={open} onOpenChange={onOpenChange}>
192
+ <DialogContent className="max-w-md">
193
+ <DialogHeader>
194
+ <DialogTitle>
195
+ <Trans>Manage Tags</Trans>
196
+ </DialogTitle>
197
+ <DialogDescription>
198
+ <Trans>Edit or delete existing tags</Trans>
199
+ </DialogDescription>
200
+ </DialogHeader>
201
+
202
+ <div className="max-h-[400px] overflow-y-auto space-y-2 py-4">
203
+ {renderTagsList()}
204
+ </div>
205
+
206
+ <DialogFooter>
207
+ <Button variant="outline" onClick={handleCancel} disabled={isSaving}>
208
+ <Trans>Cancel</Trans>
209
+ </Button>
210
+ <Button onClick={handleSave} disabled={!hasChanges || isSaving}>
211
+ {isSaving ? <Trans>Saving...</Trans> : <Trans>Save Changes</Trans>}
212
+ </Button>
213
+ </DialogFooter>
214
+ </DialogContent>
215
+ </Dialog>
216
+ );
217
+ }
@@ -8,7 +8,7 @@ import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
8
8
  import { Trans } from '@/vdb/lib/trans.js';
9
9
  import { createFileRoute, Link } from '@tanstack/react-router';
10
10
  import { PlusIcon } from 'lucide-react';
11
- import { channelListQuery, deleteChannelDocument } from './channels.graphql.js';
11
+ import { channelListQuery } from './channels.graphql.js';
12
12
  import { DeleteChannelsBulkAction } from './components/channel-bulk-actions.js';
13
13
 
14
14
  export const Route = createFileRoute('/_authenticated/_channels/channels')({
@@ -23,7 +23,6 @@ function ChannelListPage() {
23
23
  pageId="channel-list"
24
24
  title="Channels"
25
25
  listQuery={channelListQuery}
26
- deleteMutation={deleteChannelDocument}
27
26
  route={Route}
28
27
  defaultVisibility={{
29
28
  code: true,
@@ -10,11 +10,11 @@ import { createFileRoute, Link } from '@tanstack/react-router';
10
10
  import { ExpandedState, getExpandedRowModel } from '@tanstack/react-table';
11
11
  import { TableOptions } from '@tanstack/table-core';
12
12
  import { ResultOf } from 'gql.tada';
13
- import { Folder, FolderOpen, FolderTreeIcon, PlusIcon } from 'lucide-react';
13
+ import { Folder, FolderOpen, PlusIcon } from 'lucide-react';
14
14
  import { useState } from 'react';
15
15
 
16
16
  import { Badge } from '@/vdb/components/ui/badge.js';
17
- import { collectionListDocument, deleteCollectionDocument } from './collections.graphql.js';
17
+ import { collectionListDocument } from './collections.graphql.js';
18
18
  import {
19
19
  AssignCollectionsToChannelBulkAction,
20
20
  DeleteCollectionsBulkAction,
@@ -23,7 +23,6 @@ import {
23
23
  RemoveCollectionsFromChannelBulkAction,
24
24
  } from './components/collection-bulk-actions.js';
25
25
  import { CollectionContentsSheet } from './components/collection-contents-sheet.js';
26
- import { useMoveSingleCollection } from './components/move-single-collection.js';
27
26
 
28
27
  export const Route = createFileRoute('/_authenticated/_collections/collections')({
29
28
  component: CollectionListPage,
@@ -34,7 +33,6 @@ type Collection = ResultOf<typeof collectionListDocument>['collections']['items'
34
33
 
35
34
  function CollectionListPage() {
36
35
  const [expanded, setExpanded] = useState<ExpandedState>({});
37
- const { handleMoveClick, MoveDialog } = useMoveSingleCollection();
38
36
  const childrenQueries = useQueries({
39
37
  queries: Object.entries(expanded).map(([collectionId, isExpanded]) => {
40
38
  return {
@@ -96,7 +94,6 @@ function CollectionListPage() {
96
94
  },
97
95
  };
98
96
  }}
99
- deleteMutation={deleteCollectionDocument}
100
97
  customizeColumns={{
101
98
  name: {
102
99
  header: 'Collection Name',
@@ -210,16 +207,6 @@ function CollectionListPage() {
210
207
  };
211
208
  }}
212
209
  route={Route}
213
- rowActions={[
214
- {
215
- label: (
216
- <div className="flex items-center gap-2">
217
- <FolderTreeIcon className="w-4 h-4" /> <Trans>Move</Trans>
218
- </div>
219
- ),
220
- onClick: row => handleMoveClick(row.original),
221
- },
222
- ]}
223
210
  bulkActions={[
224
211
  {
225
212
  component: AssignCollectionsToChannelBulkAction,
@@ -254,7 +241,6 @@ function CollectionListPage() {
254
241
  </PermissionGuard>
255
242
  </PageActionBarRight>
256
243
  </ListPage>
257
- <MoveDialog />
258
244
  </>
259
245
  );
260
246
  }
@@ -7,7 +7,7 @@ import { Trans } from '@/vdb/lib/trans.js';
7
7
  import { createFileRoute, Link } from '@tanstack/react-router';
8
8
  import { PlusIcon } from 'lucide-react';
9
9
  import { DeleteCountriesBulkAction } from './components/country-bulk-actions.js';
10
- import { countriesListQuery, deleteCountryDocument } from './countries.graphql.js';
10
+ import { countriesListQuery } from './countries.graphql.js';
11
11
 
12
12
  export const Route = createFileRoute('/_authenticated/_countries/countries')({
13
13
  component: CountryListPage,
@@ -19,7 +19,6 @@ function CountryListPage() {
19
19
  <ListPage
20
20
  pageId="country-list"
21
21
  listQuery={countriesListQuery}
22
- deleteMutation={deleteCountryDocument}
23
22
  route={Route}
24
23
  title="Countries"
25
24
  defaultVisibility={{
@@ -8,7 +8,7 @@ import { createFileRoute, Link } from '@tanstack/react-router';
8
8
  import { PlusIcon } from 'lucide-react';
9
9
  import { DeleteCustomerGroupsBulkAction } from './components/customer-group-bulk-actions.js';
10
10
  import { CustomerGroupMembersSheet } from './components/customer-group-members-sheet.js';
11
- import { customerGroupListDocument, deleteCustomerGroupDocument } from './customer-groups.graphql.js';
11
+ import { customerGroupListDocument } from './customer-groups.graphql.js';
12
12
 
13
13
  export const Route = createFileRoute('/_authenticated/_customer-groups/customer-groups')({
14
14
  component: CustomerGroupListPage,
@@ -21,7 +21,6 @@ function CustomerGroupListPage() {
21
21
  pageId="customer-group-list"
22
22
  title="Customer Groups"
23
23
  listQuery={customerGroupListDocument}
24
- deleteMutation={deleteCustomerGroupDocument}
25
24
  route={Route}
26
25
  customizeColumns={{
27
26
  name: {
@@ -8,7 +8,7 @@ import { createFileRoute, Link } from '@tanstack/react-router';
8
8
  import { PlusIcon } from 'lucide-react';
9
9
  import { DeleteCustomersBulkAction } from './components/customer-bulk-actions.js';
10
10
  import { CustomerStatusBadge } from './components/customer-status-badge.js';
11
- import { customerListDocument, deleteCustomerDocument } from './customers.graphql.js';
11
+ import { customerListDocument } from './customers.graphql.js';
12
12
 
13
13
  export const Route = createFileRoute('/_authenticated/_customers/customers')({
14
14
  component: CustomerListPage,
@@ -21,7 +21,6 @@ function CustomerListPage() {
21
21
  title="Customers"
22
22
  pageId="customer-list"
23
23
  listQuery={customerListDocument}
24
- deleteMutation={deleteCustomerDocument}
25
24
  onSearchTermChange={searchTerm => {
26
25
  return {
27
26
  lastName: {
@@ -63,7 +63,6 @@ function FacetListPage() {
63
63
  pageId="facet-list"
64
64
  title="Facets"
65
65
  listQuery={facetListDocument}
66
- deleteMutation={deleteFacetDocument}
67
66
  defaultVisibility={{
68
67
  name: true,
69
68
  isPrivate: true,
@@ -12,7 +12,7 @@ import {
12
12
  DeletePaymentMethodsBulkAction,
13
13
  RemovePaymentMethodsFromChannelBulkAction,
14
14
  } from './components/payment-method-bulk-actions.js';
15
- import { deletePaymentMethodDocument, paymentMethodListQuery } from './payment-methods.graphql.js';
15
+ import { paymentMethodListQuery } from './payment-methods.graphql.js';
16
16
 
17
17
  export const Route = createFileRoute('/_authenticated/_payment-methods/payment-methods')({
18
18
  component: PaymentMethodListPage,
@@ -24,7 +24,6 @@ function PaymentMethodListPage() {
24
24
  <ListPage
25
25
  pageId="payment-method-list"
26
26
  listQuery={paymentMethodListQuery}
27
- deleteMutation={deletePaymentMethodDocument}
28
27
  route={Route}
29
28
  title="Payment Methods"
30
29
  defaultVisibility={{
@@ -11,7 +11,7 @@ import {
11
11
  DeleteProductVariantsBulkAction,
12
12
  RemoveProductVariantsFromChannelBulkAction,
13
13
  } from './components/product-variant-bulk-actions.js';
14
- import { deleteProductVariantDocument, productVariantListDocument } from './product-variants.graphql.js';
14
+ import { productVariantListDocument } from './product-variants.graphql.js';
15
15
 
16
16
  export const Route = createFileRoute('/_authenticated/_product-variants/product-variants')({
17
17
  component: ProductListPage,
@@ -25,7 +25,6 @@ function ProductListPage() {
25
25
  pageId="product-variant-list"
26
26
  title={<Trans>Product Variants</Trans>}
27
27
  listQuery={productVariantListDocument}
28
- deleteMutation={deleteProductVariantDocument}
29
28
  bulkActions={[
30
29
  {
31
30
  component: AssignProductVariantsToChannelBulkAction,
@@ -13,7 +13,7 @@ import {
13
13
  DuplicateProductsBulkAction,
14
14
  RemoveProductsFromChannelBulkAction,
15
15
  } from './components/product-bulk-actions.js';
16
- import { deleteProductDocument, productListDocument } from './products.graphql.js';
16
+ import { productListDocument } from './products.graphql.js';
17
17
 
18
18
  export const Route = createFileRoute('/_authenticated/_products/products')({
19
19
  component: ProductListPage,
@@ -25,7 +25,6 @@ function ProductListPage() {
25
25
  <ListPage
26
26
  pageId="product-list"
27
27
  listQuery={productListDocument}
28
- deleteMutation={deleteProductDocument}
29
28
  title="Products"
30
29
  customizeColumns={{
31
30
  name: {
@@ -13,7 +13,7 @@ import {
13
13
  DuplicatePromotionsBulkAction,
14
14
  RemovePromotionsFromChannelBulkAction,
15
15
  } from './components/promotion-bulk-actions.js';
16
- import { deletePromotionDocument, promotionListDocument } from './promotions.graphql.js';
16
+ import { promotionListDocument } from './promotions.graphql.js';
17
17
 
18
18
  export const Route = createFileRoute('/_authenticated/_promotions/promotions')({
19
19
  component: PromotionListPage,
@@ -25,7 +25,6 @@ function PromotionListPage() {
25
25
  <ListPage
26
26
  pageId="promotion-list"
27
27
  listQuery={promotionListDocument}
28
- deleteMutation={deletePromotionDocument}
29
28
  route={Route}
30
29
  title="Promotions"
31
30
  defaultVisibility={{
@@ -12,7 +12,7 @@ import { createFileRoute, Link } from '@tanstack/react-router';
12
12
  import { LayersIcon, PlusIcon } from 'lucide-react';
13
13
  import { ExpandablePermissions } from './components/expandable-permissions.js';
14
14
  import { DeleteRolesBulkAction } from './components/role-bulk-actions.js';
15
- import { deleteRoleDocument, roleListQuery } from './roles.graphql.js';
15
+ import { roleListQuery } from './roles.graphql.js';
16
16
 
17
17
  export const Route = createFileRoute('/_authenticated/_roles/roles')({
18
18
  component: RoleListPage,
@@ -27,7 +27,6 @@ function RoleListPage() {
27
27
  pageId="role-list"
28
28
  title="Roles"
29
29
  listQuery={roleListQuery}
30
- deleteMutation={deleteRoleDocument}
31
30
  route={Route}
32
31
  defaultVisibility={{
33
32
  description: true,
@@ -7,7 +7,7 @@ import { Trans } from '@/vdb/lib/trans.js';
7
7
  import { createFileRoute, Link } from '@tanstack/react-router';
8
8
  import { PlusIcon } from 'lucide-react';
9
9
  import { DeleteSellersBulkAction } from './components/seller-bulk-actions.js';
10
- import { deleteSellerDocument, sellerListQuery } from './sellers.graphql.js';
10
+ import { sellerListQuery } from './sellers.graphql.js';
11
11
 
12
12
  export const Route = createFileRoute('/_authenticated/_sellers/sellers')({
13
13
  component: SellerListPage,
@@ -19,7 +19,6 @@ function SellerListPage() {
19
19
  <ListPage
20
20
  pageId="seller-list"
21
21
  listQuery={sellerListQuery}
22
- deleteMutation={deleteSellerDocument}
23
22
  route={Route}
24
23
  title="Sellers"
25
24
  defaultVisibility={{
@@ -12,7 +12,7 @@ import {
12
12
  RemoveShippingMethodsFromChannelBulkAction,
13
13
  } from './components/shipping-method-bulk-actions.js';
14
14
  import { TestShippingMethodDialog } from './components/test-shipping-method-dialog.js';
15
- import { deleteShippingMethodDocument, shippingMethodListQuery } from './shipping-methods.graphql.js';
15
+ import { shippingMethodListQuery } from './shipping-methods.graphql.js';
16
16
 
17
17
  export const Route = createFileRoute('/_authenticated/_shipping-methods/shipping-methods')({
18
18
  component: ShippingMethodListPage,
@@ -24,7 +24,6 @@ function ShippingMethodListPage() {
24
24
  <ListPage
25
25
  pageId="shipping-method-list"
26
26
  listQuery={shippingMethodListQuery}
27
- deleteMutation={deleteShippingMethodDocument}
28
27
  route={Route}
29
28
  title="Shipping Methods"
30
29
  defaultVisibility={{
@@ -11,7 +11,7 @@ import {
11
11
  DeleteStockLocationsBulkAction,
12
12
  RemoveStockLocationsFromChannelBulkAction,
13
13
  } from './components/stock-location-bulk-actions.js';
14
- import { deleteStockLocationDocument, stockLocationListQuery } from './stock-locations.graphql.js';
14
+ import { stockLocationListQuery } from './stock-locations.graphql.js';
15
15
 
16
16
  export const Route = createFileRoute('/_authenticated/_stock-locations/stock-locations')({
17
17
  component: StockLocationListPage,
@@ -24,7 +24,6 @@ function StockLocationListPage() {
24
24
  pageId="stock-location-list"
25
25
  title="Stock Locations"
26
26
  listQuery={stockLocationListQuery}
27
- deleteMutation={deleteStockLocationDocument}
28
27
  route={Route}
29
28
  customizeColumns={{
30
29
  name: {
@@ -8,7 +8,7 @@ import { Trans } from '@/vdb/lib/trans.js';
8
8
  import { createFileRoute, Link } from '@tanstack/react-router';
9
9
  import { PlusIcon } from 'lucide-react';
10
10
  import { DeleteTaxCategoriesBulkAction } from './components/tax-category-bulk-actions.js';
11
- import { deleteTaxCategoryDocument, taxCategoryListQuery } from './tax-categories.graphql.js';
11
+ import { taxCategoryListQuery } from './tax-categories.graphql.js';
12
12
 
13
13
  export const Route = createFileRoute('/_authenticated/_tax-categories/tax-categories')({
14
14
  component: TaxCategoryListPage,
@@ -20,7 +20,6 @@ function TaxCategoryListPage() {
20
20
  <ListPage
21
21
  pageId="tax-category-list"
22
22
  listQuery={taxCategoryListQuery}
23
- deleteMutation={deleteTaxCategoryDocument}
24
23
  route={Route}
25
24
  title="Tax Categories"
26
25
  defaultVisibility={{
@@ -11,7 +11,7 @@ import { PlusIcon } from 'lucide-react';
11
11
  import { taxCategoryListQuery } from '../_tax-categories/tax-categories.graphql.js';
12
12
  import { zoneListQuery } from '../_zones/zones.graphql.js';
13
13
  import { DeleteTaxRatesBulkAction } from './components/tax-rate-bulk-actions.js';
14
- import { deleteTaxRateDocument, taxRateListQuery } from './tax-rates.graphql.js';
14
+ import { taxRateListQuery } from './tax-rates.graphql.js';
15
15
 
16
16
  export const Route = createFileRoute('/_authenticated/_tax-rates/tax-rates')({
17
17
  component: TaxRateListPage,
@@ -23,7 +23,6 @@ function TaxRateListPage() {
23
23
  <ListPage
24
24
  pageId="tax-rate-list"
25
25
  listQuery={taxRateListQuery}
26
- deleteMutation={deleteTaxRateDocument}
27
26
  route={Route}
28
27
  title="Tax Rates"
29
28
  defaultVisibility={{
@@ -8,7 +8,7 @@ import { createFileRoute, Link } from '@tanstack/react-router';
8
8
  import { PlusIcon } from 'lucide-react';
9
9
  import { DeleteZonesBulkAction } from './components/zone-bulk-actions.js';
10
10
  import { ZoneCountriesSheet } from './components/zone-countries-sheet.js';
11
- import { deleteZoneDocument, zoneListQuery } from './zones.graphql.js';
11
+ import { zoneListQuery } from './zones.graphql.js';
12
12
 
13
13
  export const Route = createFileRoute('/_authenticated/_zones/zones')({
14
14
  component: ZoneListPage,
@@ -20,7 +20,6 @@ function ZoneListPage() {
20
20
  <ListPage
21
21
  pageId="zone-list"
22
22
  listQuery={zoneListQuery}
23
- deleteMutation={deleteZoneDocument}
24
23
  route={Route}
25
24
  title="Zones"
26
25
  defaultVisibility={{
@@ -1,5 +1,4 @@
1
- 'use client';
2
-
1
+ import { useAllBulkActions } from '@/vdb/components/data-table/use-all-bulk-actions.js';
3
2
  import { Button } from '@/vdb/components/ui/button.js';
4
3
  import {
5
4
  DropdownMenu,
@@ -7,11 +6,8 @@ import {
7
6
  DropdownMenuItem,
8
7
  DropdownMenuTrigger,
9
8
  } from '@/vdb/components/ui/dropdown-menu.js';
10
- import { getBulkActions } from '@/vdb/framework/data-table/data-table-extensions.js';
11
9
  import { BulkAction } from '@/vdb/framework/extension-api/types/index.js';
12
10
  import { useFloatingBulkActions } from '@/vdb/hooks/use-floating-bulk-actions.js';
13
- import { usePageBlock } from '@/vdb/hooks/use-page-block.js';
14
- import { usePage } from '@/vdb/hooks/use-page.js';
15
11
  import { Trans } from '@/vdb/lib/trans.js';
16
12
  import { Table } from '@tanstack/react-table';
17
13
  import { ChevronDown } from 'lucide-react';
@@ -26,9 +22,7 @@ export function DataTableBulkActions<TData>({
26
22
  table,
27
23
  bulkActions,
28
24
  }: Readonly<DataTableBulkActionsProps<TData>>) {
29
- const { pageId } = usePage();
30
- const pageBlock = usePageBlock();
31
- const blockId = pageBlock?.blockId;
25
+ const allBulkActions = useAllBulkActions(bulkActions);
32
26
 
33
27
  // Cache to store selected items across page changes
34
28
  const selectedItemsCache = useRef<Map<string, TData>>(new Map());
@@ -63,18 +57,15 @@ export function DataTableBulkActions<TData>({
63
57
  if (!shouldShow) {
64
58
  return null;
65
59
  }
66
- const extendedBulkActions = pageId ? getBulkActions(pageId, blockId) : [];
67
- const allBulkActions = [...extendedBulkActions, ...(bulkActions ?? [])];
68
- allBulkActions.sort((a, b) => (a.order ?? 10_000) - (b.order ?? 10_000));
69
60
 
70
61
  return (
71
62
  <div
72
63
  className="flex items-center gap-4 px-8 py-2 animate-in fade-in duration-200 fixed transform -translate-x-1/2 bg-white shadow-2xl rounded-md border z-50"
73
- style={{
74
- height: 'auto',
64
+ style={{
65
+ height: 'auto',
75
66
  maxHeight: '60px',
76
67
  bottom: position.bottom,
77
- left: position.left
68
+ left: position.left,
78
69
  }}
79
70
  >
80
71
  <span className="text-sm text-muted-foreground">
@@ -0,0 +1,19 @@
1
+ import { getBulkActions } from '@/vdb/framework/data-table/data-table-extensions.js';
2
+ import { BulkAction } from '@/vdb/framework/extension-api/types/index.js';
3
+ import { usePageBlock } from '@/vdb/hooks/use-page-block.js';
4
+ import { usePage } from '@/vdb/hooks/use-page.js';
5
+
6
+ /**
7
+ * @description
8
+ * Augments the provided Bulk Actions with any user-defined actions for the current
9
+ * page & block, and returns all of the bulk actions sorted by the `order` property.
10
+ */
11
+ export function useAllBulkActions(bulkActions: BulkAction[]): BulkAction[] {
12
+ const { pageId } = usePage();
13
+ const pageBlock = usePageBlock();
14
+ const blockId = pageBlock?.blockId;
15
+ const extendedBulkActions = pageId ? getBulkActions(pageId, blockId) : [];
16
+ const allBulkActions = [...extendedBulkActions, ...(bulkActions ?? [])];
17
+ allBulkActions.sort((a, b) => (a.order ?? 10_000) - (b.order ?? 10_000));
18
+ return allBulkActions;
19
+ }