@myparcel-dev/pdk-admin 2.2.5 → 2.2.7

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/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  <!-- MONOWEAVE:BELOW -->
4
4
 
5
+ ## [2.2.7](https://github.com/myparcelnl/js-pdk/compare/@myparcel-dev/pdk-admin@2.2.6...@myparcel-dev/pdk-admin@2.2.7) "@myparcel-dev/pdk-admin" (2026-09-25)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **admin:** load the full order when the shipment options modal opens ([#445](https://github.com/myparcelnl/js-pdk/issues/445)) ([5ac4d1c](https://github.com/myparcelnl/js-pdk/commit/5ac4d1c87d469829cb25a9518239977d8e38e923))
11
+
12
+
13
+
14
+
15
+ ## [2.2.6](https://github.com/myparcelnl/js-pdk/compare/@myparcel-dev/pdk-admin@2.2.5...@myparcel-dev/pdk-admin@2.2.6) "@myparcel-dev/pdk-admin" (2026-09-24)
16
+
17
+
18
+ ### Reverts
19
+
20
+ * build(deps): update vitest to 4 and vite to 8 ([7696c6f](https://github.com/myparcelnl/js-pdk/commit/7696c6f8d344619c2e554f0fae5ed5db2d5c71f8)), closes [#463](https://github.com/myparcelnl/js-pdk/issues/463)
21
+
22
+
23
+
24
+
5
25
  ## [2.2.4](https://github.com/myparcelnl/js-pdk/compare/@myparcel-dev/pdk-admin@2.2.3...@myparcel-dev/pdk-admin@2.2.4) "@myparcel-dev/pdk-admin" (2026-09-22)
6
26
 
7
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myparcel-dev/pdk-admin",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/myparcelnl/js-pdk.git",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@myparcel-dev/constants": "^2.9.0",
40
- "@myparcel-dev/pdk-common": "^2.2.0",
40
+ "@myparcel-dev/pdk-common": "^2.2.1",
41
41
  "@myparcel-dev/sdk": "^5.1.0",
42
42
  "@myparcel-dev/vue-form-builder": "1.0.0-beta.42.6",
43
43
  "@tanstack/vue-query": "~4.43.0",
@@ -51,10 +51,10 @@
51
51
  "devDependencies": {
52
52
  "@myparcel-dev/pdk-build-vite": "1.0.0-alpha.0",
53
53
  "@types/lodash-es": "^4.17.6",
54
- "@vue/test-utils": "^2.0.0",
54
+ "@vue/test-utils": "^2.5.1",
55
55
  "typescript": "^5.2.2",
56
- "vite": "^5.4.10",
57
- "vitest": "^3.2.6",
56
+ "vite": "^8.3.1",
57
+ "vitest": "^4.1.11",
58
58
  "vue-tsc": "^3.3.9"
59
59
  },
60
60
  "engines": {
@@ -0,0 +1,59 @@
1
+ // @vitest-environment happy-dom
2
+
3
+ import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
4
+ import {type ActionContext} from '../executors/types';
5
+ import {useActionStore, useModalStore} from '../../stores';
6
+ import {AdminAction, AdminModalKey} from '../../data';
7
+ import {doComponentTestSetup, doComponentTestTeardown} from '../../__tests__';
8
+ import {ordersEditAction} from './orders';
9
+
10
+ const edit = (orderIds: string | string[]): Promise<unknown> =>
11
+ Promise.resolve(ordersEditAction.handler({parameters: {orderIds}} as unknown as ActionContext));
12
+
13
+ describe('ordersEditAction', () => {
14
+ beforeEach(() => {
15
+ doComponentTestSetup();
16
+ vi.mocked(useActionStore().dispatch).mockResolvedValue(undefined);
17
+ });
18
+
19
+ afterEach(() => {
20
+ doComponentTestTeardown();
21
+ });
22
+
23
+ it('loads the order before it opens the modal', async () => {
24
+ let resolveFetch: () => void = () => undefined;
25
+ const dispatch = vi.mocked(useActionStore().dispatch).mockImplementation(
26
+ () =>
27
+ new Promise<void>((resolve) => {
28
+ resolveFetch = resolve;
29
+ }),
30
+ );
31
+ const open = vi.mocked(useModalStore().open);
32
+
33
+ const handled = edit('TEST-1');
34
+
35
+ expect(dispatch).toHaveBeenCalledWith(AdminAction.OrdersFetch, {orderIds: 'TEST-1'});
36
+ expect(open).not.toHaveBeenCalled();
37
+
38
+ resolveFetch();
39
+ await handled;
40
+
41
+ expect(open).toHaveBeenCalledWith(AdminModalKey.ShipmentOptions, {orderIds: 'TEST-1'});
42
+ });
43
+
44
+ it('does not load anything for a bulk selection', async () => {
45
+ await edit(['TEST-1', 'TEST-2']);
46
+
47
+ expect(useActionStore().dispatch).not.toHaveBeenCalled();
48
+ expect(useModalStore().open).toHaveBeenCalledWith(AdminModalKey.ShipmentOptions, {
49
+ orderIds: ['TEST-1', 'TEST-2'],
50
+ });
51
+ });
52
+
53
+ it('accepts a single id given as an array', async () => {
54
+ await edit(['TEST-1']);
55
+
56
+ expect(useActionStore().dispatch).toHaveBeenCalledWith(AdminAction.OrdersFetch, {orderIds: ['TEST-1']});
57
+ expect(useModalStore().opened).toBe(AdminModalKey.ShipmentOptions);
58
+ });
59
+ });
@@ -5,7 +5,7 @@ import {createOrdersMutationHandler, createQueryHandler, executeNextAction, reso
5
5
  import {defineAction} from '../defineAction';
6
6
  import {getOrderShipmentIds} from '../../utils';
7
7
  import {type OrderIds} from '../../types';
8
- import {useModalStore} from '../../stores';
8
+ import {useActionStore, useModalStore} from '../../stores';
9
9
  import {AdminAction, AdminIcon, AdminModalKey} from '../../data';
10
10
  import {shipmentsUpdateAction} from './shipments';
11
11
  import {useGlobalContext} from '../../composables/context/useGlobalContext';
@@ -17,11 +17,16 @@ export const ordersEditAction = defineAction({
17
17
  name: AdminAction.OrdersEdit,
18
18
  icon: AdminIcon.Edit,
19
19
  label: 'action_edit',
20
- handler(context) {
21
- const modalStore = useModalStore();
22
- const {parameters} = context;
20
+ async handler(context) {
21
+ const {orderIds} = context.parameters;
23
22
 
24
- modalStore.open(AdminModalKey.ShipmentOptions, {orderIds: parameters.orderIds});
23
+ // The order list seeds the cache with an order without its lines, so load the full one first.
24
+ // Bulk skips this: that form reads no per-order data.
25
+ if (toArray(orderIds ?? []).length === 1) {
26
+ await useActionStore().dispatch(AdminAction.OrdersFetch, {orderIds});
27
+ }
28
+
29
+ useModalStore().open(AdminModalKey.ShipmentOptions, {orderIds});
25
30
  },
26
31
  });
27
32