@vendure/dashboard 3.3.8 → 3.4.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 +62 -0
- package/dist/plugin/api/api-extensions.d.ts +1 -0
- package/dist/plugin/api/api-extensions.js +38 -0
- package/dist/plugin/api/metrics.resolver.d.ts +8 -0
- package/dist/plugin/api/metrics.resolver.js +40 -0
- package/dist/plugin/config/metrics-strategies.d.ts +39 -0
- package/dist/plugin/config/metrics-strategies.js +74 -0
- package/dist/plugin/constants.d.ts +4 -3
- package/dist/plugin/constants.js +10 -277
- package/dist/plugin/dashboard.plugin.d.ts +95 -0
- package/dist/plugin/dashboard.plugin.js +168 -0
- package/dist/plugin/index.d.ts +2 -1
- package/dist/plugin/index.js +18 -1
- package/dist/plugin/package.json +3 -0
- package/dist/plugin/service/metrics.service.d.ts +15 -0
- package/dist/plugin/service/metrics.service.js +145 -0
- package/dist/plugin/types.d.ts +20 -37
- package/dist/plugin/types.js +13 -1
- package/dist/vite/constants.d.ts +5 -0
- package/dist/vite/constants.js +277 -0
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +1 -0
- package/dist/vite/types.d.ts +40 -0
- package/dist/vite/utils/config-loader.js +1 -0
- package/dist/{plugin → vite}/utils/plugin-discovery.js +1 -1
- package/dist/vite/utils/ui-config.d.ts +3 -0
- package/dist/vite/utils/ui-config.js +30 -0
- package/dist/vite/vite-plugin-ui-config.d.ts +123 -0
- package/dist/{plugin → vite}/vite-plugin-ui-config.js +3 -11
- package/dist/{plugin → vite}/vite-plugin-vendure-dashboard.js +1 -1
- package/index.html +1 -1
- package/package.json +16 -7
- package/src/app/app-providers.tsx +1 -1
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +1 -1
- package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +20 -35
- package/src/app/routes/_authenticated/_facets/facets.graphql.ts +40 -0
- package/src/app/routes/_authenticated/_facets/facets_.$facetId.values_.$id.tsx +147 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history.tsx +380 -33
- package/src/app/routes/_authenticated/_products/components/option-value-input.tsx +1 -1
- package/src/app/routes/_authenticated/_system/healthchecks.tsx +1 -1
- package/src/app/routes/_authenticated/_system/job-queue.tsx +1 -0
- package/src/app/routes/_authenticated/index.tsx +2 -2
- package/src/app/routes/_authenticated.tsx +1 -1
- package/src/lib/components/data-input/rich-text-input.tsx +14 -8
- package/src/lib/components/data-table/data-table-bulk-actions.tsx +17 -4
- package/src/lib/components/layout/app-layout.tsx +2 -7
- package/src/lib/components/layout/channel-switcher.tsx +166 -57
- package/src/lib/components/layout/dev-mode-indicator.tsx +18 -0
- package/src/lib/components/layout/language-dialog.tsx +2 -1
- package/src/lib/components/layout/manage-languages-dialog.tsx +77 -40
- package/src/lib/components/layout/nav-item-wrapper.tsx +107 -0
- package/src/lib/components/layout/nav-main.tsx +196 -107
- package/src/lib/components/login/login-form.tsx +80 -45
- package/src/lib/components/shared/asset/asset-bulk-actions.tsx +19 -4
- package/src/lib/components/shared/asset/asset-gallery.tsx +2 -2
- package/src/lib/components/shared/detail-page-button.tsx +42 -0
- package/src/lib/components/shared/history-timeline/history-entry-date.tsx +37 -0
- package/src/lib/components/shared/history-timeline/history-entry.tsx +135 -65
- package/src/lib/components/shared/history-timeline/history-note-input.tsx +4 -4
- package/src/lib/components/shared/history-timeline/history-timeline.tsx +7 -54
- package/src/lib/components/shared/translatable-form-field.tsx +16 -2
- package/src/lib/framework/defaults.ts +4 -10
- package/src/lib/framework/extension-api/define-dashboard-extension.ts +4 -0
- package/src/lib/framework/extension-api/extension-api-types.ts +11 -2
- package/src/lib/framework/extension-api/logic/index.ts +1 -0
- package/src/lib/framework/extension-api/logic/login.ts +17 -0
- package/src/lib/framework/extension-api/logic/navigation.ts +1 -0
- package/src/lib/framework/extension-api/types/data-table.ts +12 -3
- package/src/lib/framework/extension-api/types/detail-forms.ts +13 -0
- package/src/lib/framework/extension-api/types/form-components.ts +11 -0
- package/src/lib/framework/extension-api/types/index.ts +1 -0
- package/src/lib/framework/extension-api/types/layout.ts +3 -6
- package/src/lib/framework/extension-api/types/login.ts +96 -0
- package/src/lib/framework/extension-api/types/navigation.ts +57 -0
- package/src/lib/framework/extension-api/types/widgets.ts +0 -4
- package/src/lib/framework/extension-api/use-login-extensions.ts +26 -0
- package/src/lib/framework/layout-engine/dev-mode-button.tsx +24 -0
- package/src/lib/framework/layout-engine/location-wrapper.tsx +5 -12
- package/src/lib/framework/registry/global-registry.ts +4 -0
- package/src/lib/framework/registry/registry-types.ts +2 -0
- package/src/lib/graphql/api.ts +25 -3
- package/src/lib/graphql/graphql-env.d.ts +28 -28
- package/src/lib/graphql/settings-store-operations.ts +17 -0
- package/src/lib/hooks/use-floating-bulk-actions.ts +82 -0
- package/src/lib/hooks/use-local-format.ts +20 -5
- package/src/lib/index.ts +2 -1
- package/src/lib/providers/channel-provider.tsx +13 -11
- package/src/lib/providers/user-settings.tsx +78 -3
- package/src/lib/virtual.d.ts +26 -2
- package/src/vite-env.d.ts +2 -0
- package/vite/utils/plugin-discovery.ts +1 -1
- package/vite/utils/ui-config.ts +30 -42
- package/vite/vite-plugin-ui-config.ts +119 -17
- package/vite/vite-plugin-vendure-dashboard.ts +1 -1
- package/dist/plugin/utils/ui-config.d.ts +0 -3
- package/dist/plugin/utils/ui-config.js +0 -34
- package/dist/plugin/vite-plugin-ui-config.d.ts +0 -15
- package/src/app/routes/_authenticated/_facets/components/add-facet-value-dialog.tsx +0 -146
- package/src/lib/components/shared/rich-text-editor.tsx +0 -0
- /package/dist/{plugin/utils/ast-utils.spec.d.ts → vite/types.js} +0 -0
- /package/dist/{plugin → vite}/utils/ast-utils.d.ts +0 -0
- /package/dist/{plugin → vite}/utils/ast-utils.js +0 -0
- /package/dist/{plugin/utils/config-loader.d.ts → vite/utils/ast-utils.spec.d.ts} +0 -0
- /package/dist/{plugin → vite}/utils/ast-utils.spec.js +0 -0
- /package/dist/{plugin → vite}/utils/compiler.d.ts +0 -0
- /package/dist/{plugin → vite}/utils/compiler.js +0 -0
- /package/dist/{plugin/utils/config-loader.js → vite/utils/config-loader.d.ts} +0 -0
- /package/dist/{plugin → vite}/utils/logger.d.ts +0 -0
- /package/dist/{plugin → vite}/utils/logger.js +0 -0
- /package/dist/{plugin → vite}/utils/plugin-discovery.d.ts +0 -0
- /package/dist/{plugin → vite}/utils/schema-generator.d.ts +0 -0
- /package/dist/{plugin → vite}/utils/schema-generator.js +0 -0
- /package/dist/{plugin → vite}/utils/tsconfig-utils.d.ts +0 -0
- /package/dist/{plugin → vite}/utils/tsconfig-utils.js +0 -0
- /package/dist/{plugin → vite}/vite-plugin-admin-api-schema.d.ts +0 -0
- /package/dist/{plugin → vite}/vite-plugin-admin-api-schema.js +0 -0
- /package/dist/{plugin → vite}/vite-plugin-config-loader.d.ts +0 -0
- /package/dist/{plugin → vite}/vite-plugin-config-loader.js +0 -0
- /package/dist/{plugin → vite}/vite-plugin-config.d.ts +0 -0
- /package/dist/{plugin → vite}/vite-plugin-config.js +0 -0
- /package/dist/{plugin → vite}/vite-plugin-dashboard-metadata.d.ts +0 -0
- /package/dist/{plugin → vite}/vite-plugin-dashboard-metadata.js +0 -0
- /package/dist/{plugin → vite}/vite-plugin-gql-tada.d.ts +0 -0
- /package/dist/{plugin → vite}/vite-plugin-gql-tada.js +0 -0
- /package/dist/{plugin → vite}/vite-plugin-tailwind-source.d.ts +0 -0
- /package/dist/{plugin → vite}/vite-plugin-tailwind-source.js +0 -0
- /package/dist/{plugin → vite}/vite-plugin-theme.d.ts +0 -0
- /package/dist/{plugin → vite}/vite-plugin-theme.js +0 -0
- /package/dist/{plugin → vite}/vite-plugin-transform-index.d.ts +0 -0
- /package/dist/{plugin → vite}/vite-plugin-transform-index.js +0 -0
- /package/dist/{plugin → vite}/vite-plugin-vendure-dashboard.d.ts +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { DetailPageButton } from '@/vdb/components/shared/detail-page-button.js';
|
|
1
2
|
import { PaginatedListDataTable } from '@/vdb/components/shared/paginated-list-data-table.js';
|
|
2
|
-
import { Button } from '@/vdb/components/ui/button.js';
|
|
3
|
-
import { Popover, PopoverContent, PopoverTrigger } from '@/vdb/components/ui/popover.js';
|
|
4
3
|
import { addCustomFields } from '@/vdb/framework/document-introspection/add-custom-fields.js';
|
|
5
4
|
import { graphql } from '@/vdb/graphql/graphql.js';
|
|
6
5
|
import { Trans } from '@/vdb/lib/trans.js';
|
|
6
|
+
import { Link } from '@tanstack/react-router';
|
|
7
|
+
import { Button } from '@/vdb/components/ui/button.js';
|
|
7
8
|
import { ColumnFiltersState, SortingState } from '@tanstack/react-table';
|
|
9
|
+
import { PlusIcon } from 'lucide-react';
|
|
8
10
|
import { useRef, useState } from 'react';
|
|
9
|
-
import { AddFacetValueDialog } from './add-facet-value-dialog.js';
|
|
10
|
-
import { EditFacetValue } from './edit-facet-value.js';
|
|
11
11
|
import { deleteFacetValuesDocument } from '../facets.graphql.js';
|
|
12
12
|
|
|
13
13
|
export const facetValueListDocument = graphql(`
|
|
@@ -82,41 +82,26 @@ export function FacetValuesTable({ facetId, registerRefresher }: Readonly<FacetV
|
|
|
82
82
|
},
|
|
83
83
|
};
|
|
84
84
|
}}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
header: '
|
|
88
|
-
cell: ({ row }) =>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<Trans>Edit</Trans>
|
|
96
|
-
</Button>
|
|
97
|
-
</PopoverTrigger>
|
|
98
|
-
<PopoverContent className="w-80">
|
|
99
|
-
<EditFacetValue
|
|
100
|
-
facetValueId={facetValue.id}
|
|
101
|
-
onSuccess={() => {
|
|
102
|
-
setOpen(false);
|
|
103
|
-
refreshRef.current?.();
|
|
104
|
-
}}
|
|
105
|
-
/>
|
|
106
|
-
</PopoverContent>
|
|
107
|
-
</Popover>
|
|
108
|
-
);
|
|
109
|
-
},
|
|
85
|
+
customizeColumns={{
|
|
86
|
+
name: {
|
|
87
|
+
header: 'Name',
|
|
88
|
+
cell: ({ row }) => (
|
|
89
|
+
<DetailPageButton
|
|
90
|
+
id={row.original.id}
|
|
91
|
+
label={row.original.name}
|
|
92
|
+
href={`/facets/${facetId}/values/${row.original.id}`}
|
|
93
|
+
/>
|
|
94
|
+
),
|
|
110
95
|
},
|
|
111
96
|
}}
|
|
112
97
|
/>
|
|
113
98
|
<div className="mt-4">
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
99
|
+
<Button asChild variant="outline">
|
|
100
|
+
<Link to="./values/new">
|
|
101
|
+
<PlusIcon />
|
|
102
|
+
<Trans>Add facet value</Trans>
|
|
103
|
+
</Link>
|
|
104
|
+
</Button>
|
|
120
105
|
</div>
|
|
121
106
|
</>
|
|
122
107
|
);
|
|
@@ -141,3 +141,43 @@ export const deleteFacetValuesDocument = graphql(`
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
`);
|
|
144
|
+
|
|
145
|
+
export const facetValueDetailDocument = graphql(`
|
|
146
|
+
query FacetValueDetail($id: ID!) {
|
|
147
|
+
facetValue(id: $id) {
|
|
148
|
+
id
|
|
149
|
+
createdAt
|
|
150
|
+
updatedAt
|
|
151
|
+
name
|
|
152
|
+
code
|
|
153
|
+
languageCode
|
|
154
|
+
translations {
|
|
155
|
+
id
|
|
156
|
+
languageCode
|
|
157
|
+
name
|
|
158
|
+
}
|
|
159
|
+
facet {
|
|
160
|
+
id
|
|
161
|
+
name
|
|
162
|
+
code
|
|
163
|
+
}
|
|
164
|
+
customFields
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
`);
|
|
168
|
+
|
|
169
|
+
export const createFacetValueDocument = graphql(`
|
|
170
|
+
mutation CreateFacetValue($input: CreateFacetValueInput!) {
|
|
171
|
+
createFacetValue(input: $input) {
|
|
172
|
+
id
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
`);
|
|
176
|
+
|
|
177
|
+
export const updateFacetValueDocument = graphql(`
|
|
178
|
+
mutation UpdateFacetValue($input: UpdateFacetValueInput!) {
|
|
179
|
+
updateFacetValue(input: $input) {
|
|
180
|
+
id
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
`);
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ErrorPage } from '@/vdb/components/shared/error-page.js';
|
|
2
|
+
import { FormFieldWrapper } from '@/vdb/components/shared/form-field-wrapper.js';
|
|
3
|
+
import { PermissionGuard } from '@/vdb/components/shared/permission-guard.js';
|
|
4
|
+
import { TranslatableFormFieldWrapper } from '@/vdb/components/shared/translatable-form-field.js';
|
|
5
|
+
import { Button } from '@/vdb/components/ui/button.js';
|
|
6
|
+
import { Input } from '@/vdb/components/ui/input.js';
|
|
7
|
+
import { NEW_ENTITY_PATH } from '@/vdb/constants.js';
|
|
8
|
+
import {
|
|
9
|
+
CustomFieldsPageBlock,
|
|
10
|
+
DetailFormGrid,
|
|
11
|
+
Page,
|
|
12
|
+
PageActionBar,
|
|
13
|
+
PageActionBarRight,
|
|
14
|
+
PageBlock,
|
|
15
|
+
PageLayout,
|
|
16
|
+
PageTitle,
|
|
17
|
+
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
18
|
+
import { detailPageRouteLoader } from '@/vdb/framework/page/detail-page-route-loader.js';
|
|
19
|
+
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
20
|
+
import { Trans, useLingui } from '@/vdb/lib/trans.js';
|
|
21
|
+
import { createFileRoute, useNavigate } from '@tanstack/react-router';
|
|
22
|
+
import { toast } from 'sonner';
|
|
23
|
+
import {
|
|
24
|
+
createFacetValueDocument,
|
|
25
|
+
facetValueDetailDocument,
|
|
26
|
+
updateFacetValueDocument,
|
|
27
|
+
} from './facets.graphql.js';
|
|
28
|
+
import { PageBreadcrumb } from '@/vdb/components/layout/generated-breadcrumbs.js';
|
|
29
|
+
|
|
30
|
+
const pageId = 'facet-value-detail';
|
|
31
|
+
|
|
32
|
+
export const Route = createFileRoute('/_authenticated/_facets/facets_/$facetId/values_/$id')({
|
|
33
|
+
component: FacetValueDetailPage,
|
|
34
|
+
loader: detailPageRouteLoader({
|
|
35
|
+
pageId,
|
|
36
|
+
queryDocument: facetValueDetailDocument,
|
|
37
|
+
breadcrumb(isNew, entity) {
|
|
38
|
+
const facetName = entity?.facet.name ?? 'Facet Value';
|
|
39
|
+
const breadcrumb: PageBreadcrumb[] = [{ path: '/facets', label: 'Facets' }];
|
|
40
|
+
if (isNew) {
|
|
41
|
+
breadcrumb.push(<Trans>New facet value</Trans>);
|
|
42
|
+
} else if (entity) {
|
|
43
|
+
breadcrumb.push({ path: `/facets/${entity?.facet.id}`, label: facetName }, entity.name);
|
|
44
|
+
}
|
|
45
|
+
return breadcrumb;
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
errorComponent: ({ error }) => <ErrorPage message={error.message} />,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
function FacetValueDetailPage() {
|
|
52
|
+
const params = Route.useParams();
|
|
53
|
+
const navigate = useNavigate();
|
|
54
|
+
const creatingNewEntity = params.id === NEW_ENTITY_PATH;
|
|
55
|
+
const { i18n } = useLingui();
|
|
56
|
+
|
|
57
|
+
const { form, submitHandler, entity, isPending, resetForm } = useDetailPage({
|
|
58
|
+
pageId,
|
|
59
|
+
queryDocument: facetValueDetailDocument,
|
|
60
|
+
createDocument: createFacetValueDocument,
|
|
61
|
+
updateDocument: updateFacetValueDocument,
|
|
62
|
+
setValuesForUpdate: entity => {
|
|
63
|
+
return {
|
|
64
|
+
id: entity.id,
|
|
65
|
+
code: entity.code,
|
|
66
|
+
name: entity.name,
|
|
67
|
+
translations: entity.translations.map(translation => ({
|
|
68
|
+
id: translation.id,
|
|
69
|
+
languageCode: translation.languageCode,
|
|
70
|
+
name: translation.name,
|
|
71
|
+
customFields: (translation as any).customFields,
|
|
72
|
+
})),
|
|
73
|
+
customFields: entity.customFields as any,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
transformCreateInput: (value): any => {
|
|
77
|
+
return {
|
|
78
|
+
...value,
|
|
79
|
+
facetId: params.facetId,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
params: { id: params.id },
|
|
83
|
+
onSuccess: async data => {
|
|
84
|
+
toast(i18n.t('Successfully updated facet value'));
|
|
85
|
+
resetForm();
|
|
86
|
+
const created = Array.isArray(data) ? data[0] : data;
|
|
87
|
+
if (creatingNewEntity && created) {
|
|
88
|
+
await navigate({ to: `../$id`, params: { id: (created as any).id } });
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
onError: err => {
|
|
92
|
+
toast(i18n.t('Failed to update facet value'), {
|
|
93
|
+
description: err instanceof Error ? err.message : 'Unknown error',
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<Page pageId={pageId} form={form} submitHandler={submitHandler} entity={entity}>
|
|
100
|
+
<PageTitle>
|
|
101
|
+
{creatingNewEntity ? <Trans>New facet value</Trans> : ((entity as any)?.name ?? '')}
|
|
102
|
+
</PageTitle>
|
|
103
|
+
<PageActionBar>
|
|
104
|
+
<PageActionBarRight>
|
|
105
|
+
<PermissionGuard requires={['UpdateProduct', 'UpdateCatalog']}>
|
|
106
|
+
<Button
|
|
107
|
+
type="submit"
|
|
108
|
+
disabled={!form.formState.isDirty || !form.formState.isValid || isPending}
|
|
109
|
+
>
|
|
110
|
+
<Trans>Update</Trans>
|
|
111
|
+
</Button>
|
|
112
|
+
</PermissionGuard>
|
|
113
|
+
</PageActionBarRight>
|
|
114
|
+
</PageActionBar>
|
|
115
|
+
<PageLayout>
|
|
116
|
+
<PageBlock column="side" blockId="facet-info">
|
|
117
|
+
{entity?.facet && (
|
|
118
|
+
<div className="space-y-2">
|
|
119
|
+
<div className="text-sm font-medium">
|
|
120
|
+
<Trans>Facet</Trans>
|
|
121
|
+
</div>
|
|
122
|
+
<div className="text-sm text-muted-foreground">{entity?.facet.name}</div>
|
|
123
|
+
<div className="text-xs text-muted-foreground">{entity?.facet.code}</div>
|
|
124
|
+
</div>
|
|
125
|
+
)}
|
|
126
|
+
</PageBlock>
|
|
127
|
+
<PageBlock column="main" blockId="main-form">
|
|
128
|
+
<DetailFormGrid>
|
|
129
|
+
<TranslatableFormFieldWrapper
|
|
130
|
+
control={form.control}
|
|
131
|
+
name="name"
|
|
132
|
+
label={<Trans>Name</Trans>}
|
|
133
|
+
render={({ field }) => <Input {...field} />}
|
|
134
|
+
/>
|
|
135
|
+
<FormFieldWrapper
|
|
136
|
+
control={form.control}
|
|
137
|
+
name="code"
|
|
138
|
+
label={<Trans>Code</Trans>}
|
|
139
|
+
render={({ field }) => <Input {...field} />}
|
|
140
|
+
/>
|
|
141
|
+
</DetailFormGrid>
|
|
142
|
+
</PageBlock>
|
|
143
|
+
<CustomFieldsPageBlock column="main" entityType="FacetValue" control={form.control} />
|
|
144
|
+
</PageLayout>
|
|
145
|
+
</Page>
|
|
146
|
+
);
|
|
147
|
+
}
|