@periskope/types 0.6.95 → 0.6.97

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.
@@ -276,6 +276,63 @@ export type Database = {
276
276
  }
277
277
  ];
278
278
  };
279
+ tbl_chat_logs: {
280
+ Row: {
281
+ action: string | null;
282
+ chat_id: string | null;
283
+ is_success: boolean | null;
284
+ log_id: string;
285
+ metadata: Json | null;
286
+ operation_id: string;
287
+ org_id: string;
288
+ org_phone: string;
289
+ participant_id: string | null;
290
+ performed_by: string | null;
291
+ timestamp: string | null;
292
+ };
293
+ Insert: {
294
+ action?: string | null;
295
+ chat_id?: string | null;
296
+ is_success?: boolean | null;
297
+ log_id?: string;
298
+ metadata?: Json | null;
299
+ operation_id: string;
300
+ org_id: string;
301
+ org_phone: string;
302
+ participant_id?: string | null;
303
+ performed_by?: string | null;
304
+ timestamp?: string | null;
305
+ };
306
+ Update: {
307
+ action?: string | null;
308
+ chat_id?: string | null;
309
+ is_success?: boolean | null;
310
+ log_id?: string;
311
+ metadata?: Json | null;
312
+ operation_id?: string;
313
+ org_id?: string;
314
+ org_phone?: string;
315
+ participant_id?: string | null;
316
+ performed_by?: string | null;
317
+ timestamp?: string | null;
318
+ };
319
+ Relationships: [
320
+ {
321
+ foreignKeyName: 'tbl_chat_logs_org_id_fkey';
322
+ columns: ['org_id'];
323
+ isOneToOne: false;
324
+ referencedRelation: 'tbl_org';
325
+ referencedColumns: ['org_id'];
326
+ },
327
+ {
328
+ foreignKeyName: 'tbl_chat_logs_org_id_fkey';
329
+ columns: ['org_id'];
330
+ isOneToOne: false;
331
+ referencedRelation: 'view_org';
332
+ referencedColumns: ['org_id'];
333
+ }
334
+ ];
335
+ };
279
336
  tbl_chat_messages: {
280
337
  Row: {
281
338
  ack: string | null;
@@ -437,6 +494,159 @@ export type Database = {
437
494
  }
438
495
  ];
439
496
  };
