@periskope/types 0.6.52 → 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 +2 -2
- package/dist/supabase.columns.js +3 -2
- package/dist/supabase.types.d.ts +12 -2
- package/dist/types.d.ts +36 -26
- package/dist/types.js +30 -31
- package/package.json +1 -1
- package/supabase.columns.ts +3 -2
- package/supabase.types.ts +12 -2
- package/types.ts +82 -67
|
@@ -7,7 +7,7 @@ export declare const TableColumns: {
|
|
|
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
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"];
|
|
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"];
|
|
@@ -15,5 +15,5 @@ export declare const TableColumns: {
|
|
|
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
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", "
|
|
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
|
@@ -145,7 +145,9 @@ exports.TableColumns = {
|
|
|
145
145
|
"invite_link",
|
|
146
146
|
"org_phone",
|
|
147
147
|
"label_ids",
|
|
148
|
-
"updated_at"
|
|
148
|
+
"updated_at",
|
|
149
|
+
"latest_message",
|
|
150
|
+
"member_count"
|
|
149
151
|
],
|
|
150
152
|
"tbl_contacts": [
|
|
151
153
|
"org_id",
|
|
@@ -277,7 +279,6 @@ exports.TableColumns = {
|
|
|
277
279
|
"updated_at",
|
|
278
280
|
"chat_name",
|
|
279
281
|
"latest_message",
|
|
280
|
-
"message_unread_count",
|
|
281
282
|
"member_count",
|
|
282
283
|
"chat_type",
|
|
283
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;
|
|
@@ -526,6 +529,8 @@ export interface Database {
|
|
|
526
529
|
is_muted: boolean | null;
|
|
527
530
|
is_read_only: boolean | null;
|
|
528
531
|
label_ids: Json;
|
|
532
|
+
latest_message: Json | null;
|
|
533
|
+
member_count: number | null;
|
|
529
534
|
mute_expiration: number | null;
|
|
530
535
|
name: string | null;
|
|
531
536
|
org_id: string;
|
|
@@ -546,6 +551,8 @@ export interface Database {
|
|
|
546
551
|
is_muted?: boolean | null;
|
|
547
552
|
is_read_only?: boolean | null;
|
|
548
553
|
label_ids?: Json;
|
|
554
|
+
latest_message?: Json | null;
|
|
555
|
+
member_count?: number | null;
|
|
549
556
|
mute_expiration?: number | null;
|
|
550
557
|
name?: string | null;
|
|
551
558
|
org_id: string;
|
|
@@ -566,6 +573,8 @@ export interface Database {
|
|
|
566
573
|
is_muted?: boolean | null;
|
|
567
574
|
is_read_only?: boolean | null;
|
|
568
575
|
label_ids?: Json;
|
|
576
|
+
latest_message?: Json | null;
|
|
577
|
+
member_count?: number | null;
|
|
569
578
|
mute_expiration?: number | null;
|
|
570
579
|
name?: string | null;
|
|
571
580
|
org_id?: string;
|
|
@@ -954,7 +963,6 @@ export interface Database {
|
|
|
954
963
|
last_read_timestamp: string | null;
|
|
955
964
|
latest_message: Json | null;
|
|
956
965
|
member_count: number | null;
|
|
957
|
-
message_unread_count: number | null;
|
|
958
966
|
org_id: string | null;
|
|
959
967
|
org_phone: string | null;
|
|
960
968
|
updated_at: string | null;
|
|
@@ -980,7 +988,9 @@ export interface Database {
|
|
|
980
988
|
Returns: string;
|
|
981
989
|
};
|
|
982
990
|
gen_ticket_id: {
|
|
983
|
-
Args:
|
|
991
|
+
Args: {
|
|
992
|
+
org_id_input?: string;
|
|
993
|
+
};
|
|
984
994
|
Returns: string;
|
|
985
995
|
};
|
|
986
996
|
get_broadcast_id: {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { default as _Stripe } from
|
|
2
|
-
import { Merge, OverrideProperties } from
|
|
3
|
-
import { Chat, Location, MessageInfo } from
|
|
4
|
-
import { Tables } from
|
|
1
|
+
import type { default as _Stripe } from 'stripe';
|
|
2
|
+
import { Merge, OverrideProperties } from 'type-fest';
|
|
3
|
+
import { Chat, Location, MessageInfo } from 'whatsapp-web.js';
|
|
4
|
+
import { Tables } from './supabase.types';
|
|
5
5
|
export type WhatsappChat = Chat & {
|
|
6
6
|
groupMetadata?: any;
|
|
7
7
|
pinned?: boolean;
|
|
@@ -15,8 +15,17 @@ export declare enum AllPlans {
|
|
|
15
15
|
YEARLY_PRO = "yearly-pro",
|
|
16
16
|
ENTERPRISE = "enterprise"
|
|
17
17
|
}
|
|
18
|
-
export type Frequency =
|
|
19
|
-
export type
|
|
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 = {
|
|
20
29
|
plan_id: AllPlans;
|
|
21
30
|
interval: number;
|
|
22
31
|
frequency: Frequency;
|
|
@@ -24,23 +33,24 @@ export type OrgPlan = {
|
|
|
24
33
|
phone_limit: number;
|
|
25
34
|
percent_off: number | null;
|
|
26
35
|
};
|
|
27
|
-
export type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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'> & {
|
|
38
|
+
user: Tables<'tbl_org_members'>;
|
|
39
|
+
members: Tables<'tbl_org_members'>[];
|
|
40
|
+
phones: Tables<'tbl_org_phones'>[];
|
|
41
|
+
labels: Tables<'tbl_org_labels'>[];
|
|
32
42
|
}, {
|
|
33
|
-
org_plan: OrgPlan
|
|
43
|
+
org_plan: OrgPlan<AllPlans | Enterprise>;
|
|
34
44
|
stripe_customer_details: _Stripe.Customer | null;
|
|
35
45
|
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
36
|
-
stripe_customer_id: _Stripe.Customer[
|
|
46
|
+
stripe_customer_id: _Stripe.Customer['id'] | null;
|
|
37
47
|
}>;
|
|
38
|
-
export type ChatMemberType = Merge<Tables<
|
|
39
|
-
export type ChatType = Merge<Tables<
|
|
48
|
+
export type ChatMemberType = Merge<Tables<'tbl_chat_participants'>, Tables<'tbl_contacts'>>;
|
|
49
|
+
export type ChatType = Merge<Tables<'view_chats'>, {
|
|
40
50
|
chat_id: string;
|
|
41
51
|
latest_message: MessageType | null;
|
|
42
52
|
members: Record<string, ChatMemberType> | null;
|
|
43
|
-
chat_type:
|
|
53
|
+
chat_type: 'user' | 'group' | 'business' | 'unknown';
|
|
44
54
|
chat_access: Record<string, boolean>;
|
|
45
55
|
label_ids: Record<string, boolean>;
|
|
46
56
|
chat_org_phones?: string[];
|
|
@@ -57,7 +67,7 @@ export type MediaType = {
|
|
|
57
67
|
};
|
|
58
68
|
size?: number;
|
|
59
69
|
};
|
|
60
|
-
export type MessageType = OverrideProperties<Tables<
|
|
70
|
+
export type MessageType = OverrideProperties<Tables<'view_chat_messages'>, {
|
|
61
71
|
message_id: string;
|
|
62
72
|
org_id: string;
|
|
63
73
|
org_phone: string;
|
|
@@ -65,15 +75,15 @@ export type MessageType = OverrideProperties<Tables<"view_chat_messages">, {
|
|
|
65
75
|
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
66
76
|
media: MediaType | null;
|
|
67
77
|
}>;
|
|
68
|
-
export type TicketType = OverrideProperties<Tables<
|
|
78
|
+
export type TicketType = OverrideProperties<Tables<'tbl_chat_tickets'>, {
|
|
69
79
|
label_ids: Record<string, boolean>;
|
|
70
80
|
}>;
|
|
71
|
-
export type ContactType = Merge<Tables<
|
|
81
|
+
export type ContactType = Merge<Tables<'tbl_contacts'>, {
|
|
72
82
|
chats: ChatType[] | null;
|
|
73
83
|
}>;
|
|
74
|
-
export type ReactionType = Tables<
|
|
75
|
-
export type NotificationType = Tables<
|
|
76
|
-
export type ChatAccessType = Merge<Partial<Tables<
|
|
84
|
+
export type ReactionType = Tables<'tbl_chat_reactions'>;
|
|
85
|
+
export type NotificationType = Tables<'tbl_chat_notifications'>;
|
|
86
|
+
export type ChatAccessType = Merge<Partial<Tables<'tbl_chat_access'>>, Tables<'tbl_org_members'>>;
|
|
77
87
|
export declare const labelColors: string[];
|
|
78
88
|
export declare const enumChatColors: readonly ["#B4876E", "#A5B337", "#06CF9C", "#25D366", "#02A698", "#7D9EF1", "#007BFC", "#5E47DE", "#7F66FF", "#9333EA", "#FA6533", "#C4532D", "#DC2626", "#FF2E74", "#DB2777"];
|
|
79
89
|
export declare const SUPPORTED_TYPES: readonly ["chat", "sticker", "image", "video", "document", "vcard", "multi_vcard", "audio", "ptt", "poll_creation"];
|
|
@@ -84,7 +94,7 @@ export type SendMessageContent = {
|
|
|
84
94
|
contact_ids?: string[];
|
|
85
95
|
location?: Location;
|
|
86
96
|
quoted_message_id?: string;
|
|
87
|
-
quoted_message_type?:
|
|
97
|
+
quoted_message_type?: 'reply' | 'forward' | 'reply_private';
|
|
88
98
|
broadcast_id?: string;
|
|
89
99
|
performed_by?: string;
|
|
90
100
|
variables?: Record<string, VariableType>;
|
|
@@ -101,7 +111,7 @@ export type SingleMessagePayload = SendMessageContent & {
|
|
|
101
111
|
export type AttachmentTypeProps = {
|
|
102
112
|
result: string;
|
|
103
113
|
file: File | null;
|
|
104
|
-
type:
|
|
114
|
+
type: 'image' | 'audio' | 'document' | 'video';
|
|
105
115
|
};
|
|
106
116
|
export type LogsType = {
|
|
107
117
|
chat_id: string | null;
|
|
@@ -113,12 +123,12 @@ export type LogsType = {
|
|
|
113
123
|
members: Partial<ChatMemberType>[];
|
|
114
124
|
member_count: number | null;
|
|
115
125
|
};
|
|
116
|
-
export type BroadcastLogType = Tables<
|
|
126
|
+
export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
|
|
117
127
|
logs: (LogsType & ChatType)[];
|
|
118
128
|
};
|
|
119
129
|
export type ChatParticipantOperation = {
|
|
120
130
|
participant_ids: string[];
|
|
121
|
-
operation_type:
|
|
131
|
+
operation_type: 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
|
|
122
132
|
};
|
|
123
133
|
export type ChatParticipantOperationPayload = ChatParticipantOperation & {
|
|
124
134
|
chat_ids: string[];
|
package/dist/types.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SUPPORTED_TYPES = exports.enumChatColors = exports.labelColors = exports.AllPlans = void 0;
|
|
4
4
|
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
5
|
-
// TODO - @rbkayz - Need to update these types to unpkg and remove type OrgPlanType from hooks.helpers.ts:24 and import this there
|
|
6
5
|
var AllPlans;
|
|
7
6
|
(function (AllPlans) {
|
|
8
7
|
AllPlans["FREE_TRIAL"] = "free-trial";
|
|
@@ -14,39 +13,39 @@ var AllPlans;
|
|
|
14
13
|
})(AllPlans || (exports.AllPlans = AllPlans = {}));
|
|
15
14
|
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
16
15
|
exports.labelColors = [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
'#9333EA',
|
|
17
|
+
'#0D9488',
|
|
18
|
+
'#DB2777',
|
|
19
|
+
'#2563EB',
|
|
20
|
+
'#F97316',
|
|
22
21
|
];
|
|
23
22
|
exports.enumChatColors = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
'#B4876E',
|
|
24
|
+
'#A5B337',
|
|
25
|
+
'#06CF9C',
|
|
26
|
+
'#25D366',
|
|
27
|
+
'#02A698',
|
|
28
|
+
'#7D9EF1',
|
|
29
|
+
'#007BFC',
|
|
30
|
+
'#5E47DE',
|
|
31
|
+
'#7F66FF',
|
|
32
|
+
'#9333EA',
|
|
33
|
+
'#FA6533',
|
|
34
|
+
'#C4532D',
|
|
35
|
+
'#DC2626',
|
|
36
|
+
'#FF2E74',
|
|
37
|
+
'#DB2777',
|
|
39
38
|
];
|
|
40
39
|
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
41
40
|
exports.SUPPORTED_TYPES = [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
'chat',
|
|
42
|
+
'sticker',
|
|
43
|
+
'image',
|
|
44
|
+
'video',
|
|
45
|
+
'document',
|
|
46
|
+
'vcard',
|
|
47
|
+
'multi_vcard',
|
|
48
|
+
'audio',
|
|
49
|
+
'ptt',
|
|
50
|
+
'poll_creation',
|
|
52
51
|
];
|
package/package.json
CHANGED
package/supabase.columns.ts
CHANGED
|
@@ -142,7 +142,9 @@ export const TableColumns = {
|
|
|
142
142
|
"invite_link",
|
|
143
143
|
"org_phone",
|
|
144
144
|
"label_ids",
|
|
145
|
-
"updated_at"
|
|
145
|
+
"updated_at",
|
|
146
|
+
"latest_message",
|
|
147
|
+
"member_count"
|
|
146
148
|
],
|
|
147
149
|
"tbl_contacts": [
|
|
148
150
|
"org_id",
|
|
@@ -274,7 +276,6 @@ export const TableColumns = {
|
|
|
274
276
|
"updated_at",
|
|
275
277
|
"chat_name",
|
|
276
278
|
"latest_message",
|
|
277
|
-
"message_unread_count",
|
|
278
279
|
"member_count",
|
|
279
280
|
"chat_type",
|
|
280
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
|
|
@@ -529,6 +532,8 @@ export interface Database {
|
|
|
529
532
|
is_muted: boolean | null
|
|
530
533
|
is_read_only: boolean | null
|
|
531
534
|
label_ids: Json
|
|
535
|
+
latest_message: Json | null
|
|
536
|
+
member_count: number | null
|
|
532
537
|
mute_expiration: number | null
|
|
533
538
|
name: string | null
|
|
534
539
|
org_id: string
|
|
@@ -549,6 +554,8 @@ export interface Database {
|
|
|
549
554
|
is_muted?: boolean | null
|
|
550
555
|
is_read_only?: boolean | null
|
|
551
556
|
label_ids?: Json
|
|
557
|
+
latest_message?: Json | null
|
|
558
|
+
member_count?: number | null
|
|
552
559
|
mute_expiration?: number | null
|
|
553
560
|
name?: string | null
|
|
554
561
|
org_id: string
|
|
@@ -569,6 +576,8 @@ export interface Database {
|
|
|
569
576
|
is_muted?: boolean | null
|
|
570
577
|
is_read_only?: boolean | null
|
|
571
578
|
label_ids?: Json
|
|
579
|
+
latest_message?: Json | null
|
|
580
|
+
member_count?: number | null
|
|
572
581
|
mute_expiration?: number | null
|
|
573
582
|
name?: string | null
|
|
574
583
|
org_id?: string
|
|
@@ -957,7 +966,6 @@ export interface Database {
|
|
|
957
966
|
last_read_timestamp: string | null
|
|
958
967
|
latest_message: Json | null
|
|
959
968
|
member_count: number | null
|
|
960
|
-
message_unread_count: number | null
|
|
961
969
|
org_id: string | null
|
|
962
970
|
org_phone: string | null
|
|
963
971
|
updated_at: string | null
|
|
@@ -983,7 +991,9 @@ export interface Database {
|
|
|
983
991
|
Returns: string
|
|
984
992
|
}
|
|
985
993
|
gen_ticket_id: {
|
|
986
|
-
Args:
|
|
994
|
+
Args: {
|
|
995
|
+
org_id_input?: string
|
|
996
|
+
}
|
|
987
997
|
Returns: string
|
|
988
998
|
}
|
|
989
999
|
get_broadcast_id: {
|
package/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { default as _Stripe } from
|
|
2
|
-
import { Merge, OverrideProperties } from
|
|
3
|
-
import { Chat, Location, MessageInfo } from
|
|
4
|
-
import { Tables } from
|
|
1
|
+
import type { default as _Stripe } from 'stripe';
|
|
2
|
+
import { Merge, OverrideProperties } from 'type-fest';
|
|
3
|
+
import { Chat, Location, MessageInfo } from 'whatsapp-web.js';
|
|
4
|
+
import { Tables } from './supabase.types';
|
|
5
5
|
|
|
6
6
|
/* ----------------------------- TYPE SHORTHANDS ---------------------------- */
|
|
7
7
|
|
|
@@ -15,20 +15,29 @@ export type WhatsappChat = Chat & {
|
|
|
15
15
|
|
|
16
16
|
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
17
17
|
|
|
18
|
-
// TODO - @rbkayz - Need to update these types to unpkg and remove type OrgPlanType from hooks.helpers.ts:24 and import this there
|
|
19
|
-
|
|
20
18
|
export enum AllPlans {
|
|
21
|
-
FREE_TRIAL =
|
|
22
|
-
MONTHLY_STARTER =
|
|
23
|
-
YEARLY_STARTER =
|
|
24
|
-
MONTHLY_PRO =
|
|
25
|
-
YEARLY_PRO =
|
|
26
|
-
ENTERPRISE =
|
|
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',
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
export type Frequency =
|
|
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;
|
|
38
|
+
};
|
|
30
39
|
|
|
31
|
-
export type
|
|
40
|
+
export type OrgPlanNonEnterprise = {
|
|
32
41
|
plan_id: AllPlans;
|
|
33
42
|
interval: number;
|
|
34
43
|
frequency: Frequency;
|
|
@@ -37,33 +46,39 @@ export type OrgPlan = {
|
|
|
37
46
|
percent_off: number | null;
|
|
38
47
|
};
|
|
39
48
|
|
|
49
|
+
export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise
|
|
50
|
+
? OrgPlanEnterprise
|
|
51
|
+
: T extends AllPlans
|
|
52
|
+
? OrgPlanNonEnterprise
|
|
53
|
+
: never;
|
|
54
|
+
|
|
40
55
|
export type OrgType = OverrideProperties<
|
|
41
|
-
Tables<
|
|
42
|
-
user: Tables<
|
|
43
|
-
members: Tables<
|
|
44
|
-
phones: Tables<
|
|
45
|
-
labels: Tables<
|
|
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'>[];
|
|
46
61
|
},
|
|
47
62
|
{
|
|
48
|
-
org_plan: OrgPlan
|
|
63
|
+
org_plan: OrgPlan<AllPlans | Enterprise>;
|
|
49
64
|
stripe_customer_details: _Stripe.Customer | null;
|
|
50
65
|
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
51
|
-
stripe_customer_id: _Stripe.Customer[
|
|
66
|
+
stripe_customer_id: _Stripe.Customer['id'] | null;
|
|
52
67
|
}
|
|
53
68
|
>;
|
|
54
69
|
|
|
55
70
|
export type ChatMemberType = Merge<
|
|
56
|
-
Tables<
|
|
57
|
-
Tables<
|
|
71
|
+
Tables<'tbl_chat_participants'>,
|
|
72
|
+
Tables<'tbl_contacts'>
|
|
58
73
|
>;
|
|
59
74
|
|
|
60
75
|
export type ChatType = Merge<
|
|
61
|
-
Tables<
|
|
76
|
+
Tables<'view_chats'>,
|
|
62
77
|
{
|
|
63
78
|
chat_id: string;
|
|
64
79
|
latest_message: MessageType | null;
|
|
65
80
|
members: Record<string, ChatMemberType> | null;
|
|
66
|
-
chat_type:
|
|
81
|
+
chat_type: 'user' | 'group' | 'business' | 'unknown';
|
|
67
82
|
chat_access: Record<string, boolean>;
|
|
68
83
|
label_ids: Record<string, boolean>;
|
|
69
84
|
chat_org_phones?: string[];
|
|
@@ -80,7 +95,7 @@ export type MediaType = {
|
|
|
80
95
|
};
|
|
81
96
|
|
|
82
97
|
export type MessageType = OverrideProperties<
|
|
83
|
-
Tables<
|
|
98
|
+
Tables<'view_chat_messages'>,
|
|
84
99
|
{
|
|
85
100
|
message_id: string;
|
|
86
101
|
org_id: string;
|
|
@@ -91,67 +106,67 @@ export type MessageType = OverrideProperties<
|
|
|
91
106
|
}
|
|
92
107
|
>;
|
|
93
108
|
export type TicketType = OverrideProperties<
|
|
94
|
-
Tables<
|
|
109
|
+
Tables<'tbl_chat_tickets'>,
|
|
95
110
|
{
|
|
96
111
|
label_ids: Record<string, boolean>;
|
|
97
112
|
}
|
|
98
113
|
>;
|
|
99
114
|
export type ContactType = Merge<
|
|
100
|
-
Tables<
|
|
115
|
+
Tables<'tbl_contacts'>,
|
|
101
116
|
{
|
|
102
117
|
chats: ChatType[] | null;
|
|
103
118
|
}
|
|
104
119
|
>;
|
|
105
|
-
export type ReactionType = Tables<
|
|
120
|
+
export type ReactionType = Tables<'tbl_chat_reactions'>;
|
|
106
121
|
|
|
107
|
-
export type NotificationType = Tables<
|
|
122
|
+
export type NotificationType = Tables<'tbl_chat_notifications'>;
|
|
108
123
|
|
|
109
124
|
export type ChatAccessType = Merge<
|
|
110
|
-
Partial<Tables<
|
|
111
|
-
Tables<
|
|
125
|
+
Partial<Tables<'tbl_chat_access'>>,
|
|
126
|
+
Tables<'tbl_org_members'>
|
|
112
127
|
>;
|
|
113
128
|
|
|
114
129
|
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
115
130
|
|
|
116
131
|
export const labelColors = [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
132
|
+
'#9333EA',
|
|
133
|
+
'#0D9488',
|
|
134
|
+
'#DB2777',
|
|
135
|
+
'#2563EB',
|
|
136
|
+
'#F97316',
|
|
122
137
|
];
|
|
123
138
|
|
|
124
139
|
export const enumChatColors = [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
'#B4876E',
|
|
141
|
+
'#A5B337',
|
|
142
|
+
'#06CF9C',
|
|
143
|
+
'#25D366',
|
|
144
|
+
'#02A698',
|
|
145
|
+
'#7D9EF1',
|
|
146
|
+
'#007BFC',
|
|
147
|
+
'#5E47DE',
|
|
148
|
+
'#7F66FF',
|
|
149
|
+
'#9333EA',
|
|
150
|
+
'#FA6533',
|
|
151
|
+
'#C4532D',
|
|
152
|
+
'#DC2626',
|
|
153
|
+
'#FF2E74',
|
|
154
|
+
'#DB2777',
|
|
140
155
|
] as const;
|
|
141
156
|
|
|
142
157
|
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
143
158
|
|
|
144
159
|
export const SUPPORTED_TYPES = [
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
160
|
+
'chat',
|
|
161
|
+
'sticker',
|
|
162
|
+
'image',
|
|
163
|
+
'video',
|
|
164
|
+
'document',
|
|
165
|
+
'vcard',
|
|
166
|
+
'multi_vcard',
|
|
167
|
+
'audio',
|
|
168
|
+
'ptt',
|
|
169
|
+
'poll_creation',
|
|
155
170
|
] as const;
|
|
156
171
|
|
|
157
172
|
export type SendMessageContent = {
|
|
@@ -161,7 +176,7 @@ export type SendMessageContent = {
|
|
|
161
176
|
contact_ids?: string[];
|
|
162
177
|
location?: Location;
|
|
163
178
|
quoted_message_id?: string;
|
|
164
|
-
quoted_message_type?:
|
|
179
|
+
quoted_message_type?: 'reply' | 'forward' | 'reply_private';
|
|
165
180
|
broadcast_id?: string;
|
|
166
181
|
performed_by?: string;
|
|
167
182
|
variables?: Record<string, VariableType>;
|
|
@@ -182,7 +197,7 @@ export type SingleMessagePayload = SendMessageContent & {
|
|
|
182
197
|
export type AttachmentTypeProps = {
|
|
183
198
|
result: string;
|
|
184
199
|
file: File | null;
|
|
185
|
-
type:
|
|
200
|
+
type: 'image' | 'audio' | 'document' | 'video';
|
|
186
201
|
};
|
|
187
202
|
|
|
188
203
|
/* -------------------------------- BROADCAST ------------------------------- */
|
|
@@ -198,7 +213,7 @@ export type LogsType = {
|
|
|
198
213
|
member_count: number | null;
|
|
199
214
|
};
|
|
200
215
|
|
|
201
|
-
export type BroadcastLogType = Tables<
|
|
216
|
+
export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
|
|
202
217
|
logs: (LogsType & ChatType)[];
|
|
203
218
|
};
|
|
204
219
|
|
|
@@ -206,7 +221,7 @@ export type BroadcastLogType = Tables<"view_broadcast_logs"> & {
|
|
|
206
221
|
|
|
207
222
|
export type ChatParticipantOperation = {
|
|
208
223
|
participant_ids: string[];
|
|
209
|
-
operation_type:
|
|
224
|
+
operation_type: 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
|
|
210
225
|
};
|
|
211
226
|
|
|
212
227
|
export type ChatParticipantOperationPayload = ChatParticipantOperation & {
|
|
@@ -231,4 +246,4 @@ export type PhoneRealtimeChannel = {
|
|
|
231
246
|
message?: string;
|
|
232
247
|
error?: string;
|
|
233
248
|
presence_ref?: string;
|
|
234
|
-
}
|
|
249
|
+
};
|