@periskope/types 0.6.66 → 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
  };
@@ -111,8 +178,6 @@ export type Database = {
111
178
  chat_id: string;
112
179
  email: string;
113
180
  has_access: boolean | null;
114
- is_archived: boolean;
115
- is_muted: boolean;
116
181
  last_read_timestamp: string | null;
117
182
  org_id: string;
118
183
  };
@@ -121,8 +186,6 @@ export type Database = {
121
186
  chat_id: string;
122
187
  email: string;
123
188
  has_access?: boolean | null;
124
- is_archived?: boolean;
125
- is_muted?: boolean;
126
189
  last_read_timestamp?: string | null;
127
190
  org_id: string;
128
191
  };
@@ -131,8 +194,6 @@ export type Database = {
131
194
  chat_id?: string;
132
195
  email?: string;
133
196
  has_access?: boolean | null;
134
- is_archived?: boolean;
135
- is_muted?: boolean;
136
197
  last_read_timestamp?: string | null;
137
198
  org_id?: string;
138
199
  };
@@ -735,6 +796,7 @@ export type Database = {
735
796
  };
736
797
  tbl_flagged_messages: {
737
798
  Row: {
799
+ chat_id: string | null;
738
800
  org_id: string;
739
801
  response_id: string | null;
740
802
  response_timestamp: string | null;
@@ -742,6 +804,7 @@ export type Database = {
742
804
  unique_id: string;
743
805
  };
744
806
  Insert: {
807
+ chat_id?: string | null;
745
808
  org_id: string;
746
809
  response_id?: string | null;
747
810
  response_timestamp?: string | null;
@@ -749,6 +812,7 @@ export type Database = {
749
812
  unique_id: string;
750
813
  };
751
814
  Update: {
815
+ chat_id?: string | null;
752
816
  org_id?: string;
753
817
  response_id?: string | null;
754
818
  response_timestamp?: string | null;
@@ -984,10 +1048,12 @@ export type Database = {
984
1048
  invited_at: string | null;
985
1049
  invited_by: string | null;
986
1050
  is_active: boolean;
1051
+ label_ids: string[] | null;
987
1052
  member_color: Database["public"]["Enums"]["enum_chat_colors"];
988
1053
  member_image: string | null;
989
1054
  member_name: string | null;
990
1055
  org_id: string;
1056
+ org_phones: string[] | null;
991
1057
  role: Database["public"]["Enums"]["enum_member_role"];
992
1058
  user_id: string | null;
993
1059
  };
@@ -997,10 +1063,12 @@ export type Database = {
997
1063
  invited_at?: string | null;
998
1064
  invited_by?: string | null;
999
1065
  is_active?: boolean;
1066
+ label_ids?: string[] | null;
1000
1067
  member_color?: Database["public"]["Enums"]["enum_chat_colors"];
1001
1068
  member_image?: string | null;
1002
1069
  member_name?: string | null;
1003
1070
  org_id: string;
1071
+ org_phones?: string[] | null;
1004
1072
  role?: Database["public"]["Enums"]["enum_member_role"];
1005
1073
  user_id?: string | null;
1006
1074
  };
@@ -1010,10 +1078,12 @@ export type Database = {
1010
1078
  invited_at?: string | null;
1011
1079
  invited_by?: string | null;
1012
1080
  is_active?: boolean;
1081
+ label_ids?: string[] | null;
1013
1082
  member_color?: Database["public"]["Enums"]["enum_chat_colors"];
1014
1083
  member_image?: string | null;
1015
1084
  member_name?: string | null;
1016
1085
  org_id?: string;
1086
+ org_phones?: string[] | null;
1017
1087
  role?: Database["public"]["Enums"]["enum_member_role"];
1018
1088
  user_id?: string | null;
1019
1089
  };
@@ -1044,10 +1114,12 @@ export type Database = {
1044
1114
  phone_id: string;
1045
1115
  phone_image: string | null;
1046
1116
  phone_name: string | null;
1117
+ phone_state: Json | null;
1047
1118
  qr_code: string | null;
1048
1119
  server_ip: string | null;
1049
1120
  updated_at: string | null;
1050
1121
  wa_state: string | null;
1122
+ wa_version: string | null;
1051
1123
  };
1052
1124
  Insert: {
1053
1125
  created_at?: string;
@@ -1058,10 +1130,12 @@ export type Database = {
1058
1130
  phone_id?: string;
1059
1131
  phone_image?: string | null;
1060
1132
  phone_name?: string | null;
1133
+ phone_state?: Json | null;
1061
1134
  qr_code?: string | null;
1062
1135
  server_ip?: string | null;
1063
1136
  updated_at?: string | null;
1064
1137
  wa_state?: string | null;
1138
+ wa_version?: string | null;
1065
1139
  };
1066
1140
  Update: {
1067
1141
  created_at?: string;
@@ -1072,10 +1146,12 @@ export type Database = {
1072
1146
  phone_id?: string;
1073
1147
  phone_image?: string | null;
1074
1148
  phone_name?: string | null;
1149
+ phone_state?: Json | null;
1075
1150
  qr_code?: string | null;
1076
1151
  server_ip?: string | null;
1077
1152
  updated_at?: string | null;
1078
1153
  wa_state?: string | null;
1154
+ wa_version?: string | null;
1079
1155
  };
1080
1156
  Relationships: [
1081
1157
  {
@@ -1094,6 +1170,38 @@ export type Database = {
1094
1170
  }
1095
1171
  ];
1096
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
+ };
1097
1205
  tbl_tools_whatsapp_links: {
1098
1206
  Row: {
1099
1207
  created_at: string;
@@ -1123,20 +1231,21 @@ export type Database = {
1123
1231
  view_broadcast_logs: {
1124
1232
  Row: {
1125
1233
  broadcast_id: string | null;
1126
- completed_at: string | null;
1127
1234
  created_at: string | null;
1128
- delivered_member_count: number | null;
1129
1235
  delivery_percentage: number | null;
1130
1236
  failed_chats: number | null;
1131
1237
  message_payload: Json | null;
1132
1238
  org_id: string | null;
1239
+ pending_chats: number | null;
1240
+ performed_at: string | null;
1133
1241
  performed_by: string | null;
1134
- read_member_count: number | null;
1135
1242
  read_percentage: number | null;
1136
1243
  scheduled_at: string | null;
1137
1244
  sent_chats: number | null;
1138
1245
  total_chats: number | null;
1246
+ total_delivered_count: number | null;
1139
1247
  total_member_count: number | null;
1248
+ total_read_count: number | null;
1140
1249
  };
1141
1250
  Relationships: [
1142
1251
  {
@@ -1207,13 +1316,6 @@ export type Database = {
1207
1316
  };
1208
1317
  Returns: Json;
1209
1318
  };
1210
- get_broadcast_id: {
1211
- Args: {
1212
- broadcast_id_input: string;
1213
- chat_id_input?: string;
1214
- };
1215
- Returns: Json;
1216
- };
1217
1319
  get_chat_labels_data: {
1218
1320
  Args: {
1219
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[];
@@ -144,15 +145,13 @@ export type StripeSubscription = _Stripe.Subscription;
144
145
  export type StripeCustomer = _Stripe.Customer;
145
146
  export type StripeCoupon = _Stripe.Coupon;
146
147
  export type StripePrice = _Stripe.Price;
147
- export type PhoneRealtimeChannel = {
148
+ export type PhoneStateType = {
148
149
  loading: boolean;
149
150
  state: string;
150
- ready: boolean;
151
- sync: boolean;
151
+ sync: number;
152
152
  percent: number | null;
153
153
  message?: string;
154
154
  error?: string;
155
- presence_ref?: string;
156
155
  };
157
156
  export type TicketLogType = OverrideProperties<Tables<'tbl_integration_logs'>, {
158
157
  integration_name: IntegrationLogType.NEW_TICKET;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.66",
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
  }
@@ -110,8 +177,6 @@ export type Database = {
110
177
  chat_id: string
111
178
  email: string
112
179
  has_access: boolean | null
113
- is_archived: boolean
114
- is_muted: boolean
115
180
  last_read_timestamp: string | null
116
181
  org_id: string
117
182
  }
@@ -120,8 +185,6 @@ export type Database = {
120
185
  chat_id: string
121
186
  email: string
122
187
  has_access?: boolean | null
123
- is_archived?: boolean
124
- is_muted?: boolean
125
188
  last_read_timestamp?: string | null
126
189
  org_id: string
127
190
  }
@@ -130,8 +193,6 @@ export type Database = {
130
193
  chat_id?: string
131
194
  email?: string
132
195
  has_access?: boolean | null
133
- is_archived?: boolean
134
- is_muted?: boolean
135
196
  last_read_timestamp?: string | null
136
197
  org_id?: string
137
198
  }
@@ -738,6 +799,7 @@ export type Database = {
738
799
  }
739
800
  tbl_flagged_messages: {
740
801
  Row: {
802
+ chat_id: string | null
741
803
  org_id: string
742
804
  response_id: string | null
743
805
  response_timestamp: string | null
@@ -745,6 +807,7 @@ export type Database = {
745
807
  unique_id: string
746
808
  }
747
809
  Insert: {
810
+ chat_id?: string | null
748
811
  org_id: string
749
812
  response_id?: string | null
750
813
  response_timestamp?: string | null
@@ -752,6 +815,7 @@ export type Database = {
752
815
  unique_id: string
753
816
  }
754
817
  Update: {
818
+ chat_id?: string | null
755
819
  org_id?: string
756
820
  response_id?: string | null
757
821
  response_timestamp?: string | null
@@ -987,10 +1051,12 @@ export type Database = {
987
1051
  invited_at: string | null
988
1052
  invited_by: string | null
989
1053
  is_active: boolean
1054
+ label_ids: string[] | null
990
1055
  member_color: Database["public"]["Enums"]["enum_chat_colors"]
991
1056
  member_image: string | null
992
1057
  member_name: string | null
993
1058
  org_id: string
1059
+ org_phones: string[] | null
994
1060
  role: Database["public"]["Enums"]["enum_member_role"]
995
1061
  user_id: string | null
996
1062
  }
@@ -1000,10 +1066,12 @@ export type Database = {
1000
1066
  invited_at?: string | null
1001
1067
  invited_by?: string | null
1002
1068
  is_active?: boolean
1069
+ label_ids?: string[] | null
1003
1070
  member_color?: Database["public"]["Enums"]["enum_chat_colors"]
1004
1071
  member_image?: string | null
1005
1072
  member_name?: string | null
1006
1073
  org_id: string
1074
+ org_phones?: string[] | null
1007
1075
  role?: Database["public"]["Enums"]["enum_member_role"]
1008
1076
  user_id?: string | null
1009
1077
  }
@@ -1013,10 +1081,12 @@ export type Database = {
1013
1081
  invited_at?: string | null
1014
1082
  invited_by?: string | null
1015
1083
  is_active?: boolean
1084
+ label_ids?: string[] | null
1016
1085
  member_color?: Database["public"]["Enums"]["enum_chat_colors"]
1017
1086
  member_image?: string | null
1018
1087
  member_name?: string | null
1019
1088
  org_id?: string
1089
+ org_phones?: string[] | null
1020
1090
  role?: Database["public"]["Enums"]["enum_member_role"]
1021
1091
  user_id?: string | null
1022
1092
  }
@@ -1047,10 +1117,12 @@ export type Database = {
1047
1117
  phone_id: string
1048
1118
  phone_image: string | null
1049
1119
  phone_name: string | null
1120
+ phone_state: Json | null
1050
1121
  qr_code: string | null
1051
1122
  server_ip: string | null
1052
1123
  updated_at: string | null
1053
1124
  wa_state: string | null
1125
+ wa_version: string | null
1054
1126
  }
1055
1127
  Insert: {
1056
1128
  created_at?: string
@@ -1061,10 +1133,12 @@ export type Database = {
1061
1133
  phone_id?: string
1062
1134
  phone_image?: string | null
1063
1135
  phone_name?: string | null
1136
+ phone_state?: Json | null
1064
1137
  qr_code?: string | null
1065
1138
  server_ip?: string | null
1066
1139
  updated_at?: string | null
1067
1140
  wa_state?: string | null
1141
+ wa_version?: string | null
1068
1142
  }
1069
1143
  Update: {
1070
1144
  created_at?: string
@@ -1075,10 +1149,12 @@ export type Database = {
1075
1149
  phone_id?: string
1076
1150
  phone_image?: string | null
1077
1151
  phone_name?: string | null
1152
+ phone_state?: Json | null
1078
1153
  qr_code?: string | null
1079
1154
  server_ip?: string | null
1080
1155
  updated_at?: string | null
1081
1156
  wa_state?: string | null
1157
+ wa_version?: string | null
1082
1158
  }
1083
1159
  Relationships: [
1084
1160
  {
@@ -1097,6 +1173,38 @@ export type Database = {
1097
1173
  },
1098
1174
  ]
1099
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
+ }
1100
1208
  tbl_tools_whatsapp_links: {
1101
1209
  Row: {
1102
1210
  created_at: string
@@ -1126,20 +1234,21 @@ export type Database = {
1126
1234
  view_broadcast_logs: {
1127
1235
  Row: {
1128
1236
  broadcast_id: string | null
1129
- completed_at: string | null
1130
1237
  created_at: string | null
1131
- delivered_member_count: number | null
1132
1238
  delivery_percentage: number | null
1133
1239
  failed_chats: number | null
1134
1240
  message_payload: Json | null
1135
1241
  org_id: string | null
1242
+ pending_chats: number | null
1243
+ performed_at: string | null
1136
1244
  performed_by: string | null
1137
- read_member_count: number | null
1138
1245
  read_percentage: number | null
1139
1246
  scheduled_at: string | null
1140
1247
  sent_chats: number | null
1141
1248
  total_chats: number | null
1249
+ total_delivered_count: number | null
1142
1250
  total_member_count: number | null
1251
+ total_read_count: number | null
1143
1252
  }
1144
1253
  Relationships: [
1145
1254
  {
@@ -1210,13 +1319,6 @@ export type Database = {
1210
1319
  }
1211
1320
  Returns: Json
1212
1321
  }
1213
- get_broadcast_id: {
1214
- Args: {
1215
- broadcast_id_input: string
1216
- chat_id_input?: string
1217
- }
1218
- Returns: Json
1219
- }
1220
1322
  get_chat_labels_data: {
1221
1323
  Args: {
1222
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 ----------------------- */
@@ -244,27 +255,27 @@ export type StripePrice = _Stripe.Price;
244
255
 
245
256
  /* -------------------------------- REALTIME -------------------------------- */
246
257
 
247
- export type PhoneRealtimeChannel = {
258
+ export type PhoneStateType = {
248
259
  loading: boolean;
249
260
  state: string;
250
- ready: boolean;
251
- sync: boolean;
261
+ sync: number;
252
262
  percent: number | null;
253
263
  message?: string;
254
264
  error?: string;
255
- presence_ref?: string;
256
265
  };
257
266
 
258
267
  /* ------------------------------- INTEGRATIONS ----------------------------- */
259
268
 
260
-
261
- export type TicketLogType = OverrideProperties<Tables<'tbl_integration_logs'>, {
262
- integration_name: IntegrationLogType.NEW_TICKET;
263
- metadata: {
269
+ export type TicketLogType = OverrideProperties<
270
+ Tables<'tbl_integration_logs'>,
271
+ {
272
+ integration_name: IntegrationLogType.NEW_TICKET;
273
+ metadata: {
264
274
  ticket_id: string;
265
275
  name: string;
266
- };
267
- }>;
276
+ };
277
+ }
278
+ >;
268
279
 
269
280
  export type IntegrationLogDetailsType = TicketLogType;
270
281
 
@@ -272,6 +283,7 @@ export enum IntegrationLogType {
272
283
  NEW_TICKET = 'new_ticket',
273
284
  }
274
285
 
275
- export type LogTypeMap<T extends IntegrationLogType> = T extends IntegrationLogType.NEW_TICKET
276
- ? TicketLogType
277
- : Tables<'tbl_integration_logs'>;
286
+ export type LogTypeMap<T extends IntegrationLogType> =
287
+ T extends IntegrationLogType.NEW_TICKET
288
+ ? TicketLogType
289
+ : Tables<'tbl_integration_logs'>;