@bisondesk/core-sdk 1.0.492 → 1.0.494

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 (139) hide show
  1. package/lib/apis/leasing.js +2 -2
  2. package/lib/apis/leasing.js.map +1 -1
  3. package/lib/constants.d.ts +2 -0
  4. package/lib/constants.d.ts.map +1 -1
  5. package/lib/constants.js +2 -0
  6. package/lib/constants.js.map +1 -1
  7. package/lib/types/activities.d.ts +15 -5
  8. package/lib/types/activities.d.ts.map +1 -1
  9. package/lib/types/activities.js +1 -0
  10. package/lib/types/activities.js.map +1 -1
  11. package/lib/types/crm.d.ts +1 -0
  12. package/lib/types/crm.d.ts.map +1 -1
  13. package/lib/types/crm.js +1 -0
  14. package/lib/types/crm.js.map +1 -1
  15. package/lib/types/internal-events.d.ts +3 -1
  16. package/lib/types/internal-events.d.ts.map +1 -1
  17. package/lib/types/internal-events.js +2 -0
  18. package/lib/types/internal-events.js.map +1 -1
  19. package/lib/types/journeys.d.ts +6 -0
  20. package/lib/types/journeys.d.ts.map +1 -1
  21. package/lib/types/journeys.js.map +1 -1
  22. package/lib/types/leasing-debtors.d.ts +202 -0
  23. package/lib/types/leasing-debtors.d.ts.map +1 -1
  24. package/lib/types/leasing-debtors.js +58 -1
  25. package/lib/types/leasing-debtors.js.map +1 -1
  26. package/lib/types/leasing-search.d.ts +1 -0
  27. package/lib/types/leasing-search.d.ts.map +1 -1
  28. package/lib/types/leasing-search.js.map +1 -1
  29. package/lib/types/leasing.d.ts +3 -23
  30. package/lib/types/leasing.d.ts.map +1 -1
  31. package/lib/types/leasing.js.map +1 -1
  32. package/lib/types/marketing.d.ts +0 -1
  33. package/lib/types/marketing.d.ts.map +1 -1
  34. package/lib/types/marketing.js +0 -1
  35. package/lib/types/marketing.js.map +1 -1
  36. package/lib/types/tenants.d.ts +1 -0
  37. package/lib/types/tenants.d.ts.map +1 -1
  38. package/lib/types/tenants.js.map +1 -1
  39. package/lib/types/vehicle-performance.d.ts +0 -2
  40. package/lib/types/vehicle-performance.d.ts.map +1 -1
  41. package/lib/types/vehicle-performance.js.map +1 -1
  42. package/lib/types/vehicles.d.ts +1 -0
  43. package/lib/types/vehicles.d.ts.map +1 -1
  44. package/lib/types/vehicles.js.map +1 -1
  45. package/lib/utils/debtors-dossiers.d.ts +15 -0
  46. package/lib/utils/debtors-dossiers.d.ts.map +1 -0
  47. package/lib/utils/debtors-dossiers.js +51 -0
  48. package/lib/utils/debtors-dossiers.js.map +1 -0
  49. package/lib/utils/search.d.ts +3 -2
  50. package/lib/utils/search.d.ts.map +1 -1
  51. package/lib/utils/search.js.map +1 -1
  52. package/lib/utils/vehicles.d.ts.map +1 -1
  53. package/lib/utils/vehicles.js +4 -0
  54. package/lib/utils/vehicles.js.map +1 -1
  55. package/package.json +1 -1
  56. package/src/apis/leasing.ts +2 -2
  57. package/src/constants.ts +2 -0
  58. package/src/types/activities.ts +49 -4
  59. package/src/types/crm.ts +1 -0
  60. package/src/types/internal-events.ts +2 -0
  61. package/src/types/journeys.ts +7 -0
  62. package/src/types/leasing-debtors.ts +309 -0
  63. package/src/types/leasing-search.ts +1 -0
  64. package/src/types/leasing.ts +2 -21
  65. package/src/types/marketing.ts +1 -1
  66. package/src/types/tenants.ts +2 -0
  67. package/src/types/vehicle-performance.ts +0 -2
  68. package/src/types/vehicles.ts +1 -0
  69. package/src/utils/debtors-dossiers.ts +73 -0
  70. package/src/utils/search.ts +9 -2
  71. package/src/utils/vehicles.ts +4 -0
  72. package/tsconfig.tsbuildinfo +1 -1
  73. package/src/types/activities.js +0 -13
  74. package/src/types/activities.js.map +0 -1
  75. package/src/types/comparables.js +0 -2
  76. package/src/types/comparables.js.map +0 -1
  77. package/src/types/crm.js +0 -58
  78. package/src/types/crm.js.map +0 -1
  79. package/src/types/dashboard.js +0 -2
  80. package/src/types/dashboard.js.map +0 -1
  81. package/src/types/definitions.js +0 -2
  82. package/src/types/definitions.js.map +0 -1
  83. package/src/types/fields.js +0 -2
  84. package/src/types/fields.js.map +0 -1
  85. package/src/types/insights.js +0 -2
  86. package/src/types/insights.js.map +0 -1
  87. package/src/types/interests.js +0 -6
  88. package/src/types/interests.js.map +0 -1
  89. package/src/types/internal-events.js +0 -18
  90. package/src/types/internal-events.js.map +0 -1
  91. package/src/types/internet-opportunities.js +0 -2
  92. package/src/types/internet-opportunities.js.map +0 -1
  93. package/src/types/internet-vehicles.js +0 -2
  94. package/src/types/internet-vehicles.js.map +0 -1
  95. package/src/types/leasing-administration.js +0 -2
  96. package/src/types/leasing-administration.js.map +0 -1
  97. package/src/types/leasing-debtors.js +0 -2
  98. package/src/types/leasing-debtors.js.map +0 -1
  99. package/src/types/leasing-search.js +0 -2
  100. package/src/types/leasing-search.js.map +0 -1
  101. package/src/types/leasing-settings.js +0 -7
  102. package/src/types/leasing.js +0 -38
  103. package/src/types/leasing.js.map +0 -1
  104. package/src/types/marketing.js +0 -35
  105. package/src/types/marketing.js.map +0 -1
  106. package/src/types/offers.js +0 -56
  107. package/src/types/opportunities.js +0 -107
  108. package/src/types/opportunities.js.map +0 -1
  109. package/src/types/payments.js +0 -7
  110. package/src/types/picklists.js +0 -2
  111. package/src/types/picklists.js.map +0 -1
  112. package/src/types/quotes.js +0 -42
  113. package/src/types/recently-viewed.js +0 -2
  114. package/src/types/recently-viewed.js.map +0 -1
  115. package/src/types/reservations.js +0 -5
  116. package/src/types/reservations.js.map +0 -1
  117. package/src/types/roi-ratings.js +0 -5
  118. package/src/types/roi-ratings.js.map +0 -1
  119. package/src/types/saved-filters.js +0 -9
  120. package/src/types/saved-filters.js.map +0 -1
  121. package/src/types/search.js +0 -2
  122. package/src/types/search.js.map +0 -1
  123. package/src/types/settings.js +0 -2
  124. package/src/types/settings.js.map +0 -1
  125. package/src/types/templates.js +0 -2
  126. package/src/types/templates.js.map +0 -1
  127. package/src/types/tenants.js +0 -20
  128. package/src/types/user-performance.js +0 -7
  129. package/src/types/user-performance.js.map +0 -1
  130. package/src/types/utils.js +0 -2
  131. package/src/types/validation.js +0 -2
  132. package/src/types/validation.js.map +0 -1
  133. package/src/types/vehicle-sales.js +0 -6
  134. package/src/types/vehicle-sales.js.map +0 -1
  135. package/src/types/vehicles.js +0 -98
  136. package/src/types/vehicles.js.map +0 -1
  137. package/src/utils/leasing.js +0 -6
  138. package/src/utils/leasing.js.map +0 -1
  139. package/src/utils/opportunities.js +0 -48
