-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathconstants.js
105 lines (88 loc) · 2.88 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
* @type {{ ADMIN: "ADMIN"; USER: "USER"} as const}
*/
export const UserRolesEnum = {
ADMIN: "ADMIN",
USER: "USER",
};
export const AvailableUserRoles = Object.values(UserRolesEnum);
/**
* @type {{ PENDING: "PENDING"; CANCELLED: "CANCELLED"; DELIVERED: "DELIVERED" } as const}
*/
export const OrderStatusEnum = {
PENDING: "PENDING",
CANCELLED: "CANCELLED",
DELIVERED: "DELIVERED",
};
export const AvailableOrderStatuses = Object.values(OrderStatusEnum);
/**
* @type {{ UNKNOWN:"UNKNOWN"; RAZORPAY: "RAZORPAY"; PAYPAL: "PAYPAL"; } as const}
*/
export const PaymentProviderEnum = {
UNKNOWN: "UNKNOWN",
RAZORPAY: "RAZORPAY",
PAYPAL: "PAYPAL",
};
export const AvailablePaymentProviders = Object.values(PaymentProviderEnum);
/**
* @type {{ FLAT:"FLAT"; } as const}
*/
export const CouponTypeEnum = {
FLAT: "FLAT",
// PERCENTAGE: "PERCENTAGE",
};
export const AvailableCouponTypes = Object.values(CouponTypeEnum);
/**
* @type {{ GOOGLE: "GOOGLE"; GITHUB: "GITHUB"; EMAIL_PASSWORD: "EMAIL_PASSWORD"} as const}
*/
export const UserLoginType = {
GOOGLE: "GOOGLE",
GITHUB: "GITHUB",
EMAIL_PASSWORD: "EMAIL_PASSWORD",
};
export const AvailableSocialLogins = Object.values(UserLoginType);
/**
* @type {{ MOST_VIEWED: "mostViewed"; MOST_LIKED: "mostLiked"; LATEST: "latest"; OLDEST: "oldest"} as const}
*/
export const YouTubeFilterEnum = {
MOST_VIEWED: "mostViewed",
MOST_LIKED: "mostLiked",
LATEST: "latest",
OLDEST: "oldest",
};
export const AvailableYouTubeFilters = Object.values(YouTubeFilterEnum);
export const USER_TEMPORARY_TOKEN_EXPIRY = 20 * 60 * 1000; // 20 minutes
export const MAXIMUM_SUB_IMAGE_COUNT = 4;
export const MAXIMUM_SOCIAL_POST_IMAGE_COUNT = 6;
export const DB_NAME = "freeapi";
export const paypalBaseUrl = {
sandbox: "https://api-m.sandbox.paypal.com",
};
/**
* @description set of events that we are using in chat app. more to be added as we develop the chat app
*/
export const ChatEventEnum = Object.freeze({
// ? once user is ready to go
CONNECTED_EVENT: "connected",
// ? when user gets disconnected
DISCONNECT_EVENT: "disconnect",
// ? when user joins a socket room
JOIN_CHAT_EVENT: "joinChat",
// ? when participant gets removed from group, chat gets deleted or leaves a group
LEAVE_CHAT_EVENT: "leaveChat",
// ? when admin updates a group name
UPDATE_GROUP_NAME_EVENT: "updateGroupName",
// ? when new message is received
MESSAGE_RECEIVED_EVENT: "messageReceived",
// ? when there is new one on one chat, new group chat or user gets added in the group
NEW_CHAT_EVENT: "newChat",
// ? when there is an error in socket
SOCKET_ERROR_EVENT: "socketError",
// ? when participant stops typing
STOP_TYPING_EVENT: "stopTyping",
// ? when participant starts typing
TYPING_EVENT: "typing",
// ? when message is deleted
MESSAGE_DELETE_EVENT: "messageDeleted",
});
export const AvailableChatEvents = Object.values(ChatEventEnum);