@phonghq/go-chat 1.0.11 → 1.0.14

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 (65) hide show
  1. package/dist/assets/icons/IconAiCheck.vue.d.ts +2 -0
  2. package/dist/assets/icons/call/IconClose.vue.d.ts +2 -0
  3. package/dist/assets/icons/call/IconSoundDownload.vue.d.ts +2 -0
  4. package/dist/chat/App.vue.d.ts +7 -2
  5. package/dist/chat/page/customer-detail/CustomerDetail.vue.d.ts +1 -1
  6. package/dist/chat/page/home/ChatList.vue.d.ts +29 -1
  7. package/dist/chat/page/home/ChatMessage.vue.d.ts +2 -1
  8. package/dist/chat/page/home/Home.vue.d.ts +1 -1
  9. package/dist/components/chat/ScrollEvent/ScrollEvent.vue.d.ts +1 -0
  10. package/dist/components/chat/call/Calling.vue.d.ts +8 -2
  11. package/dist/components/chat/common/input/InputSearch.vue.d.ts +1 -1
  12. package/dist/components/chat/select/SelectBase.vue.d.ts +22 -0
  13. package/dist/components/common/drawer/DrawerBase.vue.d.ts +1 -1
  14. package/dist/components/common/modal/ModalBase.vue.d.ts +1 -1
  15. package/dist/composable/useCallHelper.d.ts +7 -2
  16. package/dist/composable/useInitData.d.ts +2 -4
  17. package/dist/composable/usePlivo.d.ts +9 -0
  18. package/dist/go-chat.es.js +14676 -12322
  19. package/dist/go-chat.umd.js +44 -14
  20. package/dist/plugins/websocket.d.ts +12 -2
  21. package/dist/router/index.d.ts +2 -0
  22. package/dist/style.css +1 -1
  23. package/dist/test/assets/icons/IconAiCheck.vue.js +28 -0
  24. package/dist/test/assets/icons/call/IconClose.vue.js +26 -0
  25. package/dist/test/assets/icons/call/IconMic.vue.js +9 -9
  26. package/dist/test/assets/icons/call/IconSoundDownload.vue.js +50 -0
  27. package/dist/test/chat/App.vue.js +144 -90
  28. package/dist/test/chat/page/customer-detail/CustomerDetail.vue.js +6 -5
  29. package/dist/test/chat/page/home/ChatList.vue.js +30 -9
  30. package/dist/test/chat/page/home/ChatMessage.vue.js +23 -12
  31. package/dist/test/chat/page/home/Home.vue.js +4 -3
  32. package/dist/test/chat/page/home/NewCustomer.vue.js +0 -12
  33. package/dist/test/components/chat/ScrollEvent/ScrollEvent.vue.js +7 -1
  34. package/dist/test/components/chat/call/Calling.vue.js +277 -111
  35. package/dist/test/components/chat/common/input/InputSearch.vue.js +2 -2
  36. package/dist/test/components/chat/select/SelectBase.vue.js +98 -0
  37. package/dist/test/components/common/drawer/DrawerBaseCustom.vue.js +0 -1
  38. package/dist/test/composable/data.json +32 -0
  39. package/dist/test/composable/useCallHelper.js +146 -33
  40. package/dist/test/composable/useDigibot.js +1 -1
  41. package/dist/test/composable/useInitData.js +17 -12
  42. package/dist/test/composable/usePlivo.js +138 -0
  43. package/dist/test/constant/color.js +1 -1
  44. package/dist/test/plugins/axios.js +2 -1
  45. package/dist/test/plugins/mqtt.js +11 -8
  46. package/dist/test/plugins/websocket.js +108 -19
  47. package/dist/test/router/index.js +39 -0
  48. package/dist/test/types/call.js +10 -1
  49. package/dist/test/utils/chat/auth.js +10 -2
  50. package/dist/test/utils/chat/call.js +48 -8
  51. package/dist/test/utils/chat/phone-string.js +4 -0
  52. package/dist/test/utils/chat/user.js +7 -2
  53. package/dist/test/views/NotFound.vue.js +47 -0
  54. package/dist/test/views/TenantPhone.vue.js +270 -0
  55. package/dist/types/call.d.ts +9 -0
  56. package/dist/types/chat/global.d.ts +4 -0
  57. package/dist/utils/chat/auth.d.ts +5 -1
  58. package/dist/utils/chat/call.d.ts +6 -2
  59. package/dist/utils/chat/phone-string.d.ts +1 -0
  60. package/dist/utils/chat/user.d.ts +4 -0
  61. package/dist/views/NotFound.vue.d.ts +2 -0
  62. package/dist/views/TenantPhone.vue.d.ts +2 -0
  63. package/package.json +2 -1
  64. package/dist/composable/TestSound.d.ts +0 -64
  65. package/dist/test/composable/TestSound.js +0 -196
