@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.
Files changed (124) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -0
  3. package/api/campaign.js +19 -0
  4. package/api/chat.js +518 -0
  5. package/api/chatroom.js +254 -0
  6. package/api/contact.js +45 -0
  7. package/api/crm-organization.js +101 -0
  8. package/api/customer.js +143 -0
  9. package/api/facebook-labels.js +11 -0
  10. package/api/field.js +11 -0
  11. package/api/file.js +17 -0
  12. package/api/filter.js +50 -0
  13. package/api/group.js +11 -0
  14. package/api/iam.js +23 -0
  15. package/api/index.js +54 -0
  16. package/api/orgTree.js +45 -0
  17. package/api/post.js +111 -0
  18. package/api/queue.js +15 -0
  19. package/api/report.js +422 -0
  20. package/api/send.js +21 -0
  21. package/api/session-event.js +30 -0
  22. package/api/session.js +249 -0
  23. package/api/settings/assign-task.js +10 -0
  24. package/api/settings/channel.js +136 -0
  25. package/api/settings/chat-layout.js +37 -0
  26. package/api/settings/chat-timeout.js +10 -0
  27. package/api/settings/common.js +32 -0
  28. package/api/settings/config.js +19 -0
  29. package/api/settings/index.js +24 -0
  30. package/api/settings/ivr.js +25 -0
  31. package/api/settings/queue-v3.js +56 -0
  32. package/api/settings/queue.js +48 -0
  33. package/api/settings/routing.js +32 -0
  34. package/api/settings/service.js +31 -0
  35. package/api/settings.js +567 -0
  36. package/api/shipping.js +19 -0
  37. package/api/shopee.js +21 -0
  38. package/api/smart-qc/index.js +4 -0
  39. package/api/smart-qc/keyword.js +10 -0
  40. package/api/tag.js +11 -0
  41. package/api/user.js +177 -0
  42. package/client.js +391 -0
  43. package/config/env.js +76 -0
  44. package/constants/advance-filter.js +358 -0
  45. package/constants/auto-assign-tag.js +13 -0
  46. package/constants/chat-message.js +423 -0
  47. package/constants/chat-room-tag.js +7 -0
  48. package/constants/chat-source.js +68 -0
  49. package/constants/chatbot.js +58 -0
  50. package/constants/common.js +4 -0
  51. package/constants/crm-organization.js +75 -0
  52. package/constants/distribute.js +8 -0
  53. package/constants/distribution-log.js +14 -0
  54. package/constants/events.js +27 -0
  55. package/constants/file-upload.js +86 -0
  56. package/constants/lead.js +111 -0
  57. package/constants/mask-data-config.js +16 -0
  58. package/constants/month.js +78 -0
  59. package/constants/quick-filter.js +49 -0
  60. package/constants/regex.js +34 -0
  61. package/constants/setting.js +62 -0
  62. package/constants/shipping.js +12 -0
  63. package/constants/social.js +21 -0
  64. package/constants/sortable-fields.js +146 -0
  65. package/constants/tenant_config.js +154 -0
  66. package/constants/use-query-key.js +470 -0
  67. package/constants/user.js +293 -0
  68. package/exceptions/axios-error.js +24 -0
  69. package/exceptions/https-error.js +28 -0
  70. package/exceptions/validator-error.js +20 -0
  71. package/lib/avatar-color.js +31 -0
  72. package/lib/i18n/index.js +85 -0
  73. package/lib/i18n/language-store.js +74 -0
  74. package/lib/i18n/locales/en/campaign.json +3 -0
  75. package/lib/i18n/locales/en/chat.json +656 -0
  76. package/lib/i18n/locales/en/common.json +1846 -0
  77. package/lib/i18n/locales/en/customer.json +20 -0
  78. package/lib/i18n/locales/en/lead.json +5 -0
  79. package/lib/i18n/locales/en/lumi.json +4 -0
  80. package/lib/i18n/locales/en/notification.json +107 -0
  81. package/lib/i18n/locales/en/org.json +4 -0
  82. package/lib/i18n/locales/en/posts.json +8 -0
  83. package/lib/i18n/locales/en/settings.json +39 -0
  84. package/lib/i18n/locales/vi/campaign.json +3 -0
  85. package/lib/i18n/locales/vi/chat.json +660 -0
  86. package/lib/i18n/locales/vi/common.json +1846 -0
  87. package/lib/i18n/locales/vi/customer.json +20 -0
  88. package/lib/i18n/locales/vi/lead.json +5 -0
  89. package/lib/i18n/locales/vi/lumi.json +4 -0
  90. package/lib/i18n/locales/vi/notification.json +107 -0
  91. package/lib/i18n/locales/vi/org.json +4 -0
  92. package/lib/i18n/locales/vi/posts.json +8 -0
  93. package/lib/i18n/locales/vi/settings.json +39 -0
  94. package/lib/i18n/server-label.js +33 -0
  95. package/lib/phone.js +70 -0
  96. package/lib/user-avatar.js +21 -0
  97. package/package.json +45 -0
  98. package/socket/index.js +30 -0
  99. package/transport-registry.js +77 -0
  100. package/utils/access-detail.js +119 -0
  101. package/utils/auth.js +205 -0
  102. package/utils/chunk-reload-guard.js +4 -0
  103. package/utils/concurrency-limiter.js +30 -0
  104. package/utils/crm-organization.js +0 -0
  105. package/utils/currency.js +14 -0
  106. package/utils/customers.js +42 -0
  107. package/utils/data.js +178 -0
  108. package/utils/date.js +144 -0
  109. package/utils/debounced-invalidate.js +15 -0
  110. package/utils/emoticon.js +134 -0
  111. package/utils/export.js +7 -0
  112. package/utils/field-layout.js +33 -0
  113. package/utils/filter-adapters.js +9 -0
  114. package/utils/filter.js +18 -0
  115. package/utils/formatters.js +6 -0
  116. package/utils/image-compression.js +169 -0
  117. package/utils/leads.js +13 -0
  118. package/utils/microlink.js +20 -0
  119. package/utils/org-tree.js +108 -0
  120. package/utils/request.js +461 -0
  121. package/utils/session-end.js +19 -0
  122. package/utils/string.js +154 -0
  123. package/utils/table-display-config.js +80 -0
  124. package/utils/validation.js +49 -0
