@periskope/types 0.6.13 → 0.6.14-5.2

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.
package/types.ts CHANGED
@@ -1,26 +1,123 @@
1
+ import type { default as _Stripe } from 'stripe';
1
2
  import { Merge, OverrideProperties } from 'type-fest';
2
- import { Chat, MessageTypes } from 'whatsapp-web.js';
3
- import { Tables } from './supabase.types';
3
+ import { Tables, TablesUpdate } from './supabase.types';
4
4
 
5
5
  /* ----------------------------- TYPE SHORTHANDS ---------------------------- */
6
6
 
7
- /* ------------------------------ WHATSAPP ------------------------------ */
7
+ /* ------------------------------ PERISKOPE TYPES ------------------------------ */
8
+
9
+ export enum AllPlans {
10
+ FREE_TRIAL = 'free-trial',
11
+ // MONTHLY_STARTER = 'monthly-starter',
12
+ // YEARLY_STARTER = 'yearly-starter',
13
+ // MONTHLY_PRO = 'monthly-pro',
14
+ // YEARLY_PRO = 'yearly-pro',
15
+ ENTERPRISE = 'enterprise',
16
+ MONTHLY_STARTER_SINGLE = 'monthly-starter-single',
17
+ YEARLY_STARTER_SINGLE = 'yearly-starter-single',
18
+ MONTHLY_PRO_SINGLE = 'monthly-pro-single',
19
+ YEARLY_PRO_SINGLE = 'yearly-pro-single',
20
+ }
21
+
22
+ export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
23
+
24
+ export type Enterprise = `${string}-enterprise`;
8
25
 
