@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
@@ -0,0 +1,254 @@
1
+ import { requestHubApi } from "../utils/request.js";
2
+ const getChatRoomDetail = (chatRoomId, params, signal) => {
3
+ return requestHubApi({
4
+ method: "get",
5
+ endpoint: `/api/v3/chat-rooms/${chatRoomId}`,
6
+ params,
7
+ signal
8
+ });
9
+ };
10
+ function getChatRoomList({ params, signal } = {}) {
11
+ const options = {
12
+ method: "get",
13
+ endpoint: "/api/v3/chat-rooms/filter",
14
+ params,
15
+ signal
16
+ };
17
+ return requestHubApi(options);
18
+ }
19
+ function getChatRoomWithCondition({ params }) {
20
+ const options = {
21
+ method: "get",
22
+ endpoint: "/api/v3/chat-rooms",
23
+ params
24
+ };
25
+ return requestHubApi(options);
26
+ }
27
+ const _markRoomReadLastCall = /* @__PURE__ */ new Map();
28
+ const _MARK_ROOM_READ_DEDUPE_MS = 2e3;
29
+ function markRoomRead(chatRoomId, { messageIds, isChatAllowed } = {}) {
30
+ if (!messageIds?.length) {
31
+ const now = Date.now();
32
+ if (now - (_markRoomReadLastCall.get(chatRoomId) ?? 0) < _MARK_ROOM_READ_DEDUPE_MS) {
33
+ return Promise.resolve();
34
+ }
35
+ _markRoomReadLastCall.set(chatRoomId, now);
36
+ }
37
+ const data = {};
38
+ if (messageIds?.length) data.message_ids = messageIds;
39
+ if (isChatAllowed) data.isChatAllowed = true;
40
+ return requestHubApi({
41
+ method: "post",
42
+ endpoint: `/api/v3/chat-rooms/${chatRoomId}/read`,
43
+ ...Object.keys(data).length ? { data } : {}
44
+ });
45
+ }
46
+ function markRoomUnread(chatRoomId) {
47
+ return requestHubApi({
48
+ method: "post",
49
+ endpoint: `/api/v3/chat-rooms/${chatRoomId}/unread`
50
+ });
51
+ }
52
+ function getChatMessageList(chatRoomId, { params, signal } = {}) {
53
+ const options = {
54
+ method: "get",
55
+ endpoint: `/api/v3/chat-messages/by-room/${chatRoomId}`,
56
+ params,
57
+ signal
58
+ };
59
+ return requestHubApi(options);
60
+ }
61
+ function updateTagChatRoomV2({ chatRoomId, data }) {
62
+ const options = {
63
+ method: "patch",
64
+ endpoint: `/api/v3/chat-rooms/${chatRoomId}/tags-v2`,
65
+ data
66
+ };
67
+ return requestHubApi(options);
68
+ }
69
+ function updateChatRoomTagsBatch({ data }) {
70
+ const options = {
71
+ method: "patch",
72
+ endpoint: "/api/v3/chat-rooms/tags-batch",
73
+ data
74
+ };
75
+ return requestHubApi(options);
76
+ }
77
+ function reassignChatRoomsBatch({ data }) {
78
+ const options = {
79
+ method: "patch",
80
+ endpoint: "/api/v3/chat-sessions/reassign-batch",
81
+ data
82
+ };
83
+ return requestHubApi(options);
84
+ }
85
+ function autoAssignTagChatRoom({ chatRoomId, data }) {
86
+ const options = {
87
+ method: "post",
88
+ endpoint: `/api/v3/chat-rooms/${chatRoomId}/tags/auto-assign`,
89
+ data
90
+ };
91
+ return requestHubApi(options);
92
+ }
93
+ function distributeManual({ data }) {
94
+ return requestHubApi({
95
+ method: "post",
96
+ endpoint: `/api/v3/distributors/distribute-manual`,
97
+ data
98
+ });
99
+ }
100
+ function reassign({ sessionId, payload }) {
101
+ return requestHubApi({
102
+ method: "patch",
103
+ endpoint: `/api/v3/chat-sessions/${sessionId}/reassign`,
104
+ data: payload
105
+ });
106
+ }
107
+ function closeSession({ sessionId, payload }) {
108
+ return requestHubApi({
109
+ method: "post",
110
+ endpoint: `/api/v3/chat-sessions/${sessionId}/close`,
111
+ data: payload
112
+ });
113
+ }
114
+ function closeSessionsBatch({ data }) {
115
+ return requestHubApi({
116
+ method: "post",
117
+ endpoint: "/api/v3/chat-sessions/close-batch",
118
+ data
119
+ });
120
+ }
121
+ function reopenSession(roomId) {
122
+ return requestHubApi({
123
+ method: "post",
124
+ endpoint: `/api/v3/chat-rooms/${roomId}/reopen`
125
+ });
126
+ }
127
+ function receiveSession(sessionId) {
128
+ return requestHubApi({
129
+ method: "patch",
130
+ endpoint: `/api/v3/chat-sessions/${sessionId}/received`
131
+ });
132
+ }
133
+ function inviteUsers({ sessionId, data }) {
134
+ return requestHubApi({
135
+ method: "post",
136
+ endpoint: `/api/v3/chat-sessions/${sessionId}/invite-users`,
137
+ data
138
+ });
139
+ }
140
+ function getSessionMembers({ sessionId }) {
141
+ return requestHubApi({
142
+ method: "get",
143
+ endpoint: `/api/v3/chat-sessions/${sessionId}/members`
144
+ });
145
+ }
146
+ function removeUsers({ sessionId, data }) {
147
+ return requestHubApi({
148
+ method: "post",
149
+ endpoint: `/api/v3/chat-sessions/${sessionId}/remove-users`,
150
+ data
151
+ });
152
+ }
153
+ function receiveInvite({ sessionId }) {
154
+ return requestHubApi({
155
+ method: "post",
156
+ endpoint: `/api/v3/chat-sessions/${sessionId}/receive-invite`
157
+ });
158
+ }
159
+ const getChatSessionDetail = (sessionId) => requestHubApi({
160
+ method: "get",
161
+ endpoint: `/api/v3/chat-sessions/${sessionId}`
162
+ });
163
+ function searchChatMessages({ keyword, page = 1, limit = 20, room_id }) {
164
+ return requestHubApi({
165
+ method: "get",
166
+ endpoint: "/api/v3/chat-messages/search-es",
167
+ params: { keyword, page, limit, ...room_id ? { room_id } : {} }
168
+ });
169
+ }
170
+ function getQuickFilters({ params }) {
171
+ return requestHubApi({
172
+ method: "get",
173
+ endpoint: "/api/v3/chat-rooms/quick-filters",
174
+ params
175
+ });
176
+ }
177
+ function createQuickFilter({ data }) {
178
+ return requestHubApi({
179
+ method: "post",
180
+ endpoint: "/api/v3/chat-rooms/quick-filters",
181
+ data
182
+ });
183
+ }
184
+ function getQuickFilterById({ id }) {
185
+ return requestHubApi({
186
+ method: "get",
187
+ endpoint: `/api/v3/chat-rooms/quick-filters/${id}`
188
+ });
189
+ }
190
+ function deleteQuickFilter({ id }) {
191
+ return requestHubApi({
192
+ method: "delete",
193
+ endpoint: `/api/v3/chat-rooms/quick-filters/${id}`
194
+ });
195
+ }
196
+ function updateQuickFilter({ id, data }) {
197
+ return requestHubApi({
198
+ method: "put",
199
+ endpoint: `/api/v3/chat-rooms/quick-filters/${id}`,
200
+ data
201
+ });
202
+ }
203
+ function getMessageViewers(messageId) {
204
+ return requestHubApi({
205
+ method: "get",
206
+ endpoint: `/api/v3/chat-messages/${messageId}/viewers`
207
+ });
208
+ }
209
+ function updateQuickFilterOrder({ data }) {
210
+ return requestHubApi({
211
+ method: "patch",
212
+ endpoint: "/api/v3/chat-rooms/quick-filters/reorder",
213
+ data
214
+ });
215
+ }
216
+ function toggleQuickFilterVisibility({ id, is_hidden }) {
217
+ return requestHubApi({
218
+ method: "patch",
219
+ endpoint: `/api/v3/chat-rooms/quick-filters/${id}/toggle-visibility`,
220
+ data: { is_hidden }
221
+ });
222
+ }
223
+ export {
224
+ autoAssignTagChatRoom,
225
+ closeSession,
226
+ closeSessionsBatch,
227
+ createQuickFilter,
228
+ deleteQuickFilter,
229
+ distributeManual,
230
+ getChatMessageList,
231
+ getChatRoomDetail,
232
+ getChatRoomList,
233
+ getChatRoomWithCondition,
234
+ getChatSessionDetail,
235
+ getMessageViewers,
236
+ getQuickFilterById,
237
+ getQuickFilters,
238
+ getSessionMembers,
239
+ inviteUsers,
240
+ markRoomRead,
241
+ markRoomUnread,
242
+ reassign,
243
+ reassignChatRoomsBatch,
244
+ receiveInvite,
245
+ receiveSession,
246
+ removeUsers,
247
+ reopenSession,
248
+ searchChatMessages,
249
+ toggleQuickFilterVisibility,
250
+ updateChatRoomTagsBatch,
251
+ updateQuickFilter,
252
+ updateQuickFilterOrder,
253
+ updateTagChatRoomV2
254
+ };
package/api/contact.js ADDED
@@ -0,0 +1,45 @@
1
+ import { requestApi } from "../utils/request.js";
2
+ const findByPhone = (phone) => requestApi({
3
+ method: "get",
4
+ endpoint: `/v2/find-by-phone/${phone}`
5
+ });
6
+ const createContact = (data) => requestApi({
7
+ endpoint: `/v2/contact`,
8
+ method: "post",
9
+ data
10
+ });
11
+ const convertLeadsToContacts = (data) => requestApi({
12
+ endpoint: `/v2/contact/convert-leads-to-contacts`,
13
+ method: "post",
14
+ data
15
+ });
16
+ const convertContactsToLeads = (data) => requestApi({
17
+ endpoint: `/v2/contact/convert-contacts-to-leads`,
18
+ method: "post",
19
+ data
20
+ });
21
+ const updateContact = ({ id, data }) => requestApi({
22
+ endpoint: `/v2/contact/${id}`,
23
+ method: "put",
24
+ data
25
+ });
26
+ const findContact = (id) => requestApi({
27
+ endpoint: `/v2/contact/` + id,
28
+ method: "get"
29
+ });
30
+ function checkDuplicateEmailPhone(data) {
31
+ return requestApi({
32
+ endpoint: "/v2/contact/detection",
33
+ method: "post",
34
+ data
35
+ });
36
+ }
37
+ export {
38
+ checkDuplicateEmailPhone,
39
+ convertContactsToLeads,
40
+ convertLeadsToContacts,
41
+ createContact,
42
+ findByPhone,
43
+ findContact,
44
+ updateContact
45
+ };
@@ -0,0 +1,101 @@
1
+ import { requestApi, postWithFile } from "../utils/request.js";
2
+ const createOrganization = (payload) => requestApi({
3
+ method: "post",
4
+ endpoint: "/v2/organization",
5
+ data: payload
6
+ });
7
+ const getOrganizationDetail = (id) => requestApi({
8
+ method: "get",
9
+ endpoint: `/v2/organization/${id}`
10
+ });
11
+ const updateOrganization = (id, payload) => requestApi({
12
+ method: "put",
13
+ endpoint: `/v2/organization/${id}`,
14
+ data: payload
15
+ });
16
+ const deleteOrganization = (id) => requestApi({
17
+ method: "delete",
18
+ endpoint: `/v2/organization/${id}`
19
+ });
20
+ const getOrganizations = (params) => requestApi({
21
+ method: "get",
22
+ endpoint: "/v2/organizations",
23
+ params
24
+ });
25
+ const getOrganizationExportFields = () => requestApi({
26
+ method: "get",
27
+ endpoint: "/v2/organizations/export-fields"
28
+ });
29
+ const exportOrganizations = ({ params, data }) => requestApi({
30
+ method: "post",
31
+ endpoint: "/v2/organization/exports",
32
+ params,
33
+ data,
34
+ responseType: "blob"
35
+ });
36
+ const addOrganizationMembers = (id, userIds) => requestApi({
37
+ method: "post",
38
+ endpoint: `/v2/organization/${id}/members`,
39
+ data: { user_ids: userIds }
40
+ });
41
+ const removeOrganizationMembers = (id, userIds) => requestApi({
42
+ method: "delete",
43
+ endpoint: `/v2/organization/${id}/members`,
44
+ data: { user_ids: userIds }
45
+ });
46
+ const getOrganizationMemberIds = (id) => requestApi({
47
+ method: "get",
48
+ endpoint: `/v2/organization/${id}/member-ids`
49
+ });
50
+ const changeOrganizationAssignee = (body) => requestApi({
51
+ method: "put",
52
+ endpoint: "/v2/organization/change-assignee",
53
+ data: body
54
+ });
55
+ const distributeOrganizationAssignees = (body) => requestApi({
56
+ method: "post",
57
+ endpoint: "/v2/organization/distribute-assignees",
58
+ data: body
59
+ });
60
+ const getOrganizationImportTemplate = () => requestApi({
61
+ method: "get",
62
+ endpoint: "/v2/organization/import/template",
63
+ responseType: "blob"
64
+ });
65
+ const importOrganizationsWithFile = (formData) => postWithFile({
66
+ endpoint: "/v2/organization/import-with-file",
67
+ data: formData
68
+ });
69
+ const importOrganizationsWithUrl = (fileUrl) => requestApi({
70
+ method: "post",
71
+ endpoint: "/v2/organization/import-with-url",
72
+ data: { file_url: fileUrl }
73
+ });
74
+ const getOrganizationNotes = (organizationId) => requestApi({
75
+ method: "get",
76
+ endpoint: `/v2/organization/${organizationId}/notes`
77
+ });
78
+ const createOrganizationNote = (organizationId, { content, attachments = [] }) => requestApi({
79
+ method: "post",
80
+ endpoint: `/v2/organization/${organizationId}/notes`,
81
+ data: { content, attachments }
82
+ });
83
+ export {
84
+ addOrganizationMembers,
85
+ changeOrganizationAssignee,
86
+ createOrganization,
87
+ createOrganizationNote,
88
+ deleteOrganization,
89
+ distributeOrganizationAssignees,
90
+ exportOrganizations,
91
+ getOrganizationDetail,
92
+ getOrganizationExportFields,
93
+ getOrganizationImportTemplate,
94
+ getOrganizationMemberIds,
95
+ getOrganizationNotes,
96
+ getOrganizations,
97
+ importOrganizationsWithFile,
98
+ importOrganizationsWithUrl,
99
+ removeOrganizationMembers,
100
+ updateOrganization
101
+ };
@@ -0,0 +1,143 @@
1
+ import { requestApi } from "../utils/request.js";
2
+ import { getUser } from "../utils/auth.js";
3
+ const searchCustomers = ({ params, data }) => requestApi({
4
+ method: "post",
5
+ endpoint: "/v2/contacts/search",
6
+ params,
7
+ data
8
+ });
9
+ const searchContactCounts = ({ data, signal }) => requestApi({
10
+ method: "post",
11
+ endpoint: "/v2/contacts/search/counts",
12
+ data,
13
+ signal
14
+ });
15
+ const getCustomerDetail = (customerId) => requestApi({
16
+ method: "get",
17
+ endpoint: `v2/find-user?_id=${customerId}`
18
+ });
19
+ const getCustomerGroups = () => requestApi({
20
+ method: "get",
21
+ endpoint: `v2/all-group?target=end_user`
22
+ });
23
+ const getCities = () => requestApi({
24
+ method: "get",
25
+ endpoint: `cities`
26
+ });
27
+ const getCustomerOrganizes = () => requestApi({
28
+ method: "get",
29
+ endpoint: `v2/all-organize`
30
+ });
31
+ const exportCustomers = ({ params, data }) => requestApi({
32
+ method: "post",
33
+ endpoint: "/v2/contact/exports",
34
+ params,
35
+ data
36
+ });
37
+ const exportCustomersByFilter = ({ params, data }) => requestApi({
38
+ method: "post",
39
+ endpoint: "v2/contacts/search",
40
+ params,
41
+ data
42
+ });
43
+ const getCustomersByFilter = ({ params, data }) => requestApi({
44
+ method: "post",
45
+ endpoint: "v2/contacts/search",
46
+ params,
47
+ data
48
+ });
49
+ const getCustomerExtraFields = ({ params }) => requestApi({
50
+ method: "get",
51
+ endpoint: "/v2/all-field",
52
+ params
53
+ });
54
+ const mergeCustomer = (data) => requestApi({
55
+ method: "post",
56
+ endpoint: "v2/contact/merges",
57
+ data
58
+ });
59
+ const getMergePreview = ({ contactId, mergeContactId }) => requestApi({
60
+ method: "get",
61
+ endpoint: "v2/contact/merges/preview",
62
+ params: { user_id: contactId, merge_user_id: mergeContactId }
63
+ });
64
+ const manualMergeContact = ({ userId, mergeUserId, fieldSelections }) => requestApi({
65
+ method: "post",
66
+ endpoint: "v2/contact/merges/manual",
67
+ data: {
68
+ user_id: userId,
69
+ merge_user_id: mergeUserId,
70
+ field_selections: fieldSelections
71
+ }
72
+ });
73
+ const importContact = ({ data }) => {
74
+ const user = getUser();
75
+ if (user.tenant_id === "68d8a7652306cd2fe70816dc") {
76
+ data.data_mapper_config_id = "68e4917e259bfcb43307d2b3";
77
+ }
78
+ return requestApi({
79
+ method: "post",
80
+ endpoint: "v2/contact/import-with-file",
81
+ data
82
+ });
83
+ };
84
+ const getTemplateImport = (params) => requestApi({
85
+ method: "get",
86
+ endpoint: "v2/contact/import/template",
87
+ responseType: "blob",
88
+ params
89
+ });
90
+ const createCommentCustomer = (payload) => requestApi({
91
+ method: "post",
92
+ endpoint: "/v2/comment-customer",
93
+ data: payload
94
+ });
95
+ const getCustomerComments = (contactId, params) => requestApi({
96
+ method: "get",
97
+ endpoint: `/v2/comment-customer/list`,
98
+ params: {
99
+ where: JSON.stringify({
100
+ customer_id: contactId
101
+ }),
102
+ ...params
103
+ }
104
+ });
105
+ const changeOwner = (payload) => {
106
+ return requestApi({
107
+ method: "put",
108
+ endpoint: "v2/contact/change-owner",
109
+ data: payload
110
+ });
111
+ };
112
+ const ensureOwnerIdExistByPhone = (phoneNumber, ownerId) => requestApi({
113
+ method: "put",
114
+ endpoint: `/v2/contact/ensure-owner-id-exist-by-phone/${phoneNumber}`,
115
+ data: { owner_id: ownerId }
116
+ });
117
+ const distributeCustomerOwnerShip = (data) => requestApi({
118
+ method: "post",
119
+ endpoint: "/v2/contact/distribute-customer-owner-ship",
120
+ data
121
+ });
122
+ export {
123
+ changeOwner,
124
+ createCommentCustomer,
125
+ distributeCustomerOwnerShip,
126
+ ensureOwnerIdExistByPhone,
127
+ exportCustomers,
128
+ exportCustomersByFilter,
129
+ getCities,
130
+ getCustomerComments,
131
+ getCustomerDetail,
132
+ getCustomerExtraFields,
133
+ getCustomerGroups,
134
+ getCustomerOrganizes,
135
+ getCustomersByFilter,
136
+ getMergePreview,
137
+ getTemplateImport,
138
+ importContact,
139
+ manualMergeContact,
140
+ mergeCustomer,
141
+ searchContactCounts,
142
+ searchCustomers
143
+ };
@@ -0,0 +1,11 @@
1
+ import { requestOttApi } from "../utils/request.js";
2
+ function getConversationLabels({ page_id, psid }) {
3
+ return requestOttApi({
4
+ method: "get",
5
+ endpoint: "/facebook/labels/conversation",
6
+ params: { page_id, psid }
7
+ });
8
+ }
9
+ export {
10
+ getConversationLabels
11
+ };
package/api/field.js ADDED
@@ -0,0 +1,11 @@
1
+ import { requestApi } from "../utils/request.js";
2
+ function getAllFields(params) {
3
+ return requestApi({
4
+ method: "get",
5
+ endpoint: "/v2/all-field",
6
+ params
7
+ });
8
+ }
9
+ export {
10
+ getAllFields
11
+ };
package/api/file.js ADDED
@@ -0,0 +1,17 @@
1
+ import { requestApi, requestCdn } from "../utils/request.js";
2
+ const uploadAttachment = (form) => requestCdn({
3
+ endpoint: "/upload",
4
+ method: "post",
5
+ data: form
6
+ });
7
+ function getPresignedUrl(fileName, params) {
8
+ return requestApi({
9
+ method: "get",
10
+ endpoint: `v2/presign-url/${fileName}`,
11
+ params
12
+ });
13
+ }
14
+ export {
15
+ getPresignedUrl,
16
+ uploadAttachment
17
+ };
package/api/filter.js ADDED
@@ -0,0 +1,50 @@
1
+ import { requestApi } from "../utils/request.js";
2
+ const getFilters = ({ params }) => requestApi({
3
+ method: "get",
4
+ endpoint: "v2/filters",
5
+ params
6
+ });
7
+ const deleteFilter = (filterId) => requestApi({
8
+ method: "delete",
9
+ endpoint: `v2/filter/${filterId}`
10
+ });
11
+ const createFilter = (payload) => requestApi({
12
+ method: "post",
13
+ endpoint: `v2/filter`,
14
+ data: payload
15
+ });
16
+ const updateFilter = (filterId, payload) => requestApi({
17
+ method: "put",
18
+ endpoint: `v2/filter/${filterId}`,
19
+ data: payload
20
+ });
21
+ const reorderFilter = ({ type, ordered_ids }) => requestApi({
22
+ method: "put",
23
+ endpoint: "v2/filter/reorder",
24
+ data: { type, ordered_ids }
25
+ });
26
+ const getMyFilters = ({ params }) => requestApi({
27
+ method: "get",
28
+ endpoint: "v2/filter/mine",
29
+ params
30
+ });
31
+ const reorderSmartView = ({ type, ordered_ids }) => requestApi({
32
+ method: "put",
33
+ endpoint: "v2/smart-view/reorder",
34
+ data: { type, ordered_ids }
35
+ });
36
+ const getMySmartViews = ({ params }) => requestApi({
37
+ method: "get",
38
+ endpoint: "v2/smart-view/mine",
39
+ params
40
+ });
41
+ export {
42
+ createFilter,
43
+ deleteFilter,
44
+ getFilters,
45
+ getMyFilters,
46
+ getMySmartViews,
47
+ reorderFilter,
48
+ reorderSmartView,
49
+ updateFilter
50
+ };
package/api/group.js ADDED
@@ -0,0 +1,11 @@
1
+ import { requestApi } from "../utils/request.js";
2
+ function getAllGroups(params) {
3
+ return requestApi({
4
+ method: "get",
5
+ endpoint: "/v2/all-group",
6
+ params
7
+ });
8
+ }
9
+ export {
10
+ getAllGroups
11
+ };
package/api/iam.js ADDED
@@ -0,0 +1,23 @@
1
+ import { requestApi } from "../utils/request.js";
2
+ const getWorkspaces = () => requestApi({ endpoint: "/v2/iam/workspaces" });
3
+ const getIamResources = () => requestApi({ endpoint: "/v2/iam/resources" });
4
+ const createWorkspace = (data) => requestApi({ endpoint: "/v2/iam/workspaces", method: "post", data });
5
+ const updateWorkspace = (id, data) => requestApi({ endpoint: `/v2/iam/workspaces/${id}`, method: "put", data });
6
+ const deleteWorkspace = (id) => requestApi({ endpoint: `/v2/iam/workspaces/${id}`, method: "delete" });
7
+ const getTenantRoles = (tenantId) => requestApi({ endpoint: `/v2/admin/settings/${tenantId}/roles` });
8
+ const createRole = (data) => requestApi({ endpoint: "/v2/iam/roles", method: "post", data });
9
+ const updateRole = (id, data) => requestApi({ endpoint: `/v2/iam/roles/${id}`, method: "put", data });
10
+ const deleteRole = (id) => requestApi({ endpoint: `/v2/iam/roles/${id}`, method: "delete" });
11
+ const getMyPermissions = () => requestApi({ endpoint: "/v2/iam/me/permissions" });
12
+ export {
13
+ createRole,
14
+ createWorkspace,
15
+ deleteRole,
16
+ deleteWorkspace,
17
+ getIamResources,
18
+ getMyPermissions,
19
+ getTenantRoles,
20
+ getWorkspaces,
21
+ updateRole,
22
+ updateWorkspace
23
+ };