497
+ tbl_chat_messages_default: {
498
+ Row: {
499
+ ack: string | null;
500
+ author: string | null;
501
+ body: string | null;
502
+ broadcast: boolean | null;
503
+ broadcast_id: string | null;
504
+ chat_id: string | null;
505
+ delivery_info: Json | null;
506
+ device_type: string | null;
507
+ duration: string | null;
508
+ flag_metadata: Json | null;
509
+ flag_response_time: number | null;
510
+ forwarding_score: number | null;
511
+ from: string | null;
512
+ from_me: boolean | null;
513
+ has_media: boolean | null;
514
+ has_quoted_msg: boolean | null;
515
+ has_reaction: boolean | null;
516
+ id: Json | null;
517
+ invite_v4: Json | null;
518
+ is_deleted: boolean | null;
519
+ is_ephemeral: boolean | null;
520
+ is_forwarded: boolean | null;
521
+ is_gif: boolean | null;
522
+ is_starred: boolean | null;
523
+ is_status: boolean | null;
524
+ links: Json | null;
525
+ location: Json | null;
526
+ media: Json | null;
527
+ media_key: string | null;
528
+ mentioned_ids: string[] | null;
529
+ message_id: string;
530
+ message_ticket_id: string | null;
531
+ message_type: string | null;
532
+ order_id: string | null;
533
+ org_id: string;
534
+ org_phone: string;
535
+ performed_by: string | null;
536
+ prev_body: string | null;
537
+ quoted_message_id: string | null;
538
+ raw_data: Json | null;
539
+ sender_phone: string | null;
540
+ sent_message_id: string | null;
541
+ timestamp: string | null;
542
+ to: string | null;
543
+ token: string | null;
544
+ unique_id: string | null;
545
+ updated_at: string | null;
546
+ vcards: string[] | null;
547
+ };
548
+ Insert: {
549
+ ack?: string | null;
550
+ author?: string | null;
551
+ body?: string | null;
552
+ broadcast?: boolean | null;
553
+ broadcast_id?: string | null;
554
+ chat_id?: string | null;
555
+ delivery_info?: Json | null;
556
+ device_type?: string | null;
557
+ duration?: string | null;
558
+ flag_metadata?: Json | null;
559
+ flag_response_time?: number | null;
560
+ forwarding_score?: number | null;
561
+ from?: string | null;
562
+ from_me?: boolean | null;
563
+ has_media?: boolean | null;
564
+ has_quoted_msg?: boolean | null;
565
+ has_reaction?: boolean | null;
566
+ id?: Json | null;
567
+ invite_v4?: Json | null;
568
+ is_deleted?: boolean | null;
569
+ is_ephemeral?: boolean | null;
570
+ is_forwarded?: boolean | null;
571
+ is_gif?: boolean | null;
572
+ is_starred?: boolean | null;
573
+ is_status?: boolean | null;
574
+ links?: Json | null;
575
+ location?: Json | null;
576
+ media?: Json | null;
577
+ media_key?: string | null;
578
+ mentioned_ids?: string[] | null;
579
+ message_id: string;
580
+ message_ticket_id?: string | null;
581
+ message_type?: string | null;
582
+ order_id?: string | null;
583
+ org_id: string;
584
+ org_phone: string;
585
+ performed_by?: string | null;
586
+ prev_body?: string | null;
587
+ quoted_message_id?: string | null;
588
+ raw_data?: Json | null;
589
+ sender_phone?: string | null;
590
+ sent_message_id?: string | null;
591
+ timestamp?: string | null;
592
+ to?: string | null;
593
+ token?: string | null;
594
+ unique_id?: string | null;
595
+ updated_at?: string | null;
596
+ vcards?: string[] | null;
597
+ };
598
+ Update: {
599
+ ack?: string | null;
600
+ author?: string | null;
601
+ body?: string | null;
602
+ broadcast?: boolean | null;
603
+ broadcast_id?: string | null;
604
+ chat_id?: string | null;
605
+ delivery_info?: Json | null;
606
+ device_type?: string | null;
607
+ duration?: string | null;
608
+ flag_metadata?: Json | null;
609
+ flag_response_time?: number | null;
610
+ forwarding_score?: number | null;
611
+ from?: string | null;
612
+ from_me?: boolean | null;
613
+ has_media?: boolean | null;
614
+ has_quoted_msg?: boolean | null;
615
+ has_reaction?: boolean | null;
616
+ id?: Json | null;
617
+ invite_v4?: Json | null;
618
+ is_deleted?: boolean | null;
619
+ is_ephemeral?: boolean | null;
620
+ is_forwarded?: boolean | null;
621
+ is_gif?: boolean | null;
622
+ is_starred?: boolean | null;
623
+ is_status?: boolean | null;
624
+ links?: Json | null;
625
+ location?: Json | null;
626
+ media?: Json | null;
627
+ media_key?: string | null;
628
+ mentioned_ids?: string[] | null;
629
+ message_id?: string;
630
+ message_ticket_id?: string | null;
631
+ message_type?: string | null;
632
+ order_id?: string | null;
633
+ org_id?: string;
634
+ org_phone?: string;
635
+ performed_by?: string | null;
636
+ prev_body?: string | null;
637
+ quoted_message_id?: string | null;
638
+ raw_data?: Json | null;
639
+ sender_phone?: string | null;
640
+ sent_message_id?: string | null;
641
+ timestamp?: string | null;
642
+ to?: string | null;
643
+ token?: string | null;
644
+ unique_id?: string | null;
645
+ updated_at?: string | null;
646
+ vcards?: string[] | null;
647
+ };
648
+ Relationships: [];
649
+ };
440
650
  tbl_chat_notifications: {
441
651
  Row: {
442
652
  author: string | null;
@@ -619,6 +829,7 @@ export type Database = {
619
829
  assigned_by: string | null;
620
830
  assignee: string | null;
621
831
  chat_id: string;
832
+ close_ticket_metadata: Json | null;
622
833
  closed_at: string | null;
623
834
  created_at: string;
624
835
  due_date: string | null;
@@ -630,6 +841,7 @@ export type Database = {
630
841
  priority: number | null;
631
842
  quoted_message_id: string | null;
632
843
  raised_by: string | null;
844
+ response_time: number | null;
633
845
  status: Database['public']['Enums']['enum_chat_tickets_status'] | null;
634
846
  subject: string;
635
847
  ticket_id: string;
@@ -639,6 +851,7 @@ export type Database = {
639
851
  assigned_by?: string | null;
640
852
  assignee?: string | null;
641
853
  chat_id: string;
854
+ close_ticket_metadata?: Json | null;
642
855
  closed_at?: string | null;
643
856
  created_at?: string;
644
857
  due_date?: string | null;
@@ -650,6 +863,7 @@ export type Database = {
650
863
  priority?: number | null;
651
864
  quoted_message_id?: string | null;
652
865
  raised_by?: string | null;
866
+ response_time?: number | null;
653
867
  status?: Database['public']['Enums']['enum_chat_tickets_status'] | null;
654
868
  subject: string;
655
869
  ticket_id?: string;
@@ -659,6 +873,7 @@ export type Database = {
659
873
  assigned_by?: string | null;
660
874
  assignee?: string | null;
661
875
  chat_id?: string;
876
+ close_ticket_metadata?: Json | null;
662
877
  closed_at?: string | null;
663
878
  created_at?: string;
664
879
  due_date?: string | null;
@@ -670,6 +885,7 @@ export type Database = {
670
885
  priority?: number | null;
671
886
  quoted_message_id?: string | null;
672
887
  raised_by?: string | null;
888
+ response_time?: number | null;
673
889
  status?: Database['public']['Enums']['enum_chat_tickets_status'] | null;
674
890
  subject?: string;
675
891
  ticket_id?: string;
@@ -1429,6 +1645,37 @@ export type Database = {
1429
1645
  }
1430
1646
  ];
1431
1647
  };
1648
+ view_chat_logs: {
1649
+ Row: {
1650
+ action: string | null;
1651
+ failed: number | null;
1652
+ operation_id: string | null;
1653
+ org_id: string | null;
1654
+ pending: number | null;
1655
+ performed_at: string | null;
1656
+ performed_by: string | null;
1657
+ success: number | null;
1658
+ total_chats: number | null;
1659
+ total_logs: number | null;
1660
+ total_participants: number | null;
1661
+ };
1662
+ Relationships: [
1663
+ {
1664
+ foreignKeyName: 'tbl_chat_logs_org_id_fkey';
1665
+ columns: ['org_id'];
1666
+ isOneToOne: false;
1667
+ referencedRelation: 'tbl_org';
1668
+ referencedColumns: ['org_id'];
1669
+ },
1670
+ {
1671
+ foreignKeyName: 'tbl_chat_logs_org_id_fkey';
1672
+ columns: ['org_id'];
1673
+ isOneToOne: false;
1674
+ referencedRelation: 'view_org';
1675
+ referencedColumns: ['org_id'];
1676
+ }
1677
+ ];
1678
+ };
1432
1679
  view_chats: {
1433
1680
  Row: {
1434
1681
  active_phone: string | null;
@@ -1442,6 +1689,7 @@ export type Database = {
1442
1689
  flag_count: number | null;
1443
1690
  group_description: string | null;
1444
1691
  hubspot_metadata: Json | null;
1692
+ info_admins_only: boolean | null;
1445
1693
  invite_link: string | null;
1446
1694
  is_archived: boolean | null;
1447
1695
  is_muted: boolean | null;
@@ -1450,6 +1698,7 @@ export type Database = {
1450
1698
  latest_message: Json | null;
1451
1699
  member_count: number | null;
1452
1700
  message_unread_count: number | null;
1701
+ messages_admins_only: boolean | null;
1453
1702
  org_id: string | null;
1454
1703
  org_phone: string | null;
1455
1704
  updated_at: string | null;
@@ -1597,15 +1846,16 @@ export type Database = {
1597
1846
  Args: {
1598
1847
  org_id_input: string;
1599
1848
  contact_ids_input?: string[];
1600
- with_chats?: boolean;
1601
1849
  with_name?: boolean;
1850
+ sync_phone_contacts?: boolean;
1602
1851
  };
1603
1852
  Returns: Json;
1604
1853
  };
1605
- get_dashboard_statistics: {
1854
+ get_dashboard_statistics_between_dates: {
1606
1855
  Args: {
1607
1856
  org_id_input: string;
1608
- interval_input?: unknown;
1857
+ start_date: string;
1858
+ end_date: string;
1609
1859
  chat_id_input?: string[];
1610
1860
  };
1611
1861
  Returns: Json;
@@ -1646,11 +1896,12 @@ export type Database = {
1646
1896
  };
1647
1897
  Returns: Json;
1648
1898
  };
1649
- get_team_metrics: {
1899
+ get_team_metrics_between_dates: {
1650
1900
  Args: {
1651
1901
  org_id_input: string;
1902
+ start_date: string;
1903
+ end_date: string;
1652
1904
  chat_id_input?: string[];
1653
- interval_input?: unknown;
1654
1905
  };
1655
1906
  Returns: Json;
1656
1907
  };
package/dist/types.d.ts CHANGED
@@ -9,16 +9,18 @@ export type WhatsappChat = Chat & {
9
9
  };
10
10
  export declare enum AllPlans {
11
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"
12
+ ENTERPRISE = "enterprise",
13
+ MONTHLY_STARTER_SINGLE = "monthly-starter-single",
14
+ YEARLY_STARTER_SINGLE = "yearly-starter-single",
15
+ MONTHLY_PRO_SINGLE = "monthly-pro-single",
16
+ YEARLY_PRO_SINGLE = "yearly-pro-single"
17
17
  }
18
18
  export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
19
19
  export type Enterprise = `${string}-enterprise`;
20
20
  export type OrgPlanEnterprise = {
21
+ subscription_id: string;
21
22
  plan_id: Enterprise;
23
+ interval: number;
22
24
  frequency: Frequency;
23
25
  user_limit: number;
24
26
  phone_limit: number;
@@ -26,12 +28,14 @@ export type OrgPlanEnterprise = {
26
28
  current_period_end: number | null;
27
29
  };
28
30
  export type OrgPlanNonEnterprise = {
31
+ subscription_id: string;
29
32
  plan_id: AllPlans;
30
33
  interval: number;
31
34
  frequency: Frequency;
32
35
  user_limit: number;
33
36
  phone_limit: number;
34
- percent_off: number | null;
37
+ current_period_end: number;
38
+ current_period_start: number;
35
39
  };
36
40
  export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise ? OrgPlanEnterprise : T extends AllPlans ? OrgPlanNonEnterprise : never;
37
41
  export type MicrosurveyData = {
@@ -41,8 +45,9 @@ export type MicrosurveyData = {
41
45
  }[];
42
46
  export type OrgPreferences = {
43
47
  disable_ai_flagging?: boolean;
44
- allow_exports?: boolean;
48
+ disable_allow_exports?: boolean;
45
49
  sync_phone_contacts?: boolean;
50
+ mask_phone_numbers?: boolean;
46
51
  };
47
52
  type OrgPreferenceKey = keyof OrgPreferences;
48
53
  export type OrgPreferencesValue = {
@@ -109,6 +114,8 @@ export type ChatType = Merge<Tables<'view_chats'>, {
109
114
  hubId: string;
110
115
  object_data: HubspotObjectDataType;
111
116
  } | null;
117
+ info_admins_only: boolean;
118
+ messages_admins_only: boolean;
112
119
  }>;
113
120
  export type MediaType = {
114
121
  path: string;
@@ -152,6 +159,12 @@ export type TicketType = OverrideProperties<Tables<'tbl_chat_tickets'>, {
152
159
  };
153
160
  object_data?: HubspotObjectDataType;
154
161
  } | null;
162
+ close_ticket_metadata?: {
163
+ closed_by: string;
164
+ closed_at: string;
165
+ closed_message?: string | null;
166
+ send_reply_message_id?: string | null;
167
+ } | null;
155
168
  }>;
156
169
  export type ContactType = Merge<Tables<'tbl_contacts'>, {
157
170
  chats: ChatType[] | null;
@@ -208,12 +221,15 @@ export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
208
221
  } & {
209
222
  chats: ChatType[];
210
223
  };
211
- export type ChatParticipantOperation = {
212
- participant_ids: string[];
213
- operation_type: 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
224
+ export type ChatLogType = {
225
+ log: Tables<'view_chat_logs'>;
226
+ operations: Tables<'tbl_chat_logs'>[];
214
227
  };
215
- export type ChatParticipantOperationPayload = ChatParticipantOperation & {
228
+ export type ChatOperationsType = 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
229
+ export type ChatParticipantOperationPayload = {
230
+ participant_ids: string[];
216
231
  chat_ids: string[];
232
+ performed_by: string;
217
233
  };
218
234
  export type ChatOperationReturn = {
219
235
  [participant_id: string]: {
@@ -227,6 +243,9 @@ export type StripeSubscription = _Stripe.Subscription;
227
243
  export type StripeCustomer = _Stripe.Customer;
228
244
  export type StripeCoupon = _Stripe.Coupon;
229
245
  export type StripePrice = _Stripe.Price;
246
+ export type Stripe = _Stripe;
247
+ export type StripeUpcomingInvoice = _Stripe.UpcomingInvoice;
248
+ export type StripeLineItem = _Stripe.Checkout.SessionCreateParams.LineItem;
230
249
  export type PhoneStateType = {
231
250
  loading: boolean;
232
251
  state: string;
package/dist/types.js CHANGED
@@ -5,11 +5,15 @@ exports.IntegrationLogType = exports.SUPPORTED_TYPES = exports.enumChatColors =
5
5
  var AllPlans;
6
6
  (function (AllPlans) {
7
7
  AllPlans["FREE_TRIAL"] = "free-trial";
8
- AllPlans["MONTHLY_STARTER"] = "monthly-starter";
9
- AllPlans["YEARLY_STARTER"] = "yearly-starter";
10
- AllPlans["MONTHLY_PRO"] = "monthly-pro";
11
- AllPlans["YEARLY_PRO"] = "yearly-pro";
8
+ // MONTHLY_STARTER = 'monthly-starter',
9
+ // YEARLY_STARTER = 'yearly-starter',
10
+ // MONTHLY_PRO = 'monthly-pro',
11
+ // YEARLY_PRO = 'yearly-pro',
12
12
  AllPlans["ENTERPRISE"] = "enterprise";
13
+ AllPlans["MONTHLY_STARTER_SINGLE"] = "monthly-starter-single";
14
+ AllPlans["YEARLY_STARTER_SINGLE"] = "yearly-starter-single";
15
+ AllPlans["MONTHLY_PRO_SINGLE"] = "monthly-pro-single";
16
+ AllPlans["YEARLY_PRO_SINGLE"] = "yearly-pro-single";
13
17
  })(AllPlans || (exports.AllPlans = AllPlans = {}));
14
18
  /* -------------------------------- CONSTANTS ------------------------------- */
15
19
  exports.labelColors = [
@@ -0,0 +1,23 @@
1
+ #!/bin/bash
2
+
3
+ # Define the path to the TypeScript file
4
+ filePath="./supabase.types.ts"
5
+
6
+ # Read the content of the file as a single string
7
+ fileContent=$(cat "$filePath")
8
+
9
+ # Define the current and new type definitions using Perl-style regular expressions
10
+ oldTypeDefinition='export type Json =\s*\| string\s*\| number\s*\| boolean\s*\| null\s*\| \{ \[key: string\]: Json \| undefined \}\s*\| Json\[\]'
11
+ newTypeDefinition='export type Json = { [key: string]: any } | any'
12
+
13
+ # Replace the old type definition with the new one
14
+ updatedContent=$(echo "$fileContent" | perl -0777 -pe "s/$oldTypeDefinition/$newTypeDefinition/g")
15
+
16
+ # Update interface to type
17
+ oldText='export interface Database '
18
+ newText='export type Database = '
19
+
20
+ updatedContent=$(echo "$updatedContent" | sed "s/$oldText/$newText/g")
21
+
22
+ # Write the updated content back to the file
23
+ echo "$updatedContent" > "$filePath"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.95",
3
+ "version": "0.6.97",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/supabase.types.ts CHANGED
@@ -281,6 +281,63 @@ export type Database = {
281
281
  },
282
282
  ];
283
283
  };
284
+ tbl_chat_logs: {
285
+ Row: {
286
+ action: string | null;
287
+ chat_id: string | null;
288
+ is_success: boolean | null;
289
+ log_id: string;
290
+ metadata: Json | null;
291
+ operation_id: string;
292
+ org_id: string;
293
+ org_phone: string;
294
+ participant_id: string | null;
295
+ performed_by: string | null;
296
+ timestamp: string | null;
297
+ };
298
+ Insert: {
299
+ action?: string | null;
300
+ chat_id?: string | null;
301
+ is_success?: boolean | null;
302
+ log_id?: string;
303
+ metadata?: Json | null;
304
+ operation_id: string;
305
+ org_id: string;
306
+ org_phone: string;
307
+ participant_id?: string | null;
308
+ performed_by?: string | null;
309
+ timestamp?: string | null;
310
+ };
311
+ Update: {
312
+ action?: string | null;
313
+ chat_id?: string | null;
314
+ is_success?: boolean | null;
315
+ log_id?: string;
316
+ metadata?: Json | null;
317
+ operation_id?: string;
318
+ org_id?: string;
319
+ org_phone?: string;
320
+ participant_id?: string | null;
321
+ performed_by?: string | null;
322
+ timestamp?: string | null;
323
+ };
324
+ Relationships: [
325
+ {
326
+ foreignKeyName: 'tbl_chat_logs_org_id_fkey';
327
+ columns: ['org_id'];
328
+ isOneToOne: false;
329
+ referencedRelation: 'tbl_org';
330
+ referencedColumns: ['org_id'];
331
+ },
332
+ {
333
+ foreignKeyName: 'tbl_chat_logs_org_id_fkey';
334
+ columns: ['org_id'];
335
+ isOneToOne: false;
336
+ referencedRelation: 'view_org';
337
+ referencedColumns: ['org_id'];
338
+ },
339
+ ];
340
+ };
284
341
  tbl_chat_messages: {
285
342
  Row: {
286
343
  ack: string | null;
@@ -442,6 +499,159 @@ export type Database = {
442
499
  },
443
500
  ];
444
501
  };
502
+ tbl_chat_messages_default: {
503
+ Row: {
504
+ ack: string | null;
505
+ author: string | null;
506
+ body: string | null;
507
+ broadcast: boolean | null;
508
+ broadcast_id: string | null;
509
+ chat_id: string | null;
510
+ delivery_info: Json | null;
511
+ device_type: string | null;
512
+ duration: string | null;
513
+ flag_metadata: Json | null;
514
+ flag_response_time: number | null;
515
+ forwarding_score: number | null;
516
+ from: string | null;
517
+ from_me: boolean | null;
518
+ has_media: boolean | null;
519
+ has_quoted_msg: boolean | null;
520
+ has_reaction: boolean | null;
521
+ id: Json | null;
522
+ invite_v4: Json | null;
523
+ is_deleted: boolean | null;
524
+ is_ephemeral: boolean | null;
525
+ is_forwarded: boolean | null;
526
+ is_gif: boolean | null;
527
+ is_starred: boolean | null;
528
+ is_status: boolean | null;
529
+ links: Json | null;
530
+ location: Json | null;
531
+ media: Json | null;
532
+ media_key: string | null;
533
+ mentioned_ids: string[] | null;
534
+ message_id: string;
535
+ message_ticket_id: string | null;
536
+ message_type: string | null;
537
+ order_id: string | null;
538
+ org_id: string;
539
+ org_phone: string;
540
+ performed_by: string | null;
541
+ prev_body: string | null;
542
+ quoted_message_id: string | null;
543
+ raw_data: Json | null;
544
+ sender_phone: string | null;
545
+ sent_message_id: string | null;
546
+ timestamp: string | null;
547
+ to: string | null;
548
+ token: string | null;
549
+ unique_id: string | null;
550
+ updated_at: string | null;
551
+ vcards: string[] | null;
552
+ };
553
+ Insert: {
554
+ ack?: string | null;
555
+ author?: string | null;
556
+ body?: string | null;
557
+ broadcast?: boolean | null;
558
+ broadcast_id?: string | null;
559
+ chat_id?: string | null;
560
+ delivery_info?: Json | null;
561
+ device_type?: string | null;
562
+ duration?: string | null;
563
+ flag_metadata?: Json | null;
564
+ flag_response_time?: number | null;
565
+ forwarding_score?: number | null;
566
+ from?: string | null;
567
+ from_me?: boolean | null;
568
+ has_media?: boolean | null;
569
+ has_quoted_msg?: boolean | null;
570
+ has_reaction?: boolean | null;
571
+ id?: Json | null;
572
+ invite_v4?: Json | null;
573
+ is_deleted?: boolean | null;
574
+ is_ephemeral?: boolean | null;
575
+ is_forwarded?: boolean | null;
576
+ is_gif?: boolean | null;
577
+ is_starred?: boolean | null;
578
+ is_status?: boolean | null;
579
+ links?: Json | null;
580
+ location?: Json | null;
581
+ media?: Json | null;
582
+ media_key?: string | null;
583
+ mentioned_ids?: string[] | null;
584
+ message_id: string;
585
+ message_ticket_id?: string | null;
586
+ message_type?: string | null;
587
+ order_id?: string | null;
588
+ org_id: string;
589
+ org_phone: string;
590
+ performed_by?: string | null;
591
+ prev_body?: string | null;
592
+ quoted_message_id?: string | null;
593
+ raw_data?: Json | null;
594
+ sender_phone?: string | null;
595
+ sent_message_id?: string | null;
596
+ timestamp?: string | null;
597
+ to?: string | null;
598
+ token?: string | null;
599
+ unique_id?: string | null;
600
+ updated_at?: string | null;
601
+ vcards?: string[] | null;
602
+ };
603
+ Update: {
604
+ ack?: string | null;
605
+ author?: string | null;
606
+ body?: string | null;
607
+ broadcast?: boolean | null;
608
+ broadcast_id?: string | null;
609
+ chat_id?: string | null;
610
+ delivery_info?: Json | null;
611
+ device_type?: string | null;
612
+ duration?: string | null;
613
+ flag_metadata?: Json | null;
614
+ flag_response_time?: number | null;
615
+ forwarding_score?: number | null;
616
+ from?: string | null;
617
+ from_me?: boolean | null;
618
+ has_media?: boolean | null;
619
+ has_quoted_msg?: boolean | null;
620
+ has_reaction?: boolean | null;
621
+ id?: Json | null;
622
+ invite_v4?: Json | null;
623
+ is_deleted?: boolean | null;
624
+ is_ephemeral?: boolean | null;
625
+ is_forwarded?: boolean | null;
626
+ is_gif?: boolean | null;
627
+ is_starred?: boolean | null;
628
+ is_status?: boolean | null;
629
+ links?: Json | null;
630
+ location?: Json | null;
631
+ media?: Json | null;
632
+ media_key?: string | null;
633
+ mentioned_ids?: string[] | null;
634
+ message_id?: string;
635
+ message_ticket_id?: string | null;
636
+ message_type?: string | null;
637
+ order_id?: string | null;
638
+ org_id?: string;
639
+ org_phone?: string;
640
+ performed_by?: string | null;
641
+ prev_body?: string | null;
642
+ quoted_message_id?: string | null;
643
+ raw_data?: Json | null;
644
+ sender_phone?: string | null;
645
+ sent_message_id?: string | null;
646
+ timestamp?: string | null;
647
+ to?: string | null;
648
+ token?: string | null;
649
+ unique_id?: string | null;
650
+ updated_at?: string | null;
651
+ vcards?: string[] | null;
652
+ };
653
+ Relationships: [];
654
+ };
445
655
  tbl_chat_notifications: {
446
656
  Row: {
447
657
  author: string | null;
@@ -624,6 +834,7 @@ export type Database = {
624
834
  assigned_by: string | null;
625
835
  assignee: string | null;
626
836
  chat_id: string;
837
+ close_ticket_metadata: Json | null;
627
838
  closed_at: string | null;
628
839
  created_at: string;
629
840
  due_date: string | null;
@@ -635,6 +846,7 @@ export type Database = {
635
846
  priority: number | null;
636
847
  quoted_message_id: string | null;
637
848
  raised_by: string | null;
849
+ response_time: number | null;
638
850
  status:
639
851
  | Database['public']['Enums']['enum_chat_tickets_status']
640
852
  | null;
@@ -646,6 +858,7 @@ export type Database = {
646
858
  assigned_by?: string | null;
647
859
  assignee?: string | null;
648
860
  chat_id: string;
861
+ close_ticket_metadata?: Json | null;
649
862
  closed_at?: string | null;
650
863
  created_at?: string;
651
864
  due_date?: string | null;
@@ -657,6 +870,7 @@ export type Database = {
657
870
  priority?: number | null;
658
871
  quoted_message_id?: string | null;
659
872
  raised_by?: string | null;
873
+ response_time?: number | null;
660
874
  status?:
661
875
  | Database['public']['Enums']['enum_chat_tickets_status']
662
876
  | null;
@@ -668,6 +882,7 @@ export type Database = {
668
882
  assigned_by?: string | null;
669
883
  assignee?: string | null;
670
884
  chat_id?: string;
885
+ close_ticket_metadata?: Json | null;
671
886
  closed_at?: string | null;
672
887
  created_at?: string;
673
888
  due_date?: string | null;
@@ -679,6 +894,7 @@ export type Database = {
679
894
  priority?: number | null;
680
895
  quoted_message_id?: string | null;
681
896
  raised_by?: string | null;
897
+ response_time?: number | null;
682
898
  status?:
683
899
  | Database['public']['Enums']['enum_chat_tickets_status']
684
900
  | null;
@@ -1446,6 +1662,37 @@ export type Database = {
1446
1662
  },
1447
1663
  ];
1448
1664
  };
1665
+ view_chat_logs: {
1666
+ Row: {
1667
+ action: string | null;
1668
+ failed: number | null;
1669
+ operation_id: string | null;
1670
+ org_id: string | null;
1671
+ pending: number | null;
1672
+ performed_at: string | null;
1673
+ performed_by: string | null;
1674
+ success: number | null;
1675
+ total_chats: number | null;
1676
+ total_logs: number | null;
1677
+ total_participants: number | null;
1678
+ };
1679
+ Relationships: [
1680
+ {
1681
+ foreignKeyName: 'tbl_chat_logs_org_id_fkey';
1682
+ columns: ['org_id'];
1683
+ isOneToOne: false;
1684
+ referencedRelation: 'tbl_org';
1685
+ referencedColumns: ['org_id'];
1686
+ },
1687
+ {
1688
+ foreignKeyName: 'tbl_chat_logs_org_id_fkey';
1689
+ columns: ['org_id'];
1690
+ isOneToOne: false;
1691
+ referencedRelation: 'view_org';
1692
+ referencedColumns: ['org_id'];
1693
+ },
1694
+ ];
1695
+ };
1449
1696
  view_chats: {
1450
1697
  Row: {
1451
1698
  active_phone: string | null;
@@ -1459,6 +1706,7 @@ export type Database = {
1459
1706
  flag_count: number | null;
1460
1707
  group_description: string | null;
1461
1708
  hubspot_metadata: Json | null;
1709
+ info_admins_only: boolean | null;
1462
1710
  invite_link: string | null;
1463
1711
  is_archived: boolean | null;
1464
1712
  is_muted: boolean | null;
@@ -1467,6 +1715,7 @@ export type Database = {
1467
1715
  latest_message: Json | null;
1468
1716
  member_count: number | null;
1469
1717
  message_unread_count: number | null;
1718
+ messages_admins_only: boolean | null;
1470
1719
  org_id: string | null;
1471
1720
  org_phone: string | null;
1472
1721
  updated_at: string | null;
@@ -1614,15 +1863,16 @@ export type Database = {
1614
1863
  Args: {
1615
1864
  org_id_input: string;
1616
1865
  contact_ids_input?: string[];
1617
- with_chats?: boolean;
1618
1866
  with_name?: boolean;
1867
+ sync_phone_contacts?: boolean;
1619
1868
  };
1620
1869
  Returns: Json;
1621
1870
  };
1622
- get_dashboard_statistics: {
1871
+ get_dashboard_statistics_between_dates: {
1623
1872
  Args: {
1624
1873
  org_id_input: string;
1625
- interval_input?: unknown;
1874
+ start_date: string;
1875
+ end_date: string;
1626
1876
  chat_id_input?: string[];
1627
1877
  };
1628
1878
  Returns: Json;
@@ -1663,11 +1913,12 @@ export type Database = {
1663
1913
  };
1664
1914
  Returns: Json;
1665
1915
  };
1666
- get_team_metrics: {
1916
+ get_team_metrics_between_dates: {
1667
1917
  Args: {
1668
1918
  org_id_input: string;
1919
+ start_date: string;
1920
+ end_date: string;
1669
1921
  chat_id_input?: string[];
1670
- interval_input?: unknown;
1671
1922
  };
1672
1923
  Returns: Json;
1673
1924
  };
package/types.ts CHANGED
@@ -17,11 +17,15 @@ export type WhatsappChat = Chat & {
17
17
 
18
18
  export enum AllPlans {
19
19
  FREE_TRIAL = 'free-trial',
20
- MONTHLY_STARTER = 'monthly-starter',
21
- YEARLY_STARTER = 'yearly-starter',
22
- MONTHLY_PRO = 'monthly-pro',
23
- YEARLY_PRO = 'yearly-pro',
20
+ // MONTHLY_STARTER = 'monthly-starter',
21
+ // YEARLY_STARTER = 'yearly-starter',
22
+ // MONTHLY_PRO = 'monthly-pro',
23
+ // YEARLY_PRO = 'yearly-pro',
24
24
  ENTERPRISE = 'enterprise',
25
+ MONTHLY_STARTER_SINGLE = 'monthly-starter-single',
26
+ YEARLY_STARTER_SINGLE = 'yearly-starter-single',
27
+ MONTHLY_PRO_SINGLE = 'monthly-pro-single',
28
+ YEARLY_PRO_SINGLE = 'yearly-pro-single',
25
29
  }
26
30
 
27
31
  export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
@@ -29,7 +33,9 @@ export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
29
33
  export type Enterprise = `${string}-enterprise`;
30
34
 
31
35
  export type OrgPlanEnterprise = {
36
+ subscription_id: string;
32
37
  plan_id: Enterprise;
38
+ interval: number;
33
39
  frequency: Frequency;
34
40
  user_limit: number;
35
41
  phone_limit: number;
@@ -38,12 +44,14 @@ export type OrgPlanEnterprise = {
38
44
  };
39
45
 
40
46
  export type OrgPlanNonEnterprise = {
47
+ subscription_id: string;
41
48
  plan_id: AllPlans;
42
49
  interval: number;
43
50
  frequency: Frequency;
44
51
  user_limit: number;
45
52
  phone_limit: number;
46
- percent_off: number | null;
53
+ current_period_end: number;
54
+ current_period_start: number;
47
55
  };
48
56
 
49
57
  export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise
@@ -60,8 +68,9 @@ export type MicrosurveyData = {
60
68
 
61
69
  export type OrgPreferences = {
62
70
  disable_ai_flagging?: boolean;
63
- allow_exports?: boolean;
71
+ disable_allow_exports?: boolean;
64
72
  sync_phone_contacts?: boolean;
73
+ mask_phone_numbers?: boolean;
65
74
  };
66
75
 
67
76
  type OrgPreferenceKey = keyof OrgPreferences;
@@ -83,7 +92,7 @@ export type OrgMetadata = {
83
92
  label: string;
84
93
  default_stage: { id: string; label: string };
85
94
  }[];
86
- partition?: boolean
95
+ partition?: boolean;
87
96
  };
88
97
 
89
98
  export type OrgType = OverrideProperties<
@@ -133,6 +142,8 @@ export type ChatType = Merge<
133
142
  hubId: string;
134
143
  object_data: HubspotObjectDataType;
135
144
  } | null;
145
+ info_admins_only: boolean;
146
+ messages_admins_only: boolean;
136
147
  // is_open?: boolean;
137
148
  }
138
149
  >;
@@ -187,6 +198,12 @@ export type TicketType = OverrideProperties<
187
198
  };
188
199
  object_data?: HubspotObjectDataType;
189
200
  } | null;
201
+ close_ticket_metadata?: {
202
+ closed_by: string;
203
+ closed_at: string;
204
+ closed_message?: string | null;
205
+ send_reply_message_id?: string | null;
206
+ } | null;
190
207
  }
191
208
  >;
192
209
  export type ContactType = Merge<
@@ -313,23 +330,26 @@ export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
313
330
 
314
331
  /* ----------------------- CHAT PARTICIPANT OPERATION ----------------------- */
315
332
 
316
- export type ChatParticipantOperation = {
317
- participant_ids: string[];
318
- operation_type: 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
333
+ export type ChatLogType = {
334
+ log: Tables<'view_chat_logs'>;
335
+ operations: Tables<'tbl_chat_logs'>[];
319
336
  };
337
+ export type ChatOperationsType = 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
320
338
 
321
- export type ChatParticipantOperationPayload = ChatParticipantOperation & {
339
+ export type ChatParticipantOperationPayload = {
340
+ participant_ids: string[];
322
341
  chat_ids: string[];
342
+ performed_by: string;
323
343
  };
324
344
 
325
345
  export type ChatOperationReturn = {
326
- [participant_id:string]: {
346
+ [participant_id: string]: {
327
347
  is_success: boolean;
328
348
  message?: string;
329
349
  code?: number;
330
- isInviteV4Sent?:boolean;
331
- }
332
- }
350
+ isInviteV4Sent?: boolean;
351
+ };
352
+ };
333
353
 
334
354
  /* ----------------------- BILLING - STRIPE ----------------------- */
335
355
 
@@ -337,6 +357,9 @@ export type StripeSubscription = _Stripe.Subscription;
337
357
  export type StripeCustomer = _Stripe.Customer;
338
358
  export type StripeCoupon = _Stripe.Coupon;
339
359
  export type StripePrice = _Stripe.Price;
360
+ export type Stripe = _Stripe;
361
+ export type StripeUpcomingInvoice = _Stripe.UpcomingInvoice;
362
+ export type StripeLineItem = _Stripe.Checkout.SessionCreateParams.LineItem;
340
363
 
341
364
  /* -------------------------------- REALTIME -------------------------------- */
342
365