@periskope/types 0.6.309 → 0.6.310
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/rules.types.d.ts +47 -19
- package/dist/rules.types.d.ts.map +1 -1
- package/dist/rules.types.js +51 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/mod_json_type.ps1 +108 -108
- package/mod_json_type.sh +22 -22
- package/package.json +19 -19
- package/src/index.ts +4 -4
- package/src/object.types.ts +100 -100
- package/src/rules.types.ts +2304 -2210
- package/src/supabase.types.ts +3538 -3538
- package/src/types.ts +1511 -1510
- package/src/workflows.types.ts +955 -955
- package/tsconfig.json +37 -37
- package/tsconfig.tsbuildinfo +1 -1
- package/update_package.ps1 +21 -21
package/src/types.ts
CHANGED
|
@@ -1,1510 +1,1511 @@
|
|
|
1
|
-
import type { default as _Stripe } from 'stripe';
|
|
2
|
-
import { Merge, OverrideProperties } from 'type-fest';
|
|
3
|
-
import { Filter, Rule } from './rules.types';
|
|
4
|
-
import { Tables, TablesInsert, TablesUpdate } from './supabase.types';
|
|
5
|
-
|
|
6
|
-
/* ----------------------------- TYPE SHORTHANDS ---------------------------- */
|
|
7
|
-
|
|
8
|
-
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
9
|
-
|
|
10
|
-
export enum AllPlans {
|
|
11
|
-
FREE_TRIAL = 'free-trial',
|
|
12
|
-
// MONTHLY_STARTER = 'monthly-starter',
|
|
13
|
-
// YEARLY_STARTER = 'yearly-starter',
|
|
14
|
-
// MONTHLY_PRO = 'monthly-pro',
|
|
15
|
-
// YEARLY_PRO = 'yearly-pro',
|
|
16
|
-
ENTERPRISE = 'enterprise',
|
|
17
|
-
MONTHLY_STARTER_SINGLE = 'monthly-starter-single',
|
|
18
|
-
YEARLY_STARTER_SINGLE = 'yearly-starter-single',
|
|
19
|
-
MONTHLY_PRO_SINGLE = 'monthly-pro-single',
|
|
20
|
-
YEARLY_PRO_SINGLE = 'yearly-pro-single',
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
|
|
24
|
-
|
|
25
|
-
export type Enterprise = `${string}-enterprise`;
|
|
26
|
-
|
|
27
|
-
export type OrgPlanEnterprise = {
|
|
28
|
-
subscription_id: string;
|
|
29
|
-
plan_id: Enterprise;
|
|
30
|
-
interval: number;
|
|
31
|
-
frequency: Frequency;
|
|
32
|
-
user_limit: number;
|
|
33
|
-
phone_limit: number;
|
|
34
|
-
current_period_start: number;
|
|
35
|
-
current_period_end: number | null;
|
|
36
|
-
additional_user_limit?: number;
|
|
37
|
-
additional_phone_limit?: number;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export type OrgPlanNonEnterprise = {
|
|
41
|
-
subscription_id: string;
|
|
42
|
-
plan_id: AllPlans;
|
|
43
|
-
interval: number;
|
|
44
|
-
frequency: Frequency;
|
|
45
|
-
user_limit: number;
|
|
46
|
-
phone_limit: number;
|
|
47
|
-
current_period_end: number;
|
|
48
|
-
current_period_start: number;
|
|
49
|
-
additional_user_limit?: number;
|
|
50
|
-
additional_phone_limit?: number;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise
|
|
54
|
-
? OrgPlanEnterprise
|
|
55
|
-
: T extends AllPlans
|
|
56
|
-
? OrgPlanNonEnterprise
|
|
57
|
-
: never;
|
|
58
|
-
|
|
59
|
-
export type MicrosurveyData = {
|
|
60
|
-
key: string;
|
|
61
|
-
text: string;
|
|
62
|
-
checked: boolean;
|
|
63
|
-
}[];
|
|
64
|
-
|
|
65
|
-
export type OrgPreferences = {
|
|
66
|
-
disable_ai_flagging?: boolean;
|
|
67
|
-
disable_ai_responder?: boolean;
|
|
68
|
-
ai_responder_default_on?: boolean;
|
|
69
|
-
disable_allow_exports?: boolean;
|
|
70
|
-
disable_view_deleted_messages?: boolean;
|
|
71
|
-
sync_phone_contacts?: boolean;
|
|
72
|
-
mask_phone_numbers?: boolean;
|
|
73
|
-
show_sender_names?: boolean;
|
|
74
|
-
closed_chats?: Record<string, number>;
|
|
75
|
-
auto_read_muted_chats?: boolean;
|
|
76
|
-
member_permissions?: Record<string, boolean>;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
type OrgPreferenceKey = keyof OrgPreferences;
|
|
80
|
-
|
|
81
|
-
export type OrgPreferencesValue = {
|
|
82
|
-
[K in OrgPreferenceKey]: { key: K; value: OrgPreferences[K] };
|
|
83
|
-
}[OrgPreferenceKey];
|
|
84
|
-
|
|
85
|
-
export type OrgAISettings = {
|
|
86
|
-
ai_nickname?: string;
|
|
87
|
-
confidence_score?: string;
|
|
88
|
-
company_overview?: string;
|
|
89
|
-
ai_responder_roles?: string;
|
|
90
|
-
human_agent_roles?: string;
|
|
91
|
-
ticket_creation_rules?: string;
|
|
92
|
-
private_note_creation_rules?: string;
|
|
93
|
-
response_delay_value?: string;
|
|
94
|
-
snooze_delay_value?: string;
|
|
95
|
-
temperature?: string;
|
|
96
|
-
top_p?: string;
|
|
97
|
-
top_k?: string;
|
|
98
|
-
ai_maintain_flag_status?: boolean;
|
|
99
|
-
enable_shift_timing?: boolean;
|
|
100
|
-
shift_start_time?: string;
|
|
101
|
-
shift_end_time?: string;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
type OrgAISettingsKey = keyof OrgAISettings;
|
|
105
|
-
|
|
106
|
-
export type OrgAISettingsValue = {
|
|
107
|
-
[K in OrgAISettingsKey]: { key: K; value: OrgAISettings[K] };
|
|
108
|
-
}[OrgAISettingsKey];
|
|
109
|
-
|
|
110
|
-
export type CustomPropertySectionType = {
|
|
111
|
-
id: string;
|
|
112
|
-
name: string;
|
|
113
|
-
order: number;
|
|
114
|
-
type: 'chat' | 'ticket';
|
|
115
|
-
properties_order?: {
|
|
116
|
-
[id: string]: number;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export enum CustomPropertyValueType {
|
|
121
|
-
DROPDOWN = 'dropdown',
|
|
122
|
-
TEXT = 'text',
|
|
123
|
-
DATE = 'date',
|
|
124
|
-
FILE = 'file',
|
|
125
|
-
PICKLIST = 'picklist',
|
|
126
|
-
DEPENDENT_DROPDOWN = 'dependent_dropdown',
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export type CustomPropertyMetadataType = {
|
|
130
|
-
section_id?: string;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export type CustomPropertyTextPropertiesType = {
|
|
134
|
-
property_value_type: CustomPropertyValueType.TEXT;
|
|
135
|
-
property_value: null;
|
|
136
|
-
property_metadata: CustomPropertyMetadataType;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export type CustomPropertyDropdownPropertiesType = {
|
|
140
|
-
property_value_type: CustomPropertyValueType.DROPDOWN;
|
|
141
|
-
property_value: {
|
|
142
|
-
[key: string]: string;
|
|
143
|
-
};
|
|
144
|
-
property_metadata: CustomPropertyMetadataType;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export type CustomPropertyPicklistPropertiesType = {
|
|
148
|
-
property_value_type: CustomPropertyValueType.PICKLIST;
|
|
149
|
-
property_value: {
|
|
150
|
-
[key: string]: string;
|
|
151
|
-
};
|
|
152
|
-
property_metadata: CustomPropertyMetadataType;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export type CustomPropertyDependentDropdownPropertiesType = {
|
|
156
|
-
property_value_type: CustomPropertyValueType.DEPENDENT_DROPDOWN;
|
|
157
|
-
property_value: {
|
|
158
|
-
level_1: {
|
|
159
|
-
value: string;
|
|
160
|
-
label: string;
|
|
161
|
-
level_2: {
|
|
162
|
-
value: string;
|
|
163
|
-
label: string;
|
|
164
|
-
level_3: {
|
|
165
|
-
value: string;
|
|
166
|
-
label: string;
|
|
167
|
-
}[];
|
|
168
|
-
}[];
|
|
169
|
-
}[];
|
|
170
|
-
};
|
|
171
|
-
property_metadata: Merge<
|
|
172
|
-
CustomPropertyMetadataType,
|
|
173
|
-
{
|
|
174
|
-
level_names: {
|
|
175
|
-
level_1: string;
|
|
176
|
-
level_2: string;
|
|
177
|
-
level_3: string;
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
>;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export type CustomPropertyFilePropertiesType = {
|
|
184
|
-
property_value_type: CustomPropertyValueType.FILE;
|
|
185
|
-
property_value: null;
|
|
186
|
-
property_metadata: CustomPropertyMetadataType;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export type CustomPropertyDatePropertiesType = {
|
|
190
|
-
property_value_type: CustomPropertyValueType.DATE;
|
|
191
|
-
property_value: null;
|
|
192
|
-
property_metadata: CustomPropertyMetadataType;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export type CustomPropertyType = OverrideProperties<
|
|
196
|
-
Tables<'tbl_custom_properties'>,
|
|
197
|
-
| CustomPropertyDependentDropdownPropertiesType
|
|
198
|
-
| CustomPropertyTextPropertiesType
|
|
199
|
-
| CustomPropertyDropdownPropertiesType
|
|
200
|
-
| CustomPropertyPicklistPropertiesType
|
|
201
|
-
| CustomPropertyFilePropertiesType
|
|
202
|
-
| CustomPropertyDatePropertiesType
|
|
203
|
-
>;
|
|
204
|
-
|
|
205
|
-
export type OrgMetadata = {
|
|
206
|
-
phone_number: string;
|
|
207
|
-
ticket_prefix: string;
|
|
208
|
-
referralSource?: string;
|
|
209
|
-
surveyData?: MicrosurveyData;
|
|
210
|
-
preferences?: OrgPreferences;
|
|
211
|
-
hubspot: {
|
|
212
|
-
hubspot_pipelines?: {
|
|
213
|
-
id: string;
|
|
214
|
-
label: string;
|
|
215
|
-
default_stage: { id: string; label: string };
|
|
216
|
-
}[];
|
|
217
|
-
hubspot_hidden_fields?: string[];
|
|
218
|
-
};
|
|
219
|
-
partition?: boolean;
|
|
220
|
-
tickets: {
|
|
221
|
-
prefix?: string;
|
|
222
|
-
emoji_ticketing: {
|
|
223
|
-
is_enabled?: boolean;
|
|
224
|
-
is_message_enabled?: boolean;
|
|
225
|
-
message_template?: string;
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
attribution?: Object;
|
|
229
|
-
affiliate_id?: string;
|
|
230
|
-
custom_properties?: {
|
|
231
|
-
sections?: CustomPropertySectionType[];
|
|
232
|
-
};
|
|
233
|
-
rules?: {
|
|
234
|
-
limit?: number;
|
|
235
|
-
};
|
|
236
|
-
ai?: {
|
|
237
|
-
flag_prompt?: string;
|
|
238
|
-
};
|
|
239
|
-
display_language?: string;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
export type GroupTemplateType = OverrideProperties<
|
|
243
|
-
Tables<'tbl_group_templates'>,
|
|
244
|
-
{
|
|
245
|
-
group_metadata: {
|
|
246
|
-
messagesAdminsOnly?: boolean;
|
|
247
|
-
infoAdminsOnly?: boolean;
|
|
248
|
-
addMembersAdminsOnly?: boolean;
|
|
249
|
-
description?: string;
|
|
250
|
-
admins?: string[];
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
>;
|
|
254
|
-
|
|
255
|
-
type AccessScopes = {
|
|
256
|
-
feature_flags: Record<string, boolean>;
|
|
257
|
-
integrations: boolean;
|
|
258
|
-
rules: boolean;
|
|
259
|
-
exports: boolean;
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
export type OrgMembersType = OverrideProperties<
|
|
263
|
-
Tables<'tbl_org_members'>,
|
|
264
|
-
{
|
|
265
|
-
member_metadata: {
|
|
266
|
-
shift_times: {
|
|
267
|
-
[day in
|
|
268
|
-
| 'monday'
|
|
269
|
-
| 'tuesday'
|
|
270
|
-
| 'wednesday'
|
|
271
|
-
| 'thursday'
|
|
272
|
-
| 'friday'
|
|
273
|
-
| 'saturday'
|
|
274
|
-
| 'sunday']?: [[string, string]];
|
|
275
|
-
};
|
|
276
|
-
override_status: boolean;
|
|
277
|
-
[key: string]: any;
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
>;
|
|
281
|
-
|
|
282
|
-
export type OrgType = OverrideProperties<
|
|
283
|
-
Merge<
|
|
284
|
-
Tables<'tbl_org'>,
|
|
285
|
-
{
|
|
286
|
-
user: OrgMembersType;
|
|
287
|
-
members: OrgMembersType[];
|
|
288
|
-
phones: Tables<'tbl_org_phones'>[];
|
|
289
|
-
labels: Tables<'tbl_org_labels'>[];
|
|
290
|
-
quick_replies: Tables<'tbl_quick_replies'>[];
|
|
291
|
-
custom_properties: CustomPropertyType[];
|
|
292
|
-
subscription_status: 'active' | 'inactive' | 'unpaid';
|
|
293
|
-
is_enterprise: boolean;
|
|
294
|
-
is_free_trial: boolean;
|
|
295
|
-
is_hubspot_connected: boolean;
|
|
296
|
-
is_freshdesk_connected: boolean;
|
|
297
|
-
is_zohodesk_connected: boolean;
|
|
298
|
-
access_scopes: AccessScopes;
|
|
299
|
-
rules: Rule[];
|
|
300
|
-
phone_limit: number;
|
|
301
|
-
user_limit: number;
|
|
302
|
-
}
|
|
303
|
-
>,
|
|
304
|
-
{
|
|
305
|
-
org_plan: OrgPlan<AllPlans | Enterprise>;
|
|
306
|
-
stripe_customer_details: _Stripe.Customer | null;
|
|
307
|
-
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
308
|
-
stripe_customer_id: _Stripe.Customer['id'] | null;
|
|
309
|
-
org_metadata: OrgMetadata;
|
|
310
|
-
ai_settings: OrgAISettings;
|
|
311
|
-
}
|
|
312
|
-
>;
|
|
313
|
-
|
|
314
|
-
export type ChatMemberType = Merge<
|
|
315
|
-
Tables<'tbl_chat_participants'>,
|
|
316
|
-
Tables<'tbl_contacts'>
|
|
317
|
-
>;
|
|
318
|
-
|
|
319
|
-
export type ChatType = Merge<
|
|
320
|
-
Tables<'view_chats'>,
|
|
321
|
-
{
|
|
322
|
-
chat_id: string;
|
|
323
|
-
latest_message: MessageType | null;
|
|
324
|
-
latest_message_timestamp: number | null;
|
|
325
|
-
members: { [key: string]: ChatMemberType } | null;
|
|
326
|
-
chat_type: 'user' | 'group' | 'business' | 'unknown';
|
|
327
|
-
chat_access: { [key: string]: boolean };
|
|
328
|
-
label_ids: { [key: string]: boolean };
|
|
329
|
-
chat_org_phones?: string[];
|
|
330
|
-
message_unread_count: number | null;
|
|
331
|
-
hubspot_metadata: {
|
|
332
|
-
id: string;
|
|
333
|
-
type: string;
|
|
334
|
-
hubId: string;
|
|
335
|
-
object_data: HubspotObjectDataType;
|
|
336
|
-
} | null;
|
|
337
|
-
info_admins_only: boolean;
|
|
338
|
-
messages_admins_only: boolean;
|
|
339
|
-
unread_count?: { [key: string]: number };
|
|
340
|
-
active_phone: string | null;
|
|
341
|
-
flag_count_map?: { [key: string]: number };
|
|
342
|
-
is_archived?: boolean;
|
|
343
|
-
is_pinned?: boolean;
|
|
344
|
-
closed_at?: number | null;
|
|
345
|
-
common_chats?: string[];
|
|
346
|
-
freshdesk_metadata?: Record<string, any>;
|
|
347
|
-
zohodesk_metadata?: Record<string, any>;
|
|
348
|
-
pinned_messages?: {
|
|
349
|
-
message_id: string;
|
|
350
|
-
pinned_at: number;
|
|
351
|
-
expires_at: number;
|
|
352
|
-
}[];
|
|
353
|
-
group_metadata?: Record<string, any>;
|
|
354
|
-
snooze_metadata?: {
|
|
355
|
-
snooze_until: number;
|
|
356
|
-
snooze_message?: string;
|
|
357
|
-
snooze_by?: string;
|
|
358
|
-
};
|
|
359
|
-
member_unread_count?: {
|
|
360
|
-
[key: string]: number;
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
>;
|
|
364
|
-
|
|
365
|
-
/* -------------------------------------------------------------------------- */
|
|
366
|
-
/* MESSAGE */
|
|
367
|
-
/* -------------------------------------------------------------------------- */
|
|
368
|
-
|
|
369
|
-
export type MediaType = {
|
|
370
|
-
path?: string;
|
|
371
|
-
mimetype?: string;
|
|
372
|
-
filename?: string;
|
|
373
|
-
dimensions?: { width: number; height: number; ar: number };
|
|
374
|
-
size?: number;
|
|
375
|
-
thumbnail?: string;
|
|
376
|
-
filedata?: string;
|
|
377
|
-
compress?: boolean;
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
export type MessageType = Merge<
|
|
381
|
-
OverrideProperties<
|
|
382
|
-
TablesInsert<'tbl_chat_messages'>,
|
|
383
|
-
{
|
|
384
|
-
message_id: string;
|
|
385
|
-
org_id: string;
|
|
386
|
-
org_phone: string;
|
|
387
|
-
chat_id: string;
|
|
388
|
-
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
389
|
-
media: MediaType | null;
|
|
390
|
-
flag_metadata?: MessageFlagType | null;
|
|
391
|
-
poll_info?: PollSendType | null;
|
|
392
|
-
poll_results?: PollResultType | null;
|
|
393
|
-
delivery_info?: DeliveryInfoType | null;
|
|
394
|
-
raw_data?: {
|
|
395
|
-
translations?: Record<string, string>;
|
|
396
|
-
[key: string]: unknown;
|
|
397
|
-
} | null;
|
|
398
|
-
}
|
|
399
|
-
>,
|
|
400
|
-
{
|
|
401
|
-
reactions?: ReactionType[];
|
|
402
|
-
message_payload?: SingleMessagePayload;
|
|
403
|
-
highlight?: number;
|
|
404
|
-
is_private_note?: boolean;
|
|
405
|
-
}
|
|
406
|
-
>;
|
|
407
|
-
|
|
408
|
-
export type MessageFlagType = {
|
|
409
|
-
status: boolean;
|
|
410
|
-
response_type?: 'message' | 'reaction' | 'ticket' | 'manual';
|
|
411
|
-
response_id?: string;
|
|
412
|
-
response_timestamp?: string;
|
|
413
|
-
response_email?: string;
|
|
414
|
-
flagged_by?: string;
|
|
415
|
-
flagged_at?: string;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
export type MessageSendType = {
|
|
419
|
-
queue_id: string;
|
|
420
|
-
queue_position: string;
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
export type MessageBroadcastType = {
|
|
424
|
-
broadcast_id: string;
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
/* -------------------------------------------------------------------------- */
|
|
428
|
-
|
|
429
|
-
export type TicketType = OverrideProperties<
|
|
430
|
-
Tables<'tbl_chat_tickets'>,
|
|
431
|
-
{
|
|
432
|
-
label_ids: { [key: string]: boolean };
|
|
433
|
-
hubspot_metadata: {
|
|
434
|
-
id?: string;
|
|
435
|
-
type?: string;
|
|
436
|
-
hubId?: string;
|
|
437
|
-
pipeline: {
|
|
438
|
-
id: string;
|
|
439
|
-
label: string;
|
|
440
|
-
};
|
|
441
|
-
object_data?: HubspotObjectDataType;
|
|
442
|
-
} | null;
|
|
443
|
-
freshdesk_metadata: Record<string, string>;
|
|
444
|
-
close_ticket_metadata?:
|
|
445
|
-
| {
|
|
446
|
-
closed_by: string;
|
|
447
|
-
closed_at: string;
|
|
448
|
-
closed_message?: string | null;
|
|
449
|
-
send_reply_message_id?: string | null;
|
|
450
|
-
}
|
|
451
|
-
| any;
|
|
452
|
-
}
|
|
453
|
-
>;
|
|
454
|
-
|
|
455
|
-
export type ContactType = Merge<
|
|
456
|
-
Tables<'tbl_contacts'>,
|
|
457
|
-
{
|
|
458
|
-
chats: ChatType[] | null;
|
|
459
|
-
chat_ids?: string[];
|
|
460
|
-
}
|
|
461
|
-
>;
|
|
462
|
-
export type ReactionType = Tables<'tbl_chat_reactions'>;
|
|
463
|
-
|
|
464
|
-
export type NotificationType = Tables<'tbl_chat_notifications'>;
|
|
465
|
-
|
|
466
|
-
export type ChatAccessType = Merge<
|
|
467
|
-
TablesUpdate<'tbl_org_members'>,
|
|
468
|
-
{
|
|
469
|
-
has_access?: boolean;
|
|
470
|
-
email: string | null;
|
|
471
|
-
}
|
|
472
|
-
>;
|
|
473
|
-
|
|
474
|
-
export type QueueJobTypes = {
|
|
475
|
-
addedTimestamp: number;
|
|
476
|
-
attemptsMade: number;
|
|
477
|
-
attemptsStarted: number;
|
|
478
|
-
data: {
|
|
479
|
-
body: string;
|
|
480
|
-
chat_id: string;
|
|
481
|
-
};
|
|
482
|
-
finishedTimestamp: number;
|
|
483
|
-
id: string;
|
|
484
|
-
message_id: string;
|
|
485
|
-
processedTimestamp: number;
|
|
486
|
-
stacktrace: string[];
|
|
487
|
-
status: string;
|
|
488
|
-
};
|
|
489
|
-
|
|
490
|
-
export type PhoneQueueStatusType = {
|
|
491
|
-
active: number;
|
|
492
|
-
failed: number;
|
|
493
|
-
completed: number;
|
|
494
|
-
is_running: boolean;
|
|
495
|
-
pending: number;
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
export type PhoneType = OverrideProperties<
|
|
499
|
-
Tables<'tbl_org_phones'>,
|
|
500
|
-
{
|
|
501
|
-
queue_status: {
|
|
502
|
-
[key: string]: PhoneQueueStatusType;
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
>;
|
|
506
|
-
|
|
507
|
-
export type PhoneInfoType = Merge<
|
|
508
|
-
Pick<
|
|
509
|
-
PhoneType,
|
|
510
|
-
| 'created_at'
|
|
511
|
-
| 'first_connected_at'
|
|
512
|
-
| 'is_ready'
|
|
513
|
-
| 'label_ids'
|
|
514
|
-
| 'org_id'
|
|
515
|
-
| 'org_phone'
|
|
516
|
-
| 'phone_id'
|
|
517
|
-
| 'phone_image'
|
|
518
|
-
| 'phone_name'
|
|
519
|
-
| 'qr_code'
|
|
520
|
-
| 'updated_at'
|
|
521
|
-
| 'wa_state'
|
|
522
|
-
>,
|
|
523
|
-
{
|
|
524
|
-
labels: string[];
|
|
525
|
-
}
|
|
526
|
-
>;
|
|
527
|
-
|
|
528
|
-
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
529
|
-
|
|
530
|
-
export const labelColors = [
|
|
531
|
-
'#9333EA',
|
|
532
|
-
'#0D9488',
|
|
533
|
-
'#DB2777',
|
|
534
|
-
'#2563EB',
|
|
535
|
-
'#F97316',
|
|
536
|
-
];
|
|
537
|
-
|
|
538
|
-
export const enumChatColors = [
|
|
539
|
-
'#B4876E',
|
|
540
|
-
'#A5B337',
|
|
541
|
-
'#06CF9C',
|
|
542
|
-
'#25D366',
|
|
543
|
-
'#02A698',
|
|
544
|
-
'#7D9EF1',
|
|
545
|
-
'#007BFC',
|
|
546
|
-
'#5E47DE',
|
|
547
|
-
'#7F66FF',
|
|
548
|
-
'#9333EA',
|
|
549
|
-
'#FA6533',
|
|
550
|
-
'#C4532D',
|
|
551
|
-
'#DC2626',
|
|
552
|
-
'#FF2E74',
|
|
553
|
-
'#DB2777',
|
|
554
|
-
] as const;
|
|
555
|
-
|
|
556
|
-
export type RepeatDaysType =
|
|
557
|
-
| 'monday'
|
|
558
|
-
| 'tuesday'
|
|
559
|
-
| 'wednesday'
|
|
560
|
-
| 'thursday'
|
|
561
|
-
| 'friday'
|
|
562
|
-
| 'saturday'
|
|
563
|
-
| 'sunday';
|
|
564
|
-
export type RepeatIntervalType = 'day' | 'week' | 'month';
|
|
565
|
-
|
|
566
|
-
export enum WhatsappGroupActionEnum {
|
|
567
|
-
ADD = 'add',
|
|
568
|
-
REMOVE = 'remove',
|
|
569
|
-
PROMOTE = 'promote',
|
|
570
|
-
DEMOTE = 'demote',
|
|
571
|
-
INVITE = 'invite',
|
|
572
|
-
LEAVE = 'leave',
|
|
573
|
-
ANNOUNCE_TRUE = 'announce_true',
|
|
574
|
-
ANNOUNCE_FALSE = 'announce_false',
|
|
575
|
-
RESTRICT_TRUE = 'restrict_true',
|
|
576
|
-
RESTRICT_FALSE = 'restrict_false',
|
|
577
|
-
MEMBERADDMODE_TRUE = 'memberaddmode_true',
|
|
578
|
-
MEMBERADDMODE_FALSE = 'memberaddmode_false',
|
|
579
|
-
SUBJECT = 'subject',
|
|
580
|
-
DESC = 'desc',
|
|
581
|
-
CALL = 'call',
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
/* -------------------------- LISTING ENDPOINT -------------------------- */
|
|
585
|
-
|
|
586
|
-
type ListingType = {
|
|
587
|
-
from?: number;
|
|
588
|
-
to?: number;
|
|
589
|
-
count?: number;
|
|
590
|
-
};
|
|
591
|
-
|
|
592
|
-
export type ListNotificationsType = Merge<
|
|
593
|
-
ListingType,
|
|
594
|
-
{
|
|
595
|
-
notifictions?: NotificationType[];
|
|
596
|
-
}
|
|
597
|
-
>;
|
|
598
|
-
|
|
599
|
-
export type ListChatMessagesType = Merge<
|
|
600
|
-
ListingType,
|
|
601
|
-
{
|
|
602
|
-
messages?: MessageType[];
|
|
603
|
-
}
|
|
604
|
-
>;
|
|
605
|
-
|
|
606
|
-
export type ListContactsType = Merge<
|
|
607
|
-
ListingType,
|
|
608
|
-
{
|
|
609
|
-
contacts?: ContactType[];
|
|
610
|
-
}
|
|
611
|
-
>;
|
|
612
|
-
|
|
613
|
-
export type ListTicketsType = Merge<
|
|
614
|
-
ListingType,
|
|
615
|
-
{
|
|
616
|
-
tickets?: TicketType[];
|
|
617
|
-
}
|
|
618
|
-
>;
|
|
619
|
-
|
|
620
|
-
export type ListChatsType = Merge<
|
|
621
|
-
ListingType,
|
|
622
|
-
{
|
|
623
|
-
chats?: ChatType[];
|
|
624
|
-
}
|
|
625
|
-
>;
|
|
626
|
-
|
|
627
|
-
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
628
|
-
|
|
629
|
-
export const SUPPORTED_TYPES = [
|
|
630
|
-
'chat',
|
|
631
|
-
'sticker',
|
|
632
|
-
'image',
|
|
633
|
-
'video',
|
|
634
|
-
'document',
|
|
635
|
-
'vcard',
|
|
636
|
-
'multi_vcard',
|
|
637
|
-
'audio',
|
|
638
|
-
'ptt',
|
|
639
|
-
'poll_creation',
|
|
640
|
-
'location',
|
|
641
|
-
'ciphertext',
|
|
642
|
-
] as const;
|
|
643
|
-
|
|
644
|
-
export type SendMessageContent = {
|
|
645
|
-
message_type?: (typeof SUPPORTED_TYPES)[number];
|
|
646
|
-
body?: string;
|
|
647
|
-
media?: MediaType;
|
|
648
|
-
contact_ids?: string[];
|
|
649
|
-
location?: {
|
|
650
|
-
latitude: string;
|
|
651
|
-
longitude: string;
|
|
652
|
-
options?: { name?: string; address?: string; url?: string };
|
|
653
|
-
};
|
|
654
|
-
poll?: PollSendType;
|
|
655
|
-
quoted_message_id?: string;
|
|
656
|
-
quoted_message_type?: 'reply' | 'forward' | 'reply_private';
|
|
657
|
-
broadcast_id?: string;
|
|
658
|
-
performed_by?: string;
|
|
659
|
-
options?: Record<string, any>;
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
| '
|
|
701
|
-
| '
|
|
702
|
-
| '
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
export type
|
|
758
|
-
export type
|
|
759
|
-
export type
|
|
760
|
-
export type
|
|
761
|
-
export type
|
|
762
|
-
export type
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
| '
|
|
837
|
-
| '
|
|
838
|
-
| '
|
|
839
|
-
| '
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
| IntegrationLogType.
|
|
869
|
-
| IntegrationLogType.
|
|
870
|
-
| IntegrationLogType.
|
|
871
|
-
| IntegrationLogType.
|
|
872
|
-
| IntegrationLogType.
|
|
873
|
-
| IntegrationLogType.
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
| IntegrationLogType.
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
| IntegrationLogType.
|
|
882
|
-
| IntegrationLogType.
|
|
883
|
-
| IntegrationLogType.
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
| '
|
|
1037
|
-
| '
|
|
1038
|
-
| '
|
|
1039
|
-
| '
|
|
1040
|
-
| '
|
|
1041
|
-
| '
|
|
1042
|
-
| '
|
|
1043
|
-
| '
|
|
1044
|
-
| '
|
|
1045
|
-
| '
|
|
1046
|
-
| '
|
|
1047
|
-
| '
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
| '
|
|
1062
|
-
| '
|
|
1063
|
-
| '
|
|
1064
|
-
| '
|
|
1065
|
-
| '
|
|
1066
|
-
| '
|
|
1067
|
-
| '
|
|
1068
|
-
| '
|
|
1069
|
-
| '
|
|
1070
|
-
| '
|
|
1071
|
-
| '
|
|
1072
|
-
| '
|
|
1073
|
-
| '
|
|
1074
|
-
| '
|
|
1075
|
-
| '
|
|
1076
|
-
| '
|
|
1077
|
-
| '
|
|
1078
|
-
| '
|
|
1079
|
-
| '
|
|
1080
|
-
| '
|
|
1081
|
-
| '
|
|
1082
|
-
| '
|
|
1083
|
-
| '
|
|
1084
|
-
| '
|
|
1085
|
-
| '
|
|
1086
|
-
| '
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
| '
|
|
1102
|
-
| '
|
|
1103
|
-
| '
|
|
1104
|
-
| '
|
|
1105
|
-
| '
|
|
1106
|
-
| '
|
|
1107
|
-
| '
|
|
1108
|
-
| '
|
|
1109
|
-
| '
|
|
1110
|
-
| '
|
|
1111
|
-
| '
|
|
1112
|
-
| '
|
|
1113
|
-
| '
|
|
1114
|
-
| '
|
|
1115
|
-
| '
|
|
1116
|
-
| '
|
|
1117
|
-
| '
|
|
1118
|
-
| '
|
|
1119
|
-
| '
|
|
1120
|
-
| '
|
|
1121
|
-
| '
|
|
1122
|
-
| '
|
|
1123
|
-
| '
|
|
1124
|
-
| '
|
|
1125
|
-
| '
|
|
1126
|
-
| '
|
|
1127
|
-
| '
|
|
1128
|
-
| '
|
|
1129
|
-
| '
|
|
1130
|
-
| '
|
|
1131
|
-
| '
|
|
1132
|
-
| '
|
|
1133
|
-
| '
|
|
1134
|
-
| '
|
|
1135
|
-
| '
|
|
1136
|
-
| '
|
|
1137
|
-
| '
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
| '
|
|
1163
|
-
| '
|
|
1164
|
-
| '
|
|
1165
|
-
| '
|
|
1166
|
-
| '
|
|
1167
|
-
| '
|
|
1168
|
-
| '
|
|
1169
|
-
| '
|
|
1170
|
-
| '
|
|
1171
|
-
| '
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
>;
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
|
1235
|
-
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
};
|
|
1412
|
-
}
|
|
1413
|
-
>;
|
|
1414
|
-
|
|
1415
|
-
export type ZohodeskIntegrationTokenType = OverrideProperties<
|
|
1416
|
-
Tables<'tbl_integration_tokens'>,
|
|
1417
|
-
{
|
|
1418
|
-
type: 'zohodesk';
|
|
1419
|
-
token_metadata: {
|
|
1420
|
-
scope: string;
|
|
1421
|
-
domain: string;
|
|
1422
|
-
fields: Array<{
|
|
1423
|
-
id: string;
|
|
1424
|
-
name: string;
|
|
1425
|
-
type: string;
|
|
1426
|
-
apiName: string;
|
|
1427
|
-
toolTip: string;
|
|
1428
|
-
i18NLabel: string;
|
|
1429
|
-
maxLength: number;
|
|
1430
|
-
isMandatory: boolean;
|
|
1431
|
-
toolTipType: string;
|
|
1432
|
-
displayLabel: string;
|
|
1433
|
-
isCustomField: boolean;
|
|
1434
|
-
isEncryptedField: boolean;
|
|
1435
|
-
showToHelpCenter: boolean;
|
|
1436
|
-
}>;
|
|
1437
|
-
org_id: string;
|
|
1438
|
-
webhooks: {
|
|
1439
|
-
id: string;
|
|
1440
|
-
url: string;
|
|
1441
|
-
name: string;
|
|
1442
|
-
type: string;
|
|
1443
|
-
createdBy: string;
|
|
1444
|
-
isEnabled: boolean;
|
|
1445
|
-
createdTime: string;
|
|
1446
|
-
description: string;
|
|
1447
|
-
modifiedTime: string;
|
|
1448
|
-
subscriptions: {
|
|
1449
|
-
[key: string]: {
|
|
1450
|
-
departmentIds: string[];
|
|
1451
|
-
includePrevState: boolean;
|
|
1452
|
-
};
|
|
1453
|
-
};
|
|
1454
|
-
ignoreSourceId: boolean | null;
|
|
1455
|
-
includeEventsFrom: string[];
|
|
1456
|
-
};
|
|
1457
|
-
api_domain: string;
|
|
1458
|
-
authDomain: string;
|
|
1459
|
-
expires_in: number;
|
|
1460
|
-
token_type: string;
|
|
1461
|
-
departments: Array<{
|
|
1462
|
-
id: string;
|
|
1463
|
-
name: string;
|
|
1464
|
-
hasLogo: boolean;
|
|
1465
|
-
creatorId: string;
|
|
1466
|
-
isDefault: boolean;
|
|
1467
|
-
isEnabled: boolean;
|
|
1468
|
-
chatStatus: string;
|
|
1469
|
-
createdTime: string;
|
|
1470
|
-
description: string | null;
|
|
1471
|
-
sanitizedName: string;
|
|
1472
|
-
nameInCustomerPortal: string;
|
|
1473
|
-
isAssignToTeamEnabled: boolean;
|
|
1474
|
-
isVisibleInCustomerPortal: boolean;
|
|
1475
|
-
}>;
|
|
1476
|
-
org_details: {
|
|
1477
|
-
id: number;
|
|
1478
|
-
fax: string;
|
|
1479
|
-
zip: string;
|
|
1480
|
-
city: string;
|
|
1481
|
-
alias: string | null;
|
|
1482
|
-
state: string;
|
|
1483
|
-
mobile: string;
|
|
1484
|
-
street: string;
|
|
1485
|
-
country: string;
|
|
1486
|
-
edition: string;
|
|
1487
|
-
logoURL: string;
|
|
1488
|
-
website: string;
|
|
1489
|
-
isDefault: boolean;
|
|
1490
|
-
portalURL: string;
|
|
1491
|
-
faviconURL: string;
|
|
1492
|
-
portalName: string;
|
|
1493
|
-
companyName: string;
|
|
1494
|
-
description: string | null;
|
|
1495
|
-
phoneNumber: string | null;
|
|
1496
|
-
currencyCode: string;
|
|
1497
|
-
isAdminInOrg: boolean;
|
|
1498
|
-
employeeCount: number;
|
|
1499
|
-
currencyLocale: string;
|
|
1500
|
-
currencySymbol: string;
|
|
1501
|
-
primaryContact: string;
|
|
1502
|
-
isSandboxPortal: boolean;
|
|
1503
|
-
isPayloadEncryptionEnabled: boolean;
|
|
1504
|
-
};
|
|
1505
|
-
access_token: string;
|
|
1506
|
-
refresh_token: string;
|
|
1507
|
-
integration_org_id: string | number;
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1
|
+
import type { default as _Stripe } from 'stripe';
|
|
2
|
+
import { Merge, OverrideProperties } from 'type-fest';
|
|
3
|
+
import { Filter, Rule } from './rules.types';
|
|
4
|
+
import { Tables, TablesInsert, TablesUpdate } from './supabase.types';
|
|
5
|
+
|
|
6
|
+
/* ----------------------------- TYPE SHORTHANDS ---------------------------- */
|
|
7
|
+
|
|
8
|
+
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
9
|
+
|
|
10
|
+
export enum AllPlans {
|
|
11
|
+
FREE_TRIAL = 'free-trial',
|
|
12
|
+
// MONTHLY_STARTER = 'monthly-starter',
|
|
13
|
+
// YEARLY_STARTER = 'yearly-starter',
|
|
14
|
+
// MONTHLY_PRO = 'monthly-pro',
|
|
15
|
+
// YEARLY_PRO = 'yearly-pro',
|
|
16
|
+
ENTERPRISE = 'enterprise',
|
|
17
|
+
MONTHLY_STARTER_SINGLE = 'monthly-starter-single',
|
|
18
|
+
YEARLY_STARTER_SINGLE = 'yearly-starter-single',
|
|
19
|
+
MONTHLY_PRO_SINGLE = 'monthly-pro-single',
|
|
20
|
+
YEARLY_PRO_SINGLE = 'yearly-pro-single',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
|
|
24
|
+
|
|
25
|
+
export type Enterprise = `${string}-enterprise`;
|
|
26
|
+
|
|
27
|
+
export type OrgPlanEnterprise = {
|
|
28
|
+
subscription_id: string;
|
|
29
|
+
plan_id: Enterprise;
|
|
30
|
+
interval: number;
|
|
31
|
+
frequency: Frequency;
|
|
32
|
+
user_limit: number;
|
|
33
|
+
phone_limit: number;
|
|
34
|
+
current_period_start: number;
|
|
35
|
+
current_period_end: number | null;
|
|
36
|
+
additional_user_limit?: number;
|
|
37
|
+
additional_phone_limit?: number;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type OrgPlanNonEnterprise = {
|
|
41
|
+
subscription_id: string;
|
|
42
|
+
plan_id: AllPlans;
|
|
43
|
+
interval: number;
|
|
44
|
+
frequency: Frequency;
|
|
45
|
+
user_limit: number;
|
|
46
|
+
phone_limit: number;
|
|
47
|
+
current_period_end: number;
|
|
48
|
+
current_period_start: number;
|
|
49
|
+
additional_user_limit?: number;
|
|
50
|
+
additional_phone_limit?: number;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise
|
|
54
|
+
? OrgPlanEnterprise
|
|
55
|
+
: T extends AllPlans
|
|
56
|
+
? OrgPlanNonEnterprise
|
|
57
|
+
: never;
|
|
58
|
+
|
|
59
|
+
export type MicrosurveyData = {
|
|
60
|
+
key: string;
|
|
61
|
+
text: string;
|
|
62
|
+
checked: boolean;
|
|
63
|
+
}[];
|
|
64
|
+
|
|
65
|
+
export type OrgPreferences = {
|
|
66
|
+
disable_ai_flagging?: boolean;
|
|
67
|
+
disable_ai_responder?: boolean;
|
|
68
|
+
ai_responder_default_on?: boolean;
|
|
69
|
+
disable_allow_exports?: boolean;
|
|
70
|
+
disable_view_deleted_messages?: boolean;
|
|
71
|
+
sync_phone_contacts?: boolean;
|
|
72
|
+
mask_phone_numbers?: boolean;
|
|
73
|
+
show_sender_names?: boolean;
|
|
74
|
+
closed_chats?: Record<string, number>;
|
|
75
|
+
auto_read_muted_chats?: boolean;
|
|
76
|
+
member_permissions?: Record<string, boolean>;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
type OrgPreferenceKey = keyof OrgPreferences;
|
|
80
|
+
|
|
81
|
+
export type OrgPreferencesValue = {
|
|
82
|
+
[K in OrgPreferenceKey]: { key: K; value: OrgPreferences[K] };
|
|
83
|
+
}[OrgPreferenceKey];
|
|
84
|
+
|
|
85
|
+
export type OrgAISettings = {
|
|
86
|
+
ai_nickname?: string;
|
|
87
|
+
confidence_score?: string;
|
|
88
|
+
company_overview?: string;
|
|
89
|
+
ai_responder_roles?: string;
|
|
90
|
+
human_agent_roles?: string;
|
|
91
|
+
ticket_creation_rules?: string;
|
|
92
|
+
private_note_creation_rules?: string;
|
|
93
|
+
response_delay_value?: string;
|
|
94
|
+
snooze_delay_value?: string;
|
|
95
|
+
temperature?: string;
|
|
96
|
+
top_p?: string;
|
|
97
|
+
top_k?: string;
|
|
98
|
+
ai_maintain_flag_status?: boolean;
|
|
99
|
+
enable_shift_timing?: boolean;
|
|
100
|
+
shift_start_time?: string;
|
|
101
|
+
shift_end_time?: string;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
type OrgAISettingsKey = keyof OrgAISettings;
|
|
105
|
+
|
|
106
|
+
export type OrgAISettingsValue = {
|
|
107
|
+
[K in OrgAISettingsKey]: { key: K; value: OrgAISettings[K] };
|
|
108
|
+
}[OrgAISettingsKey];
|
|
109
|
+
|
|
110
|
+
export type CustomPropertySectionType = {
|
|
111
|
+
id: string;
|
|
112
|
+
name: string;
|
|
113
|
+
order: number;
|
|
114
|
+
type: 'chat' | 'ticket';
|
|
115
|
+
properties_order?: {
|
|
116
|
+
[id: string]: number;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export enum CustomPropertyValueType {
|
|
121
|
+
DROPDOWN = 'dropdown',
|
|
122
|
+
TEXT = 'text',
|
|
123
|
+
DATE = 'date',
|
|
124
|
+
FILE = 'file',
|
|
125
|
+
PICKLIST = 'picklist',
|
|
126
|
+
DEPENDENT_DROPDOWN = 'dependent_dropdown',
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type CustomPropertyMetadataType = {
|
|
130
|
+
section_id?: string;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export type CustomPropertyTextPropertiesType = {
|
|
134
|
+
property_value_type: CustomPropertyValueType.TEXT;
|
|
135
|
+
property_value: null;
|
|
136
|
+
property_metadata: CustomPropertyMetadataType;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type CustomPropertyDropdownPropertiesType = {
|
|
140
|
+
property_value_type: CustomPropertyValueType.DROPDOWN;
|
|
141
|
+
property_value: {
|
|
142
|
+
[key: string]: string;
|
|
143
|
+
};
|
|
144
|
+
property_metadata: CustomPropertyMetadataType;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export type CustomPropertyPicklistPropertiesType = {
|
|
148
|
+
property_value_type: CustomPropertyValueType.PICKLIST;
|
|
149
|
+
property_value: {
|
|
150
|
+
[key: string]: string;
|
|
151
|
+
};
|
|
152
|
+
property_metadata: CustomPropertyMetadataType;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type CustomPropertyDependentDropdownPropertiesType = {
|
|
156
|
+
property_value_type: CustomPropertyValueType.DEPENDENT_DROPDOWN;
|
|
157
|
+
property_value: {
|
|
158
|
+
level_1: {
|
|
159
|
+
value: string;
|
|
160
|
+
label: string;
|
|
161
|
+
level_2: {
|
|
162
|
+
value: string;
|
|
163
|
+
label: string;
|
|
164
|
+
level_3: {
|
|
165
|
+
value: string;
|
|
166
|
+
label: string;
|
|
167
|
+
}[];
|
|
168
|
+
}[];
|
|
169
|
+
}[];
|
|
170
|
+
};
|
|
171
|
+
property_metadata: Merge<
|
|
172
|
+
CustomPropertyMetadataType,
|
|
173
|
+
{
|
|
174
|
+
level_names: {
|
|
175
|
+
level_1: string;
|
|
176
|
+
level_2: string;
|
|
177
|
+
level_3: string;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
>;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type CustomPropertyFilePropertiesType = {
|
|
184
|
+
property_value_type: CustomPropertyValueType.FILE;
|
|
185
|
+
property_value: null;
|
|
186
|
+
property_metadata: CustomPropertyMetadataType;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export type CustomPropertyDatePropertiesType = {
|
|
190
|
+
property_value_type: CustomPropertyValueType.DATE;
|
|
191
|
+
property_value: null;
|
|
192
|
+
property_metadata: CustomPropertyMetadataType;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export type CustomPropertyType = OverrideProperties<
|
|
196
|
+
Tables<'tbl_custom_properties'>,
|
|
197
|
+
| CustomPropertyDependentDropdownPropertiesType
|
|
198
|
+
| CustomPropertyTextPropertiesType
|
|
199
|
+
| CustomPropertyDropdownPropertiesType
|
|
200
|
+
| CustomPropertyPicklistPropertiesType
|
|
201
|
+
| CustomPropertyFilePropertiesType
|
|
202
|
+
| CustomPropertyDatePropertiesType
|
|
203
|
+
>;
|
|
204
|
+
|
|
205
|
+
export type OrgMetadata = {
|
|
206
|
+
phone_number: string;
|
|
207
|
+
ticket_prefix: string;
|
|
208
|
+
referralSource?: string;
|
|
209
|
+
surveyData?: MicrosurveyData;
|
|
210
|
+
preferences?: OrgPreferences;
|
|
211
|
+
hubspot: {
|
|
212
|
+
hubspot_pipelines?: {
|
|
213
|
+
id: string;
|
|
214
|
+
label: string;
|
|
215
|
+
default_stage: { id: string; label: string };
|
|
216
|
+
}[];
|
|
217
|
+
hubspot_hidden_fields?: string[];
|
|
218
|
+
};
|
|
219
|
+
partition?: boolean;
|
|
220
|
+
tickets: {
|
|
221
|
+
prefix?: string;
|
|
222
|
+
emoji_ticketing: {
|
|
223
|
+
is_enabled?: boolean;
|
|
224
|
+
is_message_enabled?: boolean;
|
|
225
|
+
message_template?: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
attribution?: Object;
|
|
229
|
+
affiliate_id?: string;
|
|
230
|
+
custom_properties?: {
|
|
231
|
+
sections?: CustomPropertySectionType[];
|
|
232
|
+
};
|
|
233
|
+
rules?: {
|
|
234
|
+
limit?: number;
|
|
235
|
+
};
|
|
236
|
+
ai?: {
|
|
237
|
+
flag_prompt?: string;
|
|
238
|
+
};
|
|
239
|
+
display_language?: string;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export type GroupTemplateType = OverrideProperties<
|
|
243
|
+
Tables<'tbl_group_templates'>,
|
|
244
|
+
{
|
|
245
|
+
group_metadata: {
|
|
246
|
+
messagesAdminsOnly?: boolean;
|
|
247
|
+
infoAdminsOnly?: boolean;
|
|
248
|
+
addMembersAdminsOnly?: boolean;
|
|
249
|
+
description?: string;
|
|
250
|
+
admins?: string[];
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
>;
|
|
254
|
+
|
|
255
|
+
type AccessScopes = {
|
|
256
|
+
feature_flags: Record<string, boolean>;
|
|
257
|
+
integrations: boolean;
|
|
258
|
+
rules: boolean;
|
|
259
|
+
exports: boolean;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export type OrgMembersType = OverrideProperties<
|
|
263
|
+
Tables<'tbl_org_members'>,
|
|
264
|
+
{
|
|
265
|
+
member_metadata: {
|
|
266
|
+
shift_times: {
|
|
267
|
+
[day in
|
|
268
|
+
| 'monday'
|
|
269
|
+
| 'tuesday'
|
|
270
|
+
| 'wednesday'
|
|
271
|
+
| 'thursday'
|
|
272
|
+
| 'friday'
|
|
273
|
+
| 'saturday'
|
|
274
|
+
| 'sunday']?: [[string, string]];
|
|
275
|
+
};
|
|
276
|
+
override_status: boolean;
|
|
277
|
+
[key: string]: any;
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
>;
|
|
281
|
+
|
|
282
|
+
export type OrgType = OverrideProperties<
|
|
283
|
+
Merge<
|
|
284
|
+
Tables<'tbl_org'>,
|
|
285
|
+
{
|
|
286
|
+
user: OrgMembersType;
|
|
287
|
+
members: OrgMembersType[];
|
|
288
|
+
phones: Tables<'tbl_org_phones'>[];
|
|
289
|
+
labels: Tables<'tbl_org_labels'>[];
|
|
290
|
+
quick_replies: Tables<'tbl_quick_replies'>[];
|
|
291
|
+
custom_properties: CustomPropertyType[];
|
|
292
|
+
subscription_status: 'active' | 'inactive' | 'unpaid';
|
|
293
|
+
is_enterprise: boolean;
|
|
294
|
+
is_free_trial: boolean;
|
|
295
|
+
is_hubspot_connected: boolean;
|
|
296
|
+
is_freshdesk_connected: boolean;
|
|
297
|
+
is_zohodesk_connected: boolean;
|
|
298
|
+
access_scopes: AccessScopes;
|
|
299
|
+
rules: Rule[];
|
|
300
|
+
phone_limit: number;
|
|
301
|
+
user_limit: number;
|
|
302
|
+
}
|
|
303
|
+
>,
|
|
304
|
+
{
|
|
305
|
+
org_plan: OrgPlan<AllPlans | Enterprise>;
|
|
306
|
+
stripe_customer_details: _Stripe.Customer | null;
|
|
307
|
+
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
308
|
+
stripe_customer_id: _Stripe.Customer['id'] | null;
|
|
309
|
+
org_metadata: OrgMetadata;
|
|
310
|
+
ai_settings: OrgAISettings;
|
|
311
|
+
}
|
|
312
|
+
>;
|
|
313
|
+
|
|
314
|
+
export type ChatMemberType = Merge<
|
|
315
|
+
Tables<'tbl_chat_participants'>,
|
|
316
|
+
Tables<'tbl_contacts'>
|
|
317
|
+
>;
|
|
318
|
+
|
|
319
|
+
export type ChatType = Merge<
|
|
320
|
+
Tables<'view_chats'>,
|
|
321
|
+
{
|
|
322
|
+
chat_id: string;
|
|
323
|
+
latest_message: MessageType | null;
|
|
324
|
+
latest_message_timestamp: number | null;
|
|
325
|
+
members: { [key: string]: ChatMemberType } | null;
|
|
326
|
+
chat_type: 'user' | 'group' | 'business' | 'unknown';
|
|
327
|
+
chat_access: { [key: string]: boolean };
|
|
328
|
+
label_ids: { [key: string]: boolean };
|
|
329
|
+
chat_org_phones?: string[];
|
|
330
|
+
message_unread_count: number | null;
|
|
331
|
+
hubspot_metadata: {
|
|
332
|
+
id: string;
|
|
333
|
+
type: string;
|
|
334
|
+
hubId: string;
|
|
335
|
+
object_data: HubspotObjectDataType;
|
|
336
|
+
} | null;
|
|
337
|
+
info_admins_only: boolean;
|
|
338
|
+
messages_admins_only: boolean;
|
|
339
|
+
unread_count?: { [key: string]: number };
|
|
340
|
+
active_phone: string | null;
|
|
341
|
+
flag_count_map?: { [key: string]: number };
|
|
342
|
+
is_archived?: boolean;
|
|
343
|
+
is_pinned?: boolean;
|
|
344
|
+
closed_at?: number | null;
|
|
345
|
+
common_chats?: string[];
|
|
346
|
+
freshdesk_metadata?: Record<string, any>;
|
|
347
|
+
zohodesk_metadata?: Record<string, any>;
|
|
348
|
+
pinned_messages?: {
|
|
349
|
+
message_id: string;
|
|
350
|
+
pinned_at: number;
|
|
351
|
+
expires_at: number;
|
|
352
|
+
}[];
|
|
353
|
+
group_metadata?: Record<string, any>;
|
|
354
|
+
snooze_metadata?: {
|
|
355
|
+
snooze_until: number;
|
|
356
|
+
snooze_message?: string;
|
|
357
|
+
snooze_by?: string;
|
|
358
|
+
};
|
|
359
|
+
member_unread_count?: {
|
|
360
|
+
[key: string]: number;
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
>;
|
|
364
|
+
|
|
365
|
+
/* -------------------------------------------------------------------------- */
|
|
366
|
+
/* MESSAGE */
|
|
367
|
+
/* -------------------------------------------------------------------------- */
|
|
368
|
+
|
|
369
|
+
export type MediaType = {
|
|
370
|
+
path?: string;
|
|
371
|
+
mimetype?: string;
|
|
372
|
+
filename?: string;
|
|
373
|
+
dimensions?: { width: number; height: number; ar: number };
|
|
374
|
+
size?: number;
|
|
375
|
+
thumbnail?: string;
|
|
376
|
+
filedata?: string;
|
|
377
|
+
compress?: boolean;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
export type MessageType = Merge<
|
|
381
|
+
OverrideProperties<
|
|
382
|
+
TablesInsert<'tbl_chat_messages'>,
|
|
383
|
+
{
|
|
384
|
+
message_id: string;
|
|
385
|
+
org_id: string;
|
|
386
|
+
org_phone: string;
|
|
387
|
+
chat_id: string;
|
|
388
|
+
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
389
|
+
media: MediaType | null;
|
|
390
|
+
flag_metadata?: MessageFlagType | null;
|
|
391
|
+
poll_info?: PollSendType | null;
|
|
392
|
+
poll_results?: PollResultType | null;
|
|
393
|
+
delivery_info?: DeliveryInfoType | null;
|
|
394
|
+
raw_data?: {
|
|
395
|
+
translations?: Record<string, string>;
|
|
396
|
+
[key: string]: unknown;
|
|
397
|
+
} | null;
|
|
398
|
+
}
|
|
399
|
+
>,
|
|
400
|
+
{
|
|
401
|
+
reactions?: ReactionType[];
|
|
402
|
+
message_payload?: SingleMessagePayload;
|
|
403
|
+
highlight?: number;
|
|
404
|
+
is_private_note?: boolean;
|
|
405
|
+
}
|
|
406
|
+
>;
|
|
407
|
+
|
|
408
|
+
export type MessageFlagType = {
|
|
409
|
+
status: boolean;
|
|
410
|
+
response_type?: 'message' | 'reaction' | 'ticket' | 'manual';
|
|
411
|
+
response_id?: string;
|
|
412
|
+
response_timestamp?: string;
|
|
413
|
+
response_email?: string;
|
|
414
|
+
flagged_by?: string;
|
|
415
|
+
flagged_at?: string;
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
export type MessageSendType = {
|
|
419
|
+
queue_id: string;
|
|
420
|
+
queue_position: string;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
export type MessageBroadcastType = {
|
|
424
|
+
broadcast_id: string;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
/* -------------------------------------------------------------------------- */
|
|
428
|
+
|
|
429
|
+
export type TicketType = OverrideProperties<
|
|
430
|
+
Tables<'tbl_chat_tickets'>,
|
|
431
|
+
{
|
|
432
|
+
label_ids: { [key: string]: boolean };
|
|
433
|
+
hubspot_metadata: {
|
|
434
|
+
id?: string;
|
|
435
|
+
type?: string;
|
|
436
|
+
hubId?: string;
|
|
437
|
+
pipeline: {
|
|
438
|
+
id: string;
|
|
439
|
+
label: string;
|
|
440
|
+
};
|
|
441
|
+
object_data?: HubspotObjectDataType;
|
|
442
|
+
} | null;
|
|
443
|
+
freshdesk_metadata: Record<string, string>;
|
|
444
|
+
close_ticket_metadata?:
|
|
445
|
+
| {
|
|
446
|
+
closed_by: string;
|
|
447
|
+
closed_at: string;
|
|
448
|
+
closed_message?: string | null;
|
|
449
|
+
send_reply_message_id?: string | null;
|
|
450
|
+
}
|
|
451
|
+
| any;
|
|
452
|
+
}
|
|
453
|
+
>;
|
|
454
|
+
|
|
455
|
+
export type ContactType = Merge<
|
|
456
|
+
Tables<'tbl_contacts'>,
|
|
457
|
+
{
|
|
458
|
+
chats: ChatType[] | null;
|
|
459
|
+
chat_ids?: string[];
|
|
460
|
+
}
|
|
461
|
+
>;
|
|
462
|
+
export type ReactionType = Tables<'tbl_chat_reactions'>;
|
|
463
|
+
|
|
464
|
+
export type NotificationType = Tables<'tbl_chat_notifications'>;
|
|
465
|
+
|
|
466
|
+
export type ChatAccessType = Merge<
|
|
467
|
+
TablesUpdate<'tbl_org_members'>,
|
|
468
|
+
{
|
|
469
|
+
has_access?: boolean;
|
|
470
|
+
email: string | null;
|
|
471
|
+
}
|
|
472
|
+
>;
|
|
473
|
+
|
|
474
|
+
export type QueueJobTypes = {
|
|
475
|
+
addedTimestamp: number;
|
|
476
|
+
attemptsMade: number;
|
|
477
|
+
attemptsStarted: number;
|
|
478
|
+
data: {
|
|
479
|
+
body: string;
|
|
480
|
+
chat_id: string;
|
|
481
|
+
};
|
|
482
|
+
finishedTimestamp: number;
|
|
483
|
+
id: string;
|
|
484
|
+
message_id: string;
|
|
485
|
+
processedTimestamp: number;
|
|
486
|
+
stacktrace: string[];
|
|
487
|
+
status: string;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
export type PhoneQueueStatusType = {
|
|
491
|
+
active: number;
|
|
492
|
+
failed: number;
|
|
493
|
+
completed: number;
|
|
494
|
+
is_running: boolean;
|
|
495
|
+
pending: number;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
export type PhoneType = OverrideProperties<
|
|
499
|
+
Tables<'tbl_org_phones'>,
|
|
500
|
+
{
|
|
501
|
+
queue_status: {
|
|
502
|
+
[key: string]: PhoneQueueStatusType;
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
>;
|
|
506
|
+
|
|
507
|
+
export type PhoneInfoType = Merge<
|
|
508
|
+
Pick<
|
|
509
|
+
PhoneType,
|
|
510
|
+
| 'created_at'
|
|
511
|
+
| 'first_connected_at'
|
|
512
|
+
| 'is_ready'
|
|
513
|
+
| 'label_ids'
|
|
514
|
+
| 'org_id'
|
|
515
|
+
| 'org_phone'
|
|
516
|
+
| 'phone_id'
|
|
517
|
+
| 'phone_image'
|
|
518
|
+
| 'phone_name'
|
|
519
|
+
| 'qr_code'
|
|
520
|
+
| 'updated_at'
|
|
521
|
+
| 'wa_state'
|
|
522
|
+
>,
|
|
523
|
+
{
|
|
524
|
+
labels: string[];
|
|
525
|
+
}
|
|
526
|
+
>;
|
|
527
|
+
|
|
528
|
+
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
529
|
+
|
|
530
|
+
export const labelColors = [
|
|
531
|
+
'#9333EA',
|
|
532
|
+
'#0D9488',
|
|
533
|
+
'#DB2777',
|
|
534
|
+
'#2563EB',
|
|
535
|
+
'#F97316',
|
|
536
|
+
];
|
|
537
|
+
|
|
538
|
+
export const enumChatColors = [
|
|
539
|
+
'#B4876E',
|
|
540
|
+
'#A5B337',
|
|
541
|
+
'#06CF9C',
|
|
542
|
+
'#25D366',
|
|
543
|
+
'#02A698',
|
|
544
|
+
'#7D9EF1',
|
|
545
|
+
'#007BFC',
|
|
546
|
+
'#5E47DE',
|
|
547
|
+
'#7F66FF',
|
|
548
|
+
'#9333EA',
|
|
549
|
+
'#FA6533',
|
|
550
|
+
'#C4532D',
|
|
551
|
+
'#DC2626',
|
|
552
|
+
'#FF2E74',
|
|
553
|
+
'#DB2777',
|
|
554
|
+
] as const;
|
|
555
|
+
|
|
556
|
+
export type RepeatDaysType =
|
|
557
|
+
| 'monday'
|
|
558
|
+
| 'tuesday'
|
|
559
|
+
| 'wednesday'
|
|
560
|
+
| 'thursday'
|
|
561
|
+
| 'friday'
|
|
562
|
+
| 'saturday'
|
|
563
|
+
| 'sunday';
|
|
564
|
+
export type RepeatIntervalType = 'day' | 'week' | 'month';
|
|
565
|
+
|
|
566
|
+
export enum WhatsappGroupActionEnum {
|
|
567
|
+
ADD = 'add',
|
|
568
|
+
REMOVE = 'remove',
|
|
569
|
+
PROMOTE = 'promote',
|
|
570
|
+
DEMOTE = 'demote',
|
|
571
|
+
INVITE = 'invite',
|
|
572
|
+
LEAVE = 'leave',
|
|
573
|
+
ANNOUNCE_TRUE = 'announce_true',
|
|
574
|
+
ANNOUNCE_FALSE = 'announce_false',
|
|
575
|
+
RESTRICT_TRUE = 'restrict_true',
|
|
576
|
+
RESTRICT_FALSE = 'restrict_false',
|
|
577
|
+
MEMBERADDMODE_TRUE = 'memberaddmode_true',
|
|
578
|
+
MEMBERADDMODE_FALSE = 'memberaddmode_false',
|
|
579
|
+
SUBJECT = 'subject',
|
|
580
|
+
DESC = 'desc',
|
|
581
|
+
CALL = 'call',
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/* -------------------------- LISTING ENDPOINT -------------------------- */
|
|
585
|
+
|
|
586
|
+
type ListingType = {
|
|
587
|
+
from?: number;
|
|
588
|
+
to?: number;
|
|
589
|
+
count?: number;
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
export type ListNotificationsType = Merge<
|
|
593
|
+
ListingType,
|
|
594
|
+
{
|
|
595
|
+
notifictions?: NotificationType[];
|
|
596
|
+
}
|
|
597
|
+
>;
|
|
598
|
+
|
|
599
|
+
export type ListChatMessagesType = Merge<
|
|
600
|
+
ListingType,
|
|
601
|
+
{
|
|
602
|
+
messages?: MessageType[];
|
|
603
|
+
}
|
|
604
|
+
>;
|
|
605
|
+
|
|
606
|
+
export type ListContactsType = Merge<
|
|
607
|
+
ListingType,
|
|
608
|
+
{
|
|
609
|
+
contacts?: ContactType[];
|
|
610
|
+
}
|
|
611
|
+
>;
|
|
612
|
+
|
|
613
|
+
export type ListTicketsType = Merge<
|
|
614
|
+
ListingType,
|
|
615
|
+
{
|
|
616
|
+
tickets?: TicketType[];
|
|
617
|
+
}
|
|
618
|
+
>;
|
|
619
|
+
|
|
620
|
+
export type ListChatsType = Merge<
|
|
621
|
+
ListingType,
|
|
622
|
+
{
|
|
623
|
+
chats?: ChatType[];
|
|
624
|
+
}
|
|
625
|
+
>;
|
|
626
|
+
|
|
627
|
+
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
628
|
+
|
|
629
|
+
export const SUPPORTED_TYPES = [
|
|
630
|
+
'chat',
|
|
631
|
+
'sticker',
|
|
632
|
+
'image',
|
|
633
|
+
'video',
|
|
634
|
+
'document',
|
|
635
|
+
'vcard',
|
|
636
|
+
'multi_vcard',
|
|
637
|
+
'audio',
|
|
638
|
+
'ptt',
|
|
639
|
+
'poll_creation',
|
|
640
|
+
'location',
|
|
641
|
+
'ciphertext',
|
|
642
|
+
] as const;
|
|
643
|
+
|
|
644
|
+
export type SendMessageContent = {
|
|
645
|
+
message_type?: (typeof SUPPORTED_TYPES)[number];
|
|
646
|
+
body?: string;
|
|
647
|
+
media?: MediaType;
|
|
648
|
+
contact_ids?: string[];
|
|
649
|
+
location?: {
|
|
650
|
+
latitude: string;
|
|
651
|
+
longitude: string;
|
|
652
|
+
options?: { name?: string; address?: string; url?: string };
|
|
653
|
+
};
|
|
654
|
+
poll?: PollSendType;
|
|
655
|
+
quoted_message_id?: string;
|
|
656
|
+
quoted_message_type?: 'reply' | 'forward' | 'reply_private';
|
|
657
|
+
broadcast_id?: string;
|
|
658
|
+
performed_by?: string;
|
|
659
|
+
options?: Record<string, any>;
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
export type QuickReplyContent = Omit<
|
|
663
|
+
SendMessageContent,
|
|
664
|
+
'broadcast_id' | 'variables'
|
|
665
|
+
>;
|
|
666
|
+
|
|
667
|
+
export type ScheduleMessagePayload = {
|
|
668
|
+
scheduled_id?: string;
|
|
669
|
+
is_repeat?: boolean | null;
|
|
670
|
+
scheduled_at: string;
|
|
671
|
+
repeat_config?: {
|
|
672
|
+
timezone?: string;
|
|
673
|
+
repeat_ends?: string;
|
|
674
|
+
repeat_interval?: RepeatIntervalType;
|
|
675
|
+
repeat_value?: number;
|
|
676
|
+
repeat_days?: RepeatDaysType[];
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
export type BroadcastVariableType = {
|
|
681
|
+
chat_id: string;
|
|
682
|
+
values: { [key: string]: string };
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
export type BroadcastMessagePayload = SendMessageContent & {
|
|
686
|
+
chat_ids: string[];
|
|
687
|
+
broadcast_id?: string;
|
|
688
|
+
variables?: BroadcastVariableType[];
|
|
689
|
+
delay?: number;
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
export type SingleMessagePayload = SendMessageContent & {
|
|
693
|
+
chat_id: string;
|
|
694
|
+
job_id?: string;
|
|
695
|
+
priority?: number;
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
export type MessageAttachmentFileTypes =
|
|
699
|
+
| 'image'
|
|
700
|
+
| 'audio'
|
|
701
|
+
| 'document'
|
|
702
|
+
| 'video';
|
|
703
|
+
|
|
704
|
+
export type AttachmentFileType = {
|
|
705
|
+
result: string;
|
|
706
|
+
file: File | null;
|
|
707
|
+
type: MessageAttachmentFileTypes;
|
|
708
|
+
localFileURL?: string;
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
export type AttachmentLinkType = {
|
|
712
|
+
link: {
|
|
713
|
+
url: string;
|
|
714
|
+
type: MessageAttachmentFileTypes;
|
|
715
|
+
name: string;
|
|
716
|
+
mimetype?: string;
|
|
717
|
+
};
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
export type AttachmentTypeProps = AttachmentFileType | AttachmentLinkType;
|
|
721
|
+
|
|
722
|
+
/* -------------------------------- BROADCAST ------------------------------- */
|
|
723
|
+
|
|
724
|
+
export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
|
|
725
|
+
logs: (Tables<'tbl_broadcast_logs'> & Partial<ChatType>)[];
|
|
726
|
+
} & {
|
|
727
|
+
chats: ChatType[];
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
/* ----------------------- CHAT PARTICIPANT OPERATION ----------------------- */
|
|
731
|
+
|
|
732
|
+
export type ChatLogType = {
|
|
733
|
+
log: Tables<'view_chat_logs'>;
|
|
734
|
+
operations: Tables<'tbl_chat_logs'>[];
|
|
735
|
+
};
|
|
736
|
+
export type ChatOperationsType = 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
|
|
737
|
+
|
|
738
|
+
export type ChatParticipantOperationPayload = {
|
|
739
|
+
participant_ids: string[];
|
|
740
|
+
chat_ids: string[];
|
|
741
|
+
performed_by: string;
|
|
742
|
+
force_add_participants?: boolean;
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
export type ChatOperationReturn = {
|
|
746
|
+
[participant_id: string]: {
|
|
747
|
+
is_success: boolean;
|
|
748
|
+
message?: string;
|
|
749
|
+
code?: number;
|
|
750
|
+
isInviteV4Sent?: boolean;
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
/* ----------------------- BILLING - STRIPE ----------------------- */
|
|
755
|
+
|
|
756
|
+
export type StripeSubscription = _Stripe.Subscription;
|
|
757
|
+
export type StripeCustomer = _Stripe.Customer;
|
|
758
|
+
export type StripeCoupon = _Stripe.Coupon;
|
|
759
|
+
export type StripePrice = _Stripe.Price;
|
|
760
|
+
export type Stripe = _Stripe;
|
|
761
|
+
export type StripeUpcomingInvoice = _Stripe.UpcomingInvoice;
|
|
762
|
+
export type StripeLineItem = _Stripe.Checkout.SessionCreateParams.LineItem;
|
|
763
|
+
|
|
764
|
+
/* -------------------------------- REALTIME -------------------------------- */
|
|
765
|
+
|
|
766
|
+
export type PhoneStateType = {
|
|
767
|
+
loading: boolean;
|
|
768
|
+
state: string;
|
|
769
|
+
sync: number;
|
|
770
|
+
percent: number | null;
|
|
771
|
+
message?: string;
|
|
772
|
+
error?: string;
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
/* ------------------------------- INTEGRATIONS ----------------------------- */
|
|
776
|
+
|
|
777
|
+
export type ChatInfoType = Merge<
|
|
778
|
+
ChatType,
|
|
779
|
+
{
|
|
780
|
+
members: {
|
|
781
|
+
[key: string]: Merge<ChatMemberType, { contact_labels: string }>;
|
|
782
|
+
} | null;
|
|
783
|
+
chat_labels: string | null;
|
|
784
|
+
custom_properties: { [key: string]: string } | null;
|
|
785
|
+
}
|
|
786
|
+
>;
|
|
787
|
+
|
|
788
|
+
export type TicketInfoType = {
|
|
789
|
+
chat: ChatInfoType;
|
|
790
|
+
message: {
|
|
791
|
+
body: string;
|
|
792
|
+
chat_id: string;
|
|
793
|
+
org_phone: string;
|
|
794
|
+
timestamp: string;
|
|
795
|
+
media_path: string;
|
|
796
|
+
message_id: string;
|
|
797
|
+
sender_name: string;
|
|
798
|
+
performed_by: string;
|
|
799
|
+
sender_phone: string;
|
|
800
|
+
};
|
|
801
|
+
ticket: {
|
|
802
|
+
org_id: string;
|
|
803
|
+
status: string;
|
|
804
|
+
subject: string;
|
|
805
|
+
assignee: string;
|
|
806
|
+
due_date: string;
|
|
807
|
+
priority: 0 | 1 | 2 | 3 | 4;
|
|
808
|
+
raised_by: string;
|
|
809
|
+
ticket_id: string;
|
|
810
|
+
created_at: string;
|
|
811
|
+
assigned_by: string;
|
|
812
|
+
ticket_labels: string;
|
|
813
|
+
quoted_message_id: string;
|
|
814
|
+
ticket_custom_properties: { [key: string]: string } | null;
|
|
815
|
+
closed_at: string;
|
|
816
|
+
closed_by: string;
|
|
817
|
+
closed_message: string;
|
|
818
|
+
first_assigned_at: string | null;
|
|
819
|
+
is_deleted: boolean;
|
|
820
|
+
};
|
|
821
|
+
attached_messages: {
|
|
822
|
+
body: string;
|
|
823
|
+
chat_id: string;
|
|
824
|
+
org_phone: string;
|
|
825
|
+
timestamp: string;
|
|
826
|
+
media_path: string;
|
|
827
|
+
message_id: string;
|
|
828
|
+
sender_name: string;
|
|
829
|
+
performed_by: string;
|
|
830
|
+
sender_phone: string;
|
|
831
|
+
}[];
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
export type IntegrationLogObjectType =
|
|
835
|
+
| 'chat'
|
|
836
|
+
| 'message'
|
|
837
|
+
| 'reaction'
|
|
838
|
+
| 'ticket'
|
|
839
|
+
| 'phone';
|
|
840
|
+
export enum IntegrationLogType {
|
|
841
|
+
NEW_CHAT = 'chat.created',
|
|
842
|
+
NEW_CHAT_NOTIFICATION = 'chat.notification.created',
|
|
843
|
+
NEW_MESSAGE = 'message.created',
|
|
844
|
+
MESSAGE_UPDATED = 'message.updated',
|
|
845
|
+
MESSAGE_DELETED = 'message.deleted',
|
|
846
|
+
MESSAGE_ACK_UPDATED = 'message.ack.updated',
|
|
847
|
+
MESSAGE_FLAGGED = 'message.flagged',
|
|
848
|
+
MESSAGE_UNFLAGGED = 'message.unflagged',
|
|
849
|
+
MESSAGE_TICKET_ATTACHED = 'message.ticket.attached',
|
|
850
|
+
REACTION_CREATED = 'reaction.created',
|
|
851
|
+
REACTION_UPDATED = 'reaction.updated',
|
|
852
|
+
NEW_TICKET = 'ticket.created',
|
|
853
|
+
TICKET_UPDATED = 'ticket.updated',
|
|
854
|
+
TICKET_DELETED = 'ticket.deleted',
|
|
855
|
+
PHONE_DISCONNECTED = 'org.phone.disconnected',
|
|
856
|
+
PHONE_CONNECTED = 'org.phone.connected',
|
|
857
|
+
PHONE_UPDATED = 'org.phone.updated',
|
|
858
|
+
PHONE_QR_UPDATED = 'org.phone.qr',
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
export type IntegrationLogMetadataType<T extends IntegrationLogType> =
|
|
862
|
+
T extends IntegrationLogType.NEW_TICKET | IntegrationLogType.TICKET_UPDATED
|
|
863
|
+
? TicketInfoType
|
|
864
|
+
: T extends IntegrationLogType.NEW_CHAT
|
|
865
|
+
? Tables<'tbl_chats'>
|
|
866
|
+
: T extends
|
|
867
|
+
| IntegrationLogType.NEW_MESSAGE
|
|
868
|
+
| IntegrationLogType.MESSAGE_UPDATED
|
|
869
|
+
| IntegrationLogType.MESSAGE_DELETED
|
|
870
|
+
| IntegrationLogType.MESSAGE_ACK_UPDATED
|
|
871
|
+
| IntegrationLogType.MESSAGE_FLAGGED
|
|
872
|
+
| IntegrationLogType.MESSAGE_UNFLAGGED
|
|
873
|
+
| IntegrationLogType.MESSAGE_TICKET_ATTACHED
|
|
874
|
+
? Tables<'tbl_chat_messages'>
|
|
875
|
+
: T extends
|
|
876
|
+
| IntegrationLogType.REACTION_CREATED
|
|
877
|
+
| IntegrationLogType.REACTION_UPDATED
|
|
878
|
+
? Tables<'tbl_chat_reactions'>
|
|
879
|
+
: T extends
|
|
880
|
+
| IntegrationLogType.PHONE_DISCONNECTED
|
|
881
|
+
| IntegrationLogType.PHONE_CONNECTED
|
|
882
|
+
| IntegrationLogType.PHONE_UPDATED
|
|
883
|
+
| IntegrationLogType.PHONE_QR_UPDATED
|
|
884
|
+
? Tables<'tbl_org_phones'>
|
|
885
|
+
: {
|
|
886
|
+
[key: string]: unknown;
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
export type IntegrationLogDetailsType<T extends IntegrationLogType> =
|
|
890
|
+
OverrideProperties<
|
|
891
|
+
Tables<'tbl_integration_logs'>,
|
|
892
|
+
{
|
|
893
|
+
integration_name: T;
|
|
894
|
+
metadata: {
|
|
895
|
+
event: IntegrationLogMetadataType<T> & {
|
|
896
|
+
event_type: string;
|
|
897
|
+
org_id: string;
|
|
898
|
+
previous_attributes: {
|
|
899
|
+
[key: string]: unknown;
|
|
900
|
+
};
|
|
901
|
+
};
|
|
902
|
+
hook_id: string;
|
|
903
|
+
name: string;
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
>;
|
|
907
|
+
|
|
908
|
+
export type APIAuthDetails = {
|
|
909
|
+
org_details: Tables<'view_org'> | null;
|
|
910
|
+
phone_details: Tables<'tbl_org_phones'> | null;
|
|
911
|
+
token_details: Tables<'tbl_integration_tokens'> | null;
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
export type WebhookDataType = OverrideProperties<
|
|
915
|
+
Tables<'tbl_integration_hooks'>,
|
|
916
|
+
{
|
|
917
|
+
integration_name: string[];
|
|
918
|
+
}
|
|
919
|
+
>;
|
|
920
|
+
|
|
921
|
+
export type HubspotObjectDataType = {
|
|
922
|
+
createdAt: string;
|
|
923
|
+
archived: boolean;
|
|
924
|
+
id: string;
|
|
925
|
+
type: 'contacts' | 'tickets' | 'companies';
|
|
926
|
+
properties: Record<
|
|
927
|
+
string,
|
|
928
|
+
{
|
|
929
|
+
groupLabel: string;
|
|
930
|
+
groupName: string;
|
|
931
|
+
propertyKeyName: string;
|
|
932
|
+
propertyKey: string;
|
|
933
|
+
propertyInternalValue: string;
|
|
934
|
+
propertyValue: string;
|
|
935
|
+
propertyType: string;
|
|
936
|
+
propertyFieldType: string;
|
|
937
|
+
}[]
|
|
938
|
+
>;
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
/* ---------------------------- USER PREFERENCES ---------------------------- */
|
|
942
|
+
|
|
943
|
+
export type UserPreferences = {
|
|
944
|
+
theme: 'light' | 'dark';
|
|
945
|
+
language: 'en' | 'es';
|
|
946
|
+
left_sidebar_open: boolean;
|
|
947
|
+
right_sidepanel_open: boolean;
|
|
948
|
+
sync_wa_unread_count: boolean;
|
|
949
|
+
pinned_chats: string[];
|
|
950
|
+
archived_chats: string[];
|
|
951
|
+
closed_chats: Record<string, number>;
|
|
952
|
+
periskope_chat_limit: number;
|
|
953
|
+
notifications: Record<string, boolean>;
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
/* ---------------------------- GROUP ANALYTICS SIDEPANEL TYPES---------------------------- */
|
|
957
|
+
|
|
958
|
+
export interface MostActiveMember {
|
|
959
|
+
sender_phone: string;
|
|
960
|
+
total_messages: number;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
export interface GroupAnalyticsResult {
|
|
964
|
+
total_messages: number;
|
|
965
|
+
total_joins: number;
|
|
966
|
+
total_leaves: number;
|
|
967
|
+
total_removes: number;
|
|
968
|
+
total_reactions: number;
|
|
969
|
+
most_active_members: MostActiveMember[];
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
export interface TimeRange {
|
|
973
|
+
startDateTime: string; // Format: 'YYYY-MM-DD HH:MM:SS.ms+TZ' (e.g., '2025-04-21 06:30:21.24+00')
|
|
974
|
+
endDateTime: string;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/* ----------------------------- POLL VOTE INFO ----------------------------- */
|
|
978
|
+
|
|
979
|
+
export type PollSendType = {
|
|
980
|
+
pollName: string;
|
|
981
|
+
pollOptions: string[];
|
|
982
|
+
options?: {
|
|
983
|
+
allowMultipleAnswers?: boolean;
|
|
984
|
+
messageSecret?: number[] | null;
|
|
985
|
+
pollId?: string;
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
export type PollResultType = {
|
|
990
|
+
[name: string]: Record<string, string>;
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
/* -------------------------- CREATE GROUP OPTIONS -------------------------- */
|
|
994
|
+
|
|
995
|
+
export type CreateGroupOptions = {
|
|
996
|
+
messagesAdminsOnly?: boolean;
|
|
997
|
+
infoAdminsOnly?: boolean;
|
|
998
|
+
addMembersAdminsOnly?: boolean;
|
|
999
|
+
image?: string;
|
|
1000
|
+
name?: string;
|
|
1001
|
+
description?: string;
|
|
1002
|
+
initiated_by?: string;
|
|
1003
|
+
admins?: string[];
|
|
1004
|
+
force_add_participants?: boolean;
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
/* ------------------------------ DELIVERY INFO ----------------------------- */
|
|
1008
|
+
|
|
1009
|
+
export type DeliveryInfoType = {
|
|
1010
|
+
delivered: Record<string, number | undefined>;
|
|
1011
|
+
read: Record<string, number | undefined>;
|
|
1012
|
+
pending: string[];
|
|
1013
|
+
read_count: number;
|
|
1014
|
+
delivered_count: number;
|
|
1015
|
+
};
|
|
1016
|
+
|
|
1017
|
+
/* ---------------------------- CREDITS SYSTEM ---------------------------- */
|
|
1018
|
+
|
|
1019
|
+
export type OrgCreditsType = {
|
|
1020
|
+
org_id: string;
|
|
1021
|
+
recurring_allowance: number; // recurring credits replenished every cycle
|
|
1022
|
+
recurring_balance: number; // recurring credits remaining in current cycle
|
|
1023
|
+
topup_balance: number; // topup credits remaining
|
|
1024
|
+
total_credits_used: number; // total credits used in current cycle
|
|
1025
|
+
next_renewal_date: string;
|
|
1026
|
+
topup_credits_used: number; // topup credits used in current cycle
|
|
1027
|
+
recurring_credits_used: number; // recurring credits used in current cycle
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
/* --------------------------------- RULE INFO TYPE -------------------------------- */
|
|
1031
|
+
|
|
1032
|
+
export type ChatRuleInfoType = Merge<
|
|
1033
|
+
Pick<
|
|
1034
|
+
Tables<'view_chats'>,
|
|
1035
|
+
| 'assigned_to'
|
|
1036
|
+
| 'chat_id'
|
|
1037
|
+
| 'chat_name'
|
|
1038
|
+
| 'chat_type'
|
|
1039
|
+
| 'created_at'
|
|
1040
|
+
| 'group_description'
|
|
1041
|
+
| 'info_admins_only'
|
|
1042
|
+
| 'org_id'
|
|
1043
|
+
| 'org_phone'
|
|
1044
|
+
| 'chat_org_phones'
|
|
1045
|
+
| 'messages_admins_only'
|
|
1046
|
+
| 'custom_properties'
|
|
1047
|
+
| 'initiated_by'
|
|
1048
|
+
>,
|
|
1049
|
+
{
|
|
1050
|
+
has_flagged_messages: boolean;
|
|
1051
|
+
labels: string[];
|
|
1052
|
+
members: string[];
|
|
1053
|
+
custom_properties: { [key: string]: string } | null;
|
|
1054
|
+
}
|
|
1055
|
+
>;
|
|
1056
|
+
|
|
1057
|
+
export type SenderRuleInfoType = Merge<
|
|
1058
|
+
Omit<
|
|
1059
|
+
Merge<Tables<'tbl_contacts'>, Tables<'tbl_chat_participants'>>,
|
|
1060
|
+
| 'verified_name'
|
|
1061
|
+
| 'verified_level'
|
|
1062
|
+
| 'updated_at'
|
|
1063
|
+
| 'short_name'
|
|
1064
|
+
| 'pushname'
|
|
1065
|
+
| 'periskope_name'
|
|
1066
|
+
| 'org_phone'
|
|
1067
|
+
| 'number'
|
|
1068
|
+
| 'name'
|
|
1069
|
+
| 'label_ids'
|
|
1070
|
+
| 'is_wa_contact'
|
|
1071
|
+
| 'is_user'
|
|
1072
|
+
| 'is_my_contact'
|
|
1073
|
+
| 'is_me'
|
|
1074
|
+
| 'is_imported'
|
|
1075
|
+
| 'is_group'
|
|
1076
|
+
| 'is_blocked'
|
|
1077
|
+
| 'contact_color'
|
|
1078
|
+
| 'business_profile'
|
|
1079
|
+
| 'id'
|
|
1080
|
+
| 'contact_image'
|
|
1081
|
+
| 'contact_type'
|
|
1082
|
+
| 'chat_id'
|
|
1083
|
+
| 'is_business'
|
|
1084
|
+
| 'is_enterprise'
|
|
1085
|
+
| 'is_super_admin'
|
|
1086
|
+
| 'contact_lid'
|
|
1087
|
+
>,
|
|
1088
|
+
{
|
|
1089
|
+
is_internal: boolean;
|
|
1090
|
+
labels: string[] | null;
|
|
1091
|
+
}
|
|
1092
|
+
>;
|
|
1093
|
+
|
|
1094
|
+
export type MessageRuleInfoType = {
|
|
1095
|
+
chat: ChatRuleInfoType;
|
|
1096
|
+
sender: SenderRuleInfoType;
|
|
1097
|
+
message: OverrideProperties<
|
|
1098
|
+
Omit<
|
|
1099
|
+
Tables<'tbl_chat_messages'>,
|
|
1100
|
+
| 'vcards'
|
|
1101
|
+
| 'updated_at'
|
|
1102
|
+
| 'unique_id'
|
|
1103
|
+
| 'token'
|
|
1104
|
+
| 'to'
|
|
1105
|
+
| 'sent_message_id'
|
|
1106
|
+
| 'raw_data'
|
|
1107
|
+
| 'delivery_info'
|
|
1108
|
+
| 'poll_results'
|
|
1109
|
+
| 'poll_info'
|
|
1110
|
+
| 'order_id'
|
|
1111
|
+
| 'mentioned_ids'
|
|
1112
|
+
| 'media_key'
|
|
1113
|
+
| 'location'
|
|
1114
|
+
| 'links'
|
|
1115
|
+
| 'is_status'
|
|
1116
|
+
| 'is_starred'
|
|
1117
|
+
| 'is_gif'
|
|
1118
|
+
| 'is_forwarded'
|
|
1119
|
+
| 'is_ephemeral'
|
|
1120
|
+
| 'is_deleted'
|
|
1121
|
+
| 'fts'
|
|
1122
|
+
| 'quoted_message_id'
|
|
1123
|
+
| 'invite_v4'
|
|
1124
|
+
| 'id'
|
|
1125
|
+
| 'has_reaction'
|
|
1126
|
+
| 'has_media'
|
|
1127
|
+
| 'duration'
|
|
1128
|
+
| 'broadcast'
|
|
1129
|
+
| 'broadcast_id'
|
|
1130
|
+
| 'device_type'
|
|
1131
|
+
| 'forwarding_score'
|
|
1132
|
+
| 'from'
|
|
1133
|
+
| 'from_me'
|
|
1134
|
+
| 'prev_body'
|
|
1135
|
+
| 'flag_response_time'
|
|
1136
|
+
| 'flag_metadata'
|
|
1137
|
+
| 'ack'
|
|
1138
|
+
>,
|
|
1139
|
+
{
|
|
1140
|
+
media: MediaType | null;
|
|
1141
|
+
}
|
|
1142
|
+
>;
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
export type ReactionRuleInfoType = {
|
|
1146
|
+
chat: ChatRuleInfoType;
|
|
1147
|
+
sender: SenderRuleInfoType;
|
|
1148
|
+
message: MessageRuleInfoType['message'];
|
|
1149
|
+
reaction: Pick<
|
|
1150
|
+
Tables<'tbl_chat_reactions'>,
|
|
1151
|
+
'reaction' | 'sender_id' | 'message_id' | 'chat_id' | 'reaction_id'
|
|
1152
|
+
>;
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1155
|
+
export type TicketRuleInfoType = {
|
|
1156
|
+
chat: ChatRuleInfoType;
|
|
1157
|
+
sender: SenderRuleInfoType;
|
|
1158
|
+
ticket: Merge<
|
|
1159
|
+
Pick<
|
|
1160
|
+
Tables<'tbl_chat_tickets'>,
|
|
1161
|
+
| 'org_id'
|
|
1162
|
+
| 'status'
|
|
1163
|
+
| 'chat_id'
|
|
1164
|
+
| 'subject'
|
|
1165
|
+
| 'assignee'
|
|
1166
|
+
| 'due_date'
|
|
1167
|
+
| 'priority'
|
|
1168
|
+
| 'raised_by'
|
|
1169
|
+
| 'ticket_id'
|
|
1170
|
+
| 'created_at'
|
|
1171
|
+
| 'is_deleted'
|
|
1172
|
+
>,
|
|
1173
|
+
{
|
|
1174
|
+
labels: string[] | null;
|
|
1175
|
+
custom_properties: { [key: string]: string } | null;
|
|
1176
|
+
}
|
|
1177
|
+
>;
|
|
1178
|
+
message: MessageRuleInfoType['message'];
|
|
1179
|
+
};
|
|
1180
|
+
export type FeatureFlagReturnType = Record<string, boolean>;
|
|
1181
|
+
|
|
1182
|
+
export type RuleLogsType = OverrideProperties<
|
|
1183
|
+
Tables<'tbl_rules_logs'>,
|
|
1184
|
+
{
|
|
1185
|
+
actions_progress: {
|
|
1186
|
+
action_id: string;
|
|
1187
|
+
action_type: Rule['actions'][number]['type'];
|
|
1188
|
+
action_delay: Rule['actions'][number]['delay'];
|
|
1189
|
+
ran_at: string | null;
|
|
1190
|
+
action_status: 'success' | 'failed' | 'pending';
|
|
1191
|
+
action_response: {
|
|
1192
|
+
success: boolean;
|
|
1193
|
+
data: Record<string, unknown> | null;
|
|
1194
|
+
error: {
|
|
1195
|
+
message: string;
|
|
1196
|
+
name: string;
|
|
1197
|
+
stack?: string;
|
|
1198
|
+
_error?: Error | Record<string, unknown>;
|
|
1199
|
+
} | null;
|
|
1200
|
+
};
|
|
1201
|
+
}[];
|
|
1202
|
+
metadata: {
|
|
1203
|
+
conditions: Rule['conditions'];
|
|
1204
|
+
actions: Rule['actions'];
|
|
1205
|
+
rule_metadata: Pick<
|
|
1206
|
+
Rule,
|
|
1207
|
+
'rule_name' | 'last_updated_at' | 'last_updated_by'
|
|
1208
|
+
>;
|
|
1209
|
+
data: Record<string, unknown>;
|
|
1210
|
+
};
|
|
1211
|
+
conditions_progress: {
|
|
1212
|
+
is_valid: boolean;
|
|
1213
|
+
validation_progress: Record<
|
|
1214
|
+
string,
|
|
1215
|
+
{
|
|
1216
|
+
res: boolean;
|
|
1217
|
+
filter: Filter;
|
|
1218
|
+
value: unknown;
|
|
1219
|
+
}
|
|
1220
|
+
>;
|
|
1221
|
+
checked_at: string | null;
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
>;
|
|
1225
|
+
|
|
1226
|
+
/************************** TASKS ***************************/
|
|
1227
|
+
|
|
1228
|
+
export type TaskType = OverrideProperties<
|
|
1229
|
+
Tables<'tbl_org_tasks'>,
|
|
1230
|
+
{
|
|
1231
|
+
reminder_setting: {
|
|
1232
|
+
remind_in:
|
|
1233
|
+
| `${number} ${'minutes' | 'hours' | 'days'} ${'before' | 'after'}`
|
|
1234
|
+
| string
|
|
1235
|
+
| null;
|
|
1236
|
+
repeat?: {
|
|
1237
|
+
frequency: number;
|
|
1238
|
+
interval: 'days' | 'weeks' | 'months' | 'years';
|
|
1239
|
+
end: 'never' | 'after' | 'on';
|
|
1240
|
+
on?: string;
|
|
1241
|
+
};
|
|
1242
|
+
} | null;
|
|
1243
|
+
associated_object_metadata:
|
|
1244
|
+
| {
|
|
1245
|
+
type: 'chat';
|
|
1246
|
+
index: 'chat_id';
|
|
1247
|
+
id: string;
|
|
1248
|
+
object: ChatType;
|
|
1249
|
+
}
|
|
1250
|
+
| {
|
|
1251
|
+
type: 'message';
|
|
1252
|
+
index: 'message_id';
|
|
1253
|
+
id: string;
|
|
1254
|
+
object: MessageType;
|
|
1255
|
+
}
|
|
1256
|
+
| {
|
|
1257
|
+
type: 'ticket';
|
|
1258
|
+
index: 'ticket_id';
|
|
1259
|
+
id: string;
|
|
1260
|
+
object: TicketType;
|
|
1261
|
+
}
|
|
1262
|
+
| null;
|
|
1263
|
+
status: 'open' | 'inprogress' | 'closed';
|
|
1264
|
+
priority: 1 | 2 | 3;
|
|
1265
|
+
completed_metadata?: {
|
|
1266
|
+
completed_at: string;
|
|
1267
|
+
completed_by: string;
|
|
1268
|
+
} | null;
|
|
1269
|
+
type: 'todo' | 'chat' | 'message' | 'ticket';
|
|
1270
|
+
}
|
|
1271
|
+
>;
|
|
1272
|
+
|
|
1273
|
+
type Choice = {
|
|
1274
|
+
id: number;
|
|
1275
|
+
label: string;
|
|
1276
|
+
value: string;
|
|
1277
|
+
position: number;
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
export type FreshdeskFieldType = {
|
|
1281
|
+
id: number;
|
|
1282
|
+
name: string;
|
|
1283
|
+
type: string;
|
|
1284
|
+
label: string;
|
|
1285
|
+
default: boolean;
|
|
1286
|
+
archived: boolean;
|
|
1287
|
+
position: number;
|
|
1288
|
+
created_at: string;
|
|
1289
|
+
updated_at: string;
|
|
1290
|
+
customers_can_edit: boolean;
|
|
1291
|
+
label_for_customers: string;
|
|
1292
|
+
required_for_agents: boolean;
|
|
1293
|
+
customers_can_filter: boolean;
|
|
1294
|
+
required_for_closure: boolean;
|
|
1295
|
+
displayed_to_customers: boolean;
|
|
1296
|
+
required_for_customers: boolean;
|
|
1297
|
+
choices?: Choice[];
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
export type OrgWarmup = OverrideProperties<
|
|
1301
|
+
Tables<{ schema: 'internal' }, 'tbl_org_warmup'>,
|
|
1302
|
+
{
|
|
1303
|
+
warmup_chats: { [key: string]: string };
|
|
1304
|
+
}
|
|
1305
|
+
>;
|
|
1306
|
+
|
|
1307
|
+
/** ----------------------------- INTEGRATION TOKENS TYPES ----------------------------- **/
|
|
1308
|
+
|
|
1309
|
+
export type FreshdeskIntegrationTokenType = OverrideProperties<
|
|
1310
|
+
Tables<'tbl_integration_tokens'>,
|
|
1311
|
+
{
|
|
1312
|
+
type: 'freshdesk';
|
|
1313
|
+
token_metadata: {
|
|
1314
|
+
url: string;
|
|
1315
|
+
apiKey: string;
|
|
1316
|
+
fields: {
|
|
1317
|
+
ticket: FreshdeskFieldType[];
|
|
1318
|
+
company: FreshdeskFieldType[];
|
|
1319
|
+
contact: FreshdeskFieldType[];
|
|
1320
|
+
};
|
|
1321
|
+
automation: {
|
|
1322
|
+
id: number | string;
|
|
1323
|
+
meta: {
|
|
1324
|
+
total_count: number;
|
|
1325
|
+
total_active_count: 17;
|
|
1326
|
+
};
|
|
1327
|
+
name: string;
|
|
1328
|
+
active: boolean;
|
|
1329
|
+
events: Array<{
|
|
1330
|
+
to?: string;
|
|
1331
|
+
from?: string;
|
|
1332
|
+
field_name: string;
|
|
1333
|
+
value?: string;
|
|
1334
|
+
}>;
|
|
1335
|
+
actions: Array<{
|
|
1336
|
+
url: string;
|
|
1337
|
+
content: Record<string, string>;
|
|
1338
|
+
field_name: string;
|
|
1339
|
+
content_type: string;
|
|
1340
|
+
request_type: string;
|
|
1341
|
+
content_layout: string;
|
|
1342
|
+
}>;
|
|
1343
|
+
summary: {
|
|
1344
|
+
events: Array<string>;
|
|
1345
|
+
actions: Array<string>;
|
|
1346
|
+
performer: string;
|
|
1347
|
+
conditions: {
|
|
1348
|
+
[key: string]: Array<string>;
|
|
1349
|
+
};
|
|
1350
|
+
};
|
|
1351
|
+
outdated: boolean;
|
|
1352
|
+
position: number;
|
|
1353
|
+
performer: {
|
|
1354
|
+
type: string;
|
|
1355
|
+
};
|
|
1356
|
+
conditions: Array<{
|
|
1357
|
+
name: string;
|
|
1358
|
+
match_type: string;
|
|
1359
|
+
properties: Array<{
|
|
1360
|
+
value: Array<string>;
|
|
1361
|
+
operator: string;
|
|
1362
|
+
field_name: string;
|
|
1363
|
+
resource_type: string;
|
|
1364
|
+
case_sensitive: boolean;
|
|
1365
|
+
}>;
|
|
1366
|
+
}>;
|
|
1367
|
+
created_at: string;
|
|
1368
|
+
updated_at: string;
|
|
1369
|
+
description: string | null;
|
|
1370
|
+
last_updated_by: string | number;
|
|
1371
|
+
affected_tickets_count: number | null;
|
|
1372
|
+
};
|
|
1373
|
+
org_details: {
|
|
1374
|
+
address: {
|
|
1375
|
+
city: string;
|
|
1376
|
+
state: string;
|
|
1377
|
+
street: string;
|
|
1378
|
+
country: string;
|
|
1379
|
+
postalcode: string;
|
|
1380
|
+
};
|
|
1381
|
+
timezone: string;
|
|
1382
|
+
bundle_id: string;
|
|
1383
|
+
tier_type: string;
|
|
1384
|
+
account_id: number;
|
|
1385
|
+
cloud_type: string;
|
|
1386
|
+
data_center: string;
|
|
1387
|
+
account_name: string;
|
|
1388
|
+
total_agents: {
|
|
1389
|
+
full_time: number;
|
|
1390
|
+
occasional: number;
|
|
1391
|
+
collaborators: number;
|
|
1392
|
+
field_service: number;
|
|
1393
|
+
};
|
|
1394
|
+
account_domain: string;
|
|
1395
|
+
contact_person: {
|
|
1396
|
+
email: string;
|
|
1397
|
+
lastname: string;
|
|
1398
|
+
firstname: string;
|
|
1399
|
+
};
|
|
1400
|
+
hipaa_compliant: boolean;
|
|
1401
|
+
organisation_id: number;
|
|
1402
|
+
organisation_name: string;
|
|
1403
|
+
};
|
|
1404
|
+
custom_fields: {
|
|
1405
|
+
ticket: FreshdeskFieldType[];
|
|
1406
|
+
company: FreshdeskFieldType[];
|
|
1407
|
+
contact: FreshdeskFieldType[];
|
|
1408
|
+
};
|
|
1409
|
+
integration_org_id: string | number;
|
|
1410
|
+
ticket_auto_creation?: boolean;
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
>;
|
|
1414
|
+
|
|
1415
|
+
export type ZohodeskIntegrationTokenType = OverrideProperties<
|
|
1416
|
+
Tables<'tbl_integration_tokens'>,
|
|
1417
|
+
{
|
|
1418
|
+
type: 'zohodesk';
|
|
1419
|
+
token_metadata: {
|
|
1420
|
+
scope: string;
|
|
1421
|
+
domain: string;
|
|
1422
|
+
fields: Array<{
|
|
1423
|
+
id: string;
|
|
1424
|
+
name: string;
|
|
1425
|
+
type: string;
|
|
1426
|
+
apiName: string;
|
|
1427
|
+
toolTip: string;
|
|
1428
|
+
i18NLabel: string;
|
|
1429
|
+
maxLength: number;
|
|
1430
|
+
isMandatory: boolean;
|
|
1431
|
+
toolTipType: string;
|
|
1432
|
+
displayLabel: string;
|
|
1433
|
+
isCustomField: boolean;
|
|
1434
|
+
isEncryptedField: boolean;
|
|
1435
|
+
showToHelpCenter: boolean;
|
|
1436
|
+
}>;
|
|
1437
|
+
org_id: string;
|
|
1438
|
+
webhooks: {
|
|
1439
|
+
id: string;
|
|
1440
|
+
url: string;
|
|
1441
|
+
name: string;
|
|
1442
|
+
type: string;
|
|
1443
|
+
createdBy: string;
|
|
1444
|
+
isEnabled: boolean;
|
|
1445
|
+
createdTime: string;
|
|
1446
|
+
description: string;
|
|
1447
|
+
modifiedTime: string;
|
|
1448
|
+
subscriptions: {
|
|
1449
|
+
[key: string]: {
|
|
1450
|
+
departmentIds: string[];
|
|
1451
|
+
includePrevState: boolean;
|
|
1452
|
+
};
|
|
1453
|
+
};
|
|
1454
|
+
ignoreSourceId: boolean | null;
|
|
1455
|
+
includeEventsFrom: string[];
|
|
1456
|
+
};
|
|
1457
|
+
api_domain: string;
|
|
1458
|
+
authDomain: string;
|
|
1459
|
+
expires_in: number;
|
|
1460
|
+
token_type: string;
|
|
1461
|
+
departments: Array<{
|
|
1462
|
+
id: string;
|
|
1463
|
+
name: string;
|
|
1464
|
+
hasLogo: boolean;
|
|
1465
|
+
creatorId: string;
|
|
1466
|
+
isDefault: boolean;
|
|
1467
|
+
isEnabled: boolean;
|
|
1468
|
+
chatStatus: string;
|
|
1469
|
+
createdTime: string;
|
|
1470
|
+
description: string | null;
|
|
1471
|
+
sanitizedName: string;
|
|
1472
|
+
nameInCustomerPortal: string;
|
|
1473
|
+
isAssignToTeamEnabled: boolean;
|
|
1474
|
+
isVisibleInCustomerPortal: boolean;
|
|
1475
|
+
}>;
|
|
1476
|
+
org_details: {
|
|
1477
|
+
id: number;
|
|
1478
|
+
fax: string;
|
|
1479
|
+
zip: string;
|
|
1480
|
+
city: string;
|
|
1481
|
+
alias: string | null;
|
|
1482
|
+
state: string;
|
|
1483
|
+
mobile: string;
|
|
1484
|
+
street: string;
|
|
1485
|
+
country: string;
|
|
1486
|
+
edition: string;
|
|
1487
|
+
logoURL: string;
|
|
1488
|
+
website: string;
|
|
1489
|
+
isDefault: boolean;
|
|
1490
|
+
portalURL: string;
|
|
1491
|
+
faviconURL: string;
|
|
1492
|
+
portalName: string;
|
|
1493
|
+
companyName: string;
|
|
1494
|
+
description: string | null;
|
|
1495
|
+
phoneNumber: string | null;
|
|
1496
|
+
currencyCode: string;
|
|
1497
|
+
isAdminInOrg: boolean;
|
|
1498
|
+
employeeCount: number;
|
|
1499
|
+
currencyLocale: string;
|
|
1500
|
+
currencySymbol: string;
|
|
1501
|
+
primaryContact: string;
|
|
1502
|
+
isSandboxPortal: boolean;
|
|
1503
|
+
isPayloadEncryptionEnabled: boolean;
|
|
1504
|
+
};
|
|
1505
|
+
access_token: string;
|
|
1506
|
+
refresh_token: string;
|
|
1507
|
+
integration_org_id: string | number;
|
|
1508
|
+
ticket_auto_creation?: boolean;
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
>;
|