@bisondesk/core-sdk 1.0.21 → 1.0.23-B

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.
Files changed (225) hide show
  1. package/lib/apis/crm.d.ts +39 -0
  2. package/lib/apis/crm.d.ts.map +1 -0
  3. package/lib/apis/crm.js +201 -0
  4. package/lib/apis/crm.js.map +1 -0
  5. package/lib/apis/documents.d.ts +4 -0
  6. package/lib/apis/documents.d.ts.map +1 -0
  7. package/lib/apis/documents.js +47 -0
  8. package/lib/apis/documents.js.map +1 -0
  9. package/lib/apis/internet-vehicles.d.ts +3 -0
  10. package/lib/apis/internet-vehicles.d.ts.map +1 -0
  11. package/lib/apis/internet-vehicles.js +27 -0
  12. package/lib/apis/internet-vehicles.js.map +1 -0
  13. package/lib/apis/leasing-administration.d.ts +8 -0
  14. package/lib/apis/leasing-administration.d.ts.map +1 -0
  15. package/lib/apis/leasing-administration.js +49 -0
  16. package/lib/apis/leasing-administration.js.map +1 -0
  17. package/lib/apis/leasing.d.ts +19 -0
  18. package/lib/apis/leasing.d.ts.map +1 -0
  19. package/lib/apis/leasing.js +168 -0
  20. package/lib/apis/leasing.js.map +1 -0
  21. package/lib/apis/opportunities.d.ts +9 -0
  22. package/lib/apis/opportunities.d.ts.map +1 -0
  23. package/lib/apis/opportunities.js +94 -0
  24. package/lib/apis/opportunities.js.map +1 -0
  25. package/lib/apis/picklists.d.ts +5 -0
  26. package/lib/apis/picklists.d.ts.map +1 -0
  27. package/lib/apis/picklists.js +44 -0
  28. package/lib/apis/picklists.js.map +1 -0
  29. package/lib/apis/tenants.d.ts +7 -0
  30. package/lib/apis/tenants.d.ts.map +1 -0
  31. package/lib/apis/tenants.js +80 -0
  32. package/lib/apis/tenants.js.map +1 -0
  33. package/lib/apis/users.d.ts +3 -0
  34. package/lib/apis/users.d.ts.map +1 -0
  35. package/lib/apis/users.js +26 -0
  36. package/lib/apis/users.js.map +1 -0
  37. package/lib/apis/utils.d.ts +9 -0
  38. package/lib/apis/utils.d.ts.map +1 -0
  39. package/lib/apis/utils.js +23 -0
  40. package/lib/apis/utils.js.map +1 -0
  41. package/lib/apis/vehicles.d.ts +18 -0
  42. package/lib/apis/vehicles.d.ts.map +1 -0
  43. package/lib/apis/vehicles.js +159 -0
  44. package/lib/apis/vehicles.js.map +1 -0
  45. package/lib/constants.d.ts +77 -0
  46. package/lib/constants.d.ts.map +1 -1
  47. package/lib/constants.js +924 -1
  48. package/lib/constants.js.map +1 -1
  49. package/lib/ddb-entities.d.ts +2 -0
  50. package/lib/ddb-entities.d.ts.map +1 -0
  51. package/lib/ddb-entities.js +5 -0
  52. package/lib/ddb-entities.js.map +1 -0
  53. package/lib/types/activities.d.ts +38 -0
  54. package/lib/types/activities.d.ts.map +1 -0
  55. package/lib/types/activities.js +16 -0
  56. package/lib/types/activities.js.map +1 -0
  57. package/lib/types/crm.d.ts +103 -30
  58. package/lib/types/crm.d.ts.map +1 -1
  59. package/lib/types/crm.js +16 -0
  60. package/lib/types/crm.js.map +1 -1
  61. package/lib/types/definitions.d.ts +15 -13
  62. package/lib/types/definitions.d.ts.map +1 -1
  63. package/lib/types/documents.d.ts +105 -0
  64. package/lib/types/documents.d.ts.map +1 -0
  65. package/lib/types/{interests.js → documents.js} +1 -1
  66. package/lib/types/documents.js.map +1 -0
  67. package/lib/types/fields.d.ts +26 -25
  68. package/lib/types/fields.d.ts.map +1 -1
  69. package/lib/types/fields.js +4 -0
  70. package/lib/types/fields.js.map +1 -1
  71. package/lib/types/internet-vehicles.d.ts +64 -0
  72. package/lib/types/internet-vehicles.d.ts.map +1 -0
  73. package/lib/types/internet-vehicles.js +3 -0
  74. package/lib/types/internet-vehicles.js.map +1 -0
  75. package/lib/types/leads.d.ts +134 -0
  76. package/lib/types/leads.d.ts.map +1 -0
  77. package/lib/types/leads.js +3 -0
  78. package/lib/types/leads.js.map +1 -0
  79. package/lib/types/leasing-administration.d.ts +107 -0
  80. package/lib/types/leasing-administration.d.ts.map +1 -0
  81. package/lib/types/leasing-administration.js +3 -0
  82. package/lib/types/leasing-administration.js.map +1 -0
  83. package/lib/types/leasing-search.d.ts +22 -0
  84. package/lib/types/leasing-search.d.ts.map +1 -0
  85. package/lib/types/leasing-search.js +3 -0
  86. package/lib/types/leasing-search.js.map +1 -0
  87. package/lib/types/leasing-settings.d.ts +113 -0
  88. package/lib/types/leasing-settings.d.ts.map +1 -0
  89. package/lib/types/leasing-settings.js +10 -0
  90. package/lib/types/leasing-settings.js.map +1 -0
  91. package/lib/types/leasing.d.ts +322 -0
  92. package/lib/types/leasing.d.ts.map +1 -0
  93. package/lib/types/leasing.js +24 -0
  94. package/lib/types/leasing.js.map +1 -0
  95. package/lib/types/machines.d.ts +38 -0
  96. package/lib/types/machines.d.ts.map +1 -0
  97. package/lib/types/machines.js +3 -0
  98. package/lib/types/machines.js.map +1 -0
  99. package/lib/types/opportunities.d.ts +448 -0
  100. package/lib/types/opportunities.d.ts.map +1 -0
  101. package/lib/types/opportunities.js +68 -0
  102. package/lib/types/opportunities.js.map +1 -0
  103. package/lib/types/payments.d.ts +38 -0
  104. package/lib/types/payments.d.ts.map +1 -0
  105. package/lib/types/payments.js +9 -0
  106. package/lib/types/payments.js.map +1 -0
  107. package/lib/types/picklists.d.ts +15 -4
  108. package/lib/types/picklists.d.ts.map +1 -1
  109. package/lib/types/quotes.d.ts +173 -0
  110. package/lib/types/quotes.d.ts.map +1 -0
  111. package/lib/types/quotes.js +26 -0
  112. package/lib/types/quotes.js.map +1 -0
  113. package/lib/types/recently-viewed.d.ts +33 -0
  114. package/lib/types/recently-viewed.d.ts.map +1 -0
  115. package/lib/types/recently-viewed.js +3 -0
  116. package/lib/types/recently-viewed.js.map +1 -0
  117. package/lib/types/saved-filters.d.ts +20 -0
  118. package/lib/types/saved-filters.d.ts.map +1 -0
  119. package/lib/types/saved-filters.js +3 -0
  120. package/lib/types/saved-filters.js.map +1 -0
  121. package/lib/types/search.d.ts +26 -4
  122. package/lib/types/search.d.ts.map +1 -1
  123. package/lib/types/search.js.map +1 -1
  124. package/lib/types/settings.d.ts +50 -0
  125. package/lib/types/settings.d.ts.map +1 -0
  126. package/lib/types/settings.js +3 -0
  127. package/lib/types/settings.js.map +1 -0
  128. package/lib/types/storage.d.ts +1 -11
  129. package/lib/types/storage.d.ts.map +1 -1
  130. package/lib/types/storage.js +15 -0
  131. package/lib/types/storage.js.map +1 -1
  132. package/lib/types/templates.d.ts +35 -0
  133. package/lib/types/templates.d.ts.map +1 -0
  134. package/lib/types/templates.js +9 -0
  135. package/lib/types/templates.js.map +1 -0
  136. package/lib/types/tenants.d.ts +32 -9
  137. package/lib/types/tenants.d.ts.map +1 -1
  138. package/lib/types/tenants.js +11 -0
  139. package/lib/types/tenants.js.map +1 -1
  140. package/lib/types/users.d.ts +11 -3
  141. package/lib/types/users.d.ts.map +1 -1
  142. package/lib/types/utils.d.ts +20 -0
  143. package/lib/types/utils.d.ts.map +1 -1
  144. package/lib/types/utils.js +6 -0
  145. package/lib/types/utils.js.map +1 -1
  146. package/lib/types/vehicles.d.ts +406 -92
  147. package/lib/types/vehicles.d.ts.map +1 -1
  148. package/lib/types/vehicles.js +54 -1
  149. package/lib/types/vehicles.js.map +1 -1
  150. package/lib/types/website.d.ts +24 -0
  151. package/lib/types/website.d.ts.map +1 -0
  152. package/lib/types/website.js +3 -0
  153. package/lib/types/website.js.map +1 -0
  154. package/lib/utils/forms.d.ts +6 -0
  155. package/lib/utils/forms.d.ts.map +1 -0
  156. package/lib/utils/forms.js +33 -0
  157. package/lib/utils/forms.js.map +1 -0
  158. package/lib/utils/leasing.d.ts +3 -0
  159. package/lib/utils/leasing.d.ts.map +1 -0
  160. package/lib/utils/leasing.js +10 -0
  161. package/lib/utils/leasing.js.map +1 -0
  162. package/lib/utils/slug.d.ts +3 -0
  163. package/lib/utils/slug.d.ts.map +1 -0
  164. package/lib/utils/slug.js +23 -0
  165. package/lib/utils/slug.js.map +1 -0
  166. package/lib/utils/tenants.d.ts +4 -0
  167. package/lib/utils/tenants.d.ts.map +1 -0
  168. package/lib/utils/tenants.js +16 -0
  169. package/lib/utils/tenants.js.map +1 -0
  170. package/lib/utils/vehicles.d.ts +12 -0
  171. package/lib/utils/vehicles.d.ts.map +1 -0
  172. package/lib/utils/vehicles.js +73 -0
  173. package/lib/utils/vehicles.js.map +1 -0
  174. package/package.json +8 -6
  175. package/src/apis/crm.ts +302 -0
  176. package/src/apis/documents.ts +54 -0
  177. package/src/apis/internet-vehicles.ts +23 -0
  178. package/src/apis/leasing-administration.ts +70 -0
  179. package/src/apis/leasing.ts +257 -0
  180. package/src/apis/opportunities.ts +133 -0
  181. package/src/apis/picklists.ts +50 -0
  182. package/src/apis/tenants.ts +100 -0
  183. package/src/apis/users.ts +22 -0
  184. package/src/apis/utils.ts +23 -0
  185. package/src/apis/vehicles.ts +229 -0
  186. package/src/constants.ts +930 -1
  187. package/src/ddb-entities.ts +1 -0
  188. package/src/environment.d.ts +6 -0
  189. package/src/types/activities.ts +41 -0
  190. package/src/types/crm.ts +118 -30
  191. package/src/types/definitions.ts +19 -12
  192. package/src/types/documents.ts +110 -0
  193. package/src/types/fields.ts +72 -31
  194. package/src/types/internet-vehicles.ts +67 -0
  195. package/src/types/leads.ts +144 -0
  196. package/src/types/leasing-administration.ts +131 -0
  197. package/src/types/leasing-search.ts +24 -0
  198. package/src/types/leasing-settings.ts +111 -0
  199. package/src/types/leasing.ts +360 -0
  200. package/src/types/machines.ts +40 -0
  201. package/src/types/opportunities.ts +496 -0
  202. package/src/types/payments.ts +40 -0
  203. package/src/types/picklists.ts +26 -7
  204. package/src/types/quotes.ts +186 -0
  205. package/src/types/recently-viewed.ts +45 -0
  206. package/src/types/saved-filters.ts +21 -0
  207. package/src/types/search.ts +34 -4
  208. package/src/types/settings.ts +51 -0
  209. package/src/types/storage.ts +1 -12
  210. package/src/types/templates.ts +40 -0
  211. package/src/types/tenants.ts +37 -11
  212. package/src/types/users.ts +17 -3
  213. package/src/types/utils.ts +25 -0
  214. package/src/types/vehicles.ts +461 -93
  215. package/src/types/website.ts +28 -0
  216. package/src/utils/forms.ts +32 -0
  217. package/src/utils/leasing.ts +14 -0
  218. package/src/utils/slug.ts +19 -0
  219. package/src/utils/tenants.ts +14 -0
  220. package/src/utils/vehicles.ts +92 -0
  221. package/tsconfig.tsbuildinfo +1 -2995
  222. package/lib/types/interests.d.ts +0 -23
  223. package/lib/types/interests.d.ts.map +0 -1
  224. package/lib/types/interests.js.map +0 -1
  225. package/src/types/interests.ts +0 -20
