@vendure/dashboard 3.3.6-master-202507110238 → 3.3.6
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/types.d.ts +40 -0
- package/dist/plugin/utils/ast-utils.d.ts +0 -5
- package/dist/plugin/utils/ast-utils.js +0 -67
- package/dist/plugin/utils/ast-utils.spec.js +1 -76
- package/dist/plugin/utils/compiler.d.ts +22 -0
- package/dist/plugin/utils/compiler.js +162 -0
- package/dist/plugin/utils/config-loader.d.ts +0 -120
- package/dist/plugin/utils/config-loader.js +1 -367
- package/dist/plugin/utils/logger.d.ts +3 -0
- package/dist/plugin/utils/logger.js +39 -0
- package/dist/plugin/utils/plugin-discovery.d.ts +27 -0
- package/dist/plugin/utils/plugin-discovery.js +343 -0
- package/dist/plugin/utils/tsconfig-utils.d.ts +9 -0
- package/dist/plugin/utils/tsconfig-utils.js +50 -0
- package/dist/plugin/vite-plugin-config-loader.d.ts +3 -3
- package/dist/plugin/vite-plugin-config-loader.js +13 -13
- package/dist/plugin/vite-plugin-dashboard-metadata.js +19 -2
- package/dist/plugin/vite-plugin-vendure-dashboard.d.ts +7 -7
- package/dist/plugin/vite-plugin-vendure-dashboard.js +2 -2
- package/package.json +134 -131
- package/src/app/routes/_authenticated/_orders/components/customer-address-selector.tsx +0 -1
- package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +6 -2
- package/src/app/routes/_authenticated/_orders/components/state-transition-control.tsx +2 -2
- package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +0 -1
- package/src/app/routes/_authenticated/_products/components/option-value-input.tsx +1 -1
- package/src/app/routes/_authenticated/_zones/components/zone-countries-table.tsx +0 -7
- package/src/lib/components/layout/content-language-selector.tsx +1 -1
- package/src/lib/components/shared/asset/asset-preview.tsx +0 -6
- package/src/lib/components/shared/option-value-input.tsx +1 -1
- package/src/lib/components/shared/product-variant-selector.tsx +1 -1
- package/src/lib/components/ui/calendar.tsx +1 -1
- package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +1 -1
- package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +0 -2
- package/src/lib/hooks/use-extended-list-query.ts +32 -30
- package/vite/tests/barrel-exports.spec.ts +13 -4
- package/{dist/plugin/tests/barrel-exports/my-plugin/src/my.plugin.js → vite/tests/fixtures-npm-plugin/fake_node_modules/test-plugin/index.js} +6 -6
- package/vite/tests/fixtures-npm-plugin/fake_node_modules/test-plugin/package.json +8 -0
- package/vite/tests/fixtures-npm-plugin/package.json +6 -0
- package/{dist/plugin/tests/barrel-exports/vendure-config.js → vite/tests/fixtures-npm-plugin/vendure-config.ts} +5 -6
- package/vite/tests/fixtures-path-alias/aliased-plugin/index.ts +1 -0
- package/vite/tests/fixtures-path-alias/aliased-plugin/src/aliased.plugin.ts +8 -0
- package/vite/tests/fixtures-path-alias/package.json +6 -0
- package/vite/tests/fixtures-path-alias/vendure-config.ts +19 -0
- package/vite/tests/npm-plugin.spec.ts +46 -0
- package/vite/tests/path-alias.spec.ts +33 -0
- package/vite/tests/tsconfig.json +11 -0
- package/vite/types.ts +44 -0
- package/vite/utils/ast-utils.spec.ts +1 -80
- package/vite/utils/ast-utils.ts +0 -86
- package/vite/utils/compiler.ts +244 -0
- package/vite/utils/config-loader.ts +0 -555
- package/vite/utils/logger.ts +43 -0
- package/vite/utils/plugin-discovery.ts +442 -0
- package/vite/utils/tsconfig-utils.ts +79 -0
- package/vite/vite-plugin-config-loader.ts +20 -17
- package/vite/vite-plugin-dashboard-metadata.ts +26 -7
- package/vite/vite-plugin-tailwind-source.ts +2 -2
- package/vite/vite-plugin-vendure-dashboard.ts +9 -9
- package/dist/plugin/tests/barrel-exports/my-plugin/index.d.ts +0 -1
- package/dist/plugin/tests/barrel-exports/my-plugin/index.js +0 -17
- package/dist/plugin/tests/barrel-exports/my-plugin/src/my.plugin.d.ts +0 -2
- package/dist/plugin/tests/barrel-exports/vendure-config.d.ts +0 -2
- package/dist/plugin/tests/barrel-exports.spec.js +0 -14
- /package/dist/plugin/{tests/barrel-exports.spec.d.ts → types.js} +0 -0
- /package/vite/tests/{barrel-exports → fixtures-barrel-exports}/my-plugin/index.ts +0 -0
- /package/vite/tests/{barrel-exports → fixtures-barrel-exports}/my-plugin/src/my.plugin.ts +0 -0
- /package/vite/tests/{barrel-exports → fixtures-barrel-exports}/package.json +0 -0
- /package/vite/tests/{barrel-exports → fixtures-barrel-exports}/vendure-config.ts +0 -0
package/package.json
CHANGED
|
@@ -1,134 +1,137 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
"homepage": "https://www.vendure.io",
|
|
11
|
-
"funding": "https://github.com/sponsors/michaelbromley",
|
|
12
|
-
"publishConfig": {
|
|
13
|
-
"access": "public"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "vite",
|
|
17
|
-
"build:standalone": "vite build",
|
|
18
|
-
"build": "tsc --project tsconfig.plugin.json",
|
|
19
|
-
"watch": "tsc --project tsconfig.plugin.json --watch",
|
|
20
|
-
"test": "vitest run",
|
|
21
|
-
"lint": "eslint .",
|
|
22
|
-
"preview": "vite preview",
|
|
23
|
-
"generate-index": "node scripts/generate-index.js"
|
|
24
|
-
},
|
|
25
|
-
"module": "./src/lib/index.ts",
|
|
26
|
-
"main": "./src/lib/index.ts",
|
|
27
|
-
"types": "./src/lib/index.d.ts",
|
|
28
|
-
"exports": {
|
|
29
|
-
".": {
|
|
30
|
-
"types": "./src/lib/index.d.ts",
|
|
31
|
-
"import": "./src/lib/index.ts",
|
|
32
|
-
"require": "./src/lib/index.ts"
|
|
2
|
+
"name": "@vendure/dashboard",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "3.3.6",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/vendure-ecommerce/vendure"
|
|
33
9
|
},
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
10
|
+
"homepage": "https://www.vendure.io",
|
|
11
|
+
"funding": "https://github.com/sponsors/michaelbromley",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"dev": "vite",
|
|
17
|
+
"build:standalone": "vite build",
|
|
18
|
+
"build": "tsc --project tsconfig.plugin.json",
|
|
19
|
+
"watch": "tsc --project tsconfig.plugin.json --watch",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"lint": "eslint .",
|
|
22
|
+
"preview": "vite preview",
|
|
23
|
+
"generate-index": "node scripts/generate-index.js"
|
|
24
|
+
},
|
|
25
|
+
"module": "./src/lib/index.ts",
|
|
26
|
+
"main": "./src/lib/index.ts",
|
|
27
|
+
"types": "./src/lib/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./src/lib/index.d.ts",
|
|
31
|
+
"import": "./src/lib/index.ts",
|
|
32
|
+
"require": "./src/lib/index.ts"
|
|
33
|
+
},
|
|
34
|
+
"./plugin": {
|
|
35
|
+
"types": "./dist/plugin/index.d.ts",
|
|
36
|
+
"import": "./dist/plugin/index.js",
|
|
37
|
+
"require": "./dist/plugin/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"src",
|
|
43
|
+
"vite",
|
|
44
|
+
"lingui.config.js",
|
|
45
|
+
"index.html"
|
|
46
|
+
],
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@dnd-kit/core": "^6.3.1",
|
|
49
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
50
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
51
|
+
"@hookform/resolvers": "^4.1.3",
|
|
52
|
+
"@lingui/babel-plugin-lingui-macro": "^5.2.0",
|
|
53
|
+
"@lingui/cli": "^5.2.0",
|
|
54
|
+
"@lingui/core": "^5.2.0",
|
|
55
|
+
"@lingui/react": "^5.2.0",
|
|
56
|
+
"@lingui/vite-plugin": "^5.2.0",
|
|
57
|
+
"@radix-ui/react-accordion": "^1.2.3",
|
|
58
|
+
"@radix-ui/react-alert-dialog": "^1.1.6",
|
|
59
|
+
"@radix-ui/react-avatar": "^1.1.3",
|
|
60
|
+
"@radix-ui/react-checkbox": "^1.1.4",
|
|
61
|
+
"@radix-ui/react-collapsible": "^1.1.3",
|
|
62
|
+
"@radix-ui/react-dialog": "^1.1.6",
|
|
63
|
+
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
|
64
|
+
"@radix-ui/react-hover-card": "^1.1.6",
|
|
65
|
+
"@radix-ui/react-label": "^2.1.2",
|
|
66
|
+
"@radix-ui/react-popover": "^1.1.6",
|
|
67
|
+
"@radix-ui/react-scroll-area": "^1.2.3",
|
|
68
|
+
"@radix-ui/react-select": "^2.2.5",
|
|
69
|
+
"@radix-ui/react-separator": "^1.1.2",
|
|
70
|
+
"@radix-ui/react-slot": "^1.1.2",
|
|
71
|
+
"@radix-ui/react-switch": "^1.1.3",
|
|
72
|
+
"@radix-ui/react-tabs": "^1.1.3",
|
|
73
|
+
"@radix-ui/react-tooltip": "^1.1.8",
|
|
74
|
+
"@tailwindcss/vite": "^4.1.5",
|
|
75
|
+
"@tanstack/eslint-plugin-query": "^5.66.1",
|
|
76
|
+
"@tanstack/react-query": "^5.66.7",
|
|
77
|
+
"@tanstack/react-query-devtools": "^5.68.0",
|
|
78
|
+
"@tanstack/react-router": "^1.105.0",
|
|
79
|
+
"@tanstack/react-table": "^8.21.2",
|
|
80
|
+
"@tanstack/router-devtools": "^1.105.0",
|
|
81
|
+
"@tanstack/router-plugin": "^1.105.0",
|
|
82
|
+
"@tiptap/pm": "^2.11.5",
|
|
83
|
+
"@tiptap/react": "^2.11.5",
|
|
84
|
+
"@tiptap/starter-kit": "^2.11.5",
|
|
85
|
+
"@types/react": "^19.0.10",
|
|
86
|
+
"@types/react-dom": "^19.0.4",
|
|
87
|
+
"@types/react-grid-layout": "^1.3.5",
|
|
88
|
+
"@uidotdev/usehooks": "^2.4.1",
|
|
89
|
+
"@vendure/common": "3.3.6",
|
|
90
|
+
"@vendure/core": "3.3.6",
|
|
91
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
92
|
+
"acorn": "^8.11.3",
|
|
93
|
+
"acorn-walk": "^8.3.2",
|
|
94
|
+
"awesome-graphql-client": "^2.1.0",
|
|
95
|
+
"class-variance-authority": "^0.7.1",
|
|
96
|
+
"clsx": "^2.1.1",
|
|
97
|
+
"cmdk": "^1.0.0",
|
|
98
|
+
"date-fns": "^3.6.0",
|
|
99
|
+
"fast-glob": "^3.3.2",
|
|
100
|
+
"gql.tada": "^1.8.10",
|
|
101
|
+
"graphql": "^16.10.0",
|
|
102
|
+
"json-edit-react": "^1.23.1",
|
|
103
|
+
"lucide-react": "^0.475.0",
|
|
104
|
+
"motion": "^12.6.2",
|
|
105
|
+
"next-themes": "^0.4.6",
|
|
106
|
+
"react": "^19.0.0",
|
|
107
|
+
"react-day-picker": "^9.6.7",
|
|
108
|
+
"react-dom": "^19.0.0",
|
|
109
|
+
"react-dropzone": "^14.3.8",
|
|
110
|
+
"react-grid-layout": "^1.5.1",
|
|
111
|
+
"react-hook-form": "^7.54.2",
|
|
112
|
+
"recharts": "^2.15.1",
|
|
113
|
+
"sonner": "^2.0.1",
|
|
114
|
+
"tailwind-merge": "^3.2.0",
|
|
115
|
+
"tailwindcss": "^4.1.5",
|
|
116
|
+
"tailwindcss-animate": "^1.0.7",
|
|
117
|
+
"tsconfig-paths": "^4.2.0",
|
|
118
|
+
"tw-animate-css": "^1.2.9",
|
|
119
|
+
"vite": "^6.3.5",
|
|
120
|
+
"zod": "^3.24.2"
|
|
121
|
+
},
|
|
122
|
+
"devDependencies": {
|
|
123
|
+
"@eslint/js": "^9.19.0",
|
|
124
|
+
"@types/node": "^22.13.4",
|
|
125
|
+
"eslint": "^9.19.0",
|
|
126
|
+
"eslint-plugin-react": "^7.37.4",
|
|
127
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
128
|
+
"eslint-plugin-react-refresh": "^0.4.18",
|
|
129
|
+
"globals": "^15.14.0",
|
|
130
|
+
"vite-plugin-dts": "^4.5.3"
|
|
131
|
+
},
|
|
132
|
+
"optionalDependencies": {
|
|
133
|
+
"lightningcss-linux-arm64-musl": "^1.29.3",
|
|
134
|
+
"lightningcss-linux-x64-musl": "^1.29.1"
|
|
135
|
+
},
|
|
136
|
+
"gitHead": "01a554f870d4b874b92f0d76d1602806b05f3ecc"
|
|
134
137
|
}
|
|
@@ -32,7 +32,6 @@ interface CustomerAddressSelectorProps {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export function CustomerAddressSelector({ customerId, onSelect }: Readonly<CustomerAddressSelectorProps>) {
|
|
35
|
-
const { i18n } = useLingui();
|
|
36
35
|
const [open, setOpen] = useState(false);
|
|
37
36
|
|
|
38
37
|
const { data, isLoading } = useQuery<CustomerAddressesQuery>({
|
|
@@ -18,7 +18,11 @@ import {
|
|
|
18
18
|
transitionPaymentToStateDocument,
|
|
19
19
|
} from '../orders.graphql.js';
|
|
20
20
|
import { SettleRefundDialog } from './settle-refund-dialog.js';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
getTypeForState,
|
|
23
|
+
StateTransitionAction,
|
|
24
|
+
StateTransitionControl,
|
|
25
|
+
} from './state-transition-control.js';
|
|
22
26
|
|
|
23
27
|
type PaymentDetailsProps = {
|
|
24
28
|
payment: ResultOf<typeof paymentWithRefundsFragment>;
|
|
@@ -131,7 +135,7 @@ export function PaymentDetails({ payment, currencyCode, onSuccess }: Readonly<Pa
|
|
|
131
135
|
};
|
|
132
136
|
|
|
133
137
|
const getPaymentActions = () => {
|
|
134
|
-
const actions = [];
|
|
138
|
+
const actions: StateTransitionAction[] = [];
|
|
135
139
|
|
|
136
140
|
if (payment.nextStates?.includes('Settled')) {
|
|
137
141
|
actions.push({
|
|
@@ -9,9 +9,9 @@ import { Trans } from '@/vdb/lib/trans.js';
|
|
|
9
9
|
import { cn } from '@/vdb/lib/utils.js';
|
|
10
10
|
import { EllipsisVertical, CircleDashed, CircleCheck, CircleX } from 'lucide-react';
|
|
11
11
|
|
|
12
|
-
type StateType = 'default' | 'destructive' | 'success';
|
|
12
|
+
export type StateType = 'default' | 'destructive' | 'success';
|
|
13
13
|
|
|
14
|
-
type StateTransitionAction = {
|
|
14
|
+
export type StateTransitionAction = {
|
|
15
15
|
label: string;
|
|
16
16
|
onClick: () => void;
|
|
17
17
|
disabled?: boolean;
|
|
@@ -249,7 +249,6 @@ function DraftOrderPage() {
|
|
|
249
249
|
const { mutate: removeCouponCodeForDraftOrder } = useMutation({
|
|
250
250
|
mutationFn: api.mutate(removeCouponCodeFromDraftOrderDocument),
|
|
251
251
|
onSuccess: (result: ResultOf<typeof removeCouponCodeFromDraftOrderDocument>) => {
|
|
252
|
-
const order = result.removeCouponCodeFromDraftOrder;
|
|
253
252
|
toast.success(i18n.t('Coupon code removed from order'));
|
|
254
253
|
refreshEntity();
|
|
255
254
|
},
|
|
@@ -37,7 +37,7 @@ export function OptionValueInput({
|
|
|
37
37
|
groupIndex,
|
|
38
38
|
disabled = false,
|
|
39
39
|
}: Readonly<OptionValueInputProps>) {
|
|
40
|
-
const { control
|
|
40
|
+
const { control } = useFormContext<FormValues>();
|
|
41
41
|
const { fields, append, remove } = useFieldArray({
|
|
42
42
|
control,
|
|
43
43
|
name: `optionGroups.${groupIndex}.values`,
|
|
@@ -28,13 +28,6 @@ export function ZoneCountriesTable({ zoneId, canAddCountries = false }: Readonly
|
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
const { mutate: removeCountryFromZone } = useMutation({
|
|
32
|
-
mutationFn: api.mutate(removeCountryFromZoneMutation),
|
|
33
|
-
onSuccess: () => {
|
|
34
|
-
refetch();
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
31
|
const [page, setPage] = useState(1);
|
|
39
32
|
const [pageSize, setPageSize] = useState(10);
|
|
40
33
|
|
|
@@ -14,7 +14,7 @@ export function ContentLanguageSelector({ value, onChange, className }: ContentL
|
|
|
14
14
|
const serverConfig = useServerConfig();
|
|
15
15
|
const { formatLanguageName } = useLocalFormat();
|
|
16
16
|
const {
|
|
17
|
-
settings: { contentLanguage
|
|
17
|
+
settings: { contentLanguage },
|
|
18
18
|
setContentLanguage,
|
|
19
19
|
} = useUserSettings();
|
|
20
20
|
|
|
@@ -29,12 +29,6 @@ export function AssetPreview({ asset, assets, customFields = [] }: Readonly<Asse
|
|
|
29
29
|
const imageRef = useRef<HTMLImageElement>(null);
|
|
30
30
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
31
31
|
|
|
32
|
-
const form = useForm({
|
|
33
|
-
defaultValues: {
|
|
34
|
-
name: asset.name,
|
|
35
|
-
tags: asset.tags?.map(t => t.value) || [],
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
32
|
const activeAsset = assets?.[assetIndex] ?? asset;
|
|
39
33
|
|
|
40
34
|
useEffect(() => {
|
|
@@ -32,7 +32,7 @@ interface OptionValueInputProps {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export function OptionValueInput({ groupIndex, disabled = false }: Readonly<OptionValueInputProps>) {
|
|
35
|
-
const { control
|
|
35
|
+
const { control } = useFormContext<FormValues>();
|
|
36
36
|
const { fields, append, remove } = useFieldArray({
|
|
37
37
|
control,
|
|
38
38
|
name: `optionGroups.${groupIndex}.values`,
|
|
@@ -59,7 +59,7 @@ export function ProductVariantSelector({ onProductVariantSelect }: Readonly<Prod
|
|
|
59
59
|
const [open, setOpen] = useState(false);
|
|
60
60
|
const debouncedSearch = useDebounce(search, 500);
|
|
61
61
|
|
|
62
|
-
const { data
|
|
62
|
+
const { data } = useQuery({
|
|
63
63
|
queryKey: ['productVariants', debouncedSearch],
|
|
64
64
|
staleTime: 1000 * 60 * 5,
|
|
65
65
|
enabled: debouncedSearch.length > 0,
|
|
@@ -19,7 +19,7 @@ export function MetricsWidget() {
|
|
|
19
19
|
const { activeChannel } = useChannel();
|
|
20
20
|
const [dataType, setDataType] = useState<DATA_TYPES>(DATA_TYPES.OrderTotal);
|
|
21
21
|
|
|
22
|
-
const { data
|
|
22
|
+
const { data } = useQuery({
|
|
23
23
|
queryKey: ['dashboard-order-metrics', dataType],
|
|
24
24
|
queryFn: () => {
|
|
25
25
|
return api.query(orderChartDataQuery, {
|
|
@@ -37,8 +37,6 @@ function PercentageChange({ value }: PercentageChangeProps) {
|
|
|
37
37
|
|
|
38
38
|
export function OrdersSummaryWidget() {
|
|
39
39
|
const [range, setRange] = useState<Range>(Range.Today);
|
|
40
|
-
const { formatCurrency } = useLocalFormat();
|
|
41
|
-
const { activeChannel } = useChannel();
|
|
42
40
|
|
|
43
41
|
const variables = useMemo(() => {
|
|
44
42
|
const now = new Date();
|
|
@@ -10,14 +10,13 @@ import { usePage } from './use-page.js';
|
|
|
10
10
|
|
|
11
11
|
export function useExtendedListQuery<T extends DocumentNode>(listQuery: T) {
|
|
12
12
|
const { pageId } = usePage();
|
|
13
|
-
const { blockId } = usePageBlock();
|
|
13
|
+
const { blockId } = usePageBlock() ?? {};
|
|
14
14
|
const { i18n } = useLingui();
|
|
15
15
|
const listQueryExtensions = pageId && blockId ? getListQueryDocuments(pageId, blockId) : [];
|
|
16
16
|
const hasShownError = useRef(false);
|
|
17
17
|
|
|
18
18
|
const extendedListQuery = useMemo(() => {
|
|
19
19
|
let result: T = listQuery;
|
|
20
|
-
let error: Error | null = null;
|
|
21
20
|
|
|
22
21
|
try {
|
|
23
22
|
result = listQueryExtensions.reduce(
|
|
@@ -25,40 +24,43 @@ export function useExtendedListQuery<T extends DocumentNode>(listQuery: T) {
|
|
|
25
24
|
listQuery,
|
|
26
25
|
) as T;
|
|
27
26
|
} catch (err) {
|
|
28
|
-
error = err instanceof Error ? err : new Error(String(err));
|
|
27
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
29
28
|
// Continue with the original query instead of the extended one
|
|
30
29
|
result = listQuery;
|
|
31
|
-
}
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
// Store error for useEffect to handle
|
|
32
|
+
if (error && !hasShownError.current) {
|
|
33
|
+
hasShownError.current = true;
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
// Provide a helpful error message based on the error type
|
|
36
|
+
let errorMessageText = i18n.t('Failed to extend query document');
|
|
37
|
+
if (error.message.includes('Extension query must have at least one top-level field')) {
|
|
38
|
+
errorMessageText = i18n.t(
|
|
39
|
+
'Query extension is invalid: must have at least one top-level field',
|
|
40
|
+
);
|
|
41
|
+
} else if (error.message.includes('The query extension must extend the')) {
|
|
42
|
+
errorMessageText = i18n.t('Query extension mismatch: ') + error.message;
|
|
43
|
+
} else if (error.message.includes('Syntax Error')) {
|
|
44
|
+
errorMessageText = i18n.t('Query extension contains invalid GraphQL syntax');
|
|
45
|
+
} else {
|
|
46
|
+
errorMessageText = i18n.t('Query extension error: ') + error.message;
|
|
47
|
+
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
// Log the error and continue with the original query
|
|
50
|
+
// eslint-disable-next-line no-console
|
|
51
|
+
console.warn(`${errorMessageText}. Continuing with original query.`, {
|
|
52
|
+
pageId,
|
|
53
|
+
blockId,
|
|
54
|
+
extensionsCount: listQueryExtensions.length,
|
|
55
|
+
error: error.message,
|
|
56
|
+
});
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
// Show a user-friendly toast notification
|
|
59
|
+
toast.error(i18n.t('Query extension error'), {
|
|
60
|
+
description:
|
|
61
|
+
errorMessageText + '. ' + i18n.t('The page will continue with the default query.'),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
return result;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
+
import { rm } from 'node:fs/promises';
|
|
1
2
|
import { join } from 'node:path';
|
|
2
3
|
import { describe, expect, it } from 'vitest';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import { compile } from '../utils/compiler.js';
|
|
6
|
+
import { debugLogger, noopLogger } from '../utils/logger.js';
|
|
5
7
|
|
|
6
8
|
describe('detecting plugins in barrel exports', () => {
|
|
7
9
|
it(
|
|
8
10
|
'should detect plugins in barrel exports',
|
|
9
11
|
async () => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const tempDir = join(__dirname, './__temp/barrel-exports');
|
|
13
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
14
|
+
const result = await compile({
|
|
15
|
+
outputPath: tempDir,
|
|
16
|
+
vendureConfigPath: join(__dirname, 'fixtures-barrel-exports', 'vendure-config.ts'),
|
|
17
|
+
logger: process.env.LOG ? debugLogger : noopLogger,
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
expect(result.pluginInfo).toHaveLength(1);
|
|
16
21
|
expect(result.pluginInfo[0].name).toBe('MyPlugin');
|
|
17
22
|
expect(result.pluginInfo[0].dashboardEntryPath).toBe('./dashboard/index.tsx');
|
|
23
|
+
expect(result.pluginInfo[0].sourcePluginPath).toBe(
|
|
24
|
+
join(__dirname, 'fixtures-barrel-exports', 'my-plugin', 'src', 'my.plugin.ts'),
|
|
25
|
+
);
|
|
26
|
+
expect(result.pluginInfo[0].pluginPath).toBe(join(tempDir, 'my-plugin', 'src', 'my.plugin.js'));
|
|
18
27
|
},
|
|
19
28
|
{ timeout: 10_000 },
|
|
20
29
|
);
|
|
@@ -6,15 +6,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.TestPlugin = void 0;
|
|
10
10
|
const core_1 = require("@vendure/core");
|
|
11
|
-
let
|
|
11
|
+
let TestPlugin = class TestPlugin {
|
|
12
12
|
};
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
13
|
+
exports.TestPlugin = TestPlugin;
|
|
14
|
+
exports.TestPlugin = TestPlugin = __decorate([
|
|
15
15
|
(0, core_1.VendurePlugin)({
|
|
16
16
|
imports: [core_1.PluginCommonModule],
|
|
17
|
-
providers: [],
|
|
18
17
|
dashboard: './dashboard/index.tsx',
|
|
19
18
|
})
|
|
20
|
-
],
|
|
19
|
+
], TestPlugin);
|
|
20
|
+
//# sourceMappingURL=reviews-plugin.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
exports.config = {
|
|
1
|
+
import { VendureConfig } from '@vendure/core';
|
|
2
|
+
import { TestPlugin } from 'test-plugin';
|
|
3
|
+
|
|
4
|
+
export const config: VendureConfig = {
|
|
6
5
|
apiOptions: {
|
|
7
6
|
port: 3000,
|
|
8
7
|
},
|
|
@@ -15,5 +14,5 @@ exports.config = {
|
|
|
15
14
|
paymentOptions: {
|
|
16
15
|
paymentMethodHandlers: [],
|
|
17
16
|
},
|
|
18
|
-
plugins: [
|
|
17
|
+
plugins: [TestPlugin],
|
|
19
18
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/aliased.plugin';
|