@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.
Files changed (68) hide show
  1. package/dist/plugin/types.d.ts +40 -0
  2. package/dist/plugin/utils/ast-utils.d.ts +0 -5
  3. package/dist/plugin/utils/ast-utils.js +0 -67
  4. package/dist/plugin/utils/ast-utils.spec.js +1 -76
  5. package/dist/plugin/utils/compiler.d.ts +22 -0
  6. package/dist/plugin/utils/compiler.js +162 -0
  7. package/dist/plugin/utils/config-loader.d.ts +0 -120
  8. package/dist/plugin/utils/config-loader.js +1 -367
  9. package/dist/plugin/utils/logger.d.ts +3 -0
  10. package/dist/plugin/utils/logger.js +39 -0
  11. package/dist/plugin/utils/plugin-discovery.d.ts +27 -0
  12. package/dist/plugin/utils/plugin-discovery.js +343 -0
  13. package/dist/plugin/utils/tsconfig-utils.d.ts +9 -0
  14. package/dist/plugin/utils/tsconfig-utils.js +50 -0
  15. package/dist/plugin/vite-plugin-config-loader.d.ts +3 -3
  16. package/dist/plugin/vite-plugin-config-loader.js +13 -13
  17. package/dist/plugin/vite-plugin-dashboard-metadata.js +19 -2
  18. package/dist/plugin/vite-plugin-vendure-dashboard.d.ts +7 -7
  19. package/dist/plugin/vite-plugin-vendure-dashboard.js +2 -2
  20. package/package.json +134 -131
  21. package/src/app/routes/_authenticated/_orders/components/customer-address-selector.tsx +0 -1
  22. package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +6 -2
  23. package/src/app/routes/_authenticated/_orders/components/state-transition-control.tsx +2 -2
  24. package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +0 -1
  25. package/src/app/routes/_authenticated/_products/components/option-value-input.tsx +1 -1
  26. package/src/app/routes/_authenticated/_zones/components/zone-countries-table.tsx +0 -7
  27. package/src/lib/components/layout/content-language-selector.tsx +1 -1
  28. package/src/lib/components/shared/asset/asset-preview.tsx +0 -6
  29. package/src/lib/components/shared/option-value-input.tsx +1 -1
  30. package/src/lib/components/shared/product-variant-selector.tsx +1 -1
  31. package/src/lib/components/ui/calendar.tsx +1 -1
  32. package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +1 -1
  33. package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +0 -2
  34. package/src/lib/hooks/use-extended-list-query.ts +32 -30
  35. package/vite/tests/barrel-exports.spec.ts +13 -4
  36. 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
  37. package/vite/tests/fixtures-npm-plugin/fake_node_modules/test-plugin/package.json +8 -0
  38. package/vite/tests/fixtures-npm-plugin/package.json +6 -0
  39. package/{dist/plugin/tests/barrel-exports/vendure-config.js → vite/tests/fixtures-npm-plugin/vendure-config.ts} +5 -6
  40. package/vite/tests/fixtures-path-alias/aliased-plugin/index.ts +1 -0
  41. package/vite/tests/fixtures-path-alias/aliased-plugin/src/aliased.plugin.ts +8 -0
  42. package/vite/tests/fixtures-path-alias/package.json +6 -0
  43. package/vite/tests/fixtures-path-alias/vendure-config.ts +19 -0
  44. package/vite/tests/npm-plugin.spec.ts +46 -0
  45. package/vite/tests/path-alias.spec.ts +33 -0
  46. package/vite/tests/tsconfig.json +11 -0
  47. package/vite/types.ts +44 -0
  48. package/vite/utils/ast-utils.spec.ts +1 -80
  49. package/vite/utils/ast-utils.ts +0 -86
  50. package/vite/utils/compiler.ts +244 -0
  51. package/vite/utils/config-loader.ts +0 -555
  52. package/vite/utils/logger.ts +43 -0
  53. package/vite/utils/plugin-discovery.ts +442 -0
  54. package/vite/utils/tsconfig-utils.ts +79 -0
  55. package/vite/vite-plugin-config-loader.ts +20 -17
  56. package/vite/vite-plugin-dashboard-metadata.ts +26 -7
  57. package/vite/vite-plugin-tailwind-source.ts +2 -2
  58. package/vite/vite-plugin-vendure-dashboard.ts +9 -9
  59. package/dist/plugin/tests/barrel-exports/my-plugin/index.d.ts +0 -1
  60. package/dist/plugin/tests/barrel-exports/my-plugin/index.js +0 -17
  61. package/dist/plugin/tests/barrel-exports/my-plugin/src/my.plugin.d.ts +0 -2
  62. package/dist/plugin/tests/barrel-exports/vendure-config.d.ts +0 -2
  63. package/dist/plugin/tests/barrel-exports.spec.js +0 -14
  64. /package/dist/plugin/{tests/barrel-exports.spec.d.ts → types.js} +0 -0
  65. /package/vite/tests/{barrel-exports → fixtures-barrel-exports}/my-plugin/index.ts +0 -0
  66. /package/vite/tests/{barrel-exports → fixtures-barrel-exports}/my-plugin/src/my.plugin.ts +0 -0
  67. /package/vite/tests/{barrel-exports → fixtures-barrel-exports}/package.json +0 -0
  68. /package/vite/tests/{barrel-exports → fixtures-barrel-exports}/vendure-config.ts +0 -0
