@periskope/types 0.6.73 → 0.6.75

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.
@@ -93,6 +93,13 @@ export type Database = {
93
93
  isOneToOne: false;
94
94
  referencedRelation: "tbl_org";
95
95
  referencedColumns: ["org_id"];
96
+ },
97
+ {
98
+ foreignKeyName: "tbl_broadcast_logs_org_id_fkey";
99
+ columns: ["org_id"];
100
+ isOneToOne: false;
101
+ referencedRelation: "view_org";
102
+ referencedColumns: ["org_id"];
96
103
  }
97
104
  ];
98
105
  };
@@ -134,6 +141,13 @@ export type Database = {
134
141
  isOneToOne: false;
135
142
  referencedRelation: "tbl_org";
136
143
  referencedColumns: ["org_id"];
144
+ },
145
+ {
146
+ foreignKeyName: "tbl_broadcast_messages_org_id_fkey";
147
+ columns: ["org_id"];
148
+ isOneToOne: false;
149
+ referencedRelation: "view_org";
150
+ referencedColumns: ["org_id"];
137
151
  }
138
152
  ];
139
153
  };
@@ -169,6 +183,13 @@ export type Database = {
169
183
  isOneToOne: false;
170
184
  referencedRelation: "tbl_org";
171
185
  referencedColumns: ["org_id"];
186
+ },
187
+ {
188
+ foreignKeyName: "tbl_broadcast_templates_org_id_fkey";
189
+ columns: ["org_id"];
190
+ isOneToOne: false;
191
+ referencedRelation: "view_org";
192
+ referencedColumns: ["org_id"];
172
193
  }
173
194
  ];
174
195
  };
@@ -595,6 +616,13 @@ export type Database = {
595
616
  isOneToOne: false;
596
617
  referencedRelation: "tbl_org";
597
618
  referencedColumns: ["org_id"];
619
+ },
620
+ {
621
+ foreignKeyName: "tbl_chat_tickets_org_id_fkey";
622
+ columns: ["org_id"];
623
+ isOneToOne: false;
624
+ referencedRelation: "view_org";
625
+ referencedColumns: ["org_id"];
598
626
  }
599
627
  ];
600
628
  };
@@ -605,6 +633,7 @@ export type Database = {
605
633
  chat_image: string | null;
606
634
  chat_name: string | null;
607
635
  chat_type: string | null;
636
+ created_at: string;
608
637
  group_metadata: Json | null;
609
638
  id: Json | null;
610
639
  invite_link: string | null;
@@ -628,6 +657,7 @@ export type Database = {
628
657
  chat_image?: string | null;
629
658
  chat_name?: string | null;
630
659
  chat_type?: string | null;
660
+ created_at?: string;
631
661
  group_metadata?: Json | null;
632
662
  id?: Json | null;
633
663
  invite_link?: string | null;
@@ -651,6 +681,7 @@ export type Database = {
651
681
  chat_image?: string | null;
652
682
  chat_name?: string | null;
653
683
  chat_type?: string | null;
684
+ created_at?: string;
654
685
  group_metadata?: Json | null;
655
686
  id?: Json | null;
656
687
  invite_link?: string | null;
@@ -767,6 +798,13 @@ export type Database = {
767
798
  isOneToOne: false;
768
799
  referencedRelation: "tbl_org";
769
800
  referencedColumns: ["org_id"];
801
+ },
802
+ {
803
+ foreignKeyName: "tbl_contacts_org_id_fkey";
804
+ columns: ["org_id"];
805
+ isOneToOne: false;
806
+ referencedRelation: "view_org";
807
+ referencedColumns: ["org_id"];
770
808
  }
771
809
  ];
772
810
  };
@@ -808,6 +846,13 @@ export type Database = {
808
846
  isOneToOne: false;
809
847
  referencedRelation: "tbl_org";
810
848
  referencedColumns: ["org_id"];
849
+ },
850
+ {
851
+ foreignKeyName: "tbl_custom_properties_org_id_fkey";
852
+ columns: ["org_id"];
853
+ isOneToOne: false;
854
+ referencedRelation: "view_org";
855
+ referencedColumns: ["org_id"];
811
856
  }
812
857
  ];
813
858
  };
@@ -843,6 +888,13 @@ export type Database = {
843
888
  isOneToOne: false;
844
889
  referencedRelation: "tbl_org";
845
890
  referencedColumns: ["org_id"];
891
+ },
892
+ {
893
+ foreignKeyName: "tbl_flagged_messages_org_id_fkey";
894
+ columns: ["org_id"];
895
+ isOneToOne: false;
896
+ referencedRelation: "view_org";
897
+ referencedColumns: ["org_id"];
846
898
  }
