@bisondesk/core-sdk 1.0.493 → 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 (48) hide show
  1. package/lib/constants.d.ts +2 -0
  2. package/lib/constants.d.ts.map +1 -1
  3. package/lib/constants.js +2 -0
  4. package/lib/constants.js.map +1 -1
  5. package/lib/types/activities.d.ts +15 -5
  6. package/lib/types/activities.d.ts.map +1 -1
  7. package/lib/types/activities.js +1 -0
  8. package/lib/types/activities.js.map +1 -1
  9. package/lib/types/internal-events.d.ts +2 -1
  10. package/lib/types/internal-events.d.ts.map +1 -1
  11. package/lib/types/internal-events.js +1 -0
  12. package/lib/types/internal-events.js.map +1 -1
  13. package/lib/types/journeys.d.ts +6 -0
  14. package/lib/types/journeys.d.ts.map +1 -1
  15. package/lib/types/journeys.js.map +1 -1
  16. package/lib/types/leasing-debtors.d.ts +202 -0
  17. package/lib/types/leasing-debtors.d.ts.map +1 -1
  18. package/lib/types/leasing-debtors.js +58 -1
  19. package/lib/types/leasing-debtors.js.map +1 -1
  20. package/lib/types/leasing-search.d.ts +1 -0
  21. package/lib/types/leasing-search.d.ts.map +1 -1
  22. package/lib/types/leasing-search.js.map +1 -1
  23. package/lib/types/leasing.d.ts +1 -22
  24. package/lib/types/leasing.d.ts.map +1 -1
  25. package/lib/types/leasing.js.map +1 -1
  26. package/lib/types/marketing.d.ts +0 -1
  27. package/lib/types/marketing.d.ts.map +1 -1
  28. package/lib/types/marketing.js +0 -1
  29. package/lib/types/marketing.js.map +1 -1
  30. package/lib/utils/debtors-dossiers.d.ts +15 -0
  31. package/lib/utils/debtors-dossiers.d.ts.map +1 -0
  32. package/lib/utils/debtors-dossiers.js +51 -0
  33. package/lib/utils/debtors-dossiers.js.map +1 -0
  34. package/lib/utils/search.d.ts +3 -2
  35. package/lib/utils/search.d.ts.map +1 -1
  36. package/lib/utils/search.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/constants.ts +2 -0
  39. package/src/types/activities.ts +49 -4
  40. package/src/types/internal-events.ts +1 -0
  41. package/src/types/journeys.ts +7 -0
  42. package/src/types/leasing-debtors.ts +309 -0
  43. package/src/types/leasing-search.ts +1 -0
  44. package/src/types/leasing.ts +0 -20
  45. package/src/types/marketing.ts +1 -1
  46. package/src/utils/debtors-dossiers.ts +73 -0
  47. package/src/utils/search.ts +9 -2
  48. package/tsconfig.tsbuildinfo +1 -1
@@ -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
+ };
@@ -12,6 +12,7 @@ export enum EventTypes {
12
12
  ACTIVITY = 'activities',
13
13
  EXTERNAL_VEHICLE_SALE = 'external-vehicle-sales',
14
14
  AMORTIZATION_DOC = 'amortization-docs',
15
+ DEBTOR_DOSSIER = 'debtor-dossiers',
15
16
  }
16
17
 
17
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
 
@@ -42,19 +42,6 @@ export type LeasingConditionEvent = {
42
42
  tenantId: string;
43
43
  };
44
44
 
45
- export type OverdueDossier = {
46
- id: string;
47
- organizationId: string;
48
- organizationName: string;
49
- status: 'ONGOING' | 'ERROR' | 'SUCCESS' | 'EXPIRED' | 'DISCARDED';
50
- emails: EmailMessage[];
51
- createdAt: string;
52
- modifiedAt: string;
53
- completedAt?: string;
54
- nextActionAt: string;
55
- riskLevel: number;
56
- };
57
-
58
45
  export type LeasingContractClient = {
59
46
  organizationId: string;
60
47
  contactIds: string[];
@@ -193,13 +180,6 @@ export type OpportunityRef = BaseRef & {
193
180
  //Since VAT is client specific and contracts can be transferred between clients, we always handle values without VAT
194
181
  };
195
182
 
196
- export type ListOverdueRemindersResponse = PaginatedList<OverdueDossier, ReferenceData>;
197
- export type ListOverdueRemindersRequest = {
198
- offset: number;
199
- limit: number;
200
- sortBy: SortFilter;
201
- };
202
-
203
183
  export type NewLeasingConditions = {
204
184
  parameters: {
205
185
  yearlyRoadTax: 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',
@@ -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) {