@myparcel-dev/pdk-common 1.12.0 → 2.0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  <!-- MONOWEAVE:BELOW -->
4
4
 
5
+ ## [2.0.0](https://github.com/myparcelnl/js-pdk/compare/@myparcel-dev/pdk-common@1.12.1...@myparcel-dev/pdk-common@2.0.0) "@myparcel-dev/pdk-common" (2026-06-04)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * drive admin shipment options and checkout from the PDK capabilities API (#346)
11
+
12
+ ### Features
13
+
14
+ * drive admin shipment options and checkout from the PDK capabilities API ([#346](https://github.com/myparcelnl/js-pdk/issues/346)) ([f62b934](https://github.com/myparcelnl/js-pdk/commit/f62b9348d4f4316da28dbb97e4c335fc8aa9df80)), closes [myparcelnl/pdk#459](https://github.com/myparcelnl/pdk/issues/459) [myparcelnl/pdk#459](https://github.com/myparcelnl/pdk/issues/459) [myparcelnl/pdk#459](https://github.com/myparcelnl/pdk/issues/459)
15
+
16
+
17
+
18
+
19
+ ## [1.12.1](https://github.com/myparcelnl/js-pdk/compare/@myparcel-dev/pdk-common@1.12.0...@myparcel-dev/pdk-common@1.12.1) "@myparcel-dev/pdk-common" (2026-05-29)
20
+
21
+
22
+
23
+
5
24
  ## [1.12.0](https://github.com/myparcelnl/js-pdk/compare/@myparcel-dev/pdk-common@1.11.1...@myparcel-dev/pdk-common@1.12.0) "@myparcel-dev/pdk-common" (2026-02-06)
6
25
 
7
26
 
@@ -73,7 +73,11 @@ export declare enum BackendEndpoint {
73
73
  */
74
74
  DownloadLogs = "downloadLogs",
75
75
  SwitchToAcceptanceApi = "switchToAcceptanceApi",
76
- SwitchToProductionApi = "switchToProductionApi"
76
+ SwitchToProductionApi = "switchToProductionApi",
77
+ /**
78
+ * Proxy for fetching carrier capabilities through the Microservice.
79
+ */
80
+ ProxyCapabilities = "proxyCapabilities"
77
81
  }
78
82
  /**
79
83
  * Endpoints in checkout context.
@@ -93,5 +97,9 @@ export declare enum FrontendEndpoint {
93
97
  /**
94
98
  * Proxy for validating addresses through the Microservice.
95
99
  */
96
- ProxyAddressValidate = "proxyAddressValidate"
100
+ ProxyAddressValidate = "proxyAddressValidate",
101
+ /**
102
+ * Proxy for fetching carrier capabilities through the Microservice.
103
+ */
104
+ ProxyCapabilities = "proxyCapabilities"
97
105
  }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * This is a handcrafted file to allow for drift between php-pdk and JS-pdk. Mostly because the `php-pdk.types` is not accurate at this moment.
3
+ */
4
+ export type CarrierModel = {
5
+ carrier: string;
6
+ collo: {
7
+ max: number;
8
+ };
9
+ deliveryTypes: string[];
10
+ options: {
11
+ insurance?: {
12
+ isRequired: boolean;
13
+ isSelectedByDefault: boolean;
14
+ requires?: string[];
15
+ excludes?: string[];
16
+ insuredAmount: {
17
+ min: {
18
+ amount: number;
19
+ currency: string;
20
+ };
21
+ max: {
22
+ amount: number;
23
+ currency: string;
24
+ };
25
+ default: {
26
+ amount: number;
27
+ currency: string;
28
+ };
29
+ };
30
+ };
31
+ } & Record<string, {
32
+ isRequired: boolean;
33
+ isSelectedByDefault: boolean;
34
+ /**
35
+ * Other option keys that must also be enabled when this option is enabled. Only populated
36
+ * when the carrier model came from the proxy-capabilities response (`getCarrierForShipment`);
37
+ * absent on contract-definition data (`DynamicContext` / `getCarrierForOrder`).
38
+ */
39
+ requires?: string[];
40
+ /**
41
+ * Other option keys that must NOT be enabled when this option is enabled. Same source
42
+ * constraints as `requires`.
43
+ */
44
+ excludes?: string[];
45
+ [key: string]: unknown;
46
+ }>;
47
+ packageTypes: string[];
48
+ transactionTypes: string[];
49
+ };
50
+ export type CarrierCollection = CarrierModel[];
@@ -1,3 +1,4 @@
1
+ export * from './carrier.types';
1
2
  export * from './endpoints.types';
2
3
  export * from './generic.types';
3
4
  export * from './php-pdk.types';
@@ -1,9 +1,10 @@
1
1
  import { type SupportedDeliveryTypeName, type SupportedPackageTypeName } from '@myparcel-dev/delivery-options';
2
- import { type CarrierId, type CarrierName } from '@myparcel-dev/constants';
2
+ import { type CarrierName } from '@myparcel-dev/constants';
3
3
  import { type FrontendEndpoint, type TriState } from '../data';
4
4
  import { type ShippingMethodTypeMap } from './pluginSettings.types';
5
5
  import { type DateTime, type DateTimeImmutable } from './generic.types';
6
6
  import { type EndpointObject } from './endpoints.types';
7
+ import { type CarrierCollection, type CarrierModel } from './carrier.types';
7
8
  export declare namespace Account {
8
9
  type GetAccountsRequest = Base.Request;
9
10
  type GetShopCarrierConfigurationRequest = Base.Request;
@@ -17,6 +18,7 @@ export declare namespace Account {
17
18
  status: number;
18
19
  contactInfo: Base.ModelContactDetails;
19
20
  generalSettings: ModelAccountGeneralSettings;
21
+ subscriptionFeatures: string[];
20
22
  shops: ShopCollection;
21
23
  };
22
24
  type ModelAccountGeneralSettings = {
@@ -37,7 +39,8 @@ export declare namespace Account {
37
39
  shipmentOptions: Record<string, unknown>;
38
40
  trackTrace: Record<string, unknown>;
39
41
  carrierConfigurations: ShopCarrierConfigurationCollection;
40
- carriers: Carrier.CarrierCollection;
42
+ carriers: CarrierCollection;
43
+ defaultCarrier: string | null;
41
44
  };
42
45
  type ModelShopCarrierConfiguration = {
43
46
  carrier?: string;
@@ -82,54 +85,11 @@ export declare namespace Base {
82
85
  method: string;
83
86
  parameters: Record<string, string>;
84
87
  path: string;
85
- property: string;
86
- responseProperty?: string;
88
+ property?: string | null;
89
+ useDataEnvelope?: boolean;
90
+ responseProperty?: string | null;
87
91
  }
88
92
  }
89
- export declare namespace Carrier {
90
- type CarrierCollection = ModelCarrier[];
91
- type ModelCapability = {
92
- type: string;
93
- enum: unknown[];
94
- minimum: number;
95
- maximum: number;
96
- minLength: number;
97
- maxLength: number;
98
- };
99
- type ModelCarrier = {
100
- externalIdentifier?: string;
101
- id: CarrierId;
102
- name: CarrierName;
103
- human: string;
104
- subscriptionId?: number;
105
- enabled: boolean;
106
- primary: boolean;
107
- isDefault: boolean;
108
- optional: boolean;
109
- label?: string;
110
- type: string;
111
- capabilities: ModelCarrierCapabilities;
112
- returnCapabilities: ModelCarrierCapabilities;
113
- };
114
- type ModelCarrierCapabilities = {
115
- deliveryTypes: string[];
116
- features: Record<string, unknown>;
117
- packageTypes: string[];
118
- shipmentOptions: Shipment.ModelShipmentOptions;
119
- };
120
- type ModelShipmentOptionsCapabilities = {
121
- ageCheck: ModelCapability;
122
- dropOffAtPostalPoint: ModelCapability;
123
- insurance: ModelCapability;
124
- labelDescription: ModelCapability;
125
- largeFormat: ModelCapability;
126
- onlyRecipient: ModelCapability;
127
- return: ModelCapability;
128
- sameDayDelivery: ModelCapability;
129
- saturdayDelivery: ModelCapability;
130
- signature: ModelCapability;
131
- };
132
- }
133
93
  export declare namespace Frontend {
134
94
  type FormElementCollection = (FormPlainElement | FormInteractiveElement)[];
135
95
  type FormInteractiveElement = FormPlainElement & {
@@ -340,20 +300,18 @@ export declare namespace Plugin {
340
300
  eventPong: string;
341
301
  language: string;
342
302
  mode: string;
343
- platform: {
344
- backofficeUrl: string;
345
- defaultCarrier: string;
346
- defaultCarrierId: number;
347
- human: string;
348
- localCountry: string;
303
+ proposition: {
349
304
  name: string;
305
+ human?: string;
306
+ backofficeUrl: string;
350
307
  supportUrl: string;
308
+ localCountry: string;
351
309
  };
352
310
  translations: Record<string, string>;
353
311
  };
354
312
  type ModelContextDynamicContext = {
355
313
  account: Account.ModelAccount;
356
- carriers: Carrier.CarrierCollection;
314
+ carriers: CarrierCollection;
357
315
  pluginSettings: Settings.ModelSettings;
358
316
  printOptionsView: SettingsView;
359
317
  shop: Account.ModelShop;
@@ -643,7 +601,7 @@ export declare namespace Shipment {
643
601
  weight: number;
644
602
  };
645
603
  type ModelDeliveryOptions = {
646
- carrier?: Carrier.ModelCarrier;
604
+ carrier?: CarrierModel;
647
605
  date?: DateTime;
648
606
  deliveryType?: SupportedDeliveryTypeName;
649
607
  labelAmount: number;
@@ -694,7 +652,7 @@ export declare namespace Shipment {
694
652
  externalIdentifier?: string;
695
653
  apiKey?: string;
696
654
  barcode?: string;
697
- carrier?: Carrier.ModelCarrier;
655
+ carrier?: CarrierModel;
698
656
  collectionContact?: string;
699
657
  customsDeclaration?: ModelCustomsDeclaration;
700
658
  delayed: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myparcel-dev/pdk-common",
3
- "version": "1.12.0",
3
+ "version": "2.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/myparcelnl/js-pdk.git",
@@ -34,7 +34,7 @@
34
34
  "devDependencies": {
35
35
  "typescript": "^5.2.2",
36
36
  "vitest": "^2.1.3",
37
- "vue": "3.4.31"
37
+ "vue": "3.5.35"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=20"
@@ -90,6 +90,11 @@ export enum BackendEndpoint {
90
90
  DownloadLogs = 'downloadLogs',
91
91
  SwitchToAcceptanceApi = 'switchToAcceptanceApi',
92
92
  SwitchToProductionApi = 'switchToProductionApi',
93
+
94
+ /**
95
+ * Proxy for fetching carrier capabilities through the Microservice.
96
+ */
97
+ ProxyCapabilities = 'proxyCapabilities',
93
98
  }
94
99
 
95
100
  /**
@@ -111,4 +116,8 @@ export enum FrontendEndpoint {
111
116
  * Proxy for validating addresses through the Microservice.
112
117
  */
113
118
  ProxyAddressValidate = 'proxyAddressValidate',
119
+ /**
120
+ * Proxy for fetching carrier capabilities through the Microservice.
121
+ */
122
+ ProxyCapabilities = 'proxyCapabilities',
114
123
  }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * This is a handcrafted file to allow for drift between php-pdk and JS-pdk. Mostly because the `php-pdk.types` is not accurate at this moment.
3
+ */
4
+
5
+ // @TODO determine how relevant this is after getting capabilities from the API, and if it can be based on the OpenAPI spec later.
6
+ export type CarrierModel = {
7
+ carrier: string;
8
+ collo: {max: number};
9
+ deliveryTypes: string[];
10
+ options: {
11
+ insurance?: {
12
+ isRequired: boolean;
13
+ isSelectedByDefault: boolean;
14
+ requires?: string[];
15
+ excludes?: string[];
16
+ insuredAmount: {
17
+ min: {
18
+ amount: number;
19
+ currency: string;
20
+ };
21
+ max: {
22
+ amount: number;
23
+ currency: string;
24
+ };
25
+ default: {
26
+ amount: number;
27
+ currency: string;
28
+ };
29
+ };
30
+ };
31
+ } & Record<
32
+ string,
33
+ {
34
+ isRequired: boolean;
35
+ isSelectedByDefault: boolean;
36
+ /**
37
+ * Other option keys that must also be enabled when this option is enabled. Only populated
38
+ * when the carrier model came from the proxy-capabilities response (`getCarrierForShipment`);
39
+ * absent on contract-definition data (`DynamicContext` / `getCarrierForOrder`).
40
+ */
41
+ requires?: string[];
42
+ /**
43
+ * Other option keys that must NOT be enabled when this option is enabled. Same source
44
+ * constraints as `requires`.
45
+ */
46
+ excludes?: string[];
47
+ [key: string]: unknown;
48
+ }
49
+ >;
50
+ packageTypes: string[];
51
+ transactionTypes: string[];
52
+ };
53
+
54
+ export type CarrierCollection = CarrierModel[];
@@ -1,3 +1,4 @@
1
+ export * from './carrier.types';
1
2
  export * from './endpoints.types';
2
3
  export * from './generic.types';
3
4
  export * from './php-pdk.types';
@@ -4,11 +4,12 @@
4
4
  // ⚠️ THIS FILE IS AUTOMATICALLY GENERATED!!! ⚠️
5
5
 
6
6
  import {type SupportedDeliveryTypeName, type SupportedPackageTypeName} from '@myparcel-dev/delivery-options';
7
- import {type CarrierId, type CarrierName} from '@myparcel-dev/constants';
7
+ import {type CarrierName} from '@myparcel-dev/constants';
8
8
  import {type FrontendEndpoint, type TriState} from '../data';
9
9
  import {type ShippingMethodTypeMap} from './pluginSettings.types';
10
10
  import {type DateTime, type DateTimeImmutable} from './generic.types';
11
11
  import {type EndpointObject} from './endpoints.types';
12
+ import {type CarrierCollection, type CarrierModel} from './carrier.types';
12
13
 
13
14
  export namespace Account {
14
15
  export type GetAccountsRequest = Base.Request;
@@ -29,6 +30,7 @@ export namespace Account {
29
30
  status: number;
30
31
  contactInfo: Base.ModelContactDetails;
31
32
  generalSettings: ModelAccountGeneralSettings;
33
+ subscriptionFeatures: string[];
32
34
  shops: ShopCollection;
33
35
  };
34
36
 
@@ -51,7 +53,8 @@ export namespace Account {
51
53
  shipmentOptions: Record<string, unknown>;
52
54
  trackTrace: Record<string, unknown>;
53
55
  carrierConfigurations: ShopCarrierConfigurationCollection;
54
- carriers: Carrier.CarrierCollection;
56
+ carriers: CarrierCollection;
57
+ defaultCarrier: string | null;
55
58
  };
56
59
 
57
60
  export type ModelShopCarrierConfiguration = {
@@ -105,60 +108,12 @@ export namespace Base {
105
108
  method: string;
106
109
  parameters: Record<string, string>;
107
110
  path: string;
108
- property: string;
109
- responseProperty?: string;
111
+ property?: string | null;
112
+ useDataEnvelope?: boolean;
113
+ responseProperty?: string | null;
110
114
  }
111
115
  }
112
116
 
113
- export namespace Carrier {
114
- export type CarrierCollection = ModelCarrier[];
115
-
116
- export type ModelCapability = {
117
- type: string;
118
- enum: unknown[];
119
- minimum: number;
120
- maximum: number;
121
- minLength: number;
122
- maxLength: number;
123
- };
124
-
125
- export type ModelCarrier = {
126
- externalIdentifier?: string;
127
- id: CarrierId;
128
- name: CarrierName;
129
- human: string;
130
- subscriptionId?: number;
131
- enabled: boolean;
132
- primary: boolean;
133
- isDefault: boolean;
134
- optional: boolean;
135
- label?: string;
136
- type: string;
137
- capabilities: ModelCarrierCapabilities;
138
- returnCapabilities: ModelCarrierCapabilities;
139
- };
140
-
141
- export type ModelCarrierCapabilities = {
142
- deliveryTypes: string[];
143
- features: Record<string, unknown>;
144
- packageTypes: string[];
145
- shipmentOptions: Shipment.ModelShipmentOptions;
146
- };
147
-
148
- export type ModelShipmentOptionsCapabilities = {
149
- ageCheck: ModelCapability;
150
- dropOffAtPostalPoint: ModelCapability;
151
- insurance: ModelCapability;
152
- labelDescription: ModelCapability;
153
- largeFormat: ModelCapability;
154
- onlyRecipient: ModelCapability;
155
- return: ModelCapability;
156
- sameDayDelivery: ModelCapability;
157
- saturdayDelivery: ModelCapability;
158
- signature: ModelCapability;
159
- };
160
- }
161
-
162
117
  export namespace Frontend {
163
118
  export type FormElementCollection = (FormPlainElement | FormInteractiveElement)[];
164
119
 
@@ -414,21 +369,19 @@ export namespace Plugin {
414
369
  eventPong: string;
415
370
  language: string;
416
371
  mode: string;
417
- platform: {
418
- backofficeUrl: string;
419
- defaultCarrier: string;
420
- defaultCarrierId: number;
421
- human: string;
422
- localCountry: string;
372
+ proposition: {
423
373
  name: string;
374
+ human?: string;
375
+ backofficeUrl: string;
424
376
  supportUrl: string;
377
+ localCountry: string;
425
378
  };
426
379
  translations: Record<string, string>;
427
380
  };
428
381
 
429
382
  export type ModelContextDynamicContext = {
430
383
  account: Account.ModelAccount;
431
- carriers: Carrier.CarrierCollection;
384
+ carriers: CarrierCollection;
432
385
  pluginSettings: Settings.ModelSettings;
433
386
  printOptionsView: SettingsView;
434
387
  shop: Account.ModelShop;
@@ -756,7 +709,7 @@ export namespace Shipment {
756
709
  };
757
710
 
758
711
  export type ModelDeliveryOptions = {
759
- carrier?: Carrier.ModelCarrier;
712
+ carrier?: CarrierModel;
760
713
  date?: DateTime;
761
714
  deliveryType?: SupportedDeliveryTypeName;
762
715
  labelAmount: number;
@@ -813,7 +766,7 @@ export namespace Shipment {
813
766
  externalIdentifier?: string;
814
767
  apiKey?: string;
815
768
  barcode?: string;
816
- carrier?: Carrier.ModelCarrier;
769
+ carrier?: CarrierModel;
817
770
  collectionContact?: string;
818
771
  customsDeclaration?: ModelCustomsDeclaration;
819
772
  delayed: boolean;