@periskope/types 0.6.12 → 0.6.13-7.2

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/tsconfig.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
4
  /* Projects */
6
5
  // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
6
  // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
@@ -9,9 +8,8 @@
9
8
  // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
9
  // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
10
  // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
11
  /* Language and Environment */
14
- "target": "ES2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
12
+ "target": "ES2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
13
  // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
14
  // "jsx": "preserve", /* Specify what JSX code is generated. */
17
15
  // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
@@ -23,9 +21,8 @@
23
21
  // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
22
  // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
23
  // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
-
27
24
  /* Modules */
28
- "module": "CommonJS", /* Specify what module code is generated. */
25
+ "module": "CommonJS", /* Specify what module code is generated. */
29
26
  // "rootDir": "./", /* Specify the root folder within your source files. */
30
27
  // "moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
31
28
  // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
@@ -42,20 +39,18 @@
42
39
  // "resolveJsonModule": true, /* Enable importing .json files. */
43
40
  // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
41
  // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
-
46
42
  /* JavaScript Support */
47
43
  // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48
44
  // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49
45
  // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
-
51
46
  /* Emit */
52
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
47
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53
48
  // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
49
  // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55
50
  // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56
51
  // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
52
  // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58
- "outDir": "dist/", /* Specify an output folder for all emitted files. */
53
+ "outDir": "dist/", /* Specify an output folder for all emitted files. */
59
54
  // "removeComments": true, /* Disable emitting comments. */
60
55
  // "noEmit": true, /* Disable emitting files from a compilation. */
61
56
  // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@@ -72,17 +67,15 @@
72
67
  // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73
68
  // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
74
69
  // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75
-
76
70
  /* Interop Constraints */
77
71
  // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78
72
  // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
79
73
  // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
74
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
81
75
  // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
83
-
76
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
84
77
  /* Type Checking */
85
- "strict": true, /* Enable all strict type-checking options. */
78
+ "strict": true, /* Enable all strict type-checking options. */
86
79
  // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87
80
  // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88
81
  // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
@@ -101,9 +94,13 @@
101
94
  // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102
95
  // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103
96
  // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104
-
105
97
  /* Completeness */
106
98
  // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
108
- }
109
- }
99
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
100
+ },
101
+ "exclude": [
102
+ "node_modules",
103
+ "dist",
104
+ "scripts"
105
+ ]
106
+ }
package/types.ts CHANGED
@@ -1,26 +1,123 @@
1
+ import type { default as _Stripe } from 'stripe';
1
2
  import { Merge, OverrideProperties } from 'type-fest';
2
- import { Chat, MessageTypes } from 'whatsapp-web.js';
3
- import { Tables } from './supabase.types';
3
+ import { Tables, TablesUpdate } from './supabase.types';
4
4
 
5
5
  /* ----------------------------- TYPE SHORTHANDS ---------------------------- */
6
6
 