@@ -6,6 +6,7 @@ export enum ActivityType {
6
6
  MEETING = 'meeting',
7
7
  EMAIL = 'email',
8
8
  CHAT = 'chat',
9
+ SMS = 'sms',
9
10
  }
10
11
 
11
12
  export enum ActivityActions {
@@ -13,15 +14,16 @@ export enum ActivityActions {
13
14
  EDIT = 'edit',
14
15
  }
15
16
 
16
- type BaseActivity = {
17
+ export interface BaseActivity<Meta = ActivityV2Meta> {
17
18
  type: ActivityType;
18
19
  businessEntityId: BusinessEntityIds;
19
20
  recordId: string;
20
21
  description?: string;
21
22
  readonly?: boolean;
22
- };
23
+ meta?: Meta;
24
+ }
23
25
 
24
- export type NewActivity = BaseActivity & {
26
+ export type NewActivity<Meta = ActivityV2Meta> = BaseActivity<Meta> & {
25
27
  id?: undefined;
26
28
  createdAt?: undefined;
27
29
  createdBy?: undefined;
@@ -30,7 +32,7 @@ export type NewActivity = BaseActivity & {
30
32
  activityAt?: string;
31
33
  };
32
34
 
33
- export type Activity = BaseActivity & {
35
+ export type Activity<Meta = ActivityV2Meta> = BaseActivity<Meta> & {
34
36
  id: string;
35
37
  createdAt: string;
36
38
  createdBy: string;
@@ -73,3 +75,46 @@ export type ActivityDeleteEvent = BaseActivityEvent & {
73
75
  data: undefined;
74
76
  previousData: Activity;
75
77
  };
78
+
79
+ /************
80
+ * ActivityV2Meta Types
81
+ * These types are used to define the structure of the metadata for different activity types.
82
+ ************/
83
+
84
+ export type ActivityV2Meta =
85
+ | EmailDebtorsDossierActivityPayload
86
+ | CallDebtorsDossierActivityPayload
87
+ | MeetingDebtorsDossierActivityPayload
88
+ | ChatDebtorsDossierActivityPayload;
89
+
90
+ export type EmailDebtorsDossierActivityPayload = {
91
+ /* from: { email: string; name?: string; external?: boolean };
92
+ to: { email: string; name?: string }[];
93
+ cc?: { email: string; name?: string }[];
94
+ bcc?: { email: string; name?: string }[];
95
+ subject?: string;
96
+ attachments?: AttachmentValue[]; */
97
+ };
98
+
99
+ export type CallDebtorsDossierActivityPayload = {
100
+ /* from: { phone: string; name?: string; external?: boolean };
101
+ to: string;
102
+ duration?: number;
103
+ recordingUrl?: string;
104
+ transcription?: string; */
105
+ };
106
+
107
+ export type MeetingDebtorsDossierActivityPayload = {
108
+ /* organizer: string;
109
+ participants: string[];
110
+ location?: string;
111
+ startTime: string;
112
+ endTime: string; */
113
+ };
114
+
115
+ export type ChatDebtorsDossierActivityPayload = {
116
+ /* from: { phone: string; name?: string; external?: boolean };
117
+ to: string[]; */
118
+ message: string;
119
+ platform: 'whatsapp' | 'sms';
120
+ };
package/src/types/crm.ts CHANGED
@@ -12,6 +12,7 @@ export enum OrganizatioRiskTags {
12
12
  BAD_FINANCIAL_INFO = 'BAD_FINANCIAL_INFO',
13
13
  VAT_NUMBER_INVALID = 'VAT_NUMBER_INVALID',
14
14
  INSTINCT = 'INSTINCT',
15
+ INVALID_ADDRESS = 'INVALID_ADDRESS',
15
16
  NEW_CUSTOMER = 'NEW_CUSTOMER',
16
17
  BANK_ACCOUNT_BLOCKED = 'BANK_ACCOUNT_BLOCKED',
17
18
  NO_GPS = 'NO_GPS',
@@ -11,6 +11,8 @@ export enum EventTypes {
11
11
  PRICE_CHANGE = 'price-changes',
12
12
  ACTIVITY = 'activities',
13
13
  EXTERNAL_VEHICLE_SALE = 'external-vehicle-sales',
14
+ AMORTIZATION_DOC = 'amortization-docs',
15
+ DEBTOR_DOSSIER = 'debtor-dossiers',
14
16
  }
15
17
 
16
18
  export enum InternalNotificationChannels {
@@ -12,6 +12,7 @@ export type JourneyTaskConfig<T> = {
12
12
  priority?: TaskPriority;
13
13
  tag?: string;
14
14
  description?: MultiLangValue;
15
+ dueDateInDays?: number; //now + dueDateInDays days
15
16
  completionCriteria: RulesLogic<AdditionalOperation>;
16
17
  prerequisiteTaskIds: string[];
17
18
  requiredAtStatus?: T; //Required at a given status or higher
@@ -26,3 +27,9 @@ export type JourneyConfig<T> = {
26
27
  createdBy: string;
27
28
  disabled: boolean;
28
29
  };
30
+
31
+ export type JourneyConfigCustomTasks<T> = Pick<JourneyConfig<T>, 'businessEntityId' | 'tasks'> & {
32
+ recordId: string;
33
+ createdAt: string;
34
+ createdBy: string;
35
+ };
@@ -1,4 +1,9 @@
1
+ import { EmailMessage } from '@bisondesk/commons-sdk/messages';
2
+ import { NextList, PaginatedList } from '@bisondesk/commons-sdk/types';
1
3
  import { Contact, Organization } from './crm.js';
4
+ import { LeasingContract } from './leasing.js';
5
+ import { BaseSearchRequest, SortFilter } from './search.js';
6
+ import { DataRecord, ReferenceData } from './utils.js';
2
7
 
3
8
  export type MonthData = {
4
9
  activeContractIds: string[];
@@ -33,3 +38,307 @@ export type SearchDebtorInfo = {
33
38
  hasActiveContracts: boolean;
34
39
  };
35
40
  };
41
+
42
+ export enum DebtorsDossierStatus {
43
+ AUTO_REMINDER = 'auto_reminder',
44
+ OVERDUE = 'overdue',
45
+ CONTACT_ATTEMPTED = 'contact_attempted',
46
+ DIALOGUE = 'dialogue',
47
+ PROMISE_TO_PAY = 'promise_to_pay',
48
+ FAILURE = 'failure',
49
+ RESOLVED = 'resolved',
50
+ }
51
+
52
+ export const debtorsDossierStatusToDateFieldMap: Record<
53
+ DebtorsDossierStatus,
54
+ { date: keyof DossierStatusLogFields; author: keyof DossierStatusLogFields } | null
55
+ > = {
56
+ [DebtorsDossierStatus.AUTO_REMINDER]: null,
57
+ [DebtorsDossierStatus.OVERDUE]: { date: 'overdueAt', author: 'overdueBy' },
58
+ [DebtorsDossierStatus.CONTACT_ATTEMPTED]: { date: 'contactedAt', author: 'contactedBy' },
59
+ [DebtorsDossierStatus.DIALOGUE]: { date: 'dialogueAt', author: 'dialogueBy' },
60
+ [DebtorsDossierStatus.PROMISE_TO_PAY]: { date: 'promiseToPayAt', author: 'promiseToPayBy' },
61
+ [DebtorsDossierStatus.FAILURE]: { date: 'failedAt', author: 'failedBy' },
62
+ [DebtorsDossierStatus.RESOLVED]: { date: 'resolvedAt', author: 'resolvedBy' },
63
+ };
64
+
65
+ /******
66
+ * Auto Follow-Up Types
67
+ ******/
68
+
69
+ export type DebtorAutoFollowUp = {
70
+ id: string;
71
+ organizationId: string;
72
+ organizationName: string;
73
+ status: 'ONGOING' | 'ERROR' | 'SUCCESS' | 'EXPIRED' | 'DISCARDED';
74
+ emails: EmailMessage[];
75
+ createdAt: string;
76
+ modifiedAt: string;
77
+ completedAt?: string;
78
+ nextActionAt: string;
79
+ riskLevel: number;
80
+ };
81
+
82
+ export type ListOverdueRemindersResponse = PaginatedList<DebtorAutoFollowUp, ReferenceData>;
83
+ export type ListOverdueRemindersRequest = {
84
+ offset: number;
85
+ limit: number;
86
+ sortBy: SortFilter;
87
+ };
88
+
89
+ /******
90
+ * Debtor Dossier Types
91
+ ******/
92
+
93
+ export enum DebtorsDossierActions {
94
+ SET_METADATA = 'set_metadata',
95
+ ADD_ACTIVITY = 'add_activity',
96
+ FINISH = 'finish',
97
+ SET_DOCUMENTS = 'set_documents',
98
+ SET_PAYMENT_PLAN = 'set_payment_plan',
99
+ SET_LEGAL_DOSSIER = 'set_legal_dossier',
100
+ }
101
+
102
+ export type DossierStatusLogFields = {
103
+ failedAt?: string;
104
+ failedBy?: string;
105
+ resolvedAt?: string;
106
+ contactedAt?: string;
107
+ contactedBy?: string;
108
+ overdueAt?: string;
109
+ overdueBy?: string;
110
+ resolvedBy?: string;
111
+ dialogueAt?: string;
112
+ dialogueBy?: string;
113
+ promiseToPayAt?: string;
114
+ promiseToPayBy?: string;
115
+ };
116
+
117
+ export type BaseDebtorsDossier = {
118
+ organizationId: string;
119
+ contactId?: string;
120
+ tags: string[];
121
+ origin: 'manual' | 'auto';
122
+ autoFollowUpId?: string;
123
+ administrativeUserId?: string;
124
+ branchId: string;
125
+ tenantId: string;
126
+ };
127
+ export type DebtorsDossierStatusAudit = {
128
+ from: DebtorsDossierStatus;
129
+ to: DebtorsDossierStatus;
130
+ changedAt: string;
131
+ changedBy: string;
132
+ };
133
+
134
+ export type DebtorsDossier = BaseDebtorsDossier &
135
+ DossierStatusLogFields & {
136
+ id: string;
137
+ createdAt: string;
138
+ createdBy: string;
139
+ updatedAt: string;
140
+ updatedBy: string;
141
+ status: DebtorsDossierStatus;
142
+ statusAudit: DebtorsDossierStatusAudit[];
143
+ };
144
+
145
+ export type NewDebtorsDossier = BaseDebtorsDossier & {
146
+ id?: undefined;
147
+ createdBy?: undefined;
148
+ createdAt?: undefined;
149
+ updatedBy?: undefined;
150
+ updatedAt?: undefined;
151
+ };
152
+
153
+ export type DebtorsDossierBff = {
154
+ dossier: DataRecord<DebtorsDossier>;
155
+ organization?: Organization;
156
+ contact?: Contact;
157
+ leasingContracts: LeasingContract[];
158
+ debt?: DebtorInfo;
159
+ paymentPlan?: DebtorsPaymentPlan;
160
+ legalDossier?: LegalDossier;
161
+ trackAndTraceDevices: {
162
+ /* odometer: TrackAndTraceOdometerData;
163
+ device: TrackAndTraceDevice; */
164
+ }[];
165
+ };
166
+
167
+ export type UpdateDebtorsDossier = Partial<
168
+ Pick<
169
+ DebtorsDossier,
170
+ 'status' | 'tags' | 'contactId' | 'administrativeUserId' | 'branchId' | 'organizationId'
171
+ >
172
+ > & {
173
+ overdue?: boolean;
174
+ resolve?: boolean;
175
+ terminate?: boolean;
176
+ };
177
+
178
+ /******
179
+ * Payment Plan Types
180
+ ******/
181
+
182
+ export type DebtorsPaymentPlan = {
183
+ id: string;
184
+ debtorDossierId: string;
185
+
186
+ notes?: string;
187
+
188
+ reminders?: {
189
+ frequency: {
190
+ every: number;
191
+ period: 'days' | 'weeks' | 'months';
192
+ };
193
+ endCondition:
194
+ | {
195
+ endDate: string; // ISO date string
196
+ }
197
+ | {
198
+ occurrences: number; // Number of reminders to send
199
+ };
200
+ };
201
+
202
+ createdAt: string;
203
+ createdBy: string;
204
+ updatedAt: string;
205
+ updatedBy: string;
206
+ };
207
+
208
+ export type NewPaymentPlan = Omit<
209
+ DebtorsPaymentPlan,
210
+ 'id' | 'createdAt' | 'updatedAt' | 'createdBy' | 'updatedBy'
211
+ >;
212
+
213
+ export type UpdatePaymentPlan = Partial<Pick<DebtorsPaymentPlan, 'notes' | 'reminders'>>;
214
+
215
+ /******
216
+ * Legal Dossier Types
217
+ ******/
218
+
219
+ export enum LegalDossierStatus {
220
+ ASSESSMENT = 'assessment',
221
+ PRE_LEGAL_NOTICE = 'pre_legal_notice',
222
+ SENT_TO_LAWYER = 'sent_to_lawyer',
223
+ FILED = 'filed',
224
+ IN_COURT = 'in_court',
225
+ JUDGMENT = 'judgment',
226
+ ENFORCEMENT = 'enforcement',
227
+ SETTLEMENT = 'settlement',
228
+ CLOSED_RECOVERED = 'closed_recovered',
229
+ CLOSED_UNRECOVERABLE = 'closed_unrecoverable',
230
+ ON_HOLD = 'on_hold',
231
+ }
232
+
233
+ export type LegalDossier = {
234
+ id: string;
235
+ debtorDossierId: string;
236
+ caseNumber?: string;
237
+ notes?: string;
238
+ createdAt: string;
239
+ createdBy: string;
240
+ updatedAt: string;
241
+ updatedBy: string;
242
+ status: LegalDossierStatus;
243
+ };
244
+
245
+ export type NewLegalDossier = Omit<
246
+ LegalDossier,
247
+ 'id' | 'createdAt' | 'updatedAt' | 'createdBy' | 'updatedBy'
248
+ >;
249
+
250
+ export type UpdateLegalDossier = Partial<Pick<LegalDossier, 'caseNumber' | 'status' | 'notes'>>;
251
+
252
+ /******
253
+ * Debtor Dossier Events
254
+ ******/
255
+
256
+ export type DebtorsDossierCreateEvent = {
257
+ action: 'created';
258
+ data: DebtorsDossier;
259
+ previousData?: undefined;
260
+ tenantId: string;
261
+ userId: string;
262
+ };
263
+
264
+ export type DebtorsDossierUpdateEvent = {
265
+ action: 'updated';
266
+ data: DebtorsDossier;
267
+ previousData: DebtorsDossier;
268
+ tenantId: string;
269
+ userId: string;
270
+ };
271
+
272
+ export type DebtorsDossierDeleteEvent = {
273
+ action: 'deleted';
274
+ data?: undefined;
275
+ previousData: DebtorsDossier;
276
+ tenantId: string;
277
+ userId: string;
278
+ };
279
+
280
+ export type DebtorsDossierEvent =
281
+ | DebtorsDossierCreateEvent
282
+ | DebtorsDossierUpdateEvent
283
+ | DebtorsDossierDeleteEvent;
284
+
285
+ /************
286
+ *
287
+ * Search
288
+ */
289
+
290
+ export type SearchDebtorsDossier = {
291
+ contact?: Contact;
292
+ debtorsDossier: DebtorsDossier;
293
+ org?: Organization;
294
+ legalDossier?: LegalDossier;
295
+ paymentPlan?: DebtorsPaymentPlan;
296
+ };
297
+
298
+ /************
299
+ *
300
+ * Kanban
301
+ */
302
+
303
+ export type DebtorsDossierKanbanColumn = {
304
+ status: string;
305
+ results: SearchDebtorsDossier[];
306
+ totalCount: number;
307
+ totalValue: string;
308
+ };
309
+
310
+ export type MSearchDebtorsDossierKanbanColumn = {
311
+ column: DebtorsDossierKanbanColumn;
312
+ nextToken?: string;
313
+ };
314
+
315
+ export type KanbanDebtorsDossierSearchRequest = BaseSearchRequest & {
316
+ nextTokens?: Record<string, string | undefined>;
317
+ };
318
+
319
+ export type KanbanDebtorsDossierNextList = Omit<
320
+ NextList<DebtorsDossierKanbanColumn, ReferenceData>,
321
+ 'nextToken'
322
+ > & {
323
+ nextTokens?: Record<string, string | undefined>;
324
+ };
325
+
326
+ export const DebtorsDossierStatusOrder: DebtorsDossierStatus[] = [
327
+ DebtorsDossierStatus.AUTO_REMINDER,
328
+ DebtorsDossierStatus.OVERDUE,
329
+ DebtorsDossierStatus.CONTACT_ATTEMPTED,
330
+ DebtorsDossierStatus.DIALOGUE,
331
+ DebtorsDossierStatus.PROMISE_TO_PAY,
332
+ ];
333
+
334
+ export const DebtorsDossierWonColumnId = DebtorsDossierStatus.RESOLVED;
335
+
336
+ export const DebtorsDossierKanbanEndColumns: string[] = [
337
+ DebtorsDossierStatus.RESOLVED,
338
+ DebtorsDossierStatus.FAILURE,
339
+ ];
340
+
341
+ export const DebtorsDossierKanbanColumns = [
342
+ ...DebtorsDossierStatusOrder,
343
+ ...DebtorsDossierKanbanEndColumns,
344
+ ];
@@ -22,6 +22,7 @@ export type SearchLeasingContract = {
22
22
  insurance?: InsuranceEntry;
23
23
  externalTracking?: boolean;
24
24
  accountManager?: string;
25
+ lastIssuedInvoiceDate?: string;
25
26
  };
26
27
  };
27
28
 
@@ -1,5 +1,6 @@
1
1
  import { EmailMessage } from '@bisondesk/commons-sdk/messages';
2
2
  import { AttachmentValue, Document, LinkValue, PaginatedList } from '@bisondesk/commons-sdk/types';
3
+ import { BaseEvent } from './internal-events.js';
3
4
  import { SortFilter } from './search.js';
4
5
  import { ReferenceData } from './utils.js';
5
6
 
@@ -41,19 +42,6 @@ export type LeasingConditionEvent = {
41
42
  tenantId: string;
42
43
  };
43
44
 
44
- export type OverdueDossier = {
45
- id: string;
46
- organizationId: string;
47
- organizationName: string;
48
- status: 'ONGOING' | 'ERROR' | 'SUCCESS' | 'EXPIRED' | 'DISCARDED';
49
- emails: EmailMessage[];
50
- createdAt: string;
51
- modifiedAt: string;
52
- completedAt?: string;
53
- nextActionAt: string;
54
- riskLevel: number;
55
- };
56
-
57
45
  export type LeasingContractClient = {
58
46
  organizationId: string;
59
47
  contactIds: string[];
@@ -192,13 +180,6 @@ export type OpportunityRef = BaseRef & {
192
180
  //Since VAT is client specific and contracts can be transferred between clients, we always handle values without VAT
193
181
  };
194
182
 
195
- export type ListOverdueRemindersResponse = PaginatedList<OverdueDossier, ReferenceData>;
196
- export type ListOverdueRemindersRequest = {
197
- offset: number;
198
- limit: number;
199
- sortBy: SortFilter;
200
- };
201
-
202
183
  export type NewLeasingConditions = {
203
184
  parameters: {
204
185
  yearlyRoadTax: string;
@@ -302,7 +283,7 @@ export type AmortizationTable = {
302
283
  rows: AmortizationRow[];
303
284
  };
304
285
 
305
- export type AmortizationDocsEvent = {
286
+ export type AmortizationDocsEvent = BaseEvent & {
306
287
  contractId: string;
307
288
  changedDocumentIds: string[];
308
289
  actionAt: string;
@@ -7,7 +7,7 @@ export enum MarketingPlatform {
7
7
  machineryplanet = 'machineryplanet',
8
8
  machinetrack = 'machinetrack',
9
9
  marktnet = 'marktnet',
10
- mobile = 'mobile',
10
+ // mobile = 'mobile',
11
11
  truck1st = 'truck1st', // Truck1.eu
12
12
  trucks = 'trucks', //Trucks.nl
13
13
  truckscout = 'truckscout24',
@@ -66,6 +66,8 @@ export type Branch = {
66
66
  standard: string; //percentage value (e.g. 21)
67
67
  };
68
68
  location: LocationValue;
69
+
70
+ storecoveExternalId?: number;
69
71
  };
70
72
 
71
73
  export type HdmsVehiclesSync = {
@@ -42,8 +42,6 @@ export type VehicleSaleOverview = {
42
42
  lastInvoiceIssuedAt?: string;
43
43
  firstPaymentAt?: string;
44
44
  fullPaymentAt?: string;
45
- invoiceAmountPaid?: string; // amount paid according to the document's paid status
46
- opportunityPaymentsPaid?: string; // amount paid according to the recorded opportunity payments
47
45
  expectedAmount: string; // from quote(s)
48
46
  actualAmount: string; // from all invoices
49
47
  lifetimeActualAmount: string; // sum of all invoices from all opportunities for this vehicle
@@ -486,6 +486,7 @@ export type VehicleExternalInfo = {
486
486
  alloyWheels?: boolean;
487
487
  aluminiumFuelTank?: boolean;
488
488
  cdPlayer?: boolean;
489
+ coil?: boolean;
489
490
  centralLocking?: boolean;
490
491
  centralLubrication?: boolean;
491
492
  cruiseControl?: boolean;
@@ -0,0 +1,73 @@
1
+ import { DebtorsDossier, DebtorsDossierStatus } from '@bisondesk/core-sdk/types/leasing-debtors';
2
+
3
+ export const DebtorsDossierStatusOrder: DebtorsDossierStatus[] = [
4
+ DebtorsDossierStatus.AUTO_REMINDER,
5
+ DebtorsDossierStatus.OVERDUE,
6
+ DebtorsDossierStatus.CONTACT_ATTEMPTED,
7
+ DebtorsDossierStatus.DIALOGUE,
8
+ DebtorsDossierStatus.PROMISE_TO_PAY,
9
+ DebtorsDossierStatus.FAILURE,
10
+ DebtorsDossierStatus.RESOLVED,
11
+ ];
12
+
13
+ type CompareInput = {
14
+ currentStatus: DebtorsDossierStatus;
15
+ referenceStatus: DebtorsDossierStatus;
16
+ };
17
+
18
+ const compareDebtorsDossierStatus = (input: CompareInput) => {
19
+ const { currentStatus, referenceStatus } = input;
20
+
21
+ const currentStatusIdx = DebtorsDossierStatusOrder.indexOf(currentStatus);
22
+ const referenceStatusIdx = DebtorsDossierStatusOrder.indexOf(referenceStatus);
23
+
24
+ return {
25
+ currentStatusIdx,
26
+ referenceStatusIdx,
27
+ };
28
+ };
29
+
30
+ export const getPreviousStatus = (
31
+ currentStatus: DebtorsDossierStatus
32
+ ): DebtorsDossierStatus | undefined => {
33
+ const currentIndex = DebtorsDossierStatusOrder.indexOf(currentStatus);
34
+ if (currentIndex <= 0) {
35
+ return;
36
+ }
37
+ return DebtorsDossierStatusOrder[currentIndex - 1];
38
+ };
39
+
40
+ export const getNextStatus = (status: DebtorsDossierStatus): DebtorsDossierStatus | undefined => {
41
+ const statusIndex = DebtorsDossierStatusOrder.indexOf(status);
42
+ if (statusIndex >= DebtorsDossierStatusOrder.length - 1) {
43
+ return;
44
+ }
45
+ return DebtorsDossierStatusOrder[statusIndex + 1];
46
+ };
47
+
48
+ export const isSameOrAfterReferenceDebtorsDossierStatus = (input: CompareInput): boolean => {
49
+ const { currentStatusIdx, referenceStatusIdx } = compareDebtorsDossierStatus(input);
50
+
51
+ return currentStatusIdx >= referenceStatusIdx;
52
+ };
53
+
54
+ export const isAfterReferenceDebtorsDossierStatus = (input: CompareInput): boolean => {
55
+ const { currentStatusIdx, referenceStatusIdx } = compareDebtorsDossierStatus(input);
56
+
57
+ return currentStatusIdx > referenceStatusIdx;
58
+ };
59
+
60
+ export const isSameOrBeforeReferenceDebtorsDossierStatus = (input: CompareInput): boolean => {
61
+ const { currentStatusIdx, referenceStatusIdx } = compareDebtorsDossierStatus(input);
62
+
63
+ return currentStatusIdx <= referenceStatusIdx;
64
+ };
65
+
66
+ export const isBeforeReferenceDebtorsDossierStatus = (input: CompareInput): boolean => {
67
+ const { currentStatusIdx, referenceStatusIdx } = compareDebtorsDossierStatus(input);
68
+
69
+ return currentStatusIdx < referenceStatusIdx;
70
+ };
71
+
72
+ export const isDossierFinished = (dossier: DebtorsDossier): boolean =>
73
+ dossier.resolvedAt != null || dossier.failedAt != null;
@@ -1,17 +1,24 @@
1
1
  import { joinWithSeparator } from '@bisondesk/commons-sdk/formatting';
2
2
  import { BusinessEntityIds } from '../constants.js';
3
3
  import { Contact, Organization, SearchOrganization } from '../types/crm.js';
4
+ import { DebtorsDossier, SearchDebtorsDossier } from '../types/leasing-debtors.js';
4
5
  import { SearchLeasingContract } from '../types/leasing-search.js';
5
6
  import { LeasingContract } from '../types/leasing.js';
6
7
  import { Opportunity, SearchOpportunity } from '../types/opportunities.js';
7
8
  import { SearchVehicle, Vehicle } from '../types/vehicles.js';
8
9
 
9
- export type GlobalBusinessEntity = Opportunity | Vehicle | Organization | LeasingContract;
10
+ export type GlobalBusinessEntity =
11
+ | Opportunity
12
+ | Vehicle
13
+ | Organization
14
+ | LeasingContract
15
+ | DebtorsDossier;
10
16
  export type GlobalSearchEntity =
11
17
  | SearchOpportunity
12
18
  | SearchVehicle
13
19
  | SearchOrganization
14
- | SearchLeasingContract;
20
+ | SearchLeasingContract
21
+ | SearchDebtorsDossier;
15
22
 
16
23
  export const getCustomerInformation = (org?: Organization, contact?: Contact) => {
17
24
  if (org != null) {
@@ -28,6 +28,10 @@ export const extractCustomFeatures = (vehicle: VehicleExternalInfo): string[] =>
28
28
  getValue: (vehicle) => vehicle.accessories.lowDeck,
29
29
  picklistValueId: 'lowDeck',
30
30
  },
31
+ {
32
+ getValue: (vehicle) => vehicle.accessories.coil,
33
+ picklistValueId: 'coil',
34
+ },
31
35
  ];
32
36
 
33
37
  return features