package/api/index.js ADDED
@@ -0,0 +1,54 @@
1
+ import * as campaign from "./campaign.js";
2
+ import * as chat from "./chat.js";
3
+ import * as chatroom from "./chatroom.js";
4
+ import * as contact from "./contact.js";
5
+ import * as crmOrganization from "./crm-organization.js";
6
+ import * as customer from "./customer.js";
7
+ import * as facebookLabels from "./facebook-labels.js";
8
+ import * as field from "./field.js";
9
+ import * as file from "./file.js";
10
+ import * as filter from "./filter.js";
11
+ import * as group from "./group.js";
12
+ import * as iam from "./iam.js";
13
+ import * as orgTree from "./orgTree.js";
14
+ import * as post from "./post.js";
15
+ import * as queue from "./queue.js";
16
+ import * as report from "./report.js";
17
+ import * as send from "./send.js";
18
+ import * as sessionEvent from "./session-event.js";
19
+ import * as session from "./session.js";
20
+ import * as shipping from "./shipping.js";
21
+ import * as shopee from "./shopee.js";
22
+ import * as tag from "./tag.js";
23
+ import * as user from "./user.js";
24
+ import * as smartQc from "./smart-qc/index.js";
25
+ import * as settingsRoot from "./settings.js";
26
+ import * as settingsModules from "./settings/index.js";
27
+ const settings = { ...settingsRoot, ...settingsModules };
28
+ export {
29
+ campaign,
30
+ chat,
31
+ chatroom,
32
+ contact,
33
+ crmOrganization,
34
+ customer,
35
+ facebookLabels,
36
+ field,
37
+ file,
38
+ filter,
39
+ group,
40
+ iam,
41
+ orgTree,
42
+ post,
43
+ queue,
44
+ report,
45
+ send,
46
+ session,
47
+ sessionEvent,
48
+ settings,
49
+ shipping,
50
+ shopee,
51
+ smartQc,
52
+ tag,
53
+ user
54
+ };
package/api/orgTree.js ADDED
@@ -0,0 +1,45 @@
1
+ import { requestApi } from "../utils/request.js";
2
+ const getFeatureFlags = () => requestApi({ endpoint: "/v2/iam/feature-flags" });
3
+ const getOrgTree = ({ scoped } = {}) => requestApi({
4
+ endpoint: scoped ? "/v2/iam/groups/tree?scoped=1" : "/v2/iam/groups/tree"
5
+ });
6
+ const createOrgGroup = (data) => requestApi({ endpoint: "/v2/iam/groups", method: "POST", data });
7
+ const updateOrgGroup = ({ id, data }) => requestApi({ endpoint: `/v2/iam/groups/${id}`, method: "PATCH", data });
8
+ const moveOrgGroup = ({ id, new_parent_id }) => requestApi({
9
+ endpoint: `/v2/iam/groups/${id}/move`,
10
+ method: "PATCH",
11
+ data: { new_parent_id }
12
+ });
13
+ const deleteOrgGroup = ({ id }) => requestApi({ endpoint: `/v2/iam/groups/${id}`, method: "DELETE" });
14
+ const setUserScope = ({ userId, scope_group_ids }) => requestApi({
15
+ endpoint: `/v2/iam/users/${userId}/scope`,
16
+ method: "PUT",
17
+ data: { scope_group_ids }
18
+ });
19
+ const getUserScope = (userId) => requestApi({
20
+ endpoint: `/v2/iam/users/${userId}/scope`,
21
+ method: "GET"
22
+ });
23
+ const getRoleOverride = ({ groupId, roleId }) => requestApi({ endpoint: `/v2/iam/groups/${groupId}/role-overrides/${roleId}` });
24
+ const putRoleOverride = ({
25
+ groupId,
26
+ roleId,
27
+ denied_permissions,
28
+ granted_permissions
29
+ }) => requestApi({
30
+ endpoint: `/v2/iam/groups/${groupId}/role-overrides/${roleId}`,
31
+ method: "PUT",
32
+ data: { denied_permissions, granted_permissions }
33
+ });
34
+ export {
35
+ createOrgGroup,
36
+ deleteOrgGroup,
37
+ getFeatureFlags,
38
+ getOrgTree,
39
+ getRoleOverride,
40
+ getUserScope,
41
+ moveOrgGroup,
42
+ putRoleOverride,
43
+ setUserScope,
44
+ updateOrgGroup
45
+ };
package/api/post.js ADDED
@@ -0,0 +1,111 @@
1
+ import { requestApi, requestOttApi } from "../utils/request.js";
2
+ const getPublishedPosts = ({ params }) => requestApi({
3
+ method: "get",
4
+ endpoint: "/v2/facebook/published-posts",
5
+ params
6
+ });
7
+ const getLiveVideos = ({ params }) => requestApi({
8
+ method: "get",
9
+ endpoint: "/v2/facebook/live-videos",
10
+ params
11
+ });
12
+ const upsertLivestreamConfig = ({ data }) => requestApi({
13
+ method: "post",
14
+ endpoint: "/v2/social/livestream-config",
15
+ data
16
+ });
17
+ const getSocialComments = ({ params }) => requestApi({
18
+ method: "get",
19
+ endpoint: "/v2/social-comments",
20
+ params
21
+ });
22
+ const getSocialReviews = ({ params }) => requestApi({
23
+ method: "get",
24
+ endpoint: "/v2/social-reviews",
25
+ params
26
+ });
27
+ const getSocialCommentReplies = ({ commentId, params }) => requestApi({
28
+ method: "get",
29
+ endpoint: `/v2/social-comments/${commentId}/replies`,
30
+ params
31
+ });
32
+ const replyTikTokBusinessComment = (data) => requestApi({
33
+ method: "post",
34
+ endpoint: "/v2/tiktok-business/comment",
35
+ data
36
+ });
37
+ const toggleTikTokBusinessVisibility = (data) => requestApi({
38
+ method: "post",
39
+ endpoint: "/v2/tiktok-business/comment/visibility",
40
+ data
41
+ });
42
+ const deleteTikTokBusinessComment = (data) => requestApi({
43
+ method: "delete",
44
+ endpoint: "/v2/tiktok-business/comment",
45
+ data
46
+ });
47
+ const replyFacebookComment = (data) => requestApi({
48
+ method: "post",
49
+ endpoint: "/v2/facebook/comment",
50
+ data
51
+ });
52
+ const editFacebookComment = (data) => requestApi({
53
+ method: "put",
54
+ endpoint: "/v2/facebook/comment",
55
+ data
56
+ });
57
+ const toggleCommentVisibility = (data) => requestApi({
58
+ method: "post",
59
+ endpoint: "/v2/facebook/comment/visibility",
60
+ data
61
+ });
62
+ const deleteFacebookComment = (data) => requestApi({
63
+ method: "delete",
64
+ endpoint: "/v2/facebook/comment",
65
+ data
66
+ });
67
+ const replyInstagramComment = (data) => requestApi({
68
+ method: "post",
69
+ endpoint: "/v2/instagram/comment",
70
+ data
71
+ });
72
+ const toggleInstagramCommentVisibility = (data) => requestApi({
73
+ method: "post",
74
+ endpoint: "/v2/instagram/comment/visibility",
75
+ data
76
+ });
77
+ const deleteInstagramComment = (data) => requestApi({
78
+ method: "delete",
79
+ endpoint: "/v2/instagram/comment",
80
+ data
81
+ });
82
+ const batchClassifyComments = (data) => requestOttApi({
83
+ method: "post",
84
+ endpoint: "/facebook/comment/classify/batch",
85
+ data
86
+ });
87
+ const syncGoogleReviews = (data) => requestOttApi({
88
+ method: "post",
89
+ endpoint: "/google/reviews/apify",
90
+ data
91
+ });
92
+ export {
93
+ batchClassifyComments,
94
+ deleteFacebookComment,
95
+ deleteInstagramComment,
96
+ deleteTikTokBusinessComment,
97
+ editFacebookComment,
98
+ getLiveVideos,
99
+ getPublishedPosts,
100
+ getSocialCommentReplies,
101
+ getSocialComments,
102
+ getSocialReviews,
103
+ replyFacebookComment,
104
+ replyInstagramComment,
105
+ replyTikTokBusinessComment,
106
+ syncGoogleReviews,
107
+ toggleCommentVisibility,
108
+ toggleInstagramCommentVisibility,
109
+ toggleTikTokBusinessVisibility,
110
+ upsertLivestreamConfig
111
+ };
package/api/queue.js ADDED
@@ -0,0 +1,15 @@
1
+ import { requestApi } from "../utils/request.js";
2
+ const getAllQueueManager = (params) => requestApi({
3
+ method: "get",
4
+ endpoint: `/v2/all-queue-manager`,
5
+ params
6
+ });
7
+ const getAllQueueService = (params) => requestApi({
8
+ method: "get",
9
+ endpoint: `/all-service`,
10
+ params
11
+ });
12
+ export {
13
+ getAllQueueManager,
14
+ getAllQueueService
15
+ };
package/api/report.js ADDED
@@ -0,0 +1,422 @@
1
+ import { requestApi, requestHubApi } from "../utils/request.js";
2
+ const reportSummary = ({ params, data }) => requestApi({
3
+ method: "get",
4
+ endpoint: "/v3/report/summary",
5
+ params,
6
+ data
7
+ });
8
+ const reportSummaryPersonal = ({ params, data }) => requestApi({
9
+ method: "post",
10
+ endpoint: "/v2/report/summary-personal",
11
+ params,
12
+ data
13
+ });
14
+ const reportSummaryGroups = ({ data }) => requestApi({
15
+ method: "post",
16
+ endpoint: "v2/report/summary-groups",
17
+ data
18
+ });
19
+ const reportSummaryCustomer = ({ params, data }) => requestApi({
20
+ method: "post",
21
+ endpoint: "v2/report/summary-customer",
22
+ params,
23
+ data
24
+ });
25
+ const reportSummaryAgent = ({ data }) => requestApi({
26
+ method: "post",
27
+ endpoint: "v2/report/summary-agent",
28
+ data
29
+ });
30
+ const reportAgentDetail = ({ data }) => requestApi({
31
+ method: "post",
32
+ endpoint: "v2/report/agents",
33
+ data
34
+ });
35
+ const reportAgentDetailv2 = ({ data }) => requestApi({
36
+ method: "post",
37
+ endpoint: "v2/report/agentsv2",
38
+ data
39
+ });
40
+ const getAllService = ({ params, data }) => requestApi({
41
+ method: "get",
42
+ endpoint: "all-service",
43
+ params,
44
+ data
45
+ });
46
+ const getAllFieldTicket = ({ params }) => requestApi({
47
+ method: "get",
48
+ endpoint: "v2/all-field",
49
+ params
50
+ });
51
+ const getAllIvrGateways = () => requestApi({
52
+ method: "get",
53
+ endpoint: "v2/ivrgateways"
54
+ });
55
+ const getAllQueues = ({
56
+ service_id = null,
57
+ queue_manager_id = null,
58
+ type = null,
59
+ is_count_agent = false
60
+ } = {}) => requestApi({
61
+ method: "get",
62
+ endpoint: "v2/all-queue",
63
+ params: {
64
+ ...service_id ? { service_id } : {},
65
+ ...queue_manager_id ? { queue_manager_id } : {},
66
+ ...type ? { type } : {},
67
+ ...is_count_agent ? { is_count_agent } : {}
68
+ }
69
+ });
70
+ const getAllAgent = (group_ids = null) => requestApi({
71
+ method: "get",
72
+ endpoint: "v2/all-user",
73
+ params: { ...group_ids ? { group_ids } : {} }
74
+ });
75
+ const getAllAgentV3 = (group_ids = null) => requestApi({
76
+ method: "get",
77
+ endpoint: "v3/all-user",
78
+ params: { ...group_ids ? { group_ids } : {} }
79
+ });
80
+ const getReportAdFunnel = ({ data }) => requestApi({
81
+ method: "post",
82
+ endpoint: `/v2/report/ads-report`,
83
+ data
84
+ });
85
+ const getReportAdAccounts = () => requestApi({
86
+ method: "get",
87
+ endpoint: `/v2/report/ads-report/ad-accounts`
88
+ });
89
+ const getReportAdCampaigns = ({ data }) => requestApi({
90
+ method: "post",
91
+ endpoint: `/v2/report/ads-report/campaigns`,
92
+ data
93
+ });
94
+ const getReportAdSets = ({ data }) => requestApi({
95
+ method: "post",
96
+ endpoint: `/v2/report/ads-report/adsets`,
97
+ data
98
+ });
99
+ const exportReportAdFunnel = ({ data }) => requestApi({
100
+ method: "post",
101
+ endpoint: `/v2/report/export-ad-funnel`,
102
+ data,
103
+ responseType: "blob"
104
+ });
105
+ const getReportAdFunnelDetail = ({ data }) => requestApi({
106
+ method: "post",
107
+ endpoint: `/v2/report/report-ads-detail`,
108
+ data
109
+ });
110
+ const exportReportAdFunnelDetail = ({ data }) => requestApi({
111
+ method: "post",
112
+ endpoint: `/v2/report/export-ads-detail`,
113
+ data,
114
+ responseType: "blob"
115
+ });
116
+ const getReportZnsDetail = ({ data }) => requestApi({
117
+ method: "post",
118
+ endpoint: `/v2/report/zns-detail`,
119
+ data
120
+ });
121
+ const getReportZnsLogDetail = ({ id }) => requestApi({
122
+ method: "get",
123
+ endpoint: `/v2/report/zns-detail/${id}`
124
+ });
125
+ const getReportSmsDetail = ({ data }) => requestApi({
126
+ method: "post",
127
+ endpoint: `/v2/report/sms-detail`,
128
+ data
129
+ });
130
+ const getReportZnsResponse = ({ data }) => requestApi({
131
+ method: "post",
132
+ endpoint: `/v2/report/zns-response`,
133
+ data
134
+ });
135
+ const exportReportZnsResponse = ({ data }) => requestApi({
136
+ method: "post",
137
+ endpoint: `/v2/report/zns-sending-logs/download/${data.zns_type}`,
138
+ data,
139
+ responseType: "blob"
140
+ });
141
+ const exportReportSmsResponse = ({ data }) => requestApi({
142
+ method: "post",
143
+ endpoint: `/v2/report/sms-detail/download`,
144
+ data,
145
+ responseType: "blob"
146
+ });
147
+ const getReportZnsTemplates = ({ data }) => requestApi({
148
+ method: "post",
149
+ endpoint: `/v2/report/zns-template`,
150
+ data
151
+ });
152
+ const exportReportZnsTemplates = ({ data }) => requestApi({
153
+ method: "post",
154
+ endpoint: `/v2/report/export-zns-template`,
155
+ data
156
+ });
157
+ const getReportSmsOverview = ({ params }) => requestApi({
158
+ method: "get",
159
+ endpoint: `/v2/report/sms-overview`,
160
+ params
161
+ });
162
+ const getReportZnsOverview = ({ params }) => requestApi({
163
+ method: "get",
164
+ endpoint: `/v2/report/zns-overview`,
165
+ params
166
+ });
167
+ const getLeadsByStage = (params) => requestApi({
168
+ method: "GET",
169
+ endpoint: "/v2/report/leads-by-stage",
170
+ params
171
+ });
172
+ const getLeadsDetailed = (params) => requestApi({
173
+ method: "GET",
174
+ endpoint: "/v2/report/leads-detailed",
175
+ params
176
+ });
177
+ const getLeadsBySource = (params) => requestApi({
178
+ method: "GET",
179
+ endpoint: "/v2/report/leads-by-source",
180
+ params
181
+ });
182
+ const getRevenueSummary = (params) => requestApi({
183
+ method: "GET",
184
+ endpoint: "/v2/deals/report",
185
+ params
186
+ });
187
+ const getRevenueByCustomerGroup = (params) => requestApi({
188
+ method: "GET",
189
+ endpoint: "/v2/report/revenue-by-customer-group",
190
+ params
191
+ });
192
+ const getRevenueByCustomerGroupRanking = (params) => requestApi({
193
+ method: "GET",
194
+ endpoint: "/v2/report/revenue-by-customer-group-ranking",
195
+ params
196
+ });
197
+ const getCustomerRanking = (params) => requestApi({
198
+ method: "GET",
199
+ endpoint: "/v2/report/customer-ranking",
200
+ params
201
+ });
202
+ const getRevenueByDepartment = (params) => requestApi({
203
+ method: "GET",
204
+ endpoint: "/v2/report/revenue-by-department",
205
+ params
206
+ });
207
+ const getRevenueByDepartmentRanking = (params) => requestApi({
208
+ method: "GET",
209
+ endpoint: "/v2/report/revenue-by-department-ranking",
210
+ params
211
+ });
212
+ const getAgentRanking = (params) => requestApi({
213
+ method: "GET",
214
+ endpoint: "/v2/report/agent-ranking",
215
+ params
216
+ });
217
+ const getLeadsByAgent = (params) => requestApi({
218
+ method: "GET",
219
+ endpoint: "/v2/report/leads-by-agent",
220
+ params
221
+ });
222
+ const getViancoExport = ({ params }) => requestApi({
223
+ method: "get",
224
+ endpoint: "/v2/report/vianco-report",
225
+ params,
226
+ timeout: 0
227
+ });
228
+ const getCustomerFeedbackReport = ({ params }) => requestApi({
229
+ method: "get",
230
+ endpoint: "/v2/report/customer-feedback",
231
+ params
232
+ });
233
+ const getCustomerVisitReport = ({ params }) => requestApi({
234
+ method: "get",
235
+ endpoint: "/v2/report/customer-visit",
236
+ params
237
+ });
238
+ const getWarrantyReport = ({ params }) => requestApi({
239
+ method: "get",
240
+ endpoint: "/v2/report/warranty",
241
+ params
242
+ });
243
+ const getCustomerCareReport = ({ params }) => requestApi({
244
+ method: "get",
245
+ endpoint: "/v2/report/customer-care",
246
+ params
247
+ });
248
+ const getAgentCareReport = ({ params }) => requestApi({
249
+ method: "get",
250
+ endpoint: "/v2/report/agent-care",
251
+ params
252
+ });
253
+ const getDataControlReport = ({ params }) => requestApi({
254
+ method: "get",
255
+ endpoint: "/v2/report/data-control",
256
+ params
257
+ });
258
+ const getDataByCustomerTypeReport = ({ params }) => requestApi({
259
+ method: "get",
260
+ endpoint: "/v2/report/data-by-customer-type",
261
+ params
262
+ });
263
+ const getSalesByBrandReport = ({ params }) => requestApi({
264
+ method: "get",
265
+ endpoint: "/v2/report/sales-by-brand",
266
+ params
267
+ });
268
+ const getCareStatusReport = ({ params }) => requestApi({
269
+ method: "get",
270
+ endpoint: "/v2/report/care-status-report",
271
+ params
272
+ });
273
+ const getRevenueByUnit = ({ params }) => requestApi({
274
+ method: "get",
275
+ endpoint: "/v2/report/revenue-by-unit",
276
+ params
277
+ });
278
+ const getTopSellingProducts = ({ params }) => requestApi({
279
+ method: "get",
280
+ endpoint: "/v2/report/top-selling-products",
281
+ params
282
+ });
283
+ const getPerformanceReport = ({ params }) => requestApi({
284
+ method: "get",
285
+ endpoint: "/v2/report/performance-report",
286
+ params
287
+ });
288
+ const getDailyReport = ({ params }) => requestApi({
289
+ method: "get",
290
+ endpoint: "/v2/report/daily-report",
291
+ params,
292
+ timeout: 0
293
+ });
294
+ const getChatRoomsSummary = ({ params }) => requestHubApi({
295
+ method: "get",
296
+ endpoint: "/api/v3/chat-rooms/summary",
297
+ params
298
+ });
299
+ const getChatAgentPerformanceReport = ({ params }) => requestHubApi({
300
+ method: "get",
301
+ endpoint: "/api/v3/reports/agent-performance",
302
+ params
303
+ });
304
+ const getChatAgentPerformanceChatStats = ({ params }) => requestHubApi({
305
+ method: "get",
306
+ endpoint: "/api/v3/reports/agent-performance/chat-stats",
307
+ params
308
+ });
309
+ const getChatAgentPerformanceDrilldown = ({ params }) => requestHubApi({
310
+ method: "get",
311
+ endpoint: "/api/v3/reports/agent-performance/drilldown",
312
+ params
313
+ });
314
+ const getChatAgentPerformanceChatStatsDrilldown = ({ params }) => requestHubApi({
315
+ method: "get",
316
+ endpoint: "/api/v3/reports/agent-performance/chat-stats/drilldown",
317
+ params
318
+ });
319
+ const getAiChatbotCostOverview = ({ params }) => requestHubApi({
320
+ method: "get",
321
+ endpoint: "/api/v3/reports/ai-chatbot-cost/overview",
322
+ params
323
+ });
324
+ const getAiChatbotCostTenantSummary = ({ tenantId, params }) => requestHubApi({
325
+ method: "get",
326
+ endpoint: `/api/v3/reports/ai-chatbot-cost/tenants/${tenantId}/summary`,
327
+ params
328
+ });
329
+ const getAiChatbotCostTenantBots = ({ tenantId, params }) => requestHubApi({
330
+ method: "get",
331
+ endpoint: `/api/v3/reports/ai-chatbot-cost/tenants/${tenantId}/bots`,
332
+ params
333
+ });
334
+ const getAiChatbotCostTenantConversations = ({ tenantId, params }) => requestHubApi({
335
+ method: "get",
336
+ endpoint: `/api/v3/reports/ai-chatbot-cost/tenants/${tenantId}/conversations`,
337
+ params
338
+ });
339
+ const getAiChatbotCostTenantIntents = ({ tenantId, params }) => requestHubApi({
340
+ method: "get",
341
+ endpoint: `/api/v3/reports/ai-chatbot-cost/tenants/${tenantId}/intents`,
342
+ params
343
+ });
344
+ const getAiChatbotCostTenantNodes = ({ tenantId, params }) => requestHubApi({
345
+ method: "get",
346
+ endpoint: `/api/v3/reports/ai-chatbot-cost/tenants/${tenantId}/nodes`,
347
+ params
348
+ });
349
+ const getSupersetGuestToken = ({ dashboardId, rls }) => requestApi({
350
+ method: "post",
351
+ endpoint: "v2/superset/guest-token",
352
+ data: { dashboard_id: dashboardId, rls }
353
+ });
354
+ export {
355
+ exportReportAdFunnel,
356
+ exportReportAdFunnelDetail,
357
+ exportReportSmsResponse,
358
+ exportReportZnsResponse,
359
+ exportReportZnsTemplates,
360
+ getAgentCareReport,
361
+ getAgentRanking,
362
+ getAiChatbotCostOverview,
363
+ getAiChatbotCostTenantBots,
364
+ getAiChatbotCostTenantConversations,
365
+ getAiChatbotCostTenantIntents,
366
+ getAiChatbotCostTenantNodes,
367
+ getAiChatbotCostTenantSummary,
368
+ getAllAgent,
369
+ getAllAgentV3,
370
+ getAllFieldTicket,
371
+ getAllIvrGateways,
372
+ getAllQueues,
373
+ getAllService,
374
+ getCareStatusReport,
375
+ getChatAgentPerformanceChatStats,
376
+ getChatAgentPerformanceChatStatsDrilldown,
377
+ getChatAgentPerformanceDrilldown,
378
+ getChatAgentPerformanceReport,
379
+ getChatRoomsSummary,
380
+ getCustomerCareReport,
381
+ getCustomerFeedbackReport,
382
+ getCustomerRanking,
383
+ getCustomerVisitReport,
384
+ getDailyReport,
385
+ getDataByCustomerTypeReport,
386
+ getDataControlReport,
387
+ getLeadsByAgent,
388
+ getLeadsBySource,
389
+ getLeadsByStage,
390
+ getLeadsDetailed,
391
+ getPerformanceReport,
392
+ getReportAdAccounts,
393
+ getReportAdCampaigns,
394
+ getReportAdFunnel,
395
+ getReportAdFunnelDetail,
396
+ getReportAdSets,
397
+ getReportSmsDetail,
398
+ getReportSmsOverview,
399
+ getReportZnsDetail,
400
+ getReportZnsLogDetail,
401
+ getReportZnsOverview,
402
+ getReportZnsResponse,
403
+ getReportZnsTemplates,
404
+ getRevenueByCustomerGroup,
405
+ getRevenueByCustomerGroupRanking,
406
+ getRevenueByDepartment,
407
+ getRevenueByDepartmentRanking,
408
+ getRevenueByUnit,
409
+ getRevenueSummary,
410
+ getSalesByBrandReport,
411
+ getSupersetGuestToken,
412
+ getTopSellingProducts,
413
+ getViancoExport,
414
+ getWarrantyReport,
415
+ reportAgentDetail,
416
+ reportAgentDetailv2,
417
+ reportSummary,
418
+ reportSummaryAgent,
419
+ reportSummaryCustomer,
420
+ reportSummaryGroups,
421
+ reportSummaryPersonal
422
+ };
package/api/send.js ADDED
@@ -0,0 +1,21 @@
1
+ import { requestApi, requestEmail } from "../utils/request.js";
2
+ const sendEmail = (payload) => requestEmail({
3
+ method: "post",
4
+ endpoint: "/sentemail",
5
+ data: payload
6
+ });
7
+ const sendSms = (payload) => requestApi({
8
+ method: "post",
9
+ endpoint: "/v2/sms/send",
10
+ data: payload
11
+ });
12
+ const sendZns = (payload) => requestApi({
13
+ method: "post",
14
+ endpoint: "/v2/zalo/zns/send-by-template",
15
+ data: payload
16
+ });
17
+ export {
18
+ sendEmail,
19
+ sendSms,
20
+ sendZns
21
+ };
@@ -0,0 +1,30 @@
1
+ import { getRealTokenIdentity, checkIsViewAsMode } from "../utils/auth.js";
2
+ import { env } from "../config/env.js";
3
+ const endpoint = () => `${env.API_EVS_URL || ""}/v2/session-event`;
4
+ let lastSid = null;
5
+ const sendSessionEndBeacon = (reason) => {
6
+ try {
7
+ if (checkIsViewAsMode()) return;
8
+ const { sid, user_id, tenant_id } = getRealTokenIdentity();
9
+ if (sid && sid === lastSid) return;
10
+ lastSid = sid || lastSid;
11
+ const body = JSON.stringify({
12
+ reason,
13
+ sid,
14
+ user_id,
15
+ tenant_id,
16
+ trigger_url: typeof location !== "undefined" ? location.href : void 0,
17
+ user_agent: typeof navigator !== "undefined" ? navigator.userAgent : void 0
18
+ });
19
+ if (typeof navigator !== "undefined" && navigator.sendBeacon) {
20
+ navigator.sendBeacon(
21
+ endpoint(),
22
+ new Blob([body], { type: "text/plain" })
23
+ );
24
+ }
25
+ } catch {
26
+ }
27
+ };
28
+ export {
29
+ sendSessionEndBeacon
30
+ };