@@ -1,50 +1,72 @@
1
- /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { ref, onMounted, onUnmounted, watch, computed } from 'vue';
1
+ import { computed, onMounted, onUnmounted, ref } from 'vue';
3
2
  import IconPhone from '../../../assets/icons/call/IconPhone.vue';
4
3
  import { dataProfile } from '../../../utils/chat/auth.js';
5
4
  import { useCallHelper } from '../../../composable/useCallHelper';
6
5
  import IconPhoneCancel from '../../../assets/icons/call/IconPhoneCancel.vue';
7
- import { addHandleWebSK, removeHandleWebSK } from '../../../plugins/websocket';
8
- import { callClient } from '../../../utils/chat/call';
9
- import { useAudioStream } from '../../../composable/TestSound';
6
+ import { removeHandleWebSK } from '../../../plugins/websocket';
7
+ import { downloadRecord } from '../../../utils/chat/call';
10
8
  import DrawerBaseCustom from '../../../components/common/drawer/DrawerBaseCustom.vue';
11
9
  import Avatar from '../../../components/chat/customer/Avatar.vue';
12
- const { handleOffer, handleOfferResponse, call, end, userRemoter, handleMedia, startIncomingCall } = useCallHelper();
13
- const { enqueueSpeakerChunk, processSpeakerQueue } = useAudioStream('');
14
- const props = withDefaults(defineProps(), {});
15
- const STATUS = {
16
- CONNECTING: 'Connecting...',
17
- CALLING: 'calling',
18
- RINGING: 'ringing',
19
- CONNECT_FAILED: 'Connect Error',
20
- CALL_START: 'in-progress',
21
- CALL_END: 'completed'
10
+ import { getUserDetailChat } from '../../../utils/chat/user';
11
+ import { formatPhone10number } from '../../../utils/chat/phone-string';
12
+ import IconSoundDownload from '../../../assets/icons/call/IconSoundDownload.vue';
13
+ import IconClose from '../../../assets/icons/call/IconClose.vue';
14
+ import { usePlivo } from '../../../composable/usePlivo';
15
+ import { PLIVO_CALL_STATUS } from '../../../types/call';
16
+ import IconMic from '../../../assets/icons/call/IconMic.vue';
17
+ const { call, end, handleMedia, startIncomingCall, handleCallAnswer, callAnswer, uuid, startPeerConnection } = useCallHelper();
18
+ const handlePlivoCallBack = (status, data) => {
19
+ if (status == PLIVO_CALL_STATUS.RINGING) {
20
+ getUserOffer(data?.phone ?? '');
21
+ callStatus.value = PLIVO_CALL_STATUS.RINGING;
22
+ open();
23
+ }
24
+ else if (status == PLIVO_CALL_STATUS.CONNECT_FAILED || status == PLIVO_CALL_STATUS.NO_ANSWER) {
25
+ endCall();
26
+ callStatus.value = status;
27
+ }
28
+ else if (status == PLIVO_CALL_STATUS.CALL_END) {
29
+ errorMessage.value = data?.message ?? '';
30
+ endCall();
31
+ callStatus.value = status;
32
+ }
33
+ else if (status == PLIVO_CALL_STATUS.CALL_START) {
34
+ callStatus.value = status;
35
+ startTimer();
36
+ }
22
37
  };
38
+ const { plivoLogin, plivoCallAnswer, plivoCall, plivoEndCall, plivoCallSwishMute } = usePlivo(handlePlivoCallBack);
39
+ const props = withDefaults(defineProps(), {});
40
+ const emit = defineEmits();
23
41
  const STATUS_LABEL = computed(() => {
24
42
  return {
25
- [STATUS.CONNECTING]: 'Connecting...',
26
- [STATUS.CALLING]: 'Calling...',
27
- [STATUS.RINGING]: 'Ringing...',
28
- [STATUS.CONNECT_FAILED]: errorMessage.value || 'Connect Error',
29
- [STATUS.CALL_START]: '',
30
- [STATUS.CALL_END]: 'Call Ended'
43
+ [PLIVO_CALL_STATUS.CONNECTING]: 'Connecting...',
44
+ [PLIVO_CALL_STATUS.CALLING]: 'Calling...',
45
+ [PLIVO_CALL_STATUS.RINGING]: 'Ringing...',
46
+ [PLIVO_CALL_STATUS.CONNECT_FAILED]: errorMessage.value || 'Connect Error',
47
+ [PLIVO_CALL_STATUS.CALL_START]: '',
48
+ [PLIVO_CALL_STATUS.CALL_END]: errorMessage.value || 'Call Ended',
49
+ [PLIVO_CALL_STATUS.NO_ANSWER]: 'No Answer'
31
50
  };
32
51
  });
33
- const callStatus = ref(STATUS.CONNECTING);
52
+ const callStatus = ref(PLIVO_CALL_STATUS.CONNECTING);
34
53
  const duration = ref('00:00');
35
54
  const drawerVisible = ref(false);
36
55
  const disable = ref(false);
37
56
  const errorMessage = ref('');
57
+ const record_link = ref('');
38
58
  const drawerVisibleRef = ref(null);
59
+ const userRemoter = ref(null);
60
+ const isMute = ref(false);
39
61
  let timer = null;
40
62
  let timeOut = null;
41
- onMounted(() => {
42
- // timeOut = setTimeout(() => {
43
- // callStatus.value = 'Connected'
44
- // startTimer()
45
- // }, 2000)
63
+ let callType = 'call';
64
+ let uuidEnd = '';
65
+ onMounted(async () => {
66
+ await plivoLogin('');
46
67
  });
47
68
  onUnmounted(() => {
69
+ removeHandleWebSK('call-message');
48
70
  if (timer)
49
71
  clearInterval(timer);
50
72
  if (timeOut)
@@ -61,92 +83,133 @@ function startTimer() {
61
83
  duration.value = `${m}:${s}`;
62
84
  }, 1000);
63
85
  }
64
- function toggleMute() {
65
- alert('Mic toggled');
66
- }
67
- function toggleSpeaker() {
68
- alert('Speaker toggled');
69
- }
70
- function endCall() {
71
- callStatus.value = STATUS.CALL_END;
72
- end('');
86
+ function endCall(option) {
87
+ plivoEndCall(callStatus.value);
88
+ callStatus.value = PLIVO_CALL_STATUS.CALL_END;
89
+ uuidEnd = uuid.value;
73
90
  clearInterval(timer);
74
91
  disable.value = false;
75
- drawerVisible.value = false;
76
- drawerVisibleRef.value?.close();
92
+ if (option?.closeModal) {
93
+ drawerVisible.value = false;
94
+ drawerVisibleRef.value?.close();
95
+ }
96
+ isMute.value = false;
97
+ duration.value = '00:00';
77
98
  if (timer)
78
99
  clearInterval(timer);
79
100
  if (timeOut)
80
101
  clearTimeout(timeOut);
81
- errorMessage.value = '';
82
102
  }
83
103
  const open = () => {
84
104
  drawerVisible.value = true;
85
105
  disable.value = true;
86
106
  drawerVisibleRef.value?.open();
87
107
  };
108
+ const handleMute = () => {
109
+ plivoCallSwishMute(!isMute.value);
110
+ isMute.value = !isMute.value;
111
+ };
88
112
  const startCall = async (data) => {
89
113
  try {
90
- callStatus.value = STATUS.CONNECTING;
114
+ callStatus.value = PLIVO_CALL_STATUS.CONNECTING;
115
+ userRemoter.value = data;
91
116
  open();
92
- await call(data);
93
- callStatus.value = STATUS.CALLING;
117
+ callType = 'call';
118
+ await plivoCall(data.phone);
119
+ callStatus.value = PLIVO_CALL_STATUS.CALLING;
94
120
  }
95
121
  catch (e) {
122
+ endCall();
96
123
  console.log(e);
97
124
  errorMessage.value = e?.message || JSON.stringify(e);
98
- callStatus.value = STATUS.CONNECT_FAILED;
125
+ callStatus.value = PLIVO_CALL_STATUS.CONNECT_FAILED;
99
126
  }
100
127
  };
101
- const answer = async () => {
102
- await callClient(dataWebSK);
103
- callStatus.value = STATUS.CALL_START;
104
- // sendOfferOk()
105
- };
106
- const handleMqttMessage = async (message) => {
107
- let da = true;
108
- if (message?.data?.status == STATUS.RINGING) {
109
- if (message?.data?.to_number == dataProfile.value?.phone) {
110
- callStatus.value = STATUS.RINGING;
111
- dataWebSK = {
112
- from: message.data.from_number,
113
- to: message.data.to_number
114
- };
115
- open();
116
- }
117
- }
118
- else if (message?.data?.status == STATUS.CALL_START) {
119
- try {
120
- await startIncomingCall();
121
- startTimer();
122
- callStatus.value = STATUS.CALL_START;
123
- }
124
- catch (e) {
125
- console.log(e);
126
- endCall();
127
- }
128
+ const answer = async (message) => {
129
+ try {
130
+ await plivoCallAnswer();
128
131
  }
129
- else if (message?.data?.status == STATUS.CALL_END) {
132
+ catch (e) {
130
133
  endCall();
134
+ callStatus.value = PLIVO_CALL_STATUS.CONNECT_FAILED;
135
+ errorMessage.value = e?.message || JSON.stringify(e);
136
+ }
137
+ };
138
+ const getUserOffer = async (phone) => {
139
+ let res = null;
140
+ try {
141
+ userRemoter.value = null;
142
+ let data = {
143
+ phone: formatPhone10number(phone, '1'),
144
+ client_id: dataProfile.value?.tenant_id ?? ''
145
+ };
146
+ res = await getUserDetailChat(data);
131
147
  }
132
- else {
133
- da = false;
134
- handleMedia(message);
148
+ catch (e) {
149
+ console.log(e);
135
150
  }
136
- if (da)
137
- console.log(message);
151
+ const user = {
152
+ username: res?.full_name || 'Unknown Name',
153
+ phone: '1' + res?.phone
154
+ };
155
+ userRemoter.value = user;
156
+ emit('userCalling', userRemoter.value);
157
+ };
158
+ // const handleMqttMessage = async (message: any) => {
159
+ // console.log(message)
160
+ // let da = true
161
+ // if (message.event == 'call_update') {
162
+ // if (message?.data?.status == PLIVO_CALL_STATUS.RINGING) {
163
+ // if (message?.data?.to_number == dataProfile.value?.phone) {
164
+ // callStatus.value = PLIVO_CALL_STATUS.RINGING
165
+ // dataWebSK = {
166
+ // from: message.data.from_number,
167
+ // to: message.data.to_number
168
+ // }
169
+ // getUserOffer(message.data.from_number)
170
+ // handleCallAnswer(message)
171
+ // open()
172
+ // }
173
+ // } else if (message?.data?.status == PLIVO_CALL_STATUS.CALL_START) {
174
+ // try {
175
+ // await startIncomingCall(message?.data?.call_uuid)
176
+ // startTimer()
177
+ // callStatus.value = PLIVO_CALL_STATUS.CALL_START
178
+ // } catch (e) {
179
+ // console.log(e)
180
+ // endCall()
181
+ // }
182
+ // } else if (message?.data?.status == PLIVO_CALL_STATUS.CALL_END) {
183
+ // endCall()
184
+ // } else if (
185
+ // message?.data?.status == PLIVO_CALL_STATUS.CONNECT_FAILED ||
186
+ // message?.data?.status == PLIVO_CALL_STATUS.NO_ANSWER
187
+ // ) {
188
+ // endCall()
189
+ // callStatus.value = message?.data?.status
190
+ // } else {
191
+ // // console.log(message)
192
+ // da = false
193
+ // // handleMedia(message)
194
+ // }
195
+ // } else if (message?.event == 'record_uploaded') {
196
+ // if (uuidEnd == message?.data?.call_uuid) {
197
+ // record_link.value = message?.data?.recording_url
198
+ // }
199
+ // }
200
+ //
201
+ // // if (da){
202
+ // // } else console.log('-----------------', message)
203
+ // }
204
+ const exportRecordFile = async () => {
205
+ downloadRecord(record_link.value);
206
+ };
207
+ const handleAfterClose = () => {
208
+ record_link.value = '';
209
+ uuidEnd = '';
138
210
  };
139
211
  const __VLS_exposed = { startCall, endCall };
140
212
  defineExpose(__VLS_exposed);
141
- watch(dataProfile, async (newValue, oldValue) => {
142
- if (oldValue?.id && oldValue?.id != newValue?.id) {
143
- removeHandleWebSK('call-message');
144
- }
145
- if (newValue?.id && oldValue?.id != newValue?.id) {
146
- addHandleWebSK('call-message', handleMqttMessage);
147
- addHandleWebSK('call-message', handleMqttMessage);
148
- }
149
- }, { immediate: true });
150
213
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
151
214
  const __VLS_defaults = {};
152
215
  const __VLS_ctx = {
@@ -154,6 +217,7 @@ const __VLS_ctx = {
154
217
  ...{},
155
218
  ...{},
156
219
  ...{},
220
+ ...{},
157
221
  };
158
222
  let __VLS_elements;
159
223
  let __VLS_components;
@@ -161,24 +225,30 @@ let __VLS_directives;
161
225
  /** @type {[typeof DrawerBaseCustom, typeof DrawerBaseCustom, ]} */ ;
162
226
  // @ts-ignore
163
227
  const __VLS_0 = __VLS_asFunctionalComponent(DrawerBaseCustom, new DrawerBaseCustom({
228
+ ...{ 'onAfterClose': {} },
164
229
  ref: "drawerVisibleRef",
165
230
  width: (500),
166
231
  disabledClose: (__VLS_ctx.disable),
167
232
  responsive: (__VLS_ctx.responsive),
168
233
  }));
169
234
  const __VLS_1 = __VLS_0({
235
+ ...{ 'onAfterClose': {} },
170
236
  ref: "drawerVisibleRef",
171
237
  width: (500),
172
238
  disabledClose: (__VLS_ctx.disable),
173
239
  responsive: (__VLS_ctx.responsive),
174
240
  }, ...__VLS_functionalComponentArgsRest(__VLS_0));
241
+ let __VLS_3;
242
+ let __VLS_4;
243
+ const __VLS_5 = ({ afterClose: {} },
244
+ { onAfterClose: (__VLS_ctx.handleAfterClose) });
175
245
  /** @type {typeof __VLS_ctx.drawerVisibleRef} */ ;
176
- var __VLS_3 = {};
177
- const { default: __VLS_5 } = __VLS_2.slots;
246
+ var __VLS_6 = {};
247
+ const { default: __VLS_8 } = __VLS_2.slots;
178
248
  // @ts-ignore
179
- [disable, responsive, drawerVisibleRef,];
249
+ [disable, responsive, handleAfterClose, drawerVisibleRef,];
180
250
  {
181
- const { content: __VLS_6 } = __VLS_2.slots;
251
+ const { content: __VLS_9 } = __VLS_2.slots;
182
252
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
183
253
  ...{ class: "flex flex-col items-center justify-center h-full bg-chat-haze-300 text-white relative" },
184
254
  });
@@ -187,7 +257,7 @@ const { default: __VLS_5 } = __VLS_2.slots;
187
257
  });
188
258
  /** @type {[typeof Avatar, ]} */ ;
189
259
  // @ts-ignore
190
- const __VLS_7 = __VLS_asFunctionalComponent(Avatar, new Avatar({
260
+ const __VLS_10 = __VLS_asFunctionalComponent(Avatar, new Avatar({
191
261
  ...{ class: "" },
192
262
  src: (__VLS_ctx.userRemoter?.avatar ?? ''),
193
263
  id: (__VLS_ctx.userRemoter?.id ?? ''),
@@ -195,14 +265,14 @@ const { default: __VLS_5 } = __VLS_2.slots;
195
265
  name: (__VLS_ctx.userRemoter?.username),
196
266
  size: "xxl",
197
267
  }));
198
- const __VLS_8 = __VLS_7({
268
+ const __VLS_11 = __VLS_10({
199
269
  ...{ class: "" },
200
270
  src: (__VLS_ctx.userRemoter?.avatar ?? ''),
201
271
  id: (__VLS_ctx.userRemoter?.id ?? ''),
202
272
  color: (__VLS_ctx.userRemoter?.color),
203
273
  name: (__VLS_ctx.userRemoter?.username),
204
274
  size: "xxl",
205
- }, ...__VLS_functionalComponentArgsRest(__VLS_7));
275
+ }, ...__VLS_functionalComponentArgsRest(__VLS_10));
206
276
  // @ts-ignore
207
277
  [userRemoter, userRemoter, userRemoter, userRemoter,];
208
278
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
@@ -223,9 +293,9 @@ const { default: __VLS_5 } = __VLS_2.slots;
223
293
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
224
294
  ...{ class: "flex items-center justify-center gap-8 mt-10" },
225
295
  });
226
- if (__VLS_ctx.callStatus == __VLS_ctx.STATUS.RINGING) {
296
+ if (__VLS_ctx.callStatus == __VLS_ctx.PLIVO_CALL_STATUS.RINGING) {
227
297
  // @ts-ignore
228
- [callStatus, STATUS,];
298
+ [callStatus, PLIVO_CALL_STATUS,];
229
299
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
230
300
  ...{ onClick: (__VLS_ctx.answer) },
231
301
  ...{ class: "w-16 h-16 bg-[#22C55E] hover:bg-green-600 text-white rounded-full flex items-center justify-center shadow-lg transition" },
@@ -234,19 +304,85 @@ const { default: __VLS_5 } = __VLS_2.slots;
234
304
  [answer,];
235
305
  /** @type {[typeof IconPhone, ]} */ ;
236
306
  // @ts-ignore
237
- const __VLS_11 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({}));
238
- const __VLS_12 = __VLS_11({}, ...__VLS_functionalComponentArgsRest(__VLS_11));
307
+ const __VLS_14 = __VLS_asFunctionalComponent(IconPhone, new IconPhone({}));
308
+ const __VLS_15 = __VLS_14({}, ...__VLS_functionalComponentArgsRest(__VLS_14));
309
+ }
310
+ if (__VLS_ctx.record_link && __VLS_ctx.callStatus == __VLS_ctx.PLIVO_CALL_STATUS.CALL_END) {
311
+ // @ts-ignore
312
+ [callStatus, PLIVO_CALL_STATUS, record_link,];
313
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
314
+ ...{ onClick: (__VLS_ctx.exportRecordFile) },
315
+ href: (__VLS_ctx.record_link),
316
+ download: "recording.mp3",
317
+ ...{ class: "w-16 h-16 bg-white hover:bg-green-600 text-white rounded-full flex items-center justify-center shadow-lg transition" },
318
+ });
319
+ // @ts-ignore
320
+ [record_link, exportRecordFile,];
321
+ /** @type {[typeof IconSoundDownload, ]} */ ;
322
+ // @ts-ignore
323
+ const __VLS_18 = __VLS_asFunctionalComponent(IconSoundDownload, new IconSoundDownload({}));
324
+ const __VLS_19 = __VLS_18({}, ...__VLS_functionalComponentArgsRest(__VLS_18));
325
+ }
326
+ if (__VLS_ctx.callStatus == __VLS_ctx.PLIVO_CALL_STATUS.CALL_START) {
327
+ // @ts-ignore
328
+ [callStatus, PLIVO_CALL_STATUS,];
329
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
330
+ ...{ onClick: (...[$event]) => {
331
+ if (!(__VLS_ctx.callStatus == __VLS_ctx.PLIVO_CALL_STATUS.CALL_START))
332
+ return;
333
+ __VLS_ctx.handleMute();
334
+ // @ts-ignore
335
+ [handleMute,];
336
+ } },
337
+ ...{ class: "w-16 h-16 bg-white hover:bg-green-600 text-black rounded-full flex items-center justify-center shadow-lg transition" },
338
+ });
339
+ /** @type {[typeof IconMic, ]} */ ;
340
+ // @ts-ignore
341
+ const __VLS_22 = __VLS_asFunctionalComponent(IconMic, new IconMic({
342
+ mute: (__VLS_ctx.isMute),
343
+ }));
344
+ const __VLS_23 = __VLS_22({
345
+ mute: (__VLS_ctx.isMute),
346
+ }, ...__VLS_functionalComponentArgsRest(__VLS_22));
347
+ // @ts-ignore
348
+ [isMute,];
349
+ }
350
+ if (__VLS_ctx.callStatus == __VLS_ctx.PLIVO_CALL_STATUS.CALL_END) {
351
+ // @ts-ignore
352
+ [callStatus, PLIVO_CALL_STATUS,];
353
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
354
+ ...{ onClick: (...[$event]) => {
355
+ if (!(__VLS_ctx.callStatus == __VLS_ctx.PLIVO_CALL_STATUS.CALL_END))
356
+ return;
357
+ __VLS_ctx.endCall({ closeModal: true });
358
+ // @ts-ignore
359
+ [endCall,];
360
+ } },
361
+ ...{ class: "w-16 h-16 bg-white hover:bg-green-600 text-white rounded-full flex items-center justify-center shadow-lg transition" },
362
+ });
363
+ /** @type {[typeof IconClose, ]} */ ;
364
+ // @ts-ignore
365
+ const __VLS_26 = __VLS_asFunctionalComponent(IconClose, new IconClose({}));
366
+ const __VLS_27 = __VLS_26({}, ...__VLS_functionalComponentArgsRest(__VLS_26));
367
+ }
368
+ if (__VLS_ctx.callStatus != __VLS_ctx.PLIVO_CALL_STATUS.CALL_END) {
369
+ // @ts-ignore
370
+ [callStatus, PLIVO_CALL_STATUS,];
371
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
372
+ ...{ onClick: (...[$event]) => {
373
+ if (!(__VLS_ctx.callStatus != __VLS_ctx.PLIVO_CALL_STATUS.CALL_END))
374
+ return;
375
+ __VLS_ctx.endCall();
376
+ // @ts-ignore
377
+ [endCall,];
378
+ } },
379
+ ...{ class: "w-16 h-16 rounded-full bg-[#EF4444] hover:bg-red-700 flex items-center justify-center" },
380
+ });
381
+ /** @type {[typeof IconPhoneCancel, ]} */ ;
382
+ // @ts-ignore
383
+ const __VLS_30 = __VLS_asFunctionalComponent(IconPhoneCancel, new IconPhoneCancel({}));
384
+ const __VLS_31 = __VLS_30({}, ...__VLS_functionalComponentArgsRest(__VLS_30));
239
385
  }
