@first-to-fly/crm-sdk 1.4.3 → 1.6.0

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,1017 @@
1
+ /**
2
+ * GENERATED from crm-be zod contracts by scripts/gen-sdk-contracts.ts — do not edit by hand.
3
+ *
4
+ * These types are derived directly from the CRM backend's zod request/response
5
+ * schemas so the SDK's typed API client cannot drift from the server. To
6
+ * regenerate after a contract change, run `bun run gen:sdk-contracts` in crm-be.
7
+ *
8
+ * This file is fully self-contained: it has no runtime imports and no dependency
9
+ * on crm-be or zod.
10
+ */
11
+ type ContactCreate = {
12
+ name: string;
13
+ display_name?: (string | undefined) | null;
14
+ email?: (string | undefined) | "";
15
+ phone?: (string | "") | undefined;
16
+ notes?: (string | undefined) | null;
17
+ avatar_url?: (string | undefined) | null;
18
+ position?: (string | undefined) | null;
19
+ company_name?: (string | undefined) | null;
20
+ customer_company_id?: (string | undefined) | null;
21
+ mobile?: (string | undefined) | null;
22
+ city?: (string | undefined) | null;
23
+ country?: (string | undefined) | null;
24
+ timezone?: (string | undefined) | null;
25
+ communication_preference?: (("email" | "phone" | "whatsapp") | undefined) | null;
26
+ tags?: (string[] | undefined) | null;
27
+ priority?: (("low" | "medium" | "high" | "vip") | undefined) | null;
28
+ department?: (string | undefined) | null;
29
+ industry?: (string | undefined) | null;
30
+ assigned_to?: (string | undefined) | null;
31
+ team_id?: (string | undefined) | null;
32
+ whatsapp_consent?: ("opted_in" | "opted_out" | "unknown") | undefined;
33
+ whatsapp_consent_source?: (string | undefined) | null;
34
+ metadata?: {
35
+ [x: string]: unknown;
36
+ } | undefined;
37
+ custom_fields?: ({
38
+ [x: string]: unknown;
39
+ } | undefined) | null;
40
+ };
41
+ type ContactUpdate = {
42
+ name?: string | undefined;
43
+ display_name?: ((string | undefined) | null) | undefined;
44
+ email?: ((string | undefined) | "") | undefined;
45
+ phone?: ((string | "") | undefined) | undefined;
46
+ notes?: ((string | undefined) | null) | undefined;
47
+ avatar_url?: ((string | undefined) | null) | undefined;
48
+ position?: ((string | undefined) | null) | undefined;
49
+ company_name?: ((string | undefined) | null) | undefined;
50
+ customer_company_id?: ((string | undefined) | null) | undefined;
51
+ mobile?: ((string | undefined) | null) | undefined;
52
+ city?: ((string | undefined) | null) | undefined;
53
+ country?: ((string | undefined) | null) | undefined;
54
+ timezone?: ((string | undefined) | null) | undefined;
55
+ communication_preference?: ((("email" | "phone" | "whatsapp") | undefined) | null) | undefined;
56
+ tags?: ((string[] | undefined) | null) | undefined;
57
+ priority?: ((("low" | "medium" | "high" | "vip") | undefined) | null) | undefined;
58
+ department?: ((string | undefined) | null) | undefined;
59
+ industry?: ((string | undefined) | null) | undefined;
60
+ assigned_to?: ((string | undefined) | null) | undefined;
61
+ team_id?: ((string | undefined) | null) | undefined;
62
+ whatsapp_consent?: (("opted_in" | "opted_out" | "unknown") | undefined) | undefined;
63
+ whatsapp_consent_source?: ((string | undefined) | null) | undefined;
64
+ metadata?: ({
65
+ [x: string]: unknown;
66
+ } | undefined) | undefined;
67
+ custom_fields?: (({
68
+ [x: string]: unknown;
69
+ } | undefined) | null) | undefined;
70
+ };
71
+ type ContactQuery = {
72
+ page?: number;
73
+ pageSize?: number;
74
+ search?: string | undefined;
75
+ name?: string | undefined;
76
+ email?: string | undefined;
77
+ phone?: string | undefined;
78
+ status?: ("active" | "blocked") | undefined;
79
+ company_name?: string | undefined;
80
+ priority?: ("low" | "medium" | "high" | "vip") | undefined;
81
+ department?: string | undefined;
82
+ industry?: string | undefined;
83
+ communication_preference?: ("email" | "phone" | "whatsapp") | undefined;
84
+ assigned_to?: string | undefined;
85
+ team_id?: string | string[];
86
+ tags?: string | undefined;
87
+ tag_filter?: ("and" | "or");
88
+ include_tags?: boolean;
89
+ };
90
+ type Contact = {
91
+ id: string;
92
+ name: string;
93
+ source?: (string | undefined) | null;
94
+ display_name?: (string | undefined) | null;
95
+ team_id?: (string | undefined) | null;
96
+ team_name?: (string | undefined) | null;
97
+ email?: string | undefined;
98
+ phone?: (string | undefined) | null;
99
+ notes?: string | undefined;
100
+ status: "active" | "blocked";
101
+ assigned_to?: (string | undefined) | null;
102
+ assignment: {
103
+ assigned_to?: (string | undefined) | null;
104
+ assigned_user_name?: (string | undefined) | null;
105
+ assigned_user_email?: (string | undefined) | null;
106
+ assigned_user_avatar?: (string | undefined) | null;
107
+ };
108
+ user_id: string;
109
+ workspace_id: string;
110
+ created_at: string;
111
+ updated_at: string;
112
+ deleted_at?: (string | undefined) | null;
113
+ avatar_url?: (string | undefined) | null;
114
+ position?: (string | undefined) | null;
115
+ company_name?: (string | undefined) | null;
116
+ customer_company_id?: (string | undefined) | null;
117
+ mobile?: (string | undefined) | null;
118
+ city?: (string | undefined) | null;
119
+ country?: (string | undefined) | null;
120
+ timezone?: (string | undefined) | null;
121
+ communication_preference?: (("email" | "phone" | "whatsapp") | undefined) | null;
122
+ tags?: (string[] | undefined) | null;
123
+ priority?: (("low" | "medium" | "high" | "vip") | undefined) | null;
124
+ department?: (string | undefined) | null;
125
+ industry?: (string | undefined) | null;
126
+ whatsapp_consent?: ("opted_in" | "opted_out" | "unknown") | undefined;
127
+ whatsapp_consent_source?: (string | undefined) | null;
128
+ whatsapp_consent_at?: (string | undefined) | null;
129
+ product_synced?: boolean | undefined;
130
+ metadata?: {
131
+ [x: string]: unknown;
132
+ } | undefined;
133
+ custom_fields?: ({
134
+ [x: string]: unknown;
135
+ } | undefined) | null;
136
+ tag_objects?: {
137
+ [x: string]: unknown;
138
+ }[] | undefined;
139
+ conversations?: {
140
+ id: string;
141
+ channel: "whatsapp" | "whatsapp_web" | "messenger" | "instagram" | "email" | "sms" | "telegram" | "webchat" | "website_form" | "voice";
142
+ channel_id?: (string | undefined) | null;
143
+ channel_display_name?: (string | undefined) | null;
144
+ channel_deleted?: boolean | undefined;
145
+ merge_group_id?: (string | undefined) | null;
146
+ merged_count?: number | undefined;
147
+ last_message_at?: (string | undefined) | null;
148
+ last_message_preview?: (string | undefined) | null;
149
+ }[] | undefined;
150
+ email_suppression?: ({
151
+ id: string;
152
+ reason: "hard_bounce" | "complaint_reply" | "manual";
153
+ reason_detail: string | null;
154
+ created_at: string;
155
+ } | null) | undefined;
156
+ };
157
+ type ContactList = {
158
+ items: {
159
+ id: string;
160
+ name: string;
161
+ source?: (string | undefined) | null;
162
+ display_name?: (string | undefined) | null;
163
+ team_id?: (string | undefined) | null;
164
+ team_name?: (string | undefined) | null;
165
+ email?: string | undefined;
166
+ phone?: (string | undefined) | null;
167
+ notes?: string | undefined;
168
+ status: "active" | "blocked";
169
+ assigned_to?: (string | undefined) | null;
170
+ assignment: {
171
+ assigned_to?: (string | undefined) | null;
172
+ assigned_user_name?: (string | undefined) | null;
173
+ assigned_user_email?: (string | undefined) | null;
174
+ assigned_user_avatar?: (string | undefined) | null;
175
+ };
176
+ user_id: string;
177
+ workspace_id: string;
178
+ created_at: string;
179
+ updated_at: string;
180
+ deleted_at?: (string | undefined) | null;
181
+ avatar_url?: (string | undefined) | null;
182
+ position?: (string | undefined) | null;
183
+ company_name?: (string | undefined) | null;
184
+ customer_company_id?: (string | undefined) | null;
185
+ mobile?: (string | undefined) | null;
186
+ city?: (string | undefined) | null;
187
+ country?: (string | undefined) | null;
188
+ timezone?: (string | undefined) | null;
189
+ communication_preference?: (("email" | "phone" | "whatsapp") | undefined) | null;
190
+ tags?: (string[] | undefined) | null;
191
+ priority?: (("low" | "medium" | "high" | "vip") | undefined) | null;
192
+ department?: (string | undefined) | null;
193
+ industry?: (string | undefined) | null;
194
+ whatsapp_consent?: ("opted_in" | "opted_out" | "unknown") | undefined;
195
+ whatsapp_consent_source?: (string | undefined) | null;
196
+ whatsapp_consent_at?: (string | undefined) | null;
197
+ product_synced?: boolean | undefined;
198
+ metadata?: {
199
+ [x: string]: unknown;
200
+ } | undefined;
201
+ custom_fields?: ({
202
+ [x: string]: unknown;
203
+ } | undefined) | null;
204
+ tag_objects?: {
205
+ [x: string]: unknown;
206
+ }[] | undefined;
207
+ conversations?: {
208
+ id: string;
209
+ channel: "whatsapp" | "whatsapp_web" | "messenger" | "instagram" | "email" | "sms" | "telegram" | "webchat" | "website_form" | "voice";
210
+ channel_id?: (string | undefined) | null;
211
+ channel_display_name?: (string | undefined) | null;
212
+ channel_deleted?: boolean | undefined;
213
+ merge_group_id?: (string | undefined) | null;
214
+ merged_count?: number | undefined;
215
+ last_message_at?: (string | undefined) | null;
216
+ last_message_preview?: (string | undefined) | null;
217
+ }[] | undefined;
218
+ email_suppression?: ({
219
+ id: string;
220
+ reason: "hard_bounce" | "complaint_reply" | "manual";
221
+ reason_detail: string | null;
222
+ created_at: string;
223
+ } | null) | undefined;
224
+ }[];
225
+ totalCount: number;
226
+ pageCount: number;
227
+ currentPage: number;
228
+ pageSize: number;
229
+ };
230
+ type ContactRefUpsertBody = {
231
+ name?: string | undefined;
232
+ phone?: string | undefined;
233
+ email?: string | undefined;
234
+ team_id?: string | undefined;
235
+ team_ref?: string | undefined;
236
+ team_name?: string | undefined;
237
+ whatsapp_consent?: {
238
+ status: "opted_in" | "opted_out" | "unknown";
239
+ source: string;
240
+ recorded_at: string;
241
+ } | undefined;
242
+ attributes?: {
243
+ [x: string]: string | null;
244
+ } | undefined;
245
+ };
246
+ type ContactRefUpsertResult = {
247
+ contact: {
248
+ id: string;
249
+ name: string;
250
+ source?: (string | undefined) | null;
251
+ display_name?: (string | undefined) | null;
252
+ team_id?: (string | undefined) | null;
253
+ team_name?: (string | undefined) | null;
254
+ email?: string | undefined;
255
+ phone?: (string | undefined) | null;
256
+ notes?: string | undefined;
257
+ status: "active" | "blocked";
258
+ assigned_to?: (string | undefined) | null;
259
+ assignment: {
260
+ assigned_to?: (string | undefined) | null;
261
+ assigned_user_name?: (string | undefined) | null;
262
+ assigned_user_email?: (string | undefined) | null;
263
+ assigned_user_avatar?: (string | undefined) | null;
264
+ };
265
+ user_id: string;
266
+ workspace_id: string;
267
+ created_at: string;
268
+ updated_at: string;
269
+ deleted_at?: (string | undefined) | null;
270
+ avatar_url?: (string | undefined) | null;
271
+ position?: (string | undefined) | null;
272
+ company_name?: (string | undefined) | null;
273
+ customer_company_id?: (string | undefined) | null;
274
+ mobile?: (string | undefined) | null;
275
+ city?: (string | undefined) | null;
276
+ country?: (string | undefined) | null;
277
+ timezone?: (string | undefined) | null;
278
+ communication_preference?: (("email" | "phone" | "whatsapp") | undefined) | null;
279
+ tags?: (string[] | undefined) | null;
280
+ priority?: (("low" | "medium" | "high" | "vip") | undefined) | null;
281
+ department?: (string | undefined) | null;
282
+ industry?: (string | undefined) | null;
283
+ whatsapp_consent?: ("opted_in" | "opted_out" | "unknown") | undefined;
284
+ whatsapp_consent_source?: (string | undefined) | null;
285
+ whatsapp_consent_at?: (string | undefined) | null;
286
+ product_synced?: boolean | undefined;
287
+ metadata?: {
288
+ [x: string]: unknown;
289
+ } | undefined;
290
+ custom_fields?: ({
291
+ [x: string]: unknown;
292
+ } | undefined) | null;
293
+ tag_objects?: {
294
+ [x: string]: unknown;
295
+ }[] | undefined;
296
+ conversations?: {
297
+ id: string;
298
+ channel: "whatsapp" | "whatsapp_web" | "messenger" | "instagram" | "email" | "sms" | "telegram" | "webchat" | "website_form" | "voice";
299
+ channel_id?: (string | undefined) | null;
300
+ channel_display_name?: (string | undefined) | null;
301
+ channel_deleted?: boolean | undefined;
302
+ merge_group_id?: (string | undefined) | null;
303
+ merged_count?: number | undefined;
304
+ last_message_at?: (string | undefined) | null;
305
+ last_message_preview?: (string | undefined) | null;
306
+ }[] | undefined;
307
+ email_suppression?: ({
308
+ id: string;
309
+ reason: "hard_bounce" | "complaint_reply" | "manual";
310
+ reason_detail: string | null;
311
+ created_at: string;
312
+ } | null) | undefined;
313
+ };
314
+ created: boolean;
315
+ matched_by: "ref" | "phone" | "email" | "created";
316
+ consent_applied: boolean;
317
+ };
318
+ type ContactChangesQuery = {
319
+ since?: string | undefined;
320
+ cursor?: string | undefined;
321
+ limit?: number;
322
+ };
323
+ type ContactChanges = {
324
+ items: {
325
+ id: string;
326
+ updated_at: string;
327
+ deleted: boolean;
328
+ refs: {
329
+ source: string;
330
+ ref: string;
331
+ }[];
332
+ name: string | null;
333
+ phone: string | null;
334
+ email: string | null;
335
+ team_id: string | null;
336
+ product_attributes: {
337
+ [x: string]: string;
338
+ };
339
+ whatsapp_consent: {
340
+ status: "opted_in" | "opted_out" | "unknown";
341
+ source: string | null;
342
+ at: string | null;
343
+ } | null;
344
+ }[];
345
+ next_cursor: string | null;
346
+ };
347
+ type PartnerWorkspaceUpsertBody = {
348
+ name: string;
349
+ currency?: string | undefined;
350
+ timezone?: string | undefined;
351
+ };
352
+ type PartnerWorkspacePatchBody = {
353
+ enabled?: boolean | undefined;
354
+ name?: string | undefined;
355
+ };
356
+ type PartnerWorkspaceCreated = {
357
+ external_ref: string;
358
+ workspace_id: string | null;
359
+ embed_app_id: string | null;
360
+ enabled: boolean;
361
+ embed_app_secret: string;
362
+ created: true;
363
+ };
364
+ type PartnerWorkspaceExisting = {
365
+ external_ref: string;
366
+ workspace_id: string | null;
367
+ embed_app_id: string | null;
368
+ enabled: boolean;
369
+ created: false;
370
+ };
371
+ type PartnerWorkspaceStatus = {
372
+ external_ref: string;
373
+ workspace_id: string | null;
374
+ embed_app_id: string | null;
375
+ enabled: boolean;
376
+ };
377
+ type PartnerWorkspaceDetail = {
378
+ external_ref: string;
379
+ workspace_id: string | null;
380
+ embed_app_id: string | null;
381
+ enabled: boolean;
382
+ state: "pending" | "owner_created" | "workspace_created" | "app_installed" | "sub_app_created" | "active";
383
+ };
384
+ type PartnerWorkspaceSecret = {
385
+ embed_app_id: string;
386
+ embed_app_secret: string;
387
+ };
388
+ type PartnerContactEraseResult = {
389
+ erased: true;
390
+ contact_id: string;
391
+ other_sources_removed: number;
392
+ };
393
+ type LeadCreate = {
394
+ status?: string | undefined;
395
+ assigned_to?: (string | undefined) | null;
396
+ tags?: (string[] | undefined) | null;
397
+ notes?: (string | undefined) | null;
398
+ lead_source_id?: (string | undefined) | null;
399
+ budget?: (number | undefined) | null;
400
+ expected_close_date?: (string | undefined) | null;
401
+ close_outcome?: (("won" | "lost") | undefined) | null;
402
+ close_reason?: (string | undefined) | null;
403
+ close_value?: (number | undefined) | null;
404
+ channel_id?: (string | undefined) | null;
405
+ team_id?: (string | undefined) | null;
406
+ source_identifier_type?: (("phone" | "email" | "messenger_user_id" | "instagram_user_id" | "whatsapp_phone" | "whatsapp_lid" | "telegram_user_id") | undefined) | null;
407
+ source_identifier_value?: (string | undefined) | null;
408
+ has_potential_duplicates?: boolean | undefined;
409
+ contact_id: string;
410
+ custom_fields?: ({
411
+ [x: string]: unknown;
412
+ } | undefined) | null;
413
+ };
414
+ type LeadCapture = {
415
+ status?: string;
416
+ assigned_to?: (string | undefined) | null;
417
+ tags?: (string[] | undefined) | null;
418
+ notes?: (string | undefined) | null;
419
+ lead_source_id?: (string | undefined) | null;
420
+ budget?: (number | undefined) | null;
421
+ expected_close_date?: (string | undefined) | null;
422
+ close_outcome?: (("won" | "lost") | undefined) | null;
423
+ close_reason?: (string | undefined) | null;
424
+ close_value?: (number | undefined) | null;
425
+ channel_id?: (string | undefined) | null;
426
+ team_id?: (string | undefined) | null;
427
+ source_identifier_type?: (("phone" | "email" | "messenger_user_id" | "instagram_user_id" | "whatsapp_phone" | "whatsapp_lid" | "telegram_user_id") | undefined) | null;
428
+ source_identifier_value?: (string | undefined) | null;
429
+ has_potential_duplicates?: boolean | undefined;
430
+ custom_fields?: ({
431
+ [x: string]: unknown;
432
+ } | undefined) | null;
433
+ contact_id?: string | undefined;
434
+ /** Stable website-form submission ID used to make enquiry note delivery idempotent */
435
+ submission_id?: string | undefined;
436
+ source?: (string | undefined) | null;
437
+ name?: string | undefined;
438
+ email?: ((string | undefined) | null) | "";
439
+ phone?: (string | "") | undefined;
440
+ mobile?: (string | undefined) | null;
441
+ avatar_url?: (string | undefined) | null;
442
+ company_name?: (string | undefined) | null;
443
+ position?: (string | undefined) | null;
444
+ industry?: (string | undefined) | null;
445
+ department?: (string | undefined) | null;
446
+ city?: (string | undefined) | null;
447
+ country?: (string | undefined) | null;
448
+ timezone?: (string | undefined) | null;
449
+ priority?: (("low" | "medium" | "high" | "vip") | null) | undefined;
450
+ communication_preference?: (("email" | "phone" | "whatsapp") | null) | undefined;
451
+ };
452
+ type LeadUpdate = {
453
+ status?: string | undefined;
454
+ assigned_to?: ((string | undefined) | null) | undefined;
455
+ tags?: ((string[] | undefined) | null) | undefined;
456
+ notes?: ((string | undefined) | null) | undefined;
457
+ lead_source_id?: ((string | undefined) | null) | undefined;
458
+ budget?: ((number | undefined) | null) | undefined;
459
+ expected_close_date?: ((string | undefined) | null) | undefined;
460
+ close_outcome?: ((("won" | "lost") | undefined) | null) | undefined;
461
+ close_reason?: ((string | undefined) | null) | undefined;
462
+ close_value?: ((number | undefined) | null) | undefined;
463
+ channel_id?: ((string | undefined) | null) | undefined;
464
+ team_id?: ((string | undefined) | null) | undefined;
465
+ source_identifier_type?: ((("phone" | "email" | "messenger_user_id" | "instagram_user_id" | "whatsapp_phone" | "whatsapp_lid" | "telegram_user_id") | undefined) | null) | undefined;
466
+ source_identifier_value?: ((string | undefined) | null) | undefined;
467
+ has_potential_duplicates?: (boolean | undefined) | undefined;
468
+ contact_id?: string | undefined;
469
+ custom_fields?: (({
470
+ [x: string]: unknown;
471
+ } | undefined) | null) | undefined;
472
+ legacy_sale_edit?: true | undefined;
473
+ closed_at?: (string | null) | undefined;
474
+ };
475
+ type LeadQuery = {
476
+ search?: string | undefined;
477
+ name?: string | undefined;
478
+ email?: string | undefined;
479
+ phone?: string | undefined;
480
+ contact_id?: string | undefined;
481
+ assigned_to?: (string | string[]) | undefined;
482
+ stage_model?: ("qualification") | undefined;
483
+ status?: (string | string[]) | undefined;
484
+ company_name?: string | undefined;
485
+ industry?: string | undefined;
486
+ priority?: (string | string[]) | undefined;
487
+ source?: (string | string[]) | undefined;
488
+ lead_source_id?: (string | string[]) | undefined;
489
+ channel_id?: (string | string[]) | undefined;
490
+ created_from?: string | undefined;
491
+ created_to?: string | undefined;
492
+ updated_from?: string | undefined;
493
+ updated_to?: string | undefined;
494
+ expected_value_min?: number | undefined;
495
+ expected_value_max?: number | undefined;
496
+ stage_age_days?: number | undefined;
497
+ tags?: (string | string[]) | undefined;
498
+ tag_filter?: ("and" | "or") | undefined;
499
+ team_id?: string | undefined;
500
+ task_status?: ("pending" | "due_today" | "overdue" | "completed") | undefined;
501
+ activity_time_horizon?: ("overdue" | "today" | "upcoming") | undefined;
502
+ status_exact?: string | undefined;
503
+ page?: number;
504
+ pageSize?: number;
505
+ include_tags?: boolean;
506
+ include_stage_logs?: boolean;
507
+ include_stage_counts?: (boolean | ("true" | "false")) | undefined;
508
+ include_task_summary?: boolean;
509
+ include_next_activity?: (boolean | ("true" | "false")) | undefined;
510
+ };
511
+ type Lead = {
512
+ qualification_status?: (("new" | "contacted" | "qualified" | "converted" | "disqualified") | null) | undefined;
513
+ qualification_reason?: (string | null) | undefined;
514
+ qualification_changed_at?: (string | null) | undefined;
515
+ qualification_recorded_at?: (string | null) | undefined;
516
+ sales_compatibility?: ("legacy" | "qualification_only") | undefined;
517
+ /** Record eligibility for the labelled legacy editor; normal Lead permissions still apply. */
518
+ legacy_sale_editable?: boolean | undefined;
519
+ /** Historical Confirmed sale was transferred to Awaiting customer approval; informational only. */
520
+ legacy_confirmed_sale_migrated?: boolean | undefined;
521
+ id: string;
522
+ reused?: boolean | undefined;
523
+ contact_id: string;
524
+ contact: {
525
+ id: string;
526
+ name: string | null;
527
+ email: string | null;
528
+ phone: string | null;
529
+ mobile: string | null;
530
+ avatar_url: string | null;
531
+ company_name: string | null;
532
+ position: string | null;
533
+ department: string | null;
534
+ industry: string | null;
535
+ city: string | null;
536
+ country: string | null;
537
+ timezone: string | null;
538
+ communication_preference: string | null;
539
+ priority: string | null;
540
+ } | null;
541
+ name: string;
542
+ email: string;
543
+ phone: string;
544
+ channel_id?: (string | undefined) | null;
545
+ channel_type?: (string | undefined) | null;
546
+ channel_display_name?: (string | undefined) | null;
547
+ channel_deleted?: boolean | undefined;
548
+ status: string;
549
+ assigned_to?: (string | undefined) | null;
550
+ assigned_user_name?: (string | undefined) | null;
551
+ assigned_user_email?: (string | undefined) | null;
552
+ user_id: string;
553
+ company_id: string;
554
+ created_at: string;
555
+ updated_at: string;
556
+ company_name?: (string | undefined) | null;
557
+ position?: (string | undefined) | null;
558
+ industry?: (string | undefined) | null;
559
+ department?: (string | undefined) | null;
560
+ mobile?: (string | undefined) | null;
561
+ city?: (string | undefined) | null;
562
+ country?: (string | undefined) | null;
563
+ timezone?: (string | undefined) | null;
564
+ priority?: (("low" | "medium" | "high" | "vip") | undefined) | null;
565
+ communication_preference?: (("email" | "phone" | "whatsapp") | undefined) | null;
566
+ tags?: (string[] | undefined) | null;
567
+ notes?: (string | undefined) | null;
568
+ lead_source_id?: (string | undefined) | null;
569
+ lead_source?: ({
570
+ id: string;
571
+ name: string;
572
+ is_active: boolean;
573
+ } | undefined) | null;
574
+ source?: (string | undefined) | null;
575
+ budget?: (number | undefined) | null;
576
+ probability?: (number | undefined) | null;
577
+ expected_close_date?: (string | undefined) | null;
578
+ recent_stage_logs?: {
579
+ id: string;
580
+ lead_id: string;
581
+ previous_stage: string;
582
+ new_stage: string;
583
+ changed_by: string | null;
584
+ changed_at: string;
585
+ metadata?: {
586
+ [x: string]: any;
587
+ } | undefined;
588
+ changed_by_user?: ({
589
+ id: string;
590
+ full_name?: (string | null) | undefined;
591
+ email?: (string | null) | undefined;
592
+ avatar_url?: (string | null) | undefined;
593
+ } | null) | undefined;
594
+ }[] | undefined;
595
+ has_overdue_tasks?: boolean | undefined;
596
+ pending_task_count?: number | undefined;
597
+ next_activity?: ({
598
+ id: string;
599
+ activity_type: "call" | "meeting" | "task" | "reminder" | "note" | "email" | "event";
600
+ title: string;
601
+ effective_datetime: string;
602
+ all_day: boolean;
603
+ assigned_to: string | null;
604
+ assigned_to_name: string | null;
605
+ } | null) | undefined;
606
+ avatar_url?: (string | undefined) | null;
607
+ close_outcome?: (("won" | "lost") | undefined) | null;
608
+ close_reason?: (string | undefined) | null;
609
+ close_value?: (number | undefined) | null;
610
+ assignment_source?: (("manual" | "auto_round_robin" | "auto_regional" | "workflow_automation") | undefined) | null;
611
+ team_id?: (string | undefined) | null;
612
+ };
613
+ type LeadNoteCreate = {
614
+ body: string;
615
+ mentions?: string[];
616
+ };
617
+ type LeadNote = {
618
+ id: string;
619
+ lead_id: string;
620
+ body: string;
621
+ created_by: string | null;
622
+ source: string | null;
623
+ external_id: string | null;
624
+ metadata: {
625
+ [x: string]: unknown;
626
+ };
627
+ is_system: boolean;
628
+ source_type: "user" | "website_form";
629
+ created_at: string;
630
+ updated_at: string;
631
+ author: {
632
+ id: string;
633
+ full_name?: (string | null) | undefined;
634
+ email?: (string | null) | undefined;
635
+ avatar_url?: (string | null) | undefined;
636
+ } | null;
637
+ };
638
+ type LegacyTaskUpdate = {
639
+ title?: string | undefined;
640
+ description?: (string | undefined) | null;
641
+ due_at?: string | undefined;
642
+ status?: ("pending" | "completed") | undefined;
643
+ assigned_to?: (string | undefined) | null;
644
+ };
645
+ type LegacyTask = {
646
+ id: string;
647
+ lead_id: string;
648
+ title: string;
649
+ description?: (string | null) | undefined;
650
+ due_at: string;
651
+ status: "pending" | "completed";
652
+ created_by: string;
653
+ assigned_to?: (string | null) | undefined;
654
+ created_at: string;
655
+ updated_at: string;
656
+ completed_at?: (string | null) | undefined;
657
+ metadata?: {
658
+ [x: string]: any;
659
+ } | undefined;
660
+ created_by_user: {
661
+ id: string;
662
+ full_name?: (string | null) | undefined;
663
+ email?: (string | null) | undefined;
664
+ avatar_url?: (string | null) | undefined;
665
+ } | null;
666
+ assigned_user: {
667
+ id: string;
668
+ full_name?: (string | null) | undefined;
669
+ email?: (string | null) | undefined;
670
+ avatar_url?: (string | null) | undefined;
671
+ } | null;
672
+ is_overdue: boolean;
673
+ is_due_today: boolean;
674
+ };
675
+ type TaskQuery = {
676
+ page?: number;
677
+ pageSize?: number;
678
+ search?: string | undefined;
679
+ status?: ("pending" | "completed") | undefined;
680
+ due_filter?: ("today" | "upcoming" | "overdue") | undefined;
681
+ assigned_to?: string | undefined;
682
+ };
683
+ type Task = {
684
+ id: string;
685
+ lead_id: string;
686
+ title: string;
687
+ description?: (string | null) | undefined;
688
+ due_at: string;
689
+ status: "pending" | "in_progress" | "completed" | "cancelled";
690
+ created_by: string;
691
+ assigned_to?: (string | null) | undefined;
692
+ created_at: string;
693
+ updated_at: string;
694
+ completed_at?: (string | null) | undefined;
695
+ metadata?: {
696
+ [x: string]: any;
697
+ } | undefined;
698
+ created_by_user: {
699
+ id: string;
700
+ full_name?: (string | null) | undefined;
701
+ email?: (string | null) | undefined;
702
+ avatar_url?: (string | null) | undefined;
703
+ } | null;
704
+ assigned_user: {
705
+ id: string;
706
+ full_name?: (string | null) | undefined;
707
+ email?: (string | null) | undefined;
708
+ avatar_url?: (string | null) | undefined;
709
+ } | null;
710
+ is_overdue: boolean;
711
+ is_due_today: boolean;
712
+ task_system: "lead_task" | "crm_activity";
713
+ };
714
+ type ConversationQuery = {
715
+ page?: number;
716
+ limit?: number;
717
+ pageSize?: number;
718
+ search?: string | undefined;
719
+ assignment?: (("me" | "unassigned" | "assigned" | "others") | string) | undefined;
720
+ status?: string | string[];
721
+ channel?: ("whatsapp" | "whatsapp_web" | "messenger" | "instagram" | "email" | "sms" | "webchat" | "website_form" | "voice") | undefined;
722
+ channel_id?: string | string[];
723
+ team_id?: string | string[];
724
+ tags?: string | undefined;
725
+ created_from?: string | undefined;
726
+ created_to?: string | undefined;
727
+ message_from?: string | undefined;
728
+ message_to?: string | undefined;
729
+ unread?: boolean | undefined;
730
+ needs_human_reply?: boolean | undefined;
731
+ exclude_merged?: boolean | undefined;
732
+ exclude_email?: boolean | undefined;
733
+ exclude_groups?: boolean | undefined;
734
+ contact_id?: string | undefined;
735
+ lead_stage?: string | undefined;
736
+ system_audience_id?: string | undefined;
737
+ };
738
+ type ConversationUpdate = {
739
+ assigned_to?: (string | undefined) | null;
740
+ notes?: (string | undefined) | null;
741
+ };
742
+ type Conversation = {
743
+ id: string;
744
+ contact: {
745
+ id: string;
746
+ name: string;
747
+ phone: string;
748
+ mobile?: (string | null) | undefined;
749
+ country?: (string | null) | undefined;
750
+ email?: string | undefined;
751
+ status: "active" | "blocked";
752
+ };
753
+ last_message: {
754
+ content?: string | undefined;
755
+ timestamp?: string | undefined;
756
+ direction?: ("inbound" | "outbound") | undefined;
757
+ status?: ("sent" | "delivered" | "read" | "failed") | undefined;
758
+ };
759
+ assignment: {
760
+ assigned_to?: string | undefined;
761
+ assigned_user_name?: string | undefined;
762
+ assigned_user_email?: string | undefined;
763
+ };
764
+ metadata: {
765
+ conversation_status: ("active" | "blocked" | "archived" | "reopened" | "on_hold") | null;
766
+ statuses?: ("active" | "blocked" | "archived" | "reopened" | "on_hold")[];
767
+ channel: "whatsapp" | "whatsapp_web" | "sms" | "email" | "messenger" | "instagram" | "website_form" | "voice";
768
+ unread_count: number;
769
+ total_message_count: number;
770
+ is_within_24h_window: boolean;
771
+ has_messages: boolean;
772
+ is_new_contact: boolean;
773
+ conversation_type: "active" | "new" | "archived" | "reopened" | "on_hold";
774
+ notes?: string | undefined;
775
+ };
776
+ channel_info: {
777
+ last_inbound_message_at?: string | undefined;
778
+ last_inbound_message_at_channels: {
779
+ [x: string]: string;
780
+ };
781
+ channel_windows: {
782
+ [x: string]: boolean;
783
+ };
784
+ };
785
+ human_agent_state: {
786
+ is_enabled: boolean;
787
+ activated_at: string | null;
788
+ };
789
+ ai_handoff_state: {
790
+ needs_human_reply: boolean;
791
+ reason: string | null;
792
+ since: string | null;
793
+ };
794
+ timestamps: {
795
+ created_at: string;
796
+ updated_at: string;
797
+ };
798
+ recipient_suppressed: boolean;
799
+ recipient_suppression?: ({
800
+ id: string;
801
+ reason: "hard_bounce" | "complaint_reply" | "manual";
802
+ reason_detail: string | null;
803
+ created_at: string;
804
+ } | null) | undefined;
805
+ };
806
+ type MessageQuery = {
807
+ pagination?: ("cursor") | undefined;
808
+ cursor?: string | undefined;
809
+ page?: number;
810
+ pageSize?: number;
811
+ direction?: ("inbound" | "outbound") | undefined;
812
+ channel_id?: string | undefined;
813
+ status?: ("sent" | "delivered" | "read" | "failed") | undefined;
814
+ before?: string | undefined;
815
+ after?: string | undefined;
816
+ };
817
+ type MessageCreate = {
818
+ message?: string | undefined;
819
+ channel?: ("sms" | "whatsapp" | "whatsapp_web" | "email" | "messenger" | "instagram" | "telegram" | "webchat" | "website_form") | undefined;
820
+ channel_id?: string | undefined;
821
+ target_conversation_id?: string | undefined;
822
+ reply_to_id?: string | undefined;
823
+ metadata?: {
824
+ [x: string]: any;
825
+ } | undefined;
826
+ template_id?: string | undefined;
827
+ system_template_id?: string | undefined;
828
+ template_variables?: {
829
+ [x: string]: string;
830
+ } | undefined;
831
+ language_code?: string;
832
+ is_first_message?: boolean | undefined;
833
+ risk_acknowledged?: boolean | undefined;
834
+ subject?: string | undefined;
835
+ cc?: string[] | undefined;
836
+ bcc?: string[] | undefined;
837
+ htmlContent?: string | undefined;
838
+ inlineImages?: {
839
+ id: string;
840
+ fileName: string;
841
+ mimeType: string;
842
+ }[] | undefined;
843
+ tag?: ("HUMAN_AGENT") | undefined;
844
+ messaging_type?: ("MESSAGE_TAG") | undefined;
845
+ };
846
+ type Message = {
847
+ id: string;
848
+ contact: {
849
+ id: string;
850
+ name?: string | undefined;
851
+ phone?: string | undefined;
852
+ avatar?: string | undefined;
853
+ };
854
+ sender: {
855
+ user_id?: string | undefined;
856
+ name?: string | undefined;
857
+ email?: string | undefined;
858
+ avatar?: string | undefined;
859
+ };
860
+ reply: {
861
+ reply_to_id?: string | undefined;
862
+ reply_to_message?: string | undefined;
863
+ reply_to_sender?: string | undefined;
864
+ };
865
+ message: string;
866
+ direction: "inbound" | "outbound";
867
+ channel: "sms" | "whatsapp" | "email" | "messenger" | "instagram" | "website_form" | "voice";
868
+ status: "sent" | "delivered" | "read" | "failed";
869
+ type: "text" | "image" | "video" | "audio" | "document" | "sticker" | "contacts" | "reaction" | "activity";
870
+ message_sid?: string | undefined;
871
+ metadata?: {
872
+ [x: string]: any;
873
+ } | undefined;
874
+ delivered_at?: string | undefined;
875
+ sent_at?: string | undefined;
876
+ failed_at?: string | undefined;
877
+ read_at?: string | undefined;
878
+ failure_reason?: {
879
+ [x: string]: any;
880
+ } | undefined;
881
+ created_at: string;
882
+ updated_at: string;
883
+ reactions?: {
884
+ id: string;
885
+ message_id: string;
886
+ user_id: string;
887
+ emoji: string;
888
+ metadata?: {
889
+ [x: string]: any;
890
+ } | undefined;
891
+ created_at: string;
892
+ user_name?: string | undefined;
893
+ user_email?: string | undefined;
894
+ }[];
895
+ media_files?: {
896
+ id: string;
897
+ original_filename: string;
898
+ file_size: number;
899
+ mime_type: string;
900
+ collection_name: string;
901
+ signed_url: string;
902
+ created_at?: any;
903
+ }[];
904
+ activity?: {
905
+ id: string;
906
+ entity_type: string;
907
+ entity_id: string;
908
+ activity_type: string;
909
+ actor_id?: string | undefined;
910
+ actor?: {
911
+ id: string;
912
+ full_name?: string | undefined;
913
+ email?: string | undefined;
914
+ avatar_url?: string | undefined;
915
+ } | undefined;
916
+ body?: {
917
+ [x: string]: any;
918
+ } | undefined;
919
+ created_at?: string | undefined;
920
+ } | undefined;
921
+ activity_id?: string | undefined;
922
+ };
923
+ type ProductCreate = {
924
+ name: string;
925
+ description?: string | undefined;
926
+ price: number;
927
+ };
928
+ type ProductUpdate = {
929
+ name?: string | undefined;
930
+ description?: (string | undefined) | undefined;
931
+ price?: number | undefined;
932
+ };
933
+ type ProductQuery = {
934
+ page?: string | undefined;
935
+ limit?: string | undefined;
936
+ search?: string | undefined;
937
+ name?: string | undefined;
938
+ price_min?: string | undefined;
939
+ price_max?: string | undefined;
940
+ };
941
+ type Product = {
942
+ id: string;
943
+ name: string;
944
+ description?: string | undefined;
945
+ price: number;
946
+ user_id: string;
947
+ company_id: string;
948
+ created_at: string;
949
+ updated_at: string;
950
+ };
951
+ type TagCreate = {
952
+ name: string;
953
+ color?: string;
954
+ description?: string | undefined;
955
+ entity_type: "contact" | "lead" | "conversation";
956
+ };
957
+ type TagQuery = {
958
+ page?: string | number;
959
+ limit?: string | number;
960
+ search?: string | undefined;
961
+ sort_by?: ("name" | "created_at" | "usage_count") | undefined;
962
+ order?: ("asc" | "desc") | undefined;
963
+ entity_type?: ("contact" | "lead" | "conversation") | undefined;
964
+ };
965
+ type Tag = {
966
+ id: string;
967
+ name: string;
968
+ color: string;
969
+ description?: (string | undefined) | null;
970
+ entity_type: "contact" | "lead" | "conversation";
971
+ created_by: string;
972
+ updated_by?: (string | undefined) | null;
973
+ created_at: string;
974
+ updated_at: string;
975
+ deleted_at?: (string | undefined) | null;
976
+ };
977
+ type TagWithUsage = {
978
+ id: string;
979
+ name: string;
980
+ color: string;
981
+ description?: (string | undefined) | null;
982
+ entity_type: "contact" | "lead" | "conversation";
983
+ created_by: string;
984
+ updated_by?: (string | undefined) | null;
985
+ created_at: string;
986
+ updated_at: string;
987
+ deleted_at?: (string | undefined) | null;
988
+ usage_count: number;
989
+ };
990
+ type TagList = {
991
+ items: {
992
+ id: string;
993
+ name: string;
994
+ color: string;
995
+ description?: (string | undefined) | null;
996
+ entity_type: "contact" | "lead" | "conversation";
997
+ created_by: string;
998
+ updated_by?: (string | undefined) | null;
999
+ created_at: string;
1000
+ updated_at: string;
1001
+ deleted_at?: (string | undefined) | null;
1002
+ usage_count: number;
1003
+ }[];
1004
+ totalCount: number;
1005
+ pageCount: number;
1006
+ currentPage: number;
1007
+ pageSize: number;
1008
+ };
1009
+ interface ListEnvelope<T> {
1010
+ items: T[];
1011
+ totalCount: number;
1012
+ pageCount: number;
1013
+ currentPage: number;
1014
+ pageSize: number;
1015
+ }
1016
+
1017
+ export type { ContactRefUpsertResult as A, LeadCapture as B, ContactQuery as C, LeadNote as D, LeadNoteCreate as E, PartnerContactEraseResult as F, PartnerWorkspaceCreated as G, PartnerWorkspaceDetail as H, PartnerWorkspaceExisting as I, PartnerWorkspacePatchBody as J, PartnerWorkspaceSecret as K, LeadQuery as L, MessageQuery as M, PartnerWorkspaceStatus as N, PartnerWorkspaceUpsertBody as O, ProductQuery as P, TagList as Q, TaskQuery as T, ContactList as a, Contact as b, ContactCreate as c, ContactUpdate as d, ListEnvelope as e, Lead as f, LeadCreate as g, LeadUpdate as h, Task as i, LegacyTaskUpdate as j, LegacyTask as k, Product as l, ProductCreate as m, ProductUpdate as n, ConversationQuery as o, Conversation as p, ConversationUpdate as q, Message as r, MessageCreate as s, TagQuery as t, TagWithUsage as u, TagCreate as v, Tag as w, ContactChanges as x, ContactChangesQuery as y, ContactRefUpsertBody as z };