@phonghq/go-chat 1.0.1 → 1.0.3

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 (186) hide show
  1. package/dist/chat/App.vue.d.ts +2 -2
  2. package/dist/chat/main.d.ts +6 -3
  3. package/dist/chat/page/customer-detail/CustomerDetail.vue.d.ts +1 -1
  4. package/dist/chat/page/home/ChatList.vue.d.ts +1 -1
  5. package/dist/chat/page/home/ChatMessage.vue.d.ts +2 -2
  6. package/dist/chat/page/home/Home.vue.d.ts +2 -2
  7. package/dist/chat/page/home/HomeHeader.vue.d.ts +1 -1
  8. package/dist/chat/page/home/InputChat.vue.d.ts +1 -1
  9. package/dist/chat/page/home/NewCustomer.vue.d.ts +1 -1
  10. package/dist/components/chat/call/Calling.vue.d.ts +1 -1
  11. package/dist/components/chat/common/input/InputSearch.vue.d.ts +1 -1
  12. package/dist/composable/useCallHelper.d.ts +1 -1
  13. package/dist/composable/useInitData.d.ts +1 -1
  14. package/dist/composable/useModalConfirm.d.ts +1 -1
  15. package/dist/go-chat.es.js +26369 -28399
  16. package/dist/go-chat.umd.js +15 -23
  17. package/dist/plugins/mqtt.d.ts +2 -1
  18. package/dist/plugins/websocket.d.ts +4 -1
  19. package/dist/style.css +1 -1
  20. package/dist/{chat → test/chat}/App.vue.js +60 -63
  21. package/dist/test/chat/main.js +6 -0
  22. package/dist/{chat/page/customer-appointment/CustomerApointment.vue.js → test/chat/page/customer-appointment/CustomerAppointment.vue.js} +5 -5
  23. package/dist/{chat → test/chat}/page/customer-check-in/CollapseCheckIn.vue.js +2 -2
  24. package/dist/{chat → test/chat}/page/customer-check-in/CustomerCheckIn.vue.js +4 -4
  25. package/dist/{chat → test/chat}/page/customer-detail/CustomerDetail.vue.js +16 -15
  26. package/dist/{chat → test/chat}/page/customer-detail/SubInformation.vue.js +1 -1
  27. package/dist/{chat → test/chat}/page/error/Error.vue.js +1 -1
  28. package/dist/{chat → test/chat}/page/home/ChatList.vue.js +11 -13
  29. package/dist/{chat → test/chat}/page/home/ChatMessage.vue.js +4 -4
  30. package/dist/{chat → test/chat}/page/home/Home.vue.js +10 -10
  31. package/dist/{chat → test/chat}/page/home/HomeHeader.vue.js +6 -6
  32. package/dist/{chat → test/chat}/page/home/InputChat.vue.js +13 -11
  33. package/dist/{chat → test/chat}/page/home/NewCustomer.vue.js +2 -2
  34. package/dist/test/components/ListenEvent.vue.js +45 -0
  35. package/dist/{components → test/components}/chat/ScrollEvent/ScrollEvent.vue.js +1 -1
  36. package/dist/{components → test/components}/chat/call/Calling.vue.js +68 -38
  37. package/dist/{components → test/components}/chat/common/collapse/CollapseBase.vue.js +1 -1
  38. package/dist/{components → test/components}/chat/common/input/InputSearch.vue.js +2 -2
  39. package/dist/{components → test/components}/chat/common/popover/PopoverBase.vue.js +1 -1
  40. package/dist/{components → test/components}/chat/layout/mobile/Footer.vue.js +10 -10
  41. package/dist/{components → test/components}/common/button/ButtonBase.vue.js +2 -2
  42. package/dist/{components → test/components}/common/button/ButtonToggle.vue.js +1 -1
  43. package/dist/{components → test/components}/common/checkbox/CCheckboxNumber.vue.js +1 -1
  44. package/dist/{components → test/components}/common/drawer/DrawerBase.vue.js +1 -1
  45. package/dist/{components → test/components}/common/dropdown/DropdownBase.vue.js +1 -1
  46. package/dist/{components → test/components}/common/input/CInputSearch.vue.js +1 -1
  47. package/dist/{components → test/components}/common/modal/ModalBase.vue.js +2 -2
  48. package/dist/{components → test/components}/common/slider/BaseSlider.vue.js +1 -1
  49. package/dist/{components → test/components}/modal/Confirm.vue.js +3 -3
  50. package/dist/{components → test/components}/ui/button/CButton.vue.js +1 -1
  51. package/dist/{components → test/components}/ui/checkbox/Checkbox.vue.js +1 -1
  52. package/dist/{components → test/components}/ui/dialog/DialogContent.vue.js +1 -1
  53. package/dist/{components → test/components}/ui/dialog/DialogDescription.vue.js +1 -1
  54. package/dist/{components → test/components}/ui/dialog/DialogFooter.vue.js +1 -1
  55. package/dist/{components → test/components}/ui/dialog/DialogHeader.vue.js +1 -1
  56. package/dist/{components → test/components}/ui/dialog/DialogScrollContent.vue.js +1 -1
  57. package/dist/{components → test/components}/ui/dialog/DialogTitle.vue.js +1 -1
  58. package/dist/{components → test/components}/ui/drawer/DrawerContent.vue.js +1 -1
  59. package/dist/{components → test/components}/ui/drawer/DrawerDescription.vue.js +1 -1
  60. package/dist/{components → test/components}/ui/drawer/DrawerFooter.vue.js +1 -1
  61. package/dist/{components → test/components}/ui/drawer/DrawerHeader.vue.js +1 -1
  62. package/dist/{components → test/components}/ui/drawer/DrawerOverlay.vue.js +1 -1
  63. package/dist/{components → test/components}/ui/drawer/DrawerTitle.vue.js +1 -1
  64. package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.js +1 -1
  65. package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuContent.vue.js +1 -1
  66. package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuItem.vue.js +1 -1
  67. package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuLabel.vue.js +1 -1
  68. package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuRadioItem.vue.js +1 -1
  69. package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuSeparator.vue.js +1 -1
  70. package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuShortcut.vue.js +1 -1
  71. package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuSubContent.vue.js +1 -1
  72. package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuSubTrigger.vue.js +1 -1
  73. package/dist/{components → test/components}/ui/popover/PopoverContent.vue.js +1 -1
  74. package/dist/{components → test/components}/ui/radio-group/RadioGroup.vue.js +1 -1
  75. package/dist/{components → test/components}/ui/radio-group/RadioGroupItem.vue.js +1 -1
  76. package/dist/{components → test/components}/ui/slider/Slider.vue.js +1 -1
  77. package/dist/{components → test/components}/ui/switch/Switch.vue.js +1 -1
  78. package/dist/{composable → test/composable}/useCallHelper.js +4 -16
  79. package/dist/{composable → test/composable}/useInitData.js +8 -6
  80. package/dist/{plugins → test/plugins}/mqtt.js +1 -2
  81. package/dist/{plugins → test/plugins}/sdk.js +3 -3
  82. package/dist/test/plugins/websocket.js +65 -0
  83. package/dist/test/types/chat/global.js +1 -0
  84. package/dist/test/types/chat/promise.js +1 -0
  85. package/dist/test/types/chat/user.js +1 -0
  86. package/dist/test/types/conversation.js +1 -0
  87. package/dist/test/types/global.js +15 -0
  88. package/dist/test/types/message.js +1 -0
  89. package/dist/{utils → test/utils}/chat/auth.js +2 -2
  90. package/dist/test/utils/chat/call.js +61 -0
  91. package/dist/{utils → test/utils}/chat/chat-router.js +1 -1
  92. package/dist/{utils → test/utils}/chat/conversation.js +1 -1
  93. package/dist/{utils → test/utils}/chat/message.js +1 -1
  94. package/dist/{utils → test/utils}/chat/user.js +1 -1
  95. package/dist/test/utils/json.js +18 -0
  96. package/dist/types/call.d.ts +4 -0
  97. package/dist/types/chat/auth.d.ts +37 -0
  98. package/dist/types/chat/global.d.ts +7 -0
  99. package/dist/types/chat/promise.d.ts +17 -0
  100. package/dist/types/global.d.ts +11 -0
  101. package/dist/types/message.d.ts +43 -0
  102. package/dist/utils/chat/auth.d.ts +1 -1
  103. package/dist/utils/chat/call.d.ts +4 -0
  104. package/dist/utils/chat/chat-router.d.ts +1 -1
  105. package/dist/utils/chat/conversation.d.ts +2 -2
  106. package/dist/utils/chat/message.d.ts +2 -2
  107. package/dist/utils/chat/user.d.ts +2 -2
  108. package/dist/utils/json.d.ts +2 -0
  109. package/package.json +1 -1
  110. package/dist/chat/main.js +0 -2
  111. package/dist/components/ListenEvent.vue.js +0 -47
  112. package/dist/plugins/websocket.js +0 -26
  113. package/dist/stores/general.d.ts +0 -48
  114. package/dist/stores/general.js +0 -39
  115. package/dist/utils/chat/call.js +0 -10
  116. /package/dist/chat/page/customer-appointment/{CustomerApointment.vue.d.ts → CustomerAppointment.vue.d.ts} +0 -0
  117. /package/dist/{assets → test/assets}/icons/IconArrowLeft.vue.js +0 -0
  118. /package/dist/{assets → test/assets}/icons/IconPhone.vue.js +0 -0
  119. /package/dist/{assets → test/assets}/icons/IconPlan.vue.js +0 -0
  120. /package/dist/{assets → test/assets}/icons/IconPlus.vue.js +0 -0
  121. /package/dist/{assets → test/assets}/icons/IconSearch.vue.js +0 -0
  122. /package/dist/{assets → test/assets}/icons/call/IconMic.vue.js +0 -0
  123. /package/dist/{assets → test/assets}/icons/call/IconPhone.vue.js +0 -0
  124. /package/dist/{assets → test/assets}/icons/call/IconPhoneCancel.vue.js +0 -0
  125. /package/dist/{assets → test/assets}/icons/call/IconSpeaker.vue.js +0 -0
  126. /package/dist/{assets → test/assets}/icons/customer-appointment/IconFilter.vue.js +0 -0
  127. /package/dist/{assets → test/assets}/icons/customer-detail/IconArrow.vue.js +0 -0
  128. /package/dist/{assets → test/assets}/icons/customer-detail/IconCheck.vue.js +0 -0
  129. /package/dist/{assets → test/assets}/icons/customer-detail/IconDate.vue.js +0 -0
  130. /package/dist/{assets → test/assets}/icons/customer-detail/IconGroup.vue.js +0 -0
  131. /package/dist/{assets → test/assets}/icons/customer-detail/IconMessage.vue.js +0 -0
  132. /package/dist/{assets → test/assets}/icons/customer-detail/IconNote.vue.js +0 -0
  133. /package/dist/{assets → test/assets}/icons/customer-detail/IconPhone.vue.js +0 -0
  134. /package/dist/{assets → test/assets}/icons/customer-detail/IconPin.vue.js +0 -0
  135. /package/dist/{assets → test/assets}/icons/customer-detail/IconSearch.vue.js +0 -0
  136. /package/dist/{components → test/components}/chat/card/CardCustomerDetail.vue.js +0 -0
  137. /package/dist/{components → test/components}/chat/common/spin/BaseSpin.vue.js +0 -0
  138. /package/dist/{components → test/components}/chat/customer/Avatar.vue.js +0 -0
  139. /package/dist/{components → test/components}/common/CustomLoading.vue.js +0 -0
  140. /package/dist/{components → test/components}/common/Notification/NotificationDescription.vue.js +0 -0
  141. /package/dist/{components → test/components}/common/collapse/BaseCollapse.vue.js +0 -0
  142. /package/dist/{components → test/components}/common/collapse/BaseCollapseItem.vue.js +0 -0
  143. /package/dist/{components → test/components}/common/popover/PopoverBase.vue.js +0 -0
  144. /package/dist/{components → test/components}/common/spin/CSpin.vue.js +0 -0
  145. /package/dist/{components → test/components}/common/tooltip/TooltipBase.vue.js +0 -0
  146. /package/dist/{components → test/components}/layout/Blank.vue.js +0 -0
  147. /package/dist/{components → test/components}/layout/Default.vue.js +0 -0
  148. /package/dist/{components → test/components}/ui/button/c-button.js +0 -0
  149. /package/dist/{components → test/components}/ui/checkbox/index.js +0 -0
  150. /package/dist/{components → test/components}/ui/collapsible/Collapsible.vue.js +0 -0
  151. /package/dist/{components → test/components}/ui/collapsible/CollapsibleContent.vue.js +0 -0
  152. /package/dist/{components → test/components}/ui/collapsible/CollapsibleTrigger.vue.js +0 -0
  153. /package/dist/{components → test/components}/ui/collapsible/index.js +0 -0
  154. /package/dist/{components → test/components}/ui/dialog/Dialog.vue.js +0 -0
  155. /package/dist/{components → test/components}/ui/dialog/DialogClose.vue.js +0 -0
  156. /package/dist/{components → test/components}/ui/dialog/DialogTrigger.vue.js +0 -0
  157. /package/dist/{components → test/components}/ui/dialog/index.js +0 -0
  158. /package/dist/{components → test/components}/ui/drawer/Drawer.vue.js +0 -0
  159. /package/dist/{components → test/components}/ui/drawer/index.js +0 -0
  160. /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenu.vue.js +0 -0
  161. /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuGroup.vue.js +0 -0
  162. /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuRadioGroup.vue.js +0 -0
  163. /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuSub.vue.js +0 -0
  164. /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuTrigger.vue.js +0 -0
  165. /package/dist/{components → test/components}/ui/dropdown-menu/index.js +0 -0
  166. /package/dist/{components → test/components}/ui/popover/Popover.vue.js +0 -0
  167. /package/dist/{components → test/components}/ui/popover/PopoverTrigger.vue.js +0 -0
  168. /package/dist/{components → test/components}/ui/popover/index.js +0 -0
  169. /package/dist/{components → test/components}/ui/radio-group/index.js +0 -0
  170. /package/dist/{components → test/components}/ui/slider/index.js +0 -0
  171. /package/dist/{components → test/components}/ui/switch/index.js +0 -0
  172. /package/dist/{composable → test/composable}/useModalConfirm.js +0 -0
  173. /package/dist/{constant → test/constant}/color.js +0 -0
  174. /package/dist/{constant → test/constant}/datetime.js +0 -0
  175. /package/dist/{constant → test/constant}/general.js +0 -0
  176. /package/dist/{constant → test/constant}/message.js +0 -0
  177. /package/dist/{constant → test/constant}/mqtt.js +0 -0
  178. /package/dist/{constant → test/constant}/user.js +0 -0
  179. /package/dist/{lib → test/lib}/utils.js +0 -0
  180. /package/dist/{plugins → test/plugins}/axios-gci.js +0 -0
  181. /package/dist/{plugins → test/plugins}/axios.js +0 -0
  182. /package/dist/{types/chat/user.js → test/types/call.js} +0 -0
  183. /package/dist/{types/conversation.js → test/types/chat/auth.js} +0 -0
  184. /package/dist/{utils → test/utils}/debounce.js +0 -0
  185. /package/dist/{utils → test/utils}/logger.js +0 -0
  186. /package/dist/{utils → test/utils}/string-helper.js +0 -0