240
- __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
241
- ...{ onClick: (__VLS_ctx.endCall) },
242
- ...{ class: "w-16 h-16 rounded-full bg-[#EF4444] hover:bg-red-700 flex items-center justify-center" },
243
- });
244
- // @ts-ignore
245
- [endCall,];
246
- /** @type {[typeof IconPhoneCancel, ]} */ ;
247
- // @ts-ignore
248
- const __VLS_15 = __VLS_asFunctionalComponent(IconPhoneCancel, new IconPhoneCancel({}));
249
- const __VLS_16 = __VLS_15({}, ...__VLS_functionalComponentArgsRest(__VLS_15));
250
386
  __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
251
387
  ...{ class: "absolute bottom-6 text-gray-500 text-sm" },
252
388
  });
@@ -255,10 +391,6 @@ const { default: __VLS_5 } = __VLS_2.slots;
255
391
  [duration,];
256
392
  }
257
393
  var __VLS_2;
258
- __VLS_asFunctionalElement(__VLS_elements.audio, __VLS_elements.audio)({
259
- id: "go-chat-local-audio",
260
- autoplay: true,
261
- });
262
394
  __VLS_asFunctionalElement(__VLS_elements.audio, __VLS_elements.audio)({
263
395
  id: "go-chat-remote-audio",
264
396
  autoplay: true,
@@ -303,6 +435,39 @@ __VLS_asFunctionalElement(__VLS_elements.audio, __VLS_elements.audio)({
303
435
  /** @type {__VLS_StyleScopedClasses['transition']} */ ;
304
436
  /** @type {__VLS_StyleScopedClasses['w-16']} */ ;
305
437
  /** @type {__VLS_StyleScopedClasses['h-16']} */ ;
438
+ /** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
439
+ /** @type {__VLS_StyleScopedClasses['hover:bg-green-600']} */ ;
440
+ /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
441
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
442
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
443
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
444
+ /** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
445
+ /** @type {__VLS_StyleScopedClasses['shadow-lg']} */ ;
446
+ /** @type {__VLS_StyleScopedClasses['transition']} */ ;
447
+ /** @type {__VLS_StyleScopedClasses['w-16']} */ ;
448
+ /** @type {__VLS_StyleScopedClasses['h-16']} */ ;
449
+ /** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
450
+ /** @type {__VLS_StyleScopedClasses['hover:bg-green-600']} */ ;
451
+ /** @type {__VLS_StyleScopedClasses['text-black']} */ ;
452
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
453
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
454
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
455
+ /** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
456
+ /** @type {__VLS_StyleScopedClasses['shadow-lg']} */ ;
457
+ /** @type {__VLS_StyleScopedClasses['transition']} */ ;
458
+ /** @type {__VLS_StyleScopedClasses['w-16']} */ ;
459
+ /** @type {__VLS_StyleScopedClasses['h-16']} */ ;
460
+ /** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
461
+ /** @type {__VLS_StyleScopedClasses['hover:bg-green-600']} */ ;
462
+ /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
463
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
464
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
465
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
466
+ /** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
467
+ /** @type {__VLS_StyleScopedClasses['shadow-lg']} */ ;
468
+ /** @type {__VLS_StyleScopedClasses['transition']} */ ;
469
+ /** @type {__VLS_StyleScopedClasses['w-16']} */ ;
470
+ /** @type {__VLS_StyleScopedClasses['h-16']} */ ;
306
471
  /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
307
472
  /** @type {__VLS_StyleScopedClasses['bg-[#EF4444]']} */ ;
308
473
  /** @type {__VLS_StyleScopedClasses['hover:bg-red-700']} */ ;
@@ -314,9 +479,10 @@ __VLS_asFunctionalElement(__VLS_elements.audio, __VLS_elements.audio)({
314
479
  /** @type {__VLS_StyleScopedClasses['text-gray-500']} */ ;
315
480
  /** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
316
481
  // @ts-ignore
317
- var __VLS_4 = __VLS_3;
482
+ var __VLS_7 = __VLS_6;
318
483
  const __VLS_export = (await import('vue')).defineComponent({
319
484
  setup: () => (__VLS_exposed),
485
+ __typeEmits: {},
320
486
  __typeProps: {},
321
487
  props: {},
322
488
  });
@@ -40,12 +40,12 @@ const __VLS_1 = __VLS_0({}, ...__VLS_functionalComponentArgsRest(__VLS_0));
40
40
  __VLS_asFunctionalElement(__VLS_elements.input)({
41
41
  ...{ onInput: (__VLS_ctx.search) },
42
42
  ...{ class: "sc-full chat-input bg-[#F7F8F9] pr-4 py-3 pl-10" },
43
- ...{ class: ({ '!bg-white': __VLS_ctx.response == 'mobile' }) },
43
+ ...{ class: ({ '!bg-white': __VLS_ctx.responsive == 'mobile' }) },
44
44
  placeholder: (props.placeholder),
45
45
  });
46
46
  (__VLS_ctx.keyword);
47
47
  // @ts-ignore
48
- [search, response, keyword,];
48
+ [search, responsive, keyword,];
49
49
  /** @type {__VLS_StyleScopedClasses['relative']} */ ;
50
50
  /** @type {__VLS_StyleScopedClasses['absolute']} */ ;
51
51
  /** @type {__VLS_StyleScopedClasses['inset-y-0']} */ ;
@@ -0,0 +1,98 @@
1
+ /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
+ import { ref, computed } from 'vue';
3
+ const props = defineProps();
4
+ const emit = defineEmits();
5
+ const open = ref(false);
6
+ const selectedLabel = computed(() => {
7
+ return props.options.find(o => o.value === props.modelValue)?.label ?? '';
8
+ });
9
+ function toggle() {
10
+ open.value = !open.value;
11
+ }
12
+ function select(option) {
13
+ emit('update:modelValue', option.value);
14
+ emit('select', option.value);
15
+ open.value = false;
16
+ }
17
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
18
+ const __VLS_ctx = {
19
+ ...{},
20
+ ...{},
21
+ ...{},
22
+ ...{},
23
+ ...{},
24
+ };
25
+ let __VLS_elements;
26
+ let __VLS_components;
27
+ let __VLS_directives;
28
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
29
+ ...{ onBlur: (...[$event]) => {
30
+ __VLS_ctx.open = false;
31
+ // @ts-ignore
32
+ [open,];
33
+ } },
34
+ ...{ onClick: (__VLS_ctx.toggle) },
35
+ ...{ class: "relative inline-block w-full" },
36
+ tabindex: "0",
37
+ });
38
+ // @ts-ignore
39
+ [toggle,];
40
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
41
+ ...{ class: "cursor-pointer pointer-events-none" },
42
+ });
43
+ var __VLS_0 = {};
44
+ __VLS_asFunctionalElement(__VLS_elements.ul, __VLS_elements.ul)({
45
+ ...{ class: "w-max absolute right-0 z-10 mt-1 max-h-48 overflow-auto rounded-md border border-gray-200 bg-white shadow-lg" },
46
+ });
47
+ __VLS_asFunctionalDirective(__VLS_directives.vShow)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.open) }, null, null);
48
+ // @ts-ignore
49
+ [open,];
50
+ for (const [option, idx] of __VLS_getVForSourceType((__VLS_ctx.options))) {
51
+ // @ts-ignore
52
+ [options,];
53
+ __VLS_asFunctionalElement(__VLS_elements.li, __VLS_elements.li)({
54
+ ...{ onClick: (...[$event]) => {
55
+ __VLS_ctx.select(option);
56
+ // @ts-ignore
57
+ [select,];
58
+ } },
59
+ key: (idx),
60
+ ...{ class: "cursor-pointer text-black px-3 py-2 hover:bg-chat-haze-200" },
61
+ ...{ class: ({ 'bg-primary !text-white': option.value === __VLS_ctx.modelValue }) },
62
+ });
63
+ // @ts-ignore
64
+ [modelValue,];
65
+ (option.label);
66
+ }
67
+ /** @type {__VLS_StyleScopedClasses['relative']} */ ;
68
+ /** @type {__VLS_StyleScopedClasses['inline-block']} */ ;
69
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
70
+ /** @type {__VLS_StyleScopedClasses['cursor-pointer']} */ ;
71
+ /** @type {__VLS_StyleScopedClasses['pointer-events-none']} */ ;
72
+ /** @type {__VLS_StyleScopedClasses['w-max']} */ ;
73
+ /** @type {__VLS_StyleScopedClasses['absolute']} */ ;
74
+ /** @type {__VLS_StyleScopedClasses['right-0']} */ ;
75
+ /** @type {__VLS_StyleScopedClasses['z-10']} */ ;
76
+ /** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
77
+ /** @type {__VLS_StyleScopedClasses['max-h-48']} */ ;
78
+ /** @type {__VLS_StyleScopedClasses['overflow-auto']} */ ;
79
+ /** @type {__VLS_StyleScopedClasses['rounded-md']} */ ;
80
+ /** @type {__VLS_StyleScopedClasses['border']} */ ;
81
+ /** @type {__VLS_StyleScopedClasses['border-gray-200']} */ ;
82
+ /** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
83
+ /** @type {__VLS_StyleScopedClasses['shadow-lg']} */ ;
84
+ /** @type {__VLS_StyleScopedClasses['cursor-pointer']} */ ;
85
+ /** @type {__VLS_StyleScopedClasses['text-black']} */ ;
86
+ /** @type {__VLS_StyleScopedClasses['px-3']} */ ;
87
+ /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
88
+ /** @type {__VLS_StyleScopedClasses['hover:bg-chat-haze-200']} */ ;
89
+ /** @type {__VLS_StyleScopedClasses['bg-primary']} */ ;
90
+ /** @type {__VLS_StyleScopedClasses['!text-white']} */ ;
91
+ // @ts-ignore
92
+ var __VLS_1 = __VLS_0;
93
+ const __VLS_base = (await import('vue')).defineComponent({
94
+ __typeEmits: {},
95
+ __typeProps: {},
96
+ });
97
+ const __VLS_export = {};
98
+ export default {};
@@ -1,4 +1,3 @@
1
- /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
1
  import { computed, ref } from 'vue';
3
2
  const props = withDefaults(defineProps(), {
4
3
  position: 'right',