847
899
  ];
848
900
  };
@@ -890,6 +942,13 @@ export type Database = {
890
942
  isOneToOne: false;
891
943
  referencedRelation: "tbl_org";
892
944
  referencedColumns: ["org_id"];
945
+ },
946
+ {
947
+ foreignKeyName: "tbl_integration_hooks_org_id_fkey";
948
+ columns: ["org_id"];
949
+ isOneToOne: false;
950
+ referencedRelation: "view_org";
951
+ referencedColumns: ["org_id"];
893
952
  }
894
953
  ];
895
954
  };
@@ -931,6 +990,13 @@ export type Database = {
931
990
  isOneToOne: false;
932
991
  referencedRelation: "tbl_org";
933
992
  referencedColumns: ["org_id"];
993
+ },
994
+ {
995
+ foreignKeyName: "tbl_integration_logs_org_id_fkey";
996
+ columns: ["org_id"];
997
+ isOneToOne: false;
998
+ referencedRelation: "view_org";
999
+ referencedColumns: ["org_id"];
934
1000
  }
935
1001
  ];
936
1002
  };
@@ -975,6 +1041,13 @@ export type Database = {
975
1041
  isOneToOne: false;
976
1042
  referencedRelation: "tbl_org";
977
1043
  referencedColumns: ["org_id"];
1044
+ },
1045
+ {
1046
+ foreignKeyName: "public_tbl_integration_tokens_org_id_fkey";
1047
+ columns: ["org_id"];
1048
+ isOneToOne: false;
1049
+ referencedRelation: "view_org";
1050
+ referencedColumns: ["org_id"];
978
1051
  }
979
1052
  ];
980
1053
  };
@@ -1049,6 +1122,13 @@ export type Database = {
1049
1122
  isOneToOne: false;
1050
1123
  referencedRelation: "tbl_org";
1051
1124
  referencedColumns: ["org_id"];
1125
+ },
1126
+ {
1127
+ foreignKeyName: "tbl_org_labels_org_id_fkey";
1128
+ columns: ["org_id"];
1129
+ isOneToOne: false;
1130
+ referencedRelation: "view_org";
1131
+ referencedColumns: ["org_id"];
1052
1132
  }
1053
1133
  ];
1054
1134
  };
@@ -1066,6 +1146,7 @@ export type Database = {
1066
1146
  member_name: string | null;
1067
1147
  org_id: string;
1068
1148
  org_phones: string[] | null;
1149
+ preferences: Json;
1069
1150
  role: Database["public"]["Enums"]["enum_member_role"];
1070
1151
  user_id: string | null;
1071
1152
  };
@@ -1082,6 +1163,7 @@ export type Database = {
1082
1163
  member_name?: string | null;
1083
1164
  org_id: string;
1084
1165
  org_phones?: string[] | null;
1166
+ preferences?: Json;
1085
1167
  role?: Database["public"]["Enums"]["enum_member_role"];
1086
1168
  user_id?: string | null;
1087
1169
  };
@@ -1098,6 +1180,7 @@ export type Database = {
1098
1180
  member_name?: string | null;
1099
1181
  org_id?: string;
1100
1182
  org_phones?: string[] | null;
1183
+ preferences?: Json;
1101
1184
  role?: Database["public"]["Enums"]["enum_member_role"];
1102
1185
  user_id?: string | null;
1103
1186
  };
@@ -1115,6 +1198,13 @@ export type Database = {
1115
1198
  isOneToOne: false;
1116
1199
  referencedRelation: "tbl_org";
1117
1200
  referencedColumns: ["org_id"];
1201
+ },
1202
+ {
1203
+ foreignKeyName: "tbl_org_members_fkey_tbl_org";
1204
+ columns: ["org_id"];
1205
+ isOneToOne: false;
1206
+ referencedRelation: "view_org";
1207
+ referencedColumns: ["org_id"];
1118
1208
  }
1119
1209
  ];
1120
1210
  };
