@vendure/dashboard 3.2.3 → 3.3.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/dist/plugin/utils/ast-utils.d.ts +10 -0
- package/dist/plugin/utils/ast-utils.js +96 -0
- package/dist/plugin/utils/ast-utils.spec.d.ts +1 -0
- package/dist/plugin/utils/ast-utils.spec.js +120 -0
- package/dist/plugin/{config-loader.d.ts → utils/config-loader.d.ts} +22 -8
- package/dist/plugin/utils/config-loader.js +325 -0
- package/dist/plugin/{schema-generator.d.ts → utils/schema-generator.d.ts} +5 -0
- package/dist/plugin/{schema-generator.js → utils/schema-generator.js} +7 -1
- package/dist/plugin/{ui-config.js → utils/ui-config.js} +2 -3
- package/dist/plugin/vite-plugin-admin-api-schema.js +2 -2
- package/dist/plugin/vite-plugin-config-loader.d.ts +2 -3
- package/dist/plugin/vite-plugin-config-loader.js +18 -9
- package/dist/plugin/vite-plugin-config.js +4 -6
- package/dist/plugin/vite-plugin-dashboard-metadata.js +12 -14
- package/dist/plugin/vite-plugin-gql-tada.js +2 -2
- package/dist/plugin/vite-plugin-ui-config.js +3 -2
- package/package.json +16 -11
- package/src/app/app-providers.tsx +9 -9
- package/src/app/main.tsx +1 -1
- package/src/app/routes/_authenticated/_assets/assets.graphql.ts +26 -0
- package/src/app/routes/_authenticated/_assets/assets.tsx +2 -2
- package/src/app/routes/_authenticated/_assets/assets_.$id.tsx +156 -0
- package/src/app/routes/_authenticated/_orders/components/customer-address-selector.tsx +104 -0
- package/src/app/routes/_authenticated/_orders/components/edit-order-table.tsx +228 -0
- package/src/app/routes/_authenticated/_orders/components/money-gross-net.tsx +18 -0
- package/src/app/routes/_authenticated/_orders/components/order-address.tsx +2 -1
- package/src/app/routes/_authenticated/_orders/components/order-line-custom-fields-form.tsx +38 -0
- package/src/app/routes/_authenticated/_orders/components/order-table-totals.tsx +53 -0
- package/src/app/routes/_authenticated/_orders/components/order-table.tsx +8 -49
- package/src/app/routes/_authenticated/_orders/components/shipping-method-selector.tsx +65 -0
- package/src/app/routes/_authenticated/_orders/orders.graphql.ts +187 -2
- package/src/app/routes/_authenticated/_orders/orders.tsx +39 -18
- package/src/app/routes/_authenticated/_orders/orders_.$id.tsx +31 -9
- package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +418 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +8 -2
- package/src/app/routes/_authenticated/_products/products.tsx +1 -1
- package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +6 -0
- package/src/app/routes/_authenticated/_system/job-queue.tsx +7 -8
- package/src/app/routes/_authenticated/_system/scheduled-tasks.tsx +241 -0
- package/src/app/routes/_authenticated.tsx +12 -1
- package/src/app/styles.css +15 -0
- package/src/lib/components/data-table/add-filter-menu.tsx +61 -0
- package/src/lib/components/data-table/data-table-column-header.tsx +0 -13
- package/src/lib/components/data-table/data-table-filter-badge.tsx +75 -0
- package/src/lib/components/data-table/data-table-filter-dialog.tsx +27 -28
- package/src/lib/components/data-table/data-table-types.ts +1 -0
- package/src/lib/components/data-table/data-table-view-options.tsx +73 -24
- package/src/lib/components/data-table/data-table.tsx +49 -44
- package/src/lib/components/data-table/filters/data-table-boolean-filter.tsx +57 -0
- package/src/lib/components/data-table/filters/data-table-datetime-filter.tsx +93 -0
- package/src/lib/components/data-table/filters/data-table-id-filter.tsx +58 -0
- package/src/lib/components/data-table/filters/data-table-number-filter.tsx +119 -0
- package/src/lib/components/data-table/filters/data-table-string-filter.tsx +62 -0
- package/src/lib/components/data-table/human-readable-operator.tsx +65 -0
- package/src/lib/components/data-table/refresh-button.tsx +25 -0
- package/src/lib/components/layout/nav-user.tsx +20 -15
- package/src/lib/components/layout/prerelease-popup.tsx +1 -5
- package/src/lib/components/shared/alerts.tsx +19 -1
- package/src/lib/components/shared/asset/asset-focal-point-editor.tsx +93 -0
- package/src/lib/components/shared/{asset-gallery.tsx → asset/asset-gallery.tsx} +51 -20
- package/src/lib/components/shared/{asset-picker-dialog.tsx → asset/asset-picker-dialog.tsx} +1 -1
- package/src/lib/components/shared/{asset-preview-dialog.tsx → asset/asset-preview-dialog.tsx} +1 -7
- package/src/lib/components/shared/asset/asset-preview-selector.tsx +34 -0
- package/src/lib/components/shared/asset/asset-preview.tsx +128 -0
- package/src/lib/components/shared/asset/asset-properties.tsx +46 -0
- package/src/lib/components/shared/{focal-point-control.tsx → asset/focal-point-control.tsx} +1 -1
- package/src/lib/components/shared/custom-fields-form.tsx +4 -3
- package/src/lib/components/shared/customer-selector.tsx +13 -14
- package/src/lib/components/shared/detail-page-button.tsx +2 -2
- package/src/lib/components/shared/entity-assets.tsx +3 -3
- package/src/lib/components/shared/error-page.tsx +2 -2
- package/src/lib/components/shared/navigation-confirmation.tsx +49 -0
- package/src/lib/components/shared/paginated-list-data-table.tsx +10 -1
- package/src/lib/components/shared/product-variant-selector.tsx +111 -0
- package/src/lib/components/shared/vendure-image.tsx +1 -1
- package/src/lib/components/ui/calendar.tsx +508 -63
- package/src/lib/framework/alert/alert-extensions.tsx +31 -0
- package/src/lib/framework/alert/alert-item.tsx +47 -0
- package/src/lib/framework/alert/alerts-indicator.tsx +23 -0
- package/src/lib/framework/alert/types.ts +13 -0
- package/src/lib/framework/dashboard-widget/base-widget.tsx +1 -0
- package/src/lib/framework/defaults.ts +34 -0
- package/src/lib/framework/document-introspection/get-document-structure.spec.ts +113 -3
- package/src/lib/framework/document-introspection/get-document-structure.ts +71 -13
- package/src/lib/framework/extension-api/define-dashboard-extension.ts +15 -5
- package/src/lib/framework/extension-api/extension-api-types.ts +81 -12
- package/src/lib/framework/form-engine/use-generated-form.tsx +8 -7
- package/src/lib/framework/layout-engine/layout-extensions.ts +3 -3
- package/src/lib/framework/layout-engine/page-layout.tsx +196 -35
- package/src/lib/framework/layout-engine/page-provider.tsx +10 -0
- package/src/lib/framework/page/detail-page.tsx +62 -9
- package/src/lib/framework/page/list-page.tsx +42 -4
- package/src/lib/framework/page/page-api.ts +1 -1
- package/src/lib/framework/page/use-detail-page.ts +82 -0
- package/src/lib/framework/registry/registry-types.ts +6 -2
- package/src/lib/graphql/fragments.tsx +8 -0
- package/src/lib/graphql/graphql-env.d.ts +25 -9
- package/src/lib/hooks/use-auth.tsx +13 -1
- package/src/lib/hooks/use-channel.ts +13 -0
- package/src/lib/hooks/use-local-format.ts +28 -1
- package/src/lib/hooks/use-page.tsx +2 -3
- package/src/lib/hooks/use-permissions.ts +13 -0
- package/src/lib/index.ts +7 -8
- package/src/lib/providers/auth.tsx +22 -9
- package/src/lib/providers/channel-provider.tsx +9 -1
- package/src/lib/providers/server-config.tsx +7 -1
- package/src/lib/providers/user-settings.tsx +24 -0
- package/vite/utils/ast-utils.spec.ts +128 -0
- package/vite/utils/ast-utils.ts +119 -0
- package/vite/utils/config-loader.ts +410 -0
- package/vite/{schema-generator.ts → utils/schema-generator.ts} +11 -6
- package/vite/{ui-config.ts → utils/ui-config.ts} +7 -3
- package/vite/vite-plugin-admin-api-schema.ts +2 -12
- package/vite/vite-plugin-config-loader.ts +25 -13
- package/vite/vite-plugin-config.ts +1 -0
- package/vite/vite-plugin-dashboard-metadata.ts +19 -15
- package/vite/vite-plugin-gql-tada.ts +2 -2
- package/vite/vite-plugin-ui-config.ts +3 -2
- package/dist/plugin/config-loader.js +0 -141
- package/src/lib/components/shared/asset-preview.tsx +0 -345
- package/src/lib/components/ui/avatar.tsx +0 -38
- package/vite/config-loader.ts +0 -181
- /package/dist/plugin/{ui-config.d.ts → utils/ui-config.d.ts} +0 -0
|
@@ -26,6 +26,14 @@ type RemoveNullFields<T> = {
|
|
|
26
26
|
[K in keyof T]: RemoveNull<T[K]>;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @description
|
|
31
|
+
* **Status: Developer Preview**
|
|
32
|
+
*
|
|
33
|
+
* @docsCategory hooks
|
|
34
|
+
* @docsPage useDetailPage
|
|
35
|
+
* @since 3.3.0
|
|
36
|
+
*/
|
|
29
37
|
export interface DetailPageOptions<
|
|
30
38
|
T extends TypedDocumentNode<any, any>,
|
|
31
39
|
C extends TypedDocumentNode<any, any>,
|
|
@@ -114,6 +122,14 @@ export type DetailPageEntity<
|
|
|
114
122
|
translations: DetailPageTranslations<T, EntityField>;
|
|
115
123
|
};
|
|
116
124
|
|
|
125
|
+
/**
|
|
126
|
+
* @description
|
|
127
|
+
* **Status: Developer Preview**
|
|
128
|
+
*
|
|
129
|
+
* @docsCategory hooks
|
|
130
|
+
* @docsPage useDetailPage
|
|
131
|
+
* @since 3.3.0
|
|
132
|
+
*/
|
|
117
133
|
export interface UseDetailPageResult<
|
|
118
134
|
T extends TypedDocumentNode<any, any>,
|
|
119
135
|
C extends TypedDocumentNode<any, any>,
|
|
@@ -130,8 +146,72 @@ export interface UseDetailPageResult<
|
|
|
130
146
|
|
|
131
147
|
/**
|
|
132
148
|
* @description
|
|
149
|
+
* **Status: Developer Preview**
|
|
150
|
+
*
|
|
133
151
|
* This hook is used to create an entity detail page which can read
|
|
134
152
|
* and update an entity.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* const { form, submitHandler, entity, isPending, resetForm } = useDetailPage({
|
|
157
|
+
* queryDocument: paymentMethodDetailDocument,
|
|
158
|
+
* createDocument: createPaymentMethodDocument,
|
|
159
|
+
* updateDocument: updatePaymentMethodDocument,
|
|
160
|
+
* setValuesForUpdate: entity => {
|
|
161
|
+
* return {
|
|
162
|
+
* id: entity.id,
|
|
163
|
+
* enabled: entity.enabled,
|
|
164
|
+
* name: entity.name,
|
|
165
|
+
* code: entity.code,
|
|
166
|
+
* description: entity.description,
|
|
167
|
+
* checker: entity.checker?.code
|
|
168
|
+
* ? {
|
|
169
|
+
* code: entity.checker?.code,
|
|
170
|
+
* arguments: entity.checker?.args,
|
|
171
|
+
* }
|
|
172
|
+
* : null,
|
|
173
|
+
* handler: entity.handler?.code
|
|
174
|
+
* ? {
|
|
175
|
+
* code: entity.handler?.code,
|
|
176
|
+
* arguments: entity.handler?.args,
|
|
177
|
+
* }
|
|
178
|
+
* : null,
|
|
179
|
+
* translations: entity.translations.map(translation => ({
|
|
180
|
+
* id: translation.id,
|
|
181
|
+
* languageCode: translation.languageCode,
|
|
182
|
+
* name: translation.name,
|
|
183
|
+
* description: translation.description,
|
|
184
|
+
* })),
|
|
185
|
+
* customFields: entity.customFields,
|
|
186
|
+
* };
|
|
187
|
+
* },
|
|
188
|
+
* transformCreateInput: input => {
|
|
189
|
+
* return {
|
|
190
|
+
* ...input,
|
|
191
|
+
* checker: input.checker?.code ? input.checker : undefined,
|
|
192
|
+
* handler: input.handler,
|
|
193
|
+
* };
|
|
194
|
+
* },
|
|
195
|
+
* params: { id: params.id },
|
|
196
|
+
* onSuccess: async data => {
|
|
197
|
+
* toast.success(i18n.t('Successfully updated payment method'));
|
|
198
|
+
* resetForm();
|
|
199
|
+
* if (creatingNewEntity) {
|
|
200
|
+
* await navigate({ to: `../$id`, params: { id: data.id } });
|
|
201
|
+
* }
|
|
202
|
+
* },
|
|
203
|
+
* onError: err => {
|
|
204
|
+
* toast.error(i18n.t('Failed to update payment method'), {
|
|
205
|
+
* description: err instanceof Error ? err.message : 'Unknown error',
|
|
206
|
+
* });
|
|
207
|
+
* },
|
|
208
|
+
* });
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* @docsCategory hooks
|
|
212
|
+
* @docsPage useDetailPage
|
|
213
|
+
* @docsWeight 0
|
|
214
|
+
* @since 3.3.0
|
|
135
215
|
*/
|
|
136
216
|
export function useDetailPage<
|
|
137
217
|
T extends TypedDocumentNode<any, any>,
|
|
@@ -178,6 +258,7 @@ export function useDetailPage<
|
|
|
178
258
|
onSuccess?.((data as any)[createMutationName]);
|
|
179
259
|
}
|
|
180
260
|
},
|
|
261
|
+
onError,
|
|
181
262
|
});
|
|
182
263
|
|
|
183
264
|
const updateMutation = useMutation({
|
|
@@ -195,6 +276,7 @@ export function useDetailPage<
|
|
|
195
276
|
const document = isNew ? (createDocument ?? updateDocument) : updateDocument;
|
|
196
277
|
const { form, submitHandler } = useGeneratedForm({
|
|
197
278
|
document,
|
|
279
|
+
varName: 'input',
|
|
198
280
|
entity,
|
|
199
281
|
setValues: setValuesForUpdate,
|
|
200
282
|
onSubmit(values: any) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { DashboardAlertDefinition } from '../alert/types.js';
|
|
1
2
|
import { DashboardWidgetDefinition } from '../dashboard-widget/types.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
3
|
+
import {
|
|
4
|
+
DashboardActionBarItem,
|
|
5
|
+
DashboardPageBlockDefinition,
|
|
6
|
+
} from '../extension-api/extension-api-types.js';
|
|
4
7
|
import { NavMenuConfig } from '../nav-menu/nav-menu-extensions.js';
|
|
5
8
|
|
|
6
9
|
export interface GlobalRegistryContents {
|
|
@@ -10,6 +13,7 @@ export interface GlobalRegistryContents {
|
|
|
10
13
|
dashboardActionBarItemRegistry: Map<string, DashboardActionBarItem[]>;
|
|
11
14
|
dashboardPageBlockRegistry: Map<string, DashboardPageBlockDefinition[]>;
|
|
12
15
|
dashboardWidgetRegistry: Map<string, DashboardWidgetDefinition>;
|
|
16
|
+
dashboardAlertRegistry: Map<string, DashboardAlertDefinition>;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export type GlobalRegistryKey = keyof GlobalRegistryContents;
|
|
@@ -51,4 +51,12 @@ export const configurableOperationDefFragment = graphql(`
|
|
|
51
51
|
}
|
|
52
52
|
`);
|
|
53
53
|
|
|
54
|
+
export const errorResultFragment = graphql(`
|
|
55
|
+
fragment ErrorResult on ErrorResult {
|
|
56
|
+
errorCode
|
|
57
|
+
message
|
|
58
|
+
}
|
|
59
|
+
`);
|
|
60
|
+
|
|
61
|
+
|
|
54
62
|
export type ConfigurableOperationDefFragment = ResultOf<typeof configurableOperationDefFragment>;
|