@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
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { LanguageCode } from '@vendure/core';
|
|
2
|
+
export const defaultLanguage = LanguageCode.en;
|
|
3
|
+
export const defaultLocale = undefined;
|
|
4
|
+
export const defaultAvailableLanguages = [
|
|
5
|
+
LanguageCode.he,
|
|
6
|
+
LanguageCode.ar,
|
|
7
|
+
LanguageCode.de,
|
|
8
|
+
LanguageCode.en,
|
|
9
|
+
LanguageCode.es,
|
|
10
|
+
LanguageCode.pl,
|
|
11
|
+
LanguageCode.zh_Hans,
|
|
12
|
+
LanguageCode.zh_Hant,
|
|
13
|
+
LanguageCode.pt_BR,
|
|
14
|
+
LanguageCode.pt_PT,
|
|
15
|
+
LanguageCode.cs,
|
|
16
|
+
LanguageCode.fr,
|
|
17
|
+
LanguageCode.ru,
|
|
18
|
+
LanguageCode.uk,
|
|
19
|
+
LanguageCode.it,
|
|
20
|
+
LanguageCode.fa,
|
|
21
|
+
LanguageCode.ne,
|
|
22
|
+
LanguageCode.hr,
|
|
23
|
+
LanguageCode.sv,
|
|
24
|
+
LanguageCode.nb,
|
|
25
|
+
LanguageCode.tr,
|
|
26
|
+
];
|
|
27
|
+
export const defaultAvailableLocales = [
|
|
28
|
+
'AF',
|
|
29
|
+
'AL',
|
|
30
|
+
'DZ',
|
|
31
|
+
'AS',
|
|
32
|
+
'AD',
|
|
33
|
+
'AO',
|
|
34
|
+
'AI',
|
|
35
|
+
'AQ',
|
|
36
|
+
'AG',
|
|
37
|
+
'AR',
|
|
38
|
+
'AM',
|
|
39
|
+
'AW',
|
|
40
|
+
'AU',
|
|
41
|
+
'AT',
|
|
42
|
+
'AZ',
|
|
43
|
+
'BS',
|
|
44
|
+
'BH',
|
|
45
|
+
'BD',
|
|
46
|
+
'BB',
|
|
47
|
+
'BY',
|
|
48
|
+
'BE',
|
|
49
|
+
'BZ',
|
|
50
|
+
'BJ',
|
|
51
|
+
'BM',
|
|
52
|
+
'BT',
|
|
53
|
+
'BO',
|
|
54
|
+
'BQ',
|
|
55
|
+
'BA',
|
|
56
|
+
'BW',
|
|
57
|
+
'BV',
|
|
58
|
+
'BR',
|
|
59
|
+
'IO',
|
|
60
|
+
'BN',
|
|
61
|
+
'BG',
|
|
62
|
+
'BF',
|
|
63
|
+
'BI',
|
|
64
|
+
'CV',
|
|
65
|
+
'KH',
|
|
66
|
+
'CM',
|
|
67
|
+
'CA',
|
|
68
|
+
'KY',
|
|
69
|
+
'CF',
|
|
70
|
+
'TD',
|
|
71
|
+
'CL',
|
|
72
|
+
'CN',
|
|
73
|
+
'CX',
|
|
74
|
+
'CC',
|
|
75
|
+
'CO',
|
|
76
|
+
'KM',
|
|
77
|
+
'CD',
|
|
78
|
+
'CG',
|
|
79
|
+
'CK',
|
|
80
|
+
'CR',
|
|
81
|
+
'HR',
|
|
82
|
+
'CU',
|
|
83
|
+
'CW',
|
|
84
|
+
'CY',
|
|
85
|
+
'CZ',
|
|
86
|
+
'CI',
|
|
87
|
+
'DK',
|
|
88
|
+
'DJ',
|
|
89
|
+
'DM',
|
|
90
|
+
'DO',
|
|
91
|
+
'EC',
|
|
92
|
+
'EG',
|
|
93
|
+
'SV',
|
|
94
|
+
'GQ',
|
|
95
|
+
'ER',
|
|
96
|
+
'EE',
|
|
97
|
+
'SZ',
|
|
98
|
+
'ET',
|
|
99
|
+
'FK',
|
|
100
|
+
'FO',
|
|
101
|
+
'FJ',
|
|
102
|
+
'FI',
|
|
103
|
+
'FR',
|
|
104
|
+
'GF',
|
|
105
|
+
'PF',
|
|
106
|
+
'TF',
|
|
107
|
+
'GA',
|
|
108
|
+
'GM',
|
|
109
|
+
'GE',
|
|
110
|
+
'DE',
|
|
111
|
+
'GH',
|
|
112
|
+
'GI',
|
|
113
|
+
'GR',
|
|
114
|
+
'GL',
|
|
115
|
+
'GD',
|
|
116
|
+
'GP',
|
|
117
|
+
'GU',
|
|
118
|
+
'GT',
|
|
119
|
+
'GG',
|
|
120
|
+
'GN',
|
|
121
|
+
'GW',
|
|
122
|
+
'GY',
|
|
123
|
+
'HT',
|
|
124
|
+
'HM',
|
|
125
|
+
'VA',
|
|
126
|
+
'HN',
|
|
127
|
+
'HK',
|
|
128
|
+
'HU',
|
|
129
|
+
'IS',
|
|
130
|
+
'IN',
|
|
131
|
+
'ID',
|
|
132
|
+
'IR',
|
|
133
|
+
'IQ',
|
|
134
|
+
'IE',
|
|
135
|
+
'IM',
|
|
136
|
+
'IL',
|
|
137
|
+
'IT',
|
|
138
|
+
'JM',
|
|
139
|
+
'JP',
|
|
140
|
+
'JE',
|
|
141
|
+
'JO',
|
|
142
|
+
'KZ',
|
|
143
|
+
'KE',
|
|
144
|
+
'KI',
|
|
145
|
+
'KP',
|
|
146
|
+
'KR',
|
|
147
|
+
'KW',
|
|
148
|
+
'KG',
|
|
149
|
+
'LA',
|
|
150
|
+
'LV',
|
|
151
|
+
'LB',
|
|
152
|
+
'LS',
|
|
153
|
+
'LR',
|
|
154
|
+
'LY',
|
|
155
|
+
'LI',
|
|
156
|
+
'LT',
|
|
157
|
+
'LU',
|
|
158
|
+
'MO',
|
|
159
|
+
'MG',
|
|
160
|
+
'MW',
|
|
161
|
+
'MY',
|
|
162
|
+
'MV',
|
|
163
|
+
'ML',
|
|
164
|
+
'MT',
|
|
165
|
+
'MH',
|
|
166
|
+
'MQ',
|
|
167
|
+
'MR',
|
|
168
|
+
'MU',
|
|
169
|
+
'YT',
|
|
170
|
+
'MX',
|
|
171
|
+
'FM',
|
|
172
|
+
'MD',
|
|
173
|
+
'MC',
|
|
174
|
+
'MN',
|
|
175
|
+
'ME',
|
|
176
|
+
'MS',
|
|
177
|
+
'MA',
|
|
178
|
+
'MZ',
|
|
179
|
+
'MM',
|
|
180
|
+
'NA',
|
|
181
|
+
'NR',
|
|
182
|
+
'NP',
|
|
183
|
+
'NL',
|
|
184
|
+
'NC',
|
|
185
|
+
'NZ',
|
|
186
|
+
'NI',
|
|
187
|
+
'NE',
|
|
188
|
+
'NG',
|
|
189
|
+
'NU',
|
|
190
|
+
'NF',
|
|
191
|
+
'MK',
|
|
192
|
+
'MP',
|
|
193
|
+
'NO',
|
|
194
|
+
'OM',
|
|
195
|
+
'PK',
|
|
196
|
+
'PW',
|
|
197
|
+
'PS',
|
|
198
|
+
'PA',
|
|
199
|
+
'PG',
|
|
200
|
+
'PY',
|
|
201
|
+
'PE',
|
|
202
|
+
'PH',
|
|
203
|
+
'PN',
|
|
204
|
+
'PL',
|
|
205
|
+
'PT',
|
|
206
|
+
'PR',
|
|
207
|
+
'QA',
|
|
208
|
+
'RO',
|
|
209
|
+
'RU',
|
|
210
|
+
'RW',
|
|
211
|
+
'RE',
|
|
212
|
+
'BL',
|
|
213
|
+
'SH',
|
|
214
|
+
'KN',
|
|
215
|
+
'LC',
|
|
216
|
+
'MF',
|
|
217
|
+
'PM',
|
|
218
|
+
'VC',
|
|
219
|
+
'WS',
|
|
220
|
+
'SM',
|
|
221
|
+
'ST',
|
|
222
|
+
'SA',
|
|
223
|
+
'SN',
|
|
224
|
+
'RS',
|
|
225
|
+
'SC',
|
|
226
|
+
'SL',
|
|
227
|
+
'SG',
|
|
228
|
+
'SX',
|
|
229
|
+
'SK',
|
|
230
|
+
'SI',
|
|
231
|
+
'SB',
|
|
232
|
+
'SO',
|
|
233
|
+
'ZA',
|
|
234
|
+
'GS',
|
|
235
|
+
'SS',
|
|
236
|
+
'ES',
|
|
237
|
+
'LK',
|
|
238
|
+
'SD',
|
|
239
|
+
'SR',
|
|
240
|
+
'SJ',
|
|
241
|
+
'SE',
|
|
242
|
+
'CH',
|
|
243
|
+
'SY',
|
|
244
|
+
'TW',
|
|
245
|
+
'TJ',
|
|
246
|
+
'TZ',
|
|
247
|
+
'TH',
|
|
248
|
+
'TL',
|
|
249
|
+
'TG',
|
|
250
|
+
'TK',
|
|
251
|
+
'TO',
|
|
252
|
+
'TT',
|
|
253
|
+
'TN',
|
|
254
|
+
'TR',
|
|
255
|
+
'TM',
|
|
256
|
+
'TC',
|
|
257
|
+
'TV',
|
|
258
|
+
'UG',
|
|
259
|
+
'UA',
|
|
260
|
+
'AE',
|
|
261
|
+
'GB',
|
|
262
|
+
'UM',
|
|
263
|
+
'US',
|
|
264
|
+
'UY',
|
|
265
|
+
'UZ',
|
|
266
|
+
'VU',
|
|
267
|
+
'VE',
|
|
268
|
+
'VN',
|
|
269
|
+
'VG',
|
|
270
|
+
'VI',
|
|
271
|
+
'WF',
|
|
272
|
+
'EH',
|
|
273
|
+
'YE',
|
|
274
|
+
'ZM',
|
|
275
|
+
'ZW',
|
|
276
|
+
'AX',
|
|
277
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { vendureDashboardPlugin } from './vite-plugin-vendure-dashboard.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { vendureDashboardPlugin } from './vite-plugin-vendure-dashboard.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type Logger = {
|
|
2
|
+
info: (message: string) => void;
|
|
3
|
+
warn: (message: string) => void;
|
|
4
|
+
debug: (message: string) => void;
|
|
5
|
+
error: (message: string) => void;
|
|
6
|
+
};
|
|
7
|
+
export type PluginInfo = {
|
|
8
|
+
name: string;
|
|
9
|
+
pluginPath: string;
|
|
10
|
+
dashboardEntryPath: string | undefined;
|
|
11
|
+
/** The original source path of the plugin, only set for local plugins that are compiled */
|
|
12
|
+
sourcePluginPath?: string;
|
|
13
|
+
};
|
|
14
|
+
export type GetCompiledConfigPathFn = (params: {
|
|
15
|
+
inputRootDir: string;
|
|
16
|
+
outputPath: string;
|
|
17
|
+
configFileName: string;
|
|
18
|
+
}) => string;
|
|
19
|
+
export type TransformTsConfigPathMappingsFn = (params: {
|
|
20
|
+
phase: 'compiling' | 'loading';
|
|
21
|
+
alias: string;
|
|
22
|
+
patterns: string[];
|
|
23
|
+
}) => string[];
|
|
24
|
+
/**
|
|
25
|
+
* @description
|
|
26
|
+
* The PathAdapter interface allows customization of how paths are handled
|
|
27
|
+
* when compiling the Vendure config and its imports.
|
|
28
|
+
*/
|
|
29
|
+
export interface PathAdapter {
|
|
30
|
+
/**
|
|
31
|
+
* @description
|
|
32
|
+
* A function to determine the path to the compiled Vendure config file.
|
|
33
|
+
*/
|
|
34
|
+
getCompiledConfigPath?: GetCompiledConfigPathFn;
|
|
35
|
+
/**
|
|
36
|
+
* If your project makes use of the TypeScript `paths` configuration, the compiler will
|
|
37
|
+
* attempt to use these paths when compiling the Vendure config and its imports.
|
|
38
|
+
*/
|
|
39
|
+
transformTsConfigPathMappings?: TransformTsConfigPathMappingsFn;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -377,7 +377,7 @@ function guessNodeModulesRoot(vendureConfigPath, logger) {
|
|
|
377
377
|
logger.debug(`Found core URL: ${coreUrl}`);
|
|
378
378
|
const corePath = fileURLToPath(coreUrl);
|
|
379
379
|
logger.debug(`Found core path: ${corePath}`);
|
|
380
|
-
nodeModulesRoot = path.join(path.dirname(corePath), '..', '..');
|
|
380
|
+
nodeModulesRoot = path.join(path.dirname(corePath), '..', '..', '..');
|
|
381
381
|
}
|
|
382
382
|
catch (e) {
|
|
383
383
|
logger.warn(`Failed to resolve @vendure/core: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ADMIN_API_PATH, DEFAULT_AUTH_TOKEN_HEADER_KEY, DEFAULT_CHANNEL_TOKEN_KEY, } from '@vendure/common/lib/shared-constants';
|
|
2
|
+
import { defaultAvailableLanguages, defaultAvailableLocales, defaultLanguage, defaultLocale, } from '../constants.js';
|
|
3
|
+
export function getUiConfig(config, pluginOptions) {
|
|
4
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
5
|
+
const { authOptions, apiOptions } = config;
|
|
6
|
+
// Merge API configuration with defaults
|
|
7
|
+
const api = {
|
|
8
|
+
adminApiPath: (_c = (_b = (_a = pluginOptions.api) === null || _a === void 0 ? void 0 : _a.adminApiPath) !== null && _b !== void 0 ? _b : apiOptions.adminApiPath) !== null && _c !== void 0 ? _c : ADMIN_API_PATH,
|
|
9
|
+
host: (_e = (_d = pluginOptions.api) === null || _d === void 0 ? void 0 : _d.host) !== null && _e !== void 0 ? _e : 'auto',
|
|
10
|
+
port: (_g = (_f = pluginOptions.api) === null || _f === void 0 ? void 0 : _f.port) !== null && _g !== void 0 ? _g : 'auto',
|
|
11
|
+
tokenMethod: (_j = (_h = pluginOptions.api) === null || _h === void 0 ? void 0 : _h.tokenMethod) !== null && _j !== void 0 ? _j : (authOptions.tokenMethod === 'bearer' ? 'bearer' : 'cookie'),
|
|
12
|
+
authTokenHeaderKey: (_m = (_l = (_k = pluginOptions.api) === null || _k === void 0 ? void 0 : _k.authTokenHeaderKey) !== null && _l !== void 0 ? _l : authOptions.authTokenHeaderKey) !== null && _m !== void 0 ? _m : DEFAULT_AUTH_TOKEN_HEADER_KEY,
|
|
13
|
+
channelTokenKey: (_q = (_p = (_o = pluginOptions.api) === null || _o === void 0 ? void 0 : _o.channelTokenKey) !== null && _p !== void 0 ? _p : apiOptions.channelTokenKey) !== null && _q !== void 0 ? _q : DEFAULT_CHANNEL_TOKEN_KEY,
|
|
14
|
+
};
|
|
15
|
+
// Merge i18n configuration with defaults
|
|
16
|
+
const i18n = {
|
|
17
|
+
defaultLanguage: (_s = (_r = pluginOptions.i18n) === null || _r === void 0 ? void 0 : _r.defaultLanguage) !== null && _s !== void 0 ? _s : defaultLanguage,
|
|
18
|
+
defaultLocale: (_u = (_t = pluginOptions.i18n) === null || _t === void 0 ? void 0 : _t.defaultLocale) !== null && _u !== void 0 ? _u : defaultLocale,
|
|
19
|
+
availableLanguages: ((_v = pluginOptions.i18n) === null || _v === void 0 ? void 0 : _v.availableLanguages) && pluginOptions.i18n.availableLanguages.length > 0
|
|
20
|
+
? pluginOptions.i18n.availableLanguages
|
|
21
|
+
: defaultAvailableLanguages,
|
|
22
|
+
availableLocales: ((_w = pluginOptions.i18n) === null || _w === void 0 ? void 0 : _w.availableLocales) && pluginOptions.i18n.availableLocales.length > 0
|
|
23
|
+
? pluginOptions.i18n.availableLocales
|
|
24
|
+
: defaultAvailableLocales,
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
api,
|
|
28
|
+
i18n,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { LanguageCode } from '@vendure/core';
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
|
+
export interface ApiConfig {
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* The hostname of the Vendure server which the admin UI will be making API calls
|
|
7
|
+
* to. If set to "auto", the Admin UI app will determine the hostname from the
|
|
8
|
+
* current location (i.e. `window.location.hostname`).
|
|
9
|
+
*
|
|
10
|
+
* @default 'auto'
|
|
11
|
+
*/
|
|
12
|
+
host?: string | 'auto';
|
|
13
|
+
/**
|
|
14
|
+
* @description
|
|
15
|
+
* The port of the Vendure server which the admin UI will be making API calls
|
|
16
|
+
* to. If set to "auto", the Admin UI app will determine the port from the
|
|
17
|
+
* current location (i.e. `window.location.port`).
|
|
18
|
+
*
|
|
19
|
+
* @default 'auto'
|
|
20
|
+
*/
|
|
21
|
+
port?: number | 'auto';
|
|
22
|
+
/**
|
|
23
|
+
* @description
|
|
24
|
+
* The path to the GraphQL Admin API.
|
|
25
|
+
*
|
|
26
|
+
* @default 'admin-api'
|
|
27
|
+
*/
|
|
28
|
+
adminApiPath?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @description
|
|
31
|
+
* Whether to use cookies or bearer tokens to track sessions.
|
|
32
|
+
* Should match the setting of in the server's `tokenMethod` config
|
|
33
|
+
* option.
|
|
34
|
+
*
|
|
35
|
+
* @default 'cookie'
|
|
36
|
+
*/
|
|
37
|
+
tokenMethod?: 'cookie' | 'bearer';
|
|
38
|
+
/**
|
|
39
|
+
* @description
|
|
40
|
+
* The header used when using the 'bearer' auth method. Should match the
|
|
41
|
+
* setting of the server's `authOptions.authTokenHeaderKey` config option.
|
|
42
|
+
*
|
|
43
|
+
* @default 'vendure-auth-token'
|
|
44
|
+
*/
|
|
45
|
+
authTokenHeaderKey?: string;
|
|
46
|
+
/**
|
|
47
|
+
* @description
|
|
48
|
+
* The name of the header which contains the channel token. Should match the
|
|
49
|
+
* setting of the server's `apiOptions.channelTokenKey` config option.
|
|
50
|
+
*
|
|
51
|
+
* @default 'vendure-token'
|
|
52
|
+
*/
|
|
53
|
+
channelTokenKey?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface I18nConfig {
|
|
56
|
+
/**
|
|
57
|
+
* @description
|
|
58
|
+
* The default language for the Admin UI. Must be one of the
|
|
59
|
+
* items specified in the `availableLanguages` property.
|
|
60
|
+
*
|
|
61
|
+
* @default LanguageCode.en
|
|
62
|
+
*/
|
|
63
|
+
defaultLanguage?: LanguageCode;
|
|
64
|
+
/**
|
|
65
|
+
* @description
|
|
66
|
+
* The default locale for the Admin UI. The locale affects the formatting of
|
|
67
|
+
* currencies & dates. Must be one of the items specified
|
|
68
|
+
* in the `availableLocales` property.
|
|
69
|
+
*
|
|
70
|
+
* If not set, the browser default locale will be used.
|
|
71
|
+
*
|
|
72
|
+
* @since 2.2.0
|
|
73
|
+
*/
|
|
74
|
+
defaultLocale?: string;
|
|
75
|
+
/**
|
|
76
|
+
* @description
|
|
77
|
+
* An array of languages for which translations exist for the Admin UI.
|
|
78
|
+
*/
|
|
79
|
+
availableLanguages?: LanguageCode[];
|
|
80
|
+
/**
|
|
81
|
+
* @description
|
|
82
|
+
* An array of locales to be used on Admin UI.
|
|
83
|
+
*
|
|
84
|
+
* @since 2.2.0
|
|
85
|
+
*/
|
|
86
|
+
availableLocales?: string[];
|
|
87
|
+
}
|
|
88
|
+
export interface UiConfigPluginOptions {
|
|
89
|
+
/**
|
|
90
|
+
* @description
|
|
91
|
+
* Configuration for API connection settings
|
|
92
|
+
*/
|
|
93
|
+
api?: ApiConfig;
|
|
94
|
+
/**
|
|
95
|
+
* @description
|
|
96
|
+
* Configuration for internationalization settings
|
|
97
|
+
*/
|
|
98
|
+
i18n?: I18nConfig;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @description
|
|
102
|
+
* The resolved UI configuration with all defaults applied.
|
|
103
|
+
* This is the type of the configuration object available at runtime.
|
|
104
|
+
*/
|
|
105
|
+
export interface ResolvedUiConfig {
|
|
106
|
+
/**
|
|
107
|
+
* @description
|
|
108
|
+
* API connection settings with all defaults applied
|
|
109
|
+
*/
|
|
110
|
+
api: Required<ApiConfig>;
|
|
111
|
+
/**
|
|
112
|
+
* @description
|
|
113
|
+
* Internationalization settings with all defaults applied.
|
|
114
|
+
* Note: defaultLocale remains optional as it can be undefined.
|
|
115
|
+
*/
|
|
116
|
+
i18n: Required<Omit<I18nConfig, 'defaultLocale'>> & Pick<I18nConfig, 'defaultLocale'>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* This Vite plugin scans the configured plugins for any dashboard extensions and dynamically
|
|
120
|
+
* generates an import statement for each one, wrapped up in a `runDashboardExtensions()`
|
|
121
|
+
* function which can then be imported and executed in the Dashboard app.
|
|
122
|
+
*/
|
|
123
|
+
export declare function uiConfigPlugin(options?: UiConfigPluginOptions): Plugin;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getAdminUiConfig } from './utils/ui-config.js';
|
|
1
|
+
import { getUiConfig } from './utils/ui-config.js';
|
|
3
2
|
import { getConfigLoaderApi } from './vite-plugin-config-loader.js';
|
|
4
3
|
const virtualModuleId = 'virtual:vendure-ui-config';
|
|
5
4
|
const resolvedVirtualModuleId = `\0${virtualModuleId}`;
|
|
@@ -8,7 +7,7 @@ const resolvedVirtualModuleId = `\0${virtualModuleId}`;
|
|
|
8
7
|
* generates an import statement for each one, wrapped up in a `runDashboardExtensions()`
|
|
9
8
|
* function which can then be imported and executed in the Dashboard app.
|
|
10
9
|
*/
|
|
11
|
-
export function uiConfigPlugin(
|
|
10
|
+
export function uiConfigPlugin(options = {}) {
|
|
12
11
|
let configLoaderApi;
|
|
13
12
|
let vendureConfig;
|
|
14
13
|
return {
|
|
@@ -27,7 +26,7 @@ export function uiConfigPlugin({ adminUiConfig }) {
|
|
|
27
26
|
const result = await configLoaderApi.getVendureConfig();
|
|
28
27
|
vendureConfig = result.vendureConfig;
|
|
29
28
|
}
|
|
30
|
-
const config =
|
|
29
|
+
const config = getUiConfig(vendureConfig, options);
|
|
31
30
|
return `
|
|
32
31
|
export const uiConfig = ${JSON.stringify(config)}
|
|
33
32
|
`;
|
|
@@ -35,10 +34,3 @@ export function uiConfigPlugin({ adminUiConfig }) {
|
|
|
35
34
|
},
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Converts an import path to a normalized path relative to the rootDir.
|
|
40
|
-
*/
|
|
41
|
-
function normalizeImportPath(rootDir, importPath) {
|
|
42
|
-
const relativePath = path.relative(rootDir, importPath).replace(/\\/g, '/');
|
|
43
|
-
return relativePath.replace(/\.tsx?$/, '.js');
|
|
44
|
-
}
|
|
@@ -54,7 +54,7 @@ export function vendureDashboardPlugin(options) {
|
|
|
54
54
|
viteConfigPlugin({ packageRoot }),
|
|
55
55
|
adminApiSchemaPlugin(),
|
|
56
56
|
dashboardMetadataPlugin(),
|
|
57
|
-
uiConfigPlugin(
|
|
57
|
+
uiConfigPlugin(options),
|
|
58
58
|
...(options.gqlOutputPath
|
|
59
59
|
? [gqlTadaPlugin({ gqlTadaOutputPath: options.gqlOutputPath, tempDir, packageRoot })]
|
|
60
60
|
: []),
|
package/index.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/
|
|
5
|
+
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<meta name="description" content="Vendure Admin Dashboard" />
|
|
8
8
|
<meta name="author" content="Vendure" />
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/dashboard",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"dev": "vite",
|
|
17
17
|
"build:standalone": "vite build",
|
|
18
|
-
"build": "tsc --project tsconfig.
|
|
19
|
-
"
|
|
18
|
+
"build:vite": "tsc --project tsconfig.vite.json",
|
|
19
|
+
"build:plugin": "tsc --project tsconfig.plugin.json && node scripts/build-plugin.js",
|
|
20
|
+
"build": "npm run build:vite && npm run build:plugin",
|
|
21
|
+
"watch": "tsc --project tsconfig.vite.json --watch",
|
|
20
22
|
"test": "vitest run",
|
|
21
23
|
"lint": "eslint .",
|
|
22
24
|
"preview": "vite preview",
|
|
@@ -35,6 +37,11 @@
|
|
|
35
37
|
"types": "./dist/plugin/index.d.ts",
|
|
36
38
|
"import": "./dist/plugin/index.js",
|
|
37
39
|
"require": "./dist/plugin/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./vite": {
|
|
42
|
+
"types": "./dist/vite/index.d.ts",
|
|
43
|
+
"import": "./dist/vite/index.js",
|
|
44
|
+
"require": "./dist/vite/index.js"
|
|
38
45
|
}
|
|
39
46
|
},
|
|
40
47
|
"files": [
|
|
@@ -95,8 +102,8 @@
|
|
|
95
102
|
"@types/react-dom": "^19.0.4",
|
|
96
103
|
"@types/react-grid-layout": "^1.3.5",
|
|
97
104
|
"@uidotdev/usehooks": "^2.4.1",
|
|
98
|
-
"@vendure/common": "3.
|
|
99
|
-
"@vendure/core": "3.
|
|
105
|
+
"@vendure/common": "3.4.0",
|
|
106
|
+
"@vendure/core": "3.4.0",
|
|
100
107
|
"@vitejs/plugin-react": "^4.3.4",
|
|
101
108
|
"acorn": "^8.11.3",
|
|
102
109
|
"acorn-walk": "^8.3.2",
|
|
@@ -104,9 +111,11 @@
|
|
|
104
111
|
"class-variance-authority": "^0.7.1",
|
|
105
112
|
"clsx": "^2.1.1",
|
|
106
113
|
"cmdk": "^1.1.1",
|
|
107
|
-
"date-fns": "^
|
|
114
|
+
"date-fns": "^4.0.0",
|
|
108
115
|
"embla-carousel-react": "^8.6.0",
|
|
116
|
+
"express-rate-limit": "^7.5.0",
|
|
109
117
|
"fast-glob": "^3.3.2",
|
|
118
|
+
"fs-extra": "^11.2.0",
|
|
110
119
|
"gql.tada": "^1.8.10",
|
|
111
120
|
"graphql": "^16.10.0",
|
|
112
121
|
"input-otp": "^1.4.2",
|
|
@@ -146,5 +155,5 @@
|
|
|
146
155
|
"lightningcss-linux-arm64-musl": "^1.29.3",
|
|
147
156
|
"lightningcss-linux-x64-musl": "^1.29.1"
|
|
148
157
|
},
|
|
149
|
-
"gitHead": "
|
|
158
|
+
"gitHead": "3591ce29f36b43706a1b10819b52012bb2e789cc"
|
|
150
159
|
}
|
|
@@ -14,7 +14,7 @@ export function AppProviders({ children }: { children: React.ReactNode }) {
|
|
|
14
14
|
return (
|
|
15
15
|
<I18nProvider>
|
|
16
16
|
<QueryClientProvider client={queryClient}>
|
|
17
|
-
<UserSettingsProvider>
|
|
17
|
+
<UserSettingsProvider queryClient={queryClient}>
|
|
18
18
|
<ThemeProvider defaultTheme="system">
|
|
19
19
|
<AuthProvider>
|
|
20
20
|
<ServerConfigProvider>
|
|
@@ -208,7 +208,7 @@ function CollectionDetailPage() {
|
|
|
208
208
|
<FormMessage />
|
|
209
209
|
</FormItem>
|
|
210
210
|
</PageBlock>
|
|
211
|
-
<PageBlock column="main" blockId="contents" title={<Trans>
|
|
211
|
+
<PageBlock column="main" blockId="contents" title={<Trans>Contents</Trans>}>
|
|
212
212
|
{shouldPreviewContents || creatingNewEntity ? (
|
|
213
213
|
<CollectionContentsPreviewTable
|
|
214
214
|
parentId={entity?.parent?.id}
|