@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
package/src/utils/transports.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { PurchaseDeliveryTypes } from '../types/deliveries.js';
|
|
1
2
|
import { Opportunity } from '../types/opportunities.js';
|
|
2
3
|
import { SearchTransport, Transport, TransportType } from '../types/transports.js';
|
|
3
4
|
import { VehiclePurchase } from '../types/vehicles.js';
|
|
4
5
|
import { hasPurchaseArrived } from './vehicles.js';
|
|
5
6
|
|
|
6
|
-
/**
|
|
7
|
-
* Both purchase types bring a vehicle to our park: we collect a pickup, and the supplier brings
|
|
8
|
-
* a drop-off. They share the purchase payment and arrival rules.
|
|
9
|
-
*/
|
|
10
7
|
export const isPurchaseTransport = (transport: Pick<Transport, 'type'>): boolean =>
|
|
11
|
-
transport.type
|
|
8
|
+
transport.type === TransportType.Purchase;
|
|
9
|
+
|
|
10
|
+
export const isPurchaseDropOffTransport = (
|
|
11
|
+
transport: Pick<Transport, 'type'> & { delivery: Pick<Transport['delivery'], 'type'> },
|
|
12
|
+
): boolean =>
|
|
13
|
+
isPurchaseTransport(transport) && transport.delivery.type === PurchaseDeliveryTypes.DROP_OFF;
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* A transport is finished when the journey it describes has demonstrably happened: the customer has
|
|
@@ -26,7 +28,7 @@ export const isTransportCompleted = (
|
|
|
26
28
|
transport: Transport,
|
|
27
29
|
context: { opportunity?: Opportunity; purchase?: VehiclePurchase },
|
|
28
30
|
): boolean => {
|
|
29
|
-
if (transport.type === TransportType.
|
|
31
|
+
if (transport.type === TransportType.Sale) {
|
|
30
32
|
return context.opportunity?.deliveredAt != null;
|
|
31
33
|
}
|
|
32
34
|
|