@periskope/types 0.6.38 → 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
 
@@ -44,12 +44,17 @@ export type MediaType = {
44
44
  path: string;
45
45
  mimetype?: string;
46
46
  filename?: string;
47
+ dimensions?: { width: number; height: number; ar: number };
47
48
  };
48
49
 
49
50
  export type MessageType = OverrideProperties<
50
- Tables<'tbl_chat_messages'>,
51
+ Tables<'view_chat_messages'>,
51
52
  {
52
- 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];
53
58
  media: MediaType | null;
54
59
  }
55
60
  >;
@@ -64,9 +69,11 @@ export type ContactType = Merge<
64
69
  {
65
70
  chats: ChatType[] | null;
66
71
  chat_count: number | null;
67
- chat_ids: string[] | null;
68
72
  }
69
73
  >;
74
+ export type ReactionType = Tables<'tbl_chat_reactions'>;
75
+
76
+ export type NotificationType = Tables<'tbl_chat_notifications'>;
70
77
 
71
78
  export type ChatAccessType = Merge<
72
79
  Partial<Tables<'tbl_chat_access'>>,
@@ -103,17 +110,21 @@ export const enumChatColors = [
103
110
 
104
111
  /* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
105
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
+
106
126
  export type SendMessageContent = {
107
- message_type?:
108
- | 'chat'
109
- | 'audio'
110
- | 'ptt'
111
- | 'image'
112
- | 'video'
113
- | 'document'
114
- | 'sticker'
115
- | 'location'
116
- | 'vcard';
127
+ message_type?: typeof SUPPORTED_TYPES[number];
117
128
  body?: string;
118
129
  media?: MediaType;
119
130
  contact_ids?: string[];