7
- /* ------------------------------ WHATSAPP ------------------------------ */
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`;
8
25
 
9
- export type WhatsappChat = Chat & {
10
- groupMetadata?: any;
11
- pinned?: boolean;
12
- invite_link?: string;
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;
13
35
  };
14
36
 
15
- /* ------------------------------ PERISKOPE TYPES ------------------------------ */
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;
16
53
 
17
- export type OrgType = Tables<'tbl_org'> & {
18
- user: Tables<'tbl_org_members'>;
19
- members: Tables<'tbl_org_members'>[];
20
- phones: Tables<'tbl_org_phones'>[];
21
- labels: Tables<'tbl_org_labels'>[];
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;
22
86
  };
23
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
+
24
121
  export type ChatMemberType = Merge<
25
122
  Tables<'tbl_chat_participants'>,
26
123
  Tables<'tbl_contacts'>
@@ -31,26 +128,95 @@ export type ChatType = Merge<
31
128
  {
32
129
  chat_id: string;
33
130
  latest_message: MessageType | null;
34
- members: Record<string, ChatMemberType> | null;
35
- chat_type: 'user' | 'group' | 'business';
36
- active_phone?: string;
37
- chat_access: Record<string, boolean>;
38
- label_ids: Record<string, boolean>;
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 };
39
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 };
40
148
  }
41
149
  >;
42
150
 
151
+ /* -------------------------------------------------------------------------- */
152
+ /* MESSAGE */
153
+ /* -------------------------------------------------------------------------- */
154
+
43
155
  export type MediaType = {
44
156
  path: string;
45
- mimetype: string | null;
46
- filename: string | null;
157
+ mimetype?: string;
158
+ filename?: string;
159
+ dimensions?: { width: number; height: number; ar: number };
160
+ size?: number;
161
+ thumbnail?: string;
47
162
  };
48
163
 
49
- export type MessageType = OverrideProperties<
50
- Tables<'tbl_chat_messages'>,
164
+ export type MessageType = Merge<
165
+ OverrideProperties<
166
+ Tables<'tbl_chat_messages'>,
167
+ {
168
+ message_id: string;
169
+ org_id: string;
170
+ org_phone: string;
171
+ chat_id: string;
172
+ message_type: (typeof SUPPORTED_TYPES)[number];
173
+ media: MediaType | null;
174
+ flag_metadata: MessageFlagType | null;
175
+ poll_info?: PollSendType | null;
176
+ poll_results?: PollResultType | null;
177
+ }
178
+ >,
51
179
  {
52
- message_type: MessageTypes;
53
- media: MediaType | null;
180
+ reactions?: ReactionType[];
181
+ message_payload?: SingleMessagePayload;
182
+ show_unread?: boolean;
183
+ highlight?: number;
184
+ }
185
+ >;
186
+
187
+ export type MessageFlagType = {
188
+ status: boolean;
189
+ response_type?: 'message' | 'reaction' | 'ticket';
190
+ response_id?: string;
191
+ response_timestamp?: string;
192
+ response_email?: string;
193
+ };
194
+
195
+ /* -------------------------------------------------------------------------- */
196
+
197
+ export type TicketType = OverrideProperties<
198
+ Tables<'tbl_chat_tickets'>,
199
+ {
200
+ label_ids: { [key: string]: boolean };
201
+ hubspot_metadata: {
202
+ id?: string;
203
+ type?: string;
204
+ hubId?: string;
205
+ pipeline: {
206
+ id: string;
207
+ label: string;
208
+ };
209
+ object_data?: HubspotObjectDataType;
210
+ } | null;
211
+ freshdesk_metadata: Record<string, string>;
212
+ close_ticket_metadata?:
213
+ | {
214
+ closed_by: string;
215
+ closed_at: string;
216
+ closed_message?: string | null;
217
+ send_reply_message_id?: string | null;
218
+ }
219
+ | any;
54
220
  }
55
221
  >;
56
222
 
@@ -58,22 +224,21 @@ export type ContactType = Merge<
58
224
  Tables<'tbl_contacts'>,
59
225
  {
60
226
  chats: ChatType[] | null;
61
- chat_count: number | null;
62
- chat_ids: string[] | null;
227
+ chat_ids?: string[];
63
228
  }
64
229
  >;
230
+ export type ReactionType = Tables<'tbl_chat_reactions'>;
231
+
232
+ export type NotificationType = Tables<'tbl_chat_notifications'>;
65
233
 
66
234
  export type ChatAccessType = Merge<
67
- Partial<Tables<'tbl_chat_access'>>,
68
- Tables<'tbl_org_members'>
235
+ TablesUpdate<'tbl_org_members'>,
236
+ {
237
+ has_access?: boolean;
238
+ email: string | null;
239
+ }
69
240
  >;
70
241
 
71
- export type ServerStateType = {
72
- loading: boolean;
73
- percent: number | null;
74
- ready: boolean;
75
- };
76
-
77
242
  /* -------------------------------- CONSTANTS ------------------------------- */
78
243
 
79
244
  export const labelColors = [
@@ -101,3 +266,294 @@ export const enumChatColors = [
101
266
  '#FF2E74',
102
267
  '#DB2777',
103
268
  ] as const;
269
+
270
+ /* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
271
+
272
+ export const SUPPORTED_TYPES = [
273
+ 'chat',
274
+ 'sticker',
275
+ 'image',
276
+ 'video',
277
+ 'document',
278
+ 'vcard',
279
+ 'multi_vcard',
280
+ 'audio',
281
+ 'ptt',
282
+ 'poll_creation',
283
+ 'location',
284
+ 'ciphertext',
285
+ ] as const;
286
+
287
+ export type SendMessageContent = {
288
+ message_type?: (typeof SUPPORTED_TYPES)[number];
289
+ body?: string;
290
+ media?: MediaType;
291
+ contact_ids?: string[];
292
+ location?: {
293
+ latitude: string;
294
+ longitude: string;
295
+ options?: { name?: string; address?: string; url?: string };
296
+ };
297
+ poll?: PollSendType;
298
+ quoted_message_id?: string;
299
+ quoted_message_type?: 'reply' | 'forward' | 'reply_private';
300
+ broadcast_id?: string;
301
+ performed_by?: string;
302
+ };
303
+
304
+ export type QuickReplyContent = Omit<
305
+ SendMessageContent,
306
+ 'broadcast_id' | 'variables'
307
+ >;
308
+
309
+ export type BroadcastVariableType = {
310
+ chat_id: string;
311
+ values: { [key: string]: string };
312
+ };
313
+
314
+ export type BroadcastMessagePayload = SendMessageContent & {
315
+ chat_ids: string[];
316
+ broadcast_id?: string;
317
+ variables?: BroadcastVariableType[];
318
+ };
319
+
320
+ export type SingleMessagePayload = SendMessageContent & {
321
+ chat_id: string;
322
+ job_id?: string;
323
+ };
324
+
325
+ export type MessageAttachmentFileTypes =
326
+ | 'image'
327
+ | 'audio'
328
+ | 'document'
329
+ | 'video';
330
+
331
+ export type AttachmentFileType = {
332
+ result: string;
333
+ file: File | null;
334
+ type: MessageAttachmentFileTypes;
335
+ localFileURL?: string;
336
+ };
337
+
338
+ export type AttachmentLinkType = {
339
+ link: {
340
+ url: string;
341
+ type: MessageAttachmentFileTypes;
342
+ name: string;
343
+ mimetype?: string;
344
+ };
345
+ };
346
+
347
+ export type AttachmentTypeProps = AttachmentFileType | AttachmentLinkType;
348
+
349
+ /* -------------------------------- BROADCAST ------------------------------- */
350
+
351
+ export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
352
+ logs: (Tables<'tbl_broadcast_logs'> & Partial<ChatType>)[];
353
+ } & {
354
+ chats: ChatType[];
355
+ };
356
+
357
+ /* ----------------------- CHAT PARTICIPANT OPERATION ----------------------- */
358
+
359
+ export type ChatLogType = {
360
+ log: Tables<'view_chat_logs'>;
361
+ operations: Tables<'tbl_chat_logs'>[];
362
+ };
363
+ export type ChatOperationsType = 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
364
+
365
+ export type ChatParticipantOperationPayload = {
366
+ participant_ids: string[];
367
+ chat_ids: string[];
368
+ performed_by: string;
369
+ };
370
+
371
+ export type ChatOperationReturn = {
372
+ [participant_id: string]: {
373
+ is_success: boolean;
374
+ message?: string;
375
+ code?: number;
376
+ isInviteV4Sent?: boolean;
377
+ };
378
+ };
379
+
380
+ /* ----------------------- BILLING - STRIPE ----------------------- */
381
+
382
+ export type StripeSubscription = _Stripe.Subscription;
383
+ export type StripeCustomer = _Stripe.Customer;
384
+ export type StripeCoupon = _Stripe.Coupon;
385
+ export type StripePrice = _Stripe.Price;
386
+ export type Stripe = _Stripe;
387
+ export type StripeUpcomingInvoice = _Stripe.UpcomingInvoice;
388
+ export type StripeLineItem = _Stripe.Checkout.SessionCreateParams.LineItem;
389
+
390
+ /* -------------------------------- REALTIME -------------------------------- */
391
+
392
+ export type PhoneStateType = {
393
+ loading: boolean;
394
+ state: string;
395
+ sync: number;
396
+ percent: number | null;
397
+ message?: string;
398
+ error?: string;
399
+ };
400
+
401
+ /* ------------------------------- INTEGRATIONS ----------------------------- */
402
+
403
+ export type ChatInfoType = Merge<
404
+ ChatType,
405
+ {
406
+ members: {
407
+ [key: string]: Merge<ChatMemberType, { contact_labels: string }>;
408
+ } | null;
409
+ chat_labels: string | null;
410
+ custom_properties: { [key: string]: string } | null;
411
+ }
412
+ >;
413
+
414
+ export type TicketInfoType = {
415
+ chat: ChatInfoType;
416
+ message: {
417
+ body: string;
418
+ chat_id: string;
419
+ org_phone: string;
420
+ timestamp: string;
421
+ media_path: string;
422
+ message_id: string;
423
+ sender_name: string;
424
+ performed_by: string;
425
+ sender_phone: string;
426
+ };
427
+ ticket: {
428
+ org_id: string;
429
+ status: string;
430
+ subject: string;
431
+ assignee: string;
432
+ due_date: string;
433
+ priority: 0 | 1 | 2 | 3 | 4;
434
+ raised_by: string;
435
+ ticket_id: string;
436
+ created_at: string;
437
+ assigned_by: string;
438
+ ticket_labels: string;
439
+ quoted_message_id: string;
440
+ ticket_custom_properties: { [key: string]: string } | null;
441
+ };
442
+ };
443
+
444
+ export type IntegrationLogObjectType =
445
+ | 'chat'
446
+ | 'message'
447
+ | 'reaction'
448
+ | 'ticket';
449
+
450
+ export enum IntegrationLogType {
451
+ NEW_CHAT = 'chat.created',
452
+ NEW_CHAT_NOTIFICATION = 'chat.notification.created',
453
+ NEW_MESSAGE = 'message.created',
454
+ MESSAGE_UPDATED = 'message.updated',
455
+ MESSAGE_DELETED = 'message.deleted',
456
+ MESSAGE_ACK_UPDATED = 'message.ack.updated',
457
+ REACTION_CREATED = 'reaction.created',
458
+ REACTION_UPDATED = 'reaction.updated',
459
+ NEW_TICKET = 'ticket.created',
460
+ TICKET_UPDATED = 'ticket.updated',
461
+ TICKET_DELETED = 'ticket.deleted',
462
+ }
463
+
464
+ export type IntegrationLogMetadataType<T extends IntegrationLogType> =
465
+ T extends IntegrationLogType.NEW_TICKET | IntegrationLogType.TICKET_UPDATED
466
+ ? TicketInfoType
467
+ : T extends IntegrationLogType.NEW_CHAT
468
+ ? Tables<'tbl_chats'>
469
+ : T extends
470
+ | IntegrationLogType.NEW_MESSAGE
471
+ | IntegrationLogType.MESSAGE_UPDATED
472
+ | IntegrationLogType.MESSAGE_DELETED
473
+ | IntegrationLogType.MESSAGE_ACK_UPDATED
474
+ ? Tables<'tbl_chat_messages'>
475
+ : T extends
476
+ | IntegrationLogType.REACTION_CREATED
477
+ | IntegrationLogType.REACTION_UPDATED
478
+ ? Tables<'tbl_chat_reactions'>
479
+ : {
480
+ [key: string]: unknown;
481
+ };
482
+
483
+ export type IntegrationLogDetailsType<T extends IntegrationLogType> =
484
+ OverrideProperties<
485
+ Tables<'tbl_integration_logs'>,
486
+ {
487
+ integration_name: T;
488
+ metadata: {
489
+ event: IntegrationLogMetadataType<T> & {
490
+ event_type: string;
491
+ org_id: string;
492
+ previous_attributes: {
493
+ [key: string]: unknown;
494
+ };
495
+ };
496
+ hook_id: string;
497
+ name: string;
498
+ };
499
+ }
500
+ >;
501
+
502
+ export type APIAuthDetails = {
503
+ org_details: Tables<'view_org'> | null;
504
+ phone_details: Tables<'tbl_org_phones'> | null;
505
+ token_details: Tables<'tbl_integration_tokens'> | null;
506
+ };
507
+
508
+ export type WebhookDataType = OverrideProperties<
509
+ Tables<'tbl_integration_hooks'>,
510
+ {
511
+ integration_name: string[];
512
+ }
513
+ >;
514
+
515
+ export type HubspotObjectDataType = {
516
+ createdAt: string;
517
+ archived: boolean;
518
+ id: string;
519
+ type: 'contacts' | 'tickets' | 'companies';
520
+ properties: Record<
521
+ string,
522
+ {
523
+ groupLabel: string;
524
+ groupName: string;
525
+ propertyKeyName: string;
526
+ propertyKey: string;
527
+ propertyInternalValue: string;
528
+ propertyValue: string;
529
+ propertyType: string;
530
+ propertyFieldType: string;
531
+ }[]
532
+ >;
533
+ };
534
+
535
+ /* ---------------------------- USER PREFERENCES ---------------------------- */
536
+
537
+ export type UserPreferences = {
538
+ theme: 'light' | 'dark';
539
+ language: 'en' | 'es';
540
+ left_sidebar_open: boolean;
541
+ right_sidepanel_open: boolean;
542
+ sync_wa_unread_count: boolean;
543
+ };
544
+
545
+ /* ----------------------------- POLL VOTE INFO ----------------------------- */
546
+
547
+ export type PollSendType = {
548
+ pollName: string;
549
+ pollOptions: string[];
550
+ options?: {
551
+ allowMultipleAnswers?: boolean;
552
+ messageSecret?: number[] | null;
553
+ pollId?: string;
554
+ };
555
+ };
556
+
557
+ export type PollResultType = {
558
+ [name: string]: Record<string, string>;
559
+ };
@@ -0,0 +1,21 @@
1
+ # Define the path to your package.json file
2
+ $packageJsonPath = "./package.json"
3
+
4
+ # Read the package.json file
5
+ $packageJson = Get-Content $packageJsonPath -Raw | ConvertFrom-Json
6
+
7
+ # Increment the patch version
8
+ $versionParts = $packageJson.version -split '\.'
9
+ $versionParts[2] = [int]$versionParts[2] + 1
10
+ $newVersion = $versionParts -join '.'
11
+
12
+ Write-Host "Updating package version to $newVersion"
13
+
14
+ # Update the version in the object
15
+ $packageJson.version = $newVersion
16
+
17
+ # Convert the object back to JSON and save
18
+ $packageJson | ConvertTo-Json -Depth 100 | Set-Content $packageJsonPath
19
+
20
+ # Run npm command
21
+ npm run update-package