9
- export type WhatsappChat = Chat & {
10
- groupMetadata?: any;
11
- pinned?: boolean;
12
- invite_link?: string;
26
+ export type OrgPlanEnterprise = {
27
+ subscription_id: string;
28
+ plan_id: Enterprise;
29
+ interval: number;
30
+ frequency: Frequency;
31
+ user_limit: number;
32
+ phone_limit: number;
33
+ current_period_start: number;
34
+ current_period_end: number | null;
13
35
  };
14
36
 
15
- /* ------------------------------ PERISKOPE TYPES ------------------------------ */
37
+ export type OrgPlanNonEnterprise = {
38
+ subscription_id: string;
39
+ plan_id: AllPlans;
40
+ interval: number;
41
+ frequency: Frequency;
42
+ user_limit: number;
43
+ phone_limit: number;
44
+ current_period_end: number;
45
+ current_period_start: number;
46
+ };
47
+
48
+ export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise
49
+ ? OrgPlanEnterprise
50
+ : T extends AllPlans
51
+ ? OrgPlanNonEnterprise
52
+ : never;
53
+
54
+ export type MicrosurveyData = {
55
+ key: string;
56
+ text: string;
57
+ checked: boolean;
58
+ }[];
16
59
 
17
- export type OrgType = Tables<'tbl_org'> & {
18
- user: Tables<'tbl_org_members'>;
19
- members: Tables<'tbl_org_members'>[];
20
- phones: Tables<'tbl_org_phones'>[];
21
- labels: Tables<'tbl_org_labels'>[];
60
+ export type OrgPreferences = {
61
+ disable_ai_flagging?: boolean;
62
+ disable_allow_exports?: boolean;
63
+ sync_phone_contacts?: boolean;
64
+ mask_phone_numbers?: boolean;
65
+ show_sender_names?: boolean;
22
66
  };
23
67
 
68
+ type OrgPreferenceKey = keyof OrgPreferences;
69
+
70
+ export type OrgPreferencesValue = {
71
+ [K in OrgPreferenceKey]: { key: K; value: OrgPreferences[K] };
72
+ }[OrgPreferenceKey];
73
+
74
+ export type OrgMetadata = {
75
+ phone_number: string;
76
+ ticket_prefix: string;
77
+ referralSource?: string;
78
+ surveyData?: MicrosurveyData;
79
+ preferences?: OrgPreferences;
80
+ hubspot_pipelines?: {
81
+ id: string;
82
+ label: string;
83
+ default_stage: { id: string; label: string };
84
+ }[];
85
+ partition?: boolean;
86
+ };
87
+
88
+ type AccessScopes = {
89
+ integrations: boolean;
90
+ exports: boolean;
91
+ };
92
+
93
+ export type OrgType = OverrideProperties<
94
+ Merge<
95
+ Tables<'tbl_org'>,
96
+ {
97
+ user: Tables<'tbl_org_members'>;
98
+ members: Tables<'tbl_org_members'>[];
99
+ phones: Tables<'tbl_org_phones'>[];
100
+ labels: Tables<'tbl_org_labels'>[];
101
+ quick_replies: Tables<'tbl_quick_replies'>[];
102
+ custom_properties: Tables<'tbl_custom_properties'>[];
103
+ subscription_status: 'active' | 'inactive' | 'unpaid';
104
+ is_enterprise: boolean;
105
+ is_free_trial: boolean;
106
+ is_hubspot_connected: boolean;
107
+ is_freshdesk_connected: boolean;
108
+ is_zohodesk_connected: boolean;
109
+ access_scopes: AccessScopes;
110
+ }
111
+ >,
112
+ {
113
+ org_plan: OrgPlan<AllPlans | Enterprise>;
114
+ stripe_customer_details: _Stripe.Customer | null;
115
+ stripe_subscription_details: Array<_Stripe.Subscription> | null;
116
+ stripe_customer_id: _Stripe.Customer['id'] | null;
117
+ org_metadata: OrgMetadata;
118
+ }
119
+ >;
120
+
24
121
  export type ChatMemberType = Merge<
25
122
  Tables<'tbl_chat_participants'>,
26
123
  Tables<'tbl_contacts'>
@@ -31,26 +128,98 @@ export type ChatType = Merge<
31
128
  {
32
129
  chat_id: string;
33
130
  latest_message: MessageType | null;
34
- members: Record<string, ChatMemberType> | null;
35
- chat_type: 'user' | 'group' | 'business';
36
- active_phone?: string;
37
- chat_access: Record<string, boolean>;
38
- label_ids: Record<string, boolean>;
131
+ latest_message_timestamp: number | null;
132
+ members: { [key: string]: ChatMemberType } | null;
133
+ chat_type: 'user' | 'group' | 'business' | 'unknown';
134
+ chat_access: { [key: string]: boolean };
135
+ label_ids: { [key: string]: boolean };
39
136
  chat_org_phones?: string[];
137
+ message_unread_count: number | null;
138
+ hubspot_metadata: {
139
+ id: string;
140
+ type: string;
141
+ hubId: string;
142
+ object_data: HubspotObjectDataType;
143
+ } | null;
144
+ info_admins_only: boolean;
145
+ messages_admins_only: boolean;
146
+ unread_count?: { [key: string]: number };
147
+ active_phone: string | null;
148
+ flag_count_map?: { [key: string]: number };
149
+ pin?: boolean;
40
150
  }
41
151
  >;
42
152
 
153
+ /* -------------------------------------------------------------------------- */
154
+ /* MESSAGE */
155
+ /* -------------------------------------------------------------------------- */
156
+
43
157
  export type MediaType = {
44
158
  path: string;
45
- mimetype: string | null;
46
- filename: string | null;
159
+ mimetype?: string;
160
+ filename?: string;
161
+ dimensions?: { width: number; height: number; ar: number };
162
+ size?: number;
163
+ thumbnail?: string;
47
164
  };
48
165
 
49
- export type MessageType = OverrideProperties<
50
- Tables<'tbl_chat_messages'>,
166
+ export type MessageType = Merge<
167
+ OverrideProperties<
168
+ Tables<'tbl_chat_messages'>,
169
+ {
170
+ message_id: string;
171
+ org_id: string;
172
+ org_phone: string;
173
+ chat_id: string;
174
+ message_type: (typeof SUPPORTED_TYPES)[number];
175
+ media: MediaType | null;
176
+ flag_metadata: MessageFlagType | null;
177
+ poll_info?: PollSendType | null;
178
+ poll_results?: PollResultType | null;
179
+ delivery_info?: DeliveryInfoType | null;
180
+ }
181
+ >,
51
182
  {
52
- message_type: MessageTypes;
53
- media: MediaType | null;
183
+ reactions?: ReactionType[];
184
+ message_payload?: SingleMessagePayload;
185
+ show_unread?: boolean;
186
+ highlight?: number;
187
+ }
188
+ >;
189
+
190
+ export type MessageFlagType = {
191
+ status: boolean;
192
+ response_type?: 'message' | 'reaction' | 'ticket' | 'manual';
193
+ response_id?: string;
194
+ response_timestamp?: string;
195
+ response_email?: string;
196
+ };
197
+
198
+ /* -------------------------------------------------------------------------- */
199
+
200
+ export type TicketType = OverrideProperties<
201
+ Tables<'tbl_chat_tickets'>,
202
+ {
203
+ label_ids: { [key: string]: boolean };
204
+ hubspot_metadata: {
205
+ id?: string;
206
+ type?: string;
207
+ hubId?: string;
208
+ pipeline: {
209
+ id: string;
210
+ label: string;
211
+ };
212
+ object_data?: HubspotObjectDataType;
213
+ } | null;
214
+ freshdesk_metadata: Record<string, string>;
215
+ close_ticket_metadata?:
216
+ | {
217
+ closed_by: string;
218
+ closed_at: string;
219
+ closed_message?: string | null;
220
+ send_reply_message_id?: string | null;
221
+ }
222
+ | any;
54
223
  }
55
224
  >;
56
225
 
@@ -58,22 +227,21 @@ export type ContactType = Merge<
58
227
  Tables<'tbl_contacts'>,
59
228
  {
60
229
  chats: ChatType[] | null;
61
- chat_count: number | null;
62
- chat_ids: string[] | null;
230
+ chat_ids?: string[];
63
231
  }
64
232
  >;
233
+ export type ReactionType = Tables<'tbl_chat_reactions'>;
234
+
235
+ export type NotificationType = Tables<'tbl_chat_notifications'>;
65
236
 
66
237
  export type ChatAccessType = Merge<
67
- Partial<Tables<'tbl_chat_access'>>,
68
- Tables<'tbl_org_members'>
238
+ TablesUpdate<'tbl_org_members'>,
239
+ {
240
+ has_access?: boolean;
241
+ email: string | null;
242
+ }
69
243
  >;
70
244
 
71
- export type ServerStateType = {
72
- loading: boolean;
73
- percent: number | null;
74
- ready: boolean;
75
- };
76
-
77
245
  /* -------------------------------- CONSTANTS ------------------------------- */
78
246
 
79
247
  export const labelColors = [
@@ -101,3 +269,476 @@ export const enumChatColors = [
101
269
  '#FF2E74',
102
270
  '#DB2777',
103
271
  ] as const;
272
+
273
+ /* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
274
+
275
+ export const SUPPORTED_TYPES = [
276
+ 'chat',
277
+ 'sticker',
278
+ 'image',
279
+ 'video',
280
+ 'document',
281
+ 'vcard',
282
+ 'multi_vcard',
283
+ 'audio',
284
+ 'ptt',
285
+ 'poll_creation',
286
+ 'location',
287
+ 'ciphertext',
288
+ ] as const;
289
+
290
+ export type SendMessageContent = {
291
+ message_type?: (typeof SUPPORTED_TYPES)[number];
292
+ body?: string;
293
+ media?: MediaType;
294
+ contact_ids?: string[];
295
+ location?: {
296
+ latitude: string;
297
+ longitude: string;
298
+ options?: { name?: string; address?: string; url?: string };
299
+ };
300
+ poll?: PollSendType;
301
+ quoted_message_id?: string;
302
+ quoted_message_type?: 'reply' | 'forward' | 'reply_private';
303
+ broadcast_id?: string;
304
+ performed_by?: string;
305
+ };
306
+
307
+ export type QuickReplyContent = Omit<
308
+ SendMessageContent,
309
+ 'broadcast_id' | 'variables'
310
+ >;
311
+
312
+ export type BroadcastVariableType = {
313
+ chat_id: string;
314
+ values: { [key: string]: string };
315
+ };
316
+
317
+ export type BroadcastMessagePayload = SendMessageContent & {
318
+ chat_ids: string[];
319
+ broadcast_id?: string;
320
+ variables?: BroadcastVariableType[];
321
+ };
322
+
323
+ export type SingleMessagePayload = SendMessageContent & {
324
+ chat_id: string;
325
+ job_id?: string;
326
+ };
327
+
328
+ export type MessageAttachmentFileTypes =
329
+ | 'image'
330
+ | 'audio'
331
+ | 'document'
332
+ | 'video';
333
+
334
+ export type AttachmentFileType = {
335
+ result: string;
336
+ file: File | null;
337
+ type: MessageAttachmentFileTypes;
338
+ localFileURL?: string;
339
+ };
340
+
341
+ export type AttachmentLinkType = {
342
+ link: {
343
+ url: string;
344
+ type: MessageAttachmentFileTypes;
345
+ name: string;
346
+ mimetype?: string;
347
+ };
348
+ };
349
+
350
+ export type AttachmentTypeProps = AttachmentFileType | AttachmentLinkType;
351
+
352
+ /* -------------------------------- BROADCAST ------------------------------- */
353
+
354
+ export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
355
+ logs: (Tables<'tbl_broadcast_logs'> & Partial<ChatType>)[];
356
+ } & {
357
+ chats: ChatType[];
358
+ };
359
+
360
+ /* ----------------------- CHAT PARTICIPANT OPERATION ----------------------- */
361
+
362
+ export type ChatLogType = {
363
+ log: Tables<'view_chat_logs'>;
364
+ operations: Tables<'tbl_chat_logs'>[];
365
+ };
366
+ export type ChatOperationsType = 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
367
+
368
+ export type ChatParticipantOperationPayload = {
369
+ participant_ids: string[];
370
+ chat_ids: string[];
371
+ performed_by: string;
372
+ };
373
+
374
+ export type ChatOperationReturn = {
375
+ [participant_id: string]: {
376
+ is_success: boolean;
377
+ message?: string;
378
+ code?: number;
379
+ isInviteV4Sent?: boolean;
380
+ };
381
+ };
382
+
383
+ /* ----------------------- BILLING - STRIPE ----------------------- */
384
+
385
+ export type StripeSubscription = _Stripe.Subscription;
386
+ export type StripeCustomer = _Stripe.Customer;
387
+ export type StripeCoupon = _Stripe.Coupon;
388
+ export type StripePrice = _Stripe.Price;
389
+ export type Stripe = _Stripe;
390
+ export type StripeUpcomingInvoice = _Stripe.UpcomingInvoice;
391
+ export type StripeLineItem = _Stripe.Checkout.SessionCreateParams.LineItem;
392
+
393
+ /* -------------------------------- REALTIME -------------------------------- */
394
+
395
+ export type PhoneStateType = {
396
+ loading: boolean;
397
+ state: string;
398
+ sync: number;
399
+ percent: number | null;
400
+ message?: string;
401
+ error?: string;
402
+ };
403
+
404
+ /* ------------------------------- INTEGRATIONS ----------------------------- */
405
+
406
+ export type ChatInfoType = Merge<
407
+ ChatType,
408
+ {
409
+ members: {
410
+ [key: string]: Merge<ChatMemberType, { contact_labels: string }>;
411
+ } | null;
412
+ chat_labels: string | null;
413
+ custom_properties: { [key: string]: string } | null;
414
+ }
415
+ >;
416
+
417
+ export type TicketInfoType = {
418
+ chat: ChatInfoType;
419
+ message: {
420
+ body: string;
421
+ chat_id: string;
422
+ org_phone: string;
423
+ timestamp: string;
424
+ media_path: string;
425
+ message_id: string;
426
+ sender_name: string;
427
+ performed_by: string;
428
+ sender_phone: string;
429
+ };
430
+ ticket: {
431
+ org_id: string;
432
+ status: string;
433
+ subject: string;
434
+ assignee: string;
435
+ due_date: string;
436
+ priority: 0 | 1 | 2 | 3 | 4;
437
+ raised_by: string;
438
+ ticket_id: string;
439
+ created_at: string;
440
+ assigned_by: string;
441
+ ticket_labels: string;
442
+ quoted_message_id: string;
443
+ ticket_custom_properties: { [key: string]: string } | null;
444
+ };
445
+ };
446
+
447
+ export type IntegrationLogObjectType =
448
+ | 'chat'
449
+ | 'message'
450
+ | 'reaction'
451
+ | 'ticket';
452
+
453
+ export enum IntegrationLogType {
454
+ NEW_CHAT = 'chat.created',
455
+ NEW_CHAT_NOTIFICATION = 'chat.notification.created',
456
+ NEW_MESSAGE = 'message.created',
457
+ MESSAGE_UPDATED = 'message.updated',
458
+ MESSAGE_DELETED = 'message.deleted',
459
+ MESSAGE_ACK_UPDATED = 'message.ack.updated',
460
+ REACTION_CREATED = 'reaction.created',
461
+ REACTION_UPDATED = 'reaction.updated',
462
+ NEW_TICKET = 'ticket.created',
463
+ TICKET_UPDATED = 'ticket.updated',
464
+ TICKET_DELETED = 'ticket.deleted',
465
+ }
466
+
467
+ export type IntegrationLogMetadataType<T extends IntegrationLogType> =
468
+ T extends IntegrationLogType.NEW_TICKET | IntegrationLogType.TICKET_UPDATED
469
+ ? TicketInfoType
470
+ : T extends IntegrationLogType.NEW_CHAT
471
+ ? Tables<'tbl_chats'>
472
+ : T extends
473
+ | IntegrationLogType.NEW_MESSAGE
474
+ | IntegrationLogType.MESSAGE_UPDATED
475
+ | IntegrationLogType.MESSAGE_DELETED
476
+ | IntegrationLogType.MESSAGE_ACK_UPDATED
477
+ ? Tables<'tbl_chat_messages'>
478
+ : T extends
479
+ | IntegrationLogType.REACTION_CREATED
480
+ | IntegrationLogType.REACTION_UPDATED
481
+ ? Tables<'tbl_chat_reactions'>
482
+ : {
483
+ [key: string]: unknown;
484
+ };
485
+
486
+ export type IntegrationLogDetailsType<T extends IntegrationLogType> =
487
+ OverrideProperties<
488
+ Tables<'tbl_integration_logs'>,
489
+ {
490
+ integration_name: T;
491
+ metadata: {
492
+ event: IntegrationLogMetadataType<T> & {
493
+ event_type: string;
494
+ org_id: string;
495
+ previous_attributes: {
496
+ [key: string]: unknown;
497
+ };
498
+ };
499
+ hook_id: string;
500
+ name: string;
501
+ };
502
+ }
503
+ >;
504
+
505
+ export type APIAuthDetails = {
506
+ org_details: Tables<'view_org'> | null;
507
+ phone_details: Tables<'tbl_org_phones'> | null;
508
+ token_details: Tables<'tbl_integration_tokens'> | null;
509
+ };
510
+
511
+ export type WebhookDataType = OverrideProperties<
512
+ Tables<'tbl_integration_hooks'>,
513
+ {
514
+ integration_name: string[];
515
+ }
516
+ >;
517
+
518
+ export type HubspotObjectDataType = {
519
+ createdAt: string;
520
+ archived: boolean;
521
+ id: string;
522
+ type: 'contacts' | 'tickets' | 'companies';
523
+ properties: Record<
524
+ string,
525
+ {
526
+ groupLabel: string;
527
+ groupName: string;
528
+ propertyKeyName: string;
529
+ propertyKey: string;
530
+ propertyInternalValue: string;
531
+ propertyValue: string;
532
+ propertyType: string;
533
+ propertyFieldType: string;
534
+ }[]
535
+ >;
536
+ };
537
+
538
+ /* ---------------------------- USER PREFERENCES ---------------------------- */
539
+
540
+ export type UserPreferences = {
541
+ theme: 'light' | 'dark';
542
+ language: 'en' | 'es';
543
+ left_sidebar_open: boolean;
544
+ right_sidepanel_open: boolean;
545
+ sync_wa_unread_count: boolean;
546
+ pinned_chats: string[];
547
+ };
548
+
549
+ /* ----------------------------- POLL VOTE INFO ----------------------------- */
550
+
551
+ export type PollSendType = {
552
+ pollName: string;
553
+ pollOptions: string[];
554
+ options?: {
555
+ allowMultipleAnswers?: boolean;
556
+ messageSecret?: number[] | null;
557
+ pollId?: string;
558
+ };
559
+ };
560
+
561
+ export type PollResultType = {
562
+ [name: string]: Record<string, string>;
563
+ };
564
+
565
+ /* -------------------------- CREATE GROUP OPTIONS -------------------------- */
566
+
567
+ export type CreateGroupOptions = {
568
+ messagesAdminsOnly?: boolean;
569
+ infoAdminsOnly?: boolean;
570
+ memberAddMode?: boolean;
571
+ image?: string;
572
+ name?: string;
573
+ description?: string;
574
+ };
575
+
576
+ /* ------------------------------ DELIVERY INFO ----------------------------- */
577
+
578
+ export type DeliveryInfoType = {
579
+ delivered: Record<string, number | undefined>;
580
+ read: Record<string, number | undefined>;
581
+ pending: string[];
582
+ read_count: number;
583
+ delivered_count: number;
584
+ };
585
+
586
+ /* ---------------------------- CREDITS SYSTEM ---------------------------- */
587
+
588
+ export type OrgCreditsType = {
589
+ org_id: string;
590
+ recurring_allowance: number; // recurring credits replenished every month
591
+ recurring_balance: number; // recurring credits remaining in current month
592
+ topup_balance: number; // topup credits remaining
593
+ total_credits_used: number; // total credits used in current month
594
+ next_renewal_date: string;
595
+ };
596
+
597
+ /* --------------------------------- RULE INFO TYPE -------------------------------- */
598
+
599
+ export type ChatRuleInfoType = Merge<
600
+ Pick<
601
+ Tables<'view_chats'>,
602
+ | 'assigned_to'
603
+ | 'chat_id'
604
+ | 'chat_name'
605
+ | 'chat_type'
606
+ | 'created_at'
607
+ | 'group_description'
608
+ | 'info_admins_only'
609
+ | 'is_archived'
610
+ | 'is_exited'
611
+ | 'is_muted'
612
+ | 'org_id'
613
+ | 'org_phone'
614
+ | 'chat_org_phones'
615
+ | 'messages_admins_only'
616
+ | 'custom_properties'
617
+ >,
618
+ {
619
+ has_flagged_messages: boolean;
620
+ labels: string[];
621
+ members: string[];
622
+ custom_properties: { [key: string]: string } | null;
623
+ }
624
+ >;
625
+
626
+ export type SenderRuleInfoType = Merge<
627
+ Omit<
628
+ Merge<Tables<'tbl_contacts'>, Tables<'tbl_chat_participants'>>,
629
+ | 'verified_name'
630
+ | 'verified_level'
631
+ | 'updated_at'
632
+ | 'short_name'
633
+ | 'pushname'
634
+ | 'periskope_name'
635
+ | 'org_phone'
636
+ | 'number'
637
+ | 'name'
638
+ | 'label_ids'
639
+ | 'is_wa_contact'
640
+ | 'is_user'
641
+ | 'is_my_contact'
642
+ | 'is_me'
643
+ | 'is_imported'
644
+ | 'is_group'
645
+ | 'is_blocked'
646
+ | 'contact_color'
647
+ | 'business_profile'
648
+ | 'id'
649
+ | 'contact_image'
650
+ | 'contact_type'
651
+ | 'chat_id'
652
+ >,
653
+ {
654
+ is_internal: boolean;
655
+ labels: string[] | null;
656
+ }
657
+ >;
658
+
659
+ export type MessageRuleInfoType = {
660
+ chat: ChatRuleInfoType;
661
+ sender: SenderRuleInfoType;
662
+ message: OverrideProperties<
663
+ Omit<
664
+ Tables<'tbl_chat_messages'>,
665
+ | 'vcards'
666
+ | 'updated_at'
667
+ | 'unique_id'
668
+ | 'token'
669
+ | 'to'
670
+ | 'sent_message_id'
671
+ | 'raw_data'
672
+ | 'delivery_info'
673
+ | 'poll_results'
674
+ | 'poll_info'
675
+ | 'order_id'
676
+ | 'mentioned_ids'
677
+ | 'media_key'
678
+ | 'location'
679
+ | 'links'
680
+ | 'is_status'
681
+ | 'is_starred'
682
+ | 'is_gif'
683
+ | 'is_forwarded'
684
+ | 'is_ephemeral'
685
+ | 'is_deleted'
686
+ | 'fts'
687
+ | 'quoted_message_id'
688
+ | 'invite_v4'
689
+ | 'id'
690
+ | 'has_reaction'
691
+ | 'has_media'
692
+ | 'duration'
693
+ | 'broadcast'
694
+ | 'broadcast_id'
695
+ | 'device_type'
696
+ | 'forwarding_score'
697
+ | 'from'
698
+ | 'from_me'
699
+ | 'message_ticket_id'
700
+ | 'prev_body'
701
+ | 'flag_response_time'
702
+ | 'flag_metadata'
703
+ >,
704
+ {
705
+ media: MediaType | null;
706
+ }
707
+ >;
708
+ };
709
+
710
+ export type ReactionRuleInfoType = {
711
+ chat: ChatRuleInfoType;
712
+ sender: SenderRuleInfoType;
713
+ message: MessageRuleInfoType['message'];
714
+ reaction: Pick<
715
+ Tables<'tbl_chat_reactions'>,
716
+ 'reaction' | 'sender_id' | 'message_id' | 'chat_id' | 'reaction_id'
717
+ >;
718
+ };
719
+
720
+ export type TicketRuleInfoType = {
721
+ chat: ChatRuleInfoType;
722
+ sender: SenderRuleInfoType;
723
+ ticket: Merge<
724
+ Pick<
725
+ Tables<'tbl_chat_tickets'>,
726
+ | 'org_id'
727
+ | 'status'
728
+ | 'chat_id'
729
+ | 'subject'
730
+ | 'assignee'
731
+ | 'due_date'
732
+ | 'priority'
733
+ | 'raised_by'
734
+ | 'ticket_id'
735
+ | 'created_at'
736
+ | 'is_deleted'
737
+ >,
738
+ {
739
+ labels: string[] | null;
740
+ custom_properties: { [key: string]: string } | null;
741
+ }
742
+ >;
743
+ message: MessageRuleInfoType['message'];
744
+ };