@@ -1123,6 +1213,7 @@ export type Database = {
1123
1213
  created_at: string;
1124
1214
  first_connected_at: string | null;
1125
1215
  is_ready: boolean | null;
1216
+ legacy_version: boolean | null;
1126
1217
  org_id: string;
1127
1218
  org_phone: string | null;
1128
1219
  phone_id: string;
@@ -1139,6 +1230,7 @@ export type Database = {
1139
1230
  created_at?: string;
1140
1231
  first_connected_at?: string | null;
1141
1232
  is_ready?: boolean | null;
1233
+ legacy_version?: boolean | null;
1142
1234
  org_id: string;
1143
1235
  org_phone?: string | null;
1144
1236
  phone_id?: string;
@@ -1155,6 +1247,7 @@ export type Database = {
1155
1247
  created_at?: string;
1156
1248
  first_connected_at?: string | null;
1157
1249
  is_ready?: boolean | null;
1250
+ legacy_version?: boolean | null;
1158
1251
  org_id?: string;
1159
1252
  org_phone?: string | null;
1160
1253
  phone_id?: string;
@@ -1175,12 +1268,26 @@ export type Database = {
1175
1268
  referencedRelation: "tbl_org";
1176
1269
  referencedColumns: ["org_id"];
1177
1270
  },
1271
+ {
1272
+ foreignKeyName: "tbl_org_phones_fkey_tbl_org";
1273
+ columns: ["org_id"];
1274
+ isOneToOne: false;
1275
+ referencedRelation: "view_org";
1276
+ referencedColumns: ["org_id"];
1277
+ },
1178
1278
  {
1179
1279
  foreignKeyName: "tbl_org_phones_org_id_fkey";
1180
1280
  columns: ["org_id"];
1181
1281
  isOneToOne: false;
1182
1282
  referencedRelation: "tbl_org";
1183
1283
  referencedColumns: ["org_id"];
1284
+ },
1285
+ {
1286
+ foreignKeyName: "tbl_org_phones_org_id_fkey";
1287
+ columns: ["org_id"];
1288
+ isOneToOne: false;
1289
+ referencedRelation: "view_org";
1290
+ referencedColumns: ["org_id"];
1184
1291
  }
1185
1292
  ];
1186
1293
  };
@@ -1213,6 +1320,13 @@ export type Database = {
1213
1320
  isOneToOne: false;
1214
1321
  referencedRelation: "tbl_org";
1215
1322
  referencedColumns: ["org_id"];
1323
+ },
1324
+ {
1325
+ foreignKeyName: "tbl_quick_replies_org_id_fkey";
1326
+ columns: ["org_id"];
1327
+ isOneToOne: false;
1328
+ referencedRelation: "view_org";
1329
+ referencedColumns: ["org_id"];
1216
1330
  }
1217
1331
  ];
1218
1332
  };
@@ -1268,6 +1382,13 @@ export type Database = {
1268
1382
  isOneToOne: false;
1269
1383
  referencedRelation: "tbl_org";
1270
1384
  referencedColumns: ["org_id"];
1385
+ },
1386
+ {
1387
+ foreignKeyName: "tbl_broadcast_messages_org_id_fkey";
1388
+ columns: ["org_id"];
1389
+ isOneToOne: false;
1390
+ referencedRelation: "view_org";
1391
+ referencedColumns: ["org_id"];
1271
1392
  }
1272
1393
  ];
1273
1394
  };
@@ -1296,6 +1417,66 @@ export type Database = {
1296
1417
  };
1297
1418
  Relationships: [];
1298
1419
  };
1420
+ view_org: {
1421
+ Row: {
1422
+ created_at: string | null;
1423
+ is_enterprise: boolean | null;
1424
+ is_free_trial: boolean | null;
1425
+ org_id: string | null;
1426
+ org_image: string | null;
1427
+ org_metadata: Json | null;
1428
+ org_name: string | null;
1429
+ org_plan: Json | null;
1430
+ pending_days: number | null;
1431
+ phone_limit: string | null;
1432
+ plan_id: string | null;
1433
+ stripe_customer_details: Json | null;
1434
+ stripe_customer_id: string | null;
1435
+ stripe_subscription_details: Json | null;
1436
+ subscription_status: string | null;
1437
+ support_link: string | null;
1438
+ user_limit: string | null;
1439
+ };
1440
+ Insert: {
1441
+ created_at?: string | null;
1442
+ is_enterprise?: never;
1443
+ is_free_trial?: never;
1444
+ org_id?: string | null;
1445
+ org_image?: string | null;
1446
+ org_metadata?: Json | null;
1447
+ org_name?: string | null;
1448
+ org_plan?: Json | null;
1449
+ pending_days?: never;
1450
+ phone_limit?: never;
1451
+ plan_id?: never;
1452
+ stripe_customer_details?: Json | null;
1453
+ stripe_customer_id?: string | null;
1454
+ stripe_subscription_details?: Json | null;
1455
+ subscription_status?: never;
1456
+ support_link?: string | null;
1457
+ user_limit?: never;
1458
+ };
1459
+ Update: {
1460
+ created_at?: string | null;
1461
+ is_enterprise?: never;
1462
+ is_free_trial?: never;
1463
+ org_id?: string | null;
1464
+ org_image?: string | null;
1465
+ org_metadata?: Json | null;
1466
+ org_name?: string | null;
1467
+ org_plan?: Json | null;
1468
+ pending_days?: never;
1469
+ phone_limit?: never;
1470
+ plan_id?: never;
1471
+ stripe_customer_details?: Json | null;
1472
+ stripe_customer_id?: string | null;
1473
+ stripe_subscription_details?: Json | null;
1474
+ subscription_status?: never;
1475
+ support_link?: string | null;
1476
+ user_limit?: never;
1477
+ };
1478
+ Relationships: [];
1479
+ };
1299
1480
  };
