@bisondesk/core-sdk 1.0.658 → 1.0.660
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/deliveries.d.ts +2 -0
- package/lib/types/deliveries.d.ts.map +1 -1
- package/lib/types/deliveries.js +6 -0
- package/lib/types/deliveries.js.map +1 -1
- package/lib/types/journeys.d.ts +1 -0
- package/lib/types/journeys.d.ts.map +1 -1
- package/lib/types/journeys.js.map +1 -1
- package/lib/types/reports-arrivals.d.ts +2 -1
- package/lib/types/reports-arrivals.d.ts.map +1 -1
- package/lib/types/reports-arrivals.js.map +1 -1
- package/lib/types/transports.d.ts +12 -8
- package/lib/types/transports.d.ts.map +1 -1
- package/lib/types/transports.js +2 -7
- package/lib/types/transports.js.map +1 -1
- package/lib/utils/deliveries.d.ts +2 -1
- package/lib/utils/deliveries.d.ts.map +1 -1
- package/lib/utils/deliveries.js +1 -0
- package/lib/utils/deliveries.js.map +1 -1
- package/lib/utils/reports-arrivals.d.ts.map +1 -1
- package/lib/utils/reports-arrivals.js +7 -3
- package/lib/utils/reports-arrivals.js.map +1 -1
- package/lib/utils/transports.d.ts +3 -0
- package/lib/utils/transports.d.ts.map +1 -1
- package/lib/utils/transports.js +4 -2
- package/lib/utils/transports.js.map +1 -1
- package/package.json +1 -1
- package/src/types/deliveries.ts +11 -2
- package/src/types/journeys.ts +6 -0
- package/src/types/reports-arrivals.ts +7 -1
- package/src/types/transports.ts +14 -15
- package/src/utils/deliveries.ts +6 -0
- package/src/utils/reports-arrivals.ts +7 -3
- package/src/utils/transports.ts +8 -6
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LocationValue } from '@bisondesk/commons-sdk/types';
|
|
2
|
+
export declare const PARK_DELIVERY_TYPE = "park";
|
|
2
3
|
export declare enum PurchaseDeliveryTypes {
|
|
3
4
|
ADDRESS = "address",
|
|
4
5
|
DROP_OFF = "park"
|
|
@@ -45,6 +46,7 @@ export type AddressDeliveryType<T extends SalesDeliveryTypes.ADDRESS | PurchaseD
|
|
|
45
46
|
distanceKm: string;
|
|
46
47
|
technicalControlNeeded: boolean;
|
|
47
48
|
};
|
|
49
|
+
export declare const ADDRESS_DELIVERY_FIELDS: readonly ["address", "distanceKm", "technicalControlNeeded"];
|
|
48
50
|
export type PortDeliverytype = BaseDeliveryType & {
|
|
49
51
|
type: SalesDeliveryTypes.PORT | SalesDeliveryTypes.PORT_AND_SHIP;
|
|
50
52
|
portOriginId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.d.ts","sourceRoot":"/","sources":["types/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,oBAAY,qBAAqB;IAC/B,OAAO,YAAY;IACnB,QAAQ,
|
|
1
|
+
{"version":3,"file":"deliveries.d.ts","sourceRoot":"/","sources":["types/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAGzC,oBAAY,qBAAqB;IAC/B,OAAO,YAAY;IACnB,QAAQ,SAAqB;CAC9B;AAED,oBAAY,kBAAkB;IAC5B,OAAO,SAAqB;IAC5B,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,aAAa,gBAAgB;CAC9B;AAED,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,SAAS,aAAa;CACvB;AAED,oBAAY,kBAAkB;IAC5B,OAAO,WAAW;IAClB,UAAU,aAAa;CACxB;AAED,KAAK,gBAAgB,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,kBAAkB,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M,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAG5F,MAAM,MAAM,oBAAoB,GAC5B,mBAAmB,CAAC,kBAAkB,CAAC,OAAO,GAAG,qBAAqB,CAAC,OAAO,CAAC,GAC/E,mBAAmB,CAAC;AAExB,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,aAAa,EAAE,cAAc,GAAG,MAAM,CAAC,GAAG;IACjF,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,EAAE,qBAAqB,CAAC;CACpC,CAAC"}
|
package/lib/types/deliveries.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export const PARK_DELIVERY_TYPE = 'park';
|
|
1
2
|
export var PurchaseDeliveryTypes;
|
|
2
3
|
(function (PurchaseDeliveryTypes) {
|
|
3
4
|
PurchaseDeliveryTypes["ADDRESS"] = "address";
|
|
@@ -21,4 +22,9 @@ export var TransportationMode;
|
|
|
21
22
|
TransportationMode["BY_ROAD"] = "byRoad";
|
|
22
23
|
TransportationMode["ON_LOW_BED"] = "onLowBed";
|
|
23
24
|
})(TransportationMode || (TransportationMode = {}));
|
|
25
|
+
export const ADDRESS_DELIVERY_FIELDS = [
|
|
26
|
+
'address',
|
|
27
|
+
'distanceKm',
|
|
28
|
+
'technicalControlNeeded',
|
|
29
|
+
];
|
|
24
30
|
//# sourceMappingURL=deliveries.js.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"file":"deliveries.js","sourceRoot":"/","sources":["types/deliveries.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAGzC,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,4CAAmB,CAAA;IACnB,0CAA6B,CAAA;AAC/B,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,sCAA4B,CAAA;IAC5B,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;AAoCD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS;IACT,YAAY;IACZ,wBAAwB;CACiC,CAAC","sourcesContent":["import { LocationValue } from '@bisondesk/commons-sdk/types';\n\n/** Supplier drop-off and customer pickup both take place at our park. */\nexport const PARK_DELIVERY_TYPE = 'park';\n\n/** Supplier collection keeps the existing address value in stored transports. */\nexport enum PurchaseDeliveryTypes {\n ADDRESS = 'address',\n DROP_OFF = PARK_DELIVERY_TYPE,\n}\n\nexport enum SalesDeliveryTypes {\n PICK_UP = PARK_DELIVERY_TYPE,\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 const ADDRESS_DELIVERY_FIELDS = [\n 'address',\n 'distanceKm',\n 'technicalControlNeeded',\n] as const satisfies readonly (keyof AddressDeliveryType)[];\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"]}
|
package/lib/types/journeys.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journeys.d.ts","sourceRoot":"/","sources":["types/journeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAEpE,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,cAAc,CAAC;IACtB,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;IACpD,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAKhC,uBAAuB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"journeys.d.ts","sourceRoot":"/","sources":["types/journeys.ts"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CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG;IAC/F,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journeys.js","sourceRoot":"/","sources":["types/journeys.ts"],"names":[],"mappings":"","sourcesContent":["import { TaskPriority } from '@bisondesk/commons-sdk/tasks';\nimport { MultiLangValue } from '@bisondesk/commons-sdk/types';\nimport type { AdditionalOperation, RulesLogic } from 'json-logic-js';\nimport { BusinessEntityIds } from '../constants.js';\n\nexport type JourneyTaskDependency = RulesLogic<AdditionalOperation>;\n\nexport type JourneyTaskConfig<T> = {\n configId: string;\n title: MultiLangValue;\n entryCriteria?: JourneyTaskDependency;\n priority?: TaskPriority;\n tag?: string;\n description?: MultiLangValue;\n dueDateOn?: string;\n completionCriteria: RulesLogic<AdditionalOperation>;\n prerequisiteTaskIds: string[];\n requiredAtStatus?: T; //Required at a given status or higher\n disabled: boolean;\n autoAssignToRequester?: boolean;\n /**\n * Assign the task to whoever handles the record it hangs off, as the processor for that entity\n * defines it. Ignored when the processor has no such person. `autoAssignToRequester` wins.\n */\n autoAssignToRecordOwner?: boolean;\n};\n\nexport type JourneyConfig<T> = {\n businessEntityId: BusinessEntityIds;\n versionId: string;\n tasks: JourneyTaskConfig<T>[];\n createdAt: string;\n createdBy: string;\n disabled: boolean;\n};\n\nexport type JourneyConfigCustomTasks<T> = Pick<JourneyConfig<T>, 'businessEntityId' | 'tasks'> & {\n recordId: string;\n createdAt: string;\n createdBy: string;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"journeys.js","sourceRoot":"/","sources":["types/journeys.ts"],"names":[],"mappings":"","sourcesContent":["import { TaskPriority } from '@bisondesk/commons-sdk/tasks';\nimport { MultiLangValue } from '@bisondesk/commons-sdk/types';\nimport type { AdditionalOperation, RulesLogic } from 'json-logic-js';\nimport { BusinessEntityIds } from '../constants.js';\n\nexport type JourneyTaskDependency = RulesLogic<AdditionalOperation>;\n\nexport type JourneyTaskConfig<T> = {\n configId: string;\n title: MultiLangValue;\n entryCriteria?: JourneyTaskDependency;\n priority?: TaskPriority;\n tag?: string;\n description?: MultiLangValue;\n dueDateOn?: string;\n completionCriteria: RulesLogic<AdditionalOperation>;\n prerequisiteTaskIds: string[];\n requiredAtStatus?: T; //Required at a given status or higher\n disabled: boolean;\n autoAssignToRequester?: boolean;\n /**\n * Assign the task to whoever handles the record it hangs off, as the processor for that entity\n * defines it. Ignored when the processor has no such person. `autoAssignToRequester` wins.\n */\n autoAssignToRecordOwner?: boolean;\n /**\n * A user id to fall back on when neither auto-assign option yields anyone — for work that always\n * lands on the same desk whoever triggered it, such as raising a supplier bonus invoice. Last\n * resort by design, so adding it cannot change an existing config.\n */\n assignTo?: string;\n};\n\nexport type JourneyConfig<T> = {\n businessEntityId: BusinessEntityIds;\n versionId: string;\n tasks: JourneyTaskConfig<T>[];\n createdAt: string;\n createdBy: string;\n disabled: boolean;\n};\n\nexport type JourneyConfigCustomTasks<T> = Pick<JourneyConfig<T>, 'businessEntityId' | 'tasks'> & {\n recordId: string;\n createdAt: string;\n createdBy: string;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LocationValue } from '@bisondesk/commons-sdk/locations';
|
|
2
|
-
import { TransportLocationSource, TransportStatus, TransportType } from './transports.js';
|
|
2
|
+
import { Transport, TransportLocationSource, TransportStatus, TransportType } from './transports.js';
|
|
3
3
|
import { VehiclePurchaseDeliveryType } from './vehicles.js';
|
|
4
4
|
export declare const ARRIVALS_HISTORY_MONTHS = 24;
|
|
5
5
|
export declare const ARRIVALS_USUAL_WAIT_MONTHS = 3;
|
|
@@ -7,6 +7,7 @@ export declare const ARRIVALS_LATE_AFTER_DAYS = 30;
|
|
|
7
7
|
export type ExpectedArrivalTransport = {
|
|
8
8
|
id: string;
|
|
9
9
|
type: TransportType;
|
|
10
|
+
delivery: Pick<Transport['delivery'], 'type'>;
|
|
10
11
|
status: TransportStatus;
|
|
11
12
|
date?: string;
|
|
12
13
|
transportCompany?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reports-arrivals.d.ts","sourceRoot":"/","sources":["types/reports-arrivals.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"reports-arrivals.d.ts","sourceRoot":"/","sources":["types/reports-arrivals.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,eAAe,EACf,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAG5D,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAG1C,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAG5C,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9C,MAAM,EAAE,eAAe,CAAC;IAExB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EA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C;IAEzB,SAAS,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reports-arrivals.js","sourceRoot":"/","sources":["types/reports-arrivals.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reports-arrivals.js","sourceRoot":"/","sources":["types/reports-arrivals.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAG1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAG5C,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC","sourcesContent":["/**\n * Expected arrivals report — the payload for the `Reports → Expected arrivals` tab: every\n * vehicle whose supplier has been fully paid but which has not arrived on our park (or, for a\n * direct supplier-to-client delivery, has not been delivered), with the monthly history of how\n * long a paid vehicle takes to arrive. The per-purchaser overview and the KPIs follow the\n * table's filters, so the client computes them from the rows it shows.\n *\n * The API returns raw numbers only; the client formats amounts and dates.\n */\nimport { LocationValue } from '@bisondesk/commons-sdk/locations';\nimport {\n Transport,\n TransportLocationSource,\n TransportStatus,\n TransportType,\n} from './transports.js';\nimport { VehiclePurchaseDeliveryType } from './vehicles.js';\n\n/** Months of arrivals the history chart covers. */\nexport const ARRIVALS_HISTORY_MONTHS = 24;\n\n/** Full months of arrivals behind the \"usual wait\" benchmark. */\nexport const ARRIVALS_USUAL_WAIT_MONTHS = 3;\n\n/** Days after the full payment beyond which a vehicle still not arrived is flagged. */\nexport const ARRIVALS_LATE_AFTER_DAYS = 30;\n\nexport type ExpectedArrivalTransport = {\n id: string;\n type: TransportType;\n delivery: Pick<Transport['delivery'], 'type'>;\n status: TransportStatus;\n /** Planned pick-up / delivery day. */\n date?: string;\n transportCompany?: string;\n driver?: string;\n};\n\nexport type ExpectedArrivalRow = {\n vehicleId: string;\n stockNumber: string;\n title: string;\n /** Vehicle condition; null when it has not been recorded. */\n used: boolean | null;\n /** Main picture, else the first picture; the client appends the resize parameters. */\n pictureUrl?: string;\n /** The client reads the branch location for the maps origin. */\n branchId: string;\n currency: string;\n /** User id from `purchase.purchasedBy`; the client resolves name + avatar. */\n purchasedBy: string;\n supplier: { id: string; name: string };\n /** `deal.purchase`, exclusive VAT. */\n purchasePrice: number | null;\n /** Σ of the payment rows marked paid — what left the bank. */\n amountPaid: number;\n fullPaymentSentAt: string;\n firstPaymentSentAt?: string;\n daysSincePayment: number;\n sold: boolean;\n opportunityId?: string;\n clientOrgId?: string;\n clientName?: string;\n /** The purchase transport's delivery address, else the supplier's legal address. */\n pickupAddress?: { address: LocationValue; source: TransportLocationSource };\n deliveryType?: VehiclePurchaseDeliveryType;\n /** Direct supplier-to-client delivery: no purchase logistics, the sale delivery is the exit. */\n readyToDeliver: boolean;\n availableWeek?: string;\n /** The purchase transport for a park vehicle, the sale delivery for a direct delivery. */\n transport?: ExpectedArrivalTransport;\n};\n\n/** One month of arrivals, keyed by month of arrival. Percentiles cover the paid-first rows only. */\nexport type ArrivalsMonth = {\n /** `YYYY-MM`. */\n month: string;\n arrivals: number;\n /** Fully paid before arriving — the ones with a wait to measure. */\n paidFirst: number;\n arrivedBeforePaid: number;\n p50Days: number | null;\n p80Days: number | null;\n /** Paid-first arrivals that waited more than `ARRIVALS_LATE_AFTER_DAYS`. */\n late: number;\n};\n\n/** Days between the full payment and the arrival, over a window of arrivals. */\nexport type ArrivalsWait = { p50Days: number | null; p80Days: number | null };\n\nexport type ExpectedArrivalsReportResponse = {\n rows: ExpectedArrivalRow[];\n /** The last `ARRIVALS_HISTORY_MONTHS` months, oldest first, every month present. */\n history: ArrivalsMonth[];\n /** Over the last `ARRIVALS_USUAL_WAIT_MONTHS` full months of arrivals. */\n usualWait: ArrivalsWait;\n};\n\nexport type ExpectedArrivalsExportRequest = {\n vehicleIds: string[];\n};\n"]}
|
|
@@ -7,12 +7,9 @@ import { BaseSearchRequest, SortOrder } from './search.js';
|
|
|
7
7
|
import { DataRecord, ReferenceData } from './utils.js';
|
|
8
8
|
import { Vehicle, VehiclePurchase } from './vehicles.js';
|
|
9
9
|
export declare enum TransportType {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
SaleDelivery = "SALE_DELIVERY"
|
|
10
|
+
Purchase = "PURCHASE",
|
|
11
|
+
Sale = "SALE"
|
|
13
12
|
}
|
|
14
|
-
export type TransportPurchaseType = TransportType.PurchasePickUp | TransportType.PurchaseDropOff;
|
|
15
|
-
export declare const TransportPurchaseTypes: TransportPurchaseType[];
|
|
16
13
|
export declare enum TransportStatus {
|
|
17
14
|
Todo = "TODO",
|
|
18
15
|
Planning = "PLANNING",
|
|
@@ -78,10 +75,10 @@ export type Transport = {
|
|
|
78
75
|
updatedAt: string;
|
|
79
76
|
updatedBy: string;
|
|
80
77
|
} & ({
|
|
81
|
-
type:
|
|
78
|
+
type: TransportType.Purchase;
|
|
82
79
|
delivery: TransportPurchaseDeliveryType;
|
|
83
80
|
} | {
|
|
84
|
-
type: TransportType.
|
|
81
|
+
type: TransportType.Sale;
|
|
85
82
|
delivery: TransportSalesDeliveryType;
|
|
86
83
|
});
|
|
87
84
|
export declare enum TransportWarningCode {
|
|
@@ -102,7 +99,6 @@ export declare enum TransportActions {
|
|
|
102
99
|
SetBookingRef = "set_booking_ref"
|
|
103
100
|
}
|
|
104
101
|
export type TransportUpdate = {
|
|
105
|
-
type?: TransportPurchaseType;
|
|
106
102
|
delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;
|
|
107
103
|
notes?: string | null;
|
|
108
104
|
adminApproved?: boolean;
|
|
@@ -167,9 +163,16 @@ export type SearchTransport = {
|
|
|
167
163
|
};
|
|
168
164
|
};
|
|
169
165
|
export type SearchTransportList = PaginatedList<SearchTransport, ReferenceData>;
|
|
166
|
+
export type KanbanTransportGroup = {
|
|
167
|
+
representative: SearchTransport;
|
|
168
|
+
items: SearchTransport[];
|
|
169
|
+
totalCount: number;
|
|
170
|
+
nextToken?: string;
|
|
171
|
+
};
|
|
170
172
|
export type TransportKanbanColumn = {
|
|
171
173
|
status: TransportStatus;
|
|
172
174
|
results: SearchTransport[];
|
|
175
|
+
groups?: KanbanTransportGroup[];
|
|
173
176
|
totalCount: number;
|
|
174
177
|
};
|
|
175
178
|
export type MSearchTransportsKanbanColumn = {
|
|
@@ -178,6 +181,7 @@ export type MSearchTransportsKanbanColumn = {
|
|
|
178
181
|
};
|
|
179
182
|
export type KanbanTransportsSearchRequest = BaseSearchRequest & {
|
|
180
183
|
nextTokens?: Record<string, string | undefined>;
|
|
184
|
+
groupByOrganization?: boolean;
|
|
181
185
|
statusSortBy?: Record<TransportStatus, {
|
|
182
186
|
fieldId: string;
|
|
183
187
|
order: SortOrder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEzD,oBAAY,aAAa;IACvB,
|
|
1
|
+
{"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"m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M,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CACjD,CAAC"}
|
package/lib/types/transports.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { SalesDeliveryTypes, } from './deliveries.js';
|
|
2
2
|
export var TransportType;
|
|
3
3
|
(function (TransportType) {
|
|
4
|
-
TransportType["
|
|
5
|
-
TransportType["
|
|
6
|
-
TransportType["SaleDelivery"] = "SALE_DELIVERY";
|
|
4
|
+
TransportType["Purchase"] = "PURCHASE";
|
|
5
|
+
TransportType["Sale"] = "SALE";
|
|
7
6
|
})(TransportType || (TransportType = {}));
|
|
8
|
-
export const TransportPurchaseTypes = [
|
|
9
|
-
TransportType.PurchasePickUp,
|
|
10
|
-
TransportType.PurchaseDropOff,
|
|
11
|
-
];
|
|
12
7
|
export var TransportStatus;
|
|
13
8
|
(function (TransportStatus) {
|
|
14
9
|
TransportStatus["Todo"] = "TODO";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.js","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oDAAmC,CAAA;IACnC,sDAAqC,CAAA;IACrC,+CAA8B,CAAA;AAChC,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAKD,MAAM,CAAC,MAAM,sBAAsB,GAA4B;IAC7D,aAAa,CAAC,cAAc;IAC5B,aAAa,CAAC,eAAe;CAC9B,CAAC;AAEF,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,wCAAqB,CAAA;IACrB,kCAAe,CAAA;IACf,2DAAwC,CAAA;IACxC,uDAAoC,CAAA;IACpC,+CAA4B,CAAA;IAC5B,gCAAa,CAAA;AACf,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B;AAED,MAAM,CAAC,MAAM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AmD,CAAA;IACnD,uEAA6C,CAAA;IAC7C,qEAA2C,CAAA;IAC3C,+DAAqC,CAAA;AACvC,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AAcD,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,+DAAoC,CAAA;IACpC,qDAA0B,CAAA;IAC1B,qDAA0B,CAAA;AAC5B,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC","sourcesContent":["import { GPSCoord, NextList, PaginatedList } from '@bisondesk/commons-sdk/types';\nimport { Organization } from './crm.js';\nimport {\n AddressDeliveryType,\n PickUpDeliveryType,\n PortDeliverytype,\n PurchaseDeliveryType,\n SalesDeliveryTypes,\n} from './deliveries.js';\nimport { BaseEvent } from './internal-events.js';\nimport { Opportunity, OpportunityPaymentStatus } from './opportunities.js';\nimport { BaseSearchRequest, SortOrder } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle, VehiclePurchase } from './vehicles.js';\n\nexport enum TransportType {\n PurchasePickUp = 'PURCHASE_PICK_UP',\n PurchaseDropOff = 'PURCHASE_DROP_OFF',\n SaleDelivery = 'SALE_DELIVERY',\n}\n\n/** Both inbound journeys, whoever drives them. Mirrors the purchase's own delivery type. */\nexport type TransportPurchaseType = TransportType.PurchasePickUp | TransportType.PurchaseDropOff;\n\nexport const TransportPurchaseTypes: TransportPurchaseType[] = [\n TransportType.PurchasePickUp,\n TransportType.PurchaseDropOff,\n];\n\nexport enum TransportStatus {\n Todo = 'TODO',\n Planning = 'PLANNING',\n Ready = 'READY',\n ScheduledExternal = 'SCHEDULED_EXTERNAL',\n OngoingInternal = 'ONGOING_INTERNAL',\n OngoingShip = 'ONGOING_SHIP',\n Done = 'DONE',\n}\n\nexport const TransportStatusOrder: TransportStatus[] = [\n TransportStatus.Todo,\n TransportStatus.Planning,\n TransportStatus.Ready,\n TransportStatus.ScheduledExternal,\n TransportStatus.OngoingInternal,\n TransportStatus.OngoingShip,\n];\n\nexport const TransportDoneColumnId = TransportStatus.Done;\n\nexport const TransportKanbanEndColumns: TransportStatus[] = [TransportDoneColumnId];\nexport const TransportKanbanColumns: TransportStatus[] = [\n ...TransportStatusOrder,\n ...TransportKanbanEndColumns,\n];\n\nexport enum TransportPriority {\n Normal = 'NORMAL',\n High = 'HIGH',\n Urgent = 'URGENT',\n}\n\n/**\n * The customer collects the vehicle. Nothing is driven anywhere, but the papers still have to be\n * arranged and paid for — transit plates, technical control, insurance — which is why it is a\n * delivery type administration reviews rather than the absence of one.\n *\n * `dateOfPickUpByCustomer` is dropped from the quote's shape: the transport's own `date` is the\n * collection day, and two fields for one date only ever disagree.\n */\nexport type TransportPickUpDeliveryType = Omit<PickUpDeliveryType, 'dateOfPickUpByCustomer'>;\n\ntype TransportDeliveryExtras = {\n cleaningNeeded?: boolean;\n driver?: string;\n transportCompany?: string;\n date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)\n adminCost?: string; // user-entered administrative cost summed into totalCostExclVat\n stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings\n};\n\nexport type TransportSalesDeliveryType = (\n | PortDeliverytype\n | AddressDeliveryType\n | TransportPickUpDeliveryType\n) &\n TransportDeliveryExtras;\n\nexport type TransportPurchaseDeliveryType = PurchaseDeliveryType & TransportDeliveryExtras;\n\n/** @deprecated Use SalesDeliveryTypes from ./deliveries.js. */\nexport const TransportSalesDeliveryType = {\n Address: SalesDeliveryTypes.ADDRESS,\n Port: SalesDeliveryTypes.PORT,\n PortAndShip: SalesDeliveryTypes.PORT_AND_SHIP,\n PickUp: SalesDeliveryTypes.PICK_UP,\n} as const;\n\nexport type Transport = {\n id: string;\n vehicleId: string;\n opportunityId?: string;\n\n status: TransportStatus;\n priority: TransportPriority;\n\n // administrative fields\n adminApproved: boolean;\n adminApprovedAt?: string;\n adminApprovedBy?: string;\n transportWithoutPayment?: boolean;\n notes?: string;\n\n totals: {\n totalRetailAmountExclVat: string;\n totalCostExclVat: string;\n estimatedTotalCostExclVat?: string;\n };\n\n log: Array<{\n status: TransportStatus;\n completedAt: string;\n completedBy: string;\n }>;\n\n doneAt?: string;\n doneBy?: string;\n canceledAt?: string;\n canceledBy?: string;\n\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n} & (\n | {\n type: TransportPurchaseType;\n delivery: TransportPurchaseDeliveryType;\n }\n | {\n type: TransportType.SaleDelivery;\n delivery: TransportSalesDeliveryType;\n }\n);\n\nexport enum TransportWarningCode {\n PurchaseLogisticsNotReady = 'purchase_logistics_not_ready',\n}\n\nexport type TransportWarning = {\n code: TransportWarningCode;\n details?: Record<string, string | number | boolean>;\n};\n\nexport type TransportCost = Pick<Transport, 'totals'>;\n\nexport type TransportRecord = DataRecord<Transport>;\n\n/**\n * What a requester may change on a transport, field group by field group. The server filters an\n * update through these and returns the ones granted on the record, so the drawer disables what the\n * user cannot touch instead of deciding for itself from the user's roles.\n */\nexport enum TransportActions {\n /** The route: addresses, ports, dates, costs. */\n SetDelivery = 'set_delivery',\n SetNotes = 'set_notes',\n /** The administrative sign-off, and the clearance to move before the payment. */\n SetApproval = 'set_approval',\n /** The board column. */\n SetStatus = 'set_status',\n SetPriority = 'set_priority',\n SetBookingRef = 'set_booking_ref',\n}\n\n/**\n * Every field a write may set, in one shape. `delivery` is replaced whole when it is sent — there is\n * no partial merge into the stored one — which is why `bookingRef` rides alongside as a scalar the\n * server writes into the delivery it ends up with.\n */\nexport type TransportUpdate = {\n /** Changes the purchase method and the purchase agreement together. */\n type?: TransportPurchaseType;\n delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;\n notes?: string | null;\n adminApproved?: boolean;\n transportWithoutPayment?: boolean;\n status?: TransportStatus;\n priority?: TransportPriority;\n bookingRef?: string | null;\n};\n\ntype BaseTransportEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n transportId: string;\n};\n\nexport type TransportCreateEvent = BaseTransportEvent & {\n action: 'create';\n data: Transport;\n previousData?: undefined;\n};\n\nexport type TransportUpdateEvent = BaseTransportEvent & {\n action: 'update';\n data: Transport;\n previousData: Transport;\n};\n\n/** Published whenever a transport is written. Carries both sides so subscribers judge relevance. */\nexport type TransportEvent = BaseEvent & (TransportCreateEvent | TransportUpdateEvent);\n\nexport enum TransportPaymentStatus {\n PaymentNotNeeded = 'payment_not_needed',\n NoPayment = 'no_payment',\n PartialPaymentReceived = 'partial_payment_received',\n FullPaymentReceived = 'full_payment_received',\n PartialPaymentSent = 'partial_payment_sent',\n FullPaymentSent = 'full_payment_sent',\n}\n\n/**\n * Where the money stands on the record the transport serves: the customer's payments on the\n * opportunity for a sale delivery, ours to the supplier for a purchase pick-up. Denormalised at\n * indexing time so the board can show it without joining.\n */\nexport type TransportPayment = {\n status: OpportunityPaymentStatus;\n /** Only a sale delivery knows the ratio — a pick-up has milestones, not a running total. */\n percentagePaid?: string;\n};\n\n/** Which address the map pin came from, so the UI can tell an exact pin from an approximate one. */\nexport enum TransportLocationSource {\n DeliveryAddress = 'delivery_address',\n OriginPort = 'origin_port',\n OrgAddress = 'org_address',\n}\n\nexport type SearchTransport = {\n transport: Transport;\n vehicle: Vehicle;\n org: Organization;\n opportunity?: Opportunity;\n purchase: VehiclePurchase;\n tasks: {\n totalTasks: number;\n openTasks: number;\n nextDueAt?: string;\n };\n custom: {\n commercialUserIds: string[];\n warnings: TransportWarning[];\n priorityOrdinal: number;\n payment: TransportPayment;\n paymentStatus: TransportPaymentStatus;\n /**\n * Where the transport happens: the delivery address, or the origin port for a shipped delivery.\n * Denormalised into one field because the map clusters over a single geo_point, and a port\n * delivery carries no address of its own.\n *\n * Deliberately narrower than `GPSCoord`: a geo_point field rejects any key beyond lat/lon, so\n * the map zoom the coordinates picker stores must not reach the index.\n */\n location?: Pick<GPSCoord, 'lat' | 'lon'>;\n locationSource?: TransportLocationSource;\n };\n};\n\nexport type SearchTransportList = PaginatedList<SearchTransport, ReferenceData>;\n\nexport type TransportKanbanColumn = {\n status: TransportStatus;\n results: SearchTransport[];\n totalCount: number;\n};\n\nexport type MSearchTransportsKanbanColumn = {\n column: TransportKanbanColumn;\n nextToken?: string;\n};\n\nexport type KanbanTransportsSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n statusSortBy?: Record<TransportStatus, { fieldId: string; order: SortOrder }[]>;\n};\n\nexport type KanbanTransportsNextList = Omit<\n NextList<TransportKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"transports.js","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,8BAAa,CAAA;AACf,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,wCAAqB,CAAA;IACrB,kCAAe,CAAA;IACf,2DAAwC,CAAA;IACxC,uDAAoC,CAAA;IACpC,+CAA4B,CAAA;IAC5B,gCAAa,CAAA;AACf,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACrD,eAAe,CAAC,IAAI;IACpB,eAAe,CAAC,QAAQ;IACxB,eAAe,CAAC,KAAK;IACrB,eAAe,CAAC,iBAAiB;IACjC,eAAe,CAAC,eAAe;IAC/B,eAAe,CAAC,WAAW;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,CAAC;AAE1D,MAAM,CAAC,MAAM,yBAAyB,GAAsB,CAAC,qBAAqB,CAAC,CAAC;AACpF,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACvD,GAAG,oBAAoB;IACvB,GAAG,yBAAyB;CAC7B,CAAC;AAEF,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,sCAAiB,CAAA;AACnB,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B;AA+BD,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,OAAO,EAAE,kBAAkB,CAAC,OAAO;IACnC,IAAI,EAAE,kBAAkB,CAAC,IAAI;IAC7B,WAAW,EAAE,kBAAkB,CAAC,aAAa;IAC7C,MAAM,EAAE,kBAAkB,CAAC,OAAO;CAC1B,CAAC;AAiDX,MAAM,CAAN,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC9B,kFAA0D,CAAA;AAC5D,CAAC,EAFW,oBAAoB,KAApB,oBAAoB,QAE/B;AAgBD,MAAM,CAAN,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IAE1B,gDAA4B,CAAA;IAC5B,0CAAsB,CAAA;IAEtB,gDAA4B,CAAA;IAE5B,4CAAwB,CAAA;IACxB,gDAA4B,CAAA;IAC5B,qDAAiC,CAAA;AACnC,CAAC,EAVW,gBAAgB,KAAhB,gBAAgB,QAU3B;AAuCD,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,iEAAuC,CAAA;IACvC,kDAAwB,CAAA;IACxB,6EAAmD,CAAA;IACnD,uEAA6C,CAAA;IAC7C,qEAA2C,CAAA;IAC3C,+DAAqC,CAAA;AACvC,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AAcD,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,+DAAoC,CAAA;IACpC,qDAA0B,CAAA;IAC1B,qDAA0B,CAAA;AAC5B,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC","sourcesContent":["import { GPSCoord, NextList, PaginatedList } from '@bisondesk/commons-sdk/types';\nimport { Organization } from './crm.js';\nimport {\n AddressDeliveryType,\n PickUpDeliveryType,\n PortDeliverytype,\n PurchaseDeliveryType,\n SalesDeliveryTypes,\n} from './deliveries.js';\nimport { BaseEvent } from './internal-events.js';\nimport { Opportunity, OpportunityPaymentStatus } from './opportunities.js';\nimport { BaseSearchRequest, SortOrder } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle, VehiclePurchase } from './vehicles.js';\n\nexport enum TransportType {\n Purchase = 'PURCHASE',\n Sale = 'SALE',\n}\n\nexport enum TransportStatus {\n Todo = 'TODO',\n Planning = 'PLANNING',\n Ready = 'READY',\n ScheduledExternal = 'SCHEDULED_EXTERNAL',\n OngoingInternal = 'ONGOING_INTERNAL',\n OngoingShip = 'ONGOING_SHIP',\n Done = 'DONE',\n}\n\nexport const TransportStatusOrder: TransportStatus[] = [\n TransportStatus.Todo,\n TransportStatus.Planning,\n TransportStatus.Ready,\n TransportStatus.ScheduledExternal,\n TransportStatus.OngoingInternal,\n TransportStatus.OngoingShip,\n];\n\nexport const TransportDoneColumnId = TransportStatus.Done;\n\nexport const TransportKanbanEndColumns: TransportStatus[] = [TransportDoneColumnId];\nexport const TransportKanbanColumns: TransportStatus[] = [\n ...TransportStatusOrder,\n ...TransportKanbanEndColumns,\n];\n\nexport enum TransportPriority {\n Normal = 'NORMAL',\n High = 'HIGH',\n Urgent = 'URGENT',\n}\n\n/**\n * The customer collects the vehicle. Nothing is driven anywhere, but the papers still have to be\n * arranged and paid for — transit plates, technical control, insurance — which is why it is a\n * delivery type administration reviews rather than the absence of one.\n *\n * `dateOfPickUpByCustomer` is dropped from the quote's shape: the transport's own `date` is the\n * collection day, and two fields for one date only ever disagree.\n */\nexport type TransportPickUpDeliveryType = Omit<PickUpDeliveryType, 'dateOfPickUpByCustomer'>;\n\ntype TransportDeliveryExtras = {\n cleaningNeeded?: boolean;\n driver?: string;\n transportCompany?: string;\n date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)\n adminCost?: string; // user-entered administrative cost summed into totalCostExclVat\n stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings\n};\n\nexport type TransportSalesDeliveryType = (\n | PortDeliverytype\n | AddressDeliveryType\n | TransportPickUpDeliveryType\n) &\n TransportDeliveryExtras;\n\nexport type TransportPurchaseDeliveryType = PurchaseDeliveryType & TransportDeliveryExtras;\n\n/** @deprecated Use SalesDeliveryTypes from ./deliveries.js. */\nexport const TransportSalesDeliveryType = {\n Address: SalesDeliveryTypes.ADDRESS,\n Port: SalesDeliveryTypes.PORT,\n PortAndShip: SalesDeliveryTypes.PORT_AND_SHIP,\n PickUp: SalesDeliveryTypes.PICK_UP,\n} as const;\n\nexport type Transport = {\n id: string;\n vehicleId: string;\n opportunityId?: string;\n\n status: TransportStatus;\n priority: TransportPriority;\n\n // administrative fields\n adminApproved: boolean;\n adminApprovedAt?: string;\n adminApprovedBy?: string;\n transportWithoutPayment?: boolean;\n notes?: string;\n\n totals: {\n totalRetailAmountExclVat: string;\n totalCostExclVat: string;\n estimatedTotalCostExclVat?: string;\n };\n\n log: Array<{\n status: TransportStatus;\n completedAt: string;\n completedBy: string;\n }>;\n\n doneAt?: string;\n doneBy?: string;\n canceledAt?: string;\n canceledBy?: string;\n\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n} & (\n | {\n type: TransportType.Purchase;\n delivery: TransportPurchaseDeliveryType;\n }\n | {\n type: TransportType.Sale;\n delivery: TransportSalesDeliveryType;\n }\n);\n\nexport enum TransportWarningCode {\n PurchaseLogisticsNotReady = 'purchase_logistics_not_ready',\n}\n\nexport type TransportWarning = {\n code: TransportWarningCode;\n details?: Record<string, string | number | boolean>;\n};\n\nexport type TransportCost = Pick<Transport, 'totals'>;\n\nexport type TransportRecord = DataRecord<Transport>;\n\n/**\n * What a requester may change on a transport, field group by field group. The server filters an\n * update through these and returns the ones granted on the record, so the drawer disables what the\n * user cannot touch instead of deciding for itself from the user's roles.\n */\nexport enum TransportActions {\n /** The route: addresses, ports, dates, costs. */\n SetDelivery = 'set_delivery',\n SetNotes = 'set_notes',\n /** The administrative sign-off, and the clearance to move before the payment. */\n SetApproval = 'set_approval',\n /** The board column. */\n SetStatus = 'set_status',\n SetPriority = 'set_priority',\n SetBookingRef = 'set_booking_ref',\n}\n\n/**\n * Every field a write may set, in one shape. `delivery` is replaced whole when it is sent — there is\n * no partial merge into the stored one — which is why `bookingRef` rides alongside as a scalar the\n * server writes into the delivery it ends up with.\n */\nexport type TransportUpdate = {\n delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;\n notes?: string | null;\n adminApproved?: boolean;\n transportWithoutPayment?: boolean;\n status?: TransportStatus;\n priority?: TransportPriority;\n bookingRef?: string | null;\n};\n\ntype BaseTransportEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n transportId: string;\n};\n\nexport type TransportCreateEvent = BaseTransportEvent & {\n action: 'create';\n data: Transport;\n previousData?: undefined;\n};\n\nexport type TransportUpdateEvent = BaseTransportEvent & {\n action: 'update';\n data: Transport;\n previousData: Transport;\n};\n\n/** Published whenever a transport is written. Carries both sides so subscribers judge relevance. */\nexport type TransportEvent = BaseEvent & (TransportCreateEvent | TransportUpdateEvent);\n\nexport enum TransportPaymentStatus {\n PaymentNotNeeded = 'payment_not_needed',\n NoPayment = 'no_payment',\n PartialPaymentReceived = 'partial_payment_received',\n FullPaymentReceived = 'full_payment_received',\n PartialPaymentSent = 'partial_payment_sent',\n FullPaymentSent = 'full_payment_sent',\n}\n\n/**\n * Where the money stands on the record the transport serves: the customer's payments on the\n * opportunity for a sale delivery, ours to the supplier for a purchase pick-up. Denormalised at\n * indexing time so the board can show it without joining.\n */\nexport type TransportPayment = {\n status: OpportunityPaymentStatus;\n /** Only a sale delivery knows the ratio — a pick-up has milestones, not a running total. */\n percentagePaid?: string;\n};\n\n/** Which address the map pin came from, so the UI can tell an exact pin from an approximate one. */\nexport enum TransportLocationSource {\n DeliveryAddress = 'delivery_address',\n OriginPort = 'origin_port',\n OrgAddress = 'org_address',\n}\n\nexport type SearchTransport = {\n transport: Transport;\n vehicle: Vehicle;\n org: Organization;\n opportunity?: Opportunity;\n purchase: VehiclePurchase;\n tasks: {\n totalTasks: number;\n openTasks: number;\n nextDueAt?: string;\n };\n custom: {\n commercialUserIds: string[];\n warnings: TransportWarning[];\n priorityOrdinal: number;\n payment: TransportPayment;\n paymentStatus: TransportPaymentStatus;\n /**\n * Where the transport happens: the delivery address, or the origin port for a shipped delivery.\n * Denormalised into one field because the map clusters over a single geo_point, and a port\n * delivery carries no address of its own.\n *\n * Deliberately narrower than `GPSCoord`: a geo_point field rejects any key beyond lat/lon, so\n * the map zoom the coordinates picker stores must not reach the index.\n */\n location?: Pick<GPSCoord, 'lat' | 'lon'>;\n locationSource?: TransportLocationSource;\n };\n};\n\nexport type SearchTransportList = PaginatedList<SearchTransport, ReferenceData>;\n\nexport type KanbanTransportGroup = {\n representative: SearchTransport;\n items: SearchTransport[];\n totalCount: number;\n /** Pass in nextTokens for this column to load more transports from the organization. */\n nextToken?: string;\n};\n\nexport type TransportKanbanColumn = {\n status: TransportStatus;\n results: SearchTransport[];\n groups?: KanbanTransportGroup[];\n totalCount: number;\n};\n\nexport type MSearchTransportsKanbanColumn = {\n column: TransportKanbanColumn;\n nextToken?: string;\n};\n\nexport type KanbanTransportsSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n groupByOrganization?: boolean;\n statusSortBy?: Record<TransportStatus, { fieldId: string; order: SortOrder }[]>;\n};\n\nexport type KanbanTransportsNextList = Omit<\n NextList<TransportKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { AddressDeliveryType, PurchaseDeliveryType, PurchaseDeliveryTypes, SalesDeliveryType, SalesDeliveryTypes } from '../types/deliveries.js';
|
|
1
|
+
import { AddressDeliveryType, PortDeliverytype, PurchaseDeliveryType, PurchaseDeliveryTypes, SalesDeliveryType, SalesDeliveryTypes } from '../types/deliveries.js';
|
|
2
2
|
export declare const isAddressDelivery: (delivery?: PurchaseDeliveryType | SalesDeliveryType) => delivery is AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS | SalesDeliveryTypes.ADDRESS>;
|
|
3
|
+
export declare const isPortDelivery: (delivery?: PurchaseDeliveryType | SalesDeliveryType) => delivery is PortDeliverytype;
|
|
3
4
|
//# sourceMappingURL=deliveries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
1
|
+
{"version":3,"file":"deliveries.d.ts","sourceRoot":"/","sources":["utils/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,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;AAEpG,eAAO,MAAM,cAAc,cACd,oBAAoB,GAAG,iBAAiB,KAClD,QAAQ,IAAI,gBACoF,CAAC"}
|
package/lib/utils/deliveries.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { PurchaseDeliveryTypes, SalesDeliveryTypes, } from '../types/deliveries.js';
|
|
2
2
|
export const isAddressDelivery = (delivery) => delivery?.type === PurchaseDeliveryTypes.ADDRESS || delivery?.type === SalesDeliveryTypes.ADDRESS;
|
|
3
|
+
export const isPortDelivery = (delivery) => delivery?.type === SalesDeliveryTypes.PORT || delivery?.type === SalesDeliveryTypes.PORT_AND_SHIP;
|
|
3
4
|
//# sourceMappingURL=deliveries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deliveries.js","sourceRoot":"/","sources":["utils/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deliveries.js","sourceRoot":"/","sources":["utils/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,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;AAEpG,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,QAAmD,EACrB,EAAE,CAChC,QAAQ,EAAE,IAAI,KAAK,kBAAkB,CAAC,IAAI,IAAI,QAAQ,EAAE,IAAI,KAAK,kBAAkB,CAAC,aAAa,CAAC","sourcesContent":["import {\n AddressDeliveryType,\n PortDeliverytype,\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\nexport const isPortDelivery = (\n delivery?: PurchaseDeliveryType | SalesDeliveryType,\n): delivery is PortDeliverytype =>\n delivery?.type === SalesDeliveryTypes.PORT || delivery?.type === SalesDeliveryTypes.PORT_AND_SHIP;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reports-arrivals.d.ts","sourceRoot":"/","sources":["utils/reports-arrivals.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reports-arrivals.d.ts","sourceRoot":"/","sources":["utils/reports-arrivals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAIlE,eAAO,MAAM,sBAAsB,QAC5B,kBAAkB,KACtB,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAepC,CAAC"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { PurchaseDeliveryTypes } from '../types/deliveries.js';
|
|
1
2
|
import { TransportType } from '../types/transports.js';
|
|
2
3
|
export const getArrivalDeliveryType = (row) => {
|
|
3
4
|
if (row.readyToDeliver) {
|
|
4
5
|
return 'direct';
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
if (row.transport?.type !== TransportType.Purchase) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
switch (row.transport.delivery.type) {
|
|
11
|
+
case PurchaseDeliveryTypes.ADDRESS:
|
|
8
12
|
return 'pickUp';
|
|
9
|
-
case
|
|
13
|
+
case PurchaseDeliveryTypes.DROP_OFF:
|
|
10
14
|
return 'dropOff';
|
|
11
15
|
default:
|
|
12
16
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reports-arrivals.js","sourceRoot":"/","sources":["utils/reports-arrivals.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reports-arrivals.js","sourceRoot":"/","sources":["utils/reports-arrivals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,GAAuB,EACsB,EAAE;IAC/C,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;QACvB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,GAAG,CAAC,SAAS,EAAE,IAAI,KAAK,aAAa,CAAC,QAAQ,EAAE,CAAC;QACnD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,QAAQ,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpC,KAAK,qBAAqB,CAAC,OAAO;YAChC,OAAO,QAAQ,CAAC;QAClB,KAAK,qBAAqB,CAAC,QAAQ;YACjC,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { PurchaseDeliveryTypes } from '../types/deliveries.js';\nimport { ExpectedArrivalRow } from '../types/reports-arrivals.js';\nimport { TransportType } from '../types/transports.js';\n\n/** Pick up and drop off come from the transport; direct-to-client deliveries stay separate. */\nexport const getArrivalDeliveryType = (\n row: ExpectedArrivalRow,\n): 'pickUp' | 'dropOff' | 'direct' | undefined => {\n if (row.readyToDeliver) {\n return 'direct';\n }\n if (row.transport?.type !== TransportType.Purchase) {\n return undefined;\n }\n switch (row.transport.delivery.type) {\n case PurchaseDeliveryTypes.ADDRESS:\n return 'pickUp';\n case PurchaseDeliveryTypes.DROP_OFF:\n return 'dropOff';\n default:\n return undefined;\n }\n};\n"]}
|
|
@@ -2,6 +2,9 @@ import { Opportunity } from '../types/opportunities.js';
|
|
|
2
2
|
import { SearchTransport, Transport } from '../types/transports.js';
|
|
3
3
|
import { VehiclePurchase } from '../types/vehicles.js';
|
|
4
4
|
export declare const isPurchaseTransport: (transport: Pick<Transport, 'type'>) => boolean;
|
|
5
|
+
export declare const isPurchaseDropOffTransport: (transport: Pick<Transport, 'type'> & {
|
|
6
|
+
delivery: Pick<Transport['delivery'], 'type'>;
|
|
7
|
+
}) => boolean;
|
|
5
8
|
export declare const isTransportCompleted: (transport: Transport, context: {
|
|
6
9
|
opportunity?: Opportunity;
|
|
7
10
|
purchase?: VehiclePurchase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["utils/transports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["utils/transports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAiB,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,eAAO,MAAM,mBAAmB,cAAe,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,KAAG,OAC9B,CAAC;AAE5C,eAAO,MAAM,0BAA0B,cAC1B,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,KACrF,OAC2F,CAAC;AAc/F,eAAO,MAAM,oBAAoB,cACpB,SAAS,WACX;IAAE,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;CAAE,KACjE,OAMF,CAAC;AAGF,eAAO,MAAM,0BAA0B,WAAY,eAAe,KAAG,OAIjE,CAAC"}
|
package/lib/utils/transports.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { PurchaseDeliveryTypes } from '../types/deliveries.js';
|
|
1
2
|
import { TransportType } from '../types/transports.js';
|
|
2
3
|
import { hasPurchaseArrived } from './vehicles.js';
|
|
3
|
-
export const isPurchaseTransport = (transport) => transport.type
|
|
4
|
+
export const isPurchaseTransport = (transport) => transport.type === TransportType.Purchase;
|
|
5
|
+
export const isPurchaseDropOffTransport = (transport) => isPurchaseTransport(transport) && transport.delivery.type === PurchaseDeliveryTypes.DROP_OFF;
|
|
4
6
|
export const isTransportCompleted = (transport, context) => {
|
|
5
|
-
if (transport.type === TransportType.
|
|
7
|
+
if (transport.type === TransportType.Sale) {
|
|
6
8
|
return context.opportunity?.deliveredAt != null;
|
|
7
9
|
}
|
|
8
10
|
return context.purchase != null && hasPurchaseArrived(context.purchase);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.js","sourceRoot":"/","sources":["utils/transports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transports.js","sourceRoot":"/","sources":["utils/transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAA8B,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAkC,EAAW,EAAE,CACjF,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,QAAQ,CAAC;AAE5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,SAAsF,EAC7E,EAAE,CACX,mBAAmB,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,KAAK,qBAAqB,CAAC,QAAQ,CAAC;AAc/F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,SAAoB,EACpB,OAAkE,EACzD,EAAE;IACX,IAAI,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAC,WAAW,EAAE,WAAW,IAAI,IAAI,CAAC;IAClD,CAAC;IAED,OAAO,OAAO,CAAC,QAAQ,IAAI,IAAI,IAAI,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC1E,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,MAAuB,EAAW,EAAE,CAC7E,oBAAoB,CAAC,MAAM,CAAC,SAAS,EAAE;IACrC,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;CAC1B,CAAC,CAAC","sourcesContent":["import { PurchaseDeliveryTypes } from '../types/deliveries.js';\nimport { Opportunity } from '../types/opportunities.js';\nimport { SearchTransport, Transport, TransportType } from '../types/transports.js';\nimport { VehiclePurchase } from '../types/vehicles.js';\nimport { hasPurchaseArrived } from './vehicles.js';\n\nexport const isPurchaseTransport = (transport: Pick<Transport, 'type'>): boolean =>\n transport.type === TransportType.Purchase;\n\nexport const isPurchaseDropOffTransport = (\n transport: Pick<Transport, 'type'> & { delivery: Pick<Transport['delivery'], 'type'> },\n): boolean =>\n isPurchaseTransport(transport) && transport.delivery.type === PurchaseDeliveryTypes.DROP_OFF;\n\n/**\n * A transport is finished when the journey it describes has demonstrably happened: the customer has\n * the vehicle for a sale delivery, the vehicle is on our park for a purchase. From then on\n * the record is history and the server refuses edits to it.\n *\n * Not the same thing as the transport's own `doneAt`. Delivery can be declared on the opportunity\n * (a CMR, a delivery confirmation) and arrival on the purchase, without the transport ever being\n * moved — and reversing either of those is what unlocks the transport again, which a status stamped\n * on the transport itself could not express.\n *\n * Shared so the board, the drawer and the server all answer the question the same way.\n */\nexport const isTransportCompleted = (\n transport: Transport,\n context: { opportunity?: Opportunity; purchase?: VehiclePurchase },\n): boolean => {\n if (transport.type === TransportType.Sale) {\n return context.opportunity?.deliveredAt != null;\n }\n\n return context.purchase != null && hasPurchaseArrived(context.purchase);\n};\n\n/** The same question asked of a search document, which already carries both sides. */\nexport const isSearchTransportCompleted = (record: SearchTransport): boolean =>\n isTransportCompleted(record.transport, {\n opportunity: record.opportunity,\n purchase: record.purchase,\n });\n"]}
|
package/package.json
CHANGED
package/src/types/deliveries.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { LocationValue } from '@bisondesk/commons-sdk/types';
|
|
2
2
|
|
|
3
|
+
/** Supplier drop-off and customer pickup both take place at our park. */
|
|
4
|
+
export const PARK_DELIVERY_TYPE = 'park';
|
|
5
|
+
|
|
3
6
|
/** Supplier collection keeps the existing address value in stored transports. */
|
|
4
7
|
export enum PurchaseDeliveryTypes {
|
|
5
8
|
ADDRESS = 'address',
|
|
6
|
-
DROP_OFF =
|
|
9
|
+
DROP_OFF = PARK_DELIVERY_TYPE,
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
export enum SalesDeliveryTypes {
|
|
10
|
-
PICK_UP =
|
|
13
|
+
PICK_UP = PARK_DELIVERY_TYPE,
|
|
11
14
|
ADDRESS = 'address',
|
|
12
15
|
PORT = 'port',
|
|
13
16
|
PORT_AND_SHIP = 'portAndShip',
|
|
@@ -58,6 +61,12 @@ export type AddressDeliveryType<
|
|
|
58
61
|
technicalControlNeeded: boolean;
|
|
59
62
|
};
|
|
60
63
|
|
|
64
|
+
export const ADDRESS_DELIVERY_FIELDS = [
|
|
65
|
+
'address',
|
|
66
|
+
'distanceKm',
|
|
67
|
+
'technicalControlNeeded',
|
|
68
|
+
] as const satisfies readonly (keyof AddressDeliveryType)[];
|
|
69
|
+
|
|
61
70
|
export type PortDeliverytype = BaseDeliveryType & {
|
|
62
71
|
type: SalesDeliveryTypes.PORT | SalesDeliveryTypes.PORT_AND_SHIP;
|
|
63
72
|
portOriginId: string;
|
package/src/types/journeys.ts
CHANGED
|
@@ -23,6 +23,12 @@ export type JourneyTaskConfig<T> = {
|
|
|
23
23
|
* defines it. Ignored when the processor has no such person. `autoAssignToRequester` wins.
|
|
24
24
|
*/
|
|
25
25
|
autoAssignToRecordOwner?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* A user id to fall back on when neither auto-assign option yields anyone — for work that always
|
|
28
|
+
* lands on the same desk whoever triggered it, such as raising a supplier bonus invoice. Last
|
|
29
|
+
* resort by design, so adding it cannot change an existing config.
|
|
30
|
+
*/
|
|
31
|
+
assignTo?: string;
|
|
26
32
|
};
|
|
27
33
|
|
|
28
34
|
export type JourneyConfig<T> = {
|
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
* The API returns raw numbers only; the client formats amounts and dates.
|
|
9
9
|
*/
|
|
10
10
|
import { LocationValue } from '@bisondesk/commons-sdk/locations';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
Transport,
|
|
13
|
+
TransportLocationSource,
|
|
14
|
+
TransportStatus,
|
|
15
|
+
TransportType,
|
|
16
|
+
} from './transports.js';
|
|
12
17
|
import { VehiclePurchaseDeliveryType } from './vehicles.js';
|
|
13
18
|
|
|
14
19
|
/** Months of arrivals the history chart covers. */
|
|
@@ -23,6 +28,7 @@ export const ARRIVALS_LATE_AFTER_DAYS = 30;
|
|
|
23
28
|
export type ExpectedArrivalTransport = {
|
|
24
29
|
id: string;
|
|
25
30
|
type: TransportType;
|
|
31
|
+
delivery: Pick<Transport['delivery'], 'type'>;
|
|
26
32
|
status: TransportStatus;
|
|
27
33
|
/** Planned pick-up / delivery day. */
|
|
28
34
|
date?: string;
|
package/src/types/transports.ts
CHANGED
|
@@ -14,19 +14,10 @@ import { DataRecord, ReferenceData } from './utils.js';
|
|
|
14
14
|
import { Vehicle, VehiclePurchase } from './vehicles.js';
|
|
15
15
|
|
|
16
16
|
export enum TransportType {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
SaleDelivery = 'SALE_DELIVERY',
|
|
17
|
+
Purchase = 'PURCHASE',
|
|
18
|
+
Sale = 'SALE',
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
/** Both inbound journeys, whoever drives them. Mirrors the purchase's own delivery type. */
|
|
23
|
-
export type TransportPurchaseType = TransportType.PurchasePickUp | TransportType.PurchaseDropOff;
|
|
24
|
-
|
|
25
|
-
export const TransportPurchaseTypes: TransportPurchaseType[] = [
|
|
26
|
-
TransportType.PurchasePickUp,
|
|
27
|
-
TransportType.PurchaseDropOff,
|
|
28
|
-
];
|
|
29
|
-
|
|
30
21
|
export enum TransportStatus {
|
|
31
22
|
Todo = 'TODO',
|
|
32
23
|
Planning = 'PLANNING',
|
|
@@ -134,11 +125,11 @@ export type Transport = {
|
|
|
134
125
|
updatedBy: string;
|
|
135
126
|
} & (
|
|
136
127
|
| {
|
|
137
|
-
type:
|
|
128
|
+
type: TransportType.Purchase;
|
|
138
129
|
delivery: TransportPurchaseDeliveryType;
|
|
139
130
|
}
|
|
140
131
|
| {
|
|
141
|
-
type: TransportType.
|
|
132
|
+
type: TransportType.Sale;
|
|
142
133
|
delivery: TransportSalesDeliveryType;
|
|
143
134
|
}
|
|
144
135
|
);
|
|
@@ -179,8 +170,6 @@ export enum TransportActions {
|
|
|
179
170
|
* server writes into the delivery it ends up with.
|
|
180
171
|
*/
|
|
181
172
|
export type TransportUpdate = {
|
|
182
|
-
/** Changes the purchase method and the purchase agreement together. */
|
|
183
|
-
type?: TransportPurchaseType;
|
|
184
173
|
delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;
|
|
185
174
|
notes?: string | null;
|
|
186
175
|
adminApproved?: boolean;
|
|
@@ -271,9 +260,18 @@ export type SearchTransport = {
|
|
|
271
260
|
|
|
272
261
|
export type SearchTransportList = PaginatedList<SearchTransport, ReferenceData>;
|
|
273
262
|
|
|
263
|
+
export type KanbanTransportGroup = {
|
|
264
|
+
representative: SearchTransport;
|
|
265
|
+
items: SearchTransport[];
|
|
266
|
+
totalCount: number;
|
|
267
|
+
/** Pass in nextTokens for this column to load more transports from the organization. */
|
|
268
|
+
nextToken?: string;
|
|
269
|
+
};
|
|
270
|
+
|
|
274
271
|
export type TransportKanbanColumn = {
|
|
275
272
|
status: TransportStatus;
|
|
276
273
|
results: SearchTransport[];
|
|
274
|
+
groups?: KanbanTransportGroup[];
|
|
277
275
|
totalCount: number;
|
|
278
276
|
};
|
|
279
277
|
|
|
@@ -284,6 +282,7 @@ export type MSearchTransportsKanbanColumn = {
|
|
|
284
282
|
|
|
285
283
|
export type KanbanTransportsSearchRequest = BaseSearchRequest & {
|
|
286
284
|
nextTokens?: Record<string, string | undefined>;
|
|
285
|
+
groupByOrganization?: boolean;
|
|
287
286
|
statusSortBy?: Record<TransportStatus, { fieldId: string; order: SortOrder }[]>;
|
|
288
287
|
};
|
|
289
288
|
|
package/src/utils/deliveries.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AddressDeliveryType,
|
|
3
|
+
PortDeliverytype,
|
|
3
4
|
PurchaseDeliveryType,
|
|
4
5
|
PurchaseDeliveryTypes,
|
|
5
6
|
SalesDeliveryType,
|
|
@@ -11,3 +12,8 @@ export const isAddressDelivery = (
|
|
|
11
12
|
delivery?: PurchaseDeliveryType | SalesDeliveryType,
|
|
12
13
|
): delivery is AddressDeliveryType<PurchaseDeliveryTypes.ADDRESS | SalesDeliveryTypes.ADDRESS> =>
|
|
13
14
|
delivery?.type === PurchaseDeliveryTypes.ADDRESS || delivery?.type === SalesDeliveryTypes.ADDRESS;
|
|
15
|
+
|
|
16
|
+
export const isPortDelivery = (
|
|
17
|
+
delivery?: PurchaseDeliveryType | SalesDeliveryType,
|
|
18
|
+
): delivery is PortDeliverytype =>
|
|
19
|
+
delivery?.type === SalesDeliveryTypes.PORT || delivery?.type === SalesDeliveryTypes.PORT_AND_SHIP;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PurchaseDeliveryTypes } from '../types/deliveries.js';
|
|
1
2
|
import { ExpectedArrivalRow } from '../types/reports-arrivals.js';
|
|
2
3
|
import { TransportType } from '../types/transports.js';
|
|
3
4
|
|
|
@@ -8,10 +9,13 @@ export const getArrivalDeliveryType = (
|
|
|
8
9
|
if (row.readyToDeliver) {
|
|
9
10
|
return 'direct';
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
if (row.transport?.type !== TransportType.Purchase) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
switch (row.transport.delivery.type) {
|
|
16
|
+
case PurchaseDeliveryTypes.ADDRESS:
|
|
13
17
|
return 'pickUp';
|
|
14
|
-
case
|
|
18
|
+
case PurchaseDeliveryTypes.DROP_OFF:
|
|
15
19
|
return 'dropOff';
|
|
16
20
|
default:
|
|
17
21
|
return undefined;
|