@bisondesk/core-sdk 1.0.584 → 1.0.586

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.
@@ -0,0 +1,192 @@
1
+ import { MultiLangValue } from '@bisondesk/commons-sdk/types';
2
+ import { BaseEvent } from './internal-events.js';
3
+ import { BaseSearchRequest } from './search.js';
4
+ import { Contact, Organization } from './crm.js';
5
+ import { Interest } from './interests.js';
6
+ import { DataRecord, ReferenceData } from './utils.js';
7
+ import { NextList } from '@bisondesk/commons-sdk/types';
8
+ import { Task } from '@bisondesk/commons-sdk/tasks';
9
+
10
+ export enum ProspectActions {
11
+ CLOSE = 'close',
12
+ REOPEN = 'reopen',
13
+ ENGAGE = 'engage',
14
+ SET_METADATA = 'set_metadata',
15
+ SET_OBJECTIVES = 'set_objectives',
16
+ SET_CUSTOMER = 'set_customer',
17
+ ADD_ACTIVITY = 'add_activity',
18
+ DELETE = 'delete',
19
+ }
20
+
21
+ export enum ProspectStatus {
22
+ NURTURE = 'nurture',
23
+ ATTEMPTING = 'attempting',
24
+ ENGAGED = 'engaged',
25
+ CLOSED = 'closed',
26
+ }
27
+
28
+ export const ProspectStatusOrder: ProspectStatus[] = [
29
+ ProspectStatus.NURTURE,
30
+ ProspectStatus.ATTEMPTING,
31
+ ProspectStatus.ENGAGED,
32
+ ];
33
+
34
+ export const ProspectKanbanColumns = [...ProspectStatusOrder, ProspectStatus.CLOSED];
35
+
36
+ export const ProspectKanbanEndColumns: string[] = [ProspectStatus.CLOSED];
37
+
38
+ export enum ProspectClosedReason {
39
+ CONVERTED = 'converted',
40
+ DEFERRED = 'deferred',
41
+ NO_REPLY = 'no_reply',
42
+ NOT_INTERESTED = 'not_interested',
43
+ AUTOMATIC = 'automatic',
44
+ }
45
+
46
+ export enum ProspectPriority {
47
+ LOW = 'low',
48
+ NORMAL = 'normal',
49
+ HIGH = 'high',
50
+ }
51
+
52
+ export type ProspectObjective = {
53
+ id: string;
54
+ title: MultiLangValue;
55
+ };
56
+
57
+ type BaseProspect = {
58
+ contactId?: string;
59
+ organizationId?: string;
60
+ branchId: string;
61
+ accountManager?: string;
62
+ priority: ProspectPriority;
63
+ score?: number;
64
+ objectives: ProspectObjective[];
65
+ };
66
+
67
+ export type NewProspect = BaseProspect & {
68
+ id?: undefined;
69
+ createdAt?: undefined;
70
+ createdBy?: undefined;
71
+ modifiedAt?: undefined;
72
+ modifiedBy?: undefined;
73
+ };
74
+
75
+ export type Prospect = BaseProspect & {
76
+ id: string;
77
+
78
+ status: ProspectStatus;
79
+
80
+ attemptingAt?: string;
81
+ attemptingBy?: string;
82
+ engagedAt?: string;
83
+ engagedBy?: string;
84
+ closedAt?: string;
85
+ closedBy?: string;
86
+ closedReason?: ProspectClosedReason;
87
+
88
+ createdAt: string;
89
+ createdBy: string;
90
+ modifiedAt: string;
91
+ modifiedBy: string;
92
+ };
93
+
94
+ export type ProspectUpdate = {
95
+ contactId?: string | null;
96
+ organizationId?: string | null;
97
+ branchId?: string;
98
+ accountManager?: string | null;
99
+ priority?: ProspectPriority;
100
+ score?: number | null;
101
+ objectives?: ProspectObjective[];
102
+
103
+ close?: boolean;
104
+ closedReason?: ProspectClosedReason;
105
+ reopen?: boolean;
106
+ engage?: boolean;
107
+ };
108
+
109
+ export type ProspectBff = {
110
+ prospect: DataRecord<Prospect>;
111
+ contact?: DataRecord<Contact>;
112
+ org?: DataRecord<Organization>;
113
+ tasks: DataRecord<Task>[];
114
+ };
115
+
116
+ /************
117
+ *
118
+ * Search
119
+ */
120
+
121
+ export type SearchProspect = {
122
+ contact?: Contact;
123
+ prospect: Prospect;
124
+ org?: Organization;
125
+ /**
126
+ * Interests denormalized from the prospect's lead:
127
+ * - Org-linked prospects: union of the org's own interests and every contact's interests for that org.
128
+ * - Contact-only prospects: just the contact's interests.
129
+ */
130
+ interests?: Interest[];
131
+ custom: {
132
+ closed: boolean;
133
+ unassigned: boolean;
134
+ /**
135
+ * Country of the lead, preferring contact country over org country when both are set.
136
+ */
137
+ country?: string;
138
+ };
139
+ };
140
+
141
+ /************
142
+ *
143
+ * Kanban
144
+ */
145
+
146
+ export type ProspectsKanbanColumn = {
147
+ status: string;
148
+ results: SearchProspect[];
149
+ totalCount: number;
150
+ };
151
+
152
+ export type MSearchProspectsKanbanColumn = {
153
+ column: ProspectsKanbanColumn;
154
+ nextToken?: string;
155
+ };
156
+
157
+ export type KanbanProspectsSearchRequest = BaseSearchRequest & {
158
+ nextTokens?: Record<string, string | undefined>;
159
+ };
160
+
161
+ export type KanbanProspectsNextList = Omit<
162
+ NextList<ProspectsKanbanColumn, ReferenceData>,
163
+ 'nextToken'
164
+ > & {
165
+ nextTokens?: Record<string, string | undefined>;
166
+ };
167
+
168
+ /************
169
+ *
170
+ * Events
171
+ */
172
+
173
+ type BaseProspectEvent = BaseEvent & {
174
+ id: string;
175
+ actionAt: string;
176
+ tenantId: string;
177
+ userId: string;
178
+ };
179
+
180
+ export type ProspectCreatedEvent = BaseProspectEvent & {
181
+ action: 'create';
182
+ prospect: Prospect;
183
+ previousProspect?: undefined;
184
+ };
185
+
186
+ export type ProspectUpdatedEvent = BaseProspectEvent & {
187
+ action: 'update';
188
+ prospect: Prospect;
189
+ previousProspect: Prospect;
190
+ };
191
+
192
+ export type ProspectEvent = ProspectCreatedEvent | ProspectUpdatedEvent;
@@ -241,6 +241,7 @@ export type SearchVehicle = {
241
241
  sold: boolean;
242
242
  isReserved: boolean;
243
243
  hasPayments: boolean;
244
+ listedOnWebsite: boolean;
244
245
  publishedOnWebsiteAt?: string;
245
246
  originalBranchId: string;
246
247
  };