1300
1481
  Functions: {
1301
1482
  gen_id: {
@@ -1320,6 +1501,15 @@ export type Database = {
1320
1501
  };
1321
1502
  Returns: Json;
1322
1503
  };
1504
+ get_api_auth_details: {
1505
+ Args: {
1506
+ org_id_input?: string;
1507
+ org_phone_input?: string;
1508
+ token_id_input?: string;
1509
+ token_type_input?: string;
1510
+ };
1511
+ Returns: Json;
1512
+ };
1323
1513
  get_chat_labels_data: {
1324
1514
  Args: {
1325
1515
  org_id_input: string;
package/dist/types.d.ts CHANGED
@@ -54,13 +54,18 @@ export type ChatMemberType = Merge<Tables<'tbl_chat_participants'>, Tables<'tbl_
54
54
  export type ChatType = Merge<Tables<'view_chats'>, {
55
55
  chat_id: string;
56
56
  latest_message: MessageType | null;
57
- members: Record<string, ChatMemberType> | null;
57
+ members: {
58
+ [key: string]: ChatMemberType;
59
+ } | null;
58
60
  chat_type: 'user' | 'group' | 'business' | 'unknown';
59
- chat_access: Record<string, boolean>;
60
- label_ids: Record<string, boolean>;
61
+ chat_access: {
62
+ [key: string]: boolean;
63
+ };
64
+ label_ids: {
65
+ [key: string]: boolean;
66
+ };
61
67
  chat_org_phones?: string[];
62
68
  message_unread_count: number | null;
63
- is_open?: boolean;
64
69
  }>;
65
70
  export type MediaType = {
66
71
  path: string;
@@ -83,7 +88,9 @@ export type MessageType = OverrideProperties<Tables<'tbl_chat_messages'>, {
83
88
  media: MediaType | null;
84
89
  }>;
85
90
  export type TicketType = OverrideProperties<Tables<'tbl_chat_tickets'>, {
86
- label_ids: Record<string, boolean>;
91
+ label_ids: {
92
+ [key: string]: boolean;
93
+ };
87
94
  }>;
88
95
  export type ContactType = Merge<Tables<'tbl_contacts'>, {
89
96
  chats: ChatType[] | null;
@@ -104,10 +111,14 @@ export type SendMessageContent = {
104
111
  quoted_message_type?: 'reply' | 'forward' | 'reply_private';
105
112
  broadcast_id?: string;
106
113
  performed_by?: string;
107
- variables?: Record<string, VariableType>;
114
+ variables?: {
115
+ [key: string]: VariableType;
116
+ };
108
117
  };
109
118
  export type QuickReplyContent = Omit<SendMessageContent, 'broadcast_id' | 'variables'>;
110
- export type VariableType = Record<string, string>;
119
+ export type VariableType = {
120
+ [key: string]: string;
121
+ };
111
122
  export type BroadcastMessagePayload = SendMessageContent & {
112
123
  chat_ids: string[];
113
124
  broadcast_id?: string;
@@ -163,3 +174,15 @@ export declare enum IntegrationLogType {
163
174
  NEW_TICKET = "ticket.created"
164
175
  }
165
176
  export type LogTypeMap<T extends IntegrationLogType> = T extends IntegrationLogType.NEW_TICKET ? TicketLogType : Tables<'tbl_integration_logs'>;
177
+ export type APIAuthDetails = {
178
+ org_details: Tables<'view_org'> | null;
179
+ phone_details: Tables<'tbl_org_phones'> | null;
180
+ token_details: Tables<'tbl_integration_tokens'> | null;
181
+ };
182
+ export type UserPreferences = {
183
+ theme: 'light' | 'dark';
184
+ language: 'en' | 'es';
185
+ left_sidebar_open: boolean;
186
+ right_sidepanel_open: boolean;
187
+ sync_wa_unread_count: boolean;
188
+ };
package/dist/types.js CHANGED
@@ -48,7 +48,7 @@ exports.SUPPORTED_TYPES = [
48
48
  'audio',
49
49
  'ptt',
50
50
  'poll_creation',
51
- 'location'
51
+ 'location',
52
52
  ];
53
53
  var IntegrationLogType;
54
54
  (function (IntegrationLogType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.73",
3
+ "version": "0.6.75",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/supabase.types.ts CHANGED
@@ -93,6 +93,13 @@ export type Database = {
93
93
  referencedRelation: "tbl_org"
94
94
  referencedColumns: ["org_id"]
95
95
  },
96
+ {
97
+ foreignKeyName: "tbl_broadcast_logs_org_id_fkey"
98
+ columns: ["org_id"]
99
+ isOneToOne: false
100
+ referencedRelation: "view_org"
101
+ referencedColumns: ["org_id"]
102
+ },
96
103
  ]
97
104
  }
98
105
  tbl_broadcast_messages: {
@@ -134,6 +141,13 @@ export type Database = {
134
141
  referencedRelation: "tbl_org"
135
142
  referencedColumns: ["org_id"]
136
143
  },
144
+ {
145
+ foreignKeyName: "tbl_broadcast_messages_org_id_fkey"
146
+ columns: ["org_id"]
147
+ isOneToOne: false
148
+ referencedRelation: "view_org"
149
+ referencedColumns: ["org_id"]
150
+ },
137
151
  ]
138
152
  }
139
153
  tbl_broadcast_templates: {
@@ -169,6 +183,13 @@ export type Database = {
169
183
  referencedRelation: "tbl_org"
170
184
  referencedColumns: ["org_id"]
171
185
  },
186
+ {
187
+ foreignKeyName: "tbl_broadcast_templates_org_id_fkey"
188
+ columns: ["org_id"]
189
+ isOneToOne: false
190
+ referencedRelation: "view_org"
191
+ referencedColumns: ["org_id"]
192
+ },
172
193
  ]
173
194
  }
174
195
  tbl_chat_access: {
@@ -599,6 +620,13 @@ export type Database = {
599
620
  referencedRelation: "tbl_org"
600
621
  referencedColumns: ["org_id"]
601
622
  },
623
+ {
624
+ foreignKeyName: "tbl_chat_tickets_org_id_fkey"
625
+ columns: ["org_id"]
626
+ isOneToOne: false
627
+ referencedRelation: "view_org"
628
+ referencedColumns: ["org_id"]
629
+ },
602
630
  ]
603
631
  }
604
632
  tbl_chats: {
@@ -608,6 +636,7 @@ export type Database = {
608
636
  chat_image: string | null
609
637
  chat_name: string | null
610
638
  chat_type: string | null
639
+ created_at: string
611
640
  group_metadata: Json | null
612
641
  id: Json | null
613
642
  invite_link: string | null
@@ -631,6 +660,7 @@ export type Database = {
631
660
  chat_image?: string | null
632
661
  chat_name?: string | null
633
662
  chat_type?: string | null
663
+ created_at?: string
634
664
  group_metadata?: Json | null
635
665
  id?: Json | null
636
666
  invite_link?: string | null
@@ -654,6 +684,7 @@ export type Database = {
654
684
  chat_image?: string | null
655
685
  chat_name?: string | null
656
686
  chat_type?: string | null
687
+ created_at?: string
657
688
  group_metadata?: Json | null
658
689
  id?: Json | null
659
690
  invite_link?: string | null
@@ -771,6 +802,13 @@ export type Database = {
771
802
  referencedRelation: "tbl_org"
772
803
  referencedColumns: ["org_id"]
773
804
  },
805
+ {
806
+ foreignKeyName: "tbl_contacts_org_id_fkey"
807
+ columns: ["org_id"]
808
+ isOneToOne: false
809
+ referencedRelation: "view_org"
810
+ referencedColumns: ["org_id"]
811
+ },
774
812
  ]
775
813
  }
776
814
  tbl_custom_properties: {
@@ -812,6 +850,13 @@ export type Database = {
812
850
  referencedRelation: "tbl_org"
813
851
  referencedColumns: ["org_id"]
814
852
  },
853
+ {
854
+ foreignKeyName: "tbl_custom_properties_org_id_fkey"
855
+ columns: ["org_id"]
856
+ isOneToOne: false
857
+ referencedRelation: "view_org"
858
+ referencedColumns: ["org_id"]
859
+ },
815
860
  ]
816
861
  }
817
862
  tbl_flagged_messages: {
@@ -847,6 +892,13 @@ export type Database = {
847
892
  referencedRelation: "tbl_org"
848
893
  referencedColumns: ["org_id"]
849
894
  },
895
+ {
896
+ foreignKeyName: "tbl_flagged_messages_org_id_fkey"
897
+ columns: ["org_id"]
898
+ isOneToOne: false
899
+ referencedRelation: "view_org"
900
+ referencedColumns: ["org_id"]
901
+ },
850
902
  ]
851
903
  }
852
904
  tbl_integration_hooks: {
@@ -894,6 +946,13 @@ export type Database = {
894
946
  referencedRelation: "tbl_org"
895
947
  referencedColumns: ["org_id"]
896
948
  },
949
+ {
950
+ foreignKeyName: "tbl_integration_hooks_org_id_fkey"
951
+ columns: ["org_id"]
952
+ isOneToOne: false
953
+ referencedRelation: "view_org"
954
+ referencedColumns: ["org_id"]
955
+ },
897
956
  ]
898
957
  }
899
958
  tbl_integration_logs: {
@@ -935,6 +994,13 @@ export type Database = {
935
994
  referencedRelation: "tbl_org"
936
995
  referencedColumns: ["org_id"]
937
996
  },
997
+ {
998
+ foreignKeyName: "tbl_integration_logs_org_id_fkey"
999
+ columns: ["org_id"]
1000
+ isOneToOne: false
1001
+ referencedRelation: "view_org"
1002
+ referencedColumns: ["org_id"]
1003
+ },
938
1004
  ]
939
1005
  }
940
1006
  tbl_integration_tokens: {
@@ -979,6 +1045,13 @@ export type Database = {
979
1045
  referencedRelation: "tbl_org"
980
1046
  referencedColumns: ["org_id"]
981
1047
  },
1048
+ {
1049
+ foreignKeyName: "public_tbl_integration_tokens_org_id_fkey"
1050
+ columns: ["org_id"]
1051
+ isOneToOne: false
1052
+ referencedRelation: "view_org"
1053
+ referencedColumns: ["org_id"]
1054
+ },
982
1055
  ]
983
1056
  }
