@periskope/types 0.6.39 → 0.6.40

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,5 +1,5 @@
1
1
  import { Merge, OverrideProperties } from 'type-fest';
2
- import { Chat, Location, MessageInfo, MessageTypes } from 'whatsapp-web.js';
2
+ import { Chat, Location, MessageInfo } from 'whatsapp-web.js';
3
3
  import { Tables } from './supabase.types';
4
4
 
5
5
  /* ----------------------------- TYPE SHORTHANDS ---------------------------- */
@@ -33,10 +33,10 @@ export type ChatType = Merge<
33
33
  latest_message: MessageType | null;
34
34
  members: Record<string, ChatMemberType> | null;
35
35
  chat_type: 'user' | 'group' | 'business' | 'unknown';
36
- active_phone?: string;
37
36
  chat_access: Record<string, boolean>;
38
37
  label_ids: Record<string, boolean>;
39
38
  chat_org_phones?: string[];
39
+ message_unread_count: number | null;
40
40
  }
41
41
  >;
42
42
 
@@ -48,9 +48,13 @@ export type MediaType = {
48
48
  };
49
49
 
50
50
  export type MessageType = OverrideProperties<
51
- Tables<'tbl_chat_messages'>,
51
+ Tables<'view_chat_messages'>,
52
52
  {
53
- message_type: MessageTypes;
53
+ message_id: string;
54
+ org_id: string;
55
+ org_phone: string;
56
+ chat_id: string;
57
+ message_type: typeof SUPPORTED_TYPES[number];
54
58
  media: MediaType | null;
55
59
  }
56
60
  >;
@@ -65,9 +69,11 @@ export type ContactType = Merge<
65
69
  {
66
70
  chats: ChatType[] | null;
67
71
  chat_count: number | null;
68
- chat_ids: string[] | null;
69
72
  }
70
73
  >;
74
+ export type ReactionType = Tables<'tbl_chat_reactions'>;
75
+
76
+ export type NotificationType = Tables<'tbl_chat_notifications'>;
71
77
 
72
78
  export type ChatAccessType = Merge<
73
79
  Partial<Tables<'tbl_chat_access'>>,
@@ -104,17 +110,21 @@ export const enumChatColors = [
104
110
 
105
111
  /* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
106
112
 
113
+ export const SUPPORTED_TYPES = [
114
+ 'chat',
115
+ 'sticker',
116
+ 'image',
117
+ 'video',
118
+ 'document',
119
+ 'vcard',
120
+ 'multi_vcard',
121
+ 'audio',
122
+ 'ptt',
123
+ 'poll_creation',
124
+ ] as const;
125
+
107
126
  export type SendMessageContent = {
108
- message_type?:
109
- | 'chat'
110
- | 'audio'
111
- | 'ptt'
112
- | 'image'
113
- | 'video'
114
- | 'document'
115
- | 'sticker'
116
- | 'location'
117
- | 'vcard';
127
+ message_type?: typeof SUPPORTED_TYPES[number];
118
128
  body?: string;
119
129
  media?: MediaType;
120
130
  contact_ids?: string[];