@phonghq/go-chat 1.0.53 → 1.0.55

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.
@@ -1,12 +1,14 @@
1
1
  /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { ref } from 'vue';
2
+ import { computed, ref } from 'vue';
3
3
  import IconBackspace from '../../../assets/icons/global/IconBackspace.vue';
4
- import IconPhoneBase from '../../../assets/icons/call/IconPhoneBase.vue';
5
4
  import { phoneNumberFormat, phoneNumberFormatInput } from '../../../utils/string-helper';
6
5
  import { useDebounce } from '../../../utils/debounce';
7
6
  import ConversationList from '../../../views/home/phone-numpad/ConvercationList.vue';
8
7
  import { dataProfile } from '../../../utils/chat/store/auth';
9
8
  import IconArrowLeft from '../../../assets/icons/global/IconArrowLeft.vue';
9
+ import ButtonBase from '@/components/common/button/ButtonBase.vue';
10
+ import IconPhone from '@/assets/icons/customer-detail/IconPhone.vue';
11
+ import IconMessageOutline from '@/assets/icons/global/IconMessageOutline.vue';
10
12
  const props = withDefaults(defineProps(), {});
11
13
  const emit = defineEmits();
12
14
  const phone = defineModel();
@@ -24,9 +26,11 @@ const keys = [
24
26
  { label: '0', value: '0' },
25
27
  { label: 'X', value: 'Backspace' }
26
28
  ];
29
+ const disabled = computed(() => keepOnlyNumber(phone.value ?? '').length < 10 || loading.value);
27
30
  const activeKey = ref(null);
28
31
  const activeUser = ref(null);
29
32
  const conversationListRef = ref();