package/package.json CHANGED
@@ -1,134 +1,137 @@
1
1
  {
2
- "name": "@vendure/dashboard",
3
- "private": false,
4
- "version": "3.3.6-master-202507110238",
5
- "type": "module",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/vendure-ecommerce/vendure"
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
- "./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-master-202507110238",
90
- "@vendure/core": "^3.3.6-master-202507110238",
91
- "@vitejs/plugin-react": "^4.3.4",
92
- "awesome-graphql-client": "^2.1.0",
93
- "class-variance-authority": "^0.7.1",
94
- "clsx": "^2.1.1",
95
- "cmdk": "^1.0.0",
96
- "date-fns": "^3.6.0",
97
- "gql.tada": "^1.8.10",
98
- "graphql": "^16.10.0",
99
- "json-edit-react": "^1.23.1",
100
- "lucide-react": "^0.475.0",
101
- "motion": "^12.6.2",
102
- "next-themes": "^0.4.6",
103
- "react": "^19.0.0",
104
- "react-day-picker": "^9.6.7",
105
- "react-dom": "^19.0.0",
106
- "react-dropzone": "^14.3.8",
107
- "react-grid-layout": "^1.5.1",
108
- "react-hook-form": "^7.54.2",
109
- "recharts": "^2.15.1",
110
- "sonner": "^2.0.1",
111
- "tailwind-merge": "^3.2.0",
112
- "tailwindcss": "^4.1.5",
113
- "tailwindcss-animate": "^1.0.7",
114
- "tsconfig-paths": "^4.2.0",
115
- "tw-animate-css": "^1.2.9",
116
- "vite": "^6.3.5",
117
- "zod": "^3.24.2"
118
- },
119
- "devDependencies": {
120
- "@eslint/js": "^9.19.0",
121
- "@types/node": "^22.13.4",
122
- "eslint": "^9.19.0",
123
- "eslint-plugin-react": "^7.37.4",
124
- "eslint-plugin-react-hooks": "^5.0.0",
125
- "eslint-plugin-react-refresh": "^0.4.18",
126
- "globals": "^15.14.0",
127
- "vite-plugin-dts": "^4.5.3"
128
- },
129
- "optionalDependencies": {
130
- "lightningcss-linux-arm64-musl": "^1.29.3",
131
- "lightningcss-linux-x64-musl": "^1.29.1"
132
- },
133
- "gitHead": "48140d95d510219816f76bd5d53af779e67011f3"
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 { getTypeForState, StateTransitionControl } from './state-transition-control.js';
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, watch } = useFormContext<FormValues>();
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, displayLanguage },
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, watch } = useFormContext<FormValues>();
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, isLoading } = useQuery({
62
+ const { data } = useQuery({
63
63
  queryKey: ['productVariants', debouncedSearch],
64
64
  staleTime: 1000 * 60 * 5,
65
65
  enabled: debouncedSearch.length > 0,
@@ -77,7 +77,7 @@ function Calendar({
77
77
  }, [yearRange]),
78
78
  );
79
79
 
80
- const { onNextClick, onPrevClick, startMonth, endMonth } = props;
80
+ const { onPrevClick, startMonth, endMonth } = props;
81
81
 
82
82
  const columnsDisplayed = navView === 'years' ? 1 : numberOfMonths;
83
83
 
@@ -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, error } = useQuery({
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
- // Store error for useEffect to handle
34
- if (error && !hasShownError.current) {
35
- hasShownError.current = true;
31
+ // Store error for useEffect to handle
32
+ if (error && !hasShownError.current) {
33
+ hasShownError.current = true;
36
34
 
37
- // Provide a helpful error message based on the error type
38
- let errorMessage = i18n.t('Failed to extend query document');
39
- if (error.message.includes('Extension query must have at least one top-level field')) {
40
- errorMessage = i18n.t('Query extension is invalid: must have at least one top-level field');
41
- } else if (error.message.includes('The query extension must extend the')) {
42
- errorMessage = i18n.t('Query extension mismatch: ') + error.message;
43
- } else if (error.message.includes('Syntax Error')) {
44
- errorMessage = i18n.t('Query extension contains invalid GraphQL syntax');
45
- } else {
46
- errorMessage = i18n.t('Query extension error: ') + error.message;
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
- // Log the error and continue with the original query
50
- // eslint-disable-next-line no-console
51
- console.warn(`${errorMessage}. Continuing with original query.`, {
52
- pageId,
53
- blockId,
54
- extensionsCount: listQueryExtensions.length,
55
- error: error.message,
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
- // Show a user-friendly toast notification
59
- toast.error(i18n.t('Query extension error'), {
60
- description: errorMessage + '. ' + i18n.t('The page will continue with the default query.'),
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 { loadVendureConfig } from '../utils/config-loader.js';
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 result = await loadVendureConfig({
11
- tempDir: join(__dirname, './__temp'),
12
- vendureConfigPath: join(__dirname, 'barrel-exports', 'vendure-config.ts'),
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.MyPlugin = void 0;
9
+ exports.TestPlugin = void 0;
10
10
  const core_1 = require("@vendure/core");
11
- let MyPlugin = class MyPlugin {
11
+ let TestPlugin = class TestPlugin {
12
12
  };
13
- exports.MyPlugin = MyPlugin;
14
- exports.MyPlugin = MyPlugin = __decorate([
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
- ], MyPlugin);
19
+ ], TestPlugin);
20
+ //# sourceMappingURL=reviews-plugin.js.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "test-plugin",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "build": "echo 'Building test-plugin'"
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "commonjs",
3
+ "name": "npm-plugin",
4
+ "version": "0.0.1",
5
+ "main": "index.ts"
6
+ }
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.config = void 0;
4
- const my_plugin_1 = require("./my-plugin");
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: [my_plugin_1.MyPlugin],
17
+ plugins: [TestPlugin],
19
18
  };
@@ -0,0 +1 @@
1
+ export * from './src/aliased.plugin';