@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
@@ -0,0 +1,496 @@
1
+ import { Document } from '@bisondesk/commons-sdk/lib/types';
2
+ import { OpportunityType } from '../constants';
3
+ import { Contact, Organization } from './crm';
4
+ import { Interest } from './leads';
5
+ import { Payment } from './payments';
6
+ import { LeasingQuote, QuoteStatus } from './quotes';
7
+ import { DataRecord, ReferenceData } from './utils';
8
+ import { Vehicle } from './vehicles';
9
+
10
+ export enum OpportunityActions {
11
+ CREATE_QUOTE = 'create_quote',
12
+ LOSE = 'lose',
13
+ REOPEN = 'reopen',
14
+ START_PREPARATION = 'start_preparation',
15
+ REVERT_PREPARATION = 'revert_preparation',
16
+ START_DELIVERY = 'start_delivery',
17
+ REVERT_DELIVERY = 'revert_delivery',
18
+ SET_CUSTOMER = 'set_customer',
19
+ SET_DOCUMENTS = 'set_documents',
20
+ SET_INTEREST = 'set_interest',
21
+ SET_METADATA = 'set_metadata',
22
+ SET_VEHICLE = 'set_vehicle',
23
+ ADD_ACTIVITY = 'add_activity',
24
+ ADD_PAYMENT = 'add_payment',
25
+ SWITCH_VEHICLE = 'switch_vehicle',
26
+ }
27
+
28
+ export enum OpportunityDealStatus {
29
+ SALES_AGREED = 'sales_agreed',
30
+ FIRST_PAYMENT = 'first_payment',
31
+ FULL_PAYMENT = 'full_payment',
32
+ }
33
+
34
+ export enum OpportunityStatus {
35
+ PROSPECTION = 'prospection',
36
+ DISCOVERY = 'discovery',
37
+ EVALUATION = 'evaluation',
38
+ REVIEW = 'review',
39
+ PREPARATION = 'preparation',
40
+ DELIVERY = 'delivery',
41
+ }
42
+
43
+ export const OpportunityStatusOrder: OpportunityStatus[] = [
44
+ OpportunityStatus.PROSPECTION,
45
+ OpportunityStatus.DISCOVERY,
46
+ OpportunityStatus.EVALUATION,
47
+ OpportunityStatus.REVIEW,
48
+ OpportunityStatus.PREPARATION,
49
+ OpportunityStatus.DELIVERY,
50
+ ];
51
+
52
+ export enum OpportunityLogisticStatus {
53
+ AT_ORIGIN = 'at_origin',
54
+ DELIVERED = 'delivered',
55
+ }
56
+ export const OpportunityWonColumnId = 'closed_won';
57
+
58
+ export const OpportunityKanbanColumns = [...OpportunityStatusOrder, OpportunityWonColumnId];
59
+
60
+ export const OpportunityKanbanEndColumns: string[] = [OpportunityWonColumnId];
61
+
62
+ export enum OpportunityLostReasonValues {
63
+ Expensive = 'expensive',
64
+ AlreadySold = 'already_sold',
65
+ BadExperience = 'bad_experience',
66
+ IncorrectVehicleCondition = 'incorrect_vehicle_condition',
67
+ NoStock = 'not_enough_stock',
68
+ SlowDelivery = 'slow_delivery',
69
+ HighDeposit = 'deposit_too_high',
70
+ NoAnswer = 'client_not_answered',
71
+ }
72
+
73
+ type BaseBid = {
74
+ vehicleId: string;
75
+ opportunityId?: string;
76
+ contactId: string;
77
+ amount: string;
78
+ };
79
+
80
+ export type NewBid = BaseBid & {};
81
+
82
+ export type Bid = BaseBid & {
83
+ id: string;
84
+ createdAt: string;
85
+ createdBy: string;
86
+ };
87
+
88
+ type BaseOpportunity = {
89
+ accountManager?: string;
90
+ administrativePerson?: string;
91
+ type: OpportunityType;
92
+ organizationId?: string;
93
+ contactId?: string;
94
+ vehicleId?: string;
95
+ source?: string; // e.g. website, autoscout, mobile...
96
+ branch: string;
97
+ inquiry?: string;
98
+ branchCountry: string;
99
+ };
100
+
101
+ export type NewOpportunity = BaseOpportunity & {
102
+ id?: undefined;
103
+ createdAt?: undefined;
104
+ createdBy?: undefined;
105
+ modifiedAt?: undefined;
106
+ modifiedBy?: undefined;
107
+ };
108
+
109
+ export type Opportunity = BaseOpportunity & {
110
+ id: string;
111
+ createdAt: string;
112
+ createdBy: string;
113
+ modifiedAt: string;
114
+ modifiedBy: string;
115
+ validatedAt?: string;
116
+ validatedBy?: string;
117
+ acceptedAt?: string;
118
+ acceptedBy?: string;
119
+ lastActivityAt?: string; // last time we reached out to the customer, regardless of medium
120
+ reviewedAt?: string;
121
+ reviewedBy?: string;
122
+ preparedAt?: string;
123
+ preparedBy?: string;
124
+ lostAt?: string;
125
+ lostBy?: string;
126
+ wonAt?: string;
127
+ lostReason?: OpportunityLostReasonValues;
128
+ deliveredAt?: string;
129
+ deliveredBy?: string;
130
+ status: OpportunityStatus;
131
+ dealStatus?: OpportunityDealStatus;
132
+ logisticStatus?: OpportunityLogisticStatus;
133
+ activeQuoteId?: string;
134
+ contractId?: string;
135
+ amount?: string;
136
+ interest?: Interest;
137
+ documents?: Document[];
138
+ leasingContractId?: string;
139
+ };
140
+
141
+ export type OpportunityUpdate = {
142
+ vehicleId?: string | null;
143
+ accountManager?: string | null;
144
+ administrativePerson?: string | null;
145
+ contactId?: string | null;
146
+ activeQuoteId?: string | null;
147
+ interest?: Interest | null;
148
+ reviewed?: boolean;
149
+ prepared?: boolean;
150
+ lost?: boolean;
151
+ lostReason?: OpportunityLostReasonValues;
152
+ documents?: Document[];
153
+ branch?: string;
154
+ branchCountry?: string;
155
+ type?: OpportunityType;
156
+ lastActivityAt?: string | null; // null gives the possibility to delete this field if all activities are deleted
157
+ source?: string | null;
158
+ };
159
+
160
+ export type PaymentSummary = {
161
+ total: string;
162
+ paid: string;
163
+ entries: DataRecord<Payment>[];
164
+ };
165
+
166
+ export type OpportunityBFF = {
167
+ related: {
168
+ sameVehicleOpenOpportunities?: number;
169
+ };
170
+ opportunity: DataRecord<Opportunity, ReferenceData>;
171
+ vehicle?: DataRecord<Vehicle>;
172
+ bids: DataRecord<Bid>[];
173
+ quotes: DataRecord<LeasingQuote>[];
174
+ activeQuote?: DataRecord<LeasingQuote>;
175
+ payments: PaymentSummary | undefined;
176
+ customer?: {
177
+ contact: DataRecord<Contact>;
178
+ org?: DataRecord<Organization>;
179
+ };
180
+ };
181
+
182
+ export type OpportunityEvent = {
183
+ opportunity: Opportunity;
184
+ action: 'create' | 'update' | 'delete';
185
+ actionAt: string;
186
+ userId: string;
187
+ tenantId: string;
188
+ };
189
+
190
+ export type QuoteEvent = {
191
+ quote: LeasingQuote;
192
+ opportunity: Opportunity;
193
+ action: 'create' | 'update' | 'delete';
194
+ actionAt: string;
195
+ userId: string;
196
+ tenantId: string;
197
+ };
198
+
199
+ /* Quote summary with information that should be common to different types of quotes */
200
+ export type QuoteInfo = {
201
+ status: QuoteStatus;
202
+ roi: string;
203
+ id: string;
204
+ };
205
+
206
+ export type SearchOpportunity = {
207
+ contact?: Contact;
208
+ opportunity: Opportunity;
209
+ org?: Organization;
210
+ vehicle?: Vehicle;
211
+ quote?: QuoteInfo;
212
+ custom: {
213
+ unassigned: boolean;
214
+ assignees: string[];
215
+ };
216
+ };
217
+
218
+ export const QUOTE_CREATED_NOTIFICATION_ORIGIN = 'quote-created';
219
+ export const QUOTE_VALIDATOR_FEEDBACK_NOTIFICATION_ORIGIN = 'quote-validator-feedback';
220
+ export const QUOTE_CUSTOMER_FEEDBACK_NOTIFICATION_ORIGIN = 'quote-customer-feedback';
221
+ export const OPPORTUNITY_CLOSED_NOTIFICATION_ORIGIN = 'opportunity-closed';
222
+
223
+ export type OpportunityNotificationData = {
224
+ quoteVersion?: number;
225
+ };
226
+
227
+ export type LeasingQuoteTemplateData = {
228
+ opportunity: {
229
+ id: string;
230
+ };
231
+ currentDate: string;
232
+ vehicle: {
233
+ make: string;
234
+ model: string;
235
+ type?: string;
236
+ km: string | number;
237
+ vin: string;
238
+ mainImage: string;
239
+ localLicensePlate: boolean;
240
+ description: string;
241
+ year?: string | number;
242
+ };
243
+ accountManager: {
244
+ fullName: string;
245
+ email: string;
246
+ phone: string;
247
+ };
248
+ customer: {
249
+ company: string;
250
+ fullName: string;
251
+ vatNumber?: string;
252
+ address?: string;
253
+ };
254
+ settingId: string;
255
+ leasing: {
256
+ deposit: string;
257
+ startupFee: string;
258
+ totalExtras: string;
259
+ totalBeforeDeliveryExclVat: string;
260
+ totalBeforeDelivery: string;
261
+ installment: string;
262
+ duration: number;
263
+ monthlyInsurance: string;
264
+ monthlyTax: string;
265
+ monthlyTaxesInsurance: string;
266
+ residual: string;
267
+ offerNumber: string;
268
+ extras: { name: string }[];
269
+ };
270
+ };
271
+
272
+ export type LeasingProformaTemplateData = {
273
+ opportunity: {
274
+ id: string;
275
+ offerNumber: string;
276
+ };
277
+ currentDate: string;
278
+ accountManager: {
279
+ fullName: string;
280
+ email: string;
281
+ phone: string;
282
+ };
283
+ vehicle: {
284
+ line1: string;
285
+ line2: string;
286
+ stockNumber: string;
287
+ };
288
+ c: {
289
+ organizationId?: string;
290
+ clientNumber: number;
291
+ company: string;
292
+ fullName: string;
293
+ vatNumber?: string;
294
+ email?: string;
295
+ phone?: string;
296
+ address?: string;
297
+ };
298
+ i: {
299
+ description: string;
300
+ vat: string;
301
+ quantity: number;
302
+ unitPriceExclVat: string;
303
+ amount: string;
304
+ amountExclVat: string;
305
+ }[];
306
+ t: {
307
+ totalExclVat: string;
308
+ vatAmount: string;
309
+ displayVatMessage: boolean;
310
+ total: string;
311
+ monthly: string;
312
+ monthlyExclVat: string;
313
+ residual: string;
314
+ residualExclVat: string;
315
+ duration: number;
316
+ };
317
+ };
318
+
319
+ export type OpportunitiesKanbanColumn = {
320
+ status: string;
321
+ results: SearchOpportunity[];
322
+ totalCount: number;
323
+ totalValue: string;
324
+ };
325
+
326
+ export type HpLeasingDealRequest = {
327
+ tenantId: string;
328
+ initiatedBy: 'bisondesk';
329
+ processMetaId: string;
330
+ processRunData: {
331
+ entityOwner: string;
332
+ leasingContractOwner: string;
333
+ foreseenDeliveryDate?: string;
334
+ deliveryAddressLeasing?: string;
335
+ nameSalesPerson: string;
336
+ durationLeasingInMonths: number;
337
+ vanCourier: boolean;
338
+ newVehicle?: boolean;
339
+ newTrailer?: boolean;
340
+ registrationOnTtcoBe?: string;
341
+ yearOfConstruction?: number;
342
+ chassisnumber?: string;
343
+ vehicleModel?: string;
344
+ vehicleCategory2?: string;
345
+ licencePlate?: string;
346
+ vatPercentage?: number;
347
+
348
+ opportunityContractId: string;
349
+ opportunityId: string;
350
+
351
+ company?: string;
352
+ customerNumber?: number; //bisondesk external id
353
+ //MrLease fields
354
+ vehicle?: string;
355
+ salesPriceEur: string;
356
+ depositFullAmountExclVat: string;
357
+ depositToBePrepaidExclVat: string;
358
+ vehicleMake3?: string;
359
+
360
+ //TTC fields
361
+ vehicleOriginalReference?: string;
362
+ salesPrice: string;
363
+ depositFullAmount: string;
364
+ depositAmountToBePrepaid: string;
365
+ make?: string;
366
+
367
+ //Extras
368
+ garageExtrasCodes: string[];
369
+ allExtrasDescriptions: string[];
370
+ administrationExtrasCodes: string[];
371
+ logisticExtrasCodes: string[];
372
+ customRequestDescriptions: string[];
373
+ };
374
+ };
375
+
376
+ export type HpLeasingDealResponse = {
377
+ entityId: string;
378
+ id: string;
379
+ status: string;
380
+ leasingContractNumber?: string;
381
+ };
382
+
383
+ export type HpLeasingContractRequest = {
384
+ tenantId: string;
385
+ initiatedBy: 'bisondesk';
386
+ processMetaId: string;
387
+ processRunData: {
388
+ entityOwner: string;
389
+ company?: string;
390
+ vehicle?: string;
391
+ ldNumber: number;
392
+ vanCourier: boolean;
393
+ startDate: number;
394
+ opportunityContractId: string;
395
+ data: {
396
+ leasingParameter: {
397
+ allRisksPercentage: number;
398
+ allRisksTaxPercentage: number;
399
+ civilLiability: number;
400
+ entityId: string;
401
+ oneTimeRoadTax: number;
402
+ specialInsurance: number;
403
+ yearlyRoadTax: number;
404
+ countries: string[];
405
+ vehicleCategory: string;
406
+ };
407
+
408
+ calculatorRequest: {
409
+ bankDeposit: number;
410
+ bankDurationInMonths: number;
411
+ bankInterestRatePercentage: number;
412
+ bankResidualValue: number;
413
+ deposit: number;
414
+ durationInMonths: number;
415
+ includesAllRisks: boolean;
416
+ includesCivilLiability: boolean;
417
+ includesOneTimeRoadTax: boolean;
418
+ includesSpecialInsurance: boolean;
419
+ includesYearlyRoadTax: boolean;
420
+ insuranceAmount: number;
421
+ interestRatePercentage: number;
422
+ marginPercentage: number;
423
+ monthlyAdministrationFee: 0;
424
+ purchasePrice: number;
425
+ residualValue: number;
426
+ salesPrice: number;
427
+ startupFeePercentage: number;
428
+ };
429
+
430
+ calculatorResponse: {
431
+ ROI: number;
432
+ ROIDifference: number;
433
+ ROIPerYear: number;
434
+ ROITarget: number;
435
+ allRisksInsuranceAmount: number;
436
+ bankContractValue: number;
437
+ bankLeasingAmount: number;
438
+ cashDeficit: number;
439
+ financingAmount: number;
440
+ leasingAmount: number;
441
+ leasingContractValue: number;
442
+ leasingProfit: number;
443
+ monthlyTaxRetailPrice: number;
444
+ oneTimeTaxCost: number;
445
+ totalMonthlyPayment: number;
446
+ totalProfit: number;
447
+ vehicleProfit: number;
448
+ };
449
+
450
+ cashInValues: CashInRow[];
451
+
452
+ cashOutValues: CashOutRow[];
453
+ };
454
+ };
455
+ };
456
+
457
+ export type HpLeasingContractResponse = {
458
+ entityId: string;
459
+ id: string;
460
+ status: string;
461
+ createdAt: string;
462
+ updatedAt: string;
463
+ dateOfFinalSettlement: string;
464
+ startDate: string;
465
+ email: string;
466
+ contractNumber: string;
467
+ };
468
+
469
+ export type CashInRow = {
470
+ time: number;
471
+ deposit: number;
472
+ monthlyAdministrationFee: 0; //Legacy field - Should always be 0
473
+ residualValue: number;
474
+ startupFee: number;
475
+ leasingAmountWithoutAdminFee: number;
476
+ insurancePayment: number;
477
+ taxPayment: number;
478
+ cashIn: number;
479
+ cumulativeCash: number;
480
+ };
481
+
482
+ export type CashOutRow = {
483
+ time: number;
484
+ deposit: number;
485
+ residualValue: number;
486
+ leasingAmount: number;
487
+ insurancePayment: number;
488
+ taxPayment: number;
489
+ cashOut: number;
490
+ cumulativeCash: number;
491
+ };
492
+
493
+ export type SwitchOpportunityVehicleRequest = {
494
+ opportunityId: string;
495
+ newVehicleId: string;
496
+ };
@@ -0,0 +1,40 @@
1
+ export enum PaymentActions {
2
+ DELETE = 'delete',
3
+ EDIT = 'edit',
4
+ }
5
+
6
+ type BasePayment = {
7
+ opportunityId: string;
8
+ amount: string;
9
+ description?: string;
10
+ vehicleId: string;
11
+ organizationId: string;
12
+ };
13
+
14
+ export type NewPayment = BasePayment & {
15
+ id?: undefined;
16
+ createdAt?: undefined;
17
+ createdBy?: undefined;
18
+ modifiedAt?: undefined;
19
+ modifiedBy?: undefined;
20
+ deletedAt?: undefined;
21
+ deletedBy?: undefined;
22
+ paidAt: string;
23
+ };
24
+
25
+ export type Payment = BasePayment & {
26
+ id: string;
27
+ createdAt: string;
28
+ createdBy: string;
29
+ modifiedAt: string;
30
+ modifiedBy: string;
31
+ deletedAt?: string;
32
+ deletedBy?: string;
33
+ paidAt?: string;
34
+ };
35
+
36
+ export type PaymentUpdate = {
37
+ description?: string;
38
+ amount?: string;
39
+ paidAt?: string;
40
+ };
@@ -1,36 +1,47 @@
1
1
  import { MultiLangValue } from '@bisondesk/commons-sdk/lib/types';