984
1057
  tbl_org: {
@@ -1053,6 +1126,13 @@ export type Database = {
1053
1126
  referencedRelation: "tbl_org"
1054
1127
  referencedColumns: ["org_id"]
1055
1128
  },
1129
+ {
1130
+ foreignKeyName: "tbl_org_labels_org_id_fkey"
1131
+ columns: ["org_id"]
1132
+ isOneToOne: false
1133
+ referencedRelation: "view_org"
1134
+ referencedColumns: ["org_id"]
1135
+ },
1056
1136
  ]
1057
1137
  }
1058
1138
  tbl_org_members: {
@@ -1069,6 +1149,7 @@ export type Database = {
1069
1149
  member_name: string | null
1070
1150
  org_id: string
1071
1151
  org_phones: string[] | null
1152
+ preferences: Json
1072
1153
  role: Database["public"]["Enums"]["enum_member_role"]
1073
1154
  user_id: string | null
1074
1155
  }
@@ -1085,6 +1166,7 @@ export type Database = {
1085
1166
  member_name?: string | null
1086
1167
  org_id: string
1087
1168
  org_phones?: string[] | null
1169
+ preferences?: Json
1088
1170
  role?: Database["public"]["Enums"]["enum_member_role"]
1089
1171
  user_id?: string | null
1090
1172
  }
@@ -1101,6 +1183,7 @@ export type Database = {
1101
1183
  member_name?: string | null
1102
1184
  org_id?: string
1103
1185
  org_phones?: string[] | null
1186
+ preferences?: Json
1104
1187
  role?: Database["public"]["Enums"]["enum_member_role"]
1105
1188
  user_id?: string | null
1106
1189
  }
@@ -1119,6 +1202,13 @@ export type Database = {
1119
1202
  referencedRelation: "tbl_org"
1120
1203
  referencedColumns: ["org_id"]
1121
1204
  },
1205
+ {
1206
+ foreignKeyName: "tbl_org_members_fkey_tbl_org"
1207
+ columns: ["org_id"]
1208
+ isOneToOne: false
1209
+ referencedRelation: "view_org"
1210
+ referencedColumns: ["org_id"]
1211
+ },
1122
1212
  ]
