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