@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.
- package/dist/chat/App.vue.d.ts +2 -2
- package/dist/chat/main.d.ts +6 -3
- package/dist/chat/page/customer-detail/CustomerDetail.vue.d.ts +1 -1
- package/dist/chat/page/home/ChatList.vue.d.ts +1 -1
- package/dist/chat/page/home/ChatMessage.vue.d.ts +2 -2
- package/dist/chat/page/home/Home.vue.d.ts +2 -2
- package/dist/chat/page/home/HomeHeader.vue.d.ts +1 -1
- package/dist/chat/page/home/InputChat.vue.d.ts +1 -1
- package/dist/chat/page/home/NewCustomer.vue.d.ts +1 -1
- package/dist/components/chat/call/Calling.vue.d.ts +1 -1
- package/dist/components/chat/common/input/InputSearch.vue.d.ts +1 -1
- package/dist/composable/useCallHelper.d.ts +1 -1
- package/dist/composable/useInitData.d.ts +1 -1
- package/dist/composable/useModalConfirm.d.ts +1 -1
- package/dist/go-chat.es.js +26369 -28399
- package/dist/go-chat.umd.js +15 -23
- package/dist/plugins/mqtt.d.ts +2 -1
- package/dist/plugins/websocket.d.ts +4 -1
- package/dist/style.css +1 -1
- package/dist/{chat → test/chat}/App.vue.js +60 -63
- package/dist/test/chat/main.js +6 -0
- package/dist/{chat/page/customer-appointment/CustomerApointment.vue.js → test/chat/page/customer-appointment/CustomerAppointment.vue.js} +5 -5
- package/dist/{chat → test/chat}/page/customer-check-in/CollapseCheckIn.vue.js +2 -2
- package/dist/{chat → test/chat}/page/customer-check-in/CustomerCheckIn.vue.js +4 -4
- package/dist/{chat → test/chat}/page/customer-detail/CustomerDetail.vue.js +16 -15
- package/dist/{chat → test/chat}/page/customer-detail/SubInformation.vue.js +1 -1
- package/dist/{chat → test/chat}/page/error/Error.vue.js +1 -1
- package/dist/{chat → test/chat}/page/home/ChatList.vue.js +11 -13
- package/dist/{chat → test/chat}/page/home/ChatMessage.vue.js +4 -4
- package/dist/{chat → test/chat}/page/home/Home.vue.js +10 -10
- package/dist/{chat → test/chat}/page/home/HomeHeader.vue.js +6 -6
- package/dist/{chat → test/chat}/page/home/InputChat.vue.js +13 -11
- package/dist/{chat → test/chat}/page/home/NewCustomer.vue.js +2 -2
- package/dist/test/components/ListenEvent.vue.js +45 -0
- package/dist/{components → test/components}/chat/ScrollEvent/ScrollEvent.vue.js +1 -1
- package/dist/{components → test/components}/chat/call/Calling.vue.js +68 -38
- package/dist/{components → test/components}/chat/common/collapse/CollapseBase.vue.js +1 -1
- package/dist/{components → test/components}/chat/common/input/InputSearch.vue.js +2 -2
- package/dist/{components → test/components}/chat/common/popover/PopoverBase.vue.js +1 -1
- package/dist/{components → test/components}/chat/layout/mobile/Footer.vue.js +10 -10
- package/dist/{components → test/components}/common/button/ButtonBase.vue.js +2 -2
- package/dist/{components → test/components}/common/button/ButtonToggle.vue.js +1 -1
- package/dist/{components → test/components}/common/checkbox/CCheckboxNumber.vue.js +1 -1
- package/dist/{components → test/components}/common/drawer/DrawerBase.vue.js +1 -1
- package/dist/{components → test/components}/common/dropdown/DropdownBase.vue.js +1 -1
- package/dist/{components → test/components}/common/input/CInputSearch.vue.js +1 -1
- package/dist/{components → test/components}/common/modal/ModalBase.vue.js +2 -2
- package/dist/{components → test/components}/common/slider/BaseSlider.vue.js +1 -1
- package/dist/{components → test/components}/modal/Confirm.vue.js +3 -3
- package/dist/{components → test/components}/ui/button/CButton.vue.js +1 -1
- package/dist/{components → test/components}/ui/checkbox/Checkbox.vue.js +1 -1
- package/dist/{components → test/components}/ui/dialog/DialogContent.vue.js +1 -1
- package/dist/{components → test/components}/ui/dialog/DialogDescription.vue.js +1 -1
- package/dist/{components → test/components}/ui/dialog/DialogFooter.vue.js +1 -1
- package/dist/{components → test/components}/ui/dialog/DialogHeader.vue.js +1 -1
- package/dist/{components → test/components}/ui/dialog/DialogScrollContent.vue.js +1 -1
- package/dist/{components → test/components}/ui/dialog/DialogTitle.vue.js +1 -1
- package/dist/{components → test/components}/ui/drawer/DrawerContent.vue.js +1 -1
- package/dist/{components → test/components}/ui/drawer/DrawerDescription.vue.js +1 -1
- package/dist/{components → test/components}/ui/drawer/DrawerFooter.vue.js +1 -1
- package/dist/{components → test/components}/ui/drawer/DrawerHeader.vue.js +1 -1
- package/dist/{components → test/components}/ui/drawer/DrawerOverlay.vue.js +1 -1
- package/dist/{components → test/components}/ui/drawer/DrawerTitle.vue.js +1 -1
- package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.js +1 -1
- package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuContent.vue.js +1 -1
- package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuItem.vue.js +1 -1
- package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuLabel.vue.js +1 -1
- package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuRadioItem.vue.js +1 -1
- package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuSeparator.vue.js +1 -1
- package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuShortcut.vue.js +1 -1
- package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuSubContent.vue.js +1 -1
- package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuSubTrigger.vue.js +1 -1
- package/dist/{components → test/components}/ui/popover/PopoverContent.vue.js +1 -1
- package/dist/{components → test/components}/ui/radio-group/RadioGroup.vue.js +1 -1
- package/dist/{components → test/components}/ui/radio-group/RadioGroupItem.vue.js +1 -1
- package/dist/{components → test/components}/ui/slider/Slider.vue.js +1 -1
- package/dist/{components → test/components}/ui/switch/Switch.vue.js +1 -1
- package/dist/{composable → test/composable}/useCallHelper.js +4 -16
- package/dist/{composable → test/composable}/useInitData.js +8 -6
- package/dist/{plugins → test/plugins}/mqtt.js +1 -2
- package/dist/{plugins → test/plugins}/sdk.js +3 -3
- package/dist/test/plugins/websocket.js +65 -0
- package/dist/test/types/chat/global.js +1 -0
- package/dist/test/types/chat/promise.js +1 -0
- package/dist/test/types/chat/user.js +1 -0
- package/dist/test/types/conversation.js +1 -0
- package/dist/test/types/global.js +15 -0
- package/dist/test/types/message.js +1 -0
- package/dist/{utils → test/utils}/chat/auth.js +2 -2
- package/dist/test/utils/chat/call.js +61 -0
- package/dist/{utils → test/utils}/chat/chat-router.js +1 -1
- package/dist/{utils → test/utils}/chat/conversation.js +1 -1
- package/dist/{utils → test/utils}/chat/message.js +1 -1
- package/dist/{utils → test/utils}/chat/user.js +1 -1
- package/dist/test/utils/json.js +18 -0
- package/dist/types/call.d.ts +4 -0
- package/dist/types/chat/auth.d.ts +37 -0
- package/dist/types/chat/global.d.ts +7 -0
- package/dist/types/chat/promise.d.ts +17 -0
- package/dist/types/global.d.ts +11 -0
- package/dist/types/message.d.ts +43 -0
- package/dist/utils/chat/auth.d.ts +1 -1
- package/dist/utils/chat/call.d.ts +4 -0
- package/dist/utils/chat/chat-router.d.ts +1 -1
- package/dist/utils/chat/conversation.d.ts +2 -2
- package/dist/utils/chat/message.d.ts +2 -2
- package/dist/utils/chat/user.d.ts +2 -2
- package/dist/utils/json.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chat/main.js +0 -2
- package/dist/components/ListenEvent.vue.js +0 -47
- package/dist/plugins/websocket.js +0 -26
- package/dist/stores/general.d.ts +0 -48
- package/dist/stores/general.js +0 -39
- package/dist/utils/chat/call.js +0 -10
- /package/dist/chat/page/customer-appointment/{CustomerApointment.vue.d.ts → CustomerAppointment.vue.d.ts} +0 -0
- /package/dist/{assets → test/assets}/icons/IconArrowLeft.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/IconPhone.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/IconPlan.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/IconPlus.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/IconSearch.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/call/IconMic.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/call/IconPhone.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/call/IconPhoneCancel.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/call/IconSpeaker.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-appointment/IconFilter.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-detail/IconArrow.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-detail/IconCheck.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-detail/IconDate.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-detail/IconGroup.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-detail/IconMessage.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-detail/IconNote.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-detail/IconPhone.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-detail/IconPin.vue.js +0 -0
- /package/dist/{assets → test/assets}/icons/customer-detail/IconSearch.vue.js +0 -0
- /package/dist/{components → test/components}/chat/card/CardCustomerDetail.vue.js +0 -0
- /package/dist/{components → test/components}/chat/common/spin/BaseSpin.vue.js +0 -0
- /package/dist/{components → test/components}/chat/customer/Avatar.vue.js +0 -0
- /package/dist/{components → test/components}/common/CustomLoading.vue.js +0 -0
- /package/dist/{components → test/components}/common/Notification/NotificationDescription.vue.js +0 -0
- /package/dist/{components → test/components}/common/collapse/BaseCollapse.vue.js +0 -0
- /package/dist/{components → test/components}/common/collapse/BaseCollapseItem.vue.js +0 -0
- /package/dist/{components → test/components}/common/popover/PopoverBase.vue.js +0 -0
- /package/dist/{components → test/components}/common/spin/CSpin.vue.js +0 -0
- /package/dist/{components → test/components}/common/tooltip/TooltipBase.vue.js +0 -0
- /package/dist/{components → test/components}/layout/Blank.vue.js +0 -0
- /package/dist/{components → test/components}/layout/Default.vue.js +0 -0
- /package/dist/{components → test/components}/ui/button/c-button.js +0 -0
- /package/dist/{components → test/components}/ui/checkbox/index.js +0 -0
- /package/dist/{components → test/components}/ui/collapsible/Collapsible.vue.js +0 -0
- /package/dist/{components → test/components}/ui/collapsible/CollapsibleContent.vue.js +0 -0
- /package/dist/{components → test/components}/ui/collapsible/CollapsibleTrigger.vue.js +0 -0
- /package/dist/{components → test/components}/ui/collapsible/index.js +0 -0
- /package/dist/{components → test/components}/ui/dialog/Dialog.vue.js +0 -0
- /package/dist/{components → test/components}/ui/dialog/DialogClose.vue.js +0 -0
- /package/dist/{components → test/components}/ui/dialog/DialogTrigger.vue.js +0 -0
- /package/dist/{components → test/components}/ui/dialog/index.js +0 -0
- /package/dist/{components → test/components}/ui/drawer/Drawer.vue.js +0 -0
- /package/dist/{components → test/components}/ui/drawer/index.js +0 -0
- /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenu.vue.js +0 -0
- /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuGroup.vue.js +0 -0
- /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuRadioGroup.vue.js +0 -0
- /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuSub.vue.js +0 -0
- /package/dist/{components → test/components}/ui/dropdown-menu/DropdownMenuTrigger.vue.js +0 -0
- /package/dist/{components → test/components}/ui/dropdown-menu/index.js +0 -0
- /package/dist/{components → test/components}/ui/popover/Popover.vue.js +0 -0
- /package/dist/{components → test/components}/ui/popover/PopoverTrigger.vue.js +0 -0
- /package/dist/{components → test/components}/ui/popover/index.js +0 -0
- /package/dist/{components → test/components}/ui/radio-group/index.js +0 -0
- /package/dist/{components → test/components}/ui/slider/index.js +0 -0
- /package/dist/{components → test/components}/ui/switch/index.js +0 -0
- /package/dist/{composable → test/composable}/useModalConfirm.js +0 -0
- /package/dist/{constant → test/constant}/color.js +0 -0
- /package/dist/{constant → test/constant}/datetime.js +0 -0
- /package/dist/{constant → test/constant}/general.js +0 -0
- /package/dist/{constant → test/constant}/message.js +0 -0
- /package/dist/{constant → test/constant}/mqtt.js +0 -0
- /package/dist/{constant → test/constant}/user.js +0 -0
- /package/dist/{lib → test/lib}/utils.js +0 -0
- /package/dist/{plugins → test/plugins}/axios-gci.js +0 -0
- /package/dist/{plugins → test/plugins}/axios.js +0 -0
- /package/dist/{types/chat/user.js → test/types/call.js} +0 -0
- /package/dist/{types/conversation.js → test/types/chat/auth.js} +0 -0
- /package/dist/{utils → test/utils}/debounce.js +0 -0
- /package/dist/{utils → test/utils}/logger.js +0 -0
- /package/dist/{utils → test/utils}/string-helper.js +0 -0
|
@@ -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 { DropdownMenuItem, useForwardProps } from "reka-ui";
|
|
4
|
-
import { cn } from "
|
|
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,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 { DropdownMenuLabel, useForwardProps } from "reka-ui";
|
|
4
|
-
import { cn } from "
|
|
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 { reactiveOmit } from "@vueuse/core";
|
|
3
3
|
import { Circle } from "lucide-vue-next";
|
|
4
4
|
import { DropdownMenuItemIndicator, DropdownMenuRadioItem, useForwardPropsEmits, } from "reka-ui";
|
|
5
|
-
import { cn } from "
|
|
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 { DropdownMenuSeparator, } from "reka-ui";
|
|
4
|
-
import { cn } from "
|
|
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 "
|
|
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 { DropdownMenuSubContent, useForwardPropsEmits, } from "reka-ui";
|
|
4
|
-
import { cn } from "
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
5
|
const props = defineProps();
|
|
6
6
|
const emits = defineEmits();
|
|
7
7
|
const delegatedProps = reactiveOmit(props, "class");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { reactiveOmit } from "@vueuse/core";
|
|
3
3
|
import { ChevronRight } from "lucide-vue-next";
|
|
4
4
|
import { DropdownMenuSubTrigger, useForwardProps, } from "reka-ui";
|
|
5
|
-
import { cn } from "
|
|
5
|
+
import { cn } from "../../../lib/utils";
|
|
6
6
|
const props = defineProps();
|
|
7
7
|
const delegatedProps = reactiveOmit(props, "class");
|
|
8
8
|
const forwardedProps = useForwardProps(delegatedProps);
|
|
@@ -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 { PopoverContent, PopoverPortal, useForwardPropsEmits, } from "reka-ui";
|
|
4
|
-
import { cn } from "
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
5
|
defineOptions({
|
|
6
6
|
inheritAttrs: false,
|
|
7
7
|
});
|
|
@@ -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 { RadioGroupRoot, useForwardPropsEmits } from "reka-ui";
|
|
4
|
-
import { cn } from "
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
5
|
const props = defineProps();
|
|
6
6
|
const emits = defineEmits();
|
|
7
7
|
const delegatedProps = reactiveOmit(props, "class");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { reactiveOmit } from "@vueuse/core";
|
|
3
3
|
import { Circle } from "lucide-vue-next";
|
|
4
4
|
import { RadioGroupIndicator, RadioGroupItem, useForwardProps, } from "reka-ui";
|
|
5
|
-
import { cn } from "
|
|
5
|
+
import { cn } from "../../../lib/utils";
|
|
6
6
|
const props = defineProps();
|
|
7
7
|
const delegatedProps = reactiveOmit(props, "class");
|
|
8
8
|
const forwardedProps = useForwardProps(delegatedProps);
|
|
@@ -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 { SliderRange, SliderRoot, SliderThumb, SliderTrack, useForwardPropsEmits } from 'reka-ui';
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from '../../../lib/utils';
|
|
5
5
|
const props = defineProps();
|
|
6
6
|
const emits = defineEmits();
|
|
7
7
|
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 { SwitchRoot, SwitchThumb, useForwardPropsEmits } from 'reka-ui';
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from '../../../lib/utils';
|
|
5
5
|
const props = defineProps();
|
|
6
6
|
const emits = defineEmits();
|
|
7
7
|
const delegatedProps = reactiveOmit(props, 'class');
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import { publishMessage } from '
|
|
2
|
-
import { TOPIC_DETAIL_CALL } from '
|
|
3
|
-
import { getIceService } from '
|
|
4
|
-
import { dataProfile } from '
|
|
1
|
+
import { publishMessage } from '../plugins/mqtt';
|
|
2
|
+
import { TOPIC_DETAIL_CALL } from '../constant/mqtt';
|
|
3
|
+
import { getIceService } from '../utils/chat/call';
|
|
4
|
+
import { dataProfile } from '../utils/chat/auth';
|
|
5
5
|
import { ref } from 'vue';
|
|
6
6
|
export function useCallHelper() {
|
|
7
7
|
let pc;
|
|
8
8
|
let iceStunServiceLink = '';
|
|
9
|
-
let iceTurnServiceLink = '';
|
|
10
9
|
let iceServer = null;
|
|
11
10
|
let answer;
|
|
12
11
|
let offer = null;
|
|
13
|
-
// const servers = {
|
|
14
|
-
// iceServers: [
|
|
15
|
-
// { urls: 'stun:stun.l.google.com:19302' }
|
|
16
|
-
// ]
|
|
17
|
-
// }
|
|
18
12
|
const remoteAudio = () => {
|
|
19
13
|
return document.getElementById('go-chat-remote-audio');
|
|
20
14
|
};
|
|
@@ -22,11 +16,6 @@ export function useCallHelper() {
|
|
|
22
16
|
return document.getElementById('go-chat-local-audio');
|
|
23
17
|
};
|
|
24
18
|
const userRemoter = ref(null);
|
|
25
|
-
// const start = async () => {
|
|
26
|
-
// localStream = await navigator?.mediaDevices?.getUserMedia({ audio: true })
|
|
27
|
-
// const local = localAudio() as any
|
|
28
|
-
// if (local) local.srcObject = localStream
|
|
29
|
-
// }
|
|
30
19
|
const call = async (user) => {
|
|
31
20
|
userRemoter.value = user;
|
|
32
21
|
await getIceServiceLink();
|
|
@@ -120,7 +109,6 @@ export function useCallHelper() {
|
|
|
120
109
|
const res = await getIceService();
|
|
121
110
|
console.log(res);
|
|
122
111
|
iceStunServiceLink = res[0]?.urls[0] ?? '';
|
|
123
|
-
iceTurnServiceLink = res[1]?.urls[0] ?? '';
|
|
124
112
|
iceServer = res;
|
|
125
113
|
};
|
|
126
114
|
const handleOffer = async (data) => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ref } from 'vue';
|
|
2
|
-
import { sdkInit } from '
|
|
3
|
-
import { dataProfile, getProfile, loginLink } from '
|
|
4
|
-
import { routerPush } from '
|
|
5
|
-
import { PAGE } from '
|
|
6
|
-
import { subscribeToTopic, unsubscribeFromTopic } from '
|
|
7
|
-
import { TOPIC_DETAIL_CALL } from '
|
|
2
|
+
import { sdkInit } from '../plugins/sdk';
|
|
3
|
+
import { dataProfile, getProfile, loginLink } from '../utils/chat/auth';
|
|
4
|
+
import { routerPush } from '../utils/chat/chat-router';
|
|
5
|
+
import { PAGE } from '../constant/general';
|
|
6
|
+
import { subscribeToTopic, unsubscribeFromTopic } from '../plugins/mqtt';
|
|
7
|
+
import { TOPIC_DETAIL_CALL } from '../constant/mqtt';
|
|
8
|
+
import { getWebSocket } from '../plugins/websocket';
|
|
8
9
|
//PINIA
|
|
9
10
|
export const isRouterReady = ref(false);
|
|
10
11
|
export function useInitData() {
|
|
@@ -38,6 +39,7 @@ export function useInitData() {
|
|
|
38
39
|
};
|
|
39
40
|
const initData = async () => {
|
|
40
41
|
await getProfile();
|
|
42
|
+
getWebSocket();
|
|
41
43
|
unsubscribeFromTopic(TOPIC_DETAIL_CALL + dataProfile.value?.id);
|
|
42
44
|
subscribeToTopic(TOPIC_DETAIL_CALL + dataProfile.value?.id);
|
|
43
45
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Gap, { GapApiVersion } from 'gap-nodejs-sdk';
|
|
2
2
|
import { GapMiniAppSdk } from 'gap-miniapp-sdk';
|
|
3
|
-
import logger from '
|
|
4
|
-
import { loginTenant, setDataLogin } from '
|
|
5
|
-
import { setAxiosGciInstance } from '
|
|
3
|
+
import logger from '../utils/logger';
|
|
4
|
+
import { loginTenant, setDataLogin } from '../utils/chat/auth';
|
|
5
|
+
import { setAxiosGciInstance } from '../plugins/axios-gci';
|
|
6
6
|
const baseSdk = new Gap.BaseApi(GapApiVersion.V1);
|
|
7
7
|
const gapMiniAppSdk = (function () {
|
|
8
8
|
let instance;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { tryParseJson } from '../utils/json';
|
|
2
|
+
let socket = null;
|
|
3
|
+
let dataCallBack = [];
|
|
4
|
+
export function initWebSocket(server) {
|
|
5
|
+
// Create WebSocket connection.
|
|
6
|
+
socket = new WebSocket('wss://web-socket.dev01.dtsmart.dev');
|
|
7
|
+
// socket.addEventListener('open', (event: any) => {
|
|
8
|
+
// console.log('fffffff')
|
|
9
|
+
// socket.send('Hello Server!')
|
|
10
|
+
// })
|
|
11
|
+
//
|
|
12
|
+
// socket.addEventListener('message', (event: any) => {
|
|
13
|
+
// console.log('Message from server ', event.data)
|
|
14
|
+
// })
|
|
15
|
+
socket.onopen = (event) => {
|
|
16
|
+
console.log('Connected!');
|
|
17
|
+
};
|
|
18
|
+
socket.onmessage = (event) => {
|
|
19
|
+
const data = tryParseJson(event.data);
|
|
20
|
+
dataCallBack.forEach((e) => {
|
|
21
|
+
e.callBack(data);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
socket.onclose = (event) => {
|
|
25
|
+
console.log('Disconnected:', event.reason);
|
|
26
|
+
};
|
|
27
|
+
socket.onerror = (event) => {
|
|
28
|
+
console.error('Socket error:', event);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const socketSend = (data) => {
|
|
32
|
+
let request = typeof data == 'string' ? data : JSON.stringify(data);
|
|
33
|
+
socket.send(request);
|
|
34
|
+
};
|
|
35
|
+
export const getWebSocket = async () => {
|
|
36
|
+
const url = 'https://web-socket.dev01.dtsmart.dev/ws/connect';
|
|
37
|
+
try {
|
|
38
|
+
const response = await fetch(url, {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
body: JSON.stringify({
|
|
41
|
+
clientId: 'test1'
|
|
42
|
+
}),
|
|
43
|
+
headers: {
|
|
44
|
+
Authorization: 'Bearer -Qixt-ZztiBA5Dxl-EIWG7f2TDhK-ZCj'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
throw new Error(`Response status: ${response.status}`);
|
|
49
|
+
}
|
|
50
|
+
const result = await response.json();
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error(error.message);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export const addHandleWebSK = (key, callBack) => {
|
|
57
|
+
removeHandleWebSK(key);
|
|
58
|
+
dataCallBack.push({ key, callBack });
|
|
59
|
+
};
|
|
60
|
+
export const removeHandleWebSK = (key) => {
|
|
61
|
+
const index = dataCallBack.findIndex((e) => e.key === key);
|
|
62
|
+
if (index > -1) {
|
|
63
|
+
dataCallBack.splice(index, 1);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
// declare global {
|
|
3
|
+
// /**
|
|
4
|
+
// * Now declare things that go in the global namespace,
|
|
5
|
+
// * or augment existing declarations in the global namespace.
|
|
6
|
+
// */
|
|
7
|
+
// type AddPromise<T = unknown> = T & {
|
|
8
|
+
// resolve: Resolve
|
|
9
|
+
// reject?: Reject
|
|
10
|
+
// }
|
|
11
|
+
//
|
|
12
|
+
// // PROMISE
|
|
13
|
+
// declare type Resolve = typeof ReturnType<Promise.resolve>
|
|
14
|
+
// declare type Reject = typeof ReturnType<Promise.reject>
|
|
15
|
+
// }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import axios from '
|
|
2
|
-
import { gapMiniAppSdk } from '
|
|
1
|
+
import axios from '../../plugins/axios';
|
|
2
|
+
import { gapMiniAppSdk } from '../../plugins/sdk';
|
|
3
3
|
import { ref } from 'vue';
|
|
4
4
|
export const dataProfile = ref(null);
|
|
5
5
|
export const dataLoginLink = ref(null);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import axios from '../../plugins/axios';
|
|
2
|
+
import { dataProfile } from '../../utils/chat/auth';
|
|
3
|
+
const BARE_WEBSOCKET_URL = 'https://web-socket.dev01.dtsmart.dev';
|
|
4
|
+
// const BARE_WEBSOCKET_URL = 'http://192.168.1.173:3000'
|
|
5
|
+
export const getIceService = async () => {
|
|
6
|
+
const res = await axios.post('/api/v1/message/call/ice-servers', {
|
|
7
|
+
key_id: '3dc07e93f89e44ef5d5ff98c91edb520',
|
|
8
|
+
api_token: 'c0a60a3d2b0f490b2c99fd7ff095ed1218fd7eda55c80c8b70efc9e0b8dfcd85'
|
|
9
|
+
}, {
|
|
10
|
+
token: '3VbvrMLtH6b0b9vBe0mhJz9G9NKyATiL'
|
|
11
|
+
});
|
|
12
|
+
return res;
|
|
13
|
+
};
|
|
14
|
+
// export const callClient = async (body: IResCall): Promise<any> => {
|
|
15
|
+
// const res = await axios.post('/call/answer', body, {
|
|
16
|
+
// })
|
|
17
|
+
// return res
|
|
18
|
+
// }
|
|
19
|
+
export const callClient = async (body) => {
|
|
20
|
+
const url = BARE_WEBSOCKET_URL + '/call/answer';
|
|
21
|
+
try {
|
|
22
|
+
const response = await fetch(url, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
body: JSON.stringify(body),
|
|
25
|
+
headers: {
|
|
26
|
+
['Content-Type']: 'application/json'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error(`Response status: ${response.status}`);
|
|
31
|
+
}
|
|
32
|
+
const result = await response.json();
|
|
33
|
+
console.log(result);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error(error.message);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const callOutBound = async (user) => {
|
|
40
|
+
const url = BARE_WEBSOCKET_URL + '/call/outbound';
|
|
41
|
+
try {
|
|
42
|
+
const response = await fetch(url, {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
from: dataProfile.value?.phone,
|
|
46
|
+
to: user?.phone ?? ''
|
|
47
|
+
}),
|
|
48
|
+
headers: {
|
|
49
|
+
['Content-Type']: 'application/json'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
throw new Error(`Response status: ${response.status}`);
|
|
54
|
+
}
|
|
55
|
+
const result = await response.json();
|
|
56
|
+
console.log(result);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.error(error.message);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const isJsonString = (str) => {
|
|
2
|
+
try {
|
|
3
|
+
JSON.parse(str);
|
|
4
|
+
}
|
|
5
|
+
catch (e) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
};
|
|
10
|
+
export const tryParseJson = (data) => {
|
|
11
|
+
try {
|
|
12
|
+
const result = JSON.parse(data);
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface IBodyLoginTenant {
|
|
2
|
+
tenant_id: string;
|
|
3
|
+
}
|
|
4
|
+
interface IResLoginLink {
|
|
5
|
+
token: string;
|
|
6
|
+
refresh_token: string;
|
|
7
|
+
conversation_id: number;
|
|
8
|
+
receiver_id: number;
|
|
9
|
+
}
|
|
10
|
+
interface IBodyLoginCustomer {
|
|
11
|
+
phone: string;
|
|
12
|
+
}
|
|
13
|
+
interface IBodyVerifyOTP {
|
|
14
|
+
session_uuid: string;
|
|
15
|
+
phone: string;
|
|
16
|
+
otp: string;
|
|
17
|
+
}
|
|
18
|
+
interface IResProfile {
|
|
19
|
+
id: number;
|
|
20
|
+
username: string;
|
|
21
|
+
tenant_id: string | null;
|
|
22
|
+
phone: string;
|
|
23
|
+
avatar: string | null;
|
|
24
|
+
user_type: 'customer' | 'tenant';
|
|
25
|
+
color: string;
|
|
26
|
+
}
|
|
27
|
+
interface IPramsLoginLink {
|
|
28
|
+
tenant_id: string;
|
|
29
|
+
phone: string;
|
|
30
|
+
message: string;
|
|
31
|
+
customer_name: string;
|
|
32
|
+
business_name: string;
|
|
33
|
+
}
|
|
34
|
+
interface IRefreshToken {
|
|
35
|
+
refresh_token: string;
|
|
36
|
+
}
|
|
37
|
+
export type { IBodyLoginTenant, IBodyLoginCustomer, IBodyVerifyOTP, IResProfile, IPramsLoginLink, IRefreshToken, IResLoginLink };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ConfirmPayload = {
|
|
2
|
+
headerTitle?: string;
|
|
3
|
+
bodyTitle?: string;
|
|
4
|
+
bodyImage?: string;
|
|
5
|
+
bodyMessage?: string;
|
|
6
|
+
confirmButtonText?: string;
|
|
7
|
+
cancelButtonText?: string;
|
|
8
|
+
timeOut?: number;
|
|
9
|
+
type?: 'confirm' | 'information';
|
|
10
|
+
};
|
|
11
|
+
export type ConfirmPayloadPromise = AddPromise<ConfirmPayload>;
|
|
12
|
+
export type AddPromise<T = unknown> = T & {
|
|
13
|
+
resolve: Resolve;
|
|
14
|
+
reject?: Reject;
|
|
15
|
+
};
|
|
16
|
+
export type Resolve = any;
|
|
17
|
+
export type Reject = any;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { MessageState } from '../constant/message';
|
|
2
|
+
export type IResUser = {
|
|
3
|
+
id: string;
|
|
4
|
+
username: string;
|
|
5
|
+
phone: string;
|
|
6
|
+
avatar: string | null;
|
|
7
|
+
tenant_id: string | null;
|
|
8
|
+
conversation_id: number;
|
|
9
|
+
color: string;
|
|
10
|
+
status: number;
|
|
11
|
+
last_offline_at: string;
|
|
12
|
+
};
|
|
13
|
+
export type IResMessage = {
|
|
14
|
+
id: number | string;
|
|
15
|
+
conversation_id: number;
|
|
16
|
+
sender_id: number;
|
|
17
|
+
receiver_id: number;
|
|
18
|
+
message: string | null;
|
|
19
|
+
created_at: string;
|
|
20
|
+
attachments: IAttachment[];
|
|
21
|
+
state?: MessageStateType;
|
|
22
|
+
error?: string;
|
|
23
|
+
};
|
|
24
|
+
export interface IAttachment {
|
|
25
|
+
file_name: string;
|
|
26
|
+
file_path: string;
|
|
27
|
+
file_local?: Blob;
|
|
28
|
+
mime?: string;
|
|
29
|
+
size?: number;
|
|
30
|
+
}
|
|
31
|
+
export type IResUploadImage = {
|
|
32
|
+
files: IUploadFile[];
|
|
33
|
+
};
|
|
34
|
+
export type IUploadFile = {
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
size: number;
|
|
38
|
+
base_url: string;
|
|
39
|
+
path: string;
|
|
40
|
+
url: string;
|
|
41
|
+
delete_url: string;
|
|
42
|
+
};
|
|
43
|
+
export type MessageStateType = typeof MessageState[keyof typeof MessageState];
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
import type { IResUser } from '../../types/message';
|
|
2
|
+
import type { IResCall } from '../../types/call';
|
|
1
3
|
export declare const getIceService: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
+
export declare const callClient: (body: IResCall) => Promise<void>;
|
|
5
|
+
export declare const callOutBound: (user: IResUser) => Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { IConversation, IParamGetConversation } from '
|
|
2
|
-
import type { DataWithMetaResponse } from '
|
|
1
|
+
import type { IConversation, IParamGetConversation } from '../../types/conversation';
|
|
2
|
+
import type { DataWithMetaResponse } from '../../types/global';
|
|
3
3
|
export declare const getConversation: (param: IParamGetConversation) => Promise<DataWithMetaResponse<IConversation[]>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DataWithMetaResponse } from '
|
|
2
|
-
import type { IResMessage, IResUser, IUploadFile } from '
|
|
1
|
+
import type { DataWithMetaResponse } from '../../types/global';
|
|
2
|
+
import type { IResMessage, IResUser, IUploadFile } from '../../types/message';
|
|
3
3
|
interface IParamsMessage {
|
|
4
4
|
page: number;
|
|
5
5
|
receiver_id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IResUser } from '
|
|
2
|
-
import type { GetCustomerHistoryResponse } from '
|
|
1
|
+
import type { IResUser } from '../../types/message';
|
|
2
|
+
import type { GetCustomerHistoryResponse } from '../../types/chat/user';
|
|
3
3
|
export declare const user: import("vue").Ref<{
|
|
4
4
|
id: string;
|
|
5
5
|
username: string;
|
package/package.json
CHANGED
package/dist/chat/main.js
DELETED