1123
1213
  }
1124
1214
  tbl_org_phones: {
@@ -1126,6 +1216,7 @@ export type Database = {
1126
1216
  created_at: string
1127
1217
  first_connected_at: string | null
1128
1218
  is_ready: boolean | null
1219
+ legacy_version: boolean | null
1129
1220
  org_id: string
1130
1221
  org_phone: string | null
1131
1222
  phone_id: string
@@ -1142,6 +1233,7 @@ export type Database = {
1142
1233
  created_at?: string
1143
1234
  first_connected_at?: string | null
1144
1235
  is_ready?: boolean | null
1236
+ legacy_version?: boolean | null
1145
1237
  org_id: string
1146
1238
  org_phone?: string | null
1147
1239
  phone_id?: string
@@ -1158,6 +1250,7 @@ export type Database = {
1158
1250
  created_at?: string
1159
1251
  first_connected_at?: string | null
1160
1252
  is_ready?: boolean | null
1253
+ legacy_version?: boolean | null
1161
1254
  org_id?: string
1162
1255
  org_phone?: string | null
1163
1256
  phone_id?: string
@@ -1178,6 +1271,13 @@ export type Database = {
1178
1271
  referencedRelation: "tbl_org"
1179
1272
  referencedColumns: ["org_id"]
1180
1273
  },
1274
+ {
1275
+ foreignKeyName: "tbl_org_phones_fkey_tbl_org"
1276
+ columns: ["org_id"]
1277
+ isOneToOne: false
1278
+ referencedRelation: "view_org"
1279
+ referencedColumns: ["org_id"]
1280
+ },
1181
1281
  {
1182
1282
  foreignKeyName: "tbl_org_phones_org_id_fkey"
1183
1283
  columns: ["org_id"]
@@ -1185,6 +1285,13 @@ export type Database = {
1185
1285
  referencedRelation: "tbl_org"
1186
1286
  referencedColumns: ["org_id"]
1187
1287
  },
1288
+ {
1289
+ foreignKeyName: "tbl_org_phones_org_id_fkey"
1290
+ columns: ["org_id"]
1291
+ isOneToOne: false
1292
+ referencedRelation: "view_org"
1293
+ referencedColumns: ["org_id"]
1294
+ },
1188
1295
  ]
1189
1296
  }
1190
1297
  tbl_quick_replies: {
@@ -1217,6 +1324,13 @@ export type Database = {
1217
1324
  referencedRelation: "tbl_org"
1218
1325
  referencedColumns: ["org_id"]
1219
1326
  },
1327
+ {
1328
+ foreignKeyName: "tbl_quick_replies_org_id_fkey"
1329
+ columns: ["org_id"]
1330
+ isOneToOne: false
1331
+ referencedRelation: "view_org"
1332
+ referencedColumns: ["org_id"]
1333
+ },
1220
1334
  ]
1221
1335
  }
1222
1336
  tbl_tools_whatsapp_links: {
@@ -1272,6 +1386,13 @@ export type Database = {
1272
1386
  referencedRelation: "tbl_org"
1273
1387
  referencedColumns: ["org_id"]
1274
1388
  },
1389
+ {
1390
+ foreignKeyName: "tbl_broadcast_messages_org_id_fkey"
1391
+ columns: ["org_id"]
1392
+ isOneToOne: false
1393
+ referencedRelation: "view_org"
1394
+ referencedColumns: ["org_id"]
1395
+ },
1275
1396
  ]
1276
1397
  }
1277
1398
  view_chats: {
@@ -1299,6 +1420,66 @@ export type Database = {
1299
1420
  }
1300
1421
  Relationships: []
1301
1422
  }
1423
+ view_org: {
1424
+ Row: {
1425
+ created_at: string | null
1426
+ is_enterprise: boolean | null
1427
+ is_free_trial: boolean | null
1428
+ org_id: string | null
1429
+ org_image: string | null
1430
+ org_metadata: Json | null
1431
+ org_name: string | null
1432
+ org_plan: Json | null
1433
+ pending_days: number | null
1434
+ phone_limit: string | null
1435
+ plan_id: string | null
1436
+ stripe_customer_details: Json | null
1437
+ stripe_customer_id: string | null
1438
+ stripe_subscription_details: Json | null
1439
+ subscription_status: string | null
1440
+ support_link: string | null
1441
+ user_limit: string | null
1442
+ }
1443
+ Insert: {
1444
+ created_at?: string | null
1445
+ is_enterprise?: never
1446
+ is_free_trial?: never
1447
+ org_id?: string | null
1448
+ org_image?: string | null
1449
+ org_metadata?: Json | null
1450
+ org_name?: string | null
1451
+ org_plan?: Json | null
1452
+ pending_days?: never
1453
+ phone_limit?: never
1454
+ plan_id?: never
1455
+ stripe_customer_details?: Json | null
1456
+ stripe_customer_id?: string | null
1457
+ stripe_subscription_details?: Json | null
1458
+ subscription_status?: never
1459
+ support_link?: string | null
1460
+ user_limit?: never
1461
+ }
1462
+ Update: {
1463
+ created_at?: string | null
1464
+ is_enterprise?: never
1465
+ is_free_trial?: never
1466
+ org_id?: string | null
1467
+ org_image?: string | null
1468
+ org_metadata?: Json | null
1469
+ org_name?: string | null
1470
+ org_plan?: Json | null
1471
+ pending_days?: never
1472
+ phone_limit?: never
1473
+ plan_id?: never
1474
+ stripe_customer_details?: Json | null
1475
+ stripe_customer_id?: string | null
1476
+ stripe_subscription_details?: Json | null
1477
+ subscription_status?: never
1478
+ support_link?: string | null
1479
+ user_limit?: never
1480
+ }
1481
+ Relationships: []
1482
+ }
1302
1483
  }
