@bisondesk/core-sdk 1.0.653 → 1.0.655
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/lib/types/quotes.d.ts +65 -5
- package/lib/types/quotes.d.ts.map +1 -1
- package/lib/types/quotes.js +18 -1
- package/lib/types/quotes.js.map +1 -1
- package/lib/types/templates.d.ts +0 -22
- package/lib/types/templates.d.ts.map +1 -1
- package/lib/types/templates.js.map +1 -1
- package/lib/types/transports.d.ts +15 -10
- package/lib/types/transports.d.ts.map +1 -1
- package/lib/types/transports.js +5 -5
- package/lib/types/transports.js.map +1 -1
- package/lib/types/vehicle-sales.d.ts +2 -3
- package/lib/types/vehicle-sales.d.ts.map +1 -1
- package/lib/types/vehicle-sales.js.map +1 -1
- package/lib/utils/organizations.d.ts +3 -0
- package/lib/utils/organizations.d.ts.map +1 -0
- package/lib/utils/organizations.js +15 -0
- package/lib/utils/organizations.js.map +1 -0
- package/lib/utils/transports.d.ts +1 -1
- package/lib/utils/transports.d.ts.map +1 -1
- package/lib/utils/transports.js.map +1 -1
- package/package.json +1 -1
- package/src/types/quotes.ts +73 -17
- package/src/types/templates.ts +0 -27
- package/src/types/transports.ts +24 -24
- package/src/types/vehicle-sales.ts +2 -3
- package/src/utils/organizations.ts +30 -0
- package/src/utils/transports.ts +5 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/types/deliveries.d.ts +0 -74
- package/lib/types/deliveries.d.ts.map +0 -1
- package/lib/types/deliveries.js +0 -24
- package/lib/types/deliveries.js.map +0 -1
- package/lib/utils/deliveries.d.ts +0 -3
- package/lib/utils/deliveries.d.ts.map +0 -1
- package/lib/utils/deliveries.js +0 -3
- package/lib/utils/deliveries.js.map +0 -1
- package/lib/utils/deliveries.test.d.ts +0 -2
- package/lib/utils/deliveries.test.d.ts.map +0 -1
- package/lib/utils/deliveries.test.js +0 -34
- package/lib/utils/deliveries.test.js.map +0 -1
- package/src/types/deliveries.ts +0 -92
- package/src/utils/deliveries.test.ts +0 -50
- package/src/utils/deliveries.ts +0 -13
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { LocationValue } from '@bisondesk/commons-sdk/types';
|
|
2
|
-
export declare enum PurchaseDeliveryTypes {
|
|
3
|
-
ADDRESS = "address",
|
|
4
|
-
DROP_OFF = "park"
|
|
5
|
-
}
|
|
6
|
-
export declare enum SalesDeliveryTypes {
|
|
7
|
-
PICK_UP = "park",
|
|
8
|
-
ADDRESS = "address",
|
|
9
|
-
PORT = "port",
|
|
10
|
-
PORT_AND_SHIP = "portAndShip"
|
|
11
|
-
}
|
|
12
|
-
export declare enum SpoilerInfo {
|
|
13
|
-
MOUNT = "mount",
|
|
14
|
-
UNMOUNT = "unmount",
|
|
15
|
-
NO_ACTION = "noAction"
|
|
16
|
-
}
|
|
17
|
-
export declare enum TransportationMode {
|
|
18
|
-
BY_ROAD = "byRoad",
|
|
19
|
-
ON_LOW_BED = "onLowBed"
|
|
20
|
-
}
|
|
21
|
-
type BaseDeliveryType = {
|
|
22
|
-
agreedPrice: string;
|
|
23
|
-
spoiler?: SpoilerInfo;
|
|
24
|
-
stackingVehicleNeeded?: boolean;
|
|
25
|
-
detailsStacking?: string;
|
|
26
|
-
};
|
|
27
|
-
export type PickUpDeliveryType = BaseDeliveryType & {
|
|
28
|
-
type: SalesDeliveryTypes.PICK_UP;
|
|
29
|
-
urgent: boolean;
|
|
30
|
-
transportationMode?: TransportationMode;
|
|
31
|
-
detailsBorderCrossing?: string;
|
|
32
|
-
technicalControlNeeded: boolean;
|
|
33
|
-
insuranceNeeded: boolean;
|
|
34
|
-
transitPlateBelgiumNeeded: boolean;
|
|
35
|
-
transitPlateAustriaNeeded: boolean;
|
|
36
|
-
licensePlateNeeded: boolean;
|
|
37
|
-
dateOfPickUpByCustomer?: string;
|
|
38
|
-
};
|
|
39
|
-
export type DropOffDeliveryType = BaseDeliveryType & {
|
|
40
|
-
type: PurchaseDeliveryTypes.DROP_OFF;
|
|
41
|
-
};
|
|
42
|
-
export type AddressDeliveryType<T extends SalesDeliveryTypes.ADDRESS | PurchaseDeliveryTypes.ADDRESS = SalesDeliveryTypes.ADDRESS> = BaseDeliveryType & {
|
|
43
|
-
type: T;
|
|
44
|
-
address: LocationValue;
|
|
45
|
-
distanceKm: string;
|
|
46
|
-
technicalControlNeeded: boolean;
|
|
47
|
-
};
|
|
48
|
-
export type PortDeliverytype = BaseDeliveryType & {
|
|
49
|
-
type: SalesDeliveryTypes.PORT | SalesDeliveryTypes.PORT_AND_SHIP;
|
|
50
|
-
portOriginId: string;
|
|
51
|
-
portDestination?: string;
|
|
52
|
-
shippingCompany?: string;
|
|
53
|
-
portToPortCostPrice: string;
|
|
54
|
-
parkToPortCostPrice?: string;
|
|
55
|
-
portToPortMargin: string;
|
|
56
|
-
ets?: string;
|
|
57
|
-
eta?: string;
|
|
58
|
-
etd?: string;
|
|
59
|
-
shipClosingDate?: string;
|
|
60
|
-
bookingRef?: string;
|
|
61
|
-
deliveryLocation?: string;
|
|
62
|
-
};
|
|
63
|
-
export type SalesDeliveryType = PickUpDeliveryType | AddressDeliveryType | PortDeliverytype;
|
|
64
|
-
export type PurchaseDeliveryType = AddressDeliveryType<SalesDeliveryTypes.ADDRESS | PurchaseDeliveryTypes.ADDRESS> | DropOffDeliveryType;
|
|
65
|
-
export type DeliveryLocationValue = Omit<LocationValue, 'addressLine1' | 'city'> & {
|
|
66
|
-
addressLine1: string;
|
|
67
|
-
city: string;
|
|
68
|
-
};
|
|
69
|
-
export type DeliveryRoutesRequest = {
|
|
70
|
-
origin: DeliveryLocationValue;
|
|
71
|
-
destination: DeliveryLocationValue;
|
|
72
|
-
};
|
|
73
|
-
export {};
|
|
74
|
-
//# sourceMappingURL=deliveries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.d.ts","sourceRoot":"/","sources":["types/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BA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ADDRESS"] = "address";
|
|
4
|
-
PurchaseDeliveryTypes["DROP_OFF"] = "park";
|
|
5
|
-
})(PurchaseDeliveryTypes || (PurchaseDeliveryTypes = {}));
|
|
6
|
-
export var SalesDeliveryTypes;
|
|
7
|
-
(function (SalesDeliveryTypes) {
|
|
8
|
-
SalesDeliveryTypes["PICK_UP"] = "park";
|
|
9
|
-
SalesDeliveryTypes["ADDRESS"] = "address";
|
|
10
|
-
SalesDeliveryTypes["PORT"] = "port";
|
|
11
|
-
SalesDeliveryTypes["PORT_AND_SHIP"] = "portAndShip";
|
|
12
|
-
})(SalesDeliveryTypes || (SalesDeliveryTypes = {}));
|
|
13
|
-
export var SpoilerInfo;
|
|
14
|
-
(function (SpoilerInfo) {
|
|
15
|
-
SpoilerInfo["MOUNT"] = "mount";
|
|
16
|
-
SpoilerInfo["UNMOUNT"] = "unmount";
|
|
17
|
-
SpoilerInfo["NO_ACTION"] = "noAction";
|
|
18
|
-
})(SpoilerInfo || (SpoilerInfo = {}));
|
|
19
|
-
export var TransportationMode;
|
|
20
|
-
(function (TransportationMode) {
|
|
21
|
-
TransportationMode["BY_ROAD"] = "byRoad";
|
|
22
|
-
TransportationMode["ON_LOW_BED"] = "onLowBed";
|
|
23
|
-
})(TransportationMode || (TransportationMode = {}));
|
|
24
|
-
//# sourceMappingURL=deliveries.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.js","sourceRoot":"/","sources":["types/deliveries.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,4CAAmB,CAAA;IACnB,0CAAiB,CAAA;AACnB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,sCAAgB,CAAA;IAChB,yCAAmB,CAAA;IACnB,mCAAa,CAAA;IACb,mDAA6B,CAAA;AAC/B,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,qCAAsB,CAAA;AACxB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,wCAAkB,CAAA;IAClB,6CAAuB,CAAA;AACzB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B","sourcesContent":["import { LocationValue } from '@bisondesk/commons-sdk/types';\n\n/** Supplier collection keeps the existing address value in stored transports. */\nexport enum PurchaseDeliveryTypes {\n ADDRESS = 'address',\n DROP_OFF = 'park',\n}\n\nexport enum SalesDeliveryTypes {\n PICK_UP = 'park',\n ADDRESS = 'address',\n PORT = 'port',\n PORT_AND_SHIP = 'portAndShip',\n}\n\nexport enum SpoilerInfo {\n MOUNT = 'mount',\n UNMOUNT = 'unmount',\n NO_ACTION = 'noAction',\n}\n\nexport enum TransportationMode {\n BY_ROAD = 'byRoad',\n ON_LOW_BED = 'onLowBed',\n}\n\ntype BaseDeliveryType = {\n agreedPrice: string;\n spoiler?: SpoilerInfo;\n stackingVehicleNeeded?: boolean;\n detailsStacking?: string;\n};\n\nexport type PickUpDeliveryType = BaseDeliveryType & {\n type: SalesDeliveryTypes.PICK_UP;\n urgent: boolean;\n transportationMode?: TransportationMode;\n detailsBorderCrossing?: string;\n technicalControlNeeded: boolean;\n insuranceNeeded: boolean;\n transitPlateBelgiumNeeded: boolean;\n transitPlateAustriaNeeded: boolean;\n licensePlateNeeded: boolean;\n dateOfPickUpByCustomer?: string;\n};\n\n/** The supplier brings the vehicle to our park without a collection address or distance. */\nexport type DropOffDeliveryType = BaseDeliveryType & {\n type: PurchaseDeliveryTypes.DROP_OFF;\n};\n\nexport type AddressDeliveryType<\n T extends SalesDeliveryTypes.ADDRESS | PurchaseDeliveryTypes.ADDRESS = SalesDeliveryTypes.ADDRESS,\n> = BaseDeliveryType & {\n type: T;\n address: LocationValue;\n distanceKm: string;\n technicalControlNeeded: boolean;\n};\n\nexport type PortDeliverytype = BaseDeliveryType & {\n type: SalesDeliveryTypes.PORT | SalesDeliveryTypes.PORT_AND_SHIP;\n portOriginId: string;\n portDestination?: string;\n shippingCompany?: string;\n portToPortCostPrice: string;\n parkToPortCostPrice?: string;\n portToPortMargin: string;\n ets?: string;\n eta?: string;\n etd?: string;\n shipClosingDate?: string;\n bookingRef?: string;\n deliveryLocation?: string;\n};\n\nexport type SalesDeliveryType = PickUpDeliveryType | AddressDeliveryType | PortDeliverytype;\n\n/** Earlier SDKs also used the sales address enum for purchase collection. Both store address. */\nexport type PurchaseDeliveryType =\n | AddressDeliveryType<SalesDeliveryTypes.ADDRESS | PurchaseDeliveryTypes.ADDRESS>\n | DropOffDeliveryType;\n\nexport type DeliveryLocationValue = Omit<LocationValue, 'addressLine1' | 'city'> & {\n addressLine1: string;\n city: string;\n};\n\nexport type DeliveryRoutesRequest = {\n origin: DeliveryLocationValue;\n destination: DeliveryLocationValue;\n};\n"]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { AddressDeliveryType, PurchaseDeliveryType, PurchaseDeliveryTypes, SalesDeliveryType, SalesDeliveryTypes } from '../types/deliveries.js';
|
|
2
|
-
export declare const isAddressDelivery: (delivery?: PurchaseDeliveryType | SalesDeliveryType) => delivery is AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS | SalesDeliveryTypes.ADDRESS>;
|
|
3
|
-
//# sourceMappingURL=deliveries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.d.ts","sourceRoot":"/","sources":["utils/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,iBAAiB,cACjB,oBAAoB,GAAG,iBAAiB,KAClD,QAAQ,IAAI,mBAAmB,CAAC,qBAAqB,CAAC,OAAO,GAAG,kBAAkB,CAAC,OAAO,CACM,CAAC"}
|
package/lib/utils/deliveries.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.js","sourceRoot":"/","sources":["utils/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,qBAAqB,EAErB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,QAAmD,EAC0C,EAAE,CAC/F,QAAQ,EAAE,IAAI,KAAK,qBAAqB,CAAC,OAAO,IAAI,QAAQ,EAAE,IAAI,KAAK,kBAAkB,CAAC,OAAO,CAAC","sourcesContent":["import {\n AddressDeliveryType,\n PurchaseDeliveryType,\n PurchaseDeliveryTypes,\n SalesDeliveryType,\n SalesDeliveryTypes,\n} from '../types/deliveries.js';\n\n/** Purchase collection and sales delivery share the same stored address fields. */\nexport const isAddressDelivery = (\n delivery?: PurchaseDeliveryType | SalesDeliveryType,\n): delivery is AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS | SalesDeliveryTypes.ADDRESS> =>\n delivery?.type === PurchaseDeliveryTypes.ADDRESS || delivery?.type === SalesDeliveryTypes.ADDRESS;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.test.d.ts","sourceRoot":"/","sources":["utils/deliveries.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { DeliveryTypes } from '@bisondesk/core-sdk/types/quotes';
|
|
2
|
-
import { expectTypeOf } from 'vitest';
|
|
3
|
-
import { PurchaseDeliveryTypes, SalesDeliveryTypes, } from '../types/deliveries.js';
|
|
4
|
-
import { isAddressDelivery } from './deliveries.js';
|
|
5
|
-
test('purchase and sales contracts keep supplier drop-off and customer pick-up separate', () => {
|
|
6
|
-
expectTypeOf().not.toMatchTypeOf();
|
|
7
|
-
expectTypeOf().not.toMatchTypeOf();
|
|
8
|
-
expectTypeOf().toMatchTypeOf();
|
|
9
|
-
expectTypeOf().toMatchTypeOf();
|
|
10
|
-
});
|
|
11
|
-
test('the previous quote export keeps its four sales methods', () => {
|
|
12
|
-
expect(DeliveryTypes).toEqual(SalesDeliveryTypes);
|
|
13
|
-
expect(Object.values(DeliveryTypes)).toEqual(['park', 'address', 'port', 'portAndShip']);
|
|
14
|
-
});
|
|
15
|
-
test.each([
|
|
16
|
-
SalesDeliveryTypes.ADDRESS,
|
|
17
|
-
PurchaseDeliveryTypes.ADDRESS,
|
|
18
|
-
])('reads the address fields for %s', (type) => {
|
|
19
|
-
const delivery = {
|
|
20
|
-
type,
|
|
21
|
-
address: { country: 'be', city: 'Gent' },
|
|
22
|
-
distanceKm: '100',
|
|
23
|
-
agreedPrice: '0',
|
|
24
|
-
technicalControlNeeded: false,
|
|
25
|
-
};
|
|
26
|
-
expect(isAddressDelivery(delivery)).toBe(true);
|
|
27
|
-
});
|
|
28
|
-
test('a supplier drop-off has no collection address', () => {
|
|
29
|
-
expect(isAddressDelivery({
|
|
30
|
-
type: PurchaseDeliveryTypes.DROP_OFF,
|
|
31
|
-
agreedPrice: '0',
|
|
32
|
-
})).toBe(false);
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=deliveries.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.test.js","sourceRoot":"/","sources":["utils/deliveries.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAKL,qBAAqB,EAErB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,IAAI,CAAC,mFAAmF,EAAE,GAAG,EAAE;IAC7F,YAAY,EAAuB,CAAC,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AddressDeliveryType,\n DropOffDeliveryType,\n PickUpDeliveryType,\n PurchaseDeliveryType,\n PurchaseDeliveryTypes,\n SalesDeliveryType,\n SalesDeliveryTypes,\n} from '../types/deliveries.js';\nimport { isAddressDelivery } from './deliveries.js';\n\ntest('purchase and sales contracts keep supplier drop-off and customer pick-up separate', () => {\n expectTypeOf<DropOffDeliveryType>().not.toMatchTypeOf<SalesDeliveryType>();\n expectTypeOf<PickUpDeliveryType>().not.toMatchTypeOf<PurchaseDeliveryType>();\n expectTypeOf<AddressDeliveryType>().toMatchTypeOf<PurchaseDeliveryType>();\n expectTypeOf<\n AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS>\n >().toMatchTypeOf<PurchaseDeliveryType>();\n});\n\ntest('the previous quote export keeps its four sales methods', () => {\n expect(DeliveryTypes).toEqual(SalesDeliveryTypes);\n expect(Object.values(DeliveryTypes)).toEqual(['park', 'address', 'port', 'portAndShip']);\n});\n\ntest.each([\n SalesDeliveryTypes.ADDRESS,\n PurchaseDeliveryTypes.ADDRESS,\n] as const)('reads the address fields for %s', (type) => {\n const delivery: AddressDeliveryType<SalesDeliveryTypes.ADDRESS | PurchaseDeliveryTypes.ADDRESS> =\n {\n type,\n address: { country: 'be', city: 'Gent' },\n distanceKm: '100',\n agreedPrice: '0',\n technicalControlNeeded: false,\n };\n expect(isAddressDelivery(delivery)).toBe(true);\n});\n\ntest('a supplier drop-off has no collection address', () => {\n expect(\n isAddressDelivery({\n type: PurchaseDeliveryTypes.DROP_OFF,\n agreedPrice: '0',\n }),\n ).toBe(false);\n});\n"]}
|
package/src/types/deliveries.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { LocationValue } from '@bisondesk/commons-sdk/types';
|
|
2
|
-
|
|
3
|
-
/** Supplier collection keeps the existing address value in stored transports. */
|
|
4
|
-
export enum PurchaseDeliveryTypes {
|
|
5
|
-
ADDRESS = 'address',
|
|
6
|
-
DROP_OFF = 'park',
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export enum SalesDeliveryTypes {
|
|
10
|
-
PICK_UP = 'park',
|
|
11
|
-
ADDRESS = 'address',
|
|
12
|
-
PORT = 'port',
|
|
13
|
-
PORT_AND_SHIP = 'portAndShip',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export enum SpoilerInfo {
|
|
17
|
-
MOUNT = 'mount',
|
|
18
|
-
UNMOUNT = 'unmount',
|
|
19
|
-
NO_ACTION = 'noAction',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export enum TransportationMode {
|
|
23
|
-
BY_ROAD = 'byRoad',
|
|
24
|
-
ON_LOW_BED = 'onLowBed',
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
type BaseDeliveryType = {
|
|
28
|
-
agreedPrice: string;
|
|
29
|
-
spoiler?: SpoilerInfo;
|
|
30
|
-
stackingVehicleNeeded?: boolean;
|
|
31
|
-
detailsStacking?: string;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type PickUpDeliveryType = BaseDeliveryType & {
|
|
35
|
-
type: SalesDeliveryTypes.PICK_UP;
|
|
36
|
-
urgent: boolean;
|
|
37
|
-
transportationMode?: TransportationMode;
|
|
38
|
-
detailsBorderCrossing?: string;
|
|
39
|
-
technicalControlNeeded: boolean;
|
|
40
|
-
insuranceNeeded: boolean;
|
|
41
|
-
transitPlateBelgiumNeeded: boolean;
|
|
42
|
-
transitPlateAustriaNeeded: boolean;
|
|
43
|
-
licensePlateNeeded: boolean;
|
|
44
|
-
dateOfPickUpByCustomer?: string;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/** The supplier brings the vehicle to our park without a collection address or distance. */
|
|
48
|
-
export type DropOffDeliveryType = BaseDeliveryType & {
|
|
49
|
-
type: PurchaseDeliveryTypes.DROP_OFF;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type AddressDeliveryType<
|
|
53
|
-
T extends SalesDeliveryTypes.ADDRESS | PurchaseDeliveryTypes.ADDRESS = SalesDeliveryTypes.ADDRESS,
|
|
54
|
-
> = BaseDeliveryType & {
|
|
55
|
-
type: T;
|
|
56
|
-
address: LocationValue;
|
|
57
|
-
distanceKm: string;
|
|
58
|
-
technicalControlNeeded: boolean;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export type PortDeliverytype = BaseDeliveryType & {
|
|
62
|
-
type: SalesDeliveryTypes.PORT | SalesDeliveryTypes.PORT_AND_SHIP;
|
|
63
|
-
portOriginId: string;
|
|
64
|
-
portDestination?: string;
|
|
65
|
-
shippingCompany?: string;
|
|
66
|
-
portToPortCostPrice: string;
|
|
67
|
-
parkToPortCostPrice?: string;
|
|
68
|
-
portToPortMargin: string;
|
|
69
|
-
ets?: string;
|
|
70
|
-
eta?: string;
|
|
71
|
-
etd?: string;
|
|
72
|
-
shipClosingDate?: string;
|
|
73
|
-
bookingRef?: string;
|
|
74
|
-
deliveryLocation?: string;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export type SalesDeliveryType = PickUpDeliveryType | AddressDeliveryType | PortDeliverytype;
|
|
78
|
-
|
|
79
|
-
/** Earlier SDKs also used the sales address enum for purchase collection. Both store address. */
|
|
80
|
-
export type PurchaseDeliveryType =
|
|
81
|
-
| AddressDeliveryType<SalesDeliveryTypes.ADDRESS | PurchaseDeliveryTypes.ADDRESS>
|
|
82
|
-
| DropOffDeliveryType;
|
|
83
|
-
|
|
84
|
-
export type DeliveryLocationValue = Omit<LocationValue, 'addressLine1' | 'city'> & {
|
|
85
|
-
addressLine1: string;
|
|
86
|
-
city: string;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export type DeliveryRoutesRequest = {
|
|
90
|
-
origin: DeliveryLocationValue;
|
|
91
|
-
destination: DeliveryLocationValue;
|
|
92
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { DeliveryTypes } from '@bisondesk/core-sdk/types/quotes';
|
|
2
|
-
import { expectTypeOf } from 'vitest';
|
|
3
|
-
import {
|
|
4
|
-
AddressDeliveryType,
|
|
5
|
-
DropOffDeliveryType,
|
|
6
|
-
PickUpDeliveryType,
|
|
7
|
-
PurchaseDeliveryType,
|
|
8
|
-
PurchaseDeliveryTypes,
|
|
9
|
-
SalesDeliveryType,
|
|
10
|
-
SalesDeliveryTypes,
|
|
11
|
-
} from '../types/deliveries.js';
|
|
12
|
-
import { isAddressDelivery } from './deliveries.js';
|
|
13
|
-
|
|
14
|
-
test('purchase and sales contracts keep supplier drop-off and customer pick-up separate', () => {
|
|
15
|
-
expectTypeOf<DropOffDeliveryType>().not.toMatchTypeOf<SalesDeliveryType>();
|
|
16
|
-
expectTypeOf<PickUpDeliveryType>().not.toMatchTypeOf<PurchaseDeliveryType>();
|
|
17
|
-
expectTypeOf<AddressDeliveryType>().toMatchTypeOf<PurchaseDeliveryType>();
|
|
18
|
-
expectTypeOf<
|
|
19
|
-
AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS>
|
|
20
|
-
>().toMatchTypeOf<PurchaseDeliveryType>();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test('the previous quote export keeps its four sales methods', () => {
|
|
24
|
-
expect(DeliveryTypes).toEqual(SalesDeliveryTypes);
|
|
25
|
-
expect(Object.values(DeliveryTypes)).toEqual(['park', 'address', 'port', 'portAndShip']);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test.each([
|
|
29
|
-
SalesDeliveryTypes.ADDRESS,
|
|
30
|
-
PurchaseDeliveryTypes.ADDRESS,
|
|
31
|
-
] as const)('reads the address fields for %s', (type) => {
|
|
32
|
-
const delivery: AddressDeliveryType<SalesDeliveryTypes.ADDRESS | PurchaseDeliveryTypes.ADDRESS> =
|
|
33
|
-
{
|
|
34
|
-
type,
|
|
35
|
-
address: { country: 'be', city: 'Gent' },
|
|
36
|
-
distanceKm: '100',
|
|
37
|
-
agreedPrice: '0',
|
|
38
|
-
technicalControlNeeded: false,
|
|
39
|
-
};
|
|
40
|
-
expect(isAddressDelivery(delivery)).toBe(true);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('a supplier drop-off has no collection address', () => {
|
|
44
|
-
expect(
|
|
45
|
-
isAddressDelivery({
|
|
46
|
-
type: PurchaseDeliveryTypes.DROP_OFF,
|
|
47
|
-
agreedPrice: '0',
|
|
48
|
-
}),
|
|
49
|
-
).toBe(false);
|
|
50
|
-
});
|
package/src/utils/deliveries.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AddressDeliveryType,
|
|
3
|
-
PurchaseDeliveryType,
|
|
4
|
-
PurchaseDeliveryTypes,
|
|
5
|
-
SalesDeliveryType,
|
|
6
|
-
SalesDeliveryTypes,
|
|
7
|
-
} from '../types/deliveries.js';
|
|
8
|
-
|
|
9
|
-
/** Purchase collection and sales delivery share the same stored address fields. */
|
|
10
|
-
export const isAddressDelivery = (
|
|
11
|
-
delivery?: PurchaseDeliveryType | SalesDeliveryType,
|
|
12
|
-
): delivery is AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS | SalesDeliveryTypes.ADDRESS> =>
|
|
13
|
-
delivery?.type === PurchaseDeliveryTypes.ADDRESS || delivery?.type === SalesDeliveryTypes.ADDRESS;
|