@zenify-omni/chat-js 0.1.0
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/LICENSE +21 -0
- package/README.md +28 -0
- package/api/campaign.js +19 -0
- package/api/chat.js +518 -0
- package/api/chatroom.js +254 -0
- package/api/contact.js +45 -0
- package/api/crm-organization.js +101 -0
- package/api/customer.js +143 -0
- package/api/facebook-labels.js +11 -0
- package/api/field.js +11 -0
- package/api/file.js +17 -0
- package/api/filter.js +50 -0
- package/api/group.js +11 -0
- package/api/iam.js +23 -0
- package/api/index.js +54 -0
- package/api/orgTree.js +45 -0
- package/api/post.js +111 -0
- package/api/queue.js +15 -0
- package/api/report.js +422 -0
- package/api/send.js +21 -0
- package/api/session-event.js +30 -0
- package/api/session.js +249 -0
- package/api/settings/assign-task.js +10 -0
- package/api/settings/channel.js +136 -0
- package/api/settings/chat-layout.js +37 -0
- package/api/settings/chat-timeout.js +10 -0
- package/api/settings/common.js +32 -0
- package/api/settings/config.js +19 -0
- package/api/settings/index.js +24 -0
- package/api/settings/ivr.js +25 -0
- package/api/settings/queue-v3.js +56 -0
- package/api/settings/queue.js +48 -0
- package/api/settings/routing.js +32 -0
- package/api/settings/service.js +31 -0
- package/api/settings.js +567 -0
- package/api/shipping.js +19 -0
- package/api/shopee.js +21 -0
- package/api/smart-qc/index.js +4 -0
- package/api/smart-qc/keyword.js +10 -0
- package/api/tag.js +11 -0
- package/api/user.js +177 -0
- package/client.js +391 -0
- package/config/env.js +76 -0
- package/constants/advance-filter.js +358 -0
- package/constants/auto-assign-tag.js +13 -0
- package/constants/chat-message.js +423 -0
- package/constants/chat-room-tag.js +7 -0
- package/constants/chat-source.js +68 -0
- package/constants/chatbot.js +58 -0
- package/constants/common.js +4 -0
- package/constants/crm-organization.js +75 -0
- package/constants/distribute.js +8 -0
- package/constants/distribution-log.js +14 -0
- package/constants/events.js +27 -0
- package/constants/file-upload.js +86 -0
- package/constants/lead.js +111 -0
- package/constants/mask-data-config.js +16 -0
- package/constants/month.js +78 -0
- package/constants/quick-filter.js +49 -0
- package/constants/regex.js +34 -0
- package/constants/setting.js +62 -0
- package/constants/shipping.js +12 -0
- package/constants/social.js +21 -0
- package/constants/sortable-fields.js +146 -0
- package/constants/tenant_config.js +154 -0
- package/constants/use-query-key.js +470 -0
- package/constants/user.js +293 -0
- package/exceptions/axios-error.js +24 -0
- package/exceptions/https-error.js +28 -0
- package/exceptions/validator-error.js +20 -0
- package/lib/avatar-color.js +31 -0
- package/lib/i18n/index.js +85 -0
- package/lib/i18n/language-store.js +74 -0
- package/lib/i18n/locales/en/campaign.json +3 -0
- package/lib/i18n/locales/en/chat.json +656 -0
- package/lib/i18n/locales/en/common.json +1846 -0
- package/lib/i18n/locales/en/customer.json +20 -0
- package/lib/i18n/locales/en/lead.json +5 -0
- package/lib/i18n/locales/en/lumi.json +4 -0
- package/lib/i18n/locales/en/notification.json +107 -0
- package/lib/i18n/locales/en/org.json +4 -0
- package/lib/i18n/locales/en/posts.json +8 -0
- package/lib/i18n/locales/en/settings.json +39 -0
- package/lib/i18n/locales/vi/campaign.json +3 -0
- package/lib/i18n/locales/vi/chat.json +660 -0
- package/lib/i18n/locales/vi/common.json +1846 -0
- package/lib/i18n/locales/vi/customer.json +20 -0
- package/lib/i18n/locales/vi/lead.json +5 -0
- package/lib/i18n/locales/vi/lumi.json +4 -0
- package/lib/i18n/locales/vi/notification.json +107 -0
- package/lib/i18n/locales/vi/org.json +4 -0
- package/lib/i18n/locales/vi/posts.json +8 -0
- package/lib/i18n/locales/vi/settings.json +39 -0
- package/lib/i18n/server-label.js +33 -0
- package/lib/phone.js +70 -0
- package/lib/user-avatar.js +21 -0
- package/package.json +45 -0
- package/socket/index.js +30 -0
- package/transport-registry.js +77 -0
- package/utils/access-detail.js +119 -0
- package/utils/auth.js +205 -0
- package/utils/chunk-reload-guard.js +4 -0
- package/utils/concurrency-limiter.js +30 -0
- package/utils/crm-organization.js +0 -0
- package/utils/currency.js +14 -0
- package/utils/customers.js +42 -0
- package/utils/data.js +178 -0
- package/utils/date.js +144 -0
- package/utils/debounced-invalidate.js +15 -0
- package/utils/emoticon.js +134 -0
- package/utils/export.js +7 -0
- package/utils/field-layout.js +33 -0
- package/utils/filter-adapters.js +9 -0
- package/utils/filter.js +18 -0
- package/utils/formatters.js +6 -0
- package/utils/image-compression.js +169 -0
- package/utils/leads.js +13 -0
- package/utils/microlink.js +20 -0
- package/utils/org-tree.js +108 -0
- package/utils/request.js +461 -0
- package/utils/session-end.js +19 -0
- package/utils/string.js +154 -0
- package/utils/table-display-config.js +80 -0
- package/utils/validation.js +49 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import i18n from "../lib/i18n/index.js";
|
|
2
|
+
import { nanoid } from "nanoid";
|
|
3
|
+
const ChatMessageKey = Object.freeze({
|
|
4
|
+
NEW_MESSAGE: "newMessage",
|
|
5
|
+
NEW_INTERNAL_MESSAGE: "newMessageInternal",
|
|
6
|
+
ADD_MESSAGE: "addMessage",
|
|
7
|
+
ADD_INTERNAL_MESSAGE: "addMessageInternal",
|
|
8
|
+
REFRESH_CONTACT: "refresh-contact",
|
|
9
|
+
REFRESH_STATUS: "refresh-status",
|
|
10
|
+
CHANGE_PERSONAL_ZALO_TYPE: "change-personal-zalo-type",
|
|
11
|
+
UPDATE_CHATTING: "update-chatting",
|
|
12
|
+
UPDATE_TYPING: "update-typing",
|
|
13
|
+
UPDATE_INTERNAL_CHATTING: "updateChattingInternal",
|
|
14
|
+
INVITE: "invite",
|
|
15
|
+
ASSIGN: "assign",
|
|
16
|
+
FORWARD: "forward",
|
|
17
|
+
JOIN: "join",
|
|
18
|
+
LEAVE: "leave",
|
|
19
|
+
JOIN_INTERNAL: "internal_join",
|
|
20
|
+
JOIN_FB_WEBHOOK: "joinFbWebhook",
|
|
21
|
+
REQUEST_CONTACT_CHAT: "contact-request-chat",
|
|
22
|
+
MONITOR: "monitor",
|
|
23
|
+
UPDATE_MONITOR: "update-monitor",
|
|
24
|
+
UPDATE_WEBHOOK: "update-web-hook",
|
|
25
|
+
ZALO_FRIEND_EVENT: "zalo-friend-event",
|
|
26
|
+
DISTRIBUTE_CHAT: "distribute-chat",
|
|
27
|
+
REMOVE_USER_FROM_CHAT: "remove-user-from-chat",
|
|
28
|
+
HIDE_CHAT_ROOM: "hide-chat-room",
|
|
29
|
+
UNHIDE_CHAT_ROOM: "unhide-chat-room",
|
|
30
|
+
UNHANDLED_CHANGED: "unhandled-changed",
|
|
31
|
+
AI_CLASSIFICATION: "ai:classification",
|
|
32
|
+
AI_REPLY: "ai:reply",
|
|
33
|
+
AI_SUMMARY: "ai:summary",
|
|
34
|
+
AI_TRANSLATE: "ai:translate",
|
|
35
|
+
AI_CSAT: "ai:csat",
|
|
36
|
+
MESSAGE_VIEWED: "message-viewed",
|
|
37
|
+
MARK_MESSAGE_VIEWED: "mark-message-viewed",
|
|
38
|
+
ROOM_READ_UPDATED: "room_read_updated",
|
|
39
|
+
MESSAGE_READ: "message_read"
|
|
40
|
+
});
|
|
41
|
+
const InviteStatus = Object.freeze({
|
|
42
|
+
INVITE: "invite",
|
|
43
|
+
ACCEPT: "accepted",
|
|
44
|
+
REJECT: "reject"
|
|
45
|
+
});
|
|
46
|
+
const MessageType = Object.freeze({
|
|
47
|
+
FALLBACK: "fallback",
|
|
48
|
+
REACTION: "reaction",
|
|
49
|
+
PIN: "pin_message",
|
|
50
|
+
UN_PIN: "unpin_message",
|
|
51
|
+
COUPON: "coupon",
|
|
52
|
+
IMAGES: "images",
|
|
53
|
+
LINK: "link",
|
|
54
|
+
TEXT: "text",
|
|
55
|
+
IMAGE: "image",
|
|
56
|
+
FILE: "file",
|
|
57
|
+
AUDIO: "audio",
|
|
58
|
+
VIDEO: "video",
|
|
59
|
+
STICKER: "sticker",
|
|
60
|
+
PRODUCT: "product",
|
|
61
|
+
ACTION_END: "action-end",
|
|
62
|
+
ACTION_LEAVE: "action-leave",
|
|
63
|
+
ACTION_RECEIVE: "action-receive",
|
|
64
|
+
ACTION_REDISTRIBUTE: "action-redistribute",
|
|
65
|
+
ACTION_JOIN: "action-join",
|
|
66
|
+
ACTION_OPT_IN: "action-opt-in",
|
|
67
|
+
ACTION_STARTED: "action-started",
|
|
68
|
+
ZALO_CALL: "zalo_call",
|
|
69
|
+
UNSUPPORTED: "unsupported",
|
|
70
|
+
ZALO_ACCEPT_FRIEND: "zalo_accept_friend",
|
|
71
|
+
CREATE_REMINDER: "created_reminder",
|
|
72
|
+
UPDATE_REMINDER: "updated_reminder",
|
|
73
|
+
DELETE_REMINDER: "deleted_reminder",
|
|
74
|
+
REMINDER_RECEIVE: "remind",
|
|
75
|
+
ZALO_CREATE_GROUP: "create_group",
|
|
76
|
+
CONTACT_CARD: "contact_card",
|
|
77
|
+
FRIEND_REQUEST: "friend_request",
|
|
78
|
+
CHAT_SIGNAL: "chat-signal",
|
|
79
|
+
ACTION_REOPEN: "action-reopen",
|
|
80
|
+
ACTION_TIKTOK_END_SESSION: "action-tiktok-end-session",
|
|
81
|
+
UTILITY_MESSAGES: "utility-messages",
|
|
82
|
+
ACTION_COMMENT_FB: "action_comment_fb",
|
|
83
|
+
LOCATION: "location",
|
|
84
|
+
ORDER: "order",
|
|
85
|
+
REEL: "reel",
|
|
86
|
+
SHARE_POST: "share_post",
|
|
87
|
+
SHARE_EVENT: "share_event",
|
|
88
|
+
SHARE_PAGE: "share_page",
|
|
89
|
+
SHARE_GROUP: "share_group",
|
|
90
|
+
APPOINTMENT_BOOKING: "appointment_booking",
|
|
91
|
+
POLL_CREATION: "poll_creation",
|
|
92
|
+
GENERIC_TEMPLATE: "generic-template",
|
|
93
|
+
BUTTON_TEMPLATE: "button-template",
|
|
94
|
+
MEDIA_TEMPLATE: "media-template",
|
|
95
|
+
PRODUCT_TEMPLATE: "product-template",
|
|
96
|
+
IMAGE_GRID_TEMPLATE: "image-grid-template",
|
|
97
|
+
RECEIPT_TEMPLATE: "receipt-template",
|
|
98
|
+
TEMPLATE: "template"
|
|
99
|
+
});
|
|
100
|
+
const MessageTypeContext = Object.freeze({
|
|
101
|
+
get [MessageType.TEXT]() {
|
|
102
|
+
return i18n.t("common:label.textMessage", {
|
|
103
|
+
defaultValue: "Tin nh\u1EAFn v\u0103n b\u1EA3n"
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
get [MessageType.IMAGE]() {
|
|
107
|
+
return i18n.t("common:label.imageMessage", {
|
|
108
|
+
defaultValue: "Tin nh\u1EAFn \u1EA3nh"
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
get [MessageType.FILE]() {
|
|
112
|
+
return i18n.t("common:label.attachmentMessage", {
|
|
113
|
+
defaultValue: "Tin nh\u1EAFn t\u1EC7p \u0111\xEDnh k\xE8m"
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
get [MessageType.LOCATION]() {
|
|
117
|
+
return i18n.t("common:label.locationMessage", {
|
|
118
|
+
defaultValue: "Tin nh\u1EAFn v\u1ECB tr\xED"
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
get [MessageType.ACTION_END]() {
|
|
122
|
+
return i18n.t("common:label.closeThisConversationFragment", {
|
|
123
|
+
defaultValue: "\u0111\xF3ng h\u1ED9i tho\u1EA1i n\xE0y"
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
get [MessageType.ACTION_LEAVE]() {
|
|
127
|
+
return i18n.t("common:message.leaveConversation", {
|
|
128
|
+
defaultValue: "r\u1EDDi cu\u1ED9c h\u1ED9i tho\u1EA1i"
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
get [MessageType.ACTION_RECEIVE]() {
|
|
132
|
+
return i18n.t("common:message.acceptConversation", {
|
|
133
|
+
defaultValue: "ti\u1EBFp nh\u1EADn cu\u1ED9c h\u1ED9i tho\u1EA1i"
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
get [MessageType.ACTION_JOIN]() {
|
|
137
|
+
return i18n.t("common:message.joinConversation", {
|
|
138
|
+
defaultValue: "tham gia cu\u1ED9c h\u1ED9i tho\u1EA1i"
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
get [MessageType.ACTION_OPT_IN]() {
|
|
142
|
+
return i18n.t("common:message.optInMessage", {
|
|
143
|
+
defaultValue: "\u0111\u1ED3ng \xFD nh\u1EADn tin nh\u1EAFn"
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
get [MessageType.ACTION_STARTED]() {
|
|
147
|
+
return i18n.t("common:label.startConversationFragment", {
|
|
148
|
+
defaultValue: "b\u1EAFt \u0111\u1EA7u cu\u1ED9c h\u1ED9i tho\u1EA1i"
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
get [MessageType.ACTION_REOPEN]() {
|
|
152
|
+
return i18n.t("common:message.reopenConversation", {
|
|
153
|
+
defaultValue: "m\u1EDF l\u1EA1i cu\u1ED9c h\u1ED9i tho\u1EA1i"
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
const ActionMessageTypes = [
|
|
158
|
+
MessageType.ACTION_END,
|
|
159
|
+
MessageType.ACTION_LEAVE,
|
|
160
|
+
MessageType.ACTION_RECEIVE,
|
|
161
|
+
MessageType.ACTION_REDISTRIBUTE,
|
|
162
|
+
MessageType.ACTION_JOIN,
|
|
163
|
+
MessageType.ACTION_OPT_IN,
|
|
164
|
+
MessageType.ACTION_STARTED,
|
|
165
|
+
MessageType.ZALO_ACCEPT_FRIEND,
|
|
166
|
+
MessageType.DELETE_REMINDER,
|
|
167
|
+
MessageType.REMINDER_RECEIVE,
|
|
168
|
+
MessageType.ZALO_CREATE_GROUP,
|
|
169
|
+
MessageType.CHAT_SIGNAL,
|
|
170
|
+
MessageType.ACTION_REOPEN,
|
|
171
|
+
MessageType.ACTION_COMMENT_FB,
|
|
172
|
+
MessageType.PIN,
|
|
173
|
+
MessageType.UN_PIN,
|
|
174
|
+
MessageType.ACTION_TIKTOK_END_SESSION
|
|
175
|
+
];
|
|
176
|
+
const AgentReplyMessageTypes = [
|
|
177
|
+
MessageType.IMAGES,
|
|
178
|
+
MessageType.LINK,
|
|
179
|
+
MessageType.TEXT,
|
|
180
|
+
MessageType.IMAGE,
|
|
181
|
+
MessageType.FILE,
|
|
182
|
+
MessageType.AUDIO,
|
|
183
|
+
MessageType.VIDEO,
|
|
184
|
+
MessageType.STICKER,
|
|
185
|
+
MessageType.CONTACT_CARD,
|
|
186
|
+
MessageType.UTILITY_MESSAGES,
|
|
187
|
+
MessageType.LOCATION,
|
|
188
|
+
MessageType.ZALO_CALL
|
|
189
|
+
];
|
|
190
|
+
const ContentfulMessageTypes = [
|
|
191
|
+
MessageType.FALLBACK,
|
|
192
|
+
MessageType.IMAGES,
|
|
193
|
+
MessageType.LINK,
|
|
194
|
+
MessageType.TEXT,
|
|
195
|
+
MessageType.IMAGE,
|
|
196
|
+
MessageType.FILE,
|
|
197
|
+
MessageType.AUDIO,
|
|
198
|
+
MessageType.VIDEO,
|
|
199
|
+
MessageType.STICKER,
|
|
200
|
+
MessageType.PRODUCT,
|
|
201
|
+
MessageType.UNSUPPORTED,
|
|
202
|
+
MessageType.CREATE_REMINDER,
|
|
203
|
+
MessageType.UPDATE_REMINDER,
|
|
204
|
+
MessageType.CONTACT_CARD,
|
|
205
|
+
MessageType.FRIEND_REQUEST,
|
|
206
|
+
MessageType.UTILITY_MESSAGES,
|
|
207
|
+
MessageType.ACTION_COMMENT_FB,
|
|
208
|
+
MessageType.LOCATION,
|
|
209
|
+
MessageType.ZALO_CALL,
|
|
210
|
+
MessageType.ORDER,
|
|
211
|
+
MessageType.COUPON,
|
|
212
|
+
MessageType.REEL,
|
|
213
|
+
MessageType.SHARE_POST,
|
|
214
|
+
MessageType.SHARE_EVENT,
|
|
215
|
+
MessageType.SHARE_PAGE,
|
|
216
|
+
MessageType.SHARE_GROUP,
|
|
217
|
+
MessageType.APPOINTMENT_BOOKING,
|
|
218
|
+
MessageType.POLL_CREATION,
|
|
219
|
+
MessageType.GENERIC_TEMPLATE,
|
|
220
|
+
MessageType.BUTTON_TEMPLATE,
|
|
221
|
+
MessageType.MEDIA_TEMPLATE,
|
|
222
|
+
MessageType.PRODUCT_TEMPLATE,
|
|
223
|
+
MessageType.IMAGE_GRID_TEMPLATE,
|
|
224
|
+
MessageType.RECEIPT_TEMPLATE,
|
|
225
|
+
MessageType.TEMPLATE
|
|
226
|
+
];
|
|
227
|
+
const ReminderMessageTypes = [
|
|
228
|
+
MessageType.CREATE_REMINDER,
|
|
229
|
+
MessageType.UPDATE_REMINDER,
|
|
230
|
+
MessageType.DELETE_REMINDER,
|
|
231
|
+
MessageType.REMINDER_RECEIVE
|
|
232
|
+
];
|
|
233
|
+
const PinMessageTypes = [MessageType.PIN, MessageType.UN_PIN];
|
|
234
|
+
const ChatFilterSource = Object.freeze({
|
|
235
|
+
All: "all",
|
|
236
|
+
Chat: "chat",
|
|
237
|
+
Facebook: "facebook",
|
|
238
|
+
Instagram: "instagram",
|
|
239
|
+
Zalo: "zalo",
|
|
240
|
+
ZaloPersonal: "pzalo",
|
|
241
|
+
Whatsapp: "whatsapp",
|
|
242
|
+
Tiktok: "tiktok",
|
|
243
|
+
Shopee: "shopee",
|
|
244
|
+
TiktokShop: "tiktok_shop"
|
|
245
|
+
});
|
|
246
|
+
const ChatFilterSourceLabel = Object.freeze({
|
|
247
|
+
get [ChatFilterSource.All]() {
|
|
248
|
+
return i18n.t("common:filter.all", {
|
|
249
|
+
defaultValue: "T\u1EA5t c\u1EA3"
|
|
250
|
+
});
|
|
251
|
+
},
|
|
252
|
+
[ChatFilterSource.Chat]: "LiveChat",
|
|
253
|
+
[ChatFilterSource.Facebook]: "Facebook",
|
|
254
|
+
[ChatFilterSource.Instagram]: "Instagram",
|
|
255
|
+
[ChatFilterSource.Zalo]: "Zalo OA",
|
|
256
|
+
get [ChatFilterSource.ZaloPersonal]() {
|
|
257
|
+
return i18n.t("common:label.zaloPersonal", {
|
|
258
|
+
defaultValue: "Zalo C\xE1 nh\xE2n"
|
|
259
|
+
});
|
|
260
|
+
},
|
|
261
|
+
[ChatFilterSource.Whatsapp]: "WhatsApp",
|
|
262
|
+
[ChatFilterSource.Tiktok]: "TikTok Business",
|
|
263
|
+
[ChatFilterSource.Shopee]: "Shopee",
|
|
264
|
+
[ChatFilterSource.TiktokShop]: "TikTok Shop"
|
|
265
|
+
});
|
|
266
|
+
const ChatFilterSourceOptions = [
|
|
267
|
+
{
|
|
268
|
+
value: ChatFilterSource.All,
|
|
269
|
+
label: ChatFilterSourceLabel[ChatFilterSource.All]
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
value: ChatFilterSource.Chat,
|
|
273
|
+
label: ChatFilterSourceLabel[ChatFilterSource.Chat]
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
value: ChatFilterSource.Facebook,
|
|
277
|
+
label: ChatFilterSourceLabel[ChatFilterSource.Facebook]
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
value: ChatFilterSource.Instagram,
|
|
281
|
+
label: ChatFilterSourceLabel[ChatFilterSource.Instagram]
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
value: ChatFilterSource.Zalo,
|
|
285
|
+
label: ChatFilterSourceLabel[ChatFilterSource.Zalo]
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
value: ChatFilterSource.ZaloPersonal,
|
|
289
|
+
label: ChatFilterSourceLabel[ChatFilterSource.ZaloPersonal]
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
value: ChatFilterSource.Whatsapp,
|
|
293
|
+
label: ChatFilterSourceLabel[ChatFilterSource.Whatsapp]
|
|
294
|
+
},
|
|
295
|
+
{ value: ChatFilterSource.Tiktok, label: "TikTok Business" },
|
|
296
|
+
{ value: ChatFilterSource.TiktokShop, label: "TikTok Shop" },
|
|
297
|
+
{
|
|
298
|
+
value: ChatFilterSource.Shopee,
|
|
299
|
+
label: ChatFilterSourceLabel[ChatFilterSource.Shopee]
|
|
300
|
+
}
|
|
301
|
+
];
|
|
302
|
+
const ChatFilterReadStatus = Object.freeze({
|
|
303
|
+
Read: "seen",
|
|
304
|
+
Unread: "unseen",
|
|
305
|
+
Miss: "missed"
|
|
306
|
+
});
|
|
307
|
+
const ChatFilterStatusOptions = [
|
|
308
|
+
{
|
|
309
|
+
value: ChatFilterReadStatus.Read,
|
|
310
|
+
get label() {
|
|
311
|
+
return i18n.t("common:status.seen", { defaultValue: "\u0110\xE3 xem" });
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
value: ChatFilterReadStatus.Unread,
|
|
316
|
+
get label() {
|
|
317
|
+
return i18n.t("common:status.unseen", { defaultValue: "Ch\u01B0a xem" });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
];
|
|
321
|
+
const ChatFilterAssignStatus = Object.freeze({
|
|
322
|
+
Received: "processing",
|
|
323
|
+
NotReceived: "pending",
|
|
324
|
+
Closed: "closed"
|
|
325
|
+
});
|
|
326
|
+
const ChatSortValue = Object.freeze({
|
|
327
|
+
LastMessageDesc: "-last_msg.time",
|
|
328
|
+
CreatedAsc: "created_at",
|
|
329
|
+
CreatedDesc: "-created_at",
|
|
330
|
+
UnansweredFirst: "unanswered_first"
|
|
331
|
+
});
|
|
332
|
+
const CHAT_SORT_VALUES = Object.values(ChatSortValue);
|
|
333
|
+
const DEFAULT_CHAT_SORT = ChatSortValue.LastMessageDesc;
|
|
334
|
+
const ChatSource = Object.freeze({
|
|
335
|
+
Socket: "socket",
|
|
336
|
+
API: "api"
|
|
337
|
+
});
|
|
338
|
+
const ChatMessageStatus = Object.freeze({
|
|
339
|
+
SUCCESS: "success",
|
|
340
|
+
FAILED: "failed"
|
|
341
|
+
});
|
|
342
|
+
const buildChatMessage = ({
|
|
343
|
+
id,
|
|
344
|
+
roomId,
|
|
345
|
+
tenantId,
|
|
346
|
+
source,
|
|
347
|
+
chatterId,
|
|
348
|
+
chatterName,
|
|
349
|
+
chatterType = "agent",
|
|
350
|
+
type,
|
|
351
|
+
status = ChatMessageStatus.SUCCESS,
|
|
352
|
+
createdAt,
|
|
353
|
+
updatedAt,
|
|
354
|
+
content
|
|
355
|
+
}) => ({
|
|
356
|
+
_id: id || nanoid(),
|
|
357
|
+
room_id: roomId,
|
|
358
|
+
tenant_id: tenantId,
|
|
359
|
+
source,
|
|
360
|
+
chatter_id: chatterId,
|
|
361
|
+
chatter_name: chatterName,
|
|
362
|
+
chatter_type: chatterType,
|
|
363
|
+
type,
|
|
364
|
+
status,
|
|
365
|
+
created_at: createdAt,
|
|
366
|
+
updated_at: updatedAt,
|
|
367
|
+
content
|
|
368
|
+
});
|
|
369
|
+
const buildActionReceiveMessage = ({
|
|
370
|
+
roomId,
|
|
371
|
+
source,
|
|
372
|
+
user,
|
|
373
|
+
tenantId,
|
|
374
|
+
id,
|
|
375
|
+
createdAt
|
|
376
|
+
}) => {
|
|
377
|
+
const name = user?.name || "Agent";
|
|
378
|
+
const timestamp = createdAt || (/* @__PURE__ */ new Date()).toISOString();
|
|
379
|
+
return buildChatMessage({
|
|
380
|
+
id,
|
|
381
|
+
roomId,
|
|
382
|
+
tenantId,
|
|
383
|
+
source: source || ChatFilterSource.Chat,
|
|
384
|
+
chatterId: user?._id,
|
|
385
|
+
chatterName: name,
|
|
386
|
+
chatterType: "agent",
|
|
387
|
+
type: MessageType.ACTION_RECEIVE,
|
|
388
|
+
status: ChatMessageStatus.SUCCESS,
|
|
389
|
+
createdAt: timestamp,
|
|
390
|
+
updatedAt: timestamp,
|
|
391
|
+
content: {
|
|
392
|
+
text: i18n.t("common:message.conversationAcceptedBy", {
|
|
393
|
+
name,
|
|
394
|
+
defaultValue: "{name} \u0111\xE3 ti\u1EBFp nh\u1EADn cu\u1ED9c h\u1ED9i tho\u1EA1i."
|
|
395
|
+
}),
|
|
396
|
+
type: MessageType.ACTION_RECEIVE
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
};
|
|
400
|
+
export {
|
|
401
|
+
ActionMessageTypes,
|
|
402
|
+
AgentReplyMessageTypes,
|
|
403
|
+
CHAT_SORT_VALUES,
|
|
404
|
+
ChatFilterAssignStatus,
|
|
405
|
+
ChatFilterReadStatus,
|
|
406
|
+
ChatFilterSource,
|
|
407
|
+
ChatFilterSourceLabel,
|
|
408
|
+
ChatFilterSourceOptions,
|
|
409
|
+
ChatFilterStatusOptions,
|
|
410
|
+
ChatMessageKey,
|
|
411
|
+
ChatMessageStatus,
|
|
412
|
+
ChatSortValue,
|
|
413
|
+
ChatSource,
|
|
414
|
+
ContentfulMessageTypes,
|
|
415
|
+
DEFAULT_CHAT_SORT,
|
|
416
|
+
InviteStatus,
|
|
417
|
+
MessageType,
|
|
418
|
+
MessageTypeContext,
|
|
419
|
+
PinMessageTypes,
|
|
420
|
+
ReminderMessageTypes,
|
|
421
|
+
buildActionReceiveMessage,
|
|
422
|
+
buildChatMessage
|
|
423
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import i18n from "../lib/i18n/index.js";
|
|
2
|
+
const SourceDetailTicket = Object.freeze({
|
|
3
|
+
WEB: "web",
|
|
4
|
+
API: "api",
|
|
5
|
+
CALL_IN: "CALL_INBOUND",
|
|
6
|
+
CALL_OUT: "CALL_OUTBOUND",
|
|
7
|
+
CALL_INTERNAL: "CALL_INTERNAL",
|
|
8
|
+
CHAT: "chat",
|
|
9
|
+
ZALO: "zalo",
|
|
10
|
+
PZALO: "pzalo",
|
|
11
|
+
FACEBOOK: "facebook",
|
|
12
|
+
EMAIL: "email",
|
|
13
|
+
SMS: "sms",
|
|
14
|
+
HAND: "hand",
|
|
15
|
+
IMPORT: "import",
|
|
16
|
+
WHATSAPP: "whatsapp",
|
|
17
|
+
TIKTOK: "tiktok",
|
|
18
|
+
TIKTOK_SHOP: "tiktok_shop",
|
|
19
|
+
AUTOMATION: "workflow",
|
|
20
|
+
SHOPEE: "shopee",
|
|
21
|
+
INSTAGRAM: "instagram"
|
|
22
|
+
});
|
|
23
|
+
const SourceDetailTicketContext = Object.freeze({
|
|
24
|
+
[SourceDetailTicket.WEB]: "LiveChat",
|
|
25
|
+
[SourceDetailTicket.CHAT]: "LiveChat",
|
|
26
|
+
get [SourceDetailTicket.API]() {
|
|
27
|
+
return i18n.t("common:label.fromCrm", {
|
|
28
|
+
defaultValue: "T\u1EEB CRM"
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
[SourceDetailTicket.EMAIL]: "Email",
|
|
32
|
+
[SourceDetailTicket.FACEBOOK]: "Facebook",
|
|
33
|
+
[SourceDetailTicket.ZALO]: "Zalo",
|
|
34
|
+
[SourceDetailTicket.SMS]: "SMS",
|
|
35
|
+
get [SourceDetailTicket.HAND]() {
|
|
36
|
+
return i18n.t("common:label.manual", {
|
|
37
|
+
defaultValue: "Th\u1EE7 c\xF4ng"
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
[SourceDetailTicket.PZALO]: "Zalo",
|
|
41
|
+
[SourceDetailTicket.TIKTOK]: "TikTok Business",
|
|
42
|
+
[SourceDetailTicket.TIKTOK_SHOP]: "TikTok Shop",
|
|
43
|
+
get [SourceDetailTicket.CALL_IN]() {
|
|
44
|
+
return i18n.t("common:label.inboundCall", {
|
|
45
|
+
defaultValue: "Cu\u1ED9c g\u1ECDi v\xE0o"
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
get [SourceDetailTicket.CALL_OUT]() {
|
|
49
|
+
return i18n.t("common:label.outboundCall", {
|
|
50
|
+
defaultValue: "Cu\u1ED9c g\u1ECDi ra"
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
get [SourceDetailTicket.CALL_INTERNAL]() {
|
|
54
|
+
return i18n.t("common:label.internalCall", {
|
|
55
|
+
defaultValue: "Cu\u1ED9c g\u1ECDi n\u1ED9i b\u1ED9"
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
[SourceDetailTicket.IMPORT]: "Import file",
|
|
59
|
+
[SourceDetailTicket.WHATSAPP]: "WhatsApp",
|
|
60
|
+
[SourceDetailTicket.TIKTOK_ADS]: "TikTok Ads",
|
|
61
|
+
[SourceDetailTicket.AUTOMATION]: "Automation",
|
|
62
|
+
[SourceDetailTicket.SHOPEE]: "Shopee",
|
|
63
|
+
[SourceDetailTicket.INSTAGRAM]: "Instagram"
|
|
64
|
+
});
|
|
65
|
+
export {
|
|
66
|
+
SourceDetailTicket,
|
|
67
|
+
SourceDetailTicketContext
|
|
68
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import i18n from "../lib/i18n/index.js";
|
|
2
|
+
const ChatbotStatus = {
|
|
3
|
+
ACTIVE: {
|
|
4
|
+
key: "active",
|
|
5
|
+
get label() {
|
|
6
|
+
return i18n.t("common:status.active", { defaultValue: "Ho\u1EA1t \u0111\u1ED9ng" });
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
INACTIVE: {
|
|
10
|
+
key: "inactive",
|
|
11
|
+
get label() {
|
|
12
|
+
return i18n.t("common:action.pause", { defaultValue: "T\u1EA1m d\u1EEBng" });
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
DRAFT: {
|
|
16
|
+
key: "draft",
|
|
17
|
+
get label() {
|
|
18
|
+
return i18n.t("common:status.draft", { defaultValue: "Nh\xE1p" });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const LUMI_LEARN_FROM_CHAT_SOCKET_EVENT = "lumi:agent_init";
|
|
23
|
+
const LumiSocketType = Object.freeze({
|
|
24
|
+
ANALYSIS_RESULT: "analysis_result",
|
|
25
|
+
PROCESS_PROGRESS: "process_progress",
|
|
26
|
+
PROCESS_COMPLETED: "process_completed",
|
|
27
|
+
PROCESS_FAILED: "process_failed"
|
|
28
|
+
});
|
|
29
|
+
const ENTITY_EXTRACT_SOCKET_EVENT = "entity_extract";
|
|
30
|
+
const EntityExtractSocketType = Object.freeze({
|
|
31
|
+
PROGRESS: "progress",
|
|
32
|
+
COMPLETED: "completed",
|
|
33
|
+
FAILED: "failed"
|
|
34
|
+
});
|
|
35
|
+
const KNOWLEDGE_CRAWL_SOCKET_EVENT = "knowledge:crawl";
|
|
36
|
+
const KnowledgeCrawlSocketType = Object.freeze({
|
|
37
|
+
PROGRESS: "progress",
|
|
38
|
+
COMPLETED: "completed",
|
|
39
|
+
FAILED: "failed"
|
|
40
|
+
});
|
|
41
|
+
const KnowledgeCrawlPhase = Object.freeze({
|
|
42
|
+
QUEUED: "queued",
|
|
43
|
+
CRAWLING: "crawling",
|
|
44
|
+
COLLECTING: "collecting",
|
|
45
|
+
DOWNLOADING: "downloading",
|
|
46
|
+
EXTRACTING_TEXT: "extracting_text",
|
|
47
|
+
EMBEDDING: "embedding"
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
ChatbotStatus,
|
|
51
|
+
ENTITY_EXTRACT_SOCKET_EVENT,
|
|
52
|
+
EntityExtractSocketType,
|
|
53
|
+
KNOWLEDGE_CRAWL_SOCKET_EVENT,
|
|
54
|
+
KnowledgeCrawlPhase,
|
|
55
|
+
KnowledgeCrawlSocketType,
|
|
56
|
+
LUMI_LEARN_FROM_CHAT_SOCKET_EVENT,
|
|
57
|
+
LumiSocketType
|
|
58
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import i18n from "../lib/i18n/index.js";
|
|
2
|
+
const ORGANIZATION_TYPES = {
|
|
3
|
+
company: {
|
|
4
|
+
get label() {
|
|
5
|
+
return i18n.t("common:label.company", { defaultValue: "C\xF4ng ty" });
|
|
6
|
+
},
|
|
7
|
+
value: "company"
|
|
8
|
+
},
|
|
9
|
+
agency: { label: "Agency", value: "agency" },
|
|
10
|
+
distributor: {
|
|
11
|
+
get label() {
|
|
12
|
+
return i18n.t("common:label.distributor", {
|
|
13
|
+
defaultValue: "Nh\xE0 ph\xE2n ph\u1ED1i"
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
value: "distributor"
|
|
17
|
+
},
|
|
18
|
+
other: {
|
|
19
|
+
get label() {
|
|
20
|
+
return i18n.t("common:label.other", { defaultValue: "Kh\xE1c" });
|
|
21
|
+
},
|
|
22
|
+
value: "other"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const ORGANIZATION_TYPE_OPTIONS = Object.values(ORGANIZATION_TYPES);
|
|
26
|
+
const SOURCE_TABS = {
|
|
27
|
+
all: {
|
|
28
|
+
get label() {
|
|
29
|
+
return i18n.t("common:filter.all", { defaultValue: "T\u1EA5t c\u1EA3" });
|
|
30
|
+
},
|
|
31
|
+
value: "all",
|
|
32
|
+
rolesAllowed: ["administrator", "supervisor"]
|
|
33
|
+
},
|
|
34
|
+
dept: {
|
|
35
|
+
get label() {
|
|
36
|
+
return i18n.t("common:label.departmentOrganization", {
|
|
37
|
+
defaultValue: "T\u1ED5 ch\u1EE9c c\u1EE7a b\u1ED9 ph\u1EADn"
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
value: "dept",
|
|
41
|
+
rolesAllowed: [
|
|
42
|
+
"administrator",
|
|
43
|
+
"supervisor",
|
|
44
|
+
"team_leader",
|
|
45
|
+
"sale_team_leader"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
mine: {
|
|
49
|
+
get label() {
|
|
50
|
+
return i18n.t("common:label.myOrganization", {
|
|
51
|
+
defaultValue: "T\u1ED5 ch\u1EE9c c\u1EE7a t\xF4i"
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
value: "mine"
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const DEFAULT_TABLE_COLUMNS = [
|
|
58
|
+
"name",
|
|
59
|
+
"organization_type",
|
|
60
|
+
"phone",
|
|
61
|
+
"email",
|
|
62
|
+
"website",
|
|
63
|
+
"address",
|
|
64
|
+
"member_count",
|
|
65
|
+
"tag_ids",
|
|
66
|
+
"assignee_id",
|
|
67
|
+
"created_at",
|
|
68
|
+
"updated_at"
|
|
69
|
+
];
|
|
70
|
+
export {
|
|
71
|
+
DEFAULT_TABLE_COLUMNS,
|
|
72
|
+
ORGANIZATION_TYPES,
|
|
73
|
+
ORGANIZATION_TYPE_OPTIONS,
|
|
74
|
+
SOURCE_TABS
|
|
75
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const DistributionLogSource = {
|
|
2
|
+
MANUAL: "manual",
|
|
3
|
+
ROUND_ROBIN: "round_robin",
|
|
4
|
+
LOAD_BASED: "load_based",
|
|
5
|
+
ALL: "all",
|
|
6
|
+
LAST_AGENT: "LAST_AGENT",
|
|
7
|
+
UPDATE_ASSIGNED: "update_assigned",
|
|
8
|
+
MARK_RECEIVED: "mark_received",
|
|
9
|
+
CLOSE_CHAT: "close_chat",
|
|
10
|
+
REOPEN_CHAT: "reopen_chat"
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
DistributionLogSource
|
|
14
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const PRE_LOGOUT_EVENT = "PRE_LOGOUT_EVENT";
|
|
2
|
+
const LOGOUT_EVENT = "LOGOUT_EVENT";
|
|
3
|
+
const NAVIGATION_EVENT = "NAVIGATION_EVENT";
|
|
4
|
+
const DIAL_CALL_EVENT = Object.freeze({
|
|
5
|
+
RINGING: "ringCall",
|
|
6
|
+
ANSWER: "answerCall",
|
|
7
|
+
ENDED: "endCall",
|
|
8
|
+
SET_AUDIO_TRACK: "setAudioTrack"
|
|
9
|
+
});
|
|
10
|
+
const MONITOR_EVENT = Object.freeze({
|
|
11
|
+
AVAILABLE_AGENT: "availableAgent",
|
|
12
|
+
UPDATE_MONITOR_AGENT_DASHBOARD: "updateMonitorAgentDashboard",
|
|
13
|
+
UPDATE_MONITOR_ALL_AGENT: "updateMonitorAllAgent",
|
|
14
|
+
UPDATE_MONITOR_AGENT: "updateMonitorAgent",
|
|
15
|
+
UPDATE_MONITOR_PHONE_TYPE_AGENT: "updateMonitorPhoneTypeAgent",
|
|
16
|
+
UPDATE_MONITOR_CALL: "updateMonitorCall",
|
|
17
|
+
UPDATE_MONITOR_CALL_LIST: "updateMonitorCallList",
|
|
18
|
+
UPDATE_MONITOR_CALL_DETAILS: "updateMonitorCallDetails",
|
|
19
|
+
UPDATE_MONITOR_CALL_ENDED: "updateMonitorCallEnded"
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
DIAL_CALL_EVENT,
|
|
23
|
+
LOGOUT_EVENT,
|
|
24
|
+
MONITOR_EVENT,
|
|
25
|
+
NAVIGATION_EVENT,
|
|
26
|
+
PRE_LOGOUT_EVENT
|
|
27
|
+
};
|