@@ -1,9 +1,9 @@
1
- import IconPhone from '@/assets/icons/IconPhone.vue';
2
- import { PAGE } from '@/constant/general';
3
- import Avatar from '@/components/chat/customer/Avatar.vue';
4
- import { routerPush } from '@/utils/chat/chat-router';
5
- import { user } from '@/utils/chat/user';
6
- import { dataProfile } from '@/utils/chat/auth';
1
+ import IconPhone from '../../../assets/icons/IconPhone.vue';
2
+ import { PAGE } from '../../../constant/general';
3
+ import Avatar from '../../../components/chat/customer/Avatar.vue';
4
+ import { routerPush } from '../../../utils/chat/chat-router';
5
+ import { user } from '../../../utils/chat/user';
6
+ import { dataProfile } from '../../../utils/chat/auth';
7
7
  const props = withDefaults(defineProps(), {});
8
8
  const emit = defineEmits();
9
9
  const goToViewUser = () => {
@@ -1,12 +1,12 @@
1
- import IconPlus from '@/assets/icons/IconPlus.vue';
2
- import IconPlan from '@/assets/icons/IconPlan.vue';
1
+ import IconPlus from '../../../assets/icons/IconPlus.vue';
2
+ import IconPlan from '../../../assets/icons/IconPlan.vue';
3
3
  import EmojiPicker from 'vue3-emoji-picker';
4
4
  import 'vue3-emoji-picker/css';
5
5
  import dayjs from 'dayjs';
6
- import { DATE_FORMATS } from '@/constant/datetime';
7
- import { dataProfile } from '@/utils/chat/auth';
6
+ import { DATE_FORMATS } from '../../../constant/datetime';
7
+ import { dataProfile } from '../../../utils/chat/auth';
8
8
  import { ref } from 'vue';
9
- import PopoverBase from '@/components/chat/common/popover/PopoverBase.vue';
9
+ import PopoverBase from '../../../components/chat/common/popover/PopoverBase.vue';
10
10
  const props = withDefaults(defineProps(), {});
11
11
  const emit = defineEmits();
12
12
  const keyword = defineModel();
@@ -59,7 +59,7 @@ const handleFileUpload = () => {
59
59
  handleSendMessage('file');
60
60
  };
61
61
  const onSelectEmoji = (value) => {
62
- keyword.value = keyword.value + (value?.i ?? '');
62
+ keyword.value = (keyword.value ?? '') + (value?.i?.replace('undefined', '') ?? '');
63
63
  emojiOpen.value = false;
64
64
  chatInputRef.value?.focus?.();
65
65
  };
@@ -116,9 +116,9 @@ const { default: __VLS_3 } = __VLS_2.slots;
116
116
  [emojiOpen,];
117
117
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
118
118
  ...{ onClick: (...[$event]) => {
119
- __VLS_ctx.emojiOpen = true;
119
+ __VLS_ctx.emojiOpen = !__VLS_ctx.emojiOpen;
120
120
  // @ts-ignore
121
- [emojiOpen,];
121
+ [emojiOpen, emojiOpen,];
122
122
  } },
123
123
  ...{ class: "" },
124
124
  });