@@ -1,15 +1,260 @@
1
- // mostly inspired by the Hexon data model
1
+ import {
2
+ AttachmentValue,
3
+ Document,
4
+ LocationValue,
5
+ MultiLangValue,
6
+ SearchPermissions,
7
+ } from '@bisondesk/commons-sdk/lib/types';
2
8
 
3
- import { AttachmentValue } from './fields';
9
+ type BaseVehicleEvent = {
10
+ id: string;
11
+ actionAt: string;
12
+ userId: string;
13
+ tenantId: string;
14
+ };
4
15
 
5
- export type SearchVehicle = {
6
- vehicle: Partial<Vehicle>;
16
+ type VehicleSuperstructure = {
17
+ carCapacity?: number;
18
+ compartmentCount?: number;
19
+ counter?: boolean;
20
+ crane?: {
21
+ make?: string;
22
+ model?: string;
23
+ position?: 'Behind the cabin' | 'Rear';
24
+ present?: boolean;
25
+ year?: number;
26
+ };
27
+ dimensions?: {
28
+ height?: number;
29
+ length?: number;
30
+ width?: number;
31
+ extended?: string; // L1, L2, ...
32
+ heightened?: string; // H1, H2, ...
33
+ };
34
+ baseVehicle?: SuperstructureBaseVehicle;
35
+ extendable?: boolean;
36
+ highPressurePump?: boolean;
37
+ loadingPlatformHeight?: number;
38
+ pump?: boolean;
39
+ slidingRoof?: boolean;
40
+ tailgate?: {
41
+ capacity?: number;
42
+ make?: string;
43
+ model?: string;
44
+ present?: boolean;
45
+ type?: 'slider_lift' | 'cantilever' | 'column_lift';
46
+ };
47
+ tank?: {
48
+ capacity: number;
49
+ };
50
+ temperatureControl?: {
51
+ engineType?: 'diesel' | 'electric' | 'diesel+electric' | 'engine';
52
+ make?: string;
53
+ runningHours?: {
54
+ diesel?: number;
55
+ electric?: number;
56
+ };
57
+ };
58
+ tipper?: {
59
+ tipsBack?: boolean;
60
+ tipsLeft?: boolean;
61
+ tipsRight?: boolean;
62
+ };
7
63
  };
64
+ export type NewVehicleRequest = {
65
+ branch: string;
66
+ count: number;
67
+ specs: VehicleExternalInfo;
68
+ description: {
69
+ remarks?: string;
70
+ technicalRemarks?: string;
71
+ };
72
+ logistics: {
73
+ vehicleRole: VehicleInternalInfo['role'];
74
+ parking: string;
75
+ deliveryType: VehiclePurchaseDeliveryType;
76
+ availableDate: string;
77
+ pickupAddress?: LocationValue;
78
+ };
79
+ prices: {
80
+ minimum?: string;
81
+ premium?: string;
82
+ internet?: string;
83
+ };
84
+ media: {
85
+ pictures: AttachmentValue[];
86
+ videos: AttachmentValue[];
87
+ docs: Document[];
88
+ engineeringDocs: Document[];
89
+ };
90
+ vinList?: string;
91
+ deal: {
92
+ stockNumber?: string;
93
+ contactId: string;
94
+ orgId: string;
95
+ purchasedBy: string;
96
+ dealStatus:
97
+ | VehiclePurchaseDealStatus.PurchaseEvaluation
98
+ | VehiclePurchaseDealStatus.PurchaseAgreed;
99
+ costs: {
100
+ purchase: string;
101
+ purchaseVatPercentage: string;
102
+ commission?: string;
103
+ externalTransport?: string;
104
+ internalTransport?: string;
105
+ externalGarage?: string;
106
+ internalGarage?: string;
107
+ other?: string;
108
+ };
109
+ };
110
+ };
111
+
112
+ export type VehicleCreateEvent = BaseVehicleEvent & {
113
+ action: 'create';
114
+ vehicle: Vehicle;
115
+ previousVehicle?: undefined;
116
+ };
117
+
118
+ export type VehicleUpdateEvent = BaseVehicleEvent & {
119
+ action: 'update';
120
+ vehicle: Vehicle;
121
+ previousVehicle: Vehicle;
122
+ };
123
+
124
+ export type VehicleDeleteEvent = BaseVehicleEvent & {
125
+ action: 'delete';
126
+ vehicle?: undefined;
127
+ previousVehicle: Vehicle;
128
+ };
129
+
130
+ export type VehicleEvent = VehicleCreateEvent | VehicleUpdateEvent | VehicleDeleteEvent;
8
131
 
9
- export type Vehicle = {
132
+ export type VehicleMarketingEvent = {
133
+ actionAt: string;
134
+ data: VehicleMarketing;
135
+ tenantId: string;
136
+ userId: string;
137
+ vehicleId: string;
138
+ };
139
+
140
+ export type UpdateVehiclesPricesEvent = {
10
141
  id: string;
142
+ actionAt: string;
143
+ userId: string;
144
+ tenantId: string;
145
+ priceList: AttachmentValue;
146
+ };
147
+
148
+ export type PublicVehicle = Pick<Vehicle, 'external' | 'id'>;
149
+
150
+ export type PublicSearchVehicle = {
151
+ vehicle: PublicVehicle;
152
+ };
153
+
154
+ export enum CustomSearchState {
155
+ Available = 'available',
156
+ Expected = 'expected',
157
+ Reserved = 'reserved',
158
+ }
159
+
160
+ export type SearchVehicle = {
161
+ custom: {
162
+ features: string[];
163
+ state: CustomSearchState[];
164
+ };
165
+ purchase?: {
166
+ supplierStockNumber?: string;
167
+ };
168
+ vehicle: Vehicle;
169
+ };
170
+
171
+ export type InputSearchVehicle = SearchVehicle & {
172
+ permissions: SearchPermissions;
173
+ };
174
+
175
+ export type VehicleInternalInfo = {
11
176
  createdAt: string;
177
+ description: {
178
+ title: string;
179
+ remarks?: string;
180
+ technicalRemarks?: string;
181
+ };
182
+ parkingName?: string;
183
+ identification: {
184
+ administrativeNumber?: string;
185
+ stockNumber: string;
186
+ branch: string;
187
+
188
+ /**
189
+ * This ID is used to link different vehicle objects that represent the same real world asset.
190
+ * Ideally the chassis number could be used, but in some cases it is not available yet.
191
+ */
192
+ metaId: string;
193
+ };
194
+ documents: Document[];
195
+ engineeringDocs: Document[];
196
+ pricing: {
197
+ premium?: string;
198
+ minimum?: string;
199
+ currency?: string;
200
+ };
201
+ role: 'SALE' | 'OWN_USE' | 'RENTAL' | 'BUILD' | 'UNKNOWN';
202
+ status: VehicleStatus;
12
203
  updatedAt: string;
204
+ /* use this property to store additional terms that you want the vehicle to be found with when doing a full text search */
205
+ keywords?: string[];
206
+ };
207
+
208
+ export type VehicleOriginalInfo = {
209
+ tenantId: string;
210
+ identification: {
211
+ id: string;
212
+ stockNumber: string;
213
+ hyperdmsTenantId?: string;
214
+ metaId?: string;
215
+ };
216
+ salesConditions: {
217
+ leasing?: boolean;
218
+ expected?: boolean;
219
+ reserved?: boolean;
220
+ price?: string;
221
+ currency?: string;
222
+ };
223
+ };
224
+
225
+ export type VehicleAxlesInfo = {
226
+ details: VehicleAxle[];
227
+ configuration?: string;
228
+ count?: number;
229
+ poweredAxlesCount?: number;
230
+ wheelbase?: number;
231
+ suspension?: 'Air' | 'Air/Steel' | 'Steel';
232
+ };
233
+
234
+ export type SuperstructureBaseVehicle = {
235
+ category: string;
236
+ make: string;
237
+ model?: string;
238
+ type?: string;
239
+ axlesConfiguration?: string;
240
+ emissionsClass?: string;
241
+ transmissionType?: 'Automatic' | 'Manual' | 'Semi-Automatic';
242
+ vin?: string;
243
+ currentRegistration?: {
244
+ country?: string;
245
+ };
246
+ suspension?: 'Air' | 'Air/Steel' | 'Steel';
247
+ constructionYear?: number;
248
+ firstRegistration?: string;
249
+ odometerKm?: number;
250
+ powerHp?: number;
251
+ bodystyle?: string;
252
+ accessories: VehicleExternalInfo['accessories'];
253
+ superstructure?: Pick<VehicleSuperstructure, 'crane' | 'tailgate'>;
254
+ };
255
+
256
+ // mostly inspired by the Hexon data model
257
+ export type VehicleExternalInfo = {
13
258
  body?: {
14
259
  cabin?: {
15
260
  type: 'Day' | 'Sleep / Small' | 'Sleep / Medium' | 'Sleep / Large';
@@ -29,6 +274,7 @@ export type Vehicle = {
29
274
  };
30
275
  mainPicture?: AttachmentValue;
31
276
  pictures?: AttachmentValue[];
277
+ videos?: AttachmentValue[];
32
278
  condition?: {
33
279
  damaged?: boolean;
34
280
  odometer?: {
@@ -36,26 +282,14 @@ export type Vehicle = {
36
282
  };
37
283
  used?: boolean;
38
284
  };
39
- description?: {
40
- remarks?: {
41
- [lang: string]: string;
42
- };
43
- internal_remarks?: {
44
- [lang: string]: string;
45
- };
46
- internal_technical_remarks?: {
47
- [lang: string]: string;
48
- };
49
- titles?: {
50
- [lang: string]: string;
51
- };
52
- };
53
285
  general: {
54
- bodystyle: string;
286
+ bodystyle?: string;
55
287
  category: string;
56
- make: string;
288
+ make?: string;
57
289
  model?: string;
290
+ modelName?: string;
58
291
  type?: string;
292
+ typeName?: string;
59
293
  };
60
294
  history?: {
61
295
  advertisingYear?: number;
@@ -65,29 +299,21 @@ export type Vehicle = {
65
299
  technicalInspectionEndDate?: string;
66
300
  };
67
301
  firstRegistration?: string;
302
+ cocPvg?: string;
68
303
  };
69
- identification?: {
70
- administrativeNumber: string;
71
- externalId?: string;
72
- hdmsId: string;
73
- hdmsOrg: string;
304
+ identification: {
74
305
  licensePlate?: string;
75
- stockNumber: string;
306
+ stockNumber?: string;
76
307
  vin?: string;
308
+ buildStockNumber?: string;
77
309
  };
78
310
  powertrain?: {
79
- axles?: {
80
- details?: VehicleAxle[];
81
- configuration?: string;
82
- count?: number;
83
- poweredAxlesCount?: number;
84
- wheelbase?: number;
85
- suspension?: 'Air' | 'Air/Steel' | 'Steel';
86
- };
311
+ axles?: VehicleAxlesInfo;
87
312
  emissions?: {
88
313
  class?: string;
89
314
  };
90
315
  engine?: {
316
+ cylinderCount?: number;
91
317
  energy?: string;
92
318
  power?: {
93
319
  hp?: number;
@@ -101,65 +327,14 @@ export type Vehicle = {
101
327
  type?: 'Automatic' | 'Manual' | 'Semi-Automatic';
102
328
  };
103
329
  };
104
- salesConditions?: {
330
+ salesConditions: {
105
331
  leasing?: boolean;
106
332
  expected?: boolean;
107
333
  reserved?: boolean;
108
- pricing?: {
109
- internet?: string;
110
- premium?: string;
111
- minimum?: string;
112
- currency?: string;
113
- };
114
- };
115
- superstructure?: {
116
- carCapacity?: number;
117
- compartmentCount?: number;
118
- counter?: boolean;
119
- crane?: {
120
- make?: string;
121
- model?: string;
122
- position?: 'Behind the cabin' | 'Rear';
123
- present?: boolean;
124
- year?: number;
125
- };
126
- dimensions?: {
127
- height?: number;
128
- length?: number;
129
- width?: number;
130
- extended?: 'L1' | 'L2' | 'L3' | 'L4' | 'L5';
131
- heightened?: 'H1' | 'H2' | 'H3';
132
- };
133
- extendable?: boolean;
134
- highPressurePump?: boolean;
135
- hoses?: boolean;
136
- loadingPlatformHeight?: number;
137
- pump?: boolean;
138
- slidingRoof?: boolean;
139
- tailgate?: {
140
- capacity?: number;
141
- make?: string;
142
- model?: string;
143
- present?: boolean;
144
- type?: 'slider_lift' | 'cantilever' | 'column_lift';
145
- };
146
- tank?: {
147
- capacity: number;
148
- };
149
- temperatureControl?: {
150
- engineType?: 'diesel' | 'electric' | 'diesel+electric' | 'engine';
151
- make?: string;
152
- runningHours?: {
153
- diesel?: number;
154
- electric?: number;
155
- };
156
- };
157
- tipper?: {
158
- tipsBack?: boolean;
159
- tipsLeft?: boolean;
160
- tipsRight?: boolean;
161
- };
334
+ price?: string | undefined;
335
+ currency?: string | undefined;
162
336
  };
337
+ superstructure?: VehicleSuperstructure;
163
338
  weights?: {
164
339
  gvw?: number;
165
340
  massEmpty?: number;
@@ -173,7 +348,6 @@ export type Vehicle = {
173
348
  cdPlayer?: boolean;
174
349
  centralLocking?: boolean;
175
350
  centralLubrication?: boolean;
176
- crane?: boolean;
177
351
  cruiseControl?: boolean;
178
352
  electricDoorMirrors?: boolean;
179
353
  electricWindows?: boolean;
@@ -207,9 +381,34 @@ export type Vehicle = {
207
381
  };
208
382
  };
209
383
 
384
+ type BaseVehicle<I = VehicleInternalInfo, E = VehicleExternalInfo> = {
385
+ internal: I;
386
+ external: E;
387
+ original?: VehicleOriginalInfo;
388
+ };
389
+
390
+ export type NewVehicle<I = VehicleInternalInfo, E = VehicleExternalInfo> = BaseVehicle<I, E> & {
391
+ id?: undefined;
392
+ };
393
+
394
+ export type Vehicle<I = VehicleInternalInfo, E = VehicleExternalInfo> = BaseVehicle<I, E> & {
395
+ id: string;
396
+ };
397
+
398
+ export type VehiclesByChassisNumberRequest = {
399
+ tenantIds: string[];
400
+ chassisNumber: string;
401
+ };
402
+
403
+ export type VehiclesByMetaIdRequest = {
404
+ tenantIds: string[];
405
+ metaId: string;
406
+ };
407
+
210
408
  export type VehicleAxle = {
409
+ make?: string;
211
410
  alloyWheels?: boolean;
212
- brakes?: string;
411
+ brakes?: 'Disc' | 'Drum';
213
412
  differentialLock?: boolean;
214
413
  liftAxle?: boolean;
215
414
  maxLoad?: number;
@@ -218,7 +417,7 @@ export type VehicleAxle = {
218
417
  powered?: boolean;
219
418
  reduction?: string;
220
419
  steering?: boolean;
221
- suspension?: string;
420
+ suspension?: 'Steel' | 'Air' | 'Hydraulic';
222
421
  twinWheels?: boolean;
223
422
  tyreConditionPercLeftInside?: number;
224
423
  tyreConditionPercLeftOutside?: number;
@@ -226,3 +425,172 @@ export type VehicleAxle = {
226
425
  tyreConditionPercRightOutside?: number;
227
426
  tyreSize?: string;
228
427
  };
428
+
429
+ export type VehicleMarketing = {
430
+ titles: MultiLangValue;
431
+ remarks?: MultiLangValue;
432
+ marketingPlatforms: string[];
433
+ pictures: AttachmentValue[];
434
+ videos: AttachmentValue[];
435
+ overrides?: {
436
+ marketingPlatforms?: boolean;
437
+ remarks?: boolean;
438
+ titles?: boolean;
439
+ pictures?: boolean;
440
+ videos?: boolean;
441
+ };
442
+ };
443
+
444
+ export enum VehicleSaleDealStatus {
445
+ SaleAgreed = 'SALE_AGREED',
446
+ FirstPaymentReceived = 'FIRST_PAYMENT_RECEIVED',
447
+ FullPaymentReceived = 'FULL_PAYMENT_RECEIVED',
448
+ NotSold = 'NOT_SOLD',
449
+ }
450
+
451
+ export enum VehiclePurchaseDealStatus {
452
+ PurchaseEvaluation = 'PURCHASE_EVALUATION', // used for vehicle consignation
453
+ PurchaseAgreed = 'PURCHASE_AGREED',
454
+ FirstPaymentAllowed = 'FIRST_PAYMENT_ALLOWED',
455
+ FirstPaymentSent = 'FIRST_PAYMENT_SENT',
456
+ FullPaymentAllowed = 'FULL_PAYMENT_ALLOWED',
457
+ FullPaymentSent = 'FULL_PAYMENT_SENT',
458
+ }
459
+
460
+ export enum VehicleSaleLogisticsStatus {
461
+ AtOrigin = 'AT_ORIGIN',
462
+ Delivered = 'DELIVERED',
463
+ }
464
+
465
+ export enum VehiclePurchaseLogisticsStatus {
466
+ AtOrigin = 'AT_ORIGIN',
467
+ Arrived = 'ARRIVED',
468
+ CheckedIn = 'CHECKED_IN',
469
+ }
470
+
471
+ export enum VehiclePurchaseDeliveryType {
472
+ PickUp = 'PICK_UP',
473
+ DropOff = 'DROP_OFF',
474
+ }
475
+
476
+ export type VehicleStatus = {
477
+ deleted?: boolean;
478
+ option?: {
479
+ id: string;
480
+ expirationDate: number;
481
+ };
482
+ sale: {
483
+ id?: string;
484
+ dealStatus: VehicleSaleDealStatus;
485
+ logisticsStatus?: VehicleSaleLogisticsStatus;
486
+ };
487
+ purchase: {
488
+ purchasedBy?: string;
489
+ dealStatus: VehiclePurchaseDealStatus;
490
+ logisticsStatus: VehiclePurchaseLogisticsStatus;
491
+ };
492
+ };
493
+
494
+ export type VehiclePriceList = {
495
+ uploadedAt: string;
496
+ uploadedBy: string;
497
+ priceList: AttachmentValue;
498
+ id: string;
499
+ };
500
+
501
+ export type UpdateVehiclesPricesRequest = {
502
+ priceList: AttachmentValue;
503
+ };
504
+
505
+ export type VehiclePriceListLine = {
506
+ reference: string;
507
+ internet?: string;
508
+ premium?: string;
509
+ minimum?: string;
510
+ };
511
+
512
+ export type VehiclePriceUpdateError = {
513
+ data: VehiclePriceListLine;
514
+ line: number;
515
+ error: {
516
+ fieldId: keyof VehiclePriceListLine;
517
+ msg: string;
518
+ };
519
+ };
520
+
521
+ export type VehiclePriceUpdateResponse =
522
+ | {
523
+ success: true;
524
+ }
525
+ | {
526
+ success: false;
527
+ errors: VehiclePriceUpdateError[];
528
+ };
529
+
530
+ export type VehiclePurchase = {
531
+ organizationId: string;
532
+ contactId: string;
533
+ supplierStockNumber?: string;
534
+ purchasedBy: string;
535
+
536
+ log: {
537
+ evaluationStartedAt?: string;
538
+ evaluationStartedBy?: string;
539
+
540
+ purchaseAgreedAt?: string;
541
+ purchaseAgreedBy?: string;
542
+
543
+ firstPaymentAllowedAt?: string;
544
+ firstPaymentAllowedBy?: string;
545
+ firstPaymentSentAt?: string;
546
+ firstPaymentSentBy?: string;
547
+
548
+ fullPaymentAllowedAt?: string;
549
+ fullPaymentAllowedBy?: string;
550
+ fullPaymentSentAt?: string;
551
+ fullPaymentSentBy?: string;
552
+
553
+ arrivedAt?: string;
554
+ arrivedBy?: string;
555
+ checkedInAt?: string;
556
+ checkedInBy?: string;
557
+ };
558
+
559
+ deal: {
560
+ status: VehiclePurchaseDealStatus;
561
+
562
+ askingPrice?: string;
563
+ purchaseVatRate?: string;
564
+ purchase?: string; // exclusive VAT
565
+
566
+ commission?: string;
567
+ externalTransport?: string;
568
+ internalTransport?: string;
569
+ externalGarage?: string;
570
+ internalGarage?: string;
571
+ other?: string;
572
+ };
573
+
574
+ logistics: {
575
+ parkingName?: string;
576
+ status: VehiclePurchaseLogisticsStatus;
577
+ deliveryType?: VehiclePurchaseDeliveryType;
578
+ pickupAddress?: LocationValue;
579
+ availableWeek?: string; // ISOWEEK, e.g. 2016-W02
580
+ };
581
+ };
582
+
583
+ export enum VehicleActions {
584
+ EditAdminDocs = 'edit_admin_docs',
585
+ EditEngineeringDocs = 'edit_engineering_docs',
586
+ EditMarketing = 'edit_marketing',
587
+ EditMedia = 'edit_media',
588
+ EditPictures = 'edit_pictures',
589
+ EditPrices = 'edit_prices',
590
+ EditPurchaseDeal = 'edit_purchase_deal',
591
+ EditPurchaseLogistics = 'edit_purchase_logistics',
592
+ EditSpecs = 'edit_specs',
593
+ EditVideos = 'edit_videos',
594
+ ViewLeads = 'view_leads',
595
+ ViewSimilarOnline = 'view_similar_online',
596
+ }
@@ -0,0 +1,28 @@
1
+ import { PhoneNumberRawValue, PhoneNumberValue } from '@bisondesk/commons-sdk/lib/types';
2
+
3
+ export type ContactFormRequest = {
4
+ email: string;
5
+ name: string;
6
+ message: string;
7
+ phone: PhoneNumberRawValue;
8
+ };
9
+
10
+ export type ValidContactFormRequest = Omit<ContactFormRequest, 'phone'> & {
11
+ phone: PhoneNumberValue;
12
+ };
13
+
14
+ export type ContactFormEvent = {
15
+ tenantId: string;
16
+ payload: ValidContactFormRequest;
17
+ };
18
+
19
+ export type LeasingSimulationRequest = {
20
+ deposit: number;
21
+ residual: number;
22
+ durationInMonths: number;
23
+ vehicleId: string;
24
+ };
25
+
26
+ export type LeasingSimulationResponse = {
27
+ monthly: string;
28
+ };
@@ -0,0 +1,32 @@
1
+ import Decimal from 'decimal.js';
2
+ import { PricePercentageMode } from '../types/utils';
3
+
4
+ export const computePricePercentage = (
5
+ totalAmount: string,
6
+ percentage: string,
7
+ partialAmount: string = '0',
8
+ mode: PricePercentageMode = PricePercentageMode.PERCENTAGE
9
+ ): { percentageAmount: string; currencyAmount: string } => {
10
+ const output: { percentageAmount: string; currencyAmount: string } = {
11
+ percentageAmount: percentage,
12
+ currencyAmount: partialAmount,
13
+ };
14
+
15
+ if (mode === PricePercentageMode.PERCENTAGE) {
16
+ output.currencyAmount = new Decimal(totalAmount)
17
+ .mul(percentage)
18
+ .div(100)
19
+ .toDecimalPlaces(2)
20
+ .clamp(0, totalAmount)
21
+ .toString();
22
+ } else {
23
+ output.percentageAmount = new Decimal(partialAmount)
24
+ .mul(100)
25
+ .div(totalAmount)
26
+ .toDecimalPlaces(4)
27
+ .clamp(0, 100)
28
+ .toString();
29
+ }
30
+
31
+ return output;
32
+ };
@@ -0,0 +1,14 @@
1
+ import { utc } from '@bisondesk/commons-sdk/lib/dayjs-utils';
2
+ import { map, sortBy, uniqBy } from 'lodash';
3
+ import { LeasingContractClient } from '../types/leasing';
4
+
5
+ /* sort from oldest to most recent client */
6
+ export const sortContractClients = (clients: LeasingContractClient[]): LeasingContractClient[] =>
7
+ sortBy(
8
+ map(
9
+ uniqBy(clients, (c) => c.takeoverId),
10
+ (c) => ({ ...c, since: utc(c.since).format('YYYY-MM-DD') }) // doing a map to also fix legacy data
11
+ ),
12
+ (cli) => cli.since,
13
+ (cli) => (cli.takeoverId ? parseInt(cli.takeoverId.replace(/[^0-9]/g, '')) : 0)
14
+ );