@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,358 @@
1
+ import i18n from "../lib/i18n/index.js";
2
+ const AdvanceFilterOptionType = Object.freeze({
3
+ Text: "text",
4
+ Number: "number",
5
+ Select: "select",
6
+ AsyncSelect: "async_select",
7
+ Date: "date",
8
+ DateTime: "date_time",
9
+ Phone: "phone",
10
+ ChipInput: "chip_input",
11
+ MultiSelect: "multi_select",
12
+ SelectTag: "selectTag",
13
+ PriceInput: "price_input",
14
+ AsyncMultiSelect: "async_multi_select"
15
+ });
16
+ const RuleOperator = Object.freeze({
17
+ Equal: "eq",
18
+ NotEqual: "neq",
19
+ In: "in",
20
+ NotIn: "notin",
21
+ GreatThanEqual: "gte",
22
+ LessThanEqual: "lte",
23
+ GreatThan: "gt",
24
+ LessThan: "lt",
25
+ Between: "between",
26
+ Date_Today: "date_today",
27
+ This_Week: "this_week",
28
+ This_Month: "this_month",
29
+ Exist: "exist",
30
+ NotExist: "not-exist",
31
+ Cycle: "cycle"
32
+ });
33
+ const VALUE_INDEPENDENT_OPERATORS = [
34
+ RuleOperator.Exist,
35
+ RuleOperator.NotExist,
36
+ RuleOperator.Date_Today,
37
+ RuleOperator.This_Week,
38
+ RuleOperator.This_Month
39
+ ];
40
+ const SelectOperatorOptions = [
41
+ {
42
+ value: RuleOperator.Equal,
43
+ get label() {
44
+ return i18n.t("common:filter.equal", { defaultValue: "B\u1EB1ng" });
45
+ }
46
+ },
47
+ {
48
+ value: RuleOperator.NotEqual,
49
+ get label() {
50
+ return i18n.t("common:filter.notEqual", { defaultValue: "Kh\xF4ng b\u1EB1ng" });
51
+ }
52
+ },
53
+ {
54
+ value: RuleOperator.Exist,
55
+ get label() {
56
+ return i18n.t("common:filter.hasValue", { defaultValue: "C\xF3 gi\xE1 tr\u1ECB" });
57
+ }
58
+ },
59
+ {
60
+ value: RuleOperator.NotExist,
61
+ get label() {
62
+ return i18n.t("common:filter.noValue", {
63
+ defaultValue: "Kh\xF4ng c\xF3 gi\xE1 tr\u1ECB"
64
+ });
65
+ }
66
+ }
67
+ ];
68
+ const DateOperatorOptions = [
69
+ {
70
+ value: RuleOperator.Equal,
71
+ get label() {
72
+ return i18n.t("common:filter.today", { defaultValue: "Trong ng\xE0y" });
73
+ }
74
+ },
75
+ {
76
+ value: RuleOperator.Between,
77
+ get label() {
78
+ return i18n.t("common:filter.dateRange", {
79
+ defaultValue: "Trong kho\u1EA3ng (T\u1EEB ng\xE0y - \u0110\u1EBFn ng\xE0y)"
80
+ });
81
+ }
82
+ },
83
+ {
84
+ value: RuleOperator.GreatThan,
85
+ get label() {
86
+ return i18n.t("common:filter.afterDate", { defaultValue: "Sau ng\xE0y" });
87
+ }
88
+ },
89
+ {
90
+ value: RuleOperator.LessThan,
91
+ get label() {
92
+ return i18n.t("common:filter.beforeDate", { defaultValue: "Tr\u01B0\u1EDBc ng\xE0y" });
93
+ }
94
+ },
95
+ {
96
+ value: RuleOperator.Date_Today,
97
+ get label() {
98
+ return i18n.t("common:time.today", { defaultValue: "H\xF4m nay" });
99
+ }
100
+ },
101
+ {
102
+ value: RuleOperator.This_Week,
103
+ get label() {
104
+ return i18n.t("common:filter.thisWeek", { defaultValue: "Tu\u1EA7n n\xE0y" });
105
+ }
106
+ },
107
+ {
108
+ value: RuleOperator.This_Month,
109
+ get label() {
110
+ return i18n.t("common:filter.thisMonth", { defaultValue: "Th\xE1ng n\xE0y" });
111
+ }
112
+ },
113
+ {
114
+ value: RuleOperator.Exist,
115
+ get label() {
116
+ return i18n.t("common:filter.hasValue", { defaultValue: "C\xF3 gi\xE1 tr\u1ECB" });
117
+ }
118
+ },
119
+ {
120
+ value: RuleOperator.NotExist,
121
+ get label() {
122
+ return i18n.t("common:filter.noValue", {
123
+ defaultValue: "Kh\xF4ng c\xF3 gi\xE1 tr\u1ECB"
124
+ });
125
+ }
126
+ }
127
+ ];
128
+ const CYCLE_PRESETS = Object.freeze({
129
+ c1d: {
130
+ get label() {
131
+ return i18n.t("common:filter.after1Day", { defaultValue: "Sau 1 ng\xE0y" });
132
+ },
133
+ amount: 1,
134
+ unit: "day",
135
+ tolerance: 0
136
+ },
137
+ c3d: {
138
+ get label() {
139
+ return i18n.t("common:filter.after3Days", { defaultValue: "Sau 3 ng\xE0y" });
140
+ },
141
+ amount: 3,
142
+ unit: "day",
143
+ tolerance: 1
144
+ },
145
+ c7d: {
146
+ get label() {
147
+ return i18n.t("common:filter.after7Days", { defaultValue: "Sau 7 ng\xE0y" });
148
+ },
149
+ amount: 7,
150
+ unit: "day",
151
+ tolerance: 1
152
+ },
153
+ c14d: {
154
+ get label() {
155
+ return i18n.t("common:filter.after14Days", {
156
+ defaultValue: "Sau 14 ng\xE0y"
157
+ });
158
+ },
159
+ amount: 14,
160
+ unit: "day",
161
+ tolerance: 2
162
+ },
163
+ c21d: {
164
+ get label() {
165
+ return i18n.t("common:filter.after21Days", {
166
+ defaultValue: "Sau 21 ng\xE0y"
167
+ });
168
+ },
169
+ amount: 21,
170
+ unit: "day",
171
+ tolerance: 2
172
+ },
173
+ c1m: {
174
+ get label() {
175
+ return i18n.t("common:filter.after1Month", {
176
+ defaultValue: "Sau 1 th\xE1ng"
177
+ });
178
+ },
179
+ amount: 1,
180
+ unit: "month",
181
+ tolerance: 3
182
+ },
183
+ c3m: {
184
+ get label() {
185
+ return i18n.t("common:filter.after3Months", {
186
+ defaultValue: "Sau 3 th\xE1ng"
187
+ });
188
+ },
189
+ amount: 3,
190
+ unit: "month",
191
+ tolerance: 7
192
+ },
193
+ c6m: {
194
+ get label() {
195
+ return i18n.t("common:filter.after6Months", {
196
+ defaultValue: "Sau 6 th\xE1ng"
197
+ });
198
+ },
199
+ amount: 6,
200
+ unit: "month",
201
+ tolerance: 10
202
+ },
203
+ c9m: {
204
+ get label() {
205
+ return i18n.t("common:filter.after9Months", {
206
+ defaultValue: "Sau 9 th\xE1ng"
207
+ });
208
+ },
209
+ amount: 9,
210
+ unit: "month",
211
+ tolerance: 10
212
+ },
213
+ c12m: {
214
+ get label() {
215
+ return i18n.t("common:filter.after12Months", {
216
+ defaultValue: "Sau 12 th\xE1ng"
217
+ });
218
+ },
219
+ amount: 12,
220
+ unit: "month",
221
+ tolerance: 10
222
+ }
223
+ });
224
+ const CYCLE_PRESET_OPTIONS = Object.entries(CYCLE_PRESETS).map(
225
+ ([value, preset]) => ({ value, label: preset.label })
226
+ );
227
+ const TextOperatorOptions = [
228
+ {
229
+ value: RuleOperator.Equal,
230
+ get label() {
231
+ return i18n.t("common:filter.equal", { defaultValue: "B\u1EB1ng" });
232
+ }
233
+ },
234
+ {
235
+ value: RuleOperator.NotEqual,
236
+ get label() {
237
+ return i18n.t("common:filter.notEqual", { defaultValue: "Kh\xF4ng b\u1EB1ng" });
238
+ }
239
+ },
240
+ {
241
+ value: RuleOperator.In,
242
+ get label() {
243
+ return i18n.t("common:filter.contains", { defaultValue: "C\xF3 ch\u1EE9a" });
244
+ }
245
+ },
246
+ {
247
+ value: RuleOperator.NotIn,
248
+ get label() {
249
+ return i18n.t("common:filter.notContains", { defaultValue: "Kh\xF4ng ch\u1EE9a" });
250
+ }
251
+ },
252
+ {
253
+ value: RuleOperator.Exist,
254
+ get label() {
255
+ return i18n.t("common:filter.hasValue", { defaultValue: "C\xF3 gi\xE1 tr\u1ECB" });
256
+ }
257
+ },
258
+ {
259
+ value: RuleOperator.NotExist,
260
+ get label() {
261
+ return i18n.t("common:filter.noValue", {
262
+ defaultValue: "Kh\xF4ng c\xF3 gi\xE1 tr\u1ECB"
263
+ });
264
+ }
265
+ }
266
+ ];
267
+ const NumberOperatorOptions = [
268
+ {
269
+ value: RuleOperator.Equal,
270
+ get label() {
271
+ return i18n.t("common:filter.equal", { defaultValue: "B\u1EB1ng" });
272
+ }
273
+ },
274
+ {
275
+ value: RuleOperator.NotEqual,
276
+ get label() {
277
+ return i18n.t("common:filter.notEqual", { defaultValue: "Kh\xF4ng b\u1EB1ng" });
278
+ }
279
+ },
280
+ {
281
+ value: RuleOperator.GreatThan,
282
+ get label() {
283
+ return i18n.t("common:filter.greaterThan", { defaultValue: "L\u1EDBn h\u01A1n" });
284
+ }
285
+ },
286
+ {
287
+ value: RuleOperator.LessThan,
288
+ get label() {
289
+ return i18n.t("common:filter.lessThan", { defaultValue: "Nh\u1ECF h\u01A1n" });
290
+ }
291
+ },
292
+ {
293
+ value: RuleOperator.Exist,
294
+ get label() {
295
+ return i18n.t("common:filter.hasValue", { defaultValue: "C\xF3 gi\xE1 tr\u1ECB" });
296
+ }
297
+ },
298
+ {
299
+ value: RuleOperator.NotExist,
300
+ get label() {
301
+ return i18n.t("common:filter.noValue", {
302
+ defaultValue: "Kh\xF4ng c\xF3 gi\xE1 tr\u1ECB"
303
+ });
304
+ }
305
+ }
306
+ ];
307
+ const MultiSelectOperatorOptions = [
308
+ {
309
+ value: RuleOperator.Equal,
310
+ get label() {
311
+ return i18n.t("common:filter.equal", { defaultValue: "B\u1EB1ng" });
312
+ }
313
+ },
314
+ {
315
+ value: RuleOperator.NotEqual,
316
+ get label() {
317
+ return i18n.t("common:filter.notEqual", { defaultValue: "Kh\xF4ng b\u1EB1ng" });
318
+ }
319
+ },
320
+ {
321
+ value: RuleOperator.In,
322
+ get label() {
323
+ return i18n.t("common:filter.contains", { defaultValue: "C\xF3 ch\u1EE9a" });
324
+ }
325
+ },
326
+ {
327
+ value: RuleOperator.NotIn,
328
+ get label() {
329
+ return i18n.t("common:filter.notContains", { defaultValue: "Kh\xF4ng ch\u1EE9a" });
330
+ }
331
+ },
332
+ {
333
+ value: RuleOperator.Exist,
334
+ get label() {
335
+ return i18n.t("common:filter.hasValue", { defaultValue: "C\xF3 gi\xE1 tr\u1ECB" });
336
+ }
337
+ },
338
+ {
339
+ value: RuleOperator.NotExist,
340
+ get label() {
341
+ return i18n.t("common:filter.noValue", {
342
+ defaultValue: "Kh\xF4ng c\xF3 gi\xE1 tr\u1ECB"
343
+ });
344
+ }
345
+ }
346
+ ];
347
+ export {
348
+ AdvanceFilterOptionType,
349
+ CYCLE_PRESETS,
350
+ CYCLE_PRESET_OPTIONS,
351
+ DateOperatorOptions,
352
+ MultiSelectOperatorOptions,
353
+ NumberOperatorOptions,
354
+ RuleOperator,
355
+ SelectOperatorOptions,
356
+ TextOperatorOptions,
357
+ VALUE_INDEPENDENT_OPERATORS
358
+ };
@@ -0,0 +1,13 @@
1
+ const AutoAssignTagTrigger = Object.freeze({
2
+ // Agent bấm "Lưu liên hệ" và có SĐT mới được ghi vào contact.
3
+ // Cờ tag setting: auto_assign_on_save_contact
4
+ // context: { phones, contact_id } — `phones` gom cả SĐT chính (contact.phone)
5
+ // lẫn SĐT phụ (contact.sub_phone) vì một lần lưu ghi được cả hai.
6
+ SAVE_CONTACT: "save_contact",
7
+ // Nội dung hội thoại khớp từ khóa cấu hình trên tag.
8
+ // Cờ tag setting: auto_assign_on_keyword — context: { message_id, keywords }
9
+ KEYWORD: "keyword"
10
+ });
11
+ export {
12
+ AutoAssignTagTrigger
13
+ };