@periskope/types 0.6.67 → 0.6.68

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
  };
@@ -1103,6 +1170,38 @@ export type Database = {
1103
1170
  }
1104
1171
  ];
1105
1172
  };
1173
+ tbl_quick_replies: {
1174
+ Row: {
1175
+ command: string | null;
1176
+ created_at: string;
1177
+ message_payload: Json | null;
1178
+ org_id: string | null;
1179
+ reply_id: string;
1180
+ };
1181
+ Insert: {
1182
+ command?: string | null;
1183
+ created_at?: string;
1184
+ message_payload?: Json | null;
1185
+ org_id?: string | null;
1186
+ reply_id?: string;
1187
+ };
1188
+ Update: {
1189
+ command?: string | null;
1190
+ created_at?: string;
1191
+ message_payload?: Json | null;
1192
+ org_id?: string | null;
1193
+ reply_id?: string;
1194
+ };
1195
+ Relationships: [
1196
+ {
1197
+ foreignKeyName: "tbl_quick_replies_org_id_fkey";
1198
+ columns: ["org_id"];
1199
+ isOneToOne: false;
1200
+ referencedRelation: "tbl_org";
1201
+ referencedColumns: ["org_id"];
1202
+ }
1203
+ ];
1204
+ };
1106
1205
  tbl_tools_whatsapp_links: {
1107
1206
  Row: {
1108
1207
  created_at: string;
@@ -1132,20 +1231,21 @@ export type Database = {
1132
1231
  view_broadcast_logs: {
1133
1232
  Row: {
1134
1233
  broadcast_id: string | null;
1135
- completed_at: string | null;
1136
1234
  created_at: string | null;
1137
- delivered_member_count: number | null;
1138
1235
  delivery_percentage: number | null;
1139
1236
  failed_chats: number | null;
1140
1237
  message_payload: Json | null;
1141
1238
  org_id: string | null;
1239
+ pending_chats: number | null;
1240
+ performed_at: string | null;
1142
1241
  performed_by: string | null;
1143
- read_member_count: number | null;
1144
1242
  read_percentage: number | null;
1145
1243
  scheduled_at: string | null;
1146
1244
  sent_chats: number | null;
1147
1245
  total_chats: number | null;
1246
+ total_delivered_count: number | null;
1148
1247
  total_member_count: number | null;
1248
+ total_read_count: number | null;
1149
1249
  };
1150
1250
  Relationships: [
1151
1251
  {
@@ -1216,13 +1316,6 @@ export type Database = {
1216
1316
  };
1217
1317
  Returns: Json;
1218
1318
  };
1219
- get_broadcast_id: {
1220
- Args: {
1221
- broadcast_id_input: string;
1222
- chat_id_input?: string;
1223
- };
1224
- Returns: Json;
1225
- };
1226
1319
  get_chat_labels_data: {
1227
1320
  Args: {
1228
1321
  org_id_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.68",
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
  }
@@ -1106,6 +1173,38 @@ export type Database = {
1106
1173
  },
1107
1174
  ]
1108
1175
  }
1176
+ tbl_quick_replies: {
1177
+ Row: {
1178
+ command: string | null
1179
+ created_at: string
1180
+ message_payload: Json | null
1181
+ org_id: string | null
1182
+ reply_id: string
1183
+ }
1184
+ Insert: {
1185
+ command?: string | null
1186
+ created_at?: string
1187
+ message_payload?: Json | null
1188
+ org_id?: string | null
1189
+ reply_id?: string
1190
+ }
1191
+ Update: {
1192
+ command?: string | null
1193
+ created_at?: string
1194
+ message_payload?: Json | null
1195
+ org_id?: string | null
1196
+ reply_id?: string
1197
+ }
1198
+ Relationships: [
1199
+ {
1200
+ foreignKeyName: "tbl_quick_replies_org_id_fkey"
1201
+ columns: ["org_id"]
1202
+ isOneToOne: false
1203
+ referencedRelation: "tbl_org"
1204
+ referencedColumns: ["org_id"]
1205
+ },
1206
+ ]
1207
+ }
1109
1208
  tbl_tools_whatsapp_links: {
1110
1209
  Row: {
1111
1210
  created_at: string
@@ -1135,20 +1234,21 @@ export type Database = {
1135
1234
  view_broadcast_logs: {
1136
1235
  Row: {
1137
1236
  broadcast_id: string | null
1138
- completed_at: string | null
1139
1237
  created_at: string | null
1140
- delivered_member_count: number | null
1141
1238
  delivery_percentage: number | null
1142
1239
  failed_chats: number | null
1143
1240
  message_payload: Json | null
1144
1241
  org_id: string | null
1242
+ pending_chats: number | null
1243
+ performed_at: string | null
1145
1244
  performed_by: string | null
1146
- read_member_count: number | null
1147
1245
  read_percentage: number | null
1148
1246
  scheduled_at: string | null
1149
1247
  sent_chats: number | null
1150
1248
  total_chats: number | null
1249
+ total_delivered_count: number | null
1151
1250
  total_member_count: number | null
1251
+ total_read_count: number | null
1152
1252
  }
1153
1253
  Relationships: [
1154
1254
  {
@@ -1219,13 +1319,6 @@ export type Database = {
1219
1319
  }
1220
1320
  Returns: Json
1221
1321
  }
1222
- get_broadcast_id: {
1223
- Args: {
1224
- broadcast_id_input: string
1225
- chat_id_input?: string
1226
- }
1227
- Returns: Json
1228
- }
1229
1322
  get_chat_labels_data: {
1230
1323
  Args: {
1231
1324
  org_id_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'>;