1303
1484
  Functions: {
1304
1485
  gen_id: {
@@ -1323,6 +1504,15 @@ export type Database = {
1323
1504
  }
1324
1505
  Returns: Json
1325
1506
  }
1507
+ get_api_auth_details: {
1508
+ Args: {
1509
+ org_id_input?: string
1510
+ org_phone_input?: string
1511
+ token_id_input?: string
1512
+ token_type_input?: string
1513
+ }
1514
+ Returns: Json
1515
+ }
1326
1516
  get_chat_labels_data: {
1327
1517
  Args: {
1328
1518
  org_id_input: string
package/types.ts CHANGED
@@ -62,7 +62,7 @@ export type OrgType = OverrideProperties<
62
62
  labels: Tables<'tbl_org_labels'>[];
63
63
  quick_replies: Tables<'tbl_quick_replies'>[];
64
64
  custom_properties: Tables<'tbl_custom_properties'>[];
65
- subscription_status: 'active' | 'inactive' | 'unpaid',
65
+ subscription_status: 'active' | 'inactive' | 'unpaid';
66
66
  is_enterprise: boolean;
67
67
  is_free_trial: boolean;
68
68
  }
@@ -85,13 +85,13 @@ export type ChatType = Merge<
85
85
  {
86
86
  chat_id: string;
87
87
  latest_message: MessageType | null;
88
- members: Record<string, ChatMemberType> | null;
88
+ members: { [key: string]: ChatMemberType } | null;
89
89
  chat_type: 'user' | 'group' | 'business' | 'unknown';
90
- chat_access: Record<string, boolean>;
91
- label_ids: Record<string, boolean>;
90
+ chat_access: { [key: string]: boolean };
91
+ label_ids: { [key: string]: boolean };
92
92
  chat_org_phones?: string[];
93
93
  message_unread_count: number | null;
94
- is_open?: boolean;
94
+ // is_open?: boolean;
95
95
  }
96
96
  >;
97
97
 
@@ -118,7 +118,7 @@ export type MessageType = OverrideProperties<
118
118
  export type TicketType = OverrideProperties<
119
119
  Tables<'tbl_chat_tickets'>,
120
120
  {
121
- label_ids: Record<string, boolean>;
121
+ label_ids: { [key: string]: boolean };
122
122
  }
123
123
  >;
124
124
  export type ContactType = Merge<
@@ -177,7 +177,7 @@ export const SUPPORTED_TYPES = [
177
177
  'audio',
178
178
  'ptt',
179
179
  'poll_creation',
180
- 'location'
180
+ 'location',
181
181
  ] as const;
182
182
 
183
183
  export type SendMessageContent = {
@@ -190,7 +190,7 @@ export type SendMessageContent = {
190
190
  quoted_message_type?: 'reply' | 'forward' | 'reply_private';
191
191
  broadcast_id?: string;
192
192
  performed_by?: string;
193
- variables?: Record<string, VariableType>;
193
+ variables?: { [key: string]: VariableType };
194
194
  };
195
195
 
196
196
  export type QuickReplyContent = Omit<
@@ -198,7 +198,7 @@ export type QuickReplyContent = Omit<
198
198
  'broadcast_id' | 'variables'
199
199
  >;
200
200
 
201
- export type VariableType = Record<string, string>;
201
+ export type VariableType = { [key: string]: string };
202
202
 
203
203
  export type BroadcastMessagePayload = SendMessageContent & {
204
204
  chat_ids: string[];
@@ -289,3 +289,19 @@ export type LogTypeMap<T extends IntegrationLogType> =
289
289
  T extends IntegrationLogType.NEW_TICKET
290
290
  ? TicketLogType
291
291
  : Tables<'tbl_integration_logs'>;
292
+
293
+ export type APIAuthDetails = {
294
+ org_details: Tables<'view_org'> | null;
295
+ phone_details: Tables<'tbl_org_phones'> | null;
296
+ token_details: Tables<'tbl_integration_tokens'> | null;
297
+ };
298
+
299
+ /* ---------------------------- USER PREFERENCES ---------------------------- */
300
+
301
+ export type UserPreferences = {
302
+ theme: 'light' | 'dark';
303
+ language: 'en' | 'es';
304
+ left_sidebar_open: boolean;
305
+ right_sidepanel_open: boolean;
306
+ sync_wa_unread_count: boolean;
307
+ };