@periskope/types 0.6.67 → 0.6.69

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.
@@ -29,34 +29,101 @@ export type Database = {
29
29
  };
30
30
  public: {
31
31
  Tables: {
32
+ tbl_broadcast_logs: {
33
+ Row: {
34
+ broadcast_id: string;
35
+ chat_id: string;
36
+ completed_at: string | null;
37
+ created_at: string;
38
+ delivered_count: number | null;
39
+ delivery_info: Json | null;
40
+ is_success: boolean | null;
41
+ member_count: number | null;
42
+ message_id: string | null;
43
+ org_id: string;
44
+ org_phone: string | null;
45
+ read_count: number | null;
46
+ };
47
+ Insert: {
48
+ broadcast_id: string;
49
+ chat_id: string;
50
+ completed_at?: string | null;
51
+ created_at?: string;
52
+ delivered_count?: number | null;
53
+ delivery_info?: Json | null;
54
+ is_success?: boolean | null;
55
+ member_count?: number | null;
56
+ message_id?: string | null;
57
+ org_id: string;
58
+ org_phone?: string | null;
59
+ read_count?: number | null;
60
+ };
61
+ Update: {
62
+ broadcast_id?: string;
63
+ chat_id?: string;
64
+ completed_at?: string | null;
65
+ created_at?: string;
66
+ delivered_count?: number | null;
67
+ delivery_info?: Json | null;
68
+ is_success?: boolean | null;
69
+ member_count?: number | null;
70
+ message_id?: string | null;
71
+ org_id?: string;
72
+ org_phone?: string | null;
73
+ read_count?: number | null;
74
+ };
75
+ Relationships: [
76
+ {
77
+ foreignKeyName: "tbl_broadcast_logs_broadcast_id_fkey";
78
+ columns: ["broadcast_id"];
79
+ isOneToOne: false;
80
+ referencedRelation: "tbl_broadcast_messages";
81
+ referencedColumns: ["broadcast_id"];
82
+ },
83
+ {
84
+ foreignKeyName: "tbl_broadcast_logs_broadcast_id_fkey";
85
+ columns: ["broadcast_id"];
86
+ isOneToOne: false;
87
+ referencedRelation: "view_broadcast_logs";
88
+ referencedColumns: ["broadcast_id"];
89
+ },
90
+ {
91
+ foreignKeyName: "tbl_broadcast_logs_org_id_fkey";
92
+ columns: ["org_id"];
93
+ isOneToOne: false;
94
+ referencedRelation: "tbl_org";
95
+ referencedColumns: ["org_id"];
96
+ }
97
+ ];
98
+ };
32
99
  tbl_broadcast_messages: {
33
100
  Row: {
34
101
  broadcast_id: string;
35
102
  chat_ids: string[] | null;
36
- completed_at: string | null;
37
103
  created_at: string;
38
104
  message_payload: Json | null;
39
105
  org_id: string;
106
+ performed_at: string | null;
40
107
  performed_by: string | null;
41
108
  scheduled_at: string | null;
42
109
  };
43
110
  Insert: {
44
111
  broadcast_id?: string;
45
112
  chat_ids?: string[] | null;
46
- completed_at?: string | null;
47
113
  created_at?: string;
48
114
  message_payload?: Json | null;
49
115
  org_id: string;
116
+ performed_at?: string | null;
50
117
  performed_by?: string | null;
51
118
  scheduled_at?: string | null;
52
119
  };
53
120
  Update: {
54
121
  broadcast_id?: string;
55
122
  chat_ids?: string[] | null;
56
- completed_at?: string | null;
57
123
  created_at?: string;
58
124
  message_payload?: Json | null;
59
125
  org_id?: string;
126
+ performed_at?: string | null;
60
127
  performed_by?: string | null;
61
128
  scheduled_at?: string | null;
62
129
  };
@@ -112,6 +179,7 @@ export type Database = {
112
179
  email: string;
113
180
  has_access: boolean | null;
114
181
  last_read_timestamp: string | null;
182
+ message_unread_count: number | null;
115
183
  org_id: string;
116
184
  };
117
185
  Insert: {
@@ -120,6 +188,7 @@ export type Database = {
120
188
  email: string;
121
189
  has_access?: boolean | null;
122
190
  last_read_timestamp?: string | null;
191
+ message_unread_count?: number | null;
123
192
  org_id: string;
124
193
  };
125
194
  Update: {
@@ -128,6 +197,7 @@ export type Database = {
128
197
  email?: string;
129
198
  has_access?: boolean | null;
130
199
  last_read_timestamp?: string | null;
200
+ message_unread_count?: number | null;
131
201
  org_id?: string;
132
202
  };
133
203
  Relationships: [
@@ -380,16 +450,30 @@ export type Database = {
380
450
  isOneToOne: false;
381
451
  referencedRelation: "tbl_chats";
382
452
  referencedColumns: ["org_id", "org_phone", "chat_id"];
383
- },
384
- {
385
- foreignKeyName: "tbl_chat_participants_fkey_tbl_chats";
386
- columns: ["org_id", "org_phone", "chat_id"];
387
- isOneToOne: false;
388
- referencedRelation: "view_chats";
389
- referencedColumns: ["org_id", "org_phone", "chat_id"];
390
453
  }
391
454
  ];
392
455
  };
456
+ tbl_chat_properties: {
457
+ Row: {
458
+ chat_id: string;
459
+ custom_properties: Json | null;
460
+ label_ids: Json | null;
461
+ org_id: string;
462
+ };
463
+ Insert: {
464
+ chat_id: string;
465
+ custom_properties?: Json | null;
466
+ label_ids?: Json | null;
467
+ org_id: string;
468
+ };
469
+ Update: {
470
+ chat_id?: string;
471
+ custom_properties?: Json | null;
472
+ label_ids?: Json | null;
473
+ org_id?: string;
474
+ };
475
+ Relationships: [];
476
+ };
393
477
  tbl_chat_reactions: {
394
478
  Row: {
395
479
  ack: number | null;
@@ -981,6 +1065,7 @@ export type Database = {
981
1065
  invited_at: string | null;
982
1066
  invited_by: string | null;
983
1067
  is_active: boolean;
1068
+ is_owner: boolean | null;
984
1069
  label_ids: string[] | null;
985
1070
  member_color: Database["public"]["Enums"]["enum_chat_colors"];
986
1071
  member_image: string | null;
@@ -996,6 +1081,7 @@ export type Database = {
996
1081
  invited_at?: string | null;
997
1082
  invited_by?: string | null;
998
1083
  is_active?: boolean;
1084
+ is_owner?: boolean | null;
999
1085
  label_ids?: string[] | null;
1000
1086
  member_color?: Database["public"]["Enums"]["enum_chat_colors"];
1001
1087
  member_image?: string | null;
@@ -1011,6 +1097,7 @@ export type Database = {
1011
1097
  invited_at?: string | null;
1012
1098
  invited_by?: string | null;
1013
1099
  is_active?: boolean;
1100
+ is_owner?: boolean | null;
1014
1101
  label_ids?: string[] | null;
1015
1102
  member_color?: Database["public"]["Enums"]["enum_chat_colors"];
1016
1103
  member_image?: string | null;
@@ -1103,6 +1190,38 @@ export type Database = {
1103
1190
  }
1104
1191
  ];
1105
1192
  };
1193
+ tbl_quick_replies: {
1194
+ Row: {
1195
+ command: string | null;
1196
+ created_at: string;
1197
+ message_payload: Json | null;
1198
+ org_id: string | null;
1199
+ reply_id: string;
1200
+ };
1201
+ Insert: {
1202
+ command?: string | null;
1203
+ created_at?: string;
1204
+ message_payload?: Json | null;
1205
+ org_id?: string | null;
1206
+ reply_id?: string;
1207
+ };
1208
+ Update: {
1209
+ command?: string | null;
1210
+ created_at?: string;
1211
+ message_payload?: Json | null;
1212
+ org_id?: string | null;
1213
+ reply_id?: string;
1214
+ };
1215
+ Relationships: [
1216
+ {
1217
+ foreignKeyName: "tbl_quick_replies_org_id_fkey";
1218
+ columns: ["org_id"];
1219
+ isOneToOne: false;
1220
+ referencedRelation: "tbl_org";
1221
+ referencedColumns: ["org_id"];
1222
+ }
1223
+ ];
1224
+ };
1106
1225
  tbl_tools_whatsapp_links: {
1107
1226
  Row: {
1108
1227
  created_at: string;
@@ -1132,20 +1251,21 @@ export type Database = {
1132
1251
  view_broadcast_logs: {
1133
1252
  Row: {
1134
1253
  broadcast_id: string | null;
1135
- completed_at: string | null;
1136
1254
  created_at: string | null;
1137
- delivered_member_count: number | null;
1138
1255
  delivery_percentage: number | null;
1139
1256
  failed_chats: number | null;
1140
1257
  message_payload: Json | null;
1141
1258
  org_id: string | null;
1259
+ pending_chats: number | null;
1260
+ performed_at: string | null;
1142
1261
  performed_by: string | null;
1143
- read_member_count: number | null;
1144
1262
  read_percentage: number | null;
1145
1263
  scheduled_at: string | null;
1146
1264
  sent_chats: number | null;
1147
1265
  total_chats: number | null;
1266
+ total_delivered_count: number | null;
1148
1267
  total_member_count: number | null;
1268
+ total_read_count: number | null;
1149
1269
  };
1150
1270
  Relationships: [
1151
1271
  {
@@ -1157,6 +1277,26 @@ export type Database = {
1157
1277
  }
1158
1278
  ];
1159
1279
  };
1280
+ view_chat_participants: {
1281
+ Row: {
1282
+ chat_id: string | null;
1283
+ contact_name: string | null;
1284
+ is_business: boolean | null;
1285
+ is_user: boolean | null;
1286
+ members: Json | null;
1287
+ org_id: string | null;
1288
+ org_phone: string | null;
1289
+ };
1290
+ Relationships: [
1291
+ {
1292
+ foreignKeyName: "tbl_chat_participants_fkey_tbl_chats";
1293
+ columns: ["org_id", "org_phone", "chat_id"];
1294
+ isOneToOne: false;
1295
+ referencedRelation: "tbl_chats";
1296
+ referencedColumns: ["org_id", "org_phone", "chat_id"];
1297
+ }
1298
+ ];
1299
+ };
1160
1300
  view_chats: {
1161
1301
  Row: {
1162
1302
  active_phone: string | null;
@@ -1164,12 +1304,10 @@ export type Database = {
1164
1304
  chat_id: string | null;
1165
1305
  chat_image: string | null;
1166
1306
  chat_name: string | null;
1167
- chat_org_phones: string[] | null;
1168
1307
  chat_type: string | null;
1169
1308
  created_at: string | null;
1170
1309
  custom_properties: Json | null;
1171
1310
  group_description: string | null;
1172
- has_access: boolean | null;
1173
1311
  invite_link: string | null;
1174
1312
  is_archived: boolean | null;
1175
1313
  is_muted: boolean | null;
@@ -1178,19 +1316,12 @@ export type Database = {
1178
1316
  latest_message: Json | null;
1179
1317
  member_count: number | null;
1180
1318
  members: Json | null;
1319
+ message_unread_count: number | null;
1181
1320
  org_id: string | null;
1182
1321
  org_phone: string | null;
1183
1322
  updated_at: string | null;
1184
1323
  };
1185
- Relationships: [
1186
- {
1187
- foreignKeyName: "tbl_chats_fkey_tbl_org_phones";
1188
- columns: ["org_phone", "org_id"];
1189
- isOneToOne: false;
1190
- referencedRelation: "tbl_org_phones";
1191
- referencedColumns: ["org_phone", "org_id"];
1192
- }
1193
- ];
1324
+ Relationships: [];
1194
1325
  };
1195
1326
  };
1196
1327
  Functions: {
@@ -1216,13 +1347,6 @@ export type Database = {
1216
1347
  };
1217
1348
  Returns: Json;
1218
1349
  };
1219
- get_broadcast_id: {
1220
- Args: {
1221
- broadcast_id_input: string;
1222
- chat_id_input?: string;
1223
- };
1224
- Returns: Json;
1225
- };
1226
1350
  get_chat_labels_data: {
1227
1351
  Args: {
1228
1352
  org_id_input: string;
@@ -1232,7 +1356,7 @@ export type Database = {
1232
1356
  };
1233
1357
  get_chats: {
1234
1358
  Args: {
1235
- org_id_input: string;
1359
+ org_id_input?: string;
1236
1360
  chat_id_input?: string[];
1237
1361
  with_metadata?: boolean;
1238
1362
  last_updated_at_input?: string;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Chat, Location, MessageInfo } from '@periskope/whatsapp-web.js';
1
+ import { Chat, Location } from '@periskope/whatsapp-web.js';
2
2
  import type { default as _Stripe } from 'stripe';
3
3
  import { Merge, OverrideProperties } from 'type-fest';
4
4
  import { Tables } from './supabase.types';
@@ -39,6 +39,7 @@ export type OrgType = OverrideProperties<Tables<'tbl_org'> & {
39
39
  members: Tables<'tbl_org_members'>[];
40
40
  phones: Tables<'tbl_org_phones'>[];
41
41
  labels: Tables<'tbl_org_labels'>[];
42
+ quick_replies: Tables<'tbl_quick_replies'>[];
42
43
  custom_properties: Tables<'tbl_custom_properties'>[];
43
44
  trial_details: {
44
45
  pending_in_days: number;
@@ -61,6 +62,7 @@ export type ChatType = Merge<Tables<'view_chats'>, {
61
62
  label_ids: Record<string, boolean>;
62
63
  chat_org_phones?: string[];
63
64
  message_unread_count: number | null;
65
+ is_open?: boolean;
64
66
  }>;
65
67
  export type MediaType = {
66
68
  path: string;
@@ -106,6 +108,7 @@ export type SendMessageContent = {
106
108
  performed_by?: string;
107
109
  variables?: Record<string, VariableType>;
108
110
  };
111
+ export type QuickReplyContent = Omit<SendMessageContent, 'broadcast_id' | 'variables'>;
109
112
  export type VariableType = Record<string, string>;
110
113
  export type BroadcastMessagePayload = SendMessageContent & {
111
114
  chat_ids: string[];
@@ -115,23 +118,21 @@ export type SingleMessagePayload = SendMessageContent & {
115
118
  chat_id: string;
116
119
  job_id?: string;
117
120
  };
121
+ export type MessageAttachmentFileTypes = 'image' | 'audio' | 'document' | 'video';
118
122
  export type AttachmentTypeProps = {
119
123
  result: string;
120
124
  file: File | null;
121
- type: 'image' | 'audio' | 'document' | 'video';
122
- };
123
- export type LogsType = {
124
- chat_id: string | null;
125
- message_id: string | null;
126
- read_count: number | null;
127
- total_count: number | null;
128
- delivery_info: MessageInfo | null;
129
- delivered_count: number | null;
130
- members: Partial<ChatMemberType>[];
131
- member_count: number | null;
125
+ type: MessageAttachmentFileTypes;
126
+ } | {
127
+ link: {
128
+ url: string;
129
+ type: MessageAttachmentFileTypes;
130
+ name: string;
131
+ mimetype?: string;
132
+ };
132
133
  };
133
134
  export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
134
- logs: (LogsType & ChatType)[];
135
+ logs: (Tables<'tbl_broadcast_logs'> & Partial<ChatType>)[];
135
136
  };
136
137
  export type ChatParticipantOperation = {
137
138
  participant_ids: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.67",
3
+ "version": "0.6.69",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/supabase.types.ts CHANGED
@@ -28,34 +28,101 @@ export type Database = {
28
28
  }
29
29
  public: {
30
30
  Tables: {
31
+ tbl_broadcast_logs: {
32
+ Row: {
33
+ broadcast_id: string
34
+ chat_id: string
35
+ completed_at: string | null
36
+ created_at: string
37
+ delivered_count: number | null
38
+ delivery_info: Json | null
39
+ is_success: boolean | null
40
+ member_count: number | null
41
+ message_id: string | null
42
+ org_id: string
43
+ org_phone: string | null
44
+ read_count: number | null
45
+ }
46
+ Insert: {
47
+ broadcast_id: string
48
+ chat_id: string
49
+ completed_at?: string | null
50
+ created_at?: string
51
+ delivered_count?: number | null
52
+ delivery_info?: Json | null
53
+ is_success?: boolean | null
54
+ member_count?: number | null
55
+ message_id?: string | null
56
+ org_id: string
57
+ org_phone?: string | null
58
+ read_count?: number | null
59
+ }
60
+ Update: {
61
+ broadcast_id?: string
62
+ chat_id?: string
63
+ completed_at?: string | null
64
+ created_at?: string
65
+ delivered_count?: number | null
66
+ delivery_info?: Json | null
67
+ is_success?: boolean | null
68
+ member_count?: number | null
69
+ message_id?: string | null
70
+ org_id?: string
71
+ org_phone?: string | null
72
+ read_count?: number | null
73
+ }
74
+ Relationships: [
75
+ {
76
+ foreignKeyName: "tbl_broadcast_logs_broadcast_id_fkey"
77
+ columns: ["broadcast_id"]
78
+ isOneToOne: false
79
+ referencedRelation: "tbl_broadcast_messages"
80
+ referencedColumns: ["broadcast_id"]
81
+ },
82
+ {
83
+ foreignKeyName: "tbl_broadcast_logs_broadcast_id_fkey"
84
+ columns: ["broadcast_id"]
85
+ isOneToOne: false
86
+ referencedRelation: "view_broadcast_logs"
87
+ referencedColumns: ["broadcast_id"]
88
+ },
89
+ {
90
+ foreignKeyName: "tbl_broadcast_logs_org_id_fkey"
91
+ columns: ["org_id"]
92
+ isOneToOne: false
93
+ referencedRelation: "tbl_org"
94
+ referencedColumns: ["org_id"]
95
+ },
96
+ ]
97
+ }
31
98
  tbl_broadcast_messages: {
32
99
  Row: {
33
100
  broadcast_id: string
34
101
  chat_ids: string[] | null
35
- completed_at: string | null
36
102
  created_at: string
37
103
  message_payload: Json | null
38
104
  org_id: string
105
+ performed_at: string | null
39
106
  performed_by: string | null
40
107
  scheduled_at: string | null
41
108
  }
42
109
  Insert: {
43
110
  broadcast_id?: string
44
111
  chat_ids?: string[] | null
45
- completed_at?: string | null
46
112
  created_at?: string
47
113
  message_payload?: Json | null
48
114
  org_id: string
115
+ performed_at?: string | null
49
116
  performed_by?: string | null
50
117
  scheduled_at?: string | null
51
118
  }
52
119
  Update: {
53
120
  broadcast_id?: string
54
121
  chat_ids?: string[] | null
55
- completed_at?: string | null
56
122
  created_at?: string
57
123
  message_payload?: Json | null
58
124
  org_id?: string
125
+ performed_at?: string | null
59
126
  performed_by?: string | null
60
127
  scheduled_at?: string | null
61
128
  }
@@ -111,6 +178,7 @@ export type Database = {
111
178
  email: string
112
179
  has_access: boolean | null
113
180
  last_read_timestamp: string | null
181
+ message_unread_count: number | null
114
182
  org_id: string
115
183
  }
116
184
  Insert: {
@@ -119,6 +187,7 @@ export type Database = {
119
187
  email: string
120
188
  has_access?: boolean | null
121
189
  last_read_timestamp?: string | null
190
+ message_unread_count?: number | null
122
191
  org_id: string
123
192
  }
124
193
  Update: {
@@ -127,6 +196,7 @@ export type Database = {
127
196
  email?: string
128
197
  has_access?: boolean | null
129
198
  last_read_timestamp?: string | null
199
+ message_unread_count?: number | null
130
200
  org_id?: string
131
201
  }
132
202
  Relationships: [
@@ -380,15 +450,29 @@ export type Database = {
380
450
  referencedRelation: "tbl_chats"
381
451
  referencedColumns: ["org_id", "org_phone", "chat_id"]
382
452
  },
383
- {
384
- foreignKeyName: "tbl_chat_participants_fkey_tbl_chats"
385
- columns: ["org_id", "org_phone", "chat_id"]
386
- isOneToOne: false
387
- referencedRelation: "view_chats"
388
- referencedColumns: ["org_id", "org_phone", "chat_id"]
389
- },
390
453
  ]
391
454
  }
455
+ tbl_chat_properties: {
456
+ Row: {
457
+ chat_id: string
458
+ custom_properties: Json | null
459
+ label_ids: Json | null
460
+ org_id: string
461
+ }
462
+ Insert: {
463
+ chat_id: string
464
+ custom_properties?: Json | null
465
+ label_ids?: Json | null
466
+ org_id: string
467
+ }
468
+ Update: {
469
+ chat_id?: string
470
+ custom_properties?: Json | null
471
+ label_ids?: Json | null
472
+ org_id?: string
473
+ }
474
+ Relationships: []
475
+ }
392
476
  tbl_chat_reactions: {
393
477
  Row: {
394
478
  ack: number | null
@@ -984,6 +1068,7 @@ export type Database = {
984
1068
  invited_at: string | null
985
1069
  invited_by: string | null
986
1070
  is_active: boolean
1071
+ is_owner: boolean | null
987
1072
  label_ids: string[] | null
988
1073
  member_color: Database["public"]["Enums"]["enum_chat_colors"]
989
1074
  member_image: string | null
@@ -999,6 +1084,7 @@ export type Database = {
999
1084
  invited_at?: string | null
1000
1085
  invited_by?: string | null
1001
1086
  is_active?: boolean
1087
+ is_owner?: boolean | null
1002
1088
  label_ids?: string[] | null
1003
1089
  member_color?: Database["public"]["Enums"]["enum_chat_colors"]
1004
1090
  member_image?: string | null
@@ -1014,6 +1100,7 @@ export type Database = {
1014
1100
  invited_at?: string | null
1015
1101
  invited_by?: string | null
1016
1102
  is_active?: boolean
1103
+ is_owner?: boolean | null
1017
1104
  label_ids?: string[] | null
1018
1105
  member_color?: Database["public"]["Enums"]["enum_chat_colors"]
1019
1106
  member_image?: string | null
@@ -1106,6 +1193,38 @@ export type Database = {
1106
1193
  },
1107
1194
  ]
1108
1195
  }
1196
+ tbl_quick_replies: {
1197
+ Row: {
1198
+ command: string | null
1199
+ created_at: string
1200
+ message_payload: Json | null
1201
+ org_id: string | null
1202
+ reply_id: string
1203
+ }
1204
+ Insert: {
1205
+ command?: string | null
1206
+ created_at?: string
1207
+ message_payload?: Json | null
1208
+ org_id?: string | null
1209
+ reply_id?: string
1210
+ }
1211
+ Update: {
1212
+ command?: string | null
1213
+ created_at?: string
1214
+ message_payload?: Json | null
1215
+ org_id?: string | null
1216
+ reply_id?: string
1217
+ }
1218
+ Relationships: [
1219
+ {
1220
+ foreignKeyName: "tbl_quick_replies_org_id_fkey"
1221
+ columns: ["org_id"]
1222
+ isOneToOne: false
1223
+ referencedRelation: "tbl_org"
1224
+ referencedColumns: ["org_id"]
1225
+ },
1226
+ ]
1227
+ }
1109
1228
  tbl_tools_whatsapp_links: {
1110
1229
  Row: {
1111
1230
  created_at: string
@@ -1135,20 +1254,21 @@ export type Database = {
1135
1254
  view_broadcast_logs: {
1136
1255
  Row: {
1137
1256
  broadcast_id: string | null
1138
- completed_at: string | null
1139
1257
  created_at: string | null
1140
- delivered_member_count: number | null
1141
1258
  delivery_percentage: number | null
1142
1259
  failed_chats: number | null
1143
1260
  message_payload: Json | null
1144
1261
  org_id: string | null
1262
+ pending_chats: number | null
1263
+ performed_at: string | null
1145
1264
  performed_by: string | null
1146
- read_member_count: number | null
1147
1265
  read_percentage: number | null
1148
1266
  scheduled_at: string | null
1149
1267
  sent_chats: number | null
1150
1268
  total_chats: number | null
1269
+ total_delivered_count: number | null
1151
1270
  total_member_count: number | null
1271
+ total_read_count: number | null
1152
1272
  }
1153
1273
  Relationships: [
1154
1274
  {
@@ -1160,6 +1280,26 @@ export type Database = {
1160
1280
  },
1161
1281
  ]
1162
1282
  }
1283
+ view_chat_participants: {
1284
+ Row: {
1285
+ chat_id: string | null
1286
+ contact_name: string | null
1287
+ is_business: boolean | null
1288
+ is_user: boolean | null
1289
+ members: Json | null
1290
+ org_id: string | null
1291
+ org_phone: string | null
1292
+ }
1293
+ Relationships: [
1294
+ {
1295
+ foreignKeyName: "tbl_chat_participants_fkey_tbl_chats"
1296
+ columns: ["org_id", "org_phone", "chat_id"]
1297
+ isOneToOne: false
1298
+ referencedRelation: "tbl_chats"
1299
+ referencedColumns: ["org_id", "org_phone", "chat_id"]
1300
+ },
1301
+ ]
1302
+ }
1163
1303
  view_chats: {
1164
1304
  Row: {
1165
1305
  active_phone: string | null
@@ -1167,12 +1307,10 @@ export type Database = {
1167
1307
  chat_id: string | null
1168
1308
  chat_image: string | null
1169
1309
  chat_name: string | null
1170
- chat_org_phones: string[] | null
1171
1310
  chat_type: string | null
1172
1311
  created_at: string | null
1173
1312
  custom_properties: Json | null
1174
1313
  group_description: string | null
1175
- has_access: boolean | null
1176
1314
  invite_link: string | null
1177
1315
  is_archived: boolean | null
1178
1316
  is_muted: boolean | null
@@ -1181,19 +1319,12 @@ export type Database = {
1181
1319
  latest_message: Json | null
1182
1320
  member_count: number | null
1183
1321
  members: Json | null
1322
+ message_unread_count: number | null
1184
1323
  org_id: string | null
1185
1324
  org_phone: string | null
1186
1325
  updated_at: string | null
1187
1326
  }
1188
- Relationships: [
1189
- {
1190
- foreignKeyName: "tbl_chats_fkey_tbl_org_phones"
1191
- columns: ["org_phone", "org_id"]
1192
- isOneToOne: false
1193
- referencedRelation: "tbl_org_phones"
1194
- referencedColumns: ["org_phone", "org_id"]
1195
- },
1196
- ]
1327
+ Relationships: []
1197
1328
  }
1198
1329
  }
1199
1330
  Functions: {
@@ -1219,13 +1350,6 @@ export type Database = {
1219
1350
  }
1220
1351
  Returns: Json
1221
1352
  }
1222
- get_broadcast_id: {
1223
- Args: {
1224
- broadcast_id_input: string
1225
- chat_id_input?: string
1226
- }
1227
- Returns: Json
1228
- }
1229
1353
  get_chat_labels_data: {
1230
1354
  Args: {
1231
1355
  org_id_input: string
@@ -1235,7 +1359,7 @@ export type Database = {
1235
1359
  }
1236
1360
  get_chats: {
1237
1361
  Args: {
1238
- org_id_input: string
1362
+ org_id_input?: string
1239
1363
  chat_id_input?: string[]
1240
1364
  with_metadata?: boolean
1241
1365
  last_updated_at_input?: string
package/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Chat, Location, MessageInfo } from '@periskope/whatsapp-web.js';
1
+ import { Chat, Location } from '@periskope/whatsapp-web.js';
2
2
  import type { default as _Stripe } from 'stripe';
3
3
  import { Merge, OverrideProperties } from 'type-fest';
4
4
  import { Tables } from './supabase.types';
@@ -58,6 +58,7 @@ export type OrgType = OverrideProperties<
58
58
  members: Tables<'tbl_org_members'>[];
59
59
  phones: Tables<'tbl_org_phones'>[];
60
60
  labels: Tables<'tbl_org_labels'>[];
61
+ quick_replies: Tables<'tbl_quick_replies'>[];
61
62
  custom_properties: Tables<'tbl_custom_properties'>[];
62
63
  trial_details: {
63
64
  pending_in_days: number;
@@ -89,6 +90,7 @@ export type ChatType = Merge<
89
90
  label_ids: Record<string, boolean>;
90
91
  chat_org_phones?: string[];
91
92
  message_unread_count: number | null;
93
+ is_open?: boolean;
92
94
  }
93
95
  >;
94
96
 
@@ -189,6 +191,11 @@ export type SendMessageContent = {
189
191
  variables?: Record<string, VariableType>;
190
192
  };
191
193
 
194
+ export type QuickReplyContent = Omit<
195
+ SendMessageContent,
196
+ 'broadcast_id' | 'variables'
197
+ >;
198
+
192
199
  export type VariableType = Record<string, string>;
193
200
 
194
201
  export type BroadcastMessagePayload = SendMessageContent & {
@@ -201,27 +208,31 @@ export type SingleMessagePayload = SendMessageContent & {
201
208
  job_id?: string;
202
209
  };
203
210
 
204
- export type AttachmentTypeProps = {
205
- result: string;
206
- file: File | null;
207
- type: 'image' | 'audio' | 'document' | 'video';
208
- };
211
+ export type MessageAttachmentFileTypes =
212
+ | 'image'
213
+ | 'audio'
214
+ | 'document'
215
+ | 'video';
216
+
217
+ export type AttachmentTypeProps =
218
+ | {
219
+ result: string;
220
+ file: File | null;
221
+ type: MessageAttachmentFileTypes;
222
+ }
223
+ | {
224
+ link: {
225
+ url: string;
226
+ type: MessageAttachmentFileTypes;
227
+ name: string;
228
+ mimetype?: string;
229
+ };
230
+ };
209
231
 
210
232
  /* -------------------------------- BROADCAST ------------------------------- */
211
233
 
212
- export type LogsType = {
213
- chat_id: string | null;
214
- message_id: string | null;
215
- read_count: number | null;
216
- total_count: number | null;
217
- delivery_info: MessageInfo | null;
218
- delivered_count: number | null;
219
- members: Partial<ChatMemberType>[];
220
- member_count: number | null;
221
- };
222
-
223
234
  export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
224
- logs: (LogsType & ChatType)[];
235
+ logs: (Tables<'tbl_broadcast_logs'> & Partial<ChatType>)[];
225
236
  };
226
237
 
227
238
  /* ----------------------- CHAT PARTICIPANT OPERATION ----------------------- */
@@ -255,14 +266,16 @@ export type PhoneStateType = {
255
266
 
256
267
  /* ------------------------------- INTEGRATIONS ----------------------------- */
257
268
 
258
-
259
- export type TicketLogType = OverrideProperties<Tables<'tbl_integration_logs'>, {
260
- integration_name: IntegrationLogType.NEW_TICKET;
261
- metadata: {
269
+ export type TicketLogType = OverrideProperties<
270
+ Tables<'tbl_integration_logs'>,
271
+ {
272
+ integration_name: IntegrationLogType.NEW_TICKET;
273
+ metadata: {
262
274
  ticket_id: string;
263
275
  name: string;
264
- };
265
- }>;
276
+ };
277
+ }
278
+ >;
266
279
 
267
280
  export type IntegrationLogDetailsType = TicketLogType;
268
281
 
@@ -270,6 +283,7 @@ export enum IntegrationLogType {
270
283
  NEW_TICKET = 'new_ticket',
271
284
  }
272
285
 
273
- export type LogTypeMap<T extends IntegrationLogType> = T extends IntegrationLogType.NEW_TICKET
274
- ? TicketLogType
275
- : Tables<'tbl_integration_logs'>;
286
+ export type LogTypeMap<T extends IntegrationLogType> =
287
+ T extends IntegrationLogType.NEW_TICKET
288
+ ? TicketLogType
289
+ : Tables<'tbl_integration_logs'>;