2
- ////////////////////////////////////////////////////////////////////
3
- // Picklist
4
- ////////////////////////////////////////////////////////////////////
5
2
 
6
3
  export type PicklistValueUpdateRequest = {
7
4
  picklistId: string;
8
5
  value: PicklistValue | NewPicklistValue;
9
6
  };
10
- export type NewPicklistValue = {
7
+
8
+ export type NewPicklistValue<T = Record<string, string>> = {
11
9
  color?: string;
12
10
  sortPriority?: number;
13
11
  titles: MultiLangValue;
14
12
  dependency?: PicklistValueDependency;
13
+ meta?: T;
15
14
  };
16
- export type PicklistValue = NewPicklistValue & {
15
+
16
+ export type PicklistValue<T = any> = NewPicklistValue<T> & {
17
17
  id: string;
18
18
  system?: boolean;
19
19
  };
20
+
20
21
  export type PicklistValueListRequest = {
21
22
  picklistId: string;
22
23
  limit: number;
23
24
  offset: number;
25
+ dependencies?: PicklistValueDependency[];
24
26
  };
27
+
25
28
  export type PicklistValueRequest = {
26
29
  picklistId: string;
27
30
  valueId: string;
28
31
  };
29
- export type AdHocPicklistValues = {
32
+
33
+ export type AdHocPicklistValues<T = any> = {
30
34
  [picklistId: string]: {
31
- [valueId: string]: PicklistValue;
35
+ [valueId: string]: PicklistValue<T>;
32
36
  };
33
37
  };
38
+
39
+ export type AdHocPicklistRequest = {
40
+ requests: PicklistValueRequest[];
41
+ preferredLang: string;
42
+ tenantLang: string;
43
+ };
44
+
34
45
  export type AdHocPicklistValueDisplay = {
35
46
  [picklistId: string]: {
36
47
  [valueId: string]: {
@@ -39,26 +50,32 @@ export type AdHocPicklistValueDisplay = {
39
50
  };
40
51
  };
41
52
  };
53
+
42
54
  export type PicklistOptionsRequest = {
43
55
  picklistId: string;
44
56
  dependencies?: PicklistValueDependency[];
45
57
  lang: string;
46
58
  };
59
+
47
60
  export type QuickAddPicklistValue = {
48
61
  sortPriority?: number;
49
62
  titles: MultiLangValue;
50
63
  };
64
+
51
65
  export type NewPicklist = {
66
+ id?: undefined;
52
67
  titles: MultiLangValue;
53
68
  values: QuickAddPicklistValue[];
54
69
  customSort?: boolean;
55
70
  };
71
+
56
72
  export type BasePicklist = {
57
73
  customSort?: boolean;
58
74
  id: string;
59
75
  system?: boolean;
60
76
  titles: MultiLangValue;
61
77
  };
78
+
62
79
  export type PicklistInfo = BasePicklist & {
63
80
  count: number;
64
81
  modifiedAt: string;
@@ -67,3 +84,5 @@ export type PicklistValueDependency = {
67
84
  picklistId: string;
68
85
  values: string[];
69
86
  };
87
+
88
+ export type PicklistCollection = (BasePicklist & { data: PicklistValue[] })[];