@periskope/types 0.6.121 → 0.6.122
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/dist/supabase.types.d.ts +10 -95
- package/package.json +1 -1
- package/supabase.types.ts +11 -96
- package/types.ts +534 -534
package/types.ts
CHANGED
|
@@ -1,534 +1,534 @@
|
|
|
1
|
-
import type { default as _Stripe } from 'stripe';
|
|
2
|
-
import { Merge, OverrideProperties } from 'type-fest';
|
|
3
|
-
import { Tables, TablesUpdate } from './supabase.types';
|
|
4
|
-
|
|
5
|
-
/* ----------------------------- TYPE SHORTHANDS ---------------------------- */
|
|
6
|
-
|
|
7
|
-
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
8
|
-
|
|
9
|
-
export enum AllPlans {
|
|
10
|
-
FREE_TRIAL = 'free-trial',
|
|
11
|
-
// MONTHLY_STARTER = 'monthly-starter',
|
|
12
|
-
// YEARLY_STARTER = 'yearly-starter',
|
|
13
|
-
// MONTHLY_PRO = 'monthly-pro',
|
|
14
|
-
// YEARLY_PRO = 'yearly-pro',
|
|
15
|
-
ENTERPRISE = 'enterprise',
|
|
16
|
-
MONTHLY_STARTER_SINGLE = 'monthly-starter-single',
|
|
17
|
-
YEARLY_STARTER_SINGLE = 'yearly-starter-single',
|
|
18
|
-
MONTHLY_PRO_SINGLE = 'monthly-pro-single',
|
|
19
|
-
YEARLY_PRO_SINGLE = 'yearly-pro-single',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
|
|
23
|
-
|
|
24
|
-
export type Enterprise = `${string}-enterprise`;
|
|
25
|
-
|
|
26
|
-
export type OrgPlanEnterprise = {
|
|
27
|
-
subscription_id: string;
|
|
28
|
-
plan_id: Enterprise;
|
|
29
|
-
interval: number;
|
|
30
|
-
frequency: Frequency;
|
|
31
|
-
user_limit: number;
|
|
32
|
-
phone_limit: number;
|
|
33
|
-
current_period_start: number;
|
|
34
|
-
current_period_end: number | null;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type OrgPlanNonEnterprise = {
|
|
38
|
-
subscription_id: string;
|
|
39
|
-
plan_id: AllPlans;
|
|
40
|
-
interval: number;
|
|
41
|
-
frequency: Frequency;
|
|
42
|
-
user_limit: number;
|
|
43
|
-
phone_limit: number;
|
|
44
|
-
current_period_end: number;
|
|
45
|
-
current_period_start: number;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise
|
|
49
|
-
? OrgPlanEnterprise
|
|
50
|
-
: T extends AllPlans
|
|
51
|
-
? OrgPlanNonEnterprise
|
|
52
|
-
: never;
|
|
53
|
-
|
|
54
|
-
export type MicrosurveyData = {
|
|
55
|
-
key: string;
|
|
56
|
-
text: string;
|
|
57
|
-
checked: boolean;
|
|
58
|
-
}[];
|
|
59
|
-
|
|
60
|
-
export type OrgPreferences = {
|
|
61
|
-
disable_ai_flagging?: boolean;
|
|
62
|
-
disable_allow_exports?: boolean;
|
|
63
|
-
sync_phone_contacts?: boolean;
|
|
64
|
-
mask_phone_numbers?: boolean;
|
|
65
|
-
show_sender_names?: boolean;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
type OrgPreferenceKey = keyof OrgPreferences;
|
|
69
|
-
|
|
70
|
-
export type OrgPreferencesValue = {
|
|
71
|
-
[K in OrgPreferenceKey]: { key: K; value: OrgPreferences[K] };
|
|
72
|
-
}[OrgPreferenceKey];
|
|
73
|
-
|
|
74
|
-
export type OrgMetadata = {
|
|
75
|
-
phone_number: string;
|
|
76
|
-
ticket_prefix: string;
|
|
77
|
-
referralSource?: string;
|
|
78
|
-
surveyData?: MicrosurveyData;
|
|
79
|
-
preferences?: OrgPreferences;
|
|
80
|
-
hubspot_pipelines?: {
|
|
81
|
-
id: string;
|
|
82
|
-
label: string;
|
|
83
|
-
default_stage: { id: string; label: string };
|
|
84
|
-
}[];
|
|
85
|
-
partition?: boolean;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
type AccessScopes = {
|
|
89
|
-
integrations: boolean;
|
|
90
|
-
exports: boolean;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export type OrgType = OverrideProperties<
|
|
94
|
-
Merge<
|
|
95
|
-
Tables<'tbl_org'>,
|
|
96
|
-
{
|
|
97
|
-
user: Tables<'tbl_org_members'>;
|
|
98
|
-
members: Tables<'tbl_org_members'>[];
|
|
99
|
-
phones: Tables<'tbl_org_phones'>[];
|
|
100
|
-
labels: Tables<'tbl_org_labels'>[];
|
|
101
|
-
quick_replies: Tables<'tbl_quick_replies'>[];
|
|
102
|
-
custom_properties: Tables<'tbl_custom_properties'>[];
|
|
103
|
-
subscription_status: 'active' | 'inactive' | 'unpaid';
|
|
104
|
-
is_enterprise: boolean;
|
|
105
|
-
is_free_trial: boolean;
|
|
106
|
-
is_hubspot_connected: boolean;
|
|
107
|
-
is_freshdesk_connected: boolean;
|
|
108
|
-
is_zohodesk_connected: boolean;
|
|
109
|
-
access_scopes: AccessScopes;
|
|
110
|
-
}
|
|
111
|
-
>,
|
|
112
|
-
{
|
|
113
|
-
org_plan: OrgPlan<AllPlans | Enterprise>;
|
|
114
|
-
stripe_customer_details: _Stripe.Customer | null;
|
|
115
|
-
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
116
|
-
stripe_customer_id: _Stripe.Customer['id'] | null;
|
|
117
|
-
org_metadata: OrgMetadata;
|
|
118
|
-
}
|
|
119
|
-
>;
|
|
120
|
-
|
|
121
|
-
export type ChatMemberType = Merge<
|
|
122
|
-
Tables<'tbl_chat_participants'>,
|
|
123
|
-
Tables<'tbl_contacts'>
|
|
124
|
-
>;
|
|
125
|
-
|
|
126
|
-
export type ChatType = Merge<
|
|
127
|
-
Tables<'view_chats'>,
|
|
128
|
-
{
|
|
129
|
-
chat_id: string;
|
|
130
|
-
latest_message: MessageType | null;
|
|
131
|
-
members: { [key: string]: ChatMemberType } | null;
|
|
132
|
-
chat_type: 'user' | 'group' | 'business' | 'unknown';
|
|
133
|
-
chat_access: { [key: string]: boolean };
|
|
134
|
-
label_ids: { [key: string]: boolean };
|
|
135
|
-
chat_org_phones?: string[];
|
|
136
|
-
message_unread_count: number | null;
|
|
137
|
-
hubspot_metadata: {
|
|
138
|
-
id: string;
|
|
139
|
-
type: string;
|
|
140
|
-
hubId: string;
|
|
141
|
-
object_data: HubspotObjectDataType;
|
|
142
|
-
} | null;
|
|
143
|
-
info_admins_only: boolean;
|
|
144
|
-
messages_admins_only: boolean;
|
|
145
|
-
unread_count?: { [key: string]: number };
|
|
146
|
-
active_phone: string | null;
|
|
147
|
-
flag_count_map?: { [key: string]: number };
|
|
148
|
-
}
|
|
149
|
-
>;
|
|
150
|
-
|
|
151
|
-
/* -------------------------------------------------------------------------- */
|
|
152
|
-
/* MESSAGE */
|
|
153
|
-
/* -------------------------------------------------------------------------- */
|
|
154
|
-
|
|
155
|
-
export type MediaType = {
|
|
156
|
-
path: string;
|
|
157
|
-
mimetype?: string;
|
|
158
|
-
filename?: string;
|
|
159
|
-
dimensions?: { width: number; height: number; ar: number };
|
|
160
|
-
size?: number;
|
|
161
|
-
thumbnail?: string;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export type MessageType = OverrideProperties<
|
|
165
|
-
Tables<'tbl_chat_messages'>,
|
|
166
|
-
{
|
|
167
|
-
message_id: string;
|
|
168
|
-
org_id: string;
|
|
169
|
-
org_phone: string;
|
|
170
|
-
chat_id: string;
|
|
171
|
-
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
172
|
-
media: MediaType | null;
|
|
173
|
-
flag_metadata: MessageFlagType | null;
|
|
174
|
-
}
|
|
175
|
-
>;
|
|
176
|
-
|
|
177
|
-
export type MessageFlagType = {
|
|
178
|
-
status: boolean;
|
|
179
|
-
response_type?: 'message' | 'reaction' | 'ticket';
|
|
180
|
-
response_id?: string;
|
|
181
|
-
response_timestamp?: string;
|
|
182
|
-
response_email?: string;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
/* -------------------------------------------------------------------------- */
|
|
186
|
-
|
|
187
|
-
export type TicketType = OverrideProperties<
|
|
188
|
-
Tables<'tbl_chat_tickets'>,
|
|
189
|
-
{
|
|
190
|
-
label_ids: { [key: string]: boolean };
|
|
191
|
-
hubspot_metadata: {
|
|
192
|
-
id?: string;
|
|
193
|
-
type?: string;
|
|
194
|
-
hubId?: string;
|
|
195
|
-
pipeline: {
|
|
196
|
-
id: string;
|
|
197
|
-
label: string;
|
|
198
|
-
};
|
|
199
|
-
object_data?: HubspotObjectDataType;
|
|
200
|
-
} | null;
|
|
201
|
-
freshdesk_metadata: Record<string, string>;
|
|
202
|
-
close_ticket_metadata?:
|
|
203
|
-
| {
|
|
204
|
-
closed_by: string;
|
|
205
|
-
closed_at: string;
|
|
206
|
-
closed_message?: string | null;
|
|
207
|
-
send_reply_message_id?: string | null;
|
|
208
|
-
}
|
|
209
|
-
| any;
|
|
210
|
-
}
|
|
211
|
-
>;
|
|
212
|
-
|
|
213
|
-
export type ContactType = Merge<
|
|
214
|
-
Tables<'tbl_contacts'>,
|
|
215
|
-
{
|
|
216
|
-
chats: ChatType[] | null;
|
|
217
|
-
chat_ids?: string[];
|
|
218
|
-
}
|
|
219
|
-
>;
|
|
220
|
-
export type ReactionType = Tables<'tbl_chat_reactions'>;
|
|
221
|
-
|
|
222
|
-
export type NotificationType = Tables<'tbl_chat_notifications'>;
|
|
223
|
-
|
|
224
|
-
export type ChatAccessType = Merge<
|
|
225
|
-
TablesUpdate<'tbl_org_members'>,
|
|
226
|
-
{
|
|
227
|
-
has_access?: boolean;
|
|
228
|
-
email: string | null;
|
|
229
|
-
}
|
|
230
|
-
>;
|
|
231
|
-
|
|
232
|
-
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
233
|
-
|
|
234
|
-
export const labelColors = [
|
|
235
|
-
'#9333EA',
|
|
236
|
-
'#0D9488',
|
|
237
|
-
'#DB2777',
|
|
238
|
-
'#2563EB',
|
|
239
|
-
'#F97316',
|
|
240
|
-
];
|
|
241
|
-
|
|
242
|
-
export const enumChatColors = [
|
|
243
|
-
'#B4876E',
|
|
244
|
-
'#A5B337',
|
|
245
|
-
'#06CF9C',
|
|
246
|
-
'#25D366',
|
|
247
|
-
'#02A698',
|
|
248
|
-
'#7D9EF1',
|
|
249
|
-
'#007BFC',
|
|
250
|
-
'#5E47DE',
|
|
251
|
-
'#7F66FF',
|
|
252
|
-
'#9333EA',
|
|
253
|
-
'#FA6533',
|
|
254
|
-
'#C4532D',
|
|
255
|
-
'#DC2626',
|
|
256
|
-
'#FF2E74',
|
|
257
|
-
'#DB2777',
|
|
258
|
-
] as const;
|
|
259
|
-
|
|
260
|
-
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
261
|
-
|
|
262
|
-
export const SUPPORTED_TYPES = [
|
|
263
|
-
'chat',
|
|
264
|
-
'sticker',
|
|
265
|
-
'image',
|
|
266
|
-
'video',
|
|
267
|
-
'document',
|
|
268
|
-
'vcard',
|
|
269
|
-
'multi_vcard',
|
|
270
|
-
'audio',
|
|
271
|
-
'ptt',
|
|
272
|
-
'poll_creation',
|
|
273
|
-
'location',
|
|
274
|
-
'ciphertext',
|
|
275
|
-
] as const;
|
|
276
|
-
|
|
277
|
-
export type SendMessageContent = {
|
|
278
|
-
message_type?: (typeof SUPPORTED_TYPES)[number];
|
|
279
|
-
body?: string;
|
|
280
|
-
media?: MediaType;
|
|
281
|
-
contact_ids?: string[];
|
|
282
|
-
location?: {
|
|
283
|
-
latitude: string;
|
|
284
|
-
longitude: string;
|
|
285
|
-
options?: { name?: string; address?: string; url?: string };
|
|
286
|
-
};
|
|
287
|
-
poll?: {
|
|
288
|
-
pollName: string;
|
|
289
|
-
pollOptions: string[];
|
|
290
|
-
options?: {
|
|
291
|
-
allowMultipleAnswers?: boolean;
|
|
292
|
-
messageSecret?: number[] | null;
|
|
293
|
-
pollId?: string;
|
|
294
|
-
};
|
|
295
|
-
};
|
|
296
|
-
quoted_message_id?: string;
|
|
297
|
-
quoted_message_type?: 'reply' | 'forward' | 'reply_private';
|
|
298
|
-
broadcast_id?: string;
|
|
299
|
-
performed_by?: string;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
export type QuickReplyContent = Omit<
|
|
303
|
-
SendMessageContent,
|
|
304
|
-
'broadcast_id' | 'variables'
|
|
305
|
-
>;
|
|
306
|
-
|
|
307
|
-
export type BroadcastVariableType = {
|
|
308
|
-
chat_id: string;
|
|
309
|
-
values: { [key: string]: string };
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
export type BroadcastMessagePayload = SendMessageContent & {
|
|
313
|
-
chat_ids: string[];
|
|
314
|
-
broadcast_id?: string;
|
|
315
|
-
variables?: BroadcastVariableType[];
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
export type SingleMessagePayload = SendMessageContent & {
|
|
319
|
-
chat_id: string;
|
|
320
|
-
job_id?: string;
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
export type MessageAttachmentFileTypes =
|
|
324
|
-
| 'image'
|
|
325
|
-
| 'audio'
|
|
326
|
-
| 'document'
|
|
327
|
-
| 'video';
|
|
328
|
-
|
|
329
|
-
export type AttachmentFileType = {
|
|
330
|
-
result: string;
|
|
331
|
-
file: File | null;
|
|
332
|
-
type: MessageAttachmentFileTypes;
|
|
333
|
-
localFileURL?: string;
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
export type AttachmentLinkType = {
|
|
337
|
-
link: {
|
|
338
|
-
url: string;
|
|
339
|
-
type: MessageAttachmentFileTypes;
|
|
340
|
-
name: string;
|
|
341
|
-
mimetype?: string;
|
|
342
|
-
};
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
export type AttachmentTypeProps = AttachmentFileType | AttachmentLinkType;
|
|
346
|
-
|
|
347
|
-
/* -------------------------------- BROADCAST ------------------------------- */
|
|
348
|
-
|
|
349
|
-
export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
|
|
350
|
-
logs: (Tables<'tbl_broadcast_logs'> & Partial<ChatType>)[];
|
|
351
|
-
} & {
|
|
352
|
-
chats: ChatType[];
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
/* ----------------------- CHAT PARTICIPANT OPERATION ----------------------- */
|
|
356
|
-
|
|
357
|
-
export type ChatLogType = {
|
|
358
|
-
log: Tables<'view_chat_logs'>;
|
|
359
|
-
operations: Tables<'tbl_chat_logs'>[];
|
|
360
|
-
};
|
|
361
|
-
export type ChatOperationsType = 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
|
|
362
|
-
|
|
363
|
-
export type ChatParticipantOperationPayload = {
|
|
364
|
-
participant_ids: string[];
|
|
365
|
-
chat_ids: string[];
|
|
366
|
-
performed_by: string;
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
export type ChatOperationReturn = {
|
|
370
|
-
[participant_id: string]: {
|
|
371
|
-
is_success: boolean;
|
|
372
|
-
message?: string;
|
|
373
|
-
code?: number;
|
|
374
|
-
isInviteV4Sent?: boolean;
|
|
375
|
-
};
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
/* ----------------------- BILLING - STRIPE ----------------------- */
|
|
379
|
-
|
|
380
|
-
export type StripeSubscription = _Stripe.Subscription;
|
|
381
|
-
export type StripeCustomer = _Stripe.Customer;
|
|
382
|
-
export type StripeCoupon = _Stripe.Coupon;
|
|
383
|
-
export type StripePrice = _Stripe.Price;
|
|
384
|
-
export type Stripe = _Stripe;
|
|
385
|
-
export type StripeUpcomingInvoice = _Stripe.UpcomingInvoice;
|
|
386
|
-
export type StripeLineItem = _Stripe.Checkout.SessionCreateParams.LineItem;
|
|
387
|
-
|
|
388
|
-
/* -------------------------------- REALTIME -------------------------------- */
|
|
389
|
-
|
|
390
|
-
export type PhoneStateType = {
|
|
391
|
-
loading: boolean;
|
|
392
|
-
state: string;
|
|
393
|
-
sync: number;
|
|
394
|
-
percent: number | null;
|
|
395
|
-
message?: string;
|
|
396
|
-
error?: string;
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
/* ------------------------------- INTEGRATIONS ----------------------------- */
|
|
400
|
-
|
|
401
|
-
export type ChatInfoType = Merge<
|
|
402
|
-
ChatType,
|
|
403
|
-
{
|
|
404
|
-
members: {
|
|
405
|
-
[key: string]: Merge<ChatMemberType, { contact_labels: string }>;
|
|
406
|
-
} | null;
|
|
407
|
-
chat_labels: string | null;
|
|
408
|
-
custom_properties: { [key: string]: string } | null;
|
|
409
|
-
}
|
|
410
|
-
>;
|
|
411
|
-
|
|
412
|
-
export type TicketInfoType = {
|
|
413
|
-
chat: ChatInfoType;
|
|
414
|
-
message: {
|
|
415
|
-
body: string;
|
|
416
|
-
chat_id: string;
|
|
417
|
-
org_phone: string;
|
|
418
|
-
timestamp: string;
|
|
419
|
-
media_path: string;
|
|
420
|
-
message_id: string;
|
|
421
|
-
sender_name: string;
|
|
422
|
-
performed_by: string;
|
|
423
|
-
sender_phone: string;
|
|
424
|
-
};
|
|
425
|
-
ticket: {
|
|
426
|
-
org_id: string;
|
|
427
|
-
status: string;
|
|
428
|
-
subject: string;
|
|
429
|
-
assignee: string;
|
|
430
|
-
due_date: string;
|
|
431
|
-
priority: 0 | 1 | 2 | 3 | 4;
|
|
432
|
-
raised_by: string;
|
|
433
|
-
ticket_id: string;
|
|
434
|
-
created_at: string;
|
|
435
|
-
assigned_by: string;
|
|
436
|
-
ticket_labels: string;
|
|
437
|
-
quoted_message_id: string;
|
|
438
|
-
};
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
export enum IntegrationLogType {
|
|
442
|
-
NEW_CHAT = 'chat.created',
|
|
443
|
-
NEW_CHAT_NOTIFICATION = 'chat.notification.created',
|
|
444
|
-
NEW_MESSAGE = 'message.created',
|
|
445
|
-
MESSAGE_UPDATED = 'message.updated',
|
|
446
|
-
MESSAGE_DELETED = 'message.deleted',
|
|
447
|
-
MESSAGE_ACK_UPDATED = 'message.ack.updated',
|
|
448
|
-
REACTION_CREATED = 'reaction.created',
|
|
449
|
-
REACTION_UPDATED = 'reaction.updated',
|
|
450
|
-
NEW_TICKET = 'ticket.created',
|
|
451
|
-
TICKET_UPDATED = 'ticket.updated',
|
|
452
|
-
TICKET_DELETED = 'ticket.deleted',
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
export type IntegrationLogMetadataType<T extends IntegrationLogType> =
|
|
456
|
-
T extends IntegrationLogType.NEW_TICKET | IntegrationLogType.TICKET_UPDATED
|
|
457
|
-
? TicketInfoType
|
|
458
|
-
: T extends IntegrationLogType.NEW_CHAT
|
|
459
|
-
? Tables<'tbl_chats'>
|
|
460
|
-
: T extends
|
|
461
|
-
| IntegrationLogType.NEW_MESSAGE
|
|
462
|
-
| IntegrationLogType.MESSAGE_UPDATED
|
|
463
|
-
| IntegrationLogType.MESSAGE_DELETED
|
|
464
|
-
| IntegrationLogType.MESSAGE_ACK_UPDATED
|
|
465
|
-
? Tables<'tbl_chat_messages'>
|
|
466
|
-
: T extends
|
|
467
|
-
| IntegrationLogType.REACTION_CREATED
|
|
468
|
-
| IntegrationLogType.REACTION_UPDATED
|
|
469
|
-
? Tables<'tbl_chat_reactions'>
|
|
470
|
-
: {
|
|
471
|
-
[key: string]: unknown;
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
export type IntegrationLogDetailsType<T extends IntegrationLogType> =
|
|
475
|
-
OverrideProperties<
|
|
476
|
-
Tables<'tbl_integration_logs'>,
|
|
477
|
-
{
|
|
478
|
-
integration_name: T;
|
|
479
|
-
metadata: {
|
|
480
|
-
event: IntegrationLogMetadataType<T> & {
|
|
481
|
-
event_type: string;
|
|
482
|
-
org_id: string;
|
|
483
|
-
previous_attributes: {
|
|
484
|
-
[key: string]: unknown;
|
|
485
|
-
};
|
|
486
|
-
};
|
|
487
|
-
hook_id: string;
|
|
488
|
-
name: string;
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
>;
|
|
492
|
-
|
|
493
|
-
export type APIAuthDetails = {
|
|
494
|
-
org_details: Tables<'view_org'> | null;
|
|
495
|
-
phone_details: Tables<'tbl_org_phones'> | null;
|
|
496
|
-
token_details: Tables<'tbl_integration_tokens'> | null;
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
export type WebhookDataType = OverrideProperties<
|
|
500
|
-
Tables<'tbl_integration_hooks'>,
|
|
501
|
-
{
|
|
502
|
-
integration_name: string[];
|
|
503
|
-
}
|
|
504
|
-
>;
|
|
505
|
-
|
|
506
|
-
export type HubspotObjectDataType = {
|
|
507
|
-
createdAt: string;
|
|
508
|
-
archived: boolean;
|
|
509
|
-
id: string;
|
|
510
|
-
type: 'contacts' | 'tickets' | 'companies';
|
|
511
|
-
properties: Record<
|
|
512
|
-
string,
|
|
513
|
-
{
|
|
514
|
-
groupLabel: string;
|
|
515
|
-
groupName: string;
|
|
516
|
-
propertyKeyName: string;
|
|
517
|
-
propertyKey: string;
|
|
518
|
-
propertyInternalValue: string;
|
|
519
|
-
propertyValue: string;
|
|
520
|
-
propertyType: string;
|
|
521
|
-
propertyFieldType: string;
|
|
522
|
-
}[]
|
|
523
|
-
>;
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
/* ---------------------------- USER PREFERENCES ---------------------------- */
|
|
527
|
-
|
|
528
|
-
export type UserPreferences = {
|
|
529
|
-
theme: 'light' | 'dark';
|
|
530
|
-
language: 'en' | 'es';
|
|
531
|
-
left_sidebar_open: boolean;
|
|
532
|
-
right_sidepanel_open: boolean;
|
|
533
|
-
sync_wa_unread_count: boolean;
|
|
534
|
-
};
|
|
1
|
+
import type { default as _Stripe } from 'stripe';
|
|
2
|
+
import { Merge, OverrideProperties } from 'type-fest';
|
|
3
|
+
import { Tables, TablesUpdate } from './supabase.types';
|
|
4
|
+
|
|
5
|
+
/* ----------------------------- TYPE SHORTHANDS ---------------------------- */
|
|
6
|
+
|
|
7
|
+
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
8
|
+
|
|
9
|
+
export enum AllPlans {
|
|
10
|
+
FREE_TRIAL = 'free-trial',
|
|
11
|
+
// MONTHLY_STARTER = 'monthly-starter',
|
|
12
|
+
// YEARLY_STARTER = 'yearly-starter',
|
|
13
|
+
// MONTHLY_PRO = 'monthly-pro',
|
|
14
|
+
// YEARLY_PRO = 'yearly-pro',
|
|
15
|
+
ENTERPRISE = 'enterprise',
|
|
16
|
+
MONTHLY_STARTER_SINGLE = 'monthly-starter-single',
|
|
17
|
+
YEARLY_STARTER_SINGLE = 'yearly-starter-single',
|
|
18
|
+
MONTHLY_PRO_SINGLE = 'monthly-pro-single',
|
|
19
|
+
YEARLY_PRO_SINGLE = 'yearly-pro-single',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
|
|
23
|
+
|
|
24
|
+
export type Enterprise = `${string}-enterprise`;
|
|
25
|
+
|
|
26
|
+
export type OrgPlanEnterprise = {
|
|
27
|
+
subscription_id: string;
|
|
28
|
+
plan_id: Enterprise;
|
|
29
|
+
interval: number;
|
|
30
|
+
frequency: Frequency;
|
|
31
|
+
user_limit: number;
|
|
32
|
+
phone_limit: number;
|
|
33
|
+
current_period_start: number;
|
|
34
|
+
current_period_end: number | null;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type OrgPlanNonEnterprise = {
|
|
38
|
+
subscription_id: string;
|
|
39
|
+
plan_id: AllPlans;
|
|
40
|
+
interval: number;
|
|
41
|
+
frequency: Frequency;
|
|
42
|
+
user_limit: number;
|
|
43
|
+
phone_limit: number;
|
|
44
|
+
current_period_end: number;
|
|
45
|
+
current_period_start: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise
|
|
49
|
+
? OrgPlanEnterprise
|
|
50
|
+
: T extends AllPlans
|
|
51
|
+
? OrgPlanNonEnterprise
|
|
52
|
+
: never;
|
|
53
|
+
|
|
54
|
+
export type MicrosurveyData = {
|
|
55
|
+
key: string;
|
|
56
|
+
text: string;
|
|
57
|
+
checked: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
|
|
60
|
+
export type OrgPreferences = {
|
|
61
|
+
disable_ai_flagging?: boolean;
|
|
62
|
+
disable_allow_exports?: boolean;
|
|
63
|
+
sync_phone_contacts?: boolean;
|
|
64
|
+
mask_phone_numbers?: boolean;
|
|
65
|
+
show_sender_names?: boolean;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type OrgPreferenceKey = keyof OrgPreferences;
|
|
69
|
+
|
|
70
|
+
export type OrgPreferencesValue = {
|
|
71
|
+
[K in OrgPreferenceKey]: { key: K; value: OrgPreferences[K] };
|
|
72
|
+
}[OrgPreferenceKey];
|
|
73
|
+
|
|
74
|
+
export type OrgMetadata = {
|
|
75
|
+
phone_number: string;
|
|
76
|
+
ticket_prefix: string;
|
|
77
|
+
referralSource?: string;
|
|
78
|
+
surveyData?: MicrosurveyData;
|
|
79
|
+
preferences?: OrgPreferences;
|
|
80
|
+
hubspot_pipelines?: {
|
|
81
|
+
id: string;
|
|
82
|
+
label: string;
|
|
83
|
+
default_stage: { id: string; label: string };
|
|
84
|
+
}[];
|
|
85
|
+
partition?: boolean;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
type AccessScopes = {
|
|
89
|
+
integrations: boolean;
|
|
90
|
+
exports: boolean;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type OrgType = OverrideProperties<
|
|
94
|
+
Merge<
|
|
95
|
+
Tables<'tbl_org'>,
|
|
96
|
+
{
|
|
97
|
+
user: Tables<'tbl_org_members'>;
|
|
98
|
+
members: Tables<'tbl_org_members'>[];
|
|
99
|
+
phones: Tables<'tbl_org_phones'>[];
|
|
100
|
+
labels: Tables<'tbl_org_labels'>[];
|
|
101
|
+
quick_replies: Tables<'tbl_quick_replies'>[];
|
|
102
|
+
custom_properties: Tables<'tbl_custom_properties'>[];
|
|
103
|
+
subscription_status: 'active' | 'inactive' | 'unpaid';
|
|
104
|
+
is_enterprise: boolean;
|
|
105
|
+
is_free_trial: boolean;
|
|
106
|
+
is_hubspot_connected: boolean;
|
|
107
|
+
is_freshdesk_connected: boolean;
|
|
108
|
+
is_zohodesk_connected: boolean;
|
|
109
|
+
access_scopes: AccessScopes;
|
|
110
|
+
}
|
|
111
|
+
>,
|
|
112
|
+
{
|
|
113
|
+
org_plan: OrgPlan<AllPlans | Enterprise>;
|
|
114
|
+
stripe_customer_details: _Stripe.Customer | null;
|
|
115
|
+
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
116
|
+
stripe_customer_id: _Stripe.Customer['id'] | null;
|
|
117
|
+
org_metadata: OrgMetadata;
|
|
118
|
+
}
|
|
119
|
+
>;
|
|
120
|
+
|
|
121
|
+
export type ChatMemberType = Merge<
|
|
122
|
+
Tables<'tbl_chat_participants'>,
|
|
123
|
+
Tables<'tbl_contacts'>
|
|
124
|
+
>;
|
|
125
|
+
|
|
126
|
+
export type ChatType = Merge<
|
|
127
|
+
Tables<'view_chats'>,
|
|
128
|
+
{
|
|
129
|
+
chat_id: string;
|
|
130
|
+
latest_message: MessageType | null;
|
|
131
|
+
members: { [key: string]: ChatMemberType } | null;
|
|
132
|
+
chat_type: 'user' | 'group' | 'business' | 'unknown';
|
|
133
|
+
chat_access: { [key: string]: boolean };
|
|
134
|
+
label_ids: { [key: string]: boolean };
|
|
135
|
+
chat_org_phones?: string[];
|
|
136
|
+
message_unread_count: number | null;
|
|
137
|
+
hubspot_metadata: {
|
|
138
|
+
id: string;
|
|
139
|
+
type: string;
|
|
140
|
+
hubId: string;
|
|
141
|
+
object_data: HubspotObjectDataType;
|
|
142
|
+
} | null;
|
|
143
|
+
info_admins_only: boolean;
|
|
144
|
+
messages_admins_only: boolean;
|
|
145
|
+
unread_count?: { [key: string]: number };
|
|
146
|
+
active_phone: string | null;
|
|
147
|
+
flag_count_map?: { [key: string]: number };
|
|
148
|
+
}
|
|
149
|
+
>;
|
|
150
|
+
|
|
151
|
+
/* -------------------------------------------------------------------------- */
|
|
152
|
+
/* MESSAGE */
|
|
153
|
+
/* -------------------------------------------------------------------------- */
|
|
154
|
+
|
|
155
|
+
export type MediaType = {
|
|
156
|
+
path: string;
|
|
157
|
+
mimetype?: string;
|
|
158
|
+
filename?: string;
|
|
159
|
+
dimensions?: { width: number; height: number; ar: number };
|
|
160
|
+
size?: number;
|
|
161
|
+
thumbnail?: string;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type MessageType = OverrideProperties<
|
|
165
|
+
Tables<'tbl_chat_messages'>,
|
|
166
|
+
{
|
|
167
|
+
message_id: string;
|
|
168
|
+
org_id: string;
|
|
169
|
+
org_phone: string;
|
|
170
|
+
chat_id: string;
|
|
171
|
+
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
172
|
+
media: MediaType | null;
|
|
173
|
+
flag_metadata: MessageFlagType | null;
|
|
174
|
+
}
|
|
175
|
+
>;
|
|
176
|
+
|
|
177
|
+
export type MessageFlagType = {
|
|
178
|
+
status: boolean;
|
|
179
|
+
response_type?: 'message' | 'reaction' | 'ticket';
|
|
180
|
+
response_id?: string;
|
|
181
|
+
response_timestamp?: string;
|
|
182
|
+
response_email?: string;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/* -------------------------------------------------------------------------- */
|
|
186
|
+
|
|
187
|
+
export type TicketType = OverrideProperties<
|
|
188
|
+
Tables<'tbl_chat_tickets'>,
|
|
189
|
+
{
|
|
190
|
+
label_ids: { [key: string]: boolean };
|
|
191
|
+
hubspot_metadata: {
|
|
192
|
+
id?: string;
|
|
193
|
+
type?: string;
|
|
194
|
+
hubId?: string;
|
|
195
|
+
pipeline: {
|
|
196
|
+
id: string;
|
|
197
|
+
label: string;
|
|
198
|
+
};
|
|
199
|
+
object_data?: HubspotObjectDataType;
|
|
200
|
+
} | null;
|
|
201
|
+
freshdesk_metadata: Record<string, string>;
|
|
202
|
+
close_ticket_metadata?:
|
|
203
|
+
| {
|
|
204
|
+
closed_by: string;
|
|
205
|
+
closed_at: string;
|
|
206
|
+
closed_message?: string | null;
|
|
207
|
+
send_reply_message_id?: string | null;
|
|
208
|
+
}
|
|
209
|
+
| any;
|
|
210
|
+
}
|
|
211
|
+
>;
|
|
212
|
+
|
|
213
|
+
export type ContactType = Merge<
|
|
214
|
+
Tables<'tbl_contacts'>,
|
|
215
|
+
{
|
|
216
|
+
chats: ChatType[] | null;
|
|
217
|
+
chat_ids?: string[];
|
|
218
|
+
}
|
|
219
|
+
>;
|
|
220
|
+
export type ReactionType = Tables<'tbl_chat_reactions'>;
|
|
221
|
+
|
|
222
|
+
export type NotificationType = Tables<'tbl_chat_notifications'>;
|
|
223
|
+
|
|
224
|
+
export type ChatAccessType = Merge<
|
|
225
|
+
TablesUpdate<'tbl_org_members'>,
|
|
226
|
+
{
|
|
227
|
+
has_access?: boolean;
|
|
228
|
+
email: string | null;
|
|
229
|
+
}
|
|
230
|
+
>;
|
|
231
|
+
|
|
232
|
+
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
233
|
+
|
|
234
|
+
export const labelColors = [
|
|
235
|
+
'#9333EA',
|
|
236
|
+
'#0D9488',
|
|
237
|
+
'#DB2777',
|
|
238
|
+
'#2563EB',
|
|
239
|
+
'#F97316',
|
|
240
|
+
];
|
|
241
|
+
|
|
242
|
+
export const enumChatColors = [
|
|
243
|
+
'#B4876E',
|
|
244
|
+
'#A5B337',
|
|
245
|
+
'#06CF9C',
|
|
246
|
+
'#25D366',
|
|
247
|
+
'#02A698',
|
|
248
|
+
'#7D9EF1',
|
|
249
|
+
'#007BFC',
|
|
250
|
+
'#5E47DE',
|
|
251
|
+
'#7F66FF',
|
|
252
|
+
'#9333EA',
|
|
253
|
+
'#FA6533',
|
|
254
|
+
'#C4532D',
|
|
255
|
+
'#DC2626',
|
|
256
|
+
'#FF2E74',
|
|
257
|
+
'#DB2777',
|
|
258
|
+
] as const;
|
|
259
|
+
|
|
260
|
+
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
261
|
+
|
|
262
|
+
export const SUPPORTED_TYPES = [
|
|
263
|
+
'chat',
|
|
264
|
+
'sticker',
|
|
265
|
+
'image',
|
|
266
|
+
'video',
|
|
267
|
+
'document',
|
|
268
|
+
'vcard',
|
|
269
|
+
'multi_vcard',
|
|
270
|
+
'audio',
|
|
271
|
+
'ptt',
|
|
272
|
+
'poll_creation',
|
|
273
|
+
'location',
|
|
274
|
+
'ciphertext',
|
|
275
|
+
] as const;
|
|
276
|
+
|
|
277
|
+
export type SendMessageContent = {
|
|
278
|
+
message_type?: (typeof SUPPORTED_TYPES)[number];
|
|
279
|
+
body?: string;
|
|
280
|
+
media?: MediaType;
|
|
281
|
+
contact_ids?: string[];
|
|
282
|
+
location?: {
|
|
283
|
+
latitude: string;
|
|
284
|
+
longitude: string;
|
|
285
|
+
options?: { name?: string; address?: string; url?: string };
|
|
286
|
+
};
|
|
287
|
+
poll?: {
|
|
288
|
+
pollName: string;
|
|
289
|
+
pollOptions: string[];
|
|
290
|
+
options?: {
|
|
291
|
+
allowMultipleAnswers?: boolean;
|
|
292
|
+
messageSecret?: number[] | null;
|
|
293
|
+
pollId?: string;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
quoted_message_id?: string;
|
|
297
|
+
quoted_message_type?: 'reply' | 'forward' | 'reply_private';
|
|
298
|
+
broadcast_id?: string;
|
|
299
|
+
performed_by?: string;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
export type QuickReplyContent = Omit<
|
|
303
|
+
SendMessageContent,
|
|
304
|
+
'broadcast_id' | 'variables'
|
|
305
|
+
>;
|
|
306
|
+
|
|
307
|
+
export type BroadcastVariableType = {
|
|
308
|
+
chat_id: string;
|
|
309
|
+
values: { [key: string]: string };
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export type BroadcastMessagePayload = SendMessageContent & {
|
|
313
|
+
chat_ids: string[];
|
|
314
|
+
broadcast_id?: string;
|
|
315
|
+
variables?: BroadcastVariableType[];
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
export type SingleMessagePayload = SendMessageContent & {
|
|
319
|
+
chat_id: string;
|
|
320
|
+
job_id?: string;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
export type MessageAttachmentFileTypes =
|
|
324
|
+
| 'image'
|
|
325
|
+
| 'audio'
|
|
326
|
+
| 'document'
|
|
327
|
+
| 'video';
|
|
328
|
+
|
|
329
|
+
export type AttachmentFileType = {
|
|
330
|
+
result: string;
|
|
331
|
+
file: File | null;
|
|
332
|
+
type: MessageAttachmentFileTypes;
|
|
333
|
+
localFileURL?: string;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export type AttachmentLinkType = {
|
|
337
|
+
link: {
|
|
338
|
+
url: string;
|
|
339
|
+
type: MessageAttachmentFileTypes;
|
|
340
|
+
name: string;
|
|
341
|
+
mimetype?: string;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
export type AttachmentTypeProps = AttachmentFileType | AttachmentLinkType;
|
|
346
|
+
|
|
347
|
+
/* -------------------------------- BROADCAST ------------------------------- */
|
|
348
|
+
|
|
349
|
+
export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
|
|
350
|
+
logs: (Tables<'tbl_broadcast_logs'> & Partial<ChatType>)[];
|
|
351
|
+
} & {
|
|
352
|
+
chats: ChatType[];
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
/* ----------------------- CHAT PARTICIPANT OPERATION ----------------------- */
|
|
356
|
+
|
|
357
|
+
export type ChatLogType = {
|
|
358
|
+
log: Tables<'view_chat_logs'>;
|
|
359
|
+
operations: Tables<'tbl_chat_logs'>[];
|
|
360
|
+
};
|
|
361
|
+
export type ChatOperationsType = 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
|
|
362
|
+
|
|
363
|
+
export type ChatParticipantOperationPayload = {
|
|
364
|
+
participant_ids: string[];
|
|
365
|
+
chat_ids: string[];
|
|
366
|
+
performed_by: string;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
export type ChatOperationReturn = {
|
|
370
|
+
[participant_id: string]: {
|
|
371
|
+
is_success: boolean;
|
|
372
|
+
message?: string;
|
|
373
|
+
code?: number;
|
|
374
|
+
isInviteV4Sent?: boolean;
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
/* ----------------------- BILLING - STRIPE ----------------------- */
|
|
379
|
+
|
|
380
|
+
export type StripeSubscription = _Stripe.Subscription;
|
|
381
|
+
export type StripeCustomer = _Stripe.Customer;
|
|
382
|
+
export type StripeCoupon = _Stripe.Coupon;
|
|
383
|
+
export type StripePrice = _Stripe.Price;
|
|
384
|
+
export type Stripe = _Stripe;
|
|
385
|
+
export type StripeUpcomingInvoice = _Stripe.UpcomingInvoice;
|
|
386
|
+
export type StripeLineItem = _Stripe.Checkout.SessionCreateParams.LineItem;
|
|
387
|
+
|
|
388
|
+
/* -------------------------------- REALTIME -------------------------------- */
|
|
389
|
+
|
|
390
|
+
export type PhoneStateType = {
|
|
391
|
+
loading: boolean;
|
|
392
|
+
state: string;
|
|
393
|
+
sync: number;
|
|
394
|
+
percent: number | null;
|
|
395
|
+
message?: string;
|
|
396
|
+
error?: string;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/* ------------------------------- INTEGRATIONS ----------------------------- */
|
|
400
|
+
|
|
401
|
+
export type ChatInfoType = Merge<
|
|
402
|
+
ChatType,
|
|
403
|
+
{
|
|
404
|
+
members: {
|
|
405
|
+
[key: string]: Merge<ChatMemberType, { contact_labels: string }>;
|
|
406
|
+
} | null;
|
|
407
|
+
chat_labels: string | null;
|
|
408
|
+
custom_properties: { [key: string]: string } | null;
|
|
409
|
+
}
|
|
410
|
+
>;
|
|
411
|
+
|
|
412
|
+
export type TicketInfoType = {
|
|
413
|
+
chat: ChatInfoType;
|
|
414
|
+
message: {
|
|
415
|
+
body: string;
|
|
416
|
+
chat_id: string;
|
|
417
|
+
org_phone: string;
|
|
418
|
+
timestamp: string;
|
|
419
|
+
media_path: string;
|
|
420
|
+
message_id: string;
|
|
421
|
+
sender_name: string;
|
|
422
|
+
performed_by: string;
|
|
423
|
+
sender_phone: string;
|
|
424
|
+
};
|
|
425
|
+
ticket: {
|
|
426
|
+
org_id: string;
|
|
427
|
+
status: string;
|
|
428
|
+
subject: string;
|
|
429
|
+
assignee: string;
|
|
430
|
+
due_date: string;
|
|
431
|
+
priority: 0 | 1 | 2 | 3 | 4;
|
|
432
|
+
raised_by: string;
|
|
433
|
+
ticket_id: string;
|
|
434
|
+
created_at: string;
|
|
435
|
+
assigned_by: string;
|
|
436
|
+
ticket_labels: string;
|
|
437
|
+
quoted_message_id: string;
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
export enum IntegrationLogType {
|
|
442
|
+
NEW_CHAT = 'chat.created',
|
|
443
|
+
NEW_CHAT_NOTIFICATION = 'chat.notification.created',
|
|
444
|
+
NEW_MESSAGE = 'message.created',
|
|
445
|
+
MESSAGE_UPDATED = 'message.updated',
|
|
446
|
+
MESSAGE_DELETED = 'message.deleted',
|
|
447
|
+
MESSAGE_ACK_UPDATED = 'message.ack.updated',
|
|
448
|
+
REACTION_CREATED = 'reaction.created',
|
|
449
|
+
REACTION_UPDATED = 'reaction.updated',
|
|
450
|
+
NEW_TICKET = 'ticket.created',
|
|
451
|
+
TICKET_UPDATED = 'ticket.updated',
|
|
452
|
+
TICKET_DELETED = 'ticket.deleted',
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export type IntegrationLogMetadataType<T extends IntegrationLogType> =
|
|
456
|
+
T extends IntegrationLogType.NEW_TICKET | IntegrationLogType.TICKET_UPDATED
|
|
457
|
+
? TicketInfoType
|
|
458
|
+
: T extends IntegrationLogType.NEW_CHAT
|
|
459
|
+
? Tables<'tbl_chats'>
|
|
460
|
+
: T extends
|
|
461
|
+
| IntegrationLogType.NEW_MESSAGE
|
|
462
|
+
| IntegrationLogType.MESSAGE_UPDATED
|
|
463
|
+
| IntegrationLogType.MESSAGE_DELETED
|
|
464
|
+
| IntegrationLogType.MESSAGE_ACK_UPDATED
|
|
465
|
+
? Tables<'tbl_chat_messages'>
|
|
466
|
+
: T extends
|
|
467
|
+
| IntegrationLogType.REACTION_CREATED
|
|
468
|
+
| IntegrationLogType.REACTION_UPDATED
|
|
469
|
+
? Tables<'tbl_chat_reactions'>
|
|
470
|
+
: {
|
|
471
|
+
[key: string]: unknown;
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
export type IntegrationLogDetailsType<T extends IntegrationLogType> =
|
|
475
|
+
OverrideProperties<
|
|
476
|
+
Tables<'tbl_integration_logs'>,
|
|
477
|
+
{
|
|
478
|
+
integration_name: T;
|
|
479
|
+
metadata: {
|
|
480
|
+
event: IntegrationLogMetadataType<T> & {
|
|
481
|
+
event_type: string;
|
|
482
|
+
org_id: string;
|
|
483
|
+
previous_attributes: {
|
|
484
|
+
[key: string]: unknown;
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
hook_id: string;
|
|
488
|
+
name: string;
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
>;
|
|
492
|
+
|
|
493
|
+
export type APIAuthDetails = {
|
|
494
|
+
org_details: Tables<'view_org'> | null;
|
|
495
|
+
phone_details: Tables<'tbl_org_phones'> | null;
|
|
496
|
+
token_details: Tables<'tbl_integration_tokens'> | null;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
export type WebhookDataType = OverrideProperties<
|
|
500
|
+
Tables<'tbl_integration_hooks'>,
|
|
501
|
+
{
|
|
502
|
+
integration_name: string[];
|
|
503
|
+
}
|
|
504
|
+
>;
|
|
505
|
+
|
|
506
|
+
export type HubspotObjectDataType = {
|
|
507
|
+
createdAt: string;
|
|
508
|
+
archived: boolean;
|
|
509
|
+
id: string;
|
|
510
|
+
type: 'contacts' | 'tickets' | 'companies';
|
|
511
|
+
properties: Record<
|
|
512
|
+
string,
|
|
513
|
+
{
|
|
514
|
+
groupLabel: string;
|
|
515
|
+
groupName: string;
|
|
516
|
+
propertyKeyName: string;
|
|
517
|
+
propertyKey: string;
|
|
518
|
+
propertyInternalValue: string;
|
|
519
|
+
propertyValue: string;
|
|
520
|
+
propertyType: string;
|
|
521
|
+
propertyFieldType: string;
|
|
522
|
+
}[]
|
|
523
|
+
>;
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
/* ---------------------------- USER PREFERENCES ---------------------------- */
|
|
527
|
+
|
|
528
|
+
export type UserPreferences = {
|
|
529
|
+
theme: 'light' | 'dark';
|
|
530
|
+
language: 'en' | 'es';
|
|
531
|
+
left_sidebar_open: boolean;
|
|
532
|
+
right_sidepanel_open: boolean;
|
|
533
|
+
sync_wa_unread_count: boolean;
|
|
534
|
+
};
|