@periskope/types 0.6.50 → 0.6.52
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 +3 -3
- package/dist/supabase.columns.js +8 -3
- package/dist/supabase.types.d.ts +14 -0
- package/dist/types.d.ts +60 -23
- package/dist/types.js +42 -31
- package/package.json +2 -1
- package/supabase.columns.ts +8 -3
- package/supabase.types.ts +14 -0
- package/types.ts +107 -56
|
@@ -6,7 +6,7 @@ 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"];
|
|
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
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"];
|
|
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"];
|
|
@@ -14,6 +14,6 @@ export declare const TableColumns: {
|
|
|
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", "message_unread_count", "member_count", "chat_type", "chat_access", "has_access", "last_read_timestamp", "chat_org_phones", "active_phone"];
|
|
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", "message_unread_count", "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",
|
|
@@ -261,7 +262,10 @@ exports.TableColumns = {
|
|
|
261
262
|
"delivery_info",
|
|
262
263
|
"updated_at",
|
|
263
264
|
"message_ticket_id",
|
|
264
|
-
"unique_id"
|
|
265
|
+
"unique_id",
|
|
266
|
+
"is_gif",
|
|
267
|
+
"is_forwarded",
|
|
268
|
+
"is_starred"
|
|
265
269
|
],
|
|
266
270
|
"view_chats": [
|
|
267
271
|
"org_id",
|
|
@@ -280,6 +284,7 @@ exports.TableColumns = {
|
|
|
280
284
|
"has_access",
|
|
281
285
|
"last_read_timestamp",
|
|
282
286
|
"chat_org_phones",
|
|
283
|
-
"active_phone"
|
|
287
|
+
"active_phone",
|
|
288
|
+
"group_description"
|
|
284
289
|
]
|
|
285
290
|
};
|
package/dist/supabase.types.d.ts
CHANGED
|
@@ -459,6 +459,7 @@ export interface Database {
|
|
|
459
459
|
chat_id: string;
|
|
460
460
|
created_at: string;
|
|
461
461
|
due_date: string | null;
|
|
462
|
+
is_deleted: boolean;
|
|
462
463
|
label_ids: Json | null;
|
|
463
464
|
last_updated_at: string;
|
|
464
465
|
org_id: string;
|
|
@@ -475,6 +476,7 @@ export interface Database {
|
|
|
475
476
|
chat_id: string;
|
|
476
477
|
created_at?: string;
|
|
477
478
|
due_date?: string | null;
|
|
479
|
+
is_deleted?: boolean;
|
|
478
480
|
label_ids?: Json | null;
|
|
479
481
|
last_updated_at?: string;
|
|
480
482
|
org_id: string;
|
|
@@ -491,6 +493,7 @@ export interface Database {
|
|
|
491
493
|
chat_id?: string;
|
|
492
494
|
created_at?: string;
|
|
493
495
|
due_date?: string | null;
|
|
496
|
+
is_deleted?: boolean;
|
|
494
497
|
label_ids?: Json | null;
|
|
495
498
|
last_updated_at?: string;
|
|
496
499
|
org_id?: string;
|
|
@@ -903,6 +906,9 @@ export interface Database {
|
|
|
903
906
|
from_me: boolean | null;
|
|
904
907
|
invite_v4: Json | null;
|
|
905
908
|
is_deleted: boolean | null;
|
|
909
|
+
is_forwarded: boolean | null;
|
|
910
|
+
is_gif: boolean | null;
|
|
911
|
+
is_starred: boolean | null;
|
|
906
912
|
links: Json | null;
|
|
907
913
|
location: Json | null;
|
|
908
914
|
media: Json | null;
|
|
@@ -941,6 +947,7 @@ export interface Database {
|
|
|
941
947
|
chat_name: string | null;
|
|
942
948
|
chat_org_phones: string[] | null;
|
|
943
949
|
chat_type: string | null;
|
|
950
|
+
group_description: string | null;
|
|
944
951
|
has_access: boolean | null;
|
|
945
952
|
invite_link: string | null;
|
|
946
953
|
label_ids: Json | null;
|
|
@@ -1006,6 +1013,13 @@ export interface Database {
|
|
|
1006
1013
|
};
|
|
1007
1014
|
Returns: Json;
|
|
1008
1015
|
};
|
|
1016
|
+
get_dashboard_statistics: {
|
|
1017
|
+
Args: {
|
|
1018
|
+
type_input?: string;
|
|
1019
|
+
interval_input?: unknown;
|
|
1020
|
+
};
|
|
1021
|
+
Returns: Json;
|
|
1022
|
+
};
|
|
1009
1023
|
get_export_chats_data: {
|
|
1010
1024
|
Args: {
|
|
1011
1025
|
chat_ids: string[];
|
package/dist/types.d.ts
CHANGED
|
@@ -1,23 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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";
|
|
4
5
|
export type WhatsappChat = Chat & {
|
|
5
6
|
groupMetadata?: any;
|
|
6
7
|
pinned?: boolean;
|
|
7
8
|
invite_link?: string;
|
|
8
9
|
};
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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";
|
|
19
|
+
export type OrgPlan = {
|
|
20
|
+
plan_id: AllPlans;
|
|
21
|
+
interval: number;
|
|
22
|
+
frequency: Frequency;
|
|
23
|
+
user_limit: number;
|
|
24
|
+
phone_limit: number;
|
|
25
|
+
percent_off: number | null;
|
|
14
26
|
};
|
|
15
|
-
export type
|
|
16
|
-
|
|
27
|
+
export type OrgType = OverrideProperties<Tables<"tbl_org"> & {
|
|
28
|
+
user: Tables<"tbl_org_members">;
|
|
29
|
+
members: Tables<"tbl_org_members">[];
|
|
30
|
+
phones: Tables<"tbl_org_phones">[];
|
|
31
|
+
labels: Tables<"tbl_org_labels">[];
|
|
32
|
+
}, {
|
|
33
|
+
org_plan: OrgPlan;
|
|
34
|
+
stripe_customer_details: _Stripe.Customer | null;
|
|
35
|
+
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
36
|
+
stripe_customer_id: _Stripe.Customer["id"] | null;
|
|
37
|
+
}>;
|
|
38
|
+
export type ChatMemberType = Merge<Tables<"tbl_chat_participants">, Tables<"tbl_contacts">>;
|
|
39
|
+
export type ChatType = Merge<Tables<"view_chats">, {
|
|
17
40
|
chat_id: string;
|
|
18
41
|
latest_message: MessageType | null;
|
|
19
42
|
members: Record<string, ChatMemberType> | null;
|
|
20
|
-
chat_type:
|
|
43
|
+
chat_type: "user" | "group" | "business" | "unknown";
|
|
21
44
|
chat_access: Record<string, boolean>;
|
|
22
45
|
label_ids: Record<string, boolean>;
|
|
23
46
|
chat_org_phones?: string[];
|
|
@@ -34,34 +57,34 @@ export type MediaType = {
|
|
|
34
57
|
};
|
|
35
58
|
size?: number;
|
|
36
59
|
};
|
|
37
|
-
export type MessageType = OverrideProperties<Tables<
|
|
60
|
+
export type MessageType = OverrideProperties<Tables<"view_chat_messages">, {
|
|
38
61
|
message_id: string;
|
|
39
62
|
org_id: string;
|
|
40
63
|
org_phone: string;
|
|
41
64
|
chat_id: string;
|
|
42
|
-
message_type: typeof SUPPORTED_TYPES[number];
|
|
65
|
+
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
43
66
|
media: MediaType | null;
|
|
44
67
|
}>;
|
|
45
|
-
export type TicketType = OverrideProperties<Tables<
|
|
68
|
+
export type TicketType = OverrideProperties<Tables<"tbl_chat_tickets">, {
|
|
46
69
|
label_ids: Record<string, boolean>;
|
|
47
70
|
}>;
|
|
48
|
-
export type ContactType = Merge<Tables<
|
|
71
|
+
export type ContactType = Merge<Tables<"tbl_contacts">, {
|
|
49
72
|
chats: ChatType[] | null;
|
|
50
73
|
}>;
|
|
51
|
-
export type ReactionType = Tables<
|
|
52
|
-
export type NotificationType = Tables<
|
|
53
|
-
export type ChatAccessType = Merge<Partial<Tables<
|
|
74
|
+
export type ReactionType = Tables<"tbl_chat_reactions">;
|
|
75
|
+
export type NotificationType = Tables<"tbl_chat_notifications">;
|
|
76
|
+
export type ChatAccessType = Merge<Partial<Tables<"tbl_chat_access">>, Tables<"tbl_org_members">>;
|
|
54
77
|
export declare const labelColors: string[];
|
|
55
78
|
export declare const enumChatColors: readonly ["#B4876E", "#A5B337", "#06CF9C", "#25D366", "#02A698", "#7D9EF1", "#007BFC", "#5E47DE", "#7F66FF", "#9333EA", "#FA6533", "#C4532D", "#DC2626", "#FF2E74", "#DB2777"];
|
|
56
79
|
export declare const SUPPORTED_TYPES: readonly ["chat", "sticker", "image", "video", "document", "vcard", "multi_vcard", "audio", "ptt", "poll_creation"];
|
|
57
80
|
export type SendMessageContent = {
|
|
58
|
-
message_type?: typeof SUPPORTED_TYPES[number];
|
|
81
|
+
message_type?: (typeof SUPPORTED_TYPES)[number];
|
|
59
82
|
body?: string;
|
|
60
83
|
media?: MediaType;
|
|
61
84
|
contact_ids?: string[];
|
|
62
85
|
location?: Location;
|
|
63
86
|
quoted_message_id?: string;
|
|
64
|
-
quoted_message_type?:
|
|
87
|
+
quoted_message_type?: "reply" | "forward" | "reply_private";
|
|
65
88
|
broadcast_id?: string;
|
|
66
89
|
performed_by?: string;
|
|
67
90
|
variables?: Record<string, VariableType>;
|
|
@@ -78,7 +101,7 @@ export type SingleMessagePayload = SendMessageContent & {
|
|
|
78
101
|
export type AttachmentTypeProps = {
|
|
79
102
|
result: string;
|
|
80
103
|
file: File | null;
|
|
81
|
-
type:
|
|
104
|
+
type: "image" | "audio" | "document" | "video";
|
|
82
105
|
};
|
|
83
106
|
export type LogsType = {
|
|
84
107
|
chat_id: string | null;
|
|
@@ -90,13 +113,27 @@ export type LogsType = {
|
|
|
90
113
|
members: Partial<ChatMemberType>[];
|
|
91
114
|
member_count: number | null;
|
|
92
115
|
};
|
|
93
|
-
export type BroadcastLogType = Tables<
|
|
116
|
+
export type BroadcastLogType = Tables<"view_broadcast_logs"> & {
|
|
94
117
|
logs: (LogsType & ChatType)[];
|
|
95
118
|
};
|
|
96
119
|
export type ChatParticipantOperation = {
|
|
97
120
|
participant_ids: string[];
|
|
98
|
-
operation_type:
|
|
121
|
+
operation_type: "ADD" | "REMOVE" | "PROMOTE" | "DEMOTE";
|
|
99
122
|
};
|
|
100
123
|
export type ChatParticipantOperationPayload = ChatParticipantOperation & {
|
|
101
124
|
chat_ids: string[];
|
|
102
125
|
};
|
|
126
|
+
export type StripeSubscription = _Stripe.Subscription;
|
|
127
|
+
export type StripeCustomer = _Stripe.Customer;
|
|
128
|
+
export type StripeCoupon = _Stripe.Coupon;
|
|
129
|
+
export type StripePrice = _Stripe.Price;
|
|
130
|
+
export type PhoneRealtimeChannel = {
|
|
131
|
+
loading: boolean;
|
|
132
|
+
state: string;
|
|
133
|
+
ready: boolean;
|
|
134
|
+
sync: boolean;
|
|
135
|
+
percent: number | null;
|
|
136
|
+
message?: string;
|
|
137
|
+
error?: string;
|
|
138
|
+
presence_ref?: string;
|
|
139
|
+
};
|
package/dist/types.js
CHANGED
|
@@ -1,41 +1,52 @@
|
|
|
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
|
+
// TODO - @rbkayz - Need to update these types to unpkg and remove type OrgPlanType from hooks.helpers.ts:24 and import this there
|
|
6
|
+
var AllPlans;
|
|
7
|
+
(function (AllPlans) {
|
|
8
|
+
AllPlans["FREE_TRIAL"] = "free-trial";
|
|
9
|
+
AllPlans["MONTHLY_STARTER"] = "monthly-starter";
|
|
10
|
+
AllPlans["YEARLY_STARTER"] = "yearly-starter";
|
|
11
|
+
AllPlans["MONTHLY_PRO"] = "monthly-pro";
|
|
12
|
+
AllPlans["YEARLY_PRO"] = "yearly-pro";
|
|
13
|
+
AllPlans["ENTERPRISE"] = "enterprise";
|
|
14
|
+
})(AllPlans || (exports.AllPlans = AllPlans = {}));
|
|
4
15
|
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
5
16
|
exports.labelColors = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
"#9333EA",
|
|
18
|
+
"#0D9488",
|
|
19
|
+
"#DB2777",
|
|
20
|
+
"#2563EB",
|
|
21
|
+
"#F97316",
|
|
11
22
|
];
|
|
12
23
|
exports.enumChatColors = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
"#B4876E",
|
|
25
|
+
"#A5B337",
|
|
26
|
+
"#06CF9C",
|
|
27
|
+
"#25D366",
|
|
28
|
+
"#02A698",
|
|
29
|
+
"#7D9EF1",
|
|
30
|
+
"#007BFC",
|
|
31
|
+
"#5E47DE",
|
|
32
|
+
"#7F66FF",
|
|
33
|
+
"#9333EA",
|
|
34
|
+
"#FA6533",
|
|
35
|
+
"#C4532D",
|
|
36
|
+
"#DC2626",
|
|
37
|
+
"#FF2E74",
|
|
38
|
+
"#DB2777",
|
|
28
39
|
];
|
|
29
40
|
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
30
41
|
exports.SUPPORTED_TYPES = [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
"chat",
|
|
43
|
+
"sticker",
|
|
44
|
+
"image",
|
|
45
|
+
"video",
|
|
46
|
+
"document",
|
|
47
|
+
"vcard",
|
|
48
|
+
"multi_vcard",
|
|
49
|
+
"audio",
|
|
50
|
+
"ptt",
|
|
51
|
+
"poll_creation",
|
|
41
52
|
];
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@periskope/types",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.52",
|
|
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",
|
|
@@ -258,7 +259,10 @@ export const TableColumns = {
|
|
|
258
259
|
"delivery_info",
|
|
259
260
|
"updated_at",
|
|
260
261
|
"message_ticket_id",
|
|
261
|
-
"unique_id"
|
|
262
|
+
"unique_id",
|
|
263
|
+
"is_gif",
|
|
264
|
+
"is_forwarded",
|
|
265
|
+
"is_starred"
|
|
262
266
|
],
|
|
263
267
|
"view_chats": [
|
|
264
268
|
"org_id",
|
|
@@ -277,6 +281,7 @@ export const TableColumns = {
|
|
|
277
281
|
"has_access",
|
|
278
282
|
"last_read_timestamp",
|
|
279
283
|
"chat_org_phones",
|
|
280
|
-
"active_phone"
|
|
284
|
+
"active_phone",
|
|
285
|
+
"group_description"
|
|
281
286
|
]
|
|
282
287
|
} as const;
|
package/supabase.types.ts
CHANGED
|
@@ -458,6 +458,7 @@ export interface Database {
|
|
|
458
458
|
chat_id: string
|
|
459
459
|
created_at: string
|
|
460
460
|
due_date: string | null
|
|
461
|
+
is_deleted: boolean
|
|
461
462
|
label_ids: Json | null
|
|
462
463
|
last_updated_at: string
|
|
463
464
|
org_id: string
|
|
@@ -474,6 +475,7 @@ export interface Database {
|
|
|
474
475
|
chat_id: string
|
|
475
476
|
created_at?: string
|
|
476
477
|
due_date?: string | null
|
|
478
|
+
is_deleted?: boolean
|
|
477
479
|
label_ids?: Json | null
|
|
478
480
|
last_updated_at?: string
|
|
479
481
|
org_id: string
|
|
@@ -492,6 +494,7 @@ export interface Database {
|
|
|
492
494
|
chat_id?: string
|
|
493
495
|
created_at?: string
|
|
494
496
|
due_date?: string | null
|
|
497
|
+
is_deleted?: boolean
|
|
495
498
|
label_ids?: Json | null
|
|
496
499
|
last_updated_at?: string
|
|
497
500
|
org_id?: string
|
|
@@ -906,6 +909,9 @@ export interface Database {
|
|
|
906
909
|
from_me: boolean | null
|
|
907
910
|
invite_v4: Json | null
|
|
908
911
|
is_deleted: boolean | null
|
|
912
|
+
is_forwarded: boolean | null
|
|
913
|
+
is_gif: boolean | null
|
|
914
|
+
is_starred: boolean | null
|
|
909
915
|
links: Json | null
|
|
910
916
|
location: Json | null
|
|
911
917
|
media: Json | null
|
|
@@ -944,6 +950,7 @@ export interface Database {
|
|
|
944
950
|
chat_name: string | null
|
|
945
951
|
chat_org_phones: string[] | null
|
|
946
952
|
chat_type: string | null
|
|
953
|
+
group_description: string | null
|
|
947
954
|
has_access: boolean | null
|
|
948
955
|
invite_link: string | null
|
|
949
956
|
label_ids: Json | null
|
|
@@ -1009,6 +1016,13 @@ export interface Database {
|
|
|
1009
1016
|
}
|
|
1010
1017
|
Returns: Json
|
|
1011
1018
|
}
|
|
1019
|
+
get_dashboard_statistics: {
|
|
1020
|
+
Args: {
|
|
1021
|
+
type_input?: string
|
|
1022
|
+
interval_input?: unknown
|
|
1023
|
+
}
|
|
1024
|
+
Returns: Json
|
|
1025
|
+
}
|
|
1012
1026
|
get_export_chats_data: {
|
|
1013
1027
|
Args: {
|
|
1014
1028
|
chat_ids: string[]
|
package/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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";
|
|
4
5
|
|
|
5
6
|
/* ----------------------------- TYPE SHORTHANDS ---------------------------- */
|
|
6
7
|
|
|
@@ -14,25 +15,55 @@ export type WhatsappChat = Chat & {
|
|
|
14
15
|
|
|
15
16
|
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
export enum AllPlans {
|
|
21
|
+
FREE_TRIAL = "free-trial",
|
|
22
|
+
MONTHLY_STARTER = "monthly-starter",
|
|
23
|
+
YEARLY_STARTER = "yearly-starter",
|
|
24
|
+
MONTHLY_PRO = "monthly-pro",
|
|
25
|
+
YEARLY_PRO = "yearly-pro",
|
|
26
|
+
ENTERPRISE = "enterprise",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type Frequency = "yearly" | "monthly" | "weekly";
|
|
30
|
+
|
|
31
|
+
export type OrgPlan = {
|
|
32
|
+
plan_id: AllPlans;
|
|
33
|
+
interval: number;
|
|
34
|
+
frequency: Frequency;
|
|
35
|
+
user_limit: number;
|
|
36
|
+
phone_limit: number;
|
|
37
|
+
percent_off: number | null;
|
|
22
38
|
};
|
|
23
39
|
|
|
40
|
+
export type OrgType = OverrideProperties<
|
|
41
|
+
Tables<"tbl_org"> & {
|
|
42
|
+
user: Tables<"tbl_org_members">;
|
|
43
|
+
members: Tables<"tbl_org_members">[];
|
|
44
|
+
phones: Tables<"tbl_org_phones">[];
|
|
45
|
+
labels: Tables<"tbl_org_labels">[];
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
org_plan: OrgPlan;
|
|
49
|
+
stripe_customer_details: _Stripe.Customer | null;
|
|
50
|
+
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
51
|
+
stripe_customer_id: _Stripe.Customer["id"] | null;
|
|
52
|
+
}
|
|
53
|
+
>;
|
|
54
|
+
|
|
24
55
|
export type ChatMemberType = Merge<
|
|
25
|
-
Tables<
|
|
26
|
-
Tables<
|
|
56
|
+
Tables<"tbl_chat_participants">,
|
|
57
|
+
Tables<"tbl_contacts">
|
|
27
58
|
>;
|
|
28
59
|
|
|
29
60
|
export type ChatType = Merge<
|
|
30
|
-
Tables<
|
|
61
|
+
Tables<"view_chats">,
|
|
31
62
|
{
|
|
32
63
|
chat_id: string;
|
|
33
64
|
latest_message: MessageType | null;
|
|
34
65
|
members: Record<string, ChatMemberType> | null;
|
|
35
|
-
chat_type:
|
|
66
|
+
chat_type: "user" | "group" | "business" | "unknown";
|
|
36
67
|
chat_access: Record<string, boolean>;
|
|
37
68
|
label_ids: Record<string, boolean>;
|
|
38
69
|
chat_org_phones?: string[];
|
|
@@ -49,88 +80,88 @@ export type MediaType = {
|
|
|
49
80
|
};
|
|
50
81
|
|
|
51
82
|
export type MessageType = OverrideProperties<
|
|
52
|
-
Tables<
|
|
83
|
+
Tables<"view_chat_messages">,
|
|
53
84
|
{
|
|
54
85
|
message_id: string;
|
|
55
86
|
org_id: string;
|
|
56
87
|
org_phone: string;
|
|
57
88
|
chat_id: string;
|
|
58
|
-
message_type: typeof SUPPORTED_TYPES[number];
|
|
89
|
+
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
59
90
|
media: MediaType | null;
|
|
60
91
|
}
|
|
61
92
|
>;
|
|
62
93
|
export type TicketType = OverrideProperties<
|
|
63
|
-
Tables<
|
|
94
|
+
Tables<"tbl_chat_tickets">,
|
|
64
95
|
{
|
|
65
96
|
label_ids: Record<string, boolean>;
|
|
66
97
|
}
|
|
67
98
|
>;
|
|
68
99
|
export type ContactType = Merge<
|
|
69
|
-
Tables<
|
|
100
|
+
Tables<"tbl_contacts">,
|
|
70
101
|
{
|
|
71
102
|
chats: ChatType[] | null;
|
|
72
103
|
}
|
|
73
104
|
>;
|
|
74
|
-
export type ReactionType = Tables<
|
|
105
|
+
export type ReactionType = Tables<"tbl_chat_reactions">;
|
|
75
106
|
|
|
76
|
-
export type NotificationType = Tables<
|
|
107
|
+
export type NotificationType = Tables<"tbl_chat_notifications">;
|
|
77
108
|
|
|
78
109
|
export type ChatAccessType = Merge<
|
|
79
|
-
Partial<Tables<
|
|
80
|
-
Tables<
|
|
110
|
+
Partial<Tables<"tbl_chat_access">>,
|
|
111
|
+
Tables<"tbl_org_members">
|
|
81
112
|
>;
|
|
82
113
|
|
|
83
114
|
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
84
115
|
|
|
85
116
|
export const labelColors = [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
117
|
+
"#9333EA",
|
|
118
|
+
"#0D9488",
|
|
119
|
+
"#DB2777",
|
|
120
|
+
"#2563EB",
|
|
121
|
+
"#F97316",
|
|
91
122
|
];
|
|
92
123
|
|
|
93
124
|
export const enumChatColors = [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
125
|
+
"#B4876E",
|
|
126
|
+
"#A5B337",
|
|
127
|
+
"#06CF9C",
|
|
128
|
+
"#25D366",
|
|
129
|
+
"#02A698",
|
|
130
|
+
"#7D9EF1",
|
|
131
|
+
"#007BFC",
|
|
132
|
+
"#5E47DE",
|
|
133
|
+
"#7F66FF",
|
|
134
|
+
"#9333EA",
|
|
135
|
+
"#FA6533",
|
|
136
|
+
"#C4532D",
|
|
137
|
+
"#DC2626",
|
|
138
|
+
"#FF2E74",
|
|
139
|
+
"#DB2777",
|
|
109
140
|
] as const;
|
|
110
141
|
|
|
111
142
|
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
112
143
|
|
|
113
144
|
export const SUPPORTED_TYPES = [
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
145
|
+
"chat",
|
|
146
|
+
"sticker",
|
|
147
|
+
"image",
|
|
148
|
+
"video",
|
|
149
|
+
"document",
|
|
150
|
+
"vcard",
|
|
151
|
+
"multi_vcard",
|
|
152
|
+
"audio",
|
|
153
|
+
"ptt",
|
|
154
|
+
"poll_creation",
|
|
124
155
|
] as const;
|
|
125
156
|
|
|
126
157
|
export type SendMessageContent = {
|
|
127
|
-
message_type?: typeof SUPPORTED_TYPES[number];
|
|
158
|
+
message_type?: (typeof SUPPORTED_TYPES)[number];
|
|
128
159
|
body?: string;
|
|
129
160
|
media?: MediaType;
|
|
130
161
|
contact_ids?: string[];
|
|
131
162
|
location?: Location;
|
|
132
163
|
quoted_message_id?: string;
|
|
133
|
-
quoted_message_type?:
|
|
164
|
+
quoted_message_type?: "reply" | "forward" | "reply_private";
|
|
134
165
|
broadcast_id?: string;
|
|
135
166
|
performed_by?: string;
|
|
136
167
|
variables?: Record<string, VariableType>;
|
|
@@ -151,7 +182,7 @@ export type SingleMessagePayload = SendMessageContent & {
|
|
|
151
182
|
export type AttachmentTypeProps = {
|
|
152
183
|
result: string;
|
|
153
184
|
file: File | null;
|
|
154
|
-
type:
|
|
185
|
+
type: "image" | "audio" | "document" | "video";
|
|
155
186
|
};
|
|
156
187
|
|
|
157
188
|
/* -------------------------------- BROADCAST ------------------------------- */
|
|
@@ -167,7 +198,7 @@ export type LogsType = {
|
|
|
167
198
|
member_count: number | null;
|
|
168
199
|
};
|
|
169
200
|
|
|
170
|
-
export type BroadcastLogType = Tables<
|
|
201
|
+
export type BroadcastLogType = Tables<"view_broadcast_logs"> & {
|
|
171
202
|
logs: (LogsType & ChatType)[];
|
|
172
203
|
};
|
|
173
204
|
|
|
@@ -175,9 +206,29 @@ export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
|
|
|
175
206
|
|
|
176
207
|
export type ChatParticipantOperation = {
|
|
177
208
|
participant_ids: string[];
|
|
178
|
-
operation_type:
|
|
209
|
+
operation_type: "ADD" | "REMOVE" | "PROMOTE" | "DEMOTE";
|
|
179
210
|
};
|
|
180
211
|
|
|
181
212
|
export type ChatParticipantOperationPayload = ChatParticipantOperation & {
|
|
182
213
|
chat_ids: string[];
|
|
183
|
-
};
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/* ----------------------- BILLING - STRIPE ----------------------- */
|
|
217
|
+
|
|
218
|
+
export type StripeSubscription = _Stripe.Subscription;
|
|
219
|
+
export type StripeCustomer = _Stripe.Customer;
|
|
220
|
+
export type StripeCoupon = _Stripe.Coupon;
|
|
221
|
+
export type StripePrice = _Stripe.Price;
|
|
222
|
+
|
|
223
|
+
/* -------------------------------- REALTIME -------------------------------- */
|
|
224
|
+
|
|
225
|
+
export type PhoneRealtimeChannel = {
|
|
226
|
+
loading: boolean;
|
|
227
|
+
state: string;
|
|
228
|
+
ready: boolean;
|
|
229
|
+
sync: boolean;
|
|
230
|
+
percent: number | null;
|
|
231
|
+
message?: string;
|
|
232
|
+
error?: string;
|
|
233
|
+
presence_ref?: string;
|
|
234
|
+
}
|