@periskope/types 0.6.51 → 0.6.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/supabase.columns.d.ts +4 -4
- package/dist/supabase.columns.js +9 -4
- package/dist/supabase.types.d.ts +18 -2
- package/dist/types.d.ts +41 -4
- package/dist/types.js +11 -1
- package/package.json +2 -1
- package/supabase.columns.ts +9 -4
- package/supabase.types.ts +18 -2
- package/types.ts +60 -8
|
@@ -6,14 +6,14 @@ export declare const TableColumns: {
|
|
|
6
6
|
readonly tbl_chat_notifications: readonly ["org_id", "notification_id", "chat_id", "author", "body", "id", "recipientids", "type", "timestamp", "org_phone"];
|
|
7
7
|
readonly tbl_chat_participants: readonly ["org_id", "chat_id", "contact_id", "id", "is_admin", "is_super_admin", "org_phone"];
|
|
8
8
|
readonly tbl_chat_reactions: readonly ["org_id", "message_id", "ack", "id", "orphan", "reaction", "read", "reaction_id", "timestamp", "msg_id", "orphan_reason", "sender_id", "org_phone"];
|
|
9
|
-
readonly tbl_chat_tickets: readonly ["created_at", "ticket_id", "subject", "status", "assignee", "assigned_by", "chat_id", "due_date", "org_id", "label_ids", "quoted_message_id", "raised_by", "priority", "last_updated_at"];
|
|
10
|
-
readonly tbl_chats: readonly ["org_id", "chat_id", "archived", "id", "is_group", "is_muted", "is_read_only", "mute_expiration", "name", "pinned", "unread_count", "group_metadata", "chat_image", "timestamp", "invite_link", "org_phone", "label_ids", "updated_at"];
|
|
9
|
+
readonly tbl_chat_tickets: readonly ["created_at", "ticket_id", "subject", "status", "assignee", "assigned_by", "chat_id", "due_date", "org_id", "label_ids", "quoted_message_id", "raised_by", "priority", "last_updated_at", "is_deleted"];
|
|
10
|
+
readonly tbl_chats: readonly ["org_id", "chat_id", "archived", "id", "is_group", "is_muted", "is_read_only", "mute_expiration", "name", "pinned", "unread_count", "group_metadata", "chat_image", "timestamp", "invite_link", "org_phone", "label_ids", "updated_at", "latest_message", "member_count"];
|
|
11
11
|
readonly tbl_contacts: readonly ["org_id", "contact_id", "id", "number", "is_business", "is_enterprise", "name", "pushname", "short_name", "contact_type", "is_me", "is_user", "is_group", "is_wa_contact", "is_my_contact", "is_blocked", "contact_image", "contact_color", "business_profile", "verified_name", "is_internal", "label_ids", "verified_level", "updated_at"];
|
|
12
12
|
readonly tbl_org: readonly ["org_id", "created_at", "org_image", "org_name", "support_link", "org_metadata", "org_plan", "stripe_customer_details", "stripe_customer_id", "stripe_subscription_details"];
|
|
13
13
|
readonly tbl_org_labels: readonly ["label_id", "created_at", "org_id", "name", "color", "type"];
|
|
14
14
|
readonly tbl_org_members: readonly ["created_at", "email", "user_id", "invited_at", "invited_by", "org_id", "role", "member_image", "member_name", "is_active", "member_color"];
|
|
15
15
|
readonly tbl_org_phones: readonly ["org_id", "org_phone", "created_at", "updated_at", "wa_state", "phone_id", "qr_code", "phone_image", "phone_name", "server_ip"];
|
|
16
16
|
readonly view_broadcast_logs: readonly ["broadcast_id", "org_id", "message_payload", "created_at", "total_chats", "sent_chats", "failed_chats", "total_member_count", "delivered_member_count", "read_member_count", "completed_at", "scheduled_at", "performed_by", "delivery_percentage", "read_percentage"];
|
|
17
|
-
readonly view_chat_messages: readonly ["message_id", "org_id", "ack", "author", "body", "from_me", "invite_v4", "links", "location", "mentioned_ids", "message_type", "vcards", "chat_id", "timestamp", "org_phone", "broadcast_id", "is_deleted", "media", "performed_by", "prev_body", "quoted_message_id", "sender_phone", "sent_message_id", "delivery_info", "updated_at", "message_ticket_id", "unique_id"];
|
|
18
|
-
readonly view_chats: readonly ["org_id", "chat_id", "org_phone", "chat_image", "invite_link", "label_ids", "updated_at", "chat_name", "latest_message", "
|
|
17
|
+
readonly view_chat_messages: readonly ["message_id", "org_id", "ack", "author", "body", "from_me", "invite_v4", "links", "location", "mentioned_ids", "message_type", "vcards", "chat_id", "timestamp", "org_phone", "broadcast_id", "is_deleted", "media", "performed_by", "prev_body", "quoted_message_id", "sender_phone", "sent_message_id", "delivery_info", "updated_at", "message_ticket_id", "unique_id", "is_gif", "is_forwarded", "is_starred"];
|
|
18
|
+
readonly view_chats: readonly ["org_id", "chat_id", "org_phone", "chat_image", "invite_link", "label_ids", "updated_at", "chat_name", "latest_message", "member_count", "chat_type", "chat_access", "has_access", "last_read_timestamp", "chat_org_phones", "active_phone", "group_description"];
|
|
19
19
|
};
|
package/dist/supabase.columns.js
CHANGED
|
@@ -124,7 +124,8 @@ exports.TableColumns = {
|
|
|
124
124
|
"quoted_message_id",
|
|
125
125
|
"raised_by",
|
|
126
126
|
"priority",
|
|
127
|
-
"last_updated_at"
|
|
127
|
+
"last_updated_at",
|
|
128
|
+
"is_deleted"
|
|
128
129
|
],
|
|
129
130
|
"tbl_chats": [
|
|
130
131
|
"org_id",
|
|
@@ -144,7 +145,9 @@ exports.TableColumns = {
|
|
|
144
145
|
"invite_link",
|
|
145
146
|
"org_phone",
|
|
146
147
|
"label_ids",
|
|
147
|
-
"updated_at"
|
|
148
|
+
"updated_at",
|
|
149
|
+
"latest_message",
|
|
150
|
+
"member_count"
|
|
148
151
|
],
|
|
149
152
|
"tbl_contacts": [
|
|
150
153
|
"org_id",
|
|
@@ -261,7 +264,10 @@ exports.TableColumns = {
|
|
|
261
264
|
"delivery_info",
|
|
262
265
|
"updated_at",
|
|
263
266
|
"message_ticket_id",
|
|
264
|
-
"unique_id"
|
|
267
|
+
"unique_id",
|
|
268
|
+
"is_gif",
|
|
269
|
+
"is_forwarded",
|
|
270
|
+
"is_starred"
|
|
265
271
|
],
|
|
266
272
|
"view_chats": [
|
|
267
273
|
"org_id",
|
|
@@ -273,7 +279,6 @@ exports.TableColumns = {
|
|
|
273
279
|
"updated_at",
|
|
274
280
|
"chat_name",
|
|
275
281
|
"latest_message",
|
|
276
|
-
"message_unread_count",
|
|
277
282
|
"member_count",
|
|
278
283
|
"chat_type",
|
|
279
284
|
"chat_access",
|
package/dist/supabase.types.d.ts
CHANGED
|
@@ -165,6 +165,7 @@ export interface Database {
|
|
|
165
165
|
is_gif: boolean | null;
|
|
166
166
|
is_starred: boolean | null;
|
|
167
167
|
is_status: boolean | null;
|
|
168
|
+
is_supported_type: boolean | null;
|
|
168
169
|
links: Json | null;
|
|
169
170
|
location: Json | null;
|
|
170
171
|
media: Json | null;
|
|
@@ -213,6 +214,7 @@ export interface Database {
|
|
|
213
214
|
is_gif?: boolean | null;
|
|
214
215
|
is_starred?: boolean | null;
|
|
215
216
|
is_status?: boolean | null;
|
|
217
|
+
is_supported_type?: boolean | null;
|
|
216
218
|
links?: Json | null;
|
|
217
219
|
location?: Json | null;
|
|
218
220
|
media?: Json | null;
|
|
@@ -261,6 +263,7 @@ export interface Database {
|
|
|
261
263
|
is_gif?: boolean | null;
|
|
262
264
|
is_starred?: boolean | null;
|
|
263
265
|
is_status?: boolean | null;
|
|
266
|
+
is_supported_type?: boolean | null;
|
|
264
267
|
links?: Json | null;
|
|
265
268
|
location?: Json | null;
|
|
266
269
|
media?: Json | null;
|
|
@@ -459,6 +462,7 @@ export interface Database {
|
|
|
459
462
|
chat_id: string;
|
|
460
463
|
created_at: string;
|
|
461
464
|
due_date: string | null;
|
|
465
|
+
is_deleted: boolean;
|
|
462
466
|
label_ids: Json | null;
|
|
463
467
|
last_updated_at: string;
|
|
464
468
|
org_id: string;
|
|
@@ -475,6 +479,7 @@ export interface Database {
|
|
|
475
479
|
chat_id: string;
|
|
476
480
|
created_at?: string;
|
|
477
481
|
due_date?: string | null;
|
|
482
|
+
is_deleted?: boolean;
|
|
478
483
|
label_ids?: Json | null;
|
|
479
484
|
last_updated_at?: string;
|
|
480
485
|
org_id: string;
|
|
@@ -491,6 +496,7 @@ export interface Database {
|
|
|
491
496
|
chat_id?: string;
|
|
492
497
|
created_at?: string;
|
|
493
498
|
due_date?: string | null;
|
|
499
|
+
is_deleted?: boolean;
|
|
494
500
|
label_ids?: Json | null;
|
|
495
501
|
last_updated_at?: string;
|
|
496
502
|
org_id?: string;
|
|
@@ -523,6 +529,8 @@ export interface Database {
|
|
|
523
529
|
is_muted: boolean | null;
|
|
524
530
|
is_read_only: boolean | null;
|
|
525
531
|
label_ids: Json;
|
|
532
|
+
latest_message: Json | null;
|
|
533
|
+
member_count: number | null;
|
|
526
534
|
mute_expiration: number | null;
|
|
527
535
|
name: string | null;
|
|
528
536
|
org_id: string;
|
|
@@ -543,6 +551,8 @@ export interface Database {
|
|
|
543
551
|
is_muted?: boolean | null;
|
|
544
552
|
is_read_only?: boolean | null;
|
|
545
553
|
label_ids?: Json;
|
|
554
|
+
latest_message?: Json | null;
|
|
555
|
+
member_count?: number | null;
|
|
546
556
|
mute_expiration?: number | null;
|
|
547
557
|
name?: string | null;
|
|
548
558
|
org_id: string;
|
|
@@ -563,6 +573,8 @@ export interface Database {
|
|
|
563
573
|
is_muted?: boolean | null;
|
|
564
574
|
is_read_only?: boolean | null;
|
|
565
575
|
label_ids?: Json;
|
|
576
|
+
latest_message?: Json | null;
|
|
577
|
+
member_count?: number | null;
|
|
566
578
|
mute_expiration?: number | null;
|
|
567
579
|
name?: string | null;
|
|
568
580
|
org_id?: string;
|
|
@@ -903,6 +915,9 @@ export interface Database {
|
|
|
903
915
|
from_me: boolean | null;
|
|
904
916
|
invite_v4: Json | null;
|
|
905
917
|
is_deleted: boolean | null;
|
|
918
|
+
is_forwarded: boolean | null;
|
|
919
|
+
is_gif: boolean | null;
|
|
920
|
+
is_starred: boolean | null;
|
|
906
921
|
links: Json | null;
|
|
907
922
|
location: Json | null;
|
|
908
923
|
media: Json | null;
|
|
@@ -948,7 +963,6 @@ export interface Database {
|
|
|
948
963
|
last_read_timestamp: string | null;
|
|
949
964
|
latest_message: Json | null;
|
|
950
965
|
member_count: number | null;
|
|
951
|
-
message_unread_count: number | null;
|
|
952
966
|
org_id: string | null;
|
|
953
967
|
org_phone: string | null;
|
|
954
968
|
updated_at: string | null;
|
|
@@ -974,7 +988,9 @@ export interface Database {
|
|
|
974
988
|
Returns: string;
|
|
975
989
|
};
|
|
976
990
|
gen_ticket_id: {
|
|
977
|
-
Args:
|
|
991
|
+
Args: {
|
|
992
|
+
org_id_input?: string;
|
|
993
|
+
};
|
|
978
994
|
Returns: string;
|
|
979
995
|
};
|
|
980
996
|
get_broadcast_id: {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { default as _Stripe } from 'stripe';
|
|
1
2
|
import { Merge, OverrideProperties } from 'type-fest';
|
|
2
3
|
import { Chat, Location, MessageInfo } from 'whatsapp-web.js';
|
|
3
4
|
import { Tables } from './supabase.types';
|
|
@@ -6,12 +7,44 @@ export type WhatsappChat = Chat & {
|
|
|
6
7
|
pinned?: boolean;
|
|
7
8
|
invite_link?: string;
|
|
8
9
|
};
|
|
9
|
-
export
|
|
10
|
+
export declare 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
|
+
}
|
|
18
|
+
export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
|
|
19
|
+
export type Enterprise = `${string}-enterprise`;
|
|
20
|
+
export type OrgPlanEnterprise = {
|
|
21
|
+
plan_id: Enterprise;
|
|
22
|
+
frequency: Frequency;
|
|
23
|
+
user_limit: number;
|
|
24
|
+
phone_limit: number;
|
|
25
|
+
current_period_start: number;
|
|
26
|
+
current_period_end: number | null;
|
|
27
|
+
};
|
|
28
|
+
export type OrgPlanNonEnterprise = {
|
|
29
|
+
plan_id: AllPlans;
|
|
30
|
+
interval: number;
|
|
31
|
+
frequency: Frequency;
|
|
32
|
+
user_limit: number;
|
|
33
|
+
phone_limit: number;
|
|
34
|
+
percent_off: number | null;
|
|
35
|
+
};
|
|
36
|
+
export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise ? OrgPlanEnterprise : T extends AllPlans ? OrgPlanNonEnterprise : never;
|
|
37
|
+
export type OrgType = OverrideProperties<Tables<'tbl_org'> & {
|
|
10
38
|
user: Tables<'tbl_org_members'>;
|
|
11
39
|
members: Tables<'tbl_org_members'>[];
|
|
12
40
|
phones: Tables<'tbl_org_phones'>[];
|
|
13
41
|
labels: Tables<'tbl_org_labels'>[];
|
|
14
|
-
}
|
|
42
|
+
}, {
|
|
43
|
+
org_plan: OrgPlan<AllPlans | Enterprise>;
|
|
44
|
+
stripe_customer_details: _Stripe.Customer | null;
|
|
45
|
+
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
46
|
+
stripe_customer_id: _Stripe.Customer['id'] | null;
|
|
47
|
+
}>;
|
|
15
48
|
export type ChatMemberType = Merge<Tables<'tbl_chat_participants'>, Tables<'tbl_contacts'>>;
|
|
16
49
|
export type ChatType = Merge<Tables<'view_chats'>, {
|
|
17
50
|
chat_id: string;
|
|
@@ -39,7 +72,7 @@ export type MessageType = OverrideProperties<Tables<'view_chat_messages'>, {
|
|
|
39
72
|
org_id: string;
|
|
40
73
|
org_phone: string;
|
|
41
74
|
chat_id: string;
|
|
42
|
-
message_type: typeof SUPPORTED_TYPES[number];
|
|
75
|
+
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
43
76
|
media: MediaType | null;
|
|
44
77
|
}>;
|
|
45
78
|
export type TicketType = OverrideProperties<Tables<'tbl_chat_tickets'>, {
|
|
@@ -55,7 +88,7 @@ export declare const labelColors: string[];
|
|
|
55
88
|
export declare const enumChatColors: readonly ["#B4876E", "#A5B337", "#06CF9C", "#25D366", "#02A698", "#7D9EF1", "#007BFC", "#5E47DE", "#7F66FF", "#9333EA", "#FA6533", "#C4532D", "#DC2626", "#FF2E74", "#DB2777"];
|
|
56
89
|
export declare const SUPPORTED_TYPES: readonly ["chat", "sticker", "image", "video", "document", "vcard", "multi_vcard", "audio", "ptt", "poll_creation"];
|
|
57
90
|
export type SendMessageContent = {
|
|
58
|
-
message_type?: typeof SUPPORTED_TYPES[number];
|
|
91
|
+
message_type?: (typeof SUPPORTED_TYPES)[number];
|
|
59
92
|
body?: string;
|
|
60
93
|
media?: MediaType;
|
|
61
94
|
contact_ids?: string[];
|
|
@@ -100,6 +133,10 @@ export type ChatParticipantOperation = {
|
|
|
100
133
|
export type ChatParticipantOperationPayload = ChatParticipantOperation & {
|
|
101
134
|
chat_ids: string[];
|
|
102
135
|
};
|
|
136
|
+
export type StripeSubscription = _Stripe.Subscription;
|
|
137
|
+
export type StripeCustomer = _Stripe.Customer;
|
|
138
|
+
export type StripeCoupon = _Stripe.Coupon;
|
|
139
|
+
export type StripePrice = _Stripe.Price;
|
|
103
140
|
export type PhoneRealtimeChannel = {
|
|
104
141
|
loading: boolean;
|
|
105
142
|
state: string;
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SUPPORTED_TYPES = exports.enumChatColors = exports.labelColors = void 0;
|
|
3
|
+
exports.SUPPORTED_TYPES = exports.enumChatColors = exports.labelColors = exports.AllPlans = void 0;
|
|
4
|
+
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
5
|
+
var AllPlans;
|
|
6
|
+
(function (AllPlans) {
|
|
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";
|
|
12
|
+
AllPlans["ENTERPRISE"] = "enterprise";
|
|
13
|
+
})(AllPlans || (exports.AllPlans = AllPlans = {}));
|
|
4
14
|
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
5
15
|
exports.labelColors = [
|
|
6
16
|
'#9333EA',
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@periskope/types",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.53",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@types/pg": "8.11.2",
|
|
9
9
|
"pg": "^8.11.3",
|
|
10
|
+
"stripe": "^14.19.0",
|
|
10
11
|
"ts-node": "^10.9.2",
|
|
11
12
|
"type-fest": "^4.8.3",
|
|
12
13
|
"whatsapp-web.js": "1.23.1-alpha.4"
|
package/supabase.columns.ts
CHANGED
|
@@ -121,7 +121,8 @@ export const TableColumns = {
|
|
|
121
121
|
"quoted_message_id",
|
|
122
122
|
"raised_by",
|
|
123
123
|
"priority",
|
|
124
|
-
"last_updated_at"
|
|
124
|
+
"last_updated_at",
|
|
125
|
+
"is_deleted"
|
|
125
126
|
],
|
|
126
127
|
"tbl_chats": [
|
|
127
128
|
"org_id",
|
|
@@ -141,7 +142,9 @@ export const TableColumns = {
|
|
|
141
142
|
"invite_link",
|
|
142
143
|
"org_phone",
|
|
143
144
|
"label_ids",
|
|
144
|
-
"updated_at"
|
|
145
|
+
"updated_at",
|
|
146
|
+
"latest_message",
|
|
147
|
+
"member_count"
|
|
145
148
|
],
|
|
146
149
|
"tbl_contacts": [
|
|
147
150
|
"org_id",
|
|
@@ -258,7 +261,10 @@ export const TableColumns = {
|
|
|
258
261
|
"delivery_info",
|
|
259
262
|
"updated_at",
|
|
260
263
|
"message_ticket_id",
|
|
261
|
-
"unique_id"
|
|
264
|
+
"unique_id",
|
|
265
|
+
"is_gif",
|
|
266
|
+
"is_forwarded",
|
|
267
|
+
"is_starred"
|
|
262
268
|
],
|
|
263
269
|
"view_chats": [
|
|
264
270
|
"org_id",
|
|
@@ -270,7 +276,6 @@ export const TableColumns = {
|
|
|
270
276
|
"updated_at",
|
|
271
277
|
"chat_name",
|
|
272
278
|
"latest_message",
|
|
273
|
-
"message_unread_count",
|
|
274
279
|
"member_count",
|
|
275
280
|
"chat_type",
|
|
276
281
|
"chat_access",
|
package/supabase.types.ts
CHANGED
|
@@ -164,6 +164,7 @@ export interface Database {
|
|
|
164
164
|
is_gif: boolean | null
|
|
165
165
|
is_starred: boolean | null
|
|
166
166
|
is_status: boolean | null
|
|
167
|
+
is_supported_type: boolean | null
|
|
167
168
|
links: Json | null
|
|
168
169
|
location: Json | null
|
|
169
170
|
media: Json | null
|
|
@@ -212,6 +213,7 @@ export interface Database {
|
|
|
212
213
|
is_gif?: boolean | null
|
|
213
214
|
is_starred?: boolean | null
|
|
214
215
|
is_status?: boolean | null
|
|
216
|
+
is_supported_type?: boolean | null
|
|
215
217
|
links?: Json | null
|
|
216
218
|
location?: Json | null
|
|
217
219
|
media?: Json | null
|
|
@@ -260,6 +262,7 @@ export interface Database {
|
|
|
260
262
|
is_gif?: boolean | null
|
|
261
263
|
is_starred?: boolean | null
|
|
262
264
|
is_status?: boolean | null
|
|
265
|
+
is_supported_type?: boolean | null
|
|
263
266
|
links?: Json | null
|
|
264
267
|
location?: Json | null
|
|
265
268
|
media?: Json | null
|
|
@@ -458,6 +461,7 @@ export interface Database {
|
|
|
458
461
|
chat_id: string
|
|
459
462
|
created_at: string
|
|
460
463
|
due_date: string | null
|
|
464
|
+
is_deleted: boolean
|
|
461
465
|
label_ids: Json | null
|
|
462
466
|
last_updated_at: string
|
|
463
467
|
org_id: string
|
|
@@ -474,6 +478,7 @@ export interface Database {
|
|
|
474
478
|
chat_id: string
|
|
475
479
|
created_at?: string
|
|
476
480
|
due_date?: string | null
|
|
481
|
+
is_deleted?: boolean
|
|
477
482
|
label_ids?: Json | null
|
|
478
483
|
last_updated_at?: string
|
|
479
484
|
org_id: string
|
|
@@ -492,6 +497,7 @@ export interface Database {
|
|
|
492
497
|
chat_id?: string
|
|
493
498
|
created_at?: string
|
|
494
499
|
due_date?: string | null
|
|
500
|
+
is_deleted?: boolean
|
|
495
501
|
label_ids?: Json | null
|
|
496
502
|
last_updated_at?: string
|
|
497
503
|
org_id?: string
|
|
@@ -526,6 +532,8 @@ export interface Database {
|
|
|
526
532
|
is_muted: boolean | null
|
|
527
533
|
is_read_only: boolean | null
|
|
528
534
|
label_ids: Json
|
|
535
|
+
latest_message: Json | null
|
|
536
|
+
member_count: number | null
|
|
529
537
|
mute_expiration: number | null
|
|
530
538
|
name: string | null
|
|
531
539
|
org_id: string
|
|
@@ -546,6 +554,8 @@ export interface Database {
|
|
|
546
554
|
is_muted?: boolean | null
|
|
547
555
|
is_read_only?: boolean | null
|
|
548
556
|
label_ids?: Json
|
|
557
|
+
latest_message?: Json | null
|
|
558
|
+
member_count?: number | null
|
|
549
559
|
mute_expiration?: number | null
|
|
550
560
|
name?: string | null
|
|
551
561
|
org_id: string
|
|
@@ -566,6 +576,8 @@ export interface Database {
|
|
|
566
576
|
is_muted?: boolean | null
|
|
567
577
|
is_read_only?: boolean | null
|
|
568
578
|
label_ids?: Json
|
|
579
|
+
latest_message?: Json | null
|
|
580
|
+
member_count?: number | null
|
|
569
581
|
mute_expiration?: number | null
|
|
570
582
|
name?: string | null
|
|
571
583
|
org_id?: string
|
|
@@ -906,6 +918,9 @@ export interface Database {
|
|
|
906
918
|
from_me: boolean | null
|
|
907
919
|
invite_v4: Json | null
|
|
908
920
|
is_deleted: boolean | null
|
|
921
|
+
is_forwarded: boolean | null
|
|
922
|
+
is_gif: boolean | null
|
|
923
|
+
is_starred: boolean | null
|
|
909
924
|
links: Json | null
|
|
910
925
|
location: Json | null
|
|
911
926
|
media: Json | null
|
|
@@ -951,7 +966,6 @@ export interface Database {
|
|
|
951
966
|
last_read_timestamp: string | null
|
|
952
967
|
latest_message: Json | null
|
|
953
968
|
member_count: number | null
|
|
954
|
-
message_unread_count: number | null
|
|
955
969
|
org_id: string | null
|
|
956
970
|
org_phone: string | null
|
|
957
971
|
updated_at: string | null
|
|
@@ -977,7 +991,9 @@ export interface Database {
|
|
|
977
991
|
Returns: string
|
|
978
992
|
}
|
|
979
993
|
gen_ticket_id: {
|
|
980
|
-
Args:
|
|
994
|
+
Args: {
|
|
995
|
+
org_id_input?: string
|
|
996
|
+
}
|
|
981
997
|
Returns: string
|
|
982
998
|
}
|
|
983
999
|
get_broadcast_id: {
|
package/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { default as _Stripe } from 'stripe';
|
|
1
2
|
import { Merge, OverrideProperties } from 'type-fest';
|
|
2
3
|
import { Chat, Location, MessageInfo } from 'whatsapp-web.js';
|
|
3
4
|
import { Tables } from './supabase.types';
|
|
@@ -14,13 +15,58 @@ export type WhatsappChat = Chat & {
|
|
|
14
15
|
|
|
15
16
|
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
16
17
|
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
export enum AllPlans {
|
|
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',
|
|
24
|
+
ENTERPRISE = 'enterprise',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
|
|
28
|
+
|
|
29
|
+
export type Enterprise = `${string}-enterprise`;
|
|
30
|
+
|
|
31
|
+
export type OrgPlanEnterprise = {
|
|
32
|
+
plan_id: Enterprise;
|
|
33
|
+
frequency: Frequency;
|
|
34
|
+
user_limit: number;
|
|
35
|
+
phone_limit: number;
|
|
36
|
+
current_period_start: number;
|
|
37
|
+
current_period_end: number | null;
|
|
22
38
|
};
|
|
23
39
|
|
|
40
|
+
export type OrgPlanNonEnterprise = {
|
|
41
|
+
plan_id: AllPlans;
|
|
42
|
+
interval: number;
|
|
43
|
+
frequency: Frequency;
|
|
44
|
+
user_limit: number;
|
|
45
|
+
phone_limit: number;
|
|
46
|
+
percent_off: number | null;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise
|
|
50
|
+
? OrgPlanEnterprise
|
|
51
|
+
: T extends AllPlans
|
|
52
|
+
? OrgPlanNonEnterprise
|
|
53
|
+
: never;
|
|
54
|
+
|
|
55
|
+
export type OrgType = OverrideProperties<
|
|
56
|
+
Tables<'tbl_org'> & {
|
|
57
|
+
user: Tables<'tbl_org_members'>;
|
|
58
|
+
members: Tables<'tbl_org_members'>[];
|
|
59
|
+
phones: Tables<'tbl_org_phones'>[];
|
|
60
|
+
labels: Tables<'tbl_org_labels'>[];
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
org_plan: OrgPlan<AllPlans | Enterprise>;
|
|
64
|
+
stripe_customer_details: _Stripe.Customer | null;
|
|
65
|
+
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
66
|
+
stripe_customer_id: _Stripe.Customer['id'] | null;
|
|
67
|
+
}
|
|
68
|
+
>;
|
|
69
|
+
|
|
24
70
|
export type ChatMemberType = Merge<
|
|
25
71
|
Tables<'tbl_chat_participants'>,
|
|
26
72
|
Tables<'tbl_contacts'>
|
|
@@ -55,7 +101,7 @@ export type MessageType = OverrideProperties<
|
|
|
55
101
|
org_id: string;
|
|
56
102
|
org_phone: string;
|
|
57
103
|
chat_id: string;
|
|
58
|
-
message_type: typeof SUPPORTED_TYPES[number];
|
|
104
|
+
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
59
105
|
media: MediaType | null;
|
|
60
106
|
}
|
|
61
107
|
>;
|
|
@@ -124,7 +170,7 @@ export const SUPPORTED_TYPES = [
|
|
|
124
170
|
] as const;
|
|
125
171
|
|
|
126
172
|
export type SendMessageContent = {
|
|
127
|
-
message_type?: typeof SUPPORTED_TYPES[number];
|
|
173
|
+
message_type?: (typeof SUPPORTED_TYPES)[number];
|
|
128
174
|
body?: string;
|
|
129
175
|
media?: MediaType;
|
|
130
176
|
contact_ids?: string[];
|
|
@@ -182,6 +228,12 @@ export type ChatParticipantOperationPayload = ChatParticipantOperation & {
|
|
|
182
228
|
chat_ids: string[];
|
|
183
229
|
};
|
|
184
230
|
|
|
231
|
+
/* ----------------------- BILLING - STRIPE ----------------------- */
|
|
232
|
+
|
|
233
|
+
export type StripeSubscription = _Stripe.Subscription;
|
|
234
|
+
export type StripeCustomer = _Stripe.Customer;
|
|
235
|
+
export type StripeCoupon = _Stripe.Coupon;
|
|
236
|
+
export type StripePrice = _Stripe.Price;
|
|
185
237
|
|
|
186
238
|
/* -------------------------------- REALTIME -------------------------------- */
|
|
187
239
|
|
|
@@ -194,4 +246,4 @@ export type PhoneRealtimeChannel = {
|
|
|
194
246
|
message?: string;
|
|
195
247
|
error?: string;
|
|
196
248
|
presence_ref?: string;
|
|
197
|
-
}
|
|
249
|
+
};
|