@bisondesk/core-sdk 1.0.653 → 1.0.654
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/activities.js +0 -13
- package/src/types/activities.js.map +0 -1
- package/src/types/comparables.js +0 -2
- package/src/types/comparables.js.map +0 -1
- package/src/types/crm.js +0 -58
- package/src/types/crm.js.map +0 -1
- package/src/types/dashboard.js +0 -2
- package/src/types/dashboard.js.map +0 -1
- package/src/types/definitions.js +0 -2
- package/src/types/definitions.js.map +0 -1
- package/src/types/deliveries.ts +0 -92
- package/src/types/fields.js +0 -2
- package/src/types/fields.js.map +0 -1
- package/src/types/insights.js +0 -2
- package/src/types/insights.js.map +0 -1
- package/src/types/interests.js +0 -6
- package/src/types/interests.js.map +0 -1
- package/src/types/internal-events.js +0 -18
- package/src/types/internal-events.js.map +0 -1
- package/src/types/internet-opportunities.js +0 -2
- package/src/types/internet-opportunities.js.map +0 -1
- package/src/types/internet-vehicles.js +0 -2
- package/src/types/internet-vehicles.js.map +0 -1
- package/src/types/leasing-administration.js +0 -2
- package/src/types/leasing-administration.js.map +0 -1
- package/src/types/leasing-debtors.js +0 -2
- package/src/types/leasing-debtors.js.map +0 -1
- package/src/types/leasing-search.js +0 -2
- package/src/types/leasing-search.js.map +0 -1
- package/src/types/leasing-settings.js +0 -7
- package/src/types/leasing-settings.js.map +0 -1
- package/src/types/leasing.js +0 -38
- package/src/types/leasing.js.map +0 -1
- package/src/types/marketing.js +0 -35
- package/src/types/marketing.js.map +0 -1
- package/src/types/offers.js +0 -56
- package/src/types/opportunities.js +0 -107
- package/src/types/opportunities.js.map +0 -1
- package/src/types/payments.js +0 -7
- package/src/types/picklists.js +0 -2
- package/src/types/picklists.js.map +0 -1
- package/src/types/quotes.js +0 -42
- package/src/types/recently-viewed.js +0 -2
- package/src/types/recently-viewed.js.map +0 -1
- package/src/types/reservations.js +0 -5
- package/src/types/reservations.js.map +0 -1
- package/src/types/roi-ratings.js +0 -5
- package/src/types/roi-ratings.js.map +0 -1
- package/src/types/saved-filters.js +0 -9
- package/src/types/saved-filters.js.map +0 -1
- package/src/types/search.js +0 -2
- package/src/types/search.js.map +0 -1
- package/src/types/settings.js +0 -2
- package/src/types/settings.js.map +0 -1
- package/src/types/templates.js +0 -2
- package/src/types/templates.js.map +0 -1
- package/src/types/tenants.js +0 -21
- package/src/types/tenants.js.map +0 -1
- package/src/types/user-performance.js +0 -7
- package/src/types/user-performance.js.map +0 -1
- package/src/types/utils.js +0 -2
- package/src/types/validation.js +0 -2
- package/src/types/validation.js.map +0 -1
- package/src/types/vehicle-sales.js +0 -6
- package/src/types/vehicle-sales.js.map +0 -1
- package/src/types/vehicles.js +0 -98
- package/src/types/vehicles.js.map +0 -1
- package/src/utils/deliveries.test.ts +0 -50
- package/src/utils/deliveries.ts +0 -13
- package/src/utils/leasing.js +0 -6
- package/src/utils/leasing.js.map +0 -1
- package/src/utils/opportunities.js +0 -48
- package/src/utils/opportunities.js.map +0 -1
package/src/types/quotes.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AttachmentValue } from '@bisondesk/commons-sdk/types';
|
|
1
|
+
import { AttachmentValue, LocationValue } from '@bisondesk/commons-sdk/types';
|
|
2
2
|
import { OpportunityType } from '../constants.js';
|
|
3
|
-
import { SalesDeliveryType } from './deliveries.js';
|
|
4
3
|
import {
|
|
5
4
|
CustomLeasingQuoteExtraInput,
|
|
6
5
|
CustomSalesQuoteExtraInput,
|
|
@@ -34,6 +33,24 @@ export enum QuoteMetricsScore {
|
|
|
34
33
|
NEUTRAL = 'neutral',
|
|
35
34
|
GOOD = 'good',
|
|
36
35
|
}
|
|
36
|
+
export enum DeliveryTypes {
|
|
37
|
+
PICK_UP = 'pickUp',
|
|
38
|
+
ADDRESS = 'address',
|
|
39
|
+
PORT = 'port',
|
|
40
|
+
PORT_AND_SHIP = 'portAndShip',
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export enum SpoilerInfo {
|
|
44
|
+
MOUNT = 'mount',
|
|
45
|
+
UNMOUNT = 'unmount',
|
|
46
|
+
NO_ACTION = 'noAction',
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export enum TransportationMode {
|
|
50
|
+
BY_ROAD = 'byRoad',
|
|
51
|
+
ON_LOW_BED = 'onLowBed',
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
export enum SelfFinancingType {
|
|
38
55
|
OWN_FINANCING = 'own_financing',
|
|
39
56
|
ALREADY_FINANCED = 'already_financed',
|
|
@@ -131,6 +148,49 @@ export type LeasingCalculatorInput = BaseQuoteCalculatorInput & {
|
|
|
131
148
|
customRequests: CustomLeasingQuoteExtraInput[];
|
|
132
149
|
};
|
|
133
150
|
|
|
151
|
+
type BaseDeliveryType = {
|
|
152
|
+
agreedPrice: string;
|
|
153
|
+
spoiler?: SpoilerInfo;
|
|
154
|
+
stackingVehicleNeeded?: boolean;
|
|
155
|
+
detailsStacking?: string;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export type PickUpDeliveryType = BaseDeliveryType & {
|
|
159
|
+
type: DeliveryTypes.PICK_UP;
|
|
160
|
+
urgent: boolean;
|
|
161
|
+
transportationMode?: TransportationMode;
|
|
162
|
+
detailsBorderCrossing?: string;
|
|
163
|
+
technicalControlNeeded: boolean;
|
|
164
|
+
insuranceNeeded: boolean;
|
|
165
|
+
transitPlateBelgiumNeeded: boolean;
|
|
166
|
+
transitPlateAustriaNeeded: boolean;
|
|
167
|
+
licensePlateNeeded: boolean;
|
|
168
|
+
dateOfPickUpByCustomer?: string;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export type AddressDeliveryType = BaseDeliveryType & {
|
|
172
|
+
type: DeliveryTypes.ADDRESS;
|
|
173
|
+
address: LocationValue;
|
|
174
|
+
distanceKm: string;
|
|
175
|
+
technicalControlNeeded: boolean;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type PortDeliverytype = BaseDeliveryType & {
|
|
179
|
+
type: DeliveryTypes.PORT | DeliveryTypes.PORT_AND_SHIP;
|
|
180
|
+
portOriginId: string;
|
|
181
|
+
portDestination?: string;
|
|
182
|
+
shippingCompany?: string;
|
|
183
|
+
portToPortCostPrice: string;
|
|
184
|
+
parkToPortCostPrice?: string;
|
|
185
|
+
portToPortMargin: string;
|
|
186
|
+
ets?: string;
|
|
187
|
+
eta?: string;
|
|
188
|
+
etd?: string;
|
|
189
|
+
shipClosingDate?: string;
|
|
190
|
+
bookingRef?: string;
|
|
191
|
+
deliveryLocation?: string;
|
|
192
|
+
};
|
|
193
|
+
|
|
134
194
|
// Sent by the Frontend to bootstrap the calculator
|
|
135
195
|
export type SalesCalculatorDefaultInput = Omit<BaseQuoteCalculatorInput, 'vehicle'> & {
|
|
136
196
|
vehicle: Omit<BaseQuoteCalculatorInput['vehicle'], 'vatRate'>;
|
|
@@ -146,7 +206,7 @@ export type SalesCalculatorInput = BaseQuoteCalculatorInput & {
|
|
|
146
206
|
internetPrice?: string;
|
|
147
207
|
comissionCost: string;
|
|
148
208
|
};
|
|
149
|
-
delivery?:
|
|
209
|
+
delivery?: PickUpDeliveryType | AddressDeliveryType | PortDeliverytype;
|
|
150
210
|
extras: SalesQuoteExtraInput[];
|
|
151
211
|
customRequests: CustomSalesQuoteExtraInput[];
|
|
152
212
|
financing?: {
|
|
@@ -358,6 +418,16 @@ export type CalculatorSalesIO = {
|
|
|
358
418
|
};
|
|
359
419
|
export type CalculatorQuoteIO = CalculatorLeasingIO | CalculatorSalesIO;
|
|
360
420
|
|
|
421
|
+
export type DeliveryLocationValue = Omit<LocationValue, 'addressLine1' | 'city'> & {
|
|
422
|
+
addressLine1: string;
|
|
423
|
+
city: string;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
export type DeliveryRoutesRequest = {
|
|
427
|
+
origin: DeliveryLocationValue;
|
|
428
|
+
destination: DeliveryLocationValue;
|
|
429
|
+
};
|
|
430
|
+
|
|
361
431
|
export type NewQuoteValidator = {
|
|
362
432
|
userId: string;
|
|
363
433
|
countryCode: string;
|
|
@@ -372,17 +442,3 @@ export type QuoteValidator = NewQuoteValidator & {
|
|
|
372
442
|
export type QuoteValidatorUpdate = {
|
|
373
443
|
canValidateOwn: boolean;
|
|
374
444
|
};
|
|
375
|
-
|
|
376
|
-
export type {
|
|
377
|
-
AddressDeliveryType,
|
|
378
|
-
DeliveryLocationValue,
|
|
379
|
-
DeliveryRoutesRequest,
|
|
380
|
-
PickUpDeliveryType,
|
|
381
|
-
PortDeliverytype,
|
|
382
|
-
} from './deliveries.js';
|
|
383
|
-
/** @deprecated Import delivery types from ./deliveries.js. */
|
|
384
|
-
export {
|
|
385
|
-
SalesDeliveryTypes as DeliveryTypes,
|
|
386
|
-
SpoilerInfo,
|
|
387
|
-
TransportationMode,
|
|
388
|
-
} from './deliveries.js';
|
package/src/types/templates.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { EmailContent, EmailRequest } from '@bisondesk/commons-sdk/messages';
|
|
2
|
-
|
|
3
1
|
export type TemplateContent = {
|
|
4
2
|
subject: string;
|
|
5
3
|
content: {
|
|
@@ -37,28 +35,3 @@ export type UpdateTemplateInfoRequest = {
|
|
|
37
35
|
name: string;
|
|
38
36
|
tags?: any;
|
|
39
37
|
};
|
|
40
|
-
|
|
41
|
-
export type CodeEmailTemplateInfo = Pick<TemplateInfo, 'id' | 'name' | 'countries'> & {
|
|
42
|
-
format: 'react-email';
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type TemplateCatalogueEntry = (TemplateInfo & { format: 'html' }) | CodeEmailTemplateInfo;
|
|
46
|
-
|
|
47
|
-
export type TemplateEmailRequest<T extends Record<string, unknown> = Record<string, unknown>> =
|
|
48
|
-
Omit<EmailRequest, 'subject' | 'body'> & {
|
|
49
|
-
templateId: string;
|
|
50
|
-
country: string;
|
|
51
|
-
fallbackCountry?: string;
|
|
52
|
-
data: T;
|
|
53
|
-
subject?: string;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type EmailTemplatePreviewRequest = {
|
|
57
|
-
data?: Record<string, unknown>;
|
|
58
|
-
subject?: string;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export type EmailTemplatePreview = {
|
|
62
|
-
content: EmailContent;
|
|
63
|
-
data: Record<string, unknown>;
|
|
64
|
-
};
|
package/src/types/transports.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { GPSCoord, NextList, PaginatedList } from '@bisondesk/commons-sdk/types';
|
|
2
2
|
import { Organization } from './crm.js';
|
|
3
|
+
import { BaseEvent } from './internal-events.js';
|
|
4
|
+
import { Opportunity, OpportunityPaymentStatus } from './opportunities.js';
|
|
3
5
|
import {
|
|
4
6
|
AddressDeliveryType,
|
|
7
|
+
DeliveryTypes,
|
|
5
8
|
PickUpDeliveryType,
|
|
6
9
|
PortDeliverytype,
|
|
7
|
-
|
|
8
|
-
SalesDeliveryTypes,
|
|
9
|
-
} from './deliveries.js';
|
|
10
|
-
import { BaseEvent } from './internal-events.js';
|
|
11
|
-
import { Opportunity, OpportunityPaymentStatus } from './opportunities.js';
|
|
10
|
+
} from './quotes.js';
|
|
12
11
|
import { BaseSearchRequest, SortOrder } from './search.js';
|
|
13
12
|
import { DataRecord, ReferenceData } from './utils.js';
|
|
14
13
|
import { Vehicle, VehiclePurchase } from './vehicles.js';
|
|
@@ -60,6 +59,13 @@ export enum TransportPriority {
|
|
|
60
59
|
Urgent = 'URGENT',
|
|
61
60
|
}
|
|
62
61
|
|
|
62
|
+
export const TransportSalesDeliveryType = {
|
|
63
|
+
Address: DeliveryTypes.ADDRESS,
|
|
64
|
+
Port: DeliveryTypes.PORT,
|
|
65
|
+
PortAndShip: DeliveryTypes.PORT_AND_SHIP,
|
|
66
|
+
PickUp: DeliveryTypes.PICK_UP,
|
|
67
|
+
} as const;
|
|
68
|
+
|
|
63
69
|
/**
|
|
64
70
|
* The customer collects the vehicle. Nothing is driven anywhere, but the papers still have to be
|
|
65
71
|
* arranged and paid for — transit plates, technical control, insurance — which is why it is a
|
|
@@ -70,7 +76,11 @@ export enum TransportPriority {
|
|
|
70
76
|
*/
|
|
71
77
|
export type TransportPickUpDeliveryType = Omit<PickUpDeliveryType, 'dateOfPickUpByCustomer'>;
|
|
72
78
|
|
|
73
|
-
type
|
|
79
|
+
export type TransportSalesDeliveryType = (
|
|
80
|
+
| PortDeliverytype
|
|
81
|
+
| AddressDeliveryType
|
|
82
|
+
| TransportPickUpDeliveryType
|
|
83
|
+
) & {
|
|
74
84
|
cleaningNeeded?: boolean;
|
|
75
85
|
driver?: string;
|
|
76
86
|
transportCompany?: string;
|
|
@@ -79,22 +89,14 @@ type TransportDeliveryExtras = {
|
|
|
79
89
|
stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings
|
|
80
90
|
};
|
|
81
91
|
|
|
82
|
-
export type
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/** @deprecated Use SalesDeliveryTypes from ./deliveries.js. */
|
|
92
|
-
export const TransportSalesDeliveryType = {
|
|
93
|
-
Address: SalesDeliveryTypes.ADDRESS,
|
|
94
|
-
Port: SalesDeliveryTypes.PORT,
|
|
95
|
-
PortAndShip: SalesDeliveryTypes.PORT_AND_SHIP,
|
|
96
|
-
PickUp: SalesDeliveryTypes.PICK_UP,
|
|
97
|
-
} as const;
|
|
92
|
+
export type TransportPurchaseDeliveryType = AddressDeliveryType & {
|
|
93
|
+
cleaningNeeded?: boolean;
|
|
94
|
+
driver?: string;
|
|
95
|
+
transportCompany?: string;
|
|
96
|
+
date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)
|
|
97
|
+
adminCost?: string; // user-entered administrative cost summed into totalCostExclVat
|
|
98
|
+
stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings
|
|
99
|
+
};
|
|
98
100
|
|
|
99
101
|
export type Transport = {
|
|
100
102
|
id: string;
|
|
@@ -179,8 +181,6 @@ export enum TransportActions {
|
|
|
179
181
|
* server writes into the delivery it ends up with.
|
|
180
182
|
*/
|
|
181
183
|
export type TransportUpdate = {
|
|
182
|
-
/** Changes the purchase method and the purchase agreement together. */
|
|
183
|
-
type?: TransportPurchaseType;
|
|
184
184
|
delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;
|
|
185
185
|
notes?: string | null;
|
|
186
186
|
adminApproved?: boolean;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { LocationValue } from '@bisondesk/commons-sdk/locations';
|
|
2
2
|
import { Organization } from './crm.js';
|
|
3
|
-
import { SalesDeliveryType } from './deliveries.js';
|
|
4
3
|
import { BaseEvent } from './internal-events.js';
|
|
5
4
|
import { Opportunity, VehicleSaleDealStatus, VehicleSaleLogisticsStatus } from './opportunities.js';
|
|
6
|
-
import { Quote } from './quotes.js';
|
|
5
|
+
import { DeliveryTypes, Quote } from './quotes.js';
|
|
7
6
|
import { DataRecord } from './utils.js';
|
|
8
7
|
|
|
9
8
|
export enum VehicleSaleInfoActions {
|
|
@@ -32,7 +31,7 @@ export type VehicleSaleInfoBff = {
|
|
|
32
31
|
client?: Organization;
|
|
33
32
|
delivery?: {
|
|
34
33
|
address?: LocationValue;
|
|
35
|
-
type:
|
|
34
|
+
type: DeliveryTypes;
|
|
36
35
|
};
|
|
37
36
|
};
|
|
38
37
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AppRoles } from '@bisondesk/commons-sdk/constants';
|
|
2
|
+
import { addMonths, isBefore } from 'date-fns';
|
|
3
|
+
|
|
4
|
+
const ORG_IDENTITY_LOCK_MONTHS = 1;
|
|
5
|
+
|
|
6
|
+
const ORG_IDENTITY_EDIT_ROLES: AppRoles[] = [
|
|
7
|
+
AppRoles.Administrative,
|
|
8
|
+
AppRoles.GeneralManager,
|
|
9
|
+
AppRoles.Admin,
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An organization's name and VAT number are its legal identity: the values invoices and contracts
|
|
14
|
+
* are issued against. They stay open for correction right after creation, then freeze for everyone
|
|
15
|
+
* except ORG_IDENTITY_EDIT_ROLES — by then they are already printed on legal documents.
|
|
16
|
+
*
|
|
17
|
+
* Shared so the server guard and the form's disabled state read one rule. Fails open on a missing
|
|
18
|
+
* createdAt: the org update path doubles as a create path for HyperDMS, and an org with no stored
|
|
19
|
+
* date must not be frozen out of its own first write.
|
|
20
|
+
*/
|
|
21
|
+
export const isOrgIdentityLocked = (
|
|
22
|
+
createdAt: string | undefined,
|
|
23
|
+
roles: AppRoles[] = [],
|
|
24
|
+
): boolean => {
|
|
25
|
+
if (createdAt == null || roles.some((role) => ORG_IDENTITY_EDIT_ROLES.includes(role))) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return isBefore(addMonths(new Date(createdAt), ORG_IDENTITY_LOCK_MONTHS), new Date());
|
|
30
|
+
};
|
package/src/utils/transports.ts
CHANGED
|
@@ -4,10 +4,12 @@ import { VehiclePurchase } from '../types/vehicles.js';
|
|
|
4
4
|
import { hasPurchaseArrived } from './vehicles.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* a drop-off
|
|
7
|
+
* Which side of the trade the transport serves. Both purchase types answer yes: a pick-up we drive
|
|
8
|
+
* and a drop-off the supplier drives differ only in who is behind the wheel, and every rule that
|
|
9
|
+
* asks this question — what it costs, whose money moved, which papers it needs — is the same for
|
|
10
|
+
* both.
|
|
9
11
|
*/
|
|
10
|
-
export const isPurchaseTransport = (transport:
|
|
12
|
+
export const isPurchaseTransport = (transport: Transport): boolean =>
|
|
11
13
|
transport.type !== TransportType.SaleDelivery;
|
|
12
14
|
|
|
13
15
|
/**
|