@vendure/dashboard 3.5.2-master-202512020233 → 3.5.2-master-202512170238
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/constants.js +2 -2
- package/dist/vite/constants.js +1 -0
- package/lingui.config.js +1 -0
- package/package.json +7 -7
- package/src/app/routeTree.gen.ts +1221 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/index.ts +0 -1
- package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/add-surcharge-form.tsx +139 -0
- package/src/app/routes/_authenticated/_orders/components/edit-order-table.tsx +3 -0
- package/src/app/routes/_authenticated/_orders/components/order-address.tsx +3 -3
- package/src/app/routes/_authenticated/_orders/components/order-modification-summary.tsx +49 -11
- package/src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx +9 -0
- package/src/app/routes/_authenticated/_orders/utils/use-modify-order.ts +23 -0
- package/src/app/routes/_authenticated/_product-variants/components/add-currency-dropdown.tsx +3 -3
- package/src/app/routes/_authenticated/_product-variants/components/add-stock-location-dropdown.tsx +2 -2
- package/src/app/routes/_authenticated/_products/products.graphql.ts +1 -0
- package/src/i18n/locales/bg.po +3436 -0
- package/src/lib/components/data-input/datetime-input.tsx +1 -1
- package/src/lib/components/data-input/relation-selector.tsx +1 -1
- package/src/lib/components/data-input/struct-form-input.tsx +175 -174
- package/src/lib/components/data-table/data-table.tsx +1 -0
- package/src/lib/components/layout/manage-languages-dialog.tsx +2 -25
- package/src/lib/components/shared/custom-fields-form.tsx +13 -8
- package/src/lib/components/ui/carousel.tsx +2 -2
- package/src/lib/components/ui/chart.tsx +1 -1
- package/src/lib/components/ui/context-menu.tsx +1 -1
- package/src/lib/components/ui/drawer.tsx +1 -1
- package/src/lib/components/ui/grid-layout.tsx +1 -1
- package/src/lib/components/ui/input-group.tsx +1 -0
- package/src/lib/components/ui/input-otp.tsx +1 -1
- package/src/lib/components/ui/menubar.tsx +1 -1
- package/src/lib/components/ui/navigation-menu.tsx +1 -1
- package/src/lib/components/ui/progress.tsx +1 -1
- package/src/lib/components/ui/radio-group.tsx +1 -1
- package/src/lib/components/ui/resizable.tsx +1 -1
- package/src/lib/components/ui/select.tsx +1 -1
- package/src/lib/components/ui/slider.tsx +1 -1
- package/src/lib/components/ui/toggle-group.tsx +2 -2
- package/src/lib/components/ui/toggle.tsx +1 -1
- package/src/lib/framework/component-registry/component-registry.tsx +2 -6
- package/src/lib/framework/extension-api/display-component-extensions.tsx +4 -3
- package/src/lib/framework/extension-api/logic/detail-forms.ts +0 -13
- package/src/lib/framework/extension-api/types/data-table.ts +4 -2
- package/src/lib/framework/extension-api/types/navigation.ts +2 -2
- package/src/lib/framework/form-engine/use-generated-form.tsx +7 -1
- package/src/lib/framework/layout-engine/page-layout.tsx +1 -1
- package/src/lib/framework/nav-menu/nav-menu-extensions.ts +1 -1
- package/src/lib/framework/page/detail-page-route-loader.tsx +1 -1
- package/src/lib/framework/page/page-api.ts +1 -1
- package/src/lib/framework/page/use-detail-page.ts +4 -2
- package/src/lib/framework/page/use-extended-router.tsx +20 -16
- package/src/lib/framework/registry/registry-types.ts +2 -1
- package/src/lib/graphql/graphql-env.d.ts +8 -12
- package/src/lib/providers/channel-provider.tsx +11 -7
- package/LICENSE.md +0 -42
- package/src/app/routes/_authenticated/_facets/components/edit-facet-value.tsx +0 -129
- /package/src/{app/routes/_authenticated/_global-settings → lib}/utils/global-languages.ts +0 -0
|
@@ -4,8 +4,8 @@ import * as React from "react"
|
|
|
4
4
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
|
|
5
5
|
import { type VariantProps } from "class-variance-authority"
|
|
6
6
|
|
|
7
|
-
import { cn } from "@/vdb/lib/utils"
|
|
8
|
-
import { toggleVariants } from "@/vdb/components/ui/toggle"
|
|
7
|
+
import { cn } from "@/vdb/lib/utils.js"
|
|
8
|
+
import { toggleVariants } from "@/vdb/components/ui/toggle.js"
|
|
9
9
|
|
|
10
10
|
const ToggleGroupContext = React.createContext<
|
|
11
11
|
VariantProps<typeof toggleVariants>
|
|
@@ -2,7 +2,7 @@ import * as React from "react"
|
|
|
2
2
|
import * as TogglePrimitive from "@radix-ui/react-toggle"
|
|
3
3
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
4
|
|
|
5
|
-
import { cn } from "@/vdb/lib/utils"
|
|
5
|
+
import { cn } from "@/vdb/lib/utils.js"
|
|
6
6
|
|
|
7
7
|
const toggleVariants = cva(
|
|
8
8
|
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { DashboardFormComponent } from '@/vdb/framework/form-engine/form-engine-types.js';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { getDisplayComponent } from '../extension-api/display-component-extensions.js';
|
|
4
4
|
import { getInputComponent } from '../extension-api/input-component-extensions.js';
|
|
5
5
|
|
|
6
|
-
export type
|
|
7
|
-
value: any;
|
|
8
|
-
} & T;
|
|
9
|
-
|
|
10
|
-
export type DataDisplayComponent = React.ComponentType<DataDisplayComponentProps>;
|
|
6
|
+
export type DataDisplayComponent<T extends Record<string, any> = Record<string, any>> = React.ComponentType<T & { value: any}>;
|
|
11
7
|
|
|
12
8
|
// Component registry hook that uses the global registry
|
|
13
9
|
export function useComponentRegistry() {
|
|
@@ -5,6 +5,7 @@ import { Money } from '@/vdb/components/data-display/money.js';
|
|
|
5
5
|
import { VendureImage } from '@/vdb/components/shared/vendure-image.js';
|
|
6
6
|
import { DataDisplayComponent } from '../component-registry/component-registry.js';
|
|
7
7
|
import { globalRegistry } from '../registry/global-registry.js';
|
|
8
|
+
import { DataTableDisplayComponent } from './types/data-table.js';
|
|
8
9
|
|
|
9
10
|
globalRegistry.register('displayComponents', new Map<string, DataDisplayComponent>());
|
|
10
11
|
|
|
@@ -21,7 +22,7 @@ displayComponents.set('vendure:money', Money);
|
|
|
21
22
|
displayComponents.set('vendure:json', Json);
|
|
22
23
|
|
|
23
24
|
export function getDisplayComponent(id: string): DataDisplayComponent | undefined {
|
|
24
|
-
return globalRegistry.get('displayComponents').get(id);
|
|
25
|
+
return globalRegistry.get('displayComponents').get(id) as DataDisplayComponent | undefined;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -42,10 +43,10 @@ export function addDisplayComponent({
|
|
|
42
43
|
pageId: string;
|
|
43
44
|
blockId: string;
|
|
44
45
|
field: string;
|
|
45
|
-
component:
|
|
46
|
+
component: DataDisplayComponent | DataTableDisplayComponent;
|
|
46
47
|
}) {
|
|
47
48
|
const displayComponents = globalRegistry.get('displayComponents');
|
|
48
|
-
|
|
49
|
+
|
|
49
50
|
// Generate the key using the helper function
|
|
50
51
|
const key = generateDisplayComponentKey(pageId, blockId, field);
|
|
51
52
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { addDetailQueryDocument } from '@/vdb/framework/form-engine/custom-form-component-extensions.js';
|
|
2
2
|
import { parse } from 'graphql';
|
|
3
3
|
|
|
4
|
-
import { addDisplayComponent } from '../display-component-extensions.js';
|
|
5
4
|
import { addInputComponent } from '../input-component-extensions.js';
|
|
6
5
|
import { DashboardDetailFormExtensionDefinition } from '../types/detail-forms.js';
|
|
7
6
|
|
|
@@ -31,18 +30,6 @@ export function registerDetailFormExtensions(detailForms?: DashboardDetailFormEx
|
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
// Register display components for this detail form
|
|
36
|
-
if (detailForm.displays) {
|
|
37
|
-
for (const displayComponent of detailForm.displays) {
|
|
38
|
-
addDisplayComponent({
|
|
39
|
-
pageId: detailForm.pageId,
|
|
40
|
-
blockId: displayComponent.blockId,
|
|
41
|
-
field: displayComponent.field,
|
|
42
|
-
component: displayComponent.component,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
33
|
}
|
|
47
34
|
}
|
|
48
35
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataDisplayComponent } from '@/vdb/framework/component-registry/component-registry.js';
|
|
2
2
|
import { Table } from '@tanstack/react-table';
|
|
3
3
|
import { CellContext } from '@tanstack/table-core';
|
|
4
4
|
import { DocumentNode } from 'graphql';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
+
export type DataTableDisplayComponent = DataDisplayComponent<CellContext<any, any>>;
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* @description
|
|
9
11
|
* Allows you to define custom display components for specific columns in data tables.
|
|
@@ -24,7 +26,7 @@ export interface DashboardDataTableDisplayComponent {
|
|
|
24
26
|
* The React component that will be rendered as the display.
|
|
25
27
|
* It should accept `value` and other standard display props.
|
|
26
28
|
*/
|
|
27
|
-
component:
|
|
29
|
+
component: DataTableDisplayComponent;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export type BulkActionContext<Item extends { id: string } & Record<string, any>> = {
|
|
@@ -39,7 +39,7 @@ export interface DashboardRouteDefinition {
|
|
|
39
39
|
* The value is a Tanstack Router
|
|
40
40
|
* [loader function](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#route-loaders)
|
|
41
41
|
*/
|
|
42
|
-
loader?: RouteOptions['loader'];
|
|
42
|
+
loader?: RouteOptions<any>['loader'];
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* @description
|
|
@@ -47,7 +47,7 @@ export interface DashboardRouteDefinition {
|
|
|
47
47
|
* The value is a Tanstack Router
|
|
48
48
|
* [validateSearch function](https://tanstack.com/router/latest/docs/framework/react/guide/search-params#search-param-validation)
|
|
49
49
|
*/
|
|
50
|
-
validateSearch?: RouteOptions['validateSearch'];
|
|
50
|
+
validateSearch?: RouteOptions<any>['validateSearch'];
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* @description
|
|
@@ -9,6 +9,10 @@ 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
|
+
export type WithLooseCustomFields<T> = T extends { customFields?: any }
|
|
13
|
+
? Omit<T, 'customFields'> & { customFields?: T['customFields'] | unknown }
|
|
14
|
+
: T;
|
|
15
|
+
|
|
12
16
|
/**
|
|
13
17
|
* @description
|
|
14
18
|
* Options for the useGeneratedForm hook.
|
|
@@ -40,7 +44,9 @@ export interface GeneratedFormOptions<
|
|
|
40
44
|
customFieldConfig?: any[]; // Add custom field config for validation
|
|
41
45
|
setValues: (
|
|
42
46
|
entity: NonNullable<E>,
|
|
43
|
-
) =>
|
|
47
|
+
) => WithLooseCustomFields<
|
|
48
|
+
VarName extends keyof VariablesOf<T> ? VariablesOf<T>[VarName] : VariablesOf<T>
|
|
49
|
+
>;
|
|
44
50
|
onSubmit?: (
|
|
45
51
|
values: VarName extends keyof VariablesOf<T> ? VariablesOf<T>[VarName] : VariablesOf<T>,
|
|
46
52
|
) => void;
|
|
@@ -547,7 +547,7 @@ export type PageBlockProps = {
|
|
|
547
547
|
* @description
|
|
548
548
|
* Which column this block should appear in
|
|
549
549
|
*/
|
|
550
|
-
column: 'main' | 'side';
|
|
550
|
+
column: 'main' | 'side' | 'full';
|
|
551
551
|
/**
|
|
552
552
|
* @description
|
|
553
553
|
* The ID of the block, e.g. "gift-cards" or "related-products".
|
|
@@ -29,7 +29,7 @@ export function detailPageRouteLoader<T extends TypedDocumentNode<any, any>>({
|
|
|
29
29
|
queryDocument,
|
|
30
30
|
breadcrumb,
|
|
31
31
|
}: DetailPageRouteLoaderConfig<T>) {
|
|
32
|
-
const loader: FileBaseRouteOptions<any, any>['loader'] = async ({
|
|
32
|
+
const loader: FileBaseRouteOptions<any, any, any>['loader'] = async ({
|
|
33
33
|
context,
|
|
34
34
|
params,
|
|
35
35
|
location,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
getMutationName,
|
|
23
23
|
getQueryName,
|
|
24
24
|
} from '../document-introspection/get-document-structure.js';
|
|
25
|
-
import { useGeneratedForm } from '../form-engine/use-generated-form.js';
|
|
25
|
+
import { useGeneratedForm, WithLooseCustomFields } from '../form-engine/use-generated-form.js';
|
|
26
26
|
|
|
27
27
|
import { DetailEntityPath } from './page-types.js';
|
|
28
28
|
|
|
@@ -95,7 +95,9 @@ export interface DetailPageOptions<
|
|
|
95
95
|
* @description
|
|
96
96
|
* The function to set the values for the update document.
|
|
97
97
|
*/
|
|
98
|
-
setValuesForUpdate: (
|
|
98
|
+
setValuesForUpdate: (
|
|
99
|
+
entity: NonNullable<ResultOf<T>[EntityField]>,
|
|
100
|
+
) => WithLooseCustomFields<VariablesOf<U>[VarNameUpdate]>;
|
|
99
101
|
transformCreateInput?: (input: VariablesOf<C>[VarNameCreate]) => VariablesOf<C>[VarNameCreate];
|
|
100
102
|
transformUpdateInput?: (input: VariablesOf<U>[VarNameUpdate]) => VariablesOf<U>[VarNameUpdate];
|
|
101
103
|
/**
|
|
@@ -21,10 +21,7 @@ export const useExtendedRouter = (
|
|
|
21
21
|
|
|
22
22
|
// Only extend if extensions are loaded
|
|
23
23
|
if (!extensionsLoaded) {
|
|
24
|
-
return
|
|
25
|
-
...routerOptions,
|
|
26
|
-
routeTree,
|
|
27
|
-
});
|
|
24
|
+
return createExtendedRouter(routerOptions, routeTree);
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
const authenticatedRouteIndex = routeTree.children.findIndex(
|
|
@@ -33,10 +30,7 @@ export const useExtendedRouter = (
|
|
|
33
30
|
|
|
34
31
|
if (authenticatedRouteIndex === -1) {
|
|
35
32
|
// No authenticated route found, return router with base tree
|
|
36
|
-
return
|
|
37
|
-
...routerOptions,
|
|
38
|
-
routeTree,
|
|
39
|
-
});
|
|
33
|
+
return createExtendedRouter(routerOptions, routeTree);
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
let authenticatedRoute: AnyRoute = routeTree.children[authenticatedRouteIndex];
|
|
@@ -106,10 +100,7 @@ export const useExtendedRouter = (
|
|
|
106
100
|
|
|
107
101
|
// Only extend the tree if we have new routes to add
|
|
108
102
|
if (newAuthenticatedRoutes.length === 0 && newRootRoutes.length === 0) {
|
|
109
|
-
return
|
|
110
|
-
...routerOptions,
|
|
111
|
-
routeTree,
|
|
112
|
-
});
|
|
103
|
+
return createExtendedRouter(routerOptions, routeTree);
|
|
113
104
|
}
|
|
114
105
|
|
|
115
106
|
const childrenWithoutAuthenticated = routeTree.children.filter(
|
|
@@ -127,9 +118,22 @@ export const useExtendedRouter = (
|
|
|
127
118
|
...newRootRoutes,
|
|
128
119
|
]);
|
|
129
120
|
|
|
130
|
-
return
|
|
131
|
-
...routerOptions,
|
|
132
|
-
routeTree: extendedRouteTree,
|
|
133
|
-
});
|
|
121
|
+
return createExtendedRouter(routerOptions, extendedRouteTree);
|
|
134
122
|
}, [baseRouteTree, routerOptions, extensionsLoaded]);
|
|
135
123
|
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Helper to create a router with extended route tree, handling some
|
|
127
|
+
* type issues with hydrate/dehydrate functions.
|
|
128
|
+
*/
|
|
129
|
+
function createExtendedRouter(
|
|
130
|
+
routerOptions: Omit<RouterOptions<AnyRoute, any>, 'routeTree'>,
|
|
131
|
+
extendedRouteTree: AnyRoute,
|
|
132
|
+
) {
|
|
133
|
+
return createRouter({
|
|
134
|
+
...routerOptions,
|
|
135
|
+
dehydrate: routerOptions.dehydrate as any,
|
|
136
|
+
hydrate: routerOptions.hydrate as any,
|
|
137
|
+
routeTree: extendedRouteTree,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
@@ -11,6 +11,7 @@ import { DocumentNode } from 'graphql';
|
|
|
11
11
|
|
|
12
12
|
import { DataDisplayComponent } from '../component-registry/component-registry.js';
|
|
13
13
|
import { DashboardAlertDefinition } from '../extension-api/types/alerts.js';
|
|
14
|
+
import { DataTableDisplayComponent } from '../extension-api/types/data-table.js';
|
|
14
15
|
import { NavMenuConfig } from '../nav-menu/nav-menu-extensions.js';
|
|
15
16
|
|
|
16
17
|
export interface GlobalRegistryContents {
|
|
@@ -22,7 +23,7 @@ export interface GlobalRegistryContents {
|
|
|
22
23
|
dashboardWidgetRegistry: Map<string, DashboardWidgetDefinition>;
|
|
23
24
|
dashboardAlertRegistry: Map<string, DashboardAlertDefinition>;
|
|
24
25
|
inputComponents: Map<string, DashboardFormComponent>;
|
|
25
|
-
displayComponents: Map<string, DataDisplayComponent>;
|
|
26
|
+
displayComponents: Map<string, DataDisplayComponent | DataTableDisplayComponent>;
|
|
26
27
|
bulkActionsRegistry: Map<string, BulkAction[]>;
|
|
27
28
|
listQueryDocumentRegistry: Map<string, DocumentNode[]>;
|
|
28
29
|
detailQueryDocumentRegistry: Map<string, DocumentNode[]>;
|