@@ -131,14 +131,16 @@ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
131
131
  // @ts-ignore
132
132
  const __VLS_6 = __VLS_asFunctionalComponent(__VLS_5, new __VLS_5({
133
133
  ...{ 'onSelect': {} },
134
- ...{ class: "!w-[450px]" },
134
+ ...{ class: "!w-[300px]" },
135
135
  native: (true),
136
+ offset: (2),
136
137
  hideSearch: true,
137
138
  }));
138
139
  const __VLS_7 = __VLS_6({
139
140
  ...{ 'onSelect': {} },
140
- ...{ class: "!w-[450px]" },
141
+ ...{ class: "!w-[300px]" },
141
142
  native: (true),
143
+ offset: (2),
142
144
  hideSearch: true,
143
145
  }, ...__VLS_functionalComponentArgsRest(__VLS_6));
144
146
  let __VLS_9;
@@ -203,7 +205,7 @@ const __VLS_18 = __VLS_17({
203
205
  /** @type {__VLS_StyleScopedClasses['absolute']} */ ;
204
206
  /** @type {__VLS_StyleScopedClasses['right-0']} */ ;
205
207
  /** @type {__VLS_StyleScopedClasses['bottom-0']} */ ;
206
- /** @type {__VLS_StyleScopedClasses['!w-[450px]']} */ ;
208
+ /** @type {__VLS_StyleScopedClasses['!w-[300px]']} */ ;
207
209
  /** @type {__VLS_StyleScopedClasses['h-11']} */ ;
208
210
  /** @type {__VLS_StyleScopedClasses['w-10']} */ ;
209
211
  /** @type {__VLS_StyleScopedClasses['shrink-0']} */ ;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import Avatar from '@/components/chat/customer/Avatar.vue';
2
+ import Avatar from '../../../components/chat/customer/Avatar.vue';
3
3
  const props = withDefaults(defineProps(), {});
4
4
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
5
5
  const __VLS_defaults = {};
@@ -43,7 +43,7 @@ __VLS_asFunctionalElement(__VLS_elements.h2, __VLS_elements.h2)({
43
43
  // @ts-ignore
44
44
  [data,];
45
45
  __VLS_asFunctionalElement(__VLS_elements.img)({
46
- src: "@/assets/images/icons/new-customer.png",
46
+ src: "../../../assets/images/icons/new-customer.png",
47
47
  });
48
48
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
49
49
  ...{ class: "text-chat-haze-400 text-sm mt-1 flex items-center gap-1" },
@@ -0,0 +1,45 @@
1
+ /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
+ import { onMounted, onBeforeUnmount } from 'vue';
3
+ import { useDebounce } from '../utils/debounce';
4
+ // import { useGeneralStore } from '@/stores/general'
5
+ // const deviceType = computed({
6
+ // set(value: any) {
7
+ // return useGeneralStore().deviceResponsive = value
8
+ // },
9
+ // get() {
10
+ // return useGeneralStore().deviceResponsive
11
+ // }
12
+ // })
13
+ // const getDeviceType = () => {
14
+ // const width = window.innerWidth
15
+ // if (width < 767) {
16
+ // return 'mobile'
17
+ // } else if (width < 1023) {
18
+ // return 'tablet'
19
+ // } else {
20
+ // return 'window'
21
+ // }
22
+ // }
23
+ const updateDeviceType = useDebounce(() => {
24
+ // const newType = getDeviceType()
25
+ // if (deviceType.value !== newType) {
26
+ // deviceType.value = newType
27
+ // }
28
+ }, 500);
29
+ onMounted(() => {
30
+ updateDeviceType();
31
+ window.addEventListener('resize', updateDeviceType);
32
+ });
33
+ onBeforeUnmount(() => {
34
+ window.removeEventListener('resize', updateDeviceType);
35
+ });
36
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
37
+ const __VLS_ctx = {
38
+ ...{},
39
+ ...{},
40
+ };
41
+ let __VLS_elements;
42
+ let __VLS_components;
43
+ let __VLS_directives;
44
+ const __VLS_export = (await import('vue')).defineComponent({});
45
+ export default {};
@@ -1,6 +1,6 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { ref } from 'vue';
3
- import { useDebounce } from '@/utils/debounce';
3
+ import { useDebounce } from '../../../utils/debounce';
4
4
  const props = withDefaults(defineProps(), {});
5
5
  const emit = defineEmits();
6
6
  const scrollEvent = ref(null);
@@ -1,20 +1,30 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { ref, onMounted, onUnmounted, watch } from 'vue';
3
- import DrawerBase from '@/components/common/drawer/DrawerBase.vue';
4
- import IconPhone from '@/assets/icons/call/IconPhone.vue';
5
- import { dataProfile } from '@/utils/chat/auth.js';
6
- import { addHandleMqttMessage, connectMqtt, removeHandleMqttMessage, subscribeToTopic, unsubscribeFromTopic } from '@/plugins/mqtt.js';
7
- import { TOPIC_DETAIL_CALL } from '@/constant/mqtt.js';
8
- import { useCallHelper } from '@/composable/useCallHelper';
9
- import IconPhoneCancel from '@/assets/icons/call/IconPhoneCancel.vue';
3
+ import DrawerBase from '../../../components/common/drawer/DrawerBase.vue';
4
+ import IconPhone from '../../../assets/icons/call/IconPhone.vue';
5
+ import { dataProfile } from '../../../utils/chat/auth.js';
6
+ import { addHandleMqttMessage, connectMqtt, removeHandleMqttMessage, subscribeToTopic, unsubscribeFromTopic } from '../../../plugins/mqtt.js';
7
+ import { TOPIC_DETAIL_CALL } from '../../../constant/mqtt.js';
8
+ import { useCallHelper } from '../../../composable/useCallHelper';
9
+ import IconPhoneCancel from '../../../assets/icons/call/IconPhoneCancel.vue';
10
+ import { addHandleWebSK, removeHandleWebSK } from '../../../plugins/websocket';
11
+ import { callClient, callOutBound } from '../../../utils/chat/call';
10
12
  const { handleOffer, handleOfferResponse, call, end, endPc, addIceCandidate, sendOfferOk } = useCallHelper();
11
13
  const STATUS = {
12
14
  CONNECTING: 'Connecting...',
13
- CONNECTED: 'Ringing...',
15
+ CALLING: 'calling',
16
+ RINGING: 'ringing',
14
17
  CONNECT_FAILED: 'Connect Error',
15
- CALLING: 'Calling...',
16
- CALL_START: '',
17
- CALL_END: 'Call Ended'
18
+ CALL_START: 'in-progress',
19
+ CALL_END: 'completed'
20
+ };
21
+ const STATUS_LABEL = {
22
+ [STATUS.CONNECTING]: 'Connecting...',
23
+ [STATUS.CALLING]: 'Calling...',
24
+ [STATUS.RINGING]: 'Ringing...',
25
+ [STATUS.CONNECT_FAILED]: 'Connect Error',
26
+ [STATUS.CALL_START]: '',
27
+ [STATUS.CALL_END]: 'Call Ended'
18
28
  };
19
29
  const callStatus = ref(STATUS.CONNECTING);
20
30
  const duration = ref('00:00');
@@ -34,6 +44,7 @@ onUnmounted(() => {
34
44
  if (timeOut)
35
45
  clearTimeout(timeOut);
36
46
  });
47
+ let dataWebSK = null;
37
48
  function startTimer() {
38
49
  let sec = 0;
39
50
  timer = setInterval(() => {
@@ -64,52 +75,71 @@ const startCall = async (data) => {
64
75
  try {
65
76
  callStatus.value = STATUS.CONNECTING;
66
77
  open();
67
- await call(data);
68
- callStatus.value = STATUS.CONNECTED;
78
+ await callOutBound(data);
79
+ // await call(data)
80
+ callStatus.value = STATUS.CALLING;
69
81
  }
70
82
  catch (e) {
71
83
  console.log(e);
72
84
  callStatus.value = STATUS.CONNECT_FAILED;
73
85
  }
74
86
  };
75
- const answer = () => {
87
+ const answer = async () => {
88
+ await callClient(dataWebSK);
76
89
  callStatus.value = STATUS.CALL_START;
77
- sendOfferOk();
90
+ // sendOfferOk()
78
91
  };
79
- const handleMqttMessage = async (topic, message) => {
80
- if (topic == TOPIC_DETAIL_CALL + dataProfile.value?.id) {
81
- console.log(message);
82
- if (message?.type === 'offer') {
83
- const status = await handleOffer(message);
84
- if (status) {
85
- callStatus.value = STATUS.CALLING;
86
- open();
87
- }
88
- }
89
- else if (message?.type === 'offer-response') {
90
- await handleOfferResponse(message);
91
- callStatus.value = STATUS.CALL_START;
92
- }
93
- else if (message?.type === 'candidate') {
94
- addIceCandidate(message);
95
- }
96
- else if (message?.type === 'end-call') {
97
- endPc(message?.link);
98
- callStatus.value = STATUS.CALL_END;
92
+ const handleMqttMessage = async (message) => {
93
+ if (message?.data?.status == STATUS.RINGING) {
94
+ if (message?.data?.to_number == dataProfile.value?.phone) {
95
+ callStatus.value = STATUS.RINGING;
96
+ dataWebSK = {
97
+ from: message.data.from_number,
98
+ to: message.data.to_number
99
+ };
100
+ open();
99
101
  }
100
102
  }
103
+ else if (message?.data?.status == STATUS.CALL_START) {
104
+ callStatus.value = STATUS.CALL_START;
105
+ }
106
+ else if (message?.data?.status == STATUS.CALL_END) {
107
+ endCall();
108
+ }
101
109
  };
110
+ // const handleMqttMessage = async (topic: string, message: any) => {
111
+ // if (topic == TOPIC_DETAIL_CALL + dataProfile.value?.id) {
112
+ // console.log(message)
113
+ // if (message?.type === 'offer') {
114
+ // const status = await handleOffer(message)
115
+ // if (status) {
116
+ // callStatus.value = STATUS.CALLING
117
+ // open()
118
+ // }
119
+ // } else if (message?.type === 'offer-response') {
120
+ // await handleOfferResponse(message)
121
+ // callStatus.value = STATUS.CALL_START
122
+ // } else if (message?.type === 'candidate') {
123
+ // addIceCandidate(message)
124
+ // } else if (message?.type === 'end-call') {
125
+ // endPc(message?.link)
126
+ // callStatus.value = STATUS.CALL_END
127
+ // }
128
+ // }
129
+ // }
102
130
  const __VLS_exposed = { startCall, endCall };
103
131
  defineExpose(__VLS_exposed);
104
132
  watch(dataProfile, async (newValue, oldValue) => {
105
133
  if (oldValue?.id && oldValue?.id != newValue?.id) {
106
134
  unsubscribeFromTopic(TOPIC_DETAIL_CALL + oldValue?.id);
107
135
  removeHandleMqttMessage('call-message');
136
+ removeHandleWebSK('call-message');
108
137
  }
109
138
  if (newValue?.id && oldValue?.id != newValue?.id) {
110
139
  await connectMqtt();
111
140
  subscribeToTopic(TOPIC_DETAIL_CALL + newValue?.id);
112
141
  addHandleMqttMessage('call-message', TOPIC_DETAIL_CALL + newValue?.id, handleMqttMessage);
142
+ addHandleWebSK('call-message', handleMqttMessage);
113
143
  }
114
144
  }, { immediate: true });
115
145
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
@@ -157,13 +187,13 @@ const { default: __VLS_3 } = __VLS_2.slots;
157
187
  __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
158
188
  ...{ class: "text-gray-400 mt-1" },
159
189
  });
160
- (__VLS_ctx.callStatus);
190
+ (__VLS_ctx.STATUS_LABEL[__VLS_ctx.callStatus]);
161
191
  // @ts-ignore
162
- [callStatus,];
192
+ [STATUS_LABEL, callStatus,];
163
193
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
164
194
  ...{ class: "flex items-center justify-center gap-8 mt-10" },
165
195
  });
166
- if (__VLS_ctx.callStatus == __VLS_ctx.STATUS.CALLING) {
196
+ if (__VLS_ctx.callStatus == __VLS_ctx.STATUS.RINGING) {
167
197
  // @ts-ignore
168
198
  [callStatus, STATUS,];
169
199
  __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
@@ -1,5 +1,5 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible';
2
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '../../../../components/ui/collapsible';
3
3
  const isOpen = defineModel('open');
4
4
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
5
5
  const __VLS_modelEmit = defineEmits();
@@ -1,7 +1,7 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { computed } from 'vue';
3
- import IconSearch from '@/assets/icons/IconSearch.vue';
4
- import { useDebounce } from '@/utils/debounce';
3
+ import IconSearch from '../../../../assets/icons/IconSearch.vue';
4
+ import { useDebounce } from '../../../../utils/debounce';
5
5
  const props = withDefaults(defineProps(), {
6
6
  placeholder: 'Search...'
7
7
  });
@@ -1,5 +1,5 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { Popover, PopoverContent, PopoverTrigger, } from '@/components/ui/popover';
2
+ import { Popover, PopoverContent, PopoverTrigger, } from '../../../../components/ui/popover';
3
3
  const props = withDefaults(defineProps(), {
4
4
  align: "center",
5
5
  sideOffset: 4,
@@ -1,14 +1,14 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import ICon1 from '@/assets/images/layout/mobile/chat.png';
3
- import ICon1Active from '@/assets/images/layout/mobile/chat-active.png';
4
- import ICon2 from '@/assets/images/layout/mobile/review.png';
5
- import ICon2Active from '@/assets/images/layout/mobile/review-active.png';
6
- import ICon3 from '@/assets/images/layout/mobile/booking.png';
7
- import ICon3Active from '@/assets/images/layout/mobile/booking-active.png';
8
- import ICon4 from '@/assets/images/layout/mobile/admin.png';
9
- import ICon4Active from '@/assets/images/layout/mobile/admin-active.png';
10
- import { PAGE } from '@/constant/general';
11
- import { currentPage, routerPush } from '@/utils/chat/chat-router';
2
+ import ICon1 from '../../../../assets/images/layout/mobile/chat.png';
3
+ import ICon1Active from '../../../../assets/images/layout/mobile/chat-active.png';
4
+ import ICon2 from '../../../../assets/images/layout/mobile/review.png';
5
+ import ICon2Active from '../../../../assets/images/layout/mobile/review-active.png';
6
+ import ICon3 from '../../../../assets/images/layout/mobile/booking.png';
7
+ import ICon3Active from '../../../../assets/images/layout/mobile/booking-active.png';
8
+ import ICon4 from '../../../../assets/images/layout/mobile/admin.png';
9
+ import ICon4Active from '../../../../assets/images/layout/mobile/admin-active.png';
10
+ import { PAGE } from '../../../../constant/general';
11
+ import { currentPage, routerPush } from '../../../../utils/chat/chat-router';
12
12
  const LAYOUT_CONFIG = [
13
13
  {
14
14
  icon: ICon1,
@@ -1,7 +1,7 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import CButton from '@/components/ui/button/CButton.vue';
2
+ import CButton from '../../../components/ui/button/CButton.vue';
3
3
  import { computed } from 'vue';
4
- import CSpin from '@/components/common/spin/CSpin.vue';
4
+ import CSpin from '../../../components/common/spin/CSpin.vue';
5
5
  const props = withDefaults(defineProps(), {
6
6
  size: 'middle',
7
7
  disabled: false,
@@ -1,6 +1,6 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { computed } from 'vue';
3
- import { CSwitch } from '@/components/ui/switch';
3
+ import { CSwitch } from '../../../components/ui/switch';
4
4
  const props = withDefaults(defineProps(), {
5
5
  modelValue: false,
6
6
  size: 'default',
@@ -1,6 +1,6 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { computed } from 'vue';
3
- import { Checkbox } from "@/components/ui/checkbox";
3
+ import { Checkbox } from "../../../components/ui/checkbox";
4
4
  const props = defineProps();
5
5
  const emit = defineEmits();
6
6
  const checked = computed({
@@ -1,6 +1,6 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  // COMPONENT
3
- import { Drawer, DrawerContent, DrawerHeader } from '@/components/ui/drawer';
3
+ import { Drawer, DrawerContent, DrawerHeader } from '../../../components/ui/drawer';
4
4
  const props = withDefaults(defineProps(), {
5
5
  title: 'This is title',
6
6
  placement: 'right',
@@ -1,6 +1,6 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { ref } from 'vue';
3
- import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
3
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from '../../../components/ui/dropdown-menu';
4
4
  const props = withDefaults(defineProps(), {
5
5
  placement: 'bottomLeft'
6
6
  });
@@ -1,6 +1,6 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { computed } from 'vue';
3
- import { useDebounce } from '@/utils/debounce';
3
+ import { useDebounce } from '../../../utils/debounce';
4
4
  const props = withDefaults(defineProps(), {
5
5
  placeholder: 'Search...'
6
6
  });
@@ -2,9 +2,9 @@
2
2
  defineOptions({
3
3
  inheritAttrs: false
4
4
  });
5
- import { Dialog, DialogHeader, DialogTitle, DialogScrollContent } from '@/components/ui/dialog';
5
+ import { Dialog, DialogHeader, DialogTitle, DialogScrollContent } from '../../../components/ui/dialog';
6
6
  // COMPONENT
7
- // import BaseTitle from '@/components/common/base/BaseTitle.vue'
7
+ // import BaseTitle from '../../../components/common/base/BaseTitle.vue'
8
8
  import { useAttrs } from 'vue';
9
9
  const props = withDefaults(defineProps(), {
10
10
  title: 'This is title',
@@ -1,6 +1,6 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { computed } from 'vue';
3
- import { CSlider } from "@/components/ui/slider";
3
+ import { CSlider } from "../../../components/ui/slider";
4
4
  const props = withDefaults(defineProps(), {});
5
5
  const emits = defineEmits();
6
6
  const value = computed({
@@ -1,8 +1,8 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { ref, onBeforeUnmount, onMounted } from 'vue';
3
- import ModalBase from '@/components/common/modal/ModalBase.vue';
4
- import ButtonBase from '@/components/common/button/ButtonBase.vue';
5
- import { useModalConfirm } from '@/composable/useModalConfirm';
3
+ import ModalBase from '../../components/common/modal/ModalBase.vue';
4
+ import ButtonBase from '../../components/common/button/ButtonBase.vue';
5
+ import { useModalConfirm } from '../../composable/useModalConfirm';
6
6
  const { setHandleConfirm } = useModalConfirm();
7
7
  const confirmPayload = ref(null);
8
8
  const isVisible = ref(false);
@@ -1,6 +1,6 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { Primitive } from "reka-ui";
3
- import { cn } from "@/lib/utils";
3
+ import { cn } from "../../../lib/utils";
4
4
  import { buttonVariants } from "./c-button";
5
5
  const props = withDefaults(defineProps(), {
6
6
  as: "button",
@@ -2,7 +2,7 @@
2
2
  import { reactiveOmit } from "@vueuse/core";
3
3
  import { Check } from "lucide-vue-next";
4
4
  import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from "reka-ui";
5
- import { cn } from "@/lib/utils";
5
+ import { cn } from "../../../lib/utils";
6
6
  const props = defineProps();
7
7
  const emits = defineEmits();
8
8
  const delegatedProps = reactiveOmit(props, "class");
@@ -2,7 +2,7 @@
2
2
  import { computed } from 'vue';
3
3
  import { reactiveOmit } from "@vueuse/core";
4
4
  import { DialogContent, DialogOverlay, DialogPortal, useForwardPropsEmits, } from "reka-ui";
5
- import { cn } from "@/lib/utils";
5
+ import { cn } from "../../../lib/utils";
6
6
  const props = defineProps();
7
7
  const emits = defineEmits();
8
8
  const delegatedProps = reactiveOmit(props, "class");
@@ -1,7 +1,7 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { reactiveOmit } from "@vueuse/core";
3
3
  import { DialogDescription, useForwardProps } from "reka-ui";
4
- import { cn } from "@/lib/utils";
4
+ import { cn } from "../../../lib/utils";
5
5
  const props = defineProps();
6
6
  const delegatedProps = reactiveOmit(props, "class");
7
7
  const forwardedProps = useForwardProps(delegatedProps);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { cn } from "@/lib/utils";
2
+ import { cn } from "../../../lib/utils";
3
3
  const props = defineProps();
4
4
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
5
5
  const __VLS_ctx = {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { cn } from "@/lib/utils";
2
+ import { cn } from "../../../lib/utils";
3
3
  const props = defineProps();
4
4
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
5
5
  const __VLS_ctx = {
@@ -2,7 +2,7 @@
2
2
  import { computed } from 'vue';
3
3
  import { reactiveOmit } from '@vueuse/core';
4
4
  import { DialogContent, DialogOverlay, DialogPortal, useForwardPropsEmits } from 'reka-ui';
5
- import { cn } from '@/lib/utils';
5
+ import { cn } from '../../../lib/utils';
6
6
  defineOptions({ inheritAttrs: false });
7
7
  const props = defineProps();
8
8
  const emits = defineEmits();
@@ -1,7 +1,7 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { reactiveOmit } from "@vueuse/core";
3
3
  import { DialogTitle, useForwardProps } from "reka-ui";
4
- import { cn } from "@/lib/utils";
4
+ import { cn } from "../../../lib/utils";
5
5
  const props = defineProps();
6
6
  const delegatedProps = reactiveOmit(props, "class");
7
7
  const forwardedProps = useForwardProps(delegatedProps);
@@ -2,7 +2,7 @@
2
2
  import { computed } from 'vue';
3
3
  import { useForwardPropsEmits } from 'reka-ui';
4
4
  import { DrawerContent, DrawerPortal } from 'vaul-vue';
5
- import { cn } from '@/lib/utils';
5
+ import { cn } from '../../../lib/utils';
6
6
  import DrawerOverlay from './DrawerOverlay.vue';
7
7
  const props = defineProps();
8
8
  const emits = defineEmits();
@@ -1,7 +1,7 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { reactiveOmit } from "@vueuse/core";
3
3
  import { DrawerDescription } from "vaul-vue";
4
- import { cn } from "@/lib/utils";
4
+ import { cn } from "../../../lib/utils";
5
5
  const props = defineProps();
6
6
  const delegatedProps = reactiveOmit(props, "class");
7
7
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
@@ -1,5 +1,5 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { cn } from "@/lib/utils";
2
+ import { cn } from "../../../lib/utils";
3
3
  const props = defineProps();
4
4
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
5
5
  const __VLS_ctx = {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { cn } from "@/lib/utils";
2
+ import { cn } from "../../../lib/utils";
3
3
  const props = defineProps();
4
4
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
5
5
  const __VLS_ctx = {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { reactiveOmit } from "@vueuse/core";
3
3
  import { DrawerOverlay } from "vaul-vue";
4
- import { cn } from "@/lib/utils";
4
+ import { cn } from "../../../lib/utils";
5
5
  const props = defineProps();
6
6
  const delegatedProps = reactiveOmit(props, "class");
7
7
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
@@ -1,7 +1,7 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { reactiveOmit } from "@vueuse/core";
3
3
  import { DrawerTitle } from "vaul-vue";
4
- import { cn } from "@/lib/utils";
4
+ import { cn } from "../../../lib/utils";
5
5
  const props = defineProps();
6
6
  const delegatedProps = reactiveOmit(props, "class");
7
7
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
@@ -2,7 +2,7 @@
2
2
  import { reactiveOmit } from "@vueuse/core";
3
3
  import { Check } from "lucide-vue-next";
4
4
  import { DropdownMenuCheckboxItem, DropdownMenuItemIndicator, useForwardPropsEmits, } from "reka-ui";
5
- import { cn } from "@/lib/utils";
5
+ import { cn } from "../../../lib/utils";
6
6
  const props = defineProps();
7
7
  const emits = defineEmits();
8
8
  const delegatedProps = reactiveOmit(props, "class");
@@ -1,7 +1,7 @@
1
1
  /// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
2
  import { reactiveOmit } from "@vueuse/core";
3
3
  import { DropdownMenuContent, DropdownMenuPortal, useForwardPropsEmits, } from "reka-ui";
4
- import { cn } from "@/lib/utils";
4
+ import { cn } from "../../../lib/utils";
5
5
  const props = withDefaults(defineProps(), {
6
6
  sideOffset: 4,
7
7
  });