33
+ const loading = ref(false);
30
34
  const handleKey = (key) => {
31
35
  if (props.disabled)
32
36
  return;
@@ -57,8 +61,29 @@ const handleInput = () => {
57
61
  function keepOnlyNumber(value) {
58
62
  return value.replace(/\D+/g, '');
59
63
  }
60
- const handleGetListKeyPad = useDebounce(() => conversationListRef.value?.getUserList(keepOnlyNumber(phone.value ?? ''), { reset: true }), 800);
61
- const handleGetListInput = useDebounce(() => conversationListRef.value?.getUserList(keepOnlyNumber(phone.value ?? ''), { reset: true }), 300);
64
+ const handleGetConversationList = (delay) => {
65
+ return useDebounce(async () => {
66
+ try {
67
+ await conversationListRef.value?.getUserList(keepOnlyNumber(phone.value ?? ''), {
68
+ reset: true
69
+ });
70
+ }
71
+ catch (e) {
72
+ console.log(e);
73
+ }
74
+ loading.value = false;
75
+ }, delay);
76
+ };
77
+ const handleGetListKeyPadDebounce = handleGetConversationList(800);
78
+ const handleGetListInputDebounce = handleGetConversationList(800);
79
+ const handleGetListKeyPad = () => {
80
+ loading.value = true;
81
+ handleGetListKeyPadDebounce();
82
+ };
83
+ const handleGetListInput = () => {
84
+ loading.value = true;
85
+ handleGetListInputDebounce();
86
+ };
62
87
  const call = () => {
63
88
  if (phone)
64
89
  conversationListRef.value?.checkActiveUserList();
@@ -134,52 +159,38 @@ __VLS_asFunctionalElement(__VLS_elements.input)({
134
159
  (__VLS_ctx.phone);
135
160
  // @ts-ignore
136
161
  [handleInput, dataProfile, phone,];
137
- __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
138
- ...{ onClick: (...[$event]) => {
139
- __VLS_ctx.call();
140
- // @ts-ignore
141
- [call,];
142
- } },
143
- ...{ class: "shrink-0 h-14 w-14 rounded-full flex-center bg-[#C7DEFF] text-chat-primary" },
144
- ...{ class: ({
145
- 'cursor-not-allowed opacity-[0.3] pointer-events-none': __VLS_ctx.keepOnlyNumber(__VLS_ctx.phone ?? '').length < 10
146
- }) },
147
- });
148
- // @ts-ignore
149
- [phone, keepOnlyNumber,];
150
- /** @type {[typeof IconPhoneBase, ]} */ ;
151
- // @ts-ignore
152
- const __VLS_4 = __VLS_asFunctionalComponent(IconPhoneBase, new IconPhoneBase({}));
153
- const __VLS_5 = __VLS_4({}, ...__VLS_functionalComponentArgsRest(__VLS_4));
154
162
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
155
163
  ...{ class: "grow overflow-hidden relative" },
156
164
  });
157
165
  /** @type {[typeof ConversationList, ]} */ ;
158
166
  // @ts-ignore
159
- const __VLS_8 = __VLS_asFunctionalComponent(ConversationList, new ConversationList({
167
+ const __VLS_4 = __VLS_asFunctionalComponent(ConversationList, new ConversationList({
160
168
  ...{ 'onSelectConversation': {} },
161
169
  ref: "conversationListRef",
162
170
  active: (__VLS_ctx.activeUser),
163
171
  }));
164
- const __VLS_9 = __VLS_8({
172
+ const __VLS_5 = __VLS_4({
165
173
  ...{ 'onSelectConversation': {} },
166
174
  ref: "conversationListRef",
167
175
  active: (__VLS_ctx.activeUser),
168
- }, ...__VLS_functionalComponentArgsRest(__VLS_8));
169
- let __VLS_11;
170
- let __VLS_12;
171
- const __VLS_13 = ({ selectConversation: {} },
176
+ }, ...__VLS_functionalComponentArgsRest(__VLS_4));
177
+ let __VLS_7;
178
+ let __VLS_8;
179
+ const __VLS_9 = ({ selectConversation: {} },
172
180
  { onSelectConversation: (__VLS_ctx.handleSelectConversation) });
173
181
  /** @type {typeof __VLS_ctx.conversationListRef} */ ;
174
- var __VLS_14 = {};
182
+ var __VLS_10 = {};
175
183
  // @ts-ignore
176
184
  [activeUser, handleSelectConversation, conversationListRef,];
177
- var __VLS_10;
185
+ var __VLS_6;
186
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
187
+ ...{ class: "shrink-0 w-full px-6 border-chat-gray-5 layout-shadow border-t" },
188
+ });
178
189
  if (!__VLS_ctx.hideNumpad) {
179
190
  // @ts-ignore
180
191
  [hideNumpad,];
181
192
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
182
- ...{ class: "shrink-0 grid grid-cols-3 w-full h-[400px] sm:h-[500px] px-6 border-chat-gray-5 layout-shadow border-t" },
193
+ ...{ class: "w-full h-[380px] sm:h-[450px] grid grid-cols-3" },
183
194
  });
184
195
  for (const [item] of __VLS_getVForSourceType((__VLS_ctx.keys))) {
185
196
  // @ts-ignore
@@ -209,15 +220,86 @@ if (!__VLS_ctx.hideNumpad) {
209
220
  __VLS_asFunctionalElement(__VLS_elements.span, __VLS_elements.span)({});
210
221
  /** @type {[typeof IconBackspace, ]} */ ;
211
222
  // @ts-ignore
212
- const __VLS_17 = __VLS_asFunctionalComponent(IconBackspace, new IconBackspace({
213
- ...{ class: "w-14" },
223
+ const __VLS_13 = __VLS_asFunctionalComponent(IconBackspace, new IconBackspace({
224
+ ...{ class: "w-12" },
214
225
  }));
215
- const __VLS_18 = __VLS_17({
216
- ...{ class: "w-14" },
217
- }, ...__VLS_functionalComponentArgsRest(__VLS_17));
226
+ const __VLS_14 = __VLS_13({
227
+ ...{ class: "w-12" },
228
+ }, ...__VLS_functionalComponentArgsRest(__VLS_13));
218
229
  }
219
230
  }
220
231
  }
232
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
233
+ ...{ class: "w-full grid grid-cols-2 gap-4 py-7" },
234
+ });
235
+ /** @type {[typeof ButtonBase, typeof ButtonBase, ]} */ ;
236
+ // @ts-ignore
237
+ const __VLS_17 = __VLS_asFunctionalComponent(ButtonBase, new ButtonBase({
238
+ ...{ 'onClick': {} },
239
+ ...{ class: "rounded-full h-12 shadow-lg" },
240
+ ...{ class: ({
241
+ 'cursor-not-allowed opacity-[0.3] pointer-events-none': __VLS_ctx.disabled
242
+ }) },
243
+ type: "success",
244
+ }));
245
+ const __VLS_18 = __VLS_17({
246
+ ...{ 'onClick': {} },
247
+ ...{ class: "rounded-full h-12 shadow-lg" },
248
+ ...{ class: ({
249
+ 'cursor-not-allowed opacity-[0.3] pointer-events-none': __VLS_ctx.disabled
250
+ }) },
251
+ type: "success",
252
+ }, ...__VLS_functionalComponentArgsRest(__VLS_17));
253
+ let __VLS_20;
254
+ let __VLS_21;
255
+ const __VLS_22 = ({ click: {} },
256
+ { onClick: (...[$event]) => {
257
+ __VLS_ctx.call();
258
+ // @ts-ignore
259
+ [disabled, call,];
260
+ } });
261
+ const { default: __VLS_23 } = __VLS_19.slots;
262
+ /** @type {[typeof IconPhone, ]} */ ;
263
+ // @ts-ignore
264
+ const __VLS_24 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({
265
+ weight: (2),
266
+ }));
267
+ const __VLS_25 = __VLS_24({
268
+ weight: (2),
269
+ }, ...__VLS_functionalComponentArgsRest(__VLS_24));
270
+ var __VLS_19;
271
+ /** @type {[typeof ButtonBase, typeof ButtonBase, ]} */ ;
272
+ // @ts-ignore
273
+ const __VLS_28 = __VLS_asFunctionalComponent(ButtonBase, new ButtonBase({
274
+ ...{ 'onClick': {} },
275
+ ...{ class: "rounded-full h-12 shadow-lg" },
276
+ ...{ class: ({
277
+ 'cursor-not-allowed opacity-[0.3] pointer-events-none': true
278
+ }) },
279
+ type: "primary",
280
+ }));
281
+ const __VLS_29 = __VLS_28({
282
+ ...{ 'onClick': {} },
283
+ ...{ class: "rounded-full h-12 shadow-lg" },
284
+ ...{ class: ({
285
+ 'cursor-not-allowed opacity-[0.3] pointer-events-none': true
286
+ }) },
287
+ type: "primary",
288
+ }, ...__VLS_functionalComponentArgsRest(__VLS_28));
289
+ let __VLS_31;
290
+ let __VLS_32;
291
+ const __VLS_33 = ({ click: {} },
292
+ { onClick: (...[$event]) => {
293
+ __VLS_ctx.call();
294
+ // @ts-ignore
295
+ [call,];
296
+ } });
297
+ const { default: __VLS_34 } = __VLS_30.slots;
298
+ /** @type {[typeof IconMessageOutline, ]} */ ;
299
+ // @ts-ignore
300
+ const __VLS_35 = __VLS_asFunctionalComponent(IconMessageOutline, new IconMessageOutline({}));
301
+ const __VLS_36 = __VLS_35({}, ...__VLS_functionalComponentArgsRest(__VLS_35));
302
+ var __VLS_30;
221
303
  /** @type {__VLS_StyleScopedClasses['w-[480px]']} */ ;
222
304
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
223
305
  /** @type {__VLS_StyleScopedClasses['flex']} */ ;
@@ -242,29 +324,20 @@ if (!__VLS_ctx.hideNumpad) {
242
324
  /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
243
325
  /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
244
326
  /** @type {__VLS_StyleScopedClasses['text-xl']} */ ;
245
- /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
246
- /** @type {__VLS_StyleScopedClasses['h-14']} */ ;
247
- /** @type {__VLS_StyleScopedClasses['w-14']} */ ;
248
- /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
249
- /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
250
- /** @type {__VLS_StyleScopedClasses['bg-[#C7DEFF]']} */ ;
251
- /** @type {__VLS_StyleScopedClasses['text-chat-primary']} */ ;
252
- /** @type {__VLS_StyleScopedClasses['cursor-not-allowed']} */ ;
253
- /** @type {__VLS_StyleScopedClasses['opacity-[0.3]']} */ ;
254
- /** @type {__VLS_StyleScopedClasses['pointer-events-none']} */ ;
255
327
  /** @type {__VLS_StyleScopedClasses['grow']} */ ;
256
328
  /** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
257
329
  /** @type {__VLS_StyleScopedClasses['relative']} */ ;
258
330
  /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
259
- /** @type {__VLS_StyleScopedClasses['grid']} */ ;
260
- /** @type {__VLS_StyleScopedClasses['grid-cols-3']} */ ;
261
331
  /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
262
- /** @type {__VLS_StyleScopedClasses['h-[400px]']} */ ;
263
- /** @type {__VLS_StyleScopedClasses['sm:h-[500px]']} */ ;
264
332
  /** @type {__VLS_StyleScopedClasses['px-6']} */ ;
265
333
  /** @type {__VLS_StyleScopedClasses['border-chat-gray-5']} */ ;
266
334
  /** @type {__VLS_StyleScopedClasses['layout-shadow']} */ ;
267
335
  /** @type {__VLS_StyleScopedClasses['border-t']} */ ;
336
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
337
+ /** @type {__VLS_StyleScopedClasses['h-[380px]']} */ ;
338
+ /** @type {__VLS_StyleScopedClasses['sm:h-[450px]']} */ ;
339
+ /** @type {__VLS_StyleScopedClasses['grid']} */ ;
340
+ /** @type {__VLS_StyleScopedClasses['grid-cols-3']} */ ;
268
341
  /** @type {__VLS_StyleScopedClasses['text-3xl']} */ ;
269
342
  /** @type {__VLS_StyleScopedClasses['sm:text-[40px]']} */ ;
270
343
  /** @type {__VLS_StyleScopedClasses['flex-center']} */ ;
@@ -272,9 +345,26 @@ if (!__VLS_ctx.hideNumpad) {
272
345
  /** @type {__VLS_StyleScopedClasses['bg-chat-haze-200']} */ ;
273
346
  /** @type {__VLS_StyleScopedClasses['opacity-[0.6]']} */ ;
274
347
  /** @type {__VLS_StyleScopedClasses['cursor-not-allowed']} */ ;
275
- /** @type {__VLS_StyleScopedClasses['w-14']} */ ;
348
+ /** @type {__VLS_StyleScopedClasses['w-12']} */ ;
349
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
350
+ /** @type {__VLS_StyleScopedClasses['grid']} */ ;
351
+ /** @type {__VLS_StyleScopedClasses['grid-cols-2']} */ ;
352
+ /** @type {__VLS_StyleScopedClasses['gap-4']} */ ;
353
+ /** @type {__VLS_StyleScopedClasses['py-7']} */ ;
354
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
355
+ /** @type {__VLS_StyleScopedClasses['h-12']} */ ;
356
+ /** @type {__VLS_StyleScopedClasses['shadow-lg']} */ ;
357
+ /** @type {__VLS_StyleScopedClasses['cursor-not-allowed']} */ ;
358
+ /** @type {__VLS_StyleScopedClasses['opacity-[0.3]']} */ ;
359
+ /** @type {__VLS_StyleScopedClasses['pointer-events-none']} */ ;
360
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
361
+ /** @type {__VLS_StyleScopedClasses['h-12']} */ ;
362
+ /** @type {__VLS_StyleScopedClasses['shadow-lg']} */ ;
363
+ /** @type {__VLS_StyleScopedClasses['cursor-not-allowed']} */ ;
364
+ /** @type {__VLS_StyleScopedClasses['opacity-[0.3]']} */ ;
365
+ /** @type {__VLS_StyleScopedClasses['pointer-events-none']} */ ;
276
366
  // @ts-ignore
277
- var __VLS_15 = __VLS_14;
367
+ var __VLS_11 = __VLS_10;
278
368
  const __VLS_export = (await import('vue')).defineComponent({
279
369
  setup: () => (__VLS_exposed),
280
370
  __typeEmits: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phonghq/go-chat",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"
@@ -32,7 +32,7 @@
32
32
  "loglevel": "^1.8.0",
33
33
  "lucide-react": "^0.546.0",
34
34
  "lucide-vue-next": "^0.536.0",
35
- "mqtt": "^4.3.7",
35
+ "mqtt": "^5.14.1",
36
36
  "pinia": "^2.1.7",
37
37
  "plivo-browser-sdk": "^2.2.21",
38
38
  "pocketbase": "^0.26.5",