@vendure/dashboard 3.5.4-master-202602160305 → 3.5.4
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/dashboard",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.5.4
|
|
4
|
+
"version": "3.5.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -161,8 +161,8 @@
|
|
|
161
161
|
"@storybook/addon-vitest": "^10.0.0-beta.9",
|
|
162
162
|
"@storybook/react-vite": "^10.0.0-beta.9",
|
|
163
163
|
"@types/node": "^22.13.4",
|
|
164
|
-
"@vendure/common": "
|
|
165
|
-
"@vendure/core": "
|
|
164
|
+
"@vendure/common": "3.5.4",
|
|
165
|
+
"@vendure/core": "3.5.4",
|
|
166
166
|
"@vitest/browser": "^3.2.4",
|
|
167
167
|
"@vitest/coverage-v8": "^3.2.4",
|
|
168
168
|
"eslint": "^9.19.0",
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
PageLayout,
|
|
12
12
|
PageTitle,
|
|
13
13
|
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
14
|
-
import {
|
|
14
|
+
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
15
15
|
import { api } from '@/vdb/graphql/api.js';
|
|
16
16
|
import { useCustomFieldConfig } from '@/vdb/hooks/use-custom-field-config.js';
|
|
17
17
|
import { useDynamicTranslations } from '@/vdb/hooks/use-dynamic-translations.js';
|
|
@@ -106,33 +106,35 @@ export function OrderDetailShared({
|
|
|
106
106
|
const customFieldConfig = useCustomFieldConfig('Order');
|
|
107
107
|
const refundDialogRef = useRef<RefundOrderDialogRef>(null);
|
|
108
108
|
|
|
109
|
-
const
|
|
110
|
-
if (entity)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}, [entity, queryClient]);
|
|
109
|
+
const refreshPage = useCallback(async () => {
|
|
110
|
+
if (!entity) return;
|
|
111
|
+
await Promise.all([
|
|
112
|
+
refreshEntity(),
|
|
113
|
+
queryClient.refetchQueries({ queryKey: orderHistoryQueryKey(entity.id) }),
|
|
114
|
+
]);
|
|
115
|
+
}, [refreshEntity, entity, queryClient]);
|
|
116
116
|
|
|
117
117
|
const stateTransitionActions = useMemo(() => {
|
|
118
118
|
if (!entity) {
|
|
119
119
|
return [];
|
|
120
120
|
}
|
|
121
|
-
return entity.nextStates
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
121
|
+
return entity.nextStates
|
|
122
|
+
.filter((state: string) => state !== 'Modifying')
|
|
123
|
+
.map((state: string) => ({
|
|
124
|
+
label: t`Transition to ${getTranslatedOrderState(state)}`,
|
|
125
|
+
type: getTypeForState(state),
|
|
126
|
+
onClick: async () => {
|
|
127
|
+
const transitionError = await transitionToState(state);
|
|
128
|
+
if (transitionError) {
|
|
129
|
+
toast(t`Failed to transition order to state`, {
|
|
130
|
+
description: transitionError,
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
void refreshPage();
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
}));
|
|
137
|
+
}, [entity, transitionToState, t, refreshPage]);
|
|
136
138
|
|
|
137
139
|
const handleModifyClick = useCallback(async () => {
|
|
138
140
|
if (!entity) return;
|
|
@@ -141,15 +143,14 @@ export function OrderDetailShared({
|
|
|
141
143
|
id: entity.id,
|
|
142
144
|
state: 'Modifying',
|
|
143
145
|
});
|
|
144
|
-
|
|
145
|
-
await queryClient.invalidateQueries({ queryKey });
|
|
146
|
+
await refreshPage();
|
|
146
147
|
await navigate({ to: `/orders/$id/modify`, params: { id: entity.id } });
|
|
147
148
|
} catch (error) {
|
|
148
149
|
toast(t`Failed to modify order`, {
|
|
149
150
|
description: error instanceof Error ? error.message : 'Unknown error',
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
|
-
}, [entity, transitionOrderToStateMutation,
|
|
153
|
+
}, [entity, transitionOrderToStateMutation, refreshPage, navigate, t]);
|
|
153
154
|
|
|
154
155
|
const ModifyMenuItem = useCallback(
|
|
155
156
|
() => (
|
|
@@ -197,7 +198,7 @@ export function OrderDetailShared({
|
|
|
197
198
|
<AddManualPaymentDialog
|
|
198
199
|
order={entity}
|
|
199
200
|
onSuccess={() => {
|
|
200
|
-
|
|
201
|
+
void refreshPage();
|
|
201
202
|
}}
|
|
202
203
|
/>
|
|
203
204
|
</PermissionGuard>
|
|
@@ -207,7 +208,7 @@ export function OrderDetailShared({
|
|
|
207
208
|
<FulfillOrderDialog
|
|
208
209
|
order={entity}
|
|
209
210
|
onSuccess={() => {
|
|
210
|
-
void
|
|
211
|
+
void refreshPage();
|
|
211
212
|
}}
|
|
212
213
|
/>
|
|
213
214
|
</PermissionGuard>
|
|
@@ -219,7 +220,7 @@ export function OrderDetailShared({
|
|
|
219
220
|
ref={refundDialogRef}
|
|
220
221
|
order={entity}
|
|
221
222
|
onSuccess={() => {
|
|
222
|
-
void
|
|
223
|
+
void refreshPage();
|
|
223
224
|
}}
|
|
224
225
|
/>
|
|
225
226
|
)}
|
|
@@ -252,7 +253,7 @@ export function OrderDetailShared({
|
|
|
252
253
|
key={payment.id}
|
|
253
254
|
payment={payment}
|
|
254
255
|
currencyCode={entity.currencyCode}
|
|
255
|
-
onSuccess={
|
|
256
|
+
onSuccess={refreshPage}
|
|
256
257
|
/>
|
|
257
258
|
))}
|
|
258
259
|
</div>
|
|
@@ -314,10 +315,7 @@ export function OrderDetailShared({
|
|
|
314
315
|
order={entity}
|
|
315
316
|
fulfillment={fulfillment}
|
|
316
317
|
onSuccess={() => {
|
|
317
|
-
|
|
318
|
-
void queryClient.refetchQueries({
|
|
319
|
-
queryKey: orderHistoryQueryKey(entity.id),
|
|
320
|
-
});
|
|
318
|
+
void refreshPage();
|
|
321
319
|
}}
|
|
322
320
|
/>
